@binance/w3w-multichain-connector

中文文档
1.0.22发布于 2026/11/03ISCTypeScriptES Module近 30 天下载 2083

A multichain connector for Binance Wallet

原始使用文档
文档目录21 节
  1. Installation
  2. Usage
  3. Importing
  4. Get Wallet Instance
  5. Check Extension Installed
  6. Check Extension Feature Support
  7. Connect Wallet
  8. Connect with SAS
  9. Check Connected Wallets
  10. Get Wallet Info
  11. Switch Chain
  12. Disconnect
  13. Sign Order
  14. Auto Sign
  15. SAS Operations
  16. Handle Events
  17. Properties
  18. Types
  19. IConnectedWallet
  20. WalletType
  21. Features

@binance/w3w-multichain-connector

The @binance/w3w-multichain-connector package provides a wrapper for the Binance Wallet extension multichain connector.

Installation

pnpm add @binance/w3w-multichain-connector
# or
npm install @binance/w3w-multichain-connector

Usage

Importing

import { getMultichainWallet } from '@binance/w3w-multichain-connector'

Get Wallet Instance

const wallet = getMultichainWallet()
if (!wallet) {
  console.log('Binance Wallet extension not installed')
}

Check Extension Installed

import { checkExtensionInstalled } from '@binance/w3w-multichain-connector'

const isInstalled = checkExtensionInstalled()

Check Extension Feature Support

import { checkExtensionSupported, Features } from '@binance/w3w-multichain-connector'

const isSupported = checkExtensionSupported(Features.requestConnect)

Connect Wallet

const connectedWallets = await wallet.requestConnect(['56', 'CT_501'])

Connect with SAS

// Single wallet SAS
const { wallet: connectedWallet, aggreeEnableSAS } = await wallet.requestConnectWithSAS({
  binanceChainIds: ['56'],
  userId: 'user-id',
  enabledWalletInfo: [
    { walletType: 'SEED_PHRASE', chain: 'evm', userPublicKeyHex: '0x...' }
  ]
})

// Multi wallet SAS
const { walletList, enabledWalletIds, connectId } = await wallet.requestConnectWithMultiWalletSAS({
  binanceChainIds: ['56'],
  userId: 'user-id'
})

Check Connected Wallets

const wallets = await wallet.checkConnectedWallet()
// The user's active wallet will be the first element in the array

Get Wallet Info

const walletInfo = await wallet.getWalletInfo('0x...address', '56')

Switch Chain

await wallet.switchChain('56')

Disconnect

// Disconnect all wallets
await wallet.disconnect()

// Disconnect specific accounts
await wallet.disconnectWallets(['account-id-1', 'account-id-2'])

Sign Order

const signature = await wallet.signOrder({
  walletId: 'wallet-id',
  walletAddress: '0x...',
  binanceChainId: '56',
  txData: '...',
  feeAmount: '0.001',
  feeAmountLevel: 'Medium', // 'Low' | 'Medium' | 'High' | 'Custom'
  digest: '...',
  digestSign: '...'
})

Auto Sign

await wallet.requestAutoSign()
console.log('Auto sign enabled:', wallet.autoSignEnabled)

SAS Operations

// Enable SAS
const { aggreeEnableSAS } = await wallet.requestEnableSAS({
  walletId: 'wallet-id',
  userId: 'user-id',
  userEmail: '[email protected]'
})

// Enable multi-wallet SAS
const { enabledWalletIds } = await wallet.requestEnableMultiWalletSAS({
  walletIds: ['wallet-1', 'wallet-2'],
  userId: 'user-id',
  userEmail: '[email protected]'
})

// Get SAS Keyshare
const keyshares = await wallet.getSASKeyshare({
  walletIds: ['wallet-id'],
  userId: 'user-id',
  spsVersion: '1.0',
  isSilent: false // if true, won't prompt unlock when wallet is locked
})

// Sync SAS Status
await wallet.syncSASStatus({
  userId: 'user-id',
  statusList: [
    { walletId: 'wallet-id', enabled: true }
  ]
})

