@tatumio/tron-wallet-provider
v1.0.4
Published
Tron provider with local wallet operations
Downloads
408
Readme
🌍 Tron Wallet Provider
Tron Wallet Provider integrates seamlessly with Tatum SDK to provide extended wallet capabilities for Tron.
📖 Description
The Tron Wallet Provider provides an array of tools for:
- Generating mnemonics for seed phrases.
- Creating extended public keys (xpubs) from mnemonics.
- Deriving private keys and addresses from mnemonics and xpubs.
- Signing and broadcasting transactions to the Tron network.
It is built upon popular packages like tronweb
, bip32
, and bip39
, ensuring a robust and secure foundation.
🚀 Quick Start
Installation
Firstly, ensure that the
@tatumio/tron-wallet-provider
package is set as a dependency within your project. Next, import the Tron Wallet Provider extension:import { TronWalletProvider } from '@tatumio/tron-wallet-provider'
Initialization
Create an instance of Tatum SDK passing
TronWalletProvider
as one of wallet providers.const tatumSdk = await TatumSDK.init<Tron>({ network: Network.TRON, configureWalletProviders: [ TronWalletProvider, ] })
🛠️ How to Use
Generate Mnemonic
const mnemonic = tatumSdk.walletProvider.use(TronWalletProvider).generateMnemonic()
Generate xpub with or without Mnemonic
const xpubDetails = await tatumSdk.walletProvider.use(TronWalletProvider).generateXpub(mnemonic)
Generate Private Key from Mnemonic
const privateKey = await tatumSdk.walletProvider.use(TronWalletProvider).generatePrivateKeyFromMnemonic(mnemonic, 0)
Generate Address from Mnemonic or xpub
const addressFromMnemonic = await tatumSdk.walletProvider.use(TronWalletProvider).generateAddressFromMnemonic(mnemonic, 0) const addressFromXpub = await tatumSdk.walletProvider.use(TronWalletProvider).generateAddressFromXpub(xpubDetails.xpub, 0)
Sign and Broadcast a Transaction
Define your payload according to the
TronTxPayload
type:const payloadTron = { privateKey: 'YOUR_PRIVATE_KEY', to: 'TARGET_WALLET_ADDRESS', amount: '0.01' // TRX_AMOUNT } const txHash = await tatumSdk.walletProvider.use(TronWalletProvider).signAndBroadcast(payloadTron)
Remember to always ensure the safety of mnemonics, private keys, and other sensitive data. Never expose them in client-side code or public repositories.
🔗🔗 Supported Networks
Network.TRON,
Network.TRON_SHASTA