requestAccounts
method. This connection request will prompt the user for permission to share their Bitcoin addresses, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as signing a message or sending a transaction.
requestAccounts
method returns a Promise that resolves if the user approves the connection request. Once resolved, it contains an array of the user’s BtcAccount
objects. If the user declines the request or closes the pop-up, it will reject (throw when awaited).
The array of BtcAccount
objects represent the possible addresses that can be used when a user connects with Phantom. This is defined as:
address
: The Bitcoin address owned by the user.addressType
: The address’s format. For details, see Bitcoin Design Glossary.publicKey
: A hex string representing the bytes of the public key of the account.purpose
: The general purpose of the address. If ordinals
, the user prefers to store Ordinals on this address. If payment
, the user prefers to store bitcoin on this address.payment
addresses or only Ordinals on ordinals
addresses. When submitting a transaction, make sure to carefully select UTXOs such that you do not cause the user to accidentally spend a rare or inscribed satoshi.accountsChanged
event.
accountsChanged
, it implies that the user has switched to an account that has not connected to the dapp before (that is, not already in Connected Apps) or does not support Bitcoin (for example, a Solana private key account). In this case, the application can either do nothing or attempt to reconnect: