stx_getAddresses
Requests the user's Stacks addresses from the connected wallet.
Usage
import { request } from '@stacks/connect';
const result = await request('stx_getAddresses', {
network: 'mainnet',
});
for (const entry of result.addresses) {
console.log(`Address: ${entry.address}`);
console.log(`Public Key: ${entry.publicKey}`);
}Notes
This method returns only Stacks (STX) addresses. For BTC addresses, use
getAddresses.If you need to prompt the user to select a wallet first, use
connectinstead.Results are automatically cached in local storage when
enableLocalStorageistrue(the default).
Signature
Returns
GetAddressesResult
Property
Type
Description
addresses
AddressEntry[]
An array of address entries from the wallet.
Each AddressEntry contains:
Property
Type
Description
symbol
string (optional)
The symbol for the address (e.g. 'STX').
address
string
The Stacks address string.
publicKey
string
The hex-encoded public key for this address.
Parameters
network (optional)
Type:
NetworkString
The network to request addresses for (e.g. 'mainnet', 'testnet', 'devnet').
Last updated
Was this helpful?