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:
if (typeof window.wizz !== 'undefined') {
console.log('Wizz Wallet is installed!');
}
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:
wizz.requestAccounts()
Methods
requestAccounts
wizz.requestAccounts()
Connect the current account.
Parameters
none
Returns
Promise
returns string[]
: Address of current account.
Example
try {
let accounts = await window.wizz.requestAccounts();
console.log('connect success', accounts);
} catch (e) {
console.log('connect failed');
}
> connect success ['tb1qrn7tvhdf6wnh790384ahj56u0xaa0kqgautnnz']
isBiHelixAddress
Check whether the connected address is BiHelix address.
wizz.isBiHelixAddress();
Returns
Promise<boolean>
- Whether the the connected address is BiHelix address.
Example
wizz.isBiHelixAddress().then((v) => {
console.log('isBiHelixAddress:', v);
}).catch((e) => {
console.error('error:', e);
});
requestCPFP
Create a CPFP
acceleration request. (Requires extension version >= 2.9.1) (Extension only)
wizz.requestCPFP('52c965f7...d854800');
Parameters
txid
- string
- The transaction ID of the transaction to be accelerated.
Returns
Promise<string>
- The transaction ID of the acceleration transaction.
Example
wizz.requestCPFP('52c965f7...d854800').then((txid) => {
console.log('CPFP txid:', txid);
}).catch((e) => {
console.error('CPFP error:', e);
});
requestMint
wizz.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
//mintArc20
wizz.requestMint({
type: 'mint_arc20',
atomicalId: '9527290d5f28479fa752f3eb9484ccbc5a951e2b2b5a49870318683e188e357ei0'
}).catch(error => {
console.error('Error minting ARC20:', error);
})
//mintRealm
wizz.requestMint({
type: 'mint_realm',
realm: 'sats1573',
bitworkc: '12345.6',
satsIn: 888
}).catch(error => {
console.error('Error minting Realm:', error);
})
// mintSubrealm
wizz.requestMint({
type: 'mint_subrealm',
realm: 'hello',
subrealm: '123456',
satsIn: 789
}).catch(error => {
console.error('Error minting Subrealm:', error);
})
//mintContainer
wizz.requestMint({
type: 'mint_container',
container: 'sats1573',
satsIn: 666
}).catch(error => {
console.error('Error minting Container:', error);
})
//mintDmitem
wizz.requestMint({
type: 'mint_dmitem',
atomicalId: '00000b94ff2b25b8f51118aa65dd22dece0acd28609ae90bc564a276c33d5af2i0',
dmitem: {
'mainHash': '26af0bf67e433afe6c5637d07aaa9b17701efbe52d01e00e586635bcbf25dd36',
'data': {
'args': {
'request_dmitem': '878',
'main': 'image.svg',
'i': true,
'proof': [
{
'p': false,
'd': '13576b4c9ae48ae86adf82c21f9876531825db8e5727a10eaf4b90e2e3de8bbe',
},
{
'p': true,
'd': '0b0276c54bf8c0d790df490d91f26ca94463edf9937a6660be27f4c3339a0dc3',
},
{
'p': true,
'd': '44b1c7be4aa863ea5e4fbefd5bd994d8dcf6878b387b46989ac9dadd71af4411',
},
{
'p': true,
'd': '0be312c85b53777b274be59457c0895bb37d9accee8333e2836e027c4473e6c1',
},
{
'p': true,
'd': '89e5a2d475b4e7d05adfc1d14583b18dd34a7a21f39aa4d9141939238653e0d9',
},
{
'p': false,
'd': 'fca8254d88845c95a050449e255d7a06a576f747e61a17cba3dcc27bfd963c93',
},
{
'p': false,
'd': '94cc56fcfa9f494a286e72bbb40c1823a3f07a0f74546542df369513c819d540',
},
{
'p': true,
'd': '2a57764d24fd91bdccd0bc6b899dfa99be652acc921ceacc745fcb8e3c57952d',
},
{
'p': false,
'd': '4a9a30fea16b07b2232282afc1c95e52354c6d5c1d0589dc6be9a87650a43d7f',
},
{
'p': false,
'd': 'e07e43e2b753905a6ef99eaa3f656b342c0b781d344cb80ecce6a5e1dddf4757',
},
],
'parent_container': '00000b94ff2b25b8f51118aa65dd22dece0acd28609ae90bc564a276c33d5af2i0',
'bitworkc': '8888.8',
'bitworkr': '8888.8',
},
'image.svg': {
'$b': '3c7376672077696474683d2232303022206865696768743d223230302220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667223e0a20203c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d2223303030303030222f3e0a20203c7465787420783d223530252220793d223435252220666f6e742d66616d696c793d22417269616c2220666f6e742d73697a653d223530222066696c6c3d2277686974652220646f6d696e616e742d626173656c696e653d226d6964646c652220746578742d616e63686f723d226d6964646c65223ee681903c2f746578743e0a20203c7465787420783d223530252220793d223735252220666f6e742d66616d696c793d22417269616c2220666f6e742d73697a653d223230222066696c6c3d2277686974652220646f6d696e616e742d626173656c696e653d226d6964646c652220746578742d616e63686f723d226d6964646c65223e6536383139303c2f746578743e0a3c2f7376673e',
},
},
'targetVector': '878:any:any:image.svg:26af0bf67e433afe6c5637d07aaa9b17701efbe52d01e00e586635bcbf25dd36',
'targethash': '26af0bf67e433afe6c5637d07aaa9b17701efbe52d01e00e586635bcbf25dd36',
},
satsIn: 666
}).catch(error => {
console.error('Error minting DMItem:', error);
})
//mintNFT
wizz.requestMint({
type: 'mint_nft',
fileBytes: new Uint8Array([123,10,32,32,34,109,97,105,110,72,97,115,104,34,58,32,34,51,51,100,98,54,98,53,101,101,49,51,56,48,101,102,49,98,52,101,48,101,51,54,55,49,51,49,99,102,102,54,98,53,53,57,57,101,102,102,50,51,57,54,97,98,48,54,98,97,48,97,49,99,99,100,53,49,52,52,99,102,51,53,98,34,44,10,32,32,34,100,97,116,97,34,58,32,123,10,32,32,32,32,34,97,114,103,115,34,58,32,123,10,32,32,32,32,32,32,34,114,101,113,117,101,115,116,95,100,109,105,116,101,109,34,58,32,34,57,56,56,34,44,10,32,32,32,32,32,32,34,109,97,105,110,34,58,32,34,105,109,97,103,101,46,115,118,103,34,44,10,32,32,32,32,32,32,34,105,34,58,32,116,114,117,101,44,10,32,32,32,32,32,32,34,112,114,111,111,102,34,58,32,91,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,55,101,97,57,101,50,99,98,99,50,97,102,98,53,50,49,48,52,99,57,52,51,101,54,102,100,54,102,97,54,57,54,55,54,53,52,56,57,49,56,99,53,55,51,98,56,98,48,55,54,100,98,49,98,102,100,97,48,102,55,99,52,56,99,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,48,53,52,52,97,101,98,52,49,53,49,48,99,50,52,48,99,53,57,57,100,53,48,57,55,54,50,54,48,48,56,51,101,98,54,52,56,97,49,100,55,99,48,57,50,52,54,48,99,101,56,49,102,50,53,53,56,57,48,98,49,50,51,54,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,116,114,117,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,99,55,56,101,101,51,53,100,53,99,50,55,102,51,51,50,100,101,48,57,52,99,99,53,100,97,49,57,97,97,48,99,52,100,49,50,56,54,102,57,99,51,101,99,97,97,54,102,50,97,54,54,100,55,99,57,48,97,54,50,50,56,49,102,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,48,100,48,56,98,100,53,99,54,49,98,56,99,53,99,98,57,57,97,57,54,49,97,49,54,54,56,57,49,54,50,49,54,51,53,51,48,53,56,48,98,54,97,50,50,52,49,54,53,50,100,102,52,51,102,101,51,55,50,100,55,56,56,49,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,99,54,55,52,102,101,52,54,48,54,49,98,49,51,57,49,48,57,102,101,101,98,56,56,51,97,52,98,51,57,102,52,102,49,56,49,51,48,49,101,48,55,97,101,53,99,99,51,48,48,48,55,98,54,54,53,54,53,52,50,55,100,101,102,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,116,114,117,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,50,102,54,48,57,53,55,48,57,97,99,99,57,51,55,98,48,102,51,52,51,97,97,57,57,49,102,51,97,50,49,97,98,101,102,101,97,101,55,49,101,101,101,52,49,98,53,51,49,52,51,55,100,53,99,102,55,52,102,53,52,54,101,53,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,54,57,56,101,102,53,52,102,98,98,49,50,97,51,56,98,100,55,101,55,53,49,51,53,52,97,48,53,49,55,55,53,48,100,52,55,51,48,56,55,53,99,97,56,98,53,101,56,98,101,48,55,55,48,102,48,97,51,49,56,53,97,50,56,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,97,55,56,55,52,52,54,49,52,57,51,49,57,97,55,97,55,55,53,102,100,101,54,98,101,57,52,49,97,51,55,55,50,54,52,97,50,55,100,101,48,97,49,98,52,54,54,48,50,56,102,54,101,55,99,53,54,51,56,57,97,53,48,53,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,52,97,57,97,51,48,102,101,97,49,54,98,48,55,98,50,50,51,50,50,56,50,97,102,99,49,99,57,53,101,53,50,51,53,52,99,54,100,53,99,49,100,48,53,56,57,100,99,54,98,101,57,97,56,55,54,53,48,97,52,51,100,55,102,34,10,32,32,32,32,32,32,32,32,125,44,10,32,32,32,32,32,32,32,32,123,10,32,32,32,32,32,32,32,32,32,32,34,112,34,58,32,102,97,108,115,101,44,10,32,32,32,32,32,32,32,32,32,32,34,100,34,58,32,34,101,48,55,101,52,51,101,50,98,55,53,51,57,48,53,97,54,101,102,57,57,101,97,97,51,102,54,53,54,98,51,52,50,99,48,98,55,56,49,100,51,52,52,99,98,56,48,101,99,99,101,54,97,53,101,49,100,100,100,102,52,55,53,55,34,10,32,32,32,32,32,32,32,32,125,10,32,32,32,32,32,32,93,10,32,32,32,32,125,44,10,32,32,32,32,34,105,109,97,103,101,46,115,118,103,34,58,32,123,10,32,32,32,32,32,32,34,36,98,34,58,32,34,51,99,55,51,55,54,54,55,50,48,55,55,54,57,54,52,55,52,54,56,51,100,50,50,51,50,51,48,51,48,50,50,50,48,54,56,54,53,54,57,54,55,54,56,55,52,51,100,50,50,51,50,51,48,51,48,50,50,50,48,55,56,54,100,54,99,54,101,55,51,51,100,50,50,54,56,55,52,55,52,55,48,51,97,50,102,50,102,55,55,55,55,55,55,50,101,55,55,51,51,50,101,54,102,55,50,54,55,50,102,51,50,51,48,51,48,51,48,50,102,55,51,55,54,54,55,50,50,51,101,48,97,50,48,50,48,51,99,55,50,54,53,54,51,55,52,50,48,55,55,54,57,54,52,55,52,54,56,51,100,50,50,51,49,51,48,51,48,50,53,50,50,50,48,54,56,54,53,54,57,54,55,54,56,55,52,51,100,50,50,51,49,51,48,51,48,50,53,50,50,50,48,54,54,54,57,54,99,54,99,51,100,50,50,50,51,51,48,51,48,51,48,51,48,51,48,51,48,50,50,50,102,51,101,48,97,50,48,50,48,51,99,55,52,54,53,55,56,55,52,50,48,55,56,51,100,50,50,51,53,51,48,50,53,50,50,50,48,55,57,51,100,50,50,51,52,51,53,50,53,50,50,50,48,54,54,54,102,54,101,55,52,50,100,54,54,54,49,54,100,54,57,54,99,55,57,51,100,50,50,52,49,55,50,54,57,54,49,54,99,50,50,50,48,54,54,54,102,54,101,55,52,50,100,55,51,54,57,55,97,54,53,51,100,50,50,51,53,51,48,50,50,50,48,54,54,54,57,54,99,54,99,51,100,50,50,55,55,54,56,54,57,55,52,54,53,50,50,50,48,54,52,54,102,54,100,54,57,54,101,54,49,54,101,55,52,50,100,54,50,54,49,55,51,54,53,54,99,54,57,54,101,54,53,51,100,50,50,54,100,54,57,54,52,54,52,54,99,54,53,50,50,50,48,55,52,54,53,55,56,55,52,50,100,54,49,54,101,54,51,54,56,54,102,55,50,51,100,50,50,54,100,54,57,54,52,54,52,54,99,54,53,50,50,51,101,101,54,56,52,57,97,51,99,50,102,55,52,54,53,55,56,55,52,51,101,48,97,50,48,50,48,51,99,55,52,54,53,55,56,55,52,50,48,55,56,51,100,50,50,51,53,51,48,50,53,50,50,50,48,55,57,51,100,50,50,51,55,51,53,50,53,50,50,50,48,54,54,54,102,54,101,55,52,50,100,54,54,54,49,54,100,54,57,54,99,55,57,51,100,50,50,52,49,55,50,54,57,54,49,54,99,50,50,50,48,54,54,54,102,54,101,55,52,50,100,55,51,54,57,55,97,54,53,51,100,50,50,51,50,51,48,50,50,50,48,54,54,54,57,54,99,54,99,51,100,50,50,55,55,54,56,54,57,55,52,54,53,50,50,50,48,54,52,54,102,54,100,54,57,54,101,54,49,54,101,55,52,50,100,54,50,54,49,55,51,54,53,54,99,54,57,54,101,54,53,51,100,50,50,54,100,54,57,54,52,54,52,54,99,54,53,50,50,50,48,55,52,54,53,55,56,55,52,50,100,54,49,54,101,54,51,54,56,54,102,55,50,51,100,50,50,54,100,54,57,54,52,54,52,54,99,54,53,50,50,51,101,54,53,51,54,51,56,51,52,51,57,54,49,51,99,50,102,55,52,54,53,55,56,55,52,51,101,48,97,51,99,50,102,55,51,55,54,54,55,51,101,34,10,32,32,32,32,125,10,32,32,125,44,10,32,32,34,116,97,114,103,101,116,86,101,99,116,111,114,34,58,32,34,57,56,56,58,97,110,121,58,97,110,121,58,105,109,97,103,101,46,115,118,103,58,51,51,100,98,54,98,53,101,101,49,51,56,48,101,102,49,98,52,101,48,101,51,54,55,49,51,49,99,102,102,54,98,53,53,57,57,101,102,102,50,51,57,54,97,98,48,54,98,97,48,97,49,99,99,100,53,49,52,52,99,102,51,53,98,34,44,10,32,32,34,116,97,114,103,101,116,104,97,115,104,34,58,32,34,51,51,100,98,54,98,53,101,101,49,51,56,48,101,102,49,98,52,101,48,101,51,54,55,49,51,49,99,102,102,54,98,53,53,57,57,101,102,102,50,51,57,54,97,98,48,54,98,97,48,97,49,99,99,100,53,49,52,52,99,102,51,53,98,34,10,125]),
fileName: 'item-988.json',
contentType: 'application/json',
bitworkc: '8888.8',
bitworkr: '8888.8',
satsIn: 555
}).catch(error => {
console.error('Error minting NFT:', error);
})
sendBitcoin
Send a BTC transaction. (Requires extension version >= 2.6.0)
const txid = await window.wizz.sendBitcoin('bc1p...', 1000, { feeRate: 100 });
console.log({ txid });
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)
const txid = await window.wizz.sendARC20('bc1p...', 'atom', 1000, { feeRate: 100 });
console.log({ txid });
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)
const txid = await window.wizz.sendAtomicals('bc1p...', ['O9adf....', '80ea...'], { feeRate: 100 });
console.log({ txid });
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)
const { confirmed, unconfirmed, total } = await window.wizz.getBalance();
console.log({ confirmed, unconfirmed, total });
Parameters
None.
Return
Promise
- { confirmed: number, unconfirmed: number, total: number }
: Balance of the current address
getAccounts
wizz.getAccounts()
Get address of current account
Parameters
none
Returns
Promise
- string
: address of current account
Example
try {
let res = await window.wizz.getAccounts();
console.log(res)
} catch (e) {
console.log(e);
}
> ["tb1qrn7tvhdf6wnh790384ahj56u0xaa0kqgautnnz"]
getNetwork
wizz.getNetwork()
get network
Parameters
none
Returns
Promise
- string
: the network. livenet
and testnet
Example
try {
let res = await window.wizz.getNetwork();
console.log(res)
} catch (e) {
console.log(e);
}
> 0
switchNetwork
wizz.switchNetwork(network)
switch network
Parameters
network
- string
: the network. livenet
and testnet
Returns
none
Example
try {
let res = await window.wizz.switchNetwork("livenet");
console.log(res)
} catch (e) {
console.log(e);
}
> 0
getPublicKey
wizz.getPublicKey()
Get publicKey of current account.
Parameters
none
Returns
Promise
- string
: publicKey
Example
try {
let res = await window.wizz.getPublicKey();
console.log(res)
} catch (e) {
console.log(e);
}
> 03cbaedc26f03fd3ba02fc936f338e980c9e2172c5e23128877ed46827e935296f
getInscriptions
wizz.getInscriptions(cursor,size)
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
try {
let res = await window.wizz.getInscriptions(0,10);
console.log(res)
} catch (e) {
console.log(e);
}
> {
"total":10,
"list":[
{
inscriptionId: '6037b17df2f48cf87f6b6e6ff89af416f6f21dd3d3bc9f1832fb1ff560037531i0',
inscriptionNumber: 959941,
address: 'bc1q8h8s4zd9y0lkrx334aqnj4ykqs220ss735a3gh',
outputValue: 546,
preview: 'https://ordinals.com/preview/6037b17df2f48cf87f6b6e6ff89af416f6f21dd3d3bc9f1832fb1ff560037531i0',
content: 'https://ordinals.com/content/6037b17df2f48cf87f6b6e6ff89af416f6f21dd3d3bc9f1832fb1ff560037531i0',
contentLength: 53,
contentType: 'text/plain;charset=utf-8',
timestamp: 1680865285,
genesisTransaction: '6037b17df2f48cf87f6b6e6ff89af416f6f21dd3d3bc9f1832fb1ff560037531',
location: '6037b17df2f48cf87f6b6e6ff89af416f6f21dd3d3bc9f1832fb1ff560037531:0:0',
output: '6037b17df2f48cf87f6b6e6ff89af416f6f21dd3d3bc9f1832fb1ff560037531:0',
offset: 0
}
]
}
signMessage
wizz.signMessage(msg[, type])
sign message
Parameters
msg
- string
: a string to sign
type
- string
: (Optional) "ecdsa" | "bip322-simple". default is "ecdsa"
Returns
Promise
- string
: the signature.
Example
// sign by ecdsa
try {
let res = await window.wizz.signMessage("abcdefghijk123456789");
console.log(res)
} catch (e) {
console.log(e);
}
> G+LrYa7T5dUMDgQduAErw+i6ebK4GqTXYVWIDM+snYk7Yc6LdPitmaqM6j+iJOeID1CsMXOJFpVopvPiHBdulkE=
// sign by bip322-simple
try {
let res = await window.wizz.signMessage("abcdefghijk123456789","bip322-simple");
console.log(res)
} catch (e) {
console.log(e);
}
> AkcwRAIgeHUcjr0jODaR7GMM8cenWnIj0MYdGmmrpGyMoryNSkgCICzVXWrLIKKp5cFtaCTErY7FGNXTFe6kuEofl4G+Vi5wASECaIeVi8xMtvjATqSSYPDRDjEsQbr0hSUpU7FHJNtVKqw=
pushTx
wizz.pushTx(options)
Push Transaction
Parameters
options
- Object
:rawtx
- string
: rawtx to push
Returns
Promise
- string
: txid
Example
try {
let txid = await window.wizz.pushTx({
rawtx:"0200000000010135bd7d..."
});
console.log(txid)
} catch (e) {
console.log(e);
}
signPsbt
wizz.signPsbt(psbtHex[, options])
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
try {
let res = await window.wizz.signPsbt(
"70736274ff01007d....",
{
autoFinalized:false,
toSignInputs:[
{
index: 0,
address: "tb1q8h8....mjxzny",
},
{
index: 1,
publicKey: "tb1q8h8....mjxzny",
sighashTypes: [1]
},
{
index: 2,
publicKey: "02062...8779693f",
}
]
}
);
console.log(res)
} catch (e) {
console.log(e);
}
wizz.signPsbt("xxxxxxxx",{toSignInputs:[{index:0,publicKey:"xxxxxx",disableTweakSigner:true}],autoFinalized:false})
pushPsbt
wizz.pushPsbt(psbtHex)
Push transaction
Parameters
psbtHex
- string
: the hex string of psbt to push
Returns
Promise
- string
: txid
Example
try {
let res = await window.wizz.pushPsbt("70736274ff01007d....");
console.log(res)
} catch (e) {
console.log(e);
}
Events
accountsChanged
wizz.on('accountsChanged', handler: (accounts: Array<string>) => void);
wizz.removeListener('accountsChanged', handler: (accounts: Array<string>) => void);
The accountsChanged
will be emitted whenever the user's exposed account address changes.
networkChanged
wizz.on('networkChanged', handler: (network: string) => void);
wizz.removeListener('networkChanged', handler: (network: string) => void);
The networkChanged
will be emitted whenever the user's network changes.
TODO
getAtomicals
SendBTC
SendARC20
SendNFT
Last updated