Methods
(async) connect(onSuccessopt, onErroropt) → {Promise.<{approved: boolean, address: string, publicKey: string, balance: number}>}
Initiates a connection request with the wallet.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
onSuccess | function | <optional> | Optional callback function to execute upon successful connection. Receives an object containing the wallet address and balance. |
onError | function | <optional> | Optional callback function to execute upon connection error. |
- Source
Returns:
Promise object representing the outcome of the connection attempt, resolving to an object with the connected address information.
- Type:
- Promise.<{approved: boolean, address: string, publicKey: string, balance: number}>
Example
connect(
(result) => console.log(`Connected to wallet: ${result.address}`),
(error) => console.error(`Connection failed: ${error}`)
).then(result => console.log(result.address))
.catch(error => console.error(error));(async) disconnect(onSuccessopt, onErroropt) → {Promise.<void>}
Disconnects the current session with the wallet.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
onSuccess | function | <optional> | Optional callback function to execute upon successful disconnection. |
onError | function | <optional> | Optional callback function to execute upon error in disconnecting. |
- Source
Returns:
Promise object representing the disconnection outcome.
- Type:
- Promise.<void>
Example
disconnect(
() => console.log(`Disconnected from wallet`),
(error) => console.error(`Disconnection failed: ${error}`)
).then(() => console.log('Disconnected from wallet'))
.catch(error => console.error(error));(async) getBalance(onSuccessopt, onErroropt) → {Promise.<{address: string, balance: number}>}
Retrieves the balance from the connected wallet.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
onSuccess | function | <optional> | Optional callback function to execute upon successful retrieval of balance. Receives an object containing the wallet address and balance. |
onError | function | <optional> | Optional callback function to execute upon error in retrieving balance. |
- Source
Returns:
Promise object representing the outcome of the balance retrieval, resolving to an object with the wallet address and balance.
- Type:
- Promise.<{address: string, balance: number}>
Example
getBalance(
(result) => console.log(`Connected to wallet: ${result.balance}`),
(error) => console.error(`Connection failed: ${error}`)
).then(result => console.log(result.balance))
.catch(error => console.error(error));(async) getConnectionStatus(onSuccessopt, onErroropt) → {Promise.<{connected: boolean, address: string, selectedWalletAddress: string}>}
Retrieves the connection status with the wallet.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
onSuccess | function | <optional> | Optional callback function to execute upon successfully retrieving the status. Receives an object containing the wallet address, selected wallet address, and connection status. |
onError | function | <optional> | Optional callback function to execute upon error in retrieving the connection status. |
- Source
Returns:
Promise object representing the outcome of the connection status retrieval, resolving to an object with the wallet address, selected wallet address, and connection status.
- Type:
- Promise.<{connected: boolean, address: string, selectedWalletAddress: string}>
Example
getConnectionStatus(
(result) => console.log(`Connected to wallet: ${result.connected}`),
(error) => console.error(`Connection status retrieval failed: ${error}`)
).then(result => console.log(result.connected))
.catch(error => console.error(error));(async) getDRC20Balance(data, onSuccessopt, onErroropt) → {Promise.<{availableBalance: number, transferableBalance: number, ticker: string, address: string}>}
Retrieves the DRC20 token balance based on provided data.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required to fetch the DRC20 balance, must contain 'ticker'.Properties
| |||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful retrieval. Receives an object containing the available balance, transferable balance, ticker symbol, and wallet address. | ||||||
onError | function | <optional> | Optional callback function to execute upon error in retrieving balance. |
- Source
Returns:
Promise object representing the outcome of the balance retrieval, resolving to an object with the wallet address, available balance, and transferable balance.
- Type:
- Promise.<{availableBalance: number, transferableBalance: number, ticker: string, address: string}>
Example
getDRC20Balance(
{ ticker: 'DRC20' },
(result) => console.log(`Available balance: ${result.availableBalance}, transferable balance: ${result.transferableBalance}`),
(error) => console.error(`Balance retrieval failed: ${error}`)
).then(result => console.log(result.availableBalance))
.catch(error => console.error(error));(async) getDunesBalance(data, onSuccessopt, onErroropt) → {Promise.<{balance: number, ticker: string, address: string}>}
Retrieves the Dunes token balance based on provided data.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required to fetch the Dunes balance, must contain 'ticker'.Properties
| |||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful retrieval. Receives an object containing the balance, ticker symbol, and wallet address. | ||||||
onError | function | <optional> | Optional callback function to execute upon error in retrieving balance. |
- Source
Returns:
Promise object representing the outcome of the balance retrieval, resolving to an object with the wallet address, ticker and balance.
- Type:
- Promise.<{balance: number, ticker: string, address: string}>
Example
getDunesBalance(
{ ticker: 'DUNES' },
(result) => console.log(`Balance: ${result.balance}`),
(error) => console.error(`Balance retrieval failed: ${error}`)
).then(result => console.log(result.availableBalance))
.catch(error => console.error(error));(async) getTransactionStatus(data, onSuccessopt, onErroropt) → {Promise.<{txId: string, confirmations: number, status: string, dogeAmount: number, blockTime: number, address: string}>}
Retrieves the status of a specific transaction based on provided data.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the query, must contain 'txId'.Properties
| |||||||
onSuccess | function | <optional> | Optional callback function to execute upon successfully retrieving the status. Receives an object containing the number of txId, confirmations, status, amount, blockTime and address for the given tx. | ||||||
onError | function | <optional> | Optional callback function to execute upon error in retrieving the tx status. |
- Source
Returns:
Promise object representing the outcome of the tx retrieval, resolving to an object with the txId, confirmations, status, amount, blockTime and address for the given tx.
- Type:
- Promise.<{txId: string, confirmations: number, status: string, dogeAmount: number, blockTime: number, address: string}>
Example
getTransactionStatus(
{ txId: '18d83f35060323a20e158805805e217b3ab7d849d5a1131f0ed8eba3a31c39a7' },
(result) => console.log(`Trasaction status: ${result.status}`),
(error) => console.error(`Transaction status retrieval failed: ${error}`)
).then(result => console.log(result.status))
.catch(error => console.error(error));(async) getTransferableDRC20(data, onSuccessopt, onErroropt) → {Promise.<{inscriptions: Array.<{txid: string, vout: number, ticker: string, contentType: string, content: string, location: string, amount: number}>, ticker: string, address: string}>}
Retrieves transferable DRC20 inscriptions based on provided data.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the query, must contain 'ticker'.Properties
| |||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful retrieval. Receives an object containing the transferable inscriptions, ticker symbol, and wallet address. | ||||||
onError | function | <optional> | Optional callback function to execute upon error in fetching the transferable balance. |
- Source
Returns:
Promise object representing the outcome of the balance retrieval, resolving to an object with the wallet address, transferable inscriptions, and ticker symbol.}
- Type:
- Promise.<{inscriptions: Array.<{txid: string, vout: number, ticker: string, contentType: string, content: string, location: string, amount: number}>, ticker: string, address: string}>
Example
getTransferableDRC20(
{ ticker: 'DRC20' },*
(result) => console.log(`Transferable inscriptions: ${result.inscriptions}`),
(error) => console.error(`Balance retrieval failed: ${error}`)
).then(result => console.log(result.inscriptions))
.catch(error => console.error(error));(async) requestAvailableDRC20Transaction(data, onSuccessopt, onErroropt) → {Promise.<{txId: string, ticker: string, amount: number}>}
Requests a transaction for available DRC20 tokens based on specified data.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the transaction, must contain 'ticker' and 'amount'.Properties
| ||||||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful transaction request. Receives an object containing the transaction ID, ticker symbol, and amount. | |||||||||
onError | function | <optional> | Optional callback function to execute upon error in processing the transaction request. |
- Source
Returns:
Promise object representing the outcome of the transaction request, resolving to an object with the transaction ID, ticker symbol, and amount.
- Type:
- Promise.<{txId: string, ticker: string, amount: number}>
Example
requestInscriptionTransaction(
{ ticker: 'DRC20', amount: 100 },
(result) => console.log(`Transaction ID: ${result.txId} `),
(error) => console.error(`Transaction request failed: ${error}`)
).then(result => console.log(result.txId))
.catch(error => console.error(error));(async) requestDecryptedMessage(data, onSuccessopt, onErroropt) → {Promise.<{decryptedMessage: string}>}
Requests the decrypting of an arbitrary message encrypted by the connected address public key.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the decryption, must contain 'message'.Properties
| |||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful message signing. Receives an object containing the decrypted message. | ||||||
onError | function | <optional> | Callback function to execute upon error in decrypting the message. |
- Source
Returns:
Promise object representing the outcome of the request, resolving to an object with the decrypted message.
- Type:
- Promise.<{decryptedMessage: string}>
Example
requestDecryptedMessage(
{ message: 'STjKie7Bsm9/MtwkCimz2A==' },
(result) => console.log(`Decrypted message: ${result.decryptedMessage}`),
(error) => console.error(`Message decryption failed: ${error}`)
).then(result => console.log(result.decryptedMessage))
.catch(error => console.error(error));(async) requestDunesTransaction(data, onSuccessopt, onErroropt) → {Promise.<{txId: string, ticker: string, amount: number}>}
Requests a transaction for Dunes tokens based on specified data.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the transaction, must contain 'ticker' and 'amount'.Properties
| |||||||||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful transaction request. Receives an object containing the transaction ID, ticker symbol, and amount. | ||||||||||||
onError | function | <optional> | Optional callback function to execute upon error in processing the transaction request. |
- Source
Returns:
Promise object representing the outcome of the transaction request, resolving to an object with the transaction ID, ticker symbol, and amount.
- Type:
- Promise.<{txId: string, ticker: string, amount: number}>
Example
requestDunesTransaction(
{ ticker: 'DUNES', amount: 100, recipientAddress: 'DAHkCF5LajV6jYyi5o4eMvtpqXRcm9eZYq' },
(result) => console.log(`Transaction ID: ${result.txId} `),
(error) => console.error(`Transaction request failed: ${error}`)
).then(result => console.log(result.txId))
.catch(error => console.error(error));(async) requestInscriptionTransaction(data, onSuccessopt, onErroropt) → {Promise.<{txId: string}>}
Requests an inscription transaction for Doginal/DRC-20 based on the specified data.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the transaction, must contain 'recipientAddress' and 'output'.Properties
| ||||||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful transaction request. Receives an object containing the transaction ID. | |||||||||
onError | function | <optional> | Optional function to execute upon error in processing the transaction request. |
- Source
Returns:
Promise object representing the outcome of the transaction request, resolving to an object with the transaction ID.
- Type:
- Promise.<{txId: string}>
Example
requestInscriptionTransaction(
{ recipientAddress: 'DAHkCF5LajV6jYyi5o4eMvtpqXRcm9eZYq', location: '18d83f35060323a20e158805805e217b3ab7d849d5a1131f0ed8eba3a31c39a7:0:0' },
(result) => console.log(`Transaction ID: ${result.txId}`),
(error) => console.error(`Transaction request failed: ${error}`)
).then(result => console.log(result.txId))
.catch(error => console.error(error));(async) requestPsbt(data, onSuccessopt, onErroropt) → {Promise.<{txId: string, signedRawTx: string}>}
Requests the signing of a partially signed Bitcoin transaction (PSBT) based on provided data.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for signing the PSBT, must contain 'rawTx' and an array of indexes to sign 'indexes'.Properties
| |||||||||||||||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful signing. Receives an object containing the transaction ID. | ||||||||||||||||||
onError | function | <optional> | Callback function to execute upon error in signing the PSBT. |
- Source
Returns:
Promise object representing the outcome of the transaction request, resolving to an object with the transaction ID or the signed raw transaction if signOnly = true.
- Type:
- Promise.<{txId: string, signedRawTx: string}>
Example
requestPsbt(
{ rawTx: '02000000000101...', indexes: [0] },
(result) => console.log(`Transaction ID: ${result.txId}`),
(error) => console.error(`Transaction request failed: ${error}`)
).then(result => console.log(result.txId))
.catch(error => console.error(error));(async) requestSignedMessage(data, onSuccessopt, onErroropt) → {Promise.<{signedMessage: string}>}
Requests the signing of an arbitrary message based on provided data.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
data | Object | Data required for the message signing, must contain 'message'.Properties
| |||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful message signing. Receives an object containing the signed message. | ||||||
onError | function | <optional> | Callback function to execute upon error in signing the message. |
- Source
Returns:
Promise object representing the outcome of the request, resolving to an object with the base64 signed message.
- Type:
- Promise.<{signedMessage: string}>
Example
requestSignedMessage(
{ message: 'Hello, World!' },
(result) => console.log(`Signed message: ${result.signedMessage}`),
(error) => console.error(`Message signing failed: ${error}`)
).then(result => console.log(result.signedMessage))
.catch(error => console.error(error));(async) requestTransaction(data, onSuccessopt, onErroropt) → {Promise.<{txId: string}>}
Requests a Dogecoin transaction based on the specified data.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | Data needed for the transaction, must contain 'recipientAddress' and 'dogeAmount'.Properties
| ||||||||||
onSuccess | function | <optional> | Optional callback function to execute upon successful transaction request. Receives an object containing the transaction ID. | |||||||||
onError | function | <optional> | Optional callback function to execute upon error in processing the transaction request. |
- Source
Returns:
Promise object representing the outcome of the transaction request, resolving to an object with the transaction ID.
- Type:
- Promise.<{txId: string}>
Example
requestTransaction(
{ recipientAddress: 'DAHkCF5LajV6jYyi5o4eMvtpqXRcm9eZYq', dogeAmount: 100 },
(result) => console.log(`Transaction ID: ${result.txId}`),
(error) => console.error(`Transaction request failed: ${error}`)
).then(result => console.log(result.txId))
.catch(error => console.error(error));