@fuel-ts/account 0.0.0-rc-2021-20240410132122 → 0.0.0-rc-2034-20240410133013
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.
- package/README.md +1 -1
- package/dist/account.d.ts +4 -5
- package/dist/account.d.ts.map +1 -1
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +1 -1
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +1 -1
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +1 -1
- package/dist/configs.mjs.map +1 -1
- package/dist/index.global.js +560 -793
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +523 -760
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +404 -640
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +2 -11
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +328 -894
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +2 -4
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/message.d.ts +1 -3
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +31 -36
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +2 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +25 -8
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -3
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +2 -8
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +1059 -1506
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +519 -735
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +413 -629
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +17 -17
package/dist/index.global.js
CHANGED
@@ -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
|
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
|
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(
|
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 ?
|
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.
|
28956
|
-
FUEL_CORE: "0.
|
28955
|
+
FORC: "0.49.3",
|
28956
|
+
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.79.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -31516,182 +31516,32 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31516
31516
|
function toBytes3(value, bytesPadding) {
|
31517
31517
|
return bn(value).toBytes(bytesPadding);
|
31518
31518
|
}
|
31519
|
-
|
31520
|
-
|
31521
|
-
function _isPlaceholder(a) {
|
31522
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31523
|
-
}
|
31524
|
-
|
31525
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31526
|
-
function _curry1(fn) {
|
31527
|
-
return function f1(a) {
|
31528
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31529
|
-
return f1;
|
31530
|
-
} else {
|
31531
|
-
return fn.apply(this, arguments);
|
31532
|
-
}
|
31533
|
-
};
|
31534
|
-
}
|
31535
|
-
|
31536
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31537
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
31538
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31539
|
-
};
|
31540
|
-
|
31541
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31542
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31543
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31544
|
-
});
|
31545
|
-
var type_default = type;
|
31546
|
-
|
31547
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31548
|
-
var pad = function pad2(n) {
|
31549
|
-
return (n < 10 ? "0" : "") + n;
|
31550
|
-
};
|
31551
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31552
|
-
return d.toISOString();
|
31553
|
-
} : function _toISOString3(d) {
|
31554
|
-
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
31555
|
-
};
|
31556
|
-
|
31557
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31558
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31559
|
-
return n << 0 === n;
|
31560
|
-
};
|
31561
|
-
|
31562
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31563
|
-
function _cloneRegExp(pattern) {
|
31564
|
-
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
31519
|
+
function max(...numbers) {
|
31520
|
+
return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
|
31565
31521
|
}
|
31566
31522
|
|
31567
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31568
|
-
function _clone(value, deep, map) {
|
31569
|
-
map || (map = new _ObjectMap());
|
31570
|
-
if (_isPrimitive(value)) {
|
31571
|
-
return value;
|
31572
|
-
}
|
31573
|
-
var copy = function copy2(copiedValue) {
|
31574
|
-
var cachedCopy = map.get(value);
|
31575
|
-
if (cachedCopy) {
|
31576
|
-
return cachedCopy;
|
31577
|
-
}
|
31578
|
-
map.set(value, copiedValue);
|
31579
|
-
for (var key in value) {
|
31580
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31581
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31582
|
-
}
|
31583
|
-
}
|
31584
|
-
return copiedValue;
|
31585
|
-
};
|
31586
|
-
switch (type_default(value)) {
|
31587
|
-
case "Object":
|
31588
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
31589
|
-
case "Array":
|
31590
|
-
return copy([]);
|
31591
|
-
case "Date":
|
31592
|
-
return new Date(value.valueOf());
|
31593
|
-
case "RegExp":
|
31594
|
-
return _cloneRegExp(value);
|
31595
|
-
case "Int8Array":
|
31596
|
-
case "Uint8Array":
|
31597
|
-
case "Uint8ClampedArray":
|
31598
|
-
case "Int16Array":
|
31599
|
-
case "Uint16Array":
|
31600
|
-
case "Int32Array":
|
31601
|
-
case "Uint32Array":
|
31602
|
-
case "Float32Array":
|
31603
|
-
case "Float64Array":
|
31604
|
-
case "BigInt64Array":
|
31605
|
-
case "BigUint64Array":
|
31606
|
-
return value.slice();
|
31607
|
-
default:
|
31608
|
-
return value;
|
31609
|
-
}
|
31610
|
-
}
|
31611
|
-
function _isPrimitive(param) {
|
31612
|
-
var type3 = typeof param;
|
31613
|
-
return param == null || type3 != "object" && type3 != "function";
|
31614
|
-
}
|
31615
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
31616
|
-
function _ObjectMap2() {
|
31617
|
-
this.map = {};
|
31618
|
-
this.length = 0;
|
31619
|
-
}
|
31620
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
31621
|
-
const hashedKey = this.hash(key);
|
31622
|
-
let bucket = this.map[hashedKey];
|
31623
|
-
if (!bucket) {
|
31624
|
-
this.map[hashedKey] = bucket = [];
|
31625
|
-
}
|
31626
|
-
bucket.push([key, value]);
|
31627
|
-
this.length += 1;
|
31628
|
-
};
|
31629
|
-
_ObjectMap2.prototype.hash = function(key) {
|
31630
|
-
let hashedKey = [];
|
31631
|
-
for (var value in key) {
|
31632
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31633
|
-
}
|
31634
|
-
return hashedKey.join();
|
31635
|
-
};
|
31636
|
-
_ObjectMap2.prototype.get = function(key) {
|
31637
|
-
if (this.length <= 180) {
|
31638
|
-
for (const p in this.map) {
|
31639
|
-
const bucket2 = this.map[p];
|
31640
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
31641
|
-
const element = bucket2[i];
|
31642
|
-
if (element[0] === key) {
|
31643
|
-
return element[1];
|
31644
|
-
}
|
31645
|
-
}
|
31646
|
-
}
|
31647
|
-
return;
|
31648
|
-
}
|
31649
|
-
const hashedKey = this.hash(key);
|
31650
|
-
const bucket = this.map[hashedKey];
|
31651
|
-
if (!bucket) {
|
31652
|
-
return;
|
31653
|
-
}
|
31654
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
31655
|
-
const element = bucket[i];
|
31656
|
-
if (element[0] === key) {
|
31657
|
-
return element[1];
|
31658
|
-
}
|
31659
|
-
}
|
31660
|
-
};
|
31661
|
-
return _ObjectMap2;
|
31662
|
-
}();
|
31663
|
-
|
31664
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31665
|
-
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31666
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31667
|
-
});
|
31668
|
-
var clone_default = clone;
|
31669
|
-
|
31670
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31671
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31672
|
-
|
31673
31523
|
// src/providers/coin-quantity.ts
|
31674
31524
|
var coinQuantityfy = (coinQuantityLike) => {
|
31675
31525
|
let assetId;
|
31676
31526
|
let amount;
|
31677
|
-
let
|
31527
|
+
let max2;
|
31678
31528
|
if (Array.isArray(coinQuantityLike)) {
|
31679
31529
|
amount = coinQuantityLike[0];
|
31680
31530
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31681
|
-
|
31531
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31682
31532
|
} else {
|
31683
31533
|
amount = coinQuantityLike.amount;
|
31684
31534
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31685
|
-
|
31535
|
+
max2 = coinQuantityLike.max ?? void 0;
|
31686
31536
|
}
|
31687
31537
|
const bnAmount = bn(amount);
|
31688
31538
|
return {
|
31689
31539
|
assetId: hexlify(assetId),
|
31690
31540
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31691
|
-
max:
|
31541
|
+
max: max2 ? bn(max2) : void 0
|
31692
31542
|
};
|
31693
31543
|
};
|
31694
|
-
var
|
31544
|
+
var addAmountToAsset = (params) => {
|
31695
31545
|
const { amount, assetId } = params;
|
31696
31546
|
const coinQuantities = [...params.coinQuantities];
|
31697
31547
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31783,9 +31633,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31783
31633
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31784
31634
|
var MAX_BYTES = 2 ** 32 - 1;
|
31785
31635
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31786
|
-
|
31636
|
+
WORD_SIZE + // Tx size
|
31787
31637
|
// Asset ID/Balance coin input pairs
|
31788
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE)
|
31638
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31789
31639
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31790
31640
|
WORD_SIZE + // Gas limit
|
31791
31641
|
WORD_SIZE + // Script size
|
@@ -31803,6 +31653,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31803
31653
|
ASSET_ID_LEN + // Asset id
|
31804
31654
|
TX_POINTER_LEN + // TxPointer
|
31805
31655
|
WORD_SIZE + // Witnesses index
|
31656
|
+
WORD_SIZE + // Maturity
|
31806
31657
|
WORD_SIZE + // Predicate size
|
31807
31658
|
WORD_SIZE + // Predicate data size
|
31808
31659
|
WORD_SIZE;
|
@@ -32124,7 +31975,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32124
31975
|
constructor(name, coders) {
|
32125
31976
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32126
31977
|
const encodedValueSize = Object.values(coders).reduce(
|
32127
|
-
(
|
31978
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32128
31979
|
0
|
32129
31980
|
);
|
32130
31981
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32828,7 +32679,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32828
32679
|
constructor(name, coders) {
|
32829
32680
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32830
32681
|
const encodedValueSize = Object.values(coders).reduce(
|
32831
|
-
(
|
32682
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32832
32683
|
0
|
32833
32684
|
);
|
32834
32685
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33530,19 +33381,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33530
33381
|
encode(value) {
|
33531
33382
|
const parts = [];
|
33532
33383
|
parts.push(new B256Coder().encode(value.txID));
|
33533
|
-
parts.push(new NumberCoder("
|
33384
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33534
33385
|
parts.push(new B256Coder().encode(value.owner));
|
33535
33386
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33536
33387
|
parts.push(new B256Coder().encode(value.assetId));
|
33537
33388
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33538
|
-
parts.push(new NumberCoder("
|
33389
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33390
|
+
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33539
33391
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33540
|
-
parts.push(new
|
33541
|
-
parts.push(new
|
33542
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33543
|
-
parts.push(
|
33544
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33545
|
-
);
|
33392
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33393
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33394
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33395
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33546
33396
|
return concat(parts);
|
33547
33397
|
}
|
33548
33398
|
decode(data, offset) {
|
@@ -33550,7 +33400,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33550
33400
|
let o = offset;
|
33551
33401
|
[decoded, o] = new B256Coder().decode(data, o);
|
33552
33402
|
const txID = decoded;
|
33553
|
-
[decoded, o] = new NumberCoder("
|
33403
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33554
33404
|
const outputIndex = decoded;
|
33555
33405
|
[decoded, o] = new B256Coder().decode(data, o);
|
33556
33406
|
const owner = decoded;
|
@@ -33560,17 +33410,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33560
33410
|
const assetId = decoded;
|
33561
33411
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33562
33412
|
const txPointer = decoded;
|
33563
|
-
[decoded, o] = new NumberCoder("
|
33413
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33564
33414
|
const witnessIndex = Number(decoded);
|
33415
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33416
|
+
const maturity = decoded;
|
33565
33417
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33566
33418
|
const predicateGasUsed = decoded;
|
33567
|
-
[decoded, o] = new
|
33419
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33568
33420
|
const predicateLength = decoded;
|
33569
|
-
[decoded, o] = new
|
33421
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33570
33422
|
const predicateDataLength = decoded;
|
33571
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33423
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33572
33424
|
const predicate = decoded;
|
33573
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33425
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33574
33426
|
const predicateData = decoded;
|
33575
33427
|
return [
|
33576
33428
|
{
|
@@ -33582,6 +33434,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33582
33434
|
assetId,
|
33583
33435
|
txPointer,
|
33584
33436
|
witnessIndex,
|
33437
|
+
maturity,
|
33585
33438
|
predicateGasUsed,
|
33586
33439
|
predicateLength,
|
33587
33440
|
predicateDataLength,
|
@@ -33599,7 +33452,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33599
33452
|
encode(value) {
|
33600
33453
|
const parts = [];
|
33601
33454
|
parts.push(new B256Coder().encode(value.txID));
|
33602
|
-
parts.push(new NumberCoder("
|
33455
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33603
33456
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33604
33457
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33605
33458
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33611,7 +33464,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33611
33464
|
let o = offset;
|
33612
33465
|
[decoded, o] = new B256Coder().decode(data, o);
|
33613
33466
|
const txID = decoded;
|
33614
|
-
[decoded, o] = new NumberCoder("
|
33467
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33615
33468
|
const outputIndex = decoded;
|
33616
33469
|
[decoded, o] = new B256Coder().decode(data, o);
|
33617
33470
|
const balanceRoot = decoded;
|
@@ -33660,16 +33513,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33660
33513
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33661
33514
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33662
33515
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33663
|
-
parts.push(new NumberCoder("
|
33516
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33664
33517
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33665
|
-
parts.push(new
|
33666
|
-
parts.push(new
|
33667
|
-
parts.push(new
|
33518
|
+
parts.push(new NumberCoder("u32").encode(data.length));
|
33519
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33520
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33668
33521
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33669
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33670
|
-
parts.push(
|
33671
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33672
|
-
);
|
33522
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33523
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33673
33524
|
return concat(parts);
|
33674
33525
|
}
|
33675
33526
|
static decodeData(messageData) {
|
@@ -33689,21 +33540,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33689
33540
|
const amount = decoded;
|
33690
33541
|
[decoded, o] = new B256Coder().decode(data, o);
|
33691
33542
|
const nonce = decoded;
|
33692
|
-
[decoded, o] = new NumberCoder("
|
33543
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33693
33544
|
const witnessIndex = Number(decoded);
|
33694
33545
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33695
33546
|
const predicateGasUsed = decoded;
|
33696
33547
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33697
33548
|
const dataLength2 = decoded;
|
33698
|
-
[decoded, o] = new
|
33549
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33699
33550
|
const predicateLength = decoded;
|
33700
|
-
[decoded, o] = new
|
33551
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33701
33552
|
const predicateDataLength = decoded;
|
33702
33553
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33703
33554
|
const messageData = decoded;
|
33704
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33555
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33705
33556
|
const predicate = decoded;
|
33706
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33557
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33707
33558
|
const predicateData = decoded;
|
33708
33559
|
return [
|
33709
33560
|
{
|
@@ -34015,7 +33866,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34015
33866
|
}
|
34016
33867
|
};
|
34017
33868
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
34018
|
-
PolicyType2[PolicyType2["
|
33869
|
+
PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
|
34019
33870
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
34020
33871
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
34021
33872
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -34063,9 +33914,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34063
33914
|
let o = offset;
|
34064
33915
|
const policies = [];
|
34065
33916
|
if (policyTypes & 1) {
|
34066
|
-
const [
|
33917
|
+
const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
34067
33918
|
o = nextOffset;
|
34068
|
-
policies.push({ type: 1, data:
|
33919
|
+
policies.push({ type: 1, data: gasPrice });
|
34069
33920
|
}
|
34070
33921
|
if (policyTypes & 2) {
|
34071
33922
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34297,15 +34148,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34297
34148
|
encode(value) {
|
34298
34149
|
const parts = [];
|
34299
34150
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34300
|
-
parts.push(new
|
34301
|
-
parts.push(new
|
34302
|
-
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34151
|
+
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34152
|
+
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34303
34153
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34304
|
-
parts.push(new NumberCoder("
|
34305
|
-
parts.push(new NumberCoder("
|
34306
|
-
parts.push(new NumberCoder("
|
34307
|
-
parts.push(new
|
34308
|
-
parts.push(new ByteArrayCoder(value.
|
34154
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34155
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34156
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34157
|
+
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34158
|
+
parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
|
34159
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
|
34309
34160
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34310
34161
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34311
34162
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34317,23 +34168,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34317
34168
|
let o = offset;
|
34318
34169
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34319
34170
|
const scriptGasLimit = decoded;
|
34320
|
-
[decoded, o] = new
|
34321
|
-
const receiptsRoot = decoded;
|
34322
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34171
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34323
34172
|
const scriptLength = decoded;
|
34324
|
-
[decoded, o] = new
|
34173
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34325
34174
|
const scriptDataLength = decoded;
|
34326
34175
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34327
34176
|
const policyTypes = decoded;
|
34328
|
-
[decoded, o] = new NumberCoder("
|
34177
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34329
34178
|
const inputsCount = decoded;
|
34330
|
-
[decoded, o] = new NumberCoder("
|
34179
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34331
34180
|
const outputsCount = decoded;
|
34332
|
-
[decoded, o] = new NumberCoder("
|
34181
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34333
34182
|
const witnessesCount = decoded;
|
34334
|
-
[decoded, o] = new
|
34183
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34184
|
+
const receiptsRoot = decoded;
|
34185
|
+
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34335
34186
|
const script = decoded;
|
34336
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength
|
34187
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34337
34188
|
const scriptData = decoded;
|
34338
34189
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34339
34190
|
const policies = decoded;
|
@@ -34371,19 +34222,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34371
34222
|
}
|
34372
34223
|
encode(value) {
|
34373
34224
|
const parts = [];
|
34374
|
-
parts.push(new NumberCoder("
|
34375
|
-
parts.push(new
|
34376
|
-
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34225
|
+
parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
|
34226
|
+
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34377
34227
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34378
|
-
parts.push(new NumberCoder("u16").encode(value.
|
34379
|
-
parts.push(new NumberCoder("
|
34380
|
-
parts.push(new NumberCoder("
|
34228
|
+
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
34229
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34230
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34231
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34232
|
+
parts.push(new B256Coder().encode(value.salt));
|
34233
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34381
34234
|
parts.push(
|
34382
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount
|
34383
|
-
value.storageSlots
|
34384
|
-
)
|
34235
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
|
34385
34236
|
);
|
34386
|
-
parts.push(new PoliciesCoder().encode(value.policies));
|
34387
34237
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34388
34238
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34389
34239
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34392,27 +34242,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34392
34242
|
decode(data, offset) {
|
34393
34243
|
let decoded;
|
34394
34244
|
let o = offset;
|
34395
|
-
[decoded, o] = new NumberCoder("
|
34245
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34246
|
+
const bytecodeLength = decoded;
|
34247
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34396
34248
|
const bytecodeWitnessIndex = decoded;
|
34397
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
34398
|
-
const salt = decoded;
|
34399
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34400
|
-
const storageSlotsCount = decoded;
|
34401
34249
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34402
34250
|
const policyTypes = decoded;
|
34403
34251
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34252
|
+
const storageSlotsCount = decoded;
|
34253
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34404
34254
|
const inputsCount = decoded;
|
34405
|
-
[decoded, o] = new NumberCoder("
|
34255
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34406
34256
|
const outputsCount = decoded;
|
34407
|
-
[decoded, o] = new NumberCoder("
|
34257
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34408
34258
|
const witnessesCount = decoded;
|
34409
|
-
[decoded, o] = new
|
34410
|
-
|
34411
|
-
o
|
34412
|
-
);
|
34413
|
-
const storageSlots = decoded;
|
34259
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34260
|
+
const salt = decoded;
|
34414
34261
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34415
34262
|
const policies = decoded;
|
34263
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34264
|
+
const storageSlots = decoded;
|
34416
34265
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34417
34266
|
const inputs = decoded;
|
34418
34267
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34422,6 +34271,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34422
34271
|
return [
|
34423
34272
|
{
|
34424
34273
|
type: 1,
|
34274
|
+
bytecodeLength,
|
34425
34275
|
bytecodeWitnessIndex,
|
34426
34276
|
policyTypes,
|
34427
34277
|
storageSlotsCount,
|
@@ -34450,7 +34300,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34450
34300
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34451
34301
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34452
34302
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34453
|
-
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34454
34303
|
return concat(parts);
|
34455
34304
|
}
|
34456
34305
|
decode(data, offset) {
|
@@ -34466,8 +34315,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34466
34315
|
const mintAmount = decoded;
|
34467
34316
|
[decoded, o] = new B256Coder().decode(data, o);
|
34468
34317
|
const mintAssetId = decoded;
|
34469
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34470
|
-
const gasPrice = decoded;
|
34471
34318
|
return [
|
34472
34319
|
{
|
34473
34320
|
type: 2,
|
@@ -34475,8 +34322,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34475
34322
|
inputContract,
|
34476
34323
|
outputContract,
|
34477
34324
|
mintAmount,
|
34478
|
-
mintAssetId
|
34479
|
-
gasPrice
|
34325
|
+
mintAssetId
|
34480
34326
|
},
|
34481
34327
|
o
|
34482
34328
|
];
|
@@ -34783,6 +34629,159 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34783
34629
|
// src/providers/provider.ts
|
34784
34630
|
var import_graphql_request = __toESM(require_dist2());
|
34785
34631
|
|
34632
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34633
|
+
function _isPlaceholder(a) {
|
34634
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34635
|
+
}
|
34636
|
+
|
34637
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34638
|
+
function _curry1(fn) {
|
34639
|
+
return function f1(a) {
|
34640
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34641
|
+
return f1;
|
34642
|
+
} else {
|
34643
|
+
return fn.apply(this, arguments);
|
34644
|
+
}
|
34645
|
+
};
|
34646
|
+
}
|
34647
|
+
|
34648
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34649
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
34650
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34651
|
+
};
|
34652
|
+
|
34653
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34654
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34655
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34656
|
+
});
|
34657
|
+
var type_default = type;
|
34658
|
+
|
34659
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34660
|
+
var pad = function pad2(n) {
|
34661
|
+
return (n < 10 ? "0" : "") + n;
|
34662
|
+
};
|
34663
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34664
|
+
return d.toISOString();
|
34665
|
+
} : function _toISOString3(d) {
|
34666
|
+
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";
|
34667
|
+
};
|
34668
|
+
|
34669
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34670
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34671
|
+
return n << 0 === n;
|
34672
|
+
};
|
34673
|
+
|
34674
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34675
|
+
function _cloneRegExp(pattern) {
|
34676
|
+
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" : ""));
|
34677
|
+
}
|
34678
|
+
|
34679
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34680
|
+
function _clone(value, deep, map) {
|
34681
|
+
map || (map = new _ObjectMap());
|
34682
|
+
if (_isPrimitive(value)) {
|
34683
|
+
return value;
|
34684
|
+
}
|
34685
|
+
var copy = function copy2(copiedValue) {
|
34686
|
+
var cachedCopy = map.get(value);
|
34687
|
+
if (cachedCopy) {
|
34688
|
+
return cachedCopy;
|
34689
|
+
}
|
34690
|
+
map.set(value, copiedValue);
|
34691
|
+
for (var key in value) {
|
34692
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34693
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34694
|
+
}
|
34695
|
+
}
|
34696
|
+
return copiedValue;
|
34697
|
+
};
|
34698
|
+
switch (type_default(value)) {
|
34699
|
+
case "Object":
|
34700
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
34701
|
+
case "Array":
|
34702
|
+
return copy([]);
|
34703
|
+
case "Date":
|
34704
|
+
return new Date(value.valueOf());
|
34705
|
+
case "RegExp":
|
34706
|
+
return _cloneRegExp(value);
|
34707
|
+
case "Int8Array":
|
34708
|
+
case "Uint8Array":
|
34709
|
+
case "Uint8ClampedArray":
|
34710
|
+
case "Int16Array":
|
34711
|
+
case "Uint16Array":
|
34712
|
+
case "Int32Array":
|
34713
|
+
case "Uint32Array":
|
34714
|
+
case "Float32Array":
|
34715
|
+
case "Float64Array":
|
34716
|
+
case "BigInt64Array":
|
34717
|
+
case "BigUint64Array":
|
34718
|
+
return value.slice();
|
34719
|
+
default:
|
34720
|
+
return value;
|
34721
|
+
}
|
34722
|
+
}
|
34723
|
+
function _isPrimitive(param) {
|
34724
|
+
var type3 = typeof param;
|
34725
|
+
return param == null || type3 != "object" && type3 != "function";
|
34726
|
+
}
|
34727
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
34728
|
+
function _ObjectMap2() {
|
34729
|
+
this.map = {};
|
34730
|
+
this.length = 0;
|
34731
|
+
}
|
34732
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
34733
|
+
const hashedKey = this.hash(key);
|
34734
|
+
let bucket = this.map[hashedKey];
|
34735
|
+
if (!bucket) {
|
34736
|
+
this.map[hashedKey] = bucket = [];
|
34737
|
+
}
|
34738
|
+
bucket.push([key, value]);
|
34739
|
+
this.length += 1;
|
34740
|
+
};
|
34741
|
+
_ObjectMap2.prototype.hash = function(key) {
|
34742
|
+
let hashedKey = [];
|
34743
|
+
for (var value in key) {
|
34744
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34745
|
+
}
|
34746
|
+
return hashedKey.join();
|
34747
|
+
};
|
34748
|
+
_ObjectMap2.prototype.get = function(key) {
|
34749
|
+
if (this.length <= 180) {
|
34750
|
+
for (const p in this.map) {
|
34751
|
+
const bucket2 = this.map[p];
|
34752
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
34753
|
+
const element = bucket2[i];
|
34754
|
+
if (element[0] === key) {
|
34755
|
+
return element[1];
|
34756
|
+
}
|
34757
|
+
}
|
34758
|
+
}
|
34759
|
+
return;
|
34760
|
+
}
|
34761
|
+
const hashedKey = this.hash(key);
|
34762
|
+
const bucket = this.map[hashedKey];
|
34763
|
+
if (!bucket) {
|
34764
|
+
return;
|
34765
|
+
}
|
34766
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
34767
|
+
const element = bucket[i];
|
34768
|
+
if (element[0] === key) {
|
34769
|
+
return element[1];
|
34770
|
+
}
|
34771
|
+
}
|
34772
|
+
};
|
34773
|
+
return _ObjectMap2;
|
34774
|
+
}();
|
34775
|
+
|
34776
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34777
|
+
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34778
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34779
|
+
});
|
34780
|
+
var clone_default = clone2;
|
34781
|
+
|
34782
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34783
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34784
|
+
|
34786
34785
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34787
34786
|
var __assign = function() {
|
34788
34787
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37950,10 +37949,14 @@ spurious results.`);
|
|
37950
37949
|
// src/providers/__generated__/operations.ts
|
37951
37950
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37952
37951
|
fragment receiptFragment on Receipt {
|
37953
|
-
|
37952
|
+
contract {
|
37953
|
+
id
|
37954
|
+
}
|
37954
37955
|
pc
|
37955
37956
|
is
|
37956
|
-
to
|
37957
|
+
to {
|
37958
|
+
id
|
37959
|
+
}
|
37957
37960
|
toAddress
|
37958
37961
|
amount
|
37959
37962
|
assetId
|
@@ -37991,16 +37994,10 @@ spurious results.`);
|
|
37991
37994
|
id
|
37992
37995
|
}
|
37993
37996
|
time
|
37994
|
-
receipts {
|
37995
|
-
...receiptFragment
|
37996
|
-
}
|
37997
37997
|
programState {
|
37998
37998
|
returnType
|
37999
37999
|
data
|
38000
38000
|
}
|
38001
|
-
receipts {
|
38002
|
-
...receiptFragment
|
38003
|
-
}
|
38004
38001
|
}
|
38005
38002
|
... on FailureStatus {
|
38006
38003
|
block {
|
@@ -38008,24 +38005,26 @@ spurious results.`);
|
|
38008
38005
|
}
|
38009
38006
|
time
|
38010
38007
|
reason
|
38011
|
-
receipts {
|
38012
|
-
...receiptFragment
|
38013
|
-
}
|
38014
38008
|
}
|
38015
38009
|
... on SqueezedOutStatus {
|
38016
38010
|
reason
|
38017
38011
|
}
|
38018
38012
|
}
|
38019
|
-
|
38013
|
+
`;
|
38020
38014
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38021
38015
|
fragment transactionFragment on Transaction {
|
38022
38016
|
id
|
38023
38017
|
rawPayload
|
38018
|
+
gasPrice
|
38019
|
+
receipts {
|
38020
|
+
...receiptFragment
|
38021
|
+
}
|
38024
38022
|
status {
|
38025
38023
|
...transactionStatusFragment
|
38026
38024
|
}
|
38027
38025
|
}
|
38028
|
-
${
|
38026
|
+
${ReceiptFragmentFragmentDoc}
|
38027
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38029
38028
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38030
38029
|
fragment inputEstimatePredicatesFragment on Input {
|
38031
38030
|
... on InputCoin {
|
@@ -38043,46 +38042,6 @@ spurious results.`);
|
|
38043
38042
|
}
|
38044
38043
|
}
|
38045
38044
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38046
|
-
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38047
|
-
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38048
|
-
reason
|
38049
|
-
programState {
|
38050
|
-
returnType
|
38051
|
-
data
|
38052
|
-
}
|
38053
|
-
}
|
38054
|
-
`;
|
38055
|
-
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38056
|
-
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38057
|
-
programState {
|
38058
|
-
returnType
|
38059
|
-
data
|
38060
|
-
}
|
38061
|
-
}
|
38062
|
-
`;
|
38063
|
-
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38064
|
-
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38065
|
-
... on DryRunFailureStatus {
|
38066
|
-
...dryRunFailureStatusFragment
|
38067
|
-
}
|
38068
|
-
... on DryRunSuccessStatus {
|
38069
|
-
...dryRunSuccessStatusFragment
|
38070
|
-
}
|
38071
|
-
}
|
38072
|
-
${DryRunFailureStatusFragmentFragmentDoc}
|
38073
|
-
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38074
|
-
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38075
|
-
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38076
|
-
id
|
38077
|
-
status {
|
38078
|
-
...dryRunTransactionStatusFragment
|
38079
|
-
}
|
38080
|
-
receipts {
|
38081
|
-
...receiptFragment
|
38082
|
-
}
|
38083
|
-
}
|
38084
|
-
${DryRunTransactionStatusFragmentFragmentDoc}
|
38085
|
-
${ReceiptFragmentFragmentDoc}`;
|
38086
38045
|
var CoinFragmentFragmentDoc = lib_default2`
|
38087
38046
|
fragment coinFragment on Coin {
|
38088
38047
|
__typename
|
@@ -38090,6 +38049,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38090
38049
|
owner
|
38091
38050
|
amount
|
38092
38051
|
assetId
|
38052
|
+
maturity
|
38093
38053
|
blockCreated
|
38094
38054
|
txCreatedIdx
|
38095
38055
|
}
|
@@ -38134,6 +38094,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38134
38094
|
prevRoot
|
38135
38095
|
time
|
38136
38096
|
applicationHash
|
38097
|
+
messageReceiptRoot
|
38137
38098
|
messageReceiptCount
|
38138
38099
|
}
|
38139
38100
|
commitBlockHeader {
|
@@ -38145,6 +38106,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38145
38106
|
prevRoot
|
38146
38107
|
time
|
38147
38108
|
applicationHash
|
38109
|
+
messageReceiptRoot
|
38148
38110
|
messageReceiptCount
|
38149
38111
|
}
|
38150
38112
|
sender
|
@@ -38164,8 +38126,8 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38164
38126
|
var BlockFragmentFragmentDoc = lib_default2`
|
38165
38127
|
fragment blockFragment on Block {
|
38166
38128
|
id
|
38167
|
-
height
|
38168
38129
|
header {
|
38130
|
+
height
|
38169
38131
|
time
|
38170
38132
|
}
|
38171
38133
|
transactions {
|
@@ -38223,11 +38185,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38223
38185
|
`;
|
38224
38186
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38225
38187
|
fragment GasCostsFragment on GasCosts {
|
38226
|
-
version {
|
38227
|
-
... on Version {
|
38228
|
-
value
|
38229
|
-
}
|
38230
|
-
}
|
38231
38188
|
add
|
38232
38189
|
addi
|
38233
38190
|
aloc
|
@@ -38240,6 +38197,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38240
38197
|
cb
|
38241
38198
|
cfei
|
38242
38199
|
cfsi
|
38200
|
+
croo
|
38243
38201
|
div
|
38244
38202
|
divi
|
38245
38203
|
ecr1
|
@@ -38322,9 +38280,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38322
38280
|
ccp {
|
38323
38281
|
...DependentCostFragment
|
38324
38282
|
}
|
38325
|
-
croo {
|
38326
|
-
...DependentCostFragment
|
38327
|
-
}
|
38328
38283
|
csiz {
|
38329
38284
|
...DependentCostFragment
|
38330
38285
|
}
|
@@ -38384,11 +38339,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38384
38339
|
${DependentCostFragmentFragmentDoc}`;
|
38385
38340
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38386
38341
|
fragment consensusParametersFragment on ConsensusParameters {
|
38387
|
-
version {
|
38388
|
-
... on Version {
|
38389
|
-
value
|
38390
|
-
}
|
38391
|
-
}
|
38392
38342
|
txParams {
|
38393
38343
|
...TxParametersFragment
|
38394
38344
|
}
|
@@ -38448,9 +38398,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38448
38398
|
fragment nodeInfoFragment on NodeInfo {
|
38449
38399
|
utxoValidation
|
38450
38400
|
vmBacktrace
|
38401
|
+
minGasPrice
|
38451
38402
|
maxTx
|
38452
38403
|
maxDepth
|
38453
38404
|
nodeVersion
|
38405
|
+
peers {
|
38406
|
+
id
|
38407
|
+
addresses
|
38408
|
+
clientVersion
|
38409
|
+
blockHeight
|
38410
|
+
lastHeartbeatMs
|
38411
|
+
appScore
|
38412
|
+
}
|
38454
38413
|
}
|
38455
38414
|
`;
|
38456
38415
|
var GetVersionDocument = lib_default2`
|
@@ -38485,9 +38444,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38485
38444
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38486
38445
|
transaction(id: $transactionId) {
|
38487
38446
|
...transactionFragment
|
38447
|
+
receipts {
|
38448
|
+
...receiptFragment
|
38449
|
+
}
|
38488
38450
|
}
|
38489
38451
|
}
|
38490
|
-
${TransactionFragmentFragmentDoc}
|
38452
|
+
${TransactionFragmentFragmentDoc}
|
38453
|
+
${ReceiptFragmentFragmentDoc}`;
|
38491
38454
|
var GetTransactionsDocument = lib_default2`
|
38492
38455
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38493
38456
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38615,20 +38578,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38615
38578
|
}
|
38616
38579
|
}
|
38617
38580
|
${BalanceFragmentFragmentDoc}`;
|
38618
|
-
var GetLatestGasPriceDocument = lib_default2`
|
38619
|
-
query getLatestGasPrice {
|
38620
|
-
latestGasPrice {
|
38621
|
-
gasPrice
|
38622
|
-
}
|
38623
|
-
}
|
38624
|
-
`;
|
38625
|
-
var EstimateGasPriceDocument = lib_default2`
|
38626
|
-
query estimateGasPrice($blockHorizon: U32!) {
|
38627
|
-
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38628
|
-
gasPrice
|
38629
|
-
}
|
38630
|
-
}
|
38631
|
-
`;
|
38632
38581
|
var GetBalancesDocument = lib_default2`
|
38633
38582
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38634
38583
|
balances(
|
@@ -38683,12 +38632,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38683
38632
|
}
|
38684
38633
|
`;
|
38685
38634
|
var DryRunDocument = lib_default2`
|
38686
|
-
mutation dryRun($
|
38687
|
-
dryRun(
|
38688
|
-
...
|
38635
|
+
mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
|
38636
|
+
dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
|
38637
|
+
...receiptFragment
|
38689
38638
|
}
|
38690
38639
|
}
|
38691
|
-
${
|
38640
|
+
${ReceiptFragmentFragmentDoc}`;
|
38692
38641
|
var SubmitDocument = lib_default2`
|
38693
38642
|
mutation submit($encodedTransaction: HexString!) {
|
38694
38643
|
submit(tx: $encodedTransaction) {
|
@@ -38771,12 +38720,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38771
38720
|
getBalance(variables, options) {
|
38772
38721
|
return requester(GetBalanceDocument, variables, options);
|
38773
38722
|
},
|
38774
|
-
getLatestGasPrice(variables, options) {
|
38775
|
-
return requester(GetLatestGasPriceDocument, variables, options);
|
38776
|
-
},
|
38777
|
-
estimateGasPrice(variables, options) {
|
38778
|
-
return requester(EstimateGasPriceDocument, variables, options);
|
38779
|
-
},
|
38780
38723
|
getBalances(variables, options) {
|
38781
38724
|
return requester(GetBalancesDocument, variables, options);
|
38782
38725
|
},
|
@@ -38844,14 +38787,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38844
38787
|
let data;
|
38845
38788
|
let errors;
|
38846
38789
|
try {
|
38847
|
-
|
38848
|
-
({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
|
38790
|
+
({ data, errors } = JSON.parse(text.replace(/^data:/, "")));
|
38849
38791
|
} catch (e) {
|
38850
38792
|
throw new FuelError(
|
38851
38793
|
ErrorCode.STREAM_PARSING_ERROR,
|
38852
|
-
`Error while parsing stream data response: ${text}
|
38853
|
-
|
38854
|
-
Thrown error: ${e}`
|
38794
|
+
`Error while parsing stream data response: ${text}`
|
38855
38795
|
);
|
38856
38796
|
}
|
38857
38797
|
if (Array.isArray(errors)) {
|
@@ -38945,7 +38885,7 @@ Thrown error: ${e}`
|
|
38945
38885
|
return {
|
38946
38886
|
type: InputType.Coin,
|
38947
38887
|
txID: hexlify(arrayify(value.id).slice(0, 32)),
|
38948
|
-
outputIndex: toNumber2(arrayify(value.id).slice(32,
|
38888
|
+
outputIndex: toNumber2(arrayify(value.id).slice(32, 33)),
|
38949
38889
|
owner: hexlify(value.owner),
|
38950
38890
|
amount: bn(value.amount),
|
38951
38891
|
assetId: hexlify(value.assetId),
|
@@ -38954,9 +38894,10 @@ Thrown error: ${e}`
|
|
38954
38894
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38955
38895
|
},
|
38956
38896
|
witnessIndex: value.witnessIndex,
|
38897
|
+
maturity: value.maturity ?? 0,
|
38957
38898
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38958
|
-
predicateLength:
|
38959
|
-
predicateDataLength:
|
38899
|
+
predicateLength: predicate.length,
|
38900
|
+
predicateDataLength: predicateData.length,
|
38960
38901
|
predicate: hexlify(predicate),
|
38961
38902
|
predicateData: hexlify(predicateData)
|
38962
38903
|
};
|
@@ -38987,8 +38928,8 @@ Thrown error: ${e}`
|
|
38987
38928
|
nonce: hexlify(value.nonce),
|
38988
38929
|
witnessIndex: value.witnessIndex,
|
38989
38930
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38990
|
-
predicateLength:
|
38991
|
-
predicateDataLength:
|
38931
|
+
predicateLength: predicate.length,
|
38932
|
+
predicateDataLength: predicateData.length,
|
38992
38933
|
predicate: hexlify(predicate),
|
38993
38934
|
predicateData: hexlify(predicateData),
|
38994
38935
|
data: hexlify(data),
|
@@ -39148,8 +39089,8 @@ Thrown error: ${e}`
|
|
39148
39089
|
case "CALL" /* Call */: {
|
39149
39090
|
const callReceipt = {
|
39150
39091
|
type: ReceiptType.Call,
|
39151
|
-
from: hexOrZero(receipt.id
|
39152
|
-
to: hexOrZero(receipt?.to),
|
39092
|
+
from: hexOrZero(receipt.contract?.id),
|
39093
|
+
to: hexOrZero(receipt?.to?.id),
|
39153
39094
|
amount: bn(receipt.amount),
|
39154
39095
|
assetId: hexOrZero(receipt.assetId),
|
39155
39096
|
gas: bn(receipt.gas),
|
@@ -39163,7 +39104,7 @@ Thrown error: ${e}`
|
|
39163
39104
|
case "RETURN" /* Return */: {
|
39164
39105
|
const returnReceipt = {
|
39165
39106
|
type: ReceiptType.Return,
|
39166
|
-
id: hexOrZero(receipt.id
|
39107
|
+
id: hexOrZero(receipt.contract?.id),
|
39167
39108
|
val: bn(receipt.val),
|
39168
39109
|
pc: bn(receipt.pc),
|
39169
39110
|
is: bn(receipt.is)
|
@@ -39173,7 +39114,7 @@ Thrown error: ${e}`
|
|
39173
39114
|
case "RETURN_DATA" /* ReturnData */: {
|
39174
39115
|
const returnDataReceipt = {
|
39175
39116
|
type: ReceiptType.ReturnData,
|
39176
|
-
id: hexOrZero(receipt.id
|
39117
|
+
id: hexOrZero(receipt.contract?.id),
|
39177
39118
|
ptr: bn(receipt.ptr),
|
39178
39119
|
len: bn(receipt.len),
|
39179
39120
|
digest: hexOrZero(receipt.digest),
|
@@ -39185,7 +39126,7 @@ Thrown error: ${e}`
|
|
39185
39126
|
case "PANIC" /* Panic */: {
|
39186
39127
|
const panicReceipt = {
|
39187
39128
|
type: ReceiptType.Panic,
|
39188
|
-
id: hexOrZero(receipt.id),
|
39129
|
+
id: hexOrZero(receipt.contract?.id),
|
39189
39130
|
reason: bn(receipt.reason),
|
39190
39131
|
pc: bn(receipt.pc),
|
39191
39132
|
is: bn(receipt.is),
|
@@ -39196,7 +39137,7 @@ Thrown error: ${e}`
|
|
39196
39137
|
case "REVERT" /* Revert */: {
|
39197
39138
|
const revertReceipt = {
|
39198
39139
|
type: ReceiptType.Revert,
|
39199
|
-
id: hexOrZero(receipt.id
|
39140
|
+
id: hexOrZero(receipt.contract?.id),
|
39200
39141
|
val: bn(receipt.ra),
|
39201
39142
|
pc: bn(receipt.pc),
|
39202
39143
|
is: bn(receipt.is)
|
@@ -39206,7 +39147,7 @@ Thrown error: ${e}`
|
|
39206
39147
|
case "LOG" /* Log */: {
|
39207
39148
|
const logReceipt = {
|
39208
39149
|
type: ReceiptType.Log,
|
39209
|
-
id: hexOrZero(receipt.id
|
39150
|
+
id: hexOrZero(receipt.contract?.id),
|
39210
39151
|
val0: bn(receipt.ra),
|
39211
39152
|
val1: bn(receipt.rb),
|
39212
39153
|
val2: bn(receipt.rc),
|
@@ -39219,7 +39160,7 @@ Thrown error: ${e}`
|
|
39219
39160
|
case "LOG_DATA" /* LogData */: {
|
39220
39161
|
const logDataReceipt = {
|
39221
39162
|
type: ReceiptType.LogData,
|
39222
|
-
id: hexOrZero(receipt.id
|
39163
|
+
id: hexOrZero(receipt.contract?.id),
|
39223
39164
|
val0: bn(receipt.ra),
|
39224
39165
|
val1: bn(receipt.rb),
|
39225
39166
|
ptr: bn(receipt.ptr),
|
@@ -39233,8 +39174,8 @@ Thrown error: ${e}`
|
|
39233
39174
|
case "TRANSFER" /* Transfer */: {
|
39234
39175
|
const transferReceipt = {
|
39235
39176
|
type: ReceiptType.Transfer,
|
39236
|
-
from: hexOrZero(receipt.id
|
39237
|
-
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39177
|
+
from: hexOrZero(receipt.contract?.id),
|
39178
|
+
to: hexOrZero(receipt.toAddress || receipt?.to?.id),
|
39238
39179
|
amount: bn(receipt.amount),
|
39239
39180
|
assetId: hexOrZero(receipt.assetId),
|
39240
39181
|
pc: bn(receipt.pc),
|
@@ -39245,8 +39186,8 @@ Thrown error: ${e}`
|
|
39245
39186
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39246
39187
|
const transferOutReceipt = {
|
39247
39188
|
type: ReceiptType.TransferOut,
|
39248
|
-
from: hexOrZero(receipt.id
|
39249
|
-
to: hexOrZero(receipt.toAddress || receipt.to),
|
39189
|
+
from: hexOrZero(receipt.contract?.id),
|
39190
|
+
to: hexOrZero(receipt.toAddress || receipt.to?.id),
|
39250
39191
|
amount: bn(receipt.amount),
|
39251
39192
|
assetId: hexOrZero(receipt.assetId),
|
39252
39193
|
pc: bn(receipt.pc),
|
@@ -39289,7 +39230,7 @@ Thrown error: ${e}`
|
|
39289
39230
|
return receiptMessageOut;
|
39290
39231
|
}
|
39291
39232
|
case "MINT" /* Mint */: {
|
39292
|
-
const contractId = hexOrZero(receipt.id
|
39233
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39293
39234
|
const subId = hexOrZero(receipt.subId);
|
39294
39235
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39295
39236
|
const mintReceipt = {
|
@@ -39304,7 +39245,7 @@ Thrown error: ${e}`
|
|
39304
39245
|
return mintReceipt;
|
39305
39246
|
}
|
39306
39247
|
case "BURN" /* Burn */: {
|
39307
|
-
const contractId = hexOrZero(receipt.id
|
39248
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39308
39249
|
const subId = hexOrZero(receipt.subId);
|
39309
39250
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39310
39251
|
const burnReceipt = {
|
@@ -39385,6 +39326,7 @@ Thrown error: ${e}`
|
|
39385
39326
|
};
|
39386
39327
|
|
39387
39328
|
// src/providers/utils/gas.ts
|
39329
|
+
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39388
39330
|
var getGasUsedFromReceipts = (receipts) => {
|
39389
39331
|
const scriptResult = receipts.filter(
|
39390
39332
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39405,28 +39347,18 @@ Thrown error: ${e}`
|
|
39405
39347
|
}
|
39406
39348
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39407
39349
|
const witnessCache = [];
|
39408
|
-
const
|
39409
|
-
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39410
|
-
if (isCoinOrMessage) {
|
39411
|
-
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39412
|
-
return true;
|
39413
|
-
}
|
39414
|
-
if (!witnessCache.includes(input.witnessIndex)) {
|
39415
|
-
witnessCache.push(input.witnessIndex);
|
39416
|
-
return true;
|
39417
|
-
}
|
39418
|
-
}
|
39419
|
-
return false;
|
39420
|
-
});
|
39421
|
-
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39422
|
-
const totalGas = chargeableInputs.reduce((total, input) => {
|
39350
|
+
const totalGas = inputs.reduce((total, input) => {
|
39423
39351
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39424
39352
|
return total.add(
|
39425
|
-
|
39353
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39426
39354
|
);
|
39427
39355
|
}
|
39428
|
-
|
39429
|
-
|
39356
|
+
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
39357
|
+
witnessCache.push(input.witnessIndex);
|
39358
|
+
return total.add(gasCosts.ecr1);
|
39359
|
+
}
|
39360
|
+
return total;
|
39361
|
+
}, bn());
|
39430
39362
|
return totalGas;
|
39431
39363
|
}
|
39432
39364
|
function getMinGas(params) {
|
@@ -39438,20 +39370,12 @@ Thrown error: ${e}`
|
|
39438
39370
|
return minGas;
|
39439
39371
|
}
|
39440
39372
|
function getMaxGas(params) {
|
39441
|
-
const {
|
39442
|
-
gasPerByte,
|
39443
|
-
witnessesLength,
|
39444
|
-
witnessLimit,
|
39445
|
-
minGas,
|
39446
|
-
gasLimit = bn(0),
|
39447
|
-
maxGasPerTx
|
39448
|
-
} = params;
|
39373
|
+
const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
|
39449
39374
|
let remainingAllowedWitnessGas = bn(0);
|
39450
39375
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39451
39376
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39452
39377
|
}
|
39453
|
-
|
39454
|
-
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39378
|
+
return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39455
39379
|
}
|
39456
39380
|
function calculateMetadataGasForTxCreate({
|
39457
39381
|
gasCosts,
|
@@ -39473,10 +39397,6 @@ Thrown error: ${e}`
|
|
39473
39397
|
}) {
|
39474
39398
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39475
39399
|
}
|
39476
|
-
var calculateGasFee = (params) => {
|
39477
|
-
const { gas, gasPrice, priceFactor, tip } = params;
|
39478
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39479
|
-
};
|
39480
39400
|
|
39481
39401
|
// src/providers/utils/json.ts
|
39482
39402
|
function normalize2(object) {
|
@@ -39618,7 +39538,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39618
39538
|
// src/providers/transaction-request/transaction-request.ts
|
39619
39539
|
var BaseTransactionRequest = class {
|
39620
39540
|
/** Gas price for transaction */
|
39621
|
-
|
39541
|
+
gasPrice;
|
39622
39542
|
/** Block until which tx cannot be included */
|
39623
39543
|
maturity;
|
39624
39544
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39637,7 +39557,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39637
39557
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39638
39558
|
*/
|
39639
39559
|
constructor({
|
39640
|
-
|
39560
|
+
gasPrice,
|
39641
39561
|
maturity,
|
39642
39562
|
maxFee,
|
39643
39563
|
witnessLimit,
|
@@ -39645,7 +39565,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39645
39565
|
outputs,
|
39646
39566
|
witnesses
|
39647
39567
|
} = {}) {
|
39648
|
-
this.
|
39568
|
+
this.gasPrice = bn(gasPrice);
|
39649
39569
|
this.maturity = maturity ?? 0;
|
39650
39570
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39651
39571
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39656,9 +39576,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39656
39576
|
static getPolicyMeta(req) {
|
39657
39577
|
let policyTypes = 0;
|
39658
39578
|
const policies = [];
|
39659
|
-
if (req.
|
39660
|
-
policyTypes += PolicyType.
|
39661
|
-
policies.push({ data: req.
|
39579
|
+
if (req.gasPrice) {
|
39580
|
+
policyTypes += PolicyType.GasPrice;
|
39581
|
+
policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
|
39662
39582
|
}
|
39663
39583
|
if (req.witnessLimit) {
|
39664
39584
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39845,10 +39765,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39845
39765
|
* @param predicate - Predicate bytes.
|
39846
39766
|
* @param predicateData - Predicate data bytes.
|
39847
39767
|
*/
|
39848
|
-
addCoinInput(coin) {
|
39768
|
+
addCoinInput(coin, predicate) {
|
39849
39769
|
const { assetId, owner, amount } = coin;
|
39850
39770
|
let witnessIndex;
|
39851
|
-
if (
|
39771
|
+
if (predicate) {
|
39852
39772
|
witnessIndex = 0;
|
39853
39773
|
} else {
|
39854
39774
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39863,7 +39783,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39863
39783
|
amount,
|
39864
39784
|
assetId,
|
39865
39785
|
txPointer: "0x00000000000000000000000000000000",
|
39866
|
-
witnessIndex
|
39786
|
+
witnessIndex,
|
39787
|
+
predicate: predicate?.bytes
|
39867
39788
|
};
|
39868
39789
|
this.pushInput(input);
|
39869
39790
|
this.addChangeOutput(owner, assetId);
|
@@ -39876,11 +39797,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39876
39797
|
* @param predicate - Predicate bytes.
|
39877
39798
|
* @param predicateData - Predicate data bytes.
|
39878
39799
|
*/
|
39879
|
-
addMessageInput(message) {
|
39800
|
+
addMessageInput(message, predicate) {
|
39880
39801
|
const { recipient, sender, amount } = message;
|
39881
39802
|
const assetId = BaseAssetId;
|
39882
39803
|
let witnessIndex;
|
39883
|
-
if (
|
39804
|
+
if (predicate) {
|
39884
39805
|
witnessIndex = 0;
|
39885
39806
|
} else {
|
39886
39807
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39894,7 +39815,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39894
39815
|
sender: sender.toB256(),
|
39895
39816
|
recipient: recipient.toB256(),
|
39896
39817
|
amount,
|
39897
|
-
witnessIndex
|
39818
|
+
witnessIndex,
|
39819
|
+
predicate: predicate?.bytes
|
39898
39820
|
};
|
39899
39821
|
this.pushInput(input);
|
39900
39822
|
this.addChangeOutput(recipient, assetId);
|
@@ -39925,6 +39847,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39925
39847
|
resources.forEach((resource) => this.addResource(resource));
|
39926
39848
|
return this;
|
39927
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
|
+
}
|
39928
39876
|
/**
|
39929
39877
|
* Adds a coin output to the transaction.
|
39930
39878
|
*
|
@@ -40004,7 +39952,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40004
39952
|
}
|
40005
39953
|
calculateMaxGas(chainInfo, minGas) {
|
40006
39954
|
const { consensusParameters } = chainInfo;
|
40007
|
-
const { gasPerByte
|
39955
|
+
const { gasPerByte } = consensusParameters;
|
40008
39956
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40009
39957
|
(acc, wit) => acc + wit.dataLength,
|
40010
39958
|
0
|
@@ -40013,8 +39961,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40013
39961
|
gasPerByte,
|
40014
39962
|
minGas,
|
40015
39963
|
witnessesLength,
|
40016
|
-
witnessLimit: this.witnessLimit
|
40017
|
-
maxGasPerTx
|
39964
|
+
witnessLimit: this.witnessLimit
|
40018
39965
|
});
|
40019
39966
|
}
|
40020
39967
|
/**
|
@@ -40032,20 +39979,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40032
39979
|
});
|
40033
39980
|
const updateAssetInput = (assetId, quantity) => {
|
40034
39981
|
const assetInput = findAssetInput(assetId);
|
40035
|
-
let usedQuantity = quantity;
|
40036
|
-
if (assetId === BaseAssetId) {
|
40037
|
-
usedQuantity = bn("1000000000000000000");
|
40038
|
-
}
|
40039
39982
|
if (assetInput && "assetId" in assetInput) {
|
40040
|
-
assetInput.id = hexlify(randomBytes3(
|
40041
|
-
assetInput.amount =
|
39983
|
+
assetInput.id = hexlify(randomBytes3(33));
|
39984
|
+
assetInput.amount = quantity;
|
40042
39985
|
} else {
|
40043
39986
|
this.addResources([
|
40044
39987
|
{
|
40045
|
-
id: hexlify(randomBytes3(
|
40046
|
-
amount:
|
39988
|
+
id: hexlify(randomBytes3(33)),
|
39989
|
+
amount: quantity,
|
40047
39990
|
assetId,
|
40048
39991
|
owner: resourcesOwner || Address.fromRandom(),
|
39992
|
+
maturity: 0,
|
40049
39993
|
blockCreated: bn(1),
|
40050
39994
|
txCreatedIdx: bn(1)
|
40051
39995
|
}
|
@@ -40077,7 +40021,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40077
40021
|
toJSON() {
|
40078
40022
|
return normalizeJSON(this);
|
40079
40023
|
}
|
40080
|
-
|
40024
|
+
updatePredicateInputs(inputs) {
|
40081
40025
|
this.inputs.forEach((i) => {
|
40082
40026
|
let correspondingInput;
|
40083
40027
|
switch (i.type) {
|
@@ -40099,15 +40043,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40099
40043
|
}
|
40100
40044
|
});
|
40101
40045
|
}
|
40102
|
-
shiftPredicateData() {
|
40103
|
-
this.inputs.forEach((input) => {
|
40104
|
-
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
40105
|
-
input.predicateData = input.paddPredicateData(
|
40106
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40107
|
-
);
|
40108
|
-
}
|
40109
|
-
});
|
40110
|
-
}
|
40111
40046
|
};
|
40112
40047
|
|
40113
40048
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40241,8 +40176,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40241
40176
|
return {
|
40242
40177
|
type: TransactionType.Create,
|
40243
40178
|
...baseTransaction,
|
40179
|
+
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40244
40180
|
bytecodeWitnessIndex,
|
40245
|
-
storageSlotsCount:
|
40181
|
+
storageSlotsCount: storageSlots.length,
|
40246
40182
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40247
40183
|
storageSlots
|
40248
40184
|
};
|
@@ -40356,8 +40292,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40356
40292
|
type: TransactionType.Script,
|
40357
40293
|
scriptGasLimit: this.gasLimit,
|
40358
40294
|
...super.getBaseTransaction(),
|
40359
|
-
scriptLength:
|
40360
|
-
scriptDataLength:
|
40295
|
+
scriptLength: script.length,
|
40296
|
+
scriptDataLength: scriptData.length,
|
40361
40297
|
receiptsRoot: ZeroBytes32,
|
40362
40298
|
script: hexlify(script),
|
40363
40299
|
scriptData: hexlify(scriptData)
|
@@ -40421,7 +40357,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40421
40357
|
}
|
40422
40358
|
calculateMaxGas(chainInfo, minGas) {
|
40423
40359
|
const { consensusParameters } = chainInfo;
|
40424
|
-
const { gasPerByte
|
40360
|
+
const { gasPerByte } = consensusParameters;
|
40425
40361
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40426
40362
|
(acc, wit) => acc + wit.dataLength,
|
40427
40363
|
0
|
@@ -40431,8 +40367,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40431
40367
|
minGas,
|
40432
40368
|
witnessesLength,
|
40433
40369
|
witnessLimit: this.witnessLimit,
|
40434
|
-
gasLimit: this.gasLimit
|
40435
|
-
maxGasPerTx
|
40370
|
+
gasLimit: this.gasLimit
|
40436
40371
|
});
|
40437
40372
|
}
|
40438
40373
|
/**
|
@@ -40505,29 +40440,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40505
40440
|
}
|
40506
40441
|
}
|
40507
40442
|
};
|
40508
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40509
|
-
(acc, input) => {
|
40510
|
-
if (input.type === InputType.Coin && input.owner === owner) {
|
40511
|
-
acc.utxos.push(input.id);
|
40512
|
-
}
|
40513
|
-
if (input.type === InputType.Message && input.recipient === owner) {
|
40514
|
-
acc.messages.push(input.nonce);
|
40515
|
-
}
|
40516
|
-
return acc;
|
40517
|
-
},
|
40518
|
-
{
|
40519
|
-
utxos: [],
|
40520
|
-
messages: []
|
40521
|
-
}
|
40522
|
-
);
|
40523
40443
|
|
40524
40444
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40525
40445
|
var calculateTransactionFee = (params) => {
|
40526
40446
|
const {
|
40527
|
-
|
40447
|
+
gasUsed,
|
40528
40448
|
rawPayload,
|
40529
|
-
|
40530
|
-
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40449
|
+
consensusParameters: { gasCosts, feeParams }
|
40531
40450
|
} = params;
|
40532
40451
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40533
40452
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40537,7 +40456,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40537
40456
|
return {
|
40538
40457
|
fee: bn(0),
|
40539
40458
|
minFee: bn(0),
|
40540
|
-
maxFee: bn(0)
|
40459
|
+
maxFee: bn(0),
|
40460
|
+
feeFromGasUsed: bn(0)
|
40541
40461
|
};
|
40542
40462
|
}
|
40543
40463
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40569,6 +40489,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40569
40489
|
metadataGas,
|
40570
40490
|
txBytesSize: transactionBytes.length
|
40571
40491
|
});
|
40492
|
+
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40572
40493
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40573
40494
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40574
40495
|
const maxGas = getMaxGas({
|
@@ -40576,25 +40497,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40576
40497
|
minGas,
|
40577
40498
|
witnessesLength,
|
40578
40499
|
gasLimit,
|
40579
|
-
witnessLimit
|
40580
|
-
maxGasPerTx
|
40581
|
-
});
|
40582
|
-
const minFee = calculateGasFee({
|
40583
|
-
gasPrice,
|
40584
|
-
gas: minGas,
|
40585
|
-
priceFactor: gasPriceFactor,
|
40586
|
-
tip
|
40587
|
-
});
|
40588
|
-
const maxFee = calculateGasFee({
|
40589
|
-
gasPrice,
|
40590
|
-
gas: maxGas,
|
40591
|
-
priceFactor: gasPriceFactor,
|
40592
|
-
tip
|
40500
|
+
witnessLimit
|
40593
40501
|
});
|
40502
|
+
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40503
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40504
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40505
|
+
const fee = minFee.add(feeFromGasUsed);
|
40594
40506
|
return {
|
40507
|
+
fee,
|
40595
40508
|
minFee,
|
40596
40509
|
maxFee,
|
40597
|
-
|
40510
|
+
feeFromGasUsed
|
40598
40511
|
};
|
40599
40512
|
};
|
40600
40513
|
|
@@ -41195,9 +41108,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41195
41108
|
gqlTransactionStatus,
|
41196
41109
|
abiMap = {},
|
41197
41110
|
maxInputs,
|
41198
|
-
gasCosts
|
41199
|
-
maxGasPerTx,
|
41200
|
-
gasPrice
|
41111
|
+
gasCosts
|
41201
41112
|
} = params;
|
41202
41113
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41203
41114
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41211,14 +41122,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41211
41122
|
maxInputs
|
41212
41123
|
});
|
41213
41124
|
const typeName = getTransactionTypeName(transaction.type);
|
41214
|
-
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41215
41125
|
const { fee } = calculateTransactionFee({
|
41216
|
-
|
41126
|
+
gasUsed,
|
41217
41127
|
rawPayload,
|
41218
|
-
tip,
|
41219
41128
|
consensusParameters: {
|
41220
41129
|
gasCosts,
|
41221
|
-
maxGasPerTx,
|
41222
41130
|
feeParams: {
|
41223
41131
|
gasPerByte,
|
41224
41132
|
gasPriceFactor
|
@@ -41354,13 +41262,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41354
41262
|
const decodedTransaction = this.decodeTransaction(
|
41355
41263
|
transaction
|
41356
41264
|
);
|
41357
|
-
|
41358
|
-
|
41359
|
-
txReceipts = transaction.status.receipts;
|
41360
|
-
}
|
41361
|
-
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41362
|
-
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41363
|
-
const gasPrice = await this.provider.getLatestGasPrice();
|
41265
|
+
const receipts = transaction.receipts?.map(processGqlReceipt) || [];
|
41266
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
|
41364
41267
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41365
41268
|
const transactionSummary = assembleTransactionSummary({
|
41366
41269
|
id: this.id,
|
@@ -41372,9 +41275,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41372
41275
|
gasPriceFactor,
|
41373
41276
|
abiMap: contractsAbiMap,
|
41374
41277
|
maxInputs,
|
41375
|
-
gasCosts
|
41376
|
-
maxGasPerTx,
|
41377
|
-
gasPrice
|
41278
|
+
gasCosts
|
41378
41279
|
});
|
41379
41280
|
return transactionSummary;
|
41380
41281
|
}
|
@@ -41523,7 +41424,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41523
41424
|
gasCosts,
|
41524
41425
|
latestBlock: {
|
41525
41426
|
id: latestBlock.id,
|
41526
|
-
height: bn(latestBlock.height),
|
41427
|
+
height: bn(latestBlock.header.height),
|
41527
41428
|
time: latestBlock.header.time,
|
41528
41429
|
transactions: latestBlock.transactions.map((i) => ({
|
41529
41430
|
id: i.id
|
@@ -41617,8 +41518,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41617
41518
|
* Returns some helpful parameters related to gas fees.
|
41618
41519
|
*/
|
41619
41520
|
getGasConfig() {
|
41521
|
+
const { minGasPrice } = this.getNode();
|
41620
41522
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41621
41523
|
return {
|
41524
|
+
minGasPrice,
|
41622
41525
|
maxGasPerTx,
|
41623
41526
|
maxGasPerPredicate,
|
41624
41527
|
gasPriceFactor,
|
@@ -41716,7 +41619,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41716
41619
|
*/
|
41717
41620
|
async getBlockNumber() {
|
41718
41621
|
const { chain } = await this.operations.getChain();
|
41719
|
-
return bn(chain.latestBlock.height, 10);
|
41622
|
+
return bn(chain.latestBlock.header.height, 10);
|
41720
41623
|
}
|
41721
41624
|
/**
|
41722
41625
|
* Returns the chain information.
|
@@ -41728,9 +41631,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41728
41631
|
const processedNodeInfo = {
|
41729
41632
|
maxDepth: bn(nodeInfo.maxDepth),
|
41730
41633
|
maxTx: bn(nodeInfo.maxTx),
|
41634
|
+
minGasPrice: bn(nodeInfo.minGasPrice),
|
41731
41635
|
nodeVersion: nodeInfo.nodeVersion,
|
41732
41636
|
utxoValidation: nodeInfo.utxoValidation,
|
41733
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41637
|
+
vmBacktrace: nodeInfo.vmBacktrace,
|
41638
|
+
peers: nodeInfo.peers
|
41734
41639
|
};
|
41735
41640
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41736
41641
|
return processedNodeInfo;
|
@@ -41816,13 +41721,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41816
41721
|
return this.estimateTxDependencies(transactionRequest);
|
41817
41722
|
}
|
41818
41723
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41819
|
-
const { dryRun:
|
41820
|
-
|
41724
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41725
|
+
encodedTransaction,
|
41821
41726
|
utxoValidation: utxoValidation || false
|
41822
41727
|
});
|
41823
|
-
const
|
41824
|
-
|
41825
|
-
|
41728
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41729
|
+
return {
|
41730
|
+
receipts
|
41731
|
+
};
|
41826
41732
|
}
|
41827
41733
|
/**
|
41828
41734
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41861,6 +41767,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41861
41767
|
* If there are missing variable outputs,
|
41862
41768
|
* `addVariableOutputs` is called on the transaction.
|
41863
41769
|
*
|
41770
|
+
* @privateRemarks
|
41771
|
+
* TODO: Investigate support for missing contract IDs
|
41772
|
+
* TODO: Add support for missing output messages
|
41864
41773
|
*
|
41865
41774
|
* @param transactionRequest - The transaction request object.
|
41866
41775
|
* @returns A promise.
|
@@ -41873,19 +41782,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41873
41782
|
missingContractIds: []
|
41874
41783
|
};
|
41875
41784
|
}
|
41785
|
+
await this.estimatePredicates(transactionRequest);
|
41876
41786
|
let receipts = [];
|
41877
41787
|
const missingContractIds = [];
|
41878
41788
|
let outputVariables = 0;
|
41879
|
-
let dryrunStatus;
|
41880
41789
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41881
|
-
const {
|
41882
|
-
|
41883
|
-
} = await this.operations.dryRun({
|
41884
|
-
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41790
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41791
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
41885
41792
|
utxoValidation: false
|
41886
41793
|
});
|
41887
|
-
receipts =
|
41888
|
-
dryrunStatus = status;
|
41794
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
41889
41795
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41890
41796
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41891
41797
|
if (hasMissingOutputs) {
|
@@ -41895,11 +41801,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41895
41801
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41896
41802
|
missingContractIds.push(contractId);
|
41897
41803
|
});
|
41898
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41899
|
-
transactionRequest,
|
41900
|
-
optimizeGas: false
|
41901
|
-
});
|
41902
|
-
transactionRequest.maxFee = maxFee;
|
41903
41804
|
} else {
|
41904
41805
|
break;
|
41905
41806
|
}
|
@@ -41907,133 +41808,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41907
41808
|
return {
|
41908
41809
|
receipts,
|
41909
41810
|
outputVariables,
|
41910
|
-
missingContractIds
|
41911
|
-
dryrunStatus
|
41811
|
+
missingContractIds
|
41912
41812
|
};
|
41913
41813
|
}
|
41914
41814
|
/**
|
41915
|
-
*
|
41916
|
-
*
|
41917
|
-
*
|
41918
|
-
*
|
41919
|
-
|
41920
|
-
|
41921
|
-
|
41922
|
-
|
41923
|
-
*/
|
41924
|
-
async estimateMultipleTxDependencies(transactionRequests) {
|
41925
|
-
const results = transactionRequests.map(() => ({
|
41926
|
-
receipts: [],
|
41927
|
-
outputVariables: 0,
|
41928
|
-
missingContractIds: [],
|
41929
|
-
dryrunStatus: void 0
|
41930
|
-
}));
|
41931
|
-
const allRequests = clone_default(transactionRequests);
|
41932
|
-
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41933
|
-
allRequests.forEach((req, index) => {
|
41934
|
-
if (req.type === TransactionType.Script) {
|
41935
|
-
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41936
|
-
}
|
41937
|
-
});
|
41938
|
-
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41939
|
-
let attempt = 0;
|
41940
|
-
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41941
|
-
const encodedTransactions = transactionsToProcess.map(
|
41942
|
-
(index) => serializedTransactionsMap.get(index)
|
41943
|
-
);
|
41944
|
-
const dryRunResults = await this.operations.dryRun({
|
41945
|
-
encodedTransactions,
|
41946
|
-
utxoValidation: false
|
41947
|
-
});
|
41948
|
-
const nextRoundTransactions = [];
|
41949
|
-
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41950
|
-
const currentResultIndex = transactionsToProcess[i];
|
41951
|
-
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41952
|
-
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41953
|
-
results[currentResultIndex].dryrunStatus = status;
|
41954
|
-
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41955
|
-
results[currentResultIndex].receipts
|
41956
|
-
);
|
41957
|
-
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41958
|
-
const requestToProcess = allRequests[currentResultIndex];
|
41959
|
-
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
41960
|
-
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
41961
|
-
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
41962
|
-
missingOutputContractIds.forEach(({ contractId }) => {
|
41963
|
-
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
41964
|
-
results[currentResultIndex].missingContractIds.push(contractId);
|
41965
|
-
});
|
41966
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41967
|
-
transactionRequest: requestToProcess,
|
41968
|
-
optimizeGas: false
|
41969
|
-
});
|
41970
|
-
requestToProcess.maxFee = maxFee;
|
41971
|
-
serializedTransactionsMap.set(
|
41972
|
-
currentResultIndex,
|
41973
|
-
hexlify(requestToProcess.toTransactionBytes())
|
41974
|
-
);
|
41975
|
-
nextRoundTransactions.push(currentResultIndex);
|
41976
|
-
allRequests[currentResultIndex] = requestToProcess;
|
41977
|
-
}
|
41978
|
-
}
|
41979
|
-
transactionsToProcess = nextRoundTransactions;
|
41980
|
-
attempt += 1;
|
41981
|
-
}
|
41982
|
-
return results;
|
41983
|
-
}
|
41984
|
-
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
41985
|
-
if (estimateTxDependencies) {
|
41986
|
-
return this.estimateMultipleTxDependencies(transactionRequests);
|
41987
|
-
}
|
41988
|
-
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
41989
|
-
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41990
|
-
encodedTransactions,
|
41991
|
-
utxoValidation: utxoValidation || false
|
41992
|
-
});
|
41993
|
-
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
41994
|
-
const receipts = rawReceipts.map(processGqlReceipt);
|
41995
|
-
return { receipts, dryrunStatus: status };
|
41996
|
-
});
|
41997
|
-
return results;
|
41998
|
-
}
|
41999
|
-
async estimateTxGasAndFee(params) {
|
42000
|
-
const { transactionRequest, optimizeGas = true } = params;
|
42001
|
-
let { gasPrice } = params;
|
41815
|
+
* Estimates the transaction gas and fee based on the provided transaction request.
|
41816
|
+
* @param transactionRequest - The transaction request object.
|
41817
|
+
* @param optimizeGas - Optional. Specifies whether to optimize the gas. Default is false.
|
41818
|
+
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
41819
|
+
*/
|
41820
|
+
estimateTxGasAndFee(params) {
|
41821
|
+
const { transactionRequest } = params;
|
41822
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
42002
41823
|
const chainInfo = this.getChain();
|
42003
|
-
const
|
41824
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
41825
|
+
transactionRequest.gasPrice = gasPrice;
|
42004
41826
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
42005
|
-
|
42006
|
-
gasPrice = await this.estimateGasPrice(10);
|
42007
|
-
}
|
42008
|
-
const minFee = calculateGasFee({
|
42009
|
-
gasPrice: bn(gasPrice),
|
42010
|
-
gas: minGas,
|
42011
|
-
priceFactor: gasPriceFactor,
|
42012
|
-
tip: transactionRequest.tip
|
42013
|
-
}).add(1);
|
42014
|
-
let gasLimit = bn(0);
|
41827
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42015
41828
|
if (transactionRequest.type === TransactionType.Script) {
|
42016
|
-
|
42017
|
-
if (!optimizeGas) {
|
41829
|
+
if (transactionRequest.gasLimit.eq(0)) {
|
42018
41830
|
transactionRequest.gasLimit = minGas;
|
42019
|
-
gasLimit =
|
42020
|
-
|
41831
|
+
transactionRequest.gasLimit = maxGasPerTx.sub(
|
41832
|
+
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
41833
|
+
);
|
42021
41834
|
}
|
42022
41835
|
}
|
42023
41836
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42024
|
-
const maxFee =
|
42025
|
-
gasPrice: bn(gasPrice),
|
42026
|
-
gas: maxGas,
|
42027
|
-
priceFactor: gasPriceFactor,
|
42028
|
-
tip: transactionRequest.tip
|
42029
|
-
}).add(1);
|
41837
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42030
41838
|
return {
|
42031
41839
|
minGas,
|
42032
41840
|
minFee,
|
42033
41841
|
maxGas,
|
42034
|
-
maxFee
|
42035
|
-
gasPrice,
|
42036
|
-
gasLimit
|
41842
|
+
maxFee
|
42037
41843
|
};
|
42038
41844
|
}
|
42039
41845
|
/**
|
@@ -42051,17 +41857,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42051
41857
|
if (estimateTxDependencies) {
|
42052
41858
|
return this.estimateTxDependencies(transactionRequest);
|
42053
41859
|
}
|
42054
|
-
const
|
42055
|
-
const { dryRun:
|
42056
|
-
|
41860
|
+
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41861
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41862
|
+
encodedTransaction,
|
42057
41863
|
utxoValidation: true
|
42058
41864
|
});
|
42059
|
-
const
|
42060
|
-
|
42061
|
-
|
42062
|
-
|
42063
|
-
});
|
42064
|
-
return { receipts: callResult[0].receipts };
|
41865
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41866
|
+
return {
|
41867
|
+
receipts
|
41868
|
+
};
|
42065
41869
|
}
|
42066
41870
|
/**
|
42067
41871
|
* Returns a transaction cost to enable user
|
@@ -42078,80 +41882,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42078
41882
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
42079
41883
|
* @returns A promise that resolves to the transaction cost object.
|
42080
41884
|
*/
|
42081
|
-
async getTransactionCost(transactionRequestLike,
|
41885
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
41886
|
+
estimateTxDependencies = true,
|
41887
|
+
estimatePredicates = true,
|
41888
|
+
resourcesOwner,
|
41889
|
+
signatureCallback
|
41890
|
+
} = {}) {
|
42082
41891
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41892
|
+
const { minGasPrice } = this.getGasConfig();
|
41893
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
42083
41894
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
42084
41895
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
42085
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
41896
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42086
41897
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42087
|
-
txRequestClone.maxFee = bn(0);
|
42088
41898
|
if (isScriptTransaction) {
|
42089
41899
|
txRequestClone.gasLimit = bn(0);
|
42090
41900
|
}
|
42091
|
-
if (
|
42092
|
-
resourcesOwner
|
41901
|
+
if (estimatePredicates) {
|
41902
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41903
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41904
|
+
}
|
41905
|
+
await this.estimatePredicates(txRequestClone);
|
42093
41906
|
}
|
42094
|
-
const signedRequest = clone_default(txRequestClone);
|
42095
|
-
let addedSignatures = 0;
|
42096
41907
|
if (signatureCallback && isScriptTransaction) {
|
42097
|
-
|
42098
|
-
|
42099
|
-
|
42100
|
-
|
42101
|
-
await this.estimatePredicates(signedRequest);
|
42102
|
-
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
42103
|
-
transactionRequest: signedRequest,
|
42104
|
-
optimizeGas: false
|
41908
|
+
await signatureCallback(txRequestClone);
|
41909
|
+
}
|
41910
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41911
|
+
transactionRequest: txRequestClone
|
42105
41912
|
});
|
42106
|
-
txRequestClone.maxFee = maxFee;
|
42107
41913
|
let receipts = [];
|
42108
41914
|
let missingContractIds = [];
|
42109
41915
|
let outputVariables = 0;
|
42110
41916
|
let gasUsed = bn(0);
|
42111
|
-
|
42112
|
-
|
42113
|
-
if (signatureCallback) {
|
42114
|
-
await signatureCallback(txRequestClone);
|
42115
|
-
}
|
42116
|
-
txRequestClone.gasLimit = gasLimit;
|
41917
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
41918
|
+
txRequestClone.gasPrice = bn(0);
|
42117
41919
|
const result = await this.estimateTxDependencies(txRequestClone);
|
42118
41920
|
receipts = result.receipts;
|
42119
41921
|
outputVariables = result.outputVariables;
|
42120
41922
|
missingContractIds = result.missingContractIds;
|
42121
|
-
gasUsed = getGasUsedFromReceipts(receipts);
|
41923
|
+
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
42122
41924
|
txRequestClone.gasLimit = gasUsed;
|
42123
|
-
|
42124
|
-
|
42125
|
-
|
41925
|
+
txRequestClone.gasPrice = setGasPrice;
|
41926
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41927
|
+
transactionRequest: txRequestClone
|
42126
41928
|
}));
|
42127
41929
|
}
|
42128
41930
|
return {
|
42129
41931
|
requiredQuantities: allQuantities,
|
42130
41932
|
receipts,
|
42131
41933
|
gasUsed,
|
42132
|
-
|
41934
|
+
minGasPrice,
|
41935
|
+
gasPrice: setGasPrice,
|
42133
41936
|
minGas,
|
42134
41937
|
maxGas,
|
42135
41938
|
minFee,
|
42136
41939
|
maxFee,
|
41940
|
+
estimatedInputs: txRequestClone.inputs,
|
42137
41941
|
outputVariables,
|
42138
|
-
missingContractIds
|
42139
|
-
addedSignatures,
|
42140
|
-
estimatedPredicates: txRequestClone.inputs
|
41942
|
+
missingContractIds
|
42141
41943
|
};
|
42142
41944
|
}
|
42143
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
41945
|
+
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
42144
41946
|
const ownerAddress = Address.fromAddressOrString(owner);
|
42145
41947
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
42146
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42147
|
-
quantitiesToContract
|
42148
|
-
});
|
41948
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
|
42149
41949
|
transactionRequest.addResources(
|
42150
41950
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
42151
41951
|
);
|
42152
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
42153
|
-
|
42154
|
-
|
41952
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41953
|
+
transactionRequest,
|
41954
|
+
forwardingQuantities
|
41955
|
+
);
|
42155
41956
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
42156
41957
|
return {
|
42157
41958
|
resources,
|
@@ -42175,6 +41976,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42175
41976
|
assetId: coin.assetId,
|
42176
41977
|
amount: bn(coin.amount),
|
42177
41978
|
owner: Address.fromAddressOrString(coin.owner),
|
41979
|
+
maturity: bn(coin.maturity).toNumber(),
|
42178
41980
|
blockCreated: bn(coin.blockCreated),
|
42179
41981
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42180
41982
|
}));
|
@@ -42226,6 +42028,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42226
42028
|
amount: bn(coin.amount),
|
42227
42029
|
assetId: coin.assetId,
|
42228
42030
|
owner: Address.fromAddressOrString(coin.owner),
|
42031
|
+
maturity: bn(coin.maturity).toNumber(),
|
42229
42032
|
blockCreated: bn(coin.blockCreated),
|
42230
42033
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42231
42034
|
};
|
@@ -42258,7 +42061,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42258
42061
|
}
|
42259
42062
|
return {
|
42260
42063
|
id: block2.id,
|
42261
|
-
height: bn(block2.height),
|
42064
|
+
height: bn(block2.header.height),
|
42262
42065
|
time: block2.header.time,
|
42263
42066
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42264
42067
|
};
|
@@ -42273,7 +42076,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42273
42076
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42274
42077
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42275
42078
|
id: block2.id,
|
42276
|
-
height: bn(block2.height),
|
42079
|
+
height: bn(block2.header.height),
|
42277
42080
|
time: block2.header.time,
|
42278
42081
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42279
42082
|
}));
|
@@ -42300,7 +42103,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42300
42103
|
}
|
42301
42104
|
return {
|
42302
42105
|
id: block2.id,
|
42303
|
-
height: bn(block2.height, 10),
|
42106
|
+
height: bn(block2.header.height, 10),
|
42304
42107
|
time: block2.header.time,
|
42305
42108
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42306
42109
|
transactions: block2.transactions.map(
|
@@ -42480,6 +42283,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42480
42283
|
prevRoot: messageBlockHeader.prevRoot,
|
42481
42284
|
time: messageBlockHeader.time,
|
42482
42285
|
applicationHash: messageBlockHeader.applicationHash,
|
42286
|
+
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
42483
42287
|
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
|
42484
42288
|
},
|
42485
42289
|
commitBlockHeader: {
|
@@ -42491,6 +42295,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42491
42295
|
prevRoot: commitBlockHeader.prevRoot,
|
42492
42296
|
time: commitBlockHeader.time,
|
42493
42297
|
applicationHash: commitBlockHeader.applicationHash,
|
42298
|
+
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
42494
42299
|
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
|
42495
42300
|
},
|
42496
42301
|
sender: Address.fromAddressOrString(sender),
|
@@ -42500,16 +42305,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42500
42305
|
data
|
42501
42306
|
};
|
42502
42307
|
}
|
42503
|
-
async getLatestGasPrice() {
|
42504
|
-
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42505
|
-
return bn(latestGasPrice.gasPrice);
|
42506
|
-
}
|
42507
|
-
async estimateGasPrice(blockHorizon) {
|
42508
|
-
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42509
|
-
blockHorizon: String(blockHorizon)
|
42510
|
-
});
|
42511
|
-
return bn(estimateGasPrice.gasPrice);
|
42512
|
-
}
|
42513
42308
|
/**
|
42514
42309
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42515
42310
|
*
|
@@ -42570,15 +42365,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42570
42365
|
arrayify(gqlTransaction.rawPayload),
|
42571
42366
|
0
|
42572
42367
|
);
|
42573
|
-
|
42574
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42575
|
-
txReceipts = gqlTransaction.status.receipts;
|
42576
|
-
}
|
42577
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42368
|
+
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
42578
42369
|
const {
|
42579
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42370
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42580
42371
|
} = provider.getChain();
|
42581
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42582
42372
|
const transactionInfo = assembleTransactionSummary({
|
42583
42373
|
id: gqlTransaction.id,
|
42584
42374
|
receipts,
|
@@ -42589,9 +42379,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42589
42379
|
gasPriceFactor: bn(gasPriceFactor),
|
42590
42380
|
abiMap,
|
42591
42381
|
maxInputs,
|
42592
|
-
gasCosts
|
42593
|
-
maxGasPerTx,
|
42594
|
-
gasPrice
|
42382
|
+
gasCosts
|
42595
42383
|
});
|
42596
42384
|
return {
|
42597
42385
|
gqlTransaction,
|
@@ -42601,11 +42389,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42601
42389
|
async function getTransactionSummaryFromRequest(params) {
|
42602
42390
|
const { provider, transactionRequest, abiMap } = params;
|
42603
42391
|
const { receipts } = await provider.call(transactionRequest);
|
42604
|
-
const { gasPerByte, gasPriceFactor, gasCosts
|
42392
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42605
42393
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42606
42394
|
const transaction = transactionRequest.toTransaction();
|
42607
42395
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42608
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42609
42396
|
const transactionSummary = assembleTransactionSummary({
|
42610
42397
|
receipts,
|
42611
42398
|
transaction,
|
@@ -42614,9 +42401,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42614
42401
|
gasPerByte,
|
42615
42402
|
gasPriceFactor,
|
42616
42403
|
maxInputs,
|
42617
|
-
gasCosts
|
42618
|
-
maxGasPerTx,
|
42619
|
-
gasPrice
|
42404
|
+
gasCosts
|
42620
42405
|
});
|
42621
42406
|
return transactionSummary;
|
42622
42407
|
}
|
@@ -42625,18 +42410,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42625
42410
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42626
42411
|
const { edges, pageInfo } = transactionsByOwner;
|
42627
42412
|
const {
|
42628
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42413
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42629
42414
|
} = provider.getChain();
|
42630
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42631
42415
|
const transactions = edges.map((edge) => {
|
42632
42416
|
const { node: gqlTransaction } = edge;
|
42633
|
-
const { id, rawPayload, status } = gqlTransaction;
|
42417
|
+
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
42634
42418
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42635
|
-
|
42636
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42637
|
-
txReceipts = gqlTransaction.status.receipts;
|
42638
|
-
}
|
42639
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42419
|
+
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
42640
42420
|
const transactionSummary = assembleTransactionSummary({
|
42641
42421
|
id,
|
42642
42422
|
receipts,
|
@@ -42647,9 +42427,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42647
42427
|
gasPerByte,
|
42648
42428
|
gasPriceFactor,
|
42649
42429
|
maxInputs,
|
42650
|
-
gasCosts
|
42651
|
-
maxGasPerTx,
|
42652
|
-
gasPrice
|
42430
|
+
gasCosts
|
42653
42431
|
});
|
42654
42432
|
const output3 = {
|
42655
42433
|
gqlTransaction,
|
@@ -42978,33 +42756,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42978
42756
|
* @param fee - The estimated transaction fee.
|
42979
42757
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42980
42758
|
*/
|
42981
|
-
async fund(request,
|
42982
|
-
const
|
42983
|
-
const txRequest = request;
|
42984
|
-
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42759
|
+
async fund(request, coinQuantities, fee) {
|
42760
|
+
const updatedQuantities = addAmountToAsset({
|
42985
42761
|
amount: bn(fee),
|
42986
42762
|
assetId: BaseAssetId,
|
42987
|
-
coinQuantities
|
42763
|
+
coinQuantities
|
42988
42764
|
});
|
42989
42765
|
const quantitiesDict = {};
|
42990
|
-
|
42766
|
+
updatedQuantities.forEach(({ amount, assetId }) => {
|
42991
42767
|
quantitiesDict[assetId] = {
|
42992
42768
|
required: amount,
|
42993
42769
|
owned: bn(0)
|
42994
42770
|
};
|
42995
42771
|
});
|
42996
|
-
|
42772
|
+
const cachedUtxos = [];
|
42773
|
+
const cachedMessages = [];
|
42774
|
+
const owner = this.address.toB256();
|
42775
|
+
request.inputs.forEach((input) => {
|
42997
42776
|
const isResource = "amount" in input;
|
42998
42777
|
if (isResource) {
|
42999
42778
|
const isCoin2 = "owner" in input;
|
43000
42779
|
if (isCoin2) {
|
43001
42780
|
const assetId = String(input.assetId);
|
43002
|
-
if (quantitiesDict[assetId]) {
|
42781
|
+
if (input.owner === owner && quantitiesDict[assetId]) {
|
43003
42782
|
const amount = bn(input.amount);
|
43004
42783
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42784
|
+
cachedUtxos.push(input.id);
|
43005
42785
|
}
|
43006
|
-
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42786
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
43007
42787
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42788
|
+
cachedMessages.push(input.nonce);
|
43008
42789
|
}
|
43009
42790
|
}
|
43010
42791
|
});
|
@@ -43019,23 +42800,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43019
42800
|
});
|
43020
42801
|
const needsToBeFunded = missingQuantities.length;
|
43021
42802
|
if (needsToBeFunded) {
|
43022
|
-
const
|
43023
|
-
|
43024
|
-
|
43025
|
-
|
43026
|
-
|
43027
|
-
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43028
|
-
const requestToBeReEstimate = clone_default(txRequest);
|
43029
|
-
if (addedSignatures) {
|
43030
|
-
Array.from({ length: addedSignatures }).forEach(
|
43031
|
-
() => requestToBeReEstimate.addEmptyWitness()
|
43032
|
-
);
|
42803
|
+
const resources = await this.getResourcesToSpend(missingQuantities, {
|
42804
|
+
messages: cachedMessages,
|
42805
|
+
utxos: cachedUtxos
|
42806
|
+
});
|
42807
|
+
request.addResources(resources);
|
43033
42808
|
}
|
43034
|
-
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43035
|
-
transactionRequest: requestToBeReEstimate
|
43036
|
-
});
|
43037
|
-
txRequest.maxFee = maxFee;
|
43038
|
-
return txRequest;
|
43039
42809
|
}
|
43040
42810
|
/**
|
43041
42811
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -43043,25 +42813,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43043
42813
|
* @param destination - The address of the destination.
|
43044
42814
|
* @param amount - The amount of coins to transfer.
|
43045
42815
|
* @param assetId - The asset ID of the coins to transfer.
|
43046
|
-
* @param txParams - The transaction parameters (gasLimit,
|
42816
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
43047
42817
|
* @returns A promise that resolves to the prepared transaction request.
|
43048
42818
|
*/
|
43049
42819
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
43050
|
-
const
|
42820
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42821
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42822
|
+
const request = new ScriptTransactionRequest(params);
|
43051
42823
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
43052
|
-
const
|
42824
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43053
42825
|
estimateTxDependencies: true,
|
43054
42826
|
resourcesOwner: this
|
43055
42827
|
});
|
43056
|
-
|
43057
|
-
|
43058
|
-
|
43059
|
-
|
43060
|
-
|
43061
|
-
|
43062
|
-
|
43063
|
-
|
43064
|
-
await this.fund(request,
|
42828
|
+
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
42829
|
+
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
42830
|
+
this.validateGas({
|
42831
|
+
gasUsed,
|
42832
|
+
gasPrice: request.gasPrice,
|
42833
|
+
gasLimit: request.gasLimit,
|
42834
|
+
minGasPrice
|
42835
|
+
});
|
42836
|
+
await this.fund(request, requiredQuantities, maxFee);
|
42837
|
+
request.updatePredicateInputs(estimatedInputs);
|
43065
42838
|
return request;
|
43066
42839
|
}
|
43067
42840
|
/**
|
@@ -43100,30 +42873,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43100
42873
|
);
|
43101
42874
|
}
|
43102
42875
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42876
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42877
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
43103
42878
|
const { script, scriptData } = await assembleTransferToContractScript({
|
43104
42879
|
hexlifiedContractId: contractAddress.toB256(),
|
43105
42880
|
amountToTransfer: bn(amount),
|
43106
42881
|
assetId
|
43107
42882
|
});
|
43108
42883
|
const request = new ScriptTransactionRequest({
|
43109
|
-
...
|
42884
|
+
...params,
|
43110
42885
|
script,
|
43111
42886
|
scriptData
|
43112
42887
|
});
|
43113
42888
|
request.addContractInputAndOutput(contractAddress);
|
43114
|
-
const
|
43115
|
-
|
43116
|
-
|
42889
|
+
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42890
|
+
request,
|
42891
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42892
|
+
);
|
42893
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42894
|
+
this.validateGas({
|
42895
|
+
gasUsed,
|
42896
|
+
gasPrice: request.gasPrice,
|
42897
|
+
gasLimit: request.gasLimit,
|
42898
|
+
minGasPrice
|
43117
42899
|
});
|
43118
|
-
|
43119
|
-
this.validateGas({
|
43120
|
-
gasUsed: txCost.gasUsed,
|
43121
|
-
gasLimit: request.gasLimit
|
43122
|
-
});
|
43123
|
-
}
|
43124
|
-
request.gasLimit = txCost.gasUsed;
|
43125
|
-
request.maxFee = txCost.maxFee;
|
43126
|
-
await this.fund(request, txCost);
|
42900
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43127
42901
|
return this.sendTransaction(request);
|
43128
42902
|
}
|
43129
42903
|
/**
|
@@ -43135,6 +42909,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43135
42909
|
* @returns A promise that resolves to the transaction response.
|
43136
42910
|
*/
|
43137
42911
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42912
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
43138
42913
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
43139
42914
|
const recipientDataArray = arrayify(
|
43140
42915
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -43147,19 +42922,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43147
42922
|
...recipientDataArray,
|
43148
42923
|
...amountDataArray
|
43149
42924
|
]);
|
43150
|
-
const params = { script, ...txParams };
|
42925
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
43151
42926
|
const request = new ScriptTransactionRequest(params);
|
43152
|
-
const
|
43153
|
-
const
|
43154
|
-
|
43155
|
-
|
43156
|
-
|
43157
|
-
|
43158
|
-
|
43159
|
-
|
43160
|
-
|
43161
|
-
|
43162
|
-
|
42927
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42928
|
+
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42929
|
+
request,
|
42930
|
+
forwardingQuantities
|
42931
|
+
);
|
42932
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42933
|
+
this.validateGas({
|
42934
|
+
gasUsed,
|
42935
|
+
gasPrice: request.gasPrice,
|
42936
|
+
gasLimit: request.gasLimit,
|
42937
|
+
minGasPrice
|
42938
|
+
});
|
42939
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43163
42940
|
return this.sendTransaction(request);
|
43164
42941
|
}
|
43165
42942
|
async signMessage(message) {
|
@@ -43217,7 +42994,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43217
42994
|
}
|
43218
42995
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43219
42996
|
}
|
43220
|
-
validateGas({
|
42997
|
+
validateGas({
|
42998
|
+
gasUsed,
|
42999
|
+
gasPrice,
|
43000
|
+
gasLimit,
|
43001
|
+
minGasPrice
|
43002
|
+
}) {
|
43003
|
+
if (minGasPrice.gt(gasPrice)) {
|
43004
|
+
throw new FuelError(
|
43005
|
+
ErrorCode.GAS_PRICE_TOO_LOW,
|
43006
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
43007
|
+
);
|
43008
|
+
}
|
43221
43009
|
if (gasUsed.gt(gasLimit)) {
|
43222
43010
|
throw new FuelError(
|
43223
43011
|
ErrorCode.GAS_LIMIT_TOO_LOW,
|
@@ -44806,7 +44594,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44806
44594
|
* @param transactionRequestLike - The transaction request to send.
|
44807
44595
|
* @returns A promise that resolves to the TransactionResponse object.
|
44808
44596
|
*/
|
44809
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44597
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
44810
44598
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44811
44599
|
if (estimateTxDependencies) {
|
44812
44600
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -48042,7 +47830,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48042
47830
|
// src/predicate/predicate.ts
|
48043
47831
|
var Predicate = class extends Account {
|
48044
47832
|
bytes;
|
48045
|
-
predicateDataBytes = Uint8Array.from([]);
|
48046
47833
|
predicateData = [];
|
48047
47834
|
interface;
|
48048
47835
|
/**
|
@@ -48072,7 +47859,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48072
47859
|
this.interface = predicateInterface;
|
48073
47860
|
if (inputData !== void 0 && inputData.length > 0) {
|
48074
47861
|
this.predicateData = inputData;
|
48075
|
-
this.predicateDataBytes = this.getPredicateData(0);
|
48076
47862
|
}
|
48077
47863
|
}
|
48078
47864
|
/**
|
@@ -48086,8 +47872,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48086
47872
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
48087
47873
|
request.inputs?.forEach((input) => {
|
48088
47874
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
48089
|
-
input.predicate =
|
48090
|
-
input.predicateData =
|
47875
|
+
input.predicate = this.bytes;
|
47876
|
+
input.predicateData = this.getPredicateData(policies.length);
|
48091
47877
|
}
|
48092
47878
|
});
|
48093
47879
|
return request;
|
@@ -48102,7 +47888,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48102
47888
|
* @returns A promise that resolves to the prepared transaction request.
|
48103
47889
|
*/
|
48104
47890
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
48105
|
-
|
47891
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
47892
|
+
return this.populateTransactionPredicateData(request);
|
48106
47893
|
}
|
48107
47894
|
/**
|
48108
47895
|
* Sends a transaction with the populated predicate data.
|
@@ -48110,9 +47897,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48110
47897
|
* @param transactionRequestLike - The transaction request-like object.
|
48111
47898
|
* @returns A promise that resolves to the transaction response.
|
48112
47899
|
*/
|
48113
|
-
sendTransaction(transactionRequestLike) {
|
48114
|
-
const transactionRequest =
|
48115
|
-
return super.sendTransaction(transactionRequest,
|
47900
|
+
sendTransaction(transactionRequestLike, options) {
|
47901
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47902
|
+
return super.sendTransaction(transactionRequest, options);
|
48116
47903
|
}
|
48117
47904
|
/**
|
48118
47905
|
* Simulates a transaction with the populated predicate data.
|
@@ -48121,8 +47908,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48121
47908
|
* @returns A promise that resolves to the call result.
|
48122
47909
|
*/
|
48123
47910
|
simulateTransaction(transactionRequestLike) {
|
48124
|
-
const transactionRequest =
|
48125
|
-
return super.simulateTransaction(transactionRequest
|
47911
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47912
|
+
return super.simulateTransaction(transactionRequest);
|
48126
47913
|
}
|
48127
47914
|
getPredicateData(policiesLength) {
|
48128
47915
|
if (!this.predicateData.length) {
|
@@ -48168,26 +47955,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48168
47955
|
predicateInterface: abiInterface
|
48169
47956
|
};
|
48170
47957
|
}
|
48171
|
-
/**
|
48172
|
-
* Retrieves resources satisfying the spend query for the account.
|
48173
|
-
*
|
48174
|
-
* @param quantities - IDs of coins to exclude.
|
48175
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
48176
|
-
* @returns A promise that resolves to an array of Resources.
|
48177
|
-
*/
|
48178
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
48179
|
-
const resources = await this.provider.getResourcesToSpend(
|
48180
|
-
this.address,
|
48181
|
-
quantities,
|
48182
|
-
excludedIds
|
48183
|
-
);
|
48184
|
-
return resources.map((resource) => ({
|
48185
|
-
...resource,
|
48186
|
-
predicate: hexlify(this.bytes),
|
48187
|
-
predicateData: hexlify(this.predicateDataBytes),
|
48188
|
-
paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48189
|
-
}));
|
48190
|
-
}
|
48191
47958
|
/**
|
48192
47959
|
* Sets the configurable constants for the predicate.
|
48193
47960
|
*
|