@fuel-ts/account 0.0.0-rc-2021-20240425184301 → 0.0.0-rc-2152-20240425194419
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 +6 -7
- 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 +696 -1818
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +545 -796
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +421 -671
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +24 -12
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +359 -810
- 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 -46
- 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 +28 -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 +1189 -2540
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +532 -778
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +419 -665
- 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
@@ -182,13 +182,13 @@
|
|
182
182
|
if (str !== lowered && str !== uppered)
|
183
183
|
return "Mixed-case string " + str;
|
184
184
|
str = lowered;
|
185
|
-
const
|
186
|
-
if (
|
185
|
+
const split2 = str.lastIndexOf("1");
|
186
|
+
if (split2 === -1)
|
187
187
|
return "No separator character for " + str;
|
188
|
-
if (
|
188
|
+
if (split2 === 0)
|
189
189
|
return "Missing prefix for " + str;
|
190
|
-
const prefix = str.slice(0,
|
191
|
-
const wordChars = str.slice(
|
190
|
+
const prefix = str.slice(0, split2);
|
191
|
+
const wordChars = str.slice(split2 + 1);
|
192
192
|
if (wordChars.length < 6)
|
193
193
|
return "Data too short";
|
194
194
|
let chk = prefixChk(prefix);
|
@@ -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;
|
@@ -1089,7 +1089,7 @@
|
|
1089
1089
|
}
|
1090
1090
|
return this;
|
1091
1091
|
};
|
1092
|
-
BN2.prototype.add = function
|
1092
|
+
BN2.prototype.add = function add(num) {
|
1093
1093
|
var res;
|
1094
1094
|
if (num.negative !== 0 && this.negative === 0) {
|
1095
1095
|
num.negative = 0;
|
@@ -2803,7 +2803,7 @@
|
|
2803
2803
|
}
|
2804
2804
|
return r;
|
2805
2805
|
};
|
2806
|
-
MPrime.prototype.split = function
|
2806
|
+
MPrime.prototype.split = function split2(input, out) {
|
2807
2807
|
input.iushrn(this.n, 0, out);
|
2808
2808
|
};
|
2809
2809
|
MPrime.prototype.imulK = function imulK(num) {
|
@@ -2817,7 +2817,7 @@
|
|
2817
2817
|
);
|
2818
2818
|
}
|
2819
2819
|
inherits(K256, MPrime);
|
2820
|
-
K256.prototype.split = function
|
2820
|
+
K256.prototype.split = function split2(input, output3) {
|
2821
2821
|
var mask2 = 4194303;
|
2822
2822
|
var outLen = Math.min(input.length, 9);
|
2823
2823
|
for (var i = 0; i < outLen; i++) {
|
@@ -2953,7 +2953,7 @@
|
|
2953
2953
|
}
|
2954
2954
|
return this.m.sub(a)._forceRed(this);
|
2955
2955
|
};
|
2956
|
-
Red.prototype.add = function
|
2956
|
+
Red.prototype.add = function add(a, b) {
|
2957
2957
|
this._verify2(a, b);
|
2958
2958
|
var res = a.add(b);
|
2959
2959
|
if (res.cmp(this.m) >= 0) {
|
@@ -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
|
@@ -20417,7 +20417,7 @@ spurious results.`);
|
|
20417
20417
|
}
|
20418
20418
|
return instance.ptr;
|
20419
20419
|
}
|
20420
|
-
function
|
20420
|
+
function add(dst, lhs, rhs) {
|
20421
20421
|
const ret3 = wasm$1.add(dst, lhs, rhs);
|
20422
20422
|
return Instruction.__wrap(ret3);
|
20423
20423
|
}
|
@@ -27996,7 +27996,7 @@ spurious results.`);
|
|
27996
27996
|
exports.WQOP = WQOP;
|
27997
27997
|
exports.XOR = XOR;
|
27998
27998
|
exports.XORI = XORI;
|
27999
|
-
exports.add =
|
27999
|
+
exports.add = add;
|
28000
28000
|
exports.addi = addi2;
|
28001
28001
|
exports.aloc = aloc;
|
28002
28002
|
exports.and = and;
|
@@ -28236,9 +28236,9 @@ spurious results.`);
|
|
28236
28236
|
function setBigUint64(view, byteOffset, value, isLE3) {
|
28237
28237
|
if (typeof view.setBigUint64 === "function")
|
28238
28238
|
return view.setBigUint64(byteOffset, value, isLE3);
|
28239
|
-
const
|
28239
|
+
const _32n2 = BigInt(32);
|
28240
28240
|
const _u32_max = BigInt(4294967295);
|
28241
|
-
const wh = Number(value >>
|
28241
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
28242
28242
|
const wl = Number(value & _u32_max);
|
28243
28243
|
const h = isLE3 ? 4 : 0;
|
28244
28244
|
const l = isLE3 ? 0 : 4;
|
@@ -28953,7 +28953,7 @@ spurious results.`);
|
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
28955
|
FORC: "0.55.0",
|
28956
|
-
FUEL_CORE: "0.
|
28956
|
+
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.82.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -29053,7 +29053,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29053
29053
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
29054
29054
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
29055
29055
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
29056
|
-
ErrorCode2["MAX_FEE_TOO_LOW"] = "max-fee-too-low";
|
29057
29056
|
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
|
29058
29057
|
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
|
29059
29058
|
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
|
@@ -29244,12 +29243,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29244
29243
|
};
|
29245
29244
|
var DateTime = _DateTime;
|
29246
29245
|
__publicField3(DateTime, "TAI64_NULL", "");
|
29247
|
-
function isDefined(value) {
|
29248
|
-
return value !== void 0;
|
29249
|
-
}
|
29250
29246
|
|
29251
29247
|
// ../crypto/dist/index.mjs
|
29252
|
-
var
|
29248
|
+
var import_crypto7 = __toESM(__require("crypto"), 1);
|
29253
29249
|
|
29254
29250
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
29255
29251
|
var version = "6.7.1";
|
@@ -29416,18 +29412,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29416
29412
|
function getBytes(value, name) {
|
29417
29413
|
return _getBytes(value, name, false);
|
29418
29414
|
}
|
29419
|
-
function isHexString(value, length) {
|
29420
|
-
if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
29421
|
-
return false;
|
29422
|
-
}
|
29423
|
-
if (typeof length === "number" && value.length !== 2 + 2 * length) {
|
29424
|
-
return false;
|
29425
|
-
}
|
29426
|
-
if (length === true && value.length % 2 !== 0) {
|
29427
|
-
return false;
|
29428
|
-
}
|
29429
|
-
return true;
|
29430
|
-
}
|
29431
29415
|
var HexCharacters2 = "0123456789abcdef";
|
29432
29416
|
function hexlify2(data) {
|
29433
29417
|
const bytes3 = getBytes(data);
|
@@ -29788,74 +29772,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29788
29772
|
};
|
29789
29773
|
var assert_default = assert2;
|
29790
29774
|
|
29791
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_u64.js
|
29792
|
-
var U32_MASK642 = BigInt(2 ** 32 - 1);
|
29793
|
-
var _32n2 = BigInt(32);
|
29794
|
-
function fromBig2(n, le = false) {
|
29795
|
-
if (le)
|
29796
|
-
return { h: Number(n & U32_MASK642), l: Number(n >> _32n2 & U32_MASK642) };
|
29797
|
-
return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 };
|
29798
|
-
}
|
29799
|
-
function split2(lst, le = false) {
|
29800
|
-
let Ah = new Uint32Array(lst.length);
|
29801
|
-
let Al = new Uint32Array(lst.length);
|
29802
|
-
for (let i = 0; i < lst.length; i++) {
|
29803
|
-
const { h, l } = fromBig2(lst[i], le);
|
29804
|
-
[Ah[i], Al[i]] = [h, l];
|
29805
|
-
}
|
29806
|
-
return [Ah, Al];
|
29807
|
-
}
|
29808
|
-
var toBig = (h, l) => BigInt(h >>> 0) << _32n2 | BigInt(l >>> 0);
|
29809
|
-
var shrSH = (h, l, s) => h >>> s;
|
29810
|
-
var shrSL = (h, l, s) => h << 32 - s | l >>> s;
|
29811
|
-
var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
|
29812
|
-
var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
|
29813
|
-
var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
|
29814
|
-
var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
|
29815
|
-
var rotr32H = (h, l) => l;
|
29816
|
-
var rotr32L = (h, l) => h;
|
29817
|
-
var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
|
29818
|
-
var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
|
29819
|
-
var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
29820
|
-
var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
29821
|
-
function add(Ah, Al, Bh, Bl) {
|
29822
|
-
const l = (Al >>> 0) + (Bl >>> 0);
|
29823
|
-
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
29824
|
-
}
|
29825
|
-
var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
29826
|
-
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
29827
|
-
var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
29828
|
-
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
29829
|
-
var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
29830
|
-
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
29831
|
-
var u64 = {
|
29832
|
-
fromBig: fromBig2,
|
29833
|
-
split: split2,
|
29834
|
-
toBig,
|
29835
|
-
shrSH,
|
29836
|
-
shrSL,
|
29837
|
-
rotrSH,
|
29838
|
-
rotrSL,
|
29839
|
-
rotrBH,
|
29840
|
-
rotrBL,
|
29841
|
-
rotr32H,
|
29842
|
-
rotr32L,
|
29843
|
-
rotlSH: rotlSH2,
|
29844
|
-
rotlSL: rotlSL2,
|
29845
|
-
rotlBH: rotlBH2,
|
29846
|
-
rotlBL: rotlBL2,
|
29847
|
-
add,
|
29848
|
-
add3L,
|
29849
|
-
add3H,
|
29850
|
-
add4L,
|
29851
|
-
add4H,
|
29852
|
-
add5H,
|
29853
|
-
add5L
|
29854
|
-
};
|
29855
|
-
var u64_default = u64;
|
29856
|
-
|
29857
29775
|
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/utils.js
|
29858
|
-
var u322 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
29859
29776
|
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
29860
29777
|
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
29861
29778
|
if (!isLE2)
|
@@ -29888,224 +29805,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29888
29805
|
hashC.create = () => hashConstructor();
|
29889
29806
|
return hashC;
|
29890
29807
|
}
|
29891
|
-
function wrapConstructorWithOpts(hashCons) {
|
29892
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
|
29893
|
-
const tmp = hashCons({});
|
29894
|
-
hashC.outputLen = tmp.outputLen;
|
29895
|
-
hashC.blockLen = tmp.blockLen;
|
29896
|
-
hashC.create = (opts) => hashCons(opts);
|
29897
|
-
return hashC;
|
29898
|
-
}
|
29899
|
-
|
29900
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/sha3.js
|
29901
|
-
var [SHA3_PI2, SHA3_ROTL2, _SHA3_IOTA2] = [[], [], []];
|
29902
|
-
var _0n2 = BigInt(0);
|
29903
|
-
var _1n2 = BigInt(1);
|
29904
|
-
var _2n2 = BigInt(2);
|
29905
|
-
var _7n2 = BigInt(7);
|
29906
|
-
var _256n2 = BigInt(256);
|
29907
|
-
var _0x71n2 = BigInt(113);
|
29908
|
-
for (let round = 0, R = _1n2, x = 1, y = 0; round < 24; round++) {
|
29909
|
-
[x, y] = [y, (2 * x + 3 * y) % 5];
|
29910
|
-
SHA3_PI2.push(2 * (5 * y + x));
|
29911
|
-
SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
|
29912
|
-
let t = _0n2;
|
29913
|
-
for (let j = 0; j < 7; j++) {
|
29914
|
-
R = (R << _1n2 ^ (R >> _7n2) * _0x71n2) % _256n2;
|
29915
|
-
if (R & _2n2)
|
29916
|
-
t ^= _1n2 << (_1n2 << BigInt(j)) - _1n2;
|
29917
|
-
}
|
29918
|
-
_SHA3_IOTA2.push(t);
|
29919
|
-
}
|
29920
|
-
var [SHA3_IOTA_H2, SHA3_IOTA_L2] = u64_default.split(_SHA3_IOTA2, true);
|
29921
|
-
var rotlH2 = (h, l, s) => s > 32 ? u64_default.rotlBH(h, l, s) : u64_default.rotlSH(h, l, s);
|
29922
|
-
var rotlL2 = (h, l, s) => s > 32 ? u64_default.rotlBL(h, l, s) : u64_default.rotlSL(h, l, s);
|
29923
|
-
function keccakP2(s, rounds = 24) {
|
29924
|
-
const B = new Uint32Array(5 * 2);
|
29925
|
-
for (let round = 24 - rounds; round < 24; round++) {
|
29926
|
-
for (let x = 0; x < 10; x++)
|
29927
|
-
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
29928
|
-
for (let x = 0; x < 10; x += 2) {
|
29929
|
-
const idx1 = (x + 8) % 10;
|
29930
|
-
const idx0 = (x + 2) % 10;
|
29931
|
-
const B0 = B[idx0];
|
29932
|
-
const B1 = B[idx0 + 1];
|
29933
|
-
const Th = rotlH2(B0, B1, 1) ^ B[idx1];
|
29934
|
-
const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
|
29935
|
-
for (let y = 0; y < 50; y += 10) {
|
29936
|
-
s[x + y] ^= Th;
|
29937
|
-
s[x + y + 1] ^= Tl;
|
29938
|
-
}
|
29939
|
-
}
|
29940
|
-
let curH = s[2];
|
29941
|
-
let curL = s[3];
|
29942
|
-
for (let t = 0; t < 24; t++) {
|
29943
|
-
const shift = SHA3_ROTL2[t];
|
29944
|
-
const Th = rotlH2(curH, curL, shift);
|
29945
|
-
const Tl = rotlL2(curH, curL, shift);
|
29946
|
-
const PI = SHA3_PI2[t];
|
29947
|
-
curH = s[PI];
|
29948
|
-
curL = s[PI + 1];
|
29949
|
-
s[PI] = Th;
|
29950
|
-
s[PI + 1] = Tl;
|
29951
|
-
}
|
29952
|
-
for (let y = 0; y < 50; y += 10) {
|
29953
|
-
for (let x = 0; x < 10; x++)
|
29954
|
-
B[x] = s[y + x];
|
29955
|
-
for (let x = 0; x < 10; x++)
|
29956
|
-
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
29957
|
-
}
|
29958
|
-
s[0] ^= SHA3_IOTA_H2[round];
|
29959
|
-
s[1] ^= SHA3_IOTA_L2[round];
|
29960
|
-
}
|
29961
|
-
B.fill(0);
|
29962
|
-
}
|
29963
|
-
var Keccak2 = class extends Hash2 {
|
29964
|
-
// NOTE: we accept arguments in bytes instead of bits here.
|
29965
|
-
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
29966
|
-
super();
|
29967
|
-
this.blockLen = blockLen;
|
29968
|
-
this.suffix = suffix;
|
29969
|
-
this.outputLen = outputLen;
|
29970
|
-
this.enableXOF = enableXOF;
|
29971
|
-
this.rounds = rounds;
|
29972
|
-
this.pos = 0;
|
29973
|
-
this.posOut = 0;
|
29974
|
-
this.finished = false;
|
29975
|
-
this.destroyed = false;
|
29976
|
-
assert_default.number(outputLen);
|
29977
|
-
if (0 >= this.blockLen || this.blockLen >= 200)
|
29978
|
-
throw new Error("Sha3 supports only keccak-f1600 function");
|
29979
|
-
this.state = new Uint8Array(200);
|
29980
|
-
this.state32 = u322(this.state);
|
29981
|
-
}
|
29982
|
-
keccak() {
|
29983
|
-
keccakP2(this.state32, this.rounds);
|
29984
|
-
this.posOut = 0;
|
29985
|
-
this.pos = 0;
|
29986
|
-
}
|
29987
|
-
update(data) {
|
29988
|
-
assert_default.exists(this);
|
29989
|
-
const { blockLen, state } = this;
|
29990
|
-
data = toBytes2(data);
|
29991
|
-
const len = data.length;
|
29992
|
-
for (let pos = 0; pos < len; ) {
|
29993
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
29994
|
-
for (let i = 0; i < take; i++)
|
29995
|
-
state[this.pos++] ^= data[pos++];
|
29996
|
-
if (this.pos === blockLen)
|
29997
|
-
this.keccak();
|
29998
|
-
}
|
29999
|
-
return this;
|
30000
|
-
}
|
30001
|
-
finish() {
|
30002
|
-
if (this.finished)
|
30003
|
-
return;
|
30004
|
-
this.finished = true;
|
30005
|
-
const { state, suffix, pos, blockLen } = this;
|
30006
|
-
state[pos] ^= suffix;
|
30007
|
-
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
30008
|
-
this.keccak();
|
30009
|
-
state[blockLen - 1] ^= 128;
|
30010
|
-
this.keccak();
|
30011
|
-
}
|
30012
|
-
writeInto(out) {
|
30013
|
-
assert_default.exists(this, false);
|
30014
|
-
assert_default.bytes(out);
|
30015
|
-
this.finish();
|
30016
|
-
const bufferOut = this.state;
|
30017
|
-
const { blockLen } = this;
|
30018
|
-
for (let pos = 0, len = out.length; pos < len; ) {
|
30019
|
-
if (this.posOut >= blockLen)
|
30020
|
-
this.keccak();
|
30021
|
-
const take = Math.min(blockLen - this.posOut, len - pos);
|
30022
|
-
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
30023
|
-
this.posOut += take;
|
30024
|
-
pos += take;
|
30025
|
-
}
|
30026
|
-
return out;
|
30027
|
-
}
|
30028
|
-
xofInto(out) {
|
30029
|
-
if (!this.enableXOF)
|
30030
|
-
throw new Error("XOF is not possible for this instance");
|
30031
|
-
return this.writeInto(out);
|
30032
|
-
}
|
30033
|
-
xof(bytes3) {
|
30034
|
-
assert_default.number(bytes3);
|
30035
|
-
return this.xofInto(new Uint8Array(bytes3));
|
30036
|
-
}
|
30037
|
-
digestInto(out) {
|
30038
|
-
assert_default.output(out, this);
|
30039
|
-
if (this.finished)
|
30040
|
-
throw new Error("digest() was already called");
|
30041
|
-
this.writeInto(out);
|
30042
|
-
this.destroy();
|
30043
|
-
return out;
|
30044
|
-
}
|
30045
|
-
digest() {
|
30046
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
30047
|
-
}
|
30048
|
-
destroy() {
|
30049
|
-
this.destroyed = true;
|
30050
|
-
this.state.fill(0);
|
30051
|
-
}
|
30052
|
-
_cloneInto(to) {
|
30053
|
-
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
30054
|
-
to || (to = new Keccak2(blockLen, suffix, outputLen, enableXOF, rounds));
|
30055
|
-
to.state32.set(this.state32);
|
30056
|
-
to.pos = this.pos;
|
30057
|
-
to.posOut = this.posOut;
|
30058
|
-
to.finished = this.finished;
|
30059
|
-
to.rounds = rounds;
|
30060
|
-
to.suffix = suffix;
|
30061
|
-
to.outputLen = outputLen;
|
30062
|
-
to.enableXOF = enableXOF;
|
30063
|
-
to.destroyed = this.destroyed;
|
30064
|
-
return to;
|
30065
|
-
}
|
30066
|
-
};
|
30067
|
-
var gen2 = (suffix, blockLen, outputLen) => wrapConstructor2(() => new Keccak2(blockLen, suffix, outputLen));
|
30068
|
-
var sha3_2242 = gen2(6, 144, 224 / 8);
|
30069
|
-
var sha3_2562 = gen2(6, 136, 256 / 8);
|
30070
|
-
var sha3_3842 = gen2(6, 104, 384 / 8);
|
30071
|
-
var sha3_5122 = gen2(6, 72, 512 / 8);
|
30072
|
-
var keccak_2242 = gen2(1, 144, 224 / 8);
|
30073
|
-
var keccak_2562 = gen2(1, 136, 256 / 8);
|
30074
|
-
var keccak_3842 = gen2(1, 104, 384 / 8);
|
30075
|
-
var keccak_5122 = gen2(1, 72, 512 / 8);
|
30076
|
-
var genShake2 = (suffix, blockLen, outputLen) => wrapConstructorWithOpts((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
|
30077
|
-
var shake1282 = genShake2(31, 168, 128 / 8);
|
30078
|
-
var shake2562 = genShake2(31, 136, 256 / 8);
|
30079
|
-
|
30080
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/keccak.js
|
30081
|
-
var locked2 = false;
|
30082
|
-
var _keccak256 = function(data) {
|
30083
|
-
return keccak_2562(data);
|
30084
|
-
};
|
30085
|
-
var __keccak256 = _keccak256;
|
30086
|
-
function keccak256(_data) {
|
30087
|
-
const data = getBytes(_data, "data");
|
30088
|
-
return hexlify2(__keccak256(data));
|
30089
|
-
}
|
30090
|
-
keccak256._ = _keccak256;
|
30091
|
-
keccak256.lock = function() {
|
30092
|
-
locked2 = true;
|
30093
|
-
};
|
30094
|
-
keccak256.register = function(func) {
|
30095
|
-
if (locked2) {
|
30096
|
-
throw new TypeError("keccak256 is locked");
|
30097
|
-
}
|
30098
|
-
__keccak256 = func;
|
30099
|
-
};
|
30100
|
-
Object.freeze(keccak256);
|
30101
29808
|
|
30102
29809
|
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_sha2.js
|
30103
29810
|
function setBigUint642(view, byteOffset, value, isLE3) {
|
30104
29811
|
if (typeof view.setBigUint64 === "function")
|
30105
29812
|
return view.setBigUint64(byteOffset, value, isLE3);
|
30106
|
-
const
|
29813
|
+
const _32n2 = BigInt(32);
|
30107
29814
|
const _u32_max = BigInt(4294967295);
|
30108
|
-
const wh = Number(value >>
|
29815
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
30109
29816
|
const wl = Number(value & _u32_max);
|
30110
29817
|
const h = isLE3 ? 4 : 0;
|
30111
29818
|
const l = isLE3 ? 0 : 4;
|
@@ -30277,7 +29984,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30277
29984
|
var ripemd160 = wrapConstructor2(() => new RIPEMD160());
|
30278
29985
|
|
30279
29986
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/ripemd160.js
|
30280
|
-
var
|
29987
|
+
var locked2 = false;
|
30281
29988
|
var _ripemd160 = function(data) {
|
30282
29989
|
return ripemd160(data);
|
30283
29990
|
};
|
@@ -30288,10 +29995,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30288
29995
|
}
|
30289
29996
|
ripemd1602._ = _ripemd160;
|
30290
29997
|
ripemd1602.lock = function() {
|
30291
|
-
|
29998
|
+
locked2 = true;
|
30292
29999
|
};
|
30293
30000
|
ripemd1602.register = function(func) {
|
30294
|
-
if (
|
30001
|
+
if (locked2) {
|
30295
30002
|
throw new TypeError("ripemd160 is locked");
|
30296
30003
|
}
|
30297
30004
|
__ripemd160 = func;
|
@@ -30299,7 +30006,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30299
30006
|
Object.freeze(ripemd1602);
|
30300
30007
|
|
30301
30008
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/pbkdf2.js
|
30302
|
-
var
|
30009
|
+
var locked3 = false;
|
30303
30010
|
var _pbkdf2 = function(password, salt, iterations, keylen, algo) {
|
30304
30011
|
return (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
30305
30012
|
};
|
@@ -30311,602 +30018,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30311
30018
|
}
|
30312
30019
|
pbkdf22._ = _pbkdf2;
|
30313
30020
|
pbkdf22.lock = function() {
|
30314
|
-
|
30021
|
+
locked3 = true;
|
30315
30022
|
};
|
30316
30023
|
pbkdf22.register = function(func) {
|
30317
|
-
if (
|
30024
|
+
if (locked3) {
|
30318
30025
|
throw new Error("pbkdf2 is locked");
|
30319
30026
|
}
|
30320
30027
|
__pbkdf2 = func;
|
30321
30028
|
};
|
30322
30029
|
Object.freeze(pbkdf22);
|
30323
30030
|
|
30324
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
|
30325
|
-
var BN_03 = BigInt(0);
|
30326
|
-
var BN_36 = BigInt(36);
|
30327
|
-
function getChecksumAddress(address) {
|
30328
|
-
address = address.toLowerCase();
|
30329
|
-
const chars = address.substring(2).split("");
|
30330
|
-
const expanded = new Uint8Array(40);
|
30331
|
-
for (let i = 0; i < 40; i++) {
|
30332
|
-
expanded[i] = chars[i].charCodeAt(0);
|
30333
|
-
}
|
30334
|
-
const hashed = getBytes(keccak256(expanded));
|
30335
|
-
for (let i = 0; i < 40; i += 2) {
|
30336
|
-
if (hashed[i >> 1] >> 4 >= 8) {
|
30337
|
-
chars[i] = chars[i].toUpperCase();
|
30338
|
-
}
|
30339
|
-
if ((hashed[i >> 1] & 15) >= 8) {
|
30340
|
-
chars[i + 1] = chars[i + 1].toUpperCase();
|
30341
|
-
}
|
30342
|
-
}
|
30343
|
-
return "0x" + chars.join("");
|
30344
|
-
}
|
30345
|
-
var ibanLookup = {};
|
30346
|
-
for (let i = 0; i < 10; i++) {
|
30347
|
-
ibanLookup[String(i)] = String(i);
|
30348
|
-
}
|
30349
|
-
for (let i = 0; i < 26; i++) {
|
30350
|
-
ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
|
30351
|
-
}
|
30352
|
-
var safeDigits = 15;
|
30353
|
-
function ibanChecksum(address) {
|
30354
|
-
address = address.toUpperCase();
|
30355
|
-
address = address.substring(4) + address.substring(0, 2) + "00";
|
30356
|
-
let expanded = address.split("").map((c) => {
|
30357
|
-
return ibanLookup[c];
|
30358
|
-
}).join("");
|
30359
|
-
while (expanded.length >= safeDigits) {
|
30360
|
-
let block2 = expanded.substring(0, safeDigits);
|
30361
|
-
expanded = parseInt(block2, 10) % 97 + expanded.substring(block2.length);
|
30362
|
-
}
|
30363
|
-
let checksum = String(98 - parseInt(expanded, 10) % 97);
|
30364
|
-
while (checksum.length < 2) {
|
30365
|
-
checksum = "0" + checksum;
|
30366
|
-
}
|
30367
|
-
return checksum;
|
30368
|
-
}
|
30369
|
-
var Base36 = function() {
|
30370
|
-
;
|
30371
|
-
const result = {};
|
30372
|
-
for (let i = 0; i < 36; i++) {
|
30373
|
-
const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
|
30374
|
-
result[key] = BigInt(i);
|
30375
|
-
}
|
30376
|
-
return result;
|
30377
|
-
}();
|
30378
|
-
function fromBase36(value) {
|
30379
|
-
value = value.toLowerCase();
|
30380
|
-
let result = BN_03;
|
30381
|
-
for (let i = 0; i < value.length; i++) {
|
30382
|
-
result = result * BN_36 + Base36[value[i]];
|
30383
|
-
}
|
30384
|
-
return result;
|
30385
|
-
}
|
30386
|
-
function getAddress(address) {
|
30387
|
-
assertArgument(typeof address === "string", "invalid address", "address", address);
|
30388
|
-
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
30389
|
-
if (!address.startsWith("0x")) {
|
30390
|
-
address = "0x" + address;
|
30391
|
-
}
|
30392
|
-
const result = getChecksumAddress(address);
|
30393
|
-
assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
|
30394
|
-
return result;
|
30395
|
-
}
|
30396
|
-
if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
30397
|
-
assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
|
30398
|
-
let result = fromBase36(address.substring(4)).toString(16);
|
30399
|
-
while (result.length < 40) {
|
30400
|
-
result = "0" + result;
|
30401
|
-
}
|
30402
|
-
return getChecksumAddress("0x" + result);
|
30403
|
-
}
|
30404
|
-
assertArgument(false, "invalid address", "address", address);
|
30405
|
-
}
|
30406
|
-
|
30407
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/transaction/accesslist.js
|
30408
|
-
function accessSetify(addr, storageKeys) {
|
30409
|
-
return {
|
30410
|
-
address: getAddress(addr),
|
30411
|
-
storageKeys: storageKeys.map((storageKey, index) => {
|
30412
|
-
assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey);
|
30413
|
-
return storageKey.toLowerCase();
|
30414
|
-
})
|
30415
|
-
};
|
30416
|
-
}
|
30417
|
-
function accessListify(value) {
|
30418
|
-
if (Array.isArray(value)) {
|
30419
|
-
return value.map((set, index) => {
|
30420
|
-
if (Array.isArray(set)) {
|
30421
|
-
assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set);
|
30422
|
-
return accessSetify(set[0], set[1]);
|
30423
|
-
}
|
30424
|
-
assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value);
|
30425
|
-
return accessSetify(set.address, set.storageKeys);
|
30426
|
-
});
|
30427
|
-
}
|
30428
|
-
assertArgument(value != null && typeof value === "object", "invalid access list", "value", value);
|
30429
|
-
const result = Object.keys(value).map((addr) => {
|
30430
|
-
const storageKeys = value[addr].reduce((accum, storageKey) => {
|
30431
|
-
accum[storageKey] = true;
|
30432
|
-
return accum;
|
30433
|
-
}, {});
|
30434
|
-
return accessSetify(addr, Object.keys(storageKeys).sort());
|
30435
|
-
});
|
30436
|
-
result.sort((a, b) => a.address.localeCompare(b.address));
|
30437
|
-
return result;
|
30438
|
-
}
|
30439
|
-
|
30440
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/providers/plugins-network.js
|
30441
|
-
var EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
30442
|
-
var NetworkPlugin = class {
|
30443
|
-
/**
|
30444
|
-
* The name of the plugin.
|
30445
|
-
*
|
30446
|
-
* It is recommended to use reverse-domain-notation, which permits
|
30447
|
-
* unique names with a known authority as well as hierarchal entries.
|
30448
|
-
*/
|
30449
|
-
name;
|
30450
|
-
/**
|
30451
|
-
* Creates a new **NetworkPlugin**.
|
30452
|
-
*/
|
30453
|
-
constructor(name) {
|
30454
|
-
defineProperties(this, { name });
|
30455
|
-
}
|
30456
|
-
/**
|
30457
|
-
* Creates a copy of this plugin.
|
30458
|
-
*/
|
30459
|
-
clone() {
|
30460
|
-
return new NetworkPlugin(this.name);
|
30461
|
-
}
|
30462
|
-
};
|
30463
|
-
var GasCostPlugin = class extends NetworkPlugin {
|
30464
|
-
/**
|
30465
|
-
* The block number to treat these values as valid from.
|
30466
|
-
*
|
30467
|
-
* This allows a hardfork to have updated values included as well as
|
30468
|
-
* mulutiple hardforks to be supported.
|
30469
|
-
*/
|
30470
|
-
effectiveBlock;
|
30471
|
-
/**
|
30472
|
-
* The transactions base fee.
|
30473
|
-
*/
|
30474
|
-
txBase;
|
30475
|
-
/**
|
30476
|
-
* The fee for creating a new account.
|
30477
|
-
*/
|
30478
|
-
txCreate;
|
30479
|
-
/**
|
30480
|
-
* The fee per zero-byte in the data.
|
30481
|
-
*/
|
30482
|
-
txDataZero;
|
30483
|
-
/**
|
30484
|
-
* The fee per non-zero-byte in the data.
|
30485
|
-
*/
|
30486
|
-
txDataNonzero;
|
30487
|
-
/**
|
30488
|
-
* The fee per storage key in the [[link-eip-2930]] access list.
|
30489
|
-
*/
|
30490
|
-
txAccessListStorageKey;
|
30491
|
-
/**
|
30492
|
-
* The fee per address in the [[link-eip-2930]] access list.
|
30493
|
-
*/
|
30494
|
-
txAccessListAddress;
|
30495
|
-
/**
|
30496
|
-
* Creates a new GasCostPlugin from %%effectiveBlock%% until the
|
30497
|
-
* latest block or another GasCostPlugin supercedes that block number,
|
30498
|
-
* with the associated %%costs%%.
|
30499
|
-
*/
|
30500
|
-
constructor(effectiveBlock, costs) {
|
30501
|
-
if (effectiveBlock == null) {
|
30502
|
-
effectiveBlock = 0;
|
30503
|
-
}
|
30504
|
-
super(`org.ethers.network.plugins.GasCost#${effectiveBlock || 0}`);
|
30505
|
-
const props = { effectiveBlock };
|
30506
|
-
function set(name, nullish) {
|
30507
|
-
let value = (costs || {})[name];
|
30508
|
-
if (value == null) {
|
30509
|
-
value = nullish;
|
30510
|
-
}
|
30511
|
-
assertArgument(typeof value === "number", `invalud value for ${name}`, "costs", costs);
|
30512
|
-
props[name] = value;
|
30513
|
-
}
|
30514
|
-
set("txBase", 21e3);
|
30515
|
-
set("txCreate", 32e3);
|
30516
|
-
set("txDataZero", 4);
|
30517
|
-
set("txDataNonzero", 16);
|
30518
|
-
set("txAccessListStorageKey", 1900);
|
30519
|
-
set("txAccessListAddress", 2400);
|
30520
|
-
defineProperties(this, props);
|
30521
|
-
}
|
30522
|
-
clone() {
|
30523
|
-
return new GasCostPlugin(this.effectiveBlock, this);
|
30524
|
-
}
|
30525
|
-
};
|
30526
|
-
var EnsPlugin = class extends NetworkPlugin {
|
30527
|
-
/**
|
30528
|
-
* The ENS Registrty Contract address.
|
30529
|
-
*/
|
30530
|
-
address;
|
30531
|
-
/**
|
30532
|
-
* The chain ID that the ENS contract lives on.
|
30533
|
-
*/
|
30534
|
-
targetNetwork;
|
30535
|
-
/**
|
30536
|
-
* Creates a new **EnsPlugin** connected to %%address%% on the
|
30537
|
-
* %%targetNetwork%%. The default ENS address and mainnet is used
|
30538
|
-
* if unspecified.
|
30539
|
-
*/
|
30540
|
-
constructor(address, targetNetwork) {
|
30541
|
-
super("org.ethers.plugins.network.Ens");
|
30542
|
-
defineProperties(this, {
|
30543
|
-
address: address || EnsAddress,
|
30544
|
-
targetNetwork: targetNetwork == null ? 1 : targetNetwork
|
30545
|
-
});
|
30546
|
-
}
|
30547
|
-
clone() {
|
30548
|
-
return new EnsPlugin(this.address, this.targetNetwork);
|
30549
|
-
}
|
30550
|
-
};
|
30551
|
-
var FetchUrlFeeDataNetworkPlugin = class extends NetworkPlugin {
|
30552
|
-
#url;
|
30553
|
-
#processFunc;
|
30554
|
-
/**
|
30555
|
-
* The URL to initialize the FetchRequest with in %%processFunc%%.
|
30556
|
-
*/
|
30557
|
-
get url() {
|
30558
|
-
return this.#url;
|
30559
|
-
}
|
30560
|
-
/**
|
30561
|
-
* The callback to use when computing the FeeData.
|
30562
|
-
*/
|
30563
|
-
get processFunc() {
|
30564
|
-
return this.#processFunc;
|
30565
|
-
}
|
30566
|
-
/**
|
30567
|
-
* Creates a new **FetchUrlFeeDataNetworkPlugin** which will
|
30568
|
-
* be used when computing the fee data for the network.
|
30569
|
-
*/
|
30570
|
-
constructor(url, processFunc) {
|
30571
|
-
super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");
|
30572
|
-
this.#url = url;
|
30573
|
-
this.#processFunc = processFunc;
|
30574
|
-
}
|
30575
|
-
// We are immutable, so we can serve as our own clone
|
30576
|
-
clone() {
|
30577
|
-
return this;
|
30578
|
-
}
|
30579
|
-
};
|
30580
|
-
|
30581
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/providers/network.js
|
30582
|
-
var Networks = /* @__PURE__ */ new Map();
|
30583
|
-
var Network = class {
|
30584
|
-
#name;
|
30585
|
-
#chainId;
|
30586
|
-
#plugins;
|
30587
|
-
/**
|
30588
|
-
* Creates a new **Network** for %%name%% and %%chainId%%.
|
30589
|
-
*/
|
30590
|
-
constructor(name, chainId) {
|
30591
|
-
this.#name = name;
|
30592
|
-
this.#chainId = getBigInt(chainId);
|
30593
|
-
this.#plugins = /* @__PURE__ */ new Map();
|
30594
|
-
}
|
30595
|
-
/**
|
30596
|
-
* Returns a JSON-compatible representation of a Network.
|
30597
|
-
*/
|
30598
|
-
toJSON() {
|
30599
|
-
return { name: this.name, chainId: String(this.chainId) };
|
30600
|
-
}
|
30601
|
-
/**
|
30602
|
-
* The network common name.
|
30603
|
-
*
|
30604
|
-
* This is the canonical name, as networks migh have multiple
|
30605
|
-
* names.
|
30606
|
-
*/
|
30607
|
-
get name() {
|
30608
|
-
return this.#name;
|
30609
|
-
}
|
30610
|
-
set name(value) {
|
30611
|
-
this.#name = value;
|
30612
|
-
}
|
30613
|
-
/**
|
30614
|
-
* The network chain ID.
|
30615
|
-
*/
|
30616
|
-
get chainId() {
|
30617
|
-
return this.#chainId;
|
30618
|
-
}
|
30619
|
-
set chainId(value) {
|
30620
|
-
this.#chainId = getBigInt(value, "chainId");
|
30621
|
-
}
|
30622
|
-
/**
|
30623
|
-
* Returns true if %%other%% matches this network. Any chain ID
|
30624
|
-
* must match, and if no chain ID is present, the name must match.
|
30625
|
-
*
|
30626
|
-
* This method does not currently check for additional properties,
|
30627
|
-
* such as ENS address or plug-in compatibility.
|
30628
|
-
*/
|
30629
|
-
matches(other) {
|
30630
|
-
if (other == null) {
|
30631
|
-
return false;
|
30632
|
-
}
|
30633
|
-
if (typeof other === "string") {
|
30634
|
-
try {
|
30635
|
-
return this.chainId === getBigInt(other);
|
30636
|
-
} catch (error) {
|
30637
|
-
}
|
30638
|
-
return this.name === other;
|
30639
|
-
}
|
30640
|
-
if (typeof other === "number" || typeof other === "bigint") {
|
30641
|
-
try {
|
30642
|
-
return this.chainId === getBigInt(other);
|
30643
|
-
} catch (error) {
|
30644
|
-
}
|
30645
|
-
return false;
|
30646
|
-
}
|
30647
|
-
if (typeof other === "object") {
|
30648
|
-
if (other.chainId != null) {
|
30649
|
-
try {
|
30650
|
-
return this.chainId === getBigInt(other.chainId);
|
30651
|
-
} catch (error) {
|
30652
|
-
}
|
30653
|
-
return false;
|
30654
|
-
}
|
30655
|
-
if (other.name != null) {
|
30656
|
-
return this.name === other.name;
|
30657
|
-
}
|
30658
|
-
return false;
|
30659
|
-
}
|
30660
|
-
return false;
|
30661
|
-
}
|
30662
|
-
/**
|
30663
|
-
* Returns the list of plugins currently attached to this Network.
|
30664
|
-
*/
|
30665
|
-
get plugins() {
|
30666
|
-
return Array.from(this.#plugins.values());
|
30667
|
-
}
|
30668
|
-
/**
|
30669
|
-
* Attach a new %%plugin%% to this Network. The network name
|
30670
|
-
* must be unique, excluding any fragment.
|
30671
|
-
*/
|
30672
|
-
attachPlugin(plugin) {
|
30673
|
-
if (this.#plugins.get(plugin.name)) {
|
30674
|
-
throw new Error(`cannot replace existing plugin: ${plugin.name} `);
|
30675
|
-
}
|
30676
|
-
this.#plugins.set(plugin.name, plugin.clone());
|
30677
|
-
return this;
|
30678
|
-
}
|
30679
|
-
/**
|
30680
|
-
* Return the plugin, if any, matching %%name%% exactly. Plugins
|
30681
|
-
* with fragments will not be returned unless %%name%% includes
|
30682
|
-
* a fragment.
|
30683
|
-
*/
|
30684
|
-
getPlugin(name) {
|
30685
|
-
return this.#plugins.get(name) || null;
|
30686
|
-
}
|
30687
|
-
/**
|
30688
|
-
* Gets a list of all plugins that match %%name%%, with otr without
|
30689
|
-
* a fragment.
|
30690
|
-
*/
|
30691
|
-
getPlugins(basename) {
|
30692
|
-
return this.plugins.filter((p) => p.name.split("#")[0] === basename);
|
30693
|
-
}
|
30694
|
-
/**
|
30695
|
-
* Create a copy of this Network.
|
30696
|
-
*/
|
30697
|
-
clone() {
|
30698
|
-
const clone4 = new Network(this.name, this.chainId);
|
30699
|
-
this.plugins.forEach((plugin) => {
|
30700
|
-
clone4.attachPlugin(plugin.clone());
|
30701
|
-
});
|
30702
|
-
return clone4;
|
30703
|
-
}
|
30704
|
-
/**
|
30705
|
-
* Compute the intrinsic gas required for a transaction.
|
30706
|
-
*
|
30707
|
-
* A GasCostPlugin can be attached to override the default
|
30708
|
-
* values.
|
30709
|
-
*/
|
30710
|
-
computeIntrinsicGas(tx) {
|
30711
|
-
const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || new GasCostPlugin();
|
30712
|
-
let gas = costs.txBase;
|
30713
|
-
if (tx.to == null) {
|
30714
|
-
gas += costs.txCreate;
|
30715
|
-
}
|
30716
|
-
if (tx.data) {
|
30717
|
-
for (let i = 2; i < tx.data.length; i += 2) {
|
30718
|
-
if (tx.data.substring(i, i + 2) === "00") {
|
30719
|
-
gas += costs.txDataZero;
|
30720
|
-
} else {
|
30721
|
-
gas += costs.txDataNonzero;
|
30722
|
-
}
|
30723
|
-
}
|
30724
|
-
}
|
30725
|
-
if (tx.accessList) {
|
30726
|
-
const accessList = accessListify(tx.accessList);
|
30727
|
-
for (const addr in accessList) {
|
30728
|
-
gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length;
|
30729
|
-
}
|
30730
|
-
}
|
30731
|
-
return gas;
|
30732
|
-
}
|
30733
|
-
/**
|
30734
|
-
* Returns a new Network for the %%network%% name or chainId.
|
30735
|
-
*/
|
30736
|
-
static from(network) {
|
30737
|
-
injectCommonNetworks();
|
30738
|
-
if (network == null) {
|
30739
|
-
return Network.from("mainnet");
|
30740
|
-
}
|
30741
|
-
if (typeof network === "number") {
|
30742
|
-
network = BigInt(network);
|
30743
|
-
}
|
30744
|
-
if (typeof network === "string" || typeof network === "bigint") {
|
30745
|
-
const networkFunc = Networks.get(network);
|
30746
|
-
if (networkFunc) {
|
30747
|
-
return networkFunc();
|
30748
|
-
}
|
30749
|
-
if (typeof network === "bigint") {
|
30750
|
-
return new Network("unknown", network);
|
30751
|
-
}
|
30752
|
-
assertArgument(false, "unknown network", "network", network);
|
30753
|
-
}
|
30754
|
-
if (typeof network.clone === "function") {
|
30755
|
-
const clone4 = network.clone();
|
30756
|
-
return clone4;
|
30757
|
-
}
|
30758
|
-
if (typeof network === "object") {
|
30759
|
-
assertArgument(typeof network.name === "string" && typeof network.chainId === "number", "invalid network object name or chainId", "network", network);
|
30760
|
-
const custom = new Network(network.name, network.chainId);
|
30761
|
-
if (network.ensAddress || network.ensNetwork != null) {
|
30762
|
-
custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork));
|
30763
|
-
}
|
30764
|
-
return custom;
|
30765
|
-
}
|
30766
|
-
assertArgument(false, "invalid network", "network", network);
|
30767
|
-
}
|
30768
|
-
/**
|
30769
|
-
* Register %%nameOrChainId%% with a function which returns
|
30770
|
-
* an instance of a Network representing that chain.
|
30771
|
-
*/
|
30772
|
-
static register(nameOrChainId, networkFunc) {
|
30773
|
-
if (typeof nameOrChainId === "number") {
|
30774
|
-
nameOrChainId = BigInt(nameOrChainId);
|
30775
|
-
}
|
30776
|
-
const existing = Networks.get(nameOrChainId);
|
30777
|
-
if (existing) {
|
30778
|
-
assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId);
|
30779
|
-
}
|
30780
|
-
Networks.set(nameOrChainId, networkFunc);
|
30781
|
-
}
|
30782
|
-
};
|
30783
|
-
function parseUnits(_value, decimals) {
|
30784
|
-
const value = String(_value);
|
30785
|
-
if (!value.match(/^[0-9.]+$/)) {
|
30786
|
-
throw new Error(`invalid gwei value: ${_value}`);
|
30787
|
-
}
|
30788
|
-
const comps = value.split(".");
|
30789
|
-
if (comps.length === 1) {
|
30790
|
-
comps.push("");
|
30791
|
-
}
|
30792
|
-
if (comps.length !== 2) {
|
30793
|
-
throw new Error(`invalid gwei value: ${_value}`);
|
30794
|
-
}
|
30795
|
-
while (comps[1].length < decimals) {
|
30796
|
-
comps[1] += "0";
|
30797
|
-
}
|
30798
|
-
if (comps[1].length > 9) {
|
30799
|
-
let frac = BigInt(comps[1].substring(0, 9));
|
30800
|
-
if (!comps[1].substring(9).match(/^0+$/)) {
|
30801
|
-
frac++;
|
30802
|
-
}
|
30803
|
-
comps[1] = frac.toString();
|
30804
|
-
}
|
30805
|
-
return BigInt(comps[0] + comps[1]);
|
30806
|
-
}
|
30807
|
-
function getGasStationPlugin(url) {
|
30808
|
-
return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => {
|
30809
|
-
request.setHeader("User-Agent", "ethers");
|
30810
|
-
let response;
|
30811
|
-
try {
|
30812
|
-
const [_response, _feeData] = await Promise.all([
|
30813
|
-
request.send(),
|
30814
|
-
fetchFeeData()
|
30815
|
-
]);
|
30816
|
-
response = _response;
|
30817
|
-
const payload = response.bodyJson.standard;
|
30818
|
-
const feeData = {
|
30819
|
-
gasPrice: _feeData.gasPrice,
|
30820
|
-
maxFeePerGas: parseUnits(payload.maxFee, 9),
|
30821
|
-
maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9)
|
30822
|
-
};
|
30823
|
-
return feeData;
|
30824
|
-
} catch (error) {
|
30825
|
-
assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error });
|
30826
|
-
}
|
30827
|
-
});
|
30828
|
-
}
|
30829
|
-
function getPriorityFeePlugin(maxPriorityFeePerGas) {
|
30830
|
-
return new FetchUrlFeeDataNetworkPlugin("data:", async (fetchFeeData, provider, request) => {
|
30831
|
-
const feeData = await fetchFeeData();
|
30832
|
-
if (feeData.maxFeePerGas == null || feeData.maxPriorityFeePerGas == null) {
|
30833
|
-
return feeData;
|
30834
|
-
}
|
30835
|
-
const baseFee = feeData.maxFeePerGas - feeData.maxPriorityFeePerGas;
|
30836
|
-
return {
|
30837
|
-
gasPrice: feeData.gasPrice,
|
30838
|
-
maxFeePerGas: baseFee + maxPriorityFeePerGas,
|
30839
|
-
maxPriorityFeePerGas
|
30840
|
-
};
|
30841
|
-
});
|
30842
|
-
}
|
30843
|
-
var injected = false;
|
30844
|
-
function injectCommonNetworks() {
|
30845
|
-
if (injected) {
|
30846
|
-
return;
|
30847
|
-
}
|
30848
|
-
injected = true;
|
30849
|
-
function registerEth(name, chainId, options) {
|
30850
|
-
const func = function() {
|
30851
|
-
const network = new Network(name, chainId);
|
30852
|
-
if (options.ensNetwork != null) {
|
30853
|
-
network.attachPlugin(new EnsPlugin(null, options.ensNetwork));
|
30854
|
-
}
|
30855
|
-
network.attachPlugin(new GasCostPlugin());
|
30856
|
-
(options.plugins || []).forEach((plugin) => {
|
30857
|
-
network.attachPlugin(plugin);
|
30858
|
-
});
|
30859
|
-
return network;
|
30860
|
-
};
|
30861
|
-
Network.register(name, func);
|
30862
|
-
Network.register(chainId, func);
|
30863
|
-
if (options.altNames) {
|
30864
|
-
options.altNames.forEach((name2) => {
|
30865
|
-
Network.register(name2, func);
|
30866
|
-
});
|
30867
|
-
}
|
30868
|
-
}
|
30869
|
-
registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] });
|
30870
|
-
registerEth("ropsten", 3, { ensNetwork: 3 });
|
30871
|
-
registerEth("rinkeby", 4, { ensNetwork: 4 });
|
30872
|
-
registerEth("goerli", 5, { ensNetwork: 5 });
|
30873
|
-
registerEth("kovan", 42, { ensNetwork: 42 });
|
30874
|
-
registerEth("sepolia", 11155111, {});
|
30875
|
-
registerEth("classic", 61, {});
|
30876
|
-
registerEth("classicKotti", 6, {});
|
30877
|
-
registerEth("arbitrum", 42161, {
|
30878
|
-
ensNetwork: 1
|
30879
|
-
});
|
30880
|
-
registerEth("arbitrum-goerli", 421613, {});
|
30881
|
-
registerEth("bnb", 56, { ensNetwork: 1 });
|
30882
|
-
registerEth("bnbt", 97, {});
|
30883
|
-
registerEth("linea", 59144, { ensNetwork: 1 });
|
30884
|
-
registerEth("linea-goerli", 59140, {});
|
30885
|
-
registerEth("matic", 137, {
|
30886
|
-
ensNetwork: 1,
|
30887
|
-
plugins: [
|
30888
|
-
getGasStationPlugin("https://gasstation.polygon.technology/v2")
|
30889
|
-
]
|
30890
|
-
});
|
30891
|
-
registerEth("matic-mumbai", 80001, {
|
30892
|
-
altNames: ["maticMumbai", "maticmum"],
|
30893
|
-
plugins: [
|
30894
|
-
getGasStationPlugin("https://gasstation-testnet.polygon.technology/v2")
|
30895
|
-
]
|
30896
|
-
});
|
30897
|
-
registerEth("optimism", 10, {
|
30898
|
-
ensNetwork: 1,
|
30899
|
-
plugins: [
|
30900
|
-
getPriorityFeePlugin(BigInt("1000000"))
|
30901
|
-
]
|
30902
|
-
});
|
30903
|
-
registerEth("optimism-goerli", 420, {});
|
30904
|
-
registerEth("xdai", 100, { ensNetwork: 1 });
|
30905
|
-
}
|
30906
|
-
|
30907
30031
|
// ../crypto/dist/index.mjs
|
30032
|
+
var import_crypto8 = __toESM(__require("crypto"), 1);
|
30908
30033
|
var import_crypto9 = __toESM(__require("crypto"), 1);
|
30909
|
-
var import_crypto10 = __toESM(__require("crypto"), 1);
|
30910
30034
|
var scrypt3 = (params) => {
|
30911
30035
|
const { password, salt, n, p, r, dklen } = params;
|
30912
30036
|
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
@@ -30915,7 +30039,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30915
30039
|
var keccak2562 = (data) => keccak_256(data);
|
30916
30040
|
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
30917
30041
|
var randomBytes4 = (length) => {
|
30918
|
-
const randomValues = Uint8Array.from(
|
30042
|
+
const randomValues = Uint8Array.from(import_crypto8.default.randomBytes(length));
|
30919
30043
|
return randomValues;
|
30920
30044
|
};
|
30921
30045
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -30930,7 +30054,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30930
30054
|
const salt = randomBytes4(32);
|
30931
30055
|
const secret = keyFromPassword(password, salt);
|
30932
30056
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
30933
|
-
const cipher = await
|
30057
|
+
const cipher = await import_crypto7.default.createCipheriv(ALGORITHM, secret, iv);
|
30934
30058
|
let cipherData = cipher.update(dataBuffer);
|
30935
30059
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
30936
30060
|
return {
|
@@ -30944,7 +30068,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30944
30068
|
const salt = bufferFromString(keystore.salt);
|
30945
30069
|
const secret = keyFromPassword(password, salt);
|
30946
30070
|
const encryptedText = bufferFromString(keystore.data);
|
30947
|
-
const decipher = await
|
30071
|
+
const decipher = await import_crypto7.default.createDecipheriv(ALGORITHM, secret, iv);
|
30948
30072
|
const decrypted = decipher.update(encryptedText);
|
30949
30073
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
30950
30074
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -30955,12 +30079,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30955
30079
|
}
|
30956
30080
|
};
|
30957
30081
|
async function encryptJsonWalletData(data, key, iv) {
|
30958
|
-
const cipher = await
|
30082
|
+
const cipher = await import_crypto9.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30959
30083
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
30960
30084
|
return new Uint8Array(encrypted);
|
30961
30085
|
}
|
30962
30086
|
async function decryptJsonWalletData(data, key, iv) {
|
30963
|
-
const decipher =
|
30087
|
+
const decipher = import_crypto9.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30964
30088
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
30965
30089
|
return new Uint8Array(decrypted);
|
30966
30090
|
}
|
@@ -31495,182 +30619,32 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31495
30619
|
function toBytes3(value, bytesPadding) {
|
31496
30620
|
return bn(value).toBytes(bytesPadding);
|
31497
30621
|
}
|
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
|
-
};
|
30622
|
+
function max(...numbers) {
|
30623
|
+
return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
|
31513
30624
|
}
|
31514
30625
|
|
31515
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31516
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
31517
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31518
|
-
};
|
31519
|
-
|
31520
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31521
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31522
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31523
|
-
});
|
31524
|
-
var type_default = type;
|
31525
|
-
|
31526
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31527
|
-
var pad = function pad2(n) {
|
31528
|
-
return (n < 10 ? "0" : "") + n;
|
31529
|
-
};
|
31530
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31531
|
-
return d.toISOString();
|
31532
|
-
} : function _toISOString3(d) {
|
31533
|
-
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
31534
|
-
};
|
31535
|
-
|
31536
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31537
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31538
|
-
return n << 0 === n;
|
31539
|
-
};
|
31540
|
-
|
31541
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31542
|
-
function _cloneRegExp(pattern) {
|
31543
|
-
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
31544
|
-
}
|
31545
|
-
|
31546
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31547
|
-
function _clone(value, deep, map) {
|
31548
|
-
map || (map = new _ObjectMap());
|
31549
|
-
if (_isPrimitive(value)) {
|
31550
|
-
return value;
|
31551
|
-
}
|
31552
|
-
var copy = function copy2(copiedValue) {
|
31553
|
-
var cachedCopy = map.get(value);
|
31554
|
-
if (cachedCopy) {
|
31555
|
-
return cachedCopy;
|
31556
|
-
}
|
31557
|
-
map.set(value, copiedValue);
|
31558
|
-
for (var key in value) {
|
31559
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31560
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31561
|
-
}
|
31562
|
-
}
|
31563
|
-
return copiedValue;
|
31564
|
-
};
|
31565
|
-
switch (type_default(value)) {
|
31566
|
-
case "Object":
|
31567
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
31568
|
-
case "Array":
|
31569
|
-
return copy([]);
|
31570
|
-
case "Date":
|
31571
|
-
return new Date(value.valueOf());
|
31572
|
-
case "RegExp":
|
31573
|
-
return _cloneRegExp(value);
|
31574
|
-
case "Int8Array":
|
31575
|
-
case "Uint8Array":
|
31576
|
-
case "Uint8ClampedArray":
|
31577
|
-
case "Int16Array":
|
31578
|
-
case "Uint16Array":
|
31579
|
-
case "Int32Array":
|
31580
|
-
case "Uint32Array":
|
31581
|
-
case "Float32Array":
|
31582
|
-
case "Float64Array":
|
31583
|
-
case "BigInt64Array":
|
31584
|
-
case "BigUint64Array":
|
31585
|
-
return value.slice();
|
31586
|
-
default:
|
31587
|
-
return value;
|
31588
|
-
}
|
31589
|
-
}
|
31590
|
-
function _isPrimitive(param) {
|
31591
|
-
var type3 = typeof param;
|
31592
|
-
return param == null || type3 != "object" && type3 != "function";
|
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
30626
|
// src/providers/coin-quantity.ts
|
31653
30627
|
var coinQuantityfy = (coinQuantityLike) => {
|
31654
30628
|
let assetId;
|
31655
30629
|
let amount;
|
31656
|
-
let
|
30630
|
+
let max2;
|
31657
30631
|
if (Array.isArray(coinQuantityLike)) {
|
31658
30632
|
amount = coinQuantityLike[0];
|
31659
30633
|
assetId = coinQuantityLike[1];
|
31660
|
-
|
30634
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31661
30635
|
} else {
|
31662
30636
|
amount = coinQuantityLike.amount;
|
31663
30637
|
assetId = coinQuantityLike.assetId;
|
31664
|
-
|
30638
|
+
max2 = coinQuantityLike.max ?? void 0;
|
31665
30639
|
}
|
31666
30640
|
const bnAmount = bn(amount);
|
31667
30641
|
return {
|
31668
30642
|
assetId: hexlify(assetId),
|
31669
30643
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31670
|
-
max:
|
30644
|
+
max: max2 ? bn(max2) : void 0
|
31671
30645
|
};
|
31672
30646
|
};
|
31673
|
-
var
|
30647
|
+
var addAmountToAsset = (params) => {
|
31674
30648
|
const { amount, assetId } = params;
|
31675
30649
|
const coinQuantities = [...params.coinQuantities];
|
31676
30650
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31755,7 +30729,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31755
30729
|
var ENCODING_V1 = "1";
|
31756
30730
|
var WORD_SIZE = 8;
|
31757
30731
|
var BYTES_32 = 32;
|
31758
|
-
var UTXO_ID_LEN = BYTES_32 +
|
30732
|
+
var UTXO_ID_LEN = BYTES_32 + 1;
|
31759
30733
|
var ASSET_ID_LEN = BYTES_32;
|
31760
30734
|
var ADDRESS_LEN = BYTES_32;
|
31761
30735
|
var NONCE_LEN = BYTES_32;
|
@@ -31763,9 +30737,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31763
30737
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31764
30738
|
var MAX_BYTES = 2 ** 32 - 1;
|
31765
30739
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31766
|
-
|
30740
|
+
WORD_SIZE + // Tx size
|
31767
30741
|
// Asset ID/Balance coin input pairs
|
31768
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE)
|
30742
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31769
30743
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31770
30744
|
WORD_SIZE + // Gas limit
|
31771
30745
|
WORD_SIZE + // Script size
|
@@ -31783,6 +30757,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31783
30757
|
ASSET_ID_LEN + // Asset id
|
31784
30758
|
TX_POINTER_LEN + // TxPointer
|
31785
30759
|
WORD_SIZE + // Witnesses index
|
30760
|
+
WORD_SIZE + // Maturity
|
31786
30761
|
WORD_SIZE + // Predicate size
|
31787
30762
|
WORD_SIZE + // Predicate data size
|
31788
30763
|
WORD_SIZE;
|
@@ -32104,7 +31079,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32104
31079
|
constructor(name, coders) {
|
32105
31080
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32106
31081
|
const encodedValueSize = Object.values(coders).reduce(
|
32107
|
-
(
|
31082
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32108
31083
|
0
|
32109
31084
|
);
|
32110
31085
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32822,7 +31797,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32822
31797
|
constructor(name, coders) {
|
32823
31798
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32824
31799
|
const encodedValueSize = Object.values(coders).reduce(
|
32825
|
-
(
|
31800
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32826
31801
|
0
|
32827
31802
|
);
|
32828
31803
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33540,19 +32515,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33540
32515
|
encode(value) {
|
33541
32516
|
const parts = [];
|
33542
32517
|
parts.push(new B256Coder().encode(value.txID));
|
33543
|
-
parts.push(new NumberCoder("
|
32518
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33544
32519
|
parts.push(new B256Coder().encode(value.owner));
|
33545
32520
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33546
32521
|
parts.push(new B256Coder().encode(value.assetId));
|
33547
32522
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33548
|
-
parts.push(new NumberCoder("
|
32523
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
32524
|
+
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33549
32525
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33550
|
-
parts.push(new
|
33551
|
-
parts.push(new
|
33552
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33553
|
-
parts.push(
|
33554
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33555
|
-
);
|
32526
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
32527
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
32528
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
32529
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33556
32530
|
return concat(parts);
|
33557
32531
|
}
|
33558
32532
|
decode(data, offset) {
|
@@ -33560,7 +32534,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33560
32534
|
let o = offset;
|
33561
32535
|
[decoded, o] = new B256Coder().decode(data, o);
|
33562
32536
|
const txID = decoded;
|
33563
|
-
[decoded, o] = new NumberCoder("
|
32537
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33564
32538
|
const outputIndex = decoded;
|
33565
32539
|
[decoded, o] = new B256Coder().decode(data, o);
|
33566
32540
|
const owner = decoded;
|
@@ -33570,17 +32544,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33570
32544
|
const assetId = decoded;
|
33571
32545
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33572
32546
|
const txPointer = decoded;
|
33573
|
-
[decoded, o] = new NumberCoder("
|
32547
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33574
32548
|
const witnessIndex = Number(decoded);
|
32549
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
32550
|
+
const maturity = decoded;
|
33575
32551
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33576
32552
|
const predicateGasUsed = decoded;
|
33577
|
-
[decoded, o] = new
|
32553
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33578
32554
|
const predicateLength = decoded;
|
33579
|
-
[decoded, o] = new
|
32555
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33580
32556
|
const predicateDataLength = decoded;
|
33581
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
32557
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33582
32558
|
const predicate = decoded;
|
33583
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
32559
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33584
32560
|
const predicateData = decoded;
|
33585
32561
|
return [
|
33586
32562
|
{
|
@@ -33592,6 +32568,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33592
32568
|
assetId,
|
33593
32569
|
txPointer,
|
33594
32570
|
witnessIndex,
|
32571
|
+
maturity,
|
33595
32572
|
predicateGasUsed,
|
33596
32573
|
predicateLength,
|
33597
32574
|
predicateDataLength,
|
@@ -33609,7 +32586,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33609
32586
|
encode(value) {
|
33610
32587
|
const parts = [];
|
33611
32588
|
parts.push(new B256Coder().encode(value.txID));
|
33612
|
-
parts.push(new NumberCoder("
|
32589
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33613
32590
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33614
32591
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33615
32592
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33621,7 +32598,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33621
32598
|
let o = offset;
|
33622
32599
|
[decoded, o] = new B256Coder().decode(data, o);
|
33623
32600
|
const txID = decoded;
|
33624
|
-
[decoded, o] = new NumberCoder("
|
32601
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33625
32602
|
const outputIndex = decoded;
|
33626
32603
|
[decoded, o] = new B256Coder().decode(data, o);
|
33627
32604
|
const balanceRoot = decoded;
|
@@ -33670,16 +32647,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33670
32647
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33671
32648
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33672
32649
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33673
|
-
parts.push(new NumberCoder("
|
32650
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33674
32651
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33675
|
-
parts.push(new
|
33676
|
-
parts.push(new
|
33677
|
-
parts.push(new
|
32652
|
+
parts.push(new NumberCoder("u32").encode(data.length));
|
32653
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
32654
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33678
32655
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33679
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33680
|
-
parts.push(
|
33681
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33682
|
-
);
|
32656
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
32657
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33683
32658
|
return concat(parts);
|
33684
32659
|
}
|
33685
32660
|
static decodeData(messageData) {
|
@@ -33699,21 +32674,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33699
32674
|
const amount = decoded;
|
33700
32675
|
[decoded, o] = new B256Coder().decode(data, o);
|
33701
32676
|
const nonce = decoded;
|
33702
|
-
[decoded, o] = new NumberCoder("
|
32677
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33703
32678
|
const witnessIndex = Number(decoded);
|
33704
32679
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33705
32680
|
const predicateGasUsed = decoded;
|
33706
32681
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33707
32682
|
const dataLength2 = decoded;
|
33708
|
-
[decoded, o] = new
|
32683
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33709
32684
|
const predicateLength = decoded;
|
33710
|
-
[decoded, o] = new
|
32685
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33711
32686
|
const predicateDataLength = decoded;
|
33712
32687
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33713
32688
|
const messageData = decoded;
|
33714
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
32689
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33715
32690
|
const predicate = decoded;
|
33716
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
32691
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33717
32692
|
const predicateData = decoded;
|
33718
32693
|
return [
|
33719
32694
|
{
|
@@ -34025,7 +33000,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34025
33000
|
}
|
34026
33001
|
};
|
34027
33002
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
34028
|
-
PolicyType2[PolicyType2["
|
33003
|
+
PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
|
34029
33004
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
34030
33005
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
34031
33006
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -34073,9 +33048,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34073
33048
|
let o = offset;
|
34074
33049
|
const policies = [];
|
34075
33050
|
if (policyTypes & 1) {
|
34076
|
-
const [
|
33051
|
+
const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
34077
33052
|
o = nextOffset;
|
34078
|
-
policies.push({ type: 1, data:
|
33053
|
+
policies.push({ type: 1, data: gasPrice });
|
34079
33054
|
}
|
34080
33055
|
if (policyTypes & 2) {
|
34081
33056
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34307,15 +33282,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34307
33282
|
encode(value) {
|
34308
33283
|
const parts = [];
|
34309
33284
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34310
|
-
parts.push(new
|
34311
|
-
parts.push(new
|
34312
|
-
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
33285
|
+
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
33286
|
+
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34313
33287
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34314
|
-
parts.push(new NumberCoder("
|
34315
|
-
parts.push(new NumberCoder("
|
34316
|
-
parts.push(new NumberCoder("
|
34317
|
-
parts.push(new
|
34318
|
-
parts.push(new ByteArrayCoder(value.
|
33288
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
33289
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
33290
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
33291
|
+
parts.push(new B256Coder().encode(value.receiptsRoot));
|
33292
|
+
parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
|
33293
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
|
34319
33294
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34320
33295
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34321
33296
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34327,23 +33302,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34327
33302
|
let o = offset;
|
34328
33303
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34329
33304
|
const scriptGasLimit = decoded;
|
34330
|
-
[decoded, o] = new
|
34331
|
-
const receiptsRoot = decoded;
|
34332
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33305
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34333
33306
|
const scriptLength = decoded;
|
34334
|
-
[decoded, o] = new
|
33307
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34335
33308
|
const scriptDataLength = decoded;
|
34336
33309
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34337
33310
|
const policyTypes = decoded;
|
34338
|
-
[decoded, o] = new NumberCoder("
|
33311
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34339
33312
|
const inputsCount = decoded;
|
34340
|
-
[decoded, o] = new NumberCoder("
|
33313
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34341
33314
|
const outputsCount = decoded;
|
34342
|
-
[decoded, o] = new NumberCoder("
|
33315
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34343
33316
|
const witnessesCount = decoded;
|
34344
|
-
[decoded, o] = new
|
33317
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
33318
|
+
const receiptsRoot = decoded;
|
33319
|
+
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34345
33320
|
const script = decoded;
|
34346
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength
|
33321
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34347
33322
|
const scriptData = decoded;
|
34348
33323
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34349
33324
|
const policies = decoded;
|
@@ -34381,19 +33356,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34381
33356
|
}
|
34382
33357
|
encode(value) {
|
34383
33358
|
const parts = [];
|
34384
|
-
parts.push(new NumberCoder("
|
34385
|
-
parts.push(new
|
34386
|
-
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
33359
|
+
parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
|
33360
|
+
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34387
33361
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34388
|
-
parts.push(new NumberCoder("u16").encode(value.
|
34389
|
-
parts.push(new NumberCoder("
|
34390
|
-
parts.push(new NumberCoder("
|
33362
|
+
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
33363
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
33364
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
33365
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
33366
|
+
parts.push(new B256Coder().encode(value.salt));
|
33367
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34391
33368
|
parts.push(
|
34392
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount
|
34393
|
-
value.storageSlots
|
34394
|
-
)
|
33369
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
|
34395
33370
|
);
|
34396
|
-
parts.push(new PoliciesCoder().encode(value.policies));
|
34397
33371
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34398
33372
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34399
33373
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34402,27 +33376,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34402
33376
|
decode(data, offset) {
|
34403
33377
|
let decoded;
|
34404
33378
|
let o = offset;
|
34405
|
-
[decoded, o] = new NumberCoder("
|
33379
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33380
|
+
const bytecodeLength = decoded;
|
33381
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34406
33382
|
const bytecodeWitnessIndex = decoded;
|
34407
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
34408
|
-
const salt = decoded;
|
34409
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34410
|
-
const storageSlotsCount = decoded;
|
34411
33383
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34412
33384
|
const policyTypes = decoded;
|
34413
33385
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33386
|
+
const storageSlotsCount = decoded;
|
33387
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34414
33388
|
const inputsCount = decoded;
|
34415
|
-
[decoded, o] = new NumberCoder("
|
33389
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34416
33390
|
const outputsCount = decoded;
|
34417
|
-
[decoded, o] = new NumberCoder("
|
33391
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34418
33392
|
const witnessesCount = decoded;
|
34419
|
-
[decoded, o] = new
|
34420
|
-
|
34421
|
-
o
|
34422
|
-
);
|
34423
|
-
const storageSlots = decoded;
|
33393
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
33394
|
+
const salt = decoded;
|
34424
33395
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34425
33396
|
const policies = decoded;
|
33397
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
33398
|
+
const storageSlots = decoded;
|
34426
33399
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34427
33400
|
const inputs = decoded;
|
34428
33401
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34432,6 +33405,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34432
33405
|
return [
|
34433
33406
|
{
|
34434
33407
|
type: 1,
|
33408
|
+
bytecodeLength,
|
34435
33409
|
bytecodeWitnessIndex,
|
34436
33410
|
policyTypes,
|
34437
33411
|
storageSlotsCount,
|
@@ -34460,7 +33434,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34460
33434
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34461
33435
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34462
33436
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34463
|
-
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34464
33437
|
return concat(parts);
|
34465
33438
|
}
|
34466
33439
|
decode(data, offset) {
|
@@ -34476,8 +33449,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34476
33449
|
const mintAmount = decoded;
|
34477
33450
|
[decoded, o] = new B256Coder().decode(data, o);
|
34478
33451
|
const mintAssetId = decoded;
|
34479
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34480
|
-
const gasPrice = decoded;
|
34481
33452
|
return [
|
34482
33453
|
{
|
34483
33454
|
type: 2,
|
@@ -34485,8 +33456,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34485
33456
|
inputContract,
|
34486
33457
|
outputContract,
|
34487
33458
|
mintAmount,
|
34488
|
-
mintAssetId
|
34489
|
-
gasPrice
|
33459
|
+
mintAssetId
|
34490
33460
|
},
|
34491
33461
|
o
|
34492
33462
|
];
|
@@ -34578,9 +33548,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34578
33548
|
utf8ToBytes: () => utf8ToBytes3,
|
34579
33549
|
validateObject: () => validateObject
|
34580
33550
|
});
|
34581
|
-
var
|
34582
|
-
var
|
34583
|
-
var
|
33551
|
+
var _0n2 = BigInt(0);
|
33552
|
+
var _1n2 = BigInt(1);
|
33553
|
+
var _2n2 = BigInt(2);
|
34584
33554
|
function isBytes3(a) {
|
34585
33555
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
34586
33556
|
}
|
@@ -34699,17 +33669,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34699
33669
|
}
|
34700
33670
|
function bitLen(n) {
|
34701
33671
|
let len;
|
34702
|
-
for (len = 0; n >
|
33672
|
+
for (len = 0; n > _0n2; n >>= _1n2, len += 1)
|
34703
33673
|
;
|
34704
33674
|
return len;
|
34705
33675
|
}
|
34706
33676
|
function bitGet(n, pos) {
|
34707
|
-
return n >> BigInt(pos) &
|
33677
|
+
return n >> BigInt(pos) & _1n2;
|
34708
33678
|
}
|
34709
33679
|
var bitSet = (n, pos, value) => {
|
34710
|
-
return n | (value ?
|
33680
|
+
return n | (value ? _1n2 : _0n2) << BigInt(pos);
|
34711
33681
|
};
|
34712
|
-
var bitMask = (n) => (
|
33682
|
+
var bitMask = (n) => (_2n2 << BigInt(n - 1)) - _1n2;
|
34713
33683
|
var u8n = (data) => new Uint8Array(data);
|
34714
33684
|
var u8fr = (arr) => Uint8Array.from(arr);
|
34715
33685
|
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
@@ -34736,7 +33706,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34736
33706
|
k = h(u8fr([1]), seed);
|
34737
33707
|
v = h();
|
34738
33708
|
};
|
34739
|
-
const
|
33709
|
+
const gen2 = () => {
|
34740
33710
|
if (i++ >= 1e3)
|
34741
33711
|
throw new Error("drbg: tried 1000 values");
|
34742
33712
|
let len = 0;
|
@@ -34753,7 +33723,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34753
33723
|
reset();
|
34754
33724
|
reseed(seed);
|
34755
33725
|
let res = void 0;
|
34756
|
-
while (!(res = pred(
|
33726
|
+
while (!(res = pred(gen2())))
|
34757
33727
|
reseed();
|
34758
33728
|
reset();
|
34759
33729
|
return res;
|
@@ -34793,6 +33763,159 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34793
33763
|
// src/providers/provider.ts
|
34794
33764
|
var import_graphql_request = __toESM(require_dist2());
|
34795
33765
|
|
33766
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
33767
|
+
function _isPlaceholder(a) {
|
33768
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
33769
|
+
}
|
33770
|
+
|
33771
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
33772
|
+
function _curry1(fn) {
|
33773
|
+
return function f1(a) {
|
33774
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
33775
|
+
return f1;
|
33776
|
+
} else {
|
33777
|
+
return fn.apply(this, arguments);
|
33778
|
+
}
|
33779
|
+
};
|
33780
|
+
}
|
33781
|
+
|
33782
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
33783
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
33784
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
33785
|
+
};
|
33786
|
+
|
33787
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
33788
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
33789
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
33790
|
+
});
|
33791
|
+
var type_default = type;
|
33792
|
+
|
33793
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
33794
|
+
var pad = function pad2(n) {
|
33795
|
+
return (n < 10 ? "0" : "") + n;
|
33796
|
+
};
|
33797
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
33798
|
+
return d.toISOString();
|
33799
|
+
} : function _toISOString3(d) {
|
33800
|
+
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";
|
33801
|
+
};
|
33802
|
+
|
33803
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
33804
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
33805
|
+
return n << 0 === n;
|
33806
|
+
};
|
33807
|
+
|
33808
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
33809
|
+
function _cloneRegExp(pattern) {
|
33810
|
+
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" : ""));
|
33811
|
+
}
|
33812
|
+
|
33813
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
33814
|
+
function _clone(value, deep, map) {
|
33815
|
+
map || (map = new _ObjectMap());
|
33816
|
+
if (_isPrimitive(value)) {
|
33817
|
+
return value;
|
33818
|
+
}
|
33819
|
+
var copy = function copy2(copiedValue) {
|
33820
|
+
var cachedCopy = map.get(value);
|
33821
|
+
if (cachedCopy) {
|
33822
|
+
return cachedCopy;
|
33823
|
+
}
|
33824
|
+
map.set(value, copiedValue);
|
33825
|
+
for (var key in value) {
|
33826
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
33827
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
33828
|
+
}
|
33829
|
+
}
|
33830
|
+
return copiedValue;
|
33831
|
+
};
|
33832
|
+
switch (type_default(value)) {
|
33833
|
+
case "Object":
|
33834
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
33835
|
+
case "Array":
|
33836
|
+
return copy([]);
|
33837
|
+
case "Date":
|
33838
|
+
return new Date(value.valueOf());
|
33839
|
+
case "RegExp":
|
33840
|
+
return _cloneRegExp(value);
|
33841
|
+
case "Int8Array":
|
33842
|
+
case "Uint8Array":
|
33843
|
+
case "Uint8ClampedArray":
|
33844
|
+
case "Int16Array":
|
33845
|
+
case "Uint16Array":
|
33846
|
+
case "Int32Array":
|
33847
|
+
case "Uint32Array":
|
33848
|
+
case "Float32Array":
|
33849
|
+
case "Float64Array":
|
33850
|
+
case "BigInt64Array":
|
33851
|
+
case "BigUint64Array":
|
33852
|
+
return value.slice();
|
33853
|
+
default:
|
33854
|
+
return value;
|
33855
|
+
}
|
33856
|
+
}
|
33857
|
+
function _isPrimitive(param) {
|
33858
|
+
var type3 = typeof param;
|
33859
|
+
return param == null || type3 != "object" && type3 != "function";
|
33860
|
+
}
|
33861
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
33862
|
+
function _ObjectMap2() {
|
33863
|
+
this.map = {};
|
33864
|
+
this.length = 0;
|
33865
|
+
}
|
33866
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
33867
|
+
const hashedKey = this.hash(key);
|
33868
|
+
let bucket = this.map[hashedKey];
|
33869
|
+
if (!bucket) {
|
33870
|
+
this.map[hashedKey] = bucket = [];
|
33871
|
+
}
|
33872
|
+
bucket.push([key, value]);
|
33873
|
+
this.length += 1;
|
33874
|
+
};
|
33875
|
+
_ObjectMap2.prototype.hash = function(key) {
|
33876
|
+
let hashedKey = [];
|
33877
|
+
for (var value in key) {
|
33878
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
33879
|
+
}
|
33880
|
+
return hashedKey.join();
|
33881
|
+
};
|
33882
|
+
_ObjectMap2.prototype.get = function(key) {
|
33883
|
+
if (this.length <= 180) {
|
33884
|
+
for (const p in this.map) {
|
33885
|
+
const bucket2 = this.map[p];
|
33886
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
33887
|
+
const element = bucket2[i];
|
33888
|
+
if (element[0] === key) {
|
33889
|
+
return element[1];
|
33890
|
+
}
|
33891
|
+
}
|
33892
|
+
}
|
33893
|
+
return;
|
33894
|
+
}
|
33895
|
+
const hashedKey = this.hash(key);
|
33896
|
+
const bucket = this.map[hashedKey];
|
33897
|
+
if (!bucket) {
|
33898
|
+
return;
|
33899
|
+
}
|
33900
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
33901
|
+
const element = bucket[i];
|
33902
|
+
if (element[0] === key) {
|
33903
|
+
return element[1];
|
33904
|
+
}
|
33905
|
+
}
|
33906
|
+
};
|
33907
|
+
return _ObjectMap2;
|
33908
|
+
}();
|
33909
|
+
|
33910
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
33911
|
+
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
33912
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
33913
|
+
});
|
33914
|
+
var clone_default = clone2;
|
33915
|
+
|
33916
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
33917
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
33918
|
+
|
34796
33919
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34797
33920
|
var __assign = function() {
|
34798
33921
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37958,20 +37081,16 @@ spurious results.`);
|
|
37958
37081
|
var lib_default2 = gql;
|
37959
37082
|
|
37960
37083
|
// src/providers/__generated__/operations.ts
|
37961
|
-
var TransactionStatusSubscriptionFragmentFragmentDoc = lib_default2`
|
37962
|
-
fragment transactionStatusSubscriptionFragment on TransactionStatus {
|
37963
|
-
type: __typename
|
37964
|
-
... on SqueezedOutStatus {
|
37965
|
-
reason
|
37966
|
-
}
|
37967
|
-
}
|
37968
|
-
`;
|
37969
37084
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37970
37085
|
fragment receiptFragment on Receipt {
|
37971
|
-
|
37086
|
+
contract {
|
37087
|
+
id
|
37088
|
+
}
|
37972
37089
|
pc
|
37973
37090
|
is
|
37974
|
-
to
|
37091
|
+
to {
|
37092
|
+
id
|
37093
|
+
}
|
37975
37094
|
toAddress
|
37976
37095
|
amount
|
37977
37096
|
assetId
|
@@ -38009,16 +37128,10 @@ spurious results.`);
|
|
38009
37128
|
id
|
38010
37129
|
}
|
38011
37130
|
time
|
38012
|
-
receipts {
|
38013
|
-
...receiptFragment
|
38014
|
-
}
|
38015
37131
|
programState {
|
38016
37132
|
returnType
|
38017
37133
|
data
|
38018
37134
|
}
|
38019
|
-
receipts {
|
38020
|
-
...receiptFragment
|
38021
|
-
}
|
38022
37135
|
}
|
38023
37136
|
... on FailureStatus {
|
38024
37137
|
block {
|
@@ -38026,24 +37139,26 @@ spurious results.`);
|
|
38026
37139
|
}
|
38027
37140
|
time
|
38028
37141
|
reason
|
38029
|
-
receipts {
|
38030
|
-
...receiptFragment
|
38031
|
-
}
|
38032
37142
|
}
|
38033
37143
|
... on SqueezedOutStatus {
|
38034
37144
|
reason
|
38035
37145
|
}
|
38036
37146
|
}
|
38037
|
-
|
37147
|
+
`;
|
38038
37148
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38039
37149
|
fragment transactionFragment on Transaction {
|
38040
37150
|
id
|
38041
37151
|
rawPayload
|
37152
|
+
gasPrice
|
37153
|
+
receipts {
|
37154
|
+
...receiptFragment
|
37155
|
+
}
|
38042
37156
|
status {
|
38043
37157
|
...transactionStatusFragment
|
38044
37158
|
}
|
38045
37159
|
}
|
38046
|
-
${
|
37160
|
+
${ReceiptFragmentFragmentDoc}
|
37161
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38047
37162
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38048
37163
|
fragment inputEstimatePredicatesFragment on Input {
|
38049
37164
|
... on InputCoin {
|
@@ -38061,46 +37176,6 @@ spurious results.`);
|
|
38061
37176
|
}
|
38062
37177
|
}
|
38063
37178
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38064
|
-
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38065
|
-
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38066
|
-
reason
|
38067
|
-
programState {
|
38068
|
-
returnType
|
38069
|
-
data
|
38070
|
-
}
|
38071
|
-
}
|
38072
|
-
`;
|
38073
|
-
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38074
|
-
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38075
|
-
programState {
|
38076
|
-
returnType
|
38077
|
-
data
|
38078
|
-
}
|
38079
|
-
}
|
38080
|
-
`;
|
38081
|
-
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38082
|
-
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38083
|
-
... on DryRunFailureStatus {
|
38084
|
-
...dryRunFailureStatusFragment
|
38085
|
-
}
|
38086
|
-
... on DryRunSuccessStatus {
|
38087
|
-
...dryRunSuccessStatusFragment
|
38088
|
-
}
|
38089
|
-
}
|
38090
|
-
${DryRunFailureStatusFragmentFragmentDoc}
|
38091
|
-
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38092
|
-
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38093
|
-
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38094
|
-
id
|
38095
|
-
status {
|
38096
|
-
...dryRunTransactionStatusFragment
|
38097
|
-
}
|
38098
|
-
receipts {
|
38099
|
-
...receiptFragment
|
38100
|
-
}
|
38101
|
-
}
|
38102
|
-
${DryRunTransactionStatusFragmentFragmentDoc}
|
38103
|
-
${ReceiptFragmentFragmentDoc}`;
|
38104
37179
|
var CoinFragmentFragmentDoc = lib_default2`
|
38105
37180
|
fragment coinFragment on Coin {
|
38106
37181
|
__typename
|
@@ -38108,6 +37183,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38108
37183
|
owner
|
38109
37184
|
amount
|
38110
37185
|
assetId
|
37186
|
+
maturity
|
38111
37187
|
blockCreated
|
38112
37188
|
txCreatedIdx
|
38113
37189
|
}
|
@@ -38146,32 +37222,26 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38146
37222
|
messageBlockHeader {
|
38147
37223
|
id
|
38148
37224
|
daHeight
|
38149
|
-
consensusParametersVersion
|
38150
|
-
stateTransitionBytecodeVersion
|
38151
37225
|
transactionsCount
|
38152
|
-
messageReceiptCount
|
38153
37226
|
transactionsRoot
|
38154
|
-
messageOutboxRoot
|
38155
|
-
eventInboxRoot
|
38156
37227
|
height
|
38157
37228
|
prevRoot
|
38158
37229
|
time
|
38159
37230
|
applicationHash
|
37231
|
+
messageReceiptRoot
|
37232
|
+
messageReceiptCount
|
38160
37233
|
}
|
38161
37234
|
commitBlockHeader {
|
38162
37235
|
id
|
38163
37236
|
daHeight
|
38164
|
-
consensusParametersVersion
|
38165
|
-
stateTransitionBytecodeVersion
|
38166
37237
|
transactionsCount
|
38167
|
-
messageReceiptCount
|
38168
37238
|
transactionsRoot
|
38169
|
-
messageOutboxRoot
|
38170
|
-
eventInboxRoot
|
38171
37239
|
height
|
38172
37240
|
prevRoot
|
38173
37241
|
time
|
38174
37242
|
applicationHash
|
37243
|
+
messageReceiptRoot
|
37244
|
+
messageReceiptCount
|
38175
37245
|
}
|
38176
37246
|
sender
|
38177
37247
|
recipient
|
@@ -38190,8 +37260,8 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38190
37260
|
var BlockFragmentFragmentDoc = lib_default2`
|
38191
37261
|
fragment blockFragment on Block {
|
38192
37262
|
id
|
38193
|
-
height
|
38194
37263
|
header {
|
37264
|
+
height
|
38195
37265
|
time
|
38196
37266
|
}
|
38197
37267
|
transactions {
|
@@ -38201,7 +37271,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38201
37271
|
`;
|
38202
37272
|
var TxParametersFragmentFragmentDoc = lib_default2`
|
38203
37273
|
fragment TxParametersFragment on TxParameters {
|
38204
|
-
version
|
38205
37274
|
maxInputs
|
38206
37275
|
maxOutputs
|
38207
37276
|
maxWitnesses
|
@@ -38211,7 +37280,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38211
37280
|
`;
|
38212
37281
|
var PredicateParametersFragmentFragmentDoc = lib_default2`
|
38213
37282
|
fragment PredicateParametersFragment on PredicateParameters {
|
38214
|
-
version
|
38215
37283
|
maxPredicateLength
|
38216
37284
|
maxPredicateDataLength
|
38217
37285
|
maxGasPerPredicate
|
@@ -38220,21 +37288,18 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38220
37288
|
`;
|
38221
37289
|
var ScriptParametersFragmentFragmentDoc = lib_default2`
|
38222
37290
|
fragment ScriptParametersFragment on ScriptParameters {
|
38223
|
-
version
|
38224
37291
|
maxScriptLength
|
38225
37292
|
maxScriptDataLength
|
38226
37293
|
}
|
38227
37294
|
`;
|
38228
37295
|
var ContractParametersFragmentFragmentDoc = lib_default2`
|
38229
37296
|
fragment ContractParametersFragment on ContractParameters {
|
38230
|
-
version
|
38231
37297
|
contractMaxSize
|
38232
37298
|
maxStorageSlots
|
38233
37299
|
}
|
38234
37300
|
`;
|
38235
37301
|
var FeeParametersFragmentFragmentDoc = lib_default2`
|
38236
37302
|
fragment FeeParametersFragment on FeeParameters {
|
38237
|
-
version
|
38238
37303
|
gasPriceFactor
|
38239
37304
|
gasPerByte
|
38240
37305
|
}
|
@@ -38254,7 +37319,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38254
37319
|
`;
|
38255
37320
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38256
37321
|
fragment GasCostsFragment on GasCosts {
|
38257
|
-
version
|
38258
37322
|
add
|
38259
37323
|
addi
|
38260
37324
|
aloc
|
@@ -38267,6 +37331,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38267
37331
|
cb
|
38268
37332
|
cfei
|
38269
37333
|
cfsi
|
37334
|
+
croo
|
38270
37335
|
div
|
38271
37336
|
divi
|
38272
37337
|
ecr1
|
@@ -38349,9 +37414,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38349
37414
|
ccp {
|
38350
37415
|
...DependentCostFragment
|
38351
37416
|
}
|
38352
|
-
croo {
|
38353
|
-
...DependentCostFragment
|
38354
|
-
}
|
38355
37417
|
csiz {
|
38356
37418
|
...DependentCostFragment
|
38357
37419
|
}
|
@@ -38411,7 +37473,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38411
37473
|
${DependentCostFragmentFragmentDoc}`;
|
38412
37474
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38413
37475
|
fragment consensusParametersFragment on ConsensusParameters {
|
38414
|
-
version
|
38415
37476
|
txParams {
|
38416
37477
|
...TxParametersFragment
|
38417
37478
|
}
|
@@ -38471,9 +37532,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38471
37532
|
fragment nodeInfoFragment on NodeInfo {
|
38472
37533
|
utxoValidation
|
38473
37534
|
vmBacktrace
|
37535
|
+
minGasPrice
|
38474
37536
|
maxTx
|
38475
37537
|
maxDepth
|
38476
37538
|
nodeVersion
|
37539
|
+
peers {
|
37540
|
+
id
|
37541
|
+
addresses
|
37542
|
+
clientVersion
|
37543
|
+
blockHeight
|
37544
|
+
lastHeartbeatMs
|
37545
|
+
appScore
|
37546
|
+
}
|
38477
37547
|
}
|
38478
37548
|
`;
|
38479
37549
|
var GetVersionDocument = lib_default2`
|
@@ -38508,9 +37578,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38508
37578
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38509
37579
|
transaction(id: $transactionId) {
|
38510
37580
|
...transactionFragment
|
37581
|
+
receipts {
|
37582
|
+
...receiptFragment
|
37583
|
+
}
|
38511
37584
|
}
|
38512
37585
|
}
|
38513
|
-
${TransactionFragmentFragmentDoc}
|
37586
|
+
${TransactionFragmentFragmentDoc}
|
37587
|
+
${ReceiptFragmentFragmentDoc}`;
|
38514
37588
|
var GetTransactionsDocument = lib_default2`
|
38515
37589
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38516
37590
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38638,20 +37712,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38638
37712
|
}
|
38639
37713
|
}
|
38640
37714
|
${BalanceFragmentFragmentDoc}`;
|
38641
|
-
var GetLatestGasPriceDocument = lib_default2`
|
38642
|
-
query getLatestGasPrice {
|
38643
|
-
latestGasPrice {
|
38644
|
-
gasPrice
|
38645
|
-
}
|
38646
|
-
}
|
38647
|
-
`;
|
38648
|
-
var EstimateGasPriceDocument = lib_default2`
|
38649
|
-
query estimateGasPrice($blockHorizon: U32!) {
|
38650
|
-
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38651
|
-
gasPrice
|
38652
|
-
}
|
38653
|
-
}
|
38654
|
-
`;
|
38655
37715
|
var GetBalancesDocument = lib_default2`
|
38656
37716
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38657
37717
|
balances(
|
@@ -38706,12 +37766,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38706
37766
|
}
|
38707
37767
|
`;
|
38708
37768
|
var DryRunDocument = lib_default2`
|
38709
|
-
mutation dryRun($
|
38710
|
-
dryRun(
|
38711
|
-
...
|
37769
|
+
mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
|
37770
|
+
dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
|
37771
|
+
...receiptFragment
|
38712
37772
|
}
|
38713
37773
|
}
|
38714
|
-
${
|
37774
|
+
${ReceiptFragmentFragmentDoc}`;
|
38715
37775
|
var SubmitDocument = lib_default2`
|
38716
37776
|
mutation submit($encodedTransaction: HexString!) {
|
38717
37777
|
submit(tx: $encodedTransaction) {
|
@@ -38730,17 +37790,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38730
37790
|
var SubmitAndAwaitDocument = lib_default2`
|
38731
37791
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
38732
37792
|
submitAndAwait(tx: $encodedTransaction) {
|
38733
|
-
...
|
37793
|
+
...transactionStatusFragment
|
38734
37794
|
}
|
38735
37795
|
}
|
38736
|
-
${
|
37796
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38737
37797
|
var StatusChangeDocument = lib_default2`
|
38738
37798
|
subscription statusChange($transactionId: TransactionId!) {
|
38739
37799
|
statusChange(id: $transactionId) {
|
38740
|
-
...
|
37800
|
+
...transactionStatusFragment
|
38741
37801
|
}
|
38742
37802
|
}
|
38743
|
-
${
|
37803
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38744
37804
|
function getSdk(requester) {
|
38745
37805
|
return {
|
38746
37806
|
getVersion(variables, options) {
|
@@ -38794,12 +37854,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38794
37854
|
getBalance(variables, options) {
|
38795
37855
|
return requester(GetBalanceDocument, variables, options);
|
38796
37856
|
},
|
38797
|
-
getLatestGasPrice(variables, options) {
|
38798
|
-
return requester(GetLatestGasPriceDocument, variables, options);
|
38799
|
-
},
|
38800
|
-
estimateGasPrice(variables, options) {
|
38801
|
-
return requester(EstimateGasPriceDocument, variables, options);
|
38802
|
-
},
|
38803
37857
|
getBalances(variables, options) {
|
38804
37858
|
return requester(GetBalancesDocument, variables, options);
|
38805
37859
|
},
|
@@ -38986,9 +38040,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38986
38040
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38987
38041
|
},
|
38988
38042
|
witnessIndex: value.witnessIndex,
|
38043
|
+
maturity: value.maturity ?? 0,
|
38989
38044
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38990
|
-
predicateLength:
|
38991
|
-
predicateDataLength:
|
38045
|
+
predicateLength: predicate.length,
|
38046
|
+
predicateDataLength: predicateData.length,
|
38992
38047
|
predicate: hexlify(predicate),
|
38993
38048
|
predicateData: hexlify(predicateData)
|
38994
38049
|
};
|
@@ -39019,8 +38074,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39019
38074
|
nonce: hexlify(value.nonce),
|
39020
38075
|
witnessIndex: value.witnessIndex,
|
39021
38076
|
predicateGasUsed: bn(value.predicateGasUsed),
|
39022
|
-
predicateLength:
|
39023
|
-
predicateDataLength:
|
38077
|
+
predicateLength: predicate.length,
|
38078
|
+
predicateDataLength: predicateData.length,
|
39024
38079
|
predicate: hexlify(predicate),
|
39025
38080
|
predicateData: hexlify(predicateData),
|
39026
38081
|
data: hexlify(data),
|
@@ -39180,8 +38235,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39180
38235
|
case "CALL" /* Call */: {
|
39181
38236
|
const callReceipt = {
|
39182
38237
|
type: ReceiptType.Call,
|
39183
|
-
from: hexOrZero(receipt.id
|
39184
|
-
to: hexOrZero(receipt?.to),
|
38238
|
+
from: hexOrZero(receipt.contract?.id),
|
38239
|
+
to: hexOrZero(receipt?.to?.id),
|
39185
38240
|
amount: bn(receipt.amount),
|
39186
38241
|
assetId: hexOrZero(receipt.assetId),
|
39187
38242
|
gas: bn(receipt.gas),
|
@@ -39195,7 +38250,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39195
38250
|
case "RETURN" /* Return */: {
|
39196
38251
|
const returnReceipt = {
|
39197
38252
|
type: ReceiptType.Return,
|
39198
|
-
id: hexOrZero(receipt.id
|
38253
|
+
id: hexOrZero(receipt.contract?.id),
|
39199
38254
|
val: bn(receipt.val),
|
39200
38255
|
pc: bn(receipt.pc),
|
39201
38256
|
is: bn(receipt.is)
|
@@ -39205,7 +38260,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39205
38260
|
case "RETURN_DATA" /* ReturnData */: {
|
39206
38261
|
const returnDataReceipt = {
|
39207
38262
|
type: ReceiptType.ReturnData,
|
39208
|
-
id: hexOrZero(receipt.id
|
38263
|
+
id: hexOrZero(receipt.contract?.id),
|
39209
38264
|
ptr: bn(receipt.ptr),
|
39210
38265
|
len: bn(receipt.len),
|
39211
38266
|
digest: hexOrZero(receipt.digest),
|
@@ -39217,7 +38272,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39217
38272
|
case "PANIC" /* Panic */: {
|
39218
38273
|
const panicReceipt = {
|
39219
38274
|
type: ReceiptType.Panic,
|
39220
|
-
id: hexOrZero(receipt.id),
|
38275
|
+
id: hexOrZero(receipt.contract?.id),
|
39221
38276
|
reason: bn(receipt.reason),
|
39222
38277
|
pc: bn(receipt.pc),
|
39223
38278
|
is: bn(receipt.is),
|
@@ -39228,7 +38283,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39228
38283
|
case "REVERT" /* Revert */: {
|
39229
38284
|
const revertReceipt = {
|
39230
38285
|
type: ReceiptType.Revert,
|
39231
|
-
id: hexOrZero(receipt.id
|
38286
|
+
id: hexOrZero(receipt.contract?.id),
|
39232
38287
|
val: bn(receipt.ra),
|
39233
38288
|
pc: bn(receipt.pc),
|
39234
38289
|
is: bn(receipt.is)
|
@@ -39238,7 +38293,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39238
38293
|
case "LOG" /* Log */: {
|
39239
38294
|
const logReceipt = {
|
39240
38295
|
type: ReceiptType.Log,
|
39241
|
-
id: hexOrZero(receipt.id
|
38296
|
+
id: hexOrZero(receipt.contract?.id),
|
39242
38297
|
val0: bn(receipt.ra),
|
39243
38298
|
val1: bn(receipt.rb),
|
39244
38299
|
val2: bn(receipt.rc),
|
@@ -39251,7 +38306,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39251
38306
|
case "LOG_DATA" /* LogData */: {
|
39252
38307
|
const logDataReceipt = {
|
39253
38308
|
type: ReceiptType.LogData,
|
39254
|
-
id: hexOrZero(receipt.id
|
38309
|
+
id: hexOrZero(receipt.contract?.id),
|
39255
38310
|
val0: bn(receipt.ra),
|
39256
38311
|
val1: bn(receipt.rb),
|
39257
38312
|
ptr: bn(receipt.ptr),
|
@@ -39265,8 +38320,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39265
38320
|
case "TRANSFER" /* Transfer */: {
|
39266
38321
|
const transferReceipt = {
|
39267
38322
|
type: ReceiptType.Transfer,
|
39268
|
-
from: hexOrZero(receipt.id
|
39269
|
-
to: hexOrZero(receipt.toAddress || receipt?.to),
|
38323
|
+
from: hexOrZero(receipt.contract?.id),
|
38324
|
+
to: hexOrZero(receipt.toAddress || receipt?.to?.id),
|
39270
38325
|
amount: bn(receipt.amount),
|
39271
38326
|
assetId: hexOrZero(receipt.assetId),
|
39272
38327
|
pc: bn(receipt.pc),
|
@@ -39277,8 +38332,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39277
38332
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39278
38333
|
const transferOutReceipt = {
|
39279
38334
|
type: ReceiptType.TransferOut,
|
39280
|
-
from: hexOrZero(receipt.id
|
39281
|
-
to: hexOrZero(receipt.toAddress || receipt.to),
|
38335
|
+
from: hexOrZero(receipt.contract?.id),
|
38336
|
+
to: hexOrZero(receipt.toAddress || receipt.to?.id),
|
39282
38337
|
amount: bn(receipt.amount),
|
39283
38338
|
assetId: hexOrZero(receipt.assetId),
|
39284
38339
|
pc: bn(receipt.pc),
|
@@ -39321,7 +38376,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39321
38376
|
return receiptMessageOut;
|
39322
38377
|
}
|
39323
38378
|
case "MINT" /* Mint */: {
|
39324
|
-
const contractId = hexOrZero(receipt.id
|
38379
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39325
38380
|
const subId = hexOrZero(receipt.subId);
|
39326
38381
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39327
38382
|
const mintReceipt = {
|
@@ -39336,7 +38391,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39336
38391
|
return mintReceipt;
|
39337
38392
|
}
|
39338
38393
|
case "BURN" /* Burn */: {
|
39339
|
-
const contractId = hexOrZero(receipt.id
|
38394
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39340
38395
|
const subId = hexOrZero(receipt.subId);
|
39341
38396
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39342
38397
|
const burnReceipt = {
|
@@ -39417,6 +38472,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39417
38472
|
};
|
39418
38473
|
|
39419
38474
|
// src/providers/utils/gas.ts
|
38475
|
+
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39420
38476
|
var getGasUsedFromReceipts = (receipts) => {
|
39421
38477
|
const scriptResult = receipts.filter(
|
39422
38478
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39437,28 +38493,18 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39437
38493
|
}
|
39438
38494
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39439
38495
|
const witnessCache = [];
|
39440
|
-
const
|
39441
|
-
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39442
|
-
if (isCoinOrMessage) {
|
39443
|
-
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39444
|
-
return true;
|
39445
|
-
}
|
39446
|
-
if (!witnessCache.includes(input.witnessIndex)) {
|
39447
|
-
witnessCache.push(input.witnessIndex);
|
39448
|
-
return true;
|
39449
|
-
}
|
39450
|
-
}
|
39451
|
-
return false;
|
39452
|
-
});
|
39453
|
-
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39454
|
-
const totalGas = chargeableInputs.reduce((total, input) => {
|
38496
|
+
const totalGas = inputs.reduce((total, input) => {
|
39455
38497
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39456
38498
|
return total.add(
|
39457
|
-
|
38499
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39458
38500
|
);
|
39459
38501
|
}
|
39460
|
-
|
39461
|
-
|
38502
|
+
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
38503
|
+
witnessCache.push(input.witnessIndex);
|
38504
|
+
return total.add(gasCosts.ecr1);
|
38505
|
+
}
|
38506
|
+
return total;
|
38507
|
+
}, bn());
|
39462
38508
|
return totalGas;
|
39463
38509
|
}
|
39464
38510
|
function getMinGas(params) {
|
@@ -39470,20 +38516,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39470
38516
|
return minGas;
|
39471
38517
|
}
|
39472
38518
|
function getMaxGas(params) {
|
39473
|
-
const {
|
39474
|
-
gasPerByte,
|
39475
|
-
witnessesLength,
|
39476
|
-
witnessLimit,
|
39477
|
-
minGas,
|
39478
|
-
gasLimit = bn(0),
|
39479
|
-
maxGasPerTx
|
39480
|
-
} = params;
|
38519
|
+
const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
|
39481
38520
|
let remainingAllowedWitnessGas = bn(0);
|
39482
38521
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39483
38522
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39484
38523
|
}
|
39485
|
-
|
39486
|
-
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
38524
|
+
return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39487
38525
|
}
|
39488
38526
|
function calculateMetadataGasForTxCreate({
|
39489
38527
|
gasCosts,
|
@@ -39505,10 +38543,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39505
38543
|
}) {
|
39506
38544
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39507
38545
|
}
|
39508
|
-
var calculateGasFee = (params) => {
|
39509
|
-
const { gas, gasPrice, priceFactor, tip } = params;
|
39510
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39511
|
-
};
|
39512
38546
|
|
39513
38547
|
// src/providers/utils/json.ts
|
39514
38548
|
function normalize2(object) {
|
@@ -39650,7 +38684,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39650
38684
|
// src/providers/transaction-request/transaction-request.ts
|
39651
38685
|
var BaseTransactionRequest = class {
|
39652
38686
|
/** Gas price for transaction */
|
39653
|
-
|
38687
|
+
gasPrice;
|
39654
38688
|
/** Block until which tx cannot be included */
|
39655
38689
|
maturity;
|
39656
38690
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39669,7 +38703,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39669
38703
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39670
38704
|
*/
|
39671
38705
|
constructor({
|
39672
|
-
|
38706
|
+
gasPrice,
|
39673
38707
|
maturity,
|
39674
38708
|
maxFee,
|
39675
38709
|
witnessLimit,
|
@@ -39677,7 +38711,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39677
38711
|
outputs,
|
39678
38712
|
witnesses
|
39679
38713
|
} = {}) {
|
39680
|
-
this.
|
38714
|
+
this.gasPrice = bn(gasPrice);
|
39681
38715
|
this.maturity = maturity ?? 0;
|
39682
38716
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39683
38717
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39688,9 +38722,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39688
38722
|
static getPolicyMeta(req) {
|
39689
38723
|
let policyTypes = 0;
|
39690
38724
|
const policies = [];
|
39691
|
-
if (req.
|
39692
|
-
policyTypes += PolicyType.
|
39693
|
-
policies.push({ data: req.
|
38725
|
+
if (req.gasPrice) {
|
38726
|
+
policyTypes += PolicyType.GasPrice;
|
38727
|
+
policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
|
39694
38728
|
}
|
39695
38729
|
if (req.witnessLimit) {
|
39696
38730
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39874,11 +38908,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39874
38908
|
* assetId, if one it was not added yet.
|
39875
38909
|
*
|
39876
38910
|
* @param coin - Coin resource.
|
38911
|
+
* @param predicate - Predicate bytes.
|
38912
|
+
* @param predicateData - Predicate data bytes.
|
39877
38913
|
*/
|
39878
|
-
addCoinInput(coin) {
|
38914
|
+
addCoinInput(coin, predicate) {
|
39879
38915
|
const { assetId, owner, amount } = coin;
|
39880
38916
|
let witnessIndex;
|
39881
|
-
if (
|
38917
|
+
if (predicate) {
|
39882
38918
|
witnessIndex = 0;
|
39883
38919
|
} else {
|
39884
38920
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39893,7 +38929,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39893
38929
|
amount,
|
39894
38930
|
assetId,
|
39895
38931
|
txPointer: "0x00000000000000000000000000000000",
|
39896
|
-
witnessIndex
|
38932
|
+
witnessIndex,
|
38933
|
+
predicate: predicate?.bytes
|
39897
38934
|
};
|
39898
38935
|
this.pushInput(input);
|
39899
38936
|
this.addChangeOutput(owner, assetId);
|
@@ -39903,11 +38940,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39903
38940
|
* asset against the message
|
39904
38941
|
*
|
39905
38942
|
* @param message - Message resource.
|
38943
|
+
* @param predicate - Predicate bytes.
|
39906
38944
|
*/
|
39907
|
-
addMessageInput(message) {
|
38945
|
+
addMessageInput(message, predicate) {
|
39908
38946
|
const { recipient, sender, amount, assetId } = message;
|
39909
38947
|
let witnessIndex;
|
39910
|
-
if (
|
38948
|
+
if (predicate) {
|
39911
38949
|
witnessIndex = 0;
|
39912
38950
|
} else {
|
39913
38951
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39921,7 +38959,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39921
38959
|
sender: sender.toB256(),
|
39922
38960
|
recipient: recipient.toB256(),
|
39923
38961
|
amount,
|
39924
|
-
witnessIndex
|
38962
|
+
witnessIndex,
|
38963
|
+
predicate: predicate?.bytes
|
39925
38964
|
};
|
39926
38965
|
this.pushInput(input);
|
39927
38966
|
this.addChangeOutput(recipient, assetId);
|
@@ -39952,6 +38991,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39952
38991
|
resources.forEach((resource) => this.addResource(resource));
|
39953
38992
|
return this;
|
39954
38993
|
}
|
38994
|
+
/**
|
38995
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
38996
|
+
* outputs from the related assetIds.
|
38997
|
+
*
|
38998
|
+
* @param resources - The resources to add.
|
38999
|
+
* @returns This transaction.
|
39000
|
+
*/
|
39001
|
+
addPredicateResource(resource, predicate) {
|
39002
|
+
if (isCoin(resource)) {
|
39003
|
+
this.addCoinInput(resource, predicate);
|
39004
|
+
} else {
|
39005
|
+
this.addMessageInput(resource, predicate);
|
39006
|
+
}
|
39007
|
+
return this;
|
39008
|
+
}
|
39009
|
+
/**
|
39010
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
39011
|
+
* from the related assetIds.
|
39012
|
+
*
|
39013
|
+
* @param resources - The resources to add.
|
39014
|
+
* @returns This transaction.
|
39015
|
+
*/
|
39016
|
+
addPredicateResources(resources, predicate) {
|
39017
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
39018
|
+
return this;
|
39019
|
+
}
|
39955
39020
|
/**
|
39956
39021
|
* Adds a coin output to the transaction.
|
39957
39022
|
*
|
@@ -40031,7 +39096,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40031
39096
|
}
|
40032
39097
|
calculateMaxGas(chainInfo, minGas) {
|
40033
39098
|
const { consensusParameters } = chainInfo;
|
40034
|
-
const { gasPerByte
|
39099
|
+
const { gasPerByte } = consensusParameters;
|
40035
39100
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40036
39101
|
(acc, wit) => acc + wit.dataLength,
|
40037
39102
|
0
|
@@ -40040,8 +39105,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40040
39105
|
gasPerByte,
|
40041
39106
|
minGas,
|
40042
39107
|
witnessesLength,
|
40043
|
-
witnessLimit: this.witnessLimit
|
40044
|
-
maxGasPerTx
|
39108
|
+
witnessLimit: this.witnessLimit
|
40045
39109
|
});
|
40046
39110
|
}
|
40047
39111
|
/**
|
@@ -40060,20 +39124,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40060
39124
|
});
|
40061
39125
|
const updateAssetInput = (assetId, quantity) => {
|
40062
39126
|
const assetInput = findAssetInput(assetId);
|
40063
|
-
let usedQuantity = quantity;
|
40064
|
-
if (assetId === baseAssetId) {
|
40065
|
-
usedQuantity = bn("1000000000000000000");
|
40066
|
-
}
|
40067
39127
|
if (assetInput && "assetId" in assetInput) {
|
40068
39128
|
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
40069
|
-
assetInput.amount =
|
39129
|
+
assetInput.amount = quantity;
|
40070
39130
|
} else {
|
40071
39131
|
this.addResources([
|
40072
39132
|
{
|
40073
39133
|
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
40074
|
-
amount:
|
39134
|
+
amount: quantity,
|
40075
39135
|
assetId,
|
40076
39136
|
owner: resourcesOwner || Address.fromRandom(),
|
39137
|
+
maturity: 0,
|
40077
39138
|
blockCreated: bn(1),
|
40078
39139
|
txCreatedIdx: bn(1)
|
40079
39140
|
}
|
@@ -40105,7 +39166,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40105
39166
|
toJSON() {
|
40106
39167
|
return normalizeJSON(this);
|
40107
39168
|
}
|
40108
|
-
|
39169
|
+
updatePredicateInputs(inputs) {
|
40109
39170
|
this.inputs.forEach((i) => {
|
40110
39171
|
let correspondingInput;
|
40111
39172
|
switch (i.type) {
|
@@ -40127,15 +39188,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40127
39188
|
}
|
40128
39189
|
});
|
40129
39190
|
}
|
40130
|
-
shiftPredicateData() {
|
40131
|
-
this.inputs.forEach((input) => {
|
40132
|
-
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
40133
|
-
input.predicateData = input.padPredicateData(
|
40134
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40135
|
-
);
|
40136
|
-
}
|
40137
|
-
});
|
40138
|
-
}
|
40139
39191
|
};
|
40140
39192
|
|
40141
39193
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40264,8 +39316,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40264
39316
|
return {
|
40265
39317
|
type: TransactionType.Create,
|
40266
39318
|
...baseTransaction,
|
39319
|
+
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40267
39320
|
bytecodeWitnessIndex,
|
40268
|
-
storageSlotsCount:
|
39321
|
+
storageSlotsCount: storageSlots.length,
|
40269
39322
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40270
39323
|
storageSlots
|
40271
39324
|
};
|
@@ -40379,8 +39432,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40379
39432
|
type: TransactionType.Script,
|
40380
39433
|
scriptGasLimit: this.gasLimit,
|
40381
39434
|
...super.getBaseTransaction(),
|
40382
|
-
scriptLength:
|
40383
|
-
scriptDataLength:
|
39435
|
+
scriptLength: script.length,
|
39436
|
+
scriptDataLength: scriptData.length,
|
40384
39437
|
receiptsRoot: ZeroBytes32,
|
40385
39438
|
script: hexlify(script),
|
40386
39439
|
scriptData: hexlify(scriptData)
|
@@ -40444,7 +39497,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40444
39497
|
}
|
40445
39498
|
calculateMaxGas(chainInfo, minGas) {
|
40446
39499
|
const { consensusParameters } = chainInfo;
|
40447
|
-
const { gasPerByte
|
39500
|
+
const { gasPerByte } = consensusParameters;
|
40448
39501
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40449
39502
|
(acc, wit) => acc + wit.dataLength,
|
40450
39503
|
0
|
@@ -40454,8 +39507,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40454
39507
|
minGas,
|
40455
39508
|
witnessesLength,
|
40456
39509
|
witnessLimit: this.witnessLimit,
|
40457
|
-
gasLimit: this.gasLimit
|
40458
|
-
maxGasPerTx
|
39510
|
+
gasLimit: this.gasLimit
|
40459
39511
|
});
|
40460
39512
|
}
|
40461
39513
|
/**
|
@@ -40528,29 +39580,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40528
39580
|
}
|
40529
39581
|
}
|
40530
39582
|
};
|
40531
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40532
|
-
(acc, input) => {
|
40533
|
-
if (input.type === InputType.Coin && input.owner === owner) {
|
40534
|
-
acc.utxos.push(input.id);
|
40535
|
-
}
|
40536
|
-
if (input.type === InputType.Message && input.recipient === owner) {
|
40537
|
-
acc.messages.push(input.nonce);
|
40538
|
-
}
|
40539
|
-
return acc;
|
40540
|
-
},
|
40541
|
-
{
|
40542
|
-
utxos: [],
|
40543
|
-
messages: []
|
40544
|
-
}
|
40545
|
-
);
|
40546
39583
|
|
40547
39584
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40548
39585
|
var calculateTransactionFee = (params) => {
|
40549
39586
|
const {
|
40550
|
-
|
39587
|
+
gasUsed,
|
40551
39588
|
rawPayload,
|
40552
|
-
|
40553
|
-
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
39589
|
+
consensusParameters: { gasCosts, feeParams }
|
40554
39590
|
} = params;
|
40555
39591
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40556
39592
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40560,7 +39596,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40560
39596
|
return {
|
40561
39597
|
fee: bn(0),
|
40562
39598
|
minFee: bn(0),
|
40563
|
-
maxFee: bn(0)
|
39599
|
+
maxFee: bn(0),
|
39600
|
+
feeFromGasUsed: bn(0)
|
40564
39601
|
};
|
40565
39602
|
}
|
40566
39603
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40592,6 +39629,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40592
39629
|
metadataGas,
|
40593
39630
|
txBytesSize: transactionBytes.length
|
40594
39631
|
});
|
39632
|
+
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40595
39633
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40596
39634
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40597
39635
|
const maxGas = getMaxGas({
|
@@ -40599,25 +39637,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40599
39637
|
minGas,
|
40600
39638
|
witnessesLength,
|
40601
39639
|
gasLimit,
|
40602
|
-
witnessLimit
|
40603
|
-
maxGasPerTx
|
40604
|
-
});
|
40605
|
-
const minFee = calculateGasFee({
|
40606
|
-
gasPrice,
|
40607
|
-
gas: minGas,
|
40608
|
-
priceFactor: gasPriceFactor,
|
40609
|
-
tip
|
40610
|
-
});
|
40611
|
-
const maxFee = calculateGasFee({
|
40612
|
-
gasPrice,
|
40613
|
-
gas: maxGas,
|
40614
|
-
priceFactor: gasPriceFactor,
|
40615
|
-
tip
|
39640
|
+
witnessLimit
|
40616
39641
|
});
|
39642
|
+
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
39643
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
39644
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
39645
|
+
const fee = minFee.add(feeFromGasUsed);
|
40617
39646
|
return {
|
39647
|
+
fee,
|
40618
39648
|
minFee,
|
40619
39649
|
maxFee,
|
40620
|
-
|
39650
|
+
feeFromGasUsed
|
40621
39651
|
};
|
40622
39652
|
};
|
40623
39653
|
|
@@ -41218,9 +40248,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41218
40248
|
gqlTransactionStatus,
|
41219
40249
|
abiMap = {},
|
41220
40250
|
maxInputs,
|
41221
|
-
gasCosts
|
41222
|
-
maxGasPerTx,
|
41223
|
-
gasPrice
|
40251
|
+
gasCosts
|
41224
40252
|
} = params;
|
41225
40253
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41226
40254
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41234,14 +40262,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41234
40262
|
maxInputs
|
41235
40263
|
});
|
41236
40264
|
const typeName = getTransactionTypeName(transaction.type);
|
41237
|
-
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41238
40265
|
const { fee } = calculateTransactionFee({
|
41239
|
-
|
40266
|
+
gasUsed,
|
41240
40267
|
rawPayload,
|
41241
|
-
tip,
|
41242
40268
|
consensusParameters: {
|
41243
40269
|
gasCosts,
|
41244
|
-
maxGasPerTx,
|
41245
40270
|
feeParams: {
|
41246
40271
|
gasPerByte,
|
41247
40272
|
gasPriceFactor
|
@@ -41293,7 +40318,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41293
40318
|
}
|
41294
40319
|
|
41295
40320
|
// src/providers/transaction-response/transaction-response.ts
|
41296
|
-
var
|
40321
|
+
var TransactionResponse = class {
|
41297
40322
|
/** Transaction ID */
|
41298
40323
|
id;
|
41299
40324
|
/** Current provider */
|
@@ -41323,7 +40348,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41323
40348
|
* @param provider - The provider.
|
41324
40349
|
*/
|
41325
40350
|
static async create(id, provider, abis) {
|
41326
|
-
const response = new
|
40351
|
+
const response = new TransactionResponse(id, provider, abis);
|
41327
40352
|
await response.fetch();
|
41328
40353
|
return response;
|
41329
40354
|
}
|
@@ -41377,13 +40402,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41377
40402
|
const decodedTransaction = this.decodeTransaction(
|
41378
40403
|
transaction
|
41379
40404
|
);
|
41380
|
-
|
41381
|
-
|
41382
|
-
txReceipts = transaction.status.receipts;
|
41383
|
-
}
|
41384
|
-
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41385
|
-
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41386
|
-
const gasPrice = await this.provider.getLatestGasPrice();
|
40405
|
+
const receipts = transaction.receipts?.map(processGqlReceipt) || [];
|
40406
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
|
41387
40407
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41388
40408
|
const transactionSummary = assembleTransactionSummary({
|
41389
40409
|
id: this.id,
|
@@ -41395,9 +40415,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41395
40415
|
gasPriceFactor,
|
41396
40416
|
abiMap: contractsAbiMap,
|
41397
40417
|
maxInputs,
|
41398
|
-
gasCosts
|
41399
|
-
maxGasPerTx,
|
41400
|
-
gasPrice
|
40418
|
+
gasCosts
|
41401
40419
|
});
|
41402
40420
|
return transactionSummary;
|
41403
40421
|
}
|
@@ -41546,7 +40564,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41546
40564
|
gasCosts,
|
41547
40565
|
latestBlock: {
|
41548
40566
|
id: latestBlock.id,
|
41549
|
-
height: bn(latestBlock.height),
|
40567
|
+
height: bn(latestBlock.header.height),
|
41550
40568
|
time: latestBlock.header.time,
|
41551
40569
|
transactions: latestBlock.transactions.map((i) => ({
|
41552
40570
|
id: i.id
|
@@ -41640,8 +40658,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41640
40658
|
* Returns some helpful parameters related to gas fees.
|
41641
40659
|
*/
|
41642
40660
|
getGasConfig() {
|
40661
|
+
const { minGasPrice } = this.getNode();
|
41643
40662
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41644
40663
|
return {
|
40664
|
+
minGasPrice,
|
41645
40665
|
maxGasPerTx,
|
41646
40666
|
maxGasPerPredicate,
|
41647
40667
|
gasPriceFactor,
|
@@ -41717,21 +40737,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41717
40737
|
} = await this.operations.getVersion();
|
41718
40738
|
return nodeVersion;
|
41719
40739
|
}
|
41720
|
-
/**
|
41721
|
-
* @hidden
|
41722
|
-
*
|
41723
|
-
* Returns the network configuration of the connected Fuel node.
|
41724
|
-
*
|
41725
|
-
* @returns A promise that resolves to the network configuration object
|
41726
|
-
*/
|
41727
|
-
async getNetwork() {
|
41728
|
-
const {
|
41729
|
-
name,
|
41730
|
-
consensusParameters: { chainId }
|
41731
|
-
} = await this.getChain();
|
41732
|
-
const network = new Network(name, chainId.toNumber());
|
41733
|
-
return Promise.resolve(network);
|
41734
|
-
}
|
41735
40740
|
/**
|
41736
40741
|
* Returns the block number.
|
41737
40742
|
*
|
@@ -41739,7 +40744,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41739
40744
|
*/
|
41740
40745
|
async getBlockNumber() {
|
41741
40746
|
const { chain } = await this.operations.getChain();
|
41742
|
-
return bn(chain.latestBlock.height, 10);
|
40747
|
+
return bn(chain.latestBlock.header.height, 10);
|
41743
40748
|
}
|
41744
40749
|
/**
|
41745
40750
|
* Returns the chain information.
|
@@ -41751,9 +40756,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41751
40756
|
const processedNodeInfo = {
|
41752
40757
|
maxDepth: bn(nodeInfo.maxDepth),
|
41753
40758
|
maxTx: bn(nodeInfo.maxTx),
|
40759
|
+
minGasPrice: bn(nodeInfo.minGasPrice),
|
41754
40760
|
nodeVersion: nodeInfo.nodeVersion,
|
41755
40761
|
utxoValidation: nodeInfo.utxoValidation,
|
41756
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
40762
|
+
vmBacktrace: nodeInfo.vmBacktrace,
|
40763
|
+
peers: nodeInfo.peers
|
41757
40764
|
};
|
41758
40765
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41759
40766
|
return processedNodeInfo;
|
@@ -41825,14 +40832,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41825
40832
|
}
|
41826
40833
|
}
|
41827
40834
|
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
41828
|
-
const response = new
|
40835
|
+
const response = new TransactionResponse(transactionId2, this, abis);
|
41829
40836
|
await response.fetch();
|
41830
40837
|
return response;
|
41831
40838
|
}
|
41832
40839
|
const {
|
41833
40840
|
submit: { id: transactionId }
|
41834
40841
|
} = await this.operations.submit({ encodedTransaction });
|
41835
|
-
return new
|
40842
|
+
return new TransactionResponse(transactionId, this, abis);
|
41836
40843
|
}
|
41837
40844
|
/**
|
41838
40845
|
* Executes a transaction without actually submitting it to the chain.
|
@@ -41850,13 +40857,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41850
40857
|
return this.estimateTxDependencies(transactionRequest);
|
41851
40858
|
}
|
41852
40859
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41853
|
-
const { dryRun:
|
41854
|
-
|
40860
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
40861
|
+
encodedTransaction,
|
41855
40862
|
utxoValidation: utxoValidation || false
|
41856
40863
|
});
|
41857
|
-
const
|
41858
|
-
|
41859
|
-
|
40864
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
40865
|
+
return {
|
40866
|
+
receipts
|
40867
|
+
};
|
41860
40868
|
}
|
41861
40869
|
/**
|
41862
40870
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41895,6 +40903,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41895
40903
|
* If there are missing variable outputs,
|
41896
40904
|
* `addVariableOutputs` is called on the transaction.
|
41897
40905
|
*
|
40906
|
+
* @privateRemarks
|
40907
|
+
* TODO: Investigate support for missing contract IDs
|
40908
|
+
* TODO: Add support for missing output messages
|
41898
40909
|
*
|
41899
40910
|
* @param transactionRequest - The transaction request object.
|
41900
40911
|
* @returns A promise.
|
@@ -41907,19 +40918,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41907
40918
|
missingContractIds: []
|
41908
40919
|
};
|
41909
40920
|
}
|
40921
|
+
await this.estimatePredicates(transactionRequest);
|
41910
40922
|
let receipts = [];
|
41911
40923
|
const missingContractIds = [];
|
41912
40924
|
let outputVariables = 0;
|
41913
|
-
let dryrunStatus;
|
41914
40925
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41915
|
-
const {
|
41916
|
-
|
41917
|
-
} = await this.operations.dryRun({
|
41918
|
-
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
40926
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
40927
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
41919
40928
|
utxoValidation: false
|
41920
40929
|
});
|
41921
|
-
receipts =
|
41922
|
-
dryrunStatus = status;
|
40930
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
41923
40931
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41924
40932
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41925
40933
|
if (hasMissingOutputs) {
|
@@ -41929,10 +40937,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41929
40937
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41930
40938
|
missingContractIds.push(contractId);
|
41931
40939
|
});
|
41932
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41933
|
-
transactionRequest
|
41934
|
-
});
|
41935
|
-
transactionRequest.maxFee = maxFee;
|
41936
40940
|
} else {
|
41937
40941
|
break;
|
41938
40942
|
}
|
@@ -41940,136 +40944,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41940
40944
|
return {
|
41941
40945
|
receipts,
|
41942
40946
|
outputVariables,
|
41943
|
-
missingContractIds
|
41944
|
-
dryrunStatus
|
40947
|
+
missingContractIds
|
41945
40948
|
};
|
41946
40949
|
}
|
41947
|
-
/**
|
41948
|
-
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41949
|
-
*
|
41950
|
-
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41951
|
-
* further modifications are identified. The method iteratively updates these transactions
|
41952
|
-
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41953
|
-
*
|
41954
|
-
* @param transactionRequests - Array of transaction request objects.
|
41955
|
-
* @returns A promise that resolves to an array of results for each transaction.
|
41956
|
-
*/
|
41957
|
-
async estimateMultipleTxDependencies(transactionRequests) {
|
41958
|
-
const results = transactionRequests.map(() => ({
|
41959
|
-
receipts: [],
|
41960
|
-
outputVariables: 0,
|
41961
|
-
missingContractIds: [],
|
41962
|
-
dryrunStatus: void 0
|
41963
|
-
}));
|
41964
|
-
const allRequests = clone_default(transactionRequests);
|
41965
|
-
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41966
|
-
allRequests.forEach((req, index) => {
|
41967
|
-
if (req.type === TransactionType.Script) {
|
41968
|
-
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41969
|
-
}
|
41970
|
-
});
|
41971
|
-
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41972
|
-
let attempt = 0;
|
41973
|
-
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41974
|
-
const encodedTransactions = transactionsToProcess.map(
|
41975
|
-
(index) => serializedTransactionsMap.get(index)
|
41976
|
-
);
|
41977
|
-
const dryRunResults = await this.operations.dryRun({
|
41978
|
-
encodedTransactions,
|
41979
|
-
utxoValidation: false
|
41980
|
-
});
|
41981
|
-
const nextRoundTransactions = [];
|
41982
|
-
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41983
|
-
const requestIdx = transactionsToProcess[i];
|
41984
|
-
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41985
|
-
const result = results[requestIdx];
|
41986
|
-
result.receipts = rawReceipts.map(processGqlReceipt);
|
41987
|
-
result.dryrunStatus = status;
|
41988
|
-
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41989
|
-
result.receipts
|
41990
|
-
);
|
41991
|
-
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41992
|
-
const request = allRequests[requestIdx];
|
41993
|
-
if (hasMissingOutputs && request?.type === TransactionType.Script) {
|
41994
|
-
result.outputVariables += missingOutputVariables.length;
|
41995
|
-
request.addVariableOutputs(missingOutputVariables.length);
|
41996
|
-
missingOutputContractIds.forEach(({ contractId }) => {
|
41997
|
-
request.addContractInputAndOutput(Address.fromString(contractId));
|
41998
|
-
result.missingContractIds.push(contractId);
|
41999
|
-
});
|
42000
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
42001
|
-
transactionRequest: request
|
42002
|
-
});
|
42003
|
-
request.maxFee = maxFee;
|
42004
|
-
serializedTransactionsMap.set(requestIdx, hexlify(request.toTransactionBytes()));
|
42005
|
-
nextRoundTransactions.push(requestIdx);
|
42006
|
-
}
|
42007
|
-
}
|
42008
|
-
transactionsToProcess = nextRoundTransactions;
|
42009
|
-
attempt += 1;
|
42010
|
-
}
|
42011
|
-
return results;
|
42012
|
-
}
|
42013
|
-
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
42014
|
-
if (estimateTxDependencies) {
|
42015
|
-
return this.estimateMultipleTxDependencies(transactionRequests);
|
42016
|
-
}
|
42017
|
-
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
42018
|
-
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42019
|
-
encodedTransactions,
|
42020
|
-
utxoValidation: utxoValidation || false
|
42021
|
-
});
|
42022
|
-
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
42023
|
-
const receipts = rawReceipts.map(processGqlReceipt);
|
42024
|
-
return { receipts, dryrunStatus: status };
|
42025
|
-
});
|
42026
|
-
return results;
|
42027
|
-
}
|
42028
40950
|
/**
|
42029
40951
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
42030
40952
|
* @param transactionRequest - The transaction request object.
|
42031
40953
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
42032
40954
|
*/
|
42033
|
-
|
40955
|
+
estimateTxGasAndFee(params) {
|
42034
40956
|
const { transactionRequest } = params;
|
42035
|
-
|
40957
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
42036
40958
|
const chainInfo = this.getChain();
|
42037
|
-
const
|
40959
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
40960
|
+
transactionRequest.gasPrice = gasPrice;
|
42038
40961
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
42039
|
-
|
42040
|
-
gasPrice = await this.estimateGasPrice(10);
|
42041
|
-
}
|
42042
|
-
const minFee = calculateGasFee({
|
42043
|
-
gasPrice: bn(gasPrice),
|
42044
|
-
gas: minGas,
|
42045
|
-
priceFactor: gasPriceFactor,
|
42046
|
-
tip: transactionRequest.tip
|
42047
|
-
}).add(1);
|
42048
|
-
let gasLimit = bn(0);
|
40962
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42049
40963
|
if (transactionRequest.type === TransactionType.Script) {
|
42050
|
-
gasLimit = transactionRequest.gasLimit;
|
42051
40964
|
if (transactionRequest.gasLimit.eq(0)) {
|
42052
40965
|
transactionRequest.gasLimit = minGas;
|
42053
40966
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
42054
40967
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
42055
40968
|
);
|
42056
|
-
gasLimit = transactionRequest.gasLimit;
|
42057
40969
|
}
|
42058
40970
|
}
|
42059
40971
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42060
|
-
const maxFee =
|
42061
|
-
gasPrice: bn(gasPrice),
|
42062
|
-
gas: maxGas,
|
42063
|
-
priceFactor: gasPriceFactor,
|
42064
|
-
tip: transactionRequest.tip
|
42065
|
-
}).add(1);
|
40972
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42066
40973
|
return {
|
42067
40974
|
minGas,
|
42068
40975
|
minFee,
|
42069
40976
|
maxGas,
|
42070
|
-
maxFee
|
42071
|
-
gasPrice,
|
42072
|
-
gasLimit
|
40977
|
+
maxFee
|
42073
40978
|
};
|
42074
40979
|
}
|
42075
40980
|
/**
|
@@ -42087,17 +40992,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42087
40992
|
if (estimateTxDependencies) {
|
42088
40993
|
return this.estimateTxDependencies(transactionRequest);
|
42089
40994
|
}
|
42090
|
-
const
|
42091
|
-
const { dryRun:
|
42092
|
-
|
40995
|
+
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
40996
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
40997
|
+
encodedTransaction,
|
42093
40998
|
utxoValidation: true
|
42094
40999
|
});
|
42095
|
-
const
|
42096
|
-
|
42097
|
-
|
42098
|
-
|
42099
|
-
});
|
42100
|
-
return { receipts: callResult[0].receipts };
|
41000
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41001
|
+
return {
|
41002
|
+
receipts
|
41003
|
+
};
|
42101
41004
|
}
|
42102
41005
|
/**
|
42103
41006
|
* Returns a transaction cost to enable user
|
@@ -42114,80 +41017,78 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42114
41017
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
42115
41018
|
* @returns A promise that resolves to the transaction cost object.
|
42116
41019
|
*/
|
42117
|
-
async getTransactionCost(transactionRequestLike,
|
41020
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
41021
|
+
estimateTxDependencies = true,
|
41022
|
+
estimatePredicates = true,
|
41023
|
+
resourcesOwner,
|
41024
|
+
signatureCallback
|
41025
|
+
} = {}) {
|
42118
41026
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41027
|
+
const { minGasPrice } = this.getGasConfig();
|
41028
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
42119
41029
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
42120
41030
|
const baseAssetId = this.getBaseAssetId();
|
42121
41031
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
42122
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
41032
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42123
41033
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
42124
|
-
txRequestClone.maxFee = bn(0);
|
42125
41034
|
if (isScriptTransaction) {
|
42126
41035
|
txRequestClone.gasLimit = bn(0);
|
42127
41036
|
}
|
42128
|
-
if (
|
42129
|
-
resourcesOwner
|
41037
|
+
if (estimatePredicates) {
|
41038
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41039
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41040
|
+
}
|
41041
|
+
await this.estimatePredicates(txRequestClone);
|
42130
41042
|
}
|
42131
|
-
const signedRequest = clone_default(txRequestClone);
|
42132
|
-
let addedSignatures = 0;
|
42133
41043
|
if (signatureCallback && isScriptTransaction) {
|
42134
|
-
|
42135
|
-
await signatureCallback(signedRequest);
|
42136
|
-
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41044
|
+
await signatureCallback(txRequestClone);
|
42137
41045
|
}
|
42138
|
-
|
42139
|
-
|
42140
|
-
transactionRequest: signedRequest
|
41046
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41047
|
+
transactionRequest: txRequestClone
|
42141
41048
|
});
|
42142
41049
|
let receipts = [];
|
42143
41050
|
let missingContractIds = [];
|
42144
41051
|
let outputVariables = 0;
|
42145
41052
|
let gasUsed = bn(0);
|
42146
|
-
|
42147
|
-
|
42148
|
-
if (isScriptTransaction) {
|
42149
|
-
txRequestClone.gasLimit = gasLimit;
|
42150
|
-
if (signatureCallback) {
|
42151
|
-
await signatureCallback(txRequestClone);
|
42152
|
-
}
|
41053
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
41054
|
+
txRequestClone.gasPrice = bn(0);
|
42153
41055
|
const result = await this.estimateTxDependencies(txRequestClone);
|
42154
41056
|
receipts = result.receipts;
|
42155
41057
|
outputVariables = result.outputVariables;
|
42156
41058
|
missingContractIds = result.missingContractIds;
|
42157
41059
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
42158
41060
|
txRequestClone.gasLimit = gasUsed;
|
42159
|
-
|
42160
|
-
|
42161
|
-
|
41061
|
+
txRequestClone.gasPrice = setGasPrice;
|
41062
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41063
|
+
transactionRequest: txRequestClone
|
42162
41064
|
}));
|
42163
41065
|
}
|
42164
41066
|
return {
|
42165
41067
|
requiredQuantities: allQuantities,
|
42166
41068
|
receipts,
|
42167
41069
|
gasUsed,
|
42168
|
-
|
41070
|
+
minGasPrice,
|
41071
|
+
gasPrice: setGasPrice,
|
42169
41072
|
minGas,
|
42170
41073
|
maxGas,
|
42171
41074
|
minFee,
|
42172
41075
|
maxFee,
|
41076
|
+
estimatedInputs: txRequestClone.inputs,
|
42173
41077
|
outputVariables,
|
42174
|
-
missingContractIds
|
42175
|
-
addedSignatures,
|
42176
|
-
estimatedPredicates: txRequestClone.inputs
|
41078
|
+
missingContractIds
|
42177
41079
|
};
|
42178
41080
|
}
|
42179
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
41081
|
+
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
42180
41082
|
const ownerAddress = Address.fromAddressOrString(owner);
|
42181
41083
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
42182
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42183
|
-
quantitiesToContract
|
42184
|
-
});
|
41084
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
|
42185
41085
|
transactionRequest.addResources(
|
42186
41086
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
42187
41087
|
);
|
42188
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
42189
|
-
|
42190
|
-
|
41088
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41089
|
+
transactionRequest,
|
41090
|
+
forwardingQuantities
|
41091
|
+
);
|
42191
41092
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
42192
41093
|
return {
|
42193
41094
|
resources,
|
@@ -42211,6 +41112,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42211
41112
|
assetId: coin.assetId,
|
42212
41113
|
amount: bn(coin.amount),
|
42213
41114
|
owner: Address.fromAddressOrString(coin.owner),
|
41115
|
+
maturity: bn(coin.maturity).toNumber(),
|
42214
41116
|
blockCreated: bn(coin.blockCreated),
|
42215
41117
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42216
41118
|
}));
|
@@ -42262,6 +41164,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42262
41164
|
amount: bn(coin.amount),
|
42263
41165
|
assetId: coin.assetId,
|
42264
41166
|
owner: Address.fromAddressOrString(coin.owner),
|
41167
|
+
maturity: bn(coin.maturity).toNumber(),
|
42265
41168
|
blockCreated: bn(coin.blockCreated),
|
42266
41169
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42267
41170
|
};
|
@@ -42294,7 +41197,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42294
41197
|
}
|
42295
41198
|
return {
|
42296
41199
|
id: block2.id,
|
42297
|
-
height: bn(block2.height),
|
41200
|
+
height: bn(block2.header.height),
|
42298
41201
|
time: block2.header.time,
|
42299
41202
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42300
41203
|
};
|
@@ -42309,7 +41212,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42309
41212
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42310
41213
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42311
41214
|
id: block2.id,
|
42312
|
-
height: bn(block2.height),
|
41215
|
+
height: bn(block2.header.height),
|
42313
41216
|
time: block2.header.time,
|
42314
41217
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42315
41218
|
}));
|
@@ -42336,7 +41239,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42336
41239
|
}
|
42337
41240
|
return {
|
42338
41241
|
id: block2.id,
|
42339
|
-
height: bn(block2.height, 10),
|
41242
|
+
height: bn(block2.header.height, 10),
|
42340
41243
|
time: block2.header.time,
|
42341
41244
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42342
41245
|
transactions: block2.transactions.map(
|
@@ -42516,11 +41419,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42516
41419
|
prevRoot: messageBlockHeader.prevRoot,
|
42517
41420
|
time: messageBlockHeader.time,
|
42518
41421
|
applicationHash: messageBlockHeader.applicationHash,
|
42519
|
-
|
42520
|
-
|
42521
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42522
|
-
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42523
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
41422
|
+
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
41423
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
|
42524
41424
|
},
|
42525
41425
|
commitBlockHeader: {
|
42526
41426
|
id: commitBlockHeader.id,
|
@@ -42531,11 +41431,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42531
41431
|
prevRoot: commitBlockHeader.prevRoot,
|
42532
41432
|
time: commitBlockHeader.time,
|
42533
41433
|
applicationHash: commitBlockHeader.applicationHash,
|
42534
|
-
|
42535
|
-
|
42536
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42537
|
-
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42538
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
41434
|
+
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
41435
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
|
42539
41436
|
},
|
42540
41437
|
sender: Address.fromAddressOrString(sender),
|
42541
41438
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -42544,16 +41441,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42544
41441
|
data
|
42545
41442
|
};
|
42546
41443
|
}
|
42547
|
-
async getLatestGasPrice() {
|
42548
|
-
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42549
|
-
return bn(latestGasPrice.gasPrice);
|
42550
|
-
}
|
42551
|
-
async estimateGasPrice(blockHorizon) {
|
42552
|
-
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42553
|
-
blockHorizon: String(blockHorizon)
|
42554
|
-
});
|
42555
|
-
return bn(estimateGasPrice.gasPrice);
|
42556
|
-
}
|
42557
41444
|
/**
|
42558
41445
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42559
41446
|
*
|
@@ -42580,7 +41467,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42580
41467
|
}
|
42581
41468
|
// eslint-disable-next-line @typescript-eslint/require-await
|
42582
41469
|
async getTransactionResponse(transactionId) {
|
42583
|
-
return new
|
41470
|
+
return new TransactionResponse(transactionId, this);
|
42584
41471
|
}
|
42585
41472
|
};
|
42586
41473
|
var Provider = _Provider;
|
@@ -42614,15 +41501,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42614
41501
|
arrayify(gqlTransaction.rawPayload),
|
42615
41502
|
0
|
42616
41503
|
);
|
42617
|
-
|
42618
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42619
|
-
txReceipts = gqlTransaction.status.receipts;
|
42620
|
-
}
|
42621
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
41504
|
+
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
42622
41505
|
const {
|
42623
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
41506
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42624
41507
|
} = provider.getChain();
|
42625
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42626
41508
|
const transactionInfo = assembleTransactionSummary({
|
42627
41509
|
id: gqlTransaction.id,
|
42628
41510
|
receipts,
|
@@ -42633,9 +41515,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42633
41515
|
gasPriceFactor: bn(gasPriceFactor),
|
42634
41516
|
abiMap,
|
42635
41517
|
maxInputs,
|
42636
|
-
gasCosts
|
42637
|
-
maxGasPerTx,
|
42638
|
-
gasPrice
|
41518
|
+
gasCosts
|
42639
41519
|
});
|
42640
41520
|
return {
|
42641
41521
|
gqlTransaction,
|
@@ -42645,11 +41525,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42645
41525
|
async function getTransactionSummaryFromRequest(params) {
|
42646
41526
|
const { provider, transactionRequest, abiMap } = params;
|
42647
41527
|
const { receipts } = await provider.call(transactionRequest);
|
42648
|
-
const { gasPerByte, gasPriceFactor, gasCosts
|
41528
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42649
41529
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42650
41530
|
const transaction = transactionRequest.toTransaction();
|
42651
41531
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42652
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42653
41532
|
const transactionSummary = assembleTransactionSummary({
|
42654
41533
|
receipts,
|
42655
41534
|
transaction,
|
@@ -42658,9 +41537,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42658
41537
|
gasPerByte,
|
42659
41538
|
gasPriceFactor,
|
42660
41539
|
maxInputs,
|
42661
|
-
gasCosts
|
42662
|
-
maxGasPerTx,
|
42663
|
-
gasPrice
|
41540
|
+
gasCosts
|
42664
41541
|
});
|
42665
41542
|
return transactionSummary;
|
42666
41543
|
}
|
@@ -42669,18 +41546,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42669
41546
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42670
41547
|
const { edges, pageInfo } = transactionsByOwner;
|
42671
41548
|
const {
|
42672
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
41549
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42673
41550
|
} = provider.getChain();
|
42674
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42675
41551
|
const transactions = edges.map((edge) => {
|
42676
41552
|
const { node: gqlTransaction } = edge;
|
42677
|
-
const { id, rawPayload, status } = gqlTransaction;
|
41553
|
+
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
42678
41554
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42679
|
-
|
42680
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42681
|
-
txReceipts = gqlTransaction.status.receipts;
|
42682
|
-
}
|
42683
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
41555
|
+
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
42684
41556
|
const transactionSummary = assembleTransactionSummary({
|
42685
41557
|
id,
|
42686
41558
|
receipts,
|
@@ -42691,9 +41563,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42691
41563
|
gasPerByte,
|
42692
41564
|
gasPriceFactor,
|
42693
41565
|
maxInputs,
|
42694
|
-
gasCosts
|
42695
|
-
maxGasPerTx,
|
42696
|
-
gasPrice
|
41566
|
+
gasCosts
|
42697
41567
|
});
|
42698
41568
|
const output3 = {
|
42699
41569
|
gqlTransaction,
|
@@ -43023,31 +41893,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43023
41893
|
* @param fee - The estimated transaction fee.
|
43024
41894
|
* @returns A promise that resolves when the resources are added to the transaction.
|
43025
41895
|
*/
|
43026
|
-
async fund(request,
|
43027
|
-
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
41896
|
+
async fund(request, coinQuantities, fee) {
|
43028
41897
|
const baseAssetId = this.provider.getBaseAssetId();
|
43029
|
-
const
|
43030
|
-
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
41898
|
+
const updatedQuantities = addAmountToAsset({
|
43031
41899
|
amount: bn(fee),
|
43032
41900
|
assetId: baseAssetId,
|
43033
|
-
coinQuantities
|
41901
|
+
coinQuantities
|
43034
41902
|
});
|
43035
41903
|
const quantitiesDict = {};
|
43036
|
-
|
41904
|
+
updatedQuantities.forEach(({ amount, assetId }) => {
|
43037
41905
|
quantitiesDict[assetId] = {
|
43038
41906
|
required: amount,
|
43039
41907
|
owned: bn(0)
|
43040
41908
|
};
|
43041
41909
|
});
|
43042
|
-
|
41910
|
+
const cachedUtxos = [];
|
41911
|
+
const cachedMessages = [];
|
41912
|
+
const owner = this.address.toB256();
|
41913
|
+
request.inputs.forEach((input) => {
|
43043
41914
|
const isResource = "amount" in input;
|
43044
|
-
if (
|
43045
|
-
|
43046
|
-
|
43047
|
-
|
43048
|
-
|
43049
|
-
|
43050
|
-
|
41915
|
+
if (isResource) {
|
41916
|
+
const isCoin2 = "owner" in input;
|
41917
|
+
if (isCoin2) {
|
41918
|
+
const assetId = String(input.assetId);
|
41919
|
+
if (input.owner === owner && quantitiesDict[assetId]) {
|
41920
|
+
const amount = bn(input.amount);
|
41921
|
+
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
41922
|
+
cachedUtxos.push(input.id);
|
41923
|
+
}
|
41924
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
|
41925
|
+
quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
|
41926
|
+
cachedMessages.push(input.nonce);
|
41927
|
+
}
|
43051
41928
|
}
|
43052
41929
|
});
|
43053
41930
|
const missingQuantities = [];
|
@@ -43061,21 +41938,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43061
41938
|
});
|
43062
41939
|
const needsToBeFunded = missingQuantities.length;
|
43063
41940
|
if (needsToBeFunded) {
|
43064
|
-
const
|
43065
|
-
|
43066
|
-
|
43067
|
-
|
43068
|
-
|
43069
|
-
|
43070
|
-
const requestToReestimate = clone_default(txRequest);
|
43071
|
-
if (addedSignatures) {
|
43072
|
-
Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
|
43073
|
-
}
|
43074
|
-
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43075
|
-
transactionRequest: requestToReestimate
|
43076
|
-
});
|
43077
|
-
txRequest.maxFee = maxFee;
|
43078
|
-
return txRequest;
|
41941
|
+
const resources = await this.getResourcesToSpend(missingQuantities, {
|
41942
|
+
messages: cachedMessages,
|
41943
|
+
utxos: cachedUtxos
|
41944
|
+
});
|
41945
|
+
request.addResources(resources);
|
41946
|
+
}
|
43079
41947
|
}
|
43080
41948
|
/**
|
43081
41949
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -43083,25 +41951,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43083
41951
|
* @param destination - The address of the destination.
|
43084
41952
|
* @param amount - The amount of coins to transfer.
|
43085
41953
|
* @param assetId - The asset ID of the coins to transfer.
|
43086
|
-
* @param txParams - The transaction parameters (gasLimit,
|
41954
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
43087
41955
|
* @returns A promise that resolves to the prepared transaction request.
|
43088
41956
|
*/
|
43089
41957
|
async createTransfer(destination, amount, assetId, txParams = {}) {
|
43090
|
-
const
|
41958
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
43091
41959
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
41960
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
41961
|
+
const request = new ScriptTransactionRequest(params);
|
43092
41962
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
|
43093
|
-
const
|
41963
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43094
41964
|
estimateTxDependencies: true,
|
43095
41965
|
resourcesOwner: this
|
43096
41966
|
});
|
43097
|
-
|
43098
|
-
|
43099
|
-
|
43100
|
-
|
41967
|
+
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
41968
|
+
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
41969
|
+
this.validateGas({
|
41970
|
+
gasUsed,
|
41971
|
+
gasPrice: request.gasPrice,
|
41972
|
+
gasLimit: request.gasLimit,
|
41973
|
+
minGasPrice
|
43101
41974
|
});
|
43102
|
-
request
|
43103
|
-
request.
|
43104
|
-
await this.fund(request, txCost);
|
41975
|
+
await this.fund(request, requiredQuantities, maxFee);
|
41976
|
+
request.updatePredicateInputs(estimatedInputs);
|
43105
41977
|
return request;
|
43106
41978
|
}
|
43107
41979
|
/**
|
@@ -43110,7 +41982,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43110
41982
|
* @param destination - The address of the destination.
|
43111
41983
|
* @param amount - The amount of coins to transfer.
|
43112
41984
|
* @param assetId - The asset ID of the coins to transfer.
|
43113
|
-
* @param txParams - The transaction parameters (gasLimit, maturity).
|
41985
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
43114
41986
|
* @returns A promise that resolves to the transaction response.
|
43115
41987
|
*/
|
43116
41988
|
async transfer(destination, amount, assetId, txParams = {}) {
|
@@ -43141,30 +42013,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43141
42013
|
);
|
43142
42014
|
}
|
43143
42015
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42016
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
43144
42017
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42018
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
43145
42019
|
const { script, scriptData } = await assembleTransferToContractScript({
|
43146
42020
|
hexlifiedContractId: contractAddress.toB256(),
|
43147
42021
|
amountToTransfer: bn(amount),
|
43148
42022
|
assetId: assetIdToTransfer
|
43149
42023
|
});
|
43150
42024
|
const request = new ScriptTransactionRequest({
|
43151
|
-
...
|
42025
|
+
...params,
|
43152
42026
|
script,
|
43153
42027
|
scriptData
|
43154
42028
|
});
|
43155
42029
|
request.addContractInputAndOutput(contractAddress);
|
43156
|
-
const
|
43157
|
-
|
43158
|
-
|
43159
|
-
|
43160
|
-
|
43161
|
-
|
43162
|
-
|
43163
|
-
|
42030
|
+
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42031
|
+
request,
|
42032
|
+
[{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
|
42033
|
+
);
|
42034
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42035
|
+
this.validateGas({
|
42036
|
+
gasUsed,
|
42037
|
+
gasPrice: request.gasPrice,
|
42038
|
+
gasLimit: request.gasLimit,
|
42039
|
+
minGasPrice
|
43164
42040
|
});
|
43165
|
-
request
|
43166
|
-
request.maxFee = txCost.maxFee;
|
43167
|
-
await this.fund(request, txCost);
|
42041
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43168
42042
|
return this.sendTransaction(request);
|
43169
42043
|
}
|
43170
42044
|
/**
|
@@ -43176,6 +42050,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43176
42050
|
* @returns A promise that resolves to the transaction response.
|
43177
42051
|
*/
|
43178
42052
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42053
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42054
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
43179
42055
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
43180
42056
|
const recipientDataArray = arrayify(
|
43181
42057
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -43188,19 +42064,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43188
42064
|
...recipientDataArray,
|
43189
42065
|
...amountDataArray
|
43190
42066
|
]);
|
43191
|
-
const params = {
|
43192
|
-
|
42067
|
+
const params = {
|
42068
|
+
script,
|
42069
|
+
gasPrice: minGasPrice,
|
42070
|
+
...txParams
|
42071
|
+
};
|
43193
42072
|
const request = new ScriptTransactionRequest(params);
|
43194
|
-
const
|
43195
|
-
const
|
43196
|
-
|
43197
|
-
|
43198
|
-
|
43199
|
-
|
42073
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
|
42074
|
+
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42075
|
+
request,
|
42076
|
+
forwardingQuantities
|
42077
|
+
);
|
42078
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42079
|
+
this.validateGas({
|
42080
|
+
gasUsed,
|
42081
|
+
gasPrice: request.gasPrice,
|
42082
|
+
gasLimit: request.gasLimit,
|
42083
|
+
minGasPrice
|
43200
42084
|
});
|
43201
|
-
request
|
43202
|
-
request.gasLimit = txCost.gasUsed;
|
43203
|
-
await this.fund(request, txCost);
|
42085
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43204
42086
|
return this.sendTransaction(request);
|
43205
42087
|
}
|
43206
42088
|
async signMessage(message) {
|
@@ -43258,30 +42140,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43258
42140
|
}
|
43259
42141
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43260
42142
|
}
|
43261
|
-
|
43262
|
-
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
|
42143
|
+
validateGas({
|
43263
42144
|
gasUsed,
|
43264
|
-
|
42145
|
+
gasPrice,
|
42146
|
+
gasLimit,
|
42147
|
+
minGasPrice
|
43265
42148
|
}) {
|
43266
|
-
if (
|
42149
|
+
if (minGasPrice.gt(gasPrice)) {
|
43267
42150
|
throw new FuelError(
|
43268
|
-
ErrorCode.
|
43269
|
-
`Gas
|
42151
|
+
ErrorCode.GAS_PRICE_TOO_LOW,
|
42152
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
43270
42153
|
);
|
43271
42154
|
}
|
43272
|
-
if (
|
42155
|
+
if (gasUsed.gt(gasLimit)) {
|
43273
42156
|
throw new FuelError(
|
43274
|
-
ErrorCode.
|
43275
|
-
`
|
42157
|
+
ErrorCode.GAS_LIMIT_TOO_LOW,
|
42158
|
+
`Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
|
43276
42159
|
);
|
43277
42160
|
}
|
43278
42161
|
}
|
43279
42162
|
};
|
43280
42163
|
|
43281
42164
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/modular.js
|
43282
|
-
var
|
43283
|
-
var
|
43284
|
-
var
|
42165
|
+
var _0n3 = BigInt(0);
|
42166
|
+
var _1n3 = BigInt(1);
|
42167
|
+
var _2n3 = BigInt(2);
|
43285
42168
|
var _3n = BigInt(3);
|
43286
42169
|
var _4n = BigInt(4);
|
43287
42170
|
var _5n = BigInt(5);
|
@@ -43290,38 +42173,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43290
42173
|
var _16n = BigInt(16);
|
43291
42174
|
function mod(a, b) {
|
43292
42175
|
const result = a % b;
|
43293
|
-
return result >=
|
42176
|
+
return result >= _0n3 ? result : b + result;
|
43294
42177
|
}
|
43295
42178
|
function pow(num, power, modulo) {
|
43296
|
-
if (modulo <=
|
42179
|
+
if (modulo <= _0n3 || power < _0n3)
|
43297
42180
|
throw new Error("Expected power/modulo > 0");
|
43298
|
-
if (modulo ===
|
43299
|
-
return
|
43300
|
-
let res =
|
43301
|
-
while (power >
|
43302
|
-
if (power &
|
42181
|
+
if (modulo === _1n3)
|
42182
|
+
return _0n3;
|
42183
|
+
let res = _1n3;
|
42184
|
+
while (power > _0n3) {
|
42185
|
+
if (power & _1n3)
|
43303
42186
|
res = res * num % modulo;
|
43304
42187
|
num = num * num % modulo;
|
43305
|
-
power >>=
|
42188
|
+
power >>= _1n3;
|
43306
42189
|
}
|
43307
42190
|
return res;
|
43308
42191
|
}
|
43309
42192
|
function pow2(x, power, modulo) {
|
43310
42193
|
let res = x;
|
43311
|
-
while (power-- >
|
42194
|
+
while (power-- > _0n3) {
|
43312
42195
|
res *= res;
|
43313
42196
|
res %= modulo;
|
43314
42197
|
}
|
43315
42198
|
return res;
|
43316
42199
|
}
|
43317
42200
|
function invert(number3, modulo) {
|
43318
|
-
if (number3 ===
|
42201
|
+
if (number3 === _0n3 || modulo <= _0n3) {
|
43319
42202
|
throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
|
43320
42203
|
}
|
43321
42204
|
let a = mod(number3, modulo);
|
43322
42205
|
let b = modulo;
|
43323
|
-
let x =
|
43324
|
-
while (a !==
|
42206
|
+
let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
|
42207
|
+
while (a !== _0n3) {
|
43325
42208
|
const q = b / a;
|
43326
42209
|
const r = b % a;
|
43327
42210
|
const m = x - u * q;
|
@@ -43329,19 +42212,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43329
42212
|
b = a, a = r, x = u, y = v, u = m, v = n;
|
43330
42213
|
}
|
43331
42214
|
const gcd = b;
|
43332
|
-
if (gcd !==
|
42215
|
+
if (gcd !== _1n3)
|
43333
42216
|
throw new Error("invert: does not exist");
|
43334
42217
|
return mod(x, modulo);
|
43335
42218
|
}
|
43336
42219
|
function tonelliShanks(P) {
|
43337
|
-
const legendreC = (P -
|
42220
|
+
const legendreC = (P - _1n3) / _2n3;
|
43338
42221
|
let Q, S, Z;
|
43339
|
-
for (Q = P -
|
42222
|
+
for (Q = P - _1n3, S = 0; Q % _2n3 === _0n3; Q /= _2n3, S++)
|
43340
42223
|
;
|
43341
|
-
for (Z =
|
42224
|
+
for (Z = _2n3; Z < P && pow(Z, legendreC, P) !== P - _1n3; Z++)
|
43342
42225
|
;
|
43343
42226
|
if (S === 1) {
|
43344
|
-
const p1div4 = (P +
|
42227
|
+
const p1div4 = (P + _1n3) / _4n;
|
43345
42228
|
return function tonelliFast(Fp2, n) {
|
43346
42229
|
const root = Fp2.pow(n, p1div4);
|
43347
42230
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
@@ -43349,7 +42232,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43349
42232
|
return root;
|
43350
42233
|
};
|
43351
42234
|
}
|
43352
|
-
const Q1div2 = (Q +
|
42235
|
+
const Q1div2 = (Q + _1n3) / _2n3;
|
43353
42236
|
return function tonelliSlow(Fp2, n) {
|
43354
42237
|
if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
|
43355
42238
|
throw new Error("Cannot find square root");
|
@@ -43366,7 +42249,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43366
42249
|
break;
|
43367
42250
|
t2 = Fp2.sqr(t2);
|
43368
42251
|
}
|
43369
|
-
const ge = Fp2.pow(g,
|
42252
|
+
const ge = Fp2.pow(g, _1n3 << BigInt(r - m - 1));
|
43370
42253
|
g = Fp2.sqr(ge);
|
43371
42254
|
x = Fp2.mul(x, ge);
|
43372
42255
|
b = Fp2.mul(b, g);
|
@@ -43377,7 +42260,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43377
42260
|
}
|
43378
42261
|
function FpSqrt(P) {
|
43379
42262
|
if (P % _4n === _3n) {
|
43380
|
-
const p1div4 = (P +
|
42263
|
+
const p1div4 = (P + _1n3) / _4n;
|
43381
42264
|
return function sqrt3mod4(Fp2, n) {
|
43382
42265
|
const root = Fp2.pow(n, p1div4);
|
43383
42266
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
@@ -43388,10 +42271,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43388
42271
|
if (P % _8n === _5n) {
|
43389
42272
|
const c1 = (P - _5n) / _8n;
|
43390
42273
|
return function sqrt5mod8(Fp2, n) {
|
43391
|
-
const n2 = Fp2.mul(n,
|
42274
|
+
const n2 = Fp2.mul(n, _2n3);
|
43392
42275
|
const v = Fp2.pow(n2, c1);
|
43393
42276
|
const nv = Fp2.mul(n, v);
|
43394
|
-
const i = Fp2.mul(Fp2.mul(nv,
|
42277
|
+
const i = Fp2.mul(Fp2.mul(nv, _2n3), v);
|
43395
42278
|
const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
|
43396
42279
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
43397
42280
|
throw new Error("Cannot find square root");
|
@@ -43435,19 +42318,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43435
42318
|
return validateObject(field, opts);
|
43436
42319
|
}
|
43437
42320
|
function FpPow(f2, num, power) {
|
43438
|
-
if (power <
|
42321
|
+
if (power < _0n3)
|
43439
42322
|
throw new Error("Expected power > 0");
|
43440
|
-
if (power ===
|
42323
|
+
if (power === _0n3)
|
43441
42324
|
return f2.ONE;
|
43442
|
-
if (power ===
|
42325
|
+
if (power === _1n3)
|
43443
42326
|
return num;
|
43444
42327
|
let p = f2.ONE;
|
43445
42328
|
let d = num;
|
43446
|
-
while (power >
|
43447
|
-
if (power &
|
42329
|
+
while (power > _0n3) {
|
42330
|
+
if (power & _1n3)
|
43448
42331
|
p = f2.mul(p, d);
|
43449
42332
|
d = f2.sqr(d);
|
43450
|
-
power >>=
|
42333
|
+
power >>= _1n3;
|
43451
42334
|
}
|
43452
42335
|
return p;
|
43453
42336
|
}
|
@@ -43474,7 +42357,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43474
42357
|
return { nBitLength: _nBitLength, nByteLength };
|
43475
42358
|
}
|
43476
42359
|
function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
|
43477
|
-
if (ORDER <=
|
42360
|
+
if (ORDER <= _0n3)
|
43478
42361
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
43479
42362
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
43480
42363
|
if (BYTES > 2048)
|
@@ -43485,16 +42368,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43485
42368
|
BITS,
|
43486
42369
|
BYTES,
|
43487
42370
|
MASK: bitMask(BITS),
|
43488
|
-
ZERO:
|
43489
|
-
ONE:
|
42371
|
+
ZERO: _0n3,
|
42372
|
+
ONE: _1n3,
|
43490
42373
|
create: (num) => mod(num, ORDER),
|
43491
42374
|
isValid: (num) => {
|
43492
42375
|
if (typeof num !== "bigint")
|
43493
42376
|
throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
|
43494
|
-
return
|
42377
|
+
return _0n3 <= num && num < ORDER;
|
43495
42378
|
},
|
43496
|
-
is0: (num) => num ===
|
43497
|
-
isOdd: (num) => (num &
|
42379
|
+
is0: (num) => num === _0n3,
|
42380
|
+
isOdd: (num) => (num & _1n3) === _1n3,
|
43498
42381
|
neg: (num) => mod(-num, ORDER),
|
43499
42382
|
eql: (lhs, rhs) => lhs === rhs,
|
43500
42383
|
sqr: (num) => mod(num * num, ORDER),
|
@@ -43540,13 +42423,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43540
42423
|
if (len < 16 || len < minLen || len > 1024)
|
43541
42424
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
43542
42425
|
const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
43543
|
-
const reduced = mod(num, fieldOrder -
|
42426
|
+
const reduced = mod(num, fieldOrder - _1n3) + _1n3;
|
43544
42427
|
return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
43545
42428
|
}
|
43546
42429
|
|
43547
42430
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/curve.js
|
43548
|
-
var
|
43549
|
-
var
|
42431
|
+
var _0n4 = BigInt(0);
|
42432
|
+
var _1n4 = BigInt(1);
|
43550
42433
|
function wNAF(c, bits) {
|
43551
42434
|
const constTimeNegate = (condition, item) => {
|
43552
42435
|
const neg = item.negate();
|
@@ -43563,11 +42446,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43563
42446
|
unsafeLadder(elm, n) {
|
43564
42447
|
let p = c.ZERO;
|
43565
42448
|
let d = elm;
|
43566
|
-
while (n >
|
43567
|
-
if (n &
|
42449
|
+
while (n > _0n4) {
|
42450
|
+
if (n & _1n4)
|
43568
42451
|
p = p.add(d);
|
43569
42452
|
d = d.double();
|
43570
|
-
n >>=
|
42453
|
+
n >>= _1n4;
|
43571
42454
|
}
|
43572
42455
|
return p;
|
43573
42456
|
},
|
@@ -43617,7 +42500,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43617
42500
|
n >>= shiftBy;
|
43618
42501
|
if (wbits > windowSize) {
|
43619
42502
|
wbits -= maxNumber;
|
43620
|
-
n +=
|
42503
|
+
n += _1n4;
|
43621
42504
|
}
|
43622
42505
|
const offset1 = offset;
|
43623
42506
|
const offset2 = offset + Math.abs(wbits) - 1;
|
@@ -43741,9 +42624,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43741
42624
|
return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
|
43742
42625
|
}
|
43743
42626
|
};
|
43744
|
-
var
|
43745
|
-
var
|
43746
|
-
var
|
42627
|
+
var _0n5 = BigInt(0);
|
42628
|
+
var _1n5 = BigInt(1);
|
42629
|
+
var _2n4 = BigInt(2);
|
43747
42630
|
var _3n2 = BigInt(3);
|
43748
42631
|
var _4n2 = BigInt(4);
|
43749
42632
|
function weierstrassPoints(opts) {
|
@@ -43768,7 +42651,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43768
42651
|
if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
|
43769
42652
|
throw new Error("bad generator point: equation left != right");
|
43770
42653
|
function isWithinCurveOrder(num) {
|
43771
|
-
return typeof num === "bigint" &&
|
42654
|
+
return typeof num === "bigint" && _0n5 < num && num < CURVE.n;
|
43772
42655
|
}
|
43773
42656
|
function assertGE(num) {
|
43774
42657
|
if (!isWithinCurveOrder(num))
|
@@ -44012,10 +42895,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44012
42895
|
*/
|
44013
42896
|
multiplyUnsafe(n) {
|
44014
42897
|
const I = Point2.ZERO;
|
44015
|
-
if (n ===
|
42898
|
+
if (n === _0n5)
|
44016
42899
|
return I;
|
44017
42900
|
assertGE(n);
|
44018
|
-
if (n ===
|
42901
|
+
if (n === _1n5)
|
44019
42902
|
return this;
|
44020
42903
|
const { endo } = CURVE;
|
44021
42904
|
if (!endo)
|
@@ -44024,14 +42907,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44024
42907
|
let k1p = I;
|
44025
42908
|
let k2p = I;
|
44026
42909
|
let d = this;
|
44027
|
-
while (k1 >
|
44028
|
-
if (k1 &
|
42910
|
+
while (k1 > _0n5 || k2 > _0n5) {
|
42911
|
+
if (k1 & _1n5)
|
44029
42912
|
k1p = k1p.add(d);
|
44030
|
-
if (k2 &
|
42913
|
+
if (k2 & _1n5)
|
44031
42914
|
k2p = k2p.add(d);
|
44032
42915
|
d = d.double();
|
44033
|
-
k1 >>=
|
44034
|
-
k2 >>=
|
42916
|
+
k1 >>= _1n5;
|
42917
|
+
k2 >>= _1n5;
|
44035
42918
|
}
|
44036
42919
|
if (k1neg)
|
44037
42920
|
k1p = k1p.negate();
|
@@ -44078,7 +42961,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44078
42961
|
*/
|
44079
42962
|
multiplyAndAddUnsafe(Q, a, b) {
|
44080
42963
|
const G = Point2.BASE;
|
44081
|
-
const mul = (P, a2) => a2 ===
|
42964
|
+
const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
|
44082
42965
|
const sum = mul(this, a).add(mul(Q, b));
|
44083
42966
|
return sum.is0() ? void 0 : sum;
|
44084
42967
|
}
|
@@ -44101,7 +42984,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44101
42984
|
}
|
44102
42985
|
isTorsionFree() {
|
44103
42986
|
const { h: cofactor, isTorsionFree } = CURVE;
|
44104
|
-
if (cofactor ===
|
42987
|
+
if (cofactor === _1n5)
|
44105
42988
|
return true;
|
44106
42989
|
if (isTorsionFree)
|
44107
42990
|
return isTorsionFree(Point2, this);
|
@@ -44109,7 +42992,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44109
42992
|
}
|
44110
42993
|
clearCofactor() {
|
44111
42994
|
const { h: cofactor, clearCofactor } = CURVE;
|
44112
|
-
if (cofactor ===
|
42995
|
+
if (cofactor === _1n5)
|
44113
42996
|
return this;
|
44114
42997
|
if (clearCofactor)
|
44115
42998
|
return clearCofactor(Point2, this);
|
@@ -44154,7 +43037,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44154
43037
|
const compressedLen = Fp2.BYTES + 1;
|
44155
43038
|
const uncompressedLen = 2 * Fp2.BYTES + 1;
|
44156
43039
|
function isValidFieldElement(num) {
|
44157
|
-
return
|
43040
|
+
return _0n5 < num && num < Fp2.ORDER;
|
44158
43041
|
}
|
44159
43042
|
function modN(a) {
|
44160
43043
|
return mod(a, CURVE_ORDER);
|
@@ -44184,7 +43067,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44184
43067
|
throw new Error("Point is not on curve");
|
44185
43068
|
const y2 = weierstrassEquation(x);
|
44186
43069
|
let y = Fp2.sqrt(y2);
|
44187
|
-
const isYOdd = (y &
|
43070
|
+
const isYOdd = (y & _1n5) === _1n5;
|
44188
43071
|
const isHeadOdd = (head & 1) === 1;
|
44189
43072
|
if (isHeadOdd !== isYOdd)
|
44190
43073
|
y = Fp2.neg(y);
|
@@ -44200,7 +43083,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44200
43083
|
});
|
44201
43084
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
44202
43085
|
function isBiggerThanHalfOrder(number3) {
|
44203
|
-
const HALF = CURVE_ORDER >>
|
43086
|
+
const HALF = CURVE_ORDER >> _1n5;
|
44204
43087
|
return number3 > HALF;
|
44205
43088
|
}
|
44206
43089
|
function normalizeS(s) {
|
@@ -44343,7 +43226,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44343
43226
|
function int2octets(num) {
|
44344
43227
|
if (typeof num !== "bigint")
|
44345
43228
|
throw new Error("bigint expected");
|
44346
|
-
if (!(
|
43229
|
+
if (!(_0n5 <= num && num < ORDER_MASK))
|
44347
43230
|
throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
|
44348
43231
|
return numberToBytesBE(num, CURVE.nByteLength);
|
44349
43232
|
}
|
@@ -44373,12 +43256,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44373
43256
|
const ik = invN(k);
|
44374
43257
|
const q = Point2.BASE.multiply(k).toAffine();
|
44375
43258
|
const r = modN(q.x);
|
44376
|
-
if (r ===
|
43259
|
+
if (r === _0n5)
|
44377
43260
|
return;
|
44378
43261
|
const s = modN(ik * modN(m + r * d));
|
44379
|
-
if (s ===
|
43262
|
+
if (s === _0n5)
|
44380
43263
|
return;
|
44381
|
-
let recovery = (q.x === r ? 0 : 2) | Number(q.y &
|
43264
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n5);
|
44382
43265
|
let normS = s;
|
44383
43266
|
if (lowS && isBiggerThanHalfOrder(s)) {
|
44384
43267
|
normS = normalizeS(s);
|
@@ -44470,9 +43353,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44470
43353
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/secp256k1.js
|
44471
43354
|
var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
|
44472
43355
|
var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
44473
|
-
var
|
44474
|
-
var
|
44475
|
-
var divNearest = (a, b) => (a + b /
|
43356
|
+
var _1n6 = BigInt(1);
|
43357
|
+
var _2n5 = BigInt(2);
|
43358
|
+
var divNearest = (a, b) => (a + b / _2n5) / b;
|
44476
43359
|
function sqrtMod(y) {
|
44477
43360
|
const P = secp256k1P;
|
44478
43361
|
const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
|
@@ -44481,7 +43364,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44481
43364
|
const b3 = b2 * b2 * y % P;
|
44482
43365
|
const b6 = pow2(b3, _3n3, P) * b3 % P;
|
44483
43366
|
const b9 = pow2(b6, _3n3, P) * b3 % P;
|
44484
|
-
const b11 = pow2(b9,
|
43367
|
+
const b11 = pow2(b9, _2n5, P) * b2 % P;
|
44485
43368
|
const b22 = pow2(b11, _11n, P) * b11 % P;
|
44486
43369
|
const b44 = pow2(b22, _22n, P) * b22 % P;
|
44487
43370
|
const b88 = pow2(b44, _44n, P) * b44 % P;
|
@@ -44490,7 +43373,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44490
43373
|
const b223 = pow2(b220, _3n3, P) * b3 % P;
|
44491
43374
|
const t1 = pow2(b223, _23n, P) * b22 % P;
|
44492
43375
|
const t2 = pow2(t1, _6n, P) * b2 % P;
|
44493
|
-
const root = pow2(t2,
|
43376
|
+
const root = pow2(t2, _2n5, P);
|
44494
43377
|
if (!Fp.eql(Fp.sqr(root), y))
|
44495
43378
|
throw new Error("Cannot find square root");
|
44496
43379
|
return root;
|
@@ -44523,7 +43406,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44523
43406
|
splitScalar: (k) => {
|
44524
43407
|
const n = secp256k1N;
|
44525
43408
|
const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
|
44526
|
-
const b1 = -
|
43409
|
+
const b1 = -_1n6 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
|
44527
43410
|
const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
|
44528
43411
|
const b2 = a1;
|
44529
43412
|
const POW_2_128 = BigInt("0x100000000000000000000000000000000");
|
@@ -44544,7 +43427,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44544
43427
|
}
|
44545
43428
|
}
|
44546
43429
|
}, sha256);
|
44547
|
-
var
|
43430
|
+
var _0n6 = BigInt(0);
|
44548
43431
|
var Point = secp256k1.ProjectivePoint;
|
44549
43432
|
|
44550
43433
|
// src/signer/signer.ts
|
@@ -44651,12 +43534,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44651
43534
|
};
|
44652
43535
|
|
44653
43536
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
44654
|
-
var
|
43537
|
+
var import_crypto15 = __toESM(__require("crypto"));
|
44655
43538
|
var rnds8Pool = new Uint8Array(256);
|
44656
43539
|
var poolPtr = rnds8Pool.length;
|
44657
43540
|
function rng() {
|
44658
43541
|
if (poolPtr > rnds8Pool.length - 16) {
|
44659
|
-
|
43542
|
+
import_crypto15.default.randomFillSync(rnds8Pool);
|
44660
43543
|
poolPtr = 0;
|
44661
43544
|
}
|
44662
43545
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -44672,9 +43555,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44672
43555
|
}
|
44673
43556
|
|
44674
43557
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
44675
|
-
var
|
43558
|
+
var import_crypto16 = __toESM(__require("crypto"));
|
44676
43559
|
var native_default = {
|
44677
|
-
randomUUID:
|
43560
|
+
randomUUID: import_crypto16.default.randomUUID
|
44678
43561
|
};
|
44679
43562
|
|
44680
43563
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -44857,7 +43740,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44857
43740
|
* @param transactionRequestLike - The transaction request to send.
|
44858
43741
|
* @returns A promise that resolves to the TransactionResponse object.
|
44859
43742
|
*/
|
44860
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
43743
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
44861
43744
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44862
43745
|
if (estimateTxDependencies) {
|
44863
43746
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -48135,21 +47018,35 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48135
47018
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
48136
47019
|
request.inputs?.forEach((input) => {
|
48137
47020
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
48138
|
-
input.predicate =
|
48139
|
-
input.predicateData =
|
47021
|
+
input.predicate = this.bytes;
|
47022
|
+
input.predicateData = this.getPredicateData(policies.length);
|
48140
47023
|
}
|
48141
47024
|
});
|
48142
47025
|
return request;
|
48143
47026
|
}
|
47027
|
+
/**
|
47028
|
+
* A helper that creates a transfer transaction request and returns it.
|
47029
|
+
*
|
47030
|
+
* @param destination - The address of the destination.
|
47031
|
+
* @param amount - The amount of coins to transfer.
|
47032
|
+
* @param assetId - The asset ID of the coins to transfer.
|
47033
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
47034
|
+
* @returns A promise that resolves to the prepared transaction request.
|
47035
|
+
*/
|
47036
|
+
async createTransfer(destination, amount, assetId, txParams = {}) {
|
47037
|
+
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
47038
|
+
const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
47039
|
+
return this.populateTransactionPredicateData(request);
|
47040
|
+
}
|
48144
47041
|
/**
|
48145
47042
|
* Sends a transaction with the populated predicate data.
|
48146
47043
|
*
|
48147
47044
|
* @param transactionRequestLike - The transaction request-like object.
|
48148
47045
|
* @returns A promise that resolves to the transaction response.
|
48149
47046
|
*/
|
48150
|
-
sendTransaction(transactionRequestLike) {
|
48151
|
-
const transactionRequest =
|
48152
|
-
return super.sendTransaction(transactionRequest,
|
47047
|
+
sendTransaction(transactionRequestLike, options) {
|
47048
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47049
|
+
return super.sendTransaction(transactionRequest, options);
|
48153
47050
|
}
|
48154
47051
|
/**
|
48155
47052
|
* Simulates a transaction with the populated predicate data.
|
@@ -48158,8 +47055,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48158
47055
|
* @returns A promise that resolves to the call result.
|
48159
47056
|
*/
|
48160
47057
|
simulateTransaction(transactionRequestLike) {
|
48161
|
-
const transactionRequest =
|
48162
|
-
return super.simulateTransaction(transactionRequest
|
47058
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47059
|
+
return super.simulateTransaction(transactionRequest);
|
48163
47060
|
}
|
48164
47061
|
getPredicateData(policiesLength) {
|
48165
47062
|
if (!this.predicateData.length) {
|
@@ -48205,25 +47102,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48205
47102
|
predicateInterface: abiInterface
|
48206
47103
|
};
|
48207
47104
|
}
|
48208
|
-
/**
|
48209
|
-
* Retrieves resources satisfying the spend query for the account.
|
48210
|
-
*
|
48211
|
-
* @param quantities - IDs of coins to exclude.
|
48212
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
48213
|
-
* @returns A promise that resolves to an array of Resources.
|
48214
|
-
*/
|
48215
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
48216
|
-
const resources = await this.provider.getResourcesToSpend(
|
48217
|
-
this.address,
|
48218
|
-
quantities,
|
48219
|
-
excludedIds
|
48220
|
-
);
|
48221
|
-
return resources.map((resource) => ({
|
48222
|
-
...resource,
|
48223
|
-
predicate: hexlify(this.bytes),
|
48224
|
-
padPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48225
|
-
}));
|
48226
|
-
}
|
48227
47105
|
/**
|
48228
47106
|
* Sets the configurable constants for the predicate.
|
48229
47107
|
*
|