@fuel-ts/account 0.92.1 → 0.93.0

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.
@@ -3026,7 +3026,7 @@
3026
3026
  }
3027
3027
  return chk;
3028
3028
  }
3029
- function convert2(data, inBits, outBits, pad3) {
3029
+ function convert2(data, inBits, outBits, pad) {
3030
3030
  let value = 0;
3031
3031
  let bits = 0;
3032
3032
  const maxV = (1 << outBits) - 1;
@@ -3039,7 +3039,7 @@
3039
3039
  result.push(value >> bits & maxV);
3040
3040
  }
3041
3041
  }
3042
- if (pad3) {
3042
+ if (pad) {
3043
3043
  if (bits > 0) {
3044
3044
  result.push(value << outBits - bits & maxV);
3045
3045
  }
@@ -29703,10 +29703,10 @@ spurious results.`);
29703
29703
  );
29704
29704
  };
29705
29705
  }
29706
- var compose2 = function() {
29706
+ var compose = function() {
29707
29707
  return seq.apply(null, slice(arguments).reverse());
29708
29708
  };
29709
- var _concat2 = Array.prototype.concat;
29709
+ var _concat = Array.prototype.concat;
29710
29710
  var concatLimit = function(coll, limit, iteratee, callback) {
29711
29711
  callback = callback || noop;
29712
29712
  var _iteratee = wrapAsync(iteratee);
@@ -29720,7 +29720,7 @@ spurious results.`);
29720
29720
  var result = [];
29721
29721
  for (var i = 0; i < mapResults.length; i++) {
29722
29722
  if (mapResults[i]) {
29723
- result = _concat2.apply(result, mapResults[i]);
29723
+ result = _concat.apply(result, mapResults[i]);
29724
29724
  }
29725
29725
  }
29726
29726
  return callback(err, result);
@@ -29931,12 +29931,12 @@ spurious results.`);
29931
29931
  }
29932
29932
  });
29933
29933
  }
29934
- function _filter2(eachfn, coll, iteratee, callback) {
29934
+ function _filter(eachfn, coll, iteratee, callback) {
29935
29935
  var filter2 = isArrayLike(coll) ? filterArray : filterGeneric;
29936
29936
  filter2(eachfn, coll, wrapAsync(iteratee), callback || noop);
29937
29937
  }
29938
- var filter = doParallel(_filter2);
29939
- var filterLimit = doParallelLimit(_filter2);
29938
+ var filter = doParallel(_filter);
29939
+ var filterLimit = doParallelLimit(_filter);
29940
29940
  var filterSeries = doLimit(filterLimit, 1);
29941
29941
  function forever(fn, errback) {
29942
29942
  var done = onlyOnce(errback || noop);
@@ -30148,7 +30148,7 @@ spurious results.`);
30148
30148
  return results;
30149
30149
  }
