@fuel-ts/account 0.0.0-rc-2021-20240410132122 → 0.0.0-rc-1976-20240410141707

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.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/account.d.ts +4 -5
  3. package/dist/account.d.ts.map +1 -1
  4. package/dist/configs.d.ts.map +1 -1
  5. package/dist/configs.global.js +1 -1
  6. package/dist/configs.global.js.map +1 -1
  7. package/dist/configs.js +1 -1
  8. package/dist/configs.js.map +1 -1
  9. package/dist/configs.mjs +1 -1
  10. package/dist/configs.mjs.map +1 -1
  11. package/dist/index.global.js +615 -871
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +609 -851
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +452 -693
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +2 -11
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +328 -894
  20. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  21. package/dist/providers/coin-quantity.d.ts +3 -3
  22. package/dist/providers/coin-quantity.d.ts.map +1 -1
  23. package/dist/providers/coin.d.ts +2 -4
  24. package/dist/providers/coin.d.ts.map +1 -1
  25. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  26. package/dist/providers/message.d.ts +1 -3
  27. package/dist/providers/message.d.ts.map +1 -1
  28. package/dist/providers/provider.d.ts +34 -45
  29. package/dist/providers/provider.d.ts.map +1 -1
  30. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  31. package/dist/providers/transaction-request/input.d.ts +2 -2
  32. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  34. package/dist/providers/transaction-request/transaction-request.d.ts +29 -9
  35. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/utils.d.ts +0 -3
  37. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  38. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  39. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
  40. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  41. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
  42. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
  43. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  44. package/dist/providers/utils/gas.d.ts +2 -8
  45. package/dist/providers/utils/gas.d.ts.map +1 -1
  46. package/dist/test-utils/launchNode.d.ts.map +1 -1
  47. package/dist/test-utils.global.js +1116 -1585
  48. package/dist/test-utils.global.js.map +1 -1
  49. package/dist/test-utils.js +606 -826
  50. package/dist/test-utils.js.map +1 -1
  51. package/dist/test-utils.mjs +464 -684
  52. package/dist/test-utils.mjs.map +1 -1
  53. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  54. package/package.json +17 -17
@@ -289,7 +289,7 @@
289
289
  }
290
290
  return num !== null && typeof num === "object" && num.constructor.wordSize === BN2.wordSize && Array.isArray(num.words);
291
291
  };
292
- BN2.max = function max(left, right) {
292
+ BN2.max = function max2(left, right) {
293
293
  if (left.cmp(right) > 0)
294
294
  return left;
295
295
  return right;
@@ -5113,7 +5113,7 @@
5113
5113
  function isBlob(obj) {
5114
5114
  return typeof obj === "object" && typeof obj.arrayBuffer === "function" && typeof obj.type === "string" && typeof obj.stream === "function" && typeof obj.constructor === "function" && typeof obj.constructor.name === "string" && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
5115
5115
  }
5116
- function clone3(instance) {
5116
+ function clone(instance) {
5117
5117
  let p1, p2;
5118
5118
  let body = instance.body;
5119
5119
  if (instance.bodyUsed) {
@@ -6047,7 +6047,7 @@
6047
6047
  * @return Response
6048
6048
  */
6049
6049
  clone() {
6050
- return new Response2(clone3(this), {
6050
+ return new Response2(clone(this), {
6051
6051
  url: this.url,
6052
6052
  status: this.status,
6053
6053
  statusText: this.statusText,
@@ -6097,7 +6097,7 @@
6097
6097
  if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
6098
6098
  throw new TypeError("Request with GET/HEAD method cannot have body");
6099
6099
  }
6100
- let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone3(input) : null;
6100
+ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
6101
6101
  Body.call(this, inputBody, {
6102
6102
  timeout: init.timeout || input.timeout || 0,
6103
6103
  size: init.size || input.size || 0
@@ -28952,8 +28952,8 @@ spurious results.`);
28952
28952
  // ../versions/dist/index.mjs
28953
28953
  function getBuiltinVersions() {
28954
28954
  return {
28955
- FORC: "0.51.1",
28956
- FUEL_CORE: "0.24.2",
28955
+ FORC: "0.49.3",
28956
+ FUEL_CORE: "0.22.1",
28957
28957
  FUELS: "0.79.0"
28958
28958
  };
28959
28959
  }
@@ -29245,7 +29245,7 @@ This unreleased fuel-core build may include features and updates not yet support
29245
29245
  __publicField3(DateTime, "TAI64_NULL", "");
29246
29246
 
29247
29247
  // ../crypto/dist/index.mjs
29248
- var import_crypto9 = __toESM(__require("crypto"), 1);
29248
+ var import_crypto8 = __toESM(__require("crypto"), 1);
29249
29249
 
29250
29250
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
29251
29251
  var version = "6.7.1";
@@ -30317,27 +30317,6 @@ This unreleased fuel-core build may include features and updates not yet support
30317
30317
  };
30318
30318
  Object.freeze(pbkdf22);
30319
30319
 
30320
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/random.js
30321
- var locked5 = false;
30322
- var _randomBytes = function(length) {
30323
- return new Uint8Array((0, import_crypto2.randomBytes)(length));
30324
- };
30325
- var __randomBytes = _randomBytes;
30326
- function randomBytes3(length) {
30327
- return __randomBytes(length);
30328
- }
30329
- randomBytes3._ = _randomBytes;
30330
- randomBytes3.lock = function() {
30331
- locked5 = true;
30332
- };
30333
- randomBytes3.register = function(func) {
30334
- if (locked5) {
30335
- throw new Error("randomBytes is locked");
30336
- }
30337
- __randomBytes = func;
30338
- };
30339
- Object.freeze(randomBytes3);
30340
-
30341
30320
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
30342
30321
  var BN_03 = BigInt(0);
30343
30322
  var BN_36 = BigInt(36);
@@ -30922,8 +30901,8 @@ This unreleased fuel-core build may include features and updates not yet support
30922
30901
  }
30923
30902
 
30924
30903
  // ../crypto/dist/index.mjs
30904
+ var import_crypto9 = __toESM(__require("crypto"), 1);
30925
30905
  var import_crypto10 = __toESM(__require("crypto"), 1);
30926
- var import_crypto11 = __toESM(__require("crypto"), 1);
30927
30906
  var scrypt3 = (params) => {
30928
30907
  const { password, salt, n, p, r, dklen } = params;
30929
30908
  const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
@@ -30932,7 +30911,7 @@ This unreleased fuel-core build may include features and updates not yet support
30932
30911
  var keccak2562 = (data) => keccak_256(data);
30933
30912
  var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
30934
30913
  var randomBytes4 = (length) => {
30935
- const randomValues = Uint8Array.from(import_crypto10.default.randomBytes(length));
30914
+ const randomValues = Uint8Array.from(import_crypto9.default.randomBytes(length));
30936
30915
  return randomValues;
30937
30916
  };
30938
30917
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -30947,7 +30926,7 @@ This unreleased fuel-core build may include features and updates not yet support
30947
30926
  const salt = randomBytes4(32);
30948
30927
  const secret = keyFromPassword(password, salt);
30949
30928
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
30950
- const cipher = await import_crypto9.default.createCipheriv(ALGORITHM, secret, iv);
30929
+ const cipher = await import_crypto8.default.createCipheriv(ALGORITHM, secret, iv);
30951
30930
  let cipherData = cipher.update(dataBuffer);
30952
30931
  cipherData = Buffer.concat([cipherData, cipher.final()]);
30953
30932
  return {
@@ -30961,7 +30940,7 @@ This unreleased fuel-core build may include features and updates not yet support
30961
30940
  const salt = bufferFromString(keystore.salt);
30962
30941
  const secret = keyFromPassword(password, salt);
30963
30942
  const encryptedText = bufferFromString(keystore.data);
30964
- const decipher = await import_crypto9.default.createDecipheriv(ALGORITHM, secret, iv);
30943
+ const decipher = await import_crypto8.default.createDecipheriv(ALGORITHM, secret, iv);
30965
30944
  const decrypted = decipher.update(encryptedText);
30966
30945
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
30967
30946
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -30972,12 +30951,12 @@ This unreleased fuel-core build may include features and updates not yet support
30972
30951
  }
30973
30952
  };
30974
30953
  async function encryptJsonWalletData(data, key, iv) {
30975
- const cipher = await import_crypto11.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30954
+ const cipher = await import_crypto10.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30976
30955
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
30977
30956
  return new Uint8Array(encrypted);
30978
30957
  }
30979
30958
  async function decryptJsonWalletData(data, key, iv) {
30980
- const decipher = import_crypto11.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30959
+ const decipher = import_crypto10.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30981
30960
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
30982
30961
  return new Uint8Array(decrypted);
30983
30962
  }
@@ -31293,10 +31272,6 @@ This unreleased fuel-core build may include features and updates not yet support
31293
31272
  }
31294
31273
  };
31295
31274
 
31296
- // ../address/dist/configs.mjs
31297
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
31298
- var BaseAssetId = ZeroBytes32;
31299
-
31300
31275
  // ../math/dist/index.mjs
31301
31276
  var import_bn = __toESM(require_bn(), 1);
31302
31277
  var DEFAULT_PRECISION = 9;
@@ -31516,182 +31491,32 @@ This unreleased fuel-core build may include features and updates not yet support
31516
31491
  function toBytes3(value, bytesPadding) {
31517
31492
  return bn(value).toBytes(bytesPadding);
31518
31493
  }
31519
-
31520
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
31521
- function _isPlaceholder(a) {
31522
- return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
31523
- }
31524
-
31525
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
31526
- function _curry1(fn) {
31527
- return function f1(a) {
31528
- if (arguments.length === 0 || _isPlaceholder(a)) {
31529
- return f1;
31530
- } else {
31531
- return fn.apply(this, arguments);
31532
- }
31533
- };
31534
- }
31535
-
31536
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
31537
- var isArray_default = Array.isArray || function _isArray(val) {
31538
- return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
31539
- };
31540
-
31541
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
31542
- var type = /* @__PURE__ */ _curry1(function type2(val) {
31543
- return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
31544
- });
31545
- var type_default = type;
31546
-
31547
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
31548
- var pad = function pad2(n) {
31549
- return (n < 10 ? "0" : "") + n;
31550
- };
31551
- var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
31552
- return d.toISOString();
31553
- } : function _toISOString3(d) {
31554
- return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
31555
- };
31556
-
31557
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
31558
- var isInteger_default = Number.isInteger || function _isInteger(n) {
31559
- return n << 0 === n;
31560
- };
31561
-
31562
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
31563
- function _cloneRegExp(pattern) {
31564
- return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
31565
- }
31566
-
31567
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
31568
- function _clone(value, deep, map) {
31569
- map || (map = new _ObjectMap());
31570
- if (_isPrimitive(value)) {
31571
- return value;
31572
- }
31573
- var copy = function copy2(copiedValue) {
31574
- var cachedCopy = map.get(value);
31575
- if (cachedCopy) {
31576
- return cachedCopy;
31577
- }
31578
- map.set(value, copiedValue);
31579
- for (var key in value) {
31580
- if (Object.prototype.hasOwnProperty.call(value, key)) {
31581
- copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
31582
- }
31583
- }
31584
- return copiedValue;
31585
- };
31586
- switch (type_default(value)) {
31587
- case "Object":
31588
- return copy(Object.create(Object.getPrototypeOf(value)));
31589
- case "Array":
31590
- return copy([]);
31591
- case "Date":
31592
- return new Date(value.valueOf());
31593
- case "RegExp":
31594
- return _cloneRegExp(value);
31595
- case "Int8Array":
31596
- case "Uint8Array":
31597
- case "Uint8ClampedArray":
31598
- case "Int16Array":
31599
- case "Uint16Array":
31600
- case "Int32Array":
31601
- case "Uint32Array":
31602
- case "Float32Array":
31603
- case "Float64Array":
31604
- case "BigInt64Array":
31605
- case "BigUint64Array":
31606
- return value.slice();
31607
- default:
31608
- return value;
31609
- }
31610
- }
31611
- function _isPrimitive(param) {
31612
- var type3 = typeof param;
31613
- return param == null || type3 != "object" && type3 != "function";
31494
+ function max(...numbers) {
31495
+ return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
31614
31496
  }
31615
- var _ObjectMap = /* @__PURE__ */ function() {
31616
- function _ObjectMap2() {
31617
- this.map = {};
31618
- this.length = 0;
31619
- }
31620
- _ObjectMap2.prototype.set = function(key, value) {
31621
- const hashedKey = this.hash(key);
31622
- let bucket = this.map[hashedKey];
31623
- if (!bucket) {
31624
- this.map[hashedKey] = bucket = [];
31625
- }
31626
- bucket.push([key, value]);
31627
- this.length += 1;
31628
- };
31629
- _ObjectMap2.prototype.hash = function(key) {
31630
- let hashedKey = [];
31631
- for (var value in key) {
31632
- hashedKey.push(Object.prototype.toString.call(key[value]));
31633
- }
31634
- return hashedKey.join();
31635
- };
31636
- _ObjectMap2.prototype.get = function(key) {
31637
- if (this.length <= 180) {
31638
- for (const p in this.map) {
31639
- const bucket2 = this.map[p];
31640
- for (let i = 0; i < bucket2.length; i += 1) {
31641
- const element = bucket2[i];
31642
- if (element[0] === key) {
31643
- return element[1];
31644
- }
31645
- }
31646
- }
31647
- return;
31648
- }
31649
- const hashedKey = this.hash(key);
31650
- const bucket = this.map[hashedKey];
31651
- if (!bucket) {
31652
- return;
31653
- }
31654
- for (let i = 0; i < bucket.length; i += 1) {
31655
- const element = bucket[i];
31656
- if (element[0] === key) {
31657
- return element[1];
31658
- }
31659
- }
31660
- };
31661
- return _ObjectMap2;
31662
- }();
31663
-
31664
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
31665
- var clone = /* @__PURE__ */ _curry1(function clone2(value) {
31666
- return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
31667
- });
31668
- var clone_default = clone;
31669
-
31670
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
31671
- var hasProtoTrim = typeof String.prototype.trim === "function";
31672
31497
 
31673
31498
  // src/providers/coin-quantity.ts
31674
31499
  var coinQuantityfy = (coinQuantityLike) => {
31675
31500
  let assetId;
31676
31501
  let amount;
31677
- let max;
31502
+ let max2;
31678
31503
  if (Array.isArray(coinQuantityLike)) {
31679
31504
  amount = coinQuantityLike[0];
31680
- assetId = coinQuantityLike[1] ?? BaseAssetId;
31681
- max = coinQuantityLike[2] ?? void 0;
31505
+ assetId = coinQuantityLike[1];
31506
+ max2 = coinQuantityLike[2];
31682
31507
  } else {
31683
31508
  amount = coinQuantityLike.amount;
31684
- assetId = coinQuantityLike.assetId ?? BaseAssetId;
31685
- max = coinQuantityLike.max ?? void 0;
31509
+ assetId = coinQuantityLike.assetId;
31510
+ max2 = coinQuantityLike.max ?? void 0;
31686
31511
  }
31687
31512
  const bnAmount = bn(amount);
31688
31513
  return {
31689
31514
  assetId: hexlify(assetId),
31690
31515
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
31691
- max: max ? bn(max) : void 0
31516
+ max: max2 ? bn(max2) : void 0
31692
31517
  };
31693
31518
  };
31694
- var addAmountToCoinQuantities = (params) => {
31519
+ var addAmountToAsset = (params) => {
31695
31520
  const { amount, assetId } = params;
31696
31521
  const coinQuantities = [...params.coinQuantities];
31697
31522
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -31783,9 +31608,9 @@ This unreleased fuel-core build may include features and updates not yet support
31783
31608
  var TX_POINTER_LEN = WORD_SIZE * 2;
31784
31609
  var MAX_BYTES = 2 ** 32 - 1;
31785
31610
  var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
31786
- ASSET_ID_LEN + // Base asset ID
31611
+ WORD_SIZE + // Tx size
31787
31612
  // Asset ID/Balance coin input pairs
31788
- maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
31613
+ maxInputs * (ASSET_ID_LEN + WORD_SIZE);
31789
31614
  var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
31790
31615
  WORD_SIZE + // Gas limit
31791
31616
  WORD_SIZE + // Script size
@@ -31803,6 +31628,7 @@ This unreleased fuel-core build may include features and updates not yet support
31803
31628
  ASSET_ID_LEN + // Asset id
31804
31629
  TX_POINTER_LEN + // TxPointer
31805
31630
  WORD_SIZE + // Witnesses index
31631
+ WORD_SIZE + // Maturity
31806
31632
  WORD_SIZE + // Predicate size
31807
31633
  WORD_SIZE + // Predicate data size
31808
31634
  WORD_SIZE;
@@ -32124,7 +31950,7 @@ This unreleased fuel-core build may include features and updates not yet support
32124
31950
  constructor(name, coders) {
32125
31951
  const caseIndexCoder = new BigNumberCoder("u64");
32126
31952
  const encodedValueSize = Object.values(coders).reduce(
32127
- (max, coder) => Math.max(max, coder.encodedLength),
31953
+ (max2, coder) => Math.max(max2, coder.encodedLength),
32128
31954
  0
32129
31955
  );
32130
31956
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -32828,7 +32654,7 @@ This unreleased fuel-core build may include features and updates not yet support
32828
32654
  constructor(name, coders) {
32829
32655
  const caseIndexCoder = new BigNumberCoder("u64");
32830
32656
  const encodedValueSize = Object.values(coders).reduce(
32831
- (max, coder) => Math.max(max, coder.encodedLength),
32657
+ (max2, coder) => Math.max(max2, coder.encodedLength),
32832
32658
  0
32833
32659
  );
32834
32660
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -33530,19 +33356,18 @@ This unreleased fuel-core build may include features and updates not yet support
33530
33356
  encode(value) {
33531
33357
  const parts = [];
33532
33358
  parts.push(new B256Coder().encode(value.txID));
33533
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33359
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33534
33360
  parts.push(new B256Coder().encode(value.owner));
33535
33361
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33536
33362
  parts.push(new B256Coder().encode(value.assetId));
33537
33363
  parts.push(new TxPointerCoder().encode(value.txPointer));
33538
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33364
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33365
+ parts.push(new NumberCoder("u32").encode(value.maturity));
33539
33366
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33540
- parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33541
- parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33542
- parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33543
- parts.push(
33544
- new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33545
- );
33367
+ parts.push(new NumberCoder("u32").encode(value.predicateLength));
33368
+ parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33369
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33370
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33546
33371
  return concat(parts);
33547
33372
  }
33548
33373
  decode(data, offset) {
@@ -33550,7 +33375,7 @@ This unreleased fuel-core build may include features and updates not yet support
33550
33375
  let o = offset;
33551
33376
  [decoded, o] = new B256Coder().decode(data, o);
33552
33377
  const txID = decoded;
33553
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33378
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33554
33379
  const outputIndex = decoded;
33555
33380
  [decoded, o] = new B256Coder().decode(data, o);
33556
33381
  const owner = decoded;
@@ -33560,17 +33385,19 @@ This unreleased fuel-core build may include features and updates not yet support
33560
33385
  const assetId = decoded;
33561
33386
  [decoded, o] = new TxPointerCoder().decode(data, o);
33562
33387
  const txPointer = decoded;
33563
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33388
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33564
33389
  const witnessIndex = Number(decoded);
33390
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33391
+ const maturity = decoded;
33565
33392
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33566
33393
  const predicateGasUsed = decoded;
33567
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33394
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33568
33395
  const predicateLength = decoded;
33569
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33396
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33570
33397
  const predicateDataLength = decoded;
33571
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33398
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33572
33399
  const predicate = decoded;
33573
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33400
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33574
33401
  const predicateData = decoded;
33575
33402
  return [
33576
33403
  {
@@ -33582,6 +33409,7 @@ This unreleased fuel-core build may include features and updates not yet support
33582
33409
  assetId,
33583
33410
  txPointer,
33584
33411
  witnessIndex,
33412
+ maturity,
33585
33413
  predicateGasUsed,
33586
33414
  predicateLength,
33587
33415
  predicateDataLength,
@@ -33599,7 +33427,7 @@ This unreleased fuel-core build may include features and updates not yet support
33599
33427
  encode(value) {
33600
33428
  const parts = [];
33601
33429
  parts.push(new B256Coder().encode(value.txID));
33602
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33430
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33603
33431
  parts.push(new B256Coder().encode(value.balanceRoot));
33604
33432
  parts.push(new B256Coder().encode(value.stateRoot));
33605
33433
  parts.push(new TxPointerCoder().encode(value.txPointer));
@@ -33611,7 +33439,7 @@ This unreleased fuel-core build may include features and updates not yet support
33611
33439
  let o = offset;
33612
33440
  [decoded, o] = new B256Coder().decode(data, o);
33613
33441
  const txID = decoded;
33614
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33442
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33615
33443
  const outputIndex = decoded;
33616
33444
  [decoded, o] = new B256Coder().decode(data, o);
33617
33445
  const balanceRoot = decoded;
@@ -33660,16 +33488,14 @@ This unreleased fuel-core build may include features and updates not yet support
33660
33488
  parts.push(new ByteArrayCoder(32).encode(value.recipient));
33661
33489
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33662
33490
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33663
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33491
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33664
33492
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33665
- parts.push(new BigNumberCoder("u64").encode(data.length));
33666
- parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33667
- parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33493
+ parts.push(new NumberCoder("u32").encode(data.length));
33494
+ parts.push(new NumberCoder("u32").encode(value.predicateLength));
33495
+ parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33668
33496
  parts.push(new ByteArrayCoder(data.length).encode(data));
33669
- parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33670
- parts.push(
33671
- new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33672
- );
33497
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33498
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33673
33499
  return concat(parts);
33674
33500
  }
33675
33501
  static decodeData(messageData) {
@@ -33689,21 +33515,21 @@ This unreleased fuel-core build may include features and updates not yet support
33689
33515
  const amount = decoded;
33690
33516
  [decoded, o] = new B256Coder().decode(data, o);
33691
33517
  const nonce = decoded;
33692
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33518
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33693
33519
  const witnessIndex = Number(decoded);
33694
33520
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33695
33521
  const predicateGasUsed = decoded;
33696
33522
  [decoded, o] = new NumberCoder("u32").decode(data, o);
33697
33523
  const dataLength2 = decoded;
33698
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33524
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33699
33525
  const predicateLength = decoded;
33700
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33526
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33701
33527
  const predicateDataLength = decoded;
33702
33528
  [decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
33703
33529
  const messageData = decoded;
33704
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33530
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33705
33531
  const predicate = decoded;
33706
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33532
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33707
33533
  const predicateData = decoded;
33708
33534
  return [
33709
33535
  {
@@ -34015,7 +33841,7 @@ This unreleased fuel-core build may include features and updates not yet support
34015
33841
  }
34016
33842
  };
34017
33843
  var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
34018
- PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
33844
+ PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
34019
33845
  PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
34020
33846
  PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
34021
33847
  PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
@@ -34063,9 +33889,9 @@ This unreleased fuel-core build may include features and updates not yet support
34063
33889
  let o = offset;
34064
33890
  const policies = [];
34065
33891
  if (policyTypes & 1) {
34066
- const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
33892
+ const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
34067
33893
  o = nextOffset;
34068
- policies.push({ type: 1, data: tip });
33894
+ policies.push({ type: 1, data: gasPrice });
34069
33895
  }
34070
33896
  if (policyTypes & 2) {
34071
33897
  const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
@@ -34297,15 +34123,15 @@ This unreleased fuel-core build may include features and updates not yet support
34297
34123
  encode(value) {
34298
34124
  const parts = [];
34299
34125
  parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
34300
- parts.push(new B256Coder().encode(value.receiptsRoot));
34301
- parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
34302
- parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
34126
+ parts.push(new NumberCoder("u32").encode(value.scriptLength));
34127
+ parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
34303
34128
  parts.push(new NumberCoder("u32").encode(value.policyTypes));
34304
- parts.push(new NumberCoder("u16").encode(value.inputsCount));
34305
- parts.push(new NumberCoder("u16").encode(value.outputsCount));
34306
- parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34307
- parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
34308
- parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
34129
+ parts.push(new NumberCoder("u8").encode(value.inputsCount));
34130
+ parts.push(new NumberCoder("u8").encode(value.outputsCount));
34131
+ parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34132
+ parts.push(new B256Coder().encode(value.receiptsRoot));
34133
+ parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
34134
+ parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
34309
34135
  parts.push(new PoliciesCoder().encode(value.policies));
34310
34136
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34311
34137
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
@@ -34317,23 +34143,23 @@ This unreleased fuel-core build may include features and updates not yet support
34317
34143
  let o = offset;
34318
34144
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34319
34145
  const scriptGasLimit = decoded;
34320
- [decoded, o] = new B256Coder().decode(data, o);
34321
- const receiptsRoot = decoded;
34322
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34146
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34323
34147
  const scriptLength = decoded;
34324
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34148
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34325
34149
  const scriptDataLength = decoded;
34326
34150
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34327
34151
  const policyTypes = decoded;
34328
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34152
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34329
34153
  const inputsCount = decoded;
34330
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34154
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34331
34155
  const outputsCount = decoded;
34332
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34156
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34333
34157
  const witnessesCount = decoded;
34334
- [decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
34158
+ [decoded, o] = new B256Coder().decode(data, o);
34159
+ const receiptsRoot = decoded;
34160
+ [decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
34335
34161
  const script = decoded;
34336
- [decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
34162
+ [decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
34337
34163
  const scriptData = decoded;
34338
34164
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34339
34165
  const policies = decoded;
@@ -34371,19 +34197,18 @@ This unreleased fuel-core build may include features and updates not yet support
34371
34197
  }
34372
34198
  encode(value) {
34373
34199
  const parts = [];
34374
- parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
34375
- parts.push(new B256Coder().encode(value.salt));
34376
- parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
34200
+ parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
34201
+ parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
34377
34202
  parts.push(new NumberCoder("u32").encode(value.policyTypes));
34378
- parts.push(new NumberCoder("u16").encode(value.inputsCount));
34379
- parts.push(new NumberCoder("u16").encode(value.outputsCount));
34380
- parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34203
+ parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
34204
+ parts.push(new NumberCoder("u8").encode(value.inputsCount));
34205
+ parts.push(new NumberCoder("u8").encode(value.outputsCount));
34206
+ parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34207
+ parts.push(new B256Coder().encode(value.salt));
34208
+ parts.push(new PoliciesCoder().encode(value.policies));
34381
34209
  parts.push(
34382
- new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
34383
- value.storageSlots
34384
- )
34210
+ new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
34385
34211
  );
34386
- parts.push(new PoliciesCoder().encode(value.policies));
34387
34212
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34388
34213
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
34389
34214
  parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
@@ -34392,27 +34217,26 @@ This unreleased fuel-core build may include features and updates not yet support
34392
34217
  decode(data, offset) {
34393
34218
  let decoded;
34394
34219
  let o = offset;
34395
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34220
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34221
+ const bytecodeLength = decoded;
34222
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34396
34223
  const bytecodeWitnessIndex = decoded;
34397
- [decoded, o] = new B256Coder().decode(data, o);
34398
- const salt = decoded;
34399
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34400
- const storageSlotsCount = decoded;
34401
34224
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34402
34225
  const policyTypes = decoded;
34403
34226
  [decoded, o] = new NumberCoder("u16").decode(data, o);
34227
+ const storageSlotsCount = decoded;
34228
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34404
34229
  const inputsCount = decoded;
34405
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34230
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34406
34231
  const outputsCount = decoded;
34407
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34232
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34408
34233
  const witnessesCount = decoded;
34409
- [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
34410
- data,
34411
- o
34412
- );
34413
- const storageSlots = decoded;
34234
+ [decoded, o] = new B256Coder().decode(data, o);
34235
+ const salt = decoded;
34414
34236
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34415
34237
  const policies = decoded;
34238
+ [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
34239
+ const storageSlots = decoded;
34416
34240
  [decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
34417
34241
  const inputs = decoded;
34418
34242
  [decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
@@ -34422,6 +34246,7 @@ This unreleased fuel-core build may include features and updates not yet support
34422
34246
  return [
34423
34247
  {
34424
34248
  type: 1,
34249
+ bytecodeLength,
34425
34250
  bytecodeWitnessIndex,
34426
34251
  policyTypes,
34427
34252
  storageSlotsCount,
@@ -34450,7 +34275,6 @@ This unreleased fuel-core build may include features and updates not yet support
34450
34275
  parts.push(new OutputContractCoder().encode(value.outputContract));
34451
34276
  parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
34452
34277
  parts.push(new B256Coder().encode(value.mintAssetId));
34453
- parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
34454
34278
  return concat(parts);
34455
34279
  }
34456
34280
  decode(data, offset) {
@@ -34466,8 +34290,6 @@ This unreleased fuel-core build may include features and updates not yet support
34466
34290
  const mintAmount = decoded;
34467
34291
  [decoded, o] = new B256Coder().decode(data, o);
34468
34292
  const mintAssetId = decoded;
34469
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34470
- const gasPrice = decoded;
34471
34293
  return [
34472
34294
  {
34473
34295
  type: 2,
@@ -34475,8 +34297,7 @@ This unreleased fuel-core build may include features and updates not yet support
34475
34297
  inputContract,
34476
34298
  outputContract,
34477
34299
  mintAmount,
34478
- mintAssetId,
34479
- gasPrice
34300
+ mintAssetId
34480
34301
  },
34481
34302
  o
34482
34303
  ];
@@ -34783,6 +34604,159 @@ This unreleased fuel-core build may include features and updates not yet support
34783
34604
  // src/providers/provider.ts
34784
34605
  var import_graphql_request = __toESM(require_dist2());
34785
34606
 
34607
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
34608
+ function _isPlaceholder(a) {
34609
+ return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
34610
+ }
34611
+
34612
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
34613
+ function _curry1(fn) {
34614
+ return function f1(a) {
34615
+ if (arguments.length === 0 || _isPlaceholder(a)) {
34616
+ return f1;
34617
+ } else {
34618
+ return fn.apply(this, arguments);
34619
+ }
34620
+ };
34621
+ }
34622
+
34623
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
34624
+ var isArray_default = Array.isArray || function _isArray(val) {
34625
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
34626
+ };
34627
+
34628
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
34629
+ var type = /* @__PURE__ */ _curry1(function type2(val) {
34630
+ return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
34631
+ });
34632
+ var type_default = type;
34633
+
34634
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
34635
+ var pad = function pad2(n) {
34636
+ return (n < 10 ? "0" : "") + n;
34637
+ };
34638
+ var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
34639
+ return d.toISOString();
34640
+ } : function _toISOString3(d) {
34641
+ return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
34642
+ };
34643
+
34644
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
34645
+ var isInteger_default = Number.isInteger || function _isInteger(n) {
34646
+ return n << 0 === n;
34647
+ };
34648
+
34649
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
34650
+ function _cloneRegExp(pattern) {
34651
+ return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
34652
+ }
34653
+
34654
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
34655
+ function _clone(value, deep, map) {
34656
+ map || (map = new _ObjectMap());
34657
+ if (_isPrimitive(value)) {
34658
+ return value;
34659
+ }
34660
+ var copy = function copy2(copiedValue) {
34661
+ var cachedCopy = map.get(value);
34662
+ if (cachedCopy) {
34663
+ return cachedCopy;
34664
+ }
34665
+ map.set(value, copiedValue);
34666
+ for (var key in value) {
34667
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
34668
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
34669
+ }
34670
+ }
34671
+ return copiedValue;
34672
+ };
34673
+ switch (type_default(value)) {
34674
+ case "Object":
34675
+ return copy(Object.create(Object.getPrototypeOf(value)));
34676
+ case "Array":
34677
+ return copy([]);
34678
+ case "Date":
34679
+ return new Date(value.valueOf());
34680
+ case "RegExp":
34681
+ return _cloneRegExp(value);
34682
+ case "Int8Array":
34683
+ case "Uint8Array":
34684
+ case "Uint8ClampedArray":
34685
+ case "Int16Array":
34686
+ case "Uint16Array":
34687
+ case "Int32Array":
34688
+ case "Uint32Array":
34689
+ case "Float32Array":
34690
+ case "Float64Array":
34691
+ case "BigInt64Array":
34692
+ case "BigUint64Array":
34693
+ return value.slice();
34694
+ default:
34695
+ return value;
34696
+ }
34697
+ }
34698
+ function _isPrimitive(param) {
34699
+ var type3 = typeof param;
34700
+ return param == null || type3 != "object" && type3 != "function";
34701
+ }
34702
+ var _ObjectMap = /* @__PURE__ */ function() {
34703
+ function _ObjectMap2() {
34704
+ this.map = {};
34705
+ this.length = 0;
34706
+ }
34707
+ _ObjectMap2.prototype.set = function(key, value) {
34708
+ const hashedKey = this.hash(key);
34709
+ let bucket = this.map[hashedKey];
34710
+ if (!bucket) {
34711
+ this.map[hashedKey] = bucket = [];
34712
+ }
34713
+ bucket.push([key, value]);
34714
+ this.length += 1;
34715
+ };
34716
+ _ObjectMap2.prototype.hash = function(key) {
34717
+ let hashedKey = [];
34718
+ for (var value in key) {
34719
+ hashedKey.push(Object.prototype.toString.call(key[value]));
34720
+ }
34721
+ return hashedKey.join();
34722
+ };
34723
+ _ObjectMap2.prototype.get = function(key) {
34724
+ if (this.length <= 180) {
34725
+ for (const p in this.map) {
34726
+ const bucket2 = this.map[p];
34727
+ for (let i = 0; i < bucket2.length; i += 1) {
34728
+ const element = bucket2[i];
34729
+ if (element[0] === key) {
34730
+ return element[1];
34731
+ }
34732
+ }
34733
+ }
34734
+ return;
34735
+ }
34736
+ const hashedKey = this.hash(key);
34737
+ const bucket = this.map[hashedKey];
34738
+ if (!bucket) {
34739
+ return;
34740
+ }
34741
+ for (let i = 0; i < bucket.length; i += 1) {
34742
+ const element = bucket[i];
34743
+ if (element[0] === key) {
34744
+ return element[1];
34745
+ }
34746
+ }
34747
+ };
34748
+ return _ObjectMap2;
34749
+ }();
34750
+
34751
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
34752
+ var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
34753
+ return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
34754
+ });
34755
+ var clone_default = clone2;
34756
+
34757
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
34758
+ var hasProtoTrim = typeof String.prototype.trim === "function";
34759
+
34786
34760
  // ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
34787
34761
  var __assign = function() {
34788
34762
  __assign = Object.assign || function __assign2(t) {
@@ -37950,10 +37924,14 @@ spurious results.`);
37950
37924
  // src/providers/__generated__/operations.ts
37951
37925
  var ReceiptFragmentFragmentDoc = lib_default2`
37952
37926
  fragment receiptFragment on Receipt {
37953
- id
37927
+ contract {
37928
+ id
37929
+ }
37954
37930
  pc
37955
37931
  is
37956
- to
37932
+ to {
37933
+ id
37934
+ }
37957
37935
  toAddress
37958
37936
  amount
37959
37937
  assetId
@@ -37991,16 +37969,10 @@ spurious results.`);
37991
37969
  id
37992
37970
  }
37993
37971
  time
37994
- receipts {
37995
- ...receiptFragment
37996
- }
37997
37972
  programState {
37998
37973
  returnType
37999
37974
  data
38000
37975
  }
38001
- receipts {
38002
- ...receiptFragment
38003
- }
38004
37976
  }
38005
37977
  ... on FailureStatus {
38006
37978
  block {
@@ -38008,24 +37980,26 @@ spurious results.`);
38008
37980
  }
38009
37981
  time
38010
37982
  reason
38011
- receipts {
38012
- ...receiptFragment
38013
- }
38014
37983
  }
38015
37984
  ... on SqueezedOutStatus {
38016
37985
  reason
38017
37986
  }
38018
37987
  }
38019
- ${ReceiptFragmentFragmentDoc}`;
37988
+ `;
38020
37989
  var TransactionFragmentFragmentDoc = lib_default2`
38021
37990
  fragment transactionFragment on Transaction {
38022
37991
  id
38023
37992
  rawPayload
37993
+ gasPrice
37994
+ receipts {
37995
+ ...receiptFragment
37996
+ }
38024
37997
  status {
38025
37998
  ...transactionStatusFragment
38026
37999
  }
38027
38000
  }
38028
- ${TransactionStatusFragmentFragmentDoc}`;
38001
+ ${ReceiptFragmentFragmentDoc}
38002
+ ${TransactionStatusFragmentFragmentDoc}`;
38029
38003
  var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
38030
38004
  fragment inputEstimatePredicatesFragment on Input {
38031
38005
  ... on InputCoin {
@@ -38043,46 +38017,6 @@ spurious results.`);
38043
38017
  }
38044
38018
  }
38045
38019
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
38046
- var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
38047
- fragment dryRunFailureStatusFragment on DryRunFailureStatus {
38048
- reason
38049
- programState {
38050
- returnType
38051
- data
38052
- }
38053
- }
38054
- `;
38055
- var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
38056
- fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
38057
- programState {
38058
- returnType
38059
- data
38060
- }
38061
- }
38062
- `;
38063
- var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
38064
- fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
38065
- ... on DryRunFailureStatus {
38066
- ...dryRunFailureStatusFragment
38067
- }
38068
- ... on DryRunSuccessStatus {
38069
- ...dryRunSuccessStatusFragment
38070
- }
38071
- }
38072
- ${DryRunFailureStatusFragmentFragmentDoc}
38073
- ${DryRunSuccessStatusFragmentFragmentDoc}`;
38074
- var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
38075
- fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
38076
- id
38077
- status {
38078
- ...dryRunTransactionStatusFragment
38079
- }
38080
- receipts {
38081
- ...receiptFragment
38082
- }
38083
- }
38084
- ${DryRunTransactionStatusFragmentFragmentDoc}
38085
- ${ReceiptFragmentFragmentDoc}`;
38086
38020
  var CoinFragmentFragmentDoc = lib_default2`
38087
38021
  fragment coinFragment on Coin {
38088
38022
  __typename
@@ -38090,6 +38024,7 @@ ${ReceiptFragmentFragmentDoc}`;
38090
38024
  owner
38091
38025
  amount
38092
38026
  assetId
38027
+ maturity
38093
38028
  blockCreated
38094
38029
  txCreatedIdx
38095
38030
  }
@@ -38134,6 +38069,7 @@ ${ReceiptFragmentFragmentDoc}`;
38134
38069
  prevRoot
38135
38070
  time
38136
38071
  applicationHash
38072
+ messageReceiptRoot
38137
38073
  messageReceiptCount
38138
38074
  }
38139
38075
  commitBlockHeader {
@@ -38145,6 +38081,7 @@ ${ReceiptFragmentFragmentDoc}`;
38145
38081
  prevRoot
38146
38082
  time
38147
38083
  applicationHash
38084
+ messageReceiptRoot
38148
38085
  messageReceiptCount
38149
38086
  }
38150
38087
  sender
@@ -38164,8 +38101,8 @@ ${ReceiptFragmentFragmentDoc}`;
38164
38101
  var BlockFragmentFragmentDoc = lib_default2`
38165
38102
  fragment blockFragment on Block {
38166
38103
  id
38167
- height
38168
38104
  header {
38105
+ height
38169
38106
  time
38170
38107
  }
38171
38108
  transactions {
@@ -38223,11 +38160,6 @@ ${ReceiptFragmentFragmentDoc}`;
38223
38160
  `;
38224
38161
  var GasCostsFragmentFragmentDoc = lib_default2`
38225
38162
  fragment GasCostsFragment on GasCosts {
38226
- version {
38227
- ... on Version {
38228
- value
38229
- }
38230
- }
38231
38163
  add
38232
38164
  addi
38233
38165
  aloc
@@ -38240,6 +38172,7 @@ ${ReceiptFragmentFragmentDoc}`;
38240
38172
  cb
38241
38173
  cfei
38242
38174
  cfsi
38175
+ croo
38243
38176
  div
38244
38177
  divi
38245
38178
  ecr1
@@ -38322,9 +38255,6 @@ ${ReceiptFragmentFragmentDoc}`;
38322
38255
  ccp {
38323
38256
  ...DependentCostFragment
38324
38257
  }
38325
- croo {
38326
- ...DependentCostFragment
38327
- }
38328
38258
  csiz {
38329
38259
  ...DependentCostFragment
38330
38260
  }
@@ -38384,11 +38314,6 @@ ${ReceiptFragmentFragmentDoc}`;
38384
38314
  ${DependentCostFragmentFragmentDoc}`;
38385
38315
  var ConsensusParametersFragmentFragmentDoc = lib_default2`
38386
38316
  fragment consensusParametersFragment on ConsensusParameters {
38387
- version {
38388
- ... on Version {
38389
- value
38390
- }
38391
- }
38392
38317
  txParams {
38393
38318
  ...TxParametersFragment
38394
38319
  }
@@ -38448,9 +38373,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38448
38373
  fragment nodeInfoFragment on NodeInfo {
38449
38374
  utxoValidation
38450
38375
  vmBacktrace
38376
+ minGasPrice
38451
38377
  maxTx
38452
38378
  maxDepth
38453
38379
  nodeVersion
38380
+ peers {
38381
+ id
38382
+ addresses
38383
+ clientVersion
38384
+ blockHeight
38385
+ lastHeartbeatMs
38386
+ appScore
38387
+ }
38454
38388
  }
38455
38389
  `;
38456
38390
  var GetVersionDocument = lib_default2`
@@ -38485,9 +38419,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38485
38419
  query getTransactionWithReceipts($transactionId: TransactionId!) {
38486
38420
  transaction(id: $transactionId) {
38487
38421
  ...transactionFragment
38422
+ receipts {
38423
+ ...receiptFragment
38424
+ }
38488
38425
  }
38489
38426
  }
38490
- ${TransactionFragmentFragmentDoc}`;
38427
+ ${TransactionFragmentFragmentDoc}
38428
+ ${ReceiptFragmentFragmentDoc}`;
38491
38429
  var GetTransactionsDocument = lib_default2`
38492
38430
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
38493
38431
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -38615,20 +38553,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38615
38553
  }
38616
38554
  }
38617
38555
  ${BalanceFragmentFragmentDoc}`;
38618
- var GetLatestGasPriceDocument = lib_default2`
38619
- query getLatestGasPrice {
38620
- latestGasPrice {
38621
- gasPrice
38622
- }
38623
- }
38624
- `;
38625
- var EstimateGasPriceDocument = lib_default2`
38626
- query estimateGasPrice($blockHorizon: U32!) {
38627
- estimateGasPrice(blockHorizon: $blockHorizon) {
38628
- gasPrice
38629
- }
38630
- }
38631
- `;
38632
38556
  var GetBalancesDocument = lib_default2`
38633
38557
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
38634
38558
  balances(
@@ -38683,12 +38607,12 @@ ${MessageCoinFragmentFragmentDoc}`;
38683
38607
  }
38684
38608
  `;
38685
38609
  var DryRunDocument = lib_default2`
38686
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
38687
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
38688
- ...dryRunTransactionExecutionStatusFragment
38610
+ mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
38611
+ dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
38612
+ ...receiptFragment
38689
38613
  }
38690
38614
  }
38691
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
38615
+ ${ReceiptFragmentFragmentDoc}`;
38692
38616
  var SubmitDocument = lib_default2`
38693
38617
  mutation submit($encodedTransaction: HexString!) {
38694
38618
  submit(tx: $encodedTransaction) {
@@ -38771,12 +38695,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38771
38695
  getBalance(variables, options) {
38772
38696
  return requester(GetBalanceDocument, variables, options);
38773
38697
  },
38774
- getLatestGasPrice(variables, options) {
38775
- return requester(GetLatestGasPriceDocument, variables, options);
38776
- },
38777
- estimateGasPrice(variables, options) {
38778
- return requester(EstimateGasPriceDocument, variables, options);
38779
- },
38780
38698
  getBalances(variables, options) {
38781
38699
  return requester(GetBalancesDocument, variables, options);
38782
38700
  },
@@ -38844,14 +38762,11 @@ ${MessageCoinFragmentFragmentDoc}`;
38844
38762
  let data;
38845
38763
  let errors;
38846
38764
  try {
38847
- const sanitizedText = text.replace(/\s/g, "");
38848
- ({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
38765
+ ({ data, errors } = JSON.parse(text.replace(/^data:/, "")));
38849
38766
  } catch (e) {
38850
38767
  throw new FuelError(
38851
38768
  ErrorCode.STREAM_PARSING_ERROR,
38852
- `Error while parsing stream data response: ${text}
38853
-
38854
- Thrown error: ${e}`
38769
+ `Error while parsing stream data response: ${text}`
38855
38770
  );
38856
38771
  }
38857
38772
  if (Array.isArray(errors)) {
@@ -38935,6 +38850,9 @@ Thrown error: ${e}`
38935
38850
  }
38936
38851
  };
38937
38852
 
38853
+ // ../address/dist/configs.mjs
38854
+ var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
38855
+
38938
38856
  // src/providers/transaction-request/input.ts
38939
38857
  var inputify = (value) => {
38940
38858
  const { type: type3 } = value;
@@ -38945,7 +38863,7 @@ Thrown error: ${e}`
38945
38863
  return {
38946
38864
  type: InputType.Coin,
38947
38865
  txID: hexlify(arrayify(value.id).slice(0, 32)),
38948
- outputIndex: toNumber2(arrayify(value.id).slice(32, 34)),
38866
+ outputIndex: arrayify(value.id)[32],
38949
38867
  owner: hexlify(value.owner),
38950
38868
  amount: bn(value.amount),
38951
38869
  assetId: hexlify(value.assetId),
@@ -38954,9 +38872,10 @@ Thrown error: ${e}`
38954
38872
  txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38955
38873
  },
38956
38874
  witnessIndex: value.witnessIndex,
38875
+ maturity: value.maturity ?? 0,
38957
38876
  predicateGasUsed: bn(value.predicateGasUsed),
38958
- predicateLength: bn(predicate.length),
38959
- predicateDataLength: bn(predicateData.length),
38877
+ predicateLength: predicate.length,
38878
+ predicateDataLength: predicateData.length,
38960
38879
  predicate: hexlify(predicate),
38961
38880
  predicateData: hexlify(predicateData)
38962
38881
  };
@@ -38987,8 +38906,8 @@ Thrown error: ${e}`
38987
38906
  nonce: hexlify(value.nonce),
38988
38907
  witnessIndex: value.witnessIndex,
38989
38908
  predicateGasUsed: bn(value.predicateGasUsed),
38990
- predicateLength: bn(predicate.length),
38991
- predicateDataLength: bn(predicateData.length),
38909
+ predicateLength: predicate.length,
38910
+ predicateDataLength: predicateData.length,
38992
38911
  predicate: hexlify(predicate),
38993
38912
  predicateData: hexlify(predicateData),
38994
38913
  data: hexlify(data),
@@ -39148,8 +39067,8 @@ Thrown error: ${e}`
39148
39067
  case "CALL" /* Call */: {
39149
39068
  const callReceipt = {
39150
39069
  type: ReceiptType.Call,
39151
- from: hexOrZero(receipt.id || receipt.contractId),
39152
- to: hexOrZero(receipt?.to),
39070
+ from: hexOrZero(receipt.contract?.id),
39071
+ to: hexOrZero(receipt?.to?.id),
39153
39072
  amount: bn(receipt.amount),
39154
39073
  assetId: hexOrZero(receipt.assetId),
39155
39074
  gas: bn(receipt.gas),
@@ -39163,7 +39082,7 @@ Thrown error: ${e}`
39163
39082
  case "RETURN" /* Return */: {
39164
39083
  const returnReceipt = {
39165
39084
  type: ReceiptType.Return,
39166
- id: hexOrZero(receipt.id || receipt.contractId),
39085
+ id: hexOrZero(receipt.contract?.id),
39167
39086
  val: bn(receipt.val),
39168
39087
  pc: bn(receipt.pc),
39169
39088
  is: bn(receipt.is)
@@ -39173,7 +39092,7 @@ Thrown error: ${e}`
39173
39092
  case "RETURN_DATA" /* ReturnData */: {
39174
39093
  const returnDataReceipt = {
39175
39094
  type: ReceiptType.ReturnData,
39176
- id: hexOrZero(receipt.id || receipt.contractId),
39095
+ id: hexOrZero(receipt.contract?.id),
39177
39096
  ptr: bn(receipt.ptr),
39178
39097
  len: bn(receipt.len),
39179
39098
  digest: hexOrZero(receipt.digest),
@@ -39185,7 +39104,7 @@ Thrown error: ${e}`
39185
39104
  case "PANIC" /* Panic */: {
39186
39105
  const panicReceipt = {
39187
39106
  type: ReceiptType.Panic,
39188
- id: hexOrZero(receipt.id),
39107
+ id: hexOrZero(receipt.contract?.id),
39189
39108
  reason: bn(receipt.reason),
39190
39109
  pc: bn(receipt.pc),
39191
39110
  is: bn(receipt.is),
@@ -39196,7 +39115,7 @@ Thrown error: ${e}`
39196
39115
  case "REVERT" /* Revert */: {
39197
39116
  const revertReceipt = {
39198
39117
  type: ReceiptType.Revert,
39199
- id: hexOrZero(receipt.id || receipt.contractId),
39118
+ id: hexOrZero(receipt.contract?.id),
39200
39119
  val: bn(receipt.ra),
39201
39120
  pc: bn(receipt.pc),
39202
39121
  is: bn(receipt.is)
@@ -39206,7 +39125,7 @@ Thrown error: ${e}`
39206
39125
  case "LOG" /* Log */: {
39207
39126
  const logReceipt = {
39208
39127
  type: ReceiptType.Log,
39209
- id: hexOrZero(receipt.id || receipt.contractId),
39128
+ id: hexOrZero(receipt.contract?.id),
39210
39129
  val0: bn(receipt.ra),
39211
39130
  val1: bn(receipt.rb),
39212
39131
  val2: bn(receipt.rc),
@@ -39219,7 +39138,7 @@ Thrown error: ${e}`
39219
39138
  case "LOG_DATA" /* LogData */: {
39220
39139
  const logDataReceipt = {
39221
39140
  type: ReceiptType.LogData,
39222
- id: hexOrZero(receipt.id || receipt.contractId),
39141
+ id: hexOrZero(receipt.contract?.id),
39223
39142
  val0: bn(receipt.ra),
39224
39143
  val1: bn(receipt.rb),
39225
39144
  ptr: bn(receipt.ptr),
@@ -39233,8 +39152,8 @@ Thrown error: ${e}`
39233
39152
  case "TRANSFER" /* Transfer */: {
39234
39153
  const transferReceipt = {
39235
39154
  type: ReceiptType.Transfer,
39236
- from: hexOrZero(receipt.id || receipt.contractId),
39237
- to: hexOrZero(receipt.toAddress || receipt?.to),
39155
+ from: hexOrZero(receipt.contract?.id),
39156
+ to: hexOrZero(receipt.toAddress || receipt?.to?.id),
39238
39157
  amount: bn(receipt.amount),
39239
39158
  assetId: hexOrZero(receipt.assetId),
39240
39159
  pc: bn(receipt.pc),
@@ -39245,8 +39164,8 @@ Thrown error: ${e}`
39245
39164
  case "TRANSFER_OUT" /* TransferOut */: {
39246
39165
  const transferOutReceipt = {
39247
39166
  type: ReceiptType.TransferOut,
39248
- from: hexOrZero(receipt.id || receipt.contractId),
39249
- to: hexOrZero(receipt.toAddress || receipt.to),
39167
+ from: hexOrZero(receipt.contract?.id),
39168
+ to: hexOrZero(receipt.toAddress || receipt.to?.id),
39250
39169
  amount: bn(receipt.amount),
39251
39170
  assetId: hexOrZero(receipt.assetId),
39252
39171
  pc: bn(receipt.pc),
@@ -39289,7 +39208,7 @@ Thrown error: ${e}`
39289
39208
  return receiptMessageOut;
39290
39209
  }
39291
39210
  case "MINT" /* Mint */: {
39292
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39211
+ const contractId = hexOrZero(receipt.contract?.id);
39293
39212
  const subId = hexOrZero(receipt.subId);
39294
39213
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
39295
39214
  const mintReceipt = {
@@ -39304,7 +39223,7 @@ Thrown error: ${e}`
39304
39223
  return mintReceipt;
39305
39224
  }
39306
39225
  case "BURN" /* Burn */: {
39307
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39226
+ const contractId = hexOrZero(receipt.contract?.id);
39308
39227
  const subId = hexOrZero(receipt.subId);
39309
39228
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
39310
39229
  const burnReceipt = {
@@ -39385,6 +39304,7 @@ Thrown error: ${e}`
39385
39304
  };
39386
39305
 
39387
39306
  // src/providers/utils/gas.ts
39307
+ var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
39388
39308
  var getGasUsedFromReceipts = (receipts) => {
39389
39309
  const scriptResult = receipts.filter(
39390
39310
  (receipt) => receipt.type === ReceiptType.ScriptResult
@@ -39405,28 +39325,18 @@ Thrown error: ${e}`
39405
39325
  }
39406
39326
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
39407
39327
  const witnessCache = [];
39408
- const chargeableInputs = inputs.filter((input) => {
39409
- const isCoinOrMessage = "owner" in input || "sender" in input;
39410
- if (isCoinOrMessage) {
39411
- if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39412
- return true;
39413
- }
39414
- if (!witnessCache.includes(input.witnessIndex)) {
39415
- witnessCache.push(input.witnessIndex);
39416
- return true;
39417
- }
39418
- }
39419
- return false;
39420
- });
39421
- const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
39422
- const totalGas = chargeableInputs.reduce((total, input) => {
39328
+ const totalGas = inputs.reduce((total, input) => {
39423
39329
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39424
39330
  return total.add(
39425
- vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39331
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39426
39332
  );
39427
39333
  }
39428
- return total.add(gasCosts.ecr1);
39429
- }, bn(0));
39334
+ if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
39335
+ witnessCache.push(input.witnessIndex);
39336
+ return total.add(gasCosts.ecr1);
39337
+ }
39338
+ return total;
39339
+ }, bn());
39430
39340
  return totalGas;
39431
39341
  }
39432
39342
  function getMinGas(params) {
@@ -39438,20 +39348,12 @@ Thrown error: ${e}`
39438
39348
  return minGas;
39439
39349
  }
39440
39350
  function getMaxGas(params) {
39441
- const {
39442
- gasPerByte,
39443
- witnessesLength,
39444
- witnessLimit,
39445
- minGas,
39446
- gasLimit = bn(0),
39447
- maxGasPerTx
39448
- } = params;
39351
+ const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
39449
39352
  let remainingAllowedWitnessGas = bn(0);
39450
39353
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
39451
39354
  remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
39452
39355
  }
39453
- const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39454
- return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
39356
+ return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39455
39357
  }
39456
39358
  function calculateMetadataGasForTxCreate({
39457
39359
  gasCosts,
@@ -39473,10 +39375,6 @@ Thrown error: ${e}`
39473
39375
  }) {
39474
39376
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
39475
39377
  }
39476
- var calculateGasFee = (params) => {
39477
- const { gas, gasPrice, priceFactor, tip } = params;
39478
- return gas.mul(gasPrice).div(priceFactor).add(tip);
39479
- };
39480
39378
 
39481
39379
  // src/providers/utils/json.ts
39482
39380
  function normalize2(object) {
@@ -39618,7 +39516,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39618
39516
  // src/providers/transaction-request/transaction-request.ts
39619
39517
  var BaseTransactionRequest = class {
39620
39518
  /** Gas price for transaction */
39621
- tip;
39519
+ gasPrice;
39622
39520
  /** Block until which tx cannot be included */
39623
39521
  maturity;
39624
39522
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -39631,34 +39529,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39631
39529
  outputs = [];
39632
39530
  /** List of witnesses */
39633
39531
  witnesses = [];
39532
+ /** Base asset ID - should be fetched from the chain */
39533
+ baseAssetId = ZeroBytes32;
39634
39534
  /**
39635
39535
  * Constructor for initializing a base transaction request.
39636
39536
  *
39637
39537
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
39638
39538
  */
39639
39539
  constructor({
39640
- tip,
39540
+ gasPrice,
39641
39541
  maturity,
39642
39542
  maxFee,
39643
39543
  witnessLimit,
39644
39544
  inputs,
39645
39545
  outputs,
39646
- witnesses
39546
+ witnesses,
39547
+ baseAssetId
39647
39548
  } = {}) {
39648
- this.tip = bn(tip);
39549
+ this.gasPrice = bn(gasPrice);
39649
39550
  this.maturity = maturity ?? 0;
39650
39551
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
39651
39552
  this.maxFee = maxFee ? bn(maxFee) : void 0;
39652
39553
  this.inputs = inputs ?? [];
39653
39554
  this.outputs = outputs ?? [];
39654
39555
  this.witnesses = witnesses ?? [];
39556
+ this.baseAssetId = baseAssetId ?? ZeroBytes32;
39655
39557
  }
39656
39558
  static getPolicyMeta(req) {
39657
39559
  let policyTypes = 0;
39658
39560
  const policies = [];
39659
- if (req.tip) {
39660
- policyTypes += PolicyType.Tip;
39661
- policies.push({ data: req.tip, type: PolicyType.Tip });
39561
+ if (req.gasPrice) {
39562
+ policyTypes += PolicyType.GasPrice;
39563
+ policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
39662
39564
  }
39663
39565
  if (req.witnessLimit) {
39664
39566
  policyTypes += PolicyType.WitnessLimit;
@@ -39845,10 +39747,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39845
39747
  * @param predicate - Predicate bytes.
39846
39748
  * @param predicateData - Predicate data bytes.
39847
39749
  */
39848
- addCoinInput(coin) {
39750
+ addCoinInput(coin, predicate) {
39849
39751
  const { assetId, owner, amount } = coin;
39850
39752
  let witnessIndex;
39851
- if (coin.predicate) {
39753
+ if (predicate) {
39852
39754
  witnessIndex = 0;
39853
39755
  } else {
39854
39756
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -39863,7 +39765,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39863
39765
  amount,
39864
39766
  assetId,
39865
39767
  txPointer: "0x00000000000000000000000000000000",
39866
- witnessIndex
39768
+ witnessIndex,
39769
+ predicate: predicate?.bytes
39867
39770
  };
39868
39771
  this.pushInput(input);
39869
39772
  this.addChangeOutput(owner, assetId);
@@ -39874,13 +39777,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39874
39777
  *
39875
39778
  * @param message - Message resource.
39876
39779
  * @param predicate - Predicate bytes.
39877
- * @param predicateData - Predicate data bytes.
39878
39780
  */
39879
- addMessageInput(message) {
39781
+ addMessageInput(message, predicate) {
39880
39782
  const { recipient, sender, amount } = message;
39881
- const assetId = BaseAssetId;
39882
39783
  let witnessIndex;
39883
- if (message.predicate) {
39784
+ if (predicate) {
39884
39785
  witnessIndex = 0;
39885
39786
  } else {
39886
39787
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -39894,10 +39795,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39894
39795
  sender: sender.toB256(),
39895
39796
  recipient: recipient.toB256(),
39896
39797
  amount,
39897
- witnessIndex
39798
+ witnessIndex,
39799
+ predicate: predicate?.bytes
39898
39800
  };
39899
39801
  this.pushInput(input);
39900
- this.addChangeOutput(recipient, assetId);
39802
+ this.addChangeOutput(recipient, this.baseAssetId);
39901
39803
  }
39902
39804
  /**
39903
39805
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -39925,6 +39827,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39925
39827
  resources.forEach((resource) => this.addResource(resource));
39926
39828
  return this;
39927
39829
  }
39830
+ /**
39831
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
39832
+ * outputs from the related assetIds.
39833
+ *
39834
+ * @param resources - The resources to add.
39835
+ * @returns This transaction.
39836
+ */
39837
+ addPredicateResource(resource, predicate) {
39838
+ if (isCoin(resource)) {
39839
+ this.addCoinInput(resource, predicate);
39840
+ } else {
39841
+ this.addMessageInput(resource, predicate);
39842
+ }
39843
+ return this;
39844
+ }
39845
+ /**
39846
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
39847
+ * from the related assetIds.
39848
+ *
39849
+ * @param resources - The resources to add.
39850
+ * @returns This transaction.
39851
+ */
39852
+ addPredicateResources(resources, predicate) {
39853
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
39854
+ return this;
39855
+ }
39928
39856
  /**
39929
39857
  * Adds a coin output to the transaction.
39930
39858
  *
@@ -39932,12 +39860,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39932
39860
  * @param amount - Amount of coin.
39933
39861
  * @param assetId - Asset ID of coin.
39934
39862
  */
39935
- addCoinOutput(to, amount, assetId = BaseAssetId) {
39863
+ addCoinOutput(to, amount, assetId) {
39936
39864
  this.pushOutput({
39937
39865
  type: OutputType.Coin,
39938
39866
  to: addressify(to).toB256(),
39939
39867
  amount,
39940
- assetId
39868
+ assetId: assetId ?? this.baseAssetId
39941
39869
  });
39942
39870
  return this;
39943
39871
  }
@@ -39964,7 +39892,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39964
39892
  * @param to - Address of the owner.
39965
39893
  * @param assetId - Asset ID of coin.
39966
39894
  */
39967
- addChangeOutput(to, assetId = BaseAssetId) {
39895
+ addChangeOutput(to, assetId) {
39968
39896
  const changeOutput = this.getChangeOutputs().find(
39969
39897
  (output3) => hexlify(output3.assetId) === assetId
39970
39898
  );
@@ -39972,7 +39900,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39972
39900
  this.pushOutput({
39973
39901
  type: OutputType.Change,
39974
39902
  to: addressify(to).toB256(),
39975
- assetId
39903
+ assetId: assetId ?? this.baseAssetId
39976
39904
  });
39977
39905
  }
39978
39906
  }
@@ -40004,7 +39932,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40004
39932
  }
40005
39933
  calculateMaxGas(chainInfo, minGas) {
40006
39934
  const { consensusParameters } = chainInfo;
40007
- const { gasPerByte, maxGasPerTx } = consensusParameters;
39935
+ const { gasPerByte } = consensusParameters;
40008
39936
  const witnessesLength = this.toTransaction().witnesses.reduce(
40009
39937
  (acc, wit) => acc + wit.dataLength,
40010
39938
  0
@@ -40013,8 +39941,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40013
39941
  gasPerByte,
40014
39942
  minGas,
40015
39943
  witnessesLength,
40016
- witnessLimit: this.witnessLimit,
40017
- maxGasPerTx
39944
+ witnessLimit: this.witnessLimit
40018
39945
  });
40019
39946
  }
40020
39947
  /**
@@ -40024,6 +39951,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40024
39951
  * @param quantities - CoinQuantity Array.
40025
39952
  */
40026
39953
  fundWithFakeUtxos(quantities, resourcesOwner) {
39954
+ let idCounter = 0;
39955
+ const generateId = () => {
39956
+ const counterString = String(idCounter++);
39957
+ const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString);
39958
+ return id;
39959
+ };
40027
39960
  const findAssetInput = (assetId) => this.inputs.find((input) => {
40028
39961
  if ("assetId" in input) {
40029
39962
  return input.assetId === assetId;
@@ -40032,27 +39965,24 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40032
39965
  });
40033
39966
  const updateAssetInput = (assetId, quantity) => {
40034
39967
  const assetInput = findAssetInput(assetId);
40035
- let usedQuantity = quantity;
40036
- if (assetId === BaseAssetId) {
40037
- usedQuantity = bn("1000000000000000000");
40038
- }
40039
39968
  if (assetInput && "assetId" in assetInput) {
40040
- assetInput.id = hexlify(randomBytes3(34));
40041
- assetInput.amount = usedQuantity;
39969
+ assetInput.id = generateId();
39970
+ assetInput.amount = quantity;
40042
39971
  } else {
40043
39972
  this.addResources([
40044
39973
  {
40045
- id: hexlify(randomBytes3(34)),
40046
- amount: usedQuantity,
39974
+ id: generateId(),
39975
+ amount: quantity,
40047
39976
  assetId,
40048
39977
  owner: resourcesOwner || Address.fromRandom(),
39978
+ maturity: 0,
40049
39979
  blockCreated: bn(1),
40050
39980
  txCreatedIdx: bn(1)
40051
39981
  }
40052
39982
  ]);
40053
39983
  }
40054
39984
  };
40055
- updateAssetInput(BaseAssetId, bn(1e11));
39985
+ updateAssetInput(this.baseAssetId, bn(1e11));
40056
39986
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
40057
39987
  }
40058
39988
  /**
@@ -40077,7 +40007,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40077
40007
  toJSON() {
40078
40008
  return normalizeJSON(this);
40079
40009
  }
40080
- updatePredicateGasUsed(inputs) {
40010
+ updatePredicateInputs(inputs) {
40081
40011
  this.inputs.forEach((i) => {
40082
40012
  let correspondingInput;
40083
40013
  switch (i.type) {
@@ -40099,15 +40029,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40099
40029
  }
40100
40030
  });
40101
40031
  }
40102
- shiftPredicateData() {
40103
- this.inputs.forEach((input) => {
40104
- if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
40105
- input.predicateData = input.paddPredicateData(
40106
- BaseTransactionRequest.getPolicyMeta(this).policies.length
40107
- );
40108
- }
40109
- });
40110
- }
40111
40032
  };
40112
40033
 
40113
40034
  // src/providers/transaction-request/hash-transaction.ts
@@ -40241,8 +40162,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40241
40162
  return {
40242
40163
  type: TransactionType.Create,
40243
40164
  ...baseTransaction,
40165
+ bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
40244
40166
  bytecodeWitnessIndex,
40245
- storageSlotsCount: bn(storageSlots.length),
40167
+ storageSlotsCount: storageSlots.length,
40246
40168
  salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
40247
40169
  storageSlots
40248
40170
  };
@@ -40356,8 +40278,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40356
40278
  type: TransactionType.Script,
40357
40279
  scriptGasLimit: this.gasLimit,
40358
40280
  ...super.getBaseTransaction(),
40359
- scriptLength: bn(script.length),
40360
- scriptDataLength: bn(scriptData.length),
40281
+ scriptLength: script.length,
40282
+ scriptDataLength: scriptData.length,
40361
40283
  receiptsRoot: ZeroBytes32,
40362
40284
  script: hexlify(script),
40363
40285
  scriptData: hexlify(scriptData)
@@ -40421,7 +40343,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40421
40343
  }
40422
40344
  calculateMaxGas(chainInfo, minGas) {
40423
40345
  const { consensusParameters } = chainInfo;
40424
- const { gasPerByte, maxGasPerTx } = consensusParameters;
40346
+ const { gasPerByte } = consensusParameters;
40425
40347
  const witnessesLength = this.toTransaction().witnesses.reduce(
40426
40348
  (acc, wit) => acc + wit.dataLength,
40427
40349
  0
@@ -40431,8 +40353,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40431
40353
  minGas,
40432
40354
  witnessesLength,
40433
40355
  witnessLimit: this.witnessLimit,
40434
- gasLimit: this.gasLimit,
40435
- maxGasPerTx
40356
+ gasLimit: this.gasLimit
40436
40357
  });
40437
40358
  }
40438
40359
  /**
@@ -40505,29 +40426,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40505
40426
  }
40506
40427
  }
40507
40428
  };
40508
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40509
- (acc, input) => {
40510
- if (input.type === InputType.Coin && input.owner === owner) {
40511
- acc.utxos.push(input.id);
40512
- }
40513
- if (input.type === InputType.Message && input.recipient === owner) {
40514
- acc.messages.push(input.nonce);
40515
- }
40516
- return acc;
40517
- },
40518
- {
40519
- utxos: [],
40520
- messages: []
40521
- }
40522
- );
40523
40429
 
40524
40430
  // src/providers/transaction-summary/calculate-transaction-fee.ts
40525
40431
  var calculateTransactionFee = (params) => {
40526
40432
  const {
40527
- gasPrice,
40433
+ gasUsed,
40528
40434
  rawPayload,
40529
- tip,
40530
- consensusParameters: { gasCosts, feeParams, maxGasPerTx }
40435
+ consensusParameters: { gasCosts, feeParams }
40531
40436
  } = params;
40532
40437
  const gasPerByte = bn(feeParams.gasPerByte);
40533
40438
  const gasPriceFactor = bn(feeParams.gasPriceFactor);
@@ -40537,7 +40442,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40537
40442
  return {
40538
40443
  fee: bn(0),
40539
40444
  minFee: bn(0),
40540
- maxFee: bn(0)
40445
+ maxFee: bn(0),
40446
+ feeFromGasUsed: bn(0)
40541
40447
  };
40542
40448
  }
40543
40449
  const { type: type3, witnesses, inputs, policies } = transaction;
@@ -40569,6 +40475,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40569
40475
  metadataGas,
40570
40476
  txBytesSize: transactionBytes.length
40571
40477
  });
40478
+ const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
40572
40479
  const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
40573
40480
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
40574
40481
  const maxGas = getMaxGas({
@@ -40576,25 +40483,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40576
40483
  minGas,
40577
40484
  witnessesLength,
40578
40485
  gasLimit,
40579
- witnessLimit,
40580
- maxGasPerTx
40581
- });
40582
- const minFee = calculateGasFee({
40583
- gasPrice,
40584
- gas: minGas,
40585
- priceFactor: gasPriceFactor,
40586
- tip
40587
- });
40588
- const maxFee = calculateGasFee({
40589
- gasPrice,
40590
- gas: maxGas,
40591
- priceFactor: gasPriceFactor,
40592
- tip
40486
+ witnessLimit
40593
40487
  });
40488
+ const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
40489
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
40490
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
40491
+ const fee = minFee.add(feeFromGasUsed);
40594
40492
  return {
40493
+ fee,
40595
40494
  minFee,
40596
40495
  maxFee,
40597
- fee: maxFee
40496
+ feeFromGasUsed
40598
40497
  };
40599
40498
  };
40600
40499
 
@@ -41195,9 +41094,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41195
41094
  gqlTransactionStatus,
41196
41095
  abiMap = {},
41197
41096
  maxInputs,
41198
- gasCosts,
41199
- maxGasPerTx,
41200
- gasPrice
41097
+ gasCosts
41201
41098
  } = params;
41202
41099
  const gasUsed = getGasUsedFromReceipts(receipts);
41203
41100
  const rawPayload = hexlify(transactionBytes);
@@ -41211,14 +41108,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41211
41108
  maxInputs
41212
41109
  });
41213
41110
  const typeName = getTransactionTypeName(transaction.type);
41214
- const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
41215
41111
  const { fee } = calculateTransactionFee({
41216
- gasPrice,
41112
+ gasUsed,
41217
41113
  rawPayload,
41218
- tip,
41219
41114
  consensusParameters: {
41220
41115
  gasCosts,
41221
- maxGasPerTx,
41222
41116
  feeParams: {
41223
41117
  gasPerByte,
41224
41118
  gasPriceFactor
@@ -41354,13 +41248,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41354
41248
  const decodedTransaction = this.decodeTransaction(
41355
41249
  transaction
41356
41250
  );
41357
- let txReceipts = [];
41358
- if (transaction?.status && "receipts" in transaction.status) {
41359
- txReceipts = transaction.status.receipts;
41360
- }
41361
- const receipts = txReceipts.map(processGqlReceipt) || [];
41362
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
41363
- const gasPrice = await this.provider.getLatestGasPrice();
41251
+ const receipts = transaction.receipts?.map(processGqlReceipt) || [];
41252
+ const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
41364
41253
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
41365
41254
  const transactionSummary = assembleTransactionSummary({
41366
41255
  id: this.id,
@@ -41372,9 +41261,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41372
41261
  gasPriceFactor,
41373
41262
  abiMap: contractsAbiMap,
41374
41263
  maxInputs,
41375
- gasCosts,
41376
- maxGasPerTx,
41377
- gasPrice
41264
+ gasCosts
41378
41265
  });
41379
41266
  return transactionSummary;
41380
41267
  }
@@ -41518,12 +41405,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41518
41405
  gasPerByte: bn(feeParams.gasPerByte),
41519
41406
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
41520
41407
  chainId: bn(consensusParameters.chainId),
41408
+ baseAssetId: consensusParameters.baseAssetId,
41521
41409
  gasCosts
41522
41410
  },
41523
41411
  gasCosts,
41524
41412
  latestBlock: {
41525
41413
  id: latestBlock.id,
41526
- height: bn(latestBlock.height),
41414
+ height: bn(latestBlock.header.height),
41527
41415
  time: latestBlock.header.time,
41528
41416
  transactions: latestBlock.transactions.map((i) => ({
41529
41417
  id: i.id
@@ -41617,8 +41505,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41617
41505
  * Returns some helpful parameters related to gas fees.
41618
41506
  */
41619
41507
  getGasConfig() {
41508
+ const { minGasPrice } = this.getNode();
41620
41509
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
41621
41510
  return {
41511
+ minGasPrice,
41622
41512
  maxGasPerTx,
41623
41513
  maxGasPerPredicate,
41624
41514
  gasPriceFactor,
@@ -41716,7 +41606,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41716
41606
  */
41717
41607
  async getBlockNumber() {
41718
41608
  const { chain } = await this.operations.getChain();
41719
- return bn(chain.latestBlock.height, 10);
41609
+ return bn(chain.latestBlock.header.height, 10);
41720
41610
  }
41721
41611
  /**
41722
41612
  * Returns the chain information.
@@ -41728,9 +41618,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41728
41618
  const processedNodeInfo = {
41729
41619
  maxDepth: bn(nodeInfo.maxDepth),
41730
41620
  maxTx: bn(nodeInfo.maxTx),
41621
+ minGasPrice: bn(nodeInfo.minGasPrice),
41731
41622
  nodeVersion: nodeInfo.nodeVersion,
41732
41623
  utxoValidation: nodeInfo.utxoValidation,
41733
- vmBacktrace: nodeInfo.vmBacktrace
41624
+ vmBacktrace: nodeInfo.vmBacktrace,
41625
+ peers: nodeInfo.peers
41734
41626
  };
41735
41627
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
41736
41628
  return processedNodeInfo;
@@ -41756,6 +41648,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41756
41648
  } = this.getChain();
41757
41649
  return chainId.toNumber();
41758
41650
  }
41651
+ /**
41652
+ * Returns the base asset ID
41653
+ *
41654
+ * @returns A promise that resolves to the base asset ID
41655
+ */
41656
+ getBaseAssetId() {
41657
+ const {
41658
+ consensusParameters: { baseAssetId }
41659
+ } = this.getChain();
41660
+ return baseAssetId;
41661
+ }
41759
41662
  /**
41760
41663
  * Submits a transaction to the chain to be executed.
41761
41664
  *
@@ -41816,13 +41719,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41816
41719
  return this.estimateTxDependencies(transactionRequest);
41817
41720
  }
41818
41721
  const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41819
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41820
- encodedTransactions: encodedTransaction,
41722
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41723
+ encodedTransaction,
41821
41724
  utxoValidation: utxoValidation || false
41822
41725
  });
41823
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
41824
- const receipts = rawReceipts.map(processGqlReceipt);
41825
- return { receipts, dryrunStatus: status };
41726
+ const receipts = gqlReceipts.map(processGqlReceipt);
41727
+ return {
41728
+ receipts
41729
+ };
41826
41730
  }
41827
41731
  /**
41828
41732
  * Verifies whether enough gas is available to complete transaction.
@@ -41861,6 +41765,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41861
41765
  * If there are missing variable outputs,
41862
41766
  * `addVariableOutputs` is called on the transaction.
41863
41767
  *
41768
+ * @privateRemarks
41769
+ * TODO: Investigate support for missing contract IDs
41770
+ * TODO: Add support for missing output messages
41864
41771
  *
41865
41772
  * @param transactionRequest - The transaction request object.
41866
41773
  * @returns A promise.
@@ -41873,19 +41780,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41873
41780
  missingContractIds: []
41874
41781
  };
41875
41782
  }
41783
+ await this.estimatePredicates(transactionRequest);
41876
41784
  let receipts = [];
41877
41785
  const missingContractIds = [];
41878
41786
  let outputVariables = 0;
41879
- let dryrunStatus;
41880
41787
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
41881
- const {
41882
- dryRun: [{ receipts: rawReceipts, status }]
41883
- } = await this.operations.dryRun({
41884
- encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
41788
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41789
+ encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
41885
41790
  utxoValidation: false
41886
41791
  });
41887
- receipts = rawReceipts.map(processGqlReceipt);
41888
- dryrunStatus = status;
41792
+ receipts = gqlReceipts.map(processGqlReceipt);
41889
41793
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
41890
41794
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
41891
41795
  if (hasMissingOutputs) {
@@ -41895,11 +41799,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41895
41799
  transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
41896
41800
  missingContractIds.push(contractId);
41897
41801
  });
41898
- const { maxFee } = await this.estimateTxGasAndFee({
41899
- transactionRequest,
41900
- optimizeGas: false
41901
- });
41902
- transactionRequest.maxFee = maxFee;
41903
41802
  } else {
41904
41803
  break;
41905
41804
  }
@@ -41907,133 +41806,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41907
41806
  return {
41908
41807
  receipts,
41909
41808
  outputVariables,
41910
- missingContractIds,
41911
- dryrunStatus
41912
- };
41913
- }
41914
- /**
41915
- * Dry runs multiple transactions and checks for missing dependencies in batches.
41916
- *
41917
- * Transactions are dry run in batches. After each dry run, transactions requiring
41918
- * further modifications are identified. The method iteratively updates these transactions
41919
- * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
41920
- *
41921
- * @param transactionRequests - Array of transaction request objects.
41922
- * @returns A promise that resolves to an array of results for each transaction.
41923
- */
41924
- async estimateMultipleTxDependencies(transactionRequests) {
41925
- const results = transactionRequests.map(() => ({
41926
- receipts: [],
41927
- outputVariables: 0,
41928
- missingContractIds: [],
41929
- dryrunStatus: void 0
41930
- }));
41931
- const allRequests = clone_default(transactionRequests);
41932
- const serializedTransactionsMap = /* @__PURE__ */ new Map();
41933
- allRequests.forEach((req, index) => {
41934
- if (req.type === TransactionType.Script) {
41935
- serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
41936
- }
41937
- });
41938
- let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
41939
- let attempt = 0;
41940
- while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
41941
- const encodedTransactions = transactionsToProcess.map(
41942
- (index) => serializedTransactionsMap.get(index)
41943
- );
41944
- const dryRunResults = await this.operations.dryRun({
41945
- encodedTransactions,
41946
- utxoValidation: false
41947
- });
41948
- const nextRoundTransactions = [];
41949
- for (let i = 0; i < dryRunResults.dryRun.length; i++) {
41950
- const currentResultIndex = transactionsToProcess[i];
41951
- const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
41952
- results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
41953
- results[currentResultIndex].dryrunStatus = status;
41954
- const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
41955
- results[currentResultIndex].receipts
41956
- );
41957
- const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
41958
- const requestToProcess = allRequests[currentResultIndex];
41959
- if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
41960
- results[currentResultIndex].outputVariables += missingOutputVariables.length;
41961
- requestToProcess.addVariableOutputs(missingOutputVariables.length);
41962
- missingOutputContractIds.forEach(({ contractId }) => {
41963
- requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
41964
- results[currentResultIndex].missingContractIds.push(contractId);
41965
- });
41966
- const { maxFee } = await this.estimateTxGasAndFee({
41967
- transactionRequest: requestToProcess,
41968
- optimizeGas: false
41969
- });
41970
- requestToProcess.maxFee = maxFee;
41971
- serializedTransactionsMap.set(
41972
- currentResultIndex,
41973
- hexlify(requestToProcess.toTransactionBytes())
41974
- );
41975
- nextRoundTransactions.push(currentResultIndex);
41976
- allRequests[currentResultIndex] = requestToProcess;
41977
- }
41978
- }
41979
- transactionsToProcess = nextRoundTransactions;
41980
- attempt += 1;
41981
- }
41982
- return results;
41983
- }
41984
- async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
41985
- if (estimateTxDependencies) {
41986
- return this.estimateMultipleTxDependencies(transactionRequests);
41987
- }
41988
- const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
41989
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41990
- encodedTransactions,
41991
- utxoValidation: utxoValidation || false
41992
- });
41993
- const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
41994
- const receipts = rawReceipts.map(processGqlReceipt);
41995
- return { receipts, dryrunStatus: status };
41996
- });
41997
- return results;
41998
- }
41999
- async estimateTxGasAndFee(params) {
42000
- const { transactionRequest, optimizeGas = true } = params;
42001
- let { gasPrice } = params;
42002
- const chainInfo = this.getChain();
42003
- const { gasPriceFactor } = this.getGasConfig();
42004
- const minGas = transactionRequest.calculateMinGas(chainInfo);
42005
- if (!gasPrice) {
42006
- gasPrice = await this.estimateGasPrice(10);
42007
- }
42008
- const minFee = calculateGasFee({
42009
- gasPrice: bn(gasPrice),
42010
- gas: minGas,
42011
- priceFactor: gasPriceFactor,
42012
- tip: transactionRequest.tip
42013
- }).add(1);
42014
- let gasLimit = bn(0);
42015
- if (transactionRequest.type === TransactionType.Script) {
42016
- gasLimit = transactionRequest.gasLimit;
42017
- if (!optimizeGas) {
42018
- transactionRequest.gasLimit = minGas;
42019
- gasLimit = transactionRequest.calculateMaxGas(chainInfo, minGas);
42020
- transactionRequest.gasLimit = gasLimit;
42021
- }
42022
- }
42023
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
42024
- const maxFee = calculateGasFee({
42025
- gasPrice: bn(gasPrice),
42026
- gas: maxGas,
42027
- priceFactor: gasPriceFactor,
42028
- tip: transactionRequest.tip
42029
- }).add(1);
42030
- return {
42031
- minGas,
42032
- minFee,
42033
- maxGas,
42034
- maxFee,
42035
- gasPrice,
42036
- gasLimit
41809
+ missingContractIds
42037
41810
  };
42038
41811
  }
42039
41812
  /**
@@ -42051,17 +41824,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42051
41824
  if (estimateTxDependencies) {
42052
41825
  return this.estimateTxDependencies(transactionRequest);
42053
41826
  }
42054
- const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
42055
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42056
- encodedTransactions,
41827
+ const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41828
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41829
+ encodedTransaction,
42057
41830
  utxoValidation: true
42058
41831
  });
42059
- const callResult = dryRunStatuses.map((dryRunStatus) => {
42060
- const { id, receipts, status } = dryRunStatus;
42061
- const processedReceipts = receipts.map(processGqlReceipt);
42062
- return { id, receipts: processedReceipts, status };
42063
- });
42064
- return { receipts: callResult[0].receipts };
41832
+ const receipts = gqlReceipts.map(processGqlReceipt);
41833
+ return {
41834
+ receipts
41835
+ };
42065
41836
  }
42066
41837
  /**
42067
41838
  * Returns a transaction cost to enable user
@@ -42078,80 +41849,80 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42078
41849
  * @param tolerance - The tolerance to add on top of the gasUsed.
42079
41850
  * @returns A promise that resolves to the transaction cost object.
42080
41851
  */
42081
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
41852
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
41853
+ estimateTxDependencies = true,
41854
+ estimatePredicates = true,
41855
+ resourcesOwner,
41856
+ signatureCallback
41857
+ } = {}) {
42082
41858
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
41859
+ const chainInfo = this.getChain();
41860
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
41861
+ const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
42083
41862
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
42084
41863
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
42085
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
41864
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
42086
41865
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
42087
- txRequestClone.maxFee = bn(0);
42088
- if (isScriptTransaction) {
42089
- txRequestClone.gasLimit = bn(0);
42090
- }
42091
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
42092
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
41866
+ if (estimatePredicates) {
41867
+ if (isScriptTransaction) {
41868
+ txRequestClone.gasLimit = bn(0);
41869
+ }
41870
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
41871
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
41872
+ }
41873
+ await this.estimatePredicates(txRequestClone);
42093
41874
  }
42094
- const signedRequest = clone_default(txRequestClone);
42095
- let addedSignatures = 0;
42096
41875
  if (signatureCallback && isScriptTransaction) {
42097
- const lengthBefore = signedRequest.witnesses.length;
42098
- await signatureCallback(signedRequest);
42099
- addedSignatures = signedRequest.witnesses.length - lengthBefore;
42100
- }
42101
- await this.estimatePredicates(signedRequest);
42102
- let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
42103
- transactionRequest: signedRequest,
42104
- optimizeGas: false
42105
- });
42106
- txRequestClone.maxFee = maxFee;
41876
+ await signatureCallback(txRequestClone);
41877
+ }
41878
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
41879
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
42107
41880
  let receipts = [];
42108
41881
  let missingContractIds = [];
42109
41882
  let outputVariables = 0;
42110
- let gasUsed = bn(0);
42111
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
42112
- if (isScriptTransaction) {
42113
- if (signatureCallback) {
42114
- await signatureCallback(txRequestClone);
42115
- }
42116
- txRequestClone.gasLimit = gasLimit;
41883
+ if (isScriptTransaction && estimateTxDependencies) {
41884
+ txRequestClone.gasPrice = bn(0);
41885
+ txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
42117
41886
  const result = await this.estimateTxDependencies(txRequestClone);
42118
41887
  receipts = result.receipts;
42119
41888
  outputVariables = result.outputVariables;
42120
41889
  missingContractIds = result.missingContractIds;
42121
- gasUsed = getGasUsedFromReceipts(receipts);
42122
- txRequestClone.gasLimit = gasUsed;
42123
- ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
42124
- transactionRequest: txRequestClone,
42125
- gasPrice
42126
- }));
42127
41890
  }
41891
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
41892
+ const usedFee = calculatePriceWithFactor(
41893
+ gasUsed,
41894
+ gasPrice,
41895
+ gasPriceFactor
41896
+ ).normalizeZeroToOne();
41897
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
41898
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42128
41899
  return {
42129
41900
  requiredQuantities: allQuantities,
42130
41901
  receipts,
42131
41902
  gasUsed,
41903
+ minGasPrice,
42132
41904
  gasPrice,
42133
41905
  minGas,
42134
41906
  maxGas,
41907
+ usedFee,
42135
41908
  minFee,
42136
41909
  maxFee,
41910
+ estimatedInputs: txRequestClone.inputs,
42137
41911
  outputVariables,
42138
- missingContractIds,
42139
- addedSignatures,
42140
- estimatedPredicates: txRequestClone.inputs
41912
+ missingContractIds
42141
41913
  };
42142
41914
  }
42143
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
41915
+ async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
42144
41916
  const ownerAddress = Address.fromAddressOrString(owner);
42145
41917
  const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
42146
- const transactionCost = await this.getTransactionCost(transactionRequest, {
42147
- quantitiesToContract
42148
- });
41918
+ const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
42149
41919
  transactionRequest.addResources(
42150
41920
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
42151
41921
  );
42152
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
42153
- quantitiesToContract
42154
- });
41922
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(
41923
+ transactionRequest,
41924
+ forwardingQuantities
41925
+ );
42155
41926
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
42156
41927
  return {
42157
41928
  resources,
@@ -42175,6 +41946,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42175
41946
  assetId: coin.assetId,
42176
41947
  amount: bn(coin.amount),
42177
41948
  owner: Address.fromAddressOrString(coin.owner),
41949
+ maturity: bn(coin.maturity).toNumber(),
42178
41950
  blockCreated: bn(coin.blockCreated),
42179
41951
  txCreatedIdx: bn(coin.txCreatedIdx)
42180
41952
  }));
@@ -42226,6 +41998,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42226
41998
  amount: bn(coin.amount),
42227
41999
  assetId: coin.assetId,
42228
42000
  owner: Address.fromAddressOrString(coin.owner),
42001
+ maturity: bn(coin.maturity).toNumber(),
42229
42002
  blockCreated: bn(coin.blockCreated),
42230
42003
  txCreatedIdx: bn(coin.txCreatedIdx)
42231
42004
  };
@@ -42258,7 +42031,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42258
42031
  }
42259
42032
  return {
42260
42033
  id: block2.id,
42261
- height: bn(block2.height),
42034
+ height: bn(block2.header.height),
42262
42035
  time: block2.header.time,
42263
42036
  transactionIds: block2.transactions.map((tx) => tx.id)
42264
42037
  };
@@ -42273,7 +42046,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42273
42046
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
42274
42047
  const blocks = fetchedData.edges.map(({ node: block2 }) => ({
42275
42048
  id: block2.id,
42276
- height: bn(block2.height),
42049
+ height: bn(block2.header.height),
42277
42050
  time: block2.header.time,
42278
42051
  transactionIds: block2.transactions.map((tx) => tx.id)
42279
42052
  }));
@@ -42300,7 +42073,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42300
42073
  }
42301
42074
  return {
42302
42075
  id: block2.id,
42303
- height: bn(block2.height, 10),
42076
+ height: bn(block2.header.height, 10),
42304
42077
  time: block2.header.time,
42305
42078
  transactionIds: block2.transactions.map((tx) => tx.id),
42306
42079
  transactions: block2.transactions.map(
@@ -42480,6 +42253,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42480
42253
  prevRoot: messageBlockHeader.prevRoot,
42481
42254
  time: messageBlockHeader.time,
42482
42255
  applicationHash: messageBlockHeader.applicationHash,
42256
+ messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
42483
42257
  messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
42484
42258
  },
42485
42259
  commitBlockHeader: {
@@ -42491,6 +42265,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42491
42265
  prevRoot: commitBlockHeader.prevRoot,
42492
42266
  time: commitBlockHeader.time,
42493
42267
  applicationHash: commitBlockHeader.applicationHash,
42268
+ messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
42494
42269
  messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
42495
42270
  },
42496
42271
  sender: Address.fromAddressOrString(sender),
@@ -42500,16 +42275,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42500
42275
  data
42501
42276
  };
42502
42277
  }
42503
- async getLatestGasPrice() {
42504
- const { latestGasPrice } = await this.operations.getLatestGasPrice();
42505
- return bn(latestGasPrice.gasPrice);
42506
- }
42507
- async estimateGasPrice(blockHorizon) {
42508
- const { estimateGasPrice } = await this.operations.estimateGasPrice({
42509
- blockHorizon: String(blockHorizon)
42510
- });
42511
- return bn(estimateGasPrice.gasPrice);
42512
- }
42513
42278
  /**
42514
42279
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
42515
42280
  *
@@ -42570,15 +42335,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42570
42335
  arrayify(gqlTransaction.rawPayload),
42571
42336
  0
42572
42337
  );
42573
- let txReceipts = [];
42574
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42575
- txReceipts = gqlTransaction.status.receipts;
42576
- }
42577
- const receipts = txReceipts.map(processGqlReceipt);
42338
+ const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
42578
42339
  const {
42579
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42340
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42580
42341
  } = provider.getChain();
42581
- const gasPrice = await provider.getLatestGasPrice();
42582
42342
  const transactionInfo = assembleTransactionSummary({
42583
42343
  id: gqlTransaction.id,
42584
42344
  receipts,
@@ -42589,9 +42349,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42589
42349
  gasPriceFactor: bn(gasPriceFactor),
42590
42350
  abiMap,
42591
42351
  maxInputs,
42592
- gasCosts,
42593
- maxGasPerTx,
42594
- gasPrice
42352
+ gasCosts
42595
42353
  });
42596
42354
  return {
42597
42355
  gqlTransaction,
@@ -42601,11 +42359,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42601
42359
  async function getTransactionSummaryFromRequest(params) {
42602
42360
  const { provider, transactionRequest, abiMap } = params;
42603
42361
  const { receipts } = await provider.call(transactionRequest);
42604
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
42362
+ const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
42605
42363
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
42606
42364
  const transaction = transactionRequest.toTransaction();
42607
42365
  const transactionBytes = transactionRequest.toTransactionBytes();
42608
- const gasPrice = await provider.getLatestGasPrice();
42609
42366
  const transactionSummary = assembleTransactionSummary({
42610
42367
  receipts,
42611
42368
  transaction,
@@ -42614,9 +42371,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42614
42371
  gasPerByte,
42615
42372
  gasPriceFactor,
42616
42373
  maxInputs,
42617
- gasCosts,
42618
- maxGasPerTx,
42619
- gasPrice
42374
+ gasCosts
42620
42375
  });
42621
42376
  return transactionSummary;
42622
42377
  }
@@ -42625,18 +42380,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42625
42380
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
42626
42381
  const { edges, pageInfo } = transactionsByOwner;
42627
42382
  const {
42628
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42383
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42629
42384
  } = provider.getChain();
42630
- const gasPrice = await provider.getLatestGasPrice();
42631
42385
  const transactions = edges.map((edge) => {
42632
42386
  const { node: gqlTransaction } = edge;
42633
- const { id, rawPayload, status } = gqlTransaction;
42387
+ const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
42634
42388
  const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
42635
- let txReceipts = [];
42636
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42637
- txReceipts = gqlTransaction.status.receipts;
42638
- }
42639
- const receipts = txReceipts.map(processGqlReceipt);
42389
+ const receipts = gqlReceipts?.map(processGqlReceipt) || [];
42640
42390
  const transactionSummary = assembleTransactionSummary({
42641
42391
  id,
42642
42392
  receipts,
@@ -42647,9 +42397,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42647
42397
  gasPerByte,
42648
42398
  gasPriceFactor,
42649
42399
  maxInputs,
42650
- gasCosts,
42651
- maxGasPerTx,
42652
- gasPrice
42400
+ gasCosts
42653
42401
  });
42654
42402
  const output3 = {
42655
42403
  gqlTransaction,
@@ -42940,8 +42688,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42940
42688
  * @param assetId - The asset ID to check the balance for.
42941
42689
  * @returns A promise that resolves to the balance amount.
42942
42690
  */
42943
- async getBalance(assetId = BaseAssetId) {
42944
- const amount = await this.provider.getBalance(this.address, assetId);
42691
+ async getBalance(assetId) {
42692
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
42693
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
42945
42694
  return amount;
42946
42695
  }
42947
42696
  /**
@@ -42978,33 +42727,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42978
42727
  * @param fee - The estimated transaction fee.
42979
42728
  * @returns A promise that resolves when the resources are added to the transaction.
42980
42729
  */
42981
- async fund(request, params) {
42982
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
42983
- const txRequest = request;
42984
- const requiredQuantitiesWithFee = addAmountToCoinQuantities({
42730
+ async fund(request, coinQuantities, fee) {
42731
+ const baseAssetId = this.provider.getBaseAssetId();
42732
+ const updatedQuantities = addAmountToAsset({
42985
42733
  amount: bn(fee),
42986
- assetId: BaseAssetId,
42987
- coinQuantities: requiredQuantities
42734
+ assetId: baseAssetId,
42735
+ coinQuantities
42988
42736
  });
42989
42737
  const quantitiesDict = {};
42990
- requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
42738
+ updatedQuantities.forEach(({ amount, assetId }) => {
42991
42739
  quantitiesDict[assetId] = {
42992
42740
  required: amount,
42993
42741
  owned: bn(0)
42994
42742
  };
42995
42743
  });
42996
- txRequest.inputs.forEach((input) => {
42744
+ const cachedUtxos = [];
42745
+ const cachedMessages = [];
42746
+ const owner = this.address.toB256();
42747
+ request.inputs.forEach((input) => {
42997
42748
  const isResource = "amount" in input;
42998
42749
  if (isResource) {
42999
42750
  const isCoin2 = "owner" in input;
43000
42751
  if (isCoin2) {
43001
42752
  const assetId = String(input.assetId);
43002
- if (quantitiesDict[assetId]) {
42753
+ if (input.owner === owner && quantitiesDict[assetId]) {
43003
42754
  const amount = bn(input.amount);
43004
42755
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42756
+ cachedUtxos.push(input.id);
43005
42757
  }
43006
- } else if (input.amount && quantitiesDict[BaseAssetId]) {
43007
- quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42758
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
42759
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
42760
+ cachedMessages.push(input.nonce);
43008
42761
  }
43009
42762
  }
43010
42763
  });
@@ -43019,23 +42772,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43019
42772
  });
43020
42773
  const needsToBeFunded = missingQuantities.length;
43021
42774
  if (needsToBeFunded) {
43022
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
43023
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
43024
- txRequest.addResources(resources);
43025
- }
43026
- txRequest.shiftPredicateData();
43027
- txRequest.updatePredicateGasUsed(estimatedPredicates);
43028
- const requestToBeReEstimate = clone_default(txRequest);
43029
- if (addedSignatures) {
43030
- Array.from({ length: addedSignatures }).forEach(
43031
- () => requestToBeReEstimate.addEmptyWitness()
43032
- );
42775
+ const resources = await this.getResourcesToSpend(missingQuantities, {
42776
+ messages: cachedMessages,
42777
+ utxos: cachedUtxos
42778
+ });
42779
+ request.addResources(resources);
43033
42780
  }
43034
- const { maxFee } = await this.provider.estimateTxGasAndFee({
43035
- transactionRequest: requestToBeReEstimate
43036
- });
43037
- txRequest.maxFee = maxFee;
43038
- return txRequest;
43039
42781
  }
43040
42782
  /**
43041
42783
  * A helper that creates a transfer transaction request and returns it.
@@ -43043,25 +42785,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43043
42785
  * @param destination - The address of the destination.
43044
42786
  * @param amount - The amount of coins to transfer.
43045
42787
  * @param assetId - The asset ID of the coins to transfer.
43046
- * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
42788
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43047
42789
  * @returns A promise that resolves to the prepared transaction request.
43048
42790
  */
43049
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
43050
- const request = new ScriptTransactionRequest(txParams);
43051
- request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
43052
- const txCost = await this.provider.getTransactionCost(request, {
42791
+ async createTransfer(destination, amount, assetId, txParams = {}) {
42792
+ const { minGasPrice } = this.provider.getGasConfig();
42793
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42794
+ const params = { gasPrice: minGasPrice, ...txParams };
42795
+ const request = new ScriptTransactionRequest(params);
42796
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
42797
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
43053
42798
  estimateTxDependencies: true,
43054
42799
  resourcesOwner: this
43055
42800
  });
43056
- if ("gasLimit" in txParams) {
43057
- this.validateGas({
43058
- gasUsed: txCost.gasUsed,
43059
- gasLimit: request.gasLimit
43060
- });
43061
- }
43062
- request.gasLimit = txCost.gasUsed;
43063
- request.maxFee = txCost.maxFee;
43064
- await this.fund(request, txCost);
42801
+ request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
42802
+ request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
42803
+ this.validateGas({
42804
+ gasUsed,
42805
+ gasPrice: request.gasPrice,
42806
+ gasLimit: request.gasLimit,
42807
+ minGasPrice
42808
+ });
42809
+ await this.fund(request, requiredQuantities, maxFee);
42810
+ request.updatePredicateInputs(estimatedInputs);
43065
42811
  return request;
43066
42812
  }
43067
42813
  /**
@@ -43073,14 +42819,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43073
42819
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43074
42820
  * @returns A promise that resolves to the transaction response.
43075
42821
  */
43076
- async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
42822
+ async transfer(destination, amount, assetId, txParams = {}) {
43077
42823
  if (bn(amount).lte(0)) {
43078
42824
  throw new FuelError(
43079
42825
  ErrorCode.INVALID_TRANSFER_AMOUNT,
43080
42826
  "Transfer amount must be a positive number."
43081
42827
  );
43082
42828
  }
43083
- const request = await this.createTransfer(destination, amount, assetId, txParams);
42829
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42830
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
43084
42831
  return this.sendTransaction(request, { estimateTxDependencies: false });
43085
42832
  }
43086
42833
  /**
@@ -43092,7 +42839,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43092
42839
  * @param txParams - The optional transaction parameters.
43093
42840
  * @returns A promise that resolves to the transaction response.
43094
42841
  */
43095
- async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
42842
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
43096
42843
  if (bn(amount).lte(0)) {
43097
42844
  throw new FuelError(
43098
42845
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -43100,30 +42847,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43100
42847
  );
43101
42848
  }
43102
42849
  const contractAddress = Address.fromAddressOrString(contractId);
42850
+ const { minGasPrice } = this.provider.getGasConfig();
42851
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42852
+ const params = { gasPrice: minGasPrice, ...txParams };
43103
42853
  const { script, scriptData } = await assembleTransferToContractScript({
43104
42854
  hexlifiedContractId: contractAddress.toB256(),
43105
42855
  amountToTransfer: bn(amount),
43106
- assetId
42856
+ assetId: assetIdToTransfer
43107
42857
  });
43108
42858
  const request = new ScriptTransactionRequest({
43109
- ...txParams,
42859
+ ...params,
43110
42860
  script,
43111
42861
  scriptData
43112
42862
  });
43113
42863
  request.addContractInputAndOutput(contractAddress);
43114
- const txCost = await this.provider.getTransactionCost(request, {
43115
- resourcesOwner: this,
43116
- quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
42864
+ const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
42865
+ request,
42866
+ [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
42867
+ );
42868
+ request.gasLimit = bn(params.gasLimit ?? gasUsed);
42869
+ this.validateGas({
42870
+ gasUsed,
42871
+ gasPrice: request.gasPrice,
42872
+ gasLimit: request.gasLimit,
42873
+ minGasPrice
43117
42874
  });
43118
- if (txParams.gasLimit) {
43119
- this.validateGas({
43120
- gasUsed: txCost.gasUsed,
43121
- gasLimit: request.gasLimit
43122
- });
43123
- }
43124
- request.gasLimit = txCost.gasUsed;
43125
- request.maxFee = txCost.maxFee;
43126
- await this.fund(request, txCost);
42875
+ await this.fund(request, requiredQuantities, maxFee);
43127
42876
  return this.sendTransaction(request);
43128
42877
  }
43129
42878
  /**
@@ -43135,6 +42884,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43135
42884
  * @returns A promise that resolves to the transaction response.
43136
42885
  */
43137
42886
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42887
+ const { minGasPrice } = this.provider.getGasConfig();
42888
+ const baseAssetId = this.provider.getBaseAssetId();
43138
42889
  const recipientAddress = Address.fromAddressOrString(recipient);
43139
42890
  const recipientDataArray = arrayify(
43140
42891
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -43147,19 +42898,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43147
42898
  ...recipientDataArray,
43148
42899
  ...amountDataArray
43149
42900
  ]);
43150
- const params = { script, ...txParams };
42901
+ const params = { script, gasPrice: minGasPrice, ...txParams };
43151
42902
  const request = new ScriptTransactionRequest(params);
43152
- const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
43153
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
43154
- if (txParams.gasLimit) {
43155
- this.validateGas({
43156
- gasUsed: txCost.gasUsed,
43157
- gasLimit: request.gasLimit
43158
- });
43159
- }
43160
- request.maxFee = txCost.maxFee;
43161
- request.gasLimit = txCost.gasUsed;
43162
- await this.fund(request, txCost);
42903
+ const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
42904
+ const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
42905
+ request,
42906
+ forwardingQuantities
42907
+ );
42908
+ request.gasLimit = bn(params.gasLimit ?? gasUsed);
42909
+ this.validateGas({
42910
+ gasUsed,
42911
+ gasPrice: request.gasPrice,
42912
+ gasLimit: request.gasLimit,
42913
+ minGasPrice
42914
+ });
42915
+ await this.fund(request, requiredQuantities, maxFee);
43163
42916
  return this.sendTransaction(request);
43164
42917
  }
43165
42918
  async signMessage(message) {
@@ -43217,7 +42970,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43217
42970
  }
43218
42971
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
43219
42972
  }
43220
- validateGas({ gasUsed, gasLimit }) {
42973
+ validateGas({
42974
+ gasUsed,
42975
+ gasPrice,
42976
+ gasLimit,
42977
+ minGasPrice
42978
+ }) {
42979
+ if (minGasPrice.gt(gasPrice)) {
42980
+ throw new FuelError(
42981
+ ErrorCode.GAS_PRICE_TOO_LOW,
42982
+ `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
42983
+ );
42984
+ }
43221
42985
  if (gasUsed.gt(gasLimit)) {
43222
42986
  throw new FuelError(
43223
42987
  ErrorCode.GAS_LIMIT_TOO_LOW,
@@ -44600,12 +44364,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44600
44364
  };
44601
44365
 
44602
44366
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
44603
- var import_crypto16 = __toESM(__require("crypto"));
44367
+ var import_crypto15 = __toESM(__require("crypto"));
44604
44368
  var rnds8Pool = new Uint8Array(256);
44605
44369
  var poolPtr = rnds8Pool.length;
44606
44370
  function rng() {
44607
44371
  if (poolPtr > rnds8Pool.length - 16) {
44608
- import_crypto16.default.randomFillSync(rnds8Pool);
44372
+ import_crypto15.default.randomFillSync(rnds8Pool);
44609
44373
  poolPtr = 0;
44610
44374
  }
44611
44375
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -44621,9 +44385,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44621
44385
  }
44622
44386
 
44623
44387
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
44624
- var import_crypto17 = __toESM(__require("crypto"));
44388
+ var import_crypto16 = __toESM(__require("crypto"));
44625
44389
  var native_default = {
44626
- randomUUID: import_crypto17.default.randomUUID
44390
+ randomUUID: import_crypto16.default.randomUUID
44627
44391
  };
44628
44392
 
44629
44393
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
@@ -44806,7 +44570,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44806
44570
  * @param transactionRequestLike - The transaction request to send.
44807
44571
  * @returns A promise that resolves to the TransactionResponse object.
44808
44572
  */
44809
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
44573
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
44810
44574
  const transactionRequest = transactionRequestify(transactionRequestLike);
44811
44575
  if (estimateTxDependencies) {
44812
44576
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -48042,7 +47806,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48042
47806
  // src/predicate/predicate.ts
48043
47807
  var Predicate = class extends Account {
48044
47808
  bytes;
48045
- predicateDataBytes = Uint8Array.from([]);
48046
47809
  predicateData = [];
48047
47810
  interface;
48048
47811
  /**
@@ -48072,7 +47835,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48072
47835
  this.interface = predicateInterface;
48073
47836
  if (inputData !== void 0 && inputData.length > 0) {
48074
47837
  this.predicateData = inputData;
48075
- this.predicateDataBytes = this.getPredicateData(0);
48076
47838
  }
48077
47839
  }
48078
47840
  /**
@@ -48086,8 +47848,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48086
47848
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
48087
47849
  request.inputs?.forEach((input) => {
48088
47850
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
48089
- input.predicate = hexlify(this.bytes);
48090
- input.predicateData = hexlify(this.getPredicateData(policies.length));
47851
+ input.predicate = this.bytes;
47852
+ input.predicateData = this.getPredicateData(policies.length);
48091
47853
  }
48092
47854
  });
48093
47855
  return request;
@@ -48101,8 +47863,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48101
47863
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
48102
47864
  * @returns A promise that resolves to the prepared transaction request.
48103
47865
  */
48104
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
48105
- return super.createTransfer(destination, amount, assetId, txParams);
47866
+ async createTransfer(destination, amount, assetId, txParams = {}) {
47867
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
47868
+ const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
47869
+ return this.populateTransactionPredicateData(request);
48106
47870
  }
48107
47871
  /**
48108
47872
  * Sends a transaction with the populated predicate data.
@@ -48110,9 +47874,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48110
47874
  * @param transactionRequestLike - The transaction request-like object.
48111
47875
  * @returns A promise that resolves to the transaction response.
48112
47876
  */
48113
- sendTransaction(transactionRequestLike) {
48114
- const transactionRequest = transactionRequestify(transactionRequestLike);
48115
- return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
47877
+ sendTransaction(transactionRequestLike, options) {
47878
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47879
+ return super.sendTransaction(transactionRequest, options);
48116
47880
  }
48117
47881
  /**
48118
47882
  * Simulates a transaction with the populated predicate data.
@@ -48121,8 +47885,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48121
47885
  * @returns A promise that resolves to the call result.
48122
47886
  */
48123
47887
  simulateTransaction(transactionRequestLike) {
48124
- const transactionRequest = transactionRequestify(transactionRequestLike);
48125
- return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
47888
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47889
+ return super.simulateTransaction(transactionRequest);
48126
47890
  }
48127
47891
  getPredicateData(policiesLength) {
48128
47892
  if (!this.predicateData.length) {
@@ -48168,26 +47932,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48168
47932
  predicateInterface: abiInterface
48169
47933
  };
48170
47934
  }
48171
- /**
48172
- * Retrieves resources satisfying the spend query for the account.
48173
- *
48174
- * @param quantities - IDs of coins to exclude.
48175
- * @param excludedIds - IDs of resources to be excluded from the query.
48176
- * @returns A promise that resolves to an array of Resources.
48177
- */
48178
- async getResourcesToSpend(quantities, excludedIds) {
48179
- const resources = await this.provider.getResourcesToSpend(
48180
- this.address,
48181
- quantities,
48182
- excludedIds
48183
- );
48184
- return resources.map((resource) => ({
48185
- ...resource,
48186
- predicate: hexlify(this.bytes),
48187
- predicateData: hexlify(this.predicateDataBytes),
48188
- paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
48189
- }));
48190
- }
48191
47935
  /**
48192
47936
  * Sets the configurable constants for the predicate.
48193
47937
  *