@xchainjs/xchain-doge 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.d.ts +2 -0
- package/lib/index.esm.js +6 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
package/lib/client.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ declare abstract class Client extends UTXOClient {
|
|
|
50
50
|
}) => Promise<{
|
|
51
51
|
psbt: Dogecoin.Psbt;
|
|
52
52
|
utxos: UTXO[];
|
|
53
|
+
inputs: UTXO[];
|
|
53
54
|
}>;
|
|
54
55
|
/**
|
|
55
56
|
* Asynchronously creates transaction information for ledger sign.
|
|
@@ -73,6 +74,7 @@ declare abstract class Client extends UTXOClient {
|
|
|
73
74
|
spendPendingUTXO?: boolean;
|
|
74
75
|
}): Promise<PreparedTx & {
|
|
75
76
|
utxos: UTXO[];
|
|
77
|
+
inputs: UTXO[];
|
|
76
78
|
}>;
|
|
77
79
|
/**
|
|
78
80
|
* Compiles the memo into a buffer for inclusion in a Dogecoin transaction.
|
package/lib/index.esm.js
CHANGED
|
@@ -433,7 +433,7 @@ class Client extends Client$1 {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
});
|
|
436
|
-
return { psbt, utxos };
|
|
436
|
+
return { psbt, utxos, inputs };
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
439
|
/**
|
|
@@ -487,7 +487,7 @@ class Client extends Client$1 {
|
|
|
487
487
|
prepareTx({ sender, memo, amount, recipient, feeRate, }) {
|
|
488
488
|
return __awaiter(this, void 0, void 0, function* () {
|
|
489
489
|
// Build the transaction (PSBT) with the specified transfer options
|
|
490
|
-
const { psbt, utxos } = yield this.buildTx({
|
|
490
|
+
const { psbt, utxos, inputs } = yield this.buildTx({
|
|
491
491
|
sender,
|
|
492
492
|
recipient,
|
|
493
493
|
amount,
|
|
@@ -495,7 +495,7 @@ class Client extends Client$1 {
|
|
|
495
495
|
memo,
|
|
496
496
|
});
|
|
497
497
|
// Return the raw unsigned transaction (PSBT)
|
|
498
|
-
return { rawUnsignedTx: psbt.toBase64(), utxos };
|
|
498
|
+
return { rawUnsignedTx: psbt.toBase64(), utxos, inputs };
|
|
499
499
|
});
|
|
500
500
|
}
|
|
501
501
|
/**
|
|
@@ -685,13 +685,14 @@ class ClientLedger extends Client {
|
|
|
685
685
|
const fromAddressIndex = (params === null || params === void 0 ? void 0 : params.walletIndex) || 0;
|
|
686
686
|
// Get fee rate
|
|
687
687
|
const feeRate = params.feeRate || (yield this.getFeeRates())[FeeOption.Fast];
|
|
688
|
+
checkFeeBounds(this.feeBounds, feeRate);
|
|
688
689
|
// Get sender address
|
|
689
690
|
const sender = yield this.getAddressAsync(fromAddressIndex);
|
|
690
691
|
// Prepare transaction
|
|
691
|
-
const { rawUnsignedTx,
|
|
692
|
+
const { rawUnsignedTx, inputs } = yield this.prepareTx(Object.assign(Object.assign({}, params), { sender, feeRate }));
|
|
692
693
|
const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx);
|
|
693
694
|
// Prepare Ledger inputs
|
|
694
|
-
const ledgerInputs =
|
|
695
|
+
const ledgerInputs = inputs.map(({ txHex, hash, index }) => {
|
|
695
696
|
if (!txHex) {
|
|
696
697
|
throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`);
|
|
697
698
|
}
|
package/lib/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../node_modules/coinselect/utils.js","../../../node_modules/coinselect/accumulative.js","../src/const.ts","../src/utils.ts","../src/client.ts","../src/clientKeystore.ts","../src/clientLedger.ts","../src/blockcypher-api.ts"],"sourcesContent":["// baseline estimates, used to improve performance\nvar TX_EMPTY_SIZE = 4 + 1 + 1 + 4\nvar TX_INPUT_BASE = 32 + 4 + 1 + 4\nvar TX_INPUT_PUBKEYHASH = 107\nvar TX_OUTPUT_BASE = 8 + 1\nvar TX_OUTPUT_PUBKEYHASH = 25\n\nfunction inputBytes (input) {\n return TX_INPUT_BASE + (input.script ? input.script.length : TX_INPUT_PUBKEYHASH)\n}\n\nfunction outputBytes (output) {\n return TX_OUTPUT_BASE + (output.script ? output.script.length : TX_OUTPUT_PUBKEYHASH)\n}\n\nfunction dustThreshold (output, feeRate) {\n /* ... classify the output for input estimate */\n return inputBytes({}) * feeRate\n}\n\nfunction transactionBytes (inputs, outputs) {\n return TX_EMPTY_SIZE +\n inputs.reduce(function (a, x) { return a + inputBytes(x) }, 0) +\n outputs.reduce(function (a, x) { return a + outputBytes(x) }, 0)\n}\n\nfunction uintOrNaN (v) {\n if (typeof v !== 'number') return NaN\n if (!isFinite(v)) return NaN\n if (Math.floor(v) !== v) return NaN\n if (v < 0) return NaN\n return v\n}\n\nfunction sumForgiving (range) {\n return range.reduce(function (a, x) { return a + (isFinite(x.value) ? x.value : 0) }, 0)\n}\n\nfunction sumOrNaN (range) {\n return range.reduce(function (a, x) { return a + uintOrNaN(x.value) }, 0)\n}\n\nvar BLANK_OUTPUT = outputBytes({})\n\nfunction finalize (inputs, outputs, feeRate) {\n var bytesAccum = transactionBytes(inputs, outputs)\n var feeAfterExtraOutput = feeRate * (bytesAccum + BLANK_OUTPUT)\n var remainderAfterExtraOutput = sumOrNaN(inputs) - (sumOrNaN(outputs) + feeAfterExtraOutput)\n\n // is it worth a change output?\n if (remainderAfterExtraOutput > dustThreshold({}, feeRate)) {\n outputs = outputs.concat({ value: remainderAfterExtraOutput })\n }\n\n var fee = sumOrNaN(inputs) - sumOrNaN(outputs)\n if (!isFinite(fee)) return { fee: feeRate * bytesAccum }\n\n return {\n inputs: inputs,\n outputs: outputs,\n fee: fee\n }\n}\n\nmodule.exports = {\n dustThreshold: dustThreshold,\n finalize: finalize,\n inputBytes: inputBytes,\n outputBytes: outputBytes,\n sumOrNaN: sumOrNaN,\n sumForgiving: sumForgiving,\n transactionBytes: transactionBytes,\n uintOrNaN: uintOrNaN\n}\n","var utils = require('./utils')\n\n// add inputs until we reach or surpass the target value (or deplete)\n// worst-case: O(n)\nmodule.exports = function accumulative (utxos, outputs, feeRate) {\n if (!isFinite(utils.uintOrNaN(feeRate))) return {}\n var bytesAccum = utils.transactionBytes([], outputs)\n\n var inAccum = 0\n var inputs = []\n var outAccum = utils.sumOrNaN(outputs)\n\n for (var i = 0; i < utxos.length; ++i) {\n var utxo = utxos[i]\n var utxoBytes = utils.inputBytes(utxo)\n var utxoFee = feeRate * utxoBytes\n var utxoValue = utils.uintOrNaN(utxo.value)\n\n // skip detrimental input\n if (utxoFee > utxo.value) {\n if (i === utxos.length - 1) return { fee: feeRate * (bytesAccum + utxoBytes) }\n continue\n }\n\n bytesAccum += utxoBytes\n inAccum += utxoValue\n inputs.push(utxo)\n\n var fee = feeRate * bytesAccum\n\n // go again?\n if (inAccum < outAccum + fee) continue\n\n return utils.finalize(inputs, outputs, feeRate)\n }\n\n return { fee: feeRate * bytesAccum }\n}\n","import { ExplorerProvider, Network } from '@xchainjs/xchain-client'\nimport { Asset, AssetType } from '@xchainjs/xchain-util'\nimport {\n BitgoProvider,\n BlockcypherNetwork,\n BlockcypherProvider,\n SochainNetwork,\n SochainProvider,\n UtxoOnlineDataProviders,\n} from '@xchainjs/xchain-utxo-providers'\n/**\n * Minimum transaction fee for Dogecoin transactions.\n * Defined as 100000 satoshi/kB.\n * @see https://github.com/dogecoin/dogecoin/blob/master/src/validation.h#L58\n */\nexport const MIN_TX_FEE = 100000\n\n/**\n * Decimal places for Dogecoin.\n */\nexport const DOGE_DECIMAL = 8\n\n/**\n * Lower fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const LOWER_FEE_BOUND = 100\n\n/**\n * Upper fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const UPPER_FEE_BOUND = 20_000_000\n\n/**\n * Chain identifier for Dogecoin.\n */\nexport const DOGEChain = 'DOGE' as const\n\n/**\n * Base asset object for Dogecoin.\n * Represents the Dogecoin asset in various contexts.\n */\nexport const AssetDOGE: Asset = { chain: DOGEChain, symbol: 'DOGE', ticker: 'DOGE', type: AssetType.NATIVE }\n\n/**\n * Explorer provider for Dogecoin mainnet and testnet.\n * Provides URLs for exploring Dogecoin transactions and addresses.\n */\nconst DOGE_MAINNET_EXPLORER = new ExplorerProvider(\n 'https://blockchair.com/dogecoin',\n 'https://blockchair.com/dogecoin/address/%%ADDRESS%%',\n 'https://blockchair.com/dogecoin/transaction/%%TX_ID%%',\n)\nconst DOGE_TESTNET_EXPLORER = new ExplorerProvider(\n 'https://blockexplorer.one/dogecoin/testnet',\n 'https://blockexplorer.one/dogecoin/testnet/address/%%ADDRESS%%',\n 'https://blockexplorer.one/dogecoin/testnet/tx/%%TX_ID%%',\n)\nexport const blockstreamExplorerProviders = {\n [Network.Testnet]: DOGE_TESTNET_EXPLORER,\n [Network.Stagenet]: DOGE_MAINNET_EXPLORER,\n [Network.Mainnet]: DOGE_MAINNET_EXPLORER,\n}\n\n/**\n * Sochain data providers for Dogecoin mainnet and testnet.\n * Provides API access to Sochain for Dogecoin.\n */\nconst testnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGETEST,\n)\nconst mainnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGE,\n)\nexport const sochainDataProviders = {\n [Network.Testnet]: testnetSochainProvider,\n [Network.Stagenet]: mainnetSochainProvider,\n [Network.Mainnet]: mainnetSochainProvider,\n}\n\n/**\n * Blockcypher data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Blockcypher for Dogecoin.\n */\nconst mainnetBlockcypherProvider = new BlockcypherProvider(\n 'https://api.blockcypher.com/v1',\n DOGEChain,\n AssetDOGE,\n 8,\n BlockcypherNetwork.DOGE,\n process.env.BLOCKCYPHER_API_KEY || '',\n)\nexport const blockcypherDataProviders = {\n [Network.Testnet]: undefined, //no provider here\n [Network.Stagenet]: mainnetBlockcypherProvider,\n [Network.Mainnet]: mainnetBlockcypherProvider,\n}\n\n/**\n * Bitgo data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Bitgo for Dogecoin.\n */\nconst mainnetBitgoProvider = new BitgoProvider({\n baseUrl: 'https://app.bitgo.com',\n chain: DOGEChain,\n})\n\nexport const BitgoProviders: UtxoOnlineDataProviders = {\n [Network.Testnet]: undefined,\n [Network.Stagenet]: mainnetBitgoProvider,\n [Network.Mainnet]: mainnetBitgoProvider,\n}\n","/**\n * Import statements for required modules and types.\n */\nimport { Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing bitcoinjs-lib for Dogecoin operations\nimport coininfo from 'coininfo' // Importing coininfo for cryptocurrency information retrieval\n\n/**\n * Constant values representing transaction sizes and lengths.\n */\nexport const TX_EMPTY_SIZE = 4 + 1 + 1 + 4 // 10\nexport const TX_INPUT_BASE = 32 + 4 + 1 + 4 // 41\nexport const TX_INPUT_PUBKEYHASH = 107\nexport const TX_OUTPUT_BASE = 8 + 1 // 9\nexport const TX_OUTPUT_PUBKEYHASH = 25\n\n/**\n * Calculate the number of bytes required for an input.\n *\n * @returns {number} The number of bytes required for an input.\n */\nexport function inputBytes(): number {\n return TX_INPUT_BASE + TX_INPUT_PUBKEYHASH\n}\n\n/**\n * Calculate the average value of an array.\n *\n * @param {number[]} array - The array of numbers.\n * @returns {number} The average value of the array.\n */\nexport function arrayAverage(array: number[]): number {\n let sum = 0\n array.forEach((value) => (sum += value))\n return sum / array.length\n}\n\n/**\n * Get the Dogecoin network configuration to be used with bitcoinjs.\n *\n * @param {Network} network - The network type.\n * @returns {Dogecoin.networks.Network} The Dogecoin network configuration.\n */\nexport const dogeNetwork = (network: Network): Dogecoin.networks.Network => {\n switch (network) {\n case Network.Mainnet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Stagenet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Testnet: {\n // Latest coininfo on NPM doesn't contain dogetest config information\n const bip32 = {\n private: 0x04358394,\n public: 0x043587cf,\n }\n const test = coininfo.dogecoin.test\n test.versions.bip32 = bip32\n return test.toBitcoinJS()\n }\n }\n}\n\n/**\n * Validate a Dogecoin address.\n *\n * @param {Address} address - The Dogecoin address to validate.\n * @param {Network} network - The network type.\n * @returns {boolean} `true` if the address is valid, `false` otherwise.\n */\nexport const validateAddress = (address: Address, network: Network): boolean => {\n try {\n Dogecoin.address.toOutputScript(address, dogeNetwork(network))\n return true\n } catch (error) {\n return false\n }\n}\n\n/**\n * Get the address prefix based on the network.\n *\n * @param {Network} network - The network type.\n * @returns {string} The address prefix based on the network.\n */\nexport const getPrefix = (network: Network) => {\n switch (network) {\n case Network.Mainnet:\n case Network.Stagenet:\n return ''\n case Network.Testnet:\n return 'n'\n }\n}\n","import { AssetInfo, FeeRate, Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, PreparedTx, TxParams, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\nimport accumulative from 'coinselect/accumulative'\n\nimport {\n AssetDOGE,\n BitgoProviders,\n DOGEChain,\n DOGE_DECIMAL,\n LOWER_FEE_BOUND,\n MIN_TX_FEE,\n UPPER_FEE_BOUND,\n blockcypherDataProviders,\n blockstreamExplorerProviders,\n} from './const'\nimport { LedgerTxInfo, LedgerTxInfoParams } from './types/ledger'\nimport * as Utils from './utils'\n/**\n * Default parameters for Dogecoin UTXO client.\n * Contains default values for network, phrase, explorer providers, data providers, root derivation paths, and fee bounds.\n */\nexport const defaultDogeParams: UtxoClientParams = {\n network: Network.Mainnet, // Default network is Mainnet\n phrase: '', // Default empty phrase\n explorerProviders: blockstreamExplorerProviders, // Default explorer providers\n dataProviders: [BitgoProviders, blockcypherDataProviders], // Default data providers\n rootDerivationPaths: {\n [Network.Mainnet]: `m/44'/3'/0'/0/`, // Default root derivation path for Mainnet\n [Network.Stagenet]: `m/44'/3'/0'/0/`, // Default root derivation path for Stagenet\n [Network.Testnet]: `m/44'/1'/0'/0/`, // Default root derivation path for Testnet\n },\n feeBounds: {\n lower: LOWER_FEE_BOUND, // Default lower fee bound\n upper: UPPER_FEE_BOUND, // Default upper fee bound\n },\n}\n/**\n * Custom Dogecoin client extending UTXOClient.\n * Implements methods for Dogecoin-specific functionality.\n */\nabstract class Client extends UTXOClient {\n /**\n * Constructor for initializing the Dogecoin client.\n * Initializes the client with the provided parameters.\n *\n * @param {DogecoinClientParams} params Parameters for initializing the Dogecoin client.\n */\n constructor(params = defaultDogeParams) {\n super(DOGEChain, {\n // Call the superclass constructor with DOGEChain identifier and provided parameters\n network: params.network,\n rootDerivationPaths: params.rootDerivationPaths,\n phrase: params.phrase,\n feeBounds: params.feeBounds,\n explorerProviders: params.explorerProviders,\n dataProviders: params.dataProviders,\n })\n }\n\n /**\n * Get Dogecoin asset information.\n *\n * @returns {AssetInfo} Dogecoin asset information.\n */\n getAssetInfo(): AssetInfo {\n const assetInfo: AssetInfo = {\n asset: AssetDOGE,\n decimal: DOGE_DECIMAL,\n }\n return assetInfo\n }\n\n /**\n * Validate the given address.\n *\n * @param {Address} address The Dogecoin address to validate.\n * @returns {boolean} `true` if the address is valid, otherwise `false`.\n */\n validateAddress(address: string): boolean {\n return Utils.validateAddress(address, this.network)\n }\n\n /**\n * Builds a Dogecoin transaction (PSBT).\n *\n * Builds a Partially Signed Bitcoin Transaction (PSBT) with the specified parameters.\n * @param {BuildParams} params The transaction build options including sender, recipient, amount, memo, and fee rate.\n * @returns {Transaction} A promise that resolves to the built PSBT and the unspent transaction outputs (UTXOs) used in the transaction.\n * @deprecated This method is deprecated. Use the `transfer` method instead.\n */\n public buildTx = async ({\n amount,\n recipient,\n memo,\n feeRate,\n sender,\n }: TxParams & {\n feeRate: FeeRate\n sender: Address\n }): Promise<{ psbt: Dogecoin.Psbt; utxos: UTXO[] }> => {\n // Validate the recipient address\n if (!this.validateAddress(recipient)) throw new Error('Invalid address')\n\n // Scan unspent transaction outputs (UTXOs) for the sender's address\n const utxos = await this.scanUTXOs(sender, false)\n // Throw an error if no UTXOs are found\n if (utxos.length === 0) throw new Error('No UTXOs to send')\n\n // Round the fee rate to the nearest whole number\n const feeRateWhole = Number(feeRate.toFixed(0))\n // Compile the memo if provided\n const compiledMemo = memo ? this.compileMemo(memo) : null\n\n const targetOutputs = []\n //1. Add output for the recipient\n targetOutputs.push({\n address: recipient,\n value: amount.amount().toNumber(),\n })\n //2. Add output for the memo (if provided)\n if (compiledMemo) {\n targetOutputs.push({ script: compiledMemo, value: 0 })\n }\n // Calculate the inputs and outputs for the transaction\n const { inputs, outputs } = accumulative(utxos, targetOutputs, feeRateWhole)\n\n // Throw an error if no solution was found for inputs and outputs\n if (!inputs || !outputs) throw new Error('Balance insufficient for transaction')\n\n // Create a new PSBT for building the transaction\n const psbt = new Dogecoin.Psbt({ network: Utils.dogeNetwork(this.network) })\n // Set the maximum fee rate for the PSBT\n psbt.setMaximumFeeRate(7500000)\n\n // Add inputs to the PSBT\n for (const utxo of inputs) {\n psbt.addInput({\n hash: utxo.hash,\n index: utxo.index,\n nonWitnessUtxo: Buffer.from(utxo.txHex, 'hex'),\n })\n }\n // Outputs\n outputs.forEach((output: Dogecoin.PsbtTxOutput) => {\n if (!output.address) {\n //an empty address means this is the change address\n output.address = sender\n }\n if (!output.script) {\n psbt.addOutput(output)\n } else {\n //we need to add the compiled memo this way to\n //avoid dust error tx when accumulating memo output with 0 value\n if (compiledMemo) {\n psbt.addOutput({ script: compiledMemo, value: 0 })\n }\n }\n })\n\n return { psbt, utxos }\n }\n\n /**\n * Asynchronously creates transaction information for ledger sign.\n *\n * Builds a transaction (PSBT) and prepares necessary information for ledger signing.\n *\n * @param {LedgerTxInfoParams} params The parameters for creating transaction information.\n * @returns {LedgerTxInfo} A promise that resolves to the transaction information used for ledger sign.\n */\n public async createTxInfo(params: LedgerTxInfoParams): Promise<LedgerTxInfo> {\n // Build the transaction (PSBT) and obtain the unspent transaction outputs (UTXOs)\n const { psbt, utxos } = await this.buildTx(params)\n // Construct the ledger transaction information object\n const ledgerTxInfo: LedgerTxInfo = {\n utxos,\n newTxHex: psbt.data.globalMap.unsignedTx.toBuffer().toString('hex'), // Convert unsigned transaction to hexadecimal string\n }\n return ledgerTxInfo\n }\n\n /**\n * Asynchronously prepares a transaction for transfer.\n *\n * Builds a transaction (PSBT) with the specified transfer options.\n * @param {TxParams & { sender: Address; feeRate: FeeRate; spendPendingUTXO?: boolean }} params The transfer options including sender address, fee rate, and optional flag for spending pending UTXOs.\n * @returns {Promise<PreparedTx>} A promise that resolves to the raw unsigned transaction (PSBT).\n */\n async prepareTx({\n sender,\n memo,\n amount,\n recipient,\n feeRate,\n }: TxParams & {\n sender: Address\n feeRate: FeeRate\n spendPendingUTXO?: boolean\n }): Promise<PreparedTx & { utxos: UTXO[] }> {\n // Build the transaction (PSBT) with the specified transfer options\n const { psbt, utxos } = await this.buildTx({\n sender,\n recipient,\n amount,\n feeRate,\n memo,\n })\n\n // Return the raw unsigned transaction (PSBT)\n return { rawUnsignedTx: psbt.toBase64(), utxos }\n }\n\n /**\n * Compiles the memo into a buffer for inclusion in a Dogecoin transaction.\n *\n * @param {string} memo The memo to be compiled.\n * @returns {Buffer} The compiled memo as a buffer.\n */\n protected compileMemo(memo: string): Buffer {\n // Convert the memo to a buffer\n const data = Buffer.from(memo, 'utf8')\n // Compile the OP_RETURN script with the memo data\n return Dogecoin.script.compile([Dogecoin.opcodes.OP_RETURN, data])\n }\n\n /**\n * Calculates the transaction fee based on the provided UTXOs, fee rate, and optional data.\n *\n * @param {UTXO[]} inputs The unspent transaction outputs (UTXOs) used as inputs.\n * @param {FeeRate} feeRate The fee rate for the transaction.\n * @param {Buffer | null} data The compiled memo (optional).\n * @returns {number} The calculated transaction fee.\n */\n protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, data: Buffer | null = null): number {\n // Calculate the size of the transaction\n const inputSizeBasedOnInputs =\n inputs.length > 0\n ? inputs.reduce((a) => a + Utils.inputBytes(), 0) + inputs.length // +1 byte for each input signature\n : 0\n // Calculate the sum of transaction size\n let sum =\n Utils.TX_EMPTY_SIZE +\n inputSizeBasedOnInputs +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH\n\n // Add additional output size if data is provided\n if (data) {\n sum += Utils.TX_OUTPUT_BASE + data.length\n }\n // Calculate the fee based on the sum of transaction size and the fee rate\n const fee = sum * feeRate\n // Ensure the fee is not less than the minimum transaction fee\n return fee > MIN_TX_FEE ? fee : MIN_TX_FEE\n }\n}\n\nexport { Client }\n","import { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing the base Doge client\n\nimport { Client } from './client' // Importing utility functions\nimport * as Utils from './utils'\n/**\n * Custom Doge client extended to support keystore functionality\n */\nclass ClientKeystore extends Client {\n /**\n * Get the Dogecoin address.\n *\n * Generates a Dogecoin address using the provided phrase and index.\n * @param {number} index The index of the address to retrieve. Default is 0.\n * @returns {Address} The Dogecoin address.\n * @throws {\"index must be greater than zero\"} Thrown if the index is less than zero.\n * @throws {\"Phrase must be provided\"} Thrown if the phrase is not provided.\n * @throws {\"Address not defined\"} Thrown if failed to create the address from the phrase.\n */\n getAddress(index = 0): Address {\n if (index < 0) {\n throw new Error('index must be greater than zero')\n }\n if (this.phrase) {\n // Get Dogecoin network and keys\n const dogeNetwork = Utils.dogeNetwork(this.network)\n const dogeKeys = this.getDogeKeys(this.phrase, index)\n // Generate Dogecoin address\n const { address } = Dogecoin.payments.p2pkh({\n pubkey: dogeKeys.publicKey,\n network: dogeNetwork,\n })\n if (!address) {\n throw new Error('Address not defined')\n }\n return address\n }\n throw new Error('Phrase must be provided')\n }\n /**\n * @private\n * Get private key.\n *\n * Private function to get keyPair from the this.phrase\n *\n * @param {string} phrase The phrase to be used for generating privkey\n * @returns {ECPairInterface} The privkey generated from the given phrase\n *\n * @throws {\"Could not get private key from phrase\"} Throws an error if failed creating Doge keys from the given phrase\n * */\n private getDogeKeys(phrase: string, index = 0): Dogecoin.ECPairInterface {\n const dogeNetwork = Utils.dogeNetwork(this.network)\n\n const seed = getSeed(phrase)\n const master = Dogecoin.bip32.fromSeed(seed, dogeNetwork).derivePath(this.getFullDerivationPath(index))\n\n if (!master.privateKey) {\n throw new Error('Could not get private key from phrase')\n }\n\n return Dogecoin.ECPair.fromPrivateKey(master.privateKey, { network: dogeNetwork })\n }\n\n /**\n * Get the current address.\n * Asynchronous version of getAddress method.\n * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)\n * The address is then decoded into type P2WPKH and returned.\n * @returns {Address} The current address.\n *\n * @throws {\"Phrase must be provided\"} Thrown if phrase has not been set before.\n * @throws {\"Address not defined\"} Thrown if failed creating account from phrase.\n */\n async getAddressAsync(index = 0): Promise<string> {\n return this.getAddress(index)\n }\n\n /**\n * Asynchronously transfers Dogecoin.\n *\n * Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.\n * @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.\n * @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.\n */\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n // Determine the fee rate for the transaction, using provided fee rate or fetching it from the network\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n // Check if the fee rate is within the specified fee bounds\n checkFeeBounds(this.feeBounds, feeRate)\n\n // Get the index of the sender's address or use the default index (0)\n const fromAddressIndex = params?.walletIndex || 0\n // Prepare the transaction by building it with the specified parameters\n const { rawUnsignedTx } = await this.prepareTx({\n ...params,\n feeRate,\n sender: await this.getAddressAsync(fromAddressIndex),\n })\n // Get the Dogecoin keys for signing the transaction\n const dogeKeys = this.getDogeKeys(this.phrase, fromAddressIndex)\n // Create a Partially Signed Bitcoin Transaction (PSBT) from the raw unsigned transaction\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx, { maximumFeeRate: 7500000 })\n // Sign all inputs of the transaction with the Dogecoin keys\n psbt.signAllInputs(dogeKeys)\n // Finalize all inputs of the transaction\n psbt.finalizeAllInputs()\n // Extract the signed transaction and format it to hexadecimal\n const txHex = psbt.extractTransaction().toHex()\n // Broadcast the signed transaction to the Dogecoin network and return the transaction hash\n return await this.roundRobinBroadcastTx(txHex)\n }\n}\nexport { ClientKeystore }\n","import AppBtc from '@ledgerhq/hw-app-btc'\nimport { Transaction } from '@ledgerhq/hw-app-btc/lib/types'\nimport { FeeOption, FeeRate, TxHash } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\n\nimport { Client } from './client'\n/**\n * Custom Ledger Bitcoin client\n */\nclass ClientLedger extends Client {\n // Reference to the Ledger transport object\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private transport: any // TODO: Parametrize\n private app: AppBtc | undefined\n\n // Constructor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(params: UtxoClientParams & { transport: any }) {\n super(params)\n this.transport = params.transport\n }\n\n // Get the Ledger Doge application instance\n public async getApp(): Promise<AppBtc> {\n if (this.app) {\n return this.app\n }\n this.app = new AppBtc({ transport: this.transport, currency: 'dogecoin' })\n return this.app\n }\n\n // Get the current address synchronously\n getAddress(): string {\n throw Error('Sync method not supported for Ledger')\n }\n\n // Get the current address asynchronously\n async getAddressAsync(index = 0, verify = false): Promise<Address> {\n const app = await this.getApp()\n const result = await app.getWalletPublicKey(this.getFullDerivationPath(index), {\n format: 'legacy',\n verify,\n })\n return result.bitcoinAddress\n }\n\n // Transfer Doge from Ledger\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n const app = await this.getApp()\n const fromAddressIndex = params?.walletIndex || 0\n // Get fee rate\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n // Get sender address\n const sender = await this.getAddressAsync(fromAddressIndex)\n // Prepare transaction\n const { rawUnsignedTx, utxos } = await this.prepareTx({ ...params, sender, feeRate })\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx)\n // Prepare Ledger inputs\n const ledgerInputs: Array<[Transaction, number, string | null, number | null]> = utxos.map(\n ({ txHex, hash, index }) => {\n if (!txHex) {\n throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`)\n }\n const splittedTx = app.splitTransaction(txHex, false /* no segwit support */)\n return [splittedTx, index, null, null]\n },\n )\n\n // Prepare associated keysets\n const associatedKeysets = ledgerInputs.map(() => this.getFullDerivationPath(fromAddressIndex))\n // Convert the raw unsigned transaction to a Transaction object\n // Serialize unsigned transaction\n const unsignedHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex')\n const newTx = app.splitTransaction(unsignedHex, true)\n const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex')\n const txHex = await app.createPaymentTransaction({\n inputs: ledgerInputs,\n associatedKeysets,\n outputScriptHex,\n // no additionals - similar to https://github.com/shapeshift/hdwallet/blob/a61234eb83081a4de54750b8965b873b15803a03/packages/hdwallet-ledger/src/bitcoin.ts#L222\n additionals: [],\n })\n\n const txHash = await this.broadcastTx(txHex)\n // Throw error if no transaction hash is received\n if (!txHash) {\n throw Error('No Tx hash')\n }\n\n return txHash\n }\n}\nexport { ClientLedger }\n","import { Network } from '@xchainjs/xchain-client'\n\n/**\n * Function to get the URL for sending a transaction based on the network and Blockcypher URL.\n * Throws an error if the network is 'testnet' since the testnet URL is not available for Blockcypher.\n * @param {object} params Object containing the Blockcypher URL and network type.\n * @param {string} params.blockcypherUrl The Blockcypher URL.\n * @param {Network} params.network The network type (Mainnet, Testnet, or Stagenet).\n * @returns {string} The URL for sending a transaction.\n */\nexport const getSendTxUrl = ({ blockcypherUrl, network }: { blockcypherUrl: string; network: Network }): string => {\n if (network === 'testnet') {\n // Check if the network is testnet\n throw new Error('Testnet URL is not available for Blockcypher') // Throw an error if testnet URL is requested\n } else {\n return `${blockcypherUrl}/doge/main/txs/push` // Return the mainnet URL for sending a transaction\n }\n}\n"],"names":["require$$0","accumulative","UTXOClient","Utils.dogeNetwork","Utils.validateAddress","Utils.inputBytes","Utils.TX_EMPTY_SIZE","Utils.TX_OUTPUT_BASE","Utils.TX_OUTPUT_PUBKEYHASH","dogeNetwork"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;CACA,IAAI,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;CACjC,IAAI,aAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;CAClC,IAAI,mBAAmB,GAAG,IAAG;AAC7B,CAAA,IAAI,cAAc,GAAG,CAAC,GAAG,EAAC;CAC1B,IAAI,oBAAoB,GAAG,GAAE;AAC7B;CACA,SAAS,UAAU,EAAE,KAAK,EAAE;AAC5B,GAAE,OAAO,aAAa,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAC;EAClF;AACD;CACA,SAAS,WAAW,EAAE,MAAM,EAAE;AAC9B,GAAE,OAAO,cAAc,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC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1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../node_modules/coinselect/utils.js","../../../node_modules/coinselect/accumulative.js","../src/const.ts","../src/utils.ts","../src/client.ts","../src/clientKeystore.ts","../src/clientLedger.ts","../src/blockcypher-api.ts"],"sourcesContent":["// baseline estimates, used to improve performance\nvar TX_EMPTY_SIZE = 4 + 1 + 1 + 4\nvar TX_INPUT_BASE = 32 + 4 + 1 + 4\nvar TX_INPUT_PUBKEYHASH = 107\nvar TX_OUTPUT_BASE = 8 + 1\nvar TX_OUTPUT_PUBKEYHASH = 25\n\nfunction inputBytes (input) {\n return TX_INPUT_BASE + (input.script ? input.script.length : TX_INPUT_PUBKEYHASH)\n}\n\nfunction outputBytes (output) {\n return TX_OUTPUT_BASE + (output.script ? output.script.length : TX_OUTPUT_PUBKEYHASH)\n}\n\nfunction dustThreshold (output, feeRate) {\n /* ... classify the output for input estimate */\n return inputBytes({}) * feeRate\n}\n\nfunction transactionBytes (inputs, outputs) {\n return TX_EMPTY_SIZE +\n inputs.reduce(function (a, x) { return a + inputBytes(x) }, 0) +\n outputs.reduce(function (a, x) { return a + outputBytes(x) }, 0)\n}\n\nfunction uintOrNaN (v) {\n if (typeof v !== 'number') return NaN\n if (!isFinite(v)) return NaN\n if (Math.floor(v) !== v) return NaN\n if (v < 0) return NaN\n return v\n}\n\nfunction sumForgiving (range) {\n return range.reduce(function (a, x) { return a + (isFinite(x.value) ? x.value : 0) }, 0)\n}\n\nfunction sumOrNaN (range) {\n return range.reduce(function (a, x) { return a + uintOrNaN(x.value) }, 0)\n}\n\nvar BLANK_OUTPUT = outputBytes({})\n\nfunction finalize (inputs, outputs, feeRate) {\n var bytesAccum = transactionBytes(inputs, outputs)\n var feeAfterExtraOutput = feeRate * (bytesAccum + BLANK_OUTPUT)\n var remainderAfterExtraOutput = sumOrNaN(inputs) - (sumOrNaN(outputs) + feeAfterExtraOutput)\n\n // is it worth a change output?\n if (remainderAfterExtraOutput > dustThreshold({}, feeRate)) {\n outputs = outputs.concat({ value: remainderAfterExtraOutput })\n }\n\n var fee = sumOrNaN(inputs) - sumOrNaN(outputs)\n if (!isFinite(fee)) return { fee: feeRate * bytesAccum }\n\n return {\n inputs: inputs,\n outputs: outputs,\n fee: fee\n }\n}\n\nmodule.exports = {\n dustThreshold: dustThreshold,\n finalize: finalize,\n inputBytes: inputBytes,\n outputBytes: outputBytes,\n sumOrNaN: sumOrNaN,\n sumForgiving: sumForgiving,\n transactionBytes: transactionBytes,\n uintOrNaN: uintOrNaN\n}\n","var utils = require('./utils')\n\n// add inputs until we reach or surpass the target value (or deplete)\n// worst-case: O(n)\nmodule.exports = function accumulative (utxos, outputs, feeRate) {\n if (!isFinite(utils.uintOrNaN(feeRate))) return {}\n var bytesAccum = utils.transactionBytes([], outputs)\n\n var inAccum = 0\n var inputs = []\n var outAccum = utils.sumOrNaN(outputs)\n\n for (var i = 0; i < utxos.length; ++i) {\n var utxo = utxos[i]\n var utxoBytes = utils.inputBytes(utxo)\n var utxoFee = feeRate * utxoBytes\n var utxoValue = utils.uintOrNaN(utxo.value)\n\n // skip detrimental input\n if (utxoFee > utxo.value) {\n if (i === utxos.length - 1) return { fee: feeRate * (bytesAccum + utxoBytes) }\n continue\n }\n\n bytesAccum += utxoBytes\n inAccum += utxoValue\n inputs.push(utxo)\n\n var fee = feeRate * bytesAccum\n\n // go again?\n if (inAccum < outAccum + fee) continue\n\n return utils.finalize(inputs, outputs, feeRate)\n }\n\n return { fee: feeRate * bytesAccum }\n}\n","import { ExplorerProvider, Network } from '@xchainjs/xchain-client'\nimport { Asset, AssetType } from '@xchainjs/xchain-util'\nimport {\n BitgoProvider,\n BlockcypherNetwork,\n BlockcypherProvider,\n SochainNetwork,\n SochainProvider,\n UtxoOnlineDataProviders,\n} from '@xchainjs/xchain-utxo-providers'\n/**\n * Minimum transaction fee for Dogecoin transactions.\n * Defined as 100000 satoshi/kB.\n * @see https://github.com/dogecoin/dogecoin/blob/master/src/validation.h#L58\n */\nexport const MIN_TX_FEE = 100000\n\n/**\n * Decimal places for Dogecoin.\n */\nexport const DOGE_DECIMAL = 8\n\n/**\n * Lower fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const LOWER_FEE_BOUND = 100\n\n/**\n * Upper fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const UPPER_FEE_BOUND = 20_000_000\n\n/**\n * Chain identifier for Dogecoin.\n */\nexport const DOGEChain = 'DOGE' as const\n\n/**\n * Base asset object for Dogecoin.\n * Represents the Dogecoin asset in various contexts.\n */\nexport const AssetDOGE: Asset = { chain: DOGEChain, symbol: 'DOGE', ticker: 'DOGE', type: AssetType.NATIVE }\n\n/**\n * Explorer provider for Dogecoin mainnet and testnet.\n * Provides URLs for exploring Dogecoin transactions and addresses.\n */\nconst DOGE_MAINNET_EXPLORER = new ExplorerProvider(\n 'https://blockchair.com/dogecoin',\n 'https://blockchair.com/dogecoin/address/%%ADDRESS%%',\n 'https://blockchair.com/dogecoin/transaction/%%TX_ID%%',\n)\nconst DOGE_TESTNET_EXPLORER = new ExplorerProvider(\n 'https://blockexplorer.one/dogecoin/testnet',\n 'https://blockexplorer.one/dogecoin/testnet/address/%%ADDRESS%%',\n 'https://blockexplorer.one/dogecoin/testnet/tx/%%TX_ID%%',\n)\nexport const blockstreamExplorerProviders = {\n [Network.Testnet]: DOGE_TESTNET_EXPLORER,\n [Network.Stagenet]: DOGE_MAINNET_EXPLORER,\n [Network.Mainnet]: DOGE_MAINNET_EXPLORER,\n}\n\n/**\n * Sochain data providers for Dogecoin mainnet and testnet.\n * Provides API access to Sochain for Dogecoin.\n */\nconst testnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGETEST,\n)\nconst mainnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGE,\n)\nexport const sochainDataProviders = {\n [Network.Testnet]: testnetSochainProvider,\n [Network.Stagenet]: mainnetSochainProvider,\n [Network.Mainnet]: mainnetSochainProvider,\n}\n\n/**\n * Blockcypher data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Blockcypher for Dogecoin.\n */\nconst mainnetBlockcypherProvider = new BlockcypherProvider(\n 'https://api.blockcypher.com/v1',\n DOGEChain,\n AssetDOGE,\n 8,\n BlockcypherNetwork.DOGE,\n process.env.BLOCKCYPHER_API_KEY || '',\n)\nexport const blockcypherDataProviders = {\n [Network.Testnet]: undefined, //no provider here\n [Network.Stagenet]: mainnetBlockcypherProvider,\n [Network.Mainnet]: mainnetBlockcypherProvider,\n}\n\n/**\n * Bitgo data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Bitgo for Dogecoin.\n */\nconst mainnetBitgoProvider = new BitgoProvider({\n baseUrl: 'https://app.bitgo.com',\n chain: DOGEChain,\n})\n\nexport const BitgoProviders: UtxoOnlineDataProviders = {\n [Network.Testnet]: undefined,\n [Network.Stagenet]: mainnetBitgoProvider,\n [Network.Mainnet]: mainnetBitgoProvider,\n}\n","/**\n * Import statements for required modules and types.\n */\nimport { Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing bitcoinjs-lib for Dogecoin operations\nimport coininfo from 'coininfo' // Importing coininfo for cryptocurrency information retrieval\n\n/**\n * Constant values representing transaction sizes and lengths.\n */\nexport const TX_EMPTY_SIZE = 4 + 1 + 1 + 4 // 10\nexport const TX_INPUT_BASE = 32 + 4 + 1 + 4 // 41\nexport const TX_INPUT_PUBKEYHASH = 107\nexport const TX_OUTPUT_BASE = 8 + 1 // 9\nexport const TX_OUTPUT_PUBKEYHASH = 25\n\n/**\n * Calculate the number of bytes required for an input.\n *\n * @returns {number} The number of bytes required for an input.\n */\nexport function inputBytes(): number {\n return TX_INPUT_BASE + TX_INPUT_PUBKEYHASH\n}\n\n/**\n * Calculate the average value of an array.\n *\n * @param {number[]} array - The array of numbers.\n * @returns {number} The average value of the array.\n */\nexport function arrayAverage(array: number[]): number {\n let sum = 0\n array.forEach((value) => (sum += value))\n return sum / array.length\n}\n\n/**\n * Get the Dogecoin network configuration to be used with bitcoinjs.\n *\n * @param {Network} network - The network type.\n * @returns {Dogecoin.networks.Network} The Dogecoin network configuration.\n */\nexport const dogeNetwork = (network: Network): Dogecoin.networks.Network => {\n switch (network) {\n case Network.Mainnet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Stagenet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Testnet: {\n // Latest coininfo on NPM doesn't contain dogetest config information\n const bip32 = {\n private: 0x04358394,\n public: 0x043587cf,\n }\n const test = coininfo.dogecoin.test\n test.versions.bip32 = bip32\n return test.toBitcoinJS()\n }\n }\n}\n\n/**\n * Validate a Dogecoin address.\n *\n * @param {Address} address - The Dogecoin address to validate.\n * @param {Network} network - The network type.\n * @returns {boolean} `true` if the address is valid, `false` otherwise.\n */\nexport const validateAddress = (address: Address, network: Network): boolean => {\n try {\n Dogecoin.address.toOutputScript(address, dogeNetwork(network))\n return true\n } catch (error) {\n return false\n }\n}\n\n/**\n * Get the address prefix based on the network.\n *\n * @param {Network} network - The network type.\n * @returns {string} The address prefix based on the network.\n */\nexport const getPrefix = (network: Network) => {\n switch (network) {\n case Network.Mainnet:\n case Network.Stagenet:\n return ''\n case Network.Testnet:\n return 'n'\n }\n}\n","import { AssetInfo, FeeRate, Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, PreparedTx, TxParams, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\nimport accumulative from 'coinselect/accumulative'\n\nimport {\n AssetDOGE,\n BitgoProviders,\n DOGEChain,\n DOGE_DECIMAL,\n LOWER_FEE_BOUND,\n MIN_TX_FEE,\n UPPER_FEE_BOUND,\n blockcypherDataProviders,\n blockstreamExplorerProviders,\n} from './const'\nimport { LedgerTxInfo, LedgerTxInfoParams } from './types/ledger'\nimport * as Utils from './utils'\n/**\n * Default parameters for Dogecoin UTXO client.\n * Contains default values for network, phrase, explorer providers, data providers, root derivation paths, and fee bounds.\n */\nexport const defaultDogeParams: UtxoClientParams = {\n network: Network.Mainnet, // Default network is Mainnet\n phrase: '', // Default empty phrase\n explorerProviders: blockstreamExplorerProviders, // Default explorer providers\n dataProviders: [BitgoProviders, blockcypherDataProviders], // Default data providers\n rootDerivationPaths: {\n [Network.Mainnet]: `m/44'/3'/0'/0/`, // Default root derivation path for Mainnet\n [Network.Stagenet]: `m/44'/3'/0'/0/`, // Default root derivation path for Stagenet\n [Network.Testnet]: `m/44'/1'/0'/0/`, // Default root derivation path for Testnet\n },\n feeBounds: {\n lower: LOWER_FEE_BOUND, // Default lower fee bound\n upper: UPPER_FEE_BOUND, // Default upper fee bound\n },\n}\n/**\n * Custom Dogecoin client extending UTXOClient.\n * Implements methods for Dogecoin-specific functionality.\n */\nabstract class Client extends UTXOClient {\n /**\n * Constructor for initializing the Dogecoin client.\n * Initializes the client with the provided parameters.\n *\n * @param {DogecoinClientParams} params Parameters for initializing the Dogecoin client.\n */\n constructor(params = defaultDogeParams) {\n super(DOGEChain, {\n // Call the superclass constructor with DOGEChain identifier and provided parameters\n network: params.network,\n rootDerivationPaths: params.rootDerivationPaths,\n phrase: params.phrase,\n feeBounds: params.feeBounds,\n explorerProviders: params.explorerProviders,\n dataProviders: params.dataProviders,\n })\n }\n\n /**\n * Get Dogecoin asset information.\n *\n * @returns {AssetInfo} Dogecoin asset information.\n */\n getAssetInfo(): AssetInfo {\n const assetInfo: AssetInfo = {\n asset: AssetDOGE,\n decimal: DOGE_DECIMAL,\n }\n return assetInfo\n }\n\n /**\n * Validate the given address.\n *\n * @param {Address} address The Dogecoin address to validate.\n * @returns {boolean} `true` if the address is valid, otherwise `false`.\n */\n validateAddress(address: string): boolean {\n return Utils.validateAddress(address, this.network)\n }\n\n /**\n * Builds a Dogecoin transaction (PSBT).\n *\n * Builds a Partially Signed Bitcoin Transaction (PSBT) with the specified parameters.\n * @param {BuildParams} params The transaction build options including sender, recipient, amount, memo, and fee rate.\n * @returns {Transaction} A promise that resolves to the built PSBT and the unspent transaction outputs (UTXOs) used in the transaction.\n * @deprecated This method is deprecated. Use the `transfer` method instead.\n */\n public buildTx = async ({\n amount,\n recipient,\n memo,\n feeRate,\n sender,\n }: TxParams & {\n feeRate: FeeRate\n sender: Address\n }): Promise<{ psbt: Dogecoin.Psbt; utxos: UTXO[]; inputs: UTXO[] }> => {\n // Validate the recipient address\n if (!this.validateAddress(recipient)) throw new Error('Invalid address')\n\n // Scan unspent transaction outputs (UTXOs) for the sender's address\n const utxos = await this.scanUTXOs(sender, false)\n // Throw an error if no UTXOs are found\n if (utxos.length === 0) throw new Error('No UTXOs to send')\n\n // Round the fee rate to the nearest whole number\n const feeRateWhole = Number(feeRate.toFixed(0))\n // Compile the memo if provided\n const compiledMemo = memo ? this.compileMemo(memo) : null\n\n const targetOutputs = []\n //1. Add output for the recipient\n targetOutputs.push({\n address: recipient,\n value: amount.amount().toNumber(),\n })\n //2. Add output for the memo (if provided)\n if (compiledMemo) {\n targetOutputs.push({ script: compiledMemo, value: 0 })\n }\n // Calculate the inputs and outputs for the transaction\n const { inputs, outputs } = accumulative(utxos, targetOutputs, feeRateWhole)\n\n // Throw an error if no solution was found for inputs and outputs\n if (!inputs || !outputs) throw new Error('Balance insufficient for transaction')\n\n // Create a new PSBT for building the transaction\n const psbt = new Dogecoin.Psbt({ network: Utils.dogeNetwork(this.network) })\n // Set the maximum fee rate for the PSBT\n psbt.setMaximumFeeRate(7500000)\n\n // Add inputs to the PSBT\n for (const utxo of inputs) {\n psbt.addInput({\n hash: utxo.hash,\n index: utxo.index,\n nonWitnessUtxo: Buffer.from(utxo.txHex, 'hex'),\n })\n }\n // Outputs\n outputs.forEach((output: Dogecoin.PsbtTxOutput) => {\n if (!output.address) {\n //an empty address means this is the change address\n output.address = sender\n }\n if (!output.script) {\n psbt.addOutput(output)\n } else {\n //we need to add the compiled memo this way to\n //avoid dust error tx when accumulating memo output with 0 value\n if (compiledMemo) {\n psbt.addOutput({ script: compiledMemo, value: 0 })\n }\n }\n })\n\n return { psbt, utxos, inputs }\n }\n\n /**\n * Asynchronously creates transaction information for ledger sign.\n *\n * Builds a transaction (PSBT) and prepares necessary information for ledger signing.\n *\n * @param {LedgerTxInfoParams} params The parameters for creating transaction information.\n * @returns {LedgerTxInfo} A promise that resolves to the transaction information used for ledger sign.\n */\n public async createTxInfo(params: LedgerTxInfoParams): Promise<LedgerTxInfo> {\n // Build the transaction (PSBT) and obtain the unspent transaction outputs (UTXOs)\n const { psbt, utxos } = await this.buildTx(params)\n // Construct the ledger transaction information object\n const ledgerTxInfo: LedgerTxInfo = {\n utxos,\n newTxHex: psbt.data.globalMap.unsignedTx.toBuffer().toString('hex'), // Convert unsigned transaction to hexadecimal string\n }\n return ledgerTxInfo\n }\n\n /**\n * Asynchronously prepares a transaction for transfer.\n *\n * Builds a transaction (PSBT) with the specified transfer options.\n * @param {TxParams & { sender: Address; feeRate: FeeRate; spendPendingUTXO?: boolean }} params The transfer options including sender address, fee rate, and optional flag for spending pending UTXOs.\n * @returns {Promise<PreparedTx>} A promise that resolves to the raw unsigned transaction (PSBT).\n */\n async prepareTx({\n sender,\n memo,\n amount,\n recipient,\n feeRate,\n }: TxParams & {\n sender: Address\n feeRate: FeeRate\n spendPendingUTXO?: boolean\n }): Promise<PreparedTx & { utxos: UTXO[]; inputs: UTXO[] }> {\n // Build the transaction (PSBT) with the specified transfer options\n const { psbt, utxos, inputs } = await this.buildTx({\n sender,\n recipient,\n amount,\n feeRate,\n memo,\n })\n\n // Return the raw unsigned transaction (PSBT)\n return { rawUnsignedTx: psbt.toBase64(), utxos, inputs }\n }\n\n /**\n * Compiles the memo into a buffer for inclusion in a Dogecoin transaction.\n *\n * @param {string} memo The memo to be compiled.\n * @returns {Buffer} The compiled memo as a buffer.\n */\n protected compileMemo(memo: string): Buffer {\n // Convert the memo to a buffer\n const data = Buffer.from(memo, 'utf8')\n // Compile the OP_RETURN script with the memo data\n return Dogecoin.script.compile([Dogecoin.opcodes.OP_RETURN, data])\n }\n\n /**\n * Calculates the transaction fee based on the provided UTXOs, fee rate, and optional data.\n *\n * @param {UTXO[]} inputs The unspent transaction outputs (UTXOs) used as inputs.\n * @param {FeeRate} feeRate The fee rate for the transaction.\n * @param {Buffer | null} data The compiled memo (optional).\n * @returns {number} The calculated transaction fee.\n */\n protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, data: Buffer | null = null): number {\n // Calculate the size of the transaction\n const inputSizeBasedOnInputs =\n inputs.length > 0\n ? inputs.reduce((a) => a + Utils.inputBytes(), 0) + inputs.length // +1 byte for each input signature\n : 0\n // Calculate the sum of transaction size\n let sum =\n Utils.TX_EMPTY_SIZE +\n inputSizeBasedOnInputs +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH\n\n // Add additional output size if data is provided\n if (data) {\n sum += Utils.TX_OUTPUT_BASE + data.length\n }\n // Calculate the fee based on the sum of transaction size and the fee rate\n const fee = sum * feeRate\n // Ensure the fee is not less than the minimum transaction fee\n return fee > MIN_TX_FEE ? fee : MIN_TX_FEE\n }\n}\n\nexport { Client }\n","import { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing the base Doge client\n\nimport { Client } from './client' // Importing utility functions\nimport * as Utils from './utils'\n/**\n * Custom Doge client extended to support keystore functionality\n */\nclass ClientKeystore extends Client {\n /**\n * Get the Dogecoin address.\n *\n * Generates a Dogecoin address using the provided phrase and index.\n * @param {number} index The index of the address to retrieve. Default is 0.\n * @returns {Address} The Dogecoin address.\n * @throws {\"index must be greater than zero\"} Thrown if the index is less than zero.\n * @throws {\"Phrase must be provided\"} Thrown if the phrase is not provided.\n * @throws {\"Address not defined\"} Thrown if failed to create the address from the phrase.\n */\n getAddress(index = 0): Address {\n if (index < 0) {\n throw new Error('index must be greater than zero')\n }\n if (this.phrase) {\n // Get Dogecoin network and keys\n const dogeNetwork = Utils.dogeNetwork(this.network)\n const dogeKeys = this.getDogeKeys(this.phrase, index)\n // Generate Dogecoin address\n const { address } = Dogecoin.payments.p2pkh({\n pubkey: dogeKeys.publicKey,\n network: dogeNetwork,\n })\n if (!address) {\n throw new Error('Address not defined')\n }\n return address\n }\n throw new Error('Phrase must be provided')\n }\n /**\n * @private\n * Get private key.\n *\n * Private function to get keyPair from the this.phrase\n *\n * @param {string} phrase The phrase to be used for generating privkey\n * @returns {ECPairInterface} The privkey generated from the given phrase\n *\n * @throws {\"Could not get private key from phrase\"} Throws an error if failed creating Doge keys from the given phrase\n * */\n private getDogeKeys(phrase: string, index = 0): Dogecoin.ECPairInterface {\n const dogeNetwork = Utils.dogeNetwork(this.network)\n\n const seed = getSeed(phrase)\n const master = Dogecoin.bip32.fromSeed(seed, dogeNetwork).derivePath(this.getFullDerivationPath(index))\n\n if (!master.privateKey) {\n throw new Error('Could not get private key from phrase')\n }\n\n return Dogecoin.ECPair.fromPrivateKey(master.privateKey, { network: dogeNetwork })\n }\n\n /**\n * Get the current address.\n * Asynchronous version of getAddress method.\n * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)\n * The address is then decoded into type P2WPKH and returned.\n * @returns {Address} The current address.\n *\n * @throws {\"Phrase must be provided\"} Thrown if phrase has not been set before.\n * @throws {\"Address not defined\"} Thrown if failed creating account from phrase.\n */\n async getAddressAsync(index = 0): Promise<string> {\n return this.getAddress(index)\n }\n\n /**\n * Asynchronously transfers Dogecoin.\n *\n * Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.\n * @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.\n * @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.\n */\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n // Determine the fee rate for the transaction, using provided fee rate or fetching it from the network\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n // Check if the fee rate is within the specified fee bounds\n checkFeeBounds(this.feeBounds, feeRate)\n\n // Get the index of the sender's address or use the default index (0)\n const fromAddressIndex = params?.walletIndex || 0\n // Prepare the transaction by building it with the specified parameters\n const { rawUnsignedTx } = await this.prepareTx({\n ...params,\n feeRate,\n sender: await this.getAddressAsync(fromAddressIndex),\n })\n // Get the Dogecoin keys for signing the transaction\n const dogeKeys = this.getDogeKeys(this.phrase, fromAddressIndex)\n // Create a Partially Signed Bitcoin Transaction (PSBT) from the raw unsigned transaction\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx, { maximumFeeRate: 7500000 })\n // Sign all inputs of the transaction with the Dogecoin keys\n psbt.signAllInputs(dogeKeys)\n // Finalize all inputs of the transaction\n psbt.finalizeAllInputs()\n // Extract the signed transaction and format it to hexadecimal\n const txHex = psbt.extractTransaction().toHex()\n // Broadcast the signed transaction to the Dogecoin network and return the transaction hash\n return await this.roundRobinBroadcastTx(txHex)\n }\n}\nexport { ClientKeystore }\n","import AppBtc from '@ledgerhq/hw-app-btc'\nimport { Transaction } from '@ledgerhq/hw-app-btc/lib/types'\nimport { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\n\nimport { Client } from './client'\n/**\n * Custom Ledger Bitcoin client\n */\nclass ClientLedger extends Client {\n // Reference to the Ledger transport object\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private transport: any // TODO: Parametrize\n private app: AppBtc | undefined\n\n // Constructor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(params: UtxoClientParams & { transport: any }) {\n super(params)\n this.transport = params.transport\n }\n\n // Get the Ledger Doge application instance\n public async getApp(): Promise<AppBtc> {\n if (this.app) {\n return this.app\n }\n this.app = new AppBtc({ transport: this.transport, currency: 'dogecoin' })\n return this.app\n }\n\n // Get the current address synchronously\n getAddress(): string {\n throw Error('Sync method not supported for Ledger')\n }\n\n // Get the current address asynchronously\n async getAddressAsync(index = 0, verify = false): Promise<Address> {\n const app = await this.getApp()\n const result = await app.getWalletPublicKey(this.getFullDerivationPath(index), {\n format: 'legacy',\n verify,\n })\n return result.bitcoinAddress\n }\n\n // Transfer Doge from Ledger\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n const app = await this.getApp()\n const fromAddressIndex = params?.walletIndex || 0\n // Get fee rate\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n checkFeeBounds(this.feeBounds, feeRate)\n // Get sender address\n const sender = await this.getAddressAsync(fromAddressIndex)\n // Prepare transaction\n const { rawUnsignedTx, inputs } = await this.prepareTx({ ...params, sender, feeRate })\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx)\n // Prepare Ledger inputs\n const ledgerInputs: Array<[Transaction, number, string | null, number | null]> = inputs.map(\n ({ txHex, hash, index }) => {\n if (!txHex) {\n throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`)\n }\n const splittedTx = app.splitTransaction(txHex, false /* no segwit support */)\n return [splittedTx, index, null, null]\n },\n )\n\n // Prepare associated keysets\n const associatedKeysets = ledgerInputs.map(() => this.getFullDerivationPath(fromAddressIndex))\n // Convert the raw unsigned transaction to a Transaction object\n // Serialize unsigned transaction\n const unsignedHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex')\n const newTx = app.splitTransaction(unsignedHex, true)\n const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex')\n const txHex = await app.createPaymentTransaction({\n inputs: ledgerInputs,\n associatedKeysets,\n outputScriptHex,\n // no additionals - similar to https://github.com/shapeshift/hdwallet/blob/a61234eb83081a4de54750b8965b873b15803a03/packages/hdwallet-ledger/src/bitcoin.ts#L222\n additionals: [],\n })\n\n const txHash = await this.broadcastTx(txHex)\n // Throw error if no transaction hash is received\n if (!txHash) {\n throw Error('No Tx hash')\n }\n\n return txHash\n }\n}\nexport { ClientLedger }\n","import { Network } from '@xchainjs/xchain-client'\n\n/**\n * Function to get the URL for sending a transaction based on the network and Blockcypher URL.\n * Throws an error if the network is 'testnet' since the testnet URL is not available for Blockcypher.\n * @param {object} params Object containing the Blockcypher URL and network type.\n * @param {string} params.blockcypherUrl The Blockcypher URL.\n * @param {Network} params.network The network type (Mainnet, Testnet, or Stagenet).\n * @returns {string} The URL for sending a transaction.\n */\nexport const getSendTxUrl = ({ blockcypherUrl, network }: { blockcypherUrl: string; network: Network }): string => {\n if (network === 'testnet') {\n // Check if the network is testnet\n throw new Error('Testnet URL is not available for Blockcypher') // Throw an error if testnet URL is requested\n } else {\n return `${blockcypherUrl}/doge/main/txs/push` // Return the mainnet URL for sending a transaction\n }\n}\n"],"names":["require$$0","accumulative","UTXOClient","Utils.dogeNetwork","Utils.validateAddress","Utils.inputBytes","Utils.TX_EMPTY_SIZE","Utils.TX_OUTPUT_BASE","Utils.TX_OUTPUT_PUBKEYHASH","dogeNetwork"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;CACA,IAAI,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;CACjC,IAAI,aAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;CAClC,IAAI,mBAA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,CAAC,CAAA;;YAE5C,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,MAAM,KAAK,CAAC,YAAY,CAAC,CAAA;AAC1B,aAAA;AAED,YAAA,OAAO,MAAM,CAAA;SACd,CAAA,CAAA;AAAA,KAAA;AACF;;AC5FD;;;;;;;AAOG;AACU,MAAA,YAAY,GAAG,CAAC,EAAE,cAAc,EAAE,OAAO,EAAgD,KAAY;IAChH,IAAI,OAAO,KAAK,SAAS,EAAE;;AAEzB,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;AAChE,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,CAAG,EAAA,cAAc,CAAqB,mBAAA,CAAA,CAAA;AAC9C,KAAA;AACH;;;;","x_google_ignoreList":[0,1]}
|
package/lib/index.js
CHANGED
|
@@ -459,7 +459,7 @@ class Client extends xchainUtxo.Client {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
});
|
|
462
|
-
return { psbt, utxos };
|
|
462
|
+
return { psbt, utxos, inputs };
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
@@ -513,7 +513,7 @@ class Client extends xchainUtxo.Client {
|
|
|
513
513
|
prepareTx({ sender, memo, amount, recipient, feeRate, }) {
|
|
514
514
|
return __awaiter(this, void 0, void 0, function* () {
|
|
515
515
|
// Build the transaction (PSBT) with the specified transfer options
|
|
516
|
-
const { psbt, utxos } = yield this.buildTx({
|
|
516
|
+
const { psbt, utxos, inputs } = yield this.buildTx({
|
|
517
517
|
sender,
|
|
518
518
|
recipient,
|
|
519
519
|
amount,
|
|
@@ -521,7 +521,7 @@ class Client extends xchainUtxo.Client {
|
|
|
521
521
|
memo,
|
|
522
522
|
});
|
|
523
523
|
// Return the raw unsigned transaction (PSBT)
|
|
524
|
-
return { rawUnsignedTx: psbt.toBase64(), utxos };
|
|
524
|
+
return { rawUnsignedTx: psbt.toBase64(), utxos, inputs };
|
|
525
525
|
});
|
|
526
526
|
}
|
|
527
527
|
/**
|
|
@@ -711,13 +711,14 @@ class ClientLedger extends Client {
|
|
|
711
711
|
const fromAddressIndex = (params === null || params === void 0 ? void 0 : params.walletIndex) || 0;
|
|
712
712
|
// Get fee rate
|
|
713
713
|
const feeRate = params.feeRate || (yield this.getFeeRates())[xchainClient.FeeOption.Fast];
|
|
714
|
+
xchainClient.checkFeeBounds(this.feeBounds, feeRate);
|
|
714
715
|
// Get sender address
|
|
715
716
|
const sender = yield this.getAddressAsync(fromAddressIndex);
|
|
716
717
|
// Prepare transaction
|
|
717
|
-
const { rawUnsignedTx,
|
|
718
|
+
const { rawUnsignedTx, inputs } = yield this.prepareTx(Object.assign(Object.assign({}, params), { sender, feeRate }));
|
|
718
719
|
const psbt = Dogecoin__namespace.Psbt.fromBase64(rawUnsignedTx);
|
|
719
720
|
// Prepare Ledger inputs
|
|
720
|
-
const ledgerInputs =
|
|
721
|
+
const ledgerInputs = inputs.map(({ txHex, hash, index }) => {
|
|
721
722
|
if (!txHex) {
|
|
722
723
|
throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`);
|
|
723
724
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../node_modules/coinselect/utils.js","../../../node_modules/coinselect/accumulative.js","../src/const.ts","../src/utils.ts","../src/client.ts","../src/clientKeystore.ts","../src/clientLedger.ts","../src/blockcypher-api.ts"],"sourcesContent":["// baseline estimates, used to improve performance\nvar TX_EMPTY_SIZE = 4 + 1 + 1 + 4\nvar TX_INPUT_BASE = 32 + 4 + 1 + 4\nvar TX_INPUT_PUBKEYHASH = 107\nvar TX_OUTPUT_BASE = 8 + 1\nvar TX_OUTPUT_PUBKEYHASH = 25\n\nfunction inputBytes (input) {\n return TX_INPUT_BASE + (input.script ? input.script.length : TX_INPUT_PUBKEYHASH)\n}\n\nfunction outputBytes (output) {\n return TX_OUTPUT_BASE + (output.script ? output.script.length : TX_OUTPUT_PUBKEYHASH)\n}\n\nfunction dustThreshold (output, feeRate) {\n /* ... classify the output for input estimate */\n return inputBytes({}) * feeRate\n}\n\nfunction transactionBytes (inputs, outputs) {\n return TX_EMPTY_SIZE +\n inputs.reduce(function (a, x) { return a + inputBytes(x) }, 0) +\n outputs.reduce(function (a, x) { return a + outputBytes(x) }, 0)\n}\n\nfunction uintOrNaN (v) {\n if (typeof v !== 'number') return NaN\n if (!isFinite(v)) return NaN\n if (Math.floor(v) !== v) return NaN\n if (v < 0) return NaN\n return v\n}\n\nfunction sumForgiving (range) {\n return range.reduce(function (a, x) { return a + (isFinite(x.value) ? x.value : 0) }, 0)\n}\n\nfunction sumOrNaN (range) {\n return range.reduce(function (a, x) { return a + uintOrNaN(x.value) }, 0)\n}\n\nvar BLANK_OUTPUT = outputBytes({})\n\nfunction finalize (inputs, outputs, feeRate) {\n var bytesAccum = transactionBytes(inputs, outputs)\n var feeAfterExtraOutput = feeRate * (bytesAccum + BLANK_OUTPUT)\n var remainderAfterExtraOutput = sumOrNaN(inputs) - (sumOrNaN(outputs) + feeAfterExtraOutput)\n\n // is it worth a change output?\n if (remainderAfterExtraOutput > dustThreshold({}, feeRate)) {\n outputs = outputs.concat({ value: remainderAfterExtraOutput })\n }\n\n var fee = sumOrNaN(inputs) - sumOrNaN(outputs)\n if (!isFinite(fee)) return { fee: feeRate * bytesAccum }\n\n return {\n inputs: inputs,\n outputs: outputs,\n fee: fee\n }\n}\n\nmodule.exports = {\n dustThreshold: dustThreshold,\n finalize: finalize,\n inputBytes: inputBytes,\n outputBytes: outputBytes,\n sumOrNaN: sumOrNaN,\n sumForgiving: sumForgiving,\n transactionBytes: transactionBytes,\n uintOrNaN: uintOrNaN\n}\n","var utils = require('./utils')\n\n// add inputs until we reach or surpass the target value (or deplete)\n// worst-case: O(n)\nmodule.exports = function accumulative (utxos, outputs, feeRate) {\n if (!isFinite(utils.uintOrNaN(feeRate))) return {}\n var bytesAccum = utils.transactionBytes([], outputs)\n\n var inAccum = 0\n var inputs = []\n var outAccum = utils.sumOrNaN(outputs)\n\n for (var i = 0; i < utxos.length; ++i) {\n var utxo = utxos[i]\n var utxoBytes = utils.inputBytes(utxo)\n var utxoFee = feeRate * utxoBytes\n var utxoValue = utils.uintOrNaN(utxo.value)\n\n // skip detrimental input\n if (utxoFee > utxo.value) {\n if (i === utxos.length - 1) return { fee: feeRate * (bytesAccum + utxoBytes) }\n continue\n }\n\n bytesAccum += utxoBytes\n inAccum += utxoValue\n inputs.push(utxo)\n\n var fee = feeRate * bytesAccum\n\n // go again?\n if (inAccum < outAccum + fee) continue\n\n return utils.finalize(inputs, outputs, feeRate)\n }\n\n return { fee: feeRate * bytesAccum }\n}\n","import { ExplorerProvider, Network } from '@xchainjs/xchain-client'\nimport { Asset, AssetType } from '@xchainjs/xchain-util'\nimport {\n BitgoProvider,\n BlockcypherNetwork,\n BlockcypherProvider,\n SochainNetwork,\n SochainProvider,\n UtxoOnlineDataProviders,\n} from '@xchainjs/xchain-utxo-providers'\n/**\n * Minimum transaction fee for Dogecoin transactions.\n * Defined as 100000 satoshi/kB.\n * @see https://github.com/dogecoin/dogecoin/blob/master/src/validation.h#L58\n */\nexport const MIN_TX_FEE = 100000\n\n/**\n * Decimal places for Dogecoin.\n */\nexport const DOGE_DECIMAL = 8\n\n/**\n * Lower fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const LOWER_FEE_BOUND = 100\n\n/**\n * Upper fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const UPPER_FEE_BOUND = 20_000_000\n\n/**\n * Chain identifier for Dogecoin.\n */\nexport const DOGEChain = 'DOGE' as const\n\n/**\n * Base asset object for Dogecoin.\n * Represents the Dogecoin asset in various contexts.\n */\nexport const AssetDOGE: Asset = { chain: DOGEChain, symbol: 'DOGE', ticker: 'DOGE', type: AssetType.NATIVE }\n\n/**\n * Explorer provider for Dogecoin mainnet and testnet.\n * Provides URLs for exploring Dogecoin transactions and addresses.\n */\nconst DOGE_MAINNET_EXPLORER = new ExplorerProvider(\n 'https://blockchair.com/dogecoin',\n 'https://blockchair.com/dogecoin/address/%%ADDRESS%%',\n 'https://blockchair.com/dogecoin/transaction/%%TX_ID%%',\n)\nconst DOGE_TESTNET_EXPLORER = new ExplorerProvider(\n 'https://blockexplorer.one/dogecoin/testnet',\n 'https://blockexplorer.one/dogecoin/testnet/address/%%ADDRESS%%',\n 'https://blockexplorer.one/dogecoin/testnet/tx/%%TX_ID%%',\n)\nexport const blockstreamExplorerProviders = {\n [Network.Testnet]: DOGE_TESTNET_EXPLORER,\n [Network.Stagenet]: DOGE_MAINNET_EXPLORER,\n [Network.Mainnet]: DOGE_MAINNET_EXPLORER,\n}\n\n/**\n * Sochain data providers for Dogecoin mainnet and testnet.\n * Provides API access to Sochain for Dogecoin.\n */\nconst testnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGETEST,\n)\nconst mainnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGE,\n)\nexport const sochainDataProviders = {\n [Network.Testnet]: testnetSochainProvider,\n [Network.Stagenet]: mainnetSochainProvider,\n [Network.Mainnet]: mainnetSochainProvider,\n}\n\n/**\n * Blockcypher data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Blockcypher for Dogecoin.\n */\nconst mainnetBlockcypherProvider = new BlockcypherProvider(\n 'https://api.blockcypher.com/v1',\n DOGEChain,\n AssetDOGE,\n 8,\n BlockcypherNetwork.DOGE,\n process.env.BLOCKCYPHER_API_KEY || '',\n)\nexport const blockcypherDataProviders = {\n [Network.Testnet]: undefined, //no provider here\n [Network.Stagenet]: mainnetBlockcypherProvider,\n [Network.Mainnet]: mainnetBlockcypherProvider,\n}\n\n/**\n * Bitgo data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Bitgo for Dogecoin.\n */\nconst mainnetBitgoProvider = new BitgoProvider({\n baseUrl: 'https://app.bitgo.com',\n chain: DOGEChain,\n})\n\nexport const BitgoProviders: UtxoOnlineDataProviders = {\n [Network.Testnet]: undefined,\n [Network.Stagenet]: mainnetBitgoProvider,\n [Network.Mainnet]: mainnetBitgoProvider,\n}\n","/**\n * Import statements for required modules and types.\n */\nimport { Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing bitcoinjs-lib for Dogecoin operations\nimport coininfo from 'coininfo' // Importing coininfo for cryptocurrency information retrieval\n\n/**\n * Constant values representing transaction sizes and lengths.\n */\nexport const TX_EMPTY_SIZE = 4 + 1 + 1 + 4 // 10\nexport const TX_INPUT_BASE = 32 + 4 + 1 + 4 // 41\nexport const TX_INPUT_PUBKEYHASH = 107\nexport const TX_OUTPUT_BASE = 8 + 1 // 9\nexport const TX_OUTPUT_PUBKEYHASH = 25\n\n/**\n * Calculate the number of bytes required for an input.\n *\n * @returns {number} The number of bytes required for an input.\n */\nexport function inputBytes(): number {\n return TX_INPUT_BASE + TX_INPUT_PUBKEYHASH\n}\n\n/**\n * Calculate the average value of an array.\n *\n * @param {number[]} array - The array of numbers.\n * @returns {number} The average value of the array.\n */\nexport function arrayAverage(array: number[]): number {\n let sum = 0\n array.forEach((value) => (sum += value))\n return sum / array.length\n}\n\n/**\n * Get the Dogecoin network configuration to be used with bitcoinjs.\n *\n * @param {Network} network - The network type.\n * @returns {Dogecoin.networks.Network} The Dogecoin network configuration.\n */\nexport const dogeNetwork = (network: Network): Dogecoin.networks.Network => {\n switch (network) {\n case Network.Mainnet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Stagenet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Testnet: {\n // Latest coininfo on NPM doesn't contain dogetest config information\n const bip32 = {\n private: 0x04358394,\n public: 0x043587cf,\n }\n const test = coininfo.dogecoin.test\n test.versions.bip32 = bip32\n return test.toBitcoinJS()\n }\n }\n}\n\n/**\n * Validate a Dogecoin address.\n *\n * @param {Address} address - The Dogecoin address to validate.\n * @param {Network} network - The network type.\n * @returns {boolean} `true` if the address is valid, `false` otherwise.\n */\nexport const validateAddress = (address: Address, network: Network): boolean => {\n try {\n Dogecoin.address.toOutputScript(address, dogeNetwork(network))\n return true\n } catch (error) {\n return false\n }\n}\n\n/**\n * Get the address prefix based on the network.\n *\n * @param {Network} network - The network type.\n * @returns {string} The address prefix based on the network.\n */\nexport const getPrefix = (network: Network) => {\n switch (network) {\n case Network.Mainnet:\n case Network.Stagenet:\n return ''\n case Network.Testnet:\n return 'n'\n }\n}\n","import { AssetInfo, FeeRate, Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, PreparedTx, TxParams, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\nimport accumulative from 'coinselect/accumulative'\n\nimport {\n AssetDOGE,\n BitgoProviders,\n DOGEChain,\n DOGE_DECIMAL,\n LOWER_FEE_BOUND,\n MIN_TX_FEE,\n UPPER_FEE_BOUND,\n blockcypherDataProviders,\n blockstreamExplorerProviders,\n} from './const'\nimport { LedgerTxInfo, LedgerTxInfoParams } from './types/ledger'\nimport * as Utils from './utils'\n/**\n * Default parameters for Dogecoin UTXO client.\n * Contains default values for network, phrase, explorer providers, data providers, root derivation paths, and fee bounds.\n */\nexport const defaultDogeParams: UtxoClientParams = {\n network: Network.Mainnet, // Default network is Mainnet\n phrase: '', // Default empty phrase\n explorerProviders: blockstreamExplorerProviders, // Default explorer providers\n dataProviders: [BitgoProviders, blockcypherDataProviders], // Default data providers\n rootDerivationPaths: {\n [Network.Mainnet]: `m/44'/3'/0'/0/`, // Default root derivation path for Mainnet\n [Network.Stagenet]: `m/44'/3'/0'/0/`, // Default root derivation path for Stagenet\n [Network.Testnet]: `m/44'/1'/0'/0/`, // Default root derivation path for Testnet\n },\n feeBounds: {\n lower: LOWER_FEE_BOUND, // Default lower fee bound\n upper: UPPER_FEE_BOUND, // Default upper fee bound\n },\n}\n/**\n * Custom Dogecoin client extending UTXOClient.\n * Implements methods for Dogecoin-specific functionality.\n */\nabstract class Client extends UTXOClient {\n /**\n * Constructor for initializing the Dogecoin client.\n * Initializes the client with the provided parameters.\n *\n * @param {DogecoinClientParams} params Parameters for initializing the Dogecoin client.\n */\n constructor(params = defaultDogeParams) {\n super(DOGEChain, {\n // Call the superclass constructor with DOGEChain identifier and provided parameters\n network: params.network,\n rootDerivationPaths: params.rootDerivationPaths,\n phrase: params.phrase,\n feeBounds: params.feeBounds,\n explorerProviders: params.explorerProviders,\n dataProviders: params.dataProviders,\n })\n }\n\n /**\n * Get Dogecoin asset information.\n *\n * @returns {AssetInfo} Dogecoin asset information.\n */\n getAssetInfo(): AssetInfo {\n const assetInfo: AssetInfo = {\n asset: AssetDOGE,\n decimal: DOGE_DECIMAL,\n }\n return assetInfo\n }\n\n /**\n * Validate the given address.\n *\n * @param {Address} address The Dogecoin address to validate.\n * @returns {boolean} `true` if the address is valid, otherwise `false`.\n */\n validateAddress(address: string): boolean {\n return Utils.validateAddress(address, this.network)\n }\n\n /**\n * Builds a Dogecoin transaction (PSBT).\n *\n * Builds a Partially Signed Bitcoin Transaction (PSBT) with the specified parameters.\n * @param {BuildParams} params The transaction build options including sender, recipient, amount, memo, and fee rate.\n * @returns {Transaction} A promise that resolves to the built PSBT and the unspent transaction outputs (UTXOs) used in the transaction.\n * @deprecated This method is deprecated. Use the `transfer` method instead.\n */\n public buildTx = async ({\n amount,\n recipient,\n memo,\n feeRate,\n sender,\n }: TxParams & {\n feeRate: FeeRate\n sender: Address\n }): Promise<{ psbt: Dogecoin.Psbt; utxos: UTXO[] }> => {\n // Validate the recipient address\n if (!this.validateAddress(recipient)) throw new Error('Invalid address')\n\n // Scan unspent transaction outputs (UTXOs) for the sender's address\n const utxos = await this.scanUTXOs(sender, false)\n // Throw an error if no UTXOs are found\n if (utxos.length === 0) throw new Error('No UTXOs to send')\n\n // Round the fee rate to the nearest whole number\n const feeRateWhole = Number(feeRate.toFixed(0))\n // Compile the memo if provided\n const compiledMemo = memo ? this.compileMemo(memo) : null\n\n const targetOutputs = []\n //1. Add output for the recipient\n targetOutputs.push({\n address: recipient,\n value: amount.amount().toNumber(),\n })\n //2. Add output for the memo (if provided)\n if (compiledMemo) {\n targetOutputs.push({ script: compiledMemo, value: 0 })\n }\n // Calculate the inputs and outputs for the transaction\n const { inputs, outputs } = accumulative(utxos, targetOutputs, feeRateWhole)\n\n // Throw an error if no solution was found for inputs and outputs\n if (!inputs || !outputs) throw new Error('Balance insufficient for transaction')\n\n // Create a new PSBT for building the transaction\n const psbt = new Dogecoin.Psbt({ network: Utils.dogeNetwork(this.network) })\n // Set the maximum fee rate for the PSBT\n psbt.setMaximumFeeRate(7500000)\n\n // Add inputs to the PSBT\n for (const utxo of inputs) {\n psbt.addInput({\n hash: utxo.hash,\n index: utxo.index,\n nonWitnessUtxo: Buffer.from(utxo.txHex, 'hex'),\n })\n }\n // Outputs\n outputs.forEach((output: Dogecoin.PsbtTxOutput) => {\n if (!output.address) {\n //an empty address means this is the change address\n output.address = sender\n }\n if (!output.script) {\n psbt.addOutput(output)\n } else {\n //we need to add the compiled memo this way to\n //avoid dust error tx when accumulating memo output with 0 value\n if (compiledMemo) {\n psbt.addOutput({ script: compiledMemo, value: 0 })\n }\n }\n })\n\n return { psbt, utxos }\n }\n\n /**\n * Asynchronously creates transaction information for ledger sign.\n *\n * Builds a transaction (PSBT) and prepares necessary information for ledger signing.\n *\n * @param {LedgerTxInfoParams} params The parameters for creating transaction information.\n * @returns {LedgerTxInfo} A promise that resolves to the transaction information used for ledger sign.\n */\n public async createTxInfo(params: LedgerTxInfoParams): Promise<LedgerTxInfo> {\n // Build the transaction (PSBT) and obtain the unspent transaction outputs (UTXOs)\n const { psbt, utxos } = await this.buildTx(params)\n // Construct the ledger transaction information object\n const ledgerTxInfo: LedgerTxInfo = {\n utxos,\n newTxHex: psbt.data.globalMap.unsignedTx.toBuffer().toString('hex'), // Convert unsigned transaction to hexadecimal string\n }\n return ledgerTxInfo\n }\n\n /**\n * Asynchronously prepares a transaction for transfer.\n *\n * Builds a transaction (PSBT) with the specified transfer options.\n * @param {TxParams & { sender: Address; feeRate: FeeRate; spendPendingUTXO?: boolean }} params The transfer options including sender address, fee rate, and optional flag for spending pending UTXOs.\n * @returns {Promise<PreparedTx>} A promise that resolves to the raw unsigned transaction (PSBT).\n */\n async prepareTx({\n sender,\n memo,\n amount,\n recipient,\n feeRate,\n }: TxParams & {\n sender: Address\n feeRate: FeeRate\n spendPendingUTXO?: boolean\n }): Promise<PreparedTx & { utxos: UTXO[] }> {\n // Build the transaction (PSBT) with the specified transfer options\n const { psbt, utxos } = await this.buildTx({\n sender,\n recipient,\n amount,\n feeRate,\n memo,\n })\n\n // Return the raw unsigned transaction (PSBT)\n return { rawUnsignedTx: psbt.toBase64(), utxos }\n }\n\n /**\n * Compiles the memo into a buffer for inclusion in a Dogecoin transaction.\n *\n * @param {string} memo The memo to be compiled.\n * @returns {Buffer} The compiled memo as a buffer.\n */\n protected compileMemo(memo: string): Buffer {\n // Convert the memo to a buffer\n const data = Buffer.from(memo, 'utf8')\n // Compile the OP_RETURN script with the memo data\n return Dogecoin.script.compile([Dogecoin.opcodes.OP_RETURN, data])\n }\n\n /**\n * Calculates the transaction fee based on the provided UTXOs, fee rate, and optional data.\n *\n * @param {UTXO[]} inputs The unspent transaction outputs (UTXOs) used as inputs.\n * @param {FeeRate} feeRate The fee rate for the transaction.\n * @param {Buffer | null} data The compiled memo (optional).\n * @returns {number} The calculated transaction fee.\n */\n protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, data: Buffer | null = null): number {\n // Calculate the size of the transaction\n const inputSizeBasedOnInputs =\n inputs.length > 0\n ? inputs.reduce((a) => a + Utils.inputBytes(), 0) + inputs.length // +1 byte for each input signature\n : 0\n // Calculate the sum of transaction size\n let sum =\n Utils.TX_EMPTY_SIZE +\n inputSizeBasedOnInputs +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH\n\n // Add additional output size if data is provided\n if (data) {\n sum += Utils.TX_OUTPUT_BASE + data.length\n }\n // Calculate the fee based on the sum of transaction size and the fee rate\n const fee = sum * feeRate\n // Ensure the fee is not less than the minimum transaction fee\n return fee > MIN_TX_FEE ? fee : MIN_TX_FEE\n }\n}\n\nexport { Client }\n","import { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing the base Doge client\n\nimport { Client } from './client' // Importing utility functions\nimport * as Utils from './utils'\n/**\n * Custom Doge client extended to support keystore functionality\n */\nclass ClientKeystore extends Client {\n /**\n * Get the Dogecoin address.\n *\n * Generates a Dogecoin address using the provided phrase and index.\n * @param {number} index The index of the address to retrieve. Default is 0.\n * @returns {Address} The Dogecoin address.\n * @throws {\"index must be greater than zero\"} Thrown if the index is less than zero.\n * @throws {\"Phrase must be provided\"} Thrown if the phrase is not provided.\n * @throws {\"Address not defined\"} Thrown if failed to create the address from the phrase.\n */\n getAddress(index = 0): Address {\n if (index < 0) {\n throw new Error('index must be greater than zero')\n }\n if (this.phrase) {\n // Get Dogecoin network and keys\n const dogeNetwork = Utils.dogeNetwork(this.network)\n const dogeKeys = this.getDogeKeys(this.phrase, index)\n // Generate Dogecoin address\n const { address } = Dogecoin.payments.p2pkh({\n pubkey: dogeKeys.publicKey,\n network: dogeNetwork,\n })\n if (!address) {\n throw new Error('Address not defined')\n }\n return address\n }\n throw new Error('Phrase must be provided')\n }\n /**\n * @private\n * Get private key.\n *\n * Private function to get keyPair from the this.phrase\n *\n * @param {string} phrase The phrase to be used for generating privkey\n * @returns {ECPairInterface} The privkey generated from the given phrase\n *\n * @throws {\"Could not get private key from phrase\"} Throws an error if failed creating Doge keys from the given phrase\n * */\n private getDogeKeys(phrase: string, index = 0): Dogecoin.ECPairInterface {\n const dogeNetwork = Utils.dogeNetwork(this.network)\n\n const seed = getSeed(phrase)\n const master = Dogecoin.bip32.fromSeed(seed, dogeNetwork).derivePath(this.getFullDerivationPath(index))\n\n if (!master.privateKey) {\n throw new Error('Could not get private key from phrase')\n }\n\n return Dogecoin.ECPair.fromPrivateKey(master.privateKey, { network: dogeNetwork })\n }\n\n /**\n * Get the current address.\n * Asynchronous version of getAddress method.\n * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)\n * The address is then decoded into type P2WPKH and returned.\n * @returns {Address} The current address.\n *\n * @throws {\"Phrase must be provided\"} Thrown if phrase has not been set before.\n * @throws {\"Address not defined\"} Thrown if failed creating account from phrase.\n */\n async getAddressAsync(index = 0): Promise<string> {\n return this.getAddress(index)\n }\n\n /**\n * Asynchronously transfers Dogecoin.\n *\n * Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.\n * @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.\n * @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.\n */\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n // Determine the fee rate for the transaction, using provided fee rate or fetching it from the network\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n // Check if the fee rate is within the specified fee bounds\n checkFeeBounds(this.feeBounds, feeRate)\n\n // Get the index of the sender's address or use the default index (0)\n const fromAddressIndex = params?.walletIndex || 0\n // Prepare the transaction by building it with the specified parameters\n const { rawUnsignedTx } = await this.prepareTx({\n ...params,\n feeRate,\n sender: await this.getAddressAsync(fromAddressIndex),\n })\n // Get the Dogecoin keys for signing the transaction\n const dogeKeys = this.getDogeKeys(this.phrase, fromAddressIndex)\n // Create a Partially Signed Bitcoin Transaction (PSBT) from the raw unsigned transaction\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx, { maximumFeeRate: 7500000 })\n // Sign all inputs of the transaction with the Dogecoin keys\n psbt.signAllInputs(dogeKeys)\n // Finalize all inputs of the transaction\n psbt.finalizeAllInputs()\n // Extract the signed transaction and format it to hexadecimal\n const txHex = psbt.extractTransaction().toHex()\n // Broadcast the signed transaction to the Dogecoin network and return the transaction hash\n return await this.roundRobinBroadcastTx(txHex)\n }\n}\nexport { ClientKeystore }\n","import AppBtc from '@ledgerhq/hw-app-btc'\nimport { Transaction } from '@ledgerhq/hw-app-btc/lib/types'\nimport { FeeOption, FeeRate, TxHash } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\n\nimport { Client } from './client'\n/**\n * Custom Ledger Bitcoin client\n */\nclass ClientLedger extends Client {\n // Reference to the Ledger transport object\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private transport: any // TODO: Parametrize\n private app: AppBtc | undefined\n\n // Constructor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(params: UtxoClientParams & { transport: any }) {\n super(params)\n this.transport = params.transport\n }\n\n // Get the Ledger Doge application instance\n public async getApp(): Promise<AppBtc> {\n if (this.app) {\n return this.app\n }\n this.app = new AppBtc({ transport: this.transport, currency: 'dogecoin' })\n return this.app\n }\n\n // Get the current address synchronously\n getAddress(): string {\n throw Error('Sync method not supported for Ledger')\n }\n\n // Get the current address asynchronously\n async getAddressAsync(index = 0, verify = false): Promise<Address> {\n const app = await this.getApp()\n const result = await app.getWalletPublicKey(this.getFullDerivationPath(index), {\n format: 'legacy',\n verify,\n })\n return result.bitcoinAddress\n }\n\n // Transfer Doge from Ledger\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n const app = await this.getApp()\n const fromAddressIndex = params?.walletIndex || 0\n // Get fee rate\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n // Get sender address\n const sender = await this.getAddressAsync(fromAddressIndex)\n // Prepare transaction\n const { rawUnsignedTx, utxos } = await this.prepareTx({ ...params, sender, feeRate })\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx)\n // Prepare Ledger inputs\n const ledgerInputs: Array<[Transaction, number, string | null, number | null]> = utxos.map(\n ({ txHex, hash, index }) => {\n if (!txHex) {\n throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`)\n }\n const splittedTx = app.splitTransaction(txHex, false /* no segwit support */)\n return [splittedTx, index, null, null]\n },\n )\n\n // Prepare associated keysets\n const associatedKeysets = ledgerInputs.map(() => this.getFullDerivationPath(fromAddressIndex))\n // Convert the raw unsigned transaction to a Transaction object\n // Serialize unsigned transaction\n const unsignedHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex')\n const newTx = app.splitTransaction(unsignedHex, true)\n const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex')\n const txHex = await app.createPaymentTransaction({\n inputs: ledgerInputs,\n associatedKeysets,\n outputScriptHex,\n // no additionals - similar to https://github.com/shapeshift/hdwallet/blob/a61234eb83081a4de54750b8965b873b15803a03/packages/hdwallet-ledger/src/bitcoin.ts#L222\n additionals: [],\n })\n\n const txHash = await this.broadcastTx(txHex)\n // Throw error if no transaction hash is received\n if (!txHash) {\n throw Error('No Tx hash')\n }\n\n return txHash\n }\n}\nexport { ClientLedger }\n","import { Network } from '@xchainjs/xchain-client'\n\n/**\n * Function to get the URL for sending a transaction based on the network and Blockcypher URL.\n * Throws an error if the network is 'testnet' since the testnet URL is not available for Blockcypher.\n * @param {object} params Object containing the Blockcypher URL and network type.\n * @param {string} params.blockcypherUrl The Blockcypher URL.\n * @param {Network} params.network The network type (Mainnet, Testnet, or Stagenet).\n * @returns {string} The URL for sending a transaction.\n */\nexport const getSendTxUrl = ({ blockcypherUrl, network }: { blockcypherUrl: string; network: Network }): string => {\n if (network === 'testnet') {\n // Check if the network is testnet\n throw new Error('Testnet URL is not available for Blockcypher') // Throw an error if testnet URL is requested\n } else {\n return `${blockcypherUrl}/doge/main/txs/push` // Return the mainnet URL for sending a transaction\n }\n}\n"],"names":["require$$0","accumulative","AssetType","ExplorerProvider","Network","SochainProvider","SochainNetwork","BlockcypherProvider","BlockcypherNetwork","BitgoProvider","coininfo","Dogecoin","UTXOClient","Utils.dogeNetwork","Utils.validateAddress","Utils.inputBytes","Utils.TX_EMPTY_SIZE","Utils.TX_OUTPUT_BASE","Utils.TX_OUTPUT_PUBKEYHASH","dogeNetwork","getSeed","FeeOption","checkFeeBounds","AppBtc"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;CACA,IAAI,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;CACjC,IAAI,aAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;CAClC,IAAI,mBAAmB,GAAG,IAAG;AAC7B,CAAA,IAAI,cAAc,GAAG,CAAC,GAAG,EAAC;CAC1B,IAAI,oBAAoB,GAAG,GAAE;AAC7B;CACA,SAAS,UAAU,EAAE,KAAK,EAAE;AAC5B,GAAE,OAAO,aAAa,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAC;EAClF;AACD;CACA,SAAS,WAAW,EAAE,MAAM,EAAE;AAC9B,GAAE,OAAO,cAAc,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,oBAAoB,CAAC;EACtF;AACD;AACA,CAAA,SAAS,aAAa,EA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AACH;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../node_modules/coinselect/utils.js","../../../node_modules/coinselect/accumulative.js","../src/const.ts","../src/utils.ts","../src/client.ts","../src/clientKeystore.ts","../src/clientLedger.ts","../src/blockcypher-api.ts"],"sourcesContent":["// baseline estimates, used to improve performance\nvar TX_EMPTY_SIZE = 4 + 1 + 1 + 4\nvar TX_INPUT_BASE = 32 + 4 + 1 + 4\nvar TX_INPUT_PUBKEYHASH = 107\nvar TX_OUTPUT_BASE = 8 + 1\nvar TX_OUTPUT_PUBKEYHASH = 25\n\nfunction inputBytes (input) {\n return TX_INPUT_BASE + (input.script ? input.script.length : TX_INPUT_PUBKEYHASH)\n}\n\nfunction outputBytes (output) {\n return TX_OUTPUT_BASE + (output.script ? output.script.length : TX_OUTPUT_PUBKEYHASH)\n}\n\nfunction dustThreshold (output, feeRate) {\n /* ... classify the output for input estimate */\n return inputBytes({}) * feeRate\n}\n\nfunction transactionBytes (inputs, outputs) {\n return TX_EMPTY_SIZE +\n inputs.reduce(function (a, x) { return a + inputBytes(x) }, 0) +\n outputs.reduce(function (a, x) { return a + outputBytes(x) }, 0)\n}\n\nfunction uintOrNaN (v) {\n if (typeof v !== 'number') return NaN\n if (!isFinite(v)) return NaN\n if (Math.floor(v) !== v) return NaN\n if (v < 0) return NaN\n return v\n}\n\nfunction sumForgiving (range) {\n return range.reduce(function (a, x) { return a + (isFinite(x.value) ? x.value : 0) }, 0)\n}\n\nfunction sumOrNaN (range) {\n return range.reduce(function (a, x) { return a + uintOrNaN(x.value) }, 0)\n}\n\nvar BLANK_OUTPUT = outputBytes({})\n\nfunction finalize (inputs, outputs, feeRate) {\n var bytesAccum = transactionBytes(inputs, outputs)\n var feeAfterExtraOutput = feeRate * (bytesAccum + BLANK_OUTPUT)\n var remainderAfterExtraOutput = sumOrNaN(inputs) - (sumOrNaN(outputs) + feeAfterExtraOutput)\n\n // is it worth a change output?\n if (remainderAfterExtraOutput > dustThreshold({}, feeRate)) {\n outputs = outputs.concat({ value: remainderAfterExtraOutput })\n }\n\n var fee = sumOrNaN(inputs) - sumOrNaN(outputs)\n if (!isFinite(fee)) return { fee: feeRate * bytesAccum }\n\n return {\n inputs: inputs,\n outputs: outputs,\n fee: fee\n }\n}\n\nmodule.exports = {\n dustThreshold: dustThreshold,\n finalize: finalize,\n inputBytes: inputBytes,\n outputBytes: outputBytes,\n sumOrNaN: sumOrNaN,\n sumForgiving: sumForgiving,\n transactionBytes: transactionBytes,\n uintOrNaN: uintOrNaN\n}\n","var utils = require('./utils')\n\n// add inputs until we reach or surpass the target value (or deplete)\n// worst-case: O(n)\nmodule.exports = function accumulative (utxos, outputs, feeRate) {\n if (!isFinite(utils.uintOrNaN(feeRate))) return {}\n var bytesAccum = utils.transactionBytes([], outputs)\n\n var inAccum = 0\n var inputs = []\n var outAccum = utils.sumOrNaN(outputs)\n\n for (var i = 0; i < utxos.length; ++i) {\n var utxo = utxos[i]\n var utxoBytes = utils.inputBytes(utxo)\n var utxoFee = feeRate * utxoBytes\n var utxoValue = utils.uintOrNaN(utxo.value)\n\n // skip detrimental input\n if (utxoFee > utxo.value) {\n if (i === utxos.length - 1) return { fee: feeRate * (bytesAccum + utxoBytes) }\n continue\n }\n\n bytesAccum += utxoBytes\n inAccum += utxoValue\n inputs.push(utxo)\n\n var fee = feeRate * bytesAccum\n\n // go again?\n if (inAccum < outAccum + fee) continue\n\n return utils.finalize(inputs, outputs, feeRate)\n }\n\n return { fee: feeRate * bytesAccum }\n}\n","import { ExplorerProvider, Network } from '@xchainjs/xchain-client'\nimport { Asset, AssetType } from '@xchainjs/xchain-util'\nimport {\n BitgoProvider,\n BlockcypherNetwork,\n BlockcypherProvider,\n SochainNetwork,\n SochainProvider,\n UtxoOnlineDataProviders,\n} from '@xchainjs/xchain-utxo-providers'\n/**\n * Minimum transaction fee for Dogecoin transactions.\n * Defined as 100000 satoshi/kB.\n * @see https://github.com/dogecoin/dogecoin/blob/master/src/validation.h#L58\n */\nexport const MIN_TX_FEE = 100000\n\n/**\n * Decimal places for Dogecoin.\n */\nexport const DOGE_DECIMAL = 8\n\n/**\n * Lower fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const LOWER_FEE_BOUND = 100\n\n/**\n * Upper fee bound for Dogecoin transactions.\n * Referenced from Dogecoin fee recommendation documentation.\n * @see https://github.com/dogecoin/dogecoin/blob/master/doc/fee-recommendation.md\n */\nexport const UPPER_FEE_BOUND = 20_000_000\n\n/**\n * Chain identifier for Dogecoin.\n */\nexport const DOGEChain = 'DOGE' as const\n\n/**\n * Base asset object for Dogecoin.\n * Represents the Dogecoin asset in various contexts.\n */\nexport const AssetDOGE: Asset = { chain: DOGEChain, symbol: 'DOGE', ticker: 'DOGE', type: AssetType.NATIVE }\n\n/**\n * Explorer provider for Dogecoin mainnet and testnet.\n * Provides URLs for exploring Dogecoin transactions and addresses.\n */\nconst DOGE_MAINNET_EXPLORER = new ExplorerProvider(\n 'https://blockchair.com/dogecoin',\n 'https://blockchair.com/dogecoin/address/%%ADDRESS%%',\n 'https://blockchair.com/dogecoin/transaction/%%TX_ID%%',\n)\nconst DOGE_TESTNET_EXPLORER = new ExplorerProvider(\n 'https://blockexplorer.one/dogecoin/testnet',\n 'https://blockexplorer.one/dogecoin/testnet/address/%%ADDRESS%%',\n 'https://blockexplorer.one/dogecoin/testnet/tx/%%TX_ID%%',\n)\nexport const blockstreamExplorerProviders = {\n [Network.Testnet]: DOGE_TESTNET_EXPLORER,\n [Network.Stagenet]: DOGE_MAINNET_EXPLORER,\n [Network.Mainnet]: DOGE_MAINNET_EXPLORER,\n}\n\n/**\n * Sochain data providers for Dogecoin mainnet and testnet.\n * Provides API access to Sochain for Dogecoin.\n */\nconst testnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGETEST,\n)\nconst mainnetSochainProvider = new SochainProvider(\n 'https://sochain.com/api/v3',\n process.env.SOCHAIN_API_KEY || '',\n DOGEChain,\n AssetDOGE,\n 8,\n SochainNetwork.DOGE,\n)\nexport const sochainDataProviders = {\n [Network.Testnet]: testnetSochainProvider,\n [Network.Stagenet]: mainnetSochainProvider,\n [Network.Mainnet]: mainnetSochainProvider,\n}\n\n/**\n * Blockcypher data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Blockcypher for Dogecoin.\n */\nconst mainnetBlockcypherProvider = new BlockcypherProvider(\n 'https://api.blockcypher.com/v1',\n DOGEChain,\n AssetDOGE,\n 8,\n BlockcypherNetwork.DOGE,\n process.env.BLOCKCYPHER_API_KEY || '',\n)\nexport const blockcypherDataProviders = {\n [Network.Testnet]: undefined, //no provider here\n [Network.Stagenet]: mainnetBlockcypherProvider,\n [Network.Mainnet]: mainnetBlockcypherProvider,\n}\n\n/**\n * Bitgo data providers for Dogecoin mainnet and stagenet.\n * Provides API access to Bitgo for Dogecoin.\n */\nconst mainnetBitgoProvider = new BitgoProvider({\n baseUrl: 'https://app.bitgo.com',\n chain: DOGEChain,\n})\n\nexport const BitgoProviders: UtxoOnlineDataProviders = {\n [Network.Testnet]: undefined,\n [Network.Stagenet]: mainnetBitgoProvider,\n [Network.Mainnet]: mainnetBitgoProvider,\n}\n","/**\n * Import statements for required modules and types.\n */\nimport { Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing bitcoinjs-lib for Dogecoin operations\nimport coininfo from 'coininfo' // Importing coininfo for cryptocurrency information retrieval\n\n/**\n * Constant values representing transaction sizes and lengths.\n */\nexport const TX_EMPTY_SIZE = 4 + 1 + 1 + 4 // 10\nexport const TX_INPUT_BASE = 32 + 4 + 1 + 4 // 41\nexport const TX_INPUT_PUBKEYHASH = 107\nexport const TX_OUTPUT_BASE = 8 + 1 // 9\nexport const TX_OUTPUT_PUBKEYHASH = 25\n\n/**\n * Calculate the number of bytes required for an input.\n *\n * @returns {number} The number of bytes required for an input.\n */\nexport function inputBytes(): number {\n return TX_INPUT_BASE + TX_INPUT_PUBKEYHASH\n}\n\n/**\n * Calculate the average value of an array.\n *\n * @param {number[]} array - The array of numbers.\n * @returns {number} The average value of the array.\n */\nexport function arrayAverage(array: number[]): number {\n let sum = 0\n array.forEach((value) => (sum += value))\n return sum / array.length\n}\n\n/**\n * Get the Dogecoin network configuration to be used with bitcoinjs.\n *\n * @param {Network} network - The network type.\n * @returns {Dogecoin.networks.Network} The Dogecoin network configuration.\n */\nexport const dogeNetwork = (network: Network): Dogecoin.networks.Network => {\n switch (network) {\n case Network.Mainnet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Stagenet:\n return coininfo.dogecoin.main.toBitcoinJS()\n case Network.Testnet: {\n // Latest coininfo on NPM doesn't contain dogetest config information\n const bip32 = {\n private: 0x04358394,\n public: 0x043587cf,\n }\n const test = coininfo.dogecoin.test\n test.versions.bip32 = bip32\n return test.toBitcoinJS()\n }\n }\n}\n\n/**\n * Validate a Dogecoin address.\n *\n * @param {Address} address - The Dogecoin address to validate.\n * @param {Network} network - The network type.\n * @returns {boolean} `true` if the address is valid, `false` otherwise.\n */\nexport const validateAddress = (address: Address, network: Network): boolean => {\n try {\n Dogecoin.address.toOutputScript(address, dogeNetwork(network))\n return true\n } catch (error) {\n return false\n }\n}\n\n/**\n * Get the address prefix based on the network.\n *\n * @param {Network} network - The network type.\n * @returns {string} The address prefix based on the network.\n */\nexport const getPrefix = (network: Network) => {\n switch (network) {\n case Network.Mainnet:\n case Network.Stagenet:\n return ''\n case Network.Testnet:\n return 'n'\n }\n}\n","import { AssetInfo, FeeRate, Network } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, PreparedTx, TxParams, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\nimport accumulative from 'coinselect/accumulative'\n\nimport {\n AssetDOGE,\n BitgoProviders,\n DOGEChain,\n DOGE_DECIMAL,\n LOWER_FEE_BOUND,\n MIN_TX_FEE,\n UPPER_FEE_BOUND,\n blockcypherDataProviders,\n blockstreamExplorerProviders,\n} from './const'\nimport { LedgerTxInfo, LedgerTxInfoParams } from './types/ledger'\nimport * as Utils from './utils'\n/**\n * Default parameters for Dogecoin UTXO client.\n * Contains default values for network, phrase, explorer providers, data providers, root derivation paths, and fee bounds.\n */\nexport const defaultDogeParams: UtxoClientParams = {\n network: Network.Mainnet, // Default network is Mainnet\n phrase: '', // Default empty phrase\n explorerProviders: blockstreamExplorerProviders, // Default explorer providers\n dataProviders: [BitgoProviders, blockcypherDataProviders], // Default data providers\n rootDerivationPaths: {\n [Network.Mainnet]: `m/44'/3'/0'/0/`, // Default root derivation path for Mainnet\n [Network.Stagenet]: `m/44'/3'/0'/0/`, // Default root derivation path for Stagenet\n [Network.Testnet]: `m/44'/1'/0'/0/`, // Default root derivation path for Testnet\n },\n feeBounds: {\n lower: LOWER_FEE_BOUND, // Default lower fee bound\n upper: UPPER_FEE_BOUND, // Default upper fee bound\n },\n}\n/**\n * Custom Dogecoin client extending UTXOClient.\n * Implements methods for Dogecoin-specific functionality.\n */\nabstract class Client extends UTXOClient {\n /**\n * Constructor for initializing the Dogecoin client.\n * Initializes the client with the provided parameters.\n *\n * @param {DogecoinClientParams} params Parameters for initializing the Dogecoin client.\n */\n constructor(params = defaultDogeParams) {\n super(DOGEChain, {\n // Call the superclass constructor with DOGEChain identifier and provided parameters\n network: params.network,\n rootDerivationPaths: params.rootDerivationPaths,\n phrase: params.phrase,\n feeBounds: params.feeBounds,\n explorerProviders: params.explorerProviders,\n dataProviders: params.dataProviders,\n })\n }\n\n /**\n * Get Dogecoin asset information.\n *\n * @returns {AssetInfo} Dogecoin asset information.\n */\n getAssetInfo(): AssetInfo {\n const assetInfo: AssetInfo = {\n asset: AssetDOGE,\n decimal: DOGE_DECIMAL,\n }\n return assetInfo\n }\n\n /**\n * Validate the given address.\n *\n * @param {Address} address The Dogecoin address to validate.\n * @returns {boolean} `true` if the address is valid, otherwise `false`.\n */\n validateAddress(address: string): boolean {\n return Utils.validateAddress(address, this.network)\n }\n\n /**\n * Builds a Dogecoin transaction (PSBT).\n *\n * Builds a Partially Signed Bitcoin Transaction (PSBT) with the specified parameters.\n * @param {BuildParams} params The transaction build options including sender, recipient, amount, memo, and fee rate.\n * @returns {Transaction} A promise that resolves to the built PSBT and the unspent transaction outputs (UTXOs) used in the transaction.\n * @deprecated This method is deprecated. Use the `transfer` method instead.\n */\n public buildTx = async ({\n amount,\n recipient,\n memo,\n feeRate,\n sender,\n }: TxParams & {\n feeRate: FeeRate\n sender: Address\n }): Promise<{ psbt: Dogecoin.Psbt; utxos: UTXO[]; inputs: UTXO[] }> => {\n // Validate the recipient address\n if (!this.validateAddress(recipient)) throw new Error('Invalid address')\n\n // Scan unspent transaction outputs (UTXOs) for the sender's address\n const utxos = await this.scanUTXOs(sender, false)\n // Throw an error if no UTXOs are found\n if (utxos.length === 0) throw new Error('No UTXOs to send')\n\n // Round the fee rate to the nearest whole number\n const feeRateWhole = Number(feeRate.toFixed(0))\n // Compile the memo if provided\n const compiledMemo = memo ? this.compileMemo(memo) : null\n\n const targetOutputs = []\n //1. Add output for the recipient\n targetOutputs.push({\n address: recipient,\n value: amount.amount().toNumber(),\n })\n //2. Add output for the memo (if provided)\n if (compiledMemo) {\n targetOutputs.push({ script: compiledMemo, value: 0 })\n }\n // Calculate the inputs and outputs for the transaction\n const { inputs, outputs } = accumulative(utxos, targetOutputs, feeRateWhole)\n\n // Throw an error if no solution was found for inputs and outputs\n if (!inputs || !outputs) throw new Error('Balance insufficient for transaction')\n\n // Create a new PSBT for building the transaction\n const psbt = new Dogecoin.Psbt({ network: Utils.dogeNetwork(this.network) })\n // Set the maximum fee rate for the PSBT\n psbt.setMaximumFeeRate(7500000)\n\n // Add inputs to the PSBT\n for (const utxo of inputs) {\n psbt.addInput({\n hash: utxo.hash,\n index: utxo.index,\n nonWitnessUtxo: Buffer.from(utxo.txHex, 'hex'),\n })\n }\n // Outputs\n outputs.forEach((output: Dogecoin.PsbtTxOutput) => {\n if (!output.address) {\n //an empty address means this is the change address\n output.address = sender\n }\n if (!output.script) {\n psbt.addOutput(output)\n } else {\n //we need to add the compiled memo this way to\n //avoid dust error tx when accumulating memo output with 0 value\n if (compiledMemo) {\n psbt.addOutput({ script: compiledMemo, value: 0 })\n }\n }\n })\n\n return { psbt, utxos, inputs }\n }\n\n /**\n * Asynchronously creates transaction information for ledger sign.\n *\n * Builds a transaction (PSBT) and prepares necessary information for ledger signing.\n *\n * @param {LedgerTxInfoParams} params The parameters for creating transaction information.\n * @returns {LedgerTxInfo} A promise that resolves to the transaction information used for ledger sign.\n */\n public async createTxInfo(params: LedgerTxInfoParams): Promise<LedgerTxInfo> {\n // Build the transaction (PSBT) and obtain the unspent transaction outputs (UTXOs)\n const { psbt, utxos } = await this.buildTx(params)\n // Construct the ledger transaction information object\n const ledgerTxInfo: LedgerTxInfo = {\n utxos,\n newTxHex: psbt.data.globalMap.unsignedTx.toBuffer().toString('hex'), // Convert unsigned transaction to hexadecimal string\n }\n return ledgerTxInfo\n }\n\n /**\n * Asynchronously prepares a transaction for transfer.\n *\n * Builds a transaction (PSBT) with the specified transfer options.\n * @param {TxParams & { sender: Address; feeRate: FeeRate; spendPendingUTXO?: boolean }} params The transfer options including sender address, fee rate, and optional flag for spending pending UTXOs.\n * @returns {Promise<PreparedTx>} A promise that resolves to the raw unsigned transaction (PSBT).\n */\n async prepareTx({\n sender,\n memo,\n amount,\n recipient,\n feeRate,\n }: TxParams & {\n sender: Address\n feeRate: FeeRate\n spendPendingUTXO?: boolean\n }): Promise<PreparedTx & { utxos: UTXO[]; inputs: UTXO[] }> {\n // Build the transaction (PSBT) with the specified transfer options\n const { psbt, utxos, inputs } = await this.buildTx({\n sender,\n recipient,\n amount,\n feeRate,\n memo,\n })\n\n // Return the raw unsigned transaction (PSBT)\n return { rawUnsignedTx: psbt.toBase64(), utxos, inputs }\n }\n\n /**\n * Compiles the memo into a buffer for inclusion in a Dogecoin transaction.\n *\n * @param {string} memo The memo to be compiled.\n * @returns {Buffer} The compiled memo as a buffer.\n */\n protected compileMemo(memo: string): Buffer {\n // Convert the memo to a buffer\n const data = Buffer.from(memo, 'utf8')\n // Compile the OP_RETURN script with the memo data\n return Dogecoin.script.compile([Dogecoin.opcodes.OP_RETURN, data])\n }\n\n /**\n * Calculates the transaction fee based on the provided UTXOs, fee rate, and optional data.\n *\n * @param {UTXO[]} inputs The unspent transaction outputs (UTXOs) used as inputs.\n * @param {FeeRate} feeRate The fee rate for the transaction.\n * @param {Buffer | null} data The compiled memo (optional).\n * @returns {number} The calculated transaction fee.\n */\n protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, data: Buffer | null = null): number {\n // Calculate the size of the transaction\n const inputSizeBasedOnInputs =\n inputs.length > 0\n ? inputs.reduce((a) => a + Utils.inputBytes(), 0) + inputs.length // +1 byte for each input signature\n : 0\n // Calculate the sum of transaction size\n let sum =\n Utils.TX_EMPTY_SIZE +\n inputSizeBasedOnInputs +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH +\n Utils.TX_OUTPUT_BASE +\n Utils.TX_OUTPUT_PUBKEYHASH\n\n // Add additional output size if data is provided\n if (data) {\n sum += Utils.TX_OUTPUT_BASE + data.length\n }\n // Calculate the fee based on the sum of transaction size and the fee rate\n const fee = sum * feeRate\n // Ensure the fee is not less than the minimum transaction fee\n return fee > MIN_TX_FEE ? fee : MIN_TX_FEE\n }\n}\n\nexport { Client }\n","import { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib' // Importing the base Doge client\n\nimport { Client } from './client' // Importing utility functions\nimport * as Utils from './utils'\n/**\n * Custom Doge client extended to support keystore functionality\n */\nclass ClientKeystore extends Client {\n /**\n * Get the Dogecoin address.\n *\n * Generates a Dogecoin address using the provided phrase and index.\n * @param {number} index The index of the address to retrieve. Default is 0.\n * @returns {Address} The Dogecoin address.\n * @throws {\"index must be greater than zero\"} Thrown if the index is less than zero.\n * @throws {\"Phrase must be provided\"} Thrown if the phrase is not provided.\n * @throws {\"Address not defined\"} Thrown if failed to create the address from the phrase.\n */\n getAddress(index = 0): Address {\n if (index < 0) {\n throw new Error('index must be greater than zero')\n }\n if (this.phrase) {\n // Get Dogecoin network and keys\n const dogeNetwork = Utils.dogeNetwork(this.network)\n const dogeKeys = this.getDogeKeys(this.phrase, index)\n // Generate Dogecoin address\n const { address } = Dogecoin.payments.p2pkh({\n pubkey: dogeKeys.publicKey,\n network: dogeNetwork,\n })\n if (!address) {\n throw new Error('Address not defined')\n }\n return address\n }\n throw new Error('Phrase must be provided')\n }\n /**\n * @private\n * Get private key.\n *\n * Private function to get keyPair from the this.phrase\n *\n * @param {string} phrase The phrase to be used for generating privkey\n * @returns {ECPairInterface} The privkey generated from the given phrase\n *\n * @throws {\"Could not get private key from phrase\"} Throws an error if failed creating Doge keys from the given phrase\n * */\n private getDogeKeys(phrase: string, index = 0): Dogecoin.ECPairInterface {\n const dogeNetwork = Utils.dogeNetwork(this.network)\n\n const seed = getSeed(phrase)\n const master = Dogecoin.bip32.fromSeed(seed, dogeNetwork).derivePath(this.getFullDerivationPath(index))\n\n if (!master.privateKey) {\n throw new Error('Could not get private key from phrase')\n }\n\n return Dogecoin.ECPair.fromPrivateKey(master.privateKey, { network: dogeNetwork })\n }\n\n /**\n * Get the current address.\n * Asynchronous version of getAddress method.\n * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)\n * The address is then decoded into type P2WPKH and returned.\n * @returns {Address} The current address.\n *\n * @throws {\"Phrase must be provided\"} Thrown if phrase has not been set before.\n * @throws {\"Address not defined\"} Thrown if failed creating account from phrase.\n */\n async getAddressAsync(index = 0): Promise<string> {\n return this.getAddress(index)\n }\n\n /**\n * Asynchronously transfers Dogecoin.\n *\n * Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.\n * @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.\n * @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.\n */\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n // Determine the fee rate for the transaction, using provided fee rate or fetching it from the network\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n // Check if the fee rate is within the specified fee bounds\n checkFeeBounds(this.feeBounds, feeRate)\n\n // Get the index of the sender's address or use the default index (0)\n const fromAddressIndex = params?.walletIndex || 0\n // Prepare the transaction by building it with the specified parameters\n const { rawUnsignedTx } = await this.prepareTx({\n ...params,\n feeRate,\n sender: await this.getAddressAsync(fromAddressIndex),\n })\n // Get the Dogecoin keys for signing the transaction\n const dogeKeys = this.getDogeKeys(this.phrase, fromAddressIndex)\n // Create a Partially Signed Bitcoin Transaction (PSBT) from the raw unsigned transaction\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx, { maximumFeeRate: 7500000 })\n // Sign all inputs of the transaction with the Dogecoin keys\n psbt.signAllInputs(dogeKeys)\n // Finalize all inputs of the transaction\n psbt.finalizeAllInputs()\n // Extract the signed transaction and format it to hexadecimal\n const txHex = psbt.extractTransaction().toHex()\n // Broadcast the signed transaction to the Dogecoin network and return the transaction hash\n return await this.roundRobinBroadcastTx(txHex)\n }\n}\nexport { ClientKeystore }\n","import AppBtc from '@ledgerhq/hw-app-btc'\nimport { Transaction } from '@ledgerhq/hw-app-btc/lib/types'\nimport { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { TxParams, UtxoClientParams } from '@xchainjs/xchain-utxo'\nimport * as Dogecoin from 'bitcoinjs-lib'\n\nimport { Client } from './client'\n/**\n * Custom Ledger Bitcoin client\n */\nclass ClientLedger extends Client {\n // Reference to the Ledger transport object\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private transport: any // TODO: Parametrize\n private app: AppBtc | undefined\n\n // Constructor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(params: UtxoClientParams & { transport: any }) {\n super(params)\n this.transport = params.transport\n }\n\n // Get the Ledger Doge application instance\n public async getApp(): Promise<AppBtc> {\n if (this.app) {\n return this.app\n }\n this.app = new AppBtc({ transport: this.transport, currency: 'dogecoin' })\n return this.app\n }\n\n // Get the current address synchronously\n getAddress(): string {\n throw Error('Sync method not supported for Ledger')\n }\n\n // Get the current address asynchronously\n async getAddressAsync(index = 0, verify = false): Promise<Address> {\n const app = await this.getApp()\n const result = await app.getWalletPublicKey(this.getFullDerivationPath(index), {\n format: 'legacy',\n verify,\n })\n return result.bitcoinAddress\n }\n\n // Transfer Doge from Ledger\n async transfer(params: TxParams & { feeRate?: FeeRate }): Promise<TxHash> {\n const app = await this.getApp()\n const fromAddressIndex = params?.walletIndex || 0\n // Get fee rate\n const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast]\n checkFeeBounds(this.feeBounds, feeRate)\n // Get sender address\n const sender = await this.getAddressAsync(fromAddressIndex)\n // Prepare transaction\n const { rawUnsignedTx, inputs } = await this.prepareTx({ ...params, sender, feeRate })\n const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx)\n // Prepare Ledger inputs\n const ledgerInputs: Array<[Transaction, number, string | null, number | null]> = inputs.map(\n ({ txHex, hash, index }) => {\n if (!txHex) {\n throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`)\n }\n const splittedTx = app.splitTransaction(txHex, false /* no segwit support */)\n return [splittedTx, index, null, null]\n },\n )\n\n // Prepare associated keysets\n const associatedKeysets = ledgerInputs.map(() => this.getFullDerivationPath(fromAddressIndex))\n // Convert the raw unsigned transaction to a Transaction object\n // Serialize unsigned transaction\n const unsignedHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex')\n const newTx = app.splitTransaction(unsignedHex, true)\n const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex')\n const txHex = await app.createPaymentTransaction({\n inputs: ledgerInputs,\n associatedKeysets,\n outputScriptHex,\n // no additionals - similar to https://github.com/shapeshift/hdwallet/blob/a61234eb83081a4de54750b8965b873b15803a03/packages/hdwallet-ledger/src/bitcoin.ts#L222\n additionals: [],\n })\n\n const txHash = await this.broadcastTx(txHex)\n // Throw error if no transaction hash is received\n if (!txHash) {\n throw Error('No Tx hash')\n }\n\n return txHash\n }\n}\nexport { ClientLedger }\n","import { Network } from '@xchainjs/xchain-client'\n\n/**\n * Function to get the URL for sending a transaction based on the network and Blockcypher URL.\n * Throws an error if the network is 'testnet' since the testnet URL is not available for Blockcypher.\n * @param {object} params Object containing the Blockcypher URL and network type.\n * @param {string} params.blockcypherUrl The Blockcypher URL.\n * @param {Network} params.network The network type (Mainnet, Testnet, or Stagenet).\n * @returns {string} The URL for sending a transaction.\n */\nexport const getSendTxUrl = ({ blockcypherUrl, network }: { blockcypherUrl: string; network: Network }): string => {\n if (network === 'testnet') {\n // Check if the network is testnet\n throw new Error('Testnet URL is not available for Blockcypher') // Throw an error if testnet URL is requested\n } else {\n return `${blockcypherUrl}/doge/main/txs/push` // Return the mainnet URL for sending a transaction\n }\n}\n"],"names":["require$$0","accumulative","AssetType","ExplorerProvider","Network","SochainProvider","SochainNetwork","BlockcypherProvider","BlockcypherNetwork","BitgoProvider","coininfo","Dogecoin","UTXOClient","Utils.dogeNetwork","Utils.validateAddress","Utils.inputBytes","Utils.TX_EMPTY_SIZE","Utils.TX_OUTPUT_BASE","Utils.TX_OUTPUT_PUBKEYHASH","dogeNetwork","getSeed","FeeOption","checkFeeBounds","AppBtc"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A2B,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC9E,YAAA,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,wBAAwB,CAAC;AAC/C,gBAAA,MAAM,EAAE,YAAY;gBACpB,iBAAiB;gBACjB,eAAe;;AAEf,gBAAA,WAAW,EAAE,EAAE;AAChB,aAAA,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;;YAE5C,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,MAAM,KAAK,CAAC,YAAY,CAAC,CAAA;AAC1B,aAAA;AAED,YAAA,OAAO,MAAM,CAAA;SACd,CAAA,CAAA;AAAA,KAAA;AACF;;AC5FD;;;;;;;AAOG;AACU,MAAA,YAAY,GAAG,CAAC,EAAE,cAAc,EAAE,OAAO,EAAgD,KAAY;IAChH,IAAI,OAAO,KAAK,SAAS,EAAE;;AAEzB,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;AAChE,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,CAAG,EAAA,cAAc,CAAqB,mBAAA,CAAA,CAAA;AAC9C,KAAA;AACH;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-doge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Custom Doge client and utilities used by XChain clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Xchain",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ledgerhq/hw-app-btc": "10.1.0",
|
|
37
|
-
"@xchainjs/xchain-client": "1.0.
|
|
38
|
-
"@xchainjs/xchain-crypto": "0.3.
|
|
39
|
-
"@xchainjs/xchain-util": "1.0.
|
|
40
|
-
"@xchainjs/xchain-utxo": "1.0.
|
|
41
|
-
"@xchainjs/xchain-utxo-providers": "1.0.
|
|
37
|
+
"@xchainjs/xchain-client": "1.0.9",
|
|
38
|
+
"@xchainjs/xchain-crypto": "0.3.7",
|
|
39
|
+
"@xchainjs/xchain-util": "1.0.7",
|
|
40
|
+
"@xchainjs/xchain-utxo": "1.0.9",
|
|
41
|
+
"@xchainjs/xchain-utxo-providers": "1.0.9",
|
|
42
42
|
"bitcoinjs-lib": "5.2.0",
|
|
43
43
|
"coininfo": "5.1.0",
|
|
44
44
|
"coinselect": "3.1.12"
|