Methods

pub(authorize.tabV2)

Request authorization from the wallet extension to connect the dApp.

Request

web3Enable("your-dapp-name");

Response

true | false

Example

import { web3Enable } from '@polkadot/extension-dapp';

const extensions = await web3Enable('my-dapp');
// returns true if at least one extension approved

pub(accounts.list) | pub(accounts.listV2)

Retrieve the list of all accounts available in the wallet extension.

Request

None

Response

[
  {
    address: string;
    name: string;
    type: "sr25519" | "ed25519" | "ecdsa";
    genesisHash?: string;
  }
]

Example

const provider = await window.injectedWeb3['subwallet-js'].enable('test');
const accounts = await provider.accounts.get();
console.log(accounts);

// [
//   {
//     "address": "5HnGJmptAE1KL9GyARcqjq2xj2ALXN1Dfx8BuhfFGYAZVaT1",
//     "genesisHash": "",
//     "name": "test123",
//     "type": "sr25519"
//   }
// ]

pub(accounts.subscribe)

Subscribe to real-time account changes — fires when the user adds, removes, or switches chains (genesisHash) inside the extension.

Request

None

Response

[
  {
    address: string;
    name: string;
    type: "sr25519" | "ed25519" | "ecdsa";
    genesisHash?: string;
  }
]

Example

provider.accounts.subscribe((accounts) => {
  console.log('Accounts updated:', accounts);
});

pub(metadata.list)

Returns all chain metadata cached in the wallet.

Request

None

Response

{
  genesisHash: string;
  specVersion: number;
}

pub(metadata.provider)

Receive metadata pushed from the dApp.

Not supported. The wallet does not accept chain metadata pushed from dApps.


pub(extrinsic.sign)

Sign a Substrate extrinsic payload. The request is a JSON structure.

Request

{
  specVersion: string;
  transactionVersion: string;
  address: string;
  assetId: null | string;
  blockHash: string;
  blockNumber: string;
  era: string;
  genesisHash: string;
  metadataHash: null | string;
  method: string;
  mode: number;
  nonce: string;
  signedExtensions: string[];
  tip: string;
  version: number;
  withSignedTransaction: boolean;
}

Response

{
  signature: HexString;
}

Example

// Request
{
  "specVersion": "0x000f5d99",
  "transactionVersion": "0x0000001a",
  "address": "16iZT75x21GnmgHV84fqsys7ae9zDfZMkSrg4zebpdC5g44G",
  "blockHash": "0x6ed16c5a06bdd1044852e1d772bac5a25054018f8af7407b04c1d6b3f99b14a6",
  "blockNumber": "0x01af76d9",
  "era": "0x9501",
  "genesisHash": "0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3",
  "method": "0x6308030001...",
  "nonce": "0x00000000",
  "tip": "0x00000000000000000000000000000000",
  "version": 4
}

// Response
{
  "signature": "0x01b6b00e69ff7f4d1f161178b6b029a075e63334a0e848c664711646be1afe8145..."
}

pub(bytes.sign)

Sign arbitrary bytes or a payload.

Request

{
  address: string;       // SS58-encoded address
  type: 'bytes' | 'payload';
  data: string;          // hex-encoded data
}

Response

{
  signature: HexString;
}

Example

const result = await provider.bytes.sign({
  address: "5HnGJmptAE1KL9GyARcqjq2xj2ALXN1Dfx8BuhfFGYAZVaT1",
  type: "bytes",
  data: "0x48656c6c6f"
});
console.log(result.signature);
Copyright © 2026 Cactus Custody all right reserved,powered by GitbookUpdated: 30-Jun-2026 02:04:30

results matching ""

    No results matching ""

    results matching ""

      No results matching ""