[Legacy ⚠️] getAccounts
🚀 Attention Developers: Upgrade to the connect method 🚀
A new connect method is now available to connect to user's wallets and request permissions to access their accounts.
While the legacy version documented here remains supported, we urge you to upgrade for access to the latest features and a more smoother user experience.
Your application can request to connect to the user’s wallet with the getAccounts
method, which prompts them to share their Bitcoin and Stacks addresses.
You can specify which wallet addresses you require, Bitcoin ordinals address, Bitcoin payment address or Stacks address, using the
purposes
request parameterThe
message
request param gives you the option to display a message the user when requesting their addresses. You can use it to present your app and explain why you require access to their addresses.
request parameters | Description |
---|---|
| Array of strings used to specify the purpose of the address(es) to request:
Example: |
|
The getAddresss
method returns a Promise that resolves if the user approves the connection request. The user will see a Connection Request prompt in their wallet. The prompt will display:
your app logo, if it is specified in your app manifest
the wallet addresses that your app required
the message which you specified. Note that this message will be cut beyond 80 characters.
Once resolved, the method returns GetAccountResult
: an array of the user’s wallet address objects, defined as:
You can use these addresses to make further requests such as signing a message, signing a transaction, etc.
Currently, you can retrieve two types of Bitcoin addresses, the user's Bitcoin payment address and the Ordinals address which is a taproot address.
An example response:
Where:
address field | Description |
---|---|
| string - the user’s connected wallet address |
| A hex string representing the bytes of the public key of the account. You can use this to construct partially signed Bitcoin transactions (PSBT). |
| string - The purpose of the address:
|
| string - the address’s format:
|
| string - the type of wallet used for the account
|
If the user declines the request or closes the pop-up, the promise will reject (throw when awaited).
Last updated