@fuel-ts/account 0.0.0-rc-2021-20240415193305 → 0.0.0-rc-2045-20240416150348

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 +545 -796
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +507 -762
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +388 -642
  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 +27 -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 +1057 -1546
  48. package/dist/test-utils.global.js.map +1 -1
  49. package/dist/test-utils.js +503 -740
  50. package/dist/test-utils.js.map +1 -1
  51. package/dist/test-utils.mjs +397 -634
  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
@@ -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.80.0"
28958
28958
  };
28959
28959
  }
@@ -31144,7 +31144,7 @@ This unreleased fuel-core build may include features and updates not yet support
31144
31144
  toEvmAddress() {
31145
31145
  const b256Address = toB256(this.bech32Address);
31146
31146
  return {
31147
- value: clearFirst12BytesFromB256(b256Address)
31147
+ bits: clearFirst12BytesFromB256(b256Address)
31148
31148
  };
31149
31149
  }
31150
31150
  /**
@@ -31154,7 +31154,7 @@ This unreleased fuel-core build may include features and updates not yet support
31154
31154
  */
31155
31155
  toAssetId() {
31156
31156
  return {
31157
- value: this.toB256()
31157
+ bits: this.toB256()
31158
31158
  };
31159
31159
  }
31160
31160
  /**
@@ -31495,160 +31495,10 @@ This unreleased fuel-core build may include features and updates not yet support
31495
31495
  function toBytes3(value, bytesPadding) {
31496
31496
  return bn(value).toBytes(bytesPadding);
31497
31497
  }
31498
-
31499
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
31500
- function _isPlaceholder(a) {
31501
- return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
31502
- }
31503
-
31504
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
31505
- function _curry1(fn) {
31506
- return function f1(a) {
31507
- if (arguments.length === 0 || _isPlaceholder(a)) {
31508
- return f1;
31509
- } else {
31510
- return fn.apply(this, arguments);
31511
- }
31512
- };
31513
- }
31514
-
31515
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
31516
- var isArray_default = Array.isArray || function _isArray(val) {
31517
- return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
31518
- };
31519
-
31520
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
31521
- var type = /* @__PURE__ */ _curry1(function type2(val) {
31522
- return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
31523
- });
31524
- var type_default = type;
31525
-
31526
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
31527
- var pad = function pad2(n) {
31528
- return (n < 10 ? "0" : "") + n;
31529
- };
31530
- var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
31531
- return d.toISOString();
31532
- } : function _toISOString3(d) {
31533
- 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";
31534
- };
31535
-
31536
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
31537
- var isInteger_default = Number.isInteger || function _isInteger(n) {
31538
- return n << 0 === n;
31539
- };
31540
-
31541
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
31542
- function _cloneRegExp(pattern) {
31543
- 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" : ""));
31498
+ function max(...numbers) {
31499
+ return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
31544
31500
  }
31545
31501
 
31546
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
31547
- function _clone(value, deep, map) {
31548
- map || (map = new _ObjectMap());
31549
- if (_isPrimitive(value)) {
31550
- return value;
31551
- }
31552
- var copy = function copy2(copiedValue) {
31553
- var cachedCopy = map.get(value);
31554
- if (cachedCopy) {
31555
- return cachedCopy;
31556
- }
31557
- map.set(value, copiedValue);
31558
- for (var key in value) {
31559
- if (Object.prototype.hasOwnProperty.call(value, key)) {
31560
- copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
31561
- }
31562
- }
31563
- return copiedValue;
31564
- };
31565
- switch (type_default(value)) {
31566
- case "Object":
31567
- return copy(Object.create(Object.getPrototypeOf(value)));
31568
- case "Array":
31569
- return copy([]);
31570
- case "Date":
31571
- return new Date(value.valueOf());
31572
- case "RegExp":
31573
- return _cloneRegExp(value);
31574
- case "Int8Array":
31575
- case "Uint8Array":
31576
- case "Uint8ClampedArray":
31577
- case "Int16Array":
31578
- case "Uint16Array":
31579
- case "Int32Array":
31580
- case "Uint32Array":
31581
- case "Float32Array":
31582
- case "Float64Array":
31583
- case "BigInt64Array":
31584
- case "BigUint64Array":
31585
- return value.slice();
31586
- default:
31587
- return value;
31588
- }
31589
- }
31590
- function _isPrimitive(param) {
31591
- var type3 = typeof param;
31592
- return param == null || type3 != "object" && type3 != "function";
31593
- }
31594
- var _ObjectMap = /* @__PURE__ */ function() {
31595
- function _ObjectMap2() {
31596
- this.map = {};
31597
- this.length = 0;
31598
- }
31599
- _ObjectMap2.prototype.set = function(key, value) {
31600
- const hashedKey = this.hash(key);
31601
- let bucket = this.map[hashedKey];
31602
- if (!bucket) {
31603
- this.map[hashedKey] = bucket = [];
31604
- }
31605
- bucket.push([key, value]);
31606
- this.length += 1;
31607
- };
31608
- _ObjectMap2.prototype.hash = function(key) {
31609
- let hashedKey = [];
31610
- for (var value in key) {
31611
- hashedKey.push(Object.prototype.toString.call(key[value]));
31612
- }
31613
- return hashedKey.join();
31614
- };
31615
- _ObjectMap2.prototype.get = function(key) {
31616
- if (this.length <= 180) {
31617
- for (const p in this.map) {
31618
- const bucket2 = this.map[p];
31619
- for (let i = 0; i < bucket2.length; i += 1) {
31620
- const element = bucket2[i];
31621
- if (element[0] === key) {
31622
- return element[1];
31623
- }
31624
- }
31625
- }
31626
- return;
31627
- }
31628
- const hashedKey = this.hash(key);
31629
- const bucket = this.map[hashedKey];
31630
- if (!bucket) {
31631
- return;
31632
- }
31633
- for (let i = 0; i < bucket.length; i += 1) {
31634
- const element = bucket[i];
31635
- if (element[0] === key) {
31636
- return element[1];
31637
- }
31638
- }
31639
- };
31640
- return _ObjectMap2;
31641
- }();
31642
-
31643
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
31644
- var clone = /* @__PURE__ */ _curry1(function clone2(value) {
31645
- return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
31646
- });
31647
- var clone_default = clone;
31648
-
31649
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
31650
- var hasProtoTrim = typeof String.prototype.trim === "function";
31651
-
31652
31502
  // src/providers/coin-quantity.ts
31653
31503
  var coinQuantityfy = (coinQuantityLike) => {
31654
31504
  let assetId;
@@ -31670,7 +31520,7 @@ This unreleased fuel-core build may include features and updates not yet support
31670
31520
  max: max2 ? bn(max2) : void 0
31671
31521
  };
31672
31522
  };
31673
- var addAmountToCoinQuantities = (params) => {
31523
+ var addAmountToAsset = (params) => {
31674
31524
  const { amount, assetId } = params;
31675
31525
  const coinQuantities = [...params.coinQuantities];
31676
31526
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -31755,7 +31605,7 @@ This unreleased fuel-core build may include features and updates not yet support
31755
31605
  var ENCODING_V1 = "1";
31756
31606
  var WORD_SIZE = 8;
31757
31607
  var BYTES_32 = 32;
31758
- var UTXO_ID_LEN = BYTES_32 + 2;
31608
+ var UTXO_ID_LEN = BYTES_32 + 1;
31759
31609
  var ASSET_ID_LEN = BYTES_32;
31760
31610
  var ADDRESS_LEN = BYTES_32;
31761
31611
  var NONCE_LEN = BYTES_32;
@@ -31763,9 +31613,9 @@ This unreleased fuel-core build may include features and updates not yet support
31763
31613
  var TX_POINTER_LEN = WORD_SIZE * 2;
31764
31614
  var MAX_BYTES = 2 ** 32 - 1;
31765
31615
  var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
31766
- ASSET_ID_LEN + // Base asset ID
31616
+ WORD_SIZE + // Tx size
31767
31617
  // Asset ID/Balance coin input pairs
31768
- maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
31618
+ maxInputs * (ASSET_ID_LEN + WORD_SIZE);
31769
31619
  var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
31770
31620
  WORD_SIZE + // Gas limit
31771
31621
  WORD_SIZE + // Script size
@@ -31783,6 +31633,7 @@ This unreleased fuel-core build may include features and updates not yet support
31783
31633
  ASSET_ID_LEN + // Asset id
31784
31634
  TX_POINTER_LEN + // TxPointer
31785
31635
  WORD_SIZE + // Witnesses index
31636
+ WORD_SIZE + // Maturity
31786
31637
  WORD_SIZE + // Predicate size
31787
31638
  WORD_SIZE + // Predicate data size
31788
31639
  WORD_SIZE;
@@ -33520,19 +33371,18 @@ This unreleased fuel-core build may include features and updates not yet support
33520
33371
  encode(value) {
33521
33372
  const parts = [];
33522
33373
  parts.push(new B256Coder().encode(value.txID));
33523
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33374
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33524
33375
  parts.push(new B256Coder().encode(value.owner));
33525
33376
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33526
33377
  parts.push(new B256Coder().encode(value.assetId));
33527
33378
  parts.push(new TxPointerCoder().encode(value.txPointer));
33528
- 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));
33529
33381
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33530
- parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33531
- parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
33532
- parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33533
- parts.push(
33534
- new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33535
- );
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));
33536
33386
  return concat(parts);
33537
33387
  }
