Skip to content

tronweb3/tronwallet-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

715 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TronWallet Adapter

Network npm version downloads license last commit

tronwallet-adapter is a powerful Monorepo providing a high-quality suite of wallet adapters and UI components for the TRON ecosystem. It enables developers to integrate multiple wallets (both TRON native and EVM compatible) with a unified, modern API.


✨ Key Features

  • Unified API: Maintain a single codebase to support 15+ different wallets.
  • Out-of-the-Box Components: Ready-to-use modals and buttons for React and Vue.
  • Developer Friendly: Fully typed with TypeScript, including detailed error handling and state management.

πŸ“š Documentation & Resources


🧭 Which Package Should I Use?

Decide based on your framework and the level of UI control you need:

Framework Quickest Integration (UI + Logic) Custom UI (Hooks / Logic Only) Core Only (Vanilla JS)
React @tronweb3/tronwallet-adapter-react-ui @tronweb3/tronwallet-adapter-react-hooks β€”
Vue @tronweb3/tronwallet-adapter-vue-ui @tronweb3/tronwallet-adapter-vue-hooks β€”
Vanilla JS β€” β€” @tronweb3/tronwallet-adapters

πŸ”Œ Supported Wallets

We support a wide range of TRON and EVM wallets, including TronLink, MetaMask, WalletConnect, Ledger, and more. Each adapter offers a consistent interface β€” use the collective @tronweb3/tronwallet-adapters package and import individual adapters.

πŸ‘‰ For the complete list of supported wallets and their adapters, visit our documentation.

Note: In case wallet developers intend to release breaking changes, you can open an issue here to inform us, thus enabling us to update the new protocols accordingly.

Add support for new wallet

Follow these steps to support new wallets:

  1. List your wallet to Tron Wallet .
  2. Open an issue in this repository or fork the repository and implement the according adapter.

Wallet Integration Standards

Wallets are encouraged to implement the following TRON interface standards to ensure compatibility with the TronWallet Adapter and the broader TRON dApp ecosystem:

  • TIP-1193 – Defines a standard TRON provider interface for dApps to communicate with wallets.

By following these standards, wallets can be seamlessly integrated into modern TRON dApps using unified APIs and adapters.


πŸ›  Project Structure

This repository is managed using pnpm workspaces:

tronwallet-adapter
β”œβ”€β”€ packages
β”‚   β”œβ”€β”€ adapters
β”‚   β”‚   β”œβ”€β”€ abstract-adapter  # Core interface definitions
β”‚   β”‚   β”œβ”€β”€ adapters          # Barrel package for all adapters
β”‚   β”‚   └── [specific-wallet] # Individual wallet implementations
β”‚   β”œβ”€β”€ react
β”‚   β”‚   β”œβ”€β”€ react-hooks       # State management for React
β”‚   β”‚   └── react-ui          # Pre-built React components
β”‚   └── vue
β”‚       β”œβ”€β”€ vue-hooks         # State management for Vue
β”‚       └── vue-ui            # Pre-built Vue components
β”œβ”€β”€ demos                     # Example applications (Next.js, Vite, CDN)
└── docs                      # Detailed manual and API docs

πŸš€ Development & Contributing

We welcome contributions! To get started with the codebase:

Prerequisites

  • Node.js: 20.18.0
  • pnpm: 9.6.0

Local Setup

# 1. Clone the repo
git clone https://github.com/tronweb3/tronwallet-adapter.git

# 2. Install dependencies
pnpm install

# 3. Build all packages
pnpm build

# 4. Start the development demo
pnpm example  # Runs our pre-built React/Vite example

Commands

  • pnpm watch: Rebuild packages automatically on change.
  • pnpm lint: Run ESLint across all workspaces.
  • pnpm test: Run unit tests.
  • pnpm update-version: Update package versions for release.

πŸ§ͺ End-to-End Testing

End-to-end tests live in a companion repository. It is not cloned automatically β€” fetch it into the e2e/ directory (via scripts/sync-e2e.js) by running this from the repo root:

pnpm e2e:update

This clones the repo on first run and pulls the latest changes afterwards. Then install its dependencies inside e2e/ (see the Quick Start below). You do not need to clone it manually.

tronwallet-adapter/
└── e2e/          ← automatically fetched e2e repository
    └── tron/
        β”œβ”€β”€ e2e-shared/   # shared Playwright fixtures, specs, and page harness
        β”œβ”€β”€ tronlink/     # TronLink-specific tests
        └── <walletId>/   # other wallet test packages

Quick Start

Before running the tests, build the adapters from the tronwallet-adapter repo root so the suite picks up the current code:

pnpm build:ts

All setup commands run from the e2e/ directory. Extension IDs are looked up automatically β€” you do not need to copy-paste them. For the full list of supported walletId values, see e2e/README.md β†’ Supported Wallets.

The e2e workspace requires Node 22.17.0 (pinned in e2e/.nvmrc). The nvm use command below is only for nvm users β€” if you manage Node another way, just make sure your active version is 22.17.0 before continuing.

# 1. Enter the e2e root and switch to the required Node version
cd e2e
nvm use 22.17.0   # nvm users only β€” otherwise ensure Node 22.17.0 some other way

# 2. Install pnpm 9.6.0 (skip if already installed), then the dependencies, and build
npm install -g [email protected]
pnpm install
pnpm build

# 3. Install the Playwright browser (Chromium) that drives the wallet extension
pnpm --filter ./tron/tronlink exec playwright install chromium

# 4. One-time: create the shared tron/.env (skip if it already exists)
pnpm e2e:init --init-env

# 5. One-time: copies the extension, initialises the env, and opens Chromium.
#    In the browser: import your seed phrase, set a password, switch to Nile testnet, close.
pnpm e2e:init tronlink

# 6. One-time: after the browser closes, copy the wallet profile into the project.
pnpm e2e:init tronlink --copy-profile

# 7. Edit e2e/tron/.env and set WALLET_PASSWORD to the password from step 5.
#    Then verify the environment is ready.
pnpm e2e:init tronlink --verify

Because e2e/ is a pnpm workspace, you can run tests for any wallet directly from the e2e/ root β€” no need to cd into each wallet's directory:

# Run tests for a single wallet (from e2e/ root)
pnpm --filter ./tron/tronlink e2e

# Filter by test name
pnpm --filter ./tron/tronlink e2e --grep "E2E-SEC"

# Run tests for all wallets sequentially (one wallet at a time)
pnpm e2e:all

Testing Against a Local Adapter Build

Set WALLET_ADAPTERS_PATH in e2e/tron/.env to point to your local checkout so Vite serves your in-progress changes instead of the published npm package:

# e2e/tron/.env
WALLET_ADAPTERS_PATH=../packages/adapters/adapters/src/index.ts   # resolved relative to e2e/
WALLET_PASSWORD=your_test_wallet_password

Then rebuild the adapter and re-run tests:

# In tronwallet-adapter root
pnpm build

# In e2e/tron/tronlink (or any wallet)
pnpm e2e

πŸ“„ License

MIT

About

Modular TypeScript wallet adapters and components for TRON and EVM applications.

Topics

Resources

License

Stars

76 stars

Watchers

5 watching

Forks

Packages

 
 
 

Contributors