@fuel-ts/account 0.0.0-rc-2152-20240425194419 → 0.0.0-rc-2021-20240425202957
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 +7 -6
- 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 +1818 -696
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +796 -545
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +671 -421
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +12 -24
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +810 -359
- 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 +4 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +7 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +46 -27
- 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 +8 -28
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +3 -0
- 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 +2 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
- 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 +8 -2
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +2544 -1193
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +782 -536
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +669 -423
- 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 split3 = str.lastIndexOf("1");
|
186
|
+
if (split3 === -1)
|
187
187
|
return "No separator character for " + str;
|
188
|
-
if (
|
188
|
+
if (split3 === 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, split3);
|
191
|
+
const wordChars = str.slice(split3 + 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 max(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 add2(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 split3(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 split3(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 add2(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 clone3(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(clone3(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 ? clone3(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 add2(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 = add2;
|
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 _32n3 = BigInt(32);
|
28240
28240
|
const _u32_max = BigInt(4294967295);
|
28241
|
-
const wh = Number(value >>
|
28241
|
+
const wh = Number(value >> _32n3 & _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.24.3",
|
28957
28957
|
FUELS: "0.82.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -29053,6 +29053,7 @@ 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";
|
29056
29057
|
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
|
29057
29058
|
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
|
29058
29059
|
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
|
@@ -29243,9 +29244,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29243
29244
|
};
|
29244
29245
|
var DateTime = _DateTime;
|
29245
29246
|
__publicField3(DateTime, "TAI64_NULL", "");
|
29247
|
+
function isDefined(value) {
|
29248
|
+
return value !== void 0;
|
29249
|
+
}
|
29246
29250
|
|
29247
29251
|
// ../crypto/dist/index.mjs
|
29248
|
-
var
|
29252
|
+
var import_crypto8 = __toESM(__require("crypto"), 1);
|
29249
29253
|
|
29250
29254
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
29251
29255
|
var version = "6.7.1";
|
@@ -29412,6 +29416,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29412
29416
|
function getBytes(value, name) {
|
29413
29417
|
return _getBytes(value, name, false);
|
29414
29418
|
}
|
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
|
+
}
|
29415
29431
|
var HexCharacters2 = "0123456789abcdef";
|
29416
29432
|
function hexlify2(data) {
|
29417
29433
|
const bytes3 = getBytes(data);
|
@@ -29772,7 +29788,74 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29772
29788
|
};
|
29773
29789
|
var assert_default = assert2;
|
29774
29790
|
|
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
|
+
|
29775
29857
|
// ../../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));
|
29776
29859
|
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
29777
29860
|
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
29778
29861
|
if (!isLE2)
|
@@ -29805,14 +29888,224 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29805
29888
|
hashC.create = () => hashConstructor();
|
29806
29889
|
return hashC;
|
29807
29890
|
}
|
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);
|
29808
30101
|
|
29809
30102
|
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_sha2.js
|
29810
30103
|
function setBigUint642(view, byteOffset, value, isLE3) {
|
29811
30104
|
if (typeof view.setBigUint64 === "function")
|
29812
30105
|
return view.setBigUint64(byteOffset, value, isLE3);
|
29813
|
-
const
|
30106
|
+
const _32n3 = BigInt(32);
|
29814
30107
|
const _u32_max = BigInt(4294967295);
|
29815
|
-
const wh = Number(value >>
|
30108
|
+
const wh = Number(value >> _32n3 & _u32_max);
|
29816
30109
|
const wl = Number(value & _u32_max);
|
29817
30110
|
const h = isLE3 ? 4 : 0;
|
29818
30111
|
const l = isLE3 ? 0 : 4;
|
@@ -29984,7 +30277,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29984
30277
|
var ripemd160 = wrapConstructor2(() => new RIPEMD160());
|
29985
30278
|
|
29986
30279
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/ripemd160.js
|
29987
|
-
var
|
30280
|
+
var locked3 = false;
|
29988
30281
|
var _ripemd160 = function(data) {
|
29989
30282
|
return ripemd160(data);
|
29990
30283
|
};
|
@@ -29995,10 +30288,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29995
30288
|
}
|
29996
30289
|
ripemd1602._ = _ripemd160;
|
29997
30290
|
ripemd1602.lock = function() {
|
29998
|
-
|
30291
|
+
locked3 = true;
|
29999
30292
|
};
|
30000
30293
|
ripemd1602.register = function(func) {
|
30001
|
-
if (
|
30294
|
+
if (locked3) {
|
30002
30295
|
throw new TypeError("ripemd160 is locked");
|
30003
30296
|
}
|
30004
30297
|
__ripemd160 = func;
|
@@ -30006,7 +30299,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30006
30299
|
Object.freeze(ripemd1602);
|
30007
30300
|
|
30008
30301
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/pbkdf2.js
|
30009
|
-
var
|
30302
|
+
var locked4 = false;
|
30010
30303
|
var _pbkdf2 = function(password, salt, iterations, keylen, algo) {
|
30011
30304
|
return (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
30012
30305
|
};
|
@@ -30018,19 +30311,602 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30018
30311
|
}
|
30019
30312
|
pbkdf22._ = _pbkdf2;
|
30020
30313
|
pbkdf22.lock = function() {
|
30021
|
-
|
30314
|
+
locked4 = true;
|
30022
30315
|
};
|
30023
30316
|
pbkdf22.register = function(func) {
|
30024
|
-
if (
|
30317
|
+
if (locked4) {
|
30025
30318
|
throw new Error("pbkdf2 is locked");
|
30026
30319
|
}
|
30027
30320
|
__pbkdf2 = func;
|
30028
30321
|
};
|
30029
30322
|
Object.freeze(pbkdf22);
|
30030
30323
|
|
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
|
+
|
30031
30907
|
// ../crypto/dist/index.mjs
|
30032
|
-
var import_crypto8 = __toESM(__require("crypto"), 1);
|
30033
30908
|
var import_crypto9 = __toESM(__require("crypto"), 1);
|
30909
|
+
var import_crypto10 = __toESM(__require("crypto"), 1);
|
30034
30910
|
var scrypt3 = (params) => {
|
30035
30911
|
const { password, salt, n, p, r, dklen } = params;
|
30036
30912
|
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
@@ -30039,7 +30915,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30039
30915
|
var keccak2562 = (data) => keccak_256(data);
|
30040
30916
|
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
30041
30917
|
var randomBytes4 = (length) => {
|
30042
|
-
const randomValues = Uint8Array.from(
|
30918
|
+
const randomValues = Uint8Array.from(import_crypto9.default.randomBytes(length));
|
30043
30919
|
return randomValues;
|
30044
30920
|
};
|
30045
30921
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -30054,7 +30930,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30054
30930
|
const salt = randomBytes4(32);
|
30055
30931
|
const secret = keyFromPassword(password, salt);
|
30056
30932
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
30057
|
-
const cipher = await
|
30933
|
+
const cipher = await import_crypto8.default.createCipheriv(ALGORITHM, secret, iv);
|
30058
30934
|
let cipherData = cipher.update(dataBuffer);
|
30059
30935
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
30060
30936
|
return {
|
@@ -30068,7 +30944,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30068
30944
|
const salt = bufferFromString(keystore.salt);
|
30069
30945
|
const secret = keyFromPassword(password, salt);
|
30070
30946
|
const encryptedText = bufferFromString(keystore.data);
|
30071
|
-
const decipher = await
|
30947
|
+
const decipher = await import_crypto8.default.createDecipheriv(ALGORITHM, secret, iv);
|
30072
30948
|
const decrypted = decipher.update(encryptedText);
|
30073
30949
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
30074
30950
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -30079,12 +30955,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30079
30955
|
}
|
30080
30956
|
};
|
30081
30957
|
async function encryptJsonWalletData(data, key, iv) {
|
30082
|
-
const cipher = await
|
30958
|
+
const cipher = await import_crypto10.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30083
30959
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
30084
30960
|
return new Uint8Array(encrypted);
|
30085
30961
|
}
|
30086
30962
|
async function decryptJsonWalletData(data, key, iv) {
|
30087
|
-
const decipher =
|
30963
|
+
const decipher = import_crypto10.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30088
30964
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
30089
30965
|
return new Uint8Array(decrypted);
|
30090
30966
|
}
|
@@ -30619,32 +31495,182 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30619
31495
|
function toBytes3(value, bytesPadding) {
|
30620
31496
|
return bn(value).toBytes(bytesPadding);
|
30621
31497
|
}
|
30622
|
-
|
30623
|
-
|
31498
|
+
|
31499
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
31500
|
+
function _isPlaceholder(a) {
|
31501
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31502
|
+
}
|
31503
|
+
|
31504
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31505
|
+
function _curry1(fn) {
|
31506
|
+
return function f1(a) {
|
31507
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31508
|
+
return f1;
|
31509
|
+
} else {
|
31510
|
+
return fn.apply(this, arguments);
|
31511
|
+
}
|
31512
|
+
};
|
30624
31513
|
}
|
30625
31514
|
|
31515
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31516
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
31517
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31518
|
+
};
|
31519
|
+
|
31520
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31521
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31522
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31523
|
+
});
|
31524
|
+
var type_default = type;
|
31525
|
+
|
31526
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31527
|
+
var pad = function pad2(n) {
|
31528
|
+
return (n < 10 ? "0" : "") + n;
|
31529
|
+
};
|
31530
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31531
|
+
return d.toISOString();
|
31532
|
+
} : function _toISOString3(d) {
|
31533
|
+
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
31534
|
+
};
|
31535
|
+
|
31536
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31537
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31538
|
+
return n << 0 === n;
|
31539
|
+
};
|
31540
|
+
|
31541
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31542
|
+
function _cloneRegExp(pattern) {
|
31543
|
+
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
31544
|
+
}
|
31545
|
+
|
31546
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31547
|
+
function _clone(value, deep, map) {
|
31548
|
+
map || (map = new _ObjectMap());
|
31549
|
+
if (_isPrimitive(value)) {
|
31550
|
+
return value;
|
31551
|
+
}
|
31552
|
+
var copy = function copy2(copiedValue) {
|
31553
|
+
var cachedCopy = map.get(value);
|
31554
|
+
if (cachedCopy) {
|
31555
|
+
return cachedCopy;
|
31556
|
+
}
|
31557
|
+
map.set(value, copiedValue);
|
31558
|
+
for (var key in value) {
|
31559
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31560
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31561
|
+
}
|
31562
|
+
}
|
31563
|
+
return copiedValue;
|
31564
|
+
};
|
31565
|
+
switch (type_default(value)) {
|
31566
|
+
case "Object":
|
31567
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
31568
|
+
case "Array":
|
31569
|
+
return copy([]);
|
31570
|
+
case "Date":
|
31571
|
+
return new Date(value.valueOf());
|
31572
|
+
case "RegExp":
|
31573
|
+
return _cloneRegExp(value);
|
31574
|
+
case "Int8Array":
|
31575
|
+
case "Uint8Array":
|
31576
|
+
case "Uint8ClampedArray":
|
31577
|
+
case "Int16Array":
|
31578
|
+
case "Uint16Array":
|
31579
|
+
case "Int32Array":
|
31580
|
+
case "Uint32Array":
|
31581
|
+
case "Float32Array":
|
31582
|
+
case "Float64Array":
|
31583
|
+
case "BigInt64Array":
|
31584
|
+
case "BigUint64Array":
|
31585
|
+
return value.slice();
|
31586
|
+
default:
|
31587
|
+
return value;
|
31588
|
+
}
|
31589
|
+
}
|
31590
|
+
function _isPrimitive(param) {
|
31591
|
+
var type3 = typeof param;
|
31592
|
+
return param == null || type3 != "object" && type3 != "function";
|
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
|
+
|
30626
31652
|
// src/providers/coin-quantity.ts
|
30627
31653
|
var coinQuantityfy = (coinQuantityLike) => {
|
30628
31654
|
let assetId;
|
30629
31655
|
let amount;
|
30630
|
-
let
|
31656
|
+
let max;
|
30631
31657
|
if (Array.isArray(coinQuantityLike)) {
|
30632
31658
|
amount = coinQuantityLike[0];
|
30633
31659
|
assetId = coinQuantityLike[1];
|
30634
|
-
|
31660
|
+
max = coinQuantityLike[2] ?? void 0;
|
30635
31661
|
} else {
|
30636
31662
|
amount = coinQuantityLike.amount;
|
30637
31663
|
assetId = coinQuantityLike.assetId;
|
30638
|
-
|
31664
|
+
max = coinQuantityLike.max ?? void 0;
|
30639
31665
|
}
|
30640
31666
|
const bnAmount = bn(amount);
|
30641
31667
|
return {
|
30642
31668
|
assetId: hexlify(assetId),
|
30643
31669
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
30644
|
-
max:
|
31670
|
+
max: max ? bn(max) : void 0
|
30645
31671
|
};
|
30646
31672
|
};
|
30647
|
-
var
|
31673
|
+
var addAmountToCoinQuantities = (params) => {
|
30648
31674
|
const { amount, assetId } = params;
|
30649
31675
|
const coinQuantities = [...params.coinQuantities];
|
30650
31676
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -30729,7 +31755,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30729
31755
|
var ENCODING_V1 = "1";
|
30730
31756
|
var WORD_SIZE = 8;
|
30731
31757
|
var BYTES_32 = 32;
|
30732
|
-
var UTXO_ID_LEN = BYTES_32 +
|
31758
|
+
var UTXO_ID_LEN = BYTES_32 + 2;
|
30733
31759
|
var ASSET_ID_LEN = BYTES_32;
|
30734
31760
|
var ADDRESS_LEN = BYTES_32;
|
30735
31761
|
var NONCE_LEN = BYTES_32;
|
@@ -30737,9 +31763,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30737
31763
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
30738
31764
|
var MAX_BYTES = 2 ** 32 - 1;
|
30739
31765
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
30740
|
-
|
31766
|
+
ASSET_ID_LEN + // Base asset ID
|
30741
31767
|
// Asset ID/Balance coin input pairs
|
30742
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31768
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
|
30743
31769
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
30744
31770
|
WORD_SIZE + // Gas limit
|
30745
31771
|
WORD_SIZE + // Script size
|
@@ -30757,7 +31783,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30757
31783
|
ASSET_ID_LEN + // Asset id
|
30758
31784
|
TX_POINTER_LEN + // TxPointer
|
30759
31785
|
WORD_SIZE + // Witnesses index
|
30760
|
-
WORD_SIZE + // Maturity
|
30761
31786
|
WORD_SIZE + // Predicate size
|
30762
31787
|
WORD_SIZE + // Predicate data size
|
30763
31788
|
WORD_SIZE;
|
@@ -31079,7 +32104,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31079
32104
|
constructor(name, coders) {
|
31080
32105
|
const caseIndexCoder = new BigNumberCoder("u64");
|
31081
32106
|
const encodedValueSize = Object.values(coders).reduce(
|
31082
|
-
(
|
32107
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
31083
32108
|
0
|
31084
32109
|
);
|
31085
32110
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -31797,7 +32822,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31797
32822
|
constructor(name, coders) {
|
31798
32823
|
const caseIndexCoder = new BigNumberCoder("u64");
|
31799
32824
|
const encodedValueSize = Object.values(coders).reduce(
|
31800
|
-
(
|
32825
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
31801
32826
|
0
|
31802
32827
|
);
|
31803
32828
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32515,18 +33540,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32515
33540
|
encode(value) {
|
32516
33541
|
const parts = [];
|
32517
33542
|
parts.push(new B256Coder().encode(value.txID));
|
32518
|
-
parts.push(new NumberCoder("
|
33543
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
32519
33544
|
parts.push(new B256Coder().encode(value.owner));
|
32520
33545
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
32521
33546
|
parts.push(new B256Coder().encode(value.assetId));
|
32522
33547
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
32523
|
-
parts.push(new NumberCoder("
|
32524
|
-
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33548
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
32525
33549
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
32526
|
-
parts.push(new
|
32527
|
-
parts.push(new
|
32528
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
32529
|
-
parts.push(
|
33550
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33551
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33552
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33553
|
+
parts.push(
|
33554
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33555
|
+
);
|
32530
33556
|
return concat(parts);
|
32531
33557
|
}
|
32532
33558
|
decode(data, offset) {
|
@@ -32534,7 +33560,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32534
33560
|
let o = offset;
|
32535
33561
|
[decoded, o] = new B256Coder().decode(data, o);
|
32536
33562
|
const txID = decoded;
|
32537
|
-
[decoded, o] = new NumberCoder("
|
33563
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
32538
33564
|
const outputIndex = decoded;
|
32539
33565
|
[decoded, o] = new B256Coder().decode(data, o);
|
32540
33566
|
const owner = decoded;
|
@@ -32544,19 +33570,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32544
33570
|
const assetId = decoded;
|
32545
33571
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
32546
33572
|
const txPointer = decoded;
|
32547
|
-
[decoded, o] = new NumberCoder("
|
33573
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
32548
33574
|
const witnessIndex = Number(decoded);
|
32549
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
32550
|
-
const maturity = decoded;
|
32551
33575
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32552
33576
|
const predicateGasUsed = decoded;
|
32553
|
-
[decoded, o] = new
|
33577
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32554
33578
|
const predicateLength = decoded;
|
32555
|
-
[decoded, o] = new
|
33579
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32556
33580
|
const predicateDataLength = decoded;
|
32557
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33581
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
32558
33582
|
const predicate = decoded;
|
32559
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33583
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
32560
33584
|
const predicateData = decoded;
|
32561
33585
|
return [
|
32562
33586
|
{
|
@@ -32568,7 +33592,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32568
33592
|
assetId,
|
32569
33593
|
txPointer,
|
32570
33594
|
witnessIndex,
|
32571
|
-
maturity,
|
32572
33595
|
predicateGasUsed,
|
32573
33596
|
predicateLength,
|
32574
33597
|
predicateDataLength,
|
@@ -32586,7 +33609,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32586
33609
|
encode(value) {
|
32587
33610
|
const parts = [];
|
32588
33611
|
parts.push(new B256Coder().encode(value.txID));
|
32589
|
-
parts.push(new NumberCoder("
|
33612
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
32590
33613
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
32591
33614
|
parts.push(new B256Coder().encode(value.stateRoot));
|
32592
33615
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -32598,7 +33621,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32598
33621
|
let o = offset;
|
32599
33622
|
[decoded, o] = new B256Coder().decode(data, o);
|
32600
33623
|
const txID = decoded;
|
32601
|
-
[decoded, o] = new NumberCoder("
|
33624
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
32602
33625
|
const outputIndex = decoded;
|
32603
33626
|
[decoded, o] = new B256Coder().decode(data, o);
|
32604
33627
|
const balanceRoot = decoded;
|
@@ -32647,14 +33670,16 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32647
33670
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
32648
33671
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
32649
33672
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
32650
|
-
parts.push(new NumberCoder("
|
33673
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
32651
33674
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
32652
|
-
parts.push(new
|
32653
|
-
parts.push(new
|
32654
|
-
parts.push(new
|
33675
|
+
parts.push(new BigNumberCoder("u64").encode(data.length));
|
33676
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33677
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
32655
33678
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
32656
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
32657
|
-
parts.push(
|
33679
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33680
|
+
parts.push(
|
33681
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33682
|
+
);
|
32658
33683
|
return concat(parts);
|
32659
33684
|
}
|
32660
33685
|
static decodeData(messageData) {
|
@@ -32674,21 +33699,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32674
33699
|
const amount = decoded;
|
32675
33700
|
[decoded, o] = new B256Coder().decode(data, o);
|
32676
33701
|
const nonce = decoded;
|
32677
|
-
[decoded, o] = new NumberCoder("
|
33702
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
32678
33703
|
const witnessIndex = Number(decoded);
|
32679
33704
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32680
33705
|
const predicateGasUsed = decoded;
|
32681
33706
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
32682
33707
|
const dataLength2 = decoded;
|
32683
|
-
[decoded, o] = new
|
33708
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32684
33709
|
const predicateLength = decoded;
|
32685
|
-
[decoded, o] = new
|
33710
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32686
33711
|
const predicateDataLength = decoded;
|
32687
33712
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
32688
33713
|
const messageData = decoded;
|
32689
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33714
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
32690
33715
|
const predicate = decoded;
|
32691
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33716
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
32692
33717
|
const predicateData = decoded;
|
32693
33718
|
return [
|
32694
33719
|
{
|
@@ -33000,7 +34025,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33000
34025
|
}
|
33001
34026
|
};
|
33002
34027
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
33003
|
-
PolicyType2[PolicyType2["
|
34028
|
+
PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
|
33004
34029
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
33005
34030
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
33006
34031
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -33048,9 +34073,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33048
34073
|
let o = offset;
|
33049
34074
|
const policies = [];
|
33050
34075
|
if (policyTypes & 1) {
|
33051
|
-
const [
|
34076
|
+
const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
33052
34077
|
o = nextOffset;
|
33053
|
-
policies.push({ type: 1, data:
|
34078
|
+
policies.push({ type: 1, data: tip });
|
33054
34079
|
}
|
33055
34080
|
if (policyTypes & 2) {
|
33056
34081
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -33282,15 +34307,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33282
34307
|
encode(value) {
|
33283
34308
|
const parts = [];
|
33284
34309
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
33285
|
-
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
33286
|
-
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
33287
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
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
34310
|
parts.push(new B256Coder().encode(value.receiptsRoot));
|
33292
|
-
parts.push(new
|
33293
|
-
parts.push(new
|
34311
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
|
34312
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34313
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34314
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34315
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34316
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34317
|
+
parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
|
34318
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
|
33294
34319
|
parts.push(new PoliciesCoder().encode(value.policies));
|
33295
34320
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
33296
34321
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -33302,23 +34327,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33302
34327
|
let o = offset;
|
33303
34328
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33304
34329
|
const scriptGasLimit = decoded;
|
33305
|
-
[decoded, o] = new
|
34330
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34331
|
+
const receiptsRoot = decoded;
|
34332
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33306
34333
|
const scriptLength = decoded;
|
33307
|
-
[decoded, o] = new
|
34334
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33308
34335
|
const scriptDataLength = decoded;
|
33309
34336
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33310
34337
|
const policyTypes = decoded;
|
33311
|
-
[decoded, o] = new NumberCoder("
|
34338
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33312
34339
|
const inputsCount = decoded;
|
33313
|
-
[decoded, o] = new NumberCoder("
|
34340
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33314
34341
|
const outputsCount = decoded;
|
33315
|
-
[decoded, o] = new NumberCoder("
|
34342
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33316
34343
|
const witnessesCount = decoded;
|
33317
|
-
[decoded, o] = new
|
33318
|
-
const receiptsRoot = decoded;
|
33319
|
-
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34344
|
+
[decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
|
33320
34345
|
const script = decoded;
|
33321
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34346
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
|
33322
34347
|
const scriptData = decoded;
|
33323
34348
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
33324
34349
|
const policies = decoded;
|
@@ -33356,18 +34381,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33356
34381
|
}
|
33357
34382
|
encode(value) {
|
33358
34383
|
const parts = [];
|
33359
|
-
parts.push(new NumberCoder("
|
33360
|
-
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
33361
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
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));
|
34384
|
+
parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
|
33366
34385
|
parts.push(new B256Coder().encode(value.salt));
|
33367
|
-
parts.push(new
|
34386
|
+
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34387
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34388
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34389
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34390
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
33368
34391
|
parts.push(
|
33369
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(
|
34392
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
|
34393
|
+
value.storageSlots
|
34394
|
+
)
|
33370
34395
|
);
|
34396
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
33371
34397
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
33372
34398
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
33373
34399
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -33376,26 +34402,27 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33376
34402
|
decode(data, offset) {
|
33377
34403
|
let decoded;
|
33378
34404
|
let o = offset;
|
33379
|
-
[decoded, o] = new NumberCoder("
|
33380
|
-
const bytecodeLength = decoded;
|
33381
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34405
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33382
34406
|
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;
|
33383
34411
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33384
34412
|
const policyTypes = decoded;
|
33385
34413
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33386
|
-
const storageSlotsCount = decoded;
|
33387
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33388
34414
|
const inputsCount = decoded;
|
33389
|
-
[decoded, o] = new NumberCoder("
|
34415
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33390
34416
|
const outputsCount = decoded;
|
33391
|
-
[decoded, o] = new NumberCoder("
|
34417
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33392
34418
|
const witnessesCount = decoded;
|
33393
|
-
[decoded, o] = new
|
33394
|
-
|
34419
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
|
34420
|
+
data,
|
34421
|
+
o
|
34422
|
+
);
|
34423
|
+
const storageSlots = decoded;
|
33395
34424
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
33396
34425
|
const policies = decoded;
|
33397
|
-
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
33398
|
-
const storageSlots = decoded;
|
33399
34426
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
33400
34427
|
const inputs = decoded;
|
33401
34428
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -33405,7 +34432,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33405
34432
|
return [
|
33406
34433
|
{
|
33407
34434
|
type: 1,
|
33408
|
-
bytecodeLength,
|
33409
34435
|
bytecodeWitnessIndex,
|
33410
34436
|
policyTypes,
|
33411
34437
|
storageSlotsCount,
|
@@ -33434,6 +34460,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33434
34460
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
33435
34461
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
33436
34462
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34463
|
+
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
33437
34464
|
return concat(parts);
|
33438
34465
|
}
|
33439
34466
|
decode(data, offset) {
|
@@ -33449,6 +34476,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33449
34476
|
const mintAmount = decoded;
|
33450
34477
|
[decoded, o] = new B256Coder().decode(data, o);
|
33451
34478
|
const mintAssetId = decoded;
|
34479
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34480
|
+
const gasPrice = decoded;
|
33452
34481
|
return [
|
33453
34482
|
{
|
33454
34483
|
type: 2,
|
@@ -33456,7 +34485,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33456
34485
|
inputContract,
|
33457
34486
|
outputContract,
|
33458
34487
|
mintAmount,
|
33459
|
-
mintAssetId
|
34488
|
+
mintAssetId,
|
34489
|
+
gasPrice
|
33460
34490
|
},
|
33461
34491
|
o
|
33462
34492
|
];
|
@@ -33548,9 +34578,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33548
34578
|
utf8ToBytes: () => utf8ToBytes3,
|
33549
34579
|
validateObject: () => validateObject
|
33550
34580
|
});
|
33551
|
-
var
|
33552
|
-
var
|
33553
|
-
var
|
34581
|
+
var _0n3 = BigInt(0);
|
34582
|
+
var _1n3 = BigInt(1);
|
34583
|
+
var _2n3 = BigInt(2);
|
33554
34584
|
function isBytes3(a) {
|
33555
34585
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
33556
34586
|
}
|
@@ -33669,17 +34699,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33669
34699
|
}
|
33670
34700
|
function bitLen(n) {
|
33671
34701
|
let len;
|
33672
|
-
for (len = 0; n >
|
34702
|
+
for (len = 0; n > _0n3; n >>= _1n3, len += 1)
|
33673
34703
|
;
|
33674
34704
|
return len;
|
33675
34705
|
}
|
33676
34706
|
function bitGet(n, pos) {
|
33677
|
-
return n >> BigInt(pos) &
|
34707
|
+
return n >> BigInt(pos) & _1n3;
|
33678
34708
|
}
|
33679
34709
|
var bitSet = (n, pos, value) => {
|
33680
|
-
return n | (value ?
|
34710
|
+
return n | (value ? _1n3 : _0n3) << BigInt(pos);
|
33681
34711
|
};
|
33682
|
-
var bitMask = (n) => (
|
34712
|
+
var bitMask = (n) => (_2n3 << BigInt(n - 1)) - _1n3;
|
33683
34713
|
var u8n = (data) => new Uint8Array(data);
|
33684
34714
|
var u8fr = (arr) => Uint8Array.from(arr);
|
33685
34715
|
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
@@ -33706,7 +34736,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33706
34736
|
k = h(u8fr([1]), seed);
|
33707
34737
|
v = h();
|
33708
34738
|
};
|
33709
|
-
const
|
34739
|
+
const gen3 = () => {
|
33710
34740
|
if (i++ >= 1e3)
|
33711
34741
|
throw new Error("drbg: tried 1000 values");
|
33712
34742
|
let len = 0;
|
@@ -33723,7 +34753,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33723
34753
|
reset();
|
33724
34754
|
reseed(seed);
|
33725
34755
|
let res = void 0;
|
33726
|
-
while (!(res = pred(
|
34756
|
+
while (!(res = pred(gen3())))
|
33727
34757
|
reseed();
|
33728
34758
|
reset();
|
33729
34759
|
return res;
|
@@ -33763,159 +34793,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33763
34793
|
// src/providers/provider.ts
|
33764
34794
|
var import_graphql_request = __toESM(require_dist2());
|
33765
34795
|
|
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
|
-
|
33919
34796
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
33920
34797
|
var __assign = function() {
|
33921
34798
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37081,16 +37958,20 @@ spurious results.`);
|
|
37081
37958
|
var lib_default2 = gql;
|
37082
37959
|
|
37083
37960
|
// 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
|
+
`;
|
37084
37969
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37085
37970
|
fragment receiptFragment on Receipt {
|
37086
|
-
|
37087
|
-
id
|
37088
|
-
}
|
37971
|
+
id
|
37089
37972
|
pc
|
37090
37973
|
is
|
37091
|
-
to
|
37092
|
-
id
|
37093
|
-
}
|
37974
|
+
to
|
37094
37975
|
toAddress
|
37095
37976
|
amount
|
37096
37977
|
assetId
|
@@ -37128,10 +38009,16 @@ spurious results.`);
|
|
37128
38009
|
id
|
37129
38010
|
}
|
37130
38011
|
time
|
38012
|
+
receipts {
|
38013
|
+
...receiptFragment
|
38014
|
+
}
|
37131
38015
|
programState {
|
37132
38016
|
returnType
|
37133
38017
|
data
|
37134
38018
|
}
|
38019
|
+
receipts {
|
38020
|
+
...receiptFragment
|
38021
|
+
}
|
37135
38022
|
}
|
37136
38023
|
... on FailureStatus {
|
37137
38024
|
block {
|
@@ -37139,26 +38026,24 @@ spurious results.`);
|
|
37139
38026
|
}
|
37140
38027
|
time
|
37141
38028
|
reason
|
38029
|
+
receipts {
|
38030
|
+
...receiptFragment
|
38031
|
+
}
|
37142
38032
|
}
|
37143
38033
|
... on SqueezedOutStatus {
|
37144
38034
|
reason
|
37145
38035
|
}
|
37146
38036
|
}
|
37147
|
-
`;
|
38037
|
+
${ReceiptFragmentFragmentDoc}`;
|
37148
38038
|
var TransactionFragmentFragmentDoc = lib_default2`
|
37149
38039
|
fragment transactionFragment on Transaction {
|
37150
38040
|
id
|
37151
38041
|
rawPayload
|
37152
|
-
gasPrice
|
37153
|
-
receipts {
|
37154
|
-
...receiptFragment
|
37155
|
-
}
|
37156
38042
|
status {
|
37157
38043
|
...transactionStatusFragment
|
37158
38044
|
}
|
37159
38045
|
}
|
37160
|
-
${
|
37161
|
-
${TransactionStatusFragmentFragmentDoc}`;
|
38046
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
37162
38047
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
37163
38048
|
fragment inputEstimatePredicatesFragment on Input {
|
37164
38049
|
... on InputCoin {
|
@@ -37176,6 +38061,46 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37176
38061
|
}
|
37177
38062
|
}
|
37178
38063
|
${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}`;
|
37179
38104
|
var CoinFragmentFragmentDoc = lib_default2`
|
37180
38105
|
fragment coinFragment on Coin {
|
37181
38106
|
__typename
|
@@ -37183,7 +38108,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37183
38108
|
owner
|
37184
38109
|
amount
|
37185
38110
|
assetId
|
37186
|
-
maturity
|
37187
38111
|
blockCreated
|
37188
38112
|
txCreatedIdx
|
37189
38113
|
}
|
@@ -37222,26 +38146,32 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37222
38146
|
messageBlockHeader {
|
37223
38147
|
id
|
37224
38148
|
daHeight
|
38149
|
+
consensusParametersVersion
|
38150
|
+
stateTransitionBytecodeVersion
|
37225
38151
|
transactionsCount
|
38152
|
+
messageReceiptCount
|
37226
38153
|
transactionsRoot
|
38154
|
+
messageOutboxRoot
|
38155
|
+
eventInboxRoot
|
37227
38156
|
height
|
37228
38157
|
prevRoot
|
37229
38158
|
time
|
37230
38159
|
applicationHash
|
37231
|
-
messageReceiptRoot
|
37232
|
-
messageReceiptCount
|
37233
38160
|
}
|
37234
38161
|
commitBlockHeader {
|
37235
38162
|
id
|
37236
38163
|
daHeight
|
38164
|
+
consensusParametersVersion
|
38165
|
+
stateTransitionBytecodeVersion
|
37237
38166
|
transactionsCount
|
38167
|
+
messageReceiptCount
|
37238
38168
|
transactionsRoot
|
38169
|
+
messageOutboxRoot
|
38170
|
+
eventInboxRoot
|
37239
38171
|
height
|
37240
38172
|
prevRoot
|
37241
38173
|
time
|
37242
38174
|
applicationHash
|
37243
|
-
messageReceiptRoot
|
37244
|
-
messageReceiptCount
|
37245
38175
|
}
|
37246
38176
|
sender
|
37247
38177
|
recipient
|
@@ -37260,8 +38190,8 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37260
38190
|
var BlockFragmentFragmentDoc = lib_default2`
|
37261
38191
|
fragment blockFragment on Block {
|
37262
38192
|
id
|
38193
|
+
height
|
37263
38194
|
header {
|
37264
|
-
height
|
37265
38195
|
time
|
37266
38196
|
}
|
37267
38197
|
transactions {
|
@@ -37271,6 +38201,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37271
38201
|
`;
|
37272
38202
|
var TxParametersFragmentFragmentDoc = lib_default2`
|
37273
38203
|
fragment TxParametersFragment on TxParameters {
|
38204
|
+
version
|
37274
38205
|
maxInputs
|
37275
38206
|
maxOutputs
|
37276
38207
|
maxWitnesses
|
@@ -37280,6 +38211,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37280
38211
|
`;
|
37281
38212
|
var PredicateParametersFragmentFragmentDoc = lib_default2`
|
37282
38213
|
fragment PredicateParametersFragment on PredicateParameters {
|
38214
|
+
version
|
37283
38215
|
maxPredicateLength
|
37284
38216
|
maxPredicateDataLength
|
37285
38217
|
maxGasPerPredicate
|
@@ -37288,18 +38220,21 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37288
38220
|
`;
|
37289
38221
|
var ScriptParametersFragmentFragmentDoc = lib_default2`
|
37290
38222
|
fragment ScriptParametersFragment on ScriptParameters {
|
38223
|
+
version
|
37291
38224
|
maxScriptLength
|
37292
38225
|
maxScriptDataLength
|
37293
38226
|
}
|
37294
38227
|
`;
|
37295
38228
|
var ContractParametersFragmentFragmentDoc = lib_default2`
|
37296
38229
|
fragment ContractParametersFragment on ContractParameters {
|
38230
|
+
version
|
37297
38231
|
contractMaxSize
|
37298
38232
|
maxStorageSlots
|
37299
38233
|
}
|
37300
38234
|
`;
|
37301
38235
|
var FeeParametersFragmentFragmentDoc = lib_default2`
|
37302
38236
|
fragment FeeParametersFragment on FeeParameters {
|
38237
|
+
version
|
37303
38238
|
gasPriceFactor
|
37304
38239
|
gasPerByte
|
37305
38240
|
}
|
@@ -37319,6 +38254,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37319
38254
|
`;
|
37320
38255
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
37321
38256
|
fragment GasCostsFragment on GasCosts {
|
38257
|
+
version
|
37322
38258
|
add
|
37323
38259
|
addi
|
37324
38260
|
aloc
|
@@ -37331,7 +38267,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37331
38267
|
cb
|
37332
38268
|
cfei
|
37333
38269
|
cfsi
|
37334
|
-
croo
|
37335
38270
|
div
|
37336
38271
|
divi
|
37337
38272
|
ecr1
|
@@ -37414,6 +38349,9 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37414
38349
|
ccp {
|
37415
38350
|
...DependentCostFragment
|
37416
38351
|
}
|
38352
|
+
croo {
|
38353
|
+
...DependentCostFragment
|
38354
|
+
}
|
37417
38355
|
csiz {
|
37418
38356
|
...DependentCostFragment
|
37419
38357
|
}
|
@@ -37473,6 +38411,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37473
38411
|
${DependentCostFragmentFragmentDoc}`;
|
37474
38412
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
37475
38413
|
fragment consensusParametersFragment on ConsensusParameters {
|
38414
|
+
version
|
37476
38415
|
txParams {
|
37477
38416
|
...TxParametersFragment
|
37478
38417
|
}
|
@@ -37532,18 +38471,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
37532
38471
|
fragment nodeInfoFragment on NodeInfo {
|
37533
38472
|
utxoValidation
|
37534
38473
|
vmBacktrace
|
37535
|
-
minGasPrice
|
37536
38474
|
maxTx
|
37537
38475
|
maxDepth
|
37538
38476
|
nodeVersion
|
37539
|
-
peers {
|
37540
|
-
id
|
37541
|
-
addresses
|
37542
|
-
clientVersion
|
37543
|
-
blockHeight
|
37544
|
-
lastHeartbeatMs
|
37545
|
-
appScore
|
37546
|
-
}
|
37547
38477
|
}
|
37548
38478
|
`;
|
37549
38479
|
var GetVersionDocument = lib_default2`
|
@@ -37578,13 +38508,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
37578
38508
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
37579
38509
|
transaction(id: $transactionId) {
|
37580
38510
|
...transactionFragment
|
37581
|
-
receipts {
|
37582
|
-
...receiptFragment
|
37583
|
-
}
|
37584
38511
|
}
|
37585
38512
|
}
|
37586
|
-
${TransactionFragmentFragmentDoc}
|
37587
|
-
${ReceiptFragmentFragmentDoc}`;
|
38513
|
+
${TransactionFragmentFragmentDoc}`;
|
37588
38514
|
var GetTransactionsDocument = lib_default2`
|
37589
38515
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
37590
38516
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -37712,6 +38638,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
37712
38638
|
}
|
37713
38639
|
}
|
37714
38640
|
${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
|
+
`;
|
37715
38655
|
var GetBalancesDocument = lib_default2`
|
37716
38656
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
37717
38657
|
balances(
|
@@ -37766,12 +38706,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
37766
38706
|
}
|
37767
38707
|
`;
|
37768
38708
|
var DryRunDocument = lib_default2`
|
37769
|
-
mutation dryRun($
|
37770
|
-
dryRun(
|
37771
|
-
...
|
38709
|
+
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
38710
|
+
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
38711
|
+
...dryRunTransactionExecutionStatusFragment
|
37772
38712
|
}
|
37773
38713
|
}
|
37774
|
-
${
|
38714
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
37775
38715
|
var SubmitDocument = lib_default2`
|
37776
38716
|
mutation submit($encodedTransaction: HexString!) {
|
37777
38717
|
submit(tx: $encodedTransaction) {
|
@@ -37790,17 +38730,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
37790
38730
|
var SubmitAndAwaitDocument = lib_default2`
|
37791
38731
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
37792
38732
|
submitAndAwait(tx: $encodedTransaction) {
|
37793
|
-
...
|
38733
|
+
...transactionStatusSubscriptionFragment
|
37794
38734
|
}
|
37795
38735
|
}
|
37796
|
-
${
|
38736
|
+
${TransactionStatusSubscriptionFragmentFragmentDoc}`;
|
37797
38737
|
var StatusChangeDocument = lib_default2`
|
37798
38738
|
subscription statusChange($transactionId: TransactionId!) {
|
37799
38739
|
statusChange(id: $transactionId) {
|
37800
|
-
...
|
38740
|
+
...transactionStatusSubscriptionFragment
|
37801
38741
|
}
|
37802
38742
|
}
|
37803
|
-
${
|
38743
|
+
${TransactionStatusSubscriptionFragmentFragmentDoc}`;
|
37804
38744
|
function getSdk(requester) {
|
37805
38745
|
return {
|
37806
38746
|
getVersion(variables, options) {
|
@@ -37854,6 +38794,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
37854
38794
|
getBalance(variables, options) {
|
37855
38795
|
return requester(GetBalanceDocument, variables, options);
|
37856
38796
|
},
|
38797
|
+
getLatestGasPrice(variables, options) {
|
38798
|
+
return requester(GetLatestGasPriceDocument, variables, options);
|
38799
|
+
},
|
38800
|
+
estimateGasPrice(variables, options) {
|
38801
|
+
return requester(EstimateGasPriceDocument, variables, options);
|
38802
|
+
},
|
37857
38803
|
getBalances(variables, options) {
|
37858
38804
|
return requester(GetBalancesDocument, variables, options);
|
37859
38805
|
},
|
@@ -38040,10 +38986,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38040
38986
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38041
38987
|
},
|
38042
38988
|
witnessIndex: value.witnessIndex,
|
38043
|
-
maturity: value.maturity ?? 0,
|
38044
38989
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38045
|
-
predicateLength: predicate.length,
|
38046
|
-
predicateDataLength: predicateData.length,
|
38990
|
+
predicateLength: bn(predicate.length),
|
38991
|
+
predicateDataLength: bn(predicateData.length),
|
38047
38992
|
predicate: hexlify(predicate),
|
38048
38993
|
predicateData: hexlify(predicateData)
|
38049
38994
|
};
|
@@ -38074,8 +39019,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38074
39019
|
nonce: hexlify(value.nonce),
|
38075
39020
|
witnessIndex: value.witnessIndex,
|
38076
39021
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38077
|
-
predicateLength: predicate.length,
|
38078
|
-
predicateDataLength: predicateData.length,
|
39022
|
+
predicateLength: bn(predicate.length),
|
39023
|
+
predicateDataLength: bn(predicateData.length),
|
38079
39024
|
predicate: hexlify(predicate),
|
38080
39025
|
predicateData: hexlify(predicateData),
|
38081
39026
|
data: hexlify(data),
|
@@ -38235,8 +39180,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38235
39180
|
case "CALL" /* Call */: {
|
38236
39181
|
const callReceipt = {
|
38237
39182
|
type: ReceiptType.Call,
|
38238
|
-
from: hexOrZero(receipt.
|
38239
|
-
to: hexOrZero(receipt?.to
|
39183
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39184
|
+
to: hexOrZero(receipt?.to),
|
38240
39185
|
amount: bn(receipt.amount),
|
38241
39186
|
assetId: hexOrZero(receipt.assetId),
|
38242
39187
|
gas: bn(receipt.gas),
|
@@ -38250,7 +39195,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38250
39195
|
case "RETURN" /* Return */: {
|
38251
39196
|
const returnReceipt = {
|
38252
39197
|
type: ReceiptType.Return,
|
38253
|
-
id: hexOrZero(receipt.
|
39198
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
38254
39199
|
val: bn(receipt.val),
|
38255
39200
|
pc: bn(receipt.pc),
|
38256
39201
|
is: bn(receipt.is)
|
@@ -38260,7 +39205,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38260
39205
|
case "RETURN_DATA" /* ReturnData */: {
|
38261
39206
|
const returnDataReceipt = {
|
38262
39207
|
type: ReceiptType.ReturnData,
|
38263
|
-
id: hexOrZero(receipt.
|
39208
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
38264
39209
|
ptr: bn(receipt.ptr),
|
38265
39210
|
len: bn(receipt.len),
|
38266
39211
|
digest: hexOrZero(receipt.digest),
|
@@ -38272,7 +39217,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38272
39217
|
case "PANIC" /* Panic */: {
|
38273
39218
|
const panicReceipt = {
|
38274
39219
|
type: ReceiptType.Panic,
|
38275
|
-
id: hexOrZero(receipt.
|
39220
|
+
id: hexOrZero(receipt.id),
|
38276
39221
|
reason: bn(receipt.reason),
|
38277
39222
|
pc: bn(receipt.pc),
|
38278
39223
|
is: bn(receipt.is),
|
@@ -38283,7 +39228,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38283
39228
|
case "REVERT" /* Revert */: {
|
38284
39229
|
const revertReceipt = {
|
38285
39230
|
type: ReceiptType.Revert,
|
38286
|
-
id: hexOrZero(receipt.
|
39231
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
38287
39232
|
val: bn(receipt.ra),
|
38288
39233
|
pc: bn(receipt.pc),
|
38289
39234
|
is: bn(receipt.is)
|
@@ -38293,7 +39238,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38293
39238
|
case "LOG" /* Log */: {
|
38294
39239
|
const logReceipt = {
|
38295
39240
|
type: ReceiptType.Log,
|
38296
|
-
id: hexOrZero(receipt.
|
39241
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
38297
39242
|
val0: bn(receipt.ra),
|
38298
39243
|
val1: bn(receipt.rb),
|
38299
39244
|
val2: bn(receipt.rc),
|
@@ -38306,7 +39251,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38306
39251
|
case "LOG_DATA" /* LogData */: {
|
38307
39252
|
const logDataReceipt = {
|
38308
39253
|
type: ReceiptType.LogData,
|
38309
|
-
id: hexOrZero(receipt.
|
39254
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
38310
39255
|
val0: bn(receipt.ra),
|
38311
39256
|
val1: bn(receipt.rb),
|
38312
39257
|
ptr: bn(receipt.ptr),
|
@@ -38320,8 +39265,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38320
39265
|
case "TRANSFER" /* Transfer */: {
|
38321
39266
|
const transferReceipt = {
|
38322
39267
|
type: ReceiptType.Transfer,
|
38323
|
-
from: hexOrZero(receipt.
|
38324
|
-
to: hexOrZero(receipt.toAddress || receipt?.to
|
39268
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39269
|
+
to: hexOrZero(receipt.toAddress || receipt?.to),
|
38325
39270
|
amount: bn(receipt.amount),
|
38326
39271
|
assetId: hexOrZero(receipt.assetId),
|
38327
39272
|
pc: bn(receipt.pc),
|
@@ -38332,8 +39277,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38332
39277
|
case "TRANSFER_OUT" /* TransferOut */: {
|
38333
39278
|
const transferOutReceipt = {
|
38334
39279
|
type: ReceiptType.TransferOut,
|
38335
|
-
from: hexOrZero(receipt.
|
38336
|
-
to: hexOrZero(receipt.toAddress || receipt.to
|
39280
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39281
|
+
to: hexOrZero(receipt.toAddress || receipt.to),
|
38337
39282
|
amount: bn(receipt.amount),
|
38338
39283
|
assetId: hexOrZero(receipt.assetId),
|
38339
39284
|
pc: bn(receipt.pc),
|
@@ -38376,7 +39321,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38376
39321
|
return receiptMessageOut;
|
38377
39322
|
}
|
38378
39323
|
case "MINT" /* Mint */: {
|
38379
|
-
const contractId = hexOrZero(receipt.
|
39324
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
38380
39325
|
const subId = hexOrZero(receipt.subId);
|
38381
39326
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
38382
39327
|
const mintReceipt = {
|
@@ -38391,7 +39336,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38391
39336
|
return mintReceipt;
|
38392
39337
|
}
|
38393
39338
|
case "BURN" /* Burn */: {
|
38394
|
-
const contractId = hexOrZero(receipt.
|
39339
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
38395
39340
|
const subId = hexOrZero(receipt.subId);
|
38396
39341
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
38397
39342
|
const burnReceipt = {
|
@@ -38472,7 +39417,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38472
39417
|
};
|
38473
39418
|
|
38474
39419
|
// src/providers/utils/gas.ts
|
38475
|
-
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
38476
39420
|
var getGasUsedFromReceipts = (receipts) => {
|
38477
39421
|
const scriptResult = receipts.filter(
|
38478
39422
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -38493,18 +39437,28 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38493
39437
|
}
|
38494
39438
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
38495
39439
|
const witnessCache = [];
|
38496
|
-
const
|
39440
|
+
const chargeableInputs = inputs.filter((input) => {
|
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) => {
|
38497
39455
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
38498
39456
|
return total.add(
|
38499
|
-
|
39457
|
+
vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
38500
39458
|
);
|
38501
39459
|
}
|
38502
|
-
|
38503
|
-
|
38504
|
-
return total.add(gasCosts.ecr1);
|
38505
|
-
}
|
38506
|
-
return total;
|
38507
|
-
}, bn());
|
39460
|
+
return total.add(gasCosts.ecr1);
|
39461
|
+
}, bn(0));
|
38508
39462
|
return totalGas;
|
38509
39463
|
}
|
38510
39464
|
function getMinGas(params) {
|
@@ -38516,12 +39470,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38516
39470
|
return minGas;
|
38517
39471
|
}
|
38518
39472
|
function getMaxGas(params) {
|
38519
|
-
const {
|
39473
|
+
const {
|
39474
|
+
gasPerByte,
|
39475
|
+
witnessesLength,
|
39476
|
+
witnessLimit,
|
39477
|
+
minGas,
|
39478
|
+
gasLimit = bn(0),
|
39479
|
+
maxGasPerTx
|
39480
|
+
} = params;
|
38520
39481
|
let remainingAllowedWitnessGas = bn(0);
|
38521
39482
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
38522
39483
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
38523
39484
|
}
|
38524
|
-
|
39485
|
+
const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39486
|
+
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
38525
39487
|
}
|
38526
39488
|
function calculateMetadataGasForTxCreate({
|
38527
39489
|
gasCosts,
|
@@ -38543,6 +39505,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38543
39505
|
}) {
|
38544
39506
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
38545
39507
|
}
|
39508
|
+
var calculateGasFee = (params) => {
|
39509
|
+
const { gas, gasPrice, priceFactor, tip } = params;
|
39510
|
+
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39511
|
+
};
|
38546
39512
|
|
38547
39513
|
// src/providers/utils/json.ts
|
38548
39514
|
function normalize2(object) {
|
@@ -38684,7 +39650,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38684
39650
|
// src/providers/transaction-request/transaction-request.ts
|
38685
39651
|
var BaseTransactionRequest = class {
|
38686
39652
|
/** Gas price for transaction */
|
38687
|
-
|
39653
|
+
tip;
|
38688
39654
|
/** Block until which tx cannot be included */
|
38689
39655
|
maturity;
|
38690
39656
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -38703,7 +39669,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38703
39669
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
38704
39670
|
*/
|
38705
39671
|
constructor({
|
38706
|
-
|
39672
|
+
tip,
|
38707
39673
|
maturity,
|
38708
39674
|
maxFee,
|
38709
39675
|
witnessLimit,
|
@@ -38711,7 +39677,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38711
39677
|
outputs,
|
38712
39678
|
witnesses
|
38713
39679
|
} = {}) {
|
38714
|
-
this.
|
39680
|
+
this.tip = bn(tip);
|
38715
39681
|
this.maturity = maturity ?? 0;
|
38716
39682
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
38717
39683
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -38722,9 +39688,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38722
39688
|
static getPolicyMeta(req) {
|
38723
39689
|
let policyTypes = 0;
|
38724
39690
|
const policies = [];
|
38725
|
-
if (req.
|
38726
|
-
policyTypes += PolicyType.
|
38727
|
-
policies.push({ data: req.
|
39691
|
+
if (req.tip) {
|
39692
|
+
policyTypes += PolicyType.Tip;
|
39693
|
+
policies.push({ data: req.tip, type: PolicyType.Tip });
|
38728
39694
|
}
|
38729
39695
|
if (req.witnessLimit) {
|
38730
39696
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -38908,13 +39874,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38908
39874
|
* assetId, if one it was not added yet.
|
38909
39875
|
*
|
38910
39876
|
* @param coin - Coin resource.
|
38911
|
-
* @param predicate - Predicate bytes.
|
38912
|
-
* @param predicateData - Predicate data bytes.
|
38913
39877
|
*/
|
38914
|
-
addCoinInput(coin
|
39878
|
+
addCoinInput(coin) {
|
38915
39879
|
const { assetId, owner, amount } = coin;
|
38916
39880
|
let witnessIndex;
|
38917
|
-
if (predicate) {
|
39881
|
+
if (coin.predicate) {
|
38918
39882
|
witnessIndex = 0;
|
38919
39883
|
} else {
|
38920
39884
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -38929,8 +39893,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38929
39893
|
amount,
|
38930
39894
|
assetId,
|
38931
39895
|
txPointer: "0x00000000000000000000000000000000",
|
38932
|
-
witnessIndex
|
38933
|
-
predicate: predicate?.bytes
|
39896
|
+
witnessIndex
|
38934
39897
|
};
|
38935
39898
|
this.pushInput(input);
|
38936
39899
|
this.addChangeOutput(owner, assetId);
|
@@ -38940,12 +39903,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38940
39903
|
* asset against the message
|
38941
39904
|
*
|
38942
39905
|
* @param message - Message resource.
|
38943
|
-
* @param predicate - Predicate bytes.
|
38944
39906
|
*/
|
38945
|
-
addMessageInput(message
|
39907
|
+
addMessageInput(message) {
|
38946
39908
|
const { recipient, sender, amount, assetId } = message;
|
38947
39909
|
let witnessIndex;
|
38948
|
-
if (predicate) {
|
39910
|
+
if (message.predicate) {
|
38949
39911
|
witnessIndex = 0;
|
38950
39912
|
} else {
|
38951
39913
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -38959,8 +39921,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38959
39921
|
sender: sender.toB256(),
|
38960
39922
|
recipient: recipient.toB256(),
|
38961
39923
|
amount,
|
38962
|
-
witnessIndex
|
38963
|
-
predicate: predicate?.bytes
|
39924
|
+
witnessIndex
|
38964
39925
|
};
|
38965
39926
|
this.pushInput(input);
|
38966
39927
|
this.addChangeOutput(recipient, assetId);
|
@@ -38991,32 +39952,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
38991
39952
|
resources.forEach((resource) => this.addResource(resource));
|
38992
39953
|
return this;
|
38993
39954
|
}
|
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
|
-
}
|
39020
39955
|
/**
|
39021
39956
|
* Adds a coin output to the transaction.
|
39022
39957
|
*
|
@@ -39096,7 +40031,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39096
40031
|
}
|
39097
40032
|
calculateMaxGas(chainInfo, minGas) {
|
39098
40033
|
const { consensusParameters } = chainInfo;
|
39099
|
-
const { gasPerByte } = consensusParameters;
|
40034
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
39100
40035
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
39101
40036
|
(acc, wit) => acc + wit.dataLength,
|
39102
40037
|
0
|
@@ -39105,7 +40040,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39105
40040
|
gasPerByte,
|
39106
40041
|
minGas,
|
39107
40042
|
witnessesLength,
|
39108
|
-
witnessLimit: this.witnessLimit
|
40043
|
+
witnessLimit: this.witnessLimit,
|
40044
|
+
maxGasPerTx
|
39109
40045
|
});
|
39110
40046
|
}
|
39111
40047
|
/**
|
@@ -39124,17 +40060,20 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39124
40060
|
});
|
39125
40061
|
const updateAssetInput = (assetId, quantity) => {
|
39126
40062
|
const assetInput = findAssetInput(assetId);
|
40063
|
+
let usedQuantity = quantity;
|
40064
|
+
if (assetId === baseAssetId) {
|
40065
|
+
usedQuantity = bn("1000000000000000000");
|
40066
|
+
}
|
39127
40067
|
if (assetInput && "assetId" in assetInput) {
|
39128
40068
|
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
39129
|
-
assetInput.amount =
|
40069
|
+
assetInput.amount = usedQuantity;
|
39130
40070
|
} else {
|
39131
40071
|
this.addResources([
|
39132
40072
|
{
|
39133
40073
|
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
39134
|
-
amount:
|
40074
|
+
amount: usedQuantity,
|
39135
40075
|
assetId,
|
39136
40076
|
owner: resourcesOwner || Address.fromRandom(),
|
39137
|
-
maturity: 0,
|
39138
40077
|
blockCreated: bn(1),
|
39139
40078
|
txCreatedIdx: bn(1)
|
39140
40079
|
}
|
@@ -39166,7 +40105,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39166
40105
|
toJSON() {
|
39167
40106
|
return normalizeJSON(this);
|
39168
40107
|
}
|
39169
|
-
|
40108
|
+
updatePredicateGasUsed(inputs) {
|
39170
40109
|
this.inputs.forEach((i) => {
|
39171
40110
|
let correspondingInput;
|
39172
40111
|
switch (i.type) {
|
@@ -39188,6 +40127,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39188
40127
|
}
|
39189
40128
|
});
|
39190
40129
|
}
|
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
|
+
}
|
39191
40139
|
};
|
39192
40140
|
|
39193
40141
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -39316,9 +40264,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39316
40264
|
return {
|
39317
40265
|
type: TransactionType.Create,
|
39318
40266
|
...baseTransaction,
|
39319
|
-
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
39320
40267
|
bytecodeWitnessIndex,
|
39321
|
-
storageSlotsCount: storageSlots.length,
|
40268
|
+
storageSlotsCount: bn(storageSlots.length),
|
39322
40269
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
39323
40270
|
storageSlots
|
39324
40271
|
};
|
@@ -39432,8 +40379,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39432
40379
|
type: TransactionType.Script,
|
39433
40380
|
scriptGasLimit: this.gasLimit,
|
39434
40381
|
...super.getBaseTransaction(),
|
39435
|
-
scriptLength: script.length,
|
39436
|
-
scriptDataLength: scriptData.length,
|
40382
|
+
scriptLength: bn(script.length),
|
40383
|
+
scriptDataLength: bn(scriptData.length),
|
39437
40384
|
receiptsRoot: ZeroBytes32,
|
39438
40385
|
script: hexlify(script),
|
39439
40386
|
scriptData: hexlify(scriptData)
|
@@ -39497,7 +40444,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39497
40444
|
}
|
39498
40445
|
calculateMaxGas(chainInfo, minGas) {
|
39499
40446
|
const { consensusParameters } = chainInfo;
|
39500
|
-
const { gasPerByte } = consensusParameters;
|
40447
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
39501
40448
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
39502
40449
|
(acc, wit) => acc + wit.dataLength,
|
39503
40450
|
0
|
@@ -39507,7 +40454,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39507
40454
|
minGas,
|
39508
40455
|
witnessesLength,
|
39509
40456
|
witnessLimit: this.witnessLimit,
|
39510
|
-
gasLimit: this.gasLimit
|
40457
|
+
gasLimit: this.gasLimit,
|
40458
|
+
maxGasPerTx
|
39511
40459
|
});
|
39512
40460
|
}
|
39513
40461
|
/**
|
@@ -39580,13 +40528,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39580
40528
|
}
|
39581
40529
|
}
|
39582
40530
|
};
|
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
|
+
);
|
39583
40546
|
|
39584
40547
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
39585
40548
|
var calculateTransactionFee = (params) => {
|
39586
40549
|
const {
|
39587
|
-
|
40550
|
+
gasPrice,
|
39588
40551
|
rawPayload,
|
39589
|
-
|
40552
|
+
tip,
|
40553
|
+
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
39590
40554
|
} = params;
|
39591
40555
|
const gasPerByte = bn(feeParams.gasPerByte);
|
39592
40556
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -39596,8 +40560,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39596
40560
|
return {
|
39597
40561
|
fee: bn(0),
|
39598
40562
|
minFee: bn(0),
|
39599
|
-
maxFee: bn(0)
|
39600
|
-
feeFromGasUsed: bn(0)
|
40563
|
+
maxFee: bn(0)
|
39601
40564
|
};
|
39602
40565
|
}
|
39603
40566
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -39629,7 +40592,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39629
40592
|
metadataGas,
|
39630
40593
|
txBytesSize: transactionBytes.length
|
39631
40594
|
});
|
39632
|
-
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
39633
40595
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
39634
40596
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
39635
40597
|
const maxGas = getMaxGas({
|
@@ -39637,17 +40599,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39637
40599
|
minGas,
|
39638
40600
|
witnessesLength,
|
39639
40601
|
gasLimit,
|
39640
|
-
witnessLimit
|
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
|
39641
40616
|
});
|
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);
|
39646
40617
|
return {
|
39647
|
-
fee,
|
39648
40618
|
minFee,
|
39649
40619
|
maxFee,
|
39650
|
-
|
40620
|
+
fee: maxFee
|
39651
40621
|
};
|
39652
40622
|
};
|
39653
40623
|
|
@@ -40248,7 +41218,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40248
41218
|
gqlTransactionStatus,
|
40249
41219
|
abiMap = {},
|
40250
41220
|
maxInputs,
|
40251
|
-
gasCosts
|
41221
|
+
gasCosts,
|
41222
|
+
maxGasPerTx,
|
41223
|
+
gasPrice
|
40252
41224
|
} = params;
|
40253
41225
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
40254
41226
|
const rawPayload = hexlify(transactionBytes);
|
@@ -40262,11 +41234,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40262
41234
|
maxInputs
|
40263
41235
|
});
|
40264
41236
|
const typeName = getTransactionTypeName(transaction.type);
|
41237
|
+
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
40265
41238
|
const { fee } = calculateTransactionFee({
|
40266
|
-
|
41239
|
+
gasPrice,
|
40267
41240
|
rawPayload,
|
41241
|
+
tip,
|
40268
41242
|
consensusParameters: {
|
40269
41243
|
gasCosts,
|
41244
|
+
maxGasPerTx,
|
40270
41245
|
feeParams: {
|
40271
41246
|
gasPerByte,
|
40272
41247
|
gasPriceFactor
|
@@ -40318,7 +41293,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40318
41293
|
}
|
40319
41294
|
|
40320
41295
|
// src/providers/transaction-response/transaction-response.ts
|
40321
|
-
var
|
41296
|
+
var TransactionResponse2 = class {
|
40322
41297
|
/** Transaction ID */
|
40323
41298
|
id;
|
40324
41299
|
/** Current provider */
|
@@ -40348,7 +41323,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40348
41323
|
* @param provider - The provider.
|
40349
41324
|
*/
|
40350
41325
|
static async create(id, provider, abis) {
|
40351
|
-
const response = new
|
41326
|
+
const response = new TransactionResponse2(id, provider, abis);
|
40352
41327
|
await response.fetch();
|
40353
41328
|
return response;
|
40354
41329
|
}
|
@@ -40402,8 +41377,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40402
41377
|
const decodedTransaction = this.decodeTransaction(
|
40403
41378
|
transaction
|
40404
41379
|
);
|
40405
|
-
|
40406
|
-
|
41380
|
+
let txReceipts = [];
|
41381
|
+
if (transaction?.status && "receipts" in transaction.status) {
|
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();
|
40407
41387
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
40408
41388
|
const transactionSummary = assembleTransactionSummary({
|
40409
41389
|
id: this.id,
|
@@ -40415,7 +41395,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40415
41395
|
gasPriceFactor,
|
40416
41396
|
abiMap: contractsAbiMap,
|
40417
41397
|
maxInputs,
|
40418
|
-
gasCosts
|
41398
|
+
gasCosts,
|
41399
|
+
maxGasPerTx,
|
41400
|
+
gasPrice
|
40419
41401
|
});
|
40420
41402
|
return transactionSummary;
|
40421
41403
|
}
|
@@ -40564,7 +41546,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40564
41546
|
gasCosts,
|
40565
41547
|
latestBlock: {
|
40566
41548
|
id: latestBlock.id,
|
40567
|
-
height: bn(latestBlock.
|
41549
|
+
height: bn(latestBlock.height),
|
40568
41550
|
time: latestBlock.header.time,
|
40569
41551
|
transactions: latestBlock.transactions.map((i) => ({
|
40570
41552
|
id: i.id
|
@@ -40658,10 +41640,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40658
41640
|
* Returns some helpful parameters related to gas fees.
|
40659
41641
|
*/
|
40660
41642
|
getGasConfig() {
|
40661
|
-
const { minGasPrice } = this.getNode();
|
40662
41643
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
40663
41644
|
return {
|
40664
|
-
minGasPrice,
|
40665
41645
|
maxGasPerTx,
|
40666
41646
|
maxGasPerPredicate,
|
40667
41647
|
gasPriceFactor,
|
@@ -40737,6 +41717,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40737
41717
|
} = await this.operations.getVersion();
|
40738
41718
|
return nodeVersion;
|
40739
41719
|
}
|
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
|
+
}
|
40740
41735
|
/**
|
40741
41736
|
* Returns the block number.
|
40742
41737
|
*
|
@@ -40744,7 +41739,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40744
41739
|
*/
|
40745
41740
|
async getBlockNumber() {
|
40746
41741
|
const { chain } = await this.operations.getChain();
|
40747
|
-
return bn(chain.latestBlock.
|
41742
|
+
return bn(chain.latestBlock.height, 10);
|
40748
41743
|
}
|
40749
41744
|
/**
|
40750
41745
|
* Returns the chain information.
|
@@ -40756,11 +41751,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40756
41751
|
const processedNodeInfo = {
|
40757
41752
|
maxDepth: bn(nodeInfo.maxDepth),
|
40758
41753
|
maxTx: bn(nodeInfo.maxTx),
|
40759
|
-
minGasPrice: bn(nodeInfo.minGasPrice),
|
40760
41754
|
nodeVersion: nodeInfo.nodeVersion,
|
40761
41755
|
utxoValidation: nodeInfo.utxoValidation,
|
40762
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
40763
|
-
peers: nodeInfo.peers
|
41756
|
+
vmBacktrace: nodeInfo.vmBacktrace
|
40764
41757
|
};
|
40765
41758
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
40766
41759
|
return processedNodeInfo;
|
@@ -40832,14 +41825,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40832
41825
|
}
|
40833
41826
|
}
|
40834
41827
|
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
40835
|
-
const response = new
|
41828
|
+
const response = new TransactionResponse2(transactionId2, this, abis);
|
40836
41829
|
await response.fetch();
|
40837
41830
|
return response;
|
40838
41831
|
}
|
40839
41832
|
const {
|
40840
41833
|
submit: { id: transactionId }
|
40841
41834
|
} = await this.operations.submit({ encodedTransaction });
|
40842
|
-
return new
|
41835
|
+
return new TransactionResponse2(transactionId, this, abis);
|
40843
41836
|
}
|
40844
41837
|
/**
|
40845
41838
|
* Executes a transaction without actually submitting it to the chain.
|
@@ -40857,14 +41850,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40857
41850
|
return this.estimateTxDependencies(transactionRequest);
|
40858
41851
|
}
|
40859
41852
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
40860
|
-
const { dryRun:
|
40861
|
-
encodedTransaction,
|
41853
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41854
|
+
encodedTransactions: encodedTransaction,
|
40862
41855
|
utxoValidation: utxoValidation || false
|
40863
41856
|
});
|
40864
|
-
const receipts =
|
40865
|
-
|
40866
|
-
|
40867
|
-
};
|
41857
|
+
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
41858
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41859
|
+
return { receipts, dryrunStatus: status };
|
40868
41860
|
}
|
40869
41861
|
/**
|
40870
41862
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -40903,9 +41895,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40903
41895
|
* If there are missing variable outputs,
|
40904
41896
|
* `addVariableOutputs` is called on the transaction.
|
40905
41897
|
*
|
40906
|
-
* @privateRemarks
|
40907
|
-
* TODO: Investigate support for missing contract IDs
|
40908
|
-
* TODO: Add support for missing output messages
|
40909
41898
|
*
|
40910
41899
|
* @param transactionRequest - The transaction request object.
|
40911
41900
|
* @returns A promise.
|
@@ -40918,16 +41907,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40918
41907
|
missingContractIds: []
|
40919
41908
|
};
|
40920
41909
|
}
|
40921
|
-
await this.estimatePredicates(transactionRequest);
|
40922
41910
|
let receipts = [];
|
40923
41911
|
const missingContractIds = [];
|
40924
41912
|
let outputVariables = 0;
|
41913
|
+
let dryrunStatus;
|
40925
41914
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
40926
|
-
const {
|
40927
|
-
|
41915
|
+
const {
|
41916
|
+
dryRun: [{ receipts: rawReceipts, status }]
|
41917
|
+
} = await this.operations.dryRun({
|
41918
|
+
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
40928
41919
|
utxoValidation: false
|
40929
41920
|
});
|
40930
|
-
receipts =
|
41921
|
+
receipts = rawReceipts.map(processGqlReceipt);
|
41922
|
+
dryrunStatus = status;
|
40931
41923
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
40932
41924
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
40933
41925
|
if (hasMissingOutputs) {
|
@@ -40937,6 +41929,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40937
41929
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
40938
41930
|
missingContractIds.push(contractId);
|
40939
41931
|
});
|
41932
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41933
|
+
transactionRequest
|
41934
|
+
});
|
41935
|
+
transactionRequest.maxFee = maxFee;
|
40940
41936
|
} else {
|
40941
41937
|
break;
|
40942
41938
|
}
|
@@ -40944,37 +41940,136 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40944
41940
|
return {
|
40945
41941
|
receipts,
|
40946
41942
|
outputVariables,
|
40947
|
-
missingContractIds
|
41943
|
+
missingContractIds,
|
41944
|
+
dryrunStatus
|
40948
41945
|
};
|
40949
41946
|
}
|
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
|
+
}
|
40950
42028
|
/**
|
40951
42029
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
40952
42030
|
* @param transactionRequest - The transaction request object.
|
40953
42031
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
40954
42032
|
*/
|
40955
|
-
estimateTxGasAndFee(params) {
|
42033
|
+
async estimateTxGasAndFee(params) {
|
40956
42034
|
const { transactionRequest } = params;
|
40957
|
-
|
42035
|
+
let { gasPrice } = params;
|
40958
42036
|
const chainInfo = this.getChain();
|
40959
|
-
const
|
40960
|
-
transactionRequest.gasPrice = gasPrice;
|
42037
|
+
const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
|
40961
42038
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
40962
|
-
|
42039
|
+
if (!gasPrice) {
|
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);
|
40963
42049
|
if (transactionRequest.type === TransactionType.Script) {
|
42050
|
+
gasLimit = transactionRequest.gasLimit;
|
40964
42051
|
if (transactionRequest.gasLimit.eq(0)) {
|
40965
42052
|
transactionRequest.gasLimit = minGas;
|
40966
42053
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
40967
42054
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
40968
42055
|
);
|
42056
|
+
gasLimit = transactionRequest.gasLimit;
|
40969
42057
|
}
|
40970
42058
|
}
|
40971
42059
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
40972
|
-
const maxFee =
|
42060
|
+
const maxFee = calculateGasFee({
|
42061
|
+
gasPrice: bn(gasPrice),
|
42062
|
+
gas: maxGas,
|
42063
|
+
priceFactor: gasPriceFactor,
|
42064
|
+
tip: transactionRequest.tip
|
42065
|
+
}).add(1);
|
40973
42066
|
return {
|
40974
42067
|
minGas,
|
40975
42068
|
minFee,
|
40976
42069
|
maxGas,
|
40977
|
-
maxFee
|
42070
|
+
maxFee,
|
42071
|
+
gasPrice,
|
42072
|
+
gasLimit
|
40978
42073
|
};
|
40979
42074
|
}
|
40980
42075
|
/**
|
@@ -40992,15 +42087,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40992
42087
|
if (estimateTxDependencies) {
|
40993
42088
|
return this.estimateTxDependencies(transactionRequest);
|
40994
42089
|
}
|
40995
|
-
const
|
40996
|
-
const { dryRun:
|
40997
|
-
|
42090
|
+
const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
|
42091
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42092
|
+
encodedTransactions,
|
40998
42093
|
utxoValidation: true
|
40999
42094
|
});
|
41000
|
-
const
|
41001
|
-
|
41002
|
-
receipts
|
41003
|
-
|
42095
|
+
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
42096
|
+
const { id, receipts, status } = dryRunStatus;
|
42097
|
+
const processedReceipts = receipts.map(processGqlReceipt);
|
42098
|
+
return { id, receipts: processedReceipts, status };
|
42099
|
+
});
|
42100
|
+
return { receipts: callResult[0].receipts };
|
41004
42101
|
}
|
41005
42102
|
/**
|
41006
42103
|
* Returns a transaction cost to enable user
|
@@ -41017,78 +42114,80 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41017
42114
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
41018
42115
|
* @returns A promise that resolves to the transaction cost object.
|
41019
42116
|
*/
|
41020
|
-
async getTransactionCost(transactionRequestLike,
|
41021
|
-
estimateTxDependencies = true,
|
41022
|
-
estimatePredicates = true,
|
41023
|
-
resourcesOwner,
|
41024
|
-
signatureCallback
|
41025
|
-
} = {}) {
|
42117
|
+
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
41026
42118
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41027
|
-
const { minGasPrice } = this.getGasConfig();
|
41028
|
-
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
41029
42119
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
41030
42120
|
const baseAssetId = this.getBaseAssetId();
|
41031
42121
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
41032
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
42122
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
41033
42123
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
42124
|
+
txRequestClone.maxFee = bn(0);
|
41034
42125
|
if (isScriptTransaction) {
|
41035
42126
|
txRequestClone.gasLimit = bn(0);
|
41036
42127
|
}
|
41037
|
-
if (
|
41038
|
-
|
41039
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41040
|
-
}
|
41041
|
-
await this.estimatePredicates(txRequestClone);
|
42128
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
42129
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41042
42130
|
}
|
42131
|
+
const signedRequest = clone_default(txRequestClone);
|
42132
|
+
let addedSignatures = 0;
|
41043
42133
|
if (signatureCallback && isScriptTransaction) {
|
41044
|
-
|
42134
|
+
const lengthBefore = signedRequest.witnesses.length;
|
42135
|
+
await signatureCallback(signedRequest);
|
42136
|
+
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41045
42137
|
}
|
41046
|
-
|
41047
|
-
|
42138
|
+
await this.estimatePredicates(signedRequest);
|
42139
|
+
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
42140
|
+
transactionRequest: signedRequest
|
41048
42141
|
});
|
41049
42142
|
let receipts = [];
|
41050
42143
|
let missingContractIds = [];
|
41051
42144
|
let outputVariables = 0;
|
41052
42145
|
let gasUsed = bn(0);
|
41053
|
-
|
41054
|
-
|
42146
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
42147
|
+
txRequestClone.maxFee = maxFee;
|
42148
|
+
if (isScriptTransaction) {
|
42149
|
+
txRequestClone.gasLimit = gasLimit;
|
42150
|
+
if (signatureCallback) {
|
42151
|
+
await signatureCallback(txRequestClone);
|
42152
|
+
}
|
41055
42153
|
const result = await this.estimateTxDependencies(txRequestClone);
|
41056
42154
|
receipts = result.receipts;
|
41057
42155
|
outputVariables = result.outputVariables;
|
41058
42156
|
missingContractIds = result.missingContractIds;
|
41059
42157
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
41060
42158
|
txRequestClone.gasLimit = gasUsed;
|
41061
|
-
|
41062
|
-
|
41063
|
-
|
42159
|
+
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
42160
|
+
transactionRequest: txRequestClone,
|
42161
|
+
gasPrice
|
41064
42162
|
}));
|
41065
42163
|
}
|
41066
42164
|
return {
|
41067
42165
|
requiredQuantities: allQuantities,
|
41068
42166
|
receipts,
|
41069
42167
|
gasUsed,
|
41070
|
-
|
41071
|
-
gasPrice: setGasPrice,
|
42168
|
+
gasPrice,
|
41072
42169
|
minGas,
|
41073
42170
|
maxGas,
|
41074
42171
|
minFee,
|
41075
42172
|
maxFee,
|
41076
|
-
estimatedInputs: txRequestClone.inputs,
|
41077
42173
|
outputVariables,
|
41078
|
-
missingContractIds
|
42174
|
+
missingContractIds,
|
42175
|
+
addedSignatures,
|
42176
|
+
estimatedPredicates: txRequestClone.inputs
|
41079
42177
|
};
|
41080
42178
|
}
|
41081
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
42179
|
+
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
41082
42180
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41083
42181
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
41084
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42182
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
42183
|
+
quantitiesToContract
|
42184
|
+
});
|
41085
42185
|
transactionRequest.addResources(
|
41086
42186
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
41087
42187
|
);
|
41088
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41089
|
-
|
41090
|
-
|
41091
|
-
);
|
42188
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
42189
|
+
quantitiesToContract
|
42190
|
+
});
|
41092
42191
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
41093
42192
|
return {
|
41094
42193
|
resources,
|
@@ -41112,7 +42211,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41112
42211
|
assetId: coin.assetId,
|
41113
42212
|
amount: bn(coin.amount),
|
41114
42213
|
owner: Address.fromAddressOrString(coin.owner),
|
41115
|
-
maturity: bn(coin.maturity).toNumber(),
|
41116
42214
|
blockCreated: bn(coin.blockCreated),
|
41117
42215
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41118
42216
|
}));
|
@@ -41164,7 +42262,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41164
42262
|
amount: bn(coin.amount),
|
41165
42263
|
assetId: coin.assetId,
|
41166
42264
|
owner: Address.fromAddressOrString(coin.owner),
|
41167
|
-
maturity: bn(coin.maturity).toNumber(),
|
41168
42265
|
blockCreated: bn(coin.blockCreated),
|
41169
42266
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41170
42267
|
};
|
@@ -41197,7 +42294,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41197
42294
|
}
|
41198
42295
|
return {
|
41199
42296
|
id: block2.id,
|
41200
|
-
height: bn(block2.
|
42297
|
+
height: bn(block2.height),
|
41201
42298
|
time: block2.header.time,
|
41202
42299
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
41203
42300
|
};
|
@@ -41212,7 +42309,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41212
42309
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
41213
42310
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
41214
42311
|
id: block2.id,
|
41215
|
-
height: bn(block2.
|
42312
|
+
height: bn(block2.height),
|
41216
42313
|
time: block2.header.time,
|
41217
42314
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
41218
42315
|
}));
|
@@ -41239,7 +42336,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41239
42336
|
}
|
41240
42337
|
return {
|
41241
42338
|
id: block2.id,
|
41242
|
-
height: bn(block2.
|
42339
|
+
height: bn(block2.height, 10),
|
41243
42340
|
time: block2.header.time,
|
41244
42341
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
41245
42342
|
transactions: block2.transactions.map(
|
@@ -41419,8 +42516,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41419
42516
|
prevRoot: messageBlockHeader.prevRoot,
|
41420
42517
|
time: messageBlockHeader.time,
|
41421
42518
|
applicationHash: messageBlockHeader.applicationHash,
|
41422
|
-
|
41423
|
-
|
42519
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount),
|
42520
|
+
messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
|
42521
|
+
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42522
|
+
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42523
|
+
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
41424
42524
|
},
|
41425
42525
|
commitBlockHeader: {
|
41426
42526
|
id: commitBlockHeader.id,
|
@@ -41431,8 +42531,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41431
42531
|
prevRoot: commitBlockHeader.prevRoot,
|
41432
42532
|
time: commitBlockHeader.time,
|
41433
42533
|
applicationHash: commitBlockHeader.applicationHash,
|
41434
|
-
|
41435
|
-
|
42534
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount),
|
42535
|
+
messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
|
42536
|
+
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42537
|
+
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42538
|
+
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
41436
42539
|
},
|
41437
42540
|
sender: Address.fromAddressOrString(sender),
|
41438
42541
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -41441,6 +42544,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41441
42544
|
data
|
41442
42545
|
};
|
41443
42546
|
}
|
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
|
+
}
|
41444
42557
|
/**
|
41445
42558
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
41446
42559
|
*
|
@@ -41467,7 +42580,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41467
42580
|
}
|
41468
42581
|
// eslint-disable-next-line @typescript-eslint/require-await
|
41469
42582
|
async getTransactionResponse(transactionId) {
|
41470
|
-
return new
|
42583
|
+
return new TransactionResponse2(transactionId, this);
|
41471
42584
|
}
|
41472
42585
|
};
|
41473
42586
|
var Provider = _Provider;
|
@@ -41501,10 +42614,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41501
42614
|
arrayify(gqlTransaction.rawPayload),
|
41502
42615
|
0
|
41503
42616
|
);
|
41504
|
-
|
42617
|
+
let txReceipts = [];
|
42618
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42619
|
+
txReceipts = gqlTransaction.status.receipts;
|
42620
|
+
}
|
42621
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
41505
42622
|
const {
|
41506
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42623
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
41507
42624
|
} = provider.getChain();
|
42625
|
+
const gasPrice = await provider.getLatestGasPrice();
|
41508
42626
|
const transactionInfo = assembleTransactionSummary({
|
41509
42627
|
id: gqlTransaction.id,
|
41510
42628
|
receipts,
|
@@ -41515,7 +42633,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41515
42633
|
gasPriceFactor: bn(gasPriceFactor),
|
41516
42634
|
abiMap,
|
41517
42635
|
maxInputs,
|
41518
|
-
gasCosts
|
42636
|
+
gasCosts,
|
42637
|
+
maxGasPerTx,
|
42638
|
+
gasPrice
|
41519
42639
|
});
|
41520
42640
|
return {
|
41521
42641
|
gqlTransaction,
|
@@ -41525,10 +42645,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41525
42645
|
async function getTransactionSummaryFromRequest(params) {
|
41526
42646
|
const { provider, transactionRequest, abiMap } = params;
|
41527
42647
|
const { receipts } = await provider.call(transactionRequest);
|
41528
|
-
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42648
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
|
41529
42649
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
41530
42650
|
const transaction = transactionRequest.toTransaction();
|
41531
42651
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42652
|
+
const gasPrice = await provider.getLatestGasPrice();
|
41532
42653
|
const transactionSummary = assembleTransactionSummary({
|
41533
42654
|
receipts,
|
41534
42655
|
transaction,
|
@@ -41537,7 +42658,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41537
42658
|
gasPerByte,
|
41538
42659
|
gasPriceFactor,
|
41539
42660
|
maxInputs,
|
41540
|
-
gasCosts
|
42661
|
+
gasCosts,
|
42662
|
+
maxGasPerTx,
|
42663
|
+
gasPrice
|
41541
42664
|
});
|
41542
42665
|
return transactionSummary;
|
41543
42666
|
}
|
@@ -41546,13 +42669,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41546
42669
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
41547
42670
|
const { edges, pageInfo } = transactionsByOwner;
|
41548
42671
|
const {
|
41549
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42672
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
41550
42673
|
} = provider.getChain();
|
42674
|
+
const gasPrice = await provider.getLatestGasPrice();
|
41551
42675
|
const transactions = edges.map((edge) => {
|
41552
42676
|
const { node: gqlTransaction } = edge;
|
41553
|
-
const { id, rawPayload,
|
42677
|
+
const { id, rawPayload, status } = gqlTransaction;
|
41554
42678
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
41555
|
-
|
42679
|
+
let txReceipts = [];
|
42680
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42681
|
+
txReceipts = gqlTransaction.status.receipts;
|
42682
|
+
}
|
42683
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
41556
42684
|
const transactionSummary = assembleTransactionSummary({
|
41557
42685
|
id,
|
41558
42686
|
receipts,
|
@@ -41563,7 +42691,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41563
42691
|
gasPerByte,
|
41564
42692
|
gasPriceFactor,
|
41565
42693
|
maxInputs,
|
41566
|
-
gasCosts
|
42694
|
+
gasCosts,
|
42695
|
+
maxGasPerTx,
|
42696
|
+
gasPrice
|
41567
42697
|
});
|
41568
42698
|
const output3 = {
|
41569
42699
|
gqlTransaction,
|
@@ -41893,38 +43023,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41893
43023
|
* @param fee - The estimated transaction fee.
|
41894
43024
|
* @returns A promise that resolves when the resources are added to the transaction.
|
41895
43025
|
*/
|
41896
|
-
async fund(request,
|
43026
|
+
async fund(request, params) {
|
43027
|
+
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
41897
43028
|
const baseAssetId = this.provider.getBaseAssetId();
|
41898
|
-
const
|
43029
|
+
const txRequest = request;
|
43030
|
+
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
41899
43031
|
amount: bn(fee),
|
41900
43032
|
assetId: baseAssetId,
|
41901
|
-
coinQuantities
|
43033
|
+
coinQuantities: requiredQuantities
|
41902
43034
|
});
|
41903
43035
|
const quantitiesDict = {};
|
41904
|
-
|
43036
|
+
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
41905
43037
|
quantitiesDict[assetId] = {
|
41906
43038
|
required: amount,
|
41907
43039
|
owned: bn(0)
|
41908
43040
|
};
|
41909
43041
|
});
|
41910
|
-
|
41911
|
-
const cachedMessages = [];
|
41912
|
-
const owner = this.address.toB256();
|
41913
|
-
request.inputs.forEach((input) => {
|
43042
|
+
txRequest.inputs.forEach((input) => {
|
41914
43043
|
const isResource = "amount" in input;
|
41915
|
-
if (isResource) {
|
41916
|
-
|
41917
|
-
|
41918
|
-
|
41919
|
-
|
41920
|
-
|
41921
|
-
|
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
|
-
}
|
43044
|
+
if (!isResource) {
|
43045
|
+
return;
|
43046
|
+
}
|
43047
|
+
const isCoin2 = "owner" in input;
|
43048
|
+
const assetId = isCoin2 ? String(input.assetId) : baseAssetId;
|
43049
|
+
if (quantitiesDict[assetId]) {
|
43050
|
+
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(input.amount);
|
41928
43051
|
}
|
41929
43052
|
});
|
41930
43053
|
const missingQuantities = [];
|
@@ -41938,12 +43061,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41938
43061
|
});
|
41939
43062
|
const needsToBeFunded = missingQuantities.length;
|
41940
43063
|
if (needsToBeFunded) {
|
41941
|
-
const
|
41942
|
-
|
41943
|
-
|
41944
|
-
|
41945
|
-
|
41946
|
-
|
43064
|
+
const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
|
43065
|
+
const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
|
43066
|
+
txRequest.addResources(resources);
|
43067
|
+
}
|
43068
|
+
txRequest.shiftPredicateData();
|
43069
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
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;
|
41947
43079
|
}
|
41948
43080
|
/**
|
41949
43081
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -41951,29 +43083,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41951
43083
|
* @param destination - The address of the destination.
|
41952
43084
|
* @param amount - The amount of coins to transfer.
|
41953
43085
|
* @param assetId - The asset ID of the coins to transfer.
|
41954
|
-
* @param txParams - The transaction parameters (gasLimit,
|
43086
|
+
* @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
|
41955
43087
|
* @returns A promise that resolves to the prepared transaction request.
|
41956
43088
|
*/
|
41957
43089
|
async createTransfer(destination, amount, assetId, txParams = {}) {
|
41958
|
-
const
|
43090
|
+
const request = new ScriptTransactionRequest(txParams);
|
41959
43091
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
41960
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
41961
|
-
const request = new ScriptTransactionRequest(params);
|
41962
43092
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
|
41963
|
-
const
|
43093
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
41964
43094
|
estimateTxDependencies: true,
|
41965
43095
|
resourcesOwner: this
|
41966
43096
|
});
|
41967
|
-
|
41968
|
-
|
41969
|
-
|
41970
|
-
|
41971
|
-
gasPrice: request.gasPrice,
|
41972
|
-
gasLimit: request.gasLimit,
|
41973
|
-
minGasPrice
|
43097
|
+
this.validateGasLimitAndMaxFee({
|
43098
|
+
gasUsed: txCost.gasUsed,
|
43099
|
+
maxFee: txCost.maxFee,
|
43100
|
+
txParams
|
41974
43101
|
});
|
41975
|
-
|
41976
|
-
request.
|
43102
|
+
request.gasLimit = txCost.gasUsed;
|
43103
|
+
request.maxFee = txCost.maxFee;
|
43104
|
+
await this.fund(request, txCost);
|
41977
43105
|
return request;
|
41978
43106
|
}
|
41979
43107
|
/**
|
@@ -41982,7 +43110,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41982
43110
|
* @param destination - The address of the destination.
|
41983
43111
|
* @param amount - The amount of coins to transfer.
|
41984
43112
|
* @param assetId - The asset ID of the coins to transfer.
|
41985
|
-
* @param txParams - The transaction parameters (gasLimit,
|
43113
|
+
* @param txParams - The transaction parameters (gasLimit, maturity).
|
41986
43114
|
* @returns A promise that resolves to the transaction response.
|
41987
43115
|
*/
|
41988
43116
|
async transfer(destination, amount, assetId, txParams = {}) {
|
@@ -42013,32 +43141,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42013
43141
|
);
|
42014
43142
|
}
|
42015
43143
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42016
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42017
43144
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42018
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42019
43145
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42020
43146
|
hexlifiedContractId: contractAddress.toB256(),
|
42021
43147
|
amountToTransfer: bn(amount),
|
42022
43148
|
assetId: assetIdToTransfer
|
42023
43149
|
});
|
42024
43150
|
const request = new ScriptTransactionRequest({
|
42025
|
-
...
|
43151
|
+
...txParams,
|
42026
43152
|
script,
|
42027
43153
|
scriptData
|
42028
43154
|
});
|
42029
43155
|
request.addContractInputAndOutput(contractAddress);
|
42030
|
-
const
|
42031
|
-
|
42032
|
-
[{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
|
42033
|
-
);
|
42034
|
-
|
42035
|
-
|
42036
|
-
|
42037
|
-
|
42038
|
-
gasLimit: request.gasLimit,
|
42039
|
-
minGasPrice
|
43156
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
43157
|
+
resourcesOwner: this,
|
43158
|
+
quantitiesToContract: [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
|
43159
|
+
});
|
43160
|
+
this.validateGasLimitAndMaxFee({
|
43161
|
+
gasUsed: txCost.gasUsed,
|
43162
|
+
maxFee: txCost.maxFee,
|
43163
|
+
txParams
|
42040
43164
|
});
|
42041
|
-
|
43165
|
+
request.gasLimit = txCost.gasUsed;
|
43166
|
+
request.maxFee = txCost.maxFee;
|
43167
|
+
await this.fund(request, txCost);
|
42042
43168
|
return this.sendTransaction(request);
|
42043
43169
|
}
|
42044
43170
|
/**
|
@@ -42050,8 +43176,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42050
43176
|
* @returns A promise that resolves to the transaction response.
|
42051
43177
|
*/
|
42052
43178
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42053
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42054
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42055
43179
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42056
43180
|
const recipientDataArray = arrayify(
|
42057
43181
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42064,25 +43188,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42064
43188
|
...recipientDataArray,
|
42065
43189
|
...amountDataArray
|
42066
43190
|
]);
|
42067
|
-
const params = {
|
42068
|
-
|
42069
|
-
gasPrice: minGasPrice,
|
42070
|
-
...txParams
|
42071
|
-
};
|
43191
|
+
const params = { script, ...txParams };
|
43192
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
42072
43193
|
const request = new ScriptTransactionRequest(params);
|
42073
|
-
const
|
42074
|
-
const
|
42075
|
-
|
42076
|
-
|
42077
|
-
|
42078
|
-
|
42079
|
-
this.validateGas({
|
42080
|
-
gasUsed,
|
42081
|
-
gasPrice: request.gasPrice,
|
42082
|
-
gasLimit: request.gasLimit,
|
42083
|
-
minGasPrice
|
43194
|
+
const quantitiesToContract = [{ amount: bn(amount), assetId: baseAssetId }];
|
43195
|
+
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
43196
|
+
this.validateGasLimitAndMaxFee({
|
43197
|
+
gasUsed: txCost.gasUsed,
|
43198
|
+
maxFee: txCost.maxFee,
|
43199
|
+
txParams
|
42084
43200
|
});
|
42085
|
-
|
43201
|
+
request.maxFee = txCost.maxFee;
|
43202
|
+
request.gasLimit = txCost.gasUsed;
|
43203
|
+
await this.fund(request, txCost);
|
42086
43204
|
return this.sendTransaction(request);
|
42087
43205
|
}
|
42088
43206
|
async signMessage(message) {
|
@@ -42140,31 +43258,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42140
43258
|
}
|
42141
43259
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
42142
43260
|
}
|
42143
|
-
|
43261
|
+
validateGasLimitAndMaxFee({
|
43262
|
+
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
|
42144
43263
|
gasUsed,
|
42145
|
-
|
42146
|
-
gasLimit,
|
42147
|
-
minGasPrice
|
43264
|
+
maxFee
|
42148
43265
|
}) {
|
42149
|
-
if (
|
43266
|
+
if (isDefined(setGasLimit) && gasUsed.gt(setGasLimit)) {
|
42150
43267
|
throw new FuelError(
|
42151
|
-
ErrorCode.
|
42152
|
-
`Gas
|
43268
|
+
ErrorCode.GAS_LIMIT_TOO_LOW,
|
43269
|
+
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
42153
43270
|
);
|
42154
43271
|
}
|
42155
|
-
if (
|
43272
|
+
if (isDefined(setMaxFee) && maxFee.gt(setMaxFee)) {
|
42156
43273
|
throw new FuelError(
|
42157
|
-
ErrorCode.
|
42158
|
-
`
|
43274
|
+
ErrorCode.MAX_FEE_TOO_LOW,
|
43275
|
+
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
42159
43276
|
);
|
42160
43277
|
}
|
42161
43278
|
}
|
42162
43279
|
};
|
42163
43280
|
|
42164
43281
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/modular.js
|
42165
|
-
var
|
42166
|
-
var
|
42167
|
-
var
|
43282
|
+
var _0n4 = BigInt(0);
|
43283
|
+
var _1n4 = BigInt(1);
|
43284
|
+
var _2n4 = BigInt(2);
|
42168
43285
|
var _3n = BigInt(3);
|
42169
43286
|
var _4n = BigInt(4);
|
42170
43287
|
var _5n = BigInt(5);
|
@@ -42173,38 +43290,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42173
43290
|
var _16n = BigInt(16);
|
42174
43291
|
function mod(a, b) {
|
42175
43292
|
const result = a % b;
|
42176
|
-
return result >=
|
43293
|
+
return result >= _0n4 ? result : b + result;
|
42177
43294
|
}
|
42178
43295
|
function pow(num, power, modulo) {
|
42179
|
-
if (modulo <=
|
43296
|
+
if (modulo <= _0n4 || power < _0n4)
|
42180
43297
|
throw new Error("Expected power/modulo > 0");
|
42181
|
-
if (modulo ===
|
42182
|
-
return
|
42183
|
-
let res =
|
42184
|
-
while (power >
|
42185
|
-
if (power &
|
43298
|
+
if (modulo === _1n4)
|
43299
|
+
return _0n4;
|
43300
|
+
let res = _1n4;
|
43301
|
+
while (power > _0n4) {
|
43302
|
+
if (power & _1n4)
|
42186
43303
|
res = res * num % modulo;
|
42187
43304
|
num = num * num % modulo;
|
42188
|
-
power >>=
|
43305
|
+
power >>= _1n4;
|
42189
43306
|
}
|
42190
43307
|
return res;
|
42191
43308
|
}
|
42192
43309
|
function pow2(x, power, modulo) {
|
42193
43310
|
let res = x;
|
42194
|
-
while (power-- >
|
43311
|
+
while (power-- > _0n4) {
|
42195
43312
|
res *= res;
|
42196
43313
|
res %= modulo;
|
42197
43314
|
}
|
42198
43315
|
return res;
|
42199
43316
|
}
|
42200
43317
|
function invert(number3, modulo) {
|
42201
|
-
if (number3 ===
|
43318
|
+
if (number3 === _0n4 || modulo <= _0n4) {
|
42202
43319
|
throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
|
42203
43320
|
}
|
42204
43321
|
let a = mod(number3, modulo);
|
42205
43322
|
let b = modulo;
|
42206
|
-
let x =
|
42207
|
-
while (a !==
|
43323
|
+
let x = _0n4, y = _1n4, u = _1n4, v = _0n4;
|
43324
|
+
while (a !== _0n4) {
|
42208
43325
|
const q = b / a;
|
42209
43326
|
const r = b % a;
|
42210
43327
|
const m = x - u * q;
|
@@ -42212,19 +43329,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42212
43329
|
b = a, a = r, x = u, y = v, u = m, v = n;
|
42213
43330
|
}
|
42214
43331
|
const gcd = b;
|
42215
|
-
if (gcd !==
|
43332
|
+
if (gcd !== _1n4)
|
42216
43333
|
throw new Error("invert: does not exist");
|
42217
43334
|
return mod(x, modulo);
|
42218
43335
|
}
|
42219
43336
|
function tonelliShanks(P) {
|
42220
|
-
const legendreC = (P -
|
43337
|
+
const legendreC = (P - _1n4) / _2n4;
|
42221
43338
|
let Q, S, Z;
|
42222
|
-
for (Q = P -
|
43339
|
+
for (Q = P - _1n4, S = 0; Q % _2n4 === _0n4; Q /= _2n4, S++)
|
42223
43340
|
;
|
42224
|
-
for (Z =
|
43341
|
+
for (Z = _2n4; Z < P && pow(Z, legendreC, P) !== P - _1n4; Z++)
|
42225
43342
|
;
|
42226
43343
|
if (S === 1) {
|
42227
|
-
const p1div4 = (P +
|
43344
|
+
const p1div4 = (P + _1n4) / _4n;
|
42228
43345
|
return function tonelliFast(Fp2, n) {
|
42229
43346
|
const root = Fp2.pow(n, p1div4);
|
42230
43347
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
@@ -42232,7 +43349,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42232
43349
|
return root;
|
42233
43350
|
};
|
42234
43351
|
}
|
42235
|
-
const Q1div2 = (Q +
|
43352
|
+
const Q1div2 = (Q + _1n4) / _2n4;
|
42236
43353
|
return function tonelliSlow(Fp2, n) {
|
42237
43354
|
if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
|
42238
43355
|
throw new Error("Cannot find square root");
|
@@ -42249,7 +43366,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42249
43366
|
break;
|
42250
43367
|
t2 = Fp2.sqr(t2);
|
42251
43368
|
}
|
42252
|
-
const ge = Fp2.pow(g,
|
43369
|
+
const ge = Fp2.pow(g, _1n4 << BigInt(r - m - 1));
|
42253
43370
|
g = Fp2.sqr(ge);
|
42254
43371
|
x = Fp2.mul(x, ge);
|
42255
43372
|
b = Fp2.mul(b, g);
|
@@ -42260,7 +43377,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42260
43377
|
}
|
42261
43378
|
function FpSqrt(P) {
|
42262
43379
|
if (P % _4n === _3n) {
|
42263
|
-
const p1div4 = (P +
|
43380
|
+
const p1div4 = (P + _1n4) / _4n;
|
42264
43381
|
return function sqrt3mod4(Fp2, n) {
|
42265
43382
|
const root = Fp2.pow(n, p1div4);
|
42266
43383
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
@@ -42271,10 +43388,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42271
43388
|
if (P % _8n === _5n) {
|
42272
43389
|
const c1 = (P - _5n) / _8n;
|
42273
43390
|
return function sqrt5mod8(Fp2, n) {
|
42274
|
-
const n2 = Fp2.mul(n,
|
43391
|
+
const n2 = Fp2.mul(n, _2n4);
|
42275
43392
|
const v = Fp2.pow(n2, c1);
|
42276
43393
|
const nv = Fp2.mul(n, v);
|
42277
|
-
const i = Fp2.mul(Fp2.mul(nv,
|
43394
|
+
const i = Fp2.mul(Fp2.mul(nv, _2n4), v);
|
42278
43395
|
const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
|
42279
43396
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
42280
43397
|
throw new Error("Cannot find square root");
|
@@ -42318,19 +43435,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42318
43435
|
return validateObject(field, opts);
|
42319
43436
|
}
|
42320
43437
|
function FpPow(f2, num, power) {
|
42321
|
-
if (power <
|
43438
|
+
if (power < _0n4)
|
42322
43439
|
throw new Error("Expected power > 0");
|
42323
|
-
if (power ===
|
43440
|
+
if (power === _0n4)
|
42324
43441
|
return f2.ONE;
|
42325
|
-
if (power ===
|
43442
|
+
if (power === _1n4)
|
42326
43443
|
return num;
|
42327
43444
|
let p = f2.ONE;
|
42328
43445
|
let d = num;
|
42329
|
-
while (power >
|
42330
|
-
if (power &
|
43446
|
+
while (power > _0n4) {
|
43447
|
+
if (power & _1n4)
|
42331
43448
|
p = f2.mul(p, d);
|
42332
43449
|
d = f2.sqr(d);
|
42333
|
-
power >>=
|
43450
|
+
power >>= _1n4;
|
42334
43451
|
}
|
42335
43452
|
return p;
|
42336
43453
|
}
|
@@ -42357,7 +43474,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42357
43474
|
return { nBitLength: _nBitLength, nByteLength };
|
42358
43475
|
}
|
42359
43476
|
function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
|
42360
|
-
if (ORDER <=
|
43477
|
+
if (ORDER <= _0n4)
|
42361
43478
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
42362
43479
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
42363
43480
|
if (BYTES > 2048)
|
@@ -42368,16 +43485,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42368
43485
|
BITS,
|
42369
43486
|
BYTES,
|
42370
43487
|
MASK: bitMask(BITS),
|
42371
|
-
ZERO:
|
42372
|
-
ONE:
|
43488
|
+
ZERO: _0n4,
|
43489
|
+
ONE: _1n4,
|
42373
43490
|
create: (num) => mod(num, ORDER),
|
42374
43491
|
isValid: (num) => {
|
42375
43492
|
if (typeof num !== "bigint")
|
42376
43493
|
throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
|
42377
|
-
return
|
43494
|
+
return _0n4 <= num && num < ORDER;
|
42378
43495
|
},
|
42379
|
-
is0: (num) => num ===
|
42380
|
-
isOdd: (num) => (num &
|
43496
|
+
is0: (num) => num === _0n4,
|
43497
|
+
isOdd: (num) => (num & _1n4) === _1n4,
|
42381
43498
|
neg: (num) => mod(-num, ORDER),
|
42382
43499
|
eql: (lhs, rhs) => lhs === rhs,
|
42383
43500
|
sqr: (num) => mod(num * num, ORDER),
|
@@ -42423,13 +43540,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42423
43540
|
if (len < 16 || len < minLen || len > 1024)
|
42424
43541
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
42425
43542
|
const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
42426
|
-
const reduced = mod(num, fieldOrder -
|
43543
|
+
const reduced = mod(num, fieldOrder - _1n4) + _1n4;
|
42427
43544
|
return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
42428
43545
|
}
|
42429
43546
|
|
42430
43547
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/curve.js
|
42431
|
-
var
|
42432
|
-
var
|
43548
|
+
var _0n5 = BigInt(0);
|
43549
|
+
var _1n5 = BigInt(1);
|
42433
43550
|
function wNAF(c, bits) {
|
42434
43551
|
const constTimeNegate = (condition, item) => {
|
42435
43552
|
const neg = item.negate();
|
@@ -42446,11 +43563,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42446
43563
|
unsafeLadder(elm, n) {
|
42447
43564
|
let p = c.ZERO;
|
42448
43565
|
let d = elm;
|
42449
|
-
while (n >
|
42450
|
-
if (n &
|
43566
|
+
while (n > _0n5) {
|
43567
|
+
if (n & _1n5)
|
42451
43568
|
p = p.add(d);
|
42452
43569
|
d = d.double();
|
42453
|
-
n >>=
|
43570
|
+
n >>= _1n5;
|
42454
43571
|
}
|
42455
43572
|
return p;
|
42456
43573
|
},
|
@@ -42500,7 +43617,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42500
43617
|
n >>= shiftBy;
|
42501
43618
|
if (wbits > windowSize) {
|
42502
43619
|
wbits -= maxNumber;
|
42503
|
-
n +=
|
43620
|
+
n += _1n5;
|
42504
43621
|
}
|
42505
43622
|
const offset1 = offset;
|
42506
43623
|
const offset2 = offset + Math.abs(wbits) - 1;
|
@@ -42624,9 +43741,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42624
43741
|
return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
|
42625
43742
|
}
|
42626
43743
|
};
|
42627
|
-
var
|
42628
|
-
var
|
42629
|
-
var
|
43744
|
+
var _0n6 = BigInt(0);
|
43745
|
+
var _1n6 = BigInt(1);
|
43746
|
+
var _2n5 = BigInt(2);
|
42630
43747
|
var _3n2 = BigInt(3);
|
42631
43748
|
var _4n2 = BigInt(4);
|
42632
43749
|
function weierstrassPoints(opts) {
|
@@ -42651,7 +43768,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42651
43768
|
if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
|
42652
43769
|
throw new Error("bad generator point: equation left != right");
|
42653
43770
|
function isWithinCurveOrder(num) {
|
42654
|
-
return typeof num === "bigint" &&
|
43771
|
+
return typeof num === "bigint" && _0n6 < num && num < CURVE.n;
|
42655
43772
|
}
|
42656
43773
|
function assertGE(num) {
|
42657
43774
|
if (!isWithinCurveOrder(num))
|
@@ -42895,10 +44012,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42895
44012
|
*/
|
42896
44013
|
multiplyUnsafe(n) {
|
42897
44014
|
const I = Point2.ZERO;
|
42898
|
-
if (n ===
|
44015
|
+
if (n === _0n6)
|
42899
44016
|
return I;
|
42900
44017
|
assertGE(n);
|
42901
|
-
if (n ===
|
44018
|
+
if (n === _1n6)
|
42902
44019
|
return this;
|
42903
44020
|
const { endo } = CURVE;
|
42904
44021
|
if (!endo)
|
@@ -42907,14 +44024,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42907
44024
|
let k1p = I;
|
42908
44025
|
let k2p = I;
|
42909
44026
|
let d = this;
|
42910
|
-
while (k1 >
|
42911
|
-
if (k1 &
|
44027
|
+
while (k1 > _0n6 || k2 > _0n6) {
|
44028
|
+
if (k1 & _1n6)
|
42912
44029
|
k1p = k1p.add(d);
|
42913
|
-
if (k2 &
|
44030
|
+
if (k2 & _1n6)
|
42914
44031
|
k2p = k2p.add(d);
|
42915
44032
|
d = d.double();
|
42916
|
-
k1 >>=
|
42917
|
-
k2 >>=
|
44033
|
+
k1 >>= _1n6;
|
44034
|
+
k2 >>= _1n6;
|
42918
44035
|
}
|
42919
44036
|
if (k1neg)
|
42920
44037
|
k1p = k1p.negate();
|
@@ -42961,7 +44078,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42961
44078
|
*/
|
42962
44079
|
multiplyAndAddUnsafe(Q, a, b) {
|
42963
44080
|
const G = Point2.BASE;
|
42964
|
-
const mul = (P, a2) => a2 ===
|
44081
|
+
const mul = (P, a2) => a2 === _0n6 || a2 === _1n6 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
|
42965
44082
|
const sum = mul(this, a).add(mul(Q, b));
|
42966
44083
|
return sum.is0() ? void 0 : sum;
|
42967
44084
|
}
|
@@ -42984,7 +44101,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42984
44101
|
}
|
42985
44102
|
isTorsionFree() {
|
42986
44103
|
const { h: cofactor, isTorsionFree } = CURVE;
|
42987
|
-
if (cofactor ===
|
44104
|
+
if (cofactor === _1n6)
|
42988
44105
|
return true;
|
42989
44106
|
if (isTorsionFree)
|
42990
44107
|
return isTorsionFree(Point2, this);
|
@@ -42992,7 +44109,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42992
44109
|
}
|
42993
44110
|
clearCofactor() {
|
42994
44111
|
const { h: cofactor, clearCofactor } = CURVE;
|
42995
|
-
if (cofactor ===
|
44112
|
+
if (cofactor === _1n6)
|
42996
44113
|
return this;
|
42997
44114
|
if (clearCofactor)
|
42998
44115
|
return clearCofactor(Point2, this);
|
@@ -43037,7 +44154,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43037
44154
|
const compressedLen = Fp2.BYTES + 1;
|
43038
44155
|
const uncompressedLen = 2 * Fp2.BYTES + 1;
|
43039
44156
|
function isValidFieldElement(num) {
|
43040
|
-
return
|
44157
|
+
return _0n6 < num && num < Fp2.ORDER;
|
43041
44158
|
}
|
43042
44159
|
function modN(a) {
|
43043
44160
|
return mod(a, CURVE_ORDER);
|
@@ -43067,7 +44184,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43067
44184
|
throw new Error("Point is not on curve");
|
43068
44185
|
const y2 = weierstrassEquation(x);
|
43069
44186
|
let y = Fp2.sqrt(y2);
|
43070
|
-
const isYOdd = (y &
|
44187
|
+
const isYOdd = (y & _1n6) === _1n6;
|
43071
44188
|
const isHeadOdd = (head & 1) === 1;
|
43072
44189
|
if (isHeadOdd !== isYOdd)
|
43073
44190
|
y = Fp2.neg(y);
|
@@ -43083,7 +44200,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43083
44200
|
});
|
43084
44201
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
43085
44202
|
function isBiggerThanHalfOrder(number3) {
|
43086
|
-
const HALF = CURVE_ORDER >>
|
44203
|
+
const HALF = CURVE_ORDER >> _1n6;
|
43087
44204
|
return number3 > HALF;
|
43088
44205
|
}
|
43089
44206
|
function normalizeS(s) {
|
@@ -43226,7 +44343,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43226
44343
|
function int2octets(num) {
|
43227
44344
|
if (typeof num !== "bigint")
|
43228
44345
|
throw new Error("bigint expected");
|
43229
|
-
if (!(
|
44346
|
+
if (!(_0n6 <= num && num < ORDER_MASK))
|
43230
44347
|
throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
|
43231
44348
|
return numberToBytesBE(num, CURVE.nByteLength);
|
43232
44349
|
}
|
@@ -43256,12 +44373,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43256
44373
|
const ik = invN(k);
|
43257
44374
|
const q = Point2.BASE.multiply(k).toAffine();
|
43258
44375
|
const r = modN(q.x);
|
43259
|
-
if (r ===
|
44376
|
+
if (r === _0n6)
|
43260
44377
|
return;
|
43261
44378
|
const s = modN(ik * modN(m + r * d));
|
43262
|
-
if (s ===
|
44379
|
+
if (s === _0n6)
|
43263
44380
|
return;
|
43264
|
-
let recovery = (q.x === r ? 0 : 2) | Number(q.y &
|
44381
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n6);
|
43265
44382
|
let normS = s;
|
43266
44383
|
if (lowS && isBiggerThanHalfOrder(s)) {
|
43267
44384
|
normS = normalizeS(s);
|
@@ -43353,9 +44470,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43353
44470
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/secp256k1.js
|
43354
44471
|
var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
|
43355
44472
|
var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
43356
|
-
var
|
43357
|
-
var
|
43358
|
-
var divNearest = (a, b) => (a + b /
|
44473
|
+
var _1n7 = BigInt(1);
|
44474
|
+
var _2n6 = BigInt(2);
|
44475
|
+
var divNearest = (a, b) => (a + b / _2n6) / b;
|
43359
44476
|
function sqrtMod(y) {
|
43360
44477
|
const P = secp256k1P;
|
43361
44478
|
const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
|
@@ -43364,7 +44481,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43364
44481
|
const b3 = b2 * b2 * y % P;
|
43365
44482
|
const b6 = pow2(b3, _3n3, P) * b3 % P;
|
43366
44483
|
const b9 = pow2(b6, _3n3, P) * b3 % P;
|
43367
|
-
const b11 = pow2(b9,
|
44484
|
+
const b11 = pow2(b9, _2n6, P) * b2 % P;
|
43368
44485
|
const b22 = pow2(b11, _11n, P) * b11 % P;
|
43369
44486
|
const b44 = pow2(b22, _22n, P) * b22 % P;
|
43370
44487
|
const b88 = pow2(b44, _44n, P) * b44 % P;
|
@@ -43373,7 +44490,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43373
44490
|
const b223 = pow2(b220, _3n3, P) * b3 % P;
|
43374
44491
|
const t1 = pow2(b223, _23n, P) * b22 % P;
|
43375
44492
|
const t2 = pow2(t1, _6n, P) * b2 % P;
|
43376
|
-
const root = pow2(t2,
|
44493
|
+
const root = pow2(t2, _2n6, P);
|
43377
44494
|
if (!Fp.eql(Fp.sqr(root), y))
|
43378
44495
|
throw new Error("Cannot find square root");
|
43379
44496
|
return root;
|
@@ -43406,7 +44523,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43406
44523
|
splitScalar: (k) => {
|
43407
44524
|
const n = secp256k1N;
|
43408
44525
|
const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
|
43409
|
-
const b1 = -
|
44526
|
+
const b1 = -_1n7 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
|
43410
44527
|
const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
|
43411
44528
|
const b2 = a1;
|
43412
44529
|
const POW_2_128 = BigInt("0x100000000000000000000000000000000");
|
@@ -43427,7 +44544,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43427
44544
|
}
|
43428
44545
|
}
|
43429
44546
|
}, sha256);
|
43430
|
-
var
|
44547
|
+
var _0n7 = BigInt(0);
|
43431
44548
|
var Point = secp256k1.ProjectivePoint;
|
43432
44549
|
|
43433
44550
|
// src/signer/signer.ts
|
@@ -43534,12 +44651,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43534
44651
|
};
|
43535
44652
|
|
43536
44653
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
43537
|
-
var
|
44654
|
+
var import_crypto16 = __toESM(__require("crypto"));
|
43538
44655
|
var rnds8Pool = new Uint8Array(256);
|
43539
44656
|
var poolPtr = rnds8Pool.length;
|
43540
44657
|
function rng() {
|
43541
44658
|
if (poolPtr > rnds8Pool.length - 16) {
|
43542
|
-
|
44659
|
+
import_crypto16.default.randomFillSync(rnds8Pool);
|
43543
44660
|
poolPtr = 0;
|
43544
44661
|
}
|
43545
44662
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -43555,9 +44672,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43555
44672
|
}
|
43556
44673
|
|
43557
44674
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
43558
|
-
var
|
44675
|
+
var import_crypto17 = __toESM(__require("crypto"));
|
43559
44676
|
var native_default = {
|
43560
|
-
randomUUID:
|
44677
|
+
randomUUID: import_crypto17.default.randomUUID
|
43561
44678
|
};
|
43562
44679
|
|
43563
44680
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -43740,7 +44857,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43740
44857
|
* @param transactionRequestLike - The transaction request to send.
|
43741
44858
|
* @returns A promise that resolves to the TransactionResponse object.
|
43742
44859
|
*/
|
43743
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44860
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
43744
44861
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
43745
44862
|
if (estimateTxDependencies) {
|
43746
44863
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -47018,35 +48135,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47018
48135
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
47019
48136
|
request.inputs?.forEach((input) => {
|
47020
48137
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
47021
|
-
input.predicate = this.bytes;
|
47022
|
-
input.predicateData = this.getPredicateData(policies.length);
|
48138
|
+
input.predicate = hexlify(this.bytes);
|
48139
|
+
input.predicateData = hexlify(this.getPredicateData(policies.length));
|
47023
48140
|
}
|
47024
48141
|
});
|
47025
48142
|
return request;
|
47026
48143
|
}
|
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
|
-
}
|
47041
48144
|
/**
|
47042
48145
|
* Sends a transaction with the populated predicate data.
|
47043
48146
|
*
|
47044
48147
|
* @param transactionRequestLike - The transaction request-like object.
|
47045
48148
|
* @returns A promise that resolves to the transaction response.
|
47046
48149
|
*/
|
47047
|
-
sendTransaction(transactionRequestLike
|
47048
|
-
const transactionRequest =
|
47049
|
-
return super.sendTransaction(transactionRequest,
|
48150
|
+
sendTransaction(transactionRequestLike) {
|
48151
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48152
|
+
return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
|
47050
48153
|
}
|
47051
48154
|
/**
|
47052
48155
|
* Simulates a transaction with the populated predicate data.
|
@@ -47055,8 +48158,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47055
48158
|
* @returns A promise that resolves to the call result.
|
47056
48159
|
*/
|
47057
48160
|
simulateTransaction(transactionRequestLike) {
|
47058
|
-
const transactionRequest =
|
47059
|
-
return super.simulateTransaction(transactionRequest);
|
48161
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48162
|
+
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
47060
48163
|
}
|
47061
48164
|
getPredicateData(policiesLength) {
|
47062
48165
|
if (!this.predicateData.length) {
|
@@ -47102,6 +48205,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47102
48205
|
predicateInterface: abiInterface
|
47103
48206
|
};
|
47104
48207
|
}
|
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
|
+
}
|
47105
48227
|
/**
|
47106
48228
|
* Sets the configurable constants for the predicate.
|
47107
48229
|
*
|