@fuel-ts/account 0.0.0-rc-2021-20240419013807 → 0.0.0-rc-1976-20240419063349

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 (56) 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 +604 -830
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +601 -833
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +444 -675
  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 +3 -3
  22. package/dist/providers/coin-quantity.d.ts.map +1 -1
  23. package/dist/providers/coin.d.ts +2 -4
  24. package/dist/providers/coin.d.ts.map +1 -1
  25. package/dist/providers/message.d.ts +1 -7
  26. package/dist/providers/message.d.ts.map +1 -1
  27. package/dist/providers/provider.d.ts +34 -37
  28. package/dist/providers/provider.d.ts.map +1 -1
  29. package/dist/providers/transaction-request/create-transaction-request.d.ts +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 +1 -1
  34. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  35. package/dist/providers/transaction-request/transaction-request.d.ts +29 -9
  36. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  37. package/dist/providers/transaction-request/utils.d.ts +0 -3
  38. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  39. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  40. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
  41. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  42. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
  43. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
  44. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  45. package/dist/providers/utils/gas.d.ts +2 -8
  46. package/dist/providers/utils/gas.d.ts.map +1 -1
  47. package/dist/test-utils/launchNode.d.ts.map +1 -1
  48. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  49. package/dist/test-utils.global.js +1118 -1579
  50. package/dist/test-utils.global.js.map +1 -1
  51. package/dist/test-utils.js +600 -811
  52. package/dist/test-utils.js.map +1 -1
  53. package/dist/test-utils.mjs +456 -667
  54. package/dist/test-utils.mjs.map +1 -1
  55. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  56. package/package.json +16 -16
@@ -289,7 +289,7 @@
289
289
  }
290
290
  return num !== null && typeof num === "object" && num.constructor.wordSize === BN2.wordSize && Array.isArray(num.words);
291
291
  };