30150
30150
  function reject$1(eachfn, arr, iteratee, callback) {
30151
- _filter2(eachfn, arr, function(value, cb) {
30151
+ _filter(eachfn, arr, function(value, cb) {
30152
30152
  iteratee(value, function(err, v) {
30153
30153
  cb(err, !v);
30154
30154
  });
@@ -30369,7 +30369,7 @@ spurious results.`);
30369
30369
  auto,
30370
30370
  autoInject,
30371
30371
  cargo,
30372
- compose: compose2,
30372
+ compose,
30373
30373
  concat: concat2,
30374
30374
  concatLimit,
30375
30375
  concatSeries,
@@ -30471,7 +30471,7 @@ spurious results.`);
30471
30471
  exports2.auto = auto;
30472
30472
  exports2.autoInject = autoInject;
30473
30473
  exports2.cargo = cargo;
30474
- exports2.compose = compose2;
30474
+ exports2.compose = compose;
30475
30475
  exports2.concat = concat2;
30476
30476
  exports2.concatLimit = concatLimit;
30477
30477
  exports2.concatSeries = concatSeries;
@@ -31843,16 +31843,16 @@ spurious results.`);
31843
31843
  this.blockLen = this.iHash.blockLen;
31844
31844
  this.outputLen = this.iHash.outputLen;
31845
31845
  const blockLen = this.blockLen;
31846
- const pad3 = new Uint8Array(blockLen);
31847
- pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
31848
- for (let i = 0; i < pad3.length; i++)
31849
- pad3[i] ^= 54;
31850
- this.iHash.update(pad3);
31846
+ const pad = new Uint8Array(blockLen);
31847
+ pad.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
31848
+ for (let i = 0; i < pad.length; i++)
31849
+ pad[i] ^= 54;
31850
+ this.iHash.update(pad);
31851
31851
  this.oHash = hash4.create();
31852
- for (let i = 0; i < pad3.length; i++)
31853
- pad3[i] ^= 54 ^ 92;
31854
- this.oHash.update(pad3);
31855
- pad3.fill(0);
31852
+ for (let i = 0; i < pad.length; i++)
31853
+ pad[i] ^= 54 ^ 92;
31854
+ this.oHash.update(pad);
31855
+ pad.fill(0);
31856
31856
  }
31857
31857
  update(buf) {
31858
31858
  exists(this);
@@ -32297,9 +32297,9 @@ spurious results.`);
32297
32297
  // ../versions/dist/index.mjs
32298
32298
  function getBuiltinVersions() {
32299
32299
  return {
32300
- FORC: "0.61.2",
32300
+ FORC: "0.62.0",
32301
32301
  FUEL_CORE: "0.31.0",
32302
- FUELS: "0.92.1"
32302
+ FUELS: "0.93.0"
32303
32303
  };
32304
32304
  }
32305
32305
  function parseVersion(version) {
@@ -32406,11 +32406,12 @@ This unreleased fuel-core build may include features and updates not yet support
32406
32406
  ErrorCode2["INVALID_TRANSACTION_INPUT"] = "invalid-transaction-input";
32407
32407
  ErrorCode2["INVALID_TRANSACTION_OUTPUT"] = "invalid-transaction-output";
32408
32408
  ErrorCode2["INVALID_TRANSACTION_STATUS"] = "invalid-transaction-status";
32409
- ErrorCode2["INVALID_TRANSACTION_TYPE"] = "invalid-transaction-type";
32409
+ ErrorCode2["UNSUPPORTED_TRANSACTION_TYPE"] = "unsupported-transaction-type";
32410
32410
  ErrorCode2["TRANSACTION_ERROR"] = "transaction-error";
32411
32411
  ErrorCode2["INVALID_POLICY_TYPE"] = "invalid-policy-type";
32412
32412
  ErrorCode2["DUPLICATED_POLICY"] = "duplicated-policy";
32413
32413
  ErrorCode2["TRANSACTION_SQUEEZED_OUT"] = "transaction-squeezed-out";
32414
+ ErrorCode2["CONTRACT_SIZE_EXCEEDS_LIMIT"] = "contract-size-exceeds-limit";
32414
32415
  ErrorCode2["INVALID_RECEIPT_TYPE"] = "invalid-receipt-type";
32415
32416
  ErrorCode2["INVALID_WORD_LIST"] = "invalid-word-list";
32416
32417
  ErrorCode2["INVALID_MNEMONIC"] = "invalid-mnemonic";
@@ -35426,12 +35427,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
35426
35427
  }
35427
35428
  };
35428
35429
 
35429
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
35430
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isPlaceholder.js
35430
35431
  function _isPlaceholder(a) {
35431
35432
  return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
35432
35433
  }
35433
35434
 
35434
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
35435
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry1.js
35435
35436
  function _curry1(fn) {
35436
35437
  return function f1(a) {
35437
35438
  if (arguments.length === 0 || _isPlaceholder(a)) {
@@ -35442,7 +35443,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35442
35443
  };
35443
35444
  }
35444
35445
 
35445
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry2.js
35446
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry2.js
35446
35447
  function _curry2(fn) {
35447
35448
  return function f2(a, b) {
35448
35449
  switch (arguments.length) {
@@ -35462,7 +35463,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35462
35463
  };
35463
35464
  }
35464
35465
 
35465
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry3.js
35466
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry3.js
35466
35467
  function _curry3(fn) {
35467
35468
  return function f3(a, b, c) {
35468
35469
  switch (arguments.length) {
@@ -35498,48 +35499,28 @@ If you are attempting to transform a hex value, please make sure it is being pas
35498
35499
  };
35499
35500
  }
35500
35501
 
35501
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
35502
- var isArray_default = Array.isArray || function _isArray(val) {
35503
- return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
35504
- };
35505
-
35506
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_has.js
35502
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_has.js
35507
35503
  function _has(prop, obj) {
35508
35504
  return Object.prototype.hasOwnProperty.call(obj, prop);
35509
35505
  }
35510
35506
 
35511
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
35507
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/type.js
35512
35508
  var type = /* @__PURE__ */ _curry1(function type2(val) {
35513
35509
  return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
35514
35510
  });
35515
35511
  var type_default = type;
35516
35512
 
35517
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
35518
- var pad = function pad2(n) {
35519
- return (n < 10 ? "0" : "") + n;
35520
- };
35521
- var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
35522
- return d.toISOString();
35523
- } : function _toISOString3(d) {
35524
- 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";
35525
- };
35526
-
35527
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isObject.js
35513
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isObject.js
35528
35514
  function _isObject(x) {
35529
35515
  return Object.prototype.toString.call(x) === "[object Object]";
35530
35516
  }
35531
35517
 
35532
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
35533
- var isInteger_default = Number.isInteger || function _isInteger(n) {
35534
- return n << 0 === n;
35535
- };
35536
-
35537
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
35518
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_cloneRegExp.js
35538
35519
  function _cloneRegExp(pattern) {
35539
35520
  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" : ""));
35540
35521
  }
35541
35522
 
35542
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
35523
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_clone.js
35543
35524
  function _clone(value, deep, map) {
35544
35525
  map || (map = new _ObjectMap());
35545
35526
  if (_isPrimitive(value)) {
@@ -35562,7 +35543,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35562
35543
  case "Object":
35563
35544
  return copy(Object.create(Object.getPrototypeOf(value)));
35564
35545
  case "Array":
35565
- return copy([]);
35546
+ return copy(Array(value.length));
35566
35547
  case "Date":
35567
35548
  return new Date(value.valueOf());
35568
35549
  case "RegExp":
@@ -35593,8 +35574,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
35593
35574
  this.length = 0;
35594
35575
  }
35595
35576
  _ObjectMap2.prototype.set = function(key, value) {
35596
- const hashedKey = this.hash(key);
35597
- let bucket = this.map[hashedKey];
35577
+ var hashedKey = this.hash(key);
35578
+ var bucket = this.map[hashedKey];
35598
35579
  if (!bucket) {
35599
35580
  this.map[hashedKey] = bucket = [];
35600
35581
  }
@@ -35602,7 +35583,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35602
35583
  this.length += 1;
35603
35584
  };
35604
35585
  _ObjectMap2.prototype.hash = function(key) {
35605
- let hashedKey = [];
35586
+ var hashedKey = [];
35606
35587
  for (var value in key) {
35607
35588
  hashedKey.push(Object.prototype.toString.call(key[value]));
35608
35589
  }
@@ -35610,10 +35591,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
35610
35591
  };
35611
35592
  _ObjectMap2.prototype.get = function(key) {
35612
35593
  if (this.length <= 180) {
35613
- for (const p in this.map) {
35614
- const bucket2 = this.map[p];
35615
- for (let i = 0; i < bucket2.length; i += 1) {
35616
- const element = bucket2[i];
35594
+ for (var p in this.map) {
35595
+ var bucket = this.map[p];
35596
+ for (var i = 0; i < bucket.length; i += 1) {
35597
+ var element = bucket[i];
35617
35598
  if (element[0] === key) {
35618
35599
  return element[1];
35619
35600
  }
@@ -35621,13 +35602,13 @@ If you are attempting to transform a hex value, please make sure it is being pas
35621
35602
  }
35622
35603
  return;
35623
35604
  }
35624
- const hashedKey = this.hash(key);
35625
- const bucket = this.map[hashedKey];
35605
+ var hashedKey = this.hash(key);
35606
+ var bucket = this.map[hashedKey];
35626
35607
  if (!bucket) {
35627
35608
  return;
35628
35609
  }
35629
- for (let i = 0; i < bucket.length; i += 1) {
35630
- const element = bucket[i];
35610
+ for (var i = 0; i < bucket.length; i += 1) {
35611
+ var element = bucket[i];
35631
35612
  if (element[0] === key) {
35632
35613
  return element[1];
35633
35614
  }
@@ -35636,13 +35617,13 @@ If you are attempting to transform a hex value, please make sure it is being pas
35636
35617
  return _ObjectMap2;
35637
35618
  }();
35638
35619
 
35639
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
35620
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/clone.js
35640
35621
  var clone = /* @__PURE__ */ _curry1(function clone2(value) {
35641
35622
  return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
35642
35623
  });
35643
35624
  var clone_default = clone;
35644
35625
 
35645
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/mergeWithKey.js
35626
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeWithKey.js
35646
35627
  var mergeWithKey = /* @__PURE__ */ _curry3(function mergeWithKey2(fn, l, r) {
35647
35628
  var result = {};
35648
35629
  var k;
@@ -35662,7 +35643,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35662
35643
  });
35663
35644
  var mergeWithKey_default = mergeWithKey;
35664
35645
 
35665
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/mergeDeepWithKey.js
35646
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepWithKey.js
35666
35647
  var mergeDeepWithKey = /* @__PURE__ */ _curry3(function mergeDeepWithKey2(fn, lObj, rObj) {
35667
35648
  return mergeWithKey_default(function(k, lVal, rVal) {
35668
35649
  if (_isObject(lVal) && _isObject(rVal)) {
@@ -35674,7 +35655,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35674
35655
  });
35675
35656
  var mergeDeepWithKey_default = mergeDeepWithKey;
35676
35657
 
35677
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/mergeDeepRight.js
35658
+ // ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js
35678
35659
  var mergeDeepRight = /* @__PURE__ */ _curry2(function mergeDeepRight2(lObj, rObj) {
35679
35660
  return mergeDeepWithKey_default(function(k, lVal, rVal) {
35680
35661
  return rVal;
@@ -35682,9 +35663,6 @@ If you are attempting to transform a hex value, please make sure it is being pas
35682
35663
  });
35683
35664
  var mergeDeepRight_default = mergeDeepRight;
35684
35665
 
35685
- // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
35686
- var hasProtoTrim = typeof String.prototype.trim === "function";
35687
-
35688
35666
  // src/providers/coin-quantity.ts
35689
35667
  var coinQuantityfy = (coinQuantityLike) => {
35690
35668
  let assetId;
@@ -36526,8 +36504,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
36526
36504
  }
36527
36505
  default: {
36528
36506
  throw new FuelError(
36529
- ErrorCode.INVALID_TRANSACTION_TYPE,
36530
- `Invalid transaction type: ${type3}`
36507
+ ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
36508
+ `Unsupported transaction type: ${type3}`
36531
36509
  );
36532
36510
  }
36533
36511
  }
@@ -36553,8 +36531,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
36553
36531
  }
36554
36532
  default: {
36555
36533
  throw new FuelError(
36556
- ErrorCode.INVALID_TRANSACTION_TYPE,
36557
- `Invalid transaction type: ${type3}`
36534
+ ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
36535
+ `Unsupported transaction type: ${type3}`
36558
36536
  );
36559
36537
  }
36560
36538
  }
@@ -36960,8 +36938,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
36960
36938
  }
36961
36939
  default: {
36962
36940
  throw new FuelError(
36963
- ErrorCode.INVALID_TRANSACTION_TYPE,
36964
- `Invalid transaction type: ${type3}`
36941
+ ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
36942
+ `Unsupported transaction type: ${type3}`
36965
36943
  );
36966
36944
  }
36967
36945
  }
@@ -36995,8 +36973,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
36995
36973
  }
36996
36974
  default: {
36997
36975
  throw new FuelError(
36998
- ErrorCode.INVALID_TRANSACTION_TYPE,
36999
- `Invalid transaction type: ${type3}`
36976
+ ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
36977
+ `Unsupported transaction type: ${type3}`
37000
36978
  );
37001
36979
  }
37002
36980
  }
@@ -37127,10 +37105,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
37127
37105
  sum += a.length;
37128
37106
  }
37129
37107
  const res = new Uint8Array(sum);
37130
- for (let i = 0, pad3 = 0; i < arrays.length; i++) {
37108
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
37131
37109
  const a = arrays[i];
37132
- res.set(a, pad3);
37133
- pad3 += a.length;
37110
+ res.set(a, pad);
37111
+ pad += a.length;
37134
37112
  }
37135
37113
  return res;
37136
37114
  }
@@ -43041,7 +43019,10 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43041
43019
  return CreateTransactionRequest.from(obj);
43042
43020
  }
43043
43021
  default: {
43044
- throw new FuelError(ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type3}.`);
43022
+ throw new FuelError(
43023
+ ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
43024
+ `Unsupported transaction type: ${type3}.`
43025
+ );
43045
43026
  }
43046
43027
  }
43047
43028
  };
@@ -43230,8 +43211,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43230
43211
  return "Script" /* Script */;
43231
43212
  default:
43232
43213
  throw new FuelError(
43233
- ErrorCode.INVALID_TRANSACTION_TYPE,
43234
- `Invalid transaction type: ${transactionType}.`
43214
+ ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
43215
+ `Unsupported transaction type: ${transactionType}.`
43235
43216
  );
43236
43217
  }
43237
43218
  }
@@ -43973,24 +43954,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43973
43954
  };
43974
43955
  }
43975
43956
 
43976
- // src/providers/utils/merge-quantities.ts
43977
- var mergeQuantities = (...coinQuantities) => {
43978
- const resultMap = {};
43979
- function addToMap({ amount, assetId }) {
43980
- if (resultMap[assetId]) {
43981
- resultMap[assetId] = resultMap[assetId].add(amount);
43982
- } else {
43983
- resultMap[assetId] = amount;
43984
- }
43985
- }
43986
- coinQuantities.forEach((arr) => arr.forEach(addToMap));
43987
- return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
43988
- };
43989
-
43990
43957
  // src/providers/provider.ts
43991
43958
  var MAX_RETRIES = 10;
43992
43959
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
43993
43960
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
43961
+ var DEFAULT_UTXOS_CACHE_TTL = 2e4;
43994
43962
  var processGqlChain = (chain) => {
43995
43963
  const { name, daHeight, consensusParameters, latestBlock } = chain;
43996
43964
  const {
@@ -44080,7 +44048,16 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44080
44048
  this.options = { ...this.options, ...options };
44081
44049
  this.url = url;
44082
44050
  this.operations = this.createOperations();
44083
- this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
44051
+ const { cacheUtxo } = this.options;
44052
+ if (isDefined(cacheUtxo)) {
44053
+ if (cacheUtxo !== -1) {
44054
+ this.cache = new MemoryCache(cacheUtxo);
44055
+ } else {
44056
+ this.cache = void 0;
44057
+ }
44058
+ } else {
44059
+ this.cache = new MemoryCache(DEFAULT_UTXOS_CACHE_TTL);
44060
+ }
44084
44061
  }
44085
44062
  /** @hidden */
44086
44063
  static clearChainAndNodeCaches() {
@@ -44322,9 +44299,8 @@ Supported fuel-core version: ${supportedVersion}.`
44322
44299
  * @returns A promise that resolves to the transaction response object.
44323
44300
  */
44324
44301
  // #region Provider-sendTransaction
44325
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution = false } = {}) {
44302
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
44326
44303
  const transactionRequest = transactionRequestify(transactionRequestLike);
44327
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs);
44328
44304
  if (estimateTxDependencies) {
44329
44305
  await this.estimateTxDependencies(transactionRequest);
44330
44306
  }
@@ -44333,27 +44309,10 @@ Supported fuel-core version: ${supportedVersion}.`
44333
44309
  if (transactionRequest.type === TransactionType.Script) {
44334
44310
  abis = transactionRequest.abis;
44335
44311
  }
44336
- if (awaitExecution) {
44337
- const subscription = this.operations.submitAndAwait({ encodedTransaction });
44338
- for await (const { submitAndAwait } of subscription) {
44339
- if (submitAndAwait.type === "SqueezedOutStatus") {
44340
- throw new FuelError(
44341
- ErrorCode.TRANSACTION_SQUEEZED_OUT,
44342
- `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
44343
- );
44344
- }
44345
- if (submitAndAwait.type !== "SubmittedStatus") {
44346
- break;
44347
- }
44348
- }
44349
- const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
44350
- const response = new TransactionResponse(transactionId2, this, abis);
44351
- await response.fetch();
44352
- return response;
44353
- }
44354
44312
  const {
44355
44313
  submit: { id: transactionId }
44356
44314
  } = await this.operations.submit({ encodedTransaction });
44315
+ __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs);
44357
44316
  return new TransactionResponse(transactionId, this, abis);
44358
44317
  }
44359
44318
  /**
@@ -44632,6 +44591,8 @@ Supported fuel-core version: ${supportedVersion}.`
44632
44591
  return { receipts: callResult[0].receipts };
44633
44592
  }
44634
44593
  /**
44594
+ * @hidden
44595
+ *
44635
44596
  * Returns a transaction cost to enable user
44636
44597
  * to set gasLimit and also reserve balance amounts
44637
44598
  * on the transaction.
@@ -44641,20 +44602,13 @@ Supported fuel-core version: ${supportedVersion}.`
44641
44602
  *
44642
44603
  * @returns A promise that resolves to the transaction cost object.
44643
44604
  */
44644
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
44605
+ async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
44645
44606
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
44646
44607
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
44647
- const baseAssetId = this.getBaseAssetId();
44648
44608
  const updateMaxFee = txRequestClone.maxFee.eq(0);
44649
- const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
44650
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
44651
- txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
44652
44609
  if (isScriptTransaction) {
44653
44610
  txRequestClone.gasLimit = bn(0);
44654
44611
  }
44655
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
44656
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
44657
- }
44658
44612
  const signedRequest = clone_default(txRequestClone);
44659
44613
  let addedSignatures = 0;
44660
44614
  if (signatureCallback && isScriptTransaction) {
@@ -44690,7 +44644,6 @@ Supported fuel-core version: ${supportedVersion}.`
44690
44644
  }));
44691
44645
  }
44692
44646
  return {
44693
- requiredQuantities: allQuantities,
44694
44647
  receipts,
44695
44648
  gasUsed,
44696
44649
  gasPrice,
@@ -44706,34 +44659,6 @@ Supported fuel-core version: ${supportedVersion}.`
44706
44659
  updateMaxFee
44707
44660
  };
44708
44661
  }
44709
- /**
44710
- * Get the required quantities and associated resources for a transaction.
44711
- *
44712
- * @param owner - address to add resources from.
44713
- * @param transactionRequestLike - transaction request to populate resources for.
44714
- * @param quantitiesToContract - quantities for the contract (optional).
44715
- *
44716
- * @returns a promise resolving to the required quantities for the transaction.
44717
- */
44718
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
44719
- const ownerAddress = Address.fromAddressOrString(owner);
44720
- const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
44721
- const transactionCost = await this.getTransactionCost(transactionRequest, {
44722
- quantitiesToContract
44723
- });
44724
- transactionRequest.addResources(
44725
- await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
44726
- );
44727
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
44728
- quantitiesToContract
44729
- });
44730
- const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
44731
- return {
44732
- resources,
44733
- requiredQuantities,
44734
- ...txCost
44735
- };
44736
- }
44737
44662
  /**
44738
44663
  * Returns coins for the given owner.
44739
44664
  *
@@ -45356,6 +45281,20 @@ Supported fuel-core version: ${supportedVersion}.`
45356
45281
  ];
45357
45282
  var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
45358
45283
 
45284
+ // src/providers/utils/merge-quantities.ts
45285
+ var mergeQuantities = (...coinQuantities) => {
45286
+ const resultMap = {};
45287
+ function addToMap({ amount, assetId }) {
45288
+ if (resultMap[assetId]) {
45289
+ resultMap[assetId] = resultMap[assetId].add(amount);
45290
+ } else {
45291
+ resultMap[assetId] = amount;
45292
+ }
45293
+ }
45294
+ coinQuantities.forEach((arr) => arr.forEach(addToMap));
45295
+ return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
45296
+ };
45297
+
45359
45298
  // src/utils/formatTransferToContractScriptData.ts
45360
45299
  var asm = __toESM(require_node());
45361
45300
  var formatTransferToContractScriptData = (params) => {
@@ -45693,9 +45632,8 @@ Supported fuel-core version: ${supportedVersion}.`
45693
45632
  scriptData
45694
45633
  });
45695
45634
  request.addContractInputAndOutput(contractAddress);
45696
- const txCost = await this.provider.getTransactionCost(request, {
45697
- resourcesOwner: this,
45698
- quantitiesToContract: [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
45635
+ const txCost = await this.getTransactionCost(request, {
45636
+ quantities: [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
45699
45637
  });
45700
45638
  request = this.validateGasLimitAndMaxFee({
45701
45639
  transactionRequest: request,
@@ -45730,8 +45668,8 @@ Supported fuel-core version: ${supportedVersion}.`
45730
45668
  const params = { script, ...txParams };
45731
45669
  const baseAssetId = this.provider.getBaseAssetId();
45732
45670
  let request = new ScriptTransactionRequest(params);
45733
- const quantitiesToContract = [{ amount: bn(amount), assetId: baseAssetId }];
45734
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
45671
+ const quantities = [{ amount: bn(amount), assetId: baseAssetId }];
45672
+ const txCost = await this.getTransactionCost(request, { quantities });
45735
45673
  request = this.validateGasLimitAndMaxFee({
45736
45674
  transactionRequest: request,
45737
45675
  gasUsed: txCost.gasUsed,
@@ -45741,6 +45679,34 @@ Supported fuel-core version: ${supportedVersion}.`
45741
45679
  await this.fund(request, txCost);
45742
45680
  return this.sendTransaction(request);
45743
45681
  }
45682
+ /**
45683
+ * Returns a transaction cost to enable user
45684
+ * to set gasLimit and also reserve balance amounts
45685
+ * on the transaction.
45686
+ *
45687
+ * @param transactionRequestLike - The transaction request object.
45688
+ * @param transactionCostParams - The transaction cost parameters (optional).
45689
+ *
45690
+ * @returns A promise that resolves to the transaction cost object.
45691
+ */
45692
+ async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
45693
+ const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
45694
+ const baseAssetId = this.provider.getBaseAssetId();
45695
+ const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
45696
+ const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
45697
+ const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: bn("100000000000000000") }];
45698
+ const resources = this.generateFakeResources(
45699
+ mergeQuantities(requiredQuantities, transactionFeeForDryRun)
45700
+ );
45701
+ txRequestClone.addResources(resources);
45702
+ const txCost = await this.provider.getTransactionCost(txRequestClone, {
45703
+ signatureCallback
45704
+ });
45705
+ return {
45706
+ ...txCost,
45707
+ requiredQuantities
45708
+ };
45709
+ }
45744
45710
  /**
45745
45711
  * Sign a message from the account via the connector.
45746
45712
  *
@@ -45777,7 +45743,7 @@ Supported fuel-core version: ${supportedVersion}.`
45777
45743
  * @param sendTransactionParams - The provider send transaction parameters (optional).
45778
45744
  * @returns A promise that resolves to the transaction response.
45779
45745
  */
