Wallet API
Integrating with Wizz wallet extension.
extensionWelcome to Wizz Wallet Developer Documentation. This documentation is for learning to develop applications for Wizz Wallet.
Getting Started
To develop for Wizz Wallet, install Wizz Wallet on your development machine. Download here.
Once Wizz Wallet is installed and running, you should find that new browser tabs have a window.wizz
object available in the developer console. This is how your website will interact with Wizz Wallet.
Example
Browser Detection
To verify if the browser is running Wizz Wallet, copy and paste the code snippet below in the developer console of your web browser:
You can review the full API for the window.wizz
object here.
Connecting to Wizz Wallet
"Connecting" or "logging in" to Wizz Wallet effectively means "to access the user's Bitcoin account(s)".
You should only initiate a connection request in response to guide user action, such as clicking a button. You should always disable the "connect" button while the connection request is pending. You should never initiate a connection request on page load.
We recommend that you provide a button to allow the user to connect Wizz Wallet to your dapp. Clicking this button should call the following method:
Methods
requestAccounts
Connect the current account.
Parameters
none
Returns
Promise
returns string[]
: Address of current account.
Example
isBiHelixAddress
Check whether the connected address is BiHelix address.
Returns
Promise<boolean>
- Whether the the connected address is BiHelix address.
Example
requestCPFP
Create a CPFP
acceleration request. (Requires extension version >= 2.9.1) (Extension only)
Parameters
txid
- string
- The transaction ID of the transaction to be accelerated.
Returns
Promise<string>
- The transaction ID of the acceleration transaction.
Example
requestMint
Sends a request to mint various types of digital assets.
Parameters
options
-RequestMintParams
: The options for the minting request, which vary based on the type of asset being minted. It is an object that can have different properties depending on thetype
field.type
-string
: Specifies the type of minting operation. Possible values are'mint_arc20'
,'mint_nft'
,'mint_realm'
,'mint_container'
, and'mint_dmitem'
.
For
'mint_arc20'
type:atomicalId
-string
(optional): the atomical ID of the ARC20 to be minted.
For
'mint_nft'
type:fileBytes
-Uint8Array
(optional): The file content in bytes.fileName
-string
(optional): The name of the file.contentType
-string
(optional): The MIME type of the file.bitworkc
-string
(optional): the mining difficulty for commit transaction, must be hex with a single optional . dot separated with a number of 1 to 15 with no more than 10 hex characters. Example: 0123 or 3456.12. Length between 4-10 digits.bitworkr
-string
(optional): the mining difficulty for reveal transaction, must be hex with a single optional . dot separated with a number of 1 to 15 with no more than 10 hex characters. Example: 0123 or 3456.12. Length between 4-10 digits.satsIn
-number
(optional): sats in nft.
For
'mint_dmitem'
type:atomicalId
-string
(optional): the ID of the container to be minted.dmitem
-Record<string,any>:
dmitem json filesatsIn
-number
(optional): sats in dmitem.
For
'mint_realm'
, type:bitworkc
-string
(optional): the mining difficulty for commit transaction, must be hex with a single optional . dot separated with a number of 1 to 15 with no more than 10 hex characters. Example: 0123 or 3456.12. Length between 4-10 digits.satsIn
-number
(optional): sats in realm.
For
'mint_subrealm'
, type:satsIn
-number
(optional): sats in subrealm.
For
'mint_container‘
type:bitworkc
-string
(optional): the mining difficulty for commit transaction, must be hex with a single optional . dot separated with a number of 1 to 15 with no more than 10 hex characters. Example: 0123 or 3456.12. Length between 4-10 digits.satsIn
-number
(optional): sats in container.
Returns
Promise
-void
:
Examples
sendBitcoin
Send a BTC transaction. (Requires extension version >= 2.6.0)
Parameters
address
Receiving address.amount
Amount of BTC to send.options
(Optional)feeRate
Fee rate to use.
Return
Promise
- string
: Transaction ID.
sendARC20
Send an ARC20 transaction. (Requires extension version >= 2.6.0) (Extension only)
Parameters
address
Receiving address.arc20
Name of the ARC20 token to send.amount
Amount of ARC20 to send.options
(Optional)feeRate
Fee rate to use.
Return
Promise
- string
: Transaction ID.
sendAtomicals
Send an Atomcials transaction. (Requires extension version >= 2.6.0) (Extension only)
Parameters
address
Receiving address.atomicalIds
List of Atomicals IDs to send.options
(Optional)feeRate
Fee rate to use
Return
Promise
- string
: Transaction ID
getBalance
Get the balance of the connected account. (Requires extension version >= 2.6.0)
Parameters
None.
Return
Promise
- { confirmed: number, unconfirmed: number, total: number }
: Balance of the current address
getAccounts
Get address of current account
Parameters
none
Returns
Promise
- string
: address of current account
Example
getNetwork
get network
Parameters
none
Returns
Promise
- string
: the network. livenet
and testnet
Example
switchNetwork
switch network
Parameters
network
- string
: the network. livenet
and testnet
Returns
none
Example
getPublicKey
Get publicKey of current account.
Parameters
none
Returns
Promise
- string
: publicKey
Example
getInscriptions
List inscriptions of current account
Parameters
none
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
signMessage
sign message
Parameters
msg
- string
: a string to sign
type
- string
: (Optional) "ecdsa" | "bip322-simple". default is "ecdsa"
Returns
Promise
- string
: the signature.
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
optionsautoFinalized
- 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
ublicKey
- string
: (at least specify either an address or a publicKey) Which corresponding private key to use for signing
sighashTypes
- number[]
: (optional) sighashTypes
disableTweakSigner
- boolean
:(optional)
When signing and unlocking Taproot addresses, the tweakSigner
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
pushPsbt
Push transaction
Parameters
psbtHex
- string
: the hex string of psbt to push
Returns
Promise
- string
: txid
Example
Events
accountsChanged
The accountsChanged
will be emitted whenever the user's exposed account address changes.
networkChanged
The networkChanged
will be emitted whenever the user's network changes.
TODO
getAtomicals
SendBTC
SendARC20
SendNFT
Last updated