SDK | Tron | Connect to App or Mini Wallet | Wallet Integration | DEX API Docs

·

Integrating blockchain functionality into decentralized applications (DApps) has become a critical step for developers aiming to deliver seamless user experiences. With the growing adoption of TRON-based applications and mini wallets—especially within ecosystems like Telegram—developers need robust, secure, and easy-to-implement tools. The OKX Connect SDK offers a streamlined way to integrate wallet connectivity, transaction signing, and account management for TRON-powered DApps.

This guide walks you through the complete integration process using the OKX Universal Provider, focusing on TRON chain support, secure message signing, transaction handling, and session management.

Installation and Initialization

Before connecting your DApp to any wallet, ensure your environment supports OKX Connect SDK version 6.96.0 or later. You can install it via npm:

npm install okx-connect

Once installed, initialize the OKXUniversalProvider object. This instance will serve as the foundation for all subsequent interactions, including wallet connection, transaction signing, and event listening.

Request Parameters

Return Value

👉 Get started with seamless TRON wallet integration today.


Connecting to a Wallet

To interact with user accounts, your DApp must establish a secure session by connecting to a wallet. During this process, users approve access to their accounts and selected chains.

Request Parameters

Return Value

A Promise resolving to:


Prepare the Transaction

Before sending transactions on the TRON network, instantiate the OKXTronProvider using the initialized OKXUniversalProvider. This prepares the environment for blockchain interactions such as balance queries, contract calls, and transaction submissions.

const tronProvider = new OKXTronProvider(okxUniversalProvider);

This provider abstracts low-level communication with the wallet and ensures proper formatting for TRON-specific operations.

👉 Unlock advanced TRON DApp capabilities with one integration.


Get Account Information

Retrieve the connected user’s wallet address on a specific TRON network.

Request Parameters

Return Value

Example

const account = await okxUniversalProvider.request({
  method: 'get_accounts',
  params: { chainId: 'tron:mainnet' }
});
console.log(account.address); // e.g., "TQaA1..."

Sign a Message

Allow users to sign arbitrary messages securely. Useful for authentication or proof-of-ownership flows.

Request Parameters

Return Value

Example

const signature = await okxUniversalProvider.request({
  method: 'personal_sign',
  params: { message: 'Login to MyDApp', chainId: 'tron:mainnet' }
});

Sign a Message V2

An enhanced version of message signing with stricter chain enforcement.

Request Parameters

🔍 Note: Unlike the standard method, chainId is mandatory in V2.

Return Value


SignTransaction

Prepare and sign a TRON transaction without broadcasting it. Ideal for off-chain processing or batch operations.

Request Parameters

Return Value