Skip to main content
This guide walks you through integrating your Tron wallet with the Dynamic SDK using the industry-standard TronWallet Adapter pattern. By creating a TronWallet Adapter and a Dynamic connector, your wallet will be compatible with Dynamic’s Tron network support.

Overview

To integrate your Tron wallet with Dynamic, you’ll need to follow these steps: For general information about custom wallet connectors, see our Integrate your Wallet guide.
1

Create a TronWallet Adapter

Dynamic uses the TronWallet Adapter standard, which provides a unified interface for Tron wallets. Your first step is to create a TronWallet Adapter that implements the adapter interface.

TronWallet Adapter Documentation

The TronWallet Adapter project provides comprehensive documentation for creating adapters:

Key Requirements

Your TronWallet Adapter must implement the Adapter interface from @tronweb3/tronwallet-abstract-adapter, which includes:
  • name - The name of your wallet
  • icon - Wallet icon URL
  • url - Wallet website URL
  • readyState - Connection readiness state
  • connect() - Establishes connection to the wallet
  • disconnect() - Disconnects from the wallet
  • signMessage() - Signs messages for authentication
  • signTransaction() - Signs transactions
  • network() - Gets the current network
  • wallet - The wallet provider instance (e.g., window.tronWeb)

Example Adapter Structure

Your TronWallet Adapter
import { Adapter } from '@tronweb3/tronwallet-abstract-adapter';

export class YourTronAdapter extends Adapter {
  name = 'Your Wallet';
  url = 'https://yourwallet.com';
  icon = 'https://yourwallet.com/icon.png';

  async connect(): Promise<void> {
    // Your wallet connection logic
    if (!window.yourWallet) {
      throw new Error('Your wallet not found');
    }
    
    // Connect to wallet and get address
    const address = await window.yourWallet.request({ method: 'tron_requestAccounts' });
    this.emit('connect', { address });
  }

  async disconnect(): Promise<void> {
    // Your wallet disconnection logic
    await window.yourWallet.disconnect();
    this.emit('disconnect');
  }

  async signMessage(message: string): Promise<string> {
    // Your message signing logic
    return await window.yourWallet.signMessage(message);
  }

  async signTransaction(transaction: any): Promise<any> {
    // Your transaction signing logic
    return await window.yourWallet.signTransaction(transaction);
  }

  async network(): Promise<Network> {
    // Get current network
    return await window.yourWallet.getNetwork();
  }
}
For complete implementation details, refer to the TronWallet Adapter documentation.
2

Create a Dynamic Connector

Once you have a TronWallet Adapter, you need to create a Dynamic connector that extends TronWalletAdapterConnector.

Connector Structure

Your connector should extend TronWalletAdapterConnector and provide your adapter:
YourTronConnector Implementation
import { TronWalletAdapterConnector } from '@dynamic-labs/tron';
import { YourTronAdapter } from './YourTronAdapter';

export class YourTronConnector extends TronWalletAdapterConnector {
  /**
   * The name of the wallet connector
   * @override Required override from the base connector class
   */
  override name = 'Your Wallet Name';

  /**
   * Unique identifier for your wallet
   * This should match the key used in the wallet book
   * @override Required override from the base connector class
   */
  override overrideKey = 'yourwallettron';

  /**
   * Create the TronWallet Adapter instance
   * @override Required override from the base connector class
   */
  protected override createAdapter() {
    return new YourTronAdapter();
  }

  /**
   * The constructor for the connector, with the relevant metadata
   * @param props The options for the connector
   */
  constructor(props: any) {
    super({
      ...props,
      metadata: {
        id: 'yourwallettron',
        name: 'Your Wallet Name',
        icon: 'https://your-wallet.com/icon.png',
      },
      overrideKey: 'yourwallettron',
      tronNetworks: props.tronNetworks,
    });
  }
}

Registering Your Adapter

If you want your adapter to be automatically detected, you can add it to the adapter registry. However, for custom connectors, you can also create them directly:
Using Your Custom Connector
import { DynamicContextProvider } from '@dynamic-labs/sdk-react-core';
import { YourTronConnector } from './YourTronConnector';

function App() {
  return (
    <DynamicContextProvider
      settings={{
        environmentId: 'your-environment-id',
        walletConnectors: [
          new YourTronConnector({
            walletBook: walletBookInstance,
            tronNetworks: tronNetworksConfig,
          }),
        ],
      }}
    >
      {/* Your app content */}
    </DynamicContextProvider>
  );
}
3

Test Your Integration

Before submitting, thoroughly test your integration:
  1. Connection Testing - Verify wallet connects and disconnects properly
  2. Address Retrieval - Ensure addresses are returned correctly
  3. Message Signing - Test message signing with signMessageV2
  4. Transaction Testing - Test TRX and TRC20 token transfers
  5. Network Switching - Verify network detection and switching
  6. Error Handling - Verify proper error handling for all methods

Testing Checklist

  • Wallet connects successfully
  • Wallet address is retrieved correctly
  • Messages can be signed and verified
  • TRX transfers work on mainnet and testnets
  • TRC20 token transfers work correctly
  • Network detection works (mainnet, Shasta, Nile)
  • Error cases are handled gracefully
  • Wallet disconnects cleanly
4

Submit Your Connector

Once your implementation is complete and tested:
  1. Submit your connector following the Custom Wallet Connectors process
  2. Fill out the submission form to get allowlisted
  3. Our team will review and integrate your connector

Submission Requirements

  • Working TronWallet Adapter implementation
  • Dynamic connector extending TronWalletAdapterConnector
  • Test coverage for all wallet operations
  • Documentation for your wallet integration

Supported Networks

NetworkChain IDDescriptionBlock Explorer
Tron Mainnet728126428Production networkTronscan
Shasta Testnet728126429Test networkShasta Tronscan
Nile Testnet728126430Test networkNile Tronscan

TronWallet Adapter Interface

The TronWallet Adapter interface is defined in @tronweb3/tronwallet-abstract-adapter. Key methods include:
TronWallet Adapter Interface
interface Adapter {
  name: string;
  icon: string;
  url: string;
  readyState: AdapterState;
  
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  signMessage(message: string): Promise<string>;
  signTransaction(transaction: any): Promise<any>;
  network(): Promise<Network>;
  
  // Event emitters
  on(event: 'connect' | 'disconnect' | 'accountChanged', handler: Function): void;
  off(event: 'connect' | 'disconnect' | 'accountChanged', handler: Function): void;
}
For the complete interface specification, see the TronWallet Adapter documentation.

Resources

Need Help?

If you need assistance integrating your Tron wallet: