@fuel-ts/account 0.0.0-rc-1976-20240408114146 → 0.0.0-rc-2021-20240409111335

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 +5 -4
  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 +872 -620
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +848 -610
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +690 -453
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +10 -2
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +888 -322
  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 +4 -2
  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 +3 -1
  27. package/dist/providers/message.d.ts.map +1 -1
  28. package/dist/providers/provider.d.ts +45 -34
  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 +9 -29
  35. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/utils.d.ts +3 -0
  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 +2 -0
  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 +3 -2
  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 +8 -2
  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 +1587 -1121
  48. package/dist/test-utils.global.js.map +1 -1
  49. package/dist/test-utils.js +824 -607
  50. package/dist/test-utils.js.map +1 -1
  51. package/dist/test-utils.mjs +682 -465
  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 max2(left, right) {
292
+ BN2.max = function max(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 clone(instance) {
5116
+ function clone3(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(clone(this), {
6050
+ return new Response2(clone3(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 ? clone(input) : null;
6100
+ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone3(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.49.3",
28956
- FUEL_CORE: "0.22.1",
28955
+ FORC: "0.51.1",
28956
+ FUEL_CORE: "0.24.2",
28957
28957
  FUELS: "0.79.0"
28958
28958
  };
28959
28959
  }
@@ -29244,7 +29244,7 @@ This unreleased fuel-core build may include features and updates not yet support
29244
29244
  __publicField3(DateTime, "TAI64_NULL", "");
29245
29245
 
29246
29246
  // ../crypto/dist/index.mjs
29247
- var import_crypto8 = __toESM(__require("crypto"), 1);
29247
+ var import_crypto9 = __toESM(__require("crypto"), 1);
29248
29248
 
29249
29249
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
29250
29250
  var version = "6.7.1";
@@ -30316,6 +30316,27 @@ This unreleased fuel-core build may include features and updates not yet support
30316
30316
  };
30317
30317
  Object.freeze(pbkdf22);
30318
30318
 
30319
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/random.js
30320
+ var locked5 = false;
30321
+ var _randomBytes = function(length) {
30322
+ return new Uint8Array((0, import_crypto2.randomBytes)(length));
30323
+ };
30324
+ var __randomBytes = _randomBytes;
30325
+ function randomBytes3(length) {
30326
+ return __randomBytes(length);
30327
+ }
30328
+ randomBytes3._ = _randomBytes;
30329
+ randomBytes3.lock = function() {
30330
+ locked5 = true;
30331
+ };
30332
+ randomBytes3.register = function(func) {
30333
+ if (locked5) {
30334
+ throw new Error("randomBytes is locked");
30335
+ }
30336
+ __randomBytes = func;
30337
+ };
30338
+ Object.freeze(randomBytes3);
30339
+
30319
30340
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
30320
30341
  var BN_03 = BigInt(0);
30321
30342
  var BN_36 = BigInt(36);
@@ -30900,8 +30921,8 @@ This unreleased fuel-core build may include features and updates not yet support
30900
30921
  }
30901
30922
 
30902
30923
  // ../crypto/dist/index.mjs
30903
- var import_crypto9 = __toESM(__require("crypto"), 1);
30904
30924
  var import_crypto10 = __toESM(__require("crypto"), 1);
30925
+ var import_crypto11 = __toESM(__require("crypto"), 1);
30905
30926
  var scrypt3 = (params) => {
30906
30927
  const { password, salt, n, p, r, dklen } = params;
30907
30928
  const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
@@ -30910,7 +30931,7 @@ This unreleased fuel-core build may include features and updates not yet support
30910
30931
  var keccak2562 = (data) => keccak_256(data);
30911
30932
  var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
30912
30933
  var randomBytes4 = (length) => {
30913
- const randomValues = Uint8Array.from(import_crypto9.default.randomBytes(length));
30934
+ const randomValues = Uint8Array.from(import_crypto10.default.randomBytes(length));
30914
30935
  return randomValues;
30915
30936
  };
30916
30937
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -30925,7 +30946,7 @@ This unreleased fuel-core build may include features and updates not yet support
30925
30946
  const salt = randomBytes4(32);
30926
30947
  const secret = keyFromPassword(password, salt);
30927
30948
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
30928
- const cipher = await import_crypto8.default.createCipheriv(ALGORITHM, secret, iv);
30949
+ const cipher = await import_crypto9.default.createCipheriv(ALGORITHM, secret, iv);
30929
30950
  let cipherData = cipher.update(dataBuffer);
30930
30951
  cipherData = Buffer.concat([cipherData, cipher.final()]);
30931
30952
  return {
@@ -30939,7 +30960,7 @@ This unreleased fuel-core build may include features and updates not yet support
30939
30960
  const salt = bufferFromString(keystore.salt);
30940
30961
  const secret = keyFromPassword(password, salt);
30941
30962
  const encryptedText = bufferFromString(keystore.data);
30942
- const decipher = await import_crypto8.default.createDecipheriv(ALGORITHM, secret, iv);
30963
+ const decipher = await import_crypto9.default.createDecipheriv(ALGORITHM, secret, iv);
30943
30964
  const decrypted = decipher.update(encryptedText);
30944
30965
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
30945
30966
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -30950,12 +30971,12 @@ This unreleased fuel-core build may include features and updates not yet support
30950
30971
  }
30951
30972
  };
30952
30973
  async function encryptJsonWalletData(data, key, iv) {
30953
- const cipher = await import_crypto10.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30974
+ const cipher = await import_crypto11.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30954
30975
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
30955
30976
  return new Uint8Array(encrypted);
30956
30977
  }
30957
30978
  async function decryptJsonWalletData(data, key, iv) {
30958
- const decipher = import_crypto10.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30979
+ const decipher = import_crypto11.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30959
30980
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
30960
30981
  return new Uint8Array(decrypted);
30961
30982
  }
@@ -31271,11 +31292,15 @@ This unreleased fuel-core build may include features and updates not yet support
31271
31292
  }
31272
31293
  };
31273
31294
 
31295
+ // ../address/dist/configs.mjs
31296
+ var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
31297
+ var BaseAssetId = ZeroBytes32;
31298
+
31274
31299
  // ../math/dist/index.mjs
31275
31300
  var import_bn = __toESM(require_bn(), 1);
31276
31301
  var DEFAULT_PRECISION = 9;
31277
31302
  var DEFAULT_MIN_PRECISION = 3;
31278
- var DECIMAL_UNITS = 9;
31303
+ var DEFAULT_DECIMAL_UNITS = 9;
31279
31304
  function toFixed(value, options) {
31280
31305
  const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
31281
31306
  const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
@@ -31341,7 +31366,7 @@ This unreleased fuel-core build may include features and updates not yet support
31341
31366
  }
31342
31367
  format(options) {
31343
31368
  const {
31344
- units = DECIMAL_UNITS,
31369
+ units = DEFAULT_DECIMAL_UNITS,
31345
31370
  precision = DEFAULT_PRECISION,
31346
31371
  minPrecision = DEFAULT_MIN_PRECISION
31347
31372
  } = options || {};
@@ -31357,7 +31382,7 @@ This unreleased fuel-core build may include features and updates not yet support
31357
31382
  }
31358
31383
  return formattedFixed;
31359
31384
  }
31360
- formatUnits(units = DECIMAL_UNITS) {
31385
+ formatUnits(units = DEFAULT_DECIMAL_UNITS) {
31361
31386
  const valueUnits = this.toString().slice(0, units * -1);
31362
31387
  const valueDecimals = this.toString().slice(units * -1);
31363
31388
  const length = valueDecimals.length;
@@ -31466,7 +31491,7 @@ This unreleased fuel-core build may include features and updates not yet support
31466
31491
  // END ANCHOR: OVERRIDES to avoid losing references
31467
31492
  };
31468
31493
  var bn = (value, base, endian) => new BN(value, base, endian);
31469
- bn.parseUnits = (value, units = DECIMAL_UNITS) => {
31494
+ bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
31470
31495
  const valueToParse = value === "." ? "0." : value;
31471
31496
  const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
31472
31497
  const length = valueDecimals.length;
@@ -31490,32 +31515,182 @@ This unreleased fuel-core build may include features and updates not yet support
31490
31515
  function toBytes3(value, bytesPadding) {
31491
31516
  return bn(value).toBytes(bytesPadding);
31492
31517
  }
31493
- function max(...numbers) {
31494
- return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
31518
+
31519
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
31520
+ function _isPlaceholder(a) {
31521
+ return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
31522
+ }
31523
+
31524
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
31525
+ function _curry1(fn) {
31526
+ return function f1(a) {
31527
+ if (arguments.length === 0 || _isPlaceholder(a)) {
31528
+ return f1;
31529
+ } else {
31530
+ return fn.apply(this, arguments);
31531
+ }
31532
+ };
31533
+ }
31534
+
31535
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
31536
+ var isArray_default = Array.isArray || function _isArray(val) {
31537
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
31538
+ };
31539
+
31540
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
31541
+ var type = /* @__PURE__ */ _curry1(function type2(val) {
31542
+ return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
31543
+ });
31544
+ var type_default = type;
31545
+
31546
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
31547
+ var pad = function pad2(n) {
31548
+ return (n < 10 ? "0" : "") + n;
31549
+ };
31550
+ var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
31551
+ return d.toISOString();
31552
+ } : function _toISOString3(d) {
31553
+ 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";
31554
+ };
31555
+
31556
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
31557
+ var isInteger_default = Number.isInteger || function _isInteger(n) {
31558
+ return n << 0 === n;
31559
+ };
31560
+
31561
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
31562
+ function _cloneRegExp(pattern) {
31563
+ 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" : ""));
31564
+ }
31565
+
31566
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
31567
+ function _clone(value, deep, map) {
31568
+ map || (map = new _ObjectMap());
31569
+ if (_isPrimitive(value)) {
31570
+ return value;
31571
+ }
31572
+ var copy = function copy2(copiedValue) {
31573
+ var cachedCopy = map.get(value);
31574
+ if (cachedCopy) {
31575
+ return cachedCopy;
31576
+ }
31577
+ map.set(value, copiedValue);
31578
+ for (var key in value) {
31579
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
31580
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
31581
+ }
31582
+ }
31583
+ return copiedValue;
31584
+ };
31585
+ switch (type_default(value)) {
31586
+ case "Object":
31587
+ return copy(Object.create(Object.getPrototypeOf(value)));
31588
+ case "Array":
31589
+ return copy([]);
31590
+ case "Date":
31591
+ return new Date(value.valueOf());
31592
+ case "RegExp":
31593
+ return _cloneRegExp(value);
31594
+ case "Int8Array":
31595
+ case "Uint8Array":
31596
+ case "Uint8ClampedArray":
31597
+ case "Int16Array":
31598
+ case "Uint16Array":
31599
+ case "Int32Array":
31600
+ case "Uint32Array":
31601
+ case "Float32Array":
31602
+ case "Float64Array":
31603
+ case "BigInt64Array":
31604
+ case "BigUint64Array":
31605
+ return value.slice();
31606
+ default:
31607
+ return value;
31608
+ }
31609
+ }
31610
+ function _isPrimitive(param) {
31611
+ var type3 = typeof param;
31612
+ return param == null || type3 != "object" && type3 != "function";
31495
31613
  }
31614
+ var _ObjectMap = /* @__PURE__ */ function() {
31615
+ function _ObjectMap2() {
31616
+ this.map = {};
31617
+ this.length = 0;
31618
+ }
31619
+ _ObjectMap2.prototype.set = function(key, value) {
31620
+ const hashedKey = this.hash(key);
31621
+ let bucket = this.map[hashedKey];
31622
+ if (!bucket) {
31623
+ this.map[hashedKey] = bucket = [];
31624
+ }
31625
+ bucket.push([key, value]);
31626
+ this.length += 1;
31627
+ };
31628
+ _ObjectMap2.prototype.hash = function(key) {
31629
+ let hashedKey = [];
31630
+ for (var value in key) {
31631
+ hashedKey.push(Object.prototype.toString.call(key[value]));
31632
+ }
31633
+ return hashedKey.join();
31634
+ };
31635
+ _ObjectMap2.prototype.get = function(key) {
31636
+ if (this.length <= 180) {
31637
+ for (const p in this.map) {
31638
+ const bucket2 = this.map[p];
31639
+ for (let i = 0; i < bucket2.length; i += 1) {
31640
+ const element = bucket2[i];
31641
+ if (element[0] === key) {
31642
+ return element[1];
31643
+ }
31644
+ }
31645
+ }
31646
+ return;
31647
+ }
31648
+ const hashedKey = this.hash(key);
31649
+ const bucket = this.map[hashedKey];
31650
+ if (!bucket) {
31651
+ return;
31652
+ }
31653
+ for (let i = 0; i < bucket.length; i += 1) {
31654
+ const element = bucket[i];
31655
+ if (element[0] === key) {
31656
+ return element[1];
31657
+ }
31658
+ }
31659
+ };
31660
+ return _ObjectMap2;
31661
+ }();
31662
+
31663
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
31664
+ var clone = /* @__PURE__ */ _curry1(function clone2(value) {
31665
+ return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
31666
+ });
31667
+ var clone_default = clone;
31668
+
31669
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
31670
+ var hasProtoTrim = typeof String.prototype.trim === "function";
31496
31671
 
31497
31672
  // src/providers/coin-quantity.ts
31498
31673
  var coinQuantityfy = (coinQuantityLike) => {
31499
31674
  let assetId;
31500
31675
  let amount;
31501
- let max2;
31676
+ let max;
31502
31677
  if (Array.isArray(coinQuantityLike)) {
31503
31678
  amount = coinQuantityLike[0];
31504
- assetId = coinQuantityLike[1];
31505
- max2 = coinQuantityLike[2];
31679
+ assetId = coinQuantityLike[1] ?? BaseAssetId;
31680
+ max = coinQuantityLike[2] ?? void 0;
31506
31681
  } else {
31507
31682
  amount = coinQuantityLike.amount;
31508
- assetId = coinQuantityLike.assetId;
31509
- max2 = coinQuantityLike.max ?? void 0;
31683
+ assetId = coinQuantityLike.assetId ?? BaseAssetId;
31684
+ max = coinQuantityLike.max ?? void 0;
31510
31685
  }
31511
31686
  const bnAmount = bn(amount);
31512
31687
  return {
31513
31688
  assetId: hexlify(assetId),
31514
31689
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
31515
- max: max2 ? bn(max2) : void 0
31690
+ max: max ? bn(max) : void 0
31516
31691
  };
31517
31692
  };
31518
- var addAmountToAsset = (params) => {
31693
+ var addAmountToCoinQuantities = (params) => {
31519
31694
  const { amount, assetId } = params;
31520
31695
  const coinQuantities = [...params.coinQuantities];
31521
31696
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -31607,9 +31782,9 @@ This unreleased fuel-core build may include features and updates not yet support
31607
31782
  var TX_POINTER_LEN = WORD_SIZE * 2;
31608
31783
  var MAX_BYTES = 2 ** 32 - 1;
31609
31784
  var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
31610
- WORD_SIZE + // Tx size
31785
+ ASSET_ID_LEN + // Base asset ID
31611
31786
  // Asset ID/Balance coin input pairs
31612
- maxInputs * (ASSET_ID_LEN + WORD_SIZE);
31787
+ maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
31613
31788
  var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
31614
31789
  WORD_SIZE + // Gas limit
31615
31790
  WORD_SIZE + // Script size
@@ -31627,7 +31802,6 @@ This unreleased fuel-core build may include features and updates not yet support
31627
31802
  ASSET_ID_LEN + // Asset id
31628
31803
  TX_POINTER_LEN + // TxPointer
31629
31804
  WORD_SIZE + // Witnesses index
31630
- WORD_SIZE + // Maturity
31631
31805
  WORD_SIZE + // Predicate size
31632
31806
  WORD_SIZE + // Predicate data size
31633
31807
  WORD_SIZE;
@@ -31957,7 +32131,7 @@ This unreleased fuel-core build may include features and updates not yet support
31957
32131
  constructor(name, coders) {
31958
32132
  const caseIndexCoder = new BigNumberCoder("u64");
31959
32133
  const encodedValueSize = Object.values(coders).reduce(
31960
- (max2, coder) => Math.max(max2, coder.encodedLength),
32134
+ (max, coder) => Math.max(max, coder.encodedLength),
31961
32135
  0
31962
32136
  );
31963
32137
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -32644,7 +32818,7 @@ This unreleased fuel-core build may include features and updates not yet support
32644
32818
  constructor(name, coders) {
32645
32819
  const caseIndexCoder = new BigNumberCoder("u64");
32646
32820
  const encodedValueSize = Object.values(coders).reduce(
32647
- (max2, coder) => Math.max(max2, coder.encodedLength),
32821
+ (max, coder) => Math.max(max, coder.encodedLength),
32648
32822
  0
32649
32823
  );
32650
32824
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -33367,18 +33541,19 @@ This unreleased fuel-core build may include features and updates not yet support
33367
33541
  encode(value) {
33368
33542
  const parts = [];
33369
33543
  parts.push(new B256Coder().encode(value.txID));
33370
- parts.push(new NumberCoder("u8").encode(value.outputIndex));
33544
+ parts.push(new NumberCoder("u16").encode(value.outputIndex));
33371
33545
  parts.push(new B256Coder().encode(value.owner));
33372
33546
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33373
33547
  parts.push(new B256Coder().encode(value.assetId));
33374
33548
  parts.push(new TxPointerCoder().encode(value.txPointer));
33375
- parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33376
- parts.push(new NumberCoder("u32").encode(value.maturity));
33549
+ parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33377
33550
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33378
- parts.push(new NumberCoder("u32").encode(value.predicateLength));
33379
- parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33380
- parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33381
- parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33551
+ parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33552
+ parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33553
+ parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33554
+ parts.push(
33555
+ new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33556
+ );
33382
33557
  return concat(parts);
33383
33558
  }
33384
33559
  decode(data, offset) {
@@ -33386,7 +33561,7 @@ This unreleased fuel-core build may include features and updates not yet support
33386
33561
  let o = offset;
33387
33562
  [decoded, o] = new B256Coder().decode(data, o);
33388
33563
  const txID = decoded;
33389
- [decoded, o] = new NumberCoder("u8").decode(data, o);
33564
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
33390
33565
  const outputIndex = decoded;
33391
33566
  [decoded, o] = new B256Coder().decode(data, o);
33392
33567
  const owner = decoded;
@@ -33396,19 +33571,17 @@ This unreleased fuel-core build may include features and updates not yet support
33396
33571
  const assetId = decoded;
33397
33572
  [decoded, o] = new TxPointerCoder().decode(data, o);
33398
33573
  const txPointer = decoded;
33399
- [decoded, o] = new NumberCoder("u8").decode(data, o);
33574
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
33400
33575
  const witnessIndex = Number(decoded);
33401
- [decoded, o] = new NumberCoder("u32").decode(data, o);
33402
- const maturity = decoded;
33403
33576
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33404
33577
  const predicateGasUsed = decoded;
33405
- [decoded, o] = new NumberCoder("u32").decode(data, o);
33578
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33406
33579
  const predicateLength = decoded;
33407
- [decoded, o] = new NumberCoder("u32").decode(data, o);
33580
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33408
33581
  const predicateDataLength = decoded;
33409
- [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33582
+ [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33410
33583
  const predicate = decoded;
33411
- [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33584
+ [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33412
33585
  const predicateData = decoded;
33413
33586
  return [
33414
33587
  {
@@ -33420,7 +33593,6 @@ This unreleased fuel-core build may include features and updates not yet support
33420
33593
  assetId,
33421
33594
  txPointer,
33422
33595
  witnessIndex,
33423
- maturity,
33424
33596
  predicateGasUsed,
33425
33597
  predicateLength,
33426
33598
  predicateDataLength,
@@ -33438,7 +33610,7 @@ This unreleased fuel-core build may include features and updates not yet support
33438
33610
  encode(value) {
33439
33611
  const parts = [];
33440
33612
  parts.push(new B256Coder().encode(value.txID));
33441
- parts.push(new NumberCoder("u8").encode(value.outputIndex));
33613
+ parts.push(new NumberCoder("u16").encode(value.outputIndex));
33442
33614
  parts.push(new B256Coder().encode(value.balanceRoot));
33443
33615
  parts.push(new B256Coder().encode(value.stateRoot));
33444
33616
  parts.push(new TxPointerCoder().encode(value.txPointer));
@@ -33450,7 +33622,7 @@ This unreleased fuel-core build may include features and updates not yet support
33450
33622
  let o = offset;
33451
33623
  [decoded, o] = new B256Coder().decode(data, o);
33452
33624
  const txID = decoded;
33453
- [decoded, o] = new NumberCoder("u8").decode(data, o);
33625
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
33454
33626
  const outputIndex = decoded;
33455
33627
  [decoded, o] = new B256Coder().decode(data, o);
33456
33628
  const balanceRoot = decoded;
@@ -33499,14 +33671,16 @@ This unreleased fuel-core build may include features and updates not yet support
33499
33671
  parts.push(new ByteArrayCoder(32).encode(value.recipient));
33500
33672
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33501
33673
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33502
- parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33674
+ parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33503
33675
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33504
- parts.push(new NumberCoder("u32").encode(data.length));
33505
- parts.push(new NumberCoder("u32").encode(value.predicateLength));
33506
- parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33676
+ parts.push(new BigNumberCoder("u64").encode(data.length));
33677
+ parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33678
+ parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33507
33679
  parts.push(new ByteArrayCoder(data.length).encode(data));
33508
- parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33509
- parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33680
+ parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33681
+ parts.push(
33682
+ new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33683
+ );
33510
33684
  return concat(parts);
33511
33685
  }
33512
33686
  static decodeData(messageData) {
@@ -33526,21 +33700,21 @@ This unreleased fuel-core build may include features and updates not yet support
33526
33700
  const amount = decoded;
33527
33701
  [decoded, o] = new B256Coder().decode(data, o);
33528
33702
  const nonce = decoded;
33529
- [decoded, o] = new NumberCoder("u8").decode(data, o);
33703
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
33530
33704
  const witnessIndex = Number(decoded);
33531
33705
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33532
33706
  const predicateGasUsed = decoded;
33533
33707
  [decoded, o] = new NumberCoder("u32").decode(data, o);
33534
33708
  const dataLength2 = decoded;
33535
- [decoded, o] = new NumberCoder("u32").decode(data, o);
33709
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33536
33710
  const predicateLength = decoded;
33537
- [decoded, o] = new NumberCoder("u32").decode(data, o);
33711
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33538
33712
  const predicateDataLength = decoded;
33539
33713
  [decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
33540
33714
  const messageData = decoded;
33541
- [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33715
+ [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33542
33716
  const predicate = decoded;
33543
- [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33717
+ [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33544
33718
  const predicateData = decoded;
33545
33719
  return [
33546
33720
  {
@@ -33852,7 +34026,7 @@ This unreleased fuel-core build may include features and updates not yet support
33852
34026
  }
33853
34027
  };
33854
34028
  var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
33855
- PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
34029
+ PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
33856
34030
  PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
33857
34031
  PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
33858
34032
  PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
@@ -33900,9 +34074,9 @@ This unreleased fuel-core build may include features and updates not yet support
33900
34074
  let o = offset;
33901
34075
  const policies = [];
33902
34076
  if (policyTypes & 1) {
33903
- const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
34077
+ const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
33904
34078
  o = nextOffset;
33905
- policies.push({ type: 1, data: gasPrice });
34079
+ policies.push({ type: 1, data: tip });
33906
34080
  }
33907
34081
  if (policyTypes & 2) {
33908
34082
  const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
@@ -34134,15 +34308,15 @@ This unreleased fuel-core build may include features and updates not yet support
34134
34308
  encode(value) {
34135
34309
  const parts = [];
34136
34310
  parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
34137
- parts.push(new NumberCoder("u32").encode(value.scriptLength));
34138
- parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
34139
- parts.push(new NumberCoder("u32").encode(value.policyTypes));
34140
- parts.push(new NumberCoder("u8").encode(value.inputsCount));
34141
- parts.push(new NumberCoder("u8").encode(value.outputsCount));
34142
- parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34143
34311
  parts.push(new B256Coder().encode(value.receiptsRoot));
34144
- parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
34145
- parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
34312
+ parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
34313
+ parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
34314
+ parts.push(new NumberCoder("u32").encode(value.policyTypes));
34315
+ parts.push(new NumberCoder("u16").encode(value.inputsCount));
34316
+ parts.push(new NumberCoder("u16").encode(value.outputsCount));
34317
+ parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34318
+ parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
34319
+ parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
34146
34320
  parts.push(new PoliciesCoder().encode(value.policies));
34147
34321
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34148
34322
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
@@ -34154,23 +34328,23 @@ This unreleased fuel-core build may include features and updates not yet support
34154
34328
  let o = offset;
34155
34329
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34156
34330
  const scriptGasLimit = decoded;
34157
- [decoded, o] = new NumberCoder("u32").decode(data, o);
34331
+ [decoded, o] = new B256Coder().decode(data, o);
34332
+ const receiptsRoot = decoded;
34333
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34158
34334
  const scriptLength = decoded;
34159
- [decoded, o] = new NumberCoder("u32").decode(data, o);
34335
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34160
34336
  const scriptDataLength = decoded;
34161
34337
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34162
34338
  const policyTypes = decoded;
34163
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34339
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
34164
34340
  const inputsCount = decoded;
34165
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34341
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
34166
34342
  const outputsCount = decoded;
34167
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34343
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
34168
34344
  const witnessesCount = decoded;
34169
- [decoded, o] = new B256Coder().decode(data, o);
34170
- const receiptsRoot = decoded;
34171
- [decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
34345
+ [decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
34172
34346
  const script = decoded;
34173
- [decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
34347
+ [decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
34174
34348
  const scriptData = decoded;
34175
34349
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34176
34350
  const policies = decoded;
@@ -34208,18 +34382,19 @@ This unreleased fuel-core build may include features and updates not yet support
34208
34382
  }
34209
34383
  encode(value) {
34210
34384
  const parts = [];
34211
- parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
34212
- parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
34213
- parts.push(new NumberCoder("u32").encode(value.policyTypes));
34214
- parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
34215
- parts.push(new NumberCoder("u8").encode(value.inputsCount));
34216
- parts.push(new NumberCoder("u8").encode(value.outputsCount));
34217
- parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34385
+ parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
34218
34386
  parts.push(new B256Coder().encode(value.salt));
34219
- parts.push(new PoliciesCoder().encode(value.policies));
34387
+ parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
34388
+ parts.push(new NumberCoder("u32").encode(value.policyTypes));
34389
+ parts.push(new NumberCoder("u16").encode(value.inputsCount));
34390
+ parts.push(new NumberCoder("u16").encode(value.outputsCount));
34391
+ parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34220
34392
  parts.push(
34221
- new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
34393
+ new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
34394
+ value.storageSlots
34395
+ )
34222
34396
  );
34397
+ parts.push(new PoliciesCoder().encode(value.policies));
34223
34398
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34224
34399
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
34225
34400
  parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
@@ -34228,26 +34403,27 @@ This unreleased fuel-core build may include features and updates not yet support
34228
34403
  decode(data, offset) {
34229
34404
  let decoded;
34230
34405
  let o = offset;
34231
- [decoded, o] = new NumberCoder("u32").decode(data, o);
34232
- const bytecodeLength = decoded;
34233
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34406
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
34234
34407
  const bytecodeWitnessIndex = decoded;
34408
+ [decoded, o] = new B256Coder().decode(data, o);
34409
+ const salt = decoded;
34410
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34411
+ const storageSlotsCount = decoded;
34235
34412
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34236
34413
  const policyTypes = decoded;
34237
34414
  [decoded, o] = new NumberCoder("u16").decode(data, o);
34238
- const storageSlotsCount = decoded;
34239
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34240
34415
  const inputsCount = decoded;
34241
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34416
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
34242
34417
  const outputsCount = decoded;
34243
- [decoded, o] = new NumberCoder("u8").decode(data, o);
34418
+ [decoded, o] = new NumberCoder("u16").decode(data, o);
34244
34419
  const witnessesCount = decoded;
34245
- [decoded, o] = new B256Coder().decode(data, o);
34246
- const salt = decoded;
34420
+ [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
34421
+ data,
34422
+ o
34423
+ );
34424
+ const storageSlots = decoded;
34247
34425
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34248
34426
  const policies = decoded;
34249
- [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
34250
- const storageSlots = decoded;
34251
34427
  [decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
34252
34428
  const inputs = decoded;
34253
34429
  [decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
@@ -34257,7 +34433,6 @@ This unreleased fuel-core build may include features and updates not yet support
34257
34433
  return [
34258
34434
  {
34259
34435
  type: 1,
34260
- bytecodeLength,
34261
34436
  bytecodeWitnessIndex,
34262
34437
  policyTypes,
34263
34438
  storageSlotsCount,
@@ -34286,6 +34461,7 @@ This unreleased fuel-core build may include features and updates not yet support
34286
34461
  parts.push(new OutputContractCoder().encode(value.outputContract));
34287
34462
  parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
34288
34463
  parts.push(new B256Coder().encode(value.mintAssetId));
34464
+ parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
34289
34465
  return concat(parts);
34290
34466
  }
34291
34467
  decode(data, offset) {
@@ -34301,6 +34477,8 @@ This unreleased fuel-core build may include features and updates not yet support
34301
34477
  const mintAmount = decoded;
34302
34478
  [decoded, o] = new B256Coder().decode(data, o);
34303
34479
  const mintAssetId = decoded;
34480
+ [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34481
+ const gasPrice = decoded;
34304
34482
  return [
34305
34483
  {
34306
34484
  type: 2,
@@ -34308,7 +34486,8 @@ This unreleased fuel-core build may include features and updates not yet support
34308
34486
  inputContract,
34309
34487
  outputContract,
34310
34488
  mintAmount,
34311
- mintAssetId
34489
+ mintAssetId,
34490
+ gasPrice
34312
34491
  },
34313
34492
  o
34314
34493
  ];
@@ -34615,159 +34794,6 @@ This unreleased fuel-core build may include features and updates not yet support
34615
34794
  // src/providers/provider.ts
34616
34795
  var import_graphql_request = __toESM(require_dist2());
34617
34796
 
34618
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
34619
- function _isPlaceholder(a) {
34620
- return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
34621
- }
34622
-
34623
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
34624
- function _curry1(fn) {
34625
- return function f1(a) {
34626
- if (arguments.length === 0 || _isPlaceholder(a)) {
34627
- return f1;
34628
- } else {
34629
- return fn.apply(this, arguments);
34630
- }
34631
- };
34632
- }
34633
-
34634
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
34635
- var isArray_default = Array.isArray || function _isArray(val) {
34636
- return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
34637
- };
34638
-
34639
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
34640
- var type = /* @__PURE__ */ _curry1(function type2(val) {
34641
- return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
34642
- });
34643
- var type_default = type;
34644
-
34645
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
34646
- var pad = function pad2(n) {
34647
- return (n < 10 ? "0" : "") + n;
34648
- };
34649
- var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
34650
- return d.toISOString();
34651
- } : function _toISOString3(d) {
34652
- 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";
34653
- };
34654
-
34655
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
34656
- var isInteger_default = Number.isInteger || function _isInteger(n) {
34657
- return n << 0 === n;
34658
- };
34659
-
34660
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
34661
- function _cloneRegExp(pattern) {
34662
- 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" : ""));
34663
- }
34664
-
34665
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
34666
- function _clone(value, deep, map) {
34667
- map || (map = new _ObjectMap());
34668
- if (_isPrimitive(value)) {
34669
- return value;
34670
- }
34671
- var copy = function copy2(copiedValue) {
34672
- var cachedCopy = map.get(value);
34673
- if (cachedCopy) {
34674
- return cachedCopy;
34675
- }
34676
- map.set(value, copiedValue);
34677
- for (var key in value) {
34678
- if (Object.prototype.hasOwnProperty.call(value, key)) {
34679
- copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
34680
- }
34681
- }
34682
- return copiedValue;
34683
- };
34684
- switch (type_default(value)) {
34685
- case "Object":
34686
- return copy(Object.create(Object.getPrototypeOf(value)));
34687
- case "Array":
34688
- return copy([]);
34689
- case "Date":
34690
- return new Date(value.valueOf());
34691
- case "RegExp":
34692
- return _cloneRegExp(value);
34693
- case "Int8Array":
34694
- case "Uint8Array":
34695
- case "Uint8ClampedArray":
34696
- case "Int16Array":
34697
- case "Uint16Array":
34698
- case "Int32Array":
34699
- case "Uint32Array":
34700
- case "Float32Array":
34701
- case "Float64Array":
34702
- case "BigInt64Array":
34703
- case "BigUint64Array":
34704
- return value.slice();
34705
- default:
34706
- return value;
34707
- }
34708
- }
34709
- function _isPrimitive(param) {
34710
- var type3 = typeof param;
34711
- return param == null || type3 != "object" && type3 != "function";
34712
- }
34713
- var _ObjectMap = /* @__PURE__ */ function() {
34714
- function _ObjectMap2() {
34715
- this.map = {};
34716
- this.length = 0;
34717
- }
34718
- _ObjectMap2.prototype.set = function(key, value) {
34719
- const hashedKey = this.hash(key);
34720
- let bucket = this.map[hashedKey];
34721
- if (!bucket) {
34722
- this.map[hashedKey] = bucket = [];
34723
- }
34724
- bucket.push([key, value]);
34725
- this.length += 1;
34726
- };
34727
- _ObjectMap2.prototype.hash = function(key) {
34728
- let hashedKey = [];
34729
- for (var value in key) {
34730
- hashedKey.push(Object.prototype.toString.call(key[value]));
34731
- }
34732
- return hashedKey.join();
34733
- };
34734
- _ObjectMap2.prototype.get = function(key) {
34735
- if (this.length <= 180) {
34736
- for (const p in this.map) {
34737
- const bucket2 = this.map[p];
34738
- for (let i = 0; i < bucket2.length; i += 1) {
34739
- const element = bucket2[i];
34740
- if (element[0] === key) {
34741
- return element[1];
34742
- }
34743
- }
34744
- }
34745
- return;
34746
- }
34747
- const hashedKey = this.hash(key);
34748
- const bucket = this.map[hashedKey];
34749
- if (!bucket) {
34750
- return;
34751
- }
34752
- for (let i = 0; i < bucket.length; i += 1) {
34753
- const element = bucket[i];
34754
- if (element[0] === key) {
34755
- return element[1];
34756
- }
34757
- }
34758
- };
34759
- return _ObjectMap2;
34760
- }();
34761
-
34762
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
34763
- var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
34764
- return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
34765
- });
34766
- var clone_default = clone2;
34767
-
34768
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
34769
- var hasProtoTrim = typeof String.prototype.trim === "function";
34770
-
34771
34797
  // ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
34772
34798
  var __assign = function() {
34773
34799
  __assign = Object.assign || function __assign2(t) {
@@ -37935,14 +37961,10 @@ spurious results.`);
37935
37961
  // src/providers/__generated__/operations.ts
37936
37962
  var ReceiptFragmentFragmentDoc = lib_default2`
37937
37963
  fragment receiptFragment on Receipt {
37938
- contract {
37939
- id
37940
- }
37964
+ id
37941
37965
  pc
37942
37966
  is
37943
- to {
37944
- id
37945
- }
37967
+ to
37946
37968
  toAddress
37947
37969
  amount
37948
37970
  assetId
@@ -37980,10 +38002,16 @@ spurious results.`);
37980
38002
  id
37981
38003
  }
37982
38004
  time
38005
+ receipts {
38006
+ ...receiptFragment
38007
+ }
37983
38008
  programState {
37984
38009
  returnType
37985
38010
  data
37986
38011
  }
38012
+ receipts {
38013
+ ...receiptFragment
38014
+ }
37987
38015
  }
37988
38016
  ... on FailureStatus {
37989
38017
  block {
@@ -37991,26 +38019,24 @@ spurious results.`);
37991
38019
  }
37992
38020
  time
37993
38021
  reason
38022
+ receipts {
38023
+ ...receiptFragment
38024
+ }
37994
38025
  }
37995
38026
  ... on SqueezedOutStatus {
37996
38027
  reason
37997
38028
  }
37998
38029
  }
37999
- `;
38030
+ ${ReceiptFragmentFragmentDoc}`;
38000
38031
  var TransactionFragmentFragmentDoc = lib_default2`
38001
38032
  fragment transactionFragment on Transaction {
38002
38033
  id
38003
38034
  rawPayload
38004
- gasPrice
38005
- receipts {
38006
- ...receiptFragment
38007
- }
38008
38035
  status {
38009
38036
  ...transactionStatusFragment
38010
38037
  }
38011
38038
  }
38012
- ${ReceiptFragmentFragmentDoc}
38013
- ${TransactionStatusFragmentFragmentDoc}`;
38039
+ ${TransactionStatusFragmentFragmentDoc}`;
38014
38040
  var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
38015
38041
  fragment inputEstimatePredicatesFragment on Input {
38016
38042
  ... on InputCoin {
@@ -38028,6 +38054,46 @@ ${TransactionStatusFragmentFragmentDoc}`;
38028
38054
  }
38029
38055
  }
38030
38056
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
38057
+ var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
38058
+ fragment dryRunFailureStatusFragment on DryRunFailureStatus {
38059
+ reason
38060
+ programState {
38061
+ returnType
38062
+ data
38063
+ }
38064
+ }
38065
+ `;
38066
+ var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
38067
+ fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
38068
+ programState {
38069
+ returnType
38070
+ data
38071
+ }
38072
+ }
38073
+ `;
38074
+ var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
38075
+ fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
38076
+ ... on DryRunFailureStatus {
38077
+ ...dryRunFailureStatusFragment
38078
+ }
38079
+ ... on DryRunSuccessStatus {
38080
+ ...dryRunSuccessStatusFragment
38081
+ }
38082
+ }
38083
+ ${DryRunFailureStatusFragmentFragmentDoc}
38084
+ ${DryRunSuccessStatusFragmentFragmentDoc}`;
38085
+ var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
38086
+ fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
38087
+ id
38088
+ status {
38089
+ ...dryRunTransactionStatusFragment
38090
+ }
38091
+ receipts {
38092
+ ...receiptFragment
38093
+ }
38094
+ }
38095
+ ${DryRunTransactionStatusFragmentFragmentDoc}
38096
+ ${ReceiptFragmentFragmentDoc}`;
38031
38097
  var CoinFragmentFragmentDoc = lib_default2`
38032
38098
  fragment coinFragment on Coin {
38033
38099
  __typename
@@ -38035,7 +38101,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
38035
38101
  owner
38036
38102
  amount
38037
38103
  assetId
38038
- maturity
38039
38104
  blockCreated
38040
38105
  txCreatedIdx
38041
38106
  }
@@ -38080,7 +38145,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
38080
38145
  prevRoot
38081
38146
  time
38082
38147
  applicationHash
38083
- messageReceiptRoot
38084
38148
  messageReceiptCount
38085
38149
  }
38086
38150
  commitBlockHeader {
@@ -38092,7 +38156,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
38092
38156
  prevRoot
38093
38157
  time
38094
38158
  applicationHash
38095
- messageReceiptRoot
38096
38159
  messageReceiptCount
38097
38160
  }
38098
38161
  sender
@@ -38112,8 +38175,8 @@ ${TransactionStatusFragmentFragmentDoc}`;
38112
38175
  var BlockFragmentFragmentDoc = lib_default2`
38113
38176
  fragment blockFragment on Block {
38114
38177
  id
38178
+ height
38115
38179
  header {
38116
- height
38117
38180
  time
38118
38181
  }
38119
38182
  transactions {
@@ -38171,6 +38234,11 @@ ${TransactionStatusFragmentFragmentDoc}`;
38171
38234
  `;
38172
38235
  var GasCostsFragmentFragmentDoc = lib_default2`
38173
38236
  fragment GasCostsFragment on GasCosts {
38237
+ version {
38238
+ ... on Version {
38239
+ value
38240
+ }
38241
+ }
38174
38242
  add
38175
38243
  addi
38176
38244
  aloc
@@ -38183,7 +38251,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
38183
38251
  cb
38184
38252
  cfei
38185
38253
  cfsi
38186
- croo
38187
38254
  div
38188
38255
  divi
38189
38256
  ecr1
@@ -38266,6 +38333,9 @@ ${TransactionStatusFragmentFragmentDoc}`;
38266
38333
  ccp {
38267
38334
  ...DependentCostFragment
38268
38335
  }
38336
+ croo {
38337
+ ...DependentCostFragment
38338
+ }
38269
38339
  csiz {
38270
38340
  ...DependentCostFragment
38271
38341
  }
@@ -38325,6 +38395,11 @@ ${TransactionStatusFragmentFragmentDoc}`;
38325
38395
  ${DependentCostFragmentFragmentDoc}`;
38326
38396
  var ConsensusParametersFragmentFragmentDoc = lib_default2`
38327
38397
  fragment consensusParametersFragment on ConsensusParameters {
38398
+ version {
38399
+ ... on Version {
38400
+ value
38401
+ }
38402
+ }
38328
38403
  txParams {
38329
38404
  ...TxParametersFragment
38330
38405
  }
@@ -38384,18 +38459,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38384
38459
  fragment nodeInfoFragment on NodeInfo {
38385
38460
  utxoValidation
38386
38461
  vmBacktrace
38387
- minGasPrice
38388
38462
  maxTx
38389
38463
  maxDepth
38390
38464
  nodeVersion
38391
- peers {
38392
- id
38393
- addresses
38394
- clientVersion
38395
- blockHeight
38396
- lastHeartbeatMs
38397
- appScore
38398
- }
38399
38465
  }
38400
38466
  `;
38401
38467
  var GetVersionDocument = lib_default2`
@@ -38430,13 +38496,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38430
38496
  query getTransactionWithReceipts($transactionId: TransactionId!) {
38431
38497
  transaction(id: $transactionId) {
38432
38498
  ...transactionFragment
38433
- receipts {
38434
- ...receiptFragment
38435
- }
38436
38499
  }
38437
38500
  }
38438
- ${TransactionFragmentFragmentDoc}
38439
- ${ReceiptFragmentFragmentDoc}`;
38501
+ ${TransactionFragmentFragmentDoc}`;
38440
38502
  var GetTransactionsDocument = lib_default2`
38441
38503
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
38442
38504
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -38564,6 +38626,20 @@ ${MessageCoinFragmentFragmentDoc}`;
38564
38626
  }
38565
38627
  }
38566
38628
  ${BalanceFragmentFragmentDoc}`;
38629
+ var GetLatestGasPriceDocument = lib_default2`
38630
+ query getLatestGasPrice {
38631
+ latestGasPrice {
38632
+ gasPrice
38633
+ }
38634
+ }
38635
+ `;
38636
+ var EstimateGasPriceDocument = lib_default2`
38637
+ query estimateGasPrice($blockHorizon: U32!) {
38638
+ estimateGasPrice(blockHorizon: $blockHorizon) {
38639
+ gasPrice
38640
+ }
38641
+ }
38642
+ `;
38567
38643
  var GetBalancesDocument = lib_default2`
38568
38644
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
38569
38645
  balances(
@@ -38618,12 +38694,12 @@ ${MessageCoinFragmentFragmentDoc}`;
38618
38694
  }
38619
38695
  `;
38620
38696
  var DryRunDocument = lib_default2`
38621
- mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
38622
- dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
38623
- ...receiptFragment
38697
+ mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
38698
+ dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
38699
+ ...dryRunTransactionExecutionStatusFragment
38624
38700
  }
38625
38701
  }
38626
- ${ReceiptFragmentFragmentDoc}`;
38702
+ ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
38627
38703
  var SubmitDocument = lib_default2`
38628
38704
  mutation submit($encodedTransaction: HexString!) {
38629
38705
  submit(tx: $encodedTransaction) {
@@ -38706,6 +38782,12 @@ ${MessageCoinFragmentFragmentDoc}`;
38706
38782
  getBalance(variables, options) {
38707
38783
  return requester(GetBalanceDocument, variables, options);
38708
38784
  },
38785
+ getLatestGasPrice(variables, options) {
38786
+ return requester(GetLatestGasPriceDocument, variables, options);
38787
+ },
38788
+ estimateGasPrice(variables, options) {
38789
+ return requester(EstimateGasPriceDocument, variables, options);
38790
+ },
38709
38791
  getBalances(variables, options) {
38710
38792
  return requester(GetBalancesDocument, variables, options);
38711
38793
  },
@@ -38777,7 +38859,9 @@ ${MessageCoinFragmentFragmentDoc}`;
38777
38859
  } catch (e) {
38778
38860
  throw new FuelError(
38779
38861
  ErrorCode.STREAM_PARSING_ERROR,
38780
- `Error while parsing stream data response: ${text}`
38862
+ `Error while parsing stream data response: ${text}
38863
+
38864
+ Thrown error: ${e}`
38781
38865
  );
38782
38866
  }
38783
38867
  if (Array.isArray(errors)) {
@@ -38861,9 +38945,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38861
38945
  }
38862
38946
  };
38863
38947
 
38864
- // ../address/dist/configs.mjs
38865
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
38866
-
38867
38948
  // src/providers/transaction-request/input.ts
38868
38949
  var inputify = (value) => {
38869
38950
  const { type: type3 } = value;
@@ -38874,7 +38955,7 @@ ${MessageCoinFragmentFragmentDoc}`;
38874
38955
  return {
38875
38956
  type: InputType.Coin,
38876
38957
  txID: hexlify(arrayify(value.id).slice(0, 32)),
38877
- outputIndex: arrayify(value.id)[32],
38958
+ outputIndex: toNumber2(arrayify(value.id).slice(32, 34)),
38878
38959
  owner: hexlify(value.owner),
38879
38960
  amount: bn(value.amount),
38880
38961
  assetId: hexlify(value.assetId),
@@ -38883,10 +38964,9 @@ ${MessageCoinFragmentFragmentDoc}`;
38883
38964
  txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38884
38965
  },
38885
38966
  witnessIndex: value.witnessIndex,
38886
- maturity: value.maturity ?? 0,
38887
38967
  predicateGasUsed: bn(value.predicateGasUsed),
38888
- predicateLength: predicate.length,
38889
- predicateDataLength: predicateData.length,
38968
+ predicateLength: bn(predicate.length),
38969
+ predicateDataLength: bn(predicateData.length),
38890
38970
  predicate: hexlify(predicate),
38891
38971
  predicateData: hexlify(predicateData)
38892
38972
  };
@@ -38917,8 +38997,8 @@ ${MessageCoinFragmentFragmentDoc}`;
38917
38997
  nonce: hexlify(value.nonce),
38918
38998
  witnessIndex: value.witnessIndex,
38919
38999
  predicateGasUsed: bn(value.predicateGasUsed),
38920
- predicateLength: predicate.length,
38921
- predicateDataLength: predicateData.length,
39000
+ predicateLength: bn(predicate.length),
39001
+ predicateDataLength: bn(predicateData.length),
38922
39002
  predicate: hexlify(predicate),
38923
39003
  predicateData: hexlify(predicateData),
38924
39004
  data: hexlify(data),
@@ -39078,8 +39158,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39078
39158
  case "CALL" /* Call */: {
39079
39159
  const callReceipt = {
39080
39160
  type: ReceiptType.Call,
39081
- from: hexOrZero(receipt.contract?.id),
39082
- to: hexOrZero(receipt?.to?.id),
39161
+ from: hexOrZero(receipt.id || receipt.contractId),
39162
+ to: hexOrZero(receipt?.to),
39083
39163
  amount: bn(receipt.amount),
39084
39164
  assetId: hexOrZero(receipt.assetId),
39085
39165
  gas: bn(receipt.gas),
@@ -39093,7 +39173,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39093
39173
  case "RETURN" /* Return */: {
39094
39174
  const returnReceipt = {
39095
39175
  type: ReceiptType.Return,
39096
- id: hexOrZero(receipt.contract?.id),
39176
+ id: hexOrZero(receipt.id || receipt.contractId),
39097
39177
  val: bn(receipt.val),
39098
39178
  pc: bn(receipt.pc),
39099
39179
  is: bn(receipt.is)
@@ -39103,7 +39183,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39103
39183
  case "RETURN_DATA" /* ReturnData */: {
39104
39184
  const returnDataReceipt = {
39105
39185
  type: ReceiptType.ReturnData,
39106
- id: hexOrZero(receipt.contract?.id),
39186
+ id: hexOrZero(receipt.id || receipt.contractId),
39107
39187
  ptr: bn(receipt.ptr),
39108
39188
  len: bn(receipt.len),
39109
39189
  digest: hexOrZero(receipt.digest),
@@ -39115,7 +39195,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39115
39195
  case "PANIC" /* Panic */: {
39116
39196
  const panicReceipt = {
39117
39197
  type: ReceiptType.Panic,
39118
- id: hexOrZero(receipt.contract?.id),
39198
+ id: hexOrZero(receipt.id),
39119
39199
  reason: bn(receipt.reason),
39120
39200
  pc: bn(receipt.pc),
39121
39201
  is: bn(receipt.is),
@@ -39126,7 +39206,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39126
39206
  case "REVERT" /* Revert */: {
39127
39207
  const revertReceipt = {
39128
39208
  type: ReceiptType.Revert,
39129
- id: hexOrZero(receipt.contract?.id),
39209
+ id: hexOrZero(receipt.id || receipt.contractId),
39130
39210
  val: bn(receipt.ra),
39131
39211
  pc: bn(receipt.pc),
39132
39212
  is: bn(receipt.is)
@@ -39136,7 +39216,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39136
39216
  case "LOG" /* Log */: {
39137
39217
  const logReceipt = {
39138
39218
  type: ReceiptType.Log,
39139
- id: hexOrZero(receipt.contract?.id),
39219
+ id: hexOrZero(receipt.id || receipt.contractId),
39140
39220
  val0: bn(receipt.ra),
39141
39221
  val1: bn(receipt.rb),
39142
39222
  val2: bn(receipt.rc),
@@ -39149,7 +39229,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39149
39229
  case "LOG_DATA" /* LogData */: {
39150
39230
  const logDataReceipt = {
39151
39231
  type: ReceiptType.LogData,
39152
- id: hexOrZero(receipt.contract?.id),
39232
+ id: hexOrZero(receipt.id || receipt.contractId),
39153
39233
  val0: bn(receipt.ra),
39154
39234
  val1: bn(receipt.rb),
39155
39235
  ptr: bn(receipt.ptr),
@@ -39163,8 +39243,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39163
39243
  case "TRANSFER" /* Transfer */: {
39164
39244
  const transferReceipt = {
39165
39245
  type: ReceiptType.Transfer,
39166
- from: hexOrZero(receipt.contract?.id),
39167
- to: hexOrZero(receipt.toAddress || receipt?.to?.id),
39246
+ from: hexOrZero(receipt.id || receipt.contractId),
39247
+ to: hexOrZero(receipt.toAddress || receipt?.to),
39168
39248
  amount: bn(receipt.amount),
39169
39249
  assetId: hexOrZero(receipt.assetId),
39170
39250
  pc: bn(receipt.pc),
@@ -39175,8 +39255,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39175
39255
  case "TRANSFER_OUT" /* TransferOut */: {
39176
39256
  const transferOutReceipt = {
39177
39257
  type: ReceiptType.TransferOut,
39178
- from: hexOrZero(receipt.contract?.id),
39179
- to: hexOrZero(receipt.toAddress || receipt.to?.id),
39258
+ from: hexOrZero(receipt.id || receipt.contractId),
39259
+ to: hexOrZero(receipt.toAddress || receipt.to),
39180
39260
  amount: bn(receipt.amount),
39181
39261
  assetId: hexOrZero(receipt.assetId),
39182
39262
  pc: bn(receipt.pc),
@@ -39219,7 +39299,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39219
39299
  return receiptMessageOut;
39220
39300
  }
39221
39301
  case "MINT" /* Mint */: {
39222
- const contractId = hexOrZero(receipt.contract?.id);
39302
+ const contractId = hexOrZero(receipt.id || receipt.contractId);
39223
39303
  const subId = hexOrZero(receipt.subId);
39224
39304
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
39225
39305
  const mintReceipt = {
@@ -39234,7 +39314,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39234
39314
  return mintReceipt;
39235
39315
  }
39236
39316
  case "BURN" /* Burn */: {
39237
- const contractId = hexOrZero(receipt.contract?.id);
39317
+ const contractId = hexOrZero(receipt.id || receipt.contractId);
39238
39318
  const subId = hexOrZero(receipt.subId);
39239
39319
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
39240
39320
  const burnReceipt = {
@@ -39315,7 +39395,6 @@ ${MessageCoinFragmentFragmentDoc}`;
39315
39395
  };
39316
39396
 
39317
39397
  // src/providers/utils/gas.ts
39318
- var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
39319
39398
  var getGasUsedFromReceipts = (receipts) => {
39320
39399
  const scriptResult = receipts.filter(
39321
39400
  (receipt) => receipt.type === ReceiptType.ScriptResult
@@ -39336,18 +39415,28 @@ ${MessageCoinFragmentFragmentDoc}`;
39336
39415
  }
39337
39416
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
39338
39417
  const witnessCache = [];
39339
- const totalGas = inputs.reduce((total, input) => {
39418
+ const chargeableInputs = inputs.filter((input) => {
39419
+ const isCoinOrMessage = "owner" in input || "sender" in input;
39420
+ if (isCoinOrMessage) {
39421
+ if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39422
+ return true;
39423
+ }
39424
+ if (!witnessCache.includes(input.witnessIndex)) {
39425
+ witnessCache.push(input.witnessIndex);
39426
+ return true;
39427
+ }
39428
+ }
39429
+ return false;
39430
+ });
39431
+ const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
39432
+ const totalGas = chargeableInputs.reduce((total, input) => {
39340
39433
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39341
39434
  return total.add(
39342
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39435
+ vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39343
39436
  );
39344
39437
  }
39345
- if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
39346
- witnessCache.push(input.witnessIndex);
39347
- return total.add(gasCosts.ecr1);
39348
- }
39349
- return total;
39350
- }, bn());
39438
+ return total.add(gasCosts.ecr1);
39439
+ }, bn(0));
39351
39440
  return totalGas;
39352
39441
  }
39353
39442
  function getMinGas(params) {
@@ -39359,12 +39448,20 @@ ${MessageCoinFragmentFragmentDoc}`;
39359
39448
  return minGas;
39360
39449
  }
39361
39450
  function getMaxGas(params) {
39362
- const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
39451
+ const {
39452
+ gasPerByte,
39453
+ witnessesLength,
39454
+ witnessLimit,
39455
+ minGas,
39456
+ gasLimit = bn(0),
39457
+ maxGasPerTx
39458
+ } = params;
39363
39459
  let remainingAllowedWitnessGas = bn(0);
39364
39460
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
39365
39461
  remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
39366
39462
  }
39367
- return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39463
+ const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39464
+ return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
39368
39465
  }
39369
39466
  function calculateMetadataGasForTxCreate({
39370
39467
  gasCosts,
@@ -39386,6 +39483,10 @@ ${MessageCoinFragmentFragmentDoc}`;
39386
39483
  }) {
39387
39484
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
39388
39485
  }
39486
+ var calculateGasFee = (params) => {
39487
+ const { gas, gasPrice, priceFactor, tip } = params;
39488
+ return gas.mul(gasPrice).div(priceFactor).add(tip);
39489
+ };
39389
39490
 
39390
39491
  // src/providers/utils/json.ts
39391
39492
  function normalize2(object) {
@@ -39527,7 +39628,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39527
39628
  // src/providers/transaction-request/transaction-request.ts
39528
39629
  var BaseTransactionRequest = class {
39529
39630
  /** Gas price for transaction */
39530
- gasPrice;
39631
+ tip;
39531
39632
  /** Block until which tx cannot be included */
39532
39633
  maturity;
39533
39634
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -39540,38 +39641,34 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39540
39641
  outputs = [];
39541
39642
  /** List of witnesses */
39542
39643
  witnesses = [];
39543
- /** Base asset ID - should be fetched from the chain */
39544
- baseAssetId = ZeroBytes32;
39545
39644
  /**
39546
39645
  * Constructor for initializing a base transaction request.
39547
39646
  *
39548
39647
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
39549
39648
  */
39550
39649
  constructor({
39551
- gasPrice,
39650
+ tip,
39552
39651
  maturity,
39553
39652
  maxFee,
39554
39653
  witnessLimit,
39555
39654
  inputs,
39556
39655
  outputs,
39557
- witnesses,
39558
- baseAssetId
39656
+ witnesses
39559
39657
  } = {}) {
39560
- this.gasPrice = bn(gasPrice);
39658
+ this.tip = bn(tip);
39561
39659
  this.maturity = maturity ?? 0;
39562
39660
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
39563
39661
  this.maxFee = maxFee ? bn(maxFee) : void 0;
39564
39662
  this.inputs = inputs ?? [];
39565
39663
  this.outputs = outputs ?? [];
39566
39664
  this.witnesses = witnesses ?? [];
39567
- this.baseAssetId = baseAssetId ?? ZeroBytes32;
39568
39665
  }
39569
39666
  static getPolicyMeta(req) {
39570
39667
  let policyTypes = 0;
39571
39668
  const policies = [];
39572
- if (req.gasPrice) {
39573
- policyTypes += PolicyType.GasPrice;
39574
- policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
39669
+ if (req.tip) {
39670
+ policyTypes += PolicyType.Tip;
39671
+ policies.push({ data: req.tip, type: PolicyType.Tip });
39575
39672
  }
39576
39673
  if (req.witnessLimit) {
39577
39674
  policyTypes += PolicyType.WitnessLimit;
@@ -39758,10 +39855,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39758
39855
  * @param predicate - Predicate bytes.
39759
39856
  * @param predicateData - Predicate data bytes.
39760
39857
  */
39761
- addCoinInput(coin, predicate) {
39858
+ addCoinInput(coin) {
39762
39859
  const { assetId, owner, amount } = coin;
39763
39860
  let witnessIndex;
39764
- if (predicate) {
39861
+ if (coin.predicate) {
39765
39862
  witnessIndex = 0;
39766
39863
  } else {
39767
39864
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -39776,9 +39873,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39776
39873
  amount,
39777
39874
  assetId,
39778
39875
  txPointer: "0x00000000000000000000000000000000",
39779
- witnessIndex,
39780
- predicate: predicate?.bytes,
39781
- predicateData: predicate?.predicateDataBytes
39876
+ witnessIndex
39782
39877
  };
39783
39878
  this.pushInput(input);
39784
39879
  this.addChangeOutput(owner, assetId);
@@ -39789,11 +39884,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39789
39884
  *
39790
39885
  * @param message - Message resource.
39791
39886
  * @param predicate - Predicate bytes.
39887
+ * @param predicateData - Predicate data bytes.
39792
39888
  */
39793
- addMessageInput(message, predicate) {
39889
+ addMessageInput(message) {
39794
39890
  const { recipient, sender, amount } = message;
39891
+ const assetId = BaseAssetId;
39795
39892
  let witnessIndex;
39796
- if (predicate) {
39893
+ if (message.predicate) {
39797
39894
  witnessIndex = 0;
39798
39895
  } else {
39799
39896
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -39807,12 +39904,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39807
39904
  sender: sender.toB256(),
39808
39905
  recipient: recipient.toB256(),
39809
39906
  amount,
39810
- witnessIndex,
39811
- predicate: predicate?.bytes,
39812
- predicateData: predicate?.predicateDataBytes
39907
+ witnessIndex
39813
39908
  };
39814
39909
  this.pushInput(input);
39815
- this.addChangeOutput(recipient, this.baseAssetId);
39910
+ this.addChangeOutput(recipient, assetId);
39816
39911
  }
39817
39912
  /**
39818
39913
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -39840,32 +39935,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39840
39935
  resources.forEach((resource) => this.addResource(resource));
39841
39936
  return this;
39842
39937
  }
39843
- /**
39844
- * Adds multiple resources to the transaction by adding coin/message inputs and change
39845
- * outputs from the related assetIds.
39846
- *
39847
- * @param resources - The resources to add.
39848
- * @returns This transaction.
39849
- */
39850
- addPredicateResource(resource, predicate) {
39851
- if (isCoin(resource)) {
39852
- this.addCoinInput(resource, predicate);
39853
- } else {
39854
- this.addMessageInput(resource, predicate);
39855
- }
39856
- return this;
39857
- }
39858
- /**
39859
- * Adds multiple predicate coin/message inputs to the transaction and change outputs
39860
- * from the related assetIds.
39861
- *
39862
- * @param resources - The resources to add.
39863
- * @returns This transaction.
39864
- */
39865
- addPredicateResources(resources, predicate) {
39866
- resources.forEach((resource) => this.addPredicateResource(resource, predicate));
39867
- return this;
39868
- }
39869
39938
  /**
39870
39939
  * Adds a coin output to the transaction.
39871
39940
  *
@@ -39873,12 +39942,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39873
39942
  * @param amount - Amount of coin.
39874
39943
  * @param assetId - Asset ID of coin.
39875
39944
  */
39876
- addCoinOutput(to, amount, assetId) {
39945
+ addCoinOutput(to, amount, assetId = BaseAssetId) {
39877
39946
  this.pushOutput({
39878
39947
  type: OutputType.Coin,
39879
39948
  to: addressify(to).toB256(),
39880
39949
  amount,
39881
- assetId: assetId ?? this.baseAssetId
39950
+ assetId
39882
39951
  });
39883
39952
  return this;
39884
39953
  }
@@ -39905,7 +39974,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39905
39974
  * @param to - Address of the owner.
39906
39975
  * @param assetId - Asset ID of coin.
39907
39976
  */
39908
- addChangeOutput(to, assetId) {
39977
+ addChangeOutput(to, assetId = BaseAssetId) {
39909
39978
  const changeOutput = this.getChangeOutputs().find(
39910
39979
  (output3) => hexlify(output3.assetId) === assetId
39911
39980
  );
@@ -39913,7 +39982,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39913
39982
  this.pushOutput({
39914
39983
  type: OutputType.Change,
39915
39984
  to: addressify(to).toB256(),
39916
- assetId: assetId ?? this.baseAssetId
39985
+ assetId
39917
39986
  });
39918
39987
  }
39919
39988
  }
@@ -39945,7 +40014,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39945
40014
  }
39946
40015
  calculateMaxGas(chainInfo, minGas) {
39947
40016
  const { consensusParameters } = chainInfo;
39948
- const { gasPerByte } = consensusParameters;
40017
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
39949
40018
  const witnessesLength = this.toTransaction().witnesses.reduce(
39950
40019
  (acc, wit) => acc + wit.dataLength,
39951
40020
  0
@@ -39954,7 +40023,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39954
40023
  gasPerByte,
39955
40024
  minGas,
39956
40025
  witnessesLength,
39957
- witnessLimit: this.witnessLimit
40026
+ witnessLimit: this.witnessLimit,
40027
+ maxGasPerTx
39958
40028
  });
39959
40029
  }
39960
40030
  /**
@@ -39964,12 +40034,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39964
40034
  * @param quantities - CoinQuantity Array.
39965
40035
  */
39966
40036
  fundWithFakeUtxos(quantities, resourcesOwner) {
39967
- let idCounter = 0;
39968
- const generateId = () => {
39969
- const counterString = String(idCounter++);
39970
- const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString);
39971
- return id;
39972
- };
39973
40037
  const findAssetInput = (assetId) => this.inputs.find((input) => {
39974
40038
  if ("assetId" in input) {
39975
40039
  return input.assetId === assetId;
@@ -39978,24 +40042,27 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39978
40042
  });
39979
40043
  const updateAssetInput = (assetId, quantity) => {
39980
40044
  const assetInput = findAssetInput(assetId);
40045
+ let usedQuantity = quantity;
40046
+ if (assetId === BaseAssetId) {
40047
+ usedQuantity = bn("1000000000000000000");
40048
+ }
39981
40049
  if (assetInput && "assetId" in assetInput) {
39982
- assetInput.id = generateId();
39983
- assetInput.amount = quantity;
40050
+ assetInput.id = hexlify(randomBytes3(34));
40051
+ assetInput.amount = usedQuantity;
39984
40052
  } else {
39985
40053
  this.addResources([
39986
40054
  {
39987
- id: generateId(),
39988
- amount: quantity,
40055
+ id: hexlify(randomBytes3(34)),
40056
+ amount: usedQuantity,
39989
40057
  assetId,
39990
40058
  owner: resourcesOwner || Address.fromRandom(),
39991
- maturity: 0,
39992
40059
  blockCreated: bn(1),
39993
40060
  txCreatedIdx: bn(1)
39994
40061
  }
39995
40062
  ]);
39996
40063
  }
39997
40064
  };
39998
- updateAssetInput(this.baseAssetId, bn(1e11));
40065
+ updateAssetInput(BaseAssetId, bn(1e11));
39999
40066
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
40000
40067
  }
40001
40068
  /**
@@ -40020,7 +40087,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40020
40087
  toJSON() {
40021
40088
  return normalizeJSON(this);
40022
40089
  }
40023
- updatePredicateInputs(inputs) {
40090
+ updatePredicateGasUsed(inputs) {
40024
40091
  this.inputs.forEach((i) => {
40025
40092
  let correspondingInput;
40026
40093
  switch (i.type) {
@@ -40042,6 +40109,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40042
40109
  }
40043
40110
  });
40044
40111
  }
40112
+ shiftPredicateData() {
40113
+ this.inputs.forEach((input) => {
40114
+ if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
40115
+ input.predicateData = input.paddPredicateData(
40116
+ BaseTransactionRequest.getPolicyMeta(this).policies.length
40117
+ );
40118
+ }
40119
+ });
40120
+ }
40045
40121
  };
40046
40122
 
40047
40123
  // src/providers/transaction-request/hash-transaction.ts
@@ -40175,9 +40251,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40175
40251
  return {
40176
40252
  type: TransactionType.Create,
40177
40253
  ...baseTransaction,
40178
- bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
40179
40254
  bytecodeWitnessIndex,
40180
- storageSlotsCount: storageSlots.length,
40255
+ storageSlotsCount: bn(storageSlots.length),
40181
40256
  salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
40182
40257
  storageSlots
40183
40258
  };
@@ -40291,8 +40366,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40291
40366
  type: TransactionType.Script,
40292
40367
  scriptGasLimit: this.gasLimit,
40293
40368
  ...super.getBaseTransaction(),
40294
- scriptLength: script.length,
40295
- scriptDataLength: scriptData.length,
40369
+ scriptLength: bn(script.length),
40370
+ scriptDataLength: bn(scriptData.length),
40296
40371
  receiptsRoot: ZeroBytes32,
40297
40372
  script: hexlify(script),
40298
40373
  scriptData: hexlify(scriptData)
@@ -40356,7 +40431,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40356
40431
  }
40357
40432
  calculateMaxGas(chainInfo, minGas) {
40358
40433
  const { consensusParameters } = chainInfo;
40359
- const { gasPerByte } = consensusParameters;
40434
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
40360
40435
  const witnessesLength = this.toTransaction().witnesses.reduce(
40361
40436
  (acc, wit) => acc + wit.dataLength,
40362
40437
  0
@@ -40366,7 +40441,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40366
40441
  minGas,
40367
40442
  witnessesLength,
40368
40443
  witnessLimit: this.witnessLimit,
40369
- gasLimit: this.gasLimit
40444
+ gasLimit: this.gasLimit,
40445
+ maxGasPerTx
40370
40446
  });
40371
40447
  }
40372
40448
  /**
@@ -40439,13 +40515,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40439
40515
  }
40440
40516
  }
40441
40517
  };
40518
+ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40519
+ (acc, input) => {
40520
+ if (input.type === InputType.Coin && input.owner === owner) {
40521
+ acc.utxos.push(input.id);
40522
+ }
40523
+ if (input.type === InputType.Message && input.recipient === owner) {
40524
+ acc.messages.push(input.nonce);
40525
+ }
40526
+ return acc;
40527
+ },
40528
+ {
40529
+ utxos: [],
40530
+ messages: []
40531
+ }
40532
+ );
40442
40533
 
40443
40534
  // src/providers/transaction-summary/calculate-transaction-fee.ts
40444
40535
  var calculateTransactionFee = (params) => {
40445
40536
  const {
40446
- gasUsed,
40537
+ gasPrice,
40447
40538
  rawPayload,
40448
- consensusParameters: { gasCosts, feeParams }
40539
+ tip,
40540
+ consensusParameters: { gasCosts, feeParams, maxGasPerTx }
40449
40541
  } = params;
40450
40542
  const gasPerByte = bn(feeParams.gasPerByte);
40451
40543
  const gasPriceFactor = bn(feeParams.gasPriceFactor);
@@ -40455,8 +40547,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40455
40547
  return {
40456
40548
  fee: bn(0),
40457
40549
  minFee: bn(0),
40458
- maxFee: bn(0),
40459
- feeFromGasUsed: bn(0)
40550
+ maxFee: bn(0)
40460
40551
  };
40461
40552
  }
40462
40553
  const { type: type3, witnesses, inputs, policies } = transaction;
@@ -40488,7 +40579,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40488
40579
  metadataGas,
40489
40580
  txBytesSize: transactionBytes.length
40490
40581
  });
40491
- const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
40492
40582
  const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
40493
40583
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
40494
40584
  const maxGas = getMaxGas({
@@ -40496,17 +40586,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40496
40586
  minGas,
40497
40587
  witnessesLength,
40498
40588
  gasLimit,
40499
- witnessLimit
40589
+ witnessLimit,
40590
+ maxGasPerTx
40591
+ });
40592
+ const minFee = calculateGasFee({
40593
+ gasPrice,
40594
+ gas: minGas,
40595
+ priceFactor: gasPriceFactor,
40596
+ tip
40597
+ });
40598
+ const maxFee = calculateGasFee({
40599
+ gasPrice,
40600
+ gas: maxGas,
40601
+ priceFactor: gasPriceFactor,
40602
+ tip
40500
40603
  });
40501
- const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
40502
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
40503
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
40504
- const fee = minFee.add(feeFromGasUsed);
40505
40604
  return {
40506
- fee,
40507
40605
  minFee,
40508
40606
  maxFee,
40509
- feeFromGasUsed
40607
+ fee: maxFee
40510
40608
  };
40511
40609
  };
40512
40610
 
@@ -41107,7 +41205,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41107
41205
  gqlTransactionStatus,
41108
41206
  abiMap = {},
41109
41207
  maxInputs,
41110
- gasCosts
41208
+ gasCosts,
41209
+ maxGasPerTx,
41210
+ gasPrice
41111
41211
  } = params;
41112
41212
  const gasUsed = getGasUsedFromReceipts(receipts);
41113
41213
  const rawPayload = hexlify(transactionBytes);
@@ -41121,11 +41221,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41121
41221
  maxInputs
41122
41222
  });
41123
41223
  const typeName = getTransactionTypeName(transaction.type);
41224
+ const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
41124
41225
  const { fee } = calculateTransactionFee({
41125
- gasUsed,
41226
+ gasPrice,
41126
41227
  rawPayload,
41228
+ tip,
41127
41229
  consensusParameters: {
41128
41230
  gasCosts,
41231
+ maxGasPerTx,
41129
41232
  feeParams: {
41130
41233
  gasPerByte,
41131
41234
  gasPriceFactor
@@ -41261,8 +41364,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41261
41364
  const decodedTransaction = this.decodeTransaction(
41262
41365
  transaction
41263
41366
  );
41264
- const receipts = transaction.receipts?.map(processGqlReceipt) || [];
41265
- const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
41367
+ let txReceipts = [];
41368
+ if (transaction?.status && "receipts" in transaction.status) {
41369
+ txReceipts = transaction.status.receipts;
41370
+ }
41371
+ const receipts = txReceipts.map(processGqlReceipt) || [];
41372
+ const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
41373
+ const gasPrice = await this.provider.getLatestGasPrice();
41266
41374
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
41267
41375
  const transactionSummary = assembleTransactionSummary({
41268
41376
  id: this.id,
@@ -41274,7 +41382,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41274
41382
  gasPriceFactor,
41275
41383
  abiMap: contractsAbiMap,
41276
41384
  maxInputs,
41277
- gasCosts
41385
+ gasCosts,
41386
+ maxGasPerTx,
41387
+ gasPrice
41278
41388
  });
41279
41389
  return transactionSummary;
41280
41390
  }
@@ -41418,13 +41528,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41418
41528
  gasPerByte: bn(feeParams.gasPerByte),
41419
41529
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
41420
41530
  chainId: bn(consensusParameters.chainId),
41421
- baseAssetId: consensusParameters.baseAssetId,
41422
41531
  gasCosts
41423
41532
  },
41424
41533
  gasCosts,
41425
41534
  latestBlock: {
41426
41535
  id: latestBlock.id,
41427
- height: bn(latestBlock.header.height),
41536
+ height: bn(latestBlock.height),
41428
41537
  time: latestBlock.header.time,
41429
41538
  transactions: latestBlock.transactions.map((i) => ({
41430
41539
  id: i.id
@@ -41518,10 +41627,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41518
41627
  * Returns some helpful parameters related to gas fees.
41519
41628
  */
41520
41629
  getGasConfig() {
41521
- const { minGasPrice } = this.getNode();
41522
41630
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
41523
41631
  return {
41524
- minGasPrice,
41525
41632
  maxGasPerTx,
41526
41633
  maxGasPerPredicate,
41527
41634
  gasPriceFactor,
@@ -41619,7 +41726,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41619
41726
  */
41620
41727
  async getBlockNumber() {
41621
41728
  const { chain } = await this.operations.getChain();
41622
- return bn(chain.latestBlock.header.height, 10);
41729
+ return bn(chain.latestBlock.height, 10);
41623
41730
  }
41624
41731
  /**
41625
41732
  * Returns the chain information.
@@ -41631,11 +41738,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41631
41738
  const processedNodeInfo = {
41632
41739
  maxDepth: bn(nodeInfo.maxDepth),
41633
41740
  maxTx: bn(nodeInfo.maxTx),
41634
- minGasPrice: bn(nodeInfo.minGasPrice),
41635
41741
  nodeVersion: nodeInfo.nodeVersion,
41636
41742
  utxoValidation: nodeInfo.utxoValidation,
41637
- vmBacktrace: nodeInfo.vmBacktrace,
41638
- peers: nodeInfo.peers
41743
+ vmBacktrace: nodeInfo.vmBacktrace
41639
41744
  };
41640
41745
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
41641
41746
  return processedNodeInfo;
@@ -41661,17 +41766,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41661
41766
  } = this.getChain();
41662
41767
  return chainId.toNumber();
41663
41768
  }
41664
- /**
41665
- * Returns the base asset ID
41666
- *
41667
- * @returns A promise that resolves to the base asset ID
41668
- */
41669
- getBaseAssetId() {
41670
- const {
41671
- consensusParameters: { baseAssetId }
41672
- } = this.getChain();
41673
- return baseAssetId;
41674
- }
41675
41769
  /**
41676
41770
  * Submits a transaction to the chain to be executed.
41677
41771
  *
@@ -41732,14 +41826,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41732
41826
  return this.estimateTxDependencies(transactionRequest);
41733
41827
  }
41734
41828
  const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41735
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
41736
- encodedTransaction,
41829
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41830
+ encodedTransactions: encodedTransaction,
41737
41831
  utxoValidation: utxoValidation || false
41738
41832
  });
41739
- const receipts = gqlReceipts.map(processGqlReceipt);
41740
- return {
41741
- receipts
41742
- };
41833
+ const [{ receipts: rawReceipts, status }] = dryRunStatuses;
41834
+ const receipts = rawReceipts.map(processGqlReceipt);
41835
+ return { receipts, dryrunStatus: status };
41743
41836
  }
41744
41837
  /**
41745
41838
  * Verifies whether enough gas is available to complete transaction.
@@ -41778,9 +41871,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41778
41871
  * If there are missing variable outputs,
41779
41872
  * `addVariableOutputs` is called on the transaction.
41780
41873
  *
41781
- * @privateRemarks
41782
- * TODO: Investigate support for missing contract IDs
41783
- * TODO: Add support for missing output messages
41784
41874
  *
41785
41875
  * @param transactionRequest - The transaction request object.
41786
41876
  * @returns A promise.
@@ -41793,16 +41883,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41793
41883
  missingContractIds: []
41794
41884
  };
41795
41885
  }
41796
- await this.estimatePredicates(transactionRequest);
41797
41886
  let receipts = [];
41798
41887
  const missingContractIds = [];
41799
41888
  let outputVariables = 0;
41889
+ let dryrunStatus;
41800
41890
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
41801
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
41802
- encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
41891
+ const {
41892
+ dryRun: [{ receipts: rawReceipts, status }]
41893
+ } = await this.operations.dryRun({
41894
+ encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
41803
41895
  utxoValidation: false
41804
41896
  });
41805
- receipts = gqlReceipts.map(processGqlReceipt);
41897
+ receipts = rawReceipts.map(processGqlReceipt);
41898
+ dryrunStatus = status;
41806
41899
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
41807
41900
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
41808
41901
  if (hasMissingOutputs) {
@@ -41812,6 +41905,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41812
41905
  transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
41813
41906
  missingContractIds.push(contractId);
41814
41907
  });
41908
+ const { maxFee } = await this.estimateTxGasAndFee({
41909
+ transactionRequest,
41910
+ optimizeGas: false
41911
+ });
41912
+ transactionRequest.maxFee = maxFee;
41815
41913
  } else {
41816
41914
  break;
41817
41915
  }
@@ -41819,7 +41917,133 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41819
41917
  return {
41820
41918
  receipts,
41821
41919
  outputVariables,
41822
- missingContractIds
41920
+ missingContractIds,
41921
+ dryrunStatus
41922
+ };
41923
+ }
41924
+ /**
41925
+ * Dry runs multiple transactions and checks for missing dependencies in batches.
41926
+ *
41927
+ * Transactions are dry run in batches. After each dry run, transactions requiring
41928
+ * further modifications are identified. The method iteratively updates these transactions
41929
+ * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
41930
+ *
41931
+ * @param transactionRequests - Array of transaction request objects.
41932
+ * @returns A promise that resolves to an array of results for each transaction.
41933
+ */
41934
+ async estimateMultipleTxDependencies(transactionRequests) {
41935
+ const results = transactionRequests.map(() => ({
41936
+ receipts: [],
41937
+ outputVariables: 0,
41938
+ missingContractIds: [],
41939
+ dryrunStatus: void 0
41940
+ }));
41941
+ const allRequests = clone_default(transactionRequests);
41942
+ const serializedTransactionsMap = /* @__PURE__ */ new Map();
41943
+ allRequests.forEach((req, index) => {
41944
+ if (req.type === TransactionType.Script) {
41945
+ serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
41946
+ }
41947
+ });
41948
+ let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
41949
+ let attempt = 0;
41950
+ while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
41951
+ const encodedTransactions = transactionsToProcess.map(
41952
+ (index) => serializedTransactionsMap.get(index)
41953
+ );
41954
+ const dryRunResults = await this.operations.dryRun({
41955
+ encodedTransactions,
41956
+ utxoValidation: false
41957
+ });
41958
+ const nextRoundTransactions = [];
41959
+ for (let i = 0; i < dryRunResults.dryRun.length; i++) {
41960
+ const currentResultIndex = transactionsToProcess[i];
41961
+ const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
41962
+ results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
41963
+ results[currentResultIndex].dryrunStatus = status;
41964
+ const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
41965
+ results[currentResultIndex].receipts
41966
+ );
41967
+ const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
41968
+ const requestToProcess = allRequests[currentResultIndex];
41969
+ if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
41970
+ results[currentResultIndex].outputVariables += missingOutputVariables.length;
41971
+ requestToProcess.addVariableOutputs(missingOutputVariables.length);
41972
+ missingOutputContractIds.forEach(({ contractId }) => {
41973
+ requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
41974
+ results[currentResultIndex].missingContractIds.push(contractId);
41975
+ });
41976
+ const { maxFee } = await this.estimateTxGasAndFee({
41977
+ transactionRequest: requestToProcess,
41978
+ optimizeGas: false
41979
+ });
41980
+ requestToProcess.maxFee = maxFee;
41981
+ serializedTransactionsMap.set(
41982
+ currentResultIndex,
41983
+ hexlify(requestToProcess.toTransactionBytes())
41984
+ );
41985
+ nextRoundTransactions.push(currentResultIndex);
41986
+ allRequests[currentResultIndex] = requestToProcess;
41987
+ }
41988
+ }
41989
+ transactionsToProcess = nextRoundTransactions;
41990
+ attempt += 1;
41991
+ }
41992
+ return results;
41993
+ }
41994
+ async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
41995
+ if (estimateTxDependencies) {
41996
+ return this.estimateMultipleTxDependencies(transactionRequests);
41997
+ }
41998
+ const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
41999
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42000
+ encodedTransactions,
42001
+ utxoValidation: utxoValidation || false
42002
+ });
42003
+ const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
42004
+ const receipts = rawReceipts.map(processGqlReceipt);
42005
+ return { receipts, dryrunStatus: status };
42006
+ });
42007
+ return results;
42008
+ }
42009
+ async estimateTxGasAndFee(params) {
42010
+ const { transactionRequest, optimizeGas = true } = params;
42011
+ let { gasPrice } = params;
42012
+ const chainInfo = this.getChain();
42013
+ const { gasPriceFactor } = this.getGasConfig();
42014
+ const minGas = transactionRequest.calculateMinGas(chainInfo);
42015
+ if (!gasPrice) {
42016
+ gasPrice = await this.estimateGasPrice(10);
42017
+ }
42018
+ const minFee = calculateGasFee({
42019
+ gasPrice: bn(gasPrice),
42020
+ gas: minGas,
42021
+ priceFactor: gasPriceFactor,
42022
+ tip: transactionRequest.tip
42023
+ }).add(1);
42024
+ let gasLimit = bn(0);
42025
+ if (transactionRequest.type === TransactionType.Script) {
42026
+ gasLimit = transactionRequest.gasLimit;
42027
+ if (!optimizeGas) {
42028
+ transactionRequest.gasLimit = minGas;
42029
+ gasLimit = transactionRequest.calculateMaxGas(chainInfo, minGas);
42030
+ transactionRequest.gasLimit = gasLimit;
42031
+ }
42032
+ }
42033
+ const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
42034
+ const maxFee = calculateGasFee({
42035
+ gasPrice: bn(gasPrice),
42036
+ gas: maxGas,
42037
+ priceFactor: gasPriceFactor,
42038
+ tip: transactionRequest.tip
42039
+ }).add(1);
42040
+ return {
42041
+ minGas,
42042
+ minFee,
42043
+ maxGas,
42044
+ maxFee,
42045
+ gasPrice,
42046
+ gasLimit
41823
42047
  };
41824
42048
  }
41825
42049
  /**
@@ -41837,15 +42061,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41837
42061
  if (estimateTxDependencies) {
41838
42062
  return this.estimateTxDependencies(transactionRequest);
41839
42063
  }
41840
- const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41841
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
41842
- encodedTransaction,
42064
+ const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
42065
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42066
+ encodedTransactions,
41843
42067
  utxoValidation: true
41844
42068
  });
41845
- const receipts = gqlReceipts.map(processGqlReceipt);
41846
- return {
41847
- receipts
41848
- };
42069
+ const callResult = dryRunStatuses.map((dryRunStatus) => {
42070
+ const { id, receipts, status } = dryRunStatus;
42071
+ const processedReceipts = receipts.map(processGqlReceipt);
42072
+ return { id, receipts: processedReceipts, status };
42073
+ });
42074
+ return { receipts: callResult[0].receipts };
41849
42075
  }
41850
42076
  /**
41851
42077
  * Returns a transaction cost to enable user
@@ -41862,80 +42088,80 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41862
42088
  * @param tolerance - The tolerance to add on top of the gasUsed.
41863
42089
  * @returns A promise that resolves to the transaction cost object.
41864
42090
  */
41865
- async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
41866
- estimateTxDependencies = true,
41867
- estimatePredicates = true,
41868
- resourcesOwner,
41869
- signatureCallback
41870
- } = {}) {
42091
+ async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
41871
42092
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
41872
- const chainInfo = this.getChain();
41873
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
41874
- const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
41875
42093
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
41876
42094
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
41877
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
42095
+ const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
41878
42096
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
41879
- if (estimatePredicates) {
41880
- if (isScriptTransaction) {
41881
- txRequestClone.gasLimit = bn(0);
41882
- }
41883
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
41884
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
41885
- }
41886
- await this.estimatePredicates(txRequestClone);
42097
+ txRequestClone.maxFee = bn(0);
42098
+ if (isScriptTransaction) {
42099
+ txRequestClone.gasLimit = bn(0);
41887
42100
  }
41888
- if (signatureCallback && isScriptTransaction) {
41889
- await signatureCallback(txRequestClone);
42101
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
42102
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
41890
42103
  }
41891
- const minGas = txRequestClone.calculateMinGas(chainInfo);
41892
- const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
42104
+ const signedRequest = clone_default(txRequestClone);
42105
+ let addedSignatures = 0;
42106
+ if (signatureCallback && isScriptTransaction) {
42107
+ const lengthBefore = signedRequest.witnesses.length;
42108
+ await signatureCallback(signedRequest);
42109
+ addedSignatures = signedRequest.witnesses.length - lengthBefore;
42110
+ }
42111
+ await this.estimatePredicates(signedRequest);
42112
+ let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
42113
+ transactionRequest: signedRequest,
42114
+ optimizeGas: false
42115
+ });
42116
+ txRequestClone.maxFee = maxFee;
41893
42117
  let receipts = [];
41894
42118
  let missingContractIds = [];
41895
42119
  let outputVariables = 0;
41896
- if (isScriptTransaction && estimateTxDependencies) {
41897
- txRequestClone.gasPrice = bn(0);
41898
- txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
42120
+ let gasUsed = bn(0);
42121
+ txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
42122
+ if (isScriptTransaction) {
42123
+ if (signatureCallback) {
42124
+ await signatureCallback(txRequestClone);
42125
+ }
42126
+ txRequestClone.gasLimit = gasLimit;
41899
42127
  const result = await this.estimateTxDependencies(txRequestClone);
41900
42128
  receipts = result.receipts;
41901
42129
  outputVariables = result.outputVariables;
41902
42130
  missingContractIds = result.missingContractIds;
42131
+ gasUsed = getGasUsedFromReceipts(receipts);
42132
+ txRequestClone.gasLimit = gasUsed;
42133
+ ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
42134
+ transactionRequest: txRequestClone,
42135
+ gasPrice
42136
+ }));
41903
42137
  }
41904
- const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
41905
- const usedFee = calculatePriceWithFactor(
41906
- gasUsed,
41907
- gasPrice,
41908
- gasPriceFactor
41909
- ).normalizeZeroToOne();
41910
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
41911
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
41912
42138
  return {
41913
42139
  requiredQuantities: allQuantities,
41914
42140
  receipts,
41915
42141
  gasUsed,
41916
- minGasPrice,
41917
42142
  gasPrice,
41918
42143
  minGas,
41919
42144
  maxGas,
41920
- usedFee,
41921
42145
  minFee,
41922
42146
  maxFee,
41923
- estimatedInputs: txRequestClone.inputs,
41924
42147
  outputVariables,
41925
- missingContractIds
42148
+ missingContractIds,
42149
+ addedSignatures,
42150
+ estimatedPredicates: txRequestClone.inputs
41926
42151
  };
41927
42152
  }
41928
- async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
42153
+ async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
41929
42154
  const ownerAddress = Address.fromAddressOrString(owner);
41930
42155
  const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
41931
- const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
42156
+ const transactionCost = await this.getTransactionCost(transactionRequest, {
42157
+ quantitiesToContract
42158
+ });
41932
42159
  transactionRequest.addResources(
41933
42160
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
41934
42161
  );
41935
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(
41936
- transactionRequest,
41937
- forwardingQuantities
41938
- );
42162
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
42163
+ quantitiesToContract
42164
+ });
41939
42165
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
41940
42166
  return {
41941
42167
  resources,
@@ -41959,7 +42185,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41959
42185
  assetId: coin.assetId,
41960
42186
  amount: bn(coin.amount),
41961
42187
  owner: Address.fromAddressOrString(coin.owner),
41962
- maturity: bn(coin.maturity).toNumber(),
41963
42188
  blockCreated: bn(coin.blockCreated),
41964
42189
  txCreatedIdx: bn(coin.txCreatedIdx)
41965
42190
  }));
@@ -42011,7 +42236,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42011
42236
  amount: bn(coin.amount),
42012
42237
  assetId: coin.assetId,
42013
42238
  owner: Address.fromAddressOrString(coin.owner),
42014
- maturity: bn(coin.maturity).toNumber(),
42015
42239
  blockCreated: bn(coin.blockCreated),
42016
42240
  txCreatedIdx: bn(coin.txCreatedIdx)
42017
42241
  };
@@ -42044,7 +42268,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42044
42268
  }
42045
42269
  return {
42046
42270
  id: block2.id,
42047
- height: bn(block2.header.height),
42271
+ height: bn(block2.height),
42048
42272
  time: block2.header.time,
42049
42273
  transactionIds: block2.transactions.map((tx) => tx.id)
42050
42274
  };
@@ -42059,7 +42283,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42059
42283
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
42060
42284
  const blocks = fetchedData.edges.map(({ node: block2 }) => ({
42061
42285
  id: block2.id,
42062
- height: bn(block2.header.height),
42286
+ height: bn(block2.height),
42063
42287
  time: block2.header.time,
42064
42288
  transactionIds: block2.transactions.map((tx) => tx.id)
42065
42289
  }));
@@ -42086,7 +42310,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42086
42310
  }
42087
42311
  return {
42088
42312
  id: block2.id,
42089
- height: bn(block2.header.height, 10),
42313
+ height: bn(block2.height, 10),
42090
42314
  time: block2.header.time,
42091
42315
  transactionIds: block2.transactions.map((tx) => tx.id),
42092
42316
  transactions: block2.transactions.map(
@@ -42266,7 +42490,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42266
42490
  prevRoot: messageBlockHeader.prevRoot,
42267
42491
  time: messageBlockHeader.time,
42268
42492
  applicationHash: messageBlockHeader.applicationHash,
42269
- messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
42270
42493
  messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
42271
42494
  },
42272
42495
  commitBlockHeader: {
@@ -42278,7 +42501,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42278
42501
  prevRoot: commitBlockHeader.prevRoot,
42279
42502
  time: commitBlockHeader.time,
42280
42503
  applicationHash: commitBlockHeader.applicationHash,
42281
- messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
42282
42504
  messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
42283
42505
  },
42284
42506
  sender: Address.fromAddressOrString(sender),
@@ -42288,6 +42510,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42288
42510
  data
42289
42511
  };
42290
42512
  }
42513
+ async getLatestGasPrice() {
42514
+ const { latestGasPrice } = await this.operations.getLatestGasPrice();
42515
+ return bn(latestGasPrice.gasPrice);
42516
+ }
42517
+ async estimateGasPrice(blockHorizon) {
42518
+ const { estimateGasPrice } = await this.operations.estimateGasPrice({
42519
+ blockHorizon: String(blockHorizon)
42520
+ });
42521
+ return bn(estimateGasPrice.gasPrice);
42522
+ }
42291
42523
  /**
42292
42524
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
42293
42525
  *
@@ -42348,10 +42580,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42348
42580
  arrayify(gqlTransaction.rawPayload),
42349
42581
  0
42350
42582
  );
42351
- const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
42583
+ let txReceipts = [];
42584
+ if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42585
+ txReceipts = gqlTransaction.status.receipts;
42586
+ }
42587
+ const receipts = txReceipts.map(processGqlReceipt);
42352
42588
  const {
42353
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42589
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42354
42590
  } = provider.getChain();
42591
+ const gasPrice = await provider.getLatestGasPrice();
42355
42592
  const transactionInfo = assembleTransactionSummary({
42356
42593
  id: gqlTransaction.id,
42357
42594
  receipts,
@@ -42362,7 +42599,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42362
42599
  gasPriceFactor: bn(gasPriceFactor),
42363
42600
  abiMap,
42364
42601
  maxInputs,
42365
- gasCosts
42602
+ gasCosts,
42603
+ maxGasPerTx,
42604
+ gasPrice
42366
42605
  });
42367
42606
  return {
42368
42607
  gqlTransaction,
@@ -42372,10 +42611,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42372
42611
  async function getTransactionSummaryFromRequest(params) {
42373
42612
  const { provider, transactionRequest, abiMap } = params;
42374
42613
  const { receipts } = await provider.call(transactionRequest);
42375
- const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
42614
+ const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
42376
42615
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
42377
42616
  const transaction = transactionRequest.toTransaction();
42378
42617
  const transactionBytes = transactionRequest.toTransactionBytes();
42618
+ const gasPrice = await provider.getLatestGasPrice();
42379
42619
  const transactionSummary = assembleTransactionSummary({
42380
42620
  receipts,
42381
42621
  transaction,
@@ -42384,7 +42624,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42384
42624
  gasPerByte,
42385
42625
  gasPriceFactor,
42386
42626
  maxInputs,
42387
- gasCosts
42627
+ gasCosts,
42628
+ maxGasPerTx,
42629
+ gasPrice
42388
42630
  });
42389
42631
  return transactionSummary;
42390
42632
  }
@@ -42393,13 +42635,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42393
42635
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
42394
42636
  const { edges, pageInfo } = transactionsByOwner;
42395
42637
  const {
42396
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42638
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42397
42639
  } = provider.getChain();
42640
+ const gasPrice = await provider.getLatestGasPrice();
42398
42641
  const transactions = edges.map((edge) => {
42399
42642
  const { node: gqlTransaction } = edge;
42400
- const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
42643
+ const { id, rawPayload, status } = gqlTransaction;
42401
42644
  const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
42402
- const receipts = gqlReceipts?.map(processGqlReceipt) || [];
42645
+ let txReceipts = [];
42646
+ if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42647
+ txReceipts = gqlTransaction.status.receipts;
42648
+ }
42649
+ const receipts = txReceipts.map(processGqlReceipt);
42403
42650
  const transactionSummary = assembleTransactionSummary({
42404
42651
  id,
42405
42652
  receipts,
@@ -42410,7 +42657,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42410
42657
  gasPerByte,
42411
42658
  gasPriceFactor,
42412
42659
  maxInputs,
42413
- gasCosts
42660
+ gasCosts,
42661
+ maxGasPerTx,
42662
+ gasPrice
42414
42663
  });
42415
42664
  const output3 = {
42416
42665
  gqlTransaction,
@@ -42701,9 +42950,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42701
42950
  * @param assetId - The asset ID to check the balance for.
42702
42951
  * @returns A promise that resolves to the balance amount.
42703
42952
  */
42704
- async getBalance(assetId) {
42705
- const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
42706
- const amount = await this.provider.getBalance(this.address, assetIdToFetch);
42953
+ async getBalance(assetId = BaseAssetId) {
42954
+ const amount = await this.provider.getBalance(this.address, assetId);
42707
42955
  return amount;
42708
42956
  }
42709
42957
  /**
@@ -42740,37 +42988,33 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42740
42988
  * @param fee - The estimated transaction fee.
42741
42989
  * @returns A promise that resolves when the resources are added to the transaction.
42742
42990
  */
42743
- async fund(request, coinQuantities, fee) {
42744
- const baseAssetId = this.provider.getBaseAssetId();
42745
- const updatedQuantities = addAmountToAsset({
42991
+ async fund(request, params) {
42992
+ const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
42993
+ const txRequest = request;
42994
+ const requiredQuantitiesWithFee = addAmountToCoinQuantities({
42746
42995
  amount: bn(fee),
42747
- assetId: baseAssetId,
42748
- coinQuantities
42996
+ assetId: BaseAssetId,
42997
+ coinQuantities: requiredQuantities
42749
42998
  });
42750
42999
  const quantitiesDict = {};
42751
- updatedQuantities.forEach(({ amount, assetId }) => {
43000
+ requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
42752
43001
  quantitiesDict[assetId] = {
42753
43002
  required: amount,
42754
43003
  owned: bn(0)
42755
43004
  };
42756
43005
  });
42757
- const cachedUtxos = [];
42758
- const cachedMessages = [];
42759
- const owner = this.address.toB256();
42760
- request.inputs.forEach((input) => {
43006
+ txRequest.inputs.forEach((input) => {
42761
43007
  const isResource = "amount" in input;
42762
43008
  if (isResource) {
42763
43009
  const isCoin2 = "owner" in input;
42764
43010
  if (isCoin2) {
42765
43011
  const assetId = String(input.assetId);
42766
- if (input.owner === owner && quantitiesDict[assetId]) {
43012
+ if (quantitiesDict[assetId]) {
42767
43013
  const amount = bn(input.amount);
42768
43014
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42769
- cachedUtxos.push(input.id);
42770
43015
  }
42771
- } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
42772
- quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
42773
- cachedMessages.push(input.nonce);
43016
+ } else if (input.amount && quantitiesDict[BaseAssetId]) {
43017
+ quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42774
43018
  }
42775
43019
  }
42776
43020
  });
@@ -42785,12 +43029,23 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42785
43029
  });
42786
43030
  const needsToBeFunded = missingQuantities.length;
42787
43031
  if (needsToBeFunded) {
42788
- const resources = await this.getResourcesToSpend(missingQuantities, {
42789
- messages: cachedMessages,
42790
- utxos: cachedUtxos
42791
- });
42792
- request.addResources(resources);
43032
+ const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
43033
+ const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
43034
+ txRequest.addResources(resources);
43035
+ }
43036
+ txRequest.shiftPredicateData();
43037
+ txRequest.updatePredicateGasUsed(estimatedPredicates);
43038
+ const requestToBeReEstimate = clone_default(txRequest);
43039
+ if (addedSignatures) {
43040
+ Array.from({ length: addedSignatures }).forEach(
43041
+ () => requestToBeReEstimate.addEmptyWitness()
43042
+ );
42793
43043
  }
43044
+ const { maxFee } = await this.provider.estimateTxGasAndFee({
43045
+ transactionRequest: requestToBeReEstimate
43046
+ });
43047
+ txRequest.maxFee = maxFee;
43048
+ return txRequest;
42794
43049
  }
42795
43050
  /**
42796
43051
  * A helper that creates a transfer transaction request and returns it.
@@ -42798,29 +43053,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42798
43053
  * @param destination - The address of the destination.
42799
43054
  * @param amount - The amount of coins to transfer.
42800
43055
  * @param assetId - The asset ID of the coins to transfer.
42801
- * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43056
+ * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
42802
43057
  * @returns A promise that resolves to the prepared transaction request.
42803
43058
  */
42804
- async createTransfer(destination, amount, assetId, txParams = {}) {
42805
- const { minGasPrice } = this.provider.getGasConfig();
42806
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42807
- const params = { gasPrice: minGasPrice, ...txParams };
42808
- const request = new ScriptTransactionRequest(params);
42809
- request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
42810
- const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
43059
+ async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
43060
+ const request = new ScriptTransactionRequest(txParams);
43061
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
43062
+ const txCost = await this.provider.getTransactionCost(request, {
42811
43063
  estimateTxDependencies: true,
42812
43064
  resourcesOwner: this
42813
43065
  });
42814
- request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
42815
- request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
42816
- this.validateGas({
42817
- gasUsed,
42818
- gasPrice: request.gasPrice,
42819
- gasLimit: request.gasLimit,
42820
- minGasPrice
42821
- });
42822
- await this.fund(request, requiredQuantities, maxFee);
42823
- request.updatePredicateInputs(estimatedInputs);
43066
+ if ("gasLimit" in txParams) {
43067
+ this.validateGas({
43068
+ gasUsed: txCost.gasUsed,
43069
+ gasLimit: request.gasLimit
43070
+ });
43071
+ }
43072
+ request.gasLimit = txCost.gasUsed;
43073
+ request.maxFee = txCost.maxFee;
43074
+ await this.fund(request, txCost);
42824
43075
  return request;
42825
43076
  }
42826
43077
  /**
@@ -42832,15 +43083,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42832
43083
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
42833
43084
  * @returns A promise that resolves to the transaction response.
42834
43085
  */
42835
- async transfer(destination, amount, assetId, txParams = {}) {
43086
+ async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
42836
43087
  if (bn(amount).lte(0)) {
42837
43088
  throw new FuelError(
42838
43089
  ErrorCode.INVALID_TRANSFER_AMOUNT,
42839
43090
  "Transfer amount must be a positive number."
42840
43091
  );
42841
43092
  }
42842
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42843
- const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
43093
+ const request = await this.createTransfer(destination, amount, assetId, txParams);
42844
43094
  return this.sendTransaction(request, { estimateTxDependencies: false });
42845
43095
  }
42846
43096
  /**
@@ -42852,7 +43102,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42852
43102
  * @param txParams - The optional transaction parameters.
42853
43103
  * @returns A promise that resolves to the transaction response.
42854
43104
  */
42855
- async transferToContract(contractId, amount, assetId, txParams = {}) {
43105
+ async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
42856
43106
  if (bn(amount).lte(0)) {
42857
43107
  throw new FuelError(
42858
43108
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -42860,32 +43110,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42860
43110
  );
42861
43111
  }
42862
43112
  const contractAddress = Address.fromAddressOrString(contractId);
42863
- const { minGasPrice } = this.provider.getGasConfig();
42864
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42865
- const params = { gasPrice: minGasPrice, ...txParams };
42866
43113
  const { script, scriptData } = await assembleTransferToContractScript({
42867
43114
  hexlifiedContractId: contractAddress.toB256(),
42868
43115
  amountToTransfer: bn(amount),
42869
- assetId: assetIdToTransfer
43116
+ assetId
42870
43117
  });
42871
43118
  const request = new ScriptTransactionRequest({
42872
- ...params,
43119
+ ...txParams,
42873
43120
  script,
42874
43121
  scriptData
42875
43122
  });
42876
43123
  request.addContractInputAndOutput(contractAddress);
42877
- const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
42878
- request,
42879
- [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
42880
- );
42881
- request.gasLimit = bn(params.gasLimit ?? gasUsed);
42882
- this.validateGas({
42883
- gasUsed,
42884
- gasPrice: request.gasPrice,
42885
- gasLimit: request.gasLimit,
42886
- minGasPrice
43124
+ const txCost = await this.provider.getTransactionCost(request, {
43125
+ resourcesOwner: this,
43126
+ quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
42887
43127
  });
42888
- await this.fund(request, requiredQuantities, maxFee);
43128
+ if (txParams.gasLimit) {
43129
+ this.validateGas({
43130
+ gasUsed: txCost.gasUsed,
43131
+ gasLimit: request.gasLimit
43132
+ });
43133
+ }
43134
+ request.gasLimit = txCost.gasUsed;
43135
+ request.maxFee = txCost.maxFee;
43136
+ await this.fund(request, txCost);
42889
43137
  return this.sendTransaction(request);
42890
43138
  }
42891
43139
  /**
@@ -42897,8 +43145,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42897
43145
  * @returns A promise that resolves to the transaction response.
42898
43146
  */
42899
43147
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42900
- const { minGasPrice } = this.provider.getGasConfig();
42901
- const baseAssetId = this.provider.getBaseAssetId();
42902
43148
  const recipientAddress = Address.fromAddressOrString(recipient);
42903
43149
  const recipientDataArray = arrayify(
42904
43150
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -42911,21 +43157,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42911
43157
  ...recipientDataArray,
42912
43158
  ...amountDataArray
42913
43159
  ]);
42914
- const params = { script, gasPrice: minGasPrice, ...txParams };
43160
+ const params = { script, ...txParams };
42915
43161
  const request = new ScriptTransactionRequest(params);
42916
- const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
42917
- const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
42918
- request,
42919
- forwardingQuantities
42920
- );
42921
- request.gasLimit = bn(params.gasLimit ?? gasUsed);
42922
- this.validateGas({
42923
- gasUsed,
42924
- gasPrice: request.gasPrice,
42925
- gasLimit: request.gasLimit,
42926
- minGasPrice
42927
- });
42928
- await this.fund(request, requiredQuantities, maxFee);
43162
+ const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
43163
+ const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
43164
+ if (txParams.gasLimit) {
43165
+ this.validateGas({
43166
+ gasUsed: txCost.gasUsed,
43167
+ gasLimit: request.gasLimit
43168
+ });
43169
+ }
43170
+ request.maxFee = txCost.maxFee;
43171
+ request.gasLimit = txCost.gasUsed;
43172
+ await this.fund(request, txCost);
42929
43173
  return this.sendTransaction(request);
42930
43174
  }
42931
43175
  async signMessage(message) {
@@ -42983,18 +43227,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42983
43227
  }
42984
43228
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
42985
43229
  }
42986
- validateGas({
42987
- gasUsed,
42988
- gasPrice,
42989
- gasLimit,
42990
- minGasPrice
42991
- }) {
42992
- if (minGasPrice.gt(gasPrice)) {
42993
- throw new FuelError(
42994
- ErrorCode.GAS_PRICE_TOO_LOW,
42995
- `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
42996
- );
42997
- }
43230
+ validateGas({ gasUsed, gasLimit }) {
42998
43231
  if (gasUsed.gt(gasLimit)) {
42999
43232
  throw new FuelError(
43000
43233
  ErrorCode.GAS_LIMIT_TOO_LOW,
@@ -44377,12 +44610,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44377
44610
  };
44378
44611
 
44379
44612
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
44380
- var import_crypto15 = __toESM(__require("crypto"));
44613
+ var import_crypto16 = __toESM(__require("crypto"));
44381
44614
  var rnds8Pool = new Uint8Array(256);
44382
44615
  var poolPtr = rnds8Pool.length;
44383
44616
  function rng() {
44384
44617
  if (poolPtr > rnds8Pool.length - 16) {
44385
- import_crypto15.default.randomFillSync(rnds8Pool);
44618
+ import_crypto16.default.randomFillSync(rnds8Pool);
44386
44619
  poolPtr = 0;
44387
44620
  }
44388
44621
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -44398,9 +44631,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44398
44631
  }
44399
44632
 
44400
44633
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
44401
- var import_crypto16 = __toESM(__require("crypto"));
44634
+ var import_crypto17 = __toESM(__require("crypto"));
44402
44635
  var native_default = {
44403
- randomUUID: import_crypto16.default.randomUUID
44636
+ randomUUID: import_crypto17.default.randomUUID
44404
44637
  };
44405
44638
 
44406
44639
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
@@ -44583,7 +44816,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44583
44816
  * @param transactionRequestLike - The transaction request to send.
44584
44817
  * @returns A promise that resolves to the TransactionResponse object.
44585
44818
  */
44586
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
44819
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
44587
44820
  const transactionRequest = transactionRequestify(transactionRequestLike);
44588
44821
  if (estimateTxDependencies) {
44589
44822
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -47849,6 +48082,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47849
48082
  this.interface = predicateInterface;
47850
48083
  if (inputData !== void 0 && inputData.length > 0) {
47851
48084
  this.predicateData = inputData;
48085
+ this.predicateDataBytes = this.getPredicateData(0);
47852
48086
  }
47853
48087
  }
47854
48088
  /**
@@ -47862,8 +48096,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47862
48096
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
47863
48097
  request.inputs?.forEach((input) => {
47864
48098
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
47865
- input.predicate = this.bytes;
47866
- input.predicateData = this.getPredicateData(policies.length);
48099
+ input.predicate = hexlify(this.bytes);
48100
+ input.predicateData = hexlify(this.getPredicateData(policies.length));
47867
48101
  }
47868
48102
  });
47869
48103
  return request;
@@ -47877,10 +48111,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47877
48111
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
47878
48112
  * @returns A promise that resolves to the prepared transaction request.
47879
48113
  */
47880
- async createTransfer(destination, amount, assetId, txParams = {}) {
47881
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
47882
- const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
47883
- return this.populateTransactionPredicateData(request);
48114
+ async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
48115
+ return super.createTransfer(destination, amount, assetId, txParams);
47884
48116
  }
47885
48117
  /**
47886
48118
  * Sends a transaction with the populated predicate data.
@@ -47888,9 +48120,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47888
48120
  * @param transactionRequestLike - The transaction request-like object.
47889
48121
  * @returns A promise that resolves to the transaction response.
47890
48122
  */
47891
- sendTransaction(transactionRequestLike, options) {
47892
- const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47893
- return super.sendTransaction(transactionRequest, options);
48123
+ sendTransaction(transactionRequestLike) {
48124
+ const transactionRequest = transactionRequestify(transactionRequestLike);
48125
+ return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
47894
48126
  }
47895
48127
  /**
47896
48128
  * Simulates a transaction with the populated predicate data.
@@ -47899,8 +48131,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47899
48131
  * @returns A promise that resolves to the call result.
47900
48132
  */
47901
48133
  simulateTransaction(transactionRequestLike) {
47902
- const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47903
- return super.simulateTransaction(transactionRequest);
48134
+ const transactionRequest = transactionRequestify(transactionRequestLike);
48135
+ return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
47904
48136
  }
47905
48137
  getPredicateData(policiesLength) {
47906
48138
  if (!this.predicateData.length) {
@@ -47946,6 +48178,26 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47946
48178
  predicateInterface: abiInterface
47947
48179
  };
47948
48180
  }
48181
+ /**
48182
+ * Retrieves resources satisfying the spend query for the account.
48183
+ *
48184
+ * @param quantities - IDs of coins to exclude.
48185
+ * @param excludedIds - IDs of resources to be excluded from the query.
48186
+ * @returns A promise that resolves to an array of Resources.
48187
+ */
48188
+ async getResourcesToSpend(quantities, excludedIds) {
48189
+ const resources = await this.provider.getResourcesToSpend(
48190
+ this.address,
48191
+ quantities,
48192
+ excludedIds
48193
+ );
48194
+ return resources.map((resource) => ({
48195
+ ...resource,
48196
+ predicate: hexlify(this.bytes),
48197
+ predicateData: hexlify(this.predicateDataBytes),
48198
+ paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
48199
+ }));
48200
+ }
47949
48201
  /**
47950
48202
  * Sets the configurable constants for the predicate.
47951
48203
  *