45780
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
45746
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
45781
45747
  if (this._connector) {
45782
45748
  return this.provider.getTransactionResponse(
45783
45749
  await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
@@ -45788,7 +45754,6 @@ Supported fuel-core version: ${supportedVersion}.`
45788
45754
  await this.provider.estimateTxDependencies(transactionRequest);
45789
45755
  }
45790
45756
  return this.provider.sendTransaction(transactionRequest, {
45791
- awaitExecution,
45792
45757
  estimateTxDependencies: false
45793
45758
  });
45794
45759
  }
@@ -45833,9 +45798,7 @@ Supported fuel-core version: ${supportedVersion}.`
45833
45798
  /** @hidden * */
45834
45799
  async estimateAndFundTransaction(transactionRequest, txParams) {
45835
45800
  let request = transactionRequest;
45836
- const txCost = await this.provider.getTransactionCost(request, {
45837
- resourcesOwner: this
45838
- });
45801
+ const txCost = await this.getTransactionCost(request);
45839
45802
  request = this.validateGasLimitAndMaxFee({
45840
45803
  transactionRequest: request,
45841
45804
  gasUsed: txCost.gasUsed,
@@ -45934,10 +45897,10 @@ Supported fuel-core version: ${supportedVersion}.`
45934
45897
  sum += a.length;
45935
45898
  }
45936
45899
  const res = new Uint8Array(sum);
45937
- for (let i = 0, pad3 = 0; i < arrays.length; i++) {
45900
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
45938
45901
  const a = arrays[i];
45939
- res.set(a, pad3);
45940
- pad3 += a.length;
45902
+ res.set(a, pad);
45903
+ pad += a.length;
45941
45904
  }
45942
45905
  return res;
45943
45906
  }
@@ -46229,16 +46192,16 @@ Supported fuel-core version: ${supportedVersion}.`
46229
46192
  this.blockLen = this.iHash.blockLen;
46230
46193
  this.outputLen = this.iHash.outputLen;
46231
46194
  const blockLen = this.blockLen;
46232
- const pad3 = new Uint8Array(blockLen);
46233
- pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
46234
- for (let i = 0; i < pad3.length; i++)
46235
- pad3[i] ^= 54;
46236
- this.iHash.update(pad3);
46195
+ const pad = new Uint8Array(blockLen);
46196
+ pad.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
46197
+ for (let i = 0; i < pad.length; i++)
46198
+ pad[i] ^= 54;
46199
+ this.iHash.update(pad);
46237
46200
  this.oHash = hash4.create();
46238
- for (let i = 0; i < pad3.length; i++)
46239
- pad3[i] ^= 54 ^ 92;
46240
- this.oHash.update(pad3);
46241
- pad3.fill(0);
46201
+ for (let i = 0; i < pad.length; i++)
46202
+ pad[i] ^= 54 ^ 92;
46203
+ this.oHash.update(pad);
46204
+ pad.fill(0);
46242
46205
  }
46243
46206
  update(buf) {
46244
46207
  exists2(this);
@@ -47863,17 +47826,16 @@ Supported fuel-core version: ${supportedVersion}.`
47863
47826
  *
47864
47827
  * @param transactionRequestLike - The transaction request to send.
47865
47828
  * @param estimateTxDependencies - Whether to estimate the transaction dependencies.
47866
- * @param awaitExecution - Whether to wait for the transaction to be executed.
47867
47829
  * @returns A promise that resolves to the TransactionResponse object.
47868
47830
  */
47869
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
47831
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = false } = {}) {
47870
47832
  const transactionRequest = transactionRequestify(transactionRequestLike);
47871
47833
  if (estimateTxDependencies) {
47872
47834
  await this.provider.estimateTxDependencies(transactionRequest);
47873
47835
  }
47874
47836
  return this.provider.sendTransaction(
47875
47837
  await this.populateTransactionWitnessesSignature(transactionRequest),
47876
- { awaitExecution, estimateTxDependencies: false }
47838
+ { estimateTxDependencies: false }
47877
47839
  );
47878
47840
  }
47879
47841
  /**
@@ -50607,11 +50569,12 @@ Supported fuel-core version: ${supportedVersion}.`
50607
50569
  }
50608
50570
  })
50609
50571
  );
50610
- const txCost = await genesisWallet.provider.getTransactionCost(request);
50572
+ const txCost = await genesisWallet.getTransactionCost(request);
50611
50573
  request.gasLimit = txCost.gasUsed;
50612
50574
  request.maxFee = txCost.maxFee;
50613
50575
  await genesisWallet.fund(request, txCost);
50614
- await genesisWallet.sendTransaction(request, { awaitExecution: true });
50576
+ const submit = await genesisWallet.sendTransaction(request);
50577
+ await submit.waitForResult();
50615
50578
  };
