How to Use
Installation
yarn add @xchainjs/xchain-dogePeer Dependencies
You can visit the xchain-doge package repository to get the updated peer dependencies by looking at the "peerDependencies" object in the "package.json" file.
Testing
yarn install
yarn testExamples
Connect Wallet to New Doge Client and Check Balance
Create a new instance of the Dogecoin Client Retrieve and validate an address Check the balance of assets on address The network default is Mainnet
//Imports
import { Client, DOGE_DECIMAL} from "@xchainjs/xchain-doge"
// Connect wallet to new Client
const connectWallet = async () => {
let phrase = "phrase"
let dogeClient = new Client({ network: Network.Mainnet, phrase})
let address = dogeClient.getAddress()
let isValid = dogeClient.validateAddress(address)
if(isValid === true){
try {
const balance = await dogeClient.getBalance(address)
let assetAmount = (baseToAsset(balance[0].amount)).amount()
console.log(`Adress: ${address} with balance ${assetAmount}`)
} catch (error) {
console.log(`Caught: ${error}`)
}
} else {
console.log(`Address ${address} is not valid`)
}
}
Transfer Dogecoin using dogeClient Instance
Create a new client instance Convert amount to transfer to base Build transaction with correct Tx Parameters The default fee is set to 1
Get Transfer Fees and FeeRate Estimations
Create new dogeClient and query getFees & getFeeRates functions Fees are returned as base Amounts.
Get Transaction Data & History
Create a new client instance and query chain data with a hash
getTransactions() can be filtered with limit? offset? startTime?
Last updated