// Get ProofKey Signature (before placing order)
const { timeStamp, proofKeyPublicKey, timestampSignature } = await wallet.getSASProofKeySignature({
  walletId: 'wallet-id',
  userId: 'user-id'
})

// Get Connected Wallets with ProofKey
const walletsWithProofKey = await wallet.getConnectedWalletAndProofKey({
  userId: 'user-id'
})

Handle Events

const wallet = getMultichainWallet()

// Wallet lock status changed
wallet.on('walletLockedChanged', (isLocked) => {
  console.log('Wallet locked:', isLocked)
})

// Auto sign status changed
wallet.on('autoSignEnabledChanged', (isEnabled) => {
  console.log('Auto sign enabled:', isEnabled)
})

// Connected wallets changed
wallet.on('connectedWalletsChanged', (connectedWallets) => {
  console.log('Connected wallets:', connectedWallets)
})

// Connected chain changed
wallet.on('connectedChainIdChanged', (binanceChainId) => {
  console.log('Chain changed:', binanceChainId)
})

Properties

PropertyTypeDescription
versionstringCurrent extension version
autoSignEnabledbooleanWhether auto sign is enabled
walletLockedbooleanWhether the wallet is locked
extensionIdstringExtension unique identifier

Types

IConnectedWallet

FieldTypeDescription
walletIconstringWallet icon (base64)
walletNamestringWallet name
walletIdstringWallet unique identifier
walletTypeWalletTypeWallet type (privateKey / seedPhrase)
addressListArray<{ address, binanceChainId, publicKeyHex }>Wallet address list
groupID?stringWallet group ID
groupName?stringWallet group name

WalletType

ValueDescription
privateKeyPrivate key wallet
seedPhrase (hd)Seed phrase (mnemonic) wallet

Features

ValueDescription
Connect
requestConnectConnect wallet
requestConnectWithSASConnect wallet with single-wallet SAS
requestConnectWithMultiWalletSASConnect wallet with multi-wallet SAS
checkConnectedWalletCheck connected wallets
getWalletInfoGet wallet info by address and chain
disconnectDisconnect all wallets
disconnectWalletsDisconnect specific wallets
switchChainSwitch chain
SAS
requestEnableSASRequest enable SAS (single wallet)
requestEnableMultiWalletSASRequest enable SAS (multi wallet)
getSASKeyshareGet SAS keyshare
syncSASStatusSync SAS status
getConnectedWalletAndProofKeyGet connected wallets with ProofKey
getSASProofKeySignatureGet ProofKey signature before placing order
Signing
requestAutoSignRequest auto sign
signOrderSign transaction order
Events
eventWalletLockedChangedWallet lock status changed event
eventAutoSignEnabledChangedAuto sign status changed event
eventConnectedWalletsChangedConnected wallets changed event
eventConnectedChainIdChangedConnected chain changed event

版本与发布记录

@binance/w3w-multichain-connector 共发布 21 个版本,首次发布于 2025/09/01;过去 12 个月发布了 9 个版本。

版本发布日期距今
1.0.22latest2026/11/034 天前
1.0.212026/11/035 天前
1.0.202026/10/309 天前
1.0.192026/03/207 个月前
1.0.182026/03/137 个月前
1.0.172026/03/127 个月前

关于 @binance/w3w-multichain-connector 的常见问题

@binance/w3w-multichain-connector 是什么?

A multichain connector for Binance Wallet

如何安装 @binance/w3w-multichain-connector?

在项目目录运行 npm install @binance/w3w-multichain-connector,或使用 pnpm add / yarn add / bun add。

@binance/w3w-multichain-connector 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@binance/w3w-multichain-connector 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@binance/w3w-multichain-connector 可以商用吗?

@binance/w3w-multichain-connector 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@binance/w3w-multichain-connector 的下载量有多少?

根据 npm 官方下载统计,@binance/w3w-multichain-connector 在 2026/10/08 – 2026/11/06 这 30 天内被下载 2,083 次,日均约 69 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@binance/w3w-multichain-connector 还在维护吗?

最新版本 1.0.22 发布于 2026/11/03(4 天前);至今共发布 21 个版本,其中过去 12 个月发布了 9 个;首次发布于 2025/09/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。