@xchainjs/xchain-dash 1.0.6 → 1.0.8

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/index.js CHANGED
@@ -10,7 +10,10 @@ var coininfo = require('coininfo');
10
10
  var xchainCrypto = require('@xchainjs/xchain-crypto');
11
11
  var AppBtc = require('@ledgerhq/hw-app-btc');
12
12
 
13
- function _interopNamespaceDefault(e) {
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
14
17
  var n = Object.create(null);
15
18
  if (e) {
16
19
  Object.keys(e).forEach(function (k) {
@@ -27,9 +30,10 @@ function _interopNamespaceDefault(e) {
27
30
  return Object.freeze(n);
28
31
  }
29
32
 
30
- var dashcore__namespace = /*#__PURE__*/_interopNamespaceDefault(dashcore);
31
- var Dash__namespace = /*#__PURE__*/_interopNamespaceDefault(Dash);
32
- var coininfo__namespace = /*#__PURE__*/_interopNamespaceDefault(coininfo);
33
+ var dashcore__namespace = /*#__PURE__*/_interopNamespace(dashcore);
34
+ var Dash__namespace = /*#__PURE__*/_interopNamespace(Dash);
35
+ var coininfo__namespace = /*#__PURE__*/_interopNamespace(coininfo);
36
+ var AppBtc__default = /*#__PURE__*/_interopDefault(AppBtc);
33
37
 
34
38
  /**
35
39
  * Minimum transaction fee in duff/kB.
@@ -124,7 +128,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
124
128
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
125
129
  PERFORMANCE OF THIS SOFTWARE.
126
130
  ***************************************************************************** */
127
- /* global Reflect, Promise, SuppressedError, Symbol */
131
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
128
132
 
129
133
 
130
134
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -4154,7 +4158,7 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
4154
4158
  if (memo) {
4155
4159
  tx.addData(memo);
4156
4160
  }
4157
- return { tx, utxos }; // Return the built transaction and its UTXOs
4161
+ return { tx, utxos, inputs }; // Return the built transaction and its UTXOs
4158
4162
  });
4159
4163
  /**
4160
4164
  * Function to get the prefix for a given network.
@@ -4351,7 +4355,7 @@ class Client extends xchainUtxo.Client {
4351
4355
  prepareTx({ sender, memo, amount, recipient, feeRate, }) {
4352
4356
  return __awaiter(this, void 0, void 0, function* () {
4353
4357
  // Build the transaction using provided parameters
4354
- const { tx, utxos } = yield buildTx({
4358
+ const { tx, utxos, inputs } = yield buildTx({
4355
4359
  sender,
4356
4360
  recipient,
4357
4361
  memo,
@@ -4360,7 +4364,7 @@ class Client extends xchainUtxo.Client {
4360
4364
  network: this.network,
4361
4365
  });
4362
4366
  // Return the raw unsigned transaction and UTXOs
4363
- return { rawUnsignedTx: tx.toString(), utxos };
4367
+ return { rawUnsignedTx: tx.toString(), utxos, inputs };
4364
4368
  });
4365
4369
  }
4366
4370
  /**
@@ -4556,7 +4560,7 @@ class ClientLedger extends Client {
4556
4560
  if (this.app) {
4557
4561
  return this.app;
4558
4562
  }
4559
- this.app = new AppBtc({ transport: this.transport, currency: 'dash' });
4563
+ this.app = new AppBtc__default.default({ transport: this.transport, currency: 'dash' });
4560
4564
  return this.app;
4561
4565
  });
4562
4566
  }
@@ -4582,16 +4586,17 @@ class ClientLedger extends Client {
4582
4586
  const fromAddressIndex = (params === null || params === void 0 ? void 0 : params.walletIndex) || 0;
4583
4587
  // Get fee rate
4584
4588
  const feeRate = params.feeRate || (yield this.getFeeRates())[xchainClient.FeeOption.Fast];
4589
+ xchainClient.checkFeeBounds(this.feeBounds, feeRate);
4585
4590
  // Get sender address
4586
4591
  const sender = yield this.getAddressAsync(fromAddressIndex);
4587
4592
  // Prepare transaction
4588
- const { rawUnsignedTx, utxos } = yield this.prepareTx(Object.assign(Object.assign({}, params), { sender, feeRate }));
4593
+ const { rawUnsignedTx, inputs } = yield this.prepareTx(Object.assign(Object.assign({}, params), { sender, feeRate }));
4589
4594
  const tx = new dashcore__namespace.Transaction(rawUnsignedTx);
4590
4595
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4591
4596
  const ledgerInputs = [];
4592
4597
  for (const input of tx.inputs) {
4593
4598
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4594
- const insightUtxo = utxos.find((utxo) => {
4599
+ const insightUtxo = inputs.find((utxo) => {
4595
4600
  return utxo.hash === input.prevTxId.toString('hex') && utxo.index == input.outputIndex;
4596
4601
  });
4597
4602
  if (!insightUtxo) {