33538
33388
  decode(data, offset) {
@@ -33540,7 +33390,7 @@ This unreleased fuel-core build may include features and updates not yet support
33540
33390
  let o = offset;
33541
33391
  [decoded, o] = new B256Coder().decode(data, o);
33542
33392
  const txID = decoded;
33543
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33393
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33544
33394
  const outputIndex = decoded;
33545
33395
  [decoded, o] = new B256Coder().decode(data, o);
33546
33396
  const owner = decoded;
@@ -33550,17 +33400,19 @@ This unreleased fuel-core build may include features and updates not yet support
33550
33400
  const assetId = decoded;
33551
33401
  [decoded, o] = new TxPointerCoder().decode(data, o);
33552
33402
  const txPointer = decoded;
33553
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33403
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33554
33404
  const witnessIndex = Number(decoded);
33405
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33406
+ const maturity = decoded;
33555
33407
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33556
33408
  const predicateGasUsed = decoded;
33557
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33409
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33558
33410
  const predicateLength = decoded;
33559
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33411
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33560
33412
  const predicateDataLength = decoded;
33561
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33413
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33562
33414
  const predicate = decoded;
33563
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33415
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33564
33416
  const predicateData = decoded;
33565
33417
  return [
33566
33418
  {
@@ -33572,6 +33424,7 @@ This unreleased fuel-core build may include features and updates not yet support
33572
33424
  assetId,
33573
33425
  txPointer,
33574
33426
  witnessIndex,
33427
+ maturity,
33575
33428
  predicateGasUsed,
33576
33429
  predicateLength,
33577
33430
  predicateDataLength,
@@ -33589,7 +33442,7 @@ This unreleased fuel-core build may include features and updates not yet support
33589
33442
  encode(value) {
33590
33443
  const parts = [];
33591
33444
  parts.push(new B256Coder().encode(value.txID));
33592
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33445
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33593
33446
  parts.push(new B256Coder().encode(value.balanceRoot));
33594
33447
  parts.push(new B256Coder().encode(value.stateRoot));
33595
33448
  parts.push(new TxPointerCoder().encode(value.txPointer));
@@ -33601,7 +33454,7 @@ This unreleased fuel-core build may include features and updates not yet support
33601
33454
  let o = offset;
33602
33455
  [decoded, o] = new B256Coder().decode(data, o);
33603
33456
  const txID = decoded;
33604
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33457
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33605
33458
  const outputIndex = decoded;
33606
33459
  [decoded, o] = new B256Coder().decode(data, o);
33607
33460
  const balanceRoot = decoded;
@@ -33650,16 +33503,14 @@ This unreleased fuel-core build may include features and updates not yet support
33650
33503
  parts.push(new ByteArrayCoder(32).encode(value.recipient));
33651
33504
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33652
33505
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33653
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33506
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33654
33507
  parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
33655
- parts.push(new BigNumberCoder("u64").encode(data.length));
33656
- parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
33657
- 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));
33658
33511
  parts.push(new ByteArrayCoder(data.length).encode(data));
33659
- parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
33660
- parts.push(
33661
- new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
33662
- );
33512
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33513
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33663
33514
  return concat(parts);
33664
33515
  }
33665
33516
  static decodeData(messageData) {
@@ -33679,21 +33530,21 @@ This unreleased fuel-core build may include features and updates not yet support
33679
33530
  const amount = decoded;
33680
33531
  [decoded, o] = new B256Coder().decode(data, o);
33681
33532
  const nonce = decoded;
33682
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33533
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33683
33534
  const witnessIndex = Number(decoded);
33684
33535
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33685
33536
  const predicateGasUsed = decoded;
33686
33537
  [decoded, o] = new NumberCoder("u32").decode(data, o);
33687
33538
  const dataLength2 = decoded;
33688
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33539
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33689
33540
  const predicateLength = decoded;
33690
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33541
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33691
33542
  const predicateDataLength = decoded;
33692
33543
  [decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
33693
33544
  const messageData = decoded;
33694
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33545
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33695
33546
  const predicate = decoded;
33696
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33547
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33697
33548
  const predicateData = decoded;
33698
33549
  return [
33699
33550
  {
@@ -34005,7 +33856,7 @@ This unreleased fuel-core build may include features and updates not yet support
34005
33856
  }
34006
33857
  };
34007
33858
  var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
34008
- PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
33859
+ PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
34009
33860
  PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
34010
33861
  PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
34011
33862
  PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
@@ -34053,9 +33904,9 @@ This unreleased fuel-core build may include features and updates not yet support
34053
33904
  let o = offset;
34054
33905
  const policies = [];
34055
33906
  if (policyTypes & 1) {
34056
- const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
33907
+ const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
34057
33908
  o = nextOffset;
34058
- policies.push({ type: 1, data: tip });
33909
+ policies.push({ type: 1, data: gasPrice });
34059
33910
  }
34060
33911
  if (policyTypes & 2) {
34061
33912
  const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
@@ -34287,15 +34138,15 @@ This unreleased fuel-core build may include features and updates not yet support
34287
34138
  encode(value) {
34288
34139
  const parts = [];
34289
34140
  parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
34290
- parts.push(new B256Coder().encode(value.receiptsRoot));
34291
- parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
34292
- 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));
34293
34143
  parts.push(new NumberCoder("u32").encode(value.policyTypes));
34294
- parts.push(new NumberCoder("u16").encode(value.inputsCount));
34295
- parts.push(new NumberCoder("u16").encode(value.outputsCount));
34296
- parts.push(new NumberCoder("u16").encode(value.witnessesCount));
34297
- parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
34298
- 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));
34299
34150
  parts.push(new PoliciesCoder().encode(value.policies));
34300
34151
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34301
34152
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
@@ -34307,23 +34158,23 @@ This unreleased fuel-core build may include features and updates not yet support
34307
34158
  let o = offset;
34308
34159
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34309
34160
  const scriptGasLimit = decoded;
34310
- [decoded, o] = new B256Coder().decode(data, o);
34311
- const receiptsRoot = decoded;
34312
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34161
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34313
34162
  const scriptLength = decoded;
34314
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34163
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34315
34164
  const scriptDataLength = decoded;
34316
34165
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34317
34166
  const policyTypes = decoded;
34318
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34167
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34319
34168
  const inputsCount = decoded;
34320
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34169
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34321
34170
  const outputsCount = decoded;
34322
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34171
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34323
34172
  const witnessesCount = decoded;
34324
- [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);
34325
34176
  const script = decoded;
34326
- [decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
34177
+ [decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
34327
34178
  const scriptData = decoded;
34328
34179
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34329
34180
  const policies = decoded;
@@ -34361,19 +34212,18 @@ This unreleased fuel-core build may include features and updates not yet support
34361
34212
  }
34362
34213
  encode(value) {
34363
34214
  const parts = [];
34364
- parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
34365
- parts.push(new B256Coder().encode(value.salt));
34366
- 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));
34367
34217
  parts.push(new NumberCoder("u32").encode(value.policyTypes));
34368
- parts.push(new NumberCoder("u16").encode(value.inputsCount));
34369
- parts.push(new NumberCoder("u16").encode(value.outputsCount));
34370
- 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));
34371
34224
  parts.push(
34372
- new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
34373
- value.storageSlots
34374
- )
34225
+ new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
34375
34226
  );
34376
- parts.push(new PoliciesCoder().encode(value.policies));
34377
34227
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34378
34228
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
34379
34229
  parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
@@ -34382,27 +34232,26 @@ This unreleased fuel-core build may include features and updates not yet support
34382
34232
  decode(data, offset) {
34383
34233
  let decoded;
34384
34234
  let o = offset;
34385
- [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);
34386
34238
  const bytecodeWitnessIndex = decoded;
34387
- [decoded, o] = new B256Coder().decode(data, o);
34388
- const salt = decoded;
34389
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34390
- const storageSlotsCount = decoded;
34391
34239
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34392
34240
  const policyTypes = decoded;
34393
34241
  [decoded, o] = new NumberCoder("u16").decode(data, o);
34242
+ const storageSlotsCount = decoded;
34243
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34394
34244
  const inputsCount = decoded;
34395
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34245
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34396
34246
  const outputsCount = decoded;
34397
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34247
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34398
34248
  const witnessesCount = decoded;
34399
- [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
34400
- data,
34401
- o
34402
- );
34403
- const storageSlots = decoded;
34249
+ [decoded, o] = new B256Coder().decode(data, o);
34250
+ const salt = decoded;
34404
34251
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34405
34252
  const policies = decoded;
34253
+ [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
34254
+ const storageSlots = decoded;
34406
34255
  [decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
34407
34256
  const inputs = decoded;
34408
34257
  [decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
@@ -34412,6 +34261,7 @@ This unreleased fuel-core build may include features and updates not yet support
34412
34261
  return [
34413
34262
  {
34414
34263
  type: 1,
34264
+ bytecodeLength,
34415
34265
  bytecodeWitnessIndex,
34416
34266
  policyTypes,
34417
34267
  storageSlotsCount,
@@ -34440,7 +34290,6 @@ This unreleased fuel-core build may include features and updates not yet support
34440
34290
  parts.push(new OutputContractCoder().encode(value.outputContract));
34441
34291
  parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
34442
34292
  parts.push(new B256Coder().encode(value.mintAssetId));
34443
- parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
34444
34293
  return concat(parts);
34445
34294
  }
34446
34295
  decode(data, offset) {
@@ -34456,8 +34305,6 @@ This unreleased fuel-core build may include features and updates not yet support
34456
34305
  const mintAmount = decoded;
34457
34306
  [decoded, o] = new B256Coder().decode(data, o);
34458
34307
  const mintAssetId = decoded;
34459
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34460
- const gasPrice = decoded;
34461
34308
  return [
34462
34309
  {
34463
34310
  type: 2,
@@ -34465,8 +34312,7 @@ This unreleased fuel-core build may include features and updates not yet support
34465
34312
  inputContract,
34466
34313
  outputContract,
34467
34314
  mintAmount,
34468
- mintAssetId,
34469
- gasPrice
34315
+ mintAssetId
34470
34316
  },
34471
34317
  o
34472
34318
  ];
@@ -34773,6 +34619,159 @@ This unreleased fuel-core build may include features and updates not yet support
34773
34619
  // src/providers/provider.ts
34774
34620
  var import_graphql_request = __toESM(require_dist2());
34775
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
+
34776
34775
  // ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
34777
34776
  var __assign = function() {
34778
34777
  __assign = Object.assign || function __assign2(t) {
@@ -37940,10 +37939,14 @@ spurious results.`);
37940
37939
  // src/providers/__generated__/operations.ts
37941
37940
  var ReceiptFragmentFragmentDoc = lib_default2`
37942
37941
  fragment receiptFragment on Receipt {
37943
- id
37942
+ contract {
37943
+ id
37944
+ }
37944
37945
  pc
37945
37946
  is
37946
- to
37947
+ to {
37948
+ id
37949
+ }
37947
37950
  toAddress
37948
37951
  amount
37949
37952
  assetId
@@ -37981,16 +37984,10 @@ spurious results.`);
37981
37984
  id
37982
37985
  }
37983
37986
  time
37984
- receipts {
37985
- ...receiptFragment
37986
- }
37987
37987
  programState {
37988
37988
  returnType
37989
37989
  data
37990
37990
  }
37991
- receipts {
37992
- ...receiptFragment
37993
- }
37994
37991
  }
37995
37992
  ... on FailureStatus {
37996
37993
  block {
@@ -37998,24 +37995,26 @@ spurious results.`);
37998
37995
  }
37999
37996
  time
38000
37997
  reason
38001
- receipts {
38002
- ...receiptFragment
38003
- }
38004
37998
  }
38005
37999
  ... on SqueezedOutStatus {
38006
38000
  reason
38007
38001
  }
38008
38002
  }
38009
- ${ReceiptFragmentFragmentDoc}`;
38003
+ `;
38010
38004
  var TransactionFragmentFragmentDoc = lib_default2`
38011
38005
  fragment transactionFragment on Transaction {
38012
38006
  id
38013
38007
  rawPayload
38008
+ gasPrice
38009
+ receipts {
38010
+ ...receiptFragment
38011
+ }
38014
38012
  status {
38015
38013
  ...transactionStatusFragment
38016
38014
  }
38017
38015
  }
38018
- ${TransactionStatusFragmentFragmentDoc}`;
38016
+ ${ReceiptFragmentFragmentDoc}
38017
+ ${TransactionStatusFragmentFragmentDoc}`;
38019
38018
  var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
38020
38019
  fragment inputEstimatePredicatesFragment on Input {
38021
38020
  ... on InputCoin {
@@ -38033,46 +38032,6 @@ spurious results.`);
38033
38032
  }
38034
38033
  }
38035
38034
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
38036
- var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
38037
- fragment dryRunFailureStatusFragment on DryRunFailureStatus {
38038
- reason
38039
- programState {
38040
- returnType
38041
- data
38042
- }
38043
- }
38044
- `;
38045
- var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
38046
- fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
38047
- programState {
38048
- returnType
38049
- data
38050
- }
38051
- }
38052
- `;
38053
- var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
38054
- fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
38055
- ... on DryRunFailureStatus {
38056
- ...dryRunFailureStatusFragment
38057
- }
38058
- ... on DryRunSuccessStatus {
38059
- ...dryRunSuccessStatusFragment
38060
- }
38061
- }
38062
- ${DryRunFailureStatusFragmentFragmentDoc}
38063
- ${DryRunSuccessStatusFragmentFragmentDoc}`;
38064
- var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
38065
- fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
38066
- id
38067
- status {
38068
- ...dryRunTransactionStatusFragment
38069
- }
38070
- receipts {
38071
- ...receiptFragment
38072
- }
38073
- }
38074
- ${DryRunTransactionStatusFragmentFragmentDoc}
38075
- ${ReceiptFragmentFragmentDoc}`;
38076
38035
  var CoinFragmentFragmentDoc = lib_default2`
38077
38036
  fragment coinFragment on Coin {
38078
38037
  __typename
@@ -38080,6 +38039,7 @@ ${ReceiptFragmentFragmentDoc}`;
38080
38039
  owner
38081
38040
  amount
38082
38041
  assetId
38042
+ maturity
38083
38043
  blockCreated
38084
38044
  txCreatedIdx
38085
38045
  }