292
- BN2.max = function max(left, right) {
292
+ BN2.max = function max2(left, right) {
293
293
  if (left.cmp(right) > 0)
294
294
  return left;
295
295
  return right;
@@ -5113,7 +5113,7 @@
5113
5113
  function isBlob(obj) {
5114
5114
  return typeof obj === "object" && typeof obj.arrayBuffer === "function" && typeof obj.type === "string" && typeof obj.stream === "function" && typeof obj.constructor === "function" && typeof obj.constructor.name === "string" && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
5115
5115
  }
5116
- function clone3(instance) {
5116
+ function clone(instance) {
5117
5117
  let p1, p2;
5118
5118
  let body = instance.body;
5119
5119
  if (instance.bodyUsed) {
@@ -6047,7 +6047,7 @@
6047
6047
  * @return Response
6048
6048
  */
6049
6049
  clone() {
6050
- return new Response2(clone3(this), {
6050
+ return new Response2(clone(this), {
6051
6051
  url: this.url,
6052
6052
  status: this.status,
6053
6053
  statusText: this.statusText,
@@ -6097,7 +6097,7 @@
6097
6097
  if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
6098
6098
  throw new TypeError("Request with GET/HEAD method cannot have body");
6099
6099
  }
6100
- let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone3(input) : null;
6100
+ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
6101
6101
  Body.call(this, inputBody, {
6102
6102
  timeout: init.timeout || input.timeout || 0,
6103
6103
  size: init.size || input.size || 0
@@ -28952,8 +28952,8 @@ spurious results.`);
28952
28952
  // ../versions/dist/index.mjs
28953
28953
  function getBuiltinVersions() {
28954
28954
  return {
28955
- FORC: "0.51.1",
28956
- FUEL_CORE: "0.24.2",
28955
+ FORC: "0.49.3",
28956
+ FUEL_CORE: "0.22.1",
28957
28957
  FUELS: "0.81.0"
28958
28958
  };
28959
28959
  }
@@ -31272,10 +31272,6 @@ This unreleased fuel-core build may include features and updates not yet support
31272
31272
  }
31273
31273
  };
31274
31274
 
31275
- // ../address/dist/configs.mjs
31276
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
31277
- var BaseAssetId = ZeroBytes32;
31278
-
31279
31275
  // ../math/dist/index.mjs
31280
31276
  var import_bn = __toESM(require_bn(), 1);
31281
31277
  var DEFAULT_PRECISION = 9;
@@ -31495,182 +31491,32 @@ This unreleased fuel-core build may include features and updates not yet support
31495
31491
  function toBytes3(value, bytesPadding) {
31496
31492
  return bn(value).toBytes(bytesPadding);
31497
31493
  }
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" : ""));
31544
- }
31545
-
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";
31494
+ function max(...numbers) {
31495
+ return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
31593
31496
  }
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
31497
 
31652
31498
  // src/providers/coin-quantity.ts
31653
31499
  var coinQuantityfy = (coinQuantityLike) => {
31654
31500
  let assetId;
31655
31501
  let amount;
31656
- let max;
31502
+ let max2;
31657
31503
  if (Array.isArray(coinQuantityLike)) {
31658
31504
  amount = coinQuantityLike[0];
31659
- assetId = coinQuantityLike[1] ?? BaseAssetId;
31660
- max = coinQuantityLike[2] ?? void 0;
31505
+ assetId = coinQuantityLike[1];
31506
+ max2 = coinQuantityLike[2];
31661
31507
  } else {
31662
31508
  amount = coinQuantityLike.amount;
31663
- assetId = coinQuantityLike.assetId ?? BaseAssetId;
31664
- max = coinQuantityLike.max ?? void 0;
31509
+ assetId = coinQuantityLike.assetId;
31510
+ max2 = coinQuantityLike.max ?? void 0;
31665
31511
  }
31666
31512
  const bnAmount = bn(amount);
31667
31513
  return {
31668
31514
  assetId: hexlify(assetId),
31669
31515
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
31670
- max: max ? bn(max) : void 0
31516
+ max: max2 ? bn(max2) : void 0
31671
31517
  };
31672
31518
  };
31673
- var addAmountToCoinQuantities = (params) => {
31519
+ var addAmountToAsset = (params) => {
31674
31520
  const { amount, assetId } = params;
31675
31521
  const coinQuantities = [...params.coinQuantities];
31676
31522
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -31755,7 +31601,7 @@ This unreleased fuel-core build may include features and updates not yet support
31755
31601
  var ENCODING_V1 = "1";
31756
31602
  var WORD_SIZE = 8;
31757
31603
  var BYTES_32 = 32;
31758
- var UTXO_ID_LEN = BYTES_32 + 2;
31604
+ var UTXO_ID_LEN = BYTES_32 + 1;
31759
31605
  var ASSET_ID_LEN = BYTES_32;
31760
31606
  var ADDRESS_LEN = BYTES_32;
31761
31607
  var NONCE_LEN = BYTES_32;
@@ -31763,9 +31609,9 @@ This unreleased fuel-core build may include features and updates not yet support
31763
31609
  var TX_POINTER_LEN = WORD_SIZE * 2;
31764
31610
  var MAX_BYTES = 2 ** 32 - 1;
31765
31611
  var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
31766
- ASSET_ID_LEN + // Base asset ID
31612
+ WORD_SIZE + // Tx size
31767
31613
  // Asset ID/Balance coin input pairs
31768
- maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
31614
+ maxInputs * (ASSET_ID_LEN + WORD_SIZE);
31769
31615
  var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
31770
31616
  WORD_SIZE + // Gas limit
31771
31617
  WORD_SIZE + // Script size
@@ -31783,6 +31629,7 @@ This unreleased fuel-core build may include features and updates not yet support
31783
31629
  ASSET_ID_LEN + // Asset id
31784
31630
  TX_POINTER_LEN + // TxPointer
31785
31631
  WORD_SIZE + // Witnesses index
31632
+ WORD_SIZE + // Maturity
31786
31633
  WORD_SIZE + // Predicate size
31787
31634
  WORD_SIZE + // Predicate data size
31788
31635
  WORD_SIZE;
@@ -32104,7 +31951,7 @@ This unreleased fuel-core build may include features and updates not yet support
32104
31951
  constructor(name, coders) {
32105
31952
  const caseIndexCoder = new BigNumberCoder("u64");
32106
31953
  const encodedValueSize = Object.values(coders).reduce(
32107
- (max, coder) => Math.max(max, coder.encodedLength),
31954
+ (max2, coder) => Math.max(max2, coder.encodedLength),
32108
31955
  0
32109
31956
  );
32110
31957
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -32808,7 +32655,7 @@ This unreleased fuel-core build may include features and updates not yet support
32808
32655
  constructor(name, coders) {
32809
32656
  const caseIndexCoder = new BigNumberCoder("u64");
32810
32657
  const encodedValueSize = Object.values(coders).reduce(
32811
- (max, coder) => Math.max(max, coder.encodedLength),
32658
+ (max2, coder) => Math.max(max2, coder.encodedLength),
32812
32659
  0
32813
32660
  );
32814
32661
  super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
@@ -33520,19 +33367,18 @@ This unreleased fuel-core build may include features and updates not yet support
33520
33367
  encode(value) {
33521
33368
  const parts = [];
33522
33369
  parts.push(new B256Coder().encode(value.txID));
33523
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33370
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33524
33371
  parts.push(new B256Coder().encode(value.owner));
33525
33372
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33526
33373
  parts.push(new B256Coder().encode(value.assetId));
33527
33374
  parts.push(new TxPointerCoder().encode(value.txPointer));
33528
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33375
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33376
+ parts.push(new NumberCoder("u32").encode(value.maturity));
33529
33377
  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
- );
33378
+ parts.push(new NumberCoder("u32").encode(value.predicateLength));
33379
+ parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33380
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33381
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33536
33382
  return concat(parts);
33537
33383
  }
33538
33384
  decode(data, offset) {
@@ -33540,7 +33386,7 @@ This unreleased fuel-core build may include features and updates not yet support
33540
33386
  let o = offset;
33541
33387
  [decoded, o] = new B256Coder().decode(data, o);
33542
33388
  const txID = decoded;
33543
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33389
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33544
33390
  const outputIndex = decoded;
33545
33391
  [decoded, o] = new B256Coder().decode(data, o);
33546
33392
  const owner = decoded;
@@ -33550,17 +33396,19 @@ This unreleased fuel-core build may include features and updates not yet support
33550
33396
  const assetId = decoded;
33551
33397
  [decoded, o] = new TxPointerCoder().decode(data, o);
33552
33398
  const txPointer = decoded;
33553
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33399
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33554
33400
  const witnessIndex = Number(decoded);
33401
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33402
+ const maturity = decoded;
33555
33403
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33556
33404
  const predicateGasUsed = decoded;
33557
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33405
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33558
33406
  const predicateLength = decoded;
33559
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33407
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33560
33408
  const predicateDataLength = decoded;
33561
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33409
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33562
33410
  const predicate = decoded;
33563
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33411
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33564
33412
  const predicateData = decoded;
33565
33413
  return [
33566
33414
  {
@@ -33572,6 +33420,7 @@ This unreleased fuel-core build may include features and updates not yet support
33572
33420
  assetId,
33573
33421
  txPointer,
33574
33422
  witnessIndex,
33423
+ maturity,
33575
33424
  predicateGasUsed,
33576
33425
  predicateLength,
33577
33426
  predicateDataLength,
@@ -33589,7 +33438,7 @@ This unreleased fuel-core build may include features and updates not yet support
33589
33438
  encode(value) {
33590
33439
  const parts = [];
33591
33440
  parts.push(new B256Coder().encode(value.txID));
33592
- parts.push(new NumberCoder("u16").encode(value.outputIndex));
33441
+ parts.push(new NumberCoder("u8").encode(value.outputIndex));
33593
33442
  parts.push(new B256Coder().encode(value.balanceRoot));
33594
33443
  parts.push(new B256Coder().encode(value.stateRoot));
33595
33444
  parts.push(new TxPointerCoder().encode(value.txPointer));
@@ -33601,7 +33450,7 @@ This unreleased fuel-core build may include features and updates not yet support
33601
33450
  let o = offset;
33602
33451
  [decoded, o] = new B256Coder().decode(data, o);
33603
33452
  const txID = decoded;
33604
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33453
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33605
33454
  const outputIndex = decoded;
33606
33455
  [decoded, o] = new B256Coder().decode(data, o);
33607
33456
  const balanceRoot = decoded;
@@ -33650,16 +33499,14 @@ This unreleased fuel-core build may include features and updates not yet support
33650
33499
  parts.push(new ByteArrayCoder(32).encode(value.recipient));
33651
33500
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33652
33501
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33653
- parts.push(new NumberCoder("u16").encode(value.witnessIndex));
33502
+ parts.push(new NumberCoder("u8").encode(value.witnessIndex));
33654
33503
  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));
33504
+ parts.push(new NumberCoder("u32").encode(data.length));
33505
+ parts.push(new NumberCoder("u32").encode(value.predicateLength));
33506
+ parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
33658
33507
  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
- );
33508
+ parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
33509
+ parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
33663
33510
  return concat(parts);
33664
33511
  }
33665
33512
  static decodeData(messageData) {
@@ -33679,21 +33526,21 @@ This unreleased fuel-core build may include features and updates not yet support
33679
33526
  const amount = decoded;
33680
33527
  [decoded, o] = new B256Coder().decode(data, o);
33681
33528
  const nonce = decoded;
33682
- [decoded, o] = new NumberCoder("u16").decode(data, o);
33529
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
33683
33530
  const witnessIndex = Number(decoded);
33684
33531
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33685
33532
  const predicateGasUsed = decoded;
33686
33533
  [decoded, o] = new NumberCoder("u32").decode(data, o);
33687
33534
  const dataLength2 = decoded;
33688
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33535
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33689
33536
  const predicateLength = decoded;
33690
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
33537
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
33691
33538
  const predicateDataLength = decoded;
33692
33539
  [decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
33693
33540
  const messageData = decoded;
33694
- [decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
33541
+ [decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
33695
33542
  const predicate = decoded;
33696
- [decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
33543
+ [decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
33697
33544
  const predicateData = decoded;
33698
33545
  return [
33699
33546
  {
@@ -34005,7 +33852,7 @@ This unreleased fuel-core build may include features and updates not yet support
34005
33852
  }
34006
33853
  };
34007
33854
  var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
34008
- PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
33855
+ PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
34009
33856
  PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
34010
33857
  PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
34011
33858
  PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
@@ -34053,9 +33900,9 @@ This unreleased fuel-core build may include features and updates not yet support
34053
33900
  let o = offset;
34054
33901
  const policies = [];
34055
33902
  if (policyTypes & 1) {
34056
- const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
33903
+ const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
34057
33904
  o = nextOffset;
34058
- policies.push({ type: 1, data: tip });
33905
+ policies.push({ type: 1, data: gasPrice });
34059
33906
  }
34060
33907
  if (policyTypes & 2) {
34061
33908
  const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
@@ -34287,15 +34134,15 @@ This unreleased fuel-core build may include features and updates not yet support
34287
34134
  encode(value) {
34288
34135
  const parts = [];
34289
34136
  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));
34137
+ parts.push(new NumberCoder("u32").encode(value.scriptLength));
34138
+ parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
34293
34139
  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));
34140
+ parts.push(new NumberCoder("u8").encode(value.inputsCount));
34141
+ parts.push(new NumberCoder("u8").encode(value.outputsCount));
34142
+ parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34143
+ parts.push(new B256Coder().encode(value.receiptsRoot));
34144
+ parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
34145
+ parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
34299
34146
  parts.push(new PoliciesCoder().encode(value.policies));
34300
34147
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34301
34148
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
@@ -34307,23 +34154,23 @@ This unreleased fuel-core build may include features and updates not yet support
34307
34154
  let o = offset;
34308
34155
  [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34309
34156
  const scriptGasLimit = decoded;
34310
- [decoded, o] = new B256Coder().decode(data, o);
34311
- const receiptsRoot = decoded;
34312
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34157
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34313
34158
  const scriptLength = decoded;
34314
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34159
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34315
34160
  const scriptDataLength = decoded;
34316
34161
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34317
34162
  const policyTypes = decoded;
34318
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34163
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34319
34164
  const inputsCount = decoded;
34320
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34165
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34321
34166
  const outputsCount = decoded;
34322
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34167
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34323
34168
  const witnessesCount = decoded;
34324
- [decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
34169
+ [decoded, o] = new B256Coder().decode(data, o);
34170
+ const receiptsRoot = decoded;
34171
+ [decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
34325
34172
  const script = decoded;
34326
- [decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
34173
+ [decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
34327
34174
  const scriptData = decoded;
34328
34175
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34329
34176
  const policies = decoded;
@@ -34361,19 +34208,18 @@ This unreleased fuel-core build may include features and updates not yet support
34361
34208
  }
34362
34209
  encode(value) {
34363
34210
  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));
34211
+ parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
34212
+ parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
34367
34213
  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));
34214
+ parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
34215
+ parts.push(new NumberCoder("u8").encode(value.inputsCount));
34216
+ parts.push(new NumberCoder("u8").encode(value.outputsCount));
34217
+ parts.push(new NumberCoder("u8").encode(value.witnessesCount));
34218
+ parts.push(new B256Coder().encode(value.salt));
34219
+ parts.push(new PoliciesCoder().encode(value.policies));
34371
34220
  parts.push(
34372
- new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
34373
- value.storageSlots
34374
- )
34221
+ new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
34375
34222
  );
34376
- parts.push(new PoliciesCoder().encode(value.policies));
34377
34223
  parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
34378
34224
  parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
34379
34225
  parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
@@ -34382,27 +34228,26 @@ This unreleased fuel-core build may include features and updates not yet support
34382
34228
  decode(data, offset) {
34383
34229
  let decoded;
34384
34230
  let o = offset;
34385
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34231
+ [decoded, o] = new NumberCoder("u32").decode(data, o);
34232
+ const bytecodeLength = decoded;
34233
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34386
34234
  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
34235
  [decoded, o] = new NumberCoder("u32").decode(data, o);
34392
34236
  const policyTypes = decoded;
34393
34237
  [decoded, o] = new NumberCoder("u16").decode(data, o);
34238
+ const storageSlotsCount = decoded;
34239
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34394
34240
  const inputsCount = decoded;
34395
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34241
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34396
34242
  const outputsCount = decoded;
34397
- [decoded, o] = new NumberCoder("u16").decode(data, o);
34243
+ [decoded, o] = new NumberCoder("u8").decode(data, o);
34398
34244
  const witnessesCount = decoded;
34399
- [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
34400
- data,
34401
- o
34402
- );
34403
- const storageSlots = decoded;
34245
+ [decoded, o] = new B256Coder().decode(data, o);
34246
+ const salt = decoded;
34404
34247
  [decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
34405
34248
  const policies = decoded;
34249
+ [decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
34250
+ const storageSlots = decoded;
34406
34251
  [decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
34407
34252
  const inputs = decoded;
34408
34253
  [decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
@@ -34412,6 +34257,7 @@ This unreleased fuel-core build may include features and updates not yet support
34412
34257
  return [
34413
34258
  {
34414
34259
  type: 1,
34260
+ bytecodeLength,
34415
34261
  bytecodeWitnessIndex,
34416
34262
  policyTypes,
34417
34263
  storageSlotsCount,
@@ -34440,7 +34286,6 @@ This unreleased fuel-core build may include features and updates not yet support
34440
34286
  parts.push(new OutputContractCoder().encode(value.outputContract));
34441
34287
  parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
34442
34288
  parts.push(new B256Coder().encode(value.mintAssetId));
34443
- parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
34444
34289
  return concat(parts);
34445
34290
  }
34446
34291
  decode(data, offset) {
@@ -34456,8 +34301,6 @@ This unreleased fuel-core build may include features and updates not yet support
34456
34301
  const mintAmount = decoded;
34457
34302
  [decoded, o] = new B256Coder().decode(data, o);
34458
34303
  const mintAssetId = decoded;
34459
- [decoded, o] = new BigNumberCoder("u64").decode(data, o);
34460
- const gasPrice = decoded;
34461
34304
  return [
34462
34305
  {
34463
34306
  type: 2,
@@ -34465,8 +34308,7 @@ This unreleased fuel-core build may include features and updates not yet support
34465
34308
  inputContract,
34466
34309
  outputContract,
34467
34310
  mintAmount,
34468
- mintAssetId,
34469
- gasPrice
34311
+ mintAssetId
34470
34312
  },
34471
34313
  o
34472
34314
  ];
@@ -34773,6 +34615,159 @@ This unreleased fuel-core build may include features and updates not yet support
34773
34615
  // src/providers/provider.ts
34774
34616
  var import_graphql_request = __toESM(require_dist2());
34775
34617
 
34618
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
34619
+ function _isPlaceholder(a) {
34620
+ return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
34621
+ }
34622
+
34623
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
34624
+ function _curry1(fn) {
34625
+ return function f1(a) {
34626
+ if (arguments.length === 0 || _isPlaceholder(a)) {
34627
+ return f1;
34628
+ } else {
34629
+ return fn.apply(this, arguments);
34630
+ }
34631
+ };
34632
+ }
34633
+
34634
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
34635
+ var isArray_default = Array.isArray || function _isArray(val) {
34636
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
34637
+ };
34638
+
34639
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
34640
+ var type = /* @__PURE__ */ _curry1(function type2(val) {
34641
+ return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
34642
+ });
34643
+ var type_default = type;
34644
+
34645
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
34646
+ var pad = function pad2(n) {
34647
+ return (n < 10 ? "0" : "") + n;
34648
+ };
34649
+ var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
34650
+ return d.toISOString();
34651
+ } : function _toISOString3(d) {
34652
+ return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
34653
+ };
34654
+
34655
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
34656
+ var isInteger_default = Number.isInteger || function _isInteger(n) {
34657
+ return n << 0 === n;
34658
+ };
34659
+
34660
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
34661
+ function _cloneRegExp(pattern) {
34662
+ return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
34663
+ }
34664
+
34665
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
34666
+ function _clone(value, deep, map) {
34667
+ map || (map = new _ObjectMap());
34668
+ if (_isPrimitive(value)) {
34669
+ return value;
34670
+ }
34671
+ var copy = function copy2(copiedValue) {
34672
+ var cachedCopy = map.get(value);
34673
+ if (cachedCopy) {
34674
+ return cachedCopy;
34675
+ }
34676
+ map.set(value, copiedValue);
34677
+ for (var key in value) {
34678
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
34679
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
34680
+ }
34681
+ }
34682
+ return copiedValue;
34683
+ };
34684
+ switch (type_default(value)) {
34685
+ case "Object":
34686
+ return copy(Object.create(Object.getPrototypeOf(value)));
34687
+ case "Array":
34688
+ return copy([]);
34689
+ case "Date":
34690
+ return new Date(value.valueOf());
34691
+ case "RegExp":
34692
+ return _cloneRegExp(value);
34693
+ case "Int8Array":
34694
+ case "Uint8Array":
34695
+ case "Uint8ClampedArray":
34696
+ case "Int16Array":
34697
+ case "Uint16Array":
34698
+ case "Int32Array":
34699
+ case "Uint32Array":
34700
+ case "Float32Array":
34701
+ case "Float64Array":
34702
+ case "BigInt64Array":
34703
+ case "BigUint64Array":
34704
+ return value.slice();
34705
+ default:
34706
+ return value;
34707
+ }
34708
+ }
34709
+ function _isPrimitive(param) {
34710
+ var type3 = typeof param;
34711
+ return param == null || type3 != "object" && type3 != "function";
34712
+ }
34713
+ var _ObjectMap = /* @__PURE__ */ function() {
34714
+ function _ObjectMap2() {
34715
+ this.map = {};
34716
+ this.length = 0;
34717
+ }
34718
+ _ObjectMap2.prototype.set = function(key, value) {
34719
+ const hashedKey = this.hash(key);
34720
+ let bucket = this.map[hashedKey];
34721
+ if (!bucket) {
34722
+ this.map[hashedKey] = bucket = [];
34723
+ }
34724
+ bucket.push([key, value]);
34725
+ this.length += 1;
34726
+ };
34727
+ _ObjectMap2.prototype.hash = function(key) {
34728
+ let hashedKey = [];
34729
+ for (var value in key) {
34730
+ hashedKey.push(Object.prototype.toString.call(key[value]));
34731
+ }
34732
+ return hashedKey.join();
34733
+ };
34734
+ _ObjectMap2.prototype.get = function(key) {
34735
+ if (this.length <= 180) {
34736
+ for (const p in this.map) {
34737
+ const bucket2 = this.map[p];
34738
+ for (let i = 0; i < bucket2.length; i += 1) {
34739
+ const element = bucket2[i];
34740
+ if (element[0] === key) {
34741
+ return element[1];
34742
+ }
34743
+ }
34744
+ }
34745
+ return;
34746
+ }
34747
+ const hashedKey = this.hash(key);
34748
+ const bucket = this.map[hashedKey];
34749
+ if (!bucket) {
34750
+ return;
34751
+ }
34752
+ for (let i = 0; i < bucket.length; i += 1) {
34753
+ const element = bucket[i];
34754
+ if (element[0] === key) {
34755
+ return element[1];
34756
+ }
34757
+ }
34758
+ };
34759
+ return _ObjectMap2;
34760
+ }();
34761
+
34762
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
34763
+ var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
34764
+ return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
34765
+ });
34766
+ var clone_default = clone2;
34767
+
34768
+ // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
34769
+ var hasProtoTrim = typeof String.prototype.trim === "function";
34770
+
34776
34771
  // ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
34777
34772
  var __assign = function() {
34778
34773
  __assign = Object.assign || function __assign2(t) {
@@ -37940,10 +37935,14 @@ spurious results.`);
37940
37935
  // src/providers/__generated__/operations.ts
37941
37936
  var ReceiptFragmentFragmentDoc = lib_default2`
37942
37937
  fragment receiptFragment on Receipt {
37943
- id
37938
+ contract {
37939
+ id
37940
+ }
37944
37941
  pc
37945
37942
  is
37946
- to
37943
+ to {
37944
+ id
37945
+ }
37947
37946
  toAddress
37948
37947
  amount
37949
37948
  assetId
@@ -37981,16 +37980,10 @@ spurious results.`);
37981
37980
  id
37982
37981
  }
37983
37982
  time
37984
- receipts {
37985
- ...receiptFragment
37986
- }
37987
37983
  programState {
37988
37984
  returnType
37989
37985
  data
37990
37986
  }
37991
- receipts {
37992
- ...receiptFragment
37993
- }
37994
37987
  }
37995
37988
  ... on FailureStatus {
37996
37989
  block {
@@ -37998,24 +37991,26 @@ spurious results.`);
37998
37991
  }
37999
37992
  time
38000
37993
  reason
38001
- receipts {
38002
- ...receiptFragment
38003
- }
38004
37994
  }
38005
37995
  ... on SqueezedOutStatus {
38006
37996
  reason
38007
37997
  }
38008
37998
  }
38009
- ${ReceiptFragmentFragmentDoc}`;
37999
+ `;
38010
38000
  var TransactionFragmentFragmentDoc = lib_default2`
38011
38001
  fragment transactionFragment on Transaction {
38012
38002
  id
38013
38003
  rawPayload
38004
+ gasPrice
38005
+ receipts {
38006
+ ...receiptFragment
38007
+ }
38014
38008
  status {
38015
38009
  ...transactionStatusFragment
38016
38010
  }
38017
38011
  }
38018
- ${TransactionStatusFragmentFragmentDoc}`;
38012
+ ${ReceiptFragmentFragmentDoc}
38013
+ ${TransactionStatusFragmentFragmentDoc}`;
38019
38014
  var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
38020
38015
  fragment inputEstimatePredicatesFragment on Input {
38021
38016
  ... on InputCoin {
@@ -38033,46 +38028,6 @@ spurious results.`);
38033
38028
  }
38034
38029
  }
38035
38030
  ${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
38031
  var CoinFragmentFragmentDoc = lib_default2`
38077
38032
  fragment coinFragment on Coin {
38078
38033
  __typename
@@ -38080,6 +38035,7 @@ ${ReceiptFragmentFragmentDoc}`;
38080
38035
  owner
38081
38036
  amount
38082
38037
  assetId
38038
+ maturity
38083
38039
  blockCreated
38084
38040
  txCreatedIdx
38085
38041
  }
@@ -38118,32 +38074,26 @@ ${ReceiptFragmentFragmentDoc}`;
38118
38074
  messageBlockHeader {
38119
38075
  id
38120
38076
  daHeight
38121
- consensusParametersVersion
38122
- stateTransitionBytecodeVersion
38123
38077
  transactionsCount
38124
- messageReceiptCount
38125
38078
  transactionsRoot
38126
- messageOutboxRoot
38127
- eventInboxRoot
38128
38079
  height
38129
38080
  prevRoot
38130
38081
  time
38131
38082
  applicationHash
38083
+ messageReceiptRoot
38084
+ messageReceiptCount
38132
38085
  }
38133
38086
  commitBlockHeader {
38134
38087
  id
38135
38088
  daHeight
38136
- consensusParametersVersion
38137
- stateTransitionBytecodeVersion
38138
38089
  transactionsCount
38139
- messageReceiptCount
38140
38090
  transactionsRoot
38141
- messageOutboxRoot
38142
- eventInboxRoot
38143
38091
  height
38144
38092
  prevRoot
38145
38093
  time
38146
38094
  applicationHash
38095
+ messageReceiptRoot
38096
+ messageReceiptCount
38147
38097
  }
38148
38098
  sender
38149
38099
  recipient
@@ -38162,8 +38112,8 @@ ${ReceiptFragmentFragmentDoc}`;
38162
38112
  var BlockFragmentFragmentDoc = lib_default2`
38163
38113
  fragment blockFragment on Block {
38164
38114
  id
38165
- height
38166
38115
  header {
38116
+ height
38167
38117
  time
38168
38118
  }
38169
38119
  transactions {
@@ -38221,11 +38171,6 @@ ${ReceiptFragmentFragmentDoc}`;
38221
38171
  `;
38222
38172
  var GasCostsFragmentFragmentDoc = lib_default2`
38223
38173
  fragment GasCostsFragment on GasCosts {
38224
- version {
38225
- ... on Version {
38226
- value
38227
- }
38228
- }
38229
38174
  add
38230
38175
  addi
38231
38176
  aloc
@@ -38238,6 +38183,7 @@ ${ReceiptFragmentFragmentDoc}`;
38238
38183
  cb
38239
38184
  cfei
38240
38185
  cfsi
38186
+ croo
38241
38187
  div
38242
38188
  divi
38243
38189
  ecr1
@@ -38320,9 +38266,6 @@ ${ReceiptFragmentFragmentDoc}`;
38320
38266
  ccp {
38321
38267
  ...DependentCostFragment
38322
38268
  }
38323
- croo {
38324
- ...DependentCostFragment
38325
- }
38326
38269
  csiz {
38327
38270
  ...DependentCostFragment
38328
38271
  }
@@ -38382,11 +38325,6 @@ ${ReceiptFragmentFragmentDoc}`;
38382
38325
  ${DependentCostFragmentFragmentDoc}`;
38383
38326
  var ConsensusParametersFragmentFragmentDoc = lib_default2`
38384
38327
  fragment consensusParametersFragment on ConsensusParameters {
38385
- version {
38386
- ... on Version {
38387
- value
38388
- }
38389
- }
38390
38328
  txParams {
38391
38329
  ...TxParametersFragment
38392
38330
  }
@@ -38446,9 +38384,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38446
38384
  fragment nodeInfoFragment on NodeInfo {
38447
38385
  utxoValidation
38448
38386
  vmBacktrace
38387
+ minGasPrice
38449
38388
  maxTx
38450
38389
  maxDepth
38451
38390
  nodeVersion
38391
+ peers {
38392
+ id
38393
+ addresses
38394
+ clientVersion
38395
+ blockHeight
38396
+ lastHeartbeatMs
38397
+ appScore
38398
+ }
38452
38399
  }
38453
38400
  `;
38454
38401
  var GetVersionDocument = lib_default2`
@@ -38483,9 +38430,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
38483
38430
  query getTransactionWithReceipts($transactionId: TransactionId!) {
38484
38431
  transaction(id: $transactionId) {
38485
38432
  ...transactionFragment
38433
+ receipts {
38434
+ ...receiptFragment
38435
+ }
38486
38436
  }
38487
38437
  }
38488
- ${TransactionFragmentFragmentDoc}`;
38438
+ ${TransactionFragmentFragmentDoc}
38439
+ ${ReceiptFragmentFragmentDoc}`;
38489
38440
  var GetTransactionsDocument = lib_default2`
38490
38441
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
38491
38442
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -38613,20 +38564,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38613
38564
  }
38614
38565
  }
38615
38566
  ${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
38567
  var GetBalancesDocument = lib_default2`
38631
38568
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
38632
38569
  balances(
@@ -38681,12 +38618,12 @@ ${MessageCoinFragmentFragmentDoc}`;
38681
38618
  }
38682
38619
  `;
38683
38620
  var DryRunDocument = lib_default2`
38684
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
38685
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
38686
- ...dryRunTransactionExecutionStatusFragment
38621
+ mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
38622
+ dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
38623
+ ...receiptFragment
38687
38624
  }
38688
38625
  }
38689
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
38626
+ ${ReceiptFragmentFragmentDoc}`;
38690
38627
  var SubmitDocument = lib_default2`
38691
38628
  mutation submit($encodedTransaction: HexString!) {
38692
38629
  submit(tx: $encodedTransaction) {
@@ -38769,12 +38706,6 @@ ${MessageCoinFragmentFragmentDoc}`;
38769
38706
  getBalance(variables, options) {
38770
38707
  return requester(GetBalanceDocument, variables, options);
38771
38708
  },
38772
- getLatestGasPrice(variables, options) {
38773
- return requester(GetLatestGasPriceDocument, variables, options);
38774
- },
38775
- estimateGasPrice(variables, options) {
38776
- return requester(EstimateGasPriceDocument, variables, options);
38777
- },
38778
38709
  getBalances(variables, options) {
38779
38710
  return requester(GetBalancesDocument, variables, options);
38780
38711
  },
@@ -38939,6 +38870,9 @@ ${MessageCoinFragmentFragmentDoc}`;
38939
38870
  }
38940
38871
  };
38941
38872
 
38873
+ // ../address/dist/configs.mjs
38874
+ var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
38875
+
38942
38876
  // src/providers/transaction-request/input.ts
38943
38877
  var inputify = (value) => {
38944
38878
  const { type: type3 } = value;
@@ -38958,9 +38892,10 @@ ${MessageCoinFragmentFragmentDoc}`;
38958
38892
  txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38959
38893
  },
38960
38894
  witnessIndex: value.witnessIndex,
38895
+ maturity: value.maturity ?? 0,
38961
38896
  predicateGasUsed: bn(value.predicateGasUsed),
38962
- predicateLength: bn(predicate.length),
38963
- predicateDataLength: bn(predicateData.length),
38897
+ predicateLength: predicate.length,
38898
+ predicateDataLength: predicateData.length,
38964
38899
  predicate: hexlify(predicate),
38965
38900
  predicateData: hexlify(predicateData)
38966
38901
  };
@@ -38991,8 +38926,8 @@ ${MessageCoinFragmentFragmentDoc}`;
38991
38926
  nonce: hexlify(value.nonce),
38992
38927
  witnessIndex: value.witnessIndex,
38993
38928
  predicateGasUsed: bn(value.predicateGasUsed),
38994
- predicateLength: bn(predicate.length),
38995
- predicateDataLength: bn(predicateData.length),
38929
+ predicateLength: predicate.length,
38930
+ predicateDataLength: predicateData.length,
38996
38931
  predicate: hexlify(predicate),
38997
38932
  predicateData: hexlify(predicateData),
38998
38933
  data: hexlify(data),
@@ -39152,8 +39087,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39152
39087
  case "CALL" /* Call */: {
39153
39088
  const callReceipt = {
39154
39089
  type: ReceiptType.Call,
39155
- from: hexOrZero(receipt.id || receipt.contractId),
39156
- to: hexOrZero(receipt?.to),
39090
+ from: hexOrZero(receipt.contract?.id),
39091
+ to: hexOrZero(receipt?.to?.id),
39157
39092
  amount: bn(receipt.amount),
39158
39093
  assetId: hexOrZero(receipt.assetId),
39159
39094
  gas: bn(receipt.gas),
@@ -39167,7 +39102,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39167
39102
  case "RETURN" /* Return */: {
39168
39103
  const returnReceipt = {
39169
39104
  type: ReceiptType.Return,
39170
- id: hexOrZero(receipt.id || receipt.contractId),
39105
+ id: hexOrZero(receipt.contract?.id),
39171
39106
  val: bn(receipt.val),
39172
39107
  pc: bn(receipt.pc),
39173
39108
  is: bn(receipt.is)
@@ -39177,7 +39112,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39177
39112
  case "RETURN_DATA" /* ReturnData */: {
39178
39113
  const returnDataReceipt = {
39179
39114
  type: ReceiptType.ReturnData,
39180
- id: hexOrZero(receipt.id || receipt.contractId),
39115
+ id: hexOrZero(receipt.contract?.id),
39181
39116
  ptr: bn(receipt.ptr),
39182
39117
  len: bn(receipt.len),
39183
39118
  digest: hexOrZero(receipt.digest),
@@ -39189,7 +39124,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39189
39124
  case "PANIC" /* Panic */: {
39190
39125
  const panicReceipt = {
39191
39126
  type: ReceiptType.Panic,
39192
- id: hexOrZero(receipt.id),
39127
+ id: hexOrZero(receipt.contract?.id),
39193
39128
  reason: bn(receipt.reason),
39194
39129
  pc: bn(receipt.pc),
39195
39130
  is: bn(receipt.is),
@@ -39200,7 +39135,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39200
39135
  case "REVERT" /* Revert */: {
39201
39136
  const revertReceipt = {
39202
39137
  type: ReceiptType.Revert,
39203
- id: hexOrZero(receipt.id || receipt.contractId),
39138
+ id: hexOrZero(receipt.contract?.id),
39204
39139
  val: bn(receipt.ra),
39205
39140
  pc: bn(receipt.pc),
39206
39141
  is: bn(receipt.is)
@@ -39210,7 +39145,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39210
39145
  case "LOG" /* Log */: {
39211
39146
  const logReceipt = {
39212
39147
  type: ReceiptType.Log,
39213
- id: hexOrZero(receipt.id || receipt.contractId),
39148
+ id: hexOrZero(receipt.contract?.id),
39214
39149
  val0: bn(receipt.ra),
39215
39150
  val1: bn(receipt.rb),
39216
39151
  val2: bn(receipt.rc),
@@ -39223,7 +39158,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39223
39158
  case "LOG_DATA" /* LogData */: {
39224
39159
  const logDataReceipt = {
39225
39160
  type: ReceiptType.LogData,
39226
- id: hexOrZero(receipt.id || receipt.contractId),
39161
+ id: hexOrZero(receipt.contract?.id),
39227
39162
  val0: bn(receipt.ra),
39228
39163
  val1: bn(receipt.rb),
39229
39164
  ptr: bn(receipt.ptr),
@@ -39237,8 +39172,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39237
39172
  case "TRANSFER" /* Transfer */: {
39238
39173
  const transferReceipt = {
39239
39174
  type: ReceiptType.Transfer,
39240
- from: hexOrZero(receipt.id || receipt.contractId),
39241
- to: hexOrZero(receipt.toAddress || receipt?.to),
39175
+ from: hexOrZero(receipt.contract?.id),
39176
+ to: hexOrZero(receipt.toAddress || receipt?.to?.id),
39242
39177
  amount: bn(receipt.amount),
39243
39178
  assetId: hexOrZero(receipt.assetId),
39244
39179
  pc: bn(receipt.pc),
@@ -39249,8 +39184,8 @@ ${MessageCoinFragmentFragmentDoc}`;
39249
39184
  case "TRANSFER_OUT" /* TransferOut */: {
39250
39185
  const transferOutReceipt = {
39251
39186
  type: ReceiptType.TransferOut,
39252
- from: hexOrZero(receipt.id || receipt.contractId),
39253
- to: hexOrZero(receipt.toAddress || receipt.to),
39187
+ from: hexOrZero(receipt.contract?.id),
39188
+ to: hexOrZero(receipt.toAddress || receipt.to?.id),
39254
39189
  amount: bn(receipt.amount),
39255
39190
  assetId: hexOrZero(receipt.assetId),
39256
39191
  pc: bn(receipt.pc),
@@ -39293,7 +39228,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39293
39228
  return receiptMessageOut;
39294
39229
  }
39295
39230
  case "MINT" /* Mint */: {
39296
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39231
+ const contractId = hexOrZero(receipt.contract?.id);
39297
39232
  const subId = hexOrZero(receipt.subId);
39298
39233
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
39299
39234
  const mintReceipt = {
@@ -39308,7 +39243,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39308
39243
  return mintReceipt;
39309
39244
  }
39310
39245
  case "BURN" /* Burn */: {
39311
- const contractId = hexOrZero(receipt.id || receipt.contractId);
39246
+ const contractId = hexOrZero(receipt.contract?.id);
39312
39247
  const subId = hexOrZero(receipt.subId);
39313
39248
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
39314
39249
  const burnReceipt = {
@@ -39389,6 +39324,7 @@ ${MessageCoinFragmentFragmentDoc}`;
39389
39324
  };
39390
39325
 
39391
39326
  // src/providers/utils/gas.ts
39327
+ var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
39392
39328
  var getGasUsedFromReceipts = (receipts) => {
39393
39329
  const scriptResult = receipts.filter(
39394
39330
  (receipt) => receipt.type === ReceiptType.ScriptResult
@@ -39409,28 +39345,18 @@ ${MessageCoinFragmentFragmentDoc}`;
39409
39345
  }
39410
39346
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
39411
39347
  const witnessCache = [];
39412
- const chargeableInputs = inputs.filter((input) => {
39413
- const isCoinOrMessage = "owner" in input || "sender" in input;
39414
- if (isCoinOrMessage) {
39415
- if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39416
- return true;
39417
- }
39418
- if (!witnessCache.includes(input.witnessIndex)) {
39419
- witnessCache.push(input.witnessIndex);
39420
- return true;
39421
- }
39422
- }
39423
- return false;
39424
- });
39425
- const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
39426
- const totalGas = chargeableInputs.reduce((total, input) => {
39348
+ const totalGas = inputs.reduce((total, input) => {
39427
39349
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
39428
39350
  return total.add(
39429
- vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39351
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
39430
39352
  );
39431
39353
  }
39432
- return total.add(gasCosts.ecr1);
39433
- }, bn(0));
39354
+ if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
39355
+ witnessCache.push(input.witnessIndex);
39356
+ return total.add(gasCosts.ecr1);
39357
+ }
39358
+ return total;
39359
+ }, bn());
39434
39360
  return totalGas;
39435
39361
  }
39436
39362
  function getMinGas(params) {
@@ -39442,20 +39368,12 @@ ${MessageCoinFragmentFragmentDoc}`;
39442
39368
  return minGas;
39443
39369
  }
39444
39370
  function getMaxGas(params) {
39445
- const {
39446
- gasPerByte,
39447
- witnessesLength,
39448
- witnessLimit,
39449
- minGas,
39450
- gasLimit = bn(0),
39451
- maxGasPerTx
39452
- } = params;
39371
+ const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
39453
39372
  let remainingAllowedWitnessGas = bn(0);
39454
39373
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
39455
39374
  remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
39456
39375
  }
39457
- const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39458
- return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
39376
+ return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
39459
39377
  }
39460
39378
  function calculateMetadataGasForTxCreate({
39461
39379
  gasCosts,
@@ -39477,10 +39395,6 @@ ${MessageCoinFragmentFragmentDoc}`;
39477
39395
  }) {
39478
39396
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
39479
39397
  }
39480
- var calculateGasFee = (params) => {
39481
- const { gas, gasPrice, priceFactor, tip } = params;
39482
- return gas.mul(gasPrice).div(priceFactor).add(tip);
39483
- };
39484
39398
 
39485
39399
  // src/providers/utils/json.ts
39486
39400
  function normalize2(object) {
@@ -39622,7 +39536,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39622
39536
  // src/providers/transaction-request/transaction-request.ts
39623
39537
  var BaseTransactionRequest = class {
39624
39538
  /** Gas price for transaction */
39625
- tip;
39539
+ gasPrice;
39626
39540
  /** Block until which tx cannot be included */
39627
39541
  maturity;
39628
39542
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -39635,34 +39549,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39635
39549
  outputs = [];
39636
39550
  /** List of witnesses */
39637
39551
  witnesses = [];
39552
+ /** Base asset ID - should be fetched from the chain */
39553
+ baseAssetId;
39638
39554
  /**
39639
39555
  * Constructor for initializing a base transaction request.
39640
39556
  *
39641
39557
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
39642
39558
  */
39643
39559
  constructor({
39644
- tip,
39560
+ gasPrice,
39645
39561
  maturity,
39646
39562
  maxFee,
39647
39563
  witnessLimit,
39648
39564
  inputs,
39649
39565
  outputs,
39650
- witnesses
39651
- } = {}) {
39652
- this.tip = bn(tip);
39566
+ witnesses,
39567
+ baseAssetId
39568
+ }) {
39569
+ this.gasPrice = bn(gasPrice);
39653
39570
  this.maturity = maturity ?? 0;
39654
39571
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
39655
39572
  this.maxFee = maxFee ? bn(maxFee) : void 0;
39656
39573
  this.inputs = inputs ?? [];
39657
39574
  this.outputs = outputs ?? [];
39658
39575
  this.witnesses = witnesses ?? [];
39576
+ this.baseAssetId = baseAssetId;
39659
39577
  }
39660
39578
  static getPolicyMeta(req) {
39661
39579
  let policyTypes = 0;
39662
39580
  const policies = [];
39663
- if (req.tip) {
39664
- policyTypes += PolicyType.Tip;
39665
- policies.push({ data: req.tip, type: PolicyType.Tip });
39581
+ if (req.gasPrice) {
39582
+ policyTypes += PolicyType.GasPrice;
39583
+ policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
39666
39584
  }
39667
39585
  if (req.witnessLimit) {
39668
39586
  policyTypes += PolicyType.WitnessLimit;
@@ -39849,10 +39767,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39849
39767
  * @param predicate - Predicate bytes.
39850
39768
  * @param predicateData - Predicate data bytes.
39851
39769
  */
39852
- addCoinInput(coin) {
39770
+ addCoinInput(coin, predicate) {
39853
39771
  const { assetId, owner, amount } = coin;
39854
39772
  let witnessIndex;
39855
- if (coin.predicate) {
39773
+ if (predicate) {
39856
39774
  witnessIndex = 0;
39857
39775
  } else {
39858
39776
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -39867,7 +39785,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39867
39785
  amount,
39868
39786
  assetId,
39869
39787
  txPointer: "0x00000000000000000000000000000000",
39870
- witnessIndex
39788
+ witnessIndex,
39789
+ predicate: predicate?.bytes
39871
39790
  };
39872
39791
  this.pushInput(input);
39873
39792
  this.addChangeOutput(owner, assetId);
@@ -39878,13 +39797,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39878
39797
  *
39879
39798
  * @param message - Message resource.
39880
39799
  * @param predicate - Predicate bytes.
39881
- * @param predicateData - Predicate data bytes.
39882
39800
  */
39883
- addMessageInput(message) {
39801
+ addMessageInput(message, predicate) {
39884
39802
  const { recipient, sender, amount } = message;
39885
- const assetId = BaseAssetId;
39886
39803
  let witnessIndex;
39887
- if (message.predicate) {
39804
+ if (predicate) {
39888
39805
  witnessIndex = 0;
39889
39806
  } else {
39890
39807
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -39898,10 +39815,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39898
39815
  sender: sender.toB256(),
39899
39816
  recipient: recipient.toB256(),
39900
39817
  amount,
39901
- witnessIndex
39818
+ witnessIndex,
39819
+ predicate: predicate?.bytes
39902
39820
  };
39903
39821
  this.pushInput(input);
39904
- this.addChangeOutput(recipient, assetId);
39822
+ this.addChangeOutput(recipient, this.baseAssetId);
39905
39823
  }
39906
39824
  /**
39907
39825
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -39929,6 +39847,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39929
39847
  resources.forEach((resource) => this.addResource(resource));
39930
39848
  return this;
39931
39849
  }
39850
+ /**
39851
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
39852
+ * outputs from the related assetIds.
39853
+ *
39854
+ * @param resources - The resources to add.
39855
+ * @returns This transaction.
39856
+ */
39857
+ addPredicateResource(resource, predicate) {
39858
+ if (isCoin(resource)) {
39859
+ this.addCoinInput(resource, predicate);
39860
+ } else {
39861
+ this.addMessageInput(resource, predicate);
39862
+ }
39863
+ return this;
39864
+ }
39865
+ /**
39866
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
39867
+ * from the related assetIds.
39868
+ *
39869
+ * @param resources - The resources to add.
39870
+ * @returns This transaction.
39871
+ */
39872
+ addPredicateResources(resources, predicate) {
39873
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
39874
+ return this;
39875
+ }
39932
39876
  /**
39933
39877
  * Adds a coin output to the transaction.
39934
39878
  *
@@ -39936,12 +39880,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39936
39880
  * @param amount - Amount of coin.
39937
39881
  * @param assetId - Asset ID of coin.
39938
39882
  */
39939
- addCoinOutput(to, amount, assetId = BaseAssetId) {
39883
+ addCoinOutput(to, amount, assetId) {
39940
39884
  this.pushOutput({
39941
39885
  type: OutputType.Coin,
39942
39886
  to: addressify(to).toB256(),
39943
39887
  amount,
39944
- assetId
39888
+ assetId: assetId ?? this.baseAssetId
39945
39889
  });
39946
39890
  return this;
39947
39891
  }
@@ -39968,7 +39912,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39968
39912
  * @param to - Address of the owner.
39969
39913
  * @param assetId - Asset ID of coin.
39970
39914
  */
39971
- addChangeOutput(to, assetId = BaseAssetId) {
39915
+ addChangeOutput(to, assetId) {
39972
39916
  const changeOutput = this.getChangeOutputs().find(
39973
39917
  (output3) => hexlify(output3.assetId) === assetId
39974
39918
  );
@@ -39976,7 +39920,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39976
39920
  this.pushOutput({
39977
39921
  type: OutputType.Change,
39978
39922
  to: addressify(to).toB256(),
39979
- assetId
39923
+ assetId: assetId ?? this.baseAssetId
39980
39924
  });
39981
39925
  }
39982
39926
  }
@@ -40008,7 +39952,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40008
39952
  }
40009
39953
  calculateMaxGas(chainInfo, minGas) {
40010
39954
  const { consensusParameters } = chainInfo;
40011
- const { gasPerByte, maxGasPerTx } = consensusParameters;
39955
+ const { gasPerByte } = consensusParameters;
40012
39956
  const witnessesLength = this.toTransaction().witnesses.reduce(
40013
39957
  (acc, wit) => acc + wit.dataLength,
40014
39958
  0
@@ -40017,8 +39961,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40017
39961
  gasPerByte,
40018
39962
  minGas,
40019
39963
  witnessesLength,
40020
- witnessLimit: this.witnessLimit,
40021
- maxGasPerTx
39964
+ witnessLimit: this.witnessLimit
40022
39965
  });
40023
39966
  }
40024
39967
  /**
@@ -40036,27 +39979,24 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40036
39979
  });
40037
39980
  const updateAssetInput = (assetId, quantity) => {
40038
39981
  const assetInput = findAssetInput(assetId);
40039
- let usedQuantity = quantity;
40040
- if (assetId === BaseAssetId) {
40041
- usedQuantity = bn("1000000000000000000");
40042
- }
40043
39982
  if (assetInput && "assetId" in assetInput) {
40044
39983
  assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
40045
- assetInput.amount = usedQuantity;
39984
+ assetInput.amount = quantity;
40046
39985
  } else {
40047
39986
  this.addResources([
40048
39987
  {
40049
39988
  id: hexlify(randomBytes22(UTXO_ID_LEN)),
40050
- amount: usedQuantity,
39989
+ amount: quantity,
40051
39990
  assetId,
40052
39991
  owner: resourcesOwner || Address.fromRandom(),
39992
+ maturity: 0,
40053
39993
  blockCreated: bn(1),
40054
39994
  txCreatedIdx: bn(1)
40055
39995
  }
40056
39996
  ]);
40057
39997
  }
40058
39998
  };
40059
- updateAssetInput(BaseAssetId, bn(1e11));
39999
+ updateAssetInput(this.baseAssetId, bn(1e11));
40060
40000
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
40061
40001
  }
40062
40002
  /**
@@ -40081,7 +40021,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40081
40021
  toJSON() {
40082
40022
  return normalizeJSON(this);
40083
40023
  }
40084
- updatePredicateGasUsed(inputs) {
40024
+ updatePredicateInputs(inputs) {
40085
40025
  this.inputs.forEach((i) => {
40086
40026
  let correspondingInput;
40087
40027
  switch (i.type) {
@@ -40103,15 +40043,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40103
40043
  }
40104
40044
  });
40105
40045
  }
40106
- shiftPredicateData() {
40107
- this.inputs.forEach((input) => {
40108
- if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
40109
- input.predicateData = input.paddPredicateData(
40110
- BaseTransactionRequest.getPolicyMeta(this).policies.length
40111
- );
40112
- }
40113
- });
40114
- }
40115
40046
  };
40116
40047
 
40117
40048
  // src/providers/transaction-request/hash-transaction.ts
@@ -40222,12 +40153,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40222
40153
  *
40223
40154
  * @param createTransactionRequestLike - The initial values for the instance
40224
40155
  */
40225
- constructor({
40226
- bytecodeWitnessIndex,
40227
- salt,
40228
- storageSlots,
40229
- ...rest
40230
- } = {}) {
40156
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
40231
40157
  super(rest);
40232
40158
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
40233
40159
  this.salt = hexlify(salt ?? ZeroBytes32);
@@ -40245,8 +40171,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40245
40171
  return {
40246
40172
  type: TransactionType.Create,
40247
40173
  ...baseTransaction,
40174
+ bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
40248
40175
  bytecodeWitnessIndex,
40249
- storageSlotsCount: bn(storageSlots.length),
40176
+ storageSlotsCount: storageSlots.length,
40250
40177
  salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
40251
40178
  storageSlots
40252
40179
  };
@@ -40341,7 +40268,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40341
40268
  *
40342
40269
  * @param scriptTransactionRequestLike - The initial values for the instance.
40343
40270
  */
40344
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
40271
+ constructor({ script, scriptData, gasLimit, ...rest }) {
40345
40272
  super(rest);
40346
40273
  this.gasLimit = bn(gasLimit);
40347
40274
  this.script = arrayify(script ?? returnZeroScript.bytes);
@@ -40360,8 +40287,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40360
40287
  type: TransactionType.Script,
40361
40288
  scriptGasLimit: this.gasLimit,
40362
40289
  ...super.getBaseTransaction(),
40363
- scriptLength: bn(script.length),
40364
- scriptDataLength: bn(scriptData.length),
40290
+ scriptLength: script.length,
40291
+ scriptDataLength: scriptData.length,
40365
40292
  receiptsRoot: ZeroBytes32,
40366
40293
  script: hexlify(script),
40367
40294
  scriptData: hexlify(scriptData)
@@ -40425,7 +40352,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40425
40352
  }
40426
40353
  calculateMaxGas(chainInfo, minGas) {
40427
40354
  const { consensusParameters } = chainInfo;
40428
- const { gasPerByte, maxGasPerTx } = consensusParameters;
40355
+ const { gasPerByte } = consensusParameters;
40429
40356
  const witnessesLength = this.toTransaction().witnesses.reduce(
40430
40357
  (acc, wit) => acc + wit.dataLength,
40431
40358
  0
@@ -40435,8 +40362,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40435
40362
  minGas,
40436
40363
  witnessesLength,
40437
40364
  witnessLimit: this.witnessLimit,
40438
- gasLimit: this.gasLimit,
40439
- maxGasPerTx
40365
+ gasLimit: this.gasLimit
40440
40366
  });
40441
40367
  }
40442
40368
  /**
@@ -40509,29 +40435,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40509
40435
  }
40510
40436
  }
40511
40437
  };
40512
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40513
- (acc, input) => {
40514
- if (input.type === InputType.Coin && input.owner === owner) {
40515
- acc.utxos.push(input.id);
40516
- }
40517
- if (input.type === InputType.Message && input.recipient === owner) {
40518
- acc.messages.push(input.nonce);
40519
- }
40520
- return acc;
40521
- },
40522
- {
40523
- utxos: [],
40524
- messages: []
40525
- }
40526
- );
40527
40438
 
40528
40439
  // src/providers/transaction-summary/calculate-transaction-fee.ts
40529
40440
  var calculateTransactionFee = (params) => {
40530
40441
  const {
40531
- gasPrice,
40442
+ gasUsed,
40532
40443
  rawPayload,
40533
- tip,
40534
- consensusParameters: { gasCosts, feeParams, maxGasPerTx }
40444
+ consensusParameters: { gasCosts, feeParams }
40535
40445
  } = params;
40536
40446
  const gasPerByte = bn(feeParams.gasPerByte);
40537
40447
  const gasPriceFactor = bn(feeParams.gasPriceFactor);
@@ -40541,7 +40451,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40541
40451
  return {
40542
40452
  fee: bn(0),
40543
40453
  minFee: bn(0),
40544
- maxFee: bn(0)
40454
+ maxFee: bn(0),
40455
+ feeFromGasUsed: bn(0)
40545
40456
  };
40546
40457
  }
40547
40458
  const { type: type3, witnesses, inputs, policies } = transaction;
@@ -40573,6 +40484,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40573
40484
  metadataGas,
40574
40485
  txBytesSize: transactionBytes.length
40575
40486
  });
40487
+ const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
40576
40488
  const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
40577
40489
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
40578
40490
  const maxGas = getMaxGas({
@@ -40580,25 +40492,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40580
40492
  minGas,
40581
40493
  witnessesLength,
40582
40494
  gasLimit,
40583
- witnessLimit,
40584
- maxGasPerTx
40585
- });
40586
- const minFee = calculateGasFee({
40587
- gasPrice,
40588
- gas: minGas,
40589
- priceFactor: gasPriceFactor,
40590
- tip
40591
- });
40592
- const maxFee = calculateGasFee({
40593
- gasPrice,
40594
- gas: maxGas,
40595
- priceFactor: gasPriceFactor,
40596
- tip
40495
+ witnessLimit
40597
40496
  });
40497
+ const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
40498
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
40499
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
40500
+ const fee = minFee.add(feeFromGasUsed);
40598
40501
  return {
40502
+ fee,
40599
40503
  minFee,
40600
40504
  maxFee,
40601
- fee: maxFee
40505
+ feeFromGasUsed
40602
40506
  };
40603
40507
  };
40604
40508
 
@@ -41199,9 +41103,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41199
41103
  gqlTransactionStatus,
41200
41104
  abiMap = {},
41201
41105
  maxInputs,
41202
- gasCosts,
41203
- maxGasPerTx,
41204
- gasPrice
41106
+ gasCosts
41205
41107
  } = params;
41206
41108
  const gasUsed = getGasUsedFromReceipts(receipts);
41207
41109
  const rawPayload = hexlify(transactionBytes);
@@ -41215,14 +41117,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41215
41117
  maxInputs
41216
41118
  });
41217
41119
  const typeName = getTransactionTypeName(transaction.type);
41218
- const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
41219
41120
  const { fee } = calculateTransactionFee({
41220
- gasPrice,
41121
+ gasUsed,
41221
41122
  rawPayload,
41222
- tip,
41223
41123
  consensusParameters: {
41224
41124
  gasCosts,
41225
- maxGasPerTx,
41226
41125
  feeParams: {
41227
41126
  gasPerByte,
41228
41127
  gasPriceFactor
@@ -41358,13 +41257,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41358
41257
  const decodedTransaction = this.decodeTransaction(
41359
41258
  transaction
41360
41259
  );
41361
- let txReceipts = [];
41362
- if (transaction?.status && "receipts" in transaction.status) {
41363
- txReceipts = transaction.status.receipts;
41364
- }
41365
- const receipts = txReceipts.map(processGqlReceipt) || [];
41366
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
41367
- const gasPrice = await this.provider.getLatestGasPrice();
41260
+ const receipts = transaction.receipts?.map(processGqlReceipt) || [];
41261
+ const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
41368
41262
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
41369
41263
  const transactionSummary = assembleTransactionSummary({
41370
41264
  id: this.id,
@@ -41376,9 +41270,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41376
41270
  gasPriceFactor,
41377
41271
  abiMap: contractsAbiMap,
41378
41272
  maxInputs,
41379
- gasCosts,
41380
- maxGasPerTx,
41381
- gasPrice
41273
+ gasCosts
41382
41274
  });
41383
41275
  return transactionSummary;
41384
41276
  }
@@ -41522,12 +41414,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41522
41414
  gasPerByte: bn(feeParams.gasPerByte),
41523
41415
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
41524
41416
  chainId: bn(consensusParameters.chainId),
41417
+ baseAssetId: consensusParameters.baseAssetId,
41525
41418
  gasCosts
41526
41419
  },
41527
41420
  gasCosts,
41528
41421
  latestBlock: {
41529
41422
  id: latestBlock.id,
41530
- height: bn(latestBlock.height),
41423
+ height: bn(latestBlock.header.height),
41531
41424
  time: latestBlock.header.time,
41532
41425
  transactions: latestBlock.transactions.map((i) => ({
41533
41426
  id: i.id
@@ -41621,8 +41514,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41621
41514
  * Returns some helpful parameters related to gas fees.
41622
41515
  */
41623
41516
  getGasConfig() {
41517
+ const { minGasPrice } = this.getNode();
41624
41518
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
41625
41519
  return {
41520
+ minGasPrice,
41626
41521
  maxGasPerTx,
41627
41522
  maxGasPerPredicate,
41628
41523
  gasPriceFactor,
@@ -41720,7 +41615,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41720
41615
  */
41721
41616
  async getBlockNumber() {
41722
41617
  const { chain } = await this.operations.getChain();
41723
- return bn(chain.latestBlock.height, 10);
41618
+ return bn(chain.latestBlock.header.height, 10);
41724
41619
  }
41725
41620
  /**
41726
41621
  * Returns the chain information.
@@ -41732,9 +41627,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41732
41627
  const processedNodeInfo = {
41733
41628
  maxDepth: bn(nodeInfo.maxDepth),
41734
41629
  maxTx: bn(nodeInfo.maxTx),
41630
+ minGasPrice: bn(nodeInfo.minGasPrice),
41735
41631
  nodeVersion: nodeInfo.nodeVersion,
41736
41632
  utxoValidation: nodeInfo.utxoValidation,
41737
- vmBacktrace: nodeInfo.vmBacktrace
41633
+ vmBacktrace: nodeInfo.vmBacktrace,
41634
+ peers: nodeInfo.peers
41738
41635
  };
41739
41636
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
41740
41637
  return processedNodeInfo;
@@ -41760,6 +41657,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41760
41657
  } = this.getChain();
41761
41658
  return chainId.toNumber();
41762
41659
  }
41660
+ /**
41661
+ * Returns the base asset ID
41662
+ *
41663
+ * @returns A promise that resolves to the base asset ID
41664
+ */
41665
+ getBaseAssetId() {
41666
+ const {
41667
+ consensusParameters: { baseAssetId }
41668
+ } = this.getChain();
41669
+ return baseAssetId;
41670
+ }
41763
41671
  /**
41764
41672
  * Submits a transaction to the chain to be executed.
41765
41673
  *
@@ -41820,13 +41728,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41820
41728
  return this.estimateTxDependencies(transactionRequest);
41821
41729
  }
41822
41730
  const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41823
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41824
- encodedTransactions: encodedTransaction,
41731
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41732
+ encodedTransaction,
41825
41733
  utxoValidation: utxoValidation || false
41826
41734
  });
41827
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
41828
- const receipts = rawReceipts.map(processGqlReceipt);
41829
- return { receipts, dryrunStatus: status };
41735
+ const receipts = gqlReceipts.map(processGqlReceipt);
41736
+ return {
41737
+ receipts
41738
+ };
41830
41739
  }
41831
41740
  /**
41832
41741
  * Verifies whether enough gas is available to complete transaction.
@@ -41865,6 +41774,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41865
41774
  * If there are missing variable outputs,
41866
41775
  * `addVariableOutputs` is called on the transaction.
41867
41776
  *
41777
+ * @privateRemarks
41778
+ * TODO: Investigate support for missing contract IDs
41779
+ * TODO: Add support for missing output messages
41868
41780
  *
41869
41781
  * @param transactionRequest - The transaction request object.
41870
41782
  * @returns A promise.
@@ -41877,19 +41789,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41877
41789
  missingContractIds: []
41878
41790
  };
41879
41791
  }
41792
+ await this.estimatePredicates(transactionRequest);
41880
41793
  let receipts = [];
41881
41794
  const missingContractIds = [];
41882
41795
  let outputVariables = 0;
41883
- let dryrunStatus;
41884
41796
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
41885
- const {
41886
- dryRun: [{ receipts: rawReceipts, status }]
41887
- } = await this.operations.dryRun({
41888
- encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
41797
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41798
+ encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
41889
41799
  utxoValidation: false
41890
41800
  });
41891
- receipts = rawReceipts.map(processGqlReceipt);
41892
- dryrunStatus = status;
41801
+ receipts = gqlReceipts.map(processGqlReceipt);
41893
41802
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
41894
41803
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
41895
41804
  if (hasMissingOutputs) {
@@ -41899,10 +41808,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41899
41808
  transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
41900
41809
  missingContractIds.push(contractId);
41901
41810
  });
41902
- const { maxFee } = await this.estimateTxGasAndFee({
41903
- transactionRequest
41904
- });
41905
- transactionRequest.maxFee = maxFee;
41906
41811
  } else {
41907
41812
  break;
41908
41813
  }
@@ -41910,139 +41815,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41910
41815
  return {
41911
41816
  receipts,
41912
41817
  outputVariables,
41913
- missingContractIds,
41914
- dryrunStatus
41818
+ missingContractIds
41915
41819
  };
41916
41820
  }
41917
- /**
41918
- * Dry runs multiple transactions and checks for missing dependencies in batches.
41919
- *
41920
- * Transactions are dry run in batches. After each dry run, transactions requiring
41921
- * further modifications are identified. The method iteratively updates these transactions
41922
- * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
41923
- *
41924
- * @param transactionRequests - Array of transaction request objects.
41925
- * @returns A promise that resolves to an array of results for each transaction.
41926
- */
41927
- async estimateMultipleTxDependencies(transactionRequests) {
41928
- const results = transactionRequests.map(() => ({
41929
- receipts: [],
41930
- outputVariables: 0,
41931
- missingContractIds: [],
41932
- dryrunStatus: void 0
41933
- }));
41934
- const allRequests = clone_default(transactionRequests);
41935
- const serializedTransactionsMap = /* @__PURE__ */ new Map();
41936
- allRequests.forEach((req, index) => {
41937
- if (req.type === TransactionType.Script) {
41938
- serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
41939
- }
41940
- });
41941
- let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
41942
- let attempt = 0;
41943
- while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
41944
- const encodedTransactions = transactionsToProcess.map(
41945
- (index) => serializedTransactionsMap.get(index)
41946
- );
41947
- const dryRunResults = await this.operations.dryRun({
41948
- encodedTransactions,
41949
- utxoValidation: false
41950
- });
41951
- const nextRoundTransactions = [];
41952
- for (let i = 0; i < dryRunResults.dryRun.length; i++) {
41953
- const currentResultIndex = transactionsToProcess[i];
41954
- const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
41955
- results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
41956
- results[currentResultIndex].dryrunStatus = status;
41957
- const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
41958
- results[currentResultIndex].receipts
41959
- );
41960
- const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
41961
- const requestToProcess = allRequests[currentResultIndex];
41962
- if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
41963
- results[currentResultIndex].outputVariables += missingOutputVariables.length;
41964
- requestToProcess.addVariableOutputs(missingOutputVariables.length);
41965
- missingOutputContractIds.forEach(({ contractId }) => {
41966
- requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
41967
- results[currentResultIndex].missingContractIds.push(contractId);
41968
- });
41969
- const { maxFee } = await this.estimateTxGasAndFee({
41970
- transactionRequest: requestToProcess
41971
- });
41972
- requestToProcess.maxFee = maxFee;
41973
- serializedTransactionsMap.set(
41974
- currentResultIndex,
41975
- hexlify(requestToProcess.toTransactionBytes())
41976
- );
41977
- nextRoundTransactions.push(currentResultIndex);
41978
- allRequests[currentResultIndex] = requestToProcess;
41979
- }
41980
- }
41981
- transactionsToProcess = nextRoundTransactions;
41982
- attempt += 1;
41983
- }
41984
- return results;
41985
- }
41986
- async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
41987
- if (estimateTxDependencies) {
41988
- return this.estimateMultipleTxDependencies(transactionRequests);
41989
- }
41990
- const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
41991
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
41992
- encodedTransactions,
41993
- utxoValidation: utxoValidation || false
41994
- });
41995
- const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
41996
- const receipts = rawReceipts.map(processGqlReceipt);
41997
- return { receipts, dryrunStatus: status };
41998
- });
41999
- return results;
42000
- }
42001
41821
  /**
42002
41822
  * Estimates the transaction gas and fee based on the provided transaction request.
42003
41823
  * @param transactionRequest - The transaction request object.
42004
41824
  * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
42005
41825
  */
42006
- async estimateTxGasAndFee(params) {
41826
+ estimateTxGasAndFee(params) {
42007
41827
  const { transactionRequest } = params;
42008
- let { gasPrice } = params;
41828
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
42009
41829
  const chainInfo = this.getChain();
42010
- const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
41830
+ const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
41831
+ transactionRequest.gasPrice = gasPrice;
42011
41832
  const minGas = transactionRequest.calculateMinGas(chainInfo);
42012
- if (!gasPrice) {
42013
- gasPrice = await this.estimateGasPrice(10);
42014
- }
42015
- const minFee = calculateGasFee({
42016
- gasPrice: bn(gasPrice),
42017
- gas: minGas,
42018
- priceFactor: gasPriceFactor,
42019
- tip: transactionRequest.tip
42020
- }).add(1);
42021
- let gasLimit = bn(0);
41833
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42022
41834
  if (transactionRequest.type === TransactionType.Script) {
42023
- gasLimit = transactionRequest.gasLimit;
42024
41835
  if (transactionRequest.gasLimit.eq(0)) {
42025
41836
  transactionRequest.gasLimit = minGas;
42026
41837
  transactionRequest.gasLimit = maxGasPerTx.sub(
42027
41838
  transactionRequest.calculateMaxGas(chainInfo, minGas)
42028
41839
  );
42029
- gasLimit = transactionRequest.gasLimit;
42030
41840
  }
42031
41841
  }
42032
41842
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
42033
- const maxFee = calculateGasFee({
42034
- gasPrice: bn(gasPrice),
42035
- gas: maxGas,
42036
- priceFactor: gasPriceFactor,
42037
- tip: transactionRequest.tip
42038
- }).add(1);
41843
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
42039
41844
  return {
42040
41845
  minGas,
42041
41846
  minFee,
42042
41847
  maxGas,
42043
- maxFee,
42044
- gasPrice,
42045
- gasLimit
41848
+ maxFee
42046
41849
  };
42047
41850
  }
42048
41851
  /**
@@ -42060,17 +41863,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42060
41863
  if (estimateTxDependencies) {
42061
41864
  return this.estimateTxDependencies(transactionRequest);
42062
41865
  }
42063
- const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
42064
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
42065
- encodedTransactions,
41866
+ const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
41867
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
41868
+ encodedTransaction,
42066
41869
  utxoValidation: true
42067
41870
  });
42068
- const callResult = dryRunStatuses.map((dryRunStatus) => {
42069
- const { id, receipts, status } = dryRunStatus;
42070
- const processedReceipts = receipts.map(processGqlReceipt);
42071
- return { id, receipts: processedReceipts, status };
42072
- });
42073
- return { receipts: callResult[0].receipts };
41871
+ const receipts = gqlReceipts.map(processGqlReceipt);
41872
+ return {
41873
+ receipts
41874
+ };
42074
41875
  }
42075
41876
  /**
42076
41877
  * Returns a transaction cost to enable user
@@ -42087,79 +41888,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42087
41888
  * @param tolerance - The tolerance to add on top of the gasUsed.
42088
41889
  * @returns A promise that resolves to the transaction cost object.
42089
41890
  */
42090
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
41891
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
41892
+ estimateTxDependencies = true,
41893
+ estimatePredicates = true,
41894
+ resourcesOwner,
41895
+ signatureCallback
41896
+ } = {}) {
42091
41897
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
41898
+ const { minGasPrice } = this.getGasConfig();
41899
+ const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
42092
41900
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
42093
41901
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
42094
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
41902
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
42095
41903
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
42096
- txRequestClone.maxFee = bn(0);
42097
41904
  if (isScriptTransaction) {
42098
41905
  txRequestClone.gasLimit = bn(0);
42099
41906
  }
42100
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
42101
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
41907
+ if (estimatePredicates) {
41908
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
41909
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
41910
+ }
41911
+ await this.estimatePredicates(txRequestClone);
42102
41912
  }
42103
- const signedRequest = clone_default(txRequestClone);
42104
- let addedSignatures = 0;
42105
41913
  if (signatureCallback && isScriptTransaction) {
42106
- const lengthBefore = signedRequest.witnesses.length;
42107
- await signatureCallback(signedRequest);
42108
- addedSignatures = signedRequest.witnesses.length - lengthBefore;
41914
+ await signatureCallback(txRequestClone);
42109
41915
  }
42110
- await this.estimatePredicates(signedRequest);
42111
- let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
42112
- transactionRequest: signedRequest
41916
+ let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
41917
+ transactionRequest: txRequestClone
42113
41918
  });
42114
41919
  let receipts = [];
42115
41920
  let missingContractIds = [];
42116
41921
  let outputVariables = 0;
42117
41922
  let gasUsed = bn(0);
42118
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
42119
- txRequestClone.maxFee = maxFee;
42120
- if (isScriptTransaction) {
42121
- txRequestClone.gasLimit = gasLimit;
42122
- if (signatureCallback) {
42123
- await signatureCallback(txRequestClone);
42124
- }
41923
+ if (isScriptTransaction && estimateTxDependencies) {
41924
+ txRequestClone.gasPrice = bn(0);
42125
41925
  const result = await this.estimateTxDependencies(txRequestClone);
42126
41926
  receipts = result.receipts;
42127
41927
  outputVariables = result.outputVariables;
42128
41928
  missingContractIds = result.missingContractIds;
42129
41929
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
42130
41930
  txRequestClone.gasLimit = gasUsed;
42131
- ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
42132
- transactionRequest: txRequestClone,
42133
- gasPrice
41931
+ txRequestClone.gasPrice = setGasPrice;
41932
+ ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
41933
+ transactionRequest: txRequestClone
42134
41934
  }));
42135
41935
  }
42136
41936
  return {
42137
41937
  requiredQuantities: allQuantities,
42138
41938
  receipts,
42139
41939
  gasUsed,
42140
- gasPrice,
41940
+ minGasPrice,
41941
+ gasPrice: setGasPrice,
42141
41942
  minGas,
42142
41943
  maxGas,
42143
41944
  minFee,
42144
41945
  maxFee,
41946
+ estimatedInputs: txRequestClone.inputs,
42145
41947
  outputVariables,
42146
- missingContractIds,
42147
- addedSignatures,
42148
- estimatedPredicates: txRequestClone.inputs
41948
+ missingContractIds
42149
41949
  };
42150
41950
  }
42151
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
41951
+ async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
42152
41952
  const ownerAddress = Address.fromAddressOrString(owner);
42153
41953
  const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
42154
- const transactionCost = await this.getTransactionCost(transactionRequest, {
42155
- quantitiesToContract
42156
- });
41954
+ const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
42157
41955
  transactionRequest.addResources(
42158
41956
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
42159
41957
  );
42160
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
42161
- quantitiesToContract
42162
- });
41958
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(
41959
+ transactionRequest,
41960
+ forwardingQuantities
41961
+ );
42163
41962
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
42164
41963
  return {
42165
41964
  resources,
@@ -42183,6 +41982,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42183
41982
  assetId: coin.assetId,
42184
41983
  amount: bn(coin.amount),
42185
41984
  owner: Address.fromAddressOrString(coin.owner),
41985
+ maturity: bn(coin.maturity).toNumber(),
42186
41986
  blockCreated: bn(coin.blockCreated),
42187
41987
  txCreatedIdx: bn(coin.txCreatedIdx)
42188
41988
  }));
@@ -42234,6 +42034,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42234
42034
  amount: bn(coin.amount),
42235
42035
  assetId: coin.assetId,
42236
42036
  owner: Address.fromAddressOrString(coin.owner),
42037
+ maturity: bn(coin.maturity).toNumber(),
42237
42038
  blockCreated: bn(coin.blockCreated),
42238
42039
  txCreatedIdx: bn(coin.txCreatedIdx)
42239
42040
  };
@@ -42266,7 +42067,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42266
42067
  }
42267
42068
  return {
42268
42069
  id: block2.id,
42269
- height: bn(block2.height),
42070
+ height: bn(block2.header.height),
42270
42071
  time: block2.header.time,
42271
42072
  transactionIds: block2.transactions.map((tx) => tx.id)
42272
42073
  };
@@ -42281,7 +42082,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42281
42082
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
42282
42083
  const blocks = fetchedData.edges.map(({ node: block2 }) => ({
42283
42084
  id: block2.id,
42284
- height: bn(block2.height),
42085
+ height: bn(block2.header.height),
42285
42086
  time: block2.header.time,
42286
42087
  transactionIds: block2.transactions.map((tx) => tx.id)
42287
42088
  }));
@@ -42308,7 +42109,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42308
42109
  }
42309
42110
  return {
42310
42111
  id: block2.id,
42311
- height: bn(block2.height, 10),
42112
+ height: bn(block2.header.height, 10),
42312
42113
  time: block2.header.time,
42313
42114
  transactionIds: block2.transactions.map((tx) => tx.id),
42314
42115
  transactions: block2.transactions.map(
@@ -42488,11 +42289,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42488
42289
  prevRoot: messageBlockHeader.prevRoot,
42489
42290
  time: messageBlockHeader.time,
42490
42291
  applicationHash: messageBlockHeader.applicationHash,
42491
- messageReceiptCount: bn(messageBlockHeader.messageReceiptCount),
42492
- messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
42493
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
42494
- eventInboxRoot: messageBlockHeader.eventInboxRoot,
42495
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
42292
+ messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
42293
+ messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
42496
42294
  },
42497
42295
  commitBlockHeader: {
42498
42296
  id: commitBlockHeader.id,
@@ -42503,11 +42301,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42503
42301
  prevRoot: commitBlockHeader.prevRoot,
42504
42302
  time: commitBlockHeader.time,
42505
42303
  applicationHash: commitBlockHeader.applicationHash,
42506
- messageReceiptCount: bn(commitBlockHeader.messageReceiptCount),
42507
- messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
42508
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
42509
- eventInboxRoot: commitBlockHeader.eventInboxRoot,
42510
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
42304
+ messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
42305
+ messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
42511
42306
  },
42512
42307
  sender: Address.fromAddressOrString(sender),
42513
42308
  recipient: Address.fromAddressOrString(recipient),
@@ -42516,16 +42311,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42516
42311
  data
42517
42312
  };
42518
42313
  }
