For the complete documentation index, see llms.txt. This page is also available as Markdown.
Page cover

getAddresses

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

Method name

getAddresses

Parameters

Parameter
Description
Required
Type

chains

Chains to request addresses for: bitcoin, stacks, or both. Defaults to both

❌

string[]

network

Network identifier

❌

string

Accounts

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 on the Bitcoin methods (signMessage, sendTransfer, signPsbt) to indicate the account for which to request them.

The Stacks methods do not take an account parameter. To indicate a Stacks request to a specific account, pass the address parameter with the STX address returned in the getAddresses response. This applies to stx_callContract, stx_transferStx and stx_deployContract.

If neither parameter is specified, the user's currently active account is used for fulfillment. That may not be the account your app is connected with.

Example request

Example response

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 mempool.space API with a Bitcoin address for on-chain address details:

Sandbox

Install the Leather extension then try out this method below:

Preview

Last updated

Was this helpful?