@xchainjs/xchain-dash 2.0.4 → 2.0.6

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
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { AssetInfo, FeeRate, TxHistoryParams } from '@xchainjs/xchain-client';
3
2
  import { Address } from '@xchainjs/xchain-util';
4
3
  import { Balance, Client as UTXOClient, Tx, TxParams, TxsPage, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo';
@@ -21,7 +20,7 @@ declare abstract class Client extends UTXOClient {
21
20
  dataProviders: import("@xchainjs/xchain-utxo/lib/types/types").UtxoOnlineDataProviders[];
22
21
  } & {
23
22
  nodeUrls: NodeUrls;
24
- nodeAuth?: NodeAuth | undefined;
23
+ nodeAuth?: NodeAuth;
25
24
  });
26
25
  /**
27
26
  * Get the asset info for DASH.
package/lib/index.esm.js CHANGED
@@ -1427,12 +1427,12 @@ const hasStandardBrowserWebWorkerEnv = (() => {
1427
1427
  const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1428
1428
 
1429
1429
  var utils = /*#__PURE__*/Object.freeze({
1430
- __proto__: null,
1431
- hasBrowserEnv: hasBrowserEnv,
1432
- hasStandardBrowserEnv: hasStandardBrowserEnv,
1433
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1434
- navigator: _navigator,
1435
- origin: origin
1430
+ __proto__: null,
1431
+ hasBrowserEnv: hasBrowserEnv,
1432
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1433
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1434
+ navigator: _navigator,
1435
+ origin: origin
1436
1436
  });
1437
1437
 
