@fuel-ts/account 0.0.0-rc-2021-20240411154255 → 0.0.0-rc-2045-20240411190910

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/account.d.ts +4 -5
  3. package/dist/account.d.ts.map +1 -1
  4. package/dist/configs.d.ts.map +1 -1
  5. package/dist/configs.global.js +1 -1
  6. package/dist/configs.global.js.map +1 -1
  7. package/dist/configs.js +1 -1
  8. package/dist/configs.js.map +1 -1
  9. package/dist/configs.mjs +1 -1
  10. package/dist/configs.mjs.map +1 -1
  11. package/dist/index.global.js +574 -841
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +574 -823
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +409 -657
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +2 -10
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +329 -911
  20. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  21. package/dist/providers/coin-quantity.d.ts +1 -1
  22. package/dist/providers/coin-quantity.d.ts.map +1 -1
  23. package/dist/providers/coin.d.ts +2 -4
  24. package/dist/providers/coin.d.ts.map +1 -1
  25. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  26. package/dist/providers/message.d.ts +1 -7
  27. package/dist/providers/message.d.ts.map +1 -1
  28. package/dist/providers/provider.d.ts +30 -37
  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 +25 -8
  35. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/utils.d.ts +0 -3
  37. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  38. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  39. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
  40. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  41. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
  42. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
  43. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  44. package/dist/providers/utils/gas.d.ts +2 -8
  45. package/dist/providers/utils/gas.d.ts.map +1 -1
  46. package/dist/test-utils/launchNode.d.ts.map +1 -1
  47. package/dist/test-utils.global.js +1073 -1557
  48. package/dist/test-utils.global.js.map +1 -1
  49. package/dist/test-utils.js +567 -798
  50. package/dist/test-utils.js.map +1 -1
  51. package/dist/test-utils.mjs +418 -649
  52. package/dist/test-utils.mjs.map +1 -1
  53. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  54. package/package.json +17 -17
@@ -289,7 +289,7 @@
289
289
  }
290
290
  return num !== null && typeof num === "object" && num.constructor.wordSize === BN2.wordSize && Array.isArray(num.words);
291
291
  };