42519
- async getLatestGasPrice() {
42520
- const { latestGasPrice } = await this.operations.getLatestGasPrice();
42521
- return bn(latestGasPrice.gasPrice);
42522
- }
42523
- async estimateGasPrice(blockHorizon) {
42524
- const { estimateGasPrice } = await this.operations.estimateGasPrice({
42525
- blockHorizon: String(blockHorizon)
42526
- });
42527
- return bn(estimateGasPrice.gasPrice);
42528
- }
42529
42314
  /**
42530
42315
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
42531
42316
  *
@@ -42586,15 +42371,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42586
42371
  arrayify(gqlTransaction.rawPayload),
42587
42372
  0
42588
42373
  );
42589
- let txReceipts = [];
42590
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42591
- txReceipts = gqlTransaction.status.receipts;
42592
- }
42593
- const receipts = txReceipts.map(processGqlReceipt);
42374
+ const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
42594
42375
  const {
42595
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42376
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42596
42377
  } = provider.getChain();
42597
- const gasPrice = await provider.getLatestGasPrice();
42598
42378
  const transactionInfo = assembleTransactionSummary({
42599
42379
  id: gqlTransaction.id,
42600
42380
  receipts,
@@ -42605,9 +42385,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42605
42385
  gasPriceFactor: bn(gasPriceFactor),
42606
42386
  abiMap,
42607
42387
  maxInputs,
42608
- gasCosts,
42609
- maxGasPerTx,
42610
- gasPrice
42388
+ gasCosts
42611
42389
  });
42612
42390
  return {
42613
42391
  gqlTransaction,
@@ -42617,11 +42395,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42617
42395
  async function getTransactionSummaryFromRequest(params) {
42618
42396
  const { provider, transactionRequest, abiMap } = params;
42619
42397
  const { receipts } = await provider.call(transactionRequest);
42620
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
42398
+ const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
42621
42399
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
42622
42400
  const transaction = transactionRequest.toTransaction();
42623
42401
  const transactionBytes = transactionRequest.toTransactionBytes();
42624
- const gasPrice = await provider.getLatestGasPrice();
42625
42402
  const transactionSummary = assembleTransactionSummary({
42626
42403
  receipts,
42627
42404
  transaction,
@@ -42630,9 +42407,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42630
42407
  gasPerByte,
42631
42408
  gasPriceFactor,
42632
42409
  maxInputs,
42633
- gasCosts,
42634
- maxGasPerTx,
42635
- gasPrice
42410
+ gasCosts
42636
42411
  });
42637
42412
  return transactionSummary;
42638
42413
  }
@@ -42641,18 +42416,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42641
42416
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
42642
42417
  const { edges, pageInfo } = transactionsByOwner;
42643
42418
  const {
42644
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
42419
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
42645
42420
  } = provider.getChain();
42646
- const gasPrice = await provider.getLatestGasPrice();
42647
42421
  const transactions = edges.map((edge) => {
42648
42422
  const { node: gqlTransaction } = edge;
42649
- const { id, rawPayload, status } = gqlTransaction;
42423
+ const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
42650
42424
  const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
42651
- let txReceipts = [];
42652
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
42653
- txReceipts = gqlTransaction.status.receipts;
42654
- }
42655
- const receipts = txReceipts.map(processGqlReceipt);
42425
+ const receipts = gqlReceipts?.map(processGqlReceipt) || [];
42656
42426
  const transactionSummary = assembleTransactionSummary({
42657
42427
  id,
42658
42428
  receipts,
@@ -42663,9 +42433,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42663
42433
  gasPerByte,
42664
42434
  gasPriceFactor,
42665
42435
  maxInputs,
42666
- gasCosts,
42667
- maxGasPerTx,
42668
- gasPrice
42436
+ gasCosts
42669
42437
  });
42670
42438
  const output3 = {
42671
42439
  gqlTransaction,
@@ -42956,8 +42724,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42956
42724
  * @param assetId - The asset ID to check the balance for.
42957
42725
  * @returns A promise that resolves to the balance amount.
42958
42726
  */
