Bitcoin

Ant Design Web3 officially provides @ant-design/web3-bitcoin to adapt to Bitcoin, which provides the ability for @ant-design/web3 components to connect to Bitcoin. You don't need to handle the connection status of the components yourself. It will provide relevant global states and interfaces for the components through Web3ConfigProvider. At the same time, you don't need to customize the handling of wallets. useBitcoinWallet exposes common methods such as signing and transactions, which can be directly called. Of course, you can still call the unique APIs of different wallets through provider.

The wallets currently supported are as follows, and we also welcome you to submit GitHub issues or PRs to support other wallets.

WalletConnect

SignMessage / SignPsbt

Phantom currently only provides partial support for PSBT, please test it fully before using it.

SendTransfer

If the wallet does not yet support sendTransfer, a NotImplementedError will be thrown.

GetInscriptions

Use NFTCard to show Ordinals NFT

#2087
Bitcoin Puppet #2087
Vibing, thriving, and striving for world peace.
No:9740
NodeMonkes
The first original 10k collection inscribed on bitcoin.

API

BitcoinWeb3ConfigProvider

PropertyDescriptionTypeDefaultVersion
autoConnectWhether to connect automaticallybooleanfalse-
balanceWhether to display balancebooleanfalse-
walletsWalletsWalletFactory[]--
localeMultilingual settingsLocale--

useBitcoinWallet

Result

PropertyDescriptionTypeVersion
nameThe connected wallet's namestring1.0.0
providerThe connected wallet's providerany1.0.0
accountRepresents the web3 account address of the current userstring1.0.0
connectConnect the wallet() => Promise<void>1.0.0
getBalanceGet the balance of the wallet() => Promise<Balance>1.0.0
signMessageSign message(message: string) => Promise<string>1.0.0
sendTransferTransfer bticoin(prams: TranssferParams) => Promise<string>1.0.0
signPsbtSign PSBT(params: SignPsbtParams) => Promise<SignPsbtResult>1.1.0
getInscriptionsGet Inscriptions(offset?: number, size?: number) => Promise<{ total: number; list: Inscription[] }>1.3.0
TransferParams
PropertyDescriptionTypeDefaultVersion
toThe recipient's addressstring--
satsThe amount to send to the recipient in satoshis(1BTC = 100000000sats)number--
optionsOptions, transaction fee rate{ feeRate: number }--
SignPsbtParams
PropertyDescriptionTypeDefaultVersion
psbtThe base64 encoded PSBT to signstring--
optionsPsbt optionsSignPsbtOptions--
SignPsbtOptions
PropertyDescriptionTypeDefaultVersion
signInputsThe inputs to sign. The key is the address and the value is an array of indexes of the inputs to signRecord<string, number[]>--
broadcastWhether to broadcast the transaction after signingbooleanfalse-
signHashThe sigHash type to use for signing. Will default to the sighash type of the input if not provided.number--

Note: The signHash option is not effective in the Xverse wallet. If you want to specify the signature type, it is recommended to directly include the signature type in the signature data. Reference link #43, signPsbt.

SignPsbtResult
PropertyDescriptionTypeDefaultVersion
psbtThe base64 encoded PSBT after signingstring--
txidThe transaction hash, only returned if broadcast equals truestring--
Inscription
PropertyDescriptionTypeDefaultVersion
inscriptionIdInscription idstring--
addressInscription numberstring--
outputValueThe output value of inscriptionstring--
contentThe content url of inscriptionstring--
contentLengthThe content length of inscriptionstring--
contentTypeThe content type of inscriptionstring--
previewThe preview linkstring--
timestampThe blocktime of inscriptionnumber--
offsetThe offset of inscriptionnumber--
genesisTransactionThe txid of genesis transactionstring--
locationThe txid and vout of current locationstring--
  • TypesEthereum