@fuel-ts/account 0.0.0-rc-1976-20240406124842 → 0.0.0-rc-2021-20240408141516

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 +865 -615
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +845 -609
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +687 -452
  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 +1580 -1116
  48. package/dist/test-utils.global.js.map +1 -1
  49. package/dist/test-utils.js +821 -606
  50. package/dist/test-utils.js.map +1 -1
  51. package/dist/test-utils.mjs +679 -464
  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,6 +31292,10 @@ 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;
@@ -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
  },
@@ -38861,9 +38943,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38861
38943
  }
38862
38944
  };
38863
38945
 
38864
- // ../address/dist/configs.mjs
38865
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
38866
-
38867
38946
  // src/providers/transaction-request/input.ts
38868
38947
  var inputify = (value) => {
38869
38948
  const { type: type3 } = value;
@@ -38874,7 +38953,7 @@ ${MessageCoinFragmentFragmentDoc}`;
38874
38953
  return {
38875
38954
  type: InputType.Coin,
38876
38955
  txID: hexlify(arrayify(value.id).slice(0, 32)),
38877
- outputIndex: arrayify(value.id)[32],
38956
+ outputIndex: toNumber2(arrayify(value.id).slice(32, 34)),
38878
38957
  owner: hexlify(value.owner),
38879
38958
  amount: bn(value.amount),
38880
38959
  assetId: hexlify(value.assetId),
@@ -38883,10 +38962,9 @@ ${MessageCoinFragmentFragmentDoc}`;
38883
38962
  txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38884
38963
  },
38885
38964
  witnessIndex: value.witnessIndex,
38886
- maturity: value.maturity ?? 0,
38887
38965
  predicateGasUsed: bn(value.predicateGasUsed),
38888
- predicateLength: predicate.length,
38889
- predicateDataLength: predicateData.length,
38966
+ predicateLength: bn(predicate.length),
38967
+ predicateDataLength: bn(predicateData.length),
38890
38968
  predicate: hexlify(predicate),
38891
38969
  predicateData: hexlify(predicateData)
38892
38970
  };
@@ -38917,8 +38995,8 @@ ${MessageCoinFragmentFragmentDoc}`;
38917
38995
  nonce: hexlify(value.nonce),
38918
38996
  witnessIndex: value.witnessIndex,
38919
38997
  predicateGasUsed: bn(value.predicateGasUsed),
38920
- predicateLength: predicate.length,
38921
- predicateDataLength: predicateData.length,
38998
+ predicateLength: bn(predicate.length),
38999
+ predicateDataLength: bn(predicateData.length),
38922
39000
  predicate: hexlify(predicate),
38923
39001
  predicateData: hexlify(predicateData),
38924
39002
  data: hexlify(data),
@@ -39078,8 +39156,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39078
39156
  case "CALL" /* Call */: {
39079
39157
  const callReceipt = {
39080
39158
  type: ReceiptType.Call,
39081
- from: hexOrZero(receipt.contract?.id),
39082
- to: hexOrZero(receipt?.to?.id),
39159
+ from: hexOrZero(receipt.id || receipt.contractId),
39160
+ to: hexOrZero(receipt?.to),
39083
39161
  amount: bn(receipt.amount),
39084
39162
  assetId: hexOrZero(receipt.assetId),
39085
39163
  gas: bn(receipt.gas),
@@ -39093,7 +39171,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39093
39171
  case "RETURN" /* Return */: {
39094
39172
  const returnReceipt = {
39095
39173
  type: ReceiptType.Return,
39096
- id: hexOrZero(receipt.contract?.id),
39174
+ id: hexOrZero(receipt.id || receipt.contractId),
39097
39175
  val: bn(receipt.val),
39098
39176
  pc: bn(receipt.pc),
39099
39177
  is: bn(receipt.is)
@@ -39103,7 +39181,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39103
39181
  case "RETURN_DATA" /* ReturnData */: {
39104
39182
  const returnDataReceipt = {
39105
39183
  type: ReceiptType.ReturnData,
39106
- id: hexOrZero(receipt.contract?.id),
39184
+ id: hexOrZero(receipt.id || receipt.contractId),
39107
39185
  ptr: bn(receipt.ptr),
39108
39186
  len: bn(receipt.len),
39109
39187
  digest: hexOrZero(receipt.digest),
@@ -39115,7 +39193,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39115
39193
  case "PANIC" /* Panic */: {
39116
39194
  const panicReceipt = {
39117
39195
  type: ReceiptType.Panic,
39118
- id: hexOrZero(receipt.contract?.id),
39196
+ id: hexOrZero(receipt.id),
39119
39197
  reason: bn(receipt.reason),
39120
39198
  pc: bn(receipt.pc),
39121
39199
  is: bn(receipt.is),
@@ -39126,7 +39204,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39126
39204
  case "REVERT" /* Revert */: {
39127
39205
  const revertReceipt = {
39128
39206
  type: ReceiptType.Revert,
39129
- id: hexOrZero(receipt.contract?.id),
39207
+ id: hexOrZero(receipt.id || receipt.contractId),
39130
39208
  val: bn(receipt.ra),
39131
39209
  pc: bn(receipt.pc),
39132
39210
  is: bn(receipt.is)
@@ -39136,7 +39214,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39136
39214
  case "LOG" /* Log */: {
39137
39215
  const logReceipt = {
39138
39216
  type: ReceiptType.Log,
39139
- id: hexOrZero(receipt.contract?.id),
39217
+ id: hexOrZero(receipt.id || receipt.contractId),
39140
39218
  val0: bn(receipt.ra),
39141
39219
  val1: bn(receipt.rb),
39142
39220
  val2: bn(receipt.rc),
@@ -39149,7 +39227,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39149
39227
  case "LOG_DATA" /* LogData */: {
39150
39228
  const logDataReceipt = {
39151
39229
  type: ReceiptType.LogData,
39152
- id: hexOrZero(receipt.contract?.id),
39230
+ id: hexOrZero(receipt.id || receipt.contractId),
39153
39231
  val0: bn(receipt.ra),
39154
39232
  val1: bn(receipt.rb),
39155
39233
  ptr: bn(receipt.ptr),
@@ -39163,8 +39241,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39163
39241
  case "TRANSFER" /* Transfer */: {
39164
39242
  const transferReceipt = {
39165
39243
  type: ReceiptType.Transfer,
39166
- from: hexOrZero(receipt.contract?.id),
39167
- to: hexOrZero(receipt.toAddress || receipt?.to?.id),
39244
+ from: hexOrZero(receipt.id || receipt.contractId),
39245
+ to: hexOrZero(receipt.toAddress || receipt?.to),
39168
39246
  amount: bn(receipt.amount),
39169
39247
  assetId: hexOrZero(receipt.assetId),
39170
39248
  pc: bn(receipt.pc),
@@ -39175,8 +39253,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39175
39253
  case "TRANSFER_OUT" /* TransferOut */: {
39176
39254
  const transferOutReceipt = {
39177
39255
  type: ReceiptType.TransferOut,
39178
- from: hexOrZero(receipt.contract?.id),
39179
- to: hexOrZero(receipt.toAddress || receipt.to?.id),
39256
+ from: hexOrZero(receipt.id || receipt.contractId),
39257
+ to: hexOrZero(receipt.toAddress || receipt.to),
39180
39258
  amount: bn(receipt.amount),
39181
39259
  assetId: hexOrZero(receipt.assetId),
39182
39260
  pc: bn(receipt.pc),
@@ -39219,7 +39297,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39219
39297
  return receiptMessageOut;
39220
39298
  }
39221
39299
  case "MINT" /* Mint */: {
39222
- const contractId = hexOrZero(receipt.contract?.id);
39300
+ const contractId = hexOrZero(receipt.id || receipt.contractId);
39223
39301
  const subId = hexOrZero(receipt.subId);
39224
39302
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
39225
39303
  const mintReceipt = {
@@ -39234,7 +39312,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39234
39312
  return mintReceipt;
39235
39313
  }
39236
39314
  case "BURN" /* Burn */: {
39237
- const contractId = hexOrZero(receipt.contract?.id);
39315
+ const contractId = hexOrZero(receipt.id || receipt.contractId);
39238
39316
  const subId = hexOrZero(receipt.subId);
39239
39317
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
39240
39318
  const burnReceipt = {
@@ -39315,7 +39393,6 @@ ${MessageCoinFragmentFragmentDoc}`;
39315
39393
  };
