@xchainjs/xchain-doge 0.7.15 → 0.7.17

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 CHANGED
@@ -69,7 +69,9 @@ declare abstract class Client extends UTXOClient {
69
69
  sender: Address;
70
70
  feeRate: FeeRate;
71
71
  spendPendingUTXO?: boolean;
72
- }): Promise<PreparedTx>;
72
+ }): Promise<PreparedTx & {
73
+ utxos: UTXO[];
74
+ }>;
73
75
  /**
74
76
  * Compiles the memo into a buffer for inclusion in a Dogecoin transaction.
75
77
  *
package/lib/index.esm.js CHANGED
@@ -462,7 +462,7 @@ class Client extends Client$1 {
462
462
  prepareTx({ sender, memo, amount, recipient, feeRate, }) {
463
463
  return __awaiter(this, void 0, void 0, function* () {
464
464
  // Build the transaction (PSBT) with the specified transfer options
465
- const { psbt } = yield this.buildTx({
465
+ const { psbt, utxos } = yield this.buildTx({
466
466
  sender,
467
467
  recipient,
468
468
  amount,
@@ -470,7 +470,7 @@ class Client extends Client$1 {
470
470
  memo,
471
471
  });
472
472
  // Return the raw unsigned transaction (PSBT)
473
- return { rawUnsignedTx: psbt.toBase64() };
473
+ return { rawUnsignedTx: psbt.toBase64(), utxos };
474
474
  });
475
475
  }
476
476
  /**
@@ -658,28 +658,30 @@ class ClientLedger extends Client {
658
658
  return __awaiter(this, void 0, void 0, function* () {
659
659
  const app = yield this.getApp();
660
660
  const fromAddressIndex = (params === null || params === void 0 ? void 0 : params.walletIndex) || 0;
661
- const derivePath = this.getFullDerivationPath(fromAddressIndex);
662
661
  // Get fee rate
663
662
  const feeRate = params.feeRate || (yield this.getFeeRates())[FeeOption.Fast];
664
663
  // Get sender address
665
664
  const sender = yield this.getAddressAsync(fromAddressIndex);
666
665
  // Prepare transaction
667
- const { psbt, utxos } = yield this.buildTx(Object.assign(Object.assign({}, params), { feeRate,
668
- sender }));
666
+ const { rawUnsignedTx, utxos } = yield this.prepareTx(Object.assign(Object.assign({}, params), { sender, feeRate }));
667
+ const psbt = Dogecoin.Psbt.fromBase64(rawUnsignedTx);
669
668
  // Prepare Ledger inputs
670
- const inputs = utxos.map(({ txHex, hash, index }) => {
669
+ const ledgerInputs = utxos.map(({ txHex, hash, index }) => {
671
670
  if (!txHex) {
672
671
  throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`);
673
672
  }
674
673
  const splittedTx = app.splitTransaction(txHex, false /* no segwit support */);
675
674
  return [splittedTx, index, null, null];
676
675
  });
677
- const associatedKeysets = inputs.map((_) => derivePath);
678
- const newTxHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex');
679
- const newTx = app.splitTransaction(newTxHex, true);
676
+ // Prepare associated keysets
677
+ const associatedKeysets = ledgerInputs.map(() => this.getFullDerivationPath(fromAddressIndex));
678
+ // Convert the raw unsigned transaction to a Transaction object
679
+ // Serialize unsigned transaction
680
+ const unsignedHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex');
681
+ const newTx = app.splitTransaction(unsignedHex, true);
680
682
  const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex');