@@ -38118,32 +38078,26 @@ ${ReceiptFragmentFragmentDoc}`;
38118
38078
  messageBlockHeader {
38119
38079
  id
38120
38080
  daHeight
38121
- consensusParametersVersion
38122
- stateTransitionBytecodeVersion
38123
38081
  transactionsCount
38124
- messageReceiptCount
38125
38082
  transactionsRoot
38126
- messageOutboxRoot
38127
- eventInboxRoot
38128
38083
  height
38129
38084
  prevRoot
38130
38085
  time
38131
38086
  applicationHash
38087
+ messageReceiptRoot
38088
+ messageReceiptCount
38132
38089
  }
38133
38090
  commitBlockHeader {
38134
38091
  id
38135
38092
  daHeight
38136
- consensusParametersVersion
38137
- stateTransitionBytecodeVersion
38138
38093
  transactionsCount
38139
- messageReceiptCount
38140
38094
  transactionsRoot
38141
- messageOutboxRoot
38142
- eventInboxRoot
38143
38095
  height
38144
38096
  prevRoot
38145
38097
  time
38146
38098
  applicationHash
38099
+ messageReceiptRoot
38100
+ messageReceiptCount
38147
38101
  }
38148
38102
  sender
38149
38103
  recipient
@@ -38162,8 +38116,8 @@ ${ReceiptFragmentFragmentDoc}`;
38162
38116
  var BlockFragmentFragmentDoc = lib_default2`
38163
38117
  fragment blockFragment on Block {
38164
38118
  id
38165
- height
38166
38119
  header {
38120
+ height
38167
38121
  time
38168
38122
  }
38169
38123
  transactions {
@@ -38221,11 +38175,6 @@ ${ReceiptFragmentFragmentDoc}`;
38221
38175
  `;
38222
38176
  var GasCostsFragmentFragmentDoc = lib_default2`
38223
38177
  fragment GasCostsFragment on GasCosts {
38224
- version {
38225
- ... on Version {
38226
- value
38227
- }
38228
- }
38229
38178
  add
38230
38179
  addi
38231
38180
  aloc
@@ -38238,6 +38187,7 @@ ${ReceiptFragmentFragmentDoc}`;
38238
38187
  cb
38239
38188
  cfei
38240
38189
  cfsi
38190
+ croo
38241
38191
  div
38242
38192
  divi
38243
38193
  ecr1
@@ -38320,9 +38270,6 @@ ${ReceiptFragmentFragmentDoc}`;
38320
38270
  ccp {
38321
38271
  ...DependentCostFragment
38322
38272
  }
38323
- croo {
38324
- ...DependentCostFragment
38325
- }
38326
38273
  csiz {
38327
38274
  ...DependentCostFragment
38328
38275
  }
@@ -38382,11 +38329,6 @@ ${ReceiptFragmentFragmentDoc}`;
38382
38329
  ${DependentCostFragmentFragmentDoc}`;
38383
38330
  var ConsensusParametersFragmentFragmentDoc = lib_default2`
38384
38331
  fragment consensusParametersFragment on ConsensusParameters {
38385
- version {
38386
- ... on Version {
38387
- value
38388
- }
38389
- }
38390
38332
  txParams {
38391
38333
  ...TxParametersFragment
38392
38334
  }
@@ -38446,9 +38388,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38446
38388
  fragment nodeInfoFragment on NodeInfo {
38447
38389
  utxoValidation
38448
38390
  vmBacktrace
38391
+ minGasPrice
38449
38392
  maxTx
38450
38393
  maxDepth
38451
38394
  nodeVersion
38395
+ peers {
38396
+ id
38397
+ addresses
38398
+ clientVersion
38399
+ blockHeight
38400
+ lastHeartbeatMs
38401
+ appScore
38402
+ }
38452
38403
  }
38453
38404
  `;
38454
38405
  var GetVersionDocument = lib_default2`
@@ -38483,9 +38434,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38483
38434
  query getTransactionWithReceipts($transactionId: TransactionId!) {
38484
38435
  transaction(id: $transactionId) {
38485
38436
  ...transactionFragment
38437
+ receipts {
38438
+ ...receiptFragment
38439
+ }
38486
38440
  }
38487
38441
  }
38488
- ${TransactionFragmentFragmentDoc}`;
38442
+ ${TransactionFragmentFragmentDoc}
38443
+ ${ReceiptFragmentFragmentDoc}`;
38489
38444
  var GetTransactionsDocument = lib_default2`
38490
38445
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
38491
38446
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -38613,20 +38568,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38613
38568
  }
38614
38569
  }
38615
38570
  ${BalanceFragmentFragmentDoc}`;
38616
- var GetLatestGasPriceDocument = lib_default2`
38617
- query getLatestGasPrice {
38618
- latestGasPrice {
38619
- gasPrice
38620
- }
38621
- }
38622
- `;
38623
- var EstimateGasPriceDocument = lib_default2`
38624
- query estimateGasPrice($blockHorizon: U32!) {
38625
- estimateGasPrice(blockHorizon: $blockHorizon) {
38626
- gasPrice
38627
- }
38628
- }
38629
- `;
38630
38571
  var GetBalancesDocument = lib_default2`