42959
- async getBalance(assetId = BaseAssetId) {
42960
- const amount = await this.provider.getBalance(this.address, assetId);
42727
+ async getBalance(assetId) {
42728
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
42729
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
42961
42730
  return amount;
42962
42731
  }
42963
42732
  /**
@@ -42994,33 +42763,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42994
42763
  * @param fee - The estimated transaction fee.
42995
42764
  * @returns A promise that resolves when the resources are added to the transaction.
42996
42765
  */
42997
- async fund(request, params) {
42998
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
42999
- const txRequest = request;
43000
- const requiredQuantitiesWithFee = addAmountToCoinQuantities({
42766
+ async fund(request, coinQuantities, fee) {
42767
+ const baseAssetId = this.provider.getBaseAssetId();
42768
+ const updatedQuantities = addAmountToAsset({
43001
42769
  amount: bn(fee),
43002
- assetId: BaseAssetId,
43003
- coinQuantities: requiredQuantities
42770
+ assetId: baseAssetId,
42771
+ coinQuantities
43004
42772
  });
43005
42773
  const quantitiesDict = {};
43006
- requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
42774
+ updatedQuantities.forEach(({ amount, assetId }) => {
43007
42775
  quantitiesDict[assetId] = {
43008
42776
  required: amount,
43009
42777
  owned: bn(0)
43010
42778
  };
43011
42779
  });
43012
- txRequest.inputs.forEach((input) => {
42780
+ const cachedUtxos = [];
42781
+ const cachedMessages = [];
42782
+ const owner = this.address.toB256();
42783
+ request.inputs.forEach((input) => {
43013
42784
  const isResource = "amount" in input;
43014
42785
  if (isResource) {
43015
42786
  const isCoin2 = "owner" in input;
43016
42787
  if (isCoin2) {
43017
42788
  const assetId = String(input.assetId);
43018
- if (quantitiesDict[assetId]) {
42789
+ if (input.owner === owner && quantitiesDict[assetId]) {
43019
42790
  const amount = bn(input.amount);
43020
42791
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42792
+ cachedUtxos.push(input.id);
43021
42793
  }
43022
- } else if (input.amount && quantitiesDict[BaseAssetId]) {
43023
- quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42794
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
42795
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
42796
+ cachedMessages.push(input.nonce);
43024
42797
  }
43025
42798
  }
43026
42799
  });
@@ -43035,23 +42808,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43035
42808
  });
43036
42809
  const needsToBeFunded = missingQuantities.length;
43037
42810
  if (needsToBeFunded) {
43038
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
43039
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
43040
- txRequest.addResources(resources);
43041
- }
43042
- txRequest.shiftPredicateData();
43043
- txRequest.updatePredicateGasUsed(estimatedPredicates);
43044
- const requestToBeReEstimate = clone_default(txRequest);
43045
- if (addedSignatures) {
43046
- Array.from({ length: addedSignatures }).forEach(
43047
- () => requestToBeReEstimate.addEmptyWitness()
43048
- );
42811
+ const resources = await this.getResourcesToSpend(missingQuantities, {
42812
+ messages: cachedMessages,
42813
+ utxos: cachedUtxos
42814
+ });
42815
+ request.addResources(resources);
43049
42816
  }
43050
- const { maxFee } = await this.provider.estimateTxGasAndFee({
43051
- transactionRequest: requestToBeReEstimate
43052
- });
43053
- txRequest.maxFee = maxFee;
43054
- return txRequest;
43055
42817
  }
43056
42818
  /**
43057
42819
  * A helper that creates a transfer transaction request and returns it.
@@ -43059,25 +42821,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43059
42821
  * @param destination - The address of the destination.
43060
42822
  * @param amount - The amount of coins to transfer.
43061
42823
  * @param assetId - The asset ID of the coins to transfer.
43062
- * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
42824
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43063
42825
  * @returns A promise that resolves to the prepared transaction request.
43064
42826
  */
43065
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
43066
- const request = new ScriptTransactionRequest(txParams);
43067
- request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
43068
- const txCost = await this.provider.getTransactionCost(request, {
42827
+ async createTransfer(destination, amount, assetId, txParams = {}) {
42828
+ const { minGasPrice } = this.provider.getGasConfig();
42829
+ const baseAssetId = this.provider.getBaseAssetId();
42830
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42831
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
42832
+ const request = new ScriptTransactionRequest(params);
42833
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
42834
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
43069
42835
  estimateTxDependencies: true,
43070
42836
  resourcesOwner: this
43071
42837
  });
43072
- if ("gasLimit" in txParams) {
43073
- this.validateGas({
43074
- gasUsed: txCost.gasUsed,
43075
- gasLimit: request.gasLimit
43076
- });
43077
- }
43078
- request.gasLimit = txCost.gasUsed;
43079
- request.maxFee = txCost.maxFee;
43080
- await this.fund(request, txCost);
42838
+ request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
42839
+ request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
42840
+ this.validateGas({
42841
+ gasUsed,
42842
+ gasPrice: request.gasPrice,
42843
+ gasLimit: request.gasLimit,
42844
+ minGasPrice
42845
+ });
42846
+ await this.fund(request, requiredQuantities, maxFee);
42847
+ request.updatePredicateInputs(estimatedInputs);
43081
42848
  return request;
43082
42849
  }
43083
42850
  /**
@@ -43089,14 +42856,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43089
42856
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
43090
42857
  * @returns A promise that resolves to the transaction response.
43091
42858
  */
43092
- async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
42859
+ async transfer(destination, amount, assetId, txParams = {}) {
43093
42860
  if (bn(amount).lte(0)) {
43094
42861
  throw new FuelError(
43095
42862
  ErrorCode.INVALID_TRANSFER_AMOUNT,
43096
42863
  "Transfer amount must be a positive number."
43097
42864
  );
43098
42865
  }
43099
- const request = await this.createTransfer(destination, amount, assetId, txParams);
42866
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42867
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
43100
42868
  return this.sendTransaction(request, { estimateTxDependencies: false });
43101
42869
  }
43102
42870
  /**
@@ -43108,7 +42876,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43108
42876
  * @param txParams - The optional transaction parameters.
43109
42877
  * @returns A promise that resolves to the transaction response.
43110
42878
  */
43111
- async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
42879
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
43112
42880
  if (bn(amount).lte(0)) {
43113
42881
  throw new FuelError(
43114
42882
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -43116,30 +42884,33 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43116
42884
  );
43117
42885
  }
43118
42886
  const contractAddress = Address.fromAddressOrString(contractId);
42887
+ const { minGasPrice } = this.provider.getGasConfig();
42888
+ const baseAssetId = this.provider.getBaseAssetId();
42889
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42890
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
43119
42891
  const { script, scriptData } = await assembleTransferToContractScript({
43120
42892
  hexlifiedContractId: contractAddress.toB256(),
43121
42893
  amountToTransfer: bn(amount),
43122
- assetId
42894
+ assetId: assetIdToTransfer
43123
42895
  });
43124
42896
  const request = new ScriptTransactionRequest({
43125
- ...txParams,
42897
+ ...params,
43126
42898
  script,
43127
42899
  scriptData
43128
42900
  });
43129
42901
  request.addContractInputAndOutput(contractAddress);
43130
- const txCost = await this.provider.getTransactionCost(request, {
43131
- resourcesOwner: this,
43132
- quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
42902
+ const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
42903
+ request,
42904
+ [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
42905
+ );
42906
+ request.gasLimit = bn(params.gasLimit ?? gasUsed);
42907
+ this.validateGas({
42908
+ gasUsed,
42909
+ gasPrice: request.gasPrice,
42910
+ gasLimit: request.gasLimit,
42911
+ minGasPrice
43133
42912
  });
43134
- if (txParams.gasLimit) {
43135
- this.validateGas({
43136
- gasUsed: txCost.gasUsed,
43137
- gasLimit: request.gasLimit
43138
- });
43139
- }
43140
- request.gasLimit = txCost.gasUsed;
43141
- request.maxFee = txCost.maxFee;
43142
- await this.fund(request, txCost);
42913
+ await this.fund(request, requiredQuantities, maxFee);
43143
42914
  return this.sendTransaction(request);
43144
42915
  }
43145
42916
  /**
@@ -43151,6 +42922,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43151
42922
  * @returns A promise that resolves to the transaction response.
43152
42923
  */
43153
42924
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42925
+ const { minGasPrice } = this.provider.getGasConfig();
42926
+ const baseAssetId = this.provider.getBaseAssetId();
43154
42927
  const recipientAddress = Address.fromAddressOrString(recipient);
43155
42928
  const recipientDataArray = arrayify(
43156
42929
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -43163,19 +42936,26 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43163
42936
  ...recipientDataArray,
43164
42937
  ...amountDataArray
43165
42938
  ]);
43166
- const params = { script, ...txParams };
42939
+ const params = {
42940
+ script,
42941
+ gasPrice: minGasPrice,
42942
+ baseAssetId,
42943
+ ...txParams
42944
+ };
43167
42945
  const request = new ScriptTransactionRequest(params);
43168
- const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
43169
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
43170
- if (txParams.gasLimit) {
43171
- this.validateGas({
43172
- gasUsed: txCost.gasUsed,
43173
- gasLimit: request.gasLimit
43174
- });
43175
- }
43176
- request.maxFee = txCost.maxFee;
43177
- request.gasLimit = txCost.gasUsed;
43178
- await this.fund(request, txCost);
42946
+ const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
42947
+ const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
42948
+ request,
42949
+ forwardingQuantities
42950
+ );
42951
+ request.gasLimit = bn(params.gasLimit ?? gasUsed);
42952
+ this.validateGas({
42953
+ gasUsed,
42954
+ gasPrice: request.gasPrice,
42955
+ gasLimit: request.gasLimit,
42956
+ minGasPrice
42957
+ });
42958
+ await this.fund(request, requiredQuantities, maxFee);
43179
42959
  return this.sendTransaction(request);
43180
42960
  }
43181
42961
  async signMessage(message) {
@@ -43233,7 +43013,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43233
43013
  }
43234
43014
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
43235
43015
  }
43236
- validateGas({ gasUsed, gasLimit }) {
43016
+ validateGas({
43017
+ gasUsed,
43018
+ gasPrice,
43019
+ gasLimit,
43020
+ minGasPrice
43021
+ }) {
43022
+ if (minGasPrice.gt(gasPrice)) {
43023
+ throw new FuelError(
43024
+ ErrorCode.GAS_PRICE_TOO_LOW,
43025
+ `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
43026
+ );
43027
+ }
43237
43028
  if (gasUsed.gt(gasLimit)) {
43238
43029
  throw new FuelError(
43239
43030
  ErrorCode.GAS_LIMIT_TOO_LOW,
@@ -44822,7 +44613,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44822
44613
  * @param transactionRequestLike - The transaction request to send.
44823
44614
  * @returns A promise that resolves to the TransactionResponse object.
44824
44615
  */
44825
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
44616
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
44826
44617
  const transactionRequest = transactionRequestify(transactionRequestLike);
44827
44618
  if (estimateTxDependencies) {
44828
44619
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -48100,8 +47891,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48100
47891
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
48101
47892
  request.inputs?.forEach((input) => {
48102
47893
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
48103
- input.predicate = hexlify(this.bytes);
48104
- input.predicateData = hexlify(this.getPredicateData(policies.length));
47894
+ input.predicate = this.bytes;
47895
+ input.predicateData = this.getPredicateData(policies.length);
48105
47896
  }
48106
47897
  });
48107
47898
  return request;
@@ -48115,8 +47906,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48115
47906
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
48116
47907
  * @returns A promise that resolves to the prepared transaction request.
48117
47908
  */
48118
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
48119
- return super.createTransfer(destination, amount, assetId, txParams);
47909
+ async createTransfer(destination, amount, assetId, txParams = {}) {
47910
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
47911
+ const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
47912
+ return this.populateTransactionPredicateData(request);
48120
47913
  }
48121
47914
  /**
48122
47915
  * Sends a transaction with the populated predicate data.
@@ -48124,9 +47917,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48124
47917
  * @param transactionRequestLike - The transaction request-like object.
48125
47918
  * @returns A promise that resolves to the transaction response.
48126
47919
  */
48127
- sendTransaction(transactionRequestLike) {
48128
- const transactionRequest = transactionRequestify(transactionRequestLike);
48129
- return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
47920
+ sendTransaction(transactionRequestLike, options) {
47921
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47922
+ return super.sendTransaction(transactionRequest, options);
48130
47923
  }
48131
47924
  /**
48132
47925
  * Simulates a transaction with the populated predicate data.
@@ -48135,8 +47928,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48135
47928
  * @returns A promise that resolves to the call result.
48136
47929
  */
48137
47930
  simulateTransaction(transactionRequestLike) {
48138
- const transactionRequest = transactionRequestify(transactionRequestLike);
48139
- return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
47931
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47932
+ return super.simulateTransaction(transactionRequest);
48140
47933
  }
48141
47934
  getPredicateData(policiesLength) {
48142
47935
  if (!this.predicateData.length) {
@@ -48182,25 +47975,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
48182
47975
  predicateInterface: abiInterface
48183
47976
  };
48184
47977
  }
48185
- /**
48186
- * Retrieves resources satisfying the spend query for the account.
48187
- *
48188
- * @param quantities - IDs of coins to exclude.
48189
- * @param excludedIds - IDs of resources to be excluded from the query.
48190
- * @returns A promise that resolves to an array of Resources.
48191
- */
48192
- async getResourcesToSpend(quantities, excludedIds) {
48193
- const resources = await this.provider.getResourcesToSpend(
48194
- this.address,
48195
- quantities,
48196
- excludedIds
48197
- );
48198
- return resources.map((resource) => ({
48199
- ...resource,
48200
- predicate: hexlify(this.bytes),
48201
- paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
48202
- }));
48203
- }
48204
47978
  /**
48205
47979
  * Sets the configurable constants for the predicate.
48206
47980
  *