50616
50579
 
50617
50580
  // src/test-utils/generateTestWallet.ts
@@ -50627,7 +50590,7 @@ Supported fuel-core version: ${supportedVersion}.`
50627
50590
  var import_crypto18 = __require("crypto");
50628
50591
  var import_fs = __require("fs");
50629
50592
  var import_os = __toESM(__require("os"));
50630
- var import_path7 = __toESM(__require("path"));
50593
+ var import_path = __toESM(__require("path"));
50631
50594
  var import_portfinder = __toESM(require_portfinder());
50632
50595
  var getFlagValueFromArgs = (args, flag) => {
50633
50596
  const flagIndex = args.indexOf(flag);
@@ -50695,7 +50658,9 @@ Supported fuel-core version: ${supportedVersion}.`
50695
50658
  "--snapshot",
50696
50659
  "--consensus-key",
50697
50660
  "--db-type",
50698
- "--poa-instant"
50661
+ "--poa-instant",
50662
+ "--min-gas-price",
50663
+ "--native-executor-version"
50699
50664
  ]);
50700
50665
  const snapshotDir = getFlagValueFromArgs(args, "--snapshot");
50701
50666
  const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || defaultConsensusKey;
@@ -50704,6 +50669,7 @@ Supported fuel-core version: ${supportedVersion}.`
50704
50669
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
50705
50670
  const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
50706
50671
  const nativeExecutorVersion = getFlagValueFromArgs(args, "--native-executor-version") || "0";
50672
+ const minGasPrice = getFlagValueFromArgs(args, "--min-gas-price") || "1";
50707
50673
  const graphQLStartSubstring = "Binding GraphQL provider to";
50708
50674
  const command = fuelCorePath || "fuel-core";
50709
50675
  const ipToUse = ip || "0.0.0.0";
@@ -50716,7 +50682,7 @@ Supported fuel-core version: ${supportedVersion}.`
50716
50682
  let snapshotDirToUse;
