# @tronweb3/tronwallet-adapter-backpack

> Wallet adapter for Backpack Wallet.

Latest version **1.2.0** (published 2026-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tronweb3/tronwallet-adapter-backpack
pnpm add @tronweb3/tronwallet-adapter-backpack
yarn add @tronweb3/tronwallet-adapter-backpack
bun add @tronweb3/tronwallet-adapter-backpack
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-09-04 |
| First published | 2026-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 1 |
| Unpacked size | 180.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 80 |
| Author | tronweb3 |
| Maintainers | troncore, tronwallet-adapter |
| Keywords | TRON, TronWeb, Backpack |

## Links

- npm: https://www.npmjs.com/package/@tronweb3/tronwallet-adapter-backpack
- Repository: https://github.com/tronweb3/tronwallet-adapter
- Homepage: https://github.com/tronweb3/tronwallet-adapter#readme
- Issues: https://github.com/tronweb3/tronwallet-adapter/issues
- npm.io page: https://npm.io/package/@tronweb3/tronwallet-adapter-backpack

## Dependencies (1)

- [@tronweb3/tronwallet-abstract-adapter](https://npm.io/package/@tronweb3/tronwallet-abstract-adapter.md) ^1.3.0

## Recent versions

- 1.2.0 (latest) — 2026-09-04
- 1.1.0 — 2026-06-11
- 1.0.0 — 2026-04-23

## README

# @tronweb3/tronwallet-adapter-backpack

Backpack wallet adapter for Backpack Wallet browser extension.

## Installation

```bash
npm install @tronweb3/tronwallet-adapter-backpack
# or
yarn add @tronweb3/tronwallet-adapter-backpack
# or
pnpm add @tronweb3/tronwallet-adapter-backpack
```

## Usage

### Basic Usage

```typescript
import { BackpackAdapter } from '@tronweb3/tronwallet-adapter-backpack';

const adapter = new BackpackAdapter();

// Connect
await adapter.connect();

// Sign message
const signature = await adapter.signMessage('Hello TRON');

// Sign transaction
const signedTx = await adapter.signTransaction(transaction);

// Disconnect
await adapter.disconnect();
```

### Event Handling

```typescript
// Listen to connection events
adapter.on('connect', (address) => {
    console.log('Connected:', address);
});

adapter.on('disconnect', () => {
    console.log('Disconnected');
});

adapter.on('stateChanged', (state) => {
    console.log('State changed:', state);
});

adapter.on('error', (error) => {
    console.error('Error:', error);
});
```

### Error Handling

```typescript
import {
    WalletNotFoundError,
    WalletConnectionError,
    WalletDisconnectedError,
} from '@tronweb3/tronwallet-abstract-adapter';

try {
    await adapter.connect();
} catch (error) {
    if (error instanceof WalletNotFoundError) {
        console.error('Backpack wallet not found');
    } else if (error instanceof WalletConnectionError) {
        console.error('Connection failed:', error.message);
    }
}
```

### Security Check

`BackpackAdapter` supports an optional `securityOptions` field for detecting wallet risks before `connect()`. When enabled, the adapter fetches a remote risk configuration and calls `onRiskDetected` if the wallet is flagged.

```typescript
const adapter = new BackpackAdapter({
    securityOptions: {
        enabled: true,
        configUrls: ['https://your-server.com/security-config.json'],
        onRiskDetected: async ({ risks }) => {
            // Throw to block the connection, or log a warning
            throw new Error(`Wallet risk detected: ${risks[0].title}`);
        },
    },
});
```

For the full `SecurityOptions` API reference, see [walletadapter.org/docs](https://walletadapter.org/docs/index.html).

## Browser Support

-   Chrome/Chromium-based browsers (extension)
-   Firefox (extension)

## Caveats

-   Currently Backpack wallet only support TRON on Browser Extension wallet.
-   Backpack wallet does not support `multiSign`.
-   Backpack wallet only support `Mainnet` and `Shasta`.
-   Backpack extension cannot be connected automatically after page refresh.
-   Backpack extension events cannot work fine currently.

## Troubleshooting

### Wallet Not Detected

If the adapter cannot detect Backpack wallet:

1. Ensure Backpack browser extension is installed
2. Refresh the page after installing the extension
3. Check browser console for errors

## License

MIT

## Links

-   [Backpack Wallet](https://www.backpack.app)
-   [TronWallet Adapter](https://github.com/tronweb3/tronwallet-adapter)
-   [Documentation](https://walletadapter.org/)
-   [TRON Wallet Integration Standards](https://walletadapter.org/docs/new-wallet-support/wallet.html#wallet-integration-standards)

---
_Source: https://npm.io/package/@tronweb3/tronwallet-adapter-backpack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