39316
39394
 
39317
39395
  // src/providers/utils/gas.ts
39318
- var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
39319
39396
  var getGasUsedFromReceipts = (receipts) => {
39320
39397
  const scriptResult = receipts.filter(
39321
39398
  (receipt) => receipt.type === ReceiptType.ScriptResult
@@ -39336,18 +39413,28 @@ ${MessageCoinFragmentFragmentDoc}`;
39336
39413
  }
39337
39414
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
39338
39415
  const witnessCache = [];
39339
- const totalGas = inputs.reduce((total, input) => {
39416
+ const chargeableInputs = inputs.filter((input) => {
39417
+ const isCoinOrMessage = "owner" in input || "sender" in input;
39418
+ if (isCoinOrMessage) {
39419
+ if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39420
+ return true;
39421
+ }
39422
+ if (!witnessCache.includes(input.witnessIndex)) {
39423
+ witnessCache.push(input.witnessIndex);
39424
+ return true;
39425
+ }
39426
+ }
39427
+ return false;
39428
+ });
39429
+ const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
39430
+ const totalGas = chargeableInputs.reduce((total, input) => {
39340
39431
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39341
39432
  return total.add(
39342
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39433
+ vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39343
39434
  );
39344
39435
  }
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());
39436
+ return total.add(gasCosts.ecr1);
39437
+ }, bn(0));
39351
39438
  return totalGas;
39352
39439
  }
39353
39440
  function getMinGas(params) {
@@ -39359,12 +39446,20 @@ ${MessageCoinFragmentFragmentDoc}`;
39359
39446
  return minGas;
39360
39447
  }
39361
39448
  function getMaxGas(params) {
39362
- const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
39449
+ const {
39450
+ gasPerByte,
39451
+ witnessesLength,
39452
+ witnessLimit,
39453
+ minGas,
39454
+ gasLimit = bn(0),
39455
+ maxGasPerTx
39456
+ } = params;
39363
39457
  let remainingAllowedWitnessGas = bn(0);
39364
39458
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
39365
39459
  remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
39366
39460
  }
39367
- return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39461
+ const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39462
+ return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
39368
39463
  }
