@fuel-ts/account 0.101.1 → 0.101.2

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.
@@ -405,7 +405,7 @@ var launchNode = /* @__PURE__ */ __name(async ({
405
405
  ), "launchNode");
406
406
 
407
407
  // src/test-utils/setup-test-provider-and-wallets.ts
408
- var import_utils46 = require("@fuel-ts/utils");
408
+ var import_utils47 = require("@fuel-ts/utils");
409
409
  var import_ramda10 = require("ramda");
410
410
 
411
411
  // src/providers/coin-quantity.ts
@@ -447,7 +447,7 @@ var import_address4 = require("@fuel-ts/address");
447
447
  var import_errors21 = require("@fuel-ts/errors");
448
448
  var import_math20 = require("@fuel-ts/math");
449
449
  var import_transactions25 = require("@fuel-ts/transactions");
450
- var import_utils32 = require("@fuel-ts/utils");
450
+ var import_utils33 = require("@fuel-ts/utils");
451
451
  var import_versions = require("@fuel-ts/versions");
452
452
  var import_graphql_request = require("graphql-request");
453
453
  var import_graphql_tag2 = __toESM(require("graphql-tag"));
@@ -2891,58 +2891,97 @@ ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
2891
2891
  });
2892
2892
  }, "assemblePanicError");
2893
2893
  var stringify = /* @__PURE__ */ __name((obj) => JSON.stringify(obj, null, 2), "stringify");
2894
- var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
2894
+ var assembleSignalErrorMessage = /* @__PURE__ */ __name((reasonHex, logs, metadata) => {
2895
2895
  let errorMessage = "The transaction reverted with an unknown reason.";
2896
- const revertReceipt = receipts.find(({ type }) => type === import_transactions7.ReceiptType.Revert);
2897
2896
  let reason = "";
2898
- if (revertReceipt) {
2899
- const reasonHex = (0, import_math8.bn)(revertReceipt.val).toHex();
2900
- const lastLog = logs[logs.length - 1];
2901
- const lastButOneLog = logs[logs.length - 2];
2902
- switch (reasonHex) {
2903
- case import_configs5.FAILED_REQUIRE_SIGNAL: {
2904
- reason = "require";
2905
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
2906
- break;
2907
- }
2908
- case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
2909
- const suffix = logs.length >= 2 ? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.` : ".";
2910
- reason = "assert_eq";
2911
- errorMessage = `The transaction reverted because of an "assert_eq" statement${suffix}`;
2912
- break;
2913
- }
2914
- case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
2915
- const suffix = logs.length >= 2 ? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.` : ".";
2916
- reason = "assert_ne";
2917
- errorMessage = `The transaction reverted because of an "assert_ne" statement${suffix}`;
2918
- break;
2919
- }
2920
- case import_configs5.FAILED_ASSERT_SIGNAL:
2921
- reason = "assert";
2922
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
2923
- break;
2924
- case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
2925
- reason = "MissingOutputVariable";
2926
- errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
2927
- break;
2928
- default:
2929
- throw new import_errors9.FuelError(
2930
- import_errors9.ErrorCode.UNKNOWN,
2931
- `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
2932
- {
2933
- ...metadata,
2934
- reason: "unknown"
2935
- }
2936
- );
2897
+ const lastLog = logs[logs.length - 1];
2898
+ const lastButOneLog = logs[logs.length - 2];
2899
+ switch (reasonHex) {
2900
+ case import_configs5.FAILED_REQUIRE_SIGNAL: {
2901
+ reason = "require";
2902
+ errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
2903
+ break;
2904
+ }
2905
+ case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
2906
+ const suffix = logs.length >= 2 ? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.` : ".";
2907
+ reason = "assert_eq";
2908
+ errorMessage = `The transaction reverted because of an "assert_eq" statement${suffix}`;
2909
+ break;
2910
+ }
2911
+ case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
2912
+ const suffix = logs.length >= 2 ? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.` : ".";
2913
+ reason = "assert_ne";
2914
+ errorMessage = `The transaction reverted because of an "assert_ne" statement${suffix}`;
2915
+ break;
2916
+ }
2917
+ case import_configs5.FAILED_ASSERT_SIGNAL:
2918
+ reason = "assert";
2919
+ errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
2920
+ break;
2921
+ case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
2922
+ reason = "MissingOutputVariable";
2923
+ errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
2924
+ break;
2925
+ default:
2926
+ reason = `revert_with_log`;
2927
+ errorMessage = `The transaction reverted because a "revert_with_log" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
2928
+ break;
2929
+ }
2930
+ return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2931
+ ...metadata,
2932
+ reason
2933
+ });
2934
+ }, "assembleSignalErrorMessage");
2935
+ function buildAbiErrorMessage(abiError, logs, metadata, reason) {
2936
+ const { pos, msg } = abiError;
2937
+ let errorMessage = "";
2938
+ const positionMessage = pos ? `
2939
+
2940
+ This error originated at ${JSON.stringify(pos, null, 2)}` : "";
2941
+ if (msg) {
2942
+ errorMessage = `A sway "panic" expression was invoked with the message: "${msg}".${positionMessage}`;
2943
+ } else {
2944
+ const value = logs[logs.length - 1];
2945
+ errorMessage = `A sway "panic" expression was invoked with the value: ${JSON.stringify(value)}.${positionMessage}`;
2946
+ }
2947
+ return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2948
+ ...metadata,
2949
+ reason
2950
+ });
2951
+ }
2952
+ __name(buildAbiErrorMessage, "buildAbiErrorMessage");
2953
+ function findErrorInAbis(statusReason, abis = []) {
2954
+ for (const abi of abis) {
2955
+ if (abi.errorCodes?.[statusReason]) {
2956
+ return abi.errorCodes[statusReason];
2937
2957
  }
2938
2958
  }
2959
+ return void 0;
2960
+ }
2961
+ __name(findErrorInAbis, "findErrorInAbis");
2962
+ var assembleRevertError = /* @__PURE__ */ __name((_receipts, logs, metadata, statusReason, abis) => {
2963
+ const match = statusReason.match(/Revert\((\d+)\)/);
2964
+ const reason = match?.[1] ?? statusReason;
2965
+ const reasonHex = (0, import_math8.bn)(reason).toHex();
2966
+ if (Object.values(import_configs5.SwaySignalErrors).includes(reasonHex)) {
2967
+ return assembleSignalErrorMessage(reasonHex, logs, metadata);
2968
+ }
2969
+ let abiError;
2970
+ if (abis) {
2971
+ const abisArr = [abis.main, ...Object.values(abis.otherContractsAbis)];
2972
+ abiError = findErrorInAbis(reason, abisArr);
2973
+ }
2974
+ if (abiError) {
2975
+ return buildAbiErrorMessage(abiError, logs, metadata, reason);
2976
+ }
2977
+ const errorMessage = `The transaction reverted with reason: ${reason}.`;
2939
2978
  return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2940
2979
  ...metadata,
2941
2980
  reason
2942
2981
  });
2943
2982
  }, "assembleRevertError");