681
683
  const txHex = yield app.createPaymentTransaction({
682
- inputs,
684
+ inputs: ledgerInputs,
683
685
  associatedKeysets,
684
686
  outputScriptHex,
685
687
  // no additionals - similar to https://github.com/shapeshift/hdwallet/blob/a61234eb83081a4de54750b8965b873b15803a03/packages/hdwallet-ledger/src/bitcoin.ts#L222
@@ -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 } 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', synth: false }\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, PreparedTx, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, 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> {\n // Build the transaction (PSBT) with the specified transfer options\n const { psbt } = 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() }\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, TxParams, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\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, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { UtxoClientParams } from '@xchainjs/xchain-utxo'\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 const derivePath = this.getFullDerivationPath(fromAddressIndex)\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 { psbt, utxos } = await this.buildTx({\n ...params,\n feeRate,\n sender,\n })\n // Prepare Ledger inputs\n const inputs: Array<[Transaction, number, string | null, number | null]> = utxos.map(({ 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 const associatedKeysets: string[] = inputs.map((_) => derivePath)\n const newTxHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex')\n const newTx: Transaction = app.splitTransaction(newTxHex, true)\n\n const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex')\n\n const txHex = await app.createPaymentTransaction({\n inputs,\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":["TX_EMPTY_SIZE","TX_INPUT_BASE","TX_INPUT_PUBKEYHASH","TX_OUTPUT_BASE","TX_OUTPUT_PUBKEYHASH","inputBytes","utils","require$$0","UTXOClient","accumulative","Utils.dogeNetwork","Utils.validateAddress","Utils.inputBytes","Utils.TX_EMPTY_SIZE","Utils.TX_OUTPUT_BASE","Utils.TX_OUTPUT_PUBKEYHASH","dogeNetwork"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAIA,eAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AACjC,IAAIC,eAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AAClC,IAAIC,qBAAmB,GAAG,IAAG;AAC7B,IAAIC,gBAAc,GAAG,CAAC,GAAG,EAAC;AAC1B,IAAIC,sBAAoB,GAAG,GAAE;AAC7B;AACA,SAASC,YAAU,EAAE,KAAK,EAAE;AAC5B,EAAE,OAAOJ,eAAa,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAGC,qBAAmB,CAAC;AACnF,CAAC;AACD;AACA,SAAS,WAAW,EAAE,MAAM,EAAE;AAC9B,EAAE,OAAOC,gBAAc,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAGC,sBAAoB,CAAC;AACvF,CAAC;AACD;AACA,SAAS,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;AACzC;AACA,EAAE,OAAOC,YAAU,CAAC,EAAE,CAAC,GAAG,OAAO;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{"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 } 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', synth: false }\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, PreparedTx, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, 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, TxParams, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\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, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { 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":["TX_EMPTY_SIZE","TX_INPUT_BASE","TX_INPUT_PUBKEYHASH","TX_OUTPUT_BASE","TX_OUTPUT_PUBKEYHASH","inputBytes","utils","require$$0","UTXOClient","accumulative","Utils.dogeNetwork","Utils.validateAddress","Utils.inputBytes","Utils.TX_EMPTY_SIZE","Utils.TX_OUTPUT_BASE","Utils.TX_OUTPUT_PUBKEYHASH","dogeNetwork"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAIA,eAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AACjC,IAAIC,eAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AAClC,IAAIC,qBAAmB,GAAG,IAAG;AAC7B,IAAIC,gBAAc,G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,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;;AC3FD;;;;;;;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;;;;"}
package/lib/index.js CHANGED
@@ -490,7 +490,7 @@ class Client extends xchainUtxo.Client {
490
490
  prepareTx({ sender, memo, amount, recipient, feeRate, }) {
491
491
  return __awaiter(this, void 0, void 0, function* () {
492
492
  // Build the transaction (PSBT) with the specified transfer options
493
- const { psbt } = yield this.buildTx({
493
+ const { psbt, utxos } = yield this.buildTx({
494
494
  sender,
495
495
  recipient,
496
496
  amount,
@@ -498,7 +498,7 @@ class Client extends xchainUtxo.Client {
498
498
  memo,
499
499
  });
500
500
  // Return the raw unsigned transaction (PSBT)
501
- return { rawUnsignedTx: psbt.toBase64() };
501
+ return { rawUnsignedTx: psbt.toBase64(), utxos };
502
502
  });
503
503
  }
504
504
  /**
@@ -686,28 +686,30 @@ class ClientLedger extends Client {
686
686
  return __awaiter(this, void 0, void 0, function* () {
687
687
  const app = yield this.getApp();
688
688
  const fromAddressIndex = (params === null || params === void 0 ? void 0 : params.walletIndex) || 0;
689
- const derivePath = this.getFullDerivationPath(fromAddressIndex);
690
689
  // Get fee rate
691
690
  const feeRate = params.feeRate || (yield this.getFeeRates())[xchainClient.FeeOption.Fast];
692
691
  // Get sender address
693
692
  const sender = yield this.getAddressAsync(fromAddressIndex);
694
693
  // Prepare transaction
695
- const { psbt, utxos } = yield this.buildTx(Object.assign(Object.assign({}, params), { feeRate,
696
- sender }));
694
+ const { rawUnsignedTx, utxos } = yield this.prepareTx(Object.assign(Object.assign({}, params), { sender, feeRate }));
695
+ const psbt = Dogecoin__namespace.Psbt.fromBase64(rawUnsignedTx);
697
696
  // Prepare Ledger inputs
698
- const inputs = utxos.map(({ txHex, hash, index }) => {
697
+ const ledgerInputs = utxos.map(({ txHex, hash, index }) => {
699
698
  if (!txHex) {
700
699
  throw Error(`Missing 'txHex' for UTXO (txHash ${hash})`);
701
700
  }
702
701
  const splittedTx = app.splitTransaction(txHex, false /* no segwit support */);
703
702
  return [splittedTx, index, null, null];
704
703
  });
705
- const associatedKeysets = inputs.map((_) => derivePath);
706
- const newTxHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex');
707
- const newTx = app.splitTransaction(newTxHex, true);
704
+ // Prepare associated keysets
705
+ const associatedKeysets = ledgerInputs.map(() => this.getFullDerivationPath(fromAddressIndex));
706
+ // Convert the raw unsigned transaction to a Transaction object
707
+ // Serialize unsigned transaction
708
+ const unsignedHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex');
709
+ const newTx = app.splitTransaction(unsignedHex, true);
708
710
  const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex');
709
711
  const txHex = yield app.createPaymentTransaction({
710
- inputs,
712
+ inputs: ledgerInputs,
711
713
  associatedKeysets,
712
714
  outputScriptHex,
713
715
  // no additionals - similar to https://github.com/shapeshift/hdwallet/blob/a61234eb83081a4de54750b8965b873b15803a03/packages/hdwallet-ledger/src/bitcoin.ts#L222
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 } 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', synth: false }\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, PreparedTx, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, 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> {\n // Build the transaction (PSBT) with the specified transfer options\n const { psbt } = 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() }\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, TxParams, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\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, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { UtxoClientParams } from '@xchainjs/xchain-utxo'\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 const derivePath = this.getFullDerivationPath(fromAddressIndex)\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 { psbt, utxos } = await this.buildTx({\n ...params,\n feeRate,\n sender,\n })\n // Prepare Ledger inputs\n const inputs: Array<[Transaction, number, string | null, number | null]> = utxos.map(({ 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 const associatedKeysets: string[] = inputs.map((_) => derivePath)\n const newTxHex = psbt.data.globalMap.unsignedTx.toBuffer().toString('hex')\n const newTx: Transaction = app.splitTransaction(newTxHex, true)\n\n const outputScriptHex = app.serializeTransactionOutputs(newTx).toString('hex')\n\n const txHex = await app.createPaymentTransaction({\n inputs,\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":["TX_EMPTY_SIZE","TX_INPUT_BASE","TX_INPUT_PUBKEYHASH","TX_OUTPUT_BASE","TX_OUTPUT_PUBKEYHASH","inputBytes","utils","require$$0","ExplorerProvider","Network","SochainProvider","SochainNetwork","BlockcypherProvider","BlockcypherNetwork","BitgoProvider","coininfo","Dogecoin","UTXOClient","accumulative","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;AACA,IAAIA,eAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AACjC,IAAIC,eAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AAClC,IAAIC,qBAAmB,GAAG,IAAG;AAC7B,IAAIC,gBAAc,GAAG,CAAC,GAAG,EAAC;AAC1B,IAAIC,sBAAoB,GAAG,GAAE;AAC7B;AACA,SAASC,YAAU,EAAE,KAAK,EAAE;AAC5B,EAAE,OAAOJ,eAAa,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MA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A,MAAM,KAAK,CAAC,YAAY,CAAC,CAAA;AAC1B,aAAA;AAED,YAAA,OAAO,MAAM,CAAA;SACd,CAAA,CAAA;AAAA,KAAA;AACF;;AC3FD;;;;;;;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;;;;;;;;;;;;;;;;;;;"}
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 } 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', synth: false }\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, PreparedTx, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { Client as UTXOClient, 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, TxParams, checkFeeBounds } from '@xchainjs/xchain-client'\nimport { getSeed } from '@xchainjs/xchain-crypto'\nimport { Address } from '@xchainjs/xchain-util'\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, TxParams } from '@xchainjs/xchain-client'\nimport { Address } from '@xchainjs/xchain-util'\nimport { 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":["TX_EMPTY_SIZE","TX_INPUT_BASE","TX_INPUT_PUBKEYHASH","TX_OUTPUT_BASE","TX_OUTPUT_PUBKEYHASH","inputBytes","utils","require$$0","ExplorerProvider","Network","SochainProvider","SochainNetwork","BlockcypherProvider","BlockcypherNetwork","BitgoProvider","coininfo","Dogecoin","UTXOClient","accumulative","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;AACA,IAAIA,eAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AACjC,IAAIC,eAAa,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAC;AAClC,IAAIC,qBAAmB,GAAG,IAAG;AAC7B,IAAIC,gBAAc,GAAG,CAAC,GAAG,EAAC;AAC1B,IAAIC,sBAAoB,GAAG,GAAE;AAC7B;AACA,SAASC,YAAU,EAAE,KAAK,EAAE;AAC5B,EAAE,OAAOJ,eAAa,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAGC,qBAAmB,CAAC;AACnF,CAAC;AACD;AACA,SAAS,WAAW,EAAE,MAAM,EAAE;AAC9B,EAAE,OAAOC,gBAAc,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAGC,sBAAoB,CAAC;AACvF,CAAC;AACD;AACA,SAAS,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;AACzC;AACA,EAAE,OAAOC,YAAU,CAAC,EAAE,CAAC,GAAG,OAAO;AACjC,CAAC;AACD;AACA,SAAS,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE;AAC5C,EAAE,OAAOL,eAAa;AACtB,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE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
  {
2
2
  "name": "@xchainjs/xchain-doge",
3
- "version": "0.7.15",
3
+ "version": "0.7.17",
4
4
  "description": "Custom Doge client and utilities used by XChain clients",
5
5
  "keywords": [
6
6
  "Xchain",
@@ -33,21 +33,21 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@ledgerhq/hw-app-btc": "10.1.0",
36
- "@xchainjs/xchain-client": "*",
37
- "@xchainjs/xchain-crypto": "*",
38
- "@xchainjs/xchain-util": "*",
39
- "@xchainjs/xchain-utxo": "*",
40
- "@xchainjs/xchain-utxo-providers": "*",
36
+ "@xchainjs/xchain-client": "workspace:*",
37
+ "@xchainjs/xchain-crypto": "workspace:*",
38
+ "@xchainjs/xchain-util": "workspace:*",
39
+ "@xchainjs/xchain-utxo": "workspace:*",
40
+ "@xchainjs/xchain-utxo-providers": "workspace:*",
41
41
  "bitcoinjs-lib": "5.2.0",
42
42
  "coininfo": "5.1.0",
43
43
  "coinselect": "3.1.12"
44
44
  },
45
45
  "devDependencies": {
46
- "@ledgerhq/hw-transport-node-hid": "^6.28.0",
46
+ "@ledgerhq/hw-transport-node-hid": "6.28.6",
47
47
  "axios": "1.3.6",
48
48
  "axios-mock-adapter": "1.20.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  }
53
- }
53
+ }