mainnet-js 1.1.23 → 1.1.25

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.
@@ -214,7 +214,7 @@ export class BCMR {
214
214
  }
215
215
  }
216
216
  return result;
217
- };
217
+ }
218
218
 
219
219
  /**
220
220
  * buildAuthChain Build an authchain - Zeroth-Descendant Transaction Chain, refer to https://github.com/bitjson/chip-bcmr#zeroth-descendant-transaction-chains
@@ -409,18 +409,19 @@ export class BCMR {
409
409
  network?: string;
410
410
  }): Promise<AuthChain> {
411
411
  if (!options.chaingraphUrl) {
412
- throw new Error("Provide `chaingraphUrl` param.")
412
+ throw new Error("Provide `chaingraphUrl` param.");
413
413
  }
414
414
 
415
415
  if (options.network === undefined) {
416
416
  options.network = "mainnet";
417
417
  }
418
418
 
419
- const response = await axios.post(options.chaingraphUrl, {
420
- operationName: null,
421
- variables: {},
422
- query:
423
- `{
419
+ const response = await axios.post(
420
+ options.chaingraphUrl,
421
+ {
422
+ operationName: null,
423
+ variables: {},
424
+ query: `{
424
425
  transaction(
425
426
  where: {
426
427
  hash:{_eq:"\\\\x${options.transactionHash}"},
@@ -450,17 +451,20 @@ export class BCMR {
450
451
  }
451
452
  }
452
453
  }
453
- }`
454
- }, {
455
- responseType: "json",
456
- headers: {
457
- Accept: "*/*",
458
- "Content-Type": "application/json",
454
+ }`,
459
455
  },
460
- });
456
+ {
457
+ responseType: "json",
458
+ headers: {
459
+ Accept: "*/*",
460
+ "Content-Type": "application/json",
461
+ },
462
+ }
463
+ );
461
464
 
462
465
  const result: AuthChain = [];
463
- const migrations = response.data.data.transaction[0]?.authchains[0].migrations;
466
+ const migrations =
467
+ response.data.data.transaction[0]?.authchains[0].migrations;
464
468
  if (!migrations) {
465
469
  return result;
466
470
  }
@@ -470,13 +474,19 @@ export class BCMR {
470
474
  if (!transaction) {
471
475
  continue;
472
476
  }
473
- transaction.inputs.forEach(input => input.outpointIndex = Number(input.outpoint_index));
474
- transaction.outputs.forEach(output => {
477
+ transaction.inputs.forEach(
478
+ (input) => (input.outpointIndex = Number(input.outpoint_index))
479
+ );
480
+ transaction.outputs.forEach((output) => {
475
481
  output.outputIndex = Number(output.output_index);
476
- output.lockingBytecode = hexToBin(output.locking_bytecode.replace("\\x", ""));
482
+ output.lockingBytecode = hexToBin(
483
+ output.locking_bytecode.replace("\\x", "")
484
+ );
477
485
  });
478
486
  const txHash = transaction.hash.replace("\\x", "");
479
- result.push(BCMR.makeAuthChainElement(transaction as Transaction, txHash));
487
+ result.push(
488
+ BCMR.makeAuthChainElement(transaction as Transaction, txHash)
489
+ );
480
490
  }
481
491
 
482
492
  return result;
package/src/wallet/Wif.ts CHANGED
@@ -1229,18 +1229,8 @@ export class Wallet extends BaseWallet {
1229
1229
  }
1230
1230
 
1231
1231
  const relayFeePerByteInSatoshi = await getRelayFeeCache(this.provider!);
1232
- // console.trace(utxos.slice().filter(val => val.token).reverse().slice(0, 10))
1233
- const feeEstimate = await getFeeAmount({
1234
- utxos: utxos,
1235
- sendRequests: sendRequests,
1236
- privateKey: this.privateKey ?? Uint8Array.from([]),
1237
- sourceAddress: this.cashaddr!,
1238
- relayFeePerByteInSatoshi: relayFeePerByteInSatoshi,
1239
- slpOutputs: [],
1240
- feePaidBy: feePaidBy,
1241
- });
1232
+ const feeEstimate = 500;
1242
1233
 
1243
- // console.warn(utxos.slice().filter(val => val.token).reverse().slice(0, 10))
1244
1234
  const fundingUtxos = await getSuitableUtxos(
1245
1235
  utxos,
1246
1236
  BigInt(spendAmount) + BigInt(feeEstimate),
@@ -1250,7 +1240,6 @@ export class Wallet extends BaseWallet {
1250
1240
  options?.ensureUtxos || [],
1251
1241
  options?.tokenOperation
1252
1242
  );
1253
- // console.log(fundingUtxos.slice().filter(val => val.token).reverse().slice(0, 10))
1254
1243
  if (fundingUtxos.length === 0) {
1255
1244
  throw Error(
1256
1245
  "The available inputs couldn't satisfy the request with fees"