292
- BN2.max = function max(left, right) {
292
+ BN2.max = function max2(left, right) {
293
293
  if (left.cmp(right) > 0)
294
294
  return left;
295
295
  return right;
@@ -5113,7 +5113,7 @@
5113
5113
  function isBlob(obj) {
5114
5114
  return typeof obj === "object" && typeof obj.arrayBuffer === "function" && typeof obj.type === "string" && typeof obj.stream === "function" && typeof obj.constructor === "function" && typeof obj.constructor.name === "string" && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
5115
5115
  }
5116
- function clone3(instance) {
5116
+ function clone(instance) {
5117
5117
  let p1, p2;
5118
5118
  let body = instance.body;
5119
5119
  if (instance.bodyUsed) {
@@ -6047,7 +6047,7 @@
6047
6047
  * @return Response
6048
6048
  */
6049
6049
  clone() {
6050
- return new Response2(clone3(this), {
6050
+ return new Response2(clone(this), {
6051
6051
  url: this.url,
6052
6052
  status: this.status,
6053
6053
  statusText: this.statusText,
@@ -6097,7 +6097,7 @@
6097
6097
  if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
6098
6098
  throw new TypeError("Request with GET/HEAD method cannot have body");
6099
6099
  }
6100
- let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone3(input) : null;
6100
+ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
6101
6101
  Body.call(this, inputBody, {
6102
6102
  timeout: init.timeout || input.timeout || 0,
6103
6103
  size: init.size || input.size || 0
@@ -28952,8 +28952,8 @@ spurious results.`);
28952
28952
  // ../versions/dist/index.mjs
28953
28953
  function getBuiltinVersions() {
28954
28954
  return {
28955
- FORC: "0.51.1",
28956
- FUEL_CORE: "0.24.2",
28955
+ FORC: "0.53.0",
28956
+ FUEL_CORE: "0.22.1",
28957
28957
  FUELS: "0.79.0"
28958
28958
  };
28959
28959
  }
@@ -29245,7 +29245,7 @@ This unreleased fuel-core build may include features and updates not yet support
29245
29245
  __publicField3(DateTime, "TAI64_NULL", "");
29246
29246
 
29247
29247
  // ../crypto/dist/index.mjs
29248
- var import_crypto9 = __toESM(__require("crypto"), 1);
29248
+ var import_crypto8 = __toESM(__require("crypto"), 1);
29249
29249
 
29250
29250
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
29251
29251
  var version = "6.7.1";
@@ -30317,27 +30317,6 @@ This unreleased fuel-core build may include features and updates not yet support
30317
30317
  };
30318
30318
  Object.freeze(pbkdf22);
30319
30319
 
30320
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/random.js
30321
- var locked5 = false;
30322
- var _randomBytes = function(length) {
30323
- return new Uint8Array((0, import_crypto2.randomBytes)(length));
30324
- };
30325
- var __randomBytes = _randomBytes;
30326
- function randomBytes3(length) {
30327
- return __randomBytes(length);
30328
- }
30329
- randomBytes3._ = _randomBytes;
30330
- randomBytes3.lock = function() {
30331
- locked5 = true;
30332
- };
30333
- randomBytes3.register = function(func) {
30334
- if (locked5) {
30335
- throw new Error("randomBytes is locked");
30336
- }
30337
- __randomBytes = func;
30338
- };
30339
- Object.freeze(randomBytes3);
30340
-
30341
30320
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
30342
30321
  var BN_03 = BigInt(0);
30343
30322
  var BN_36 = BigInt(36);
@@ -30922,8 +30901,8 @@ This unreleased fuel-core build may include features and updates not yet support
30922
30901
  }
30923
30902
 
30924
30903
  // ../crypto/dist/index.mjs
30904
+ var import_crypto9 = __toESM(__require("crypto"), 1);
30925
30905
  var import_crypto10 = __toESM(__require("crypto"), 1);
30926
- var import_crypto11 = __toESM(__require("crypto"), 1);
30927
30906
  var scrypt3 = (params) => {
30928
30907
  const { password, salt, n, p, r, dklen } = params;
30929
30908
  const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
@@ -30932,7 +30911,7 @@ This unreleased fuel-core build may include features and updates not yet support
30932
30911
  var keccak2562 = (data) => keccak_256(data);
30933
30912
  var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
30934
30913
  var randomBytes4 = (length) => {
30935
- const randomValues = Uint8Array.from(import_crypto10.default.randomBytes(length));
30914
+ const randomValues = Uint8Array.from(import_crypto9.default.randomBytes(length));
30936
30915
  return randomValues;
30937
30916
  };
30938
30917
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -30947,7 +30926,7 @@ This unreleased fuel-core build may include features and updates not yet support
30947
30926
  const salt = randomBytes4(32);
30948
30927
  const secret = keyFromPassword(password, salt);
30949
30928
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
30950
- const cipher = await import_crypto9.default.createCipheriv(ALGORITHM, secret, iv);
30929
+ const cipher = await import_crypto8.default.createCipheriv(ALGORITHM, secret, iv);
30951
30930
  let cipherData = cipher.update(dataBuffer);
30952
30931
  cipherData = Buffer.concat([cipherData, cipher.final()]);
30953
30932
  return {
@@ -30961,7 +30940,7 @@ This unreleased fuel-core build may include features and updates not yet support
30961
30940
  const salt = bufferFromString(keystore.salt);
30962
30941
  const secret = keyFromPassword(password, salt);
30963
30942
  const encryptedText = bufferFromString(keystore.data);
30964
- const decipher = await import_crypto9.default.createDecipheriv(ALGORITHM, secret, iv);
30943
+ const decipher = await import_crypto8.default.createDecipheriv(ALGORITHM, secret, iv);
30965
30944
  const decrypted = decipher.update(encryptedText);
30966
30945
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
30967
30946
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -30972,12 +30951,12 @@ This unreleased fuel-core build may include features and updates not yet support
30972
30951
  }
30973
30952
  };
30974
30953
  async function encryptJsonWalletData(data, key, iv) {
30975
- const cipher = await import_crypto11.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30954
+ const cipher = await import_crypto10.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30976
30955
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
30977
30956
  return new Uint8Array(encrypted);
30978
30957
  }
30979
30958
  async function decryptJsonWalletData(data, key, iv) {
30980
- const decipher = import_crypto11.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30959
+ const decipher = import_crypto10.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30981
30960
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
30982
30961
  return new Uint8Array(decrypted);
30983
30962
  }
@@ -31165,7 +31144,7 @@ This unreleased fuel-core build may include features and updates not yet support
31165
31144
  toEvmAddress() {
31166
31145
  const b256Address = toB256(this.bech32Address);
31167
31146
  return {
31168
- value: clearFirst12BytesFromB256(b256Address)
31147
+ bits: clearFirst12BytesFromB256(b256Address)
31169
31148
  };
31170
31149
  }
31171
31150
  /**
@@ -31175,7 +31154,7 @@ This unreleased fuel-core build may include features and updates not yet support
31175
31154
  */
31176
31155
  toAssetId() {
31177
31156
  return {
31178
- value: this.toB256()
31157
+ bits: this.toB256()
31179
31158
  };
31180
31159
  }
31181
31160
  /**
@@ -31516,182 +31495,32 @@ This unreleased fuel-core build may include features and updates not yet support
31516
31495
  function toBytes3(value, bytesPadding) {
31517
31496
  return bn(value).toBytes(bytesPadding);
31518
31497
  }
31519
-
31520
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
31521
- function _isPlaceholder(a) {
31522
- return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
31523
- }
31524
-
31525
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
31526
- function _curry1(fn) {
31527
- return function f1(a) {
31528
- if (arguments.length === 0 || _isPlaceholder(a)) {
31529
- return f1;
31530
- } else {
31531
- return fn.apply(this, arguments);
31532
- }
31533
- };
31498
+ function max(...numbers) {
31499
+ return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
31534
31500
  }
31535
31501
 
31536
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
31537
- var isArray_default = Array.isArray || function _isArray(val) {
31538
- return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
31539
- };
31540
-
31541
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
31542
- var type = /* @__PURE__ */ _curry1(function type2(val) {
31543
- return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
31544
- });
31545
- var type_default = type;
31546
-
31547
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
31548
- var pad = function pad2(n) {
31549
- return (n < 10 ? "0" : "") + n;
31550
- };
31551
- var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
31552
- return d.toISOString();
31553
- } : function _toISOString3(d) {
31554
- return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
31555
- };
31556
-
31557
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
31558
- var isInteger_default = Number.isInteger || function _isInteger(n) {
31559
- return n << 0 === n;
31560
- };
31561
-
31562
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
31563
- function _cloneRegExp(pattern) {
31564
- return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
31565
- }
31566
-
31567
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
31568
- function _clone(value, deep, map) {
31569
- map || (map = new _ObjectMap());
31570
- if (_isPrimitive(value)) {
31571
- return value;
31572
- }
31573
- var copy = function copy2(copiedValue) {
31574
- var cachedCopy = map.get(value);
31575
- if (cachedCopy) {
31576
- return cachedCopy;
31577
- }
31578
- map.set(value, copiedValue);
31579
- for (var key in value) {
31580
- if (Object.prototype.hasOwnProperty.call(value, key)) {
31581
- copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
31582
- }
31583
- }
31584
- return copiedValue;
31585
- };
31586
- switch (type_default(value)) {
31587
- case "Object":
31588
- return copy(Object.create(Object.getPrototypeOf(value)));
31589
- case "Array":
31590
- return copy([]);
31591
- case "Date":
31592
- return new Date(value.valueOf());
31593
- case "RegExp":
31594
- return _cloneRegExp(value);
31595
- case "Int8Array":
31596
- case "Uint8Array":
31597
- case "Uint8ClampedArray":
31598
- case "Int16Array":
31599
- case "Uint16Array":
31600
- case "Int32Array":
31601
- case "Uint32Array":
31602
- case "Float32Array":
31603
- case "Float64Array":
31604
- case "BigInt64Array":
31605
- case "BigUint64Array":
31606
- return value.slice();
31607
- default:
31608
- return value;
31609
- }
31610
- }
31611
- function _isPrimitive(param) {
31612
- var type3 = typeof param;
31613
- return param == null || type3 != "object" && type3 != "function";
31614
- }
31615
- var _ObjectMap = /* @__PURE__ */ function() {
31616
- function _ObjectMap2() {
31617
- this.map = {};
31618
- this.length = 0;
31619
- }
31620
- _ObjectMap2.prototype.set = function(key, value) {
31621
- const hashedKey = this.hash(key);
31622
- let bucket = this.map[hashedKey];
31623
- if (!bucket) {
31624
- this.map[hashedKey] = bucket = [];
31625
- }
31626
- bucket.push([key, value]);
31627
- this.length += 1;
31628
- };
31629
- _ObjectMap2.prototype.hash = function(key) {
31630
- let hashedKey = [];
31631
- for (var value in key) {
31632
- hashedKey.push(Object.prototype.toString.call(key[value]));
31633
- }
31634
- return hashedKey.join();
31635
- };
31636
- _ObjectMap2.prototype.get = function(key) {
31637
- if (this.length <= 180) {
31638
- for (const p in this.map) {
31639
- const bucket2 = this.map[p];
31640
- for (let i = 0; i < bucket2.length; i += 1) {
31641
- const element = bucket2[i];
31642
- if (element[0] === key) {
31643
- return element[1];
31644
- }
31645
- }
31646
- }
31647
- return;
31648
- }
31649
- const hashedKey = this.hash(key);
31650
- const bucket = this.map[hashedKey];
31651
- if (!bucket) {
31652
- return;
31653
- }
31654
- for (let i = 0; i < bucket.length; i += 1) {
31655
- const element = bucket[i];
31656
- if (element[0] === key) {
31657
- return element[1];
31658
- }
31659
- }
31660
- };
31661
- return _ObjectMap2;
31662
- }();
31663
-
31664
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
31665
- var clone = /* @__PURE__ */ _curry1(function clone2(value) {
31666
- return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
31667
- });
31668
- var clone_default = clone;
31669
-
31670
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
31671
- var hasProtoTrim = typeof String.prototype.trim === "function";
31672
-
31673
31502
  // src/providers/coin-quantity.ts
31674
31503
  var coinQuantityfy = (coinQuantityLike) => {
31675
31504
  let assetId;
31676
31505
  let amount;
31677
- let max;
31506
+ let max2;
31678
31507
  if (Array.isArray(coinQuantityLike)) {
31679
31508
  amount = coinQuantityLike[0];
31680
31509
  assetId = coinQuantityLike[1] ?? BaseAssetId;
31681
- max = coinQuantityLike[2] ?? void 0;
31510
+ max2 = coinQuantityLike[2] ?? void 0;
31682
31511
  } else {
31683
31512
  amount = coinQuantityLike.amount;
31684
31513
  assetId = coinQuantityLike.assetId ?? BaseAssetId;
31685
- max = coinQuantityLike.max ?? void 0;
31514
+ max2 = coinQuantityLike.max ?? void 0;
31686
31515
  }
31687
31516
  const bnAmount = bn(amount);
31688
31517
  return {
31689
31518
  assetId: hexlify(assetId),
31690
31519
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
31691
- max: max ? bn(max) : void 0
31520
+ max: max2 ? bn(max2) : void 0
31692
31521
  };
31693
31522
  };
31694
- var addAmountToCoinQuantities = (params) => {
31523
+ var addAmountToAsset = (params) => {
31695
31524
  const { amount, assetId } = params;
31696
31525
  const coinQuantities = [...params.coinQuantities];
31697
31526
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -31776,6 +31605,7 @@ This unreleased fuel-core build may include features and updates not yet support
31776
31605
  var ENCODING_V1 = "1";
31777
31606
  var WORD_SIZE = 8;
31778
31607
  var BYTES_32 = 32;
31608
+ var UTXO_ID_LEN = BYTES_32 + 1;
31779
31609
  var ASSET_ID_LEN = BYTES_32;
31780
31610
  var ADDRESS_LEN = BYTES_32;
31781
31611
  var NONCE_LEN = BYTES_32;
@@ -31783,9 +31613,9 @@ This unreleased fuel-core build may include features and updates not yet support
31783
31613
  var TX_POINTER_LEN = WORD_SIZE * 2;
31784
31614
  var MAX_BYTES = 2 ** 32 - 1;
31785
31615
  var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
31786
- ASSET_ID_LEN + // Base asset ID
31616
+ WORD_SIZE + // Tx size
31787
31617
  // Asset ID/Balance coin input pairs
31788
- maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
31618
+ maxInputs * (ASSET_ID_LEN + WORD_SIZE);
31789
31619
  var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
31790
31620
  WORD_SIZE + // Gas limit
31791
31621
  WORD_SIZE + // Script size
@@ -31803,6 +31633,7 @@ This unreleased fuel-core build may include features and updates not yet support
31803
31633
  ASSET_ID_LEN + // Asset id
31804
31634
  TX_POINTER_LEN + // TxPointer
31805
31635
  WORD_SIZE + // Witnesses index
31636
+ WORD_SIZE + // Maturity
31806
31637
  WORD_SIZE + // Predicate size
31807
31638
  WORD_SIZE + // Predicate data size
31808
31639
  WORD_SIZE;
@@ -32124,7 +31955,7 @@ This unreleased fuel-core build may include features and updates not yet support
32124
31955
  constructor(name, coders) {
32125
31956
  const caseIndexCoder = new BigNumberCoder("u64");
32126
31957
  const encodedValueSize = Object.values(coders).reduce(
32127
- (max, coder) => Math.max(max, coder.encodedLength),
31958
+ (max2, coder) => Math.max(max2, coder.encodedLength),
32128
31959
  0
32129
31960
  );
32130
31961
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -32828,7 +32659,7 @@ This unreleased fuel-core build may include features and updates not yet support
32828
32659
  constructor(name, coders) {
32829
32660
  const caseIndexCoder = new BigNumberCoder("u64");
32830
32661
  const encodedValueSize = Object.values(coders).reduce(
32831
- (max, coder) => Math.max(max, coder.encodedLength),
32662
+ (max2, coder) => Math.max(max2, coder.encodedLength),
32832
32663
  0
32833
32664
  );
32834
32665
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -33540,19 +33371,18 @@ This unreleased fuel-core build may include features and updates not yet support
33540
33371
  encode(value) {
33541
33372
  const parts = [];
33542
33373
  parts.push(new B256Coder().encode(value.txID));
33543
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33374
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33544
33375
  parts.push(new B256Coder().encode(value.owner));
33545
33376
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33546
33377
  parts.push(new B256Coder().encode(value.assetId));
33547
33378
  parts.push(new TxPointerCoder().encode(value.txPointer));
33548
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33379
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33380
+ parts.push(new NumberCoder("u32").encode(value.maturity));
33549
33381
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33550
- parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33551
- parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33552
- parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33553
- parts.push(
33554
- new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33555
- );
33382
+ parts.push(new NumberCoder("u32").encode(value.predicateLength));
33383
+ parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33384
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33385
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33556
33386
  return concat(parts);
33557
33387
  }
33558
33388
  decode(data, offset) {
@@ -33560,7 +33390,7 @@ This unreleased fuel-core build may include features and updates not yet support
33560
33390
  let o = offset;
33561
33391
  [decoded, o] = new B256Coder().decode(data, o);
33562
33392
  const txID = decoded;
33563
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33393
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33564
33394
  const outputIndex = decoded;
33565
33395
  [decoded, o] = new B256Coder().decode(data, o);
33566
33396
  const owner = decoded;
@@ -33570,17 +33400,19 @@ This unreleased fuel-core build may include features and updates not yet support
33570
33400
  const assetId = decoded;
33571
33401
  [decoded, o] = new TxPointerCoder().decode(data, o);
33572
33402
  const txPointer = decoded;
33573
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33403
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33574
33404
  const witnessIndex = Number(decoded);
33405
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33406
+ const maturity = decoded;
33575
33407
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33576
33408
  const predicateGasUsed = decoded;
33577
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33409
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33578
33410
  const predicateLength = decoded;
33579
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33411
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33580
33412
  const predicateDataLength = decoded;
33581
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33413
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33582
33414
  const predicate = decoded;
33583
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33415
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33584
33416
  const predicateData = decoded;
33585
33417
  return [
33586
33418
  {
@@ -33592,6 +33424,7 @@ This unreleased fuel-core build may include features and updates not yet support
33592
33424
  assetId,
33593
33425
  txPointer,
33594
33426
  witnessIndex,
33427
+ maturity,
33595
33428
  predicateGasUsed,
33596
33429
  predicateLength,
33597
33430
  predicateDataLength,
@@ -33609,7 +33442,7 @@ This unreleased fuel-core build may include features and updates not yet support
33609
33442
  encode(value) {
33610
33443
  const parts = [];
33611
33444
  parts.push(new B256Coder().encode(value.txID));
33612
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33445
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33613
33446
  parts.push(new B256Coder().encode(value.balanceRoot));
33614
33447
  parts.push(new B256Coder().encode(value.stateRoot));
33615
33448
  parts.push(new TxPointerCoder().encode(value.txPointer));
@@ -33621,7 +33454,7 @@ This unreleased fuel-core build may include features and updates not yet support
33621
33454
  let o = offset;
33622
33455
  [decoded, o] = new B256Coder().decode(data, o);
33623
33456
  const txID = decoded;
33624
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33457
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33625
33458
  const outputIndex = decoded;
33626
33459
  [decoded, o] = new B256Coder().decode(data, o);
33627
33460
  const balanceRoot = decoded;
@@ -33670,16 +33503,14 @@ This unreleased fuel-core build may include features and updates not yet support
33670
33503
  parts.push(new ByteArrayCoder(32).encode(value.recipient));
33671
33504
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33672
33505
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33673
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33506
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33674
33507
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33675
- parts.push(new BigNumberCoder("u64").encode(data.length));
33676
- parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33677
- parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33508
+ parts.push(new NumberCoder("u32").encode(data.length));
33509
+ parts.push(new NumberCoder("u32").encode(value.predicateLength));
33510
+ parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33678
33511
  parts.push(new ByteArrayCoder(data.length).encode(data));
33679
- parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33680
- parts.push(
33681
- new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33682
- );
33512
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33513
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33683
33514
  return concat(parts);
33684
33515
  }
33685
33516
  static decodeData(messageData) {
@@ -33699,21 +33530,21 @@ This unreleased fuel-core build may include features and updates not yet support
33699
33530
  const amount = decoded;
33700
33531
  [decoded, o] = new B256Coder().decode(data, o);
33701
33532
  const nonce = decoded;
33702
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33533
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33703
33534
  const witnessIndex = Number(decoded);
33704
33535
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33705
33536
  const predicateGasUsed = decoded;
33706
33537
  [decoded, o] = new NumberCoder("u32").decode(data, o);
33707
33538
  const dataLength2 = decoded;
33708
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33539
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33709
33540
  const predicateLength = decoded;
33710
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33541
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33711
33542
  const predicateDataLength = decoded;
33712
33543
  [decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
33713
33544
  const messageData = decoded;
33714
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33545
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33715
33546
  const predicate = decoded;
33716
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33547
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33717
33548
  const predicateData = decoded;
33718
33549
  return [
33719
33550
  {
@@ -34025,7 +33856,7 @@ This unreleased fuel-core build may include features and updates not yet support
34025
33856
  }
34026
33857
  };
34027
33858
  var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
34028
- PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
33859
+ PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
34029
33860
  PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
34030
33861
  PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
34031
33862
  PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
@@ -34073,9 +33904,9 @@ This unreleased fuel-core build may include features and updates not yet support
34073
33904
  let o = offset;
34074
33905
  const policies = [];
34075
33906
  if (policyTypes & 1) {
34076
- const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
33907
+ const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
34077
33908
  o = nextOffset;
34078
- policies.push({ type: 1, data: tip });
33909
+ policies.push({ type: 1, data: gasPrice });
34079
33910
  }
34080
33911
  if (policyTypes & 2) {
34081
33912
  const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
@@ -34307,15 +34138,15 @@ This unreleased fuel-core build may include features and updates not yet support
34307
34138
  encode(value) {
34308
34139
  const parts = [];
34309
34140
  parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
34310
- parts.push(new B256Coder().encode(value.receiptsRoot));
34311
- parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
34312
- parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
34141
+ parts.push(new NumberCoder("u32").encode(value.scriptLength));
34142
+ parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
34313
34143
  parts.push(new NumberCoder("u32").encode(value.policyTypes));
34314
- parts.push(new NumberCoder("u16").encode(value.inputsCount));
34315
- parts.push(new NumberCoder("u16").encode(value.outputsCount));
34316
- parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34317
- parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
34318
- parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
34144
+ parts.push(new NumberCoder("u8").encode(value.inputsCount));
34145
+ parts.push(new NumberCoder("u8").encode(value.outputsCount));
34146
+ parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34147
+ parts.push(new B256Coder().encode(value.receiptsRoot));
34148
+ parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
34149
+ parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
34319
34150
  parts.push(new PoliciesCoder().encode(value.policies));
34320
34151
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34321
34152
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
@@ -34327,23 +34158,23 @@ This unreleased fuel-core build may include features and updates not yet support
34327
34158
  let o = offset;
34328
34159
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34329
34160
  const scriptGasLimit = decoded;
34330
- [decoded, o] = new B256Coder().decode(data, o);
34331
- const receiptsRoot = decoded;
34332
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34161
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34333
34162
  const scriptLength = decoded;
34334
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34163
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34335
34164
  const scriptDataLength = decoded;
34336
34165
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34337
34166
  const policyTypes = decoded;
34338
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34167
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34339
34168
  const inputsCount = decoded;
34340
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34169
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34341
34170
  const outputsCount = decoded;
34342
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34171
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34343
34172
  const witnessesCount = decoded;
34344
- [decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
34173
+ [decoded, o] = new B256Coder().decode(data, o);
34174
+ const receiptsRoot = decoded;
34175
+ [decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
34345
34176
  const script = decoded;
34346
- [decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
34177
+ [decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
34347
34178
  const scriptData = decoded;
34348
34179
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34349
34180
  const policies = decoded;
@@ -34381,19 +34212,18 @@ This unreleased fuel-core build may include features and updates not yet support
34381
34212
  }
34382
34213
  encode(value) {
34383
34214
  const parts = [];
34384
- parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
34385
- parts.push(new B256Coder().encode(value.salt));
34386
- parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
34215
+ parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
34216
+ parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
34387
34217
  parts.push(new NumberCoder("u32").encode(value.policyTypes));
34388
- parts.push(new NumberCoder("u16").encode(value.inputsCount));
34389
- parts.push(new NumberCoder("u16").encode(value.outputsCount));
34390
- parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34218
+ parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
34219
+ parts.push(new NumberCoder("u8").encode(value.inputsCount));
34220
+ parts.push(new NumberCoder("u8").encode(value.outputsCount));
34221
+ parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34222
+ parts.push(new B256Coder().encode(value.salt));
34223
+ parts.push(new PoliciesCoder().encode(value.policies));
34391
34224
  parts.push(
34392
- new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
34393
- value.storageSlots
34394
- )
34225
+ new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
34395
34226
  );
34396
- parts.push(new PoliciesCoder().encode(value.policies));
34397
34227
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34398
34228
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
34399
34229
  parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
@@ -34402,27 +34232,26 @@ This unreleased fuel-core build may include features and updates not yet support
34402
34232
  decode(data, offset) {
34403
34233
  let decoded;
34404
34234
  let o = offset;
34405
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34235
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34236
+ const bytecodeLength = decoded;
34237
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34406
34238
  const bytecodeWitnessIndex = decoded;
34407
- [decoded, o] = new B256Coder().decode(data, o);
34408
- const salt = decoded;
34409
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34410
- const storageSlotsCount = decoded;
34411
34239
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34412
34240
  const policyTypes = decoded;
34413
34241
  [decoded, o] = new NumberCoder("u16").decode(data, o);
34242
+ const storageSlotsCount = decoded;
34243
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34414
34244
  const inputsCount = decoded;
34415
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34245
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34416
34246
  const outputsCount = decoded;
34417
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34247
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34418
34248
  const witnessesCount = decoded;
34419
- [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
34420
- data,
34421
- o
34422
- );
34423
- const storageSlots = decoded;
34249
+ [decoded, o] = new B256Coder().decode(data, o);
34250
+ const salt = decoded;
34424
34251
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34425
34252
  const policies = decoded;
34253
+ [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
34254
+ const storageSlots = decoded;
34426
34255
  [decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
34427
34256
  const inputs = decoded;
34428
34257
  [decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
@@ -34432,6 +34261,7 @@ This unreleased fuel-core build may include features and updates not yet support
34432
34261
  return [
34433
34262
  {
34434
34263
  type: 1,
34264
+ bytecodeLength,
34435
34265
  bytecodeWitnessIndex,
34436
34266
  policyTypes,
34437
34267
  storageSlotsCount,
@@ -34460,7 +34290,6 @@ This unreleased fuel-core build may include features and updates not yet support
34460
34290
  parts.push(new OutputContractCoder().encode(value.outputContract));
34461
34291
  parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
34462
34292
  parts.push(new B256Coder().encode(value.mintAssetId));
34463
- parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
34464
34293
  return concat(parts);
34465
34294
  }
34466
34295
  decode(data, offset) {
@@ -34476,8 +34305,6 @@ This unreleased fuel-core build may include features and updates not yet support
34476
34305
  const mintAmount = decoded;
34477
34306
  [decoded, o] = new B256Coder().decode(data, o);
34478
34307
  const mintAssetId = decoded;
34479
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34480
- const gasPrice = decoded;
34481
34308
  return [
34482
34309
  {
34483
34310
  type: 2,
@@ -34485,8 +34312,7 @@ This unreleased fuel-core build may include features and updates not yet support
34485
34312
  inputContract,
34486
34313
  outputContract,
34487
34314
  mintAmount,
34488
- mintAssetId,
34489
- gasPrice
34315
+ mintAssetId
34490
34316
  },
34491
34317
  o
34492
34318
  ];
@@ -34793,6 +34619,159 @@ This unreleased fuel-core build may include features and updates not yet support
34793
34619
  // src/providers/provider.ts
34794
34620
  var import_graphql_request = __toESM(require_dist2());
34795
34621
 
34622
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
34623
+ function _isPlaceholder(a) {
34624
+ return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
34625
+ }
34626
+
34627
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
34628
+ function _curry1(fn) {
34629
+ return function f1(a) {
34630
+ if (arguments.length === 0 || _isPlaceholder(a)) {
34631
+ return f1;
34632
+ } else {
34633
+ return fn.apply(this, arguments);
34634
+ }
34635
+ };
34636
+ }
34637
+
34638
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
34639
+ var isArray_default = Array.isArray || function _isArray(val) {
34640
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
34641
+ };
34642
+
34643
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
34644
+ var type = /* @__PURE__ */ _curry1(function type2(val) {
34645
+ return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
34646
+ });
34647
+ var type_default = type;
34648
+
34649
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
34650
+ var pad = function pad2(n) {
34651
+ return (n < 10 ? "0" : "") + n;
34652
+ };
34653
+ var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
34654
+ return d.toISOString();
34655
+ } : function _toISOString3(d) {
34656
+ 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";
34657
+ };
34658
+
34659
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
34660
+ var isInteger_default = Number.isInteger || function _isInteger(n) {
34661
+ return n << 0 === n;
34662
+ };
34663
+
34664
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
34665
+ function _cloneRegExp(pattern) {
34666
+ 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" : ""));
34667
+ }
34668
+
34669
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
34670
+ function _clone(value, deep, map) {
34671
+ map || (map = new _ObjectMap());
34672
+ if (_isPrimitive(value)) {
34673
+ return value;
34674
+ }
34675
+ var copy = function copy2(copiedValue) {
34676
+ var cachedCopy = map.get(value);
34677
+ if (cachedCopy) {
34678
+ return cachedCopy;
34679
+ }
34680
+ map.set(value, copiedValue);
34681
+ for (var key in value) {
34682
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
34683
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
34684
+ }
34685
+ }
34686
+ return copiedValue;
34687
+ };
34688
+ switch (type_default(value)) {
34689
+ case "Object":
34690
+ return copy(Object.create(Object.getPrototypeOf(value)));
34691
+ case "Array":
34692
+ return copy([]);
34693
+ case "Date":
34694
+ return new Date(value.valueOf());
34695
+ case "RegExp":
34696
+ return _cloneRegExp(value);
34697
+ case "Int8Array":
34698
+ case "Uint8Array":
34699
+ case "Uint8ClampedArray":
34700
+ case "Int16Array":
34701
+ case "Uint16Array":
34702
+ case "Int32Array":
34703
+ case "Uint32Array":
34704
+ case "Float32Array":
34705
+ case "Float64Array":
34706
+ case "BigInt64Array":
34707
+ case "BigUint64Array":
34708
+ return value.slice();
34709
+ default:
34710
+ return value;
34711
+ }
34712
+ }
34713
+ function _isPrimitive(param) {
34714
+ var type3 = typeof param;
34715
+ return param == null || type3 != "object" && type3 != "function";
34716
+ }
34717
+ var _ObjectMap = /* @__PURE__ */ function() {
34718
+ function _ObjectMap2() {
34719
+ this.map = {};
34720
+ this.length = 0;
34721
+ }
34722
+ _ObjectMap2.prototype.set = function(key, value) {
34723
+ const hashedKey = this.hash(key);
34724
+ let bucket = this.map[hashedKey];
34725
+ if (!bucket) {
34726
+ this.map[hashedKey] = bucket = [];
34727
+ }
34728
+ bucket.push([key, value]);
34729
+ this.length += 1;
34730
+ };
34731
+ _ObjectMap2.prototype.hash = function(key) {
34732
+ let hashedKey = [];
34733
+ for (var value in key) {
34734
+ hashedKey.push(Object.prototype.toString.call(key[value]));
34735
+ }
34736
+ return hashedKey.join();
34737
+ };
34738
+ _ObjectMap2.prototype.get = function(key) {
34739
+ if (this.length <= 180) {
34740
+ for (const p in this.map) {
34741
+ const bucket2 = this.map[p];
34742
+ for (let i = 0; i < bucket2.length; i += 1) {
34743
+ const element = bucket2[i];
34744
+ if (element[0] === key) {
34745
+ return element[1];
34746
+ }
34747
+ }
34748
+ }
34749
+ return;
34750
+ }
34751
+ const hashedKey = this.hash(key);
34752
+ const bucket = this.map[hashedKey];
34753
+ if (!bucket) {
34754
+ return;
34755
+ }
34756
+ for (let i = 0; i < bucket.length; i += 1) {
34757
+ const element = bucket[i];
34758
+ if (element[0] === key) {
34759
+ return element[1];
34760
+ }
34761
+ }
34762
+ };
34763
+ return _ObjectMap2;
34764
+ }();
34765
+
34766
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
34767
+ var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
34768
+ return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
34769
+ });
34770
+ var clone_default = clone2;
34771
+
34772
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
34773
+ var hasProtoTrim = typeof String.prototype.trim === "function";
34774
+
34796
34775
  // ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
34797
34776
  var __assign = function() {
34798
34777
  __assign = Object.assign || function __assign2(t) {
@@ -37960,10 +37939,14 @@ spurious results.`);
37960
37939
  // src/providers/__generated__/operations.ts
37961
37940
  var ReceiptFragmentFragmentDoc = lib_default2`
37962
37941
  fragment receiptFragment on Receipt {
37963
- id
37942
+ contract {
37943
+ id
37944
+ }
37964
37945
  pc
37965
37946
  is
37966
- to
37947
+ to {
37948
+ id
37949
+ }
37967
37950
  toAddress
37968
37951
  amount
37969
37952
  assetId
@@ -38001,16 +37984,10 @@ spurious results.`);
38001
37984
  id
38002
37985
  }
38003
37986
  time
38004
- receipts {
38005
- ...receiptFragment
38006
- }
38007
37987
  programState {
38008
37988
  returnType
38009
37989
  data
38010
37990
  }
38011
- receipts {
38012
- ...receiptFragment
38013
- }
38014
37991
  }
38015
37992
  ... on FailureStatus {
38016
37993
  block {
@@ -38018,24 +37995,26 @@ spurious results.`);
38018
37995
  }
38019
37996
  time
38020
37997
  reason
38021
- receipts {
38022
- ...receiptFragment
38023
- }
38024
37998
  }
38025
37999
  ... on SqueezedOutStatus {
38026
38000
  reason
38027
38001
  }
38028
38002
  }
38029
- ${ReceiptFragmentFragmentDoc}`;
38003
+ `;
38030
38004
  var TransactionFragmentFragmentDoc = lib_default2`
38031
38005
  fragment transactionFragment on Transaction {
38032
38006
  id
38033
38007
  rawPayload
38008
+ gasPrice
38009
+ receipts {
38010
+ ...receiptFragment
38011
+ }
38034
38012
  status {
38035
38013
  ...transactionStatusFragment
38036
38014
  }
38037
38015
  }
38038
- ${TransactionStatusFragmentFragmentDoc}`;
38016
+ ${ReceiptFragmentFragmentDoc}
38017
+ ${TransactionStatusFragmentFragmentDoc}`;
38039
38018
  var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
38040
38019
  fragment inputEstimatePredicatesFragment on Input {
38041
38020
  ... on InputCoin {
@@ -38053,46 +38032,6 @@ spurious results.`);
38053
38032
  }
38054
38033
  }
38055
38034
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
38056
- var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
38057
- fragment dryRunFailureStatusFragment on DryRunFailureStatus {
38058
- reason
38059
- programState {
38060
- returnType
38061
- data
38062
- }
38063
- }
38064
- `;
38065
- var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
38066
- fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
38067
- programState {
38068
- returnType
38069
- data
38070
- }
38071
- }
38072
- `;
38073
- var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
38074
- fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
38075
- ... on DryRunFailureStatus {
38076
- ...dryRunFailureStatusFragment
38077
- }
38078
- ... on DryRunSuccessStatus {
38079
- ...dryRunSuccessStatusFragment
38080
- }
38081
- }
38082
- ${DryRunFailureStatusFragmentFragmentDoc}
38083
- ${DryRunSuccessStatusFragmentFragmentDoc}`;
38084
- var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
38085
- fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
38086
- id
38087
- status {
38088
- ...dryRunTransactionStatusFragment
38089
- }
38090
- receipts {
38091
- ...receiptFragment
38092
- }
38093
- }
38094
- ${DryRunTransactionStatusFragmentFragmentDoc}
38095
- ${ReceiptFragmentFragmentDoc}`;
38096
38035
  var CoinFragmentFragmentDoc = lib_default2`
38097
38036
  fragment coinFragment on Coin {
38098
38037
  __typename
@@ -38100,6 +38039,7 @@ ${ReceiptFragmentFragmentDoc}`;
38100
38039
  owner
38101
38040
  amount
38102
38041
  assetId
38042
+ maturity
38103
38043
  blockCreated
38104
38044
  txCreatedIdx
38105
38045
  }
@@ -38138,32 +38078,26 @@ ${ReceiptFragmentFragmentDoc}`;
38138
38078
  messageBlockHeader {
38139
38079
  id
38140
38080
  daHeight
38141
- consensusParametersVersion
38142
- stateTransitionBytecodeVersion
38143
38081
  transactionsCount
38144
- messageReceiptCount
38145
38082
  transactionsRoot
38146
- messageOutboxRoot
38147
- eventInboxRoot
38148
38083
  height
38149
38084
  prevRoot
38150
38085
  time
38151
38086
  applicationHash
38087
+ messageReceiptRoot
38088
+ messageReceiptCount
38152
38089
  }
38153
38090
  commitBlockHeader {
38154
38091
  id
38155
38092
  daHeight
38156
- consensusParametersVersion
38157
- stateTransitionBytecodeVersion
38158
38093
  transactionsCount
38159
- messageReceiptCount
38160
38094
  transactionsRoot
38161
- messageOutboxRoot
38162
- eventInboxRoot
38163
38095
  height
38164
38096
  prevRoot
38165
38097
  time
38166
38098
  applicationHash
38099
+ messageReceiptRoot
38100
+ messageReceiptCount
38167
38101
  }
38168
38102
  sender
38169
38103
  recipient
@@ -38182,8 +38116,8 @@ ${ReceiptFragmentFragmentDoc}`;
38182
38116
  var BlockFragmentFragmentDoc = lib_default2`
38183
38117
  fragment blockFragment on Block {
38184
38118
  id
38185
- height
38186
38119
  header {
38120
+ height
38187
38121
  time
38188
38122
  }
38189
38123
  transactions {
@@ -38241,11 +38175,6 @@ ${ReceiptFragmentFragmentDoc}`;
38241
38175
  `;
38242
38176
  var GasCostsFragmentFragmentDoc = lib_default2`
38243
38177
  fragment GasCostsFragment on GasCosts {
38244
- version {
38245
- ... on Version {
38246
- value
38247
- }
38248
- }
38249
38178
  add
38250
38179
  addi
38251
38180
  aloc
@@ -38258,6 +38187,7 @@ ${ReceiptFragmentFragmentDoc}`;
38258
38187
  cb
38259
38188
  cfei
38260
38189
  cfsi
38190
+ croo
38261
38191
  div
38262
38192
  divi
38263
38193
  ecr1
@@ -38340,9 +38270,6 @@ ${ReceiptFragmentFragmentDoc}`;
38340
38270
  ccp {
38341
38271
  ...DependentCostFragment
38342
38272
  }
38343
- croo {
38344
- ...DependentCostFragment
38345
- }
38346
38273
  csiz {
38347
38274
  ...DependentCostFragment
38348
38275
  }
@@ -38402,11 +38329,6 @@ ${ReceiptFragmentFragmentDoc}`;
38402
38329
  ${DependentCostFragmentFragmentDoc}`;
38403
38330
  var ConsensusParametersFragmentFragmentDoc = lib_default2`
38404
38331
  fragment consensusParametersFragment on ConsensusParameters {
38405
- version {
38406
- ... on Version {
38407
- value
38408
- }
38409
- }
38410
38332
  txParams {
38411
38333
  ...TxParametersFragment
38412
38334
  }
@@ -38466,9 +38388,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38466
38388
  fragment nodeInfoFragment on NodeInfo {
38467
38389
  utxoValidation
38468
38390
  vmBacktrace
38391
+ minGasPrice
38469
38392
  maxTx
38470
38393
  maxDepth
38471
38394
  nodeVersion
38395
+ peers {
38396
+ id
38397
+ addresses
38398
+ clientVersion
38399
+ blockHeight
38400
+ lastHeartbeatMs
38401
+ appScore
38402
+ }
38472
38403
  }
38473
38404
  `;
38474
38405
  var GetVersionDocument = lib_default2`
@@ -38503,9 +38434,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38503
38434
  query getTransactionWithReceipts($transactionId: TransactionId!) {
38504
38435
  transaction(id: $transactionId) {
38505
38436
  ...transactionFragment
38437
+ receipts {
38438
+ ...receiptFragment
38439
+ }
38506
38440
  }
38507
38441
  }
38508
- ${TransactionFragmentFragmentDoc}`;
38442
+ ${TransactionFragmentFragmentDoc}
38443
+ ${ReceiptFragmentFragmentDoc}`;
38509
38444
  var GetTransactionsDocument = lib_default2`
38510
38445
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
38511
38446
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -38633,20 +38568,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38633
38568
  }
38634
38569
  }
38635
38570
  ${BalanceFragmentFragmentDoc}`;
38636
- var GetLatestGasPriceDocument = lib_default2`
38637
- query getLatestGasPrice {
38638
- latestGasPrice {
38639
- gasPrice
38640
- }
38641
- }
38642
- `;
38643
- var EstimateGasPriceDocument = lib_default2`
38644
- query estimateGasPrice($blockHorizon: U32!) {
38645
- estimateGasPrice(blockHorizon: $blockHorizon) {
38646
- gasPrice
38647
- }
38648
- }
38649
- `;
38650
38571
  var GetBalancesDocument = lib_default2`
38651
38572
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
38652
38573
  balances(
@@ -38701,12 +38622,12 @@ ${MessageCoinFragmentFragmentDoc}`;
38701
38622
  }
38702
38623
  `;
38703
38624
  var DryRunDocument = lib_default2`
38704
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
38705
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
38706
- ...dryRunTransactionExecutionStatusFragment
38625
+ mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
38626
+ dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
38627
+ ...receiptFragment
38707
38628
  }
38708
38629
  }
38709
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
38630
+ ${ReceiptFragmentFragmentDoc}`;
38710
38631
  var SubmitDocument = lib_default2`
38711
38632
  mutation submit($encodedTransaction: HexString!) {
38712
38633
  submit(tx: $encodedTransaction) {
@@ -38789,12 +38710,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38789
38710
  getBalance(variables, options) {
38790
38711
  return requester(GetBalanceDocument, variables, options);
38791
38712
  },
38792
- getLatestGasPrice(variables, options) {
38793
- return requester(GetLatestGasPriceDocument, variables, options);
38794
- },
38795
- estimateGasPrice(variables, options) {
38796
- return requester(EstimateGasPriceDocument, variables, options);
38797
- },
38798
38713
  getBalances(variables, options) {
38799
38714
  return requester(GetBalancesDocument, variables, options);
38800
38715
  },
@@ -38862,14 +38777,11 @@ ${MessageCoinFragmentFragmentDoc}`;
38862
38777
  let data;
38863
38778
  let errors;
38864
38779
  try {
38865
- const sanitizedText = text.replace(/\s/g, "");
38866
- ({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
38780
+ ({ data, errors } = JSON.parse(text.replace(/^data:/, "")));
38867
38781
  } catch (e) {
38868
38782
  throw new FuelError(
38869
38783
  ErrorCode.STREAM_PARSING_ERROR,
38870
- `Error while parsing stream data response: ${text}
38871
-
38872
- Thrown error: ${e}`
38784
+ `Error while parsing stream data response: ${text}`
38873
38785
  );
38874
38786
  }
38875
38787
  if (Array.isArray(errors)) {
@@ -38962,8 +38874,8 @@ Thrown error: ${e}`
38962
38874
  const predicateData = arrayify(value.predicateData ?? "0x");
38963
38875
  return {
38964
38876
  type: InputType.Coin,
38965
- txID: hexlify(arrayify(value.id).slice(0, 32)),
38966
- outputIndex: toNumber2(arrayify(value.id).slice(32, 34)),
38877
+ txID: hexlify(arrayify(value.id).slice(0, BYTES_32)),
38878
+ outputIndex: toNumber2(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
38967
38879
  owner: hexlify(value.owner),
38968
38880
  amount: bn(value.amount),
38969
38881
  assetId: hexlify(value.assetId),
@@ -38972,9 +38884,10 @@ Thrown error: ${e}`
38972
38884
  txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38973
38885
  },
38974
38886
  witnessIndex: value.witnessIndex,
38887
+ maturity: value.maturity ?? 0,
38975
38888
  predicateGasUsed: bn(value.predicateGasUsed),
38976
- predicateLength: bn(predicate.length),
38977
- predicateDataLength: bn(predicateData.length),
38889
+ predicateLength: predicate.length,
38890
+ predicateDataLength: predicateData.length,
38978
38891
  predicate: hexlify(predicate),
38979
38892
  predicateData: hexlify(predicateData)
38980
38893
  };
@@ -39005,8 +38918,8 @@ Thrown error: ${e}`
39005
38918
  nonce: hexlify(value.nonce),
39006
38919
  witnessIndex: value.witnessIndex,
39007
38920
  predicateGasUsed: bn(value.predicateGasUsed),
39008
- predicateLength: bn(predicate.length),
39009
- predicateDataLength: bn(predicateData.length),
38921
+ predicateLength: predicate.length,
38922
+ predicateDataLength: predicateData.length,
39010
38923
  predicate: hexlify(predicate),
39011
38924
  predicateData: hexlify(predicateData),
39012
38925
  data: hexlify(data),
@@ -39166,8 +39079,8 @@ Thrown error: ${e}`
39166
39079
  case "CALL" /* Call */: {
39167
39080
  const callReceipt = {
39168
39081
  type: ReceiptType.Call,
39169
- from: hexOrZero(receipt.id || receipt.contractId),
39170
- to: hexOrZero(receipt?.to),
39082
+ from: hexOrZero(receipt.contract?.id),
39083
+ to: hexOrZero(receipt?.to?.id),
39171
39084
  amount: bn(receipt.amount),
39172
39085
  assetId: hexOrZero(receipt.assetId),
39173
39086
  gas: bn(receipt.gas),
@@ -39181,7 +39094,7 @@ Thrown error: ${e}`
39181
39094
  case "RETURN" /* Return */: {
39182
39095
  const returnReceipt = {
39183
39096
  type: ReceiptType.Return,
39184
- id: hexOrZero(receipt.id || receipt.contractId),
39097
+ id: hexOrZero(receipt.contract?.id),
39185
39098
  val: bn(receipt.val),
39186
39099
  pc: bn(receipt.pc),
39187
39100
  is: bn(receipt.is)
@@ -39191,7 +39104,7 @@ Thrown error: ${e}`
39191
39104
  case "RETURN_DATA" /* ReturnData */: {
39192
39105
  const returnDataReceipt = {
39193
39106
  type: ReceiptType.ReturnData,
39194
- id: hexOrZero(receipt.id || receipt.contractId),
39107
+ id: hexOrZero(receipt.contract?.id),
39195
39108
  ptr: bn(receipt.ptr),
39196
39109
  len: bn(receipt.len),
39197
39110
  digest: hexOrZero(receipt.digest),
@@ -39203,7 +39116,7 @@ Thrown error: ${e}`
39203
39116
  case "PANIC" /* Panic */: {
39204
39117
  const panicReceipt = {
39205
39118
  type: ReceiptType.Panic,
39206
- id: hexOrZero(receipt.id),
39119
+ id: hexOrZero(receipt.contract?.id),
39207
39120
  reason: bn(receipt.reason),
39208
39121
  pc: bn(receipt.pc),
39209
39122
  is: bn(receipt.is),
@@ -39214,7 +39127,7 @@ Thrown error: ${e}`
39214
39127
  case "REVERT" /* Revert */: {
39215
39128
  const revertReceipt = {
39216
39129
  type: ReceiptType.Revert,
39217
- id: hexOrZero(receipt.id || receipt.contractId),
39130
+ id: hexOrZero(receipt.contract?.id),
39218
39131
  val: bn(receipt.ra),
39219
39132
  pc: bn(receipt.pc),
39220
39133
  is: bn(receipt.is)
@@ -39224,7 +39137,7 @@ Thrown error: ${e}`
39224
39137
  case "LOG" /* Log */: {
39225
39138
  const logReceipt = {
39226
39139
  type: ReceiptType.Log,
39227
- id: hexOrZero(receipt.id || receipt.contractId),
39140
+ id: hexOrZero(receipt.contract?.id),
39228
39141
  val0: bn(receipt.ra),
39229
39142
  val1: bn(receipt.rb),
39230
39143
  val2: bn(receipt.rc),
@@ -39237,7 +39150,7 @@ Thrown error: ${e}`
39237
39150
  case "LOG_DATA" /* LogData */: {
39238
39151
  const logDataReceipt = {
39239
39152
  type: ReceiptType.LogData,
39240
- id: hexOrZero(receipt.id || receipt.contractId),
39153
+ id: hexOrZero(receipt.contract?.id),
39241
39154
  val0: bn(receipt.ra),
39242
39155
  val1: bn(receipt.rb),
39243
39156
  ptr: bn(receipt.ptr),
@@ -39251,8 +39164,8 @@ Thrown error: ${e}`
39251
39164
  case "TRANSFER" /* Transfer */: {
39252
39165
  const transferReceipt = {
39253
39166
  type: ReceiptType.Transfer,
39254
- from: hexOrZero(receipt.id || receipt.contractId),
39255
- to: hexOrZero(receipt.toAddress || receipt?.to),
39167
+ from: hexOrZero(receipt.contract?.id),
39168
+ to: hexOrZero(receipt.toAddress || receipt?.to?.id),
39256
39169
  amount: bn(receipt.amount),
39257
39170
  assetId: hexOrZero(receipt.assetId),
39258
39171
  pc: bn(receipt.pc),
@@ -39263,8 +39176,8 @@ Thrown error: ${e}`
39263
39176
  case "TRANSFER_OUT" /* TransferOut */: {
39264
39177
  const transferOutReceipt = {
39265
39178
  type: ReceiptType.TransferOut,
39266
- from: hexOrZero(receipt.id || receipt.contractId),
39267
- to: hexOrZero(receipt.toAddress || receipt.to),
39179
+ from: hexOrZero(receipt.contract?.id),
39180
+ to: hexOrZero(receipt.toAddress || receipt.to?.id),
39268
39181
  amount: bn(receipt.amount),
39269
39182
  assetId: hexOrZero(receipt.assetId),
39270
39183
  pc: bn(receipt.pc),
@@ -39307,7 +39220,7 @@ Thrown error: ${e}`
39307
39220
  return receiptMessageOut;
39308
39221
  }
39309
39222
  case "MINT" /* Mint */: {
39310
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39223
+ const contractId = hexOrZero(receipt.contract?.id);
39311
39224
  const subId = hexOrZero(receipt.subId);
39312
39225
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
39313
39226
  const mintReceipt = {
@@ -39322,7 +39235,7 @@ Thrown error: ${e}`
39322
39235
  return mintReceipt;
39323
39236
  }
39324
39237
  case "BURN" /* Burn */: {
39325
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39238
+ const contractId = hexOrZero(receipt.contract?.id);
39326
39239
  const subId = hexOrZero(receipt.subId);
39327
39240
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
39328
39241
  const burnReceipt = {
@@ -39403,6 +39316,7 @@ Thrown error: ${e}`
39403
39316
  };
39404
39317
 
39405
39318
  // src/providers/utils/gas.ts
39319
+ var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
39406
39320
  var getGasUsedFromReceipts = (receipts) => {
39407
39321
  const scriptResult = receipts.filter(
39408
39322
  (receipt) => receipt.type === ReceiptType.ScriptResult
@@ -39423,28 +39337,18 @@ Thrown error: ${e}`
39423
39337
  }
39424
39338
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
39425
39339
  const witnessCache = [];
39426
- const chargeableInputs = inputs.filter((input) => {
39427
- const isCoinOrMessage = "owner" in input || "sender" in input;
39428
- if (isCoinOrMessage) {
39429
- if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39430
- return true;
39431
- }
39432
- if (!witnessCache.includes(input.witnessIndex)) {
39433
- witnessCache.push(input.witnessIndex);
39434
- return true;
39435
- }
39436
- }
39437
- return false;
39438
- });
39439
- const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
39440
- const totalGas = chargeableInputs.reduce((total, input) => {
39340
+ const totalGas = inputs.reduce((total, input) => {
39441
39341
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39442
39342
  return total.add(
39443
- vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39343
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39444
39344
  );
39445
39345
  }
39446
- return total.add(gasCosts.ecr1);
39447
- }, bn(0));
39346
+ if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
39347
+ witnessCache.push(input.witnessIndex);
39348
+ return total.add(gasCosts.ecr1);
39349
+ }
39350
+ return total;
39351
+ }, bn());
39448
39352
  return totalGas;
39449
39353
  }
39450
39354
  function getMinGas(params) {
@@ -39456,20 +39360,12 @@ Thrown error: ${e}`
39456
39360
  return minGas;
39457
39361
  }
39458
39362
  function getMaxGas(params) {
39459
- const {
39460
- gasPerByte,
39461
- witnessesLength,
39462
- witnessLimit,
39463
- minGas,
39464
- gasLimit = bn(0),
39465
- maxGasPerTx
39466
- } = params;
39363
+ const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
39467
39364
  let remainingAllowedWitnessGas = bn(0);
39468
39365
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
39469
39366
  remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
39470
39367
  }
39471
- const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39472
- return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
39368
+ return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39473
39369
  }
39474
39370
  function calculateMetadataGasForTxCreate({
39475
39371
  gasCosts,
@@ -39491,10 +39387,6 @@ Thrown error: ${e}`
39491
39387
  }) {
39492
39388
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
39493
39389
  }
39494
- var calculateGasFee = (params) => {
39495
- const { gas, gasPrice, priceFactor, tip } = params;
39496
- return gas.mul(gasPrice).div(priceFactor).add(tip);
39497
- };
39498
39390
 
39499
39391
  // src/providers/utils/json.ts
39500
39392
  function normalize2(object) {
@@ -39636,7 +39528,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39636
39528
  // src/providers/transaction-request/transaction-request.ts
39637
39529
  var BaseTransactionRequest = class {
39638
39530
  /** Gas price for transaction */
39639
- tip;
39531
+ gasPrice;
39640
39532
  /** Block until which tx cannot be included */
39641
39533
  maturity;
39642
39534
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -39655,7 +39547,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39655
39547
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
39656
39548
  */
39657
39549
  constructor({
39658
- tip,
39550
+ gasPrice,
39659
39551
  maturity,
39660
39552
  maxFee,
39661
39553
  witnessLimit,
@@ -39663,7 +39555,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39663
39555
  outputs,
39664
39556
  witnesses
39665
39557
  } = {}) {
39666
- this.tip = bn(tip);
39558
+ this.gasPrice = bn(gasPrice);
39667
39559
  this.maturity = maturity ?? 0;
39668
39560
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
39669
39561
  this.maxFee = maxFee ? bn(maxFee) : void 0;
@@ -39674,9 +39566,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39674
39566
  static getPolicyMeta(req) {
39675
39567
  let policyTypes = 0;
39676
39568
  const policies = [];
39677
- if (req.tip) {
39678
- policyTypes += PolicyType.Tip;
39679
- policies.push({ data: req.tip, type: PolicyType.Tip });
39569
+ if (req.gasPrice) {
39570
+ policyTypes += PolicyType.GasPrice;
39571
+ policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
39680
39572
  }
39681
39573
  if (req.witnessLimit) {
39682
39574
  policyTypes += PolicyType.WitnessLimit;
@@ -39863,10 +39755,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39863
39755
  * @param predicate - Predicate bytes.
39864
39756
  * @param predicateData - Predicate data bytes.
39865
39757
  */
39866
- addCoinInput(coin) {
39758
+ addCoinInput(coin, predicate) {
39867
39759
  const { assetId, owner, amount } = coin;
39868
39760
  let witnessIndex;
39869
- if (coin.predicate) {
39761
+ if (predicate) {
39870
39762
  witnessIndex = 0;
39871
39763
  } else {
39872
39764
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -39881,7 +39773,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39881
39773
  amount,
39882
39774
  assetId,
39883
39775
  txPointer: "0x00000000000000000000000000000000",
39884
- witnessIndex
39776
+ witnessIndex,
39777
+ predicate: predicate?.bytes
39885
39778
  };
39886
39779
  this.pushInput(input);
39887
39780
  this.addChangeOutput(owner, assetId);
@@ -39894,11 +39787,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39894
39787
  * @param predicate - Predicate bytes.
39895
39788
  * @param predicateData - Predicate data bytes.
39896
39789
  */
39897
- addMessageInput(message) {
39790
+ addMessageInput(message, predicate) {
39898
39791
  const { recipient, sender, amount } = message;
39899
39792
  const assetId = BaseAssetId;
39900
39793
  let witnessIndex;
39901
- if (message.predicate) {
39794
+ if (predicate) {
39902
39795
  witnessIndex = 0;
39903
39796
  } else {
39904
39797
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -39912,7 +39805,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39912
39805
  sender: sender.toB256(),
39913
39806
  recipient: recipient.toB256(),
39914
39807
  amount,
39915
- witnessIndex
39808
+ witnessIndex,
39809
+ predicate: predicate?.bytes
39916
39810
  };
39917
39811
  this.pushInput(input);
39918
39812
  this.addChangeOutput(recipient, assetId);
@@ -39943,6 +39837,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39943
39837
  resources.forEach((resource) => this.addResource(resource));
39944
39838
  return this;
39945
39839
  }
39840
+ /**
39841
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
39842
+ * outputs from the related assetIds.
39843
+ *
39844
+ * @param resources - The resources to add.
39845
+ * @returns This transaction.
39846
+ */
39847
+ addPredicateResource(resource, predicate) {
39848
+ if (isCoin(resource)) {
39849
+ this.addCoinInput(resource, predicate);
39850
+ } else {
39851
+ this.addMessageInput(resource, predicate);
39852
+ }
39853
+ return this;
39854
+ }
39855
+ /**
39856
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
39857
+ * from the related assetIds.
39858
+ *
39859
+ * @param resources - The resources to add.
39860
+ * @returns This transaction.
39861
+ */
39862
+ addPredicateResources(resources, predicate) {
39863
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
39864
+ return this;
39865
+ }
39946
39866
  /**
39947
39867
  * Adds a coin output to the transaction.
39948
39868
  *
@@ -40022,7 +39942,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40022
39942
  }
40023
39943
  calculateMaxGas(chainInfo, minGas) {
40024
39944
  const { consensusParameters } = chainInfo;
40025
- const { gasPerByte, maxGasPerTx } = consensusParameters;
39945
+ const { gasPerByte } = consensusParameters;
40026
39946
  const witnessesLength = this.toTransaction().witnesses.reduce(
40027
39947
  (acc, wit) => acc + wit.dataLength,
40028
39948
  0
@@ -40031,8 +39951,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40031
39951
  gasPerByte,
40032
39952
  minGas,
40033
39953
  witnessesLength,
40034
- witnessLimit: this.witnessLimit,
40035
- maxGasPerTx
39954
+ witnessLimit: this.witnessLimit
40036
39955
  });
40037
39956
  }
40038
39957
  /**
@@ -40050,20 +39969,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40050
39969
  });
40051
39970
  const updateAssetInput = (assetId, quantity) => {
40052
39971
  const assetInput = findAssetInput(assetId);
40053
- let usedQuantity = quantity;
40054
- if (assetId === BaseAssetId) {
40055
- usedQuantity = bn("1000000000000000000");
40056
- }
40057
39972
  if (assetInput && "assetId" in assetInput) {
40058
- assetInput.id = hexlify(randomBytes3(34));
40059
- assetInput.amount = usedQuantity;
39973
+ assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
39974
+ assetInput.amount = quantity;
40060
39975
  } else {
40061
39976
  this.addResources([
40062
39977
  {
40063
- id: hexlify(randomBytes3(34)),
40064
- amount: usedQuantity,
39978
+ id: hexlify(randomBytes22(UTXO_ID_LEN)),
39979
+ amount: quantity,
40065
39980
  assetId,
40066
39981
  owner: resourcesOwner || Address.fromRandom(),
39982
+ maturity: 0,
40067
39983
  blockCreated: bn(1),
40068
39984
  txCreatedIdx: bn(1)
40069
39985
  }
@@ -40095,7 +40011,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40095
40011
  toJSON() {
40096
40012
  return normalizeJSON(this);
40097
40013
  }
40098
- updatePredicateGasUsed(inputs) {
40014
+ updatePredicateInputs(inputs) {
40099
40015
  this.inputs.forEach((i) => {
40100
40016
  let correspondingInput;
40101
40017
  switch (i.type) {
@@ -40117,15 +40033,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40117
40033
  }
40118
40034
  });
40119
40035
  }
40120
- shiftPredicateData() {
40121
- this.inputs.forEach((input) => {
40122
- if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
40123
- input.predicateData = input.paddPredicateData(
40124
- BaseTransactionRequest.getPolicyMeta(this).policies.length
40125
- );
40126
- }
40127
- });
40128
- }
40129
40036
  };
40130
40037
 
40131
40038
  // src/providers/transaction-request/hash-transaction.ts
@@ -40259,8 +40166,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40259
40166
  return {
40260
40167
  type: TransactionType.Create,
40261
40168
  ...baseTransaction,
40169
+ bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
40262
40170
  bytecodeWitnessIndex,
40263
- storageSlotsCount: bn(storageSlots.length),
40171
+ storageSlotsCount: storageSlots.length,
40264
40172
  salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
40265
40173
  storageSlots
40266
40174
  };
@@ -40374,8 +40282,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40374
40282
  type: TransactionType.Script,
40375
40283
  scriptGasLimit: this.gasLimit,
40376
40284
  ...super.getBaseTransaction(),
40377
- scriptLength: bn(script.length),
40378
- scriptDataLength: bn(scriptData.length),
40285
+ scriptLength: script.length,
40286
+ scriptDataLength: scriptData.length,
40379
40287
  receiptsRoot: ZeroBytes32,
40380
40288
  script: hexlify(script),
40381
40289
  scriptData: hexlify(scriptData)
@@ -40439,7 +40347,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40439
40347
  }
40440
40348
  calculateMaxGas(chainInfo, minGas) {
40441
40349
  const { consensusParameters } = chainInfo;
40442
- const { gasPerByte, maxGasPerTx } = consensusParameters;
40350
+ const { gasPerByte } = consensusParameters;
40443
40351
  const witnessesLength = this.toTransaction().witnesses.reduce(
40444
40352
  (acc, wit) => acc + wit.dataLength,
40445
40353
  0
@@ -40449,8 +40357,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40449
40357
  minGas,
40450
40358
  witnessesLength,
40451
40359
  witnessLimit: this.witnessLimit,
40452
- gasLimit: this.gasLimit,
40453
- maxGasPerTx
40360
+ gasLimit: this.gasLimit
40454
40361
  });
40455
40362
  }
40456
40363
  /**
@@ -40523,29 +40430,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40523
40430
  }
40524
40431
  }
40525
40432
  };
40526
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40527
- (acc, input) => {
40528
- if (input.type === InputType.Coin && input.owner === owner) {
40529
- acc.utxos.push(input.id);
40530
- }
40531
- if (input.type === InputType.Message && input.recipient === owner) {
40532
- acc.messages.push(input.nonce);
40533
- }
40534
- return acc;
40535
- },
40536
- {
40537
- utxos: [],
40538
- messages: []
40539
- }
40540
- );
40541
40433
 
40542
40434
  // src/providers/transaction-summary/calculate-transaction-fee.ts
40543
40435
  var calculateTransactionFee = (params) => {
40544
40436
  const {
40545
- gasPrice,
40437
+ gasUsed,
40546
40438
  rawPayload,
40547
- tip,
40548
- consensusParameters: { gasCosts, feeParams, maxGasPerTx }
40439
+ consensusParameters: { gasCosts, feeParams }
40549
40440
  } = params;
40550
40441
  const gasPerByte = bn(feeParams.gasPerByte);
40551
40442
  const gasPriceFactor = bn(feeParams.gasPriceFactor);
@@ -40555,7 +40446,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40555
40446
  return {
40556
40447
  fee: bn(0),
40557
40448
  minFee: bn(0),
40558
- maxFee: bn(0)
40449
+ maxFee: bn(0),
40450
+ feeFromGasUsed: bn(0)
40559
40451
  };
40560
40452
  }
40561
40453
  const { type: type3, witnesses, inputs, policies } = transaction;
@@ -40587,6 +40479,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40587
40479
  metadataGas,
40588
40480
  txBytesSize: transactionBytes.length
40589
40481
  });
40482
+ const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
40590
40483
  const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
40591
40484
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
40592
40485
  const maxGas = getMaxGas({
@@ -40594,25 +40487,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40594
40487
  minGas,
40595
40488
  witnessesLength,
40596
40489
  gasLimit,
40597
- witnessLimit,
40598
- maxGasPerTx
40599
- });
40600
- const minFee = calculateGasFee({
40601
- gasPrice,
40602
- gas: minGas,
40603
- priceFactor: gasPriceFactor,
40604
- tip
40605
- });
40606
- const maxFee = calculateGasFee({
40607
- gasPrice,
40608
- gas: maxGas,
40609
- priceFactor: gasPriceFactor,
40610
- tip
40490
+ witnessLimit
40611
40491
  });
40492
+ const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
40493
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
40494
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
40495
+ const fee = minFee.add(feeFromGasUsed);
40612
40496
  return {
40497
+ fee,
40613
40498
  minFee,
40614
40499
  maxFee,
40615
- fee: maxFee
40500
+ feeFromGasUsed
40616
40501
  };
40617
40502
  };
40618
40503
 
@@ -41213,9 +41098,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41213
41098
  gqlTransactionStatus,
41214
41099
  abiMap = {},
41215
41100
  maxInputs,
41216
- gasCosts,
41217
- maxGasPerTx,
41218
- gasPrice
41101
+ gasCosts
41219
41102
  } = params;
41220
41103
  const gasUsed = getGasUsedFromReceipts(receipts);
41221
41104
  const rawPayload = hexlify(transactionBytes);
@@ -41229,14 +41112,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41229
41112
  maxInputs
41230
41113
  });
41231
41114
  const typeName = getTransactionTypeName(transaction.type);
41232
- const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
41233
41115
  const { fee } = calculateTransactionFee({
41234
- gasPrice,
41116
+ gasUsed,
41235
41117
  rawPayload,
41236
- tip,
41237
41118
  consensusParameters: {
41238
41119
  gasCosts,
41239
- maxGasPerTx,
41240
41120
  feeParams: {
41241
41121
  gasPerByte,
41242
41122
  gasPriceFactor
@@ -41372,13 +41252,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41372
41252
  const decodedTransaction = this.decodeTransaction(
41373
41253
  transaction
41374
41254
  );
41375
- let txReceipts = [];
41376
- if (transaction?.status && "receipts" in transaction.status) {
41377
- txReceipts = transaction.status.receipts;
41378
- }
41379
- const receipts = txReceipts.map(processGqlReceipt) || [];
41380
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
41381
- const gasPrice = await this.provider.getLatestGasPrice();
41255
+ const receipts = transaction.receipts?.map(processGqlReceipt) || [];
41256
+ const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
41382
41257
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
41383
41258
  const transactionSummary = assembleTransactionSummary({
41384
41259
  id: this.id,
@@ -41390,9 +41265,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41390
41265
  gasPriceFactor,
41391
41266
  abiMap: contractsAbiMap,
41392
41267
  maxInputs,
41393
- gasCosts,
41394
- maxGasPerTx,
41395
- gasPrice
41268
+ gasCosts
41396
41269
  });
41397
41270
  return transactionSummary;
41398
41271
  }
@@ -41541,7 +41414,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41541
41414
  gasCosts,
41542
41415
  latestBlock: {
41543
41416
  id: latestBlock.id,
41544
- height: bn(latestBlock.height),
41417
+ height: bn(latestBlock.header.height),
41545
41418
  time: latestBlock.header.time,
41546
41419
  transactions: latestBlock.transactions.map((i) => ({
41547
41420
  id: i.id
@@ -41635,8 +41508,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41635
41508
  * Returns some helpful parameters related to gas fees.
41636
41509
  */
41637
41510
  getGasConfig() {
41511
+ const { minGasPrice } = this.getNode();
41638
41512
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
41639
41513
  return {
41514
+ minGasPrice,
41640
41515
  maxGasPerTx,
41641
41516
  maxGasPerPredicate,
41642
41517
  gasPriceFactor,
@@ -41734,7 +41609,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41734
41609
  */
41735
41610
  async getBlockNumber() {
41736
41611
  const { chain } = await this.operations.getChain();
41737
- return bn(chain.latestBlock.height, 10);
41612
+ return bn(chain.latestBlock.header.height, 10);
41738
41613
  }
41739
41614
  /**
41740
41615
  * Returns the chain information.
@@ -41746,9 +41621,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41746
41621
  const processedNodeInfo = {
41747
41622
  maxDepth: bn(nodeInfo.maxDepth),
41748
41623
  maxTx: bn(nodeInfo.maxTx),
41624
+ minGasPrice: bn(nodeInfo.minGasPrice),
41749
41625
  nodeVersion: nodeInfo.nodeVersion,
41750
41626
  utxoValidation: nodeInfo.utxoValidation,
41751
- vmBacktrace: nodeInfo.vmBacktrace
41627
+ vmBacktrace: nodeInfo.vmBacktrace,
41628
+ peers: nodeInfo.peers
41752
41629
  };
41753
41630
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
41754
41631
  return processedNodeInfo;
@@ -41834,13 +41711,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41834
41711
  return this.estimateTxDependencies(transactionRequest);
41835
41712
  }
41836
41713
  const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41837
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41838
- encodedTransactions: encodedTransaction,
41714
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41715
+ encodedTransaction,
41839
41716
  utxoValidation: utxoValidation || false
41840
41717
  });
41841
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
41842
- const receipts = rawReceipts.map(processGqlReceipt);
41843
- return { receipts, dryrunStatus: status };
41718
+ const receipts = gqlReceipts.map(processGqlReceipt);
41719
+ return {
41720
+ receipts
41721
+ };
41844
41722
  }
41845
41723
  /**
41846
41724
  * Verifies whether enough gas is available to complete transaction.
@@ -41879,6 +41757,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41879
41757
  * If there are missing variable outputs,
41880
41758
  * `addVariableOutputs` is called on the transaction.
41881
41759
  *
41760
+ * @privateRemarks
41761
+ * TODO: Investigate support for missing contract IDs
41762
+ * TODO: Add support for missing output messages
41882
41763
  *
41883
41764
  * @param transactionRequest - The transaction request object.
41884
41765
  * @returns A promise.
@@ -41891,19 +41772,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41891
41772
  missingContractIds: []
41892
41773
  };
41893
41774
  }
41775
+ await this.estimatePredicates(transactionRequest);
41894
41776
  let receipts = [];
41895
41777
  const missingContractIds = [];
41896
41778
  let outputVariables = 0;
41897
- let dryrunStatus;
41898
41779
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
41899
- const {
41900
- dryRun: [{ receipts: rawReceipts, status }]
41901
- } = await this.operations.dryRun({
41902
- encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
41780
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41781
+ encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
41903
41782
  utxoValidation: false
41904
41783
  });
41905
- receipts = rawReceipts.map(processGqlReceipt);
41906
- dryrunStatus = status;
41784
+ receipts = gqlReceipts.map(processGqlReceipt);
41907
41785
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
41908
41786
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
41909
41787
  if (hasMissingOutputs) {
@@ -41913,11 +41791,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41913
41791
  transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
41914
41792
  missingContractIds.push(contractId);
41915
41793
  });
41916
- const { maxFee } = await this.estimateTxGasAndFee({
41917
- transactionRequest,
41918
- optimizeGas: false
41919
- });
41920
- transactionRequest.maxFee = maxFee;
41921
41794
  } else {
41922
41795
  break;
41923
41796
  }
@@ -41925,133 +41798,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41925
41798
  return {
41926
41799
  receipts,
41927
41800
  outputVariables,
41928
- missingContractIds,
41929
- dryrunStatus
41801
+ missingContractIds
41930
41802
  };
41931
41803
  }
41932
41804
  /**
41933
- * Dry runs multiple transactions and checks for missing dependencies in batches.
41934
- *
41935
- * Transactions are dry run in batches. After each dry run, transactions requiring
41936
- * further modifications are identified. The method iteratively updates these transactions
41937
- * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
41938
- *
41939
- * @param transactionRequests - Array of transaction request objects.
41940
- * @returns A promise that resolves to an array of results for each transaction.
41941
- */
41942
- async estimateMultipleTxDependencies(transactionRequests) {
41943
- const results = transactionRequests.map(() => ({
41944
- receipts: [],
41945
- outputVariables: 0,
41946
- missingContractIds: [],
41947
- dryrunStatus: void 0
41948
- }));
41949
- const allRequests = clone_default(transactionRequests);
41950
- const serializedTransactionsMap = /* @__PURE__ */ new Map();
41951
- allRequests.forEach((req, index) => {
41952
- if (req.type === TransactionType.Script) {
41953
- serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
41954
- }
41955
- });
41956
- let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
41957
- let attempt = 0;
41958
- while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
41959
- const encodedTransactions = transactionsToProcess.map(
41960
- (index) => serializedTransactionsMap.get(index)
41961
- );
41962
- const dryRunResults = await this.operations.dryRun({
41963
- encodedTransactions,
41964
- utxoValidation: false
41965
- });
41966
- const nextRoundTransactions = [];
41967
- for (let i = 0; i < dryRunResults.dryRun.length; i++) {
41968
- const currentResultIndex = transactionsToProcess[i];
41969
- const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
41970
- results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
41971
- results[currentResultIndex].dryrunStatus = status;
41972
- const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
41973
- results[currentResultIndex].receipts
41974
- );
41975
- const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
41976
- const requestToProcess = allRequests[currentResultIndex];
41977
- if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
41978
- results[currentResultIndex].outputVariables += missingOutputVariables.length;
41979
- requestToProcess.addVariableOutputs(missingOutputVariables.length);
41980
- missingOutputContractIds.forEach(({ contractId }) => {
41981
- requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
41982
- results[currentResultIndex].missingContractIds.push(contractId);
41983
- });
41984
- const { maxFee } = await this.estimateTxGasAndFee({
41985
- transactionRequest: requestToProcess,
41986
- optimizeGas: false
41987
- });
41988
- requestToProcess.maxFee = maxFee;
41989
- serializedTransactionsMap.set(
41990
- currentResultIndex,
41991
- hexlify(requestToProcess.toTransactionBytes())
41992
- );
41993
- nextRoundTransactions.push(currentResultIndex);
41994
- allRequests[currentResultIndex] = requestToProcess;
41995
- }
41996
- }
41997
- transactionsToProcess = nextRoundTransactions;
41998
- attempt += 1;
41999
- }
42000
- return results;
42001
- }
42002
- async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
42003
- if (estimateTxDependencies) {
42004
- return this.estimateMultipleTxDependencies(transactionRequests);
42005
- }
42006
- const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
42007
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42008
- encodedTransactions,
42009
- utxoValidation: utxoValidation || false
42010
- });
42011
- const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
42012
- const receipts = rawReceipts.map(processGqlReceipt);
42013
- return { receipts, dryrunStatus: status };
42014
- });
42015
- return results;
42016
- }
42017
- async estimateTxGasAndFee(params) {
42018
- const { transactionRequest, optimizeGas = true } = params;
42019
- let { gasPrice } = params;
41805
+ * Estimates the transaction gas and fee based on the provided transaction request.
41806
+ * @param transactionRequest - The transaction request object.
41807
+ * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
41808
+ */
41809
+ estimateTxGasAndFee(params) {
41810
+ const { transactionRequest } = params;
41811
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
42020
41812
  const chainInfo = this.getChain();
42021
- const { gasPriceFactor } = this.getGasConfig();
41813
+ const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
41814
+ transactionRequest.gasPrice = gasPrice;
42022
41815
  const minGas = transactionRequest.calculateMinGas(chainInfo);
42023
- if (!gasPrice) {
42024
- gasPrice = await this.estimateGasPrice(10);
42025
- }
42026
- const minFee = calculateGasFee({
42027
- gasPrice: bn(gasPrice),
42028
- gas: minGas,
42029
- priceFactor: gasPriceFactor,
42030
- tip: transactionRequest.tip
42031
- }).add(1);
42032
- let gasLimit = bn(0);
41816
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42033
41817
  if (transactionRequest.type === TransactionType.Script) {
42034
- gasLimit = transactionRequest.gasLimit;
42035
- if (!optimizeGas) {
41818
+ if (transactionRequest.gasLimit.eq(0)) {
42036
41819
  transactionRequest.gasLimit = minGas;
42037
- gasLimit = transactionRequest.calculateMaxGas(chainInfo, minGas);
42038
- transactionRequest.gasLimit = gasLimit;
41820
+ transactionRequest.gasLimit = maxGasPerTx.sub(
41821
+ transactionRequest.calculateMaxGas(chainInfo, minGas)
41822
+ );
42039
41823
  }
42040
41824
  }
42041
41825
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
42042
- const maxFee = calculateGasFee({
42043
- gasPrice: bn(gasPrice),
42044
- gas: maxGas,
42045
- priceFactor: gasPriceFactor,
42046
- tip: transactionRequest.tip
42047
- }).add(1);
41826
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42048
41827
  return {
42049
41828
  minGas,
42050
41829
  minFee,
42051
41830
  maxGas,
42052
- maxFee,
42053
- gasPrice,
42054
- gasLimit
41831
+ maxFee
42055
41832
  };
42056
41833
  }
42057
41834
  /**
@@ -42069,17 +41846,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42069
41846
  if (estimateTxDependencies) {
42070
41847
  return this.estimateTxDependencies(transactionRequest);
42071
41848
  }
42072
- const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
42073
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42074
- encodedTransactions,
41849
+ const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41850
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41851
+ encodedTransaction,
42075
41852
  utxoValidation: true
42076
41853
  });
42077
- const callResult = dryRunStatuses.map((dryRunStatus) => {
42078
- const { id, receipts, status } = dryRunStatus;
42079
- const processedReceipts = receipts.map(processGqlReceipt);
42080
- return { id, receipts: processedReceipts, status };
42081
- });
42082
- return { receipts: callResult[0].receipts };
41854
+ const receipts = gqlReceipts.map(processGqlReceipt);
41855
+ return {
41856
+ receipts
41857
+ };
42083
41858
  }
42084
41859
  /**
42085
41860
  * Returns a transaction cost to enable user
@@ -42096,80 +41871,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42096
41871
  * @param tolerance - The tolerance to add on top of the gasUsed.
42097
41872
  * @returns A promise that resolves to the transaction cost object.
42098
41873
  */
42099
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
41874
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
41875
+ estimateTxDependencies = true,
41876
+ estimatePredicates = true,
41877
+ resourcesOwner,
41878
+ signatureCallback
41879
+ } = {}) {
42100
41880
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
41881
+ const { minGasPrice } = this.getGasConfig();
41882
+ const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
42101
41883
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
42102
41884
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
42103
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
41885
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
42104
41886
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
42105
- txRequestClone.maxFee = bn(0);
42106
41887
  if (isScriptTransaction) {
42107
41888
  txRequestClone.gasLimit = bn(0);
42108
41889
  }
42109
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
42110
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
41890
+ if (estimatePredicates) {
41891
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
41892
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
41893
+ }
41894
+ await this.estimatePredicates(txRequestClone);
42111
41895
  }
42112
- const signedRequest = clone_default(txRequestClone);
42113
- let addedSignatures = 0;
42114
41896
  if (signatureCallback && isScriptTransaction) {
42115
- const lengthBefore = signedRequest.witnesses.length;
42116
- await signatureCallback(signedRequest);
42117
- addedSignatures = signedRequest.witnesses.length - lengthBefore;
42118
- }
42119
- await this.estimatePredicates(signedRequest);
42120
- let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
42121
- transactionRequest: signedRequest,
42122
- optimizeGas: false
41897
+ await signatureCallback(txRequestClone);
41898
+ }
41899
+ let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
41900
+ transactionRequest: txRequestClone
42123
41901
  });
42124
- txRequestClone.maxFee = maxFee;
42125
41902
  let receipts = [];
42126
41903
  let missingContractIds = [];
42127
41904
  let outputVariables = 0;
42128
41905
  let gasUsed = bn(0);
42129
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
42130
- if (isScriptTransaction) {
42131
- if (signatureCallback) {
42132
- await signatureCallback(txRequestClone);
42133
- }
42134
- txRequestClone.gasLimit = gasLimit;
41906
+ if (isScriptTransaction && estimateTxDependencies) {
41907
+ txRequestClone.gasPrice = bn(0);
42135
41908
  const result = await this.estimateTxDependencies(txRequestClone);
42136
41909
  receipts = result.receipts;
42137
41910
  outputVariables = result.outputVariables;
42138
41911
  missingContractIds = result.missingContractIds;
42139
- gasUsed = getGasUsedFromReceipts(receipts);
41912
+ gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
42140
41913
  txRequestClone.gasLimit = gasUsed;
42141
- ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
42142
- transactionRequest: txRequestClone,
42143
- gasPrice
41914
+ txRequestClone.gasPrice = setGasPrice;
41915
+ ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
41916
+ transactionRequest: txRequestClone
42144
41917
  }));
42145
41918
  }
42146
41919
  return {
42147
41920
  requiredQuantities: allQuantities,
42148
41921
  receipts,
42149
41922
  gasUsed,
42150
- gasPrice,
41923
+ minGasPrice,
41924
+ gasPrice: setGasPrice,
42151
41925
  minGas,
42152
41926
  maxGas,
42153
41927
  minFee,
42154
41928
  maxFee,
41929
+ estimatedInputs: txRequestClone.inputs,
42155
41930
  outputVariables,
42156
- missingContractIds,
42157
- addedSignatures,
42158
- estimatedPredicates: txRequestClone.inputs
41931
+ missingContractIds
42159
41932
  };
42160
41933
  }
42161
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
41934
+ async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
42162
41935
  const ownerAddress = Address.fromAddressOrString(owner);
42163
41936
  const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
42164
- const transactionCost = await this.getTransactionCost(transactionRequest, {
42165
- quantitiesToContract
42166
- });
41937
+ const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
42167
41938
  transactionRequest.addResources(
42168
41939
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
42169
41940
  );
42170
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
42171
- quantitiesToContract
42172
- });
41941
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(
41942
+ transactionRequest,
41943
+ forwardingQuantities
41944
+ );
42173
41945
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
42174
41946
  return {
42175
41947
  resources,
@@ -42193,6 +41965,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42193
41965
  assetId: coin.assetId,
42194
41966
  amount: bn(coin.amount),
42195
41967
  owner: Address.fromAddressOrString(coin.owner),
41968
+ maturity: bn(coin.maturity).toNumber(),
42196
41969
  blockCreated: bn(coin.blockCreated),
42197
41970
  txCreatedIdx: bn(coin.txCreatedIdx)
42198
41971
  }));
@@ -42244,6 +42017,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42244
42017
  amount: bn(coin.amount),
42245
42018
  assetId: coin.assetId,
42246
42019
  owner: Address.fromAddressOrString(coin.owner),
42020
+ maturity: bn(coin.maturity).toNumber(),
42247
42021
  blockCreated: bn(coin.blockCreated),
42248
42022
  txCreatedIdx: bn(coin.txCreatedIdx)
42249
42023
  };
@@ -42276,7 +42050,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42276
42050
  }
42277
42051
  return {
42278
42052
  id: block2.id,
42279
- height: bn(block2.height),
42053
+ height: bn(block2.header.height),
42280
42054
  time: block2.header.time,
42281
42055
  transactionIds: block2.transactions.map((tx) => tx.id)
42282
42056
  };
@@ -42291,7 +42065,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42291
42065
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
42292
42066
  const blocks = fetchedData.edges.map(({ node: block2 }) => ({
42293
42067
  id: block2.id,
42294
- height: bn(block2.height),
42068
+ height: bn(block2.header.height),
42295
42069
  time: block2.header.time,
42296
42070
  transactionIds: block2.transactions.map((tx) => tx.id)
42297
42071
  }));
@@ -42318,7 +42092,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42318
42092
  }
42319
42093
  return {
42320
42094
  id: block2.id,
42321
- height: bn(block2.height, 10),
42095
+ height: bn(block2.header.height, 10),
42322
42096
  time: block2.header.time,
42323
42097
  transactionIds: block2.transactions.map((tx) => tx.id),
42324
42098
  transactions: block2.transactions.map(
@@ -42498,11 +42272,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42498
42272
  prevRoot: messageBlockHeader.prevRoot,
42499
42273
  time: messageBlockHeader.time,
42500
42274
  applicationHash: messageBlockHeader.applicationHash,
42501
- messageReceiptCount: bn(messageBlockHeader.messageReceiptCount),
42502
- messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
42503
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
42504
- eventInboxRoot: messageBlockHeader.eventInboxRoot,
42505
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
42275
+ messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
42276
+ messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
42506
42277
  },
42507
42278
  commitBlockHeader: {
42508
42279
  id: commitBlockHeader.id,
@@ -42513,11 +42284,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42513
42284
  prevRoot: commitBlockHeader.prevRoot,
42514
42285
  time: commitBlockHeader.time,
42515
42286
  applicationHash: commitBlockHeader.applicationHash,
42516
- messageReceiptCount: bn(commitBlockHeader.messageReceiptCount),
42517
- messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
42518
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
42519
- eventInboxRoot: commitBlockHeader.eventInboxRoot,
42520
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
42287
+ messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
42288
+ messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
42521
42289
  },
42522
42290
  sender: Address.fromAddressOrString(sender),
42523
42291
  recipient: Address.fromAddressOrString(recipient),
@@ -42526,16 +42294,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42526
42294
  data
42527
42295
  };
42528
42296
  }
42529
- async getLatestGasPrice() {
42530
- const { latestGasPrice } = await this.operations.getLatestGasPrice();
42531
- return bn(latestGasPrice.gasPrice);
42532
- }
42533
- async estimateGasPrice(blockHorizon) {
42534
- const { estimateGasPrice } = await this.operations.estimateGasPrice({
42535
- blockHorizon: String(blockHorizon)
42536
- });
42537
- return bn(estimateGasPrice.gasPrice);
42538
- }
42539
42297
  /**
42540
42298
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
42541
42299
  *
@@ -42596,15 +42354,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42596
42354
  arrayify(gqlTransaction.rawPayload),
42597
42355
  0
42598
42356
  );
42599
- let txReceipts = [];
42600
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42601
- txReceipts = gqlTransaction.status.receipts;
42602
- }
42603
- const receipts = txReceipts.map(processGqlReceipt);
42357
+ const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
42604
42358
  const {
42605
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42359
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42606
42360
  } = provider.getChain();
42607
- const gasPrice = await provider.getLatestGasPrice();
42608
42361
  const transactionInfo = assembleTransactionSummary({
42609
42362
  id: gqlTransaction.id,
42610
42363
  receipts,
@@ -42615,9 +42368,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42615
42368
  gasPriceFactor: bn(gasPriceFactor),
42616
42369
  abiMap,
42617
42370
  maxInputs,
42618
- gasCosts,
42619
- maxGasPerTx,
42620
- gasPrice
42371
+ gasCosts
42621
42372
  });
42622
42373
  return {
42623
42374
  gqlTransaction,
@@ -42627,11 +42378,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42627
42378
  async function getTransactionSummaryFromRequest(params) {
42628
42379
  const { provider, transactionRequest, abiMap } = params;
42629
42380
  const { receipts } = await provider.call(transactionRequest);
42630
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
42381
+ const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
42631
42382
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
42632
42383
  const transaction = transactionRequest.toTransaction();
42633
42384
  const transactionBytes = transactionRequest.toTransactionBytes();
42634
- const gasPrice = await provider.getLatestGasPrice();
42635
42385
  const transactionSummary = assembleTransactionSummary({
42636
42386
  receipts,
42637
42387
  transaction,
@@ -42640,9 +42390,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42640
42390
  gasPerByte,
42641
42391
  gasPriceFactor,
42642
42392
  maxInputs,
42643
- gasCosts,
42644
- maxGasPerTx,
42645
- gasPrice
42393
+ gasCosts
42646
42394
  });
42647
42395
  return transactionSummary;
42648
42396
  }
@@ -42651,18 +42399,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42651
42399
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
42652
42400
  const { edges, pageInfo } = transactionsByOwner;
42653
42401
  const {
42654
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42402
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42655
42403
  } = provider.getChain();
42656
- const gasPrice = await provider.getLatestGasPrice();
42657
42404
  const transactions = edges.map((edge) => {
42658
42405
  const { node: gqlTransaction } = edge;
42659
- const { id, rawPayload, status } = gqlTransaction;
42406
+ const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
42660
42407
  const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
42661
- let txReceipts = [];
42662
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42663
- txReceipts = gqlTransaction.status.receipts;
42664
- }
42665
- const receipts = txReceipts.map(processGqlReceipt);
42408
+ const receipts = gqlReceipts?.map(processGqlReceipt) || [];
42666
42409
  const transactionSummary = assembleTransactionSummary({
42667
42410
  id,
42668
42411
  receipts,
@@ -42673,9 +42416,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42673
42416
  gasPerByte,
42674
42417
  gasPriceFactor,
42675
42418
  maxInputs,
42676
- gasCosts,
42677
- maxGasPerTx,
42678
- gasPrice
42419
+ gasCosts
42679
42420
  });
42680
42421
  const output3 = {
42681
42422
  gqlTransaction,
@@ -43004,33 +42745,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43004
42745
  * @param fee - The estimated transaction fee.
43005
42746
  * @returns A promise that resolves when the resources are added to the transaction.
43006
42747
  */
43007
- async fund(request, params) {
43008
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
43009
- const txRequest = request;
43010
- const requiredQuantitiesWithFee = addAmountToCoinQuantities({
42748
+ async fund(request, coinQuantities, fee) {
42749
+ const updatedQuantities = addAmountToAsset({
43011
42750
  amount: bn(fee),
43012
42751
  assetId: BaseAssetId,
43013
- coinQuantities: requiredQuantities
42752
+ coinQuantities
43014
42753
  });
43015
42754
  const quantitiesDict = {};
43016
- requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
42755
+ updatedQuantities.forEach(({ amount, assetId }) => {
43017
42756
  quantitiesDict[assetId] = {
43018
42757
  required: amount,
43019
42758
  owned: bn(0)
43020
42759
  };
43021
42760
  });
43022
- txRequest.inputs.forEach((input) => {
42761
+ const cachedUtxos = [];
42762
+ const cachedMessages = [];
42763
+ const owner = this.address.toB256();
42764
+ request.inputs.forEach((input) => {
43023
42765
  const isResource = "amount" in input;
43024
42766
  if (isResource) {
43025
42767
  const isCoin2 = "owner" in input;
43026
42768
  if (isCoin2) {
43027
42769
  const assetId = String(input.assetId);
43028
- if (quantitiesDict[assetId]) {
42770
+ if (input.owner === owner && quantitiesDict[assetId]) {
43029
42771
  const amount = bn(input.amount);
43030
42772
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42773
+ cachedUtxos.push(input.id);
43031
42774
  }
43032
- } else if (input.amount && quantitiesDict[BaseAssetId]) {
42775
+ } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
43033
42776
  quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42777
+ cachedMessages.push(input.nonce);
43034
42778
  }
43035
42779
  }
43036
42780
  });
@@ -43045,23 +42789,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43045
42789
  });
43046
42790
  const needsToBeFunded = missingQuantities.length;
43047
42791
  if (needsToBeFunded) {
43048
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
43049
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
43050
- txRequest.addResources(resources);
43051
- }
43052
- txRequest.shiftPredicateData();
43053
- txRequest.updatePredicateGasUsed(estimatedPredicates);
43054
- const requestToBeReEstimate = clone_default(txRequest);
43055
- if (addedSignatures) {
43056
- Array.from({ length: addedSignatures }).forEach(
43057
- () => requestToBeReEstimate.addEmptyWitness()
43058
- );
42792
+ const resources = await this.getResourcesToSpend(missingQuantities, {
42793
+ messages: cachedMessages,
42794
+ utxos: cachedUtxos
42795
+ });
42796
+ request.addResources(resources);
43059
42797
  }
43060
- const { maxFee } = await this.provider.estimateTxGasAndFee({
43061
- transactionRequest: requestToBeReEstimate
43062
- });
43063
- txRequest.maxFee = maxFee;
43064
- return txRequest;
43065
42798
  }
43066
42799
  /**
43067
42800
  * A helper that creates a transfer transaction request and returns it.
@@ -43069,25 +42802,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43069
42802
  * @param destination - The address of the destination.
43070
42803
  * @param amount - The amount of coins to transfer.
43071
42804
  * @param assetId - The asset ID of the coins to transfer.
43072
- * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
42805
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43073
42806
  * @returns A promise that resolves to the prepared transaction request.
43074
42807
  */
43075
42808
  async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
43076
- const request = new ScriptTransactionRequest(txParams);
42809
+ const { minGasPrice } = this.provider.getGasConfig();
42810
+ const params = { gasPrice: minGasPrice, ...txParams };
42811
+ const request = new ScriptTransactionRequest(params);
43077
42812
  request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
43078
- const txCost = await this.provider.getTransactionCost(request, {
42813
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
43079
42814
  estimateTxDependencies: true,
43080
42815
  resourcesOwner: this
43081
42816
  });
43082
- if ("gasLimit" in txParams) {
43083
- this.validateGas({
43084
- gasUsed: txCost.gasUsed,
43085
- gasLimit: request.gasLimit
43086
- });
43087
- }
43088
- request.gasLimit = txCost.gasUsed;
43089
- request.maxFee = txCost.maxFee;
43090
- await this.fund(request, txCost);
42817
+ request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
42818
+ request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
42819
+ this.validateGas({
42820
+ gasUsed,
42821
+ gasPrice: request.gasPrice,
42822
+ gasLimit: request.gasLimit,
42823
+ minGasPrice
42824
+ });
42825
+ await this.fund(request, requiredQuantities, maxFee);
42826
+ request.updatePredicateInputs(estimatedInputs);
43091
42827
  return request;
43092
42828
  }
43093
42829
  /**
@@ -43126,30 +42862,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43126
42862
  );
43127
42863
  }
43128
42864
  const contractAddress = Address.fromAddressOrString(contractId);
42865
+ const { minGasPrice } = this.provider.getGasConfig();
42866
+ const params = { gasPrice: minGasPrice, ...txParams };
43129
42867
  const { script, scriptData } = await assembleTransferToContractScript({
43130
42868
  hexlifiedContractId: contractAddress.toB256(),
43131
42869
  amountToTransfer: bn(amount),
43132
42870
  assetId
43133
42871
  });
43134
42872
  const request = new ScriptTransactionRequest({
43135
- ...txParams,
42873
+ ...params,
43136
42874
  script,
43137
42875
  scriptData
43138
42876
  });
43139
42877
  request.addContractInputAndOutput(contractAddress);
43140
- const txCost = await this.provider.getTransactionCost(request, {
43141
- resourcesOwner: this,
43142
- quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
42878
+ const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
42879
+ request,
42880
+ [{ amount: bn(amount), assetId: String(assetId) }]
42881
+ );
42882
+ request.gasLimit = bn(params.gasLimit ?? gasUsed);
42883
+ this.validateGas({
42884
+ gasUsed,
42885
+ gasPrice: request.gasPrice,
42886
+ gasLimit: request.gasLimit,
42887
+ minGasPrice
43143
42888
  });
43144
- if (txParams.gasLimit) {
43145
- this.validateGas({
43146
- gasUsed: txCost.gasUsed,
43147
- gasLimit: request.gasLimit
43148
- });
43149
- }
43150
- request.gasLimit = txCost.gasUsed;
43151
- request.maxFee = txCost.maxFee;
43152
- await this.fund(request, txCost);
42889
+ await this.fund(request, requiredQuantities, maxFee);
43153
42890
  return this.sendTransaction(request);
43154
42891
  }
43155
42892
  /**
@@ -43161,6 +42898,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43161
42898
  * @returns A promise that resolves to the transaction response.
43162
42899
  */
43163
42900
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42901
+ const { minGasPrice } = this.provider.getGasConfig();
43164
42902
  const recipientAddress = Address.fromAddressOrString(recipient);
43165
42903
  const recipientDataArray = arrayify(
43166
42904
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -43173,19 +42911,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43173
42911
  ...recipientDataArray,
43174
42912
  ...amountDataArray
43175
42913
  ]);
43176
- const params = { script, ...txParams };
42914
+ const params = { script, gasPrice: minGasPrice, ...txParams };
43177
42915
  const request = new ScriptTransactionRequest(params);
43178
- const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
43179
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
43180
- if (txParams.gasLimit) {
43181
- this.validateGas({
43182
- gasUsed: txCost.gasUsed,
43183
- gasLimit: request.gasLimit
43184
- });
43185
- }
43186
- request.maxFee = txCost.maxFee;
43187
- request.gasLimit = txCost.gasUsed;
43188
- await this.fund(request, txCost);
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);
43189
42929
  return this.sendTransaction(request);
43190
42930
  }
43191
42931
  async signMessage(message) {
@@ -43243,7 +42983,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43243
42983
  }
43244
42984
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
43245
42985
  }
43246
- validateGas({ gasUsed, gasLimit }) {
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
+ }
43247
42998
  if (gasUsed.gt(gasLimit)) {
43248
42999
  throw new FuelError(
43249
43000
  ErrorCode.GAS_LIMIT_TOO_LOW,
@@ -44832,7 +44583,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44832
44583
  * @param transactionRequestLike - The transaction request to send.
44833
44584
  * @returns A promise that resolves to the TransactionResponse object.
44834
44585
  */
44835
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
44586
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
44836
44587
  const transactionRequest = transactionRequestify(transactionRequestLike);
44837
44588
  if (estimateTxDependencies) {
44838
44589
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -48110,8 +47861,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48110
47861
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
48111
47862
  request.inputs?.forEach((input) => {
48112
47863
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
48113
- input.predicate = hexlify(this.bytes);
48114
- input.predicateData = hexlify(this.getPredicateData(policies.length));
47864
+ input.predicate = this.bytes;
47865
+ input.predicateData = this.getPredicateData(policies.length);
48115
47866
  }
48116
47867
  });
48117
47868
  return request;
@@ -48126,7 +47877,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48126
47877
  * @returns A promise that resolves to the prepared transaction request.
48127
47878
  */
48128
47879
  async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
48129
- return super.createTransfer(destination, amount, assetId, txParams);
47880
+ const request = await super.createTransfer(destination, amount, assetId, txParams);
47881
+ return this.populateTransactionPredicateData(request);
48130
47882
  }
48131
47883
  /**
48132
47884
  * Sends a transaction with the populated predicate data.
@@ -48134,9 +47886,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48134
47886
  * @param transactionRequestLike - The transaction request-like object.
48135
47887
  * @returns A promise that resolves to the transaction response.
48136
47888
  */
48137
- sendTransaction(transactionRequestLike) {
48138
- const transactionRequest = transactionRequestify(transactionRequestLike);
48139
- return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
47889
+ sendTransaction(transactionRequestLike, options) {
47890
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47891
+ return super.sendTransaction(transactionRequest, options);
48140
47892
  }
48141
47893
  /**
48142
47894
  * Simulates a transaction with the populated predicate data.
@@ -48145,8 +47897,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48145
47897
  * @returns A promise that resolves to the call result.
48146
47898
  */
48147
47899
  simulateTransaction(transactionRequestLike) {
48148
- const transactionRequest = transactionRequestify(transactionRequestLike);
48149
- return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
47900
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47901
+ return super.simulateTransaction(transactionRequest);
48150
47902
  }
48151
47903
  getPredicateData(policiesLength) {
48152
47904
  if (!this.predicateData.length) {
@@ -48192,25 +47944,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48192
47944
  predicateInterface: abiInterface
48193
47945
  };
48194
47946
  }
48195
- /**
48196
- * Retrieves resources satisfying the spend query for the account.
48197
- *
48198
- * @param quantities - IDs of coins to exclude.
48199
- * @param excludedIds - IDs of resources to be excluded from the query.
48200
- * @returns A promise that resolves to an array of Resources.
48201
- */
48202
- async getResourcesToSpend(quantities, excludedIds) {
48203
- const resources = await this.provider.getResourcesToSpend(
48204
- this.address,
48205
- quantities,
48206
- excludedIds
48207
- );
48208
- return resources.map((resource) => ({
48209
- ...resource,
48210
- predicate: hexlify(this.bytes),
48211
- paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
48212
- }));
48213
- }
48214
47947
  /**
48215
47948
  * Sets the configurable constants for the predicate.
48216
47949
  *