2944
2983
  var extractTxError = /* @__PURE__ */ __name((params) => {
2945
- const { receipts, statusReason, logs, groupedLogs } = params;
2984
+ const { receipts, statusReason, logs, groupedLogs, abis } = params;
2946
2985
  const isPanic = receipts.some(({ type }) => type === import_transactions7.ReceiptType.Panic);
2947
2986
  const isRevert = receipts.some(({ type }) => type === import_transactions7.ReceiptType.Revert);
2948
2987
  const metadata = {
@@ -2956,7 +2995,7 @@ var extractTxError = /* @__PURE__ */ __name((params) => {
2956
2995
  if (isPanic) {
2957
2996
  return assemblePanicError(statusReason, metadata);
2958
2997
  }
2959
- return assembleRevertError(receipts, logs, metadata);
2998
+ return assembleRevertError(receipts, logs, metadata, statusReason, abis);
2960
2999
  }, "extractTxError");
2961
3000
 
2962
3001
  // src/providers/utils/merge-quantities.ts
@@ -4500,12 +4539,12 @@ var ResourceCache = class {
4500
4539
  var import_errors19 = require("@fuel-ts/errors");
4501
4540
  var import_math19 = require("@fuel-ts/math");
4502
4541
  var import_transactions23 = require("@fuel-ts/transactions");
4503
- var import_utils29 = require("@fuel-ts/utils");
4542
+ var import_utils30 = require("@fuel-ts/utils");
4504
4543
 
4505
4544
  // src/providers/transaction-summary/assemble-transaction-summary.ts
4506
4545
  var import_math18 = require("@fuel-ts/math");
4507
4546
  var import_transactions21 = require("@fuel-ts/transactions");
4508
- var import_utils27 = require("@fuel-ts/utils");
4547
+ var import_utils28 = require("@fuel-ts/utils");
4509
4548
 
4510
4549
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
4511
4550
  var import_math14 = require("@fuel-ts/math");
@@ -4578,6 +4617,45 @@ var import_configs11 = require("@fuel-ts/address/configs");
4578
4617
  var import_errors17 = require("@fuel-ts/errors");
4579
4618
  var import_math16 = require("@fuel-ts/math");
4580
4619
  var import_transactions19 = require("@fuel-ts/transactions");
4620
+ var import_utils26 = require("@fuel-ts/utils");
4621
+
4622
+ // src/providers/transaction-summary/call.ts
4623
+ var import_abi_coder5 = require("@fuel-ts/abi-coder");
4624
+ var import_abi_coder6 = require("@fuel-ts/abi-coder");
4625
+ var getFunctionCall = /* @__PURE__ */ __name(({
4626
+ abi,
4627
+ receipt,
4628
+ offset,
4629
+ scriptData
4630
+ }) => {
4631
+ const [functionSelector, argumentsOffset] = new import_abi_coder5.StdStringCoder().decode(scriptData, offset);
4632
+ const abiInterface = new import_abi_coder6.Interface(abi);
4633
+ const functionFragment = abiInterface.getFunction(functionSelector);
4634
+ const inputs = functionFragment.jsonFn.inputs;
4635
+ let argumentsProvided;
4636
+ if (inputs.length) {
4637
+ const functionArgsBytes = scriptData.slice(argumentsOffset);
4638
+ const decodedArguments = functionFragment.decodeArguments(functionArgsBytes);
4639
+ argumentsProvided = inputs.reduce((prev, input, index) => {
4640
+ const value = decodedArguments?.[index];
4641
+ const name = input.name;
4642
+ if (name) {
4643
+ return {
4644
+ ...prev,
4645
+ // reparse to remove bn
4646
+ [name]: JSON.parse(JSON.stringify(value))
4647
+ };
4648
+ }
4649
+ return prev;
4650
+ }, {});
4651
+ }
4652
+ return {
4653
+ functionSignature: functionFragment.signature,
4654
+ functionName: functionFragment.name,
4655
+ argumentsProvided,
4656
+ ...receipt.amount?.isZero() ? {} : { amount: receipt.amount, assetId: receipt.assetId }
4657
+ };
4658
+ }, "getFunctionCall");
4581
4659
 
4582
4660
  // src/providers/transaction-summary/input.ts
4583
4661
  var import_errors16 = require("@fuel-ts/errors");
@@ -4861,12 +4939,45 @@ function getWithdrawFromFuelOperations({
4861
4939
  return withdrawFromFuelOperations;
4862
4940
  }
4863
4941
  __name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
4864
- function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
4865
- const abi = abiMap?.[contractInput.contractID];
4866
- if (!abi) {
4867
- return [];
4942
+ function findBytesSegmentIndex(whole, segment) {
4943
+ for (let i = 0; i <= whole.length - segment.length; i++) {
4944
+ let match = true;
4945
+ for (let j = 0; j < segment.length; j++) {
4946
+ if (whole[i + j] !== segment[j]) {
4947
+ match = false;
4948
+ break;
4949
+ }
4950
+ }
4951
+ if (match) {
4952
+ return i;
4953
+ }
4868
4954
  }
4869
- return [];
4955
+ return -1;
4956
+ }
4957
+ __name(findBytesSegmentIndex, "findBytesSegmentIndex");
4958
+ function getContractCalls(contractInput, abiMap, receipt, scriptData) {
4959
+ const calls = [];
4960
+ const abi = abiMap?.[contractInput.contractID];
4961
+ if (!abi || !scriptData) {
4962
+ return calls;
4963
+ }
4964
+ const bytesSegment = (0, import_utils26.concat)([
4965
+ (0, import_utils26.arrayify)(receipt.to),
4966
+ // Contract ID (32 bytes)
4967
+ (0, import_math16.toBytes)(receipt.param1.toHex(), 8),
4968
+ // Function selector offset (8 bytes)
4969
+ (0, import_math16.toBytes)(receipt.param2.toHex(), 8)
4970
+ // Function args offset (8 bytes)
4971
+ ]);
4972
+ const segmentIndex = findBytesSegmentIndex(scriptData, bytesSegment);
4973
+ const canDecodeFunctionCall = segmentIndex !== -1;
4974
+ if (!canDecodeFunctionCall) {
4975
+ return calls;
4976
+ }
4977
+ const offset = segmentIndex + bytesSegment.length;
4978
+ const call = getFunctionCall({ abi, receipt, offset, scriptData });
4979
+ calls.push(call);
4980
+ return calls;
4870
4981
  }
4871
4982
  __name(getContractCalls, "getContractCalls");
4872
4983
  function getAssetsSent(receipt) {
@@ -4878,14 +4989,14 @@ function getAssetsSent(receipt) {
4878
4989
  ];
4879
4990
  }
4880
4991
  __name(getAssetsSent, "getAssetsSent");
4881
- function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
4992
+ function processCallReceipt(receipt, contractInput, inputs, abiMap, scriptData, baseAssetId) {
4882
4993
  const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
4883
4994
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
4884
4995
  if (!input) {
4885
4996
  return [];
4886
4997
  }
4887
4998
  const inputAddress = getInputAccountAddress(input);
4888
- const calls = getContractCalls(contractInput, abiMap, receipt, rawPayload, maxInputs);
4999
+ const calls = getContractCalls(contractInput, abiMap, receipt, scriptData);
4889
5000
  return [
4890
5001
  {
4891
5002
  name: "Contract call" /* contractCall */,
@@ -4910,7 +5021,6 @@ function getContractCallOperations({
4910
5021
  receipts,
4911
5022
  abiMap,
4912
5023
  rawPayload,
4913
- maxInputs,
4914
5024
  baseAssetId
4915
5025
  }) {
4916
5026
  const contractCallReceipts = getReceiptsCall(receipts);
@@ -4920,16 +5030,15 @@ function getContractCallOperations({
4920
5030
  if (!contractInput) {
4921
5031
  return [];
4922
5032
  }
5033
+ let scriptData;
5034
+ if (rawPayload) {
5035
+ const [transaction] = new import_transactions19.TransactionCoder().decode((0, import_utils26.arrayify)(rawPayload), 0);
5036
+ if (transaction.type === import_transactions19.TransactionType.Script) {
5037
+ scriptData = (0, import_utils26.arrayify)(transaction.scriptData);
5038
+ }
5039
+ }
4923
5040
  return contractCallReceipts.filter((receipt) => receipt.to === contractInput.contractID).flatMap(
4924
- (receipt) => processCallReceipt(
4925
- receipt,
4926
- contractInput,
4927
- inputs,
4928
- abiMap,
4929
- rawPayload,
4930
- maxInputs,
4931
- baseAssetId
4932
- )
5041
+ (receipt) => processCallReceipt(receipt, contractInput, inputs, abiMap, scriptData, baseAssetId)
4933
5042
  );
4934
5043
  });
4935
5044
  }
@@ -5253,7 +5362,7 @@ function assembleTransactionSummary(params) {
5253
5362
  baseAssetId
5254
5363
  } = params;
5255
5364
  const gasUsed = getGasUsedFromReceipts(receipts);
5256
- const rawPayload = (0, import_utils27.hexlify)(transactionBytes);
5365
+ const rawPayload = (0, import_utils28.hexlify)(transactionBytes);
5257
5366
  const operations = getOperations({
5258
5367
  transactionType: transaction.type,
5259
5368
  inputs: transaction.inputs || [],
@@ -5284,7 +5393,7 @@ function assembleTransactionSummary(params) {
5284
5393
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
5285
5394
  let date;
5286
5395
  if (time) {
5287
- date = import_utils27.DateTime.fromTai64(time);
5396
+ date = import_utils28.DateTime.fromTai64(time);
5288
5397
  }
5289
5398
  const transactionSummary = {
5290
5399
  id,
@@ -5345,7 +5454,7 @@ function assemblePreConfirmationTransactionSummary(params) {
5345
5454
  type = getTransactionTypeName(transaction.type);
5346
5455
  tip = (0, import_math18.bn)(transaction.policies?.find((policy) => policy.type === import_transactions21.PolicyType.Tip)?.data);
5347
5456
  if (receipts) {
5348
- const rawPayload = (0, import_utils27.hexlify)(new import_transactions21.TransactionCoder().encode(transaction));
5457
+ const rawPayload = (0, import_utils28.hexlify)(new import_transactions21.TransactionCoder().encode(transaction));
5349
5458
  operations = getOperations({
5350
5459
  transactionType: transaction.type,
5351
5460
  inputs: transaction.inputs || [],
@@ -5391,7 +5500,7 @@ function assemblePreConfirmationTransactionSummary(params) {
5391
5500
  __name(assemblePreConfirmationTransactionSummary, "assemblePreConfirmationTransactionSummary");
5392
5501
 
5393
5502
  // src/providers/transaction-response/getAllDecodedLogs.ts
5394
- var import_abi_coder5 = require("@fuel-ts/abi-coder");
5503
+ var import_abi_coder7 = require("@fuel-ts/abi-coder");
5395
5504
  var import_configs12 = require("@fuel-ts/address/configs");
5396
5505
  var import_transactions22 = require("@fuel-ts/transactions");
5397
5506
  function getAllDecodedLogs(opts) {
@@ -5411,8 +5520,8 @@ function getAllDecodedLogs(opts) {
5411
5520
  const isLogFromMainAbi = receipt.id === import_configs12.ZeroBytes32 || mainContract === receipt.id;
5412
5521
  const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
5413
5522
  if (isDecodable) {
5414
- const interfaceToUse = isLogFromMainAbi ? new import_abi_coder5.Interface(mainAbi) : new import_abi_coder5.Interface(externalAbis[receipt.id]);
5415
- const data = receipt.type === import_transactions22.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
5523
+ const interfaceToUse = isLogFromMainAbi ? new import_abi_coder7.Interface(mainAbi) : new import_abi_coder7.Interface(externalAbis[receipt.id]);
5524
+ const data = receipt.type === import_transactions22.ReceiptType.Log ? new import_abi_coder7.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
5416
5525
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
5417
5526
  logs.push(decodedLog);
5418
5527
  groupedLogs[receipt.id] = [...groupedLogs[receipt.id] || [], decodedLog];
@@ -5511,7 +5620,7 @@ var TransactionResponse = class _TransactionResponse {
5511
5620
  }
5512
5621
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
5513
5622
  const { rawPayload } = gqlTransaction;
5514
- const bytes = (0, import_utils29.arrayify)(rawPayload);
5623
+ const bytes = (0, import_utils30.arrayify)(rawPayload);
5515
5624
  const [tx] = new import_transactions23.TransactionCoder().decode(bytes, 0);
5516
5625
  return {
5517
5626
  tx,
@@ -5699,6 +5808,7 @@ var TransactionResponse = class _TransactionResponse {
5699
5808
  ...transactionSummary
5700
5809
  };
5701
5810
  let { logs, groupedLogs } = { logs: [], groupedLogs: {} };
5811
+ let abis;
5702
5812
  if (this.abis) {
5703
5813
  ({ logs, groupedLogs } = getAllDecodedLogs({
5704
5814
  receipts: transactionSummary.receipts,
@@ -5707,6 +5817,7 @@ var TransactionResponse = class _TransactionResponse {
5707
5817
  }));
5708
5818
  transactionResult.logs = logs;
5709
5819
  transactionResult.groupedLogs = groupedLogs;
5820
+ abis = this.abis;
5710
5821
  }
5711
5822
  const { receipts } = transactionResult;
5712
5823
  const status = this.getTransactionStatus();
@@ -5716,7 +5827,8 @@ var TransactionResponse = class _TransactionResponse {
5716
5827
  receipts,
5717
5828
  statusReason: reason,
5718
5829
  logs,
5719
- groupedLogs
5830
+ groupedLogs,
5831
+ abis
5720
5832
  });
5721
5833
  }
5722
5834
  return transactionResult;
@@ -5778,12 +5890,12 @@ var TransactionResponse = class _TransactionResponse {
5778
5890
  };
5779
5891
 
5780
5892
  // src/providers/transaction-response/getDecodedLogs.ts
5781
- var import_abi_coder6 = require("@fuel-ts/abi-coder");
5893
+ var import_abi_coder8 = require("@fuel-ts/abi-coder");
5782
5894
  var import_configs13 = require("@fuel-ts/address/configs");
5783
5895
  var import_transactions24 = require("@fuel-ts/transactions");
5784
5896
 
5785
5897
  // src/providers/utils/auto-retry-fetch.ts
5786
- var import_utils31 = require("@fuel-ts/utils");
5898
+ var import_utils32 = require("@fuel-ts/utils");
5787
5899
  function getWaitDelay(options, retryAttemptNum) {
5788
5900
  const duration = options.baseDelay ?? 150;
5789
5901
  switch (options.backoff) {
@@ -5814,7 +5926,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
5814
5926
  throw error;
5815
5927
  }
5816
5928
  const delay = getWaitDelay(options, retryNum);
5817
- await (0, import_utils31.sleep)(delay);
5929
+ await (0, import_utils32.sleep)(delay);
5818
5930
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
5819
5931
  }
5820
5932
  };
@@ -5954,7 +6066,7 @@ var Provider = class _Provider {
5954
6066
  return url.replace(/-sub$/, "");
5955
6067
  }
5956
6068
  static hasWriteOperationHappened(url) {
5957
- return (0, import_utils32.isDefined)(_Provider.currentBlockHeightCache[this.normalizeUrl(url)]);
6069
+ return (0, import_utils33.isDefined)(_Provider.currentBlockHeightCache[this.normalizeUrl(url)]);
5958
6070
  }
5959
6071
  /**
5960
6072
  * @hidden
@@ -6009,14 +6121,14 @@ var Provider = class _Provider {
6009
6121
  }
6010
6122
  const retryAttempt = retryOptions.maxRetries - retriesLeft + 1;
6011
6123
  const sleepTime = getWaitDelay(retryOptions, retryAttempt);
6012
- await (0, import_utils32.sleep)(sleepTime);
6124
+ await (0, import_utils33.sleep)(sleepTime);
6013
6125
  response = await fetchFn();
6014
6126
  }
6015
6127
  return response;
6016
6128
  }
6017
6129
  static setCurrentBlockHeight(url, height) {
6018
6130
  const writeOperationHappened = _Provider.hasWriteOperationHappened(url);
6019
- if (!(0, import_utils32.isDefined)(height) || !writeOperationHappened) {
6131
+ if (!(0, import_utils33.isDefined)(height) || !writeOperationHappened) {
6020
6132
  return;
6021
6133
  }
6022
6134
  const normalizedUrl = _Provider.normalizeUrl(url);
@@ -6051,7 +6163,7 @@ var Provider = class _Provider {
6051
6163
  _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
6052
6164
  _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
6053
6165
  }
6054
- if ((0, import_utils32.isDefined)(resourceCacheTTL)) {
6166
+ if ((0, import_utils33.isDefined)(resourceCacheTTL)) {
6055
6167
  if (resourceCacheTTL !== -1) {
6056
6168
  this.cache = new ResourceCache(resourceCacheTTL);
6057
6169
  } else {
@@ -6414,7 +6526,7 @@ var Provider = class _Provider {
6414
6526
  await this.estimateTxDependencies(transactionRequest);
6415
6527
  }
6416
6528
  await this.validateTransaction(transactionRequest);
6417
- const encodedTransaction = (0, import_utils32.hexlify)(transactionRequest.toTransactionBytes());
6529
+ const encodedTransaction = (0, import_utils33.hexlify)(transactionRequest.toTransactionBytes());
6418
6530
  let abis;
6419
6531
  if (isTransactionTypeScript(transactionRequest)) {
6420
6532
  abis = transactionRequest.abis;
@@ -6445,7 +6557,7 @@ var Provider = class _Provider {
6445
6557
  if (estimateTxDependencies) {
6446
6558
  return this.estimateTxDependencies(transactionRequest);
6447
6559
  }
6448
- const encodedTransaction = (0, import_utils32.hexlify)(transactionRequest.toTransactionBytes());
6560
+ const encodedTransaction = (0, import_utils33.hexlify)(transactionRequest.toTransactionBytes());
6449
6561
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
6450
6562
  encodedTransactions: encodedTransaction,
6451
6563
  utxoValidation: utxoValidation || false
@@ -6469,7 +6581,7 @@ var Provider = class _Provider {
6469
6581
  if (!shouldEstimatePredicates) {
6470
6582
  return transactionRequest;
6471
6583
  }
6472
- const encodedTransaction = (0, import_utils32.hexlify)(transactionRequest.toTransactionBytes());
6584
+ const encodedTransaction = (0, import_utils33.hexlify)(transactionRequest.toTransactionBytes());
6473
6585
  const response = await this.operations.estimatePredicates({
6474
6586
  encodedTransaction
6475
6587
  });
@@ -6501,7 +6613,7 @@ var Provider = class _Provider {
6501
6613
  estimatePredicates
6502
6614
  } = await this.operations.estimatePredicatesAndGasPrice({
6503
6615
  blockHorizon: String(blockHorizon),
6504
- encodedTransaction: (0, import_utils32.hexlify)(transactionRequest.toTransactionBytes())
6616
+ encodedTransaction: (0, import_utils33.hexlify)(transactionRequest.toTransactionBytes())
6505
6617
  });
6506
6618
  transactionRequest = this.parseEstimatePredicatesResponse(
6507
6619
  transactionRequest,
@@ -6539,7 +6651,7 @@ var Provider = class _Provider {
6539
6651
  const {
6540
6652
  dryRun: [{ receipts: serializedReceipts, status }]
6541
6653
  } = await this.operations.dryRun({
6542
- encodedTransactions: [(0, import_utils32.hexlify)(transactionRequest.toTransactionBytes())],
6654
+ encodedTransactions: [(0, import_utils33.hexlify)(transactionRequest.toTransactionBytes())],
6543
6655
  utxoValidation: false,
6544
6656
  gasPrice: gasPrice.toString()
6545
6657
  });
@@ -6594,7 +6706,7 @@ var Provider = class _Provider {
6594
6706
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
6595
6707
  allRequests.forEach((req, index) => {
6596
6708
  if (isTransactionTypeScript(req)) {
6597
- serializedTransactionsMap.set(index, (0, import_utils32.hexlify)(req.toTransactionBytes()));
6709
+ serializedTransactionsMap.set(index, (0, import_utils33.hexlify)(req.toTransactionBytes()));
6598
6710
  }
6599
6711
  });
6600
6712
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -6630,7 +6742,7 @@ var Provider = class _Provider {
6630
6742
  transactionRequest: request
6631
6743
  });
6632
6744
  request.maxFee = maxFee;
6633
- serializedTransactionsMap.set(requestIdx, (0, import_utils32.hexlify)(request.toTransactionBytes()));
6745
+ serializedTransactionsMap.set(requestIdx, (0, import_utils33.hexlify)(request.toTransactionBytes()));
6634
6746
  nextRoundTransactions.push(requestIdx);
6635
6747
  }
6636
6748
  }
@@ -6651,7 +6763,7 @@ var Provider = class _Provider {
6651
6763
  if (estimateTxDependencies) {
6652
6764
  return this.estimateMultipleTxDependencies(transactionRequests);
6653
6765
  }
6654
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils32.hexlify)(tx.toTransactionBytes()));
6766
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils33.hexlify)(tx.toTransactionBytes()));
6655
6767
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
6656
6768
  encodedTransactions,
6657
6769
  utxoValidation: utxoValidation || false
@@ -6701,7 +6813,7 @@ var Provider = class _Provider {
6701
6813
  const chainInfo = await this.getChain();
6702
6814
  const { gasPriceFactor, maxGasPerTx } = await this.getGasConfig();
6703
6815
  const minGas = transactionRequest.calculateMinGas(chainInfo);
6704
- if (!(0, import_utils32.isDefined)(gasPrice)) {
6816
+ if (!(0, import_utils33.isDefined)(gasPrice)) {
6705
6817
  gasPrice = await this.estimateGasPrice(10);
6706
6818
  }
6707
6819
  const minFee = calculateGasFee({
@@ -6753,7 +6865,7 @@ var Provider = class _Provider {
6753
6865
  if (estimateTxDependencies) {
6754
6866
  return this.estimateTxDependencies(transactionRequest);
6755
6867
  }
6756
- const encodedTransactions = [(0, import_utils32.hexlify)(transactionRequest.toTransactionBytes())];
6868
+ const encodedTransactions = [(0, import_utils33.hexlify)(transactionRequest.toTransactionBytes())];
6757
6869
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
6758
6870
  encodedTransactions,
6759
6871
  utxoValidation: true
@@ -6916,7 +7028,7 @@ var Provider = class _Provider {
6916
7028
  const {
6917
7029
  assembleTx: { status, transaction: gqlTransaction, gasPrice }
6918
7030
  } = await this.operations.assembleTx({
6919
- tx: (0, import_utils32.hexlify)(request.toTransactionBytes()),
7031
+ tx: (0, import_utils33.hexlify)(request.toTransactionBytes()),
6920
7032
  blockHorizon: String(blockHorizon),
6921
7033
  feeAddressIndex: String(feePayerIndex),
6922
7034
  requiredBalances,
@@ -6968,7 +7080,7 @@ var Provider = class _Provider {
6968
7080
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
6969
7081
  inputArgs: paginationArgs
6970
7082
  }),
6971
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils32.hexlify)(assetId) }
7083
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils33.hexlify)(assetId) }
6972
7084
  });
6973
7085
  const coins = edges.map(({ node }) => ({
6974
7086
  id: node.utxoId,
@@ -7000,7 +7112,7 @@ var Provider = class _Provider {
7000
7112
  const coinsQuery = {
7001
7113
  owner: ownerAddress.toB256(),
7002
7114
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
7003
- assetId: (0, import_utils32.hexlify)(assetId),
7115
+ assetId: (0, import_utils33.hexlify)(assetId),
7004
7116
  amount: (amount.eqn(0) ? (0, import_math20.bn)(1) : amount).toString(10),
7005
7117
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
7006
7118
  })),
@@ -7158,7 +7270,7 @@ var Provider = class _Provider {
7158
7270
  },
7159
7271
  transactionIds: block.transactions.map((tx) => tx.id),
7160
7272
  transactions: block.transactions.map(
7161
- (tx) => new import_transactions25.TransactionCoder().decode((0, import_utils32.arrayify)(tx.rawPayload), 0)?.[0]
7273
+ (tx) => new import_transactions25.TransactionCoder().decode((0, import_utils33.arrayify)(tx.rawPayload), 0)?.[0]
7162
7274
  )
7163
7275
  };
7164
7276
  }
@@ -7175,7 +7287,7 @@ var Provider = class _Provider {
7175
7287
  }
7176
7288
  try {
7177
7289
  return new import_transactions25.TransactionCoder().decode(
7178
- (0, import_utils32.arrayify)(transaction.rawPayload),
7290
+ (0, import_utils33.arrayify)(transaction.rawPayload),
7179
7291
  0
7180
7292
  )?.[0];
7181
7293
  } catch (error) {
@@ -7203,7 +7315,7 @@ var Provider = class _Provider {
7203
7315
  const coder = new import_transactions25.TransactionCoder();
7204
7316
  const transactions = edges.map(({ node: { rawPayload } }) => {
7205
7317
  try {
7206
- return coder.decode((0, import_utils32.arrayify)(rawPayload), 0)[0];
7318
+ return coder.decode((0, import_utils33.arrayify)(rawPayload), 0)[0];
7207
7319
  } catch (error) {
7208
7320
  if (error instanceof import_errors21.FuelError && error.code === import_errors21.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
7209
7321
  console.warn("Unsupported transaction type encountered");
@@ -7252,7 +7364,7 @@ var Provider = class _Provider {
7252
7364
  async getContractBalance(contractId, assetId) {
7253
7365
  const { contractBalance } = await this.operations.getContractBalance({
7254
7366
  contract: new import_address4.Address(contractId).toB256(),
7255
- asset: (0, import_utils32.hexlify)(assetId)
7367
+ asset: (0, import_utils33.hexlify)(assetId)
7256
7368
  });
7257
7369
  return (0, import_math20.bn)(contractBalance.amount, 10);
7258
7370
  }
@@ -7266,7 +7378,7 @@ var Provider = class _Provider {
7266
7378
  async getBalance(owner, assetId) {
7267
7379
  const { balance } = await this.operations.getBalanceV2({
7268
7380
  owner: new import_address4.Address(owner).toB256(),
7269
- assetId: (0, import_utils32.hexlify)(assetId)
7381
+ assetId: (0, import_utils33.hexlify)(assetId)
7270
7382
  });
7271
7383
  return (0, import_math20.bn)(balance.amountU128, 10);
7272
7384
  }
@@ -7471,7 +7583,7 @@ var Provider = class _Provider {
7471
7583
  async produceBlocks(amount, startTime) {
7472
7584
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
7473
7585
  blocksToProduce: (0, import_math20.bn)(amount).toString(10),
7474
- startTimestamp: startTime ? import_utils32.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
7586
+ startTimestamp: startTime ? import_utils33.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
7475
7587
  });
7476
7588
  return (0, import_math20.bn)(latestBlockHeight);
7477
7589
  }
@@ -7574,18 +7686,21 @@ var Provider = class _Provider {
7574
7686
  extractDryRunError(transactionRequest, receipts, reason) {
7575
7687
  let logs = [];
7576
7688
  let groupedLogs = {};
7689
+ let abis;
7577
7690
  if (transactionRequest.type === import_transactions25.TransactionType.Script && transactionRequest.abis) {
7578
7691
  ({ logs, groupedLogs } = getAllDecodedLogs({
7579
7692
  receipts,
7580
7693
  mainAbi: transactionRequest.abis.main,
7581
7694
  externalAbis: transactionRequest.abis.otherContractsAbis
7582
7695
  }));
7696
+ abis = transactionRequest.abis;
7583
7697
  }
7584
7698
  return extractTxError({
7585
7699
  logs,
7586
7700
  groupedLogs,
7587
7701
  receipts,
7588
- statusReason: reason
7702
+ statusReason: reason,
7703
+ abis
7589
7704
  });
7590
7705
  }
7591
7706
  /**
@@ -7624,8 +7739,8 @@ var Provider = class _Provider {
7624
7739
  */
7625
7740
  async adjustResourcesToIgnoreForAddresses(addresses, resourcesIdsToIgnore) {
7626
7741
  const final = {
7627
- messages: resourcesIdsToIgnore?.messages?.map((nonce) => (0, import_utils32.hexlify)(nonce)) || [],
7628
- utxos: resourcesIdsToIgnore?.utxos?.map((id) => (0, import_utils32.hexlify)(id)) || []
7742
+ messages: resourcesIdsToIgnore?.messages?.map((nonce) => (0, import_utils33.hexlify)(nonce)) || [],
7743
+ utxos: resourcesIdsToIgnore?.utxos?.map((id) => (0, import_utils33.hexlify)(id)) || []
7629
7744
  };
7630
7745
  if (this.cache) {
7631
7746
  const cache2 = this.cache;
@@ -7657,16 +7772,16 @@ var Provider = class _Provider {
7657
7772
  var import_errors22 = require("@fuel-ts/errors");
7658
7773
  var import_math21 = require("@fuel-ts/math");
7659
7774
  var import_transactions26 = require("@fuel-ts/transactions");
7660
- var import_utils34 = require("@fuel-ts/utils");
7775
+ var import_utils35 = require("@fuel-ts/utils");
7661
7776
 
7662
7777
  // src/providers/transaction-summary/assemble-transaction-summary-from-serialized.ts
7663
7778
  var import_math22 = require("@fuel-ts/math");
7664
7779
  var import_transactions27 = require("@fuel-ts/transactions");
7665
- var import_utils35 = require("@fuel-ts/utils");
7780
+ var import_utils36 = require("@fuel-ts/utils");
7666
7781
 
7667
7782
  // src/test-utils/test-asset-id.ts
7668
7783
  var import_crypto4 = require("@fuel-ts/crypto");
7669
- var import_utils36 = require("@fuel-ts/utils");
7784
+ var import_utils37 = require("@fuel-ts/utils");
7670
7785
  var TestAssetId = class _TestAssetId {
7671
7786
  constructor(value) {
7672
7787
  this.value = value;
@@ -7683,7 +7798,7 @@ var TestAssetId = class _TestAssetId {
7683
7798
  static random(count = 1) {
7684
7799
  const assetIds = [];
7685
7800
  for (let i = 0; i < count; i++) {
7686
- assetIds.push(new _TestAssetId((0, import_utils36.hexlify)((0, import_crypto4.randomBytes)(32))));
7801
+ assetIds.push(new _TestAssetId((0, import_utils37.hexlify)((0, import_crypto4.randomBytes)(32))));
7687
7802
  }
7688
7803
  return assetIds;
7689
7804
  }
@@ -7693,20 +7808,20 @@ var TestAssetId = class _TestAssetId {
7693
7808
  var import_crypto9 = require("@fuel-ts/crypto");
7694
7809
  var import_errors28 = require("@fuel-ts/errors");
7695
7810
  var import_math25 = require("@fuel-ts/math");
7696
- var import_utils45 = require("@fuel-ts/utils");
7811
+ var import_utils46 = require("@fuel-ts/utils");
7697
7812
 
7698
7813
  // src/wallet/base-wallet-unlocked.ts
7699
7814
  var import_hasher4 = require("@fuel-ts/hasher");
7700
- var import_utils40 = require("@fuel-ts/utils");
7815
+ var import_utils41 = require("@fuel-ts/utils");
7701
7816
 
7702
7817
  // src/account.ts
7703
- var import_abi_coder8 = require("@fuel-ts/abi-coder");
7818
+ var import_abi_coder10 = require("@fuel-ts/abi-coder");
7704
7819
  var import_address6 = require("@fuel-ts/address");
7705
7820
  var import_crypto5 = require("@fuel-ts/crypto");
7706
7821
  var import_errors23 = require("@fuel-ts/errors");
7707
7822
  var import_math23 = require("@fuel-ts/math");
7708
7823
  var import_transactions28 = require("@fuel-ts/transactions");
7709
- var import_utils38 = require("@fuel-ts/utils");
7824
+ var import_utils39 = require("@fuel-ts/utils");
7710
7825
  var import_ramda9 = require("ramda");
7711
7826
 
7712
7827
  // src/types.ts
@@ -7717,17 +7832,17 @@ var AbstractAccount = class {
7717
7832
  };
7718
7833
 
7719
7834
  // src/utils/formatTransferToContractScriptData.ts
7720
- var import_abi_coder7 = require("@fuel-ts/abi-coder");
7835
+ var import_abi_coder9 = require("@fuel-ts/abi-coder");
7721
7836
  var import_address5 = require("@fuel-ts/address");
7722
- var import_utils37 = require("@fuel-ts/utils");
7837
+ var import_utils38 = require("@fuel-ts/utils");
7723
7838
  var asm = __toESM(require("@fuels/vm-asm"));
7724
7839
  var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
7725
- const numberCoder = new import_abi_coder7.BigNumberCoder("u64");
7840
+ const numberCoder = new import_abi_coder9.BigNumberCoder("u64");
7726
7841
  return transferParams.reduce((acc, transferParam) => {
7727
7842
  const { assetId, amount, contractId } = transferParam;
7728
7843
  const encoded = numberCoder.encode(amount);
7729
- const scriptData = (0, import_utils37.concat)([new import_address5.Address(contractId).toBytes(), encoded, (0, import_utils37.arrayify)(assetId)]);
7730
- return (0, import_utils37.concat)([acc, scriptData]);
7844
+ const scriptData = (0, import_utils38.concat)([new import_address5.Address(contractId).toBytes(), encoded, (0, import_utils38.arrayify)(assetId)]);
7845
+ return (0, import_utils38.concat)([acc, scriptData]);
7731
7846
  }, new Uint8Array());
7732
7847
  }, "formatTransferToContractScriptData");
7733
7848
  var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferParams) => {
@@ -7735,24 +7850,24 @@ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferPar
7735
7850
  await asm.initWasm();
7736
7851
  let script = new Uint8Array();
7737
7852
  transferParams.forEach((_, i) => {
7738
- const offset = (import_abi_coder7.CONTRACT_ID_LEN + import_abi_coder7.WORD_SIZE + import_abi_coder7.ASSET_ID_LEN) * i;
7739
- script = (0, import_utils37.concat)([
7853
+ const offset = (import_abi_coder9.CONTRACT_ID_LEN + import_abi_coder9.WORD_SIZE + import_abi_coder9.ASSET_ID_LEN) * i;
7854
+ script = (0, import_utils38.concat)([
7740
7855
  script,
7741
7856
  // Load ScriptData into register 0x10.
7742
7857
  asm.gtf(16, 0, asm.GTFArgs.ScriptData).to_bytes(),
7743
7858
  // Add the offset to 0x10 so it will point to the current contract ID, store in 0x11.
7744
7859
  asm.addi(17, 16, offset).to_bytes(),
7745
7860
  // Add CONTRACT_ID_LEN to 0x11 to point to the amount in the ScriptData, store in 0x12.
7746
- asm.addi(18, 17, import_abi_coder7.CONTRACT_ID_LEN).to_bytes(),
7861
+ asm.addi(18, 17, import_abi_coder9.CONTRACT_ID_LEN).to_bytes(),
7747
7862
  // Load word to the amount at 0x12 into register 0x13.
7748
7863
  asm.lw(19, 18, 0).to_bytes(),
7749
7864
  // Add WORD_SIZE to 0x12 to point to the asset ID in the ScriptData, store in 0x14.
7750
- asm.addi(20, 18, import_abi_coder7.WORD_SIZE).to_bytes(),
7865
+ asm.addi(20, 18, import_abi_coder9.WORD_SIZE).to_bytes(),
7751
7866
  // Perform the transfer using contract ID in 0x11, amount in 0x13, and asset ID in 0x14.
7752
7867
  asm.tr(17, 19, 20).to_bytes()
7753
7868
  ]);
7754
7869
  });
7755
- script = (0, import_utils37.concat)([script, asm.ret(1).to_bytes()]);
7870
+ script = (0, import_utils38.concat)([script, asm.ret(1).to_bytes()]);
7756
7871
  return { script, scriptData };
7757
7872
  }, "assembleTransferToContractScript");
7758
7873
 
@@ -8102,7 +8217,7 @@ var Account = class extends AbstractAccount {
8102
8217
  const transferParams = contractTransferParams.map((transferParam) => {
8103
8218
  const amount = (0, import_math23.bn)(transferParam.amount);
8104
8219
  const contractAddress = new import_address6.Address(transferParam.contractId);
8105
- const assetId = transferParam.assetId ? (0, import_utils38.hexlify)(transferParam.assetId) : defaultAssetId;
8220
+ const assetId = transferParam.assetId ? (0, import_utils39.hexlify)(transferParam.assetId) : defaultAssetId;
8106
8221
  if (amount.lte(0)) {
8107
8222
  throw new import_errors23.FuelError(
8108
8223
  import_errors23.ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -8140,14 +8255,14 @@ var Account = class extends AbstractAccount {
8140
8255
  */
8141
8256
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
8142
8257
  const recipientAddress = new import_address6.Address(recipient);
8143
- const recipientDataArray = (0, import_utils38.arrayify)(
8258
+ const recipientDataArray = (0, import_utils39.arrayify)(
8144
8259
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
8145
8260
  );
8146
- const amountDataArray = (0, import_utils38.arrayify)(
8261
+ const amountDataArray = (0, import_utils39.arrayify)(
8147
8262
  "0x".concat((0, import_math23.bn)(amount).toHex().substring(2).padStart(16, "0"))
8148
8263
  );
8149
8264
  const script = new Uint8Array([
8150
- ...(0, import_utils38.arrayify)(withdrawScript.bytes),
8265
+ ...(0, import_utils39.arrayify)(withdrawScript.bytes),
8151
8266
  ...recipientDataArray,
8152
8267
  ...amountDataArray
8153
8268
  ]);
@@ -8437,7 +8552,7 @@ var Account = class extends AbstractAccount {
8437
8552
  */
8438
8553
  generateFakeResources(coins) {
8439
8554
  return coins.map((coin) => ({
8440
- id: (0, import_utils38.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder8.UTXO_ID_LEN)),
8555
+ id: (0, import_utils39.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder10.UTXO_ID_LEN)),
8441
8556
  owner: this.address,
8442
8557
  blockCreated: (0, import_math23.bn)(1),
8443
8558
  txCreatedIdx: (0, import_math23.bn)(1),
@@ -8447,7 +8562,7 @@ var Account = class extends AbstractAccount {
8447
8562
  /** @hidden */
8448
8563
  async prepareTransactionForSend(request) {
8449
8564
  const { transactionId } = request.flag;
8450
- if (!(0, import_utils38.isDefined)(transactionId)) {
8565
+ if (!(0, import_utils39.isDefined)(transactionId)) {
8451
8566
  return request;
8452
8567
  }
8453
8568
  const chainId = await this.provider.getChainId();
@@ -8460,10 +8575,10 @@ var Account = class extends AbstractAccount {
8460
8575
  /** @hidden */
8461
8576
  async prepareTransactionSummary(request) {
8462
8577
  const chainId = await this.provider.getChainId();
8463
- return (0, import_utils38.isDefined)(request.flag.summary) ? {
8578
+ return (0, import_utils39.isDefined)(request.flag.summary) ? {
8464
8579
  ...request.flag.summary,
8465
8580
  id: request.getTransactionId(chainId),
8466
- transactionBytes: (0, import_utils38.hexlify)(request.toTransactionBytes())
8581
+ transactionBytes: (0, import_utils39.hexlify)(request.toTransactionBytes())
8467
8582
  } : void 0;
8468
8583
  }
8469
8584
  /** @hidden * */
@@ -8508,7 +8623,7 @@ var Account = class extends AbstractAccount {
8508
8623
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
8509
8624
  }) {
8510
8625
  const request = transactionRequestify(transactionRequest);
8511
- if (!(0, import_utils38.isDefined)(setGasLimit)) {
8626
+ if (!(0, import_utils39.isDefined)(setGasLimit)) {
8512
8627
  request.gasLimit = gasUsed;
8513
8628
  } else if (gasUsed.gt(setGasLimit)) {
8514
8629
  throw new import_errors23.FuelError(
@@ -8516,7 +8631,7 @@ var Account = class extends AbstractAccount {
8516
8631
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
8517
8632
  );
8518
8633
  }
8519
- if (!(0, import_utils38.isDefined)(setMaxFee)) {
8634
+ if (!(0, import_utils39.isDefined)(setMaxFee)) {
8520
8635
  request.maxFee = maxFee;
8521
8636
  } else if (maxFee.gt(setMaxFee)) {
8522
8637
  throw new import_errors23.FuelError(
@@ -8561,7 +8676,7 @@ var Account = class extends AbstractAccount {
8561
8676
  var import_address7 = require("@fuel-ts/address");
8562
8677
  var import_crypto6 = require("@fuel-ts/crypto");
8563
8678
  var import_errors24 = require("@fuel-ts/errors");
8564
- var import_utils39 = require("@fuel-ts/utils");
8679
+ var import_utils40 = require("@fuel-ts/utils");
8565
8680
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
8566
8681
  var DEFAULT_KDF_PARAMS_R = 8;
8567
8682
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -8644,7 +8759,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
8644
8759
  );
8645
8760
  }
8646
8761
  const buffer = await (0, import_crypto6.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
8647
- const privateKey = (0, import_utils39.hexlify)(buffer);
8762
+ const privateKey = (0, import_utils40.hexlify)(buffer);
8648
8763
  return privateKey;
8649
8764
  }
8650
8765
  __name(decryptKeystoreWallet, "decryptKeystoreWallet");
@@ -8697,7 +8812,7 @@ var BaseWalletUnlocked = class extends Account {
8697
8812
  */
8698
8813
  async signMessage(message) {
8699
8814
  const signedMessage = await this.signer().sign((0, import_hasher4.hashMessage)(message));
8700
- return (0, import_utils40.hexlify)(signedMessage);
8815
+ return (0, import_utils41.hexlify)(signedMessage);
8701
8816
  }
8702
8817
  /**
8703
8818
  * Signs a transaction with the wallet's private key.
@@ -8710,7 +8825,7 @@ var BaseWalletUnlocked = class extends Account {
8710
8825
  const chainId = await this.provider.getChainId();
8711
8826
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
8712
8827
  const signature = await this.signer().sign(hashedTransaction);
8713
- return (0, import_utils40.hexlify)(signature);
8828
+ return (0, import_utils41.hexlify)(signature);
8714
8829
  }
8715
8830
  /**
8716
8831
  * Populates a transaction with the witnesses signature.
@@ -8781,13 +8896,13 @@ var import_crypto8 = require("@fuel-ts/crypto");
8781
8896
  var import_errors27 = require("@fuel-ts/errors");
8782
8897
  var import_hasher7 = require("@fuel-ts/hasher");
8783
8898
  var import_math24 = require("@fuel-ts/math");
8784
- var import_utils44 = require("@fuel-ts/utils");
8899
+ var import_utils45 = require("@fuel-ts/utils");
8785
8900
 
8786
8901
  // src/mnemonic/mnemonic.ts
8787
8902
  var import_crypto7 = require("@fuel-ts/crypto");
8788
8903
  var import_errors26 = require("@fuel-ts/errors");
8789
8904
  var import_hasher6 = require("@fuel-ts/hasher");
8790
- var import_utils42 = require("@fuel-ts/utils");
8905
+ var import_utils43 = require("@fuel-ts/utils");
8791
8906
 
8792
8907
  // src/wordlists/words/english.ts
8793
8908
  var english = [
@@ -10844,7 +10959,7 @@ var english = [
10844
10959
  // src/mnemonic/utils.ts
10845
10960
  var import_errors25 = require("@fuel-ts/errors");
10846
10961
  var import_hasher5 = require("@fuel-ts/hasher");
10847
- var import_utils41 = require("@fuel-ts/utils");
10962
+ var import_utils42 = require("@fuel-ts/utils");
10848
10963
  function getLowerMask(bits) {
10849
10964
  return (1 << bits) - 1;
10850
10965
  }
@@ -10883,7 +10998,7 @@ function entropyToMnemonicIndices(entropy) {
10883
10998
  }
10884
10999
  }
10885
11000
  const checksumBits = entropy.length / 4;
10886
- const checksum = (0, import_utils41.arrayify)((0, import_hasher5.sha256)(entropy))[0] & getUpperMask(checksumBits);
11001
+ const checksum = (0, import_utils42.arrayify)((0, import_hasher5.sha256)(entropy))[0] & getUpperMask(checksumBits);
10887
11002
  indices[indices.length - 1] <<= checksumBits;
10888
11003
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
10889
11004
  return indices;
@@ -10891,7 +11006,7 @@ function entropyToMnemonicIndices(entropy) {
10891
11006
  __name(entropyToMnemonicIndices, "entropyToMnemonicIndices");
10892
11007
  function mnemonicWordsToEntropy(words, wordlist) {
10893
11008
  const size = Math.ceil(11 * words.length / 8);
10894
- const entropy = (0, import_utils41.arrayify)(new Uint8Array(size));
11009
+ const entropy = (0, import_utils42.arrayify)(new Uint8Array(size));
10895
11010
  let offset = 0;
10896
11011
  for (let i = 0; i < words.length; i += 1) {
10897
11012
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -10911,7 +11026,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
10911
11026
  const entropyBits = 32 * words.length / 3;
10912
11027
  const checksumBits = words.length / 3;
10913
11028
  const checksumMask = getUpperMask(checksumBits);
10914
- const checksum = (0, import_utils41.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
11029
+ const checksum = (0, import_utils42.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
10915
11030
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
10916
11031
  throw new import_errors25.FuelError(
10917
11032
  import_errors25.ErrorCode.INVALID_CHECKSUM,
@@ -10923,7 +11038,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
10923
11038
  __name(mnemonicWordsToEntropy, "mnemonicWordsToEntropy");
10924
11039
 
10925
11040
  // src/mnemonic/mnemonic.ts
10926
- var MasterSecret = (0, import_utils42.toUtf8Bytes)("Bitcoin seed");
11041
+ var MasterSecret = (0, import_utils43.toUtf8Bytes)("Bitcoin seed");
10927
11042
  var MainnetPRV = "0x0488ade4";
10928
11043
  var TestnetPRV = "0x04358394";
10929
11044
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
@@ -10993,7 +11108,7 @@ var Mnemonic = class _Mnemonic {
10993
11108
  static mnemonicToEntropy(phrase, wordlist = english) {
10994
11109
  const words = getWords(phrase);
10995
11110
  assertMnemonic(words);
10996
- return (0, import_utils42.hexlify)(mnemonicWordsToEntropy(words, wordlist));
11111
+ return (0, import_utils43.hexlify)(mnemonicWordsToEntropy(words, wordlist));
10997
11112
  }
10998
11113
  /**
10999
11114
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -11001,7 +11116,7 @@ var Mnemonic = class _Mnemonic {
11001
11116
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
11002
11117
  */
11003
11118
  static entropyToMnemonic(entropy, wordlist = english) {
11004
- const entropyBytes = (0, import_utils42.arrayify)(entropy);
11119
+ const entropyBytes = (0, import_utils43.arrayify)(entropy);
11005
11120
  assertWordList(wordlist);
11006
11121
  assertEntropy(entropyBytes);
11007
11122
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -11013,8 +11128,8 @@ var Mnemonic = class _Mnemonic {
11013
11128
  */
11014
11129
  static mnemonicToSeed(phrase, passphrase = "") {
11015
11130
  assertMnemonic(getWords(phrase));
11016
- const phraseBytes = (0, import_utils42.toUtf8Bytes)(getPhrase(phrase));
11017
- const salt = (0, import_utils42.toUtf8Bytes)(`mnemonic${passphrase}`);
11131
+ const phraseBytes = (0, import_utils43.toUtf8Bytes)(getPhrase(phrase));
11132
+ const salt = (0, import_utils43.toUtf8Bytes)(`mnemonic${passphrase}`);
11018
11133
  return (0, import_crypto7.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
11019
11134
  }
11020
11135
  /**
@@ -11070,14 +11185,14 @@ var Mnemonic = class _Mnemonic {
11070
11185
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
11071
11186
  */
11072
11187
  static masterKeysFromSeed(seed) {
11073
- const seedArray = (0, import_utils42.arrayify)(seed);
11188
+ const seedArray = (0, import_utils43.arrayify)(seed);
11074
11189
  if (seedArray.length < 16 || seedArray.length > 64) {
11075
11190
  throw new import_errors26.FuelError(
11076
11191
  import_errors26.ErrorCode.INVALID_SEED,
11077
11192
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
11078
11193
  );
11079
11194
  }
11080
- return (0, import_utils42.arrayify)((0, import_crypto7.computeHmac)("sha512", MasterSecret, seedArray));
11195
+ return (0, import_utils43.arrayify)((0, import_crypto7.computeHmac)("sha512", MasterSecret, seedArray));
11081
11196
  }
11082
11197
  /**
11083
11198
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -11088,22 +11203,22 @@ var Mnemonic = class _Mnemonic {
11088
11203
  */
11089
11204
  static seedToExtendedKey(seed, testnet = false) {
11090
11205
  const masterKey = _Mnemonic.masterKeysFromSeed(seed);
11091
- const prefix = (0, import_utils42.arrayify)(testnet ? TestnetPRV : MainnetPRV);
11206
+ const prefix = (0, import_utils43.arrayify)(testnet ? TestnetPRV : MainnetPRV);
11092
11207
  const depth = "0x00";
11093
11208
  const fingerprint = "0x00000000";
11094
11209
  const index = "0x00000000";
11095
11210
  const chainCode = masterKey.slice(32);
11096
11211
  const privateKey = masterKey.slice(0, 32);
11097
- const extendedKey = (0, import_utils42.concat)([
11212
+ const extendedKey = (0, import_utils43.concat)([
11098
11213
  prefix,
11099
11214
  depth,
11100
11215
  fingerprint,
11101
11216
  index,
11102
11217
  chainCode,
11103
- (0, import_utils42.concat)(["0x00", privateKey])
11218
+ (0, import_utils43.concat)(["0x00", privateKey])
11104
11219
  ]);
11105
- const checksum = (0, import_utils42.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(extendedKey)), 0, 4);
11106
- return (0, import_utils42.encodeBase58)((0, import_utils42.concat)([extendedKey, checksum]));
11220
+ const checksum = (0, import_utils43.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(extendedKey)), 0, 4);
11221
+ return (0, import_utils43.encodeBase58)((0, import_utils43.concat)([extendedKey, checksum]));
11107
11222
  }
11108
11223
  /**
11109
11224
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -11118,7 +11233,7 @@ var Mnemonic = class _Mnemonic {
11118
11233
  * @returns A randomly generated mnemonic
11119
11234
  */
11120
11235
  static generate(size = 32, extraEntropy = "") {
11121
- const entropy = extraEntropy ? (0, import_hasher6.sha256)((0, import_utils42.concat)([(0, import_crypto7.randomBytes)(size), (0, import_utils42.arrayify)(extraEntropy)])) : (0, import_crypto7.randomBytes)(size);
11236
+ const entropy = extraEntropy ? (0, import_hasher6.sha256)((0, import_utils43.concat)([(0, import_crypto7.randomBytes)(size), (0, import_utils43.arrayify)(extraEntropy)])) : (0, import_crypto7.randomBytes)(size);
11122
11237
  return _Mnemonic.entropyToMnemonic(entropy);
11123
11238
  }
11124
11239
  };
@@ -11126,12 +11241,12 @@ var mnemonic_default = Mnemonic;
11126
11241
 
11127
11242
  // src/hdwallet/hdwallet.ts
11128
11243
  var HARDENED_INDEX = 2147483648;
11129
- var MainnetPRV2 = (0, import_utils44.hexlify)("0x0488ade4");
11130
- var MainnetPUB = (0, import_utils44.hexlify)("0x0488b21e");
11131
- var TestnetPRV2 = (0, import_utils44.hexlify)("0x04358394");
11132
- var TestnetPUB = (0, import_utils44.hexlify)("0x043587cf");
11244
+ var MainnetPRV2 = (0, import_utils45.hexlify)("0x0488ade4");
11245
+ var MainnetPUB = (0, import_utils45.hexlify)("0x0488b21e");
11246
+ var TestnetPRV2 = (0, import_utils45.hexlify)("0x04358394");
11247
+ var TestnetPUB = (0, import_utils45.hexlify)("0x043587cf");
11133
11248
  function base58check(data) {
11134
- return (0, import_utils44.encodeBase58)((0, import_utils44.concat)([data, (0, import_utils44.dataSlice)((0, import_hasher7.sha256)((0, import_hasher7.sha256)(data)), 0, 4)]));
11249
+ return (0, import_utils45.encodeBase58)((0, import_utils45.concat)([data, (0, import_utils45.dataSlice)((0, import_hasher7.sha256)((0, import_hasher7.sha256)(data)), 0, 4)]));
11135
11250
  }
11136
11251
  __name(base58check, "base58check");
11137
11252
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
@@ -11142,12 +11257,12 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
11142
11257
  }
11143
11258
  __name(getExtendedKeyPrefix, "getExtendedKeyPrefix");
11144
11259
  function isPublicExtendedKey(extendedKey) {
11145
- return [MainnetPUB, TestnetPUB].includes((0, import_utils44.hexlify)(extendedKey.slice(0, 4)));
11260
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils45.hexlify)(extendedKey.slice(0, 4)));
11146
11261
  }
11147
11262
  __name(isPublicExtendedKey, "isPublicExtendedKey");
11148
11263
  function isValidExtendedKey(extendedKey) {
11149
11264
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
11150
- (0, import_utils44.hexlify)(extendedKey.slice(0, 4))
11265
+ (0, import_utils45.hexlify)(extendedKey.slice(0, 4))
11151
11266
  );
11152
11267
  }
11153
11268
  __name(isValidExtendedKey, "isValidExtendedKey");
@@ -11170,8 +11285,8 @@ var HDWallet = class _HDWallet {
11170
11285
  }
11171
11286
  depth = 0;
11172
11287
  index = 0;
11173
- fingerprint = (0, import_utils44.hexlify)("0x00000000");
11174
- parentFingerprint = (0, import_utils44.hexlify)("0x00000000");
11288
+ fingerprint = (0, import_utils45.hexlify)("0x00000000");
11289
+ parentFingerprint = (0, import_utils45.hexlify)("0x00000000");
11175
11290
  privateKey;
11176
11291
  publicKey;
11177
11292
  chainCode;
@@ -11183,8 +11298,8 @@ var HDWallet = class _HDWallet {
11183
11298
  constructor(config) {
11184
11299
  if (config.privateKey) {
11185
11300
  const signer = new Signer(config.privateKey);
11186
- this.publicKey = (0, import_utils44.hexlify)(signer.compressedPublicKey);
11187
- this.privateKey = (0, import_utils44.hexlify)(config.privateKey);
11301
+ this.publicKey = (0, import_utils45.hexlify)(signer.compressedPublicKey);
11302
+ this.privateKey = (0, import_utils45.hexlify)(config.privateKey);
11188
11303
  } else {
11189
11304
  if (!config.publicKey) {
11190
11305
  throw new import_errors27.FuelError(
@@ -11192,10 +11307,10 @@ var HDWallet = class _HDWallet {
11192
11307
  "Both public and private Key cannot be missing. At least one should be provided."
11193
11308
  );
11194
11309
  }
11195
- this.publicKey = (0, import_utils44.hexlify)(config.publicKey);
11310
+ this.publicKey = (0, import_utils45.hexlify)(config.publicKey);
11196
11311
  }
11197
11312
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
11198
- this.fingerprint = (0, import_utils44.dataSlice)((0, import_crypto8.ripemd160)((0, import_hasher7.sha256)(this.publicKey)), 0, 4);
11313
+ this.fingerprint = (0, import_utils45.dataSlice)((0, import_crypto8.ripemd160)((0, import_hasher7.sha256)(this.publicKey)), 0, 4);
11199
11314
  this.depth = config.depth || this.depth;
11200
11315
  this.index = config.index || this.index;
11201
11316
  this.chainCode = config.chainCode;
@@ -11211,9 +11326,9 @@ var HDWallet = class _HDWallet {
11211
11326
  * @returns A new instance of HDWallet on the derived index
11212
11327
  */
11213
11328
  deriveIndex(index) {
11214
- const privateKey = this.privateKey && (0, import_utils44.arrayify)(this.privateKey);
11215
- const publicKey = (0, import_utils44.arrayify)(this.publicKey);
11216
- const chainCode = (0, import_utils44.arrayify)(this.chainCode);
11329
+ const privateKey = this.privateKey && (0, import_utils45.arrayify)(this.privateKey);
11330
+ const publicKey = (0, import_utils45.arrayify)(this.publicKey);
11331
+ const chainCode = (0, import_utils45.arrayify)(this.chainCode);
11217
11332
  const data = new Uint8Array(37);
11218
11333
  if (index & HARDENED_INDEX) {
11219
11334
  if (!privateKey) {
@@ -11224,10 +11339,10 @@ var HDWallet = class _HDWallet {
11224
11339
  }
11225
11340
  data.set(privateKey, 1);
11226
11341
  } else {
11227
- data.set((0, import_utils44.arrayify)(this.publicKey));
11342
+ data.set((0, import_utils45.arrayify)(this.publicKey));
11228
11343
  }
11229
11344
  data.set((0, import_math24.toBytes)(index, 4), 33);
11230
- const bytes = (0, import_utils44.arrayify)((0, import_crypto8.computeHmac)("sha512", chainCode, data));
11345
+ const bytes = (0, import_utils45.arrayify)((0, import_crypto8.computeHmac)("sha512", chainCode, data));
11231
11346
  const IL = bytes.slice(0, 32);
11232
11347
  const IR = bytes.slice(32);
11233
11348
  if (privateKey) {
@@ -11241,7 +11356,7 @@ var HDWallet = class _HDWallet {
11241
11356
  parentFingerprint: this.fingerprint
11242
11357
  });
11243
11358
  }
11244
- const signer = new Signer((0, import_utils44.hexlify)(IL));
11359
+ const signer = new Signer((0, import_utils45.hexlify)(IL));
11245
11360
  const Ki = signer.addPoint(publicKey);
11246
11361
  return new _HDWallet({
11247
11362
  publicKey: Ki,
@@ -11276,12 +11391,12 @@ var HDWallet = class _HDWallet {
11276
11391
  );
11277
11392
  }
11278
11393
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
11279
- const depth = (0, import_utils44.hexlify)(Uint8Array.from([this.depth]));
11394
+ const depth = (0, import_utils45.hexlify)(Uint8Array.from([this.depth]));
11280
11395
  const parentFingerprint = this.parentFingerprint;
11281
11396
  const index = (0, import_math24.toHex)(this.index, 4);
11282
11397
  const chainCode = this.chainCode;
11283
- const key = this.privateKey != null && !isPublic ? (0, import_utils44.concat)(["0x00", this.privateKey]) : this.publicKey;
11284
- const extendedKey = (0, import_utils44.arrayify)((0, import_utils44.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
11398
+ const key = this.privateKey != null && !isPublic ? (0, import_utils45.concat)(["0x00", this.privateKey]) : this.publicKey;
11399
+ const extendedKey = (0, import_utils45.arrayify)((0, import_utils45.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
11285
11400
  return base58check(extendedKey);
11286
11401
  }
11287
11402
  /**
@@ -11293,13 +11408,13 @@ var HDWallet = class _HDWallet {
11293
11408
  static fromSeed(seed) {
11294
11409
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
11295
11410
  return new _HDWallet({
11296
- chainCode: (0, import_utils44.arrayify)(masterKey.slice(32)),
11297
- privateKey: (0, import_utils44.arrayify)(masterKey.slice(0, 32))
11411
+ chainCode: (0, import_utils45.arrayify)(masterKey.slice(32)),
11412
+ privateKey: (0, import_utils45.arrayify)(masterKey.slice(0, 32))
11298
11413
  });
11299
11414
  }
11300
11415
  static fromExtendedKey(extendedKey) {
11301
- const decoded = (0, import_utils44.hexlify)((0, import_math24.toBytes)((0, import_utils44.decodeBase58)(extendedKey)));
11302
- const bytes = (0, import_utils44.arrayify)(decoded);
11416
+ const decoded = (0, import_utils45.hexlify)((0, import_math24.toBytes)((0, import_utils45.decodeBase58)(extendedKey)));
11417
+ const bytes = (0, import_utils45.arrayify)(decoded);
11303
11418
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
11304
11419
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
11305
11420
  throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -11308,9 +11423,9 @@ var HDWallet = class _HDWallet {
11308
11423
  throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
11309
11424
  }
11310
11425
  const depth = bytes[4];
11311
- const parentFingerprint = (0, import_utils44.hexlify)(bytes.slice(5, 9));
11312
- const index = parseInt((0, import_utils44.hexlify)(bytes.slice(9, 13)).substring(2), 16);
11313
- const chainCode = (0, import_utils44.hexlify)(bytes.slice(13, 45));
11426
+ const parentFingerprint = (0, import_utils45.hexlify)(bytes.slice(5, 9));
11427
+ const index = parseInt((0, import_utils45.hexlify)(bytes.slice(9, 13)).substring(2), 16);
11428
+ const chainCode = (0, import_utils45.hexlify)(bytes.slice(13, 45));
11314
11429
  const key = bytes.slice(45, 78);
11315
11430
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
11316
11431
  throw new import_errors27.FuelError(
@@ -11540,7 +11655,7 @@ var WalletsConfig = class _WalletsConfig {
11540
11655
  return {
11541
11656
  ...snapshotConfig,
11542
11657
  stateConfig: {
11543
- ...snapshotConfig?.stateConfig ?? import_utils45.defaultSnapshotConfigs.stateConfig,
11658
+ ...snapshotConfig?.stateConfig ?? import_utils46.defaultSnapshotConfigs.stateConfig,
11544
11659
  coins: this.initialState.coins.concat(snapshotConfig?.stateConfig?.coins || []),
11545
11660
  messages: this.initialState.messages.concat(snapshotConfig?.stateConfig?.messages ?? [])
11546
11661
  }
@@ -11573,7 +11688,7 @@ var WalletsConfig = class _WalletsConfig {
11573
11688
  tx_pointer_block_height: 0,
11574
11689
  tx_pointer_tx_idx: 0,
11575
11690
  output_index: 0,
11576
- tx_id: (0, import_utils45.hexlify)((0, import_crypto9.randomBytes)(32))
11691
+ tx_id: (0, import_utils46.hexlify)((0, import_crypto9.randomBytes)(32))
11577
11692
  });
11578
11693
  }
11579
11694
  });
@@ -11629,7 +11744,7 @@ async function setupTestProviderAndWallets({
11629
11744
  } = {}) {
11630
11745
  Symbol.dispose ??= Symbol("Symbol.dispose");
11631
11746
  const walletsConfig = new WalletsConfig(
11632
- nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V2?.base_asset_id ?? import_utils46.defaultSnapshotConfigs.chainConfig.consensus_parameters.V2.base_asset_id,
11747
+ nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V2?.base_asset_id ?? import_utils47.defaultSnapshotConfigs.chainConfig.consensus_parameters.V2.base_asset_id,
11633
11748
  {
11634
11749
  ...defaultWalletConfigOptions,
11635
11750
  ...walletsConfigOptions
@@ -11639,7 +11754,7 @@ async function setupTestProviderAndWallets({
11639
11754
  loggingEnabled: false,
11640
11755
  ...nodeOptions,
11641
11756
  snapshotConfig: (0, import_ramda10.mergeDeepRight)(
11642
- import_utils46.defaultSnapshotConfigs,
11757
+ import_utils47.defaultSnapshotConfigs,
11643
11758
  walletsConfig.apply(nodeOptions?.snapshotConfig)
11644
11759
  ),
11645
11760
  port: nodeOptions.port || "0"
@@ -11685,7 +11800,7 @@ __name(setupTestProviderAndWallets, "setupTestProviderAndWallets");
11685
11800
  var import_address8 = require("@fuel-ts/address");
11686
11801
  var import_crypto10 = require("@fuel-ts/crypto");
11687
11802
  var import_math26 = require("@fuel-ts/math");
11688
- var import_utils47 = require("@fuel-ts/utils");
11803
+ var import_utils48 = require("@fuel-ts/utils");
11689
11804
  var TestMessage = class {
11690
11805
  static {
11691
11806
  __name(this, "TestMessage");
@@ -11705,7 +11820,7 @@ var TestMessage = class {
11705
11820
  constructor({
11706
11821
  sender = import_address8.Address.fromRandom(),
11707
11822
  recipient = import_address8.Address.fromRandom(),
11708
- nonce = (0, import_utils47.hexlify)((0, import_crypto10.randomBytes)(32)),
11823
+ nonce = (0, import_utils48.hexlify)((0, import_crypto10.randomBytes)(32)),
11709
11824
  amount = 1e6,
11710
11825
  data = "",
11711
11826
  // Will default to empty data in order to be a spendable message