1438
1438
  var platform = {
@@ -3879,19 +3879,19 @@ const getRawTx = (p) => __awaiter(void 0, void 0, void 0, function* () {
3879
3879
  * Object containing the sizes (in bytes) of various components in a Dash transaction.
3880
3880
  */
3881
3881
  const TransactionBytes = {
3882
- Version: 2,
3883
- Type: 2,
3884
- InputCount: 1,
3885
- OutputCount: 1,
3886
- LockTime: 4,
3887
- InputPrevOutputHash: 32,
3888
- InputPrevOutputIndex: 4,
3889
- InputScriptLength: 1,
3890
- InputSequence: 4,
3891
- InputPubkeyHash: 107,
3892
- OutputPubkeyHash: 25,
3893
- OutputValue: 8,
3894
- OutputOpReturn: 1,
3882
+ Version: 2, // Size of transaction version
3883
+ Type: 2, // Size of transaction type
3884
+ InputCount: 1, // Size of input count
3885
+ OutputCount: 1, // Size of output count
3886
+ LockTime: 4, // Size of lock time
3887
+ InputPrevOutputHash: 32, // Size of input previous output hash
3888
+ InputPrevOutputIndex: 4, // Size of input previous output index
3889
+ InputScriptLength: 1, // Size of input script length
3890
+ InputSequence: 4, // Size of input sequence
3891
+ InputPubkeyHash: 107, // Size of input pubkey hash
3892
+ OutputPubkeyHash: 25, // Size of output pubkey hash
3893
+ OutputValue: 8, // Size of output value
3894
+ OutputOpReturn: 1, // Size of output OP_RETURN
3895
3895
  OutputScriptLength: 1, // Size of output script length
3896
3896
  };
3897
3897
  /**
@@ -3936,7 +3936,7 @@ const validateAddress = (address, network) => {
3936
3936
  * @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network.
3937
3937
  * @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs.
3938
3938
  */
3939
- const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __awaiter(void 0, void 0, void 0, function* () {
3939
+ const buildTx = (_a) => __awaiter(void 0, [_a], void 0, function* ({ amount, recipient, memo, feeRate, sender, network, }) {
3940
3940
  // Validate recipient address
3941
3941
  if (!validateAddress(recipient, network))
3942
3942
  throw new Error('Invalid address');
@@ -4091,8 +4091,8 @@ class Client extends Client$1 {
4091
4091
  * @returns {Promise<TxsPage>} A promise resolving to a page of transactions.
4092
4092
  */
4093
4093
  getTransactions(params) {
4094
- var _a;
4095
4094
  return __awaiter(this, void 0, void 0, function* () {
4095
+ var _a;
4096
4096
  // Extract offset and limit from parameters or set default values
4097
4097
  const offset = (_a = params === null || params === void 0 ? void 0 : params.offset) !== null && _a !== void 0 ? _a : 0;
4098
4098
  const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
@@ -4186,8 +4186,8 @@ class Client extends Client$1 {
4186
4186
  * @param {TxParams&Address&FeeRate} params - Parameters for the transaction preparation.
4187
4187
  * @returns {string} A promise resolving to the prepared transaction data.
4188
4188
  */
4189
- prepareTx({ sender, memo, amount, recipient, feeRate, }) {
4190
- return __awaiter(this, void 0, void 0, function* () {
4189
+ prepareTx(_a) {
4190
+ return __awaiter(this, arguments, void 0, function* ({ sender, memo, amount, recipient, feeRate, }) {
4191
4191
  // Build the transaction using provided parameters
4192
4192
  const { tx, utxos, inputs } = yield buildTx({
4193
4193
  sender,
@@ -4260,10 +4260,10 @@ const broadcastTx = (params) => __awaiter(void 0, void 0, void 0, function* () {
4260
4260
  const response = (yield axios.post(`${params.nodeUrl}/tx/send`, // URL endpoint for broadcasting the transaction.
4261
4261
  {
4262
4262
  jsonrpc: '2.0',
4263
- rawtx: [params.txHex],
4263
+ rawtx: [params.txHex], // Include the hexadecimal transaction in the request body.
4264
4264
  id: uniqueId,
4265
4265
  }, {
4266
- auth: params.auth,
4266
+ auth: params.auth, // Include authentication credentials if provided.
4267
4267
  timeout: 30 * 1000, // Set a timeout for the request.
4268
4268
  })).data;
4269
4269
  if (response.error) {
@@ -4313,8 +4313,8 @@ class ClientKeystore extends Client {
4313
4313
  * @param {number} index The index of the address.
4314
4314
  * @returns {Promise<string>} A promise resolving to the DASH address.
4315
4315
  */
4316
- getAddressAsync(index = 0) {
4317
- return __awaiter(this, void 0, void 0, function* () {
4316
+ getAddressAsync() {
4317
+ return __awaiter(this, arguments, void 0, function* (index = 0) {
4318
4318
  return this.getAddress(index);
4319
4319
  });
4320
4320
  }
@@ -4340,8 +4340,8 @@ class ClientKeystore extends Client {
4340
4340
  * @returns {Promise<TxHash>} A promise resolving to the transaction hash.
4341
4341
  */
4342
4342
  transfer(params) {
4343
- var _a;
4344
4343
  return __awaiter(this, void 0, void 0, function* () {
4344
+ var _a;
4345
4345
  const feeRate = params.feeRate || (yield this.getFeeRates())[FeeOption.Average];
4346
4346
  checkFeeBounds(this.feeBounds, feeRate);
4347
4347
  const fromAddressIndex = params.walletIndex || 0;
@@ -4404,8 +4404,8 @@ class ClientLedger extends Client {
4404
4404
  throw Error('Sync method not supported for Ledger');
4405
4405
  }
4406
4406
  // Get the current address asynchronously
4407
- getAddressAsync(index = 0, verify = false) {
4408
- return __awaiter(this, void 0, void 0, function* () {
4407
+ getAddressAsync() {
4408
+ return __awaiter(this, arguments, void 0, function* (index = 0, verify = false) {
4409
4409
  const app = yield this.getApp();
4410
4410
  const result = yield app.getWalletPublicKey(this.getFullDerivationPath(index), {
4411
4411
  format: 'legacy',
package/lib/index.js CHANGED
@@ -16,21 +16,21 @@ var AppBtc = require('@ledgerhq/hw-app-btc');
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
17
 
18
18
  function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
20
- var n = Object.create(null);
21
- if (e) {
22
- Object.keys(e).forEach(function (k) {
23
- if (k !== 'default') {
24
- var d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () { return e[k]; }
19
+ if (e && e.__esModule) return e;
20
+ var n = Object.create(null);
21
+ if (e) {
22
+ Object.keys(e).forEach(function (k) {
23
+ if (k !== 'default') {
24
+ var d = Object.getOwnPropertyDescriptor(e, k);
25
+ Object.defineProperty(n, k, d.get ? d : {
26
+ enumerable: true,
27
+ get: function () { return e[k]; }
28
+ });
29
+ }
28
30
  });
29
- }
30
- });
31
- }
32
- n.default = e;
33
- return Object.freeze(n);
31
+ }
32
+ n.default = e;
33
+ return Object.freeze(n);
34
34
  }
35
35
 
36
36
  var dashcore__namespace = /*#__PURE__*/_interopNamespace(dashcore);
@@ -1454,12 +1454,12 @@ const hasStandardBrowserWebWorkerEnv = (() => {
1454
1454
  const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1455
1455
 
1456
1456
  var utils = /*#__PURE__*/Object.freeze({
1457
- __proto__: null,
1458
- hasBrowserEnv: hasBrowserEnv,
1459
- hasStandardBrowserEnv: hasStandardBrowserEnv,
1460
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1461
- navigator: _navigator,
1462
- origin: origin
1457
+ __proto__: null,
1458
+ hasBrowserEnv: hasBrowserEnv,
1459
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1460
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1461
+ navigator: _navigator,
1462
+ origin: origin
1463
1463
  });
1464
1464
 
1465
1465
  var platform = {
@@ -3906,19 +3906,19 @@ const getRawTx = (p) => __awaiter(void 0, void 0, void 0, function* () {
3906
3906
  * Object containing the sizes (in bytes) of various components in a Dash transaction.
3907
3907
  */
3908
3908
  const TransactionBytes = {
3909
- Version: 2,
3910
- Type: 2,
3911
- InputCount: 1,
3912
- OutputCount: 1,
3913
- LockTime: 4,
3914
- InputPrevOutputHash: 32,
3915
- InputPrevOutputIndex: 4,
3916
- InputScriptLength: 1,
3917
- InputSequence: 4,
3918
- InputPubkeyHash: 107,
3919
- OutputPubkeyHash: 25,
3920
- OutputValue: 8,
3921
- OutputOpReturn: 1,
3909
+ Version: 2, // Size of transaction version
3910
+ Type: 2, // Size of transaction type
3911
+ InputCount: 1, // Size of input count
3912
+ OutputCount: 1, // Size of output count
3913
+ LockTime: 4, // Size of lock time
3914
+ InputPrevOutputHash: 32, // Size of input previous output hash
3915
+ InputPrevOutputIndex: 4, // Size of input previous output index
3916
+ InputScriptLength: 1, // Size of input script length
3917
+ InputSequence: 4, // Size of input sequence
3918
+ InputPubkeyHash: 107, // Size of input pubkey hash
3919
+ OutputPubkeyHash: 25, // Size of output pubkey hash
3920
+ OutputValue: 8, // Size of output value
3921
+ OutputOpReturn: 1, // Size of output OP_RETURN
3922
3922
  OutputScriptLength: 1, // Size of output script length
3923
3923
  };
3924
3924
  /**
@@ -3963,7 +3963,7 @@ const validateAddress = (address, network) => {
3963
3963
  * @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network.
3964
3964
  * @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs.
3965
3965
  */
3966
- const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __awaiter(void 0, void 0, void 0, function* () {
3966
+ const buildTx = (_a) => __awaiter(void 0, [_a], void 0, function* ({ amount, recipient, memo, feeRate, sender, network, }) {
3967
3967
  // Validate recipient address
3968
3968
  if (!validateAddress(recipient, network))
3969
3969
  throw new Error('Invalid address');
@@ -4118,8 +4118,8 @@ class Client extends xchainUtxo.Client {
4118
4118
  * @returns {Promise<TxsPage>} A promise resolving to a page of transactions.
4119
4119
  */
4120
4120
  getTransactions(params) {
4121
- var _a;
4122
4121
  return __awaiter(this, void 0, void 0, function* () {
4122
+ var _a;
4123
4123
  // Extract offset and limit from parameters or set default values
4124
4124
  const offset = (_a = params === null || params === void 0 ? void 0 : params.offset) !== null && _a !== void 0 ? _a : 0;
4125
4125
  const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
@@ -4213,8 +4213,8 @@ class Client extends xchainUtxo.Client {
4213
4213
  * @param {TxParams&Address&FeeRate} params - Parameters for the transaction preparation.
4214
4214
  * @returns {string} A promise resolving to the prepared transaction data.
4215
4215
  */
4216
- prepareTx({ sender, memo, amount, recipient, feeRate, }) {
4217
- return __awaiter(this, void 0, void 0, function* () {
4216
+ prepareTx(_a) {
4217
+ return __awaiter(this, arguments, void 0, function* ({ sender, memo, amount, recipient, feeRate, }) {
4218
4218
  // Build the transaction using provided parameters
4219
4219
  const { tx, utxos, inputs } = yield buildTx({
4220
4220
  sender,
@@ -4287,10 +4287,10 @@ const broadcastTx = (params) => __awaiter(void 0, void 0, void 0, function* () {
4287
4287
  const response = (yield axios.post(`${params.nodeUrl}/tx/send`, // URL endpoint for broadcasting the transaction.
4288
4288
  {
4289
4289
  jsonrpc: '2.0',
4290
- rawtx: [params.txHex],
4290
+ rawtx: [params.txHex], // Include the hexadecimal transaction in the request body.
4291
4291
  id: uniqueId,
4292
4292
  }, {
4293
- auth: params.auth,
4293
+ auth: params.auth, // Include authentication credentials if provided.
4294
4294
  timeout: 30 * 1000, // Set a timeout for the request.
4295
4295
  })).data;
4296
4296
  if (response.error) {
@@ -4340,8 +4340,8 @@ class ClientKeystore extends Client {
4340
4340
  * @param {number} index The index of the address.
4341
4341
  * @returns {Promise<string>} A promise resolving to the DASH address.
4342
4342
  */
4343
- getAddressAsync(index = 0) {
4344
- return __awaiter(this, void 0, void 0, function* () {
4343
+ getAddressAsync() {
4344
+ return __awaiter(this, arguments, void 0, function* (index = 0) {
4345
4345
  return this.getAddress(index);
4346
4346
  });
4347
4347
  }
@@ -4367,8 +4367,8 @@ class ClientKeystore extends Client {
4367
4367
  * @returns {Promise<TxHash>} A promise resolving to the transaction hash.
4368
4368
  */
4369
4369
  transfer(params) {
4370
- var _a;
4371
4370
  return __awaiter(this, void 0, void 0, function* () {
4371
+ var _a;
4372
4372
  const feeRate = params.feeRate || (yield this.getFeeRates())[xchainClient.FeeOption.Average];
4373
4373
  xchainClient.checkFeeBounds(this.feeBounds, feeRate);
4374
4374
  const fromAddressIndex = params.walletIndex || 0;
@@ -4431,8 +4431,8 @@ class ClientLedger extends Client {
4431
4431
  throw Error('Sync method not supported for Ledger');
4432
4432
  }
4433
4433
  // Get the current address asynchronously
4434
- getAddressAsync(index = 0, verify = false) {
4435
- return __awaiter(this, void 0, void 0, function* () {
4434
+ getAddressAsync() {
4435
+ return __awaiter(this, arguments, void 0, function* (index = 0, verify = false) {
4436
4436
  const app = yield this.getApp();
4437
4437
  const result = yield app.getWalletPublicKey(this.getFullDerivationPath(index), {
4438
4438
  format: 'legacy',
package/lib/utils.d.ts CHANGED
@@ -48,13 +48,11 @@ export declare const validateAddress: (address: Address, network: Network) => bo
48
48
  * @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network.
49
49
  * @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs.
50
50
  */
51
- export declare const buildTx: ({ amount, recipient, memo, feeRate, sender, network, }: import("@xchainjs/xchain-client").TxParams & {
52
- asset?: import("@xchainjs/xchain-util").Asset | undefined;
53
- } & {
51
+ export declare const buildTx: ({ amount, recipient, memo, feeRate, sender, network, }: TxParams & {
54
52
  feeRate: FeeRate;
55
53
  sender: Address;
56
54
  network: Network;
57
- withTxHex?: boolean | undefined;
55
+ withTxHex?: boolean;
58
56
  }) => Promise<{
59
57
  tx: Transaction;
60
58
  utxos: UTXO[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-dash",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Custom Dash client and utilities used by XChainJS clients",
5
5
  "keywords": [
6
6
  "XChain",
@@ -35,22 +35,21 @@
35
35
  "dependencies": {
36
36
  "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
37
37
  "@dashevo/dashcore-lib": "^0.25.0",
38
- "@ledgerhq/hw-app-btc": "10.9.0",
38
+ "@ledgerhq/hw-app-btc": "^10.9.0",
39
39
  "@scure/bip32": "^1.7.0",
40
- "@xchainjs/xchain-client": "2.0.4",
41
- "@xchainjs/xchain-crypto": "1.0.2",
42
- "@xchainjs/xchain-util": "2.0.3",
43
- "@xchainjs/xchain-utxo": "2.0.4",
44
- "@xchainjs/xchain-utxo-providers": "2.0.4",
40
+ "@xchainjs/xchain-client": "2.0.6",
41
+ "@xchainjs/xchain-crypto": "1.0.4",
42
+ "@xchainjs/xchain-util": "2.0.4",
43
+ "@xchainjs/xchain-utxo": "2.0.6",
44
+ "@xchainjs/xchain-utxo-providers": "2.0.6",
45
45
  "bitcoinjs-lib": "^6.1.7",
46
46
  "coinselect": "3.1.12",
47
47
  "ecpair": "2.1.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@ledgerhq/hw-transport-node-hid": "6.28.6",
51
- "@types/bitcoinjs-lib": "^5.0.4",
52
- "axios": "1.8.4",
53
- "axios-mock-adapter": "2.1.0"
50
+ "@ledgerhq/hw-transport-node-hid": "^6.28.6",
51
+ "axios": "^1.8.4",
52
+ "axios-mock-adapter": "^2.1.0"
54
53
  },
55
54
  "publishConfig": {
56
55
  "access": "public",