39369
39464
  function calculateMetadataGasForTxCreate({
39370
39465
  gasCosts,
@@ -39386,6 +39481,10 @@ ${MessageCoinFragmentFragmentDoc}`;
39386
39481
  }) {
39387
39482
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
39388
39483
  }
39484
+ var calculateGasFee = (params) => {
39485
+ const { gas, gasPrice, priceFactor, tip } = params;
39486
+ return gas.mul(gasPrice).div(priceFactor).add(tip);
39487
+ };
39389
39488
 
39390
39489
  // src/providers/utils/json.ts
39391
39490
  function normalize2(object) {
@@ -39527,7 +39626,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39527
39626
  // src/providers/transaction-request/transaction-request.ts
39528
39627
  var BaseTransactionRequest = class {
39529
39628
  /** Gas price for transaction */
39530
- gasPrice;
39629
+ tip;
39531
39630
  /** Block until which tx cannot be included */
39532
39631
  maturity;
39533
39632
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -39540,38 +39639,34 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39540
39639
  outputs = [];
39541
39640
  /** List of witnesses */
39542
39641
  witnesses = [];
39543
- /** Base asset ID - should be fetched from the chain */
39544
- baseAssetId = ZeroBytes32;
39545
39642
  /**
39546
39643
  * Constructor for initializing a base transaction request.
39547
39644
  *
39548
39645
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
39549
39646
  */
39550
39647
  constructor({
39551
- gasPrice,
39648
+ tip,
39552
39649
  maturity,
39553
39650
  maxFee,
39554
39651
  witnessLimit,
39555
39652
  inputs,
39556
39653
  outputs,
39557
- witnesses,
39558
- baseAssetId
39654
+ witnesses
39559
39655
  } = {}) {
39560
- this.gasPrice = bn(gasPrice);
39656
+ this.tip = bn(tip);
39561
39657
  this.maturity = maturity ?? 0;
39562
39658
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
39563
39659
  this.maxFee = maxFee ? bn(maxFee) : void 0;
39564
39660
  this.inputs = inputs ?? [];
39565
39661
  this.outputs = outputs ?? [];
39566
39662
  this.witnesses = witnesses ?? [];
39567
- this.baseAssetId = baseAssetId ?? ZeroBytes32;
39568
39663
  }
39569
39664
  static getPolicyMeta(req) {
39570
39665
  let policyTypes = 0;
39571
39666
  const policies = [];
39572
- if (req.gasPrice) {
39573
- policyTypes += PolicyType.GasPrice;
39574
- policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
39667
+ if (req.tip) {
39668
+ policyTypes += PolicyType.Tip;
39669
+ policies.push({ data: req.tip, type: PolicyType.Tip });
39575
39670
  }
39576
39671
  if (req.witnessLimit) {
39577
39672
  policyTypes += PolicyType.WitnessLimit;
@@ -39758,10 +39853,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39758
39853
  * @param predicate - Predicate bytes.
39759
39854
  * @param predicateData - Predicate data bytes.
39760
39855
  */
39761
- addCoinInput(coin, predicate) {
39856
+ addCoinInput(coin) {
39762
39857
  const { assetId, owner, amount } = coin;
39763
39858
  let witnessIndex;
39764
- if (predicate) {
39859
+ if (coin.predicate) {
39765
39860
  witnessIndex = 0;
39766
39861
  } else {
39767
39862
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -39776,9 +39871,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39776
39871
  amount,
39777
39872
  assetId,
39778
39873
  txPointer: "0x00000000000000000000000000000000",
39779
- witnessIndex,
39780
- predicate: predicate?.bytes,
39781
- predicateData: predicate?.predicateDataBytes
39874
+ witnessIndex
39782
39875
  };
39783
39876
  this.pushInput(input);
39784
39877
  this.addChangeOutput(owner, assetId);
@@ -39789,11 +39882,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39789
39882
  *
39790
39883
  * @param message - Message resource.
39791
39884
  * @param predicate - Predicate bytes.
39885
+ * @param predicateData - Predicate data bytes.
39792
39886
  */
39793
- addMessageInput(message, predicate) {
39887
+ addMessageInput(message) {
39794
39888
  const { recipient, sender, amount } = message;
39889
+ const assetId = BaseAssetId;
39795
39890
  let witnessIndex;
39796
- if (predicate) {
39891
+ if (message.predicate) {
39797
39892
  witnessIndex = 0;
39798
39893
  } else {
39799
39894
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -39807,12 +39902,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39807
39902
  sender: sender.toB256(),
39808
39903
  recipient: recipient.toB256(),
39809
39904
  amount,
39810
- witnessIndex,
39811
- predicate: predicate?.bytes,
39812
- predicateData: predicate?.predicateDataBytes
39905
+ witnessIndex
39813
39906
  };
39814
39907
  this.pushInput(input);
39815
- this.addChangeOutput(recipient, this.baseAssetId);
39908
+ this.addChangeOutput(recipient, assetId);
39816
39909
  }
39817
39910
  /**
39818
39911
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -39840,32 +39933,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39840
39933
  resources.forEach((resource) => this.addResource(resource));
39841
39934
  return this;
39842
39935
  }
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
39936
  /**
39870
39937
  * Adds a coin output to the transaction.
39871
39938
  *
@@ -39873,12 +39940,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39873
39940
  * @param amount - Amount of coin.
39874
39941
  * @param assetId - Asset ID of coin.
39875
39942
  */
39876
- addCoinOutput(to, amount, assetId) {
39943
+ addCoinOutput(to, amount, assetId = BaseAssetId) {
39877
39944
  this.pushOutput({
39878
39945
  type: OutputType.Coin,
39879
39946
  to: addressify(to).toB256(),
39880
39947
  amount,
39881
- assetId: assetId ?? this.baseAssetId
39948
+ assetId
39882
39949
  });
39883
39950
  return this;
39884
39951
  }
@@ -39905,7 +39972,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39905
39972
  * @param to - Address of the owner.
39906
39973
  * @param assetId - Asset ID of coin.
39907
39974
  */
39908
- addChangeOutput(to, assetId) {
39975
+ addChangeOutput(to, assetId = BaseAssetId) {
39909
39976
  const changeOutput = this.getChangeOutputs().find(
39910
39977
  (output3) => hexlify(output3.assetId) === assetId
39911
39978
  );
@@ -39913,7 +39980,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39913
39980
  this.pushOutput({
39914
39981
  type: OutputType.Change,
39915
39982
  to: addressify(to).toB256(),
39916
- assetId: assetId ?? this.baseAssetId
39983
+ assetId
39917
39984
  });
39918
39985
  }
39919
39986
  }
@@ -39945,7 +40012,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39945
40012
  }
39946
40013
  calculateMaxGas(chainInfo, minGas) {
39947
40014
  const { consensusParameters } = chainInfo;
39948
- const { gasPerByte } = consensusParameters;
40015
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
39949
40016
  const witnessesLength = this.toTransaction().witnesses.reduce(
39950
40017
  (acc, wit) => acc + wit.dataLength,
39951
40018
  0
@@ -39954,7 +40021,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39954
40021
  gasPerByte,
39955
40022
  minGas,
39956
40023
  witnessesLength,
39957
- witnessLimit: this.witnessLimit
40024
+ witnessLimit: this.witnessLimit,
40025
+ maxGasPerTx
39958
40026
  });
39959
40027
  }
39960
40028
  /**
@@ -39964,12 +40032,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39964
40032
  * @param quantities - CoinQuantity Array.
39965
40033
  */
39966
40034
  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
40035
  const findAssetInput = (assetId) => this.inputs.find((input) => {
39974
40036
  if ("assetId" in input) {
39975
40037
  return input.assetId === assetId;
@@ -39978,24 +40040,27 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39978
40040
  });
39979
40041
  const updateAssetInput = (assetId, quantity) => {
39980
40042
  const assetInput = findAssetInput(assetId);
40043
+ let usedQuantity = quantity;
40044
+ if (assetId === BaseAssetId) {
40045
+ usedQuantity = bn("1000000000000000000");
40046
+ }
39981
40047
  if (assetInput && "assetId" in assetInput) {
39982
- assetInput.id = generateId();
39983
- assetInput.amount = quantity;
40048
+ assetInput.id = hexlify(randomBytes3(34));
40049
+ assetInput.amount = usedQuantity;
39984
40050
  } else {
39985
40051
  this.addResources([
39986
40052
  {
39987
- id: generateId(),
39988
- amount: quantity,
40053
+ id: hexlify(randomBytes3(34)),
40054
+ amount: usedQuantity,
39989
40055
  assetId,
39990
40056
  owner: resourcesOwner || Address.fromRandom(),
39991
- maturity: 0,
39992
40057
  blockCreated: bn(1),
39993
40058
  txCreatedIdx: bn(1)
39994
40059
  }
39995
40060
  ]);
39996
40061
  }
39997
40062
  };
39998
- updateAssetInput(this.baseAssetId, bn(1e11));
40063
+ updateAssetInput(BaseAssetId, bn(1e11));
39999
40064
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
40000
40065
  }
40001
40066
  /**
@@ -40020,7 +40085,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40020
40085
  toJSON() {
40021
40086
  return normalizeJSON(this);
40022
40087
  }
40023
- updatePredicateInputs(inputs) {
40088
+ updatePredicateGasUsed(inputs) {
40024
40089
  this.inputs.forEach((i) => {
40025
40090
  let correspondingInput;
40026
40091
  switch (i.type) {
@@ -40042,6 +40107,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40042
40107
  }
40043
40108
  });
40044
40109
  }
40110
+ shiftPredicateData() {
40111
+ this.inputs.forEach((input) => {
40112
+ if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
40113
+ input.predicateData = input.paddPredicateData(
40114
+ BaseTransactionRequest.getPolicyMeta(this).policies.length
40115
+ );
40116
+ }
40117
+ });
40118
+ }
40045
40119
  };
40046
40120
 
40047
40121
  // src/providers/transaction-request/hash-transaction.ts
@@ -40175,9 +40249,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40175
40249
  return {
40176
40250
  type: TransactionType.Create,
40177
40251
  ...baseTransaction,
40178
- bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
40179
40252
  bytecodeWitnessIndex,
40180
- storageSlotsCount: storageSlots.length,
40253
+ storageSlotsCount: bn(storageSlots.length),
40181
40254
  salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
40182
40255
  storageSlots
40183
40256
  };
@@ -40291,8 +40364,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40291
40364
  type: TransactionType.Script,
40292
40365
  scriptGasLimit: this.gasLimit,
40293
40366
  ...super.getBaseTransaction(),
40294
- scriptLength: script.length,
40295
- scriptDataLength: scriptData.length,
40367
+ scriptLength: bn(script.length),
40368
+ scriptDataLength: bn(scriptData.length),
40296
40369
  receiptsRoot: ZeroBytes32,
40297
40370
  script: hexlify(script),
40298
40371
  scriptData: hexlify(scriptData)
@@ -40356,7 +40429,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40356
40429
  }
40357
40430
  calculateMaxGas(chainInfo, minGas) {
40358
40431
  const { consensusParameters } = chainInfo;
40359
- const { gasPerByte } = consensusParameters;
40432
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
40360
40433
  const witnessesLength = this.toTransaction().witnesses.reduce(
40361
40434
  (acc, wit) => acc + wit.dataLength,
40362
40435
  0
@@ -40366,7 +40439,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40366
40439
  minGas,
40367
40440
  witnessesLength,
40368
40441
  witnessLimit: this.witnessLimit,
40369
- gasLimit: this.gasLimit
40442
+ gasLimit: this.gasLimit,
40443
+ maxGasPerTx
40370
40444
  });
40371
40445
  }
40372
40446
  /**
@@ -40439,13 +40513,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40439
40513
  }
40440
40514
  }
40441
40515
  };
40516
+ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40517
+ (acc, input) => {
40518
+ if (input.type === InputType.Coin && input.owner === owner) {
40519
+ acc.utxos.push(input.id);
40520
+ }
40521
+ if (input.type === InputType.Message && input.recipient === owner) {
40522
+ acc.messages.push(input.nonce);
40523
+ }
40524
+ return acc;
40525
+ },
40526
+ {
40527
+ utxos: [],
40528
+ messages: []
40529
+ }
40530
+ );
40442
40531
 
40443
40532
  // src/providers/transaction-summary/calculate-transaction-fee.ts
40444
40533
  var calculateTransactionFee = (params) => {
40445
40534
  const {
40446
- gasUsed,
40535
+ gasPrice,
40447
40536
  rawPayload,
40448
- consensusParameters: { gasCosts, feeParams }
40537
+ tip,
40538
+ consensusParameters: { gasCosts, feeParams, maxGasPerTx }
40449
40539
  } = params;
40450
40540
  const gasPerByte = bn(feeParams.gasPerByte);
40451
40541
  const gasPriceFactor = bn(feeParams.gasPriceFactor);
@@ -40455,8 +40545,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40455
40545
  return {
40456
40546
  fee: bn(0),
40457
40547
  minFee: bn(0),
40458
- maxFee: bn(0),
40459
- feeFromGasUsed: bn(0)
40548
+ maxFee: bn(0)
40460
40549
  };
40461
40550
  }
40462
40551
  const { type: type3, witnesses, inputs, policies } = transaction;
@@ -40488,7 +40577,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40488
40577
  metadataGas,
40489
40578
  txBytesSize: transactionBytes.length
40490
40579
  });
40491
- const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
40492
40580
  const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
40493
40581
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
40494
40582
  const maxGas = getMaxGas({
@@ -40496,17 +40584,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40496
40584
  minGas,
40497
40585
  witnessesLength,
40498
40586
  gasLimit,
40499
- witnessLimit
40587
+ witnessLimit,
40588
+ maxGasPerTx
40589
+ });
40590
+ const minFee = calculateGasFee({
40591
+ gasPrice,
40592
+ gas: minGas,
40593
+ priceFactor: gasPriceFactor,
40594
+ tip
40595
+ });
40596
+ const maxFee = calculateGasFee({
40597
+ gasPrice,
40598
+ gas: maxGas,
40599
+ priceFactor: gasPriceFactor,
40600
+ tip
40500
40601
  });
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
40602
  return {
40506
- fee,
40507
40603
  minFee,
40508
40604
  maxFee,
40509
- feeFromGasUsed
40605
+ fee: maxFee
40510
40606
  };
40511
40607
  };
40512
40608
 
@@ -41107,7 +41203,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41107
41203
  gqlTransactionStatus,
41108
41204
  abiMap = {},
41109
41205
  maxInputs,
41110
- gasCosts
41206
+ gasCosts,
41207
+ maxGasPerTx,
41208
+ gasPrice
41111
41209
  } = params;
41112
41210
  const gasUsed = getGasUsedFromReceipts(receipts);
41113
41211
  const rawPayload = hexlify(transactionBytes);
@@ -41121,11 +41219,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41121
41219
  maxInputs
41122
41220
  });
41123
41221
  const typeName = getTransactionTypeName(transaction.type);
41222
+ const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
41124
41223
  const { fee } = calculateTransactionFee({
41125
- gasUsed,
41224
+ gasPrice,
41126
41225
  rawPayload,
41226
+ tip,
41127
41227
  consensusParameters: {
41128
41228
  gasCosts,
41229
+ maxGasPerTx,
41129
41230
  feeParams: {
41130
41231
  gasPerByte,
41131
41232
  gasPriceFactor
@@ -41261,8 +41362,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41261
41362
  const decodedTransaction = this.decodeTransaction(
41262
41363
  transaction
41263
41364
  );
41264
- const receipts = transaction.receipts?.map(processGqlReceipt) || [];
41265
- const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
41365
+ let txReceipts = [];
41366
+ if (transaction?.status && "receipts" in transaction.status) {
41367
+ txReceipts = transaction.status.receipts;
41368
+ }
41369
+ const receipts = txReceipts.map(processGqlReceipt) || [];
41370
+ const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
41371
+ const gasPrice = await this.provider.getLatestGasPrice();
41266
41372
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
41267
41373
  const transactionSummary = assembleTransactionSummary({
41268
41374
  id: this.id,
@@ -41274,7 +41380,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41274
41380
  gasPriceFactor,
41275
41381
  abiMap: contractsAbiMap,
41276
41382
  maxInputs,
41277
- gasCosts
41383
+ gasCosts,
41384
+ maxGasPerTx,
41385
+ gasPrice
41278
41386
  });
41279
41387
  return transactionSummary;
41280
41388
  }
@@ -41418,13 +41526,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41418
41526
  gasPerByte: bn(feeParams.gasPerByte),
41419
41527
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
41420
41528
  chainId: bn(consensusParameters.chainId),
41421
- baseAssetId: consensusParameters.baseAssetId,
41422
41529
  gasCosts
41423
41530
  },
41424
41531
  gasCosts,
41425
41532
  latestBlock: {
41426
41533
  id: latestBlock.id,
41427
- height: bn(latestBlock.header.height),
41534
+ height: bn(latestBlock.height),
41428
41535
  time: latestBlock.header.time,
41429
41536
  transactions: latestBlock.transactions.map((i) => ({
41430
41537
  id: i.id
@@ -41518,10 +41625,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41518
41625
  * Returns some helpful parameters related to gas fees.
41519
41626
  */
41520
41627
  getGasConfig() {
41521
- const { minGasPrice } = this.getNode();
41522
41628
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
41523
41629
  return {
41524
- minGasPrice,
41525
41630
  maxGasPerTx,
41526
41631
  maxGasPerPredicate,
41527
41632
  gasPriceFactor,
@@ -41619,7 +41724,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41619
41724
  */
41620
41725
  async getBlockNumber() {
41621
41726
  const { chain } = await this.operations.getChain();
41622
- return bn(chain.latestBlock.header.height, 10);
41727
+ return bn(chain.latestBlock.height, 10);
41623
41728
  }
41624
41729
  /**
41625
41730
  * Returns the chain information.
@@ -41631,11 +41736,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41631
41736
  const processedNodeInfo = {
41632
41737
  maxDepth: bn(nodeInfo.maxDepth),
41633
41738
  maxTx: bn(nodeInfo.maxTx),
41634
- minGasPrice: bn(nodeInfo.minGasPrice),
41635
41739
  nodeVersion: nodeInfo.nodeVersion,
41636
41740
  utxoValidation: nodeInfo.utxoValidation,
41637
- vmBacktrace: nodeInfo.vmBacktrace,
41638
- peers: nodeInfo.peers
41741
+ vmBacktrace: nodeInfo.vmBacktrace
41639
41742
  };
41640
41743
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
41641
41744
  return processedNodeInfo;
@@ -41661,17 +41764,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41661
41764
  } = this.getChain();
41662
41765
  return chainId.toNumber();
41663
41766
  }
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
41767
  /**
41676
41768
  * Submits a transaction to the chain to be executed.
41677
41769
  *
@@ -41732,14 +41824,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41732
41824
  return this.estimateTxDependencies(transactionRequest);
41733
41825
  }
41734
41826
  const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41735
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
41736
- encodedTransaction,
41827
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41828
+ encodedTransactions: encodedTransaction,
41737
41829
  utxoValidation: utxoValidation || false
41738
41830
  });
41739
- const receipts = gqlReceipts.map(processGqlReceipt);
41740
- return {
41741
- receipts
41742
- };
41831
+ const [{ receipts: rawReceipts, status }] = dryRunStatuses;
41832
+ const receipts = rawReceipts.map(processGqlReceipt);
41833
+ return { receipts, dryrunStatus: status };
41743
41834
  }
41744
41835
  /**
41745
41836
  * Verifies whether enough gas is available to complete transaction.
@@ -41778,9 +41869,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41778
41869
  * If there are missing variable outputs,
41779
41870
  * `addVariableOutputs` is called on the transaction.
41780
41871
  *
41781
- * @privateRemarks
41782
- * TODO: Investigate support for missing contract IDs
41783
- * TODO: Add support for missing output messages
41784
41872
  *
41785
41873
  * @param transactionRequest - The transaction request object.
41786
41874
  * @returns A promise.
@@ -41793,16 +41881,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41793
41881
  missingContractIds: []
41794
41882
  };
41795
41883
  }
41796
- await this.estimatePredicates(transactionRequest);
41797
41884
  let receipts = [];
41798
41885
  const missingContractIds = [];
41799
41886
  let outputVariables = 0;
41887
+ let dryrunStatus;
41800
41888
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
41801
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
41802
- encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
41889
+ const {
41890
+ dryRun: [{ receipts: rawReceipts, status }]
41891
+ } = await this.operations.dryRun({
41892
+ encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
41803
41893
  utxoValidation: false
41804
41894
  });
41805
- receipts = gqlReceipts.map(processGqlReceipt);
41895
+ receipts = rawReceipts.map(processGqlReceipt);
41896
+ dryrunStatus = status;
41806
41897
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
41807
41898
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
41808
41899
  if (hasMissingOutputs) {
@@ -41812,6 +41903,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41812
41903
  transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
41813
41904
  missingContractIds.push(contractId);
41814
41905
  });
41906
+ const { maxFee } = await this.estimateTxGasAndFee({
41907
+ transactionRequest,
41908
+ optimizeGas: false
41909
+ });
41910
+ transactionRequest.maxFee = maxFee;
41815
41911
  } else {
41816
41912
  break;
41817
41913
  }
@@ -41819,7 +41915,133 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41819
41915
  return {
41820
41916
  receipts,
41821
41917
  outputVariables,
41822
- missingContractIds
41918
+ missingContractIds,
41919
+ dryrunStatus
41920
+ };
41921
+ }
41922
+ /**
41923
+ * Dry runs multiple transactions and checks for missing dependencies in batches.
41924
+ *
41925
+ * Transactions are dry run in batches. After each dry run, transactions requiring
41926
+ * further modifications are identified. The method iteratively updates these transactions
41927
+ * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
41928
+ *
41929
+ * @param transactionRequests - Array of transaction request objects.
41930
+ * @returns A promise that resolves to an array of results for each transaction.
41931
+ */
41932
+ async estimateMultipleTxDependencies(transactionRequests) {
41933
+ const results = transactionRequests.map(() => ({
41934
+ receipts: [],
41935
+ outputVariables: 0,
41936
+ missingContractIds: [],
41937
+ dryrunStatus: void 0
41938
+ }));
41939
+ const allRequests = clone_default(transactionRequests);
41940
+ const serializedTransactionsMap = /* @__PURE__ */ new Map();
41941
+ allRequests.forEach((req, index) => {
41942
+ if (req.type === TransactionType.Script) {
41943
+ serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
41944
+ }
41945
+ });
41946
+ let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
41947
+ let attempt = 0;
41948
+ while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
41949
+ const encodedTransactions = transactionsToProcess.map(
41950
+ (index) => serializedTransactionsMap.get(index)
41951
+ );
41952
+ const dryRunResults = await this.operations.dryRun({
41953
+ encodedTransactions,
41954
+ utxoValidation: false
41955
+ });
41956
+ const nextRoundTransactions = [];
41957
+ for (let i = 0; i < dryRunResults.dryRun.length; i++) {
41958
+ const currentResultIndex = transactionsToProcess[i];
41959
+ const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
41960
+ results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
41961
+ results[currentResultIndex].dryrunStatus = status;
41962
+ const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
41963
+ results[currentResultIndex].receipts
41964
+ );
41965
+ const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
41966
+ const requestToProcess = allRequests[currentResultIndex];
41967
+ if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
41968
+ results[currentResultIndex].outputVariables += missingOutputVariables.length;
41969
+ requestToProcess.addVariableOutputs(missingOutputVariables.length);
41970
+ missingOutputContractIds.forEach(({ contractId }) => {
41971
+ requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
41972
+ results[currentResultIndex].missingContractIds.push(contractId);
41973
+ });
41974
+ const { maxFee } = await this.estimateTxGasAndFee({
41975
+ transactionRequest: requestToProcess,
41976
+ optimizeGas: false
41977
+ });
41978
+ requestToProcess.maxFee = maxFee;
41979
+ serializedTransactionsMap.set(
41980
+ currentResultIndex,
41981
+ hexlify(requestToProcess.toTransactionBytes())
41982
+ );
41983
+ nextRoundTransactions.push(currentResultIndex);
41984
+ allRequests[currentResultIndex] = requestToProcess;
41985
+ }
41986
+ }
41987
+ transactionsToProcess = nextRoundTransactions;
41988
+ attempt += 1;
41989
+ }
41990
+ return results;
41991
+ }
41992
+ async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
41993
+ if (estimateTxDependencies) {
41994
+ return this.estimateMultipleTxDependencies(transactionRequests);
41995
+ }
41996
+ const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
41997
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41998
+ encodedTransactions,
41999
+ utxoValidation: utxoValidation || false
42000
+ });
42001
+ const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
42002
+ const receipts = rawReceipts.map(processGqlReceipt);
42003
+ return { receipts, dryrunStatus: status };
42004
+ });
42005
+ return results;
42006
+ }
42007
+ async estimateTxGasAndFee(params) {
42008
+ const { transactionRequest, optimizeGas = true } = params;
42009
+ let { gasPrice } = params;
42010
+ const chainInfo = this.getChain();
42011
+ const { gasPriceFactor } = this.getGasConfig();
42012
+ const minGas = transactionRequest.calculateMinGas(chainInfo);
42013
+ if (!gasPrice) {
42014
+ gasPrice = await this.estimateGasPrice(10);
42015
+ }
42016
+ const minFee = calculateGasFee({
42017
+ gasPrice: bn(gasPrice),
42018
+ gas: minGas,
42019
+ priceFactor: gasPriceFactor,
42020
+ tip: transactionRequest.tip
42021
+ }).add(1);
42022
+ let gasLimit = bn(0);
42023
+ if (transactionRequest.type === TransactionType.Script) {
42024
+ gasLimit = transactionRequest.gasLimit;
42025
+ if (!optimizeGas) {
42026
+ transactionRequest.gasLimit = minGas;
42027
+ gasLimit = transactionRequest.calculateMaxGas(chainInfo, minGas);
42028
+ transactionRequest.gasLimit = gasLimit;
42029
+ }
42030
+ }
42031
+ const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
42032
+ const maxFee = calculateGasFee({
42033
+ gasPrice: bn(gasPrice),
42034
+ gas: maxGas,
42035
+ priceFactor: gasPriceFactor,
42036
+ tip: transactionRequest.tip
42037
+ }).add(1);
42038
+ return {
42039
+ minGas,
42040
+ minFee,
42041
+ maxGas,
42042
+ maxFee,
42043
+ gasPrice,
42044
+ gasLimit
41823
42045
  };
41824
42046
  }
41825
42047
  /**
@@ -41837,15 +42059,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41837
42059
  if (estimateTxDependencies) {
41838
42060
  return this.estimateTxDependencies(transactionRequest);
41839
42061
  }
41840
- const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41841
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
41842
- encodedTransaction,
42062
+ const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
42063
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42064
+ encodedTransactions,
41843
42065
  utxoValidation: true
41844
42066
  });
41845
- const receipts = gqlReceipts.map(processGqlReceipt);
41846
- return {
41847
- receipts
41848
- };
42067
+ const callResult = dryRunStatuses.map((dryRunStatus) => {
42068
+ const { id, receipts, status } = dryRunStatus;
42069
+ const processedReceipts = receipts.map(processGqlReceipt);
42070
+ return { id, receipts: processedReceipts, status };
42071
+ });
42072
+ return { receipts: callResult[0].receipts };
41849
42073
  }
41850
42074
  /**
41851
42075
  * Returns a transaction cost to enable user
@@ -41862,80 +42086,80 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41862
42086
  * @param tolerance - The tolerance to add on top of the gasUsed.
41863
42087
  * @returns A promise that resolves to the transaction cost object.
41864
42088
  */
41865
- async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
41866
- estimateTxDependencies = true,
41867
- estimatePredicates = true,
41868
- resourcesOwner,
41869
- signatureCallback
41870
- } = {}) {
42089
+ async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
41871
42090
  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
42091
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
41876
42092
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
41877
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
42093
+ const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
41878
42094
  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);
42095
+ txRequestClone.maxFee = bn(0);
42096
+ if (isScriptTransaction) {
42097
+ txRequestClone.gasLimit = bn(0);
41887
42098
  }
41888
- if (signatureCallback && isScriptTransaction) {
41889
- await signatureCallback(txRequestClone);
42099
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
42100
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
41890
42101
  }
41891
- const minGas = txRequestClone.calculateMinGas(chainInfo);
41892
- const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
42102
+ const signedRequest = clone_default(txRequestClone);
42103
+ let addedSignatures = 0;
42104
+ if (signatureCallback && isScriptTransaction) {
42105
+ const lengthBefore = signedRequest.witnesses.length;
42106
+ await signatureCallback(signedRequest);
42107
+ addedSignatures = signedRequest.witnesses.length - lengthBefore;
42108
+ }
42109
+ await this.estimatePredicates(signedRequest);
42110
+ let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
42111
+ transactionRequest: signedRequest,
42112
+ optimizeGas: false
42113
+ });
42114
+ txRequestClone.maxFee = maxFee;
41893
42115
  let receipts = [];
41894
42116
  let missingContractIds = [];
41895
42117
  let outputVariables = 0;
41896
- if (isScriptTransaction && estimateTxDependencies) {
41897
- txRequestClone.gasPrice = bn(0);
41898
- txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
42118
+ let gasUsed = bn(0);
42119
+ txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
42120
+ if (isScriptTransaction) {
42121
+ if (signatureCallback) {
42122
+ await signatureCallback(txRequestClone);
42123
+ }
42124
+ txRequestClone.gasLimit = gasLimit;
41899
42125
  const result = await this.estimateTxDependencies(txRequestClone);
41900
42126
  receipts = result.receipts;
41901
42127
  outputVariables = result.outputVariables;
41902
42128
  missingContractIds = result.missingContractIds;
42129
+ gasUsed = getGasUsedFromReceipts(receipts);
42130
+ txRequestClone.gasLimit = gasUsed;
42131
+ ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
42132
+ transactionRequest: txRequestClone,
42133
+ gasPrice
42134
+ }));
41903
42135
  }
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
42136
  return {
41913
42137
  requiredQuantities: allQuantities,
41914
42138
  receipts,
41915
42139
  gasUsed,
41916
- minGasPrice,
41917
42140
  gasPrice,
41918
42141
  minGas,
41919
42142
  maxGas,
41920
- usedFee,
41921
42143
  minFee,
41922
42144
  maxFee,
41923
- estimatedInputs: txRequestClone.inputs,
41924
42145
  outputVariables,
41925
- missingContractIds
42146
+ missingContractIds,
42147
+ addedSignatures,
42148
+ estimatedPredicates: txRequestClone.inputs
41926
42149
  };
41927
42150
  }
41928
- async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
42151
+ async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
41929
42152
  const ownerAddress = Address.fromAddressOrString(owner);
41930
42153
  const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
41931
- const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
42154
+ const transactionCost = await this.getTransactionCost(transactionRequest, {
42155
+ quantitiesToContract
42156
+ });
41932
42157
  transactionRequest.addResources(
41933
42158
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
41934
42159
  );
41935
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(
41936
- transactionRequest,
41937
- forwardingQuantities
41938
- );
42160
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
42161
+ quantitiesToContract
42162
+ });
41939
42163
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
41940
42164
  return {
41941
42165
  resources,
@@ -41959,7 +42183,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41959
42183
  assetId: coin.assetId,
41960
42184
  amount: bn(coin.amount),
41961
42185
  owner: Address.fromAddressOrString(coin.owner),
41962
- maturity: bn(coin.maturity).toNumber(),
41963
42186
  blockCreated: bn(coin.blockCreated),
41964
42187
  txCreatedIdx: bn(coin.txCreatedIdx)
41965
42188
  }));
@@ -42011,7 +42234,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42011
42234
  amount: bn(coin.amount),
42012
42235
  assetId: coin.assetId,
42013
42236
  owner: Address.fromAddressOrString(coin.owner),
42014
- maturity: bn(coin.maturity).toNumber(),
42015
42237
  blockCreated: bn(coin.blockCreated),
42016
42238
  txCreatedIdx: bn(coin.txCreatedIdx)
42017
42239
  };
@@ -42044,7 +42266,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42044
42266
  }
42045
42267
  return {
42046
42268
  id: block2.id,
42047
- height: bn(block2.header.height),
42269
+ height: bn(block2.height),
42048
42270
  time: block2.header.time,
42049
42271
  transactionIds: block2.transactions.map((tx) => tx.id)
42050
42272
  };
@@ -42059,7 +42281,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42059
42281
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
42060
42282
  const blocks = fetchedData.edges.map(({ node: block2 }) => ({
42061
42283
  id: block2.id,
42062
- height: bn(block2.header.height),
42284
+ height: bn(block2.height),
42063
42285
  time: block2.header.time,
42064
42286
  transactionIds: block2.transactions.map((tx) => tx.id)
42065
42287
  }));
@@ -42086,7 +42308,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42086
42308
  }
42087
42309
  return {
42088
42310
  id: block2.id,
42089
- height: bn(block2.header.height, 10),
42311
+ height: bn(block2.height, 10),
42090
42312
  time: block2.header.time,
42091
42313
  transactionIds: block2.transactions.map((tx) => tx.id),
42092
42314
  transactions: block2.transactions.map(
@@ -42266,7 +42488,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42266
42488
  prevRoot: messageBlockHeader.prevRoot,
42267
42489
  time: messageBlockHeader.time,
42268
42490
  applicationHash: messageBlockHeader.applicationHash,
42269
- messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
42270
42491
  messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
42271
42492
  },
42272
42493
  commitBlockHeader: {
@@ -42278,7 +42499,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42278
42499
  prevRoot: commitBlockHeader.prevRoot,
42279
42500
  time: commitBlockHeader.time,
42280
42501
  applicationHash: commitBlockHeader.applicationHash,
42281
- messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
42282
42502
  messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
42283
42503
  },
42284
42504
  sender: Address.fromAddressOrString(sender),
@@ -42288,6 +42508,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42288
42508
  data
42289
42509
  };
42290
42510
  }
42511
+ async getLatestGasPrice() {
42512
+ const { latestGasPrice } = await this.operations.getLatestGasPrice();
42513
+ return bn(latestGasPrice.gasPrice);
42514
+ }
42515
+ async estimateGasPrice(blockHorizon) {
42516
+ const { estimateGasPrice } = await this.operations.estimateGasPrice({
42517
+ blockHorizon: String(blockHorizon)
42518
+ });
42519
+ return bn(estimateGasPrice.gasPrice);
42520
+ }
42291
42521
  /**
42292
42522
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
42293
42523
  *
@@ -42348,10 +42578,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42348
42578
  arrayify(gqlTransaction.rawPayload),
42349
42579
  0
42350
42580
  );
42351
- const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
42581
+ let txReceipts = [];
42582
+ if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42583
+ txReceipts = gqlTransaction.status.receipts;
42584
+ }
42585
+ const receipts = txReceipts.map(processGqlReceipt);
42352
42586
  const {
42353
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42587
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42354
42588
  } = provider.getChain();
42589
+ const gasPrice = await provider.getLatestGasPrice();
42355
42590
  const transactionInfo = assembleTransactionSummary({
42356
42591
  id: gqlTransaction.id,
42357
42592
  receipts,
@@ -42362,7 +42597,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42362
42597
  gasPriceFactor: bn(gasPriceFactor),
42363
42598
  abiMap,
42364
42599
  maxInputs,
42365
- gasCosts
42600
+ gasCosts,
42601
+ maxGasPerTx,
42602
+ gasPrice
42366
42603
  });
42367
42604
  return {
42368
42605
  gqlTransaction,
@@ -42372,10 +42609,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42372
42609
  async function getTransactionSummaryFromRequest(params) {
42373
42610
  const { provider, transactionRequest, abiMap } = params;
42374
42611
  const { receipts } = await provider.call(transactionRequest);
42375
- const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
42612
+ const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
42376
42613
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
42377
42614
  const transaction = transactionRequest.toTransaction();
42378
42615
  const transactionBytes = transactionRequest.toTransactionBytes();
42616
+ const gasPrice = await provider.getLatestGasPrice();
42379
42617
  const transactionSummary = assembleTransactionSummary({
42380
42618
  receipts,
42381
42619
  transaction,
@@ -42384,7 +42622,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42384
42622
  gasPerByte,
42385
42623
  gasPriceFactor,
42386
42624
  maxInputs,
42387
- gasCosts
42625
+ gasCosts,
42626
+ maxGasPerTx,
42627
+ gasPrice
42388
42628
  });
42389
42629
  return transactionSummary;
42390
42630
  }
@@ -42393,13 +42633,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42393
42633
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
42394
42634
  const { edges, pageInfo } = transactionsByOwner;
42395
42635
  const {
42396
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42636
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42397
42637
  } = provider.getChain();
42638
+ const gasPrice = await provider.getLatestGasPrice();
42398
42639
  const transactions = edges.map((edge) => {
42399
42640
  const { node: gqlTransaction } = edge;
42400
- const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
42641
+ const { id, rawPayload, status } = gqlTransaction;
42401
42642
  const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
42402
- const receipts = gqlReceipts?.map(processGqlReceipt) || [];
42643
+ let txReceipts = [];
42644
+ if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42645
+ txReceipts = gqlTransaction.status.receipts;
42646
+ }
42647
+ const receipts = txReceipts.map(processGqlReceipt);
42403
42648
  const transactionSummary = assembleTransactionSummary({
42404
42649
  id,
42405
42650
  receipts,
@@ -42410,7 +42655,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42410
42655
  gasPerByte,
42411
42656
  gasPriceFactor,
42412
42657
  maxInputs,
42413
- gasCosts
42658
+ gasCosts,
42659
+ maxGasPerTx,
42660
+ gasPrice
42414
42661
  });
42415
42662
  const output3 = {
42416
42663
  gqlTransaction,
@@ -42701,9 +42948,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42701
42948
  * @param assetId - The asset ID to check the balance for.
42702
42949
  * @returns A promise that resolves to the balance amount.
42703
42950
  */
42704
- async getBalance(assetId) {
42705
- const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
42706
- const amount = await this.provider.getBalance(this.address, assetIdToFetch);
42951
+ async getBalance(assetId = BaseAssetId) {
42952
+ const amount = await this.provider.getBalance(this.address, assetId);
42707
42953
  return amount;
42708
42954
  }
42709
42955
  /**
@@ -42740,37 +42986,33 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42740
42986
  * @param fee - The estimated transaction fee.
42741
42987
  * @returns A promise that resolves when the resources are added to the transaction.
42742
42988
  */
42743
- async fund(request, coinQuantities, fee) {
42744
- const baseAssetId = this.provider.getBaseAssetId();
42745
- const updatedQuantities = addAmountToAsset({
42989
+ async fund(request, params) {
42990
+ const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
42991
+ const txRequest = request;
42992
+ const requiredQuantitiesWithFee = addAmountToCoinQuantities({
42746
42993
  amount: bn(fee),
42747
- assetId: baseAssetId,
42748
- coinQuantities
42994
+ assetId: BaseAssetId,
42995
+ coinQuantities: requiredQuantities
42749
42996
  });
42750
42997
  const quantitiesDict = {};
42751
- updatedQuantities.forEach(({ amount, assetId }) => {
42998
+ requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
42752
42999
  quantitiesDict[assetId] = {
42753
43000
  required: amount,
42754
43001
  owned: bn(0)
42755
43002
  };
42756
43003
  });
42757
- const cachedUtxos = [];
42758
- const cachedMessages = [];
42759
- const owner = this.address.toB256();
42760
- request.inputs.forEach((input) => {
43004
+ txRequest.inputs.forEach((input) => {
42761
43005
  const isResource = "amount" in input;
42762
43006
  if (isResource) {
42763
43007
  const isCoin2 = "owner" in input;
42764
43008
  if (isCoin2) {
42765
43009
  const assetId = String(input.assetId);
42766
- if (input.owner === owner && quantitiesDict[assetId]) {
43010
+ if (quantitiesDict[assetId]) {
42767
43011
  const amount = bn(input.amount);
42768
43012
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42769
- cachedUtxos.push(input.id);
42770
43013
  }
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);
43014
+ } else if (input.amount && quantitiesDict[BaseAssetId]) {
43015
+ quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42774
43016
  }
42775
43017
  }
42776
43018
  });
@@ -42785,12 +43027,23 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42785
43027
  });
42786
43028
  const needsToBeFunded = missingQuantities.length;
42787
43029
  if (needsToBeFunded) {
42788
- const resources = await this.getResourcesToSpend(missingQuantities, {
42789
- messages: cachedMessages,
42790
- utxos: cachedUtxos
42791
- });
42792
- request.addResources(resources);
43030
+ const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
43031
+ const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
43032
+ txRequest.addResources(resources);
43033
+ }
43034
+ txRequest.shiftPredicateData();
43035
+ txRequest.updatePredicateGasUsed(estimatedPredicates);
43036
+ const requestToBeReEstimate = clone_default(txRequest);
43037
+ if (addedSignatures) {
43038
+ Array.from({ length: addedSignatures }).forEach(
43039
+ () => requestToBeReEstimate.addEmptyWitness()
43040
+ );
42793
43041
  }
43042
+ const { maxFee } = await this.provider.estimateTxGasAndFee({
43043
+ transactionRequest: requestToBeReEstimate
43044
+ });
43045
+ txRequest.maxFee = maxFee;
43046
+ return txRequest;
42794
43047
  }
42795
43048
  /**
42796
43049
  * A helper that creates a transfer transaction request and returns it.
@@ -42798,29 +43051,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42798
43051
  * @param destination - The address of the destination.
42799
43052
  * @param amount - The amount of coins to transfer.
42800
43053
  * @param assetId - The asset ID of the coins to transfer.
42801
- * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43054
+ * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
42802
43055
  * @returns A promise that resolves to the prepared transaction request.
42803
43056
  */
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, [], {
43057
+ async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
43058
+ const request = new ScriptTransactionRequest(txParams);
43059
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
43060
+ const txCost = await this.provider.getTransactionCost(request, {
42811
43061
  estimateTxDependencies: true,
42812
43062
  resourcesOwner: this
42813
43063
  });
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);
43064
+ if ("gasLimit" in txParams) {
43065
+ this.validateGas({
43066
+ gasUsed: txCost.gasUsed,
43067
+ gasLimit: request.gasLimit
43068
+ });
43069
+ }
43070
+ request.gasLimit = txCost.gasUsed;
43071
+ request.maxFee = txCost.maxFee;
43072
+ await this.fund(request, txCost);
42824
43073
  return request;
42825
43074
  }
42826
43075
  /**
@@ -42832,15 +43081,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42832
43081
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
42833
43082
  * @returns A promise that resolves to the transaction response.
42834
43083
  */
42835
- async transfer(destination, amount, assetId, txParams = {}) {
43084
+ async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
42836
43085
  if (bn(amount).lte(0)) {
42837
43086
  throw new FuelError(
42838
43087
  ErrorCode.INVALID_TRANSFER_AMOUNT,
42839
43088
  "Transfer amount must be a positive number."
42840
43089
  );
42841
43090
  }
42842
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42843
- const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
43091
+ const request = await this.createTransfer(destination, amount, assetId, txParams);
42844
43092
  return this.sendTransaction(request, { estimateTxDependencies: false });
42845
43093
  }
42846
43094
  /**
@@ -42852,7 +43100,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42852
43100
  * @param txParams - The optional transaction parameters.
42853
43101
  * @returns A promise that resolves to the transaction response.
42854
43102
  */
42855
- async transferToContract(contractId, amount, assetId, txParams = {}) {
43103
+ async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
42856
43104
  if (bn(amount).lte(0)) {
42857
43105
  throw new FuelError(
42858
43106
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -42860,32 +43108,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42860
43108
  );
42861
43109
  }
42862
43110
  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
43111
  const { script, scriptData } = await assembleTransferToContractScript({
42867
43112
  hexlifiedContractId: contractAddress.toB256(),
42868
43113
  amountToTransfer: bn(amount),
42869
- assetId: assetIdToTransfer
43114
+ assetId
42870
43115
  });
42871
43116
  const request = new ScriptTransactionRequest({
42872
- ...params,
43117
+ ...txParams,
42873
43118
  script,
42874
43119
  scriptData
42875
43120
  });
42876
43121
  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
43122
+ const txCost = await this.provider.getTransactionCost(request, {
43123
+ resourcesOwner: this,
43124
+ quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
42887
43125
  });
42888
- await this.fund(request, requiredQuantities, maxFee);
43126
+ if (txParams.gasLimit) {
43127
+ this.validateGas({
43128
+ gasUsed: txCost.gasUsed,
43129
+ gasLimit: request.gasLimit
43130
+ });
43131
+ }
43132
+ request.gasLimit = txCost.gasUsed;
43133
+ request.maxFee = txCost.maxFee;
43134
+ await this.fund(request, txCost);
42889
43135
  return this.sendTransaction(request);
42890
43136
  }
42891
43137
  /**
@@ -42897,8 +43143,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42897
43143
  * @returns A promise that resolves to the transaction response.
42898
43144
  */
42899
43145
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42900
- const { minGasPrice } = this.provider.getGasConfig();
42901
- const baseAssetId = this.provider.getBaseAssetId();
42902
43146
  const recipientAddress = Address.fromAddressOrString(recipient);
42903
43147
  const recipientDataArray = arrayify(
42904
43148
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -42911,21 +43155,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42911
43155
  ...recipientDataArray,
42912
43156
  ...amountDataArray
42913
43157
  ]);
42914
- const params = { script, gasPrice: minGasPrice, ...txParams };
43158
+ const params = { script, ...txParams };
42915
43159
  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);
43160
+ const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
43161
+ const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
43162
+ if (txParams.gasLimit) {
43163
+ this.validateGas({
43164
+ gasUsed: txCost.gasUsed,
43165
+ gasLimit: request.gasLimit
43166
+ });
43167
+ }
43168
+ request.maxFee = txCost.maxFee;
43169
+ request.gasLimit = txCost.gasUsed;
43170
+ await this.fund(request, txCost);
42929
43171
  return this.sendTransaction(request);
42930
43172
  }
42931
43173
  async signMessage(message) {
@@ -42983,18 +43225,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42983
43225
  }
42984
43226
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
42985
43227
  }
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
- }
43228
+ validateGas({ gasUsed, gasLimit }) {
42998
43229
  if (gasUsed.gt(gasLimit)) {
42999
43230
  throw new FuelError(
43000
43231
  ErrorCode.GAS_LIMIT_TOO_LOW,
@@ -44377,12 +44608,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44377
44608
  };
44378
44609
 
44379
44610
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
44380
- var import_crypto15 = __toESM(__require("crypto"));
44611
+ var import_crypto16 = __toESM(__require("crypto"));
44381
44612
  var rnds8Pool = new Uint8Array(256);
44382
44613
  var poolPtr = rnds8Pool.length;
44383
44614
  function rng() {
44384
44615
  if (poolPtr > rnds8Pool.length - 16) {
44385
- import_crypto15.default.randomFillSync(rnds8Pool);
44616
+ import_crypto16.default.randomFillSync(rnds8Pool);
44386
44617
  poolPtr = 0;
44387
44618
  }
44388
44619
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -44398,9 +44629,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44398
44629
  }
44399
44630
 
44400
44631
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
44401
- var import_crypto16 = __toESM(__require("crypto"));
44632
+ var import_crypto17 = __toESM(__require("crypto"));
44402
44633
  var native_default = {
44403
- randomUUID: import_crypto16.default.randomUUID
44634
+ randomUUID: import_crypto17.default.randomUUID
44404
44635
  };
44405
44636
 
44406
44637
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
@@ -44583,7 +44814,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44583
44814
  * @param transactionRequestLike - The transaction request to send.
44584
44815
  * @returns A promise that resolves to the TransactionResponse object.
44585
44816
  */
44586
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
44817
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
44587
44818
  const transactionRequest = transactionRequestify(transactionRequestLike);
44588
44819
  if (estimateTxDependencies) {
44589
44820
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -47849,6 +48080,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47849
48080
  this.interface = predicateInterface;
47850
48081
  if (inputData !== void 0 && inputData.length > 0) {
47851
48082
  this.predicateData = inputData;
48083
+ this.predicateDataBytes = this.getPredicateData(0);
47852
48084
  }
47853
48085
  }
47854
48086
  /**
@@ -47862,8 +48094,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47862
48094
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
47863
48095
  request.inputs?.forEach((input) => {
47864
48096
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
47865
- input.predicate = this.bytes;
47866
- input.predicateData = this.getPredicateData(policies.length);
48097
+ input.predicate = hexlify(this.bytes);
48098
+ input.predicateData = hexlify(this.getPredicateData(policies.length));
47867
48099
  }
47868
48100
  });
47869
48101
  return request;
@@ -47877,10 +48109,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47877
48109
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
47878
48110
  * @returns A promise that resolves to the prepared transaction request.
47879
48111
  */
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);
48112
+ async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
48113
+ return super.createTransfer(destination, amount, assetId, txParams);
47884
48114
  }
47885
48115
  /**
47886
48116
  * Sends a transaction with the populated predicate data.
@@ -47888,9 +48118,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47888
48118
  * @param transactionRequestLike - The transaction request-like object.
47889
48119
  * @returns A promise that resolves to the transaction response.
47890
48120
  */
47891
- sendTransaction(transactionRequestLike, options) {
47892
- const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47893
- return super.sendTransaction(transactionRequest, options);
48121
+ sendTransaction(transactionRequestLike) {
48122
+ const transactionRequest = transactionRequestify(transactionRequestLike);
48123
+ return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
47894
48124
  }
47895
48125
  /**
47896
48126
  * Simulates a transaction with the populated predicate data.
@@ -47899,8 +48129,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47899
48129
  * @returns A promise that resolves to the call result.
47900
48130
  */
47901
48131
  simulateTransaction(transactionRequestLike) {
47902
- const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47903
- return super.simulateTransaction(transactionRequest);
48132
+ const transactionRequest = transactionRequestify(transactionRequestLike);
48133
+ return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
47904
48134
  }
47905
48135
  getPredicateData(policiesLength) {
47906
48136
  if (!this.predicateData.length) {
@@ -47946,6 +48176,26 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47946
48176
  predicateInterface: abiInterface
47947
48177
  };
47948
48178
  }
48179
+ /**
48180
+ * Retrieves resources satisfying the spend query for the account.
48181
+ *
48182
+ * @param quantities - IDs of coins to exclude.
48183
+ * @param excludedIds - IDs of resources to be excluded from the query.
48184
+ * @returns A promise that resolves to an array of Resources.
48185
+ */
48186
+ async getResourcesToSpend(quantities, excludedIds) {
48187
+ const resources = await this.provider.getResourcesToSpend(
48188
+ this.address,
48189
+ quantities,
48190
+ excludedIds
48191
+ );
48192
+ return resources.map((resource) => ({
48193
+ ...resource,
48194
+ predicate: hexlify(this.bytes),
48195
+ predicateData: hexlify(this.predicateDataBytes),
48196
+ paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
48197
+ }));
48198
+ }
47949
48199
  /**
47950
48200
  * Sets the configurable constants for the predicate.
47951
48201
  *