Provider API Reference
Methods
requestAccounts
requestAccounts
Description
Connects to the user’s Phantom account.
Parameters
None
Response
Promise<BtcAccount[]>
array
Array of the connected user’s BtcAccount
objects
BtcAccount
Response Object Properties
BtcAccount
Response Object Propertiesaddress
string
The Bitcoin address owned by the user
publicKey
string
A hex string representing the bytes of the public key of the account
purpose
payment
| ordinals
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
signMessage
signMessage
Description
Signs a message with the user’s Phantom account.
Parameters
Property
Type
Description
message
Uint8Array
The message to be signed
address
string
One of the user’s addresses that should be used to sign the message
Response
Property
Type
Description
Promise<{ signature: Uint8Array; }>
object
Object containing the signature
signPSBT
signPSBT
Description
Signs a Partially-Signed Bitcoin Transaction.
Parameters
psbtHex
Uint8Array
A serialized PSBT
options
object
Configuration options for signing the PSBT
options
parameters
options
parametersinputsToSign
{sigHash?: number | undefined, address: string, signingIndexes: number[]}[]
An array containing the indexes of which transaction inputs to sign, and how to sign them.
Response
Promise<string>
string
A serialized PSBT where the inputs belonging to the user’s account have been signed.
Events
accountsChanged
accountsChanged
Description
The event that is emitted when a user changes their connected Phantom account.
Properties
Property
Type
Description
accounts
BtcAccount[]
The array of BtcAccount
objects of the newly connect Phantom account
BtcAccount
Response Object Properties
BtcAccount
Response Object PropertiesProperty
Type
Description
address
string
The Bitcoin address owned by the user
addressType
p2tr
| p2wpkh
| p2sh
| p2pkh
The address’s format (see: https://bitcoin.design/guide/glossary/address/)
publicKey
string
A hex string representing the bytes of the public key of the account
purpose
payment
| ordinals
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
Last updated