38631
38572
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
38632
38573
  balances(
@@ -38681,12 +38622,12 @@ ${MessageCoinFragmentFragmentDoc}`;
38681
38622
  }
38682
38623
  `;
38683
38624
  var DryRunDocument = lib_default2`
38684
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
38685
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
38686
- ...dryRunTransactionExecutionStatusFragment
38625
+ mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
38626
+ dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
38627
+ ...receiptFragment
38687
38628
  }
38688
38629
  }
38689
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
38630
+ ${ReceiptFragmentFragmentDoc}`;
38690
38631
  var SubmitDocument = lib_default2`
38691
38632
  mutation submit($encodedTransaction: HexString!) {
38692
38633
  submit(tx: $encodedTransaction) {
@@ -38769,12 +38710,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38769
38710
  getBalance(variables, options) {
38770
38711
  return requester(GetBalanceDocument, variables, options);
38771
38712
  },
38772
- getLatestGasPrice(variables, options) {
38773
- return requester(GetLatestGasPriceDocument, variables, options);
38774
- },
38775
- estimateGasPrice(variables, options) {
38776
- return requester(EstimateGasPriceDocument, variables, options);
38777
- },
38778
38713
  getBalances(variables, options) {
38779
38714
  return requester(GetBalancesDocument, variables, options);
38780
38715
  },
@@ -38842,14 +38777,11 @@ ${MessageCoinFragmentFragmentDoc}`;
38842
38777
  let data;
38843
38778
  let errors;
38844
38779
  try {
38845
- const sanitizedText = text.replace(/\s/g, "");
38846
- ({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
38780
+ ({ data, errors } = JSON.parse(text.replace(/^data:/, "")));
38847
38781
  } catch (e) {
38848
38782
  throw new FuelError(
38849
38783
  ErrorCode.STREAM_PARSING_ERROR,
38850
- `Error while parsing stream data response: ${text}
38851
-
38852
- Thrown error: ${e}`
38784
+ `Error while parsing stream data response: ${text}`
38853
38785
  );
38854
38786
  }
38855
38787
  if (Array.isArray(errors)) {
@@ -38952,9 +38884,10 @@ Thrown error: ${e}`
38952
38884
  txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38953
38885
  },
38954
38886
  witnessIndex: value.witnessIndex,
38887
+ maturity: value.maturity ?? 0,
38955
38888
  predicateGasUsed: bn(value.predicateGasUsed),
38956
- predicateLength: bn(predicate.length),
38957
- predicateDataLength: bn(predicateData.length),
38889
+ predicateLength: predicate.length,
38890
+ predicateDataLength: predicateData.length,
38958
38891
  predicate: hexlify(predicate),
38959
38892
  predicateData: hexlify(predicateData)
38960
38893
  };
@@ -38985,8 +38918,8 @@ Thrown error: ${e}`
38985
38918
  nonce: hexlify(value.nonce),
38986
38919
  witnessIndex: value.witnessIndex,
38987
38920
  predicateGasUsed: bn(value.predicateGasUsed),
38988
- predicateLength: bn(predicate.length),
38989
- predicateDataLength: bn(predicateData.length),
38921
+ predicateLength: predicate.length,
38922
+ predicateDataLength: predicateData.length,
38990
38923
  predicate: hexlify(predicate),
38991
38924
  predicateData: hexlify(predicateData),
38992
38925
  data: hexlify(data),
@@ -39146,8 +39079,8 @@ Thrown error: ${e}`
39146
39079
  case "CALL" /* Call */: {
39147
39080
  const callReceipt = {
39148
39081
  type: ReceiptType.Call,
39149
- from: hexOrZero(receipt.id || receipt.contractId),
39150
- to: hexOrZero(receipt?.to),
39082
+ from: hexOrZero(receipt.contract?.id),
39083
+ to: hexOrZero(receipt?.to?.id),
39151
39084
  amount: bn(receipt.amount),
39152
39085
  assetId: hexOrZero(receipt.assetId),
39153
39086
  gas: bn(receipt.gas),
@@ -39161,7 +39094,7 @@ Thrown error: ${e}`
39161
39094
  case "RETURN" /* Return */: {
39162
39095
  const returnReceipt = {
39163
39096
  type: ReceiptType.Return,
39164
- id: hexOrZero(receipt.id || receipt.contractId),
39097
+ id: hexOrZero(receipt.contract?.id),
39165
39098
  val: bn(receipt.val),
39166
39099
  pc: bn(receipt.pc),
39167
39100
  is: bn(receipt.is)
@@ -39171,7 +39104,7 @@ Thrown error: ${e}`
39171
39104
  case "RETURN_DATA" /* ReturnData */: {
39172
39105
  const returnDataReceipt = {
39173
39106
  type: ReceiptType.ReturnData,
39174
- id: hexOrZero(receipt.id || receipt.contractId),
39107
+ id: hexOrZero(receipt.contract?.id),
39175
39108
  ptr: bn(receipt.ptr),
39176
39109
  len: bn(receipt.len),
39177
39110
  digest: hexOrZero(receipt.digest),
@@ -39183,7 +39116,7 @@ Thrown error: ${e}`
39183
39116
  case "PANIC" /* Panic */: {
39184
39117
  const panicReceipt = {
39185
39118
  type: ReceiptType.Panic,
39186
- id: hexOrZero(receipt.id),
39119
+ id: hexOrZero(receipt.contract?.id),
39187
39120
  reason: bn(receipt.reason),
39188
39121
  pc: bn(receipt.pc),
39189
39122
  is: bn(receipt.is),
@@ -39194,7 +39127,7 @@ Thrown error: ${e}`
39194
39127
  case "REVERT" /* Revert */: {
39195
39128
  const revertReceipt = {
39196
39129
  type: ReceiptType.Revert,
39197
- id: hexOrZero(receipt.id || receipt.contractId),
39130
+ id: hexOrZero(receipt.contract?.id),
39198
39131
  val: bn(receipt.ra),
39199
39132
  pc: bn(receipt.pc),
39200
39133
  is: bn(receipt.is)
@@ -39204,7 +39137,7 @@ Thrown error: ${e}`
39204
39137
  case "LOG" /* Log */: {
39205
39138
  const logReceipt = {
39206
39139
  type: ReceiptType.Log,
39207
- id: hexOrZero(receipt.id || receipt.contractId),
39140
+ id: hexOrZero(receipt.contract?.id),
39208
39141
  val0: bn(receipt.ra),
39209
39142
  val1: bn(receipt.rb),
39210
39143
  val2: bn(receipt.rc),
@@ -39217,7 +39150,7 @@ Thrown error: ${e}`
39217
39150
  case "LOG_DATA" /* LogData */: {
39218
39151
  const logDataReceipt = {
39219
39152
  type: ReceiptType.LogData,
39220
- id: hexOrZero(receipt.id || receipt.contractId),
39153
+ id: hexOrZero(receipt.contract?.id),
39221
39154
  val0: bn(receipt.ra),
39222
39155
  val1: bn(receipt.rb),
39223
39156
  ptr: bn(receipt.ptr),
@@ -39231,8 +39164,8 @@ Thrown error: ${e}`
39231
39164
  case "TRANSFER" /* Transfer */: {
39232
39165
  const transferReceipt = {
39233
39166
  type: ReceiptType.Transfer,
39234
- from: hexOrZero(receipt.id || receipt.contractId),
39235
- to: hexOrZero(receipt.toAddress || receipt?.to),
39167
+ from: hexOrZero(receipt.contract?.id),
39168
+ to: hexOrZero(receipt.toAddress || receipt?.to?.id),
39236
39169
  amount: bn(receipt.amount),
39237
39170
  assetId: hexOrZero(receipt.assetId),
39238
39171
  pc: bn(receipt.pc),
@@ -39243,8 +39176,8 @@ Thrown error: ${e}`
39243
39176
  case "TRANSFER_OUT" /* TransferOut */: {
39244
39177
  const transferOutReceipt = {
39245
39178
  type: ReceiptType.TransferOut,
39246
- from: hexOrZero(receipt.id || receipt.contractId),
39247
- to: hexOrZero(receipt.toAddress || receipt.to),
39179
+ from: hexOrZero(receipt.contract?.id),
39180
+ to: hexOrZero(receipt.toAddress || receipt.to?.id),
39248
39181
  amount: bn(receipt.amount),
39249
39182
  assetId: hexOrZero(receipt.assetId),
39250
39183
  pc: bn(receipt.pc),
@@ -39287,7 +39220,7 @@ Thrown error: ${e}`
39287
39220
  return receiptMessageOut;
39288
39221
  }
39289
39222
  case "MINT" /* Mint */: {
39290
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39223
+ const contractId = hexOrZero(receipt.contract?.id);
39291
39224
  const subId = hexOrZero(receipt.subId);
39292
39225
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
39293
39226
  const mintReceipt = {
@@ -39302,7 +39235,7 @@ Thrown error: ${e}`
39302
39235
  return mintReceipt;
39303
39236
  }
39304
39237
  case "BURN" /* Burn */: {
39305
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39238
+ const contractId = hexOrZero(receipt.contract?.id);
39306
39239
  const subId = hexOrZero(receipt.subId);
39307
39240
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
39308
39241
  const burnReceipt = {
@@ -39383,6 +39316,7 @@ Thrown error: ${e}`
39383
39316
  };
39384
39317
 
39385
39318
  // src/providers/utils/gas.ts
39319
+ var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
39386
39320
  var getGasUsedFromReceipts = (receipts) => {
39387
39321
  const scriptResult = receipts.filter(
39388
39322
  (receipt) => receipt.type === ReceiptType.ScriptResult
@@ -39403,28 +39337,18 @@ Thrown error: ${e}`
39403
39337
  }
39404
39338
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
39405
39339
  const witnessCache = [];
39406
- const chargeableInputs = inputs.filter((input) => {
39407
- const isCoinOrMessage = "owner" in input || "sender" in input;
39408
- if (isCoinOrMessage) {
39409
- if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39410
- return true;
39411
- }
39412
- if (!witnessCache.includes(input.witnessIndex)) {
39413
- witnessCache.push(input.witnessIndex);
39414
- return true;
39415
- }
39416
- }
39417
- return false;
39418
- });
39419
- const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
39420
- const totalGas = chargeableInputs.reduce((total, input) => {
39340
+ const totalGas = inputs.reduce((total, input) => {
39421
39341
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39422
39342
  return total.add(
39423
- 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))
39424
39344
  );
39425
39345
  }
39426
- return total.add(gasCosts.ecr1);
39427
- }, 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());
39428
39352
  return totalGas;
39429
39353
  }
39430
39354
  function getMinGas(params) {
@@ -39436,20 +39360,12 @@ Thrown error: ${e}`
39436
39360
  return minGas;
39437
39361
  }
39438
39362
  function getMaxGas(params) {
39439
- const {
39440
- gasPerByte,
39441
- witnessesLength,
39442
- witnessLimit,
39443
- minGas,
39444
- gasLimit = bn(0),
39445
- maxGasPerTx
39446
- } = params;
39363
+ const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
39447
39364
  let remainingAllowedWitnessGas = bn(0);
39448
39365
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
39449
39366
  remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
39450
39367
  }
39451
- const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39452
- return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
39368
+ return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39453
39369
  }
39454
39370
  function calculateMetadataGasForTxCreate({
39455
39371
  gasCosts,
@@ -39471,10 +39387,6 @@ Thrown error: ${e}`
39471
39387
  }) {
39472
39388
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
39473
39389
  }
39474
- var calculateGasFee = (params) => {
39475
- const { gas, gasPrice, priceFactor, tip } = params;
39476
- return gas.mul(gasPrice).div(priceFactor).add(tip);
39477
- };
39478
39390
 
39479
39391
  // src/providers/utils/json.ts
39480
39392
  function normalize2(object) {
@@ -39616,7 +39528,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39616
39528
  // src/providers/transaction-request/transaction-request.ts
39617
39529
  var BaseTransactionRequest = class {
39618
39530
  /** Gas price for transaction */
39619
- tip;
39531
+ gasPrice;
39620
39532
  /** Block until which tx cannot be included */
39621
39533
  maturity;
39622
39534
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -39635,7 +39547,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39635
39547
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
39636
39548
  */
39637
39549
  constructor({
39638
- tip,
39550
+ gasPrice,
39639
39551
  maturity,
39640
39552
  maxFee,
39641
39553
  witnessLimit,
@@ -39643,7 +39555,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39643
39555
  outputs,
39644
39556
  witnesses
39645
39557
  } = {}) {
39646
- this.tip = bn(tip);
39558
+ this.gasPrice = bn(gasPrice);
39647
39559
  this.maturity = maturity ?? 0;
39648
39560
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
39649
39561
  this.maxFee = maxFee ? bn(maxFee) : void 0;
@@ -39654,9 +39566,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39654
39566
  static getPolicyMeta(req) {
39655
39567
  let policyTypes = 0;
39656
39568
  const policies = [];
39657
- if (req.tip) {
39658
- policyTypes += PolicyType.Tip;
39659
- 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 });
39660
39572
  }
39661
39573
  if (req.witnessLimit) {
39662
39574
  policyTypes += PolicyType.WitnessLimit;
@@ -39843,10 +39755,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39843
39755
  * @param predicate - Predicate bytes.
39844
39756
  * @param predicateData - Predicate data bytes.
39845
39757
  */
39846
- addCoinInput(coin) {
39758
+ addCoinInput(coin, predicate) {
39847
39759
  const { assetId, owner, amount } = coin;
39848
39760
  let witnessIndex;
39849
- if (coin.predicate) {
39761
+ if (predicate) {
39850
39762
  witnessIndex = 0;
39851
39763
  } else {
39852
39764
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -39861,7 +39773,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39861
39773
  amount,
39862
39774
  assetId,
39863
39775
  txPointer: "0x00000000000000000000000000000000",
39864
- witnessIndex
39776
+ witnessIndex,
39777
+ predicate: predicate?.bytes
39865
39778
  };
39866
39779
  this.pushInput(input);
39867
39780
  this.addChangeOutput(owner, assetId);
@@ -39874,11 +39787,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39874
39787
  * @param predicate - Predicate bytes.
39875
39788
  * @param predicateData - Predicate data bytes.
39876
39789
  */
39877
- addMessageInput(message) {
39790
+ addMessageInput(message, predicate) {
39878
39791
  const { recipient, sender, amount } = message;
39879
39792
  const assetId = BaseAssetId;
39880
39793
  let witnessIndex;
39881
- if (message.predicate) {
39794
+ if (predicate) {
39882
39795
  witnessIndex = 0;
39883
39796
  } else {
39884
39797
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -39892,7 +39805,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39892
39805
  sender: sender.toB256(),
39893
39806
  recipient: recipient.toB256(),
39894
39807
  amount,
39895
- witnessIndex
39808
+ witnessIndex,
39809
+ predicate: predicate?.bytes
39896
39810
  };
39897
39811
  this.pushInput(input);
39898
39812
  this.addChangeOutput(recipient, assetId);
@@ -39923,6 +39837,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39923
39837
  resources.forEach((resource) => this.addResource(resource));
39924
39838
  return this;
39925
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
+ }
39926
39866
  /**
39927
39867
  * Adds a coin output to the transaction.
39928
39868
  *
@@ -40002,7 +39942,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40002
39942
  }
40003
39943
  calculateMaxGas(chainInfo, minGas) {
40004
39944
  const { consensusParameters } = chainInfo;
40005
- const { gasPerByte, maxGasPerTx } = consensusParameters;
39945
+ const { gasPerByte } = consensusParameters;
40006
39946
  const witnessesLength = this.toTransaction().witnesses.reduce(
40007
39947
  (acc, wit) => acc + wit.dataLength,
40008
39948
  0
@@ -40011,8 +39951,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40011
39951
  gasPerByte,
40012
39952
  minGas,
40013
39953
  witnessesLength,
40014
- witnessLimit: this.witnessLimit,
40015
- maxGasPerTx
39954
+ witnessLimit: this.witnessLimit
40016
39955
  });
40017
39956
  }
40018
39957
  /**
@@ -40030,20 +39969,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40030
39969
  });
40031
39970
  const updateAssetInput = (assetId, quantity) => {
40032
39971
  const assetInput = findAssetInput(assetId);
40033
- let usedQuantity = quantity;
40034
- if (assetId === BaseAssetId) {
40035
- usedQuantity = bn("1000000000000000000");
40036
- }
40037
39972
  if (assetInput && "assetId" in assetInput) {
40038
39973
  assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
40039
- assetInput.amount = usedQuantity;
39974
+ assetInput.amount = quantity;
40040
39975
  } else {
40041
39976
  this.addResources([
40042
39977
  {
40043
39978
  id: hexlify(randomBytes22(UTXO_ID_LEN)),
40044
- amount: usedQuantity,
39979
+ amount: quantity,
40045
39980
  assetId,
40046
39981
  owner: resourcesOwner || Address.fromRandom(),
39982
+ maturity: 0,
40047
39983
  blockCreated: bn(1),
40048
39984
  txCreatedIdx: bn(1)
40049
39985
  }
@@ -40075,7 +40011,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40075
40011
  toJSON() {
40076
40012
  return normalizeJSON(this);
40077
40013
  }
40078
- updatePredicateGasUsed(inputs) {
40014
+ updatePredicateInputs(inputs) {
40079
40015
  this.inputs.forEach((i) => {
40080
40016
  let correspondingInput;
40081
40017
  switch (i.type) {
@@ -40097,15 +40033,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40097
40033
  }
40098
40034
  });
40099
40035
  }
40100
- shiftPredicateData() {
40101
- this.inputs.forEach((input) => {
40102
- if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
40103
- input.predicateData = input.paddPredicateData(
40104
- BaseTransactionRequest.getPolicyMeta(this).policies.length
40105
- );
40106
- }
40107
- });
40108
- }
40109
40036
  };
40110
40037
 
40111
40038
  // src/providers/transaction-request/hash-transaction.ts
@@ -40239,8 +40166,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40239
40166
  return {
40240
40167
  type: TransactionType.Create,
40241
40168
  ...baseTransaction,
40169
+ bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
40242
40170
  bytecodeWitnessIndex,
40243
- storageSlotsCount: bn(storageSlots.length),
40171
+ storageSlotsCount: storageSlots.length,
40244
40172
  salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
40245
40173
  storageSlots
40246
40174
  };
@@ -40354,8 +40282,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40354
40282
  type: TransactionType.Script,
40355
40283
  scriptGasLimit: this.gasLimit,
40356
40284
  ...super.getBaseTransaction(),
40357
- scriptLength: bn(script.length),
40358
- scriptDataLength: bn(scriptData.length),
40285
+ scriptLength: script.length,
40286
+ scriptDataLength: scriptData.length,
40359
40287
  receiptsRoot: ZeroBytes32,
40360
40288
  script: hexlify(script),
40361
40289
  scriptData: hexlify(scriptData)
@@ -40419,7 +40347,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40419
40347
  }
40420
40348
  calculateMaxGas(chainInfo, minGas) {
40421
40349
  const { consensusParameters } = chainInfo;
40422
- const { gasPerByte, maxGasPerTx } = consensusParameters;
40350
+ const { gasPerByte } = consensusParameters;
40423
40351
  const witnessesLength = this.toTransaction().witnesses.reduce(
40424
40352
  (acc, wit) => acc + wit.dataLength,
40425
40353
  0
@@ -40429,8 +40357,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40429
40357
  minGas,
40430
40358
  witnessesLength,
40431
40359
  witnessLimit: this.witnessLimit,
40432
- gasLimit: this.gasLimit,
40433
- maxGasPerTx
40360
+ gasLimit: this.gasLimit
40434
40361
  });
40435
40362
  }
40436
40363
  /**
@@ -40503,29 +40430,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40503
40430
  }
40504
40431
  }
40505
40432
  };
40506
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40507
- (acc, input) => {
40508
- if (input.type === InputType.Coin && input.owner === owner) {
40509
- acc.utxos.push(input.id);
40510
- }
40511
- if (input.type === InputType.Message && input.recipient === owner) {
40512
- acc.messages.push(input.nonce);
40513
- }
40514
- return acc;
40515
- },
40516
- {
40517
- utxos: [],
40518
- messages: []
40519
- }
40520
- );
40521
40433
 
40522
40434
  // src/providers/transaction-summary/calculate-transaction-fee.ts
40523
40435
  var calculateTransactionFee = (params) => {
40524
40436
  const {
40525
- gasPrice,
40437
+ gasUsed,
40526
40438
  rawPayload,
40527
- tip,
40528
- consensusParameters: { gasCosts, feeParams, maxGasPerTx }
40439
+ consensusParameters: { gasCosts, feeParams }
40529
40440
  } = params;
40530
40441
  const gasPerByte = bn(feeParams.gasPerByte);
40531
40442
  const gasPriceFactor = bn(feeParams.gasPriceFactor);
@@ -40535,7 +40446,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40535
40446
  return {
40536
40447
  fee: bn(0),
40537
40448
  minFee: bn(0),
40538
- maxFee: bn(0)
40449
+ maxFee: bn(0),
40450
+ feeFromGasUsed: bn(0)
40539
40451
  };
40540
40452
  }
40541
40453
  const { type: type3, witnesses, inputs, policies } = transaction;
@@ -40567,6 +40479,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40567
40479
  metadataGas,
40568
40480
  txBytesSize: transactionBytes.length
40569
40481
  });
40482
+ const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
40570
40483
  const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
40571
40484
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
40572
40485
  const maxGas = getMaxGas({
@@ -40574,25 +40487,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40574
40487
  minGas,
40575
40488
  witnessesLength,
40576
40489
  gasLimit,
40577
- witnessLimit,
40578
- maxGasPerTx
40579
- });
40580
- const minFee = calculateGasFee({
40581
- gasPrice,
40582
- gas: minGas,
40583
- priceFactor: gasPriceFactor,
40584
- tip
40585
- });
40586
- const maxFee = calculateGasFee({
40587
- gasPrice,
40588
- gas: maxGas,
40589
- priceFactor: gasPriceFactor,
40590
- tip
40490
+ witnessLimit
40591
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);
40592
40496
  return {
40497
+ fee,
40593
40498
  minFee,
40594
40499
  maxFee,
40595
- fee: maxFee
40500
+ feeFromGasUsed
40596
40501
  };
40597
40502
  };
40598
40503
 
@@ -41193,9 +41098,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41193
41098
  gqlTransactionStatus,
41194
41099
  abiMap = {},
41195
41100
  maxInputs,
41196
- gasCosts,
41197
- maxGasPerTx,
41198
- gasPrice
41101
+ gasCosts
41199
41102
  } = params;
41200
41103
  const gasUsed = getGasUsedFromReceipts(receipts);
41201
41104
  const rawPayload = hexlify(transactionBytes);
@@ -41209,14 +41112,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41209
41112
  maxInputs
41210
41113
  });
41211
41114
  const typeName = getTransactionTypeName(transaction.type);
41212
- const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
41213
41115
  const { fee } = calculateTransactionFee({
41214
- gasPrice,
41116
+ gasUsed,
41215
41117
  rawPayload,
41216
- tip,
41217
41118
  consensusParameters: {
41218
41119
  gasCosts,
41219
- maxGasPerTx,
41220
41120
  feeParams: {
41221
41121
  gasPerByte,
41222
41122
  gasPriceFactor
@@ -41352,13 +41252,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41352
41252
  const decodedTransaction = this.decodeTransaction(
41353
41253
  transaction
41354
41254
  );
41355
- let txReceipts = [];
41356
- if (transaction?.status && "receipts" in transaction.status) {
41357
- txReceipts = transaction.status.receipts;
41358
- }
41359
- const receipts = txReceipts.map(processGqlReceipt) || [];
41360
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
41361
- const gasPrice = await this.provider.getLatestGasPrice();
41255
+ const receipts = transaction.receipts?.map(processGqlReceipt) || [];
41256
+ const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
41362
41257
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
41363
41258
  const transactionSummary = assembleTransactionSummary({
41364
41259
  id: this.id,
@@ -41370,9 +41265,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41370
41265
  gasPriceFactor,
41371
41266
  abiMap: contractsAbiMap,
41372
41267
  maxInputs,
41373
- gasCosts,
41374
- maxGasPerTx,
41375
- gasPrice
41268
+ gasCosts
41376
41269
  });
41377
41270
  return transactionSummary;
41378
41271
  }
@@ -41521,7 +41414,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41521
41414
  gasCosts,
41522
41415
  latestBlock: {
41523
41416
  id: latestBlock.id,
41524
- height: bn(latestBlock.height),
41417
+ height: bn(latestBlock.header.height),
41525
41418
  time: latestBlock.header.time,
41526
41419
  transactions: latestBlock.transactions.map((i) => ({
41527
41420
  id: i.id
@@ -41615,8 +41508,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41615
41508
  * Returns some helpful parameters related to gas fees.
41616
41509
  */
41617
41510
  getGasConfig() {
41511
+ const { minGasPrice } = this.getNode();
41618
41512
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
41619
41513
  return {
41514
+ minGasPrice,
41620
41515
  maxGasPerTx,
41621
41516
  maxGasPerPredicate,
41622
41517
  gasPriceFactor,
@@ -41714,7 +41609,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41714
41609
  */
41715
41610
  async getBlockNumber() {
41716
41611
  const { chain } = await this.operations.getChain();
41717
- return bn(chain.latestBlock.height, 10);
41612
+ return bn(chain.latestBlock.header.height, 10);
41718
41613
  }
41719
41614
  /**
41720
41615
  * Returns the chain information.
@@ -41726,9 +41621,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41726
41621
  const processedNodeInfo = {
41727
41622
  maxDepth: bn(nodeInfo.maxDepth),
41728
41623
  maxTx: bn(nodeInfo.maxTx),
41624
+ minGasPrice: bn(nodeInfo.minGasPrice),
41729
41625
  nodeVersion: nodeInfo.nodeVersion,
41730
41626
  utxoValidation: nodeInfo.utxoValidation,
41731
- vmBacktrace: nodeInfo.vmBacktrace
41627
+ vmBacktrace: nodeInfo.vmBacktrace,
41628
+ peers: nodeInfo.peers
41732
41629
  };
41733
41630
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
41734
41631
  return processedNodeInfo;
@@ -41814,13 +41711,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41814
41711
  return this.estimateTxDependencies(transactionRequest);
41815
41712
  }
41816
41713
  const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41817
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41818
- encodedTransactions: encodedTransaction,
41714
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41715
+ encodedTransaction,
41819
41716
  utxoValidation: utxoValidation || false
41820
41717
  });
41821
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
41822
- const receipts = rawReceipts.map(processGqlReceipt);
41823
- return { receipts, dryrunStatus: status };
41718
+ const receipts = gqlReceipts.map(processGqlReceipt);
41719
+ return {
41720
+ receipts
41721
+ };
41824
41722
  }
41825
41723
  /**
41826
41724
  * Verifies whether enough gas is available to complete transaction.
@@ -41859,6 +41757,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41859
41757
  * If there are missing variable outputs,
41860
41758
  * `addVariableOutputs` is called on the transaction.
41861
41759
  *
41760
+ * @privateRemarks
41761
+ * TODO: Investigate support for missing contract IDs
41762
+ * TODO: Add support for missing output messages
41862
41763
  *
41863
41764
  * @param transactionRequest - The transaction request object.
41864
41765
  * @returns A promise.
@@ -41871,19 +41772,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41871
41772
  missingContractIds: []
41872
41773
  };
41873
41774
  }
41775
+ await this.estimatePredicates(transactionRequest);
41874
41776
  let receipts = [];
41875
41777
  const missingContractIds = [];
41876
41778
  let outputVariables = 0;
41877
- let dryrunStatus;
41878
41779
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
41879
- const {
41880
- dryRun: [{ receipts: rawReceipts, status }]
41881
- } = await this.operations.dryRun({
41882
- encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
41780
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41781
+ encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
41883
41782
  utxoValidation: false
41884
41783
  });
41885
- receipts = rawReceipts.map(processGqlReceipt);
41886
- dryrunStatus = status;
41784
+ receipts = gqlReceipts.map(processGqlReceipt);
41887
41785
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
41888
41786
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
41889
41787
  if (hasMissingOutputs) {
@@ -41893,10 +41791,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41893
41791
  transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
41894
41792
  missingContractIds.push(contractId);
41895
41793
  });
41896
- const { maxFee } = await this.estimateTxGasAndFee({
41897
- transactionRequest
41898
- });
41899
- transactionRequest.maxFee = maxFee;
41900
41794
  } else {
41901
41795
  break;
41902
41796
  }
@@ -41904,139 +41798,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41904
41798
  return {
41905
41799
  receipts,
41906
41800
  outputVariables,
41907
- missingContractIds,
41908
- dryrunStatus
41801
+ missingContractIds
41909
41802
  };
41910
41803
  }
41911
- /**
41912
- * Dry runs multiple transactions and checks for missing dependencies in batches.
41913
- *
41914
- * Transactions are dry run in batches. After each dry run, transactions requiring
41915
- * further modifications are identified. The method iteratively updates these transactions
41916
- * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
41917
- *
41918
- * @param transactionRequests - Array of transaction request objects.
41919
- * @returns A promise that resolves to an array of results for each transaction.
41920
- */
41921
- async estimateMultipleTxDependencies(transactionRequests) {
41922
- const results = transactionRequests.map(() => ({
41923
- receipts: [],
41924
- outputVariables: 0,
41925
- missingContractIds: [],
41926
- dryrunStatus: void 0
41927
- }));
41928
- const allRequests = clone_default(transactionRequests);
41929
- const serializedTransactionsMap = /* @__PURE__ */ new Map();
41930
- allRequests.forEach((req, index) => {
41931
- if (req.type === TransactionType.Script) {
41932
- serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
41933
- }
41934
- });
41935
- let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
41936
- let attempt = 0;
41937
- while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
41938
- const encodedTransactions = transactionsToProcess.map(
41939
- (index) => serializedTransactionsMap.get(index)
41940
- );
41941
- const dryRunResults = await this.operations.dryRun({
41942
- encodedTransactions,
41943
- utxoValidation: false
41944
- });
41945
- const nextRoundTransactions = [];
41946
- for (let i = 0; i < dryRunResults.dryRun.length; i++) {
41947
- const currentResultIndex = transactionsToProcess[i];
41948
- const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
41949
- results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
41950
- results[currentResultIndex].dryrunStatus = status;
41951
- const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
41952
- results[currentResultIndex].receipts
41953
- );
41954
- const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
41955
- const requestToProcess = allRequests[currentResultIndex];
41956
- if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
41957
- results[currentResultIndex].outputVariables += missingOutputVariables.length;
41958
- requestToProcess.addVariableOutputs(missingOutputVariables.length);
41959
- missingOutputContractIds.forEach(({ contractId }) => {
41960
- requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
41961
- results[currentResultIndex].missingContractIds.push(contractId);
41962
- });
41963
- const { maxFee } = await this.estimateTxGasAndFee({
41964
- transactionRequest: requestToProcess
41965
- });
41966
- requestToProcess.maxFee = maxFee;
41967
- serializedTransactionsMap.set(
41968
- currentResultIndex,
41969
- hexlify(requestToProcess.toTransactionBytes())
41970
- );
41971
- nextRoundTransactions.push(currentResultIndex);
41972
- allRequests[currentResultIndex] = requestToProcess;
41973
- }
41974
- }
41975
- transactionsToProcess = nextRoundTransactions;
41976
- attempt += 1;
41977
- }
41978
- return results;
41979
- }
41980
- async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
41981
- if (estimateTxDependencies) {
41982
- return this.estimateMultipleTxDependencies(transactionRequests);
41983
- }
41984
- const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
41985
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41986
- encodedTransactions,
41987
- utxoValidation: utxoValidation || false
41988
- });
41989
- const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
41990
- const receipts = rawReceipts.map(processGqlReceipt);
41991
- return { receipts, dryrunStatus: status };
41992
- });
41993
- return results;
41994
- }
41995
41804
  /**
41996
41805
  * Estimates the transaction gas and fee based on the provided transaction request.
41997
41806
  * @param transactionRequest - The transaction request object.
41998
41807
  * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
41999
41808
  */
42000
- async estimateTxGasAndFee(params) {
41809
+ estimateTxGasAndFee(params) {
42001
41810
  const { transactionRequest } = params;
42002
- let { gasPrice } = params;
41811
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
42003
41812
  const chainInfo = this.getChain();
42004
- const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
41813
+ const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
41814
+ transactionRequest.gasPrice = gasPrice;
42005
41815
  const minGas = transactionRequest.calculateMinGas(chainInfo);
42006
- if (!gasPrice) {
42007
- gasPrice = await this.estimateGasPrice(10);
42008
- }
42009
- const minFee = calculateGasFee({
42010
- gasPrice: bn(gasPrice),
42011
- gas: minGas,
42012
- priceFactor: gasPriceFactor,
42013
- tip: transactionRequest.tip
42014
- }).add(1);
42015
- let gasLimit = bn(0);
41816
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42016
41817
  if (transactionRequest.type === TransactionType.Script) {
42017
- gasLimit = transactionRequest.gasLimit;
42018
41818
  if (transactionRequest.gasLimit.eq(0)) {
42019
41819
  transactionRequest.gasLimit = minGas;
42020
41820
  transactionRequest.gasLimit = maxGasPerTx.sub(
42021
41821
  transactionRequest.calculateMaxGas(chainInfo, minGas)
42022
41822
  );
42023
- gasLimit = transactionRequest.gasLimit;
42024
41823
  }
42025
41824
  }
42026
41825
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
42027
- const maxFee = calculateGasFee({
42028
- gasPrice: bn(gasPrice),
42029
- gas: maxGas,
42030
- priceFactor: gasPriceFactor,
42031
- tip: transactionRequest.tip
42032
- }).add(1);
41826
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42033
41827
  return {
42034
41828
  minGas,
42035
41829
  minFee,
42036
41830
  maxGas,
42037
- maxFee,
42038
- gasPrice,
42039
- gasLimit
41831
+ maxFee
42040
41832
  };
42041
41833
  }
42042
41834
  /**
@@ -42054,17 +41846,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42054
41846
  if (estimateTxDependencies) {
42055
41847
  return this.estimateTxDependencies(transactionRequest);
42056
41848
  }
42057
- const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
42058
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42059
- encodedTransactions,
41849
+ const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41850
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41851
+ encodedTransaction,
42060
41852
  utxoValidation: true
42061
41853
  });
42062
- const callResult = dryRunStatuses.map((dryRunStatus) => {
42063
- const { id, receipts, status } = dryRunStatus;
42064
- const processedReceipts = receipts.map(processGqlReceipt);
42065
- return { id, receipts: processedReceipts, status };
42066
- });
42067
- return { receipts: callResult[0].receipts };
41854
+ const receipts = gqlReceipts.map(processGqlReceipt);
41855
+ return {
41856
+ receipts
41857
+ };
42068
41858
  }
42069
41859
  /**
42070
41860
  * Returns a transaction cost to enable user
@@ -42081,79 +41871,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42081
41871
  * @param tolerance - The tolerance to add on top of the gasUsed.
42082
41872
  * @returns A promise that resolves to the transaction cost object.
42083
41873
  */
42084
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
41874
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
41875
+ estimateTxDependencies = true,
41876
+ estimatePredicates = true,
41877
+ resourcesOwner,
41878
+ signatureCallback
41879
+ } = {}) {
42085
41880
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
41881
+ const { minGasPrice } = this.getGasConfig();
41882
+ const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
42086
41883
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
42087
41884
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
42088
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
41885
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
42089
41886
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
42090
- txRequestClone.maxFee = bn(0);
42091
41887
  if (isScriptTransaction) {
42092
41888
  txRequestClone.gasLimit = bn(0);
42093
41889
  }
42094
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
42095
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
41890
+ if (estimatePredicates) {
41891
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
41892
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
41893
+ }
41894
+ await this.estimatePredicates(txRequestClone);
42096
41895
  }
42097
- const signedRequest = clone_default(txRequestClone);
42098
- let addedSignatures = 0;
42099
41896
  if (signatureCallback && isScriptTransaction) {
42100
- const lengthBefore = signedRequest.witnesses.length;
42101
- await signatureCallback(signedRequest);
42102
- addedSignatures = signedRequest.witnesses.length - lengthBefore;
41897
+ await signatureCallback(txRequestClone);
42103
41898
  }
42104
- await this.estimatePredicates(signedRequest);
42105
- let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
42106
- transactionRequest: signedRequest
41899
+ let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
41900
+ transactionRequest: txRequestClone
42107
41901
  });
42108
41902
  let receipts = [];
42109
41903
  let missingContractIds = [];
42110
41904
  let outputVariables = 0;
42111
41905
  let gasUsed = bn(0);
42112
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
42113
- txRequestClone.maxFee = maxFee;
42114
- if (isScriptTransaction) {
42115
- txRequestClone.gasLimit = gasLimit;
42116
- if (signatureCallback) {
42117
- await signatureCallback(txRequestClone);
42118
- }
41906
+ if (isScriptTransaction && estimateTxDependencies) {
41907
+ txRequestClone.gasPrice = bn(0);
42119
41908
  const result = await this.estimateTxDependencies(txRequestClone);
42120
41909
  receipts = result.receipts;
42121
41910
  outputVariables = result.outputVariables;
42122
41911
  missingContractIds = result.missingContractIds;
42123
41912
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
42124
41913
  txRequestClone.gasLimit = gasUsed;
42125
- ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
42126
- transactionRequest: txRequestClone,
42127
- gasPrice
41914
+ txRequestClone.gasPrice = setGasPrice;
41915
+ ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
41916
+ transactionRequest: txRequestClone
42128
41917
  }));
42129
41918
  }
42130
41919
  return {
42131
41920
  requiredQuantities: allQuantities,
42132
41921
  receipts,
42133
41922
  gasUsed,
42134
- gasPrice,
41923
+ minGasPrice,
41924
+ gasPrice: setGasPrice,
42135
41925
  minGas,
42136
41926
  maxGas,
42137
41927
  minFee,
42138
41928
  maxFee,
41929
+ estimatedInputs: txRequestClone.inputs,
42139
41930
  outputVariables,
42140
- missingContractIds,
42141
- addedSignatures,
42142
- estimatedPredicates: txRequestClone.inputs
41931
+ missingContractIds
42143
41932
  };
42144
41933
  }
42145
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
41934
+ async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
42146
41935
  const ownerAddress = Address.fromAddressOrString(owner);
42147
41936
  const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
42148
- const transactionCost = await this.getTransactionCost(transactionRequest, {
42149
- quantitiesToContract
42150
- });
41937
+ const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
42151
41938
  transactionRequest.addResources(
42152
41939
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
42153
41940
  );
42154
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
42155
- quantitiesToContract
42156
- });
41941
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(
41942
+ transactionRequest,
41943
+ forwardingQuantities
41944
+ );
42157
41945
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
42158
41946
  return {
42159
41947
  resources,
@@ -42177,6 +41965,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42177
41965
  assetId: coin.assetId,
42178
41966
  amount: bn(coin.amount),
42179
41967
  owner: Address.fromAddressOrString(coin.owner),
41968
+ maturity: bn(coin.maturity).toNumber(),
42180
41969
  blockCreated: bn(coin.blockCreated),
42181
41970
  txCreatedIdx: bn(coin.txCreatedIdx)
42182
41971
  }));
@@ -42228,6 +42017,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42228
42017
  amount: bn(coin.amount),
42229
42018
  assetId: coin.assetId,
42230
42019
  owner: Address.fromAddressOrString(coin.owner),
42020
+ maturity: bn(coin.maturity).toNumber(),
42231
42021
  blockCreated: bn(coin.blockCreated),
42232
42022
  txCreatedIdx: bn(coin.txCreatedIdx)
42233
42023
  };
@@ -42260,7 +42050,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42260
42050
  }
42261
42051
  return {
42262
42052
  id: block2.id,
42263
- height: bn(block2.height),
42053
+ height: bn(block2.header.height),
42264
42054
  time: block2.header.time,
42265
42055
  transactionIds: block2.transactions.map((tx) => tx.id)
42266
42056
  };
@@ -42275,7 +42065,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42275
42065
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
42276
42066
  const blocks = fetchedData.edges.map(({ node: block2 }) => ({
42277
42067
  id: block2.id,
42278
- height: bn(block2.height),
42068
+ height: bn(block2.header.height),
42279
42069
  time: block2.header.time,
42280
42070
  transactionIds: block2.transactions.map((tx) => tx.id)
42281
42071
  }));
@@ -42302,7 +42092,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42302
42092
  }
42303
42093
  return {
42304
42094
  id: block2.id,
42305
- height: bn(block2.height, 10),
42095
+ height: bn(block2.header.height, 10),
42306
42096
  time: block2.header.time,
42307
42097
  transactionIds: block2.transactions.map((tx) => tx.id),
42308
42098
  transactions: block2.transactions.map(
@@ -42482,11 +42272,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42482
42272
  prevRoot: messageBlockHeader.prevRoot,
42483
42273
  time: messageBlockHeader.time,
42484
42274
  applicationHash: messageBlockHeader.applicationHash,
42485
- messageReceiptCount: bn(messageBlockHeader.messageReceiptCount),
42486
- messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
42487
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
42488
- eventInboxRoot: messageBlockHeader.eventInboxRoot,
42489
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
42275
+ messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
42276
+ messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
42490
42277
  },
42491
42278
  commitBlockHeader: {
42492
42279
  id: commitBlockHeader.id,
@@ -42497,11 +42284,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42497
42284
  prevRoot: commitBlockHeader.prevRoot,
42498
42285
  time: commitBlockHeader.time,
42499
42286
  applicationHash: commitBlockHeader.applicationHash,
42500
- messageReceiptCount: bn(commitBlockHeader.messageReceiptCount),
42501
- messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
42502
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
42503
- eventInboxRoot: commitBlockHeader.eventInboxRoot,
42504
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
42287
+ messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
42288
+ messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
42505
42289
  },
42506
42290
  sender: Address.fromAddressOrString(sender),
42507
42291
  recipient: Address.fromAddressOrString(recipient),
@@ -42510,16 +42294,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42510
42294
  data
42511
42295
  };
42512
42296
  }
42513
- async getLatestGasPrice() {
42514
- const { latestGasPrice } = await this.operations.getLatestGasPrice();
42515
- return bn(latestGasPrice.gasPrice);
42516
- }
42517
- async estimateGasPrice(blockHorizon) {
42518
- const { estimateGasPrice } = await this.operations.estimateGasPrice({
42519
- blockHorizon: String(blockHorizon)
42520
- });
42521
- return bn(estimateGasPrice.gasPrice);
42522
- }
42523
42297
  /**
42524
42298
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
42525
42299
  *
@@ -42580,15 +42354,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42580
42354
  arrayify(gqlTransaction.rawPayload),
42581
42355
  0
42582
42356
  );
42583
- let txReceipts = [];
42584
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42585
- txReceipts = gqlTransaction.status.receipts;
42586
- }
42587
- const receipts = txReceipts.map(processGqlReceipt);
42357
+ const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
42588
42358
  const {
42589
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42359
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42590
42360
  } = provider.getChain();
42591
- const gasPrice = await provider.getLatestGasPrice();
42592
42361
  const transactionInfo = assembleTransactionSummary({
42593
42362
  id: gqlTransaction.id,
42594
42363
  receipts,
@@ -42599,9 +42368,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42599
42368
  gasPriceFactor: bn(gasPriceFactor),
42600
42369
  abiMap,
42601
42370
  maxInputs,
42602
- gasCosts,
42603
- maxGasPerTx,
42604
- gasPrice
42371
+ gasCosts
42605
42372
  });
42606
42373
  return {
42607
42374
  gqlTransaction,
@@ -42611,11 +42378,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42611
42378
  async function getTransactionSummaryFromRequest(params) {
42612
42379
  const { provider, transactionRequest, abiMap } = params;
42613
42380
  const { receipts } = await provider.call(transactionRequest);
42614
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
42381
+ const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
42615
42382
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
42616
42383
  const transaction = transactionRequest.toTransaction();
42617
42384
  const transactionBytes = transactionRequest.toTransactionBytes();
42618
- const gasPrice = await provider.getLatestGasPrice();
42619
42385
  const transactionSummary = assembleTransactionSummary({
42620
42386
  receipts,
42621
42387
  transaction,
@@ -42624,9 +42390,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42624
42390
  gasPerByte,
42625
42391
  gasPriceFactor,
42626
42392
  maxInputs,
42627
- gasCosts,
42628
- maxGasPerTx,
42629
- gasPrice
42393
+ gasCosts
42630
42394
  });
42631
42395
  return transactionSummary;
42632
42396
  }
@@ -42635,18 +42399,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42635
42399
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
42636
42400
  const { edges, pageInfo } = transactionsByOwner;
42637
42401
  const {
42638
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42402
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42639
42403
  } = provider.getChain();
42640
- const gasPrice = await provider.getLatestGasPrice();
42641
42404
  const transactions = edges.map((edge) => {
42642
42405
  const { node: gqlTransaction } = edge;
42643
- const { id, rawPayload, status } = gqlTransaction;
42406
+ const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
42644
42407
  const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
42645
- let txReceipts = [];
42646
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42647
- txReceipts = gqlTransaction.status.receipts;
42648
- }
42649
- const receipts = txReceipts.map(processGqlReceipt);
42408
+ const receipts = gqlReceipts?.map(processGqlReceipt) || [];
42650
42409
  const transactionSummary = assembleTransactionSummary({
42651
42410
  id,
42652
42411
  receipts,
@@ -42657,9 +42416,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42657
42416
  gasPerByte,
42658
42417
  gasPriceFactor,
42659
42418
  maxInputs,
42660
- gasCosts,
42661
- maxGasPerTx,
42662
- gasPrice
42419
+ gasCosts
42663
42420
  });
42664
42421
  const output3 = {
42665
42422
  gqlTransaction,
@@ -42988,33 +42745,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42988
42745
  * @param fee - The estimated transaction fee.
42989
42746
  * @returns A promise that resolves when the resources are added to the transaction.
42990
42747
  */
42991
- async fund(request, params) {
42992
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
42993
- const txRequest = request;
42994
- const requiredQuantitiesWithFee = addAmountToCoinQuantities({
42748
+ async fund(request, coinQuantities, fee) {
42749
+ const updatedQuantities = addAmountToAsset({
42995
42750
  amount: bn(fee),
42996
42751
  assetId: BaseAssetId,
42997
- coinQuantities: requiredQuantities
42752
+ coinQuantities
42998
42753
  });
42999
42754
  const quantitiesDict = {};
43000
- requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
42755
+ updatedQuantities.forEach(({ amount, assetId }) => {
43001
42756
  quantitiesDict[assetId] = {
43002
42757
  required: amount,
43003
42758
  owned: bn(0)
43004
42759
  };
43005
42760
  });
43006
- txRequest.inputs.forEach((input) => {
42761
+ const cachedUtxos = [];
42762
+ const cachedMessages = [];
42763
+ const owner = this.address.toB256();
42764
+ request.inputs.forEach((input) => {
43007
42765
  const isResource = "amount" in input;
43008
42766
  if (isResource) {
43009
42767
  const isCoin2 = "owner" in input;
43010
42768
  if (isCoin2) {
43011
42769
  const assetId = String(input.assetId);
43012
- if (quantitiesDict[assetId]) {
42770
+ if (input.owner === owner && quantitiesDict[assetId]) {
43013
42771
  const amount = bn(input.amount);
43014
42772
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42773
+ cachedUtxos.push(input.id);
43015
42774
  }
43016
- } else if (input.amount && quantitiesDict[BaseAssetId]) {
42775
+ } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
43017
42776
  quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42777
+ cachedMessages.push(input.nonce);
43018
42778
  }
43019
42779
  }
43020
42780
  });
@@ -43029,23 +42789,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43029
42789
  });
43030
42790
  const needsToBeFunded = missingQuantities.length;
43031
42791
  if (needsToBeFunded) {
43032
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
43033
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
43034
- txRequest.addResources(resources);
43035
- }
43036
- txRequest.shiftPredicateData();
43037
- txRequest.updatePredicateGasUsed(estimatedPredicates);
43038
- const requestToBeReEstimate = clone_default(txRequest);
43039
- if (addedSignatures) {
43040
- Array.from({ length: addedSignatures }).forEach(
43041
- () => requestToBeReEstimate.addEmptyWitness()
43042
- );
42792
+ const resources = await this.getResourcesToSpend(missingQuantities, {
42793
+ messages: cachedMessages,
42794
+ utxos: cachedUtxos
42795
+ });
42796
+ request.addResources(resources);
43043
42797
  }
43044
- const { maxFee } = await this.provider.estimateTxGasAndFee({
43045
- transactionRequest: requestToBeReEstimate
43046
- });
43047
- txRequest.maxFee = maxFee;
43048
- return txRequest;
43049
42798
  }
43050
42799
  /**
43051
42800
  * A helper that creates a transfer transaction request and returns it.
@@ -43053,25 +42802,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43053
42802
  * @param destination - The address of the destination.
43054
42803
  * @param amount - The amount of coins to transfer.
43055
42804
  * @param assetId - The asset ID of the coins to transfer.
43056
- * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
42805
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43057
42806
  * @returns A promise that resolves to the prepared transaction request.
43058
42807
  */
43059
42808
  async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
43060
- const request = new ScriptTransactionRequest(txParams);
42809
+ const { minGasPrice } = this.provider.getGasConfig();
42810
+ const params = { gasPrice: minGasPrice, ...txParams };
42811
+ const request = new ScriptTransactionRequest(params);
43061
42812
  request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
43062
- const txCost = await this.provider.getTransactionCost(request, {
42813
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
43063
42814
  estimateTxDependencies: true,
43064
42815
  resourcesOwner: this
43065
42816
  });
43066
- if ("gasLimit" in txParams) {
43067
- this.validateGas({
43068
- gasUsed: txCost.gasUsed,
43069
- gasLimit: request.gasLimit
43070
- });
43071
- }
43072
- request.gasLimit = txCost.gasUsed;
43073
- request.maxFee = txCost.maxFee;
43074
- await this.fund(request, txCost);
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);
43075
42827
  return request;
43076
42828
  }
43077
42829
  /**
@@ -43110,30 +42862,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43110
42862
  );
43111
42863
  }
43112
42864
  const contractAddress = Address.fromAddressOrString(contractId);
42865
+ const { minGasPrice } = this.provider.getGasConfig();
42866
+ const params = { gasPrice: minGasPrice, ...txParams };
43113
42867
  const { script, scriptData } = await assembleTransferToContractScript({
43114
42868
  hexlifiedContractId: contractAddress.toB256(),
43115
42869
  amountToTransfer: bn(amount),
43116
42870
  assetId
43117
42871
  });
43118
42872
  const request = new ScriptTransactionRequest({
43119
- ...txParams,
42873
+ ...params,
43120
42874
  script,
43121
42875
  scriptData
43122
42876
  });
43123
42877
  request.addContractInputAndOutput(contractAddress);
43124
- const txCost = await this.provider.getTransactionCost(request, {
43125
- resourcesOwner: this,
43126
- 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
43127
42888
  });
43128
- if (txParams.gasLimit) {
43129
- this.validateGas({
43130
- gasUsed: txCost.gasUsed,
43131
- gasLimit: request.gasLimit
43132
- });
43133
- }
43134
- request.gasLimit = txCost.gasUsed;
43135
- request.maxFee = txCost.maxFee;
43136
- await this.fund(request, txCost);
42889
+ await this.fund(request, requiredQuantities, maxFee);
43137
42890
  return this.sendTransaction(request);
43138
42891
  }
43139
42892
  /**
@@ -43145,6 +42898,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43145
42898
  * @returns A promise that resolves to the transaction response.
43146
42899
  */
43147
42900
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42901
+ const { minGasPrice } = this.provider.getGasConfig();
43148
42902
  const recipientAddress = Address.fromAddressOrString(recipient);
43149
42903
  const recipientDataArray = arrayify(
43150
42904
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -43157,19 +42911,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43157
42911
  ...recipientDataArray,
43158
42912
  ...amountDataArray
43159
42913
  ]);
43160
- const params = { script, ...txParams };
42914
+ const params = { script, gasPrice: minGasPrice, ...txParams };
43161
42915
  const request = new ScriptTransactionRequest(params);
43162
- const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
43163
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
43164
- if (txParams.gasLimit) {
43165
- this.validateGas({
43166
- gasUsed: txCost.gasUsed,
43167
- gasLimit: request.gasLimit
43168
- });
43169
- }
43170
- request.maxFee = txCost.maxFee;
43171
- request.gasLimit = txCost.gasUsed;
43172
- await this.fund(request, txCost);
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);
43173
42929
  return this.sendTransaction(request);
43174
42930
  }
43175
42931
  async signMessage(message) {
@@ -43227,7 +42983,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43227
42983
  }
43228
42984
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
43229
42985
  }
43230
- 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
+ }
43231
42998
  if (gasUsed.gt(gasLimit)) {
43232
42999
  throw new FuelError(
43233
43000
  ErrorCode.GAS_LIMIT_TOO_LOW,
@@ -44816,7 +44583,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44816
44583
  * @param transactionRequestLike - The transaction request to send.
44817
44584
  * @returns A promise that resolves to the TransactionResponse object.
44818
44585
  */
44819
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
44586
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
44820
44587
  const transactionRequest = transactionRequestify(transactionRequestLike);
44821
44588
  if (estimateTxDependencies) {
44822
44589
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -48094,8 +47861,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48094
47861
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
48095
47862
  request.inputs?.forEach((input) => {
48096
47863
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
48097
- input.predicate = hexlify(this.bytes);
48098
- input.predicateData = hexlify(this.getPredicateData(policies.length));
47864
+ input.predicate = this.bytes;
47865
+ input.predicateData = this.getPredicateData(policies.length);
48099
47866
  }
48100
47867
  });
48101
47868
  return request;
@@ -48110,7 +47877,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48110
47877
  * @returns A promise that resolves to the prepared transaction request.
48111
47878
  */
48112
47879
  async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
48113
- return super.createTransfer(destination, amount, assetId, txParams);
47880
+ const request = await super.createTransfer(destination, amount, assetId, txParams);
47881
+ return this.populateTransactionPredicateData(request);
48114
47882
  }
48115
47883
  /**
48116
47884
  * Sends a transaction with the populated predicate data.
@@ -48118,9 +47886,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48118
47886
  * @param transactionRequestLike - The transaction request-like object.
48119
47887
  * @returns A promise that resolves to the transaction response.
48120
47888
  */
48121
- sendTransaction(transactionRequestLike) {
48122
- const transactionRequest = transactionRequestify(transactionRequestLike);
48123
- return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
47889
+ sendTransaction(transactionRequestLike, options) {
47890
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47891
+ return super.sendTransaction(transactionRequest, options);
48124
47892
  }
48125
47893
  /**
48126
47894
  * Simulates a transaction with the populated predicate data.
@@ -48129,8 +47897,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48129
47897
  * @returns A promise that resolves to the call result.
48130
47898
  */
48131
47899
  simulateTransaction(transactionRequestLike) {
48132
- const transactionRequest = transactionRequestify(transactionRequestLike);
48133
- return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
47900
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47901
+ return super.simulateTransaction(transactionRequest);
48134
47902
  }
48135
47903
  getPredicateData(policiesLength) {
48136
47904
  if (!this.predicateData.length) {
@@ -48176,25 +47944,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48176
47944
  predicateInterface: abiInterface
48177
47945
  };
48178
47946
  }
48179
- /**
48180
- * Retrieves resources satisfying the spend query for the account.
48181
- *
48182
- * @param quantities - IDs of coins to exclude.
48183
- * @param excludedIds - IDs of resources to be excluded from the query.
48184
- * @returns A promise that resolves to an array of Resources.
48185
- */
48186
- async getResourcesToSpend(quantities, excludedIds) {
48187
- const resources = await this.provider.getResourcesToSpend(
48188
- this.address,
48189
- quantities,
48190
- excludedIds
48191
- );
48192
- return resources.map((resource) => ({
48193
- ...resource,
48194
- predicate: hexlify(this.bytes),
48195
- paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
48196
- }));
48197
- }
48198
47947
  /**
48199
47948
  * Sets the configurable constants for the predicate.
48200
47949
  *