Bitcoin L1
Bitcoin L1 specific methods
Methods
getBalance
Get BTC balance.
Parameters
None
Returns
Promise
-Object
:confirmed
-number
: the confirmed satoshis.unconfirmed
-number
: the unconfirmed satoshis.total
-number
: the total satohis.
Example
getInscriptions
List inscriptions of current account.
Parameters
cursor
-number
size
-number
Returns
Promise
-Object
:total
-number
: the total count.list
-Object[]
:inscriptionId
-string
: the id of inscription.inscriptionNumber
-string
: the number of inscription.address
-string
: the address of inscription.outputValue
-string
: the output value of inscription.content
-string
: the content url of inscription.contentLength
-string
: the content length of inscription.contentType
-number
: the content type of inscription.preview
-number
: the preview link.timestamp
-number
: the blocktime of inscription.offset
-number
: the offset of inscription.genesisTransaction
-string
: the txid of genesis transaction.location
-string
: the txid and vout of current location.
Example
sendBitcoin
Send BTC over Bitcoin L1.
Parameters
toAddress
-string
: the address to send.satoshis
-number
: the satoshis to send.options
-object
: (optional)feeRate
-number
: the network fee rate.
Returns
Promise
-string
: txid
Example
sendInscription
Send Inscription over Bitcoin L1.
Parameters
address
-string
: the receiver address.inscriptionId
-string
: the id of Inscription.options
-object
: (optional)feeRate
-number
: the network fee rate.
Returns
Promise
-Object
:txid
-string
: the txid.
Example
inscribeTransfer
Inscribe BRC-20 TRANSFER Inscription.
Parameters
ticker
-string
: BRC-20 ticker.amount
-string
: the amount to inscribe.
Returns
Promise
-void
Example
pushTx
Push Transaction.
Parameters
options
-Object
:rawtx
-string
: rawtx to push.
Returns
Promise
-string
: txid.
Example
signPsbt
Sign PSBT
This method will traverse all inputs that match the current address to sign.
Parameters
psbtHex
-string
: the hex string of psbt to sign.Options:
autoFinalized
-boolean
: whether finalize psbt after signing, default is true.toSignInputs
-array
:index
-number
: which input to sign.address
-string
: (at least specify either an address or a publicKey) Which corresponding private key to use for signing.publicKey
-string
: (at least specify either an address or a publicKey) Which corresponding private key to use for signing.sighashTypes
-number[]
: (optional) sighashTypes.disableTweakSigner
-boolean
:(optionals) When signing and unlocking Taproot addresses, thetweakSigner
is used by default for signature generation. Enabling this allows for signing with the original private key.
Returns
Promise
-string
: the hex string of signed psbt.
Example
signPsbts
Sign Multiple PSBTs at once.
This method will traverse all inputs that match the current address to sign.
Parameters
psbtHexs
-string[]
: the hex strings of psbt to sign.Options -
object
[]: the options of signing psbt.autoFinalized
-boolean
: whether finalize psbt after signing, default is true.toSignInputs
-array
:index
-number
: which input to sign.address
-string
: (at least specify either an address or a publicKey) Which corresponding private key to use for signing.publicKey
-string
: (at least specify either an address or a publicKey) Which corresponding private key to use for signing.sighashTypes
-number[]
: (optional) sighashTypes.
Returns
Promise
-string[]
: the hex strings of signed psbt.
Example
pushPsbt
Push transaction.
Parameters
psbtHex
-string
: the hex string of psbt to push.
Returns
Promise
-string
: txid.
Example
Last updated