@fuel-ts/account 0.0.0-rc-2021-20240422173414 → 0.0.0-rc-2045-20240422220518
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 +550 -798
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +509 -761
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +390 -641
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +2 -10
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +329 -911
- 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/message.d.ts +1 -7
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +27 -37
- 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 +1062 -1548
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +505 -739
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +399 -633
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +16 -16
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.55.0",
|
28956
|
+
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.81.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -31144,7 +31144,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31144
31144
|
toEvmAddress() {
|
31145
31145
|
const b256Address = toB256(this.bech32Address);
|
31146
31146
|
return {
|
31147
|
-
|
31147
|
+
bits: clearFirst12BytesFromB256(b256Address)
|
31148
31148
|
};
|
31149
31149
|
}
|
31150
31150
|
/**
|
@@ -31154,7 +31154,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31154
31154
|
*/
|
31155
31155
|
toAssetId() {
|
31156
31156
|
return {
|
31157
|
-
|
31157
|
+
bits: this.toB256()
|
31158
31158
|
};
|
31159
31159
|
}
|
31160
31160
|
/**
|
@@ -31495,182 +31495,32 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31495
31495
|
function toBytes3(value, bytesPadding) {
|
31496
31496
|
return bn(value).toBytes(bytesPadding);
|
31497
31497
|
}
|
31498
|
-
|
31499
|
-
|
31500
|
-
function _isPlaceholder(a) {
|
31501
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31502
|
-
}
|
31503
|
-
|
31504
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31505
|
-
function _curry1(fn) {
|
31506
|
-
return function f1(a) {
|
31507
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31508
|
-
return f1;
|
31509
|
-
} else {
|
31510
|
-
return fn.apply(this, arguments);
|
31511
|
-
}
|
31512
|
-
};
|
31513
|
-
}
|
31514
|
-
|
31515
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31516
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
31517
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31518
|
-
};
|
31519
|
-
|
31520
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31521
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31522
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31523
|
-
});
|
31524
|
-
var type_default = type;
|
31525
|
-
|
31526
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31527
|
-
var pad = function pad2(n) {
|
31528
|
-
return (n < 10 ? "0" : "") + n;
|
31529
|
-
};
|
31530
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31531
|
-
return d.toISOString();
|
31532
|
-
} : function _toISOString3(d) {
|
31533
|
-
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
31534
|
-
};
|
31535
|
-
|
31536
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31537
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31538
|
-
return n << 0 === n;
|
31539
|
-
};
|
31540
|
-
|
31541
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31542
|
-
function _cloneRegExp(pattern) {
|
31543
|
-
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
31498
|
+
function max(...numbers) {
|
31499
|
+
return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
|
31544
31500
|
}
|
31545
31501
|
|
31546
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31547
|
-
function _clone(value, deep, map) {
|
31548
|
-
map || (map = new _ObjectMap());
|
31549
|
-
if (_isPrimitive(value)) {
|
31550
|
-
return value;
|
31551
|
-
}
|
31552
|
-
var copy = function copy2(copiedValue) {
|
31553
|
-
var cachedCopy = map.get(value);
|
31554
|
-
if (cachedCopy) {
|
31555
|
-
return cachedCopy;
|
31556
|
-
}
|
31557
|
-
map.set(value, copiedValue);
|
31558
|
-
for (var key in value) {
|
31559
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31560
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31561
|
-
}
|
31562
|
-
}
|
31563
|
-
return copiedValue;
|
31564
|
-
};
|
31565
|
-
switch (type_default(value)) {
|
31566
|
-
case "Object":
|
31567
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
31568
|
-
case "Array":
|
31569
|
-
return copy([]);
|
31570
|
-
case "Date":
|
31571
|
-
return new Date(value.valueOf());
|
31572
|
-
case "RegExp":
|
31573
|
-
return _cloneRegExp(value);
|
31574
|
-
case "Int8Array":
|
31575
|
-
case "Uint8Array":
|
31576
|
-
case "Uint8ClampedArray":
|
31577
|
-
case "Int16Array":
|
31578
|
-
case "Uint16Array":
|
31579
|
-
case "Int32Array":
|
31580
|
-
case "Uint32Array":
|
31581
|
-
case "Float32Array":
|
31582
|
-
case "Float64Array":
|
31583
|
-
case "BigInt64Array":
|
31584
|
-
case "BigUint64Array":
|
31585
|
-
return value.slice();
|
31586
|
-
default:
|
31587
|
-
return value;
|
31588
|
-
}
|
31589
|
-
}
|
31590
|
-
function _isPrimitive(param) {
|
31591
|
-
var type3 = typeof param;
|
31592
|
-
return param == null || type3 != "object" && type3 != "function";
|
31593
|
-
}
|
31594
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
31595
|
-
function _ObjectMap2() {
|
31596
|
-
this.map = {};
|
31597
|
-
this.length = 0;
|
31598
|
-
}
|
31599
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
31600
|
-
const hashedKey = this.hash(key);
|
31601
|
-
let bucket = this.map[hashedKey];
|
31602
|
-
if (!bucket) {
|
31603
|
-
this.map[hashedKey] = bucket = [];
|
31604
|
-
}
|
31605
|
-
bucket.push([key, value]);
|
31606
|
-
this.length += 1;
|
31607
|
-
};
|
31608
|
-
_ObjectMap2.prototype.hash = function(key) {
|
31609
|
-
let hashedKey = [];
|
31610
|
-
for (var value in key) {
|
31611
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31612
|
-
}
|
31613
|
-
return hashedKey.join();
|
31614
|
-
};
|
31615
|
-
_ObjectMap2.prototype.get = function(key) {
|
31616
|
-
if (this.length <= 180) {
|
31617
|
-
for (const p in this.map) {
|
31618
|
-
const bucket2 = this.map[p];
|
31619
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
31620
|
-
const element = bucket2[i];
|
31621
|
-
if (element[0] === key) {
|
31622
|
-
return element[1];
|
31623
|
-
}
|
31624
|
-
}
|
31625
|
-
}
|
31626
|
-
return;
|
31627
|
-
}
|
31628
|
-
const hashedKey = this.hash(key);
|
31629
|
-
const bucket = this.map[hashedKey];
|
31630
|
-
if (!bucket) {
|
31631
|
-
return;
|
31632
|
-
}
|
31633
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
31634
|
-
const element = bucket[i];
|
31635
|
-
if (element[0] === key) {
|
31636
|
-
return element[1];
|
31637
|
-
}
|
31638
|
-
}
|
31639
|
-
};
|
31640
|
-
return _ObjectMap2;
|
31641
|
-
}();
|
31642
|
-
|
31643
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31644
|
-
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31645
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31646
|
-
});
|
31647
|
-
var clone_default = clone;
|
31648
|
-
|
31649
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31650
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31651
|
-
|
31652
31502
|
// src/providers/coin-quantity.ts
|
31653
31503
|
var coinQuantityfy = (coinQuantityLike) => {
|
31654
31504
|
let assetId;
|
31655
31505
|
let amount;
|
31656
|
-
let
|
31506
|
+
let max2;
|
31657
31507
|
if (Array.isArray(coinQuantityLike)) {
|
31658
31508
|
amount = coinQuantityLike[0];
|
31659
31509
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31660
|
-
|
31510
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31661
31511
|
} else {
|
31662
31512
|
amount = coinQuantityLike.amount;
|
31663
31513
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31664
|
-
|
31514
|
+
max2 = coinQuantityLike.max ?? void 0;
|
31665
31515
|
}
|
31666
31516
|
const bnAmount = bn(amount);
|
31667
31517
|
return {
|
31668
31518
|
assetId: hexlify(assetId),
|
31669
31519
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31670
|
-
max:
|
31520
|
+
max: max2 ? bn(max2) : void 0
|
31671
31521
|
};
|
31672
31522
|
};
|
31673
|
-
var
|
31523
|
+
var addAmountToAsset = (params) => {
|
31674
31524
|
const { amount, assetId } = params;
|
31675
31525
|
const coinQuantities = [...params.coinQuantities];
|
31676
31526
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31755,7 +31605,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31755
31605
|
var ENCODING_V1 = "1";
|
31756
31606
|
var WORD_SIZE = 8;
|
31757
31607
|
var BYTES_32 = 32;
|
31758
|
-
var UTXO_ID_LEN = BYTES_32 +
|
31608
|
+
var UTXO_ID_LEN = BYTES_32 + 1;
|
31759
31609
|
var ASSET_ID_LEN = BYTES_32;
|
31760
31610
|
var ADDRESS_LEN = BYTES_32;
|
31761
31611
|
var NONCE_LEN = BYTES_32;
|
@@ -31763,9 +31613,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31763
31613
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31764
31614
|
var MAX_BYTES = 2 ** 32 - 1;
|
31765
31615
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31766
|
-
|
31616
|
+
WORD_SIZE + // Tx size
|
31767
31617
|
// Asset ID/Balance coin input pairs
|
31768
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE)
|
31618
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31769
31619
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31770
31620
|
WORD_SIZE + // Gas limit
|
31771
31621
|
WORD_SIZE + // Script size
|
@@ -31783,6 +31633,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31783
31633
|
ASSET_ID_LEN + // Asset id
|
31784
31634
|
TX_POINTER_LEN + // TxPointer
|
31785
31635
|
WORD_SIZE + // Witnesses index
|
31636
|
+
WORD_SIZE + // Maturity
|
31786
31637
|
WORD_SIZE + // Predicate size
|
31787
31638
|
WORD_SIZE + // Predicate data size
|
31788
31639
|
WORD_SIZE;
|
@@ -32104,7 +31955,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32104
31955
|
constructor(name, coders) {
|
32105
31956
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32106
31957
|
const encodedValueSize = Object.values(coders).reduce(
|
32107
|
-
(
|
31958
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32108
31959
|
0
|
32109
31960
|
);
|
32110
31961
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32808,7 +32659,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32808
32659
|
constructor(name, coders) {
|
32809
32660
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32810
32661
|
const encodedValueSize = Object.values(coders).reduce(
|
32811
|
-
(
|
32662
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32812
32663
|
0
|
32813
32664
|
);
|
32814
32665
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33520,19 +33371,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33520
33371
|
encode(value) {
|
33521
33372
|
const parts = [];
|
33522
33373
|
parts.push(new B256Coder().encode(value.txID));
|
33523
|
-
parts.push(new NumberCoder("
|
33374
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33524
33375
|
parts.push(new B256Coder().encode(value.owner));
|
33525
33376
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33526
33377
|
parts.push(new B256Coder().encode(value.assetId));
|
33527
33378
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33528
|
-
parts.push(new NumberCoder("
|
33379
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33380
|
+
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33529
33381
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33530
|
-
parts.push(new
|
33531
|
-
parts.push(new
|
33532
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33533
|
-
parts.push(
|
33534
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33535
|
-
);
|
33382
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33383
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33384
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33385
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33536
33386
|
return concat(parts);
|
33537
33387
|
}
|
33538
33388
|
decode(data, offset) {
|
@@ -33540,7 +33390,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33540
33390
|
let o = offset;
|
33541
33391
|
[decoded, o] = new B256Coder().decode(data, o);
|
33542
33392
|
const txID = decoded;
|
33543
|
-
[decoded, o] = new NumberCoder("
|
33393
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33544
33394
|
const outputIndex = decoded;
|
33545
33395
|
[decoded, o] = new B256Coder().decode(data, o);
|
33546
33396
|
const owner = decoded;
|
@@ -33550,17 +33400,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33550
33400
|
const assetId = decoded;
|
33551
33401
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33552
33402
|
const txPointer = decoded;
|
33553
|
-
[decoded, o] = new NumberCoder("
|
33403
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33554
33404
|
const witnessIndex = Number(decoded);
|
33405
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33406
|
+
const maturity = decoded;
|
33555
33407
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33556
33408
|
const predicateGasUsed = decoded;
|
33557
|
-
[decoded, o] = new
|
33409
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33558
33410
|
const predicateLength = decoded;
|
33559
|
-
[decoded, o] = new
|
33411
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33560
33412
|
const predicateDataLength = decoded;
|
33561
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33413
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33562
33414
|
const predicate = decoded;
|
33563
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33415
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33564
33416
|
const predicateData = decoded;
|
33565
33417
|
return [
|
33566
33418
|
{
|
@@ -33572,6 +33424,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33572
33424
|
assetId,
|
33573
33425
|
txPointer,
|
33574
33426
|
witnessIndex,
|
33427
|
+
maturity,
|
33575
33428
|
predicateGasUsed,
|
33576
33429
|
predicateLength,
|
33577
33430
|
predicateDataLength,
|
@@ -33589,7 +33442,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33589
33442
|
encode(value) {
|
33590
33443
|
const parts = [];
|
33591
33444
|
parts.push(new B256Coder().encode(value.txID));
|
33592
|
-
parts.push(new NumberCoder("
|
33445
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33593
33446
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33594
33447
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33595
33448
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33601,7 +33454,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33601
33454
|
let o = offset;
|
33602
33455
|
[decoded, o] = new B256Coder().decode(data, o);
|
33603
33456
|
const txID = decoded;
|
33604
|
-
[decoded, o] = new NumberCoder("
|
33457
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33605
33458
|
const outputIndex = decoded;
|
33606
33459
|
[decoded, o] = new B256Coder().decode(data, o);
|
33607
33460
|
const balanceRoot = decoded;
|
@@ -33650,16 +33503,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33650
33503
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33651
33504
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33652
33505
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33653
|
-
parts.push(new NumberCoder("
|
33506
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33654
33507
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33655
|
-
parts.push(new
|
33656
|
-
parts.push(new
|
33657
|
-
parts.push(new
|
33508
|
+
parts.push(new NumberCoder("u32").encode(data.length));
|
33509
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33510
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33658
33511
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33659
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33660
|
-
parts.push(
|
33661
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33662
|
-
);
|
33512
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33513
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33663
33514
|
return concat(parts);
|
33664
33515
|
}
|
33665
33516
|
static decodeData(messageData) {
|
@@ -33679,21 +33530,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33679
33530
|
const amount = decoded;
|
33680
33531
|
[decoded, o] = new B256Coder().decode(data, o);
|
33681
33532
|
const nonce = decoded;
|
33682
|
-
[decoded, o] = new NumberCoder("
|
33533
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33683
33534
|
const witnessIndex = Number(decoded);
|
33684
33535
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33685
33536
|
const predicateGasUsed = decoded;
|
33686
33537
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33687
33538
|
const dataLength2 = decoded;
|
33688
|
-
[decoded, o] = new
|
33539
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33689
33540
|
const predicateLength = decoded;
|
33690
|
-
[decoded, o] = new
|
33541
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33691
33542
|
const predicateDataLength = decoded;
|
33692
33543
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33693
33544
|
const messageData = decoded;
|
33694
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33545
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33695
33546
|
const predicate = decoded;
|
33696
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33547
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33697
33548
|
const predicateData = decoded;
|
33698
33549
|
return [
|
33699
33550
|
{
|
@@ -34005,7 +33856,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34005
33856
|
}
|
34006
33857
|
};
|
34007
33858
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
34008
|
-
PolicyType2[PolicyType2["
|
33859
|
+
PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
|
34009
33860
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
34010
33861
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
34011
33862
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -34053,9 +33904,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34053
33904
|
let o = offset;
|
34054
33905
|
const policies = [];
|
34055
33906
|
if (policyTypes & 1) {
|
34056
|
-
const [
|
33907
|
+
const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
34057
33908
|
o = nextOffset;
|
34058
|
-
policies.push({ type: 1, data:
|
33909
|
+
policies.push({ type: 1, data: gasPrice });
|
34059
33910
|
}
|
34060
33911
|
if (policyTypes & 2) {
|
34061
33912
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34287,15 +34138,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34287
34138
|
encode(value) {
|
34288
34139
|
const parts = [];
|
34289
34140
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34290
|
-
parts.push(new
|
34291
|
-
parts.push(new
|
34292
|
-
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34141
|
+
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34142
|
+
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34293
34143
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34294
|
-
parts.push(new NumberCoder("
|
34295
|
-
parts.push(new NumberCoder("
|
34296
|
-
parts.push(new NumberCoder("
|
34297
|
-
parts.push(new
|
34298
|
-
parts.push(new ByteArrayCoder(value.
|
34144
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34145
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34146
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34147
|
+
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34148
|
+
parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
|
34149
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
|
34299
34150
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34300
34151
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34301
34152
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34307,23 +34158,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34307
34158
|
let o = offset;
|
34308
34159
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34309
34160
|
const scriptGasLimit = decoded;
|
34310
|
-
[decoded, o] = new
|
34311
|
-
const receiptsRoot = decoded;
|
34312
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34161
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34313
34162
|
const scriptLength = decoded;
|
34314
|
-
[decoded, o] = new
|
34163
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34315
34164
|
const scriptDataLength = decoded;
|
34316
34165
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34317
34166
|
const policyTypes = decoded;
|
34318
|
-
[decoded, o] = new NumberCoder("
|
34167
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34319
34168
|
const inputsCount = decoded;
|
34320
|
-
[decoded, o] = new NumberCoder("
|
34169
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34321
34170
|
const outputsCount = decoded;
|
34322
|
-
[decoded, o] = new NumberCoder("
|
34171
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34323
34172
|
const witnessesCount = decoded;
|
34324
|
-
[decoded, o] = new
|
34173
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34174
|
+
const receiptsRoot = decoded;
|
34175
|
+
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34325
34176
|
const script = decoded;
|
34326
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength
|
34177
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34327
34178
|
const scriptData = decoded;
|
34328
34179
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34329
34180
|
const policies = decoded;
|
@@ -34361,19 +34212,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34361
34212
|
}
|
34362
34213
|
encode(value) {
|
34363
34214
|
const parts = [];
|
34364
|
-
parts.push(new NumberCoder("
|
34365
|
-
parts.push(new
|
34366
|
-
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34215
|
+
parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
|
34216
|
+
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34367
34217
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34368
|
-
parts.push(new NumberCoder("u16").encode(value.
|
34369
|
-
parts.push(new NumberCoder("
|
34370
|
-
parts.push(new NumberCoder("
|
34218
|
+
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
34219
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34220
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34221
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34222
|
+
parts.push(new B256Coder().encode(value.salt));
|
34223
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34371
34224
|
parts.push(
|
34372
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount
|
34373
|
-
value.storageSlots
|
34374
|
-
)
|
34225
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
|
34375
34226
|
);
|
34376
|
-
parts.push(new PoliciesCoder().encode(value.policies));
|
34377
34227
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34378
34228
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34379
34229
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34382,27 +34232,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34382
34232
|
decode(data, offset) {
|
34383
34233
|
let decoded;
|
34384
34234
|
let o = offset;
|
34385
|
-
[decoded, o] = new NumberCoder("
|
34235
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34236
|
+
const bytecodeLength = decoded;
|
34237
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34386
34238
|
const bytecodeWitnessIndex = decoded;
|
34387
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
34388
|
-
const salt = decoded;
|
34389
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34390
|
-
const storageSlotsCount = decoded;
|
34391
34239
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34392
34240
|
const policyTypes = decoded;
|
34393
34241
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34242
|
+
const storageSlotsCount = decoded;
|
34243
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34394
34244
|
const inputsCount = decoded;
|
34395
|
-
[decoded, o] = new NumberCoder("
|
34245
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34396
34246
|
const outputsCount = decoded;
|
34397
|
-
[decoded, o] = new NumberCoder("
|
34247
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34398
34248
|
const witnessesCount = decoded;
|
34399
|
-
[decoded, o] = new
|
34400
|
-
|
34401
|
-
o
|
34402
|
-
);
|
34403
|
-
const storageSlots = decoded;
|
34249
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34250
|
+
const salt = decoded;
|
34404
34251
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34405
34252
|
const policies = decoded;
|
34253
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34254
|
+
const storageSlots = decoded;
|
34406
34255
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34407
34256
|
const inputs = decoded;
|
34408
34257
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34412,6 +34261,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34412
34261
|
return [
|
34413
34262
|
{
|
34414
34263
|
type: 1,
|
34264
|
+
bytecodeLength,
|
34415
34265
|
bytecodeWitnessIndex,
|
34416
34266
|
policyTypes,
|
34417
34267
|
storageSlotsCount,
|
@@ -34440,7 +34290,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34440
34290
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34441
34291
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34442
34292
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34443
|
-
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34444
34293
|
return concat(parts);
|
34445
34294
|
}
|
34446
34295
|
decode(data, offset) {
|
@@ -34456,8 +34305,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34456
34305
|
const mintAmount = decoded;
|
34457
34306
|
[decoded, o] = new B256Coder().decode(data, o);
|
34458
34307
|
const mintAssetId = decoded;
|
34459
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34460
|
-
const gasPrice = decoded;
|
34461
34308
|
return [
|
34462
34309
|
{
|
34463
34310
|
type: 2,
|
@@ -34465,8 +34312,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34465
34312
|
inputContract,
|
34466
34313
|
outputContract,
|
34467
34314
|
mintAmount,
|
34468
|
-
mintAssetId
|
34469
|
-
gasPrice
|
34315
|
+
mintAssetId
|
34470
34316
|
},
|
34471
34317
|
o
|
34472
34318
|
];
|
@@ -34773,6 +34619,159 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34773
34619
|
// src/providers/provider.ts
|
34774
34620
|
var import_graphql_request = __toESM(require_dist2());
|
34775
34621
|
|
34622
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34623
|
+
function _isPlaceholder(a) {
|
34624
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34625
|
+
}
|
34626
|
+
|
34627
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34628
|
+
function _curry1(fn) {
|
34629
|
+
return function f1(a) {
|
34630
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34631
|
+
return f1;
|
34632
|
+
} else {
|
34633
|
+
return fn.apply(this, arguments);
|
34634
|
+
}
|
34635
|
+
};
|
34636
|
+
}
|
34637
|
+
|
34638
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34639
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
34640
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34641
|
+
};
|
34642
|
+
|
34643
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34644
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34645
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34646
|
+
});
|
34647
|
+
var type_default = type;
|
34648
|
+
|
34649
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34650
|
+
var pad = function pad2(n) {
|
34651
|
+
return (n < 10 ? "0" : "") + n;
|
34652
|
+
};
|
34653
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34654
|
+
return d.toISOString();
|
34655
|
+
} : function _toISOString3(d) {
|
34656
|
+
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
34657
|
+
};
|
34658
|
+
|
34659
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34660
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34661
|
+
return n << 0 === n;
|
34662
|
+
};
|
34663
|
+
|
34664
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34665
|
+
function _cloneRegExp(pattern) {
|
34666
|
+
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
34667
|
+
}
|
34668
|
+
|
34669
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34670
|
+
function _clone(value, deep, map) {
|
34671
|
+
map || (map = new _ObjectMap());
|
34672
|
+
if (_isPrimitive(value)) {
|
34673
|
+
return value;
|
34674
|
+
}
|
34675
|
+
var copy = function copy2(copiedValue) {
|
34676
|
+
var cachedCopy = map.get(value);
|
34677
|
+
if (cachedCopy) {
|
34678
|
+
return cachedCopy;
|
34679
|
+
}
|
34680
|
+
map.set(value, copiedValue);
|
34681
|
+
for (var key in value) {
|
34682
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34683
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34684
|
+
}
|
34685
|
+
}
|
34686
|
+
return copiedValue;
|
34687
|
+
};
|
34688
|
+
switch (type_default(value)) {
|
34689
|
+
case "Object":
|
34690
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
34691
|
+
case "Array":
|
34692
|
+
return copy([]);
|
34693
|
+
case "Date":
|
34694
|
+
return new Date(value.valueOf());
|
34695
|
+
case "RegExp":
|
34696
|
+
return _cloneRegExp(value);
|
34697
|
+
case "Int8Array":
|
34698
|
+
case "Uint8Array":
|
34699
|
+
case "Uint8ClampedArray":
|
34700
|
+
case "Int16Array":
|
34701
|
+
case "Uint16Array":
|
34702
|
+
case "Int32Array":
|
34703
|
+
case "Uint32Array":
|
34704
|
+
case "Float32Array":
|
34705
|
+
case "Float64Array":
|
34706
|
+
case "BigInt64Array":
|
34707
|
+
case "BigUint64Array":
|
34708
|
+
return value.slice();
|
34709
|
+
default:
|
34710
|
+
return value;
|
34711
|
+
}
|
34712
|
+
}
|
34713
|
+
function _isPrimitive(param) {
|
34714
|
+
var type3 = typeof param;
|
34715
|
+
return param == null || type3 != "object" && type3 != "function";
|
34716
|
+
}
|
34717
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
34718
|
+
function _ObjectMap2() {
|
34719
|
+
this.map = {};
|
34720
|
+
this.length = 0;
|
34721
|
+
}
|
34722
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
34723
|
+
const hashedKey = this.hash(key);
|
34724
|
+
let bucket = this.map[hashedKey];
|
34725
|
+
if (!bucket) {
|
34726
|
+
this.map[hashedKey] = bucket = [];
|
34727
|
+
}
|
34728
|
+
bucket.push([key, value]);
|
34729
|
+
this.length += 1;
|
34730
|
+
};
|
34731
|
+
_ObjectMap2.prototype.hash = function(key) {
|
34732
|
+
let hashedKey = [];
|
34733
|
+
for (var value in key) {
|
34734
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34735
|
+
}
|
34736
|
+
return hashedKey.join();
|
34737
|
+
};
|
34738
|
+
_ObjectMap2.prototype.get = function(key) {
|
34739
|
+
if (this.length <= 180) {
|
34740
|
+
for (const p in this.map) {
|
34741
|
+
const bucket2 = this.map[p];
|
34742
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
34743
|
+
const element = bucket2[i];
|
34744
|
+
if (element[0] === key) {
|
34745
|
+
return element[1];
|
34746
|
+
}
|
34747
|
+
}
|
34748
|
+
}
|
34749
|
+
return;
|
34750
|
+
}
|
34751
|
+
const hashedKey = this.hash(key);
|
34752
|
+
const bucket = this.map[hashedKey];
|
34753
|
+
if (!bucket) {
|
34754
|
+
return;
|
34755
|
+
}
|
34756
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
34757
|
+
const element = bucket[i];
|
34758
|
+
if (element[0] === key) {
|
34759
|
+
return element[1];
|
34760
|
+
}
|
34761
|
+
}
|
34762
|
+
};
|
34763
|
+
return _ObjectMap2;
|
34764
|
+
}();
|
34765
|
+
|
34766
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34767
|
+
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34768
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34769
|
+
});
|
34770
|
+
var clone_default = clone2;
|
34771
|
+
|
34772
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34773
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34774
|
+
|
34776
34775
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34777
34776
|
var __assign = function() {
|
34778
34777
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37940,10 +37939,14 @@ spurious results.`);
|
|
37940
37939
|
// src/providers/__generated__/operations.ts
|
37941
37940
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37942
37941
|
fragment receiptFragment on Receipt {
|
37943
|
-
|
37942
|
+
contract {
|
37943
|
+
id
|
37944
|
+
}
|
37944
37945
|
pc
|
37945
37946
|
is
|
37946
|
-
to
|
37947
|
+
to {
|
37948
|
+
id
|
37949
|
+
}
|
37947
37950
|
toAddress
|
37948
37951
|
amount
|
37949
37952
|
assetId
|
@@ -37981,16 +37984,10 @@ spurious results.`);
|
|
37981
37984
|
id
|
37982
37985
|
}
|
37983
37986
|
time
|
37984
|
-
receipts {
|
37985
|
-
...receiptFragment
|
37986
|
-
}
|
37987
37987
|
programState {
|
37988
37988
|
returnType
|
37989
37989
|
data
|
37990
37990
|
}
|
37991
|
-
receipts {
|
37992
|
-
...receiptFragment
|
37993
|
-
}
|
37994
37991
|
}
|
37995
37992
|
... on FailureStatus {
|
37996
37993
|
block {
|
@@ -37998,24 +37995,26 @@ spurious results.`);
|
|
37998
37995
|
}
|
37999
37996
|
time
|
38000
37997
|
reason
|
38001
|
-
receipts {
|
38002
|
-
...receiptFragment
|
38003
|
-
}
|
38004
37998
|
}
|
38005
37999
|
... on SqueezedOutStatus {
|
38006
38000
|
reason
|
38007
38001
|
}
|
38008
38002
|
}
|
38009
|
-
|
38003
|
+
`;
|
38010
38004
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38011
38005
|
fragment transactionFragment on Transaction {
|
38012
38006
|
id
|
38013
38007
|
rawPayload
|
38008
|
+
gasPrice
|
38009
|
+
receipts {
|
38010
|
+
...receiptFragment
|
38011
|
+
}
|
38014
38012
|
status {
|
38015
38013
|
...transactionStatusFragment
|
38016
38014
|
}
|
38017
38015
|
}
|
38018
|
-
${
|
38016
|
+
${ReceiptFragmentFragmentDoc}
|
38017
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38019
38018
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38020
38019
|
fragment inputEstimatePredicatesFragment on Input {
|
38021
38020
|
... on InputCoin {
|
@@ -38033,46 +38032,6 @@ spurious results.`);
|
|
38033
38032
|
}
|
38034
38033
|
}
|
38035
38034
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38036
|
-
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38037
|
-
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38038
|
-
reason
|
38039
|
-
programState {
|
38040
|
-
returnType
|
38041
|
-
data
|
38042
|
-
}
|
38043
|
-
}
|
38044
|
-
`;
|
38045
|
-
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38046
|
-
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38047
|
-
programState {
|
38048
|
-
returnType
|
38049
|
-
data
|
38050
|
-
}
|
38051
|
-
}
|
38052
|
-
`;
|
38053
|
-
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38054
|
-
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38055
|
-
... on DryRunFailureStatus {
|
38056
|
-
...dryRunFailureStatusFragment
|
38057
|
-
}
|
38058
|
-
... on DryRunSuccessStatus {
|
38059
|
-
...dryRunSuccessStatusFragment
|
38060
|
-
}
|
38061
|
-
}
|
38062
|
-
${DryRunFailureStatusFragmentFragmentDoc}
|
38063
|
-
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38064
|
-
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38065
|
-
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38066
|
-
id
|
38067
|
-
status {
|
38068
|
-
...dryRunTransactionStatusFragment
|
38069
|
-
}
|
38070
|
-
receipts {
|
38071
|
-
...receiptFragment
|
38072
|
-
}
|
38073
|
-
}
|
38074
|
-
${DryRunTransactionStatusFragmentFragmentDoc}
|
38075
|
-
${ReceiptFragmentFragmentDoc}`;
|
38076
38035
|
var CoinFragmentFragmentDoc = lib_default2`
|
38077
38036
|
fragment coinFragment on Coin {
|
38078
38037
|
__typename
|
@@ -38080,6 +38039,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38080
38039
|
owner
|
38081
38040
|
amount
|
38082
38041
|
assetId
|
38042
|
+
maturity
|
38083
38043
|
blockCreated
|
38084
38044
|
txCreatedIdx
|
38085
38045
|
}
|
@@ -38118,32 +38078,26 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38118
38078
|
messageBlockHeader {
|
38119
38079
|
id
|
38120
38080
|
daHeight
|
38121
|
-
consensusParametersVersion
|
38122
|
-
stateTransitionBytecodeVersion
|
38123
38081
|
transactionsCount
|
38124
|
-
messageReceiptCount
|
38125
38082
|
transactionsRoot
|
38126
|
-
messageOutboxRoot
|
38127
|
-
eventInboxRoot
|
38128
38083
|
height
|
38129
38084
|
prevRoot
|
38130
38085
|
time
|
38131
38086
|
applicationHash
|
38087
|
+
messageReceiptRoot
|
38088
|
+
messageReceiptCount
|
38132
38089
|
}
|
38133
38090
|
commitBlockHeader {
|
38134
38091
|
id
|
38135
38092
|
daHeight
|
38136
|
-
consensusParametersVersion
|
38137
|
-
stateTransitionBytecodeVersion
|
38138
38093
|
transactionsCount
|
38139
|
-
messageReceiptCount
|
38140
38094
|
transactionsRoot
|
38141
|
-
messageOutboxRoot
|
38142
|
-
eventInboxRoot
|
38143
38095
|
height
|
38144
38096
|
prevRoot
|
38145
38097
|
time
|
38146
38098
|
applicationHash
|
38099
|
+
messageReceiptRoot
|
38100
|
+
messageReceiptCount
|
38147
38101
|
}
|
38148
38102
|
sender
|
38149
38103
|
recipient
|
@@ -38162,8 +38116,8 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38162
38116
|
var BlockFragmentFragmentDoc = lib_default2`
|
38163
38117
|
fragment blockFragment on Block {
|
38164
38118
|
id
|
38165
|
-
height
|
38166
38119
|
header {
|
38120
|
+
height
|
38167
38121
|
time
|
38168
38122
|
}
|
38169
38123
|
transactions {
|
@@ -38221,11 +38175,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38221
38175
|
`;
|
38222
38176
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38223
38177
|
fragment GasCostsFragment on GasCosts {
|
38224
|
-
version {
|
38225
|
-
... on Version {
|
38226
|
-
value
|
38227
|
-
}
|
38228
|
-
}
|
38229
38178
|
add
|
38230
38179
|
addi
|
38231
38180
|
aloc
|
@@ -38238,6 +38187,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38238
38187
|
cb
|
38239
38188
|
cfei
|
38240
38189
|
cfsi
|
38190
|
+
croo
|
38241
38191
|
div
|
38242
38192
|
divi
|
38243
38193
|
ecr1
|
@@ -38320,9 +38270,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38320
38270
|
ccp {
|
38321
38271
|
...DependentCostFragment
|
38322
38272
|
}
|
38323
|
-
croo {
|
38324
|
-
...DependentCostFragment
|
38325
|
-
}
|
38326
38273
|
csiz {
|
38327
38274
|
...DependentCostFragment
|
38328
38275
|
}
|
@@ -38382,11 +38329,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38382
38329
|
${DependentCostFragmentFragmentDoc}`;
|
38383
38330
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38384
38331
|
fragment consensusParametersFragment on ConsensusParameters {
|
38385
|
-
version {
|
38386
|
-
... on Version {
|
38387
|
-
value
|
38388
|
-
}
|
38389
|
-
}
|
38390
38332
|
txParams {
|
38391
38333
|
...TxParametersFragment
|
38392
38334
|
}
|
@@ -38446,9 +38388,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38446
38388
|
fragment nodeInfoFragment on NodeInfo {
|
38447
38389
|
utxoValidation
|
38448
38390
|
vmBacktrace
|
38391
|
+
minGasPrice
|
38449
38392
|
maxTx
|
38450
38393
|
maxDepth
|
38451
38394
|
nodeVersion
|
38395
|
+
peers {
|
38396
|
+
id
|
38397
|
+
addresses
|
38398
|
+
clientVersion
|
38399
|
+
blockHeight
|
38400
|
+
lastHeartbeatMs
|
38401
|
+
appScore
|
38402
|
+
}
|
38452
38403
|
}
|
38453
38404
|
`;
|
38454
38405
|
var GetVersionDocument = lib_default2`
|
@@ -38483,9 +38434,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38483
38434
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38484
38435
|
transaction(id: $transactionId) {
|
38485
38436
|
...transactionFragment
|
38437
|
+
receipts {
|
38438
|
+
...receiptFragment
|
38439
|
+
}
|
38486
38440
|
}
|
38487
38441
|
}
|
38488
|
-
${TransactionFragmentFragmentDoc}
|
38442
|
+
${TransactionFragmentFragmentDoc}
|
38443
|
+
${ReceiptFragmentFragmentDoc}`;
|
38489
38444
|
var GetTransactionsDocument = lib_default2`
|
38490
38445
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38491
38446
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38613,20 +38568,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38613
38568
|
}
|
38614
38569
|
}
|
38615
38570
|
${BalanceFragmentFragmentDoc}`;
|
38616
|
-
var GetLatestGasPriceDocument = lib_default2`
|
38617
|
-
query getLatestGasPrice {
|
38618
|
-
latestGasPrice {
|
38619
|
-
gasPrice
|
38620
|
-
}
|
38621
|
-
}
|
38622
|
-
`;
|
38623
|
-
var EstimateGasPriceDocument = lib_default2`
|
38624
|
-
query estimateGasPrice($blockHorizon: U32!) {
|
38625
|
-
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38626
|
-
gasPrice
|
38627
|
-
}
|
38628
|
-
}
|
38629
|
-
`;
|
38630
38571
|
var GetBalancesDocument = lib_default2`
|
38631
38572
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38632
38573
|
balances(
|
@@ -38681,12 +38622,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38681
38622
|
}
|
38682
38623
|
`;
|
38683
38624
|
var DryRunDocument = lib_default2`
|
38684
|
-
mutation dryRun($
|
38685
|
-
dryRun(
|
38686
|
-
...
|
38625
|
+
mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
|
38626
|
+
dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
|
38627
|
+
...receiptFragment
|
38687
38628
|
}
|
38688
38629
|
}
|
38689
|
-
${
|
38630
|
+
${ReceiptFragmentFragmentDoc}`;
|
38690
38631
|
var SubmitDocument = lib_default2`
|
38691
38632
|
mutation submit($encodedTransaction: HexString!) {
|
38692
38633
|
submit(tx: $encodedTransaction) {
|
@@ -38769,12 +38710,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38769
38710
|
getBalance(variables, options) {
|
38770
38711
|
return requester(GetBalanceDocument, variables, options);
|
38771
38712
|
},
|
38772
|
-
getLatestGasPrice(variables, options) {
|
38773
|
-
return requester(GetLatestGasPriceDocument, variables, options);
|
38774
|
-
},
|
38775
|
-
estimateGasPrice(variables, options) {
|
38776
|
-
return requester(EstimateGasPriceDocument, variables, options);
|
38777
|
-
},
|
38778
38713
|
getBalances(variables, options) {
|
38779
38714
|
return requester(GetBalancesDocument, variables, options);
|
38780
38715
|
},
|
@@ -38958,9 +38893,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38958
38893
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38959
38894
|
},
|
38960
38895
|
witnessIndex: value.witnessIndex,
|
38896
|
+
maturity: value.maturity ?? 0,
|
38961
38897
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38962
|
-
predicateLength:
|
38963
|
-
predicateDataLength:
|
38898
|
+
predicateLength: predicate.length,
|
38899
|
+
predicateDataLength: predicateData.length,
|
38964
38900
|
predicate: hexlify(predicate),
|
38965
38901
|
predicateData: hexlify(predicateData)
|
38966
38902
|
};
|
@@ -38991,8 +38927,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38991
38927
|
nonce: hexlify(value.nonce),
|
38992
38928
|
witnessIndex: value.witnessIndex,
|
38993
38929
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38994
|
-
predicateLength:
|
38995
|
-
predicateDataLength:
|
38930
|
+
predicateLength: predicate.length,
|
38931
|
+
predicateDataLength: predicateData.length,
|
38996
38932
|
predicate: hexlify(predicate),
|
38997
38933
|
predicateData: hexlify(predicateData),
|
38998
38934
|
data: hexlify(data),
|
@@ -39152,8 +39088,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39152
39088
|
case "CALL" /* Call */: {
|
39153
39089
|
const callReceipt = {
|
39154
39090
|
type: ReceiptType.Call,
|
39155
|
-
from: hexOrZero(receipt.id
|
39156
|
-
to: hexOrZero(receipt?.to),
|
39091
|
+
from: hexOrZero(receipt.contract?.id),
|
39092
|
+
to: hexOrZero(receipt?.to?.id),
|
39157
39093
|
amount: bn(receipt.amount),
|
39158
39094
|
assetId: hexOrZero(receipt.assetId),
|
39159
39095
|
gas: bn(receipt.gas),
|
@@ -39167,7 +39103,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39167
39103
|
case "RETURN" /* Return */: {
|
39168
39104
|
const returnReceipt = {
|
39169
39105
|
type: ReceiptType.Return,
|
39170
|
-
id: hexOrZero(receipt.id
|
39106
|
+
id: hexOrZero(receipt.contract?.id),
|
39171
39107
|
val: bn(receipt.val),
|
39172
39108
|
pc: bn(receipt.pc),
|
39173
39109
|
is: bn(receipt.is)
|
@@ -39177,7 +39113,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39177
39113
|
case "RETURN_DATA" /* ReturnData */: {
|
39178
39114
|
const returnDataReceipt = {
|
39179
39115
|
type: ReceiptType.ReturnData,
|
39180
|
-
id: hexOrZero(receipt.id
|
39116
|
+
id: hexOrZero(receipt.contract?.id),
|
39181
39117
|
ptr: bn(receipt.ptr),
|
39182
39118
|
len: bn(receipt.len),
|
39183
39119
|
digest: hexOrZero(receipt.digest),
|
@@ -39189,7 +39125,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39189
39125
|
case "PANIC" /* Panic */: {
|
39190
39126
|
const panicReceipt = {
|
39191
39127
|
type: ReceiptType.Panic,
|
39192
|
-
id: hexOrZero(receipt.id),
|
39128
|
+
id: hexOrZero(receipt.contract?.id),
|
39193
39129
|
reason: bn(receipt.reason),
|
39194
39130
|
pc: bn(receipt.pc),
|
39195
39131
|
is: bn(receipt.is),
|
@@ -39200,7 +39136,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39200
39136
|
case "REVERT" /* Revert */: {
|
39201
39137
|
const revertReceipt = {
|
39202
39138
|
type: ReceiptType.Revert,
|
39203
|
-
id: hexOrZero(receipt.id
|
39139
|
+
id: hexOrZero(receipt.contract?.id),
|
39204
39140
|
val: bn(receipt.ra),
|
39205
39141
|
pc: bn(receipt.pc),
|
39206
39142
|
is: bn(receipt.is)
|
@@ -39210,7 +39146,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39210
39146
|
case "LOG" /* Log */: {
|
39211
39147
|
const logReceipt = {
|
39212
39148
|
type: ReceiptType.Log,
|
39213
|
-
id: hexOrZero(receipt.id
|
39149
|
+
id: hexOrZero(receipt.contract?.id),
|
39214
39150
|
val0: bn(receipt.ra),
|
39215
39151
|
val1: bn(receipt.rb),
|
39216
39152
|
val2: bn(receipt.rc),
|
@@ -39223,7 +39159,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39223
39159
|
case "LOG_DATA" /* LogData */: {
|
39224
39160
|
const logDataReceipt = {
|
39225
39161
|
type: ReceiptType.LogData,
|
39226
|
-
id: hexOrZero(receipt.id
|
39162
|
+
id: hexOrZero(receipt.contract?.id),
|
39227
39163
|
val0: bn(receipt.ra),
|
39228
39164
|
val1: bn(receipt.rb),
|
39229
39165
|
ptr: bn(receipt.ptr),
|
@@ -39237,8 +39173,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39237
39173
|
case "TRANSFER" /* Transfer */: {
|
39238
39174
|
const transferReceipt = {
|
39239
39175
|
type: ReceiptType.Transfer,
|
39240
|
-
from: hexOrZero(receipt.id
|
39241
|
-
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39176
|
+
from: hexOrZero(receipt.contract?.id),
|
39177
|
+
to: hexOrZero(receipt.toAddress || receipt?.to?.id),
|
39242
39178
|
amount: bn(receipt.amount),
|
39243
39179
|
assetId: hexOrZero(receipt.assetId),
|
39244
39180
|
pc: bn(receipt.pc),
|
@@ -39249,8 +39185,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39249
39185
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39250
39186
|
const transferOutReceipt = {
|
39251
39187
|
type: ReceiptType.TransferOut,
|
39252
|
-
from: hexOrZero(receipt.id
|
39253
|
-
to: hexOrZero(receipt.toAddress || receipt.to),
|
39188
|
+
from: hexOrZero(receipt.contract?.id),
|
39189
|
+
to: hexOrZero(receipt.toAddress || receipt.to?.id),
|
39254
39190
|
amount: bn(receipt.amount),
|
39255
39191
|
assetId: hexOrZero(receipt.assetId),
|
39256
39192
|
pc: bn(receipt.pc),
|
@@ -39293,7 +39229,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39293
39229
|
return receiptMessageOut;
|
39294
39230
|
}
|
39295
39231
|
case "MINT" /* Mint */: {
|
39296
|
-
const contractId = hexOrZero(receipt.id
|
39232
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39297
39233
|
const subId = hexOrZero(receipt.subId);
|
39298
39234
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39299
39235
|
const mintReceipt = {
|
@@ -39308,7 +39244,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39308
39244
|
return mintReceipt;
|
39309
39245
|
}
|
39310
39246
|
case "BURN" /* Burn */: {
|
39311
|
-
const contractId = hexOrZero(receipt.id
|
39247
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39312
39248
|
const subId = hexOrZero(receipt.subId);
|
39313
39249
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39314
39250
|
const burnReceipt = {
|
@@ -39389,6 +39325,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39389
39325
|
};
|
39390
39326
|
|
39391
39327
|
// src/providers/utils/gas.ts
|
39328
|
+
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39392
39329
|
var getGasUsedFromReceipts = (receipts) => {
|
39393
39330
|
const scriptResult = receipts.filter(
|
39394
39331
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39409,28 +39346,18 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39409
39346
|
}
|
39410
39347
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39411
39348
|
const witnessCache = [];
|
39412
|
-
const
|
39413
|
-
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39414
|
-
if (isCoinOrMessage) {
|
39415
|
-
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39416
|
-
return true;
|
39417
|
-
}
|
39418
|
-
if (!witnessCache.includes(input.witnessIndex)) {
|
39419
|
-
witnessCache.push(input.witnessIndex);
|
39420
|
-
return true;
|
39421
|
-
}
|
39422
|
-
}
|
39423
|
-
return false;
|
39424
|
-
});
|
39425
|
-
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39426
|
-
const totalGas = chargeableInputs.reduce((total, input) => {
|
39349
|
+
const totalGas = inputs.reduce((total, input) => {
|
39427
39350
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39428
39351
|
return total.add(
|
39429
|
-
|
39352
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39430
39353
|
);
|
39431
39354
|
}
|
39432
|
-
|
39433
|
-
|
39355
|
+
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
39356
|
+
witnessCache.push(input.witnessIndex);
|
39357
|
+
return total.add(gasCosts.ecr1);
|
39358
|
+
}
|
39359
|
+
return total;
|
39360
|
+
}, bn());
|
39434
39361
|
return totalGas;
|
39435
39362
|
}
|
39436
39363
|
function getMinGas(params) {
|
@@ -39442,20 +39369,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39442
39369
|
return minGas;
|
39443
39370
|
}
|
39444
39371
|
function getMaxGas(params) {
|
39445
|
-
const {
|
39446
|
-
gasPerByte,
|
39447
|
-
witnessesLength,
|
39448
|
-
witnessLimit,
|
39449
|
-
minGas,
|
39450
|
-
gasLimit = bn(0),
|
39451
|
-
maxGasPerTx
|
39452
|
-
} = params;
|
39372
|
+
const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
|
39453
39373
|
let remainingAllowedWitnessGas = bn(0);
|
39454
39374
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39455
39375
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39456
39376
|
}
|
39457
|
-
|
39458
|
-
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39377
|
+
return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39459
39378
|
}
|
39460
39379
|
function calculateMetadataGasForTxCreate({
|
39461
39380
|
gasCosts,
|
@@ -39477,10 +39396,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39477
39396
|
}) {
|
39478
39397
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39479
39398
|
}
|
39480
|
-
var calculateGasFee = (params) => {
|
39481
|
-
const { gas, gasPrice, priceFactor, tip } = params;
|
39482
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39483
|
-
};
|
39484
39399
|
|
39485
39400
|
// src/providers/utils/json.ts
|
39486
39401
|
function normalize2(object) {
|
@@ -39622,7 +39537,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39622
39537
|
// src/providers/transaction-request/transaction-request.ts
|
39623
39538
|
var BaseTransactionRequest = class {
|
39624
39539
|
/** Gas price for transaction */
|
39625
|
-
|
39540
|
+
gasPrice;
|
39626
39541
|
/** Block until which tx cannot be included */
|
39627
39542
|
maturity;
|
39628
39543
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39641,7 +39556,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39641
39556
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39642
39557
|
*/
|
39643
39558
|
constructor({
|
39644
|
-
|
39559
|
+
gasPrice,
|
39645
39560
|
maturity,
|
39646
39561
|
maxFee,
|
39647
39562
|
witnessLimit,
|
@@ -39649,7 +39564,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39649
39564
|
outputs,
|
39650
39565
|
witnesses
|
39651
39566
|
} = {}) {
|
39652
|
-
this.
|
39567
|
+
this.gasPrice = bn(gasPrice);
|
39653
39568
|
this.maturity = maturity ?? 0;
|
39654
39569
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39655
39570
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39660,9 +39575,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39660
39575
|
static getPolicyMeta(req) {
|
39661
39576
|
let policyTypes = 0;
|
39662
39577
|
const policies = [];
|
39663
|
-
if (req.
|
39664
|
-
policyTypes += PolicyType.
|
39665
|
-
policies.push({ data: req.
|
39578
|
+
if (req.gasPrice) {
|
39579
|
+
policyTypes += PolicyType.GasPrice;
|
39580
|
+
policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
|
39666
39581
|
}
|
39667
39582
|
if (req.witnessLimit) {
|
39668
39583
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39849,10 +39764,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39849
39764
|
* @param predicate - Predicate bytes.
|
39850
39765
|
* @param predicateData - Predicate data bytes.
|
39851
39766
|
*/
|
39852
|
-
addCoinInput(coin) {
|
39767
|
+
addCoinInput(coin, predicate) {
|
39853
39768
|
const { assetId, owner, amount } = coin;
|
39854
39769
|
let witnessIndex;
|
39855
|
-
if (
|
39770
|
+
if (predicate) {
|
39856
39771
|
witnessIndex = 0;
|
39857
39772
|
} else {
|
39858
39773
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39867,7 +39782,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39867
39782
|
amount,
|
39868
39783
|
assetId,
|
39869
39784
|
txPointer: "0x00000000000000000000000000000000",
|
39870
|
-
witnessIndex
|
39785
|
+
witnessIndex,
|
39786
|
+
predicate: predicate?.bytes
|
39871
39787
|
};
|
39872
39788
|
this.pushInput(input);
|
39873
39789
|
this.addChangeOutput(owner, assetId);
|
@@ -39880,11 +39796,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39880
39796
|
* @param predicate - Predicate bytes.
|
39881
39797
|
* @param predicateData - Predicate data bytes.
|
39882
39798
|
*/
|
39883
|
-
addMessageInput(message) {
|
39799
|
+
addMessageInput(message, predicate) {
|
39884
39800
|
const { recipient, sender, amount } = message;
|
39885
39801
|
const assetId = BaseAssetId;
|
39886
39802
|
let witnessIndex;
|
39887
|
-
if (
|
39803
|
+
if (predicate) {
|
39888
39804
|
witnessIndex = 0;
|
39889
39805
|
} else {
|
39890
39806
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39898,7 +39814,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39898
39814
|
sender: sender.toB256(),
|
39899
39815
|
recipient: recipient.toB256(),
|
39900
39816
|
amount,
|
39901
|
-
witnessIndex
|
39817
|
+
witnessIndex,
|
39818
|
+
predicate: predicate?.bytes
|
39902
39819
|
};
|
39903
39820
|
this.pushInput(input);
|
39904
39821
|
this.addChangeOutput(recipient, assetId);
|
@@ -39929,6 +39846,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39929
39846
|
resources.forEach((resource) => this.addResource(resource));
|
39930
39847
|
return this;
|
39931
39848
|
}
|
39849
|
+
/**
|
39850
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
39851
|
+
* outputs from the related assetIds.
|
39852
|
+
*
|
39853
|
+
* @param resources - The resources to add.
|
39854
|
+
* @returns This transaction.
|
39855
|
+
*/
|
39856
|
+
addPredicateResource(resource, predicate) {
|
39857
|
+
if (isCoin(resource)) {
|
39858
|
+
this.addCoinInput(resource, predicate);
|
39859
|
+
} else {
|
39860
|
+
this.addMessageInput(resource, predicate);
|
39861
|
+
}
|
39862
|
+
return this;
|
39863
|
+
}
|
39864
|
+
/**
|
39865
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
39866
|
+
* from the related assetIds.
|
39867
|
+
*
|
39868
|
+
* @param resources - The resources to add.
|
39869
|
+
* @returns This transaction.
|
39870
|
+
*/
|
39871
|
+
addPredicateResources(resources, predicate) {
|
39872
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
39873
|
+
return this;
|
39874
|
+
}
|
39932
39875
|
/**
|
39933
39876
|
* Adds a coin output to the transaction.
|
39934
39877
|
*
|
@@ -40008,7 +39951,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40008
39951
|
}
|
40009
39952
|
calculateMaxGas(chainInfo, minGas) {
|
40010
39953
|
const { consensusParameters } = chainInfo;
|
40011
|
-
const { gasPerByte
|
39954
|
+
const { gasPerByte } = consensusParameters;
|
40012
39955
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40013
39956
|
(acc, wit) => acc + wit.dataLength,
|
40014
39957
|
0
|
@@ -40017,8 +39960,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40017
39960
|
gasPerByte,
|
40018
39961
|
minGas,
|
40019
39962
|
witnessesLength,
|
40020
|
-
witnessLimit: this.witnessLimit
|
40021
|
-
maxGasPerTx
|
39963
|
+
witnessLimit: this.witnessLimit
|
40022
39964
|
});
|
40023
39965
|
}
|
40024
39966
|
/**
|
@@ -40036,20 +39978,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40036
39978
|
});
|
40037
39979
|
const updateAssetInput = (assetId, quantity) => {
|
40038
39980
|
const assetInput = findAssetInput(assetId);
|
40039
|
-
let usedQuantity = quantity;
|
40040
|
-
if (assetId === BaseAssetId) {
|
40041
|
-
usedQuantity = bn("1000000000000000000");
|
40042
|
-
}
|
40043
39981
|
if (assetInput && "assetId" in assetInput) {
|
40044
39982
|
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
40045
|
-
assetInput.amount =
|
39983
|
+
assetInput.amount = quantity;
|
40046
39984
|
} else {
|
40047
39985
|
this.addResources([
|
40048
39986
|
{
|
40049
39987
|
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
40050
|
-
amount:
|
39988
|
+
amount: quantity,
|
40051
39989
|
assetId,
|
40052
39990
|
owner: resourcesOwner || Address.fromRandom(),
|
39991
|
+
maturity: 0,
|
40053
39992
|
blockCreated: bn(1),
|
40054
39993
|
txCreatedIdx: bn(1)
|
40055
39994
|
}
|
@@ -40081,7 +40020,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40081
40020
|
toJSON() {
|
40082
40021
|
return normalizeJSON(this);
|
40083
40022
|
}
|
40084
|
-
|
40023
|
+
updatePredicateInputs(inputs) {
|
40085
40024
|
this.inputs.forEach((i) => {
|
40086
40025
|
let correspondingInput;
|
40087
40026
|
switch (i.type) {
|
@@ -40103,15 +40042,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40103
40042
|
}
|
40104
40043
|
});
|
40105
40044
|
}
|
40106
|
-
shiftPredicateData() {
|
40107
|
-
this.inputs.forEach((input) => {
|
40108
|
-
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
40109
|
-
input.predicateData = input.paddPredicateData(
|
40110
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40111
|
-
);
|
40112
|
-
}
|
40113
|
-
});
|
40114
|
-
}
|
40115
40045
|
};
|
40116
40046
|
|
40117
40047
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40245,8 +40175,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40245
40175
|
return {
|
40246
40176
|
type: TransactionType.Create,
|
40247
40177
|
...baseTransaction,
|
40178
|
+
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40248
40179
|
bytecodeWitnessIndex,
|
40249
|
-
storageSlotsCount:
|
40180
|
+
storageSlotsCount: storageSlots.length,
|
40250
40181
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40251
40182
|
storageSlots
|
40252
40183
|
};
|
@@ -40360,8 +40291,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40360
40291
|
type: TransactionType.Script,
|
40361
40292
|
scriptGasLimit: this.gasLimit,
|
40362
40293
|
...super.getBaseTransaction(),
|
40363
|
-
scriptLength:
|
40364
|
-
scriptDataLength:
|
40294
|
+
scriptLength: script.length,
|
40295
|
+
scriptDataLength: scriptData.length,
|
40365
40296
|
receiptsRoot: ZeroBytes32,
|
40366
40297
|
script: hexlify(script),
|
40367
40298
|
scriptData: hexlify(scriptData)
|
@@ -40425,7 +40356,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40425
40356
|
}
|
40426
40357
|
calculateMaxGas(chainInfo, minGas) {
|
40427
40358
|
const { consensusParameters } = chainInfo;
|
40428
|
-
const { gasPerByte
|
40359
|
+
const { gasPerByte } = consensusParameters;
|
40429
40360
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40430
40361
|
(acc, wit) => acc + wit.dataLength,
|
40431
40362
|
0
|
@@ -40435,8 +40366,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40435
40366
|
minGas,
|
40436
40367
|
witnessesLength,
|
40437
40368
|
witnessLimit: this.witnessLimit,
|
40438
|
-
gasLimit: this.gasLimit
|
40439
|
-
maxGasPerTx
|
40369
|
+
gasLimit: this.gasLimit
|
40440
40370
|
});
|
40441
40371
|
}
|
40442
40372
|
/**
|
@@ -40509,29 +40439,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40509
40439
|
}
|
40510
40440
|
}
|
40511
40441
|
};
|
40512
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40513
|
-
(acc, input) => {
|
40514
|
-
if (input.type === InputType.Coin && input.owner === owner) {
|
40515
|
-
acc.utxos.push(input.id);
|
40516
|
-
}
|
40517
|
-
if (input.type === InputType.Message && input.recipient === owner) {
|
40518
|
-
acc.messages.push(input.nonce);
|
40519
|
-
}
|
40520
|
-
return acc;
|
40521
|
-
},
|
40522
|
-
{
|
40523
|
-
utxos: [],
|
40524
|
-
messages: []
|
40525
|
-
}
|
40526
|
-
);
|
40527
40442
|
|
40528
40443
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40529
40444
|
var calculateTransactionFee = (params) => {
|
40530
40445
|
const {
|
40531
|
-
|
40446
|
+
gasUsed,
|
40532
40447
|
rawPayload,
|
40533
|
-
|
40534
|
-
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40448
|
+
consensusParameters: { gasCosts, feeParams }
|
40535
40449
|
} = params;
|
40536
40450
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40537
40451
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40541,7 +40455,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40541
40455
|
return {
|
40542
40456
|
fee: bn(0),
|
40543
40457
|
minFee: bn(0),
|
40544
|
-
maxFee: bn(0)
|
40458
|
+
maxFee: bn(0),
|
40459
|
+
feeFromGasUsed: bn(0)
|
40545
40460
|
};
|
40546
40461
|
}
|
40547
40462
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40573,6 +40488,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40573
40488
|
metadataGas,
|
40574
40489
|
txBytesSize: transactionBytes.length
|
40575
40490
|
});
|
40491
|
+
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40576
40492
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40577
40493
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40578
40494
|
const maxGas = getMaxGas({
|
@@ -40580,25 +40496,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40580
40496
|
minGas,
|
40581
40497
|
witnessesLength,
|
40582
40498
|
gasLimit,
|
40583
|
-
witnessLimit
|
40584
|
-
maxGasPerTx
|
40585
|
-
});
|
40586
|
-
const minFee = calculateGasFee({
|
40587
|
-
gasPrice,
|
40588
|
-
gas: minGas,
|
40589
|
-
priceFactor: gasPriceFactor,
|
40590
|
-
tip
|
40591
|
-
});
|
40592
|
-
const maxFee = calculateGasFee({
|
40593
|
-
gasPrice,
|
40594
|
-
gas: maxGas,
|
40595
|
-
priceFactor: gasPriceFactor,
|
40596
|
-
tip
|
40499
|
+
witnessLimit
|
40597
40500
|
});
|
40501
|
+
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40502
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40503
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40504
|
+
const fee = minFee.add(feeFromGasUsed);
|
40598
40505
|
return {
|
40506
|
+
fee,
|
40599
40507
|
minFee,
|
40600
40508
|
maxFee,
|
40601
|
-
|
40509
|
+
feeFromGasUsed
|
40602
40510
|
};
|
40603
40511
|
};
|
40604
40512
|
|
@@ -41199,9 +41107,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41199
41107
|
gqlTransactionStatus,
|
41200
41108
|
abiMap = {},
|
41201
41109
|
maxInputs,
|
41202
|
-
gasCosts
|
41203
|
-
maxGasPerTx,
|
41204
|
-
gasPrice
|
41110
|
+
gasCosts
|
41205
41111
|
} = params;
|
41206
41112
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41207
41113
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41215,14 +41121,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41215
41121
|
maxInputs
|
41216
41122
|
});
|
41217
41123
|
const typeName = getTransactionTypeName(transaction.type);
|
41218
|
-
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41219
41124
|
const { fee } = calculateTransactionFee({
|
41220
|
-
|
41125
|
+
gasUsed,
|
41221
41126
|
rawPayload,
|
41222
|
-
tip,
|
41223
41127
|
consensusParameters: {
|
41224
41128
|
gasCosts,
|
41225
|
-
maxGasPerTx,
|
41226
41129
|
feeParams: {
|
41227
41130
|
gasPerByte,
|
41228
41131
|
gasPriceFactor
|
@@ -41358,13 +41261,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41358
41261
|
const decodedTransaction = this.decodeTransaction(
|
41359
41262
|
transaction
|
41360
41263
|
);
|
41361
|
-
|
41362
|
-
|
41363
|
-
txReceipts = transaction.status.receipts;
|
41364
|
-
}
|
41365
|
-
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41366
|
-
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41367
|
-
const gasPrice = await this.provider.getLatestGasPrice();
|
41264
|
+
const receipts = transaction.receipts?.map(processGqlReceipt) || [];
|
41265
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
|
41368
41266
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41369
41267
|
const transactionSummary = assembleTransactionSummary({
|
41370
41268
|
id: this.id,
|
@@ -41376,9 +41274,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41376
41274
|
gasPriceFactor,
|
41377
41275
|
abiMap: contractsAbiMap,
|
41378
41276
|
maxInputs,
|
41379
|
-
gasCosts
|
41380
|
-
maxGasPerTx,
|
41381
|
-
gasPrice
|
41277
|
+
gasCosts
|
41382
41278
|
});
|
41383
41279
|
return transactionSummary;
|
41384
41280
|
}
|
@@ -41527,7 +41423,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41527
41423
|
gasCosts,
|
41528
41424
|
latestBlock: {
|
41529
41425
|
id: latestBlock.id,
|
41530
|
-
height: bn(latestBlock.height),
|
41426
|
+
height: bn(latestBlock.header.height),
|
41531
41427
|
time: latestBlock.header.time,
|
41532
41428
|
transactions: latestBlock.transactions.map((i) => ({
|
41533
41429
|
id: i.id
|
@@ -41621,8 +41517,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41621
41517
|
* Returns some helpful parameters related to gas fees.
|
41622
41518
|
*/
|
41623
41519
|
getGasConfig() {
|
41520
|
+
const { minGasPrice } = this.getNode();
|
41624
41521
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41625
41522
|
return {
|
41523
|
+
minGasPrice,
|
41626
41524
|
maxGasPerTx,
|
41627
41525
|
maxGasPerPredicate,
|
41628
41526
|
gasPriceFactor,
|
@@ -41720,7 +41618,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41720
41618
|
*/
|
41721
41619
|
async getBlockNumber() {
|
41722
41620
|
const { chain } = await this.operations.getChain();
|
41723
|
-
return bn(chain.latestBlock.height, 10);
|
41621
|
+
return bn(chain.latestBlock.header.height, 10);
|
41724
41622
|
}
|
41725
41623
|
/**
|
41726
41624
|
* Returns the chain information.
|
@@ -41732,9 +41630,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41732
41630
|
const processedNodeInfo = {
|
41733
41631
|
maxDepth: bn(nodeInfo.maxDepth),
|
41734
41632
|
maxTx: bn(nodeInfo.maxTx),
|
41633
|
+
minGasPrice: bn(nodeInfo.minGasPrice),
|
41735
41634
|
nodeVersion: nodeInfo.nodeVersion,
|
41736
41635
|
utxoValidation: nodeInfo.utxoValidation,
|
41737
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41636
|
+
vmBacktrace: nodeInfo.vmBacktrace,
|
41637
|
+
peers: nodeInfo.peers
|
41738
41638
|
};
|
41739
41639
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41740
41640
|
return processedNodeInfo;
|
@@ -41820,13 +41720,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41820
41720
|
return this.estimateTxDependencies(transactionRequest);
|
41821
41721
|
}
|
41822
41722
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41823
|
-
const { dryRun:
|
41824
|
-
|
41723
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41724
|
+
encodedTransaction,
|
41825
41725
|
utxoValidation: utxoValidation || false
|
41826
41726
|
});
|
41827
|
-
const
|
41828
|
-
|
41829
|
-
|
41727
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41728
|
+
return {
|
41729
|
+
receipts
|
41730
|
+
};
|
41830
41731
|
}
|
41831
41732
|
/**
|
41832
41733
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41865,6 +41766,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41865
41766
|
* If there are missing variable outputs,
|
41866
41767
|
* `addVariableOutputs` is called on the transaction.
|
41867
41768
|
*
|
41769
|
+
* @privateRemarks
|
41770
|
+
* TODO: Investigate support for missing contract IDs
|
41771
|
+
* TODO: Add support for missing output messages
|
41868
41772
|
*
|
41869
41773
|
* @param transactionRequest - The transaction request object.
|
41870
41774
|
* @returns A promise.
|
@@ -41877,19 +41781,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41877
41781
|
missingContractIds: []
|
41878
41782
|
};
|
41879
41783
|
}
|
41784
|
+
await this.estimatePredicates(transactionRequest);
|
41880
41785
|
let receipts = [];
|
41881
41786
|
const missingContractIds = [];
|
41882
41787
|
let outputVariables = 0;
|
41883
|
-
let dryrunStatus;
|
41884
41788
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41885
|
-
const {
|
41886
|
-
|
41887
|
-
} = await this.operations.dryRun({
|
41888
|
-
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41789
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41790
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
41889
41791
|
utxoValidation: false
|
41890
41792
|
});
|
41891
|
-
receipts =
|
41892
|
-
dryrunStatus = status;
|
41793
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
41893
41794
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41894
41795
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41895
41796
|
if (hasMissingOutputs) {
|
@@ -41899,10 +41800,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41899
41800
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41900
41801
|
missingContractIds.push(contractId);
|
41901
41802
|
});
|
41902
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41903
|
-
transactionRequest
|
41904
|
-
});
|
41905
|
-
transactionRequest.maxFee = maxFee;
|
41906
41803
|
} else {
|
41907
41804
|
break;
|
41908
41805
|
}
|
@@ -41910,139 +41807,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41910
41807
|
return {
|
41911
41808
|
receipts,
|
41912
41809
|
outputVariables,
|
41913
|
-
missingContractIds
|
41914
|
-
dryrunStatus
|
41810
|
+
missingContractIds
|
41915
41811
|
};
|
41916
41812
|
}
|
41917
|
-
/**
|
41918
|
-
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41919
|
-
*
|
41920
|
-
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41921
|
-
* further modifications are identified. The method iteratively updates these transactions
|
41922
|
-
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41923
|
-
*
|
41924
|
-
* @param transactionRequests - Array of transaction request objects.
|
41925
|
-
* @returns A promise that resolves to an array of results for each transaction.
|
41926
|
-
*/
|
41927
|
-
async estimateMultipleTxDependencies(transactionRequests) {
|
41928
|
-
const results = transactionRequests.map(() => ({
|
41929
|
-
receipts: [],
|
41930
|
-
outputVariables: 0,
|
41931
|
-
missingContractIds: [],
|
41932
|
-
dryrunStatus: void 0
|
41933
|
-
}));
|
41934
|
-
const allRequests = clone_default(transactionRequests);
|
41935
|
-
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41936
|
-
allRequests.forEach((req, index) => {
|
41937
|
-
if (req.type === TransactionType.Script) {
|
41938
|
-
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41939
|
-
}
|
41940
|
-
});
|
41941
|
-
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41942
|
-
let attempt = 0;
|
41943
|
-
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41944
|
-
const encodedTransactions = transactionsToProcess.map(
|
41945
|
-
(index) => serializedTransactionsMap.get(index)
|
41946
|
-
);
|
41947
|
-
const dryRunResults = await this.operations.dryRun({
|
41948
|
-
encodedTransactions,
|
41949
|
-
utxoValidation: false
|
41950
|
-
});
|
41951
|
-
const nextRoundTransactions = [];
|
41952
|
-
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41953
|
-
const currentResultIndex = transactionsToProcess[i];
|
41954
|
-
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41955
|
-
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41956
|
-
results[currentResultIndex].dryrunStatus = status;
|
41957
|
-
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41958
|
-
results[currentResultIndex].receipts
|
41959
|
-
);
|
41960
|
-
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41961
|
-
const requestToProcess = allRequests[currentResultIndex];
|
41962
|
-
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
41963
|
-
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
41964
|
-
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
41965
|
-
missingOutputContractIds.forEach(({ contractId }) => {
|
41966
|
-
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
41967
|
-
results[currentResultIndex].missingContractIds.push(contractId);
|
41968
|
-
});
|
41969
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41970
|
-
transactionRequest: requestToProcess
|
41971
|
-
});
|
41972
|
-
requestToProcess.maxFee = maxFee;
|
41973
|
-
serializedTransactionsMap.set(
|
41974
|
-
currentResultIndex,
|
41975
|
-
hexlify(requestToProcess.toTransactionBytes())
|
41976
|
-
);
|
41977
|
-
nextRoundTransactions.push(currentResultIndex);
|
41978
|
-
allRequests[currentResultIndex] = requestToProcess;
|
41979
|
-
}
|
41980
|
-
}
|
41981
|
-
transactionsToProcess = nextRoundTransactions;
|
41982
|
-
attempt += 1;
|
41983
|
-
}
|
41984
|
-
return results;
|
41985
|
-
}
|
41986
|
-
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
41987
|
-
if (estimateTxDependencies) {
|
41988
|
-
return this.estimateMultipleTxDependencies(transactionRequests);
|
41989
|
-
}
|
41990
|
-
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
41991
|
-
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41992
|
-
encodedTransactions,
|
41993
|
-
utxoValidation: utxoValidation || false
|
41994
|
-
});
|
41995
|
-
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
41996
|
-
const receipts = rawReceipts.map(processGqlReceipt);
|
41997
|
-
return { receipts, dryrunStatus: status };
|
41998
|
-
});
|
41999
|
-
return results;
|
42000
|
-
}
|
42001
41813
|
/**
|
42002
41814
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
42003
41815
|
* @param transactionRequest - The transaction request object.
|
42004
41816
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
42005
41817
|
*/
|
42006
|
-
|
41818
|
+
estimateTxGasAndFee(params) {
|
42007
41819
|
const { transactionRequest } = params;
|
42008
|
-
|
41820
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
42009
41821
|
const chainInfo = this.getChain();
|
42010
|
-
const
|
41822
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
41823
|
+
transactionRequest.gasPrice = gasPrice;
|
42011
41824
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
42012
|
-
|
42013
|
-
gasPrice = await this.estimateGasPrice(10);
|
42014
|
-
}
|
42015
|
-
const minFee = calculateGasFee({
|
42016
|
-
gasPrice: bn(gasPrice),
|
42017
|
-
gas: minGas,
|
42018
|
-
priceFactor: gasPriceFactor,
|
42019
|
-
tip: transactionRequest.tip
|
42020
|
-
}).add(1);
|
42021
|
-
let gasLimit = bn(0);
|
41825
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42022
41826
|
if (transactionRequest.type === TransactionType.Script) {
|
42023
|
-
gasLimit = transactionRequest.gasLimit;
|
42024
41827
|
if (transactionRequest.gasLimit.eq(0)) {
|
42025
41828
|
transactionRequest.gasLimit = minGas;
|
42026
41829
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
42027
41830
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
42028
41831
|
);
|
42029
|
-
gasLimit = transactionRequest.gasLimit;
|
42030
41832
|
}
|
42031
41833
|
}
|
42032
41834
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42033
|
-
const maxFee =
|
42034
|
-
gasPrice: bn(gasPrice),
|
42035
|
-
gas: maxGas,
|
42036
|
-
priceFactor: gasPriceFactor,
|
42037
|
-
tip: transactionRequest.tip
|
42038
|
-
}).add(1);
|
41835
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42039
41836
|
return {
|
42040
41837
|
minGas,
|
42041
41838
|
minFee,
|
42042
41839
|
maxGas,
|
42043
|
-
maxFee
|
42044
|
-
gasPrice,
|
42045
|
-
gasLimit
|
41840
|
+
maxFee
|
42046
41841
|
};
|
42047
41842
|
}
|
42048
41843
|
/**
|
@@ -42060,17 +41855,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42060
41855
|
if (estimateTxDependencies) {
|
42061
41856
|
return this.estimateTxDependencies(transactionRequest);
|
42062
41857
|
}
|
42063
|
-
const
|
42064
|
-
const { dryRun:
|
42065
|
-
|
41858
|
+
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41859
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41860
|
+
encodedTransaction,
|
42066
41861
|
utxoValidation: true
|
42067
41862
|
});
|
42068
|
-
const
|
42069
|
-
|
42070
|
-
|
42071
|
-
|
42072
|
-
});
|
42073
|
-
return { receipts: callResult[0].receipts };
|
41863
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41864
|
+
return {
|
41865
|
+
receipts
|
41866
|
+
};
|
42074
41867
|
}
|
42075
41868
|
/**
|
42076
41869
|
* Returns a transaction cost to enable user
|
@@ -42087,79 +41880,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42087
41880
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
42088
41881
|
* @returns A promise that resolves to the transaction cost object.
|
42089
41882
|
*/
|
42090
|
-
async getTransactionCost(transactionRequestLike,
|
41883
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
41884
|
+
estimateTxDependencies = true,
|
41885
|
+
estimatePredicates = true,
|
41886
|
+
resourcesOwner,
|
41887
|
+
signatureCallback
|
41888
|
+
} = {}) {
|
42091
41889
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41890
|
+
const { minGasPrice } = this.getGasConfig();
|
41891
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
42092
41892
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
42093
41893
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
42094
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
41894
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42095
41895
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42096
|
-
txRequestClone.maxFee = bn(0);
|
42097
41896
|
if (isScriptTransaction) {
|
42098
41897
|
txRequestClone.gasLimit = bn(0);
|
42099
41898
|
}
|
42100
|
-
if (
|
42101
|
-
resourcesOwner
|
41899
|
+
if (estimatePredicates) {
|
41900
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41901
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41902
|
+
}
|
41903
|
+
await this.estimatePredicates(txRequestClone);
|
42102
41904
|
}
|
42103
|
-
const signedRequest = clone_default(txRequestClone);
|
42104
|
-
let addedSignatures = 0;
|
42105
41905
|
if (signatureCallback && isScriptTransaction) {
|
42106
|
-
|
42107
|
-
await signatureCallback(signedRequest);
|
42108
|
-
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41906
|
+
await signatureCallback(txRequestClone);
|
42109
41907
|
}
|
42110
|
-
|
42111
|
-
|
42112
|
-
transactionRequest: signedRequest
|
41908
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41909
|
+
transactionRequest: txRequestClone
|
42113
41910
|
});
|
42114
41911
|
let receipts = [];
|
42115
41912
|
let missingContractIds = [];
|
42116
41913
|
let outputVariables = 0;
|
42117
41914
|
let gasUsed = bn(0);
|
42118
|
-
|
42119
|
-
|
42120
|
-
if (isScriptTransaction) {
|
42121
|
-
txRequestClone.gasLimit = gasLimit;
|
42122
|
-
if (signatureCallback) {
|
42123
|
-
await signatureCallback(txRequestClone);
|
42124
|
-
}
|
41915
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
41916
|
+
txRequestClone.gasPrice = bn(0);
|
42125
41917
|
const result = await this.estimateTxDependencies(txRequestClone);
|
42126
41918
|
receipts = result.receipts;
|
42127
41919
|
outputVariables = result.outputVariables;
|
42128
41920
|
missingContractIds = result.missingContractIds;
|
42129
41921
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
42130
41922
|
txRequestClone.gasLimit = gasUsed;
|
42131
|
-
|
42132
|
-
|
42133
|
-
|
41923
|
+
txRequestClone.gasPrice = setGasPrice;
|
41924
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41925
|
+
transactionRequest: txRequestClone
|
42134
41926
|
}));
|
42135
41927
|
}
|
42136
41928
|
return {
|
42137
41929
|
requiredQuantities: allQuantities,
|
42138
41930
|
receipts,
|
42139
41931
|
gasUsed,
|
42140
|
-
|
41932
|
+
minGasPrice,
|
41933
|
+
gasPrice: setGasPrice,
|
42141
41934
|
minGas,
|
42142
41935
|
maxGas,
|
42143
41936
|
minFee,
|
42144
41937
|
maxFee,
|
41938
|
+
estimatedInputs: txRequestClone.inputs,
|
42145
41939
|
outputVariables,
|
42146
|
-
missingContractIds
|
42147
|
-
addedSignatures,
|
42148
|
-
estimatedPredicates: txRequestClone.inputs
|
41940
|
+
missingContractIds
|
42149
41941
|
};
|
42150
41942
|
}
|
42151
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
41943
|
+
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
42152
41944
|
const ownerAddress = Address.fromAddressOrString(owner);
|
42153
41945
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
42154
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42155
|
-
quantitiesToContract
|
42156
|
-
});
|
41946
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
|
42157
41947
|
transactionRequest.addResources(
|
42158
41948
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
42159
41949
|
);
|
42160
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
42161
|
-
|
42162
|
-
|
41950
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41951
|
+
transactionRequest,
|
41952
|
+
forwardingQuantities
|
41953
|
+
);
|
42163
41954
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
42164
41955
|
return {
|
42165
41956
|
resources,
|
@@ -42183,6 +41974,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42183
41974
|
assetId: coin.assetId,
|
42184
41975
|
amount: bn(coin.amount),
|
42185
41976
|
owner: Address.fromAddressOrString(coin.owner),
|
41977
|
+
maturity: bn(coin.maturity).toNumber(),
|
42186
41978
|
blockCreated: bn(coin.blockCreated),
|
42187
41979
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42188
41980
|
}));
|
@@ -42234,6 +42026,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42234
42026
|
amount: bn(coin.amount),
|
42235
42027
|
assetId: coin.assetId,
|
42236
42028
|
owner: Address.fromAddressOrString(coin.owner),
|
42029
|
+
maturity: bn(coin.maturity).toNumber(),
|
42237
42030
|
blockCreated: bn(coin.blockCreated),
|
42238
42031
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42239
42032
|
};
|
@@ -42266,7 +42059,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42266
42059
|
}
|
42267
42060
|
return {
|
42268
42061
|
id: block2.id,
|
42269
|
-
height: bn(block2.height),
|
42062
|
+
height: bn(block2.header.height),
|
42270
42063
|
time: block2.header.time,
|
42271
42064
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42272
42065
|
};
|
@@ -42281,7 +42074,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42281
42074
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42282
42075
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42283
42076
|
id: block2.id,
|
42284
|
-
height: bn(block2.height),
|
42077
|
+
height: bn(block2.header.height),
|
42285
42078
|
time: block2.header.time,
|
42286
42079
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42287
42080
|
}));
|
@@ -42308,7 +42101,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42308
42101
|
}
|
42309
42102
|
return {
|
42310
42103
|
id: block2.id,
|
42311
|
-
height: bn(block2.height, 10),
|
42104
|
+
height: bn(block2.header.height, 10),
|
42312
42105
|
time: block2.header.time,
|
42313
42106
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42314
42107
|
transactions: block2.transactions.map(
|
@@ -42488,11 +42281,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42488
42281
|
prevRoot: messageBlockHeader.prevRoot,
|
42489
42282
|
time: messageBlockHeader.time,
|
42490
42283
|
applicationHash: messageBlockHeader.applicationHash,
|
42491
|
-
|
42492
|
-
|
42493
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42494
|
-
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42495
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
42284
|
+
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
42285
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
|
42496
42286
|
},
|
42497
42287
|
commitBlockHeader: {
|
42498
42288
|
id: commitBlockHeader.id,
|
@@ -42503,11 +42293,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42503
42293
|
prevRoot: commitBlockHeader.prevRoot,
|
42504
42294
|
time: commitBlockHeader.time,
|
42505
42295
|
applicationHash: commitBlockHeader.applicationHash,
|
42506
|
-
|
42507
|
-
|
42508
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42509
|
-
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42510
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
42296
|
+
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
42297
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
|
42511
42298
|
},
|
42512
42299
|
sender: Address.fromAddressOrString(sender),
|
42513
42300
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -42516,16 +42303,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42516
42303
|
data
|
42517
42304
|
};
|
42518
42305
|
}
|
42519
|
-
async getLatestGasPrice() {
|
42520
|
-
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42521
|
-
return bn(latestGasPrice.gasPrice);
|
42522
|
-
}
|
42523
|
-
async estimateGasPrice(blockHorizon) {
|
42524
|
-
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42525
|
-
blockHorizon: String(blockHorizon)
|
42526
|
-
});
|
42527
|
-
return bn(estimateGasPrice.gasPrice);
|
42528
|
-
}
|
42529
42306
|
/**
|
42530
42307
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42531
42308
|
*
|
@@ -42586,15 +42363,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42586
42363
|
arrayify(gqlTransaction.rawPayload),
|
42587
42364
|
0
|
42588
42365
|
);
|
42589
|
-
|
42590
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42591
|
-
txReceipts = gqlTransaction.status.receipts;
|
42592
|
-
}
|
42593
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42366
|
+
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
42594
42367
|
const {
|
42595
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42368
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42596
42369
|
} = provider.getChain();
|
42597
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42598
42370
|
const transactionInfo = assembleTransactionSummary({
|
42599
42371
|
id: gqlTransaction.id,
|
42600
42372
|
receipts,
|
@@ -42605,9 +42377,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42605
42377
|
gasPriceFactor: bn(gasPriceFactor),
|
42606
42378
|
abiMap,
|
42607
42379
|
maxInputs,
|
42608
|
-
gasCosts
|
42609
|
-
maxGasPerTx,
|
42610
|
-
gasPrice
|
42380
|
+
gasCosts
|
42611
42381
|
});
|
42612
42382
|
return {
|
42613
42383
|
gqlTransaction,
|
@@ -42617,11 +42387,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42617
42387
|
async function getTransactionSummaryFromRequest(params) {
|
42618
42388
|
const { provider, transactionRequest, abiMap } = params;
|
42619
42389
|
const { receipts } = await provider.call(transactionRequest);
|
42620
|
-
const { gasPerByte, gasPriceFactor, gasCosts
|
42390
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42621
42391
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42622
42392
|
const transaction = transactionRequest.toTransaction();
|
42623
42393
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42624
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42625
42394
|
const transactionSummary = assembleTransactionSummary({
|
42626
42395
|
receipts,
|
42627
42396
|
transaction,
|
@@ -42630,9 +42399,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42630
42399
|
gasPerByte,
|
42631
42400
|
gasPriceFactor,
|
42632
42401
|
maxInputs,
|
42633
|
-
gasCosts
|
42634
|
-
maxGasPerTx,
|
42635
|
-
gasPrice
|
42402
|
+
gasCosts
|
42636
42403
|
});
|
42637
42404
|
return transactionSummary;
|
42638
42405
|
}
|
@@ -42641,18 +42408,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42641
42408
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42642
42409
|
const { edges, pageInfo } = transactionsByOwner;
|
42643
42410
|
const {
|
42644
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42411
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42645
42412
|
} = provider.getChain();
|
42646
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42647
42413
|
const transactions = edges.map((edge) => {
|
42648
42414
|
const { node: gqlTransaction } = edge;
|
42649
|
-
const { id, rawPayload, status } = gqlTransaction;
|
42415
|
+
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
42650
42416
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42651
|
-
|
42652
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42653
|
-
txReceipts = gqlTransaction.status.receipts;
|
42654
|
-
}
|
42655
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42417
|
+
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
42656
42418
|
const transactionSummary = assembleTransactionSummary({
|
42657
42419
|
id,
|
42658
42420
|
receipts,
|
@@ -42663,9 +42425,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42663
42425
|
gasPerByte,
|
42664
42426
|
gasPriceFactor,
|
42665
42427
|
maxInputs,
|
42666
|
-
gasCosts
|
42667
|
-
maxGasPerTx,
|
42668
|
-
gasPrice
|
42428
|
+
gasCosts
|
42669
42429
|
});
|
42670
42430
|
const output3 = {
|
42671
42431
|
gqlTransaction,
|
@@ -42994,33 +42754,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42994
42754
|
* @param fee - The estimated transaction fee.
|
42995
42755
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42996
42756
|
*/
|
42997
|
-
async fund(request,
|
42998
|
-
const
|
42999
|
-
const txRequest = request;
|
43000
|
-
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42757
|
+
async fund(request, coinQuantities, fee) {
|
42758
|
+
const updatedQuantities = addAmountToAsset({
|
43001
42759
|
amount: bn(fee),
|
43002
42760
|
assetId: BaseAssetId,
|
43003
|
-
coinQuantities
|
42761
|
+
coinQuantities
|
43004
42762
|
});
|
43005
42763
|
const quantitiesDict = {};
|
43006
|
-
|
42764
|
+
updatedQuantities.forEach(({ amount, assetId }) => {
|
43007
42765
|
quantitiesDict[assetId] = {
|
43008
42766
|
required: amount,
|
43009
42767
|
owned: bn(0)
|
43010
42768
|
};
|
43011
42769
|
});
|
43012
|
-
|
42770
|
+
const cachedUtxos = [];
|
42771
|
+
const cachedMessages = [];
|
42772
|
+
const owner = this.address.toB256();
|
42773
|
+
request.inputs.forEach((input) => {
|
43013
42774
|
const isResource = "amount" in input;
|
43014
42775
|
if (isResource) {
|
43015
42776
|
const isCoin2 = "owner" in input;
|
43016
42777
|
if (isCoin2) {
|
43017
42778
|
const assetId = String(input.assetId);
|
43018
|
-
if (quantitiesDict[assetId]) {
|
42779
|
+
if (input.owner === owner && quantitiesDict[assetId]) {
|
43019
42780
|
const amount = bn(input.amount);
|
43020
42781
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42782
|
+
cachedUtxos.push(input.id);
|
43021
42783
|
}
|
43022
|
-
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42784
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
43023
42785
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42786
|
+
cachedMessages.push(input.nonce);
|
43024
42787
|
}
|
43025
42788
|
}
|
43026
42789
|
});
|
@@ -43035,23 +42798,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43035
42798
|
});
|
43036
42799
|
const needsToBeFunded = missingQuantities.length;
|
43037
42800
|
if (needsToBeFunded) {
|
43038
|
-
const
|
43039
|
-
|
43040
|
-
|
43041
|
-
|
43042
|
-
|
43043
|
-
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43044
|
-
const requestToBeReEstimate = clone_default(txRequest);
|
43045
|
-
if (addedSignatures) {
|
43046
|
-
Array.from({ length: addedSignatures }).forEach(
|
43047
|
-
() => requestToBeReEstimate.addEmptyWitness()
|
43048
|
-
);
|
42801
|
+
const resources = await this.getResourcesToSpend(missingQuantities, {
|
42802
|
+
messages: cachedMessages,
|
42803
|
+
utxos: cachedUtxos
|
42804
|
+
});
|
42805
|
+
request.addResources(resources);
|
43049
42806
|
}
|
43050
|
-
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43051
|
-
transactionRequest: requestToBeReEstimate
|
43052
|
-
});
|
43053
|
-
txRequest.maxFee = maxFee;
|
43054
|
-
return txRequest;
|
43055
42807
|
}
|
43056
42808
|
/**
|
43057
42809
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -43059,25 +42811,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43059
42811
|
* @param destination - The address of the destination.
|
43060
42812
|
* @param amount - The amount of coins to transfer.
|
43061
42813
|
* @param assetId - The asset ID of the coins to transfer.
|
43062
|
-
* @param txParams - The transaction parameters (gasLimit,
|
42814
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
43063
42815
|
* @returns A promise that resolves to the prepared transaction request.
|
43064
42816
|
*/
|
43065
42817
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
43066
|
-
const
|
42818
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42819
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42820
|
+
const request = new ScriptTransactionRequest(params);
|
43067
42821
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
43068
|
-
const
|
42822
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43069
42823
|
estimateTxDependencies: true,
|
43070
42824
|
resourcesOwner: this
|
43071
42825
|
});
|
43072
|
-
|
43073
|
-
|
43074
|
-
|
43075
|
-
|
43076
|
-
|
43077
|
-
|
43078
|
-
|
43079
|
-
|
43080
|
-
await this.fund(request,
|
42826
|
+
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
42827
|
+
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
42828
|
+
this.validateGas({
|
42829
|
+
gasUsed,
|
42830
|
+
gasPrice: request.gasPrice,
|
42831
|
+
gasLimit: request.gasLimit,
|
42832
|
+
minGasPrice
|
42833
|
+
});
|
42834
|
+
await this.fund(request, requiredQuantities, maxFee);
|
42835
|
+
request.updatePredicateInputs(estimatedInputs);
|
43081
42836
|
return request;
|
43082
42837
|
}
|
43083
42838
|
/**
|
@@ -43116,30 +42871,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43116
42871
|
);
|
43117
42872
|
}
|
43118
42873
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42874
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42875
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
43119
42876
|
const { script, scriptData } = await assembleTransferToContractScript({
|
43120
42877
|
hexlifiedContractId: contractAddress.toB256(),
|
43121
42878
|
amountToTransfer: bn(amount),
|
43122
42879
|
assetId
|
43123
42880
|
});
|
43124
42881
|
const request = new ScriptTransactionRequest({
|
43125
|
-
...
|
42882
|
+
...params,
|
43126
42883
|
script,
|
43127
42884
|
scriptData
|
43128
42885
|
});
|
43129
42886
|
request.addContractInputAndOutput(contractAddress);
|
43130
|
-
const
|
43131
|
-
|
43132
|
-
|
42887
|
+
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42888
|
+
request,
|
42889
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42890
|
+
);
|
42891
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42892
|
+
this.validateGas({
|
42893
|
+
gasUsed,
|
42894
|
+
gasPrice: request.gasPrice,
|
42895
|
+
gasLimit: request.gasLimit,
|
42896
|
+
minGasPrice
|
43133
42897
|
});
|
43134
|
-
|
43135
|
-
this.validateGas({
|
43136
|
-
gasUsed: txCost.gasUsed,
|
43137
|
-
gasLimit: request.gasLimit
|
43138
|
-
});
|
43139
|
-
}
|
43140
|
-
request.gasLimit = txCost.gasUsed;
|
43141
|
-
request.maxFee = txCost.maxFee;
|
43142
|
-
await this.fund(request, txCost);
|
42898
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43143
42899
|
return this.sendTransaction(request);
|
43144
42900
|
}
|
43145
42901
|
/**
|
@@ -43151,6 +42907,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43151
42907
|
* @returns A promise that resolves to the transaction response.
|
43152
42908
|
*/
|
43153
42909
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42910
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
43154
42911
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
43155
42912
|
const recipientDataArray = arrayify(
|
43156
42913
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -43163,19 +42920,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43163
42920
|
...recipientDataArray,
|
43164
42921
|
...amountDataArray
|
43165
42922
|
]);
|
43166
|
-
const params = { script, ...txParams };
|
42923
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
43167
42924
|
const request = new ScriptTransactionRequest(params);
|
43168
|
-
const
|
43169
|
-
const
|
43170
|
-
|
43171
|
-
|
43172
|
-
|
43173
|
-
|
43174
|
-
|
43175
|
-
|
43176
|
-
|
43177
|
-
|
43178
|
-
|
42925
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42926
|
+
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42927
|
+
request,
|
42928
|
+
forwardingQuantities
|
42929
|
+
);
|
42930
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42931
|
+
this.validateGas({
|
42932
|
+
gasUsed,
|
42933
|
+
gasPrice: request.gasPrice,
|
42934
|
+
gasLimit: request.gasLimit,
|
42935
|
+
minGasPrice
|
42936
|
+
});
|
42937
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43179
42938
|
return this.sendTransaction(request);
|
43180
42939
|
}
|
43181
42940
|
async signMessage(message) {
|
@@ -43233,7 +42992,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43233
42992
|
}
|
43234
42993
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43235
42994
|
}
|
43236
|
-
validateGas({
|
42995
|
+
validateGas({
|
42996
|
+
gasUsed,
|
42997
|
+
gasPrice,
|
42998
|
+
gasLimit,
|
42999
|
+
minGasPrice
|
43000
|
+
}) {
|
43001
|
+
if (minGasPrice.gt(gasPrice)) {
|
43002
|
+
throw new FuelError(
|
43003
|
+
ErrorCode.GAS_PRICE_TOO_LOW,
|
43004
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
43005
|
+
);
|
43006
|
+
}
|
43237
43007
|
if (gasUsed.gt(gasLimit)) {
|
43238
43008
|
throw new FuelError(
|
43239
43009
|
ErrorCode.GAS_LIMIT_TOO_LOW,
|
@@ -44822,7 +44592,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44822
44592
|
* @param transactionRequestLike - The transaction request to send.
|
44823
44593
|
* @returns A promise that resolves to the TransactionResponse object.
|
44824
44594
|
*/
|
44825
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44595
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
44826
44596
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44827
44597
|
if (estimateTxDependencies) {
|
44828
44598
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -48100,8 +47870,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48100
47870
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
48101
47871
|
request.inputs?.forEach((input) => {
|
48102
47872
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
48103
|
-
input.predicate =
|
48104
|
-
input.predicateData =
|
47873
|
+
input.predicate = this.bytes;
|
47874
|
+
input.predicateData = this.getPredicateData(policies.length);
|
48105
47875
|
}
|
48106
47876
|
});
|
48107
47877
|
return request;
|
@@ -48116,7 +47886,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48116
47886
|
* @returns A promise that resolves to the prepared transaction request.
|
48117
47887
|
*/
|
48118
47888
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
48119
|
-
|
47889
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
47890
|
+
return this.populateTransactionPredicateData(request);
|
48120
47891
|
}
|
48121
47892
|
/**
|
48122
47893
|
* Sends a transaction with the populated predicate data.
|
@@ -48124,9 +47895,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48124
47895
|
* @param transactionRequestLike - The transaction request-like object.
|
48125
47896
|
* @returns A promise that resolves to the transaction response.
|
48126
47897
|
*/
|
48127
|
-
sendTransaction(transactionRequestLike) {
|
48128
|
-
const transactionRequest =
|
48129
|
-
return super.sendTransaction(transactionRequest,
|
47898
|
+
sendTransaction(transactionRequestLike, options) {
|
47899
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47900
|
+
return super.sendTransaction(transactionRequest, options);
|
48130
47901
|
}
|
48131
47902
|
/**
|
48132
47903
|
* Simulates a transaction with the populated predicate data.
|
@@ -48135,8 +47906,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48135
47906
|
* @returns A promise that resolves to the call result.
|
48136
47907
|
*/
|
48137
47908
|
simulateTransaction(transactionRequestLike) {
|
48138
|
-
const transactionRequest =
|
48139
|
-
return super.simulateTransaction(transactionRequest
|
47909
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47910
|
+
return super.simulateTransaction(transactionRequest);
|
48140
47911
|
}
|
48141
47912
|
getPredicateData(policiesLength) {
|
48142
47913
|
if (!this.predicateData.length) {
|
@@ -48182,25 +47953,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48182
47953
|
predicateInterface: abiInterface
|
48183
47954
|
};
|
48184
47955
|
}
|
48185
|
-
/**
|
48186
|
-
* Retrieves resources satisfying the spend query for the account.
|
48187
|
-
*
|
48188
|
-
* @param quantities - IDs of coins to exclude.
|
48189
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
48190
|
-
* @returns A promise that resolves to an array of Resources.
|
48191
|
-
*/
|
48192
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
48193
|
-
const resources = await this.provider.getResourcesToSpend(
|
48194
|
-
this.address,
|
48195
|
-
quantities,
|
48196
|
-
excludedIds
|
48197
|
-
);
|
48198
|
-
return resources.map((resource) => ({
|
48199
|
-
...resource,
|
48200
|
-
predicate: hexlify(this.bytes),
|
48201
|
-
paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48202
|
-
}));
|
48203
|
-
}
|
48204
47956
|
/**
|
48205
47957
|
* Sets the configurable constants for the predicate.
|
48206
47958
|
*
|