Request the Bitcoin addresses (Native SegWit and Taproot) and Stacks addresses for the active account of the user's wallet

Method name





The number of the account connected by the user can be inferred by the derivationPath property for addresses returned in the response.

Account values as indicated by derivation paths are one less than account values as represented in the wallet for users (i.e. the account value 6 corresponds to "Account 7").

In the example response below, the user has connected "Account 2" in their wallet (i.e. account value 1 per the derivation path).

This account number can be used for the account parameter while requesting other methods to indicate the account for which to request them (e.g. for signing transactions with a particular account).

If an account parameter is not specified while requesting other methods, the user's currently active account will be used for fulfillment.

Example request

function accountFromDerivationPath(path: string) {
  const segments = path.split("/");
  const account = parseInt(segments[3].replaceAll("'", ""), 10);
  if (isNaN(account)) throw new Error("Cannot parse account number from path");
  return account;

const response = await window.LeatherProvider?.request("getAddresses");

console.log("Addresses:", response.result.addresses);

Example response

    "jsonrpc": "2.0",
    "id": "288a4a32-899b-47da-ac43-b6adbb8caec2",
    "result": {
        "addresses": [
                "symbol": "BTC",
                "type": "p2wpkh",
                "address": "bc1qetcn9fdtzq3wez6vrljjyry225ml7j52h3kwgl",
                "publicKey": "0328e268de2bd09f703b379d20b8a53fdc9c599a09a8c2fcd9c35e7b3cc48d0ece",
                "derivationPath": "m/84'/0'/1'/0/0"
                "symbol": "BTC",
                "type": "p2tr",
                "address": "bc1ph65ywff65f0nl84xaxwdxgc2rc2gpr70tptllffktt3qzyx859zsp3zvwl",
                "publicKey": "03482aa14965b71358082b110a30b91ef8dfbe6fbae3b18f5b841323f599b954f8",
                "tweakedPublicKey": "482aa14965b71358082b110a30b91ef8dfbe6fbae3b18f5b841323f599b954f8",
                "derivationPath": "m/86'/0'/1'/0/0"
                "symbol": "STX",
                "address": "SPY0682ZM7VGPMVGQP99Z05J3QWMVV83RA6N42SA"

Example use case

You can use response data to store and retrieve data associated with any of the user's addresses.

For example, you can query API with a Bitcoin address for on-chain address details:

const response = await window.LeatherProvider?.request("getAddresses");
const usersNativeSegwitAddress = response.result.addresses.find(address => address.type === 'p2wpkh');
const addressDetails = await fetch('' + usersNativeSegwitAddress)


Install the Leather extension then try out this method below:


Last updated