50717
50683
  const prefix = basePath || import_os.default.tmpdir();
50718
50684
  const suffix = basePath ? "" : (0, import_crypto18.randomUUID)();
50719
- const tempDir = import_path7.default.join(prefix, ".fuels", suffix, "snapshotDir");
50685
+ const tempDir = import_path.default.join(prefix, ".fuels", suffix, "snapshotDir");
50720
50686
  if (snapshotDir) {
50721
50687
  snapshotDirToUse = snapshotDir;
50722
50688
  } else {
@@ -50724,10 +50690,10 @@ Supported fuel-core version: ${supportedVersion}.`
50724
50690
  (0, import_fs.mkdirSync)(tempDir, { recursive: true });
50725
50691
  }
50726
50692
  const { metadata } = snapshotConfig;
50727
- const metadataPath = import_path7.default.join(tempDir, "metadata.json");
50728
- const chainConfigPath = import_path7.default.join(tempDir, metadata.chain_config);
50729
- const stateConfigPath = import_path7.default.join(tempDir, metadata.table_encoding.Json.filepath);
50730
- const stateTransitionPath = import_path7.default.join(tempDir, "state_transition_bytecode.wasm");
50693
+ const metadataPath = import_path.default.join(tempDir, "metadata.json");
50694
+ const chainConfigPath = import_path.default.join(tempDir, metadata.chain_config);
50695
+ const stateConfigPath = import_path.default.join(tempDir, metadata.table_encoding.Json.filepath);
50696
+ const stateTransitionPath = import_path.default.join(tempDir, "state_transition_bytecode.wasm");
50731
50697
  (0, import_fs.writeFileSync)(chainConfigPath, JSON.stringify(snapshotConfig.chainConfig), "utf8");
50732
50698
  (0, import_fs.writeFileSync)(stateConfigPath, getFinalStateConfigJSON(snapshotConfig), "utf8");
50733
50699
  (0, import_fs.writeFileSync)(metadataPath, JSON.stringify(metadata), "utf8");
@@ -50742,7 +50708,7 @@ Supported fuel-core version: ${supportedVersion}.`
50742
50708
  ["--ip", ipToUse],
50743
50709
  ["--port", portToUse],
50744
50710
  useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path", tempDir],
50745
- ["--min-gas-price", "1"],
50711
+ ["--min-gas-price", minGasPrice],
50746
50712
  poaInstant ? ["--poa-instant", "true"] : [],
50747
50713
  ["--native-executor-version", nativeExecutorVersion],
50748
50714
  ["--consensus-key", consensusKey],
@@ -50833,10 +50799,11 @@ Supported fuel-core version: ${supportedVersion}.`
50833
50799
  };
50834
50800
  var launchNodeAndGetWallets = async ({
50835
50801
  launchNodeOptions,
50802
+ providerOptions,
50836
50803
  walletCount = 10
50837
50804
  } = {}) => {
50838
50805
  const { cleanup: closeNode, ip, port } = await launchNode(launchNodeOptions || {});
50839
- const provider = await Provider.create(`http://${ip}:${port}/v1/graphql`);
50806
+ const provider = await Provider.create(`http://${ip}:${port}/v1/graphql`, providerOptions);
50840
50807
  const wallets = await generateWallets(walletCount, provider);
50841
50808
  const cleanup = () => {
50842
50809
  closeNode();