Provider API

介绍

通过访问ton provider会得到一个tonconnect对象

const tonConnect = window.naboxTon.tonconnect();

interface TonConnectBridge {
    deviceInfo: DeviceInfo;
    walletInfo?: WalletInfo;
    protocolVersion: number;
    connect(protocolVersion: number, message: ConnectRequest): Promise<ConnectEvent>;
    restoreConnection(): Promise<ConnectEvent>;
    send(message: AppRequest): Promise<WalletResponse>;
    listen(callback: (event: WalletEvent) => void): () => void;
};

deviceInfo(设备信息)

{
    platform: 'browser', // 当前环境
    appName: 'Nabox Wallet', // 钱包
    appVersion: '1.2.19', // 当前版本号
    maxProtocolVersion: 2, // 支持的协议类型,当前为2
    features: [ // 当前钱包支持的特性
      'SendTransaction',
      {
        name: 'SendTransaction',
        maxMessages: 4,
      },
    ],
}

walletInfo(钱包信息)

protocolVersion

当前支持的协议版本

connect(连接钱包)

restoreConnection(恢复连接,常用于之前连接过进行第二次连接)

send(sendTransaction/disconnect)

listen

Last updated