@sentio/sdk-bundle 2.61.0-rc.5 → 2.61.0-rc.7
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.
- package/lib/aptos/builtin/0x1.js +4 -4
- package/lib/aptos/builtin/0x3.js +5 -5
- package/lib/aptos/builtin/0x4.js +5 -5
- package/lib/aptos/builtin/index.js +6 -6
- package/lib/aptos/ext/index.js +4 -4
- package/lib/aptos/index.js +4 -4
- package/lib/btc/index.js +2 -2
- package/lib/{chunk-5J7XO34J.js → chunk-3RALZ4H6.js} +991 -311
- package/lib/chunk-3RALZ4H6.js.map +1 -0
- package/lib/{chunk-RQEJ6VYV.js → chunk-4ZXFUDK4.js} +5 -5
- package/lib/{chunk-V7GMUFEU.js → chunk-5TGZTD5Q.js} +3 -3
- package/lib/{chunk-W5VWFQZQ.js → chunk-6I5K3NEY.js} +5 -5
- package/lib/{chunk-NF66PTSR.js → chunk-6OBOJCP7.js} +5 -5
- package/lib/{chunk-63C2SM23.js → chunk-AHQUVBU7.js} +2 -2
- package/lib/{chunk-HGKRXQLP.js → chunk-BTYDHZ4W.js} +2 -2
- package/lib/{chunk-OUQN675E.js → chunk-BY3UN5YU.js} +6 -6
- package/lib/{chunk-XLNIFS5I.js → chunk-ITCWSIOM.js} +2 -2
- package/lib/{chunk-GXWFPPVN.js → chunk-MJG4BKNQ.js} +2 -2
- package/lib/{chunk-VOZ7XW36.js → chunk-OHLDBO64.js} +3 -3
- package/lib/{chunk-3U72IHGI.js → chunk-PVLVS5MG.js} +2 -2
- package/lib/{chunk-JM77GOBI.js → chunk-RIOM2HXS.js} +6 -6
- package/lib/{chunk-FSFHO32Q.js → chunk-STUVQNC6.js} +4 -4
- package/lib/{chunk-RNKAUU7M.js → chunk-UMN7NZY2.js} +4 -4
- package/lib/{chunk-TBCNZKOI.js → chunk-UYJRFS74.js} +4 -4
- package/lib/{chunk-N3RF2ACU.js → chunk-XOBZLCW2.js} +2 -2
- package/lib/{chunk-NEDO74L4.js → chunk-Y2ZUWHJT.js} +3 -3
- package/lib/{chunk-O2FX3ST4.js → chunk-YCYZBEH6.js} +2 -2
- package/lib/{chunk-PSLT5TLU.js → chunk-YUD47PY2.js} +3 -3
- package/lib/core/index.js +1 -1
- package/lib/eth/builtin/eacaggregatorproxy.js +2 -2
- package/lib/eth/builtin/erc1155.js +3 -3
- package/lib/eth/builtin/erc20.js +2 -2
- package/lib/eth/builtin/erc721.js +2 -2
- package/lib/eth/builtin/index.js +4 -4
- package/lib/eth/builtin/weth9.js +3 -3
- package/lib/eth/index.js +2 -2
- package/lib/fuel/index.js +2 -2
- package/lib/index.js +1 -1
- package/lib/iota/builtin/0x1.js +7 -7
- package/lib/iota/builtin/0x2.js +8 -8
- package/lib/iota/builtin/0x3.js +9 -9
- package/lib/iota/builtin/index.js +9 -9
- package/lib/iota/ext/index.js +4 -4
- package/lib/iota/index.js +6 -6
- package/lib/move/index.js +2 -2
- package/lib/solana/builtin/index.js +2 -2
- package/lib/solana/index.js +2 -2
- package/lib/stark/index.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/sui/builtin/0x1.js +7 -7
- package/lib/sui/builtin/0x2.js +8 -8
- package/lib/sui/builtin/0x3.js +9 -9
- package/lib/sui/builtin/index.js +9 -9
- package/lib/sui/ext/index.js +4 -4
- package/lib/sui/index.js +6 -6
- package/lib/testing/index.js +9 -9
- package/lib/utils/index.js +2 -2
- package/package.json +2 -2
- package/lib/chunk-5J7XO34J.js.map +0 -1
- /package/lib/{chunk-RQEJ6VYV.js.map → chunk-4ZXFUDK4.js.map} +0 -0
- /package/lib/{chunk-V7GMUFEU.js.map → chunk-5TGZTD5Q.js.map} +0 -0
- /package/lib/{chunk-W5VWFQZQ.js.map → chunk-6I5K3NEY.js.map} +0 -0
- /package/lib/{chunk-NF66PTSR.js.map → chunk-6OBOJCP7.js.map} +0 -0
- /package/lib/{chunk-63C2SM23.js.map → chunk-AHQUVBU7.js.map} +0 -0
- /package/lib/{chunk-HGKRXQLP.js.map → chunk-BTYDHZ4W.js.map} +0 -0
- /package/lib/{chunk-OUQN675E.js.map → chunk-BY3UN5YU.js.map} +0 -0
- /package/lib/{chunk-XLNIFS5I.js.map → chunk-ITCWSIOM.js.map} +0 -0
- /package/lib/{chunk-GXWFPPVN.js.map → chunk-MJG4BKNQ.js.map} +0 -0
- /package/lib/{chunk-VOZ7XW36.js.map → chunk-OHLDBO64.js.map} +0 -0
- /package/lib/{chunk-3U72IHGI.js.map → chunk-PVLVS5MG.js.map} +0 -0
- /package/lib/{chunk-JM77GOBI.js.map → chunk-RIOM2HXS.js.map} +0 -0
- /package/lib/{chunk-FSFHO32Q.js.map → chunk-STUVQNC6.js.map} +0 -0
- /package/lib/{chunk-RNKAUU7M.js.map → chunk-UMN7NZY2.js.map} +0 -0
- /package/lib/{chunk-TBCNZKOI.js.map → chunk-UYJRFS74.js.map} +0 -0
- /package/lib/{chunk-N3RF2ACU.js.map → chunk-XOBZLCW2.js.map} +0 -0
- /package/lib/{chunk-NEDO74L4.js.map → chunk-Y2ZUWHJT.js.map} +0 -0
- /package/lib/{chunk-O2FX3ST4.js.map → chunk-YCYZBEH6.js.map} +0 -0
- /package/lib/{chunk-PSLT5TLU.js.map → chunk-YUD47PY2.js.map} +0 -0
|
@@ -21741,17 +21741,17 @@ var require_minimal = __commonJS({
|
|
|
21741
21741
|
}
|
|
21742
21742
|
});
|
|
21743
21743
|
|
|
21744
|
-
// ../../node_modules/.pnpm/fuels@0.
|
|
21744
|
+
// ../../node_modules/.pnpm/fuels@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/fuels/dist/index.mjs
|
|
21745
21745
|
var FuelAsm = __toESM(require_node(), 1);
|
|
21746
21746
|
|
|
21747
|
-
// ../../node_modules/.pnpm/@fuel-ts+versions@0.
|
|
21747
|
+
// ../../node_modules/.pnpm/@fuel-ts+versions@0.101.3/node_modules/@fuel-ts/versions/dist/index.mjs
|
|
21748
21748
|
var __defProp = Object.defineProperty;
|
|
21749
21749
|
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp(target, "name", { value, configurable: true }), "__name");
|
|
21750
21750
|
function getBuiltinVersions() {
|
|
21751
21751
|
return {
|
|
21752
21752
|
FUEL_CORE: "0.43.1",
|
|
21753
|
-
FORC: "0.68.
|
|
21754
|
-
FUELS: "0.
|
|
21753
|
+
FORC: "0.68.7",
|
|
21754
|
+
FUELS: "0.101.3"
|
|
21755
21755
|
};
|
|
21756
21756
|
}
|
|
21757
21757
|
__name(getBuiltinVersions, "getBuiltinVersions");
|
|
@@ -21830,7 +21830,7 @@ __name(checkFuelCoreVersionCompatibility, "checkFuelCoreVersionCompatibility");
|
|
|
21830
21830
|
__name2(checkFuelCoreVersionCompatibility, "checkFuelCoreVersionCompatibility");
|
|
21831
21831
|
var versions = getBuiltinVersions();
|
|
21832
21832
|
|
|
21833
|
-
// ../../node_modules/.pnpm/@fuel-ts+errors@0.
|
|
21833
|
+
// ../../node_modules/.pnpm/@fuel-ts+errors@0.101.3/node_modules/@fuel-ts/errors/dist/index.mjs
|
|
21834
21834
|
var __defProp2 = Object.defineProperty;
|
|
21835
21835
|
var __name3 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
21836
21836
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
@@ -21864,6 +21864,7 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
21864
21864
|
ErrorCode2["CONNECTION_REFUSED"] = "connection-refused";
|
|
21865
21865
|
ErrorCode2["INVALID_URL"] = "invalid-url";
|
|
21866
21866
|
ErrorCode2["UNSUPPORTED_FEATURE"] = "unsupported-feature";
|
|
21867
|
+
ErrorCode2["RESPONSE_BODY_EMPTY"] = "response-body-empty";
|
|
21867
21868
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
|
21868
21869
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
|
21869
21870
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
|
@@ -21882,6 +21883,8 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
21882
21883
|
ErrorCode2["INVALID_REQUEST"] = "invalid-request";
|
|
21883
21884
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
|
21884
21885
|
ErrorCode2["INSUFFICIENT_FUNDS_OR_MAX_COINS"] = "not-enough-funds-or-max-coins-reached";
|
|
21886
|
+
ErrorCode2["INSUFFICIENT_FUNDS"] = "not-enough-funds";
|
|
21887
|
+
ErrorCode2["MAX_COINS_REACHED"] = "max-coins-reached";
|
|
21885
21888
|
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
|
|
21886
21889
|
ErrorCode2["HASHER_LOCKED"] = "hasher-locked";
|
|
21887
21890
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
|
@@ -21915,6 +21918,7 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
21915
21918
|
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
|
|
21916
21919
|
ErrorCode2["ACCOUNT_REQUIRED"] = "account-required";
|
|
21917
21920
|
ErrorCode2["UNLOCKED_WALLET_REQUIRED"] = "unlocked-wallet-required";
|
|
21921
|
+
ErrorCode2["UNABLE_TO_CONSOLIDATE_COINS"] = "unable-to-consolidate-coins";
|
|
21918
21922
|
ErrorCode2["NO_COINS_TO_CONSOLIDATE"] = "no-coins-to-consolidate";
|
|
21919
21923
|
ErrorCode2["COINS_ASSET_ID_MISMATCH"] = "coins-asset-id-mismatch";
|
|
21920
21924
|
ErrorCode2["ASSET_NOT_FOUND"] = "asset-not-found";
|
|
@@ -21956,7 +21960,7 @@ var FuelError = class _FuelError extends Error {
|
|
|
21956
21960
|
`Unknown error code: ${error.code}. Accepted codes: ${enumValues.join(", ")}.`
|
|
21957
21961
|
);
|
|
21958
21962
|
}
|
|
21959
|
-
return new _FuelError(error.code, error.message);
|
|
21963
|
+
return new _FuelError(error.code, error.message, error.metadata, error.rawError);
|
|
21960
21964
|
}
|
|
21961
21965
|
code;
|
|
21962
21966
|
constructor(code, message, metadata = {}, rawError = null) {
|
|
@@ -21972,7 +21976,7 @@ var FuelError = class _FuelError extends Error {
|
|
|
21972
21976
|
}
|
|
21973
21977
|
};
|
|
21974
21978
|
|
|
21975
|
-
// ../../node_modules/.pnpm/@fuel-ts+math@0.
|
|
21979
|
+
// ../../node_modules/.pnpm/@fuel-ts+math@0.101.3/node_modules/@fuel-ts/math/dist/index.mjs
|
|
21976
21980
|
var import_bn = __toESM(require_bn(), 1);
|
|
21977
21981
|
var __defProp3 = Object.defineProperty;
|
|
21978
21982
|
var __name4 = /* @__PURE__ */ __name((target, value) => __defProp3(target, "name", { value, configurable: true }), "__name");
|
|
@@ -22657,7 +22661,7 @@ try {
|
|
|
22657
22661
|
} catch (e) {
|
|
22658
22662
|
}
|
|
22659
22663
|
|
|
22660
|
-
// ../../node_modules/.pnpm/@fuel-ts+utils@0.
|
|
22664
|
+
// ../../node_modules/.pnpm/@fuel-ts+utils@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/utils/dist/index.mjs
|
|
22661
22665
|
var __defProp4 = Object.defineProperty;
|
|
22662
22666
|
var __name5 = /* @__PURE__ */ __name((target, value) => __defProp4(target, "name", { value, configurable: true }), "__name");
|
|
22663
22667
|
var chunkAndPadBytes = /* @__PURE__ */ __name5((bytes, chunkSize) => {
|
|
@@ -23219,7 +23223,7 @@ function scrypt(password, salt, opts) {
|
|
|
23219
23223
|
}
|
|
23220
23224
|
__name(scrypt, "scrypt");
|
|
23221
23225
|
|
|
23222
|
-
// ../../node_modules/.pnpm/@fuel-ts+crypto@0.
|
|
23226
|
+
// ../../node_modules/.pnpm/@fuel-ts+crypto@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/crypto/dist/index.mjs
|
|
23223
23227
|
init_sha3();
|
|
23224
23228
|
|
|
23225
23229
|
// ../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/esm/ripemd160.js
|
|
@@ -23324,7 +23328,7 @@ var RIPEMD160 = class extends HashMD {
|
|
|
23324
23328
|
};
|
|
23325
23329
|
var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
|
23326
23330
|
|
|
23327
|
-
// ../../node_modules/.pnpm/@fuel-ts+crypto@0.
|
|
23331
|
+
// ../../node_modules/.pnpm/@fuel-ts+crypto@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/crypto/dist/index.mjs
|
|
23328
23332
|
import crypto2 from "crypto";
|
|
23329
23333
|
import { pbkdf2Sync } from "crypto";
|
|
23330
23334
|
import crypto3 from "crypto";
|
|
@@ -23449,7 +23453,7 @@ var {
|
|
|
23449
23453
|
randomUUID: randomUUID2
|
|
23450
23454
|
} = node_default;
|
|
23451
23455
|
|
|
23452
|
-
// ../../node_modules/.pnpm/@fuel-ts+hasher@0.
|
|
23456
|
+
// ../../node_modules/.pnpm/@fuel-ts+hasher@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/hasher/dist/index.mjs
|
|
23453
23457
|
init_sha256();
|
|
23454
23458
|
var __defProp6 = Object.defineProperty;
|
|
23455
23459
|
var __name7 = /* @__PURE__ */ __name((target, value) => __defProp6(target, "name", { value, configurable: true }), "__name");
|
|
@@ -23489,7 +23493,7 @@ function hashMessage(message) {
|
|
|
23489
23493
|
__name(hashMessage, "hashMessage");
|
|
23490
23494
|
__name7(hashMessage, "hashMessage");
|
|
23491
23495
|
|
|
23492
|
-
// ../../node_modules/.pnpm/@fuel-ts+abi-coder@0.
|
|
23496
|
+
// ../../node_modules/.pnpm/@fuel-ts+abi-coder@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/abi-coder/dist/index.mjs
|
|
23493
23497
|
var __defProp7 = Object.defineProperty;
|
|
23494
23498
|
var __name8 = /* @__PURE__ */ __name((target, value) => __defProp7(target, "name", { value, configurable: true }), "__name");
|
|
23495
23499
|
var Coder = class {
|
|
@@ -24785,7 +24789,8 @@ function transpileAbi(abi2) {
|
|
|
24785
24789
|
functions,
|
|
24786
24790
|
loggedTypes,
|
|
24787
24791
|
messagesTypes: abi2.messagesTypes,
|
|
24788
|
-
configurables
|
|
24792
|
+
configurables,
|
|
24793
|
+
errorCodes: abi2.errorCodes
|
|
24789
24794
|
};
|
|
24790
24795
|
return transpiled;
|
|
24791
24796
|
}
|
|
@@ -24879,7 +24884,7 @@ var Interface = class {
|
|
|
24879
24884
|
}
|
|
24880
24885
|
};
|
|
24881
24886
|
|
|
24882
|
-
// ../../node_modules/.pnpm/@fuel-ts+address@0.
|
|
24887
|
+
// ../../node_modules/.pnpm/@fuel-ts+address@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/address/dist/index.mjs
|
|
24883
24888
|
init_sha256();
|
|
24884
24889
|
init_sha256();
|
|
24885
24890
|
var __defProp8 = Object.defineProperty;
|
|
@@ -25196,7 +25201,7 @@ var Address = class _Address {
|
|
|
25196
25201
|
}
|
|
25197
25202
|
};
|
|
25198
25203
|
|
|
25199
|
-
// ../../node_modules/.pnpm/@fuel-ts+transactions@0.
|
|
25204
|
+
// ../../node_modules/.pnpm/@fuel-ts+transactions@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/transactions/dist/index.mjs
|
|
25200
25205
|
var __defProp9 = Object.defineProperty;
|
|
25201
25206
|
var __name10 = /* @__PURE__ */ __name((target, value) => __defProp9(target, "name", { value, configurable: true }), "__name");
|
|
25202
25207
|
var ByteArrayCoder = class extends Coder {
|
|
@@ -26612,6 +26617,69 @@ function _curry1(fn) {
|
|
|
26612
26617
|
}
|
|
26613
26618
|
__name(_curry1, "_curry1");
|
|
26614
26619
|
|
|
26620
|
+
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry2.js
|
|
26621
|
+
function _curry2(fn) {
|
|
26622
|
+
return /* @__PURE__ */ __name(function f2(a, b) {
|
|
26623
|
+
switch (arguments.length) {
|
|
26624
|
+
case 0:
|
|
26625
|
+
return f2;
|
|
26626
|
+
case 1:
|
|
26627
|
+
return _isPlaceholder(a) ? f2 : _curry1(function(_b2) {
|
|
26628
|
+
return fn(a, _b2);
|
|
26629
|
+
});
|
|
26630
|
+
default:
|
|
26631
|
+
return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function(_a2) {
|
|
26632
|
+
return fn(_a2, b);
|
|
26633
|
+
}) : _isPlaceholder(b) ? _curry1(function(_b2) {
|
|
26634
|
+
return fn(a, _b2);
|
|
26635
|
+
}) : fn(a, b);
|
|
26636
|
+
}
|
|
26637
|
+
}, "f2");
|
|
26638
|
+
}
|
|
26639
|
+
__name(_curry2, "_curry2");
|
|
26640
|
+
|
|
26641
|
+
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry3.js
|
|
26642
|
+
function _curry3(fn) {
|
|
26643
|
+
return /* @__PURE__ */ __name(function f3(a, b, c) {
|
|
26644
|
+
switch (arguments.length) {
|
|
26645
|
+
case 0:
|
|
26646
|
+
return f3;
|
|
26647
|
+
case 1:
|
|
26648
|
+
return _isPlaceholder(a) ? f3 : _curry2(function(_b2, _c) {
|
|
26649
|
+
return fn(a, _b2, _c);
|
|
26650
|
+
});
|
|
26651
|
+
case 2:
|
|
26652
|
+
return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function(_a2, _c) {
|
|
26653
|
+
return fn(_a2, b, _c);
|
|
26654
|
+
}) : _isPlaceholder(b) ? _curry2(function(_b2, _c) {
|
|
26655
|
+
return fn(a, _b2, _c);
|
|
26656
|
+
}) : _curry1(function(_c) {
|
|
26657
|
+
return fn(a, b, _c);
|
|
26658
|
+
});
|
|
26659
|
+
default:
|
|
26660
|
+
return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function(_a2, _b2) {
|
|
26661
|
+
return fn(_a2, _b2, c);
|
|
26662
|
+
}) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function(_a2, _c) {
|
|
26663
|
+
return fn(_a2, b, _c);
|
|
26664
|
+
}) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function(_b2, _c) {
|
|
26665
|
+
return fn(a, _b2, _c);
|
|
26666
|
+
}) : _isPlaceholder(a) ? _curry1(function(_a2) {
|
|
26667
|
+
return fn(_a2, b, c);
|
|
26668
|
+
}) : _isPlaceholder(b) ? _curry1(function(_b2) {
|
|
26669
|
+
return fn(a, _b2, c);
|
|
26670
|
+
}) : _isPlaceholder(c) ? _curry1(function(_c) {
|
|
26671
|
+
return fn(a, b, _c);
|
|
26672
|
+
}) : fn(a, b, c);
|
|
26673
|
+
}
|
|
26674
|
+
}, "f3");
|
|
26675
|
+
}
|
|
26676
|
+
__name(_curry3, "_curry3");
|
|
26677
|
+
|
|
26678
|
+
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isArray.js
|
|
26679
|
+
var isArray_default = Array.isArray || /* @__PURE__ */ __name(function _isArray(val) {
|
|
26680
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
|
26681
|
+
}, "_isArray");
|
|
26682
|
+
|
|
26615
26683
|
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/type.js
|
|
26616
26684
|
var type = /* @__PURE__ */ _curry1(/* @__PURE__ */ __name(function type2(val) {
|
|
26617
26685
|
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
|
@@ -26730,6 +26798,39 @@ var clone = /* @__PURE__ */ _curry1(/* @__PURE__ */ __name(function clone2(value
|
|
|
26730
26798
|
}, "clone"));
|
|
26731
26799
|
var clone_default = clone;
|
|
26732
26800
|
|
|
26801
|
+
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_checkForMethod.js
|
|
26802
|
+
function _checkForMethod(methodname, fn) {
|
|
26803
|
+
return function() {
|
|
26804
|
+
var length = arguments.length;
|
|
26805
|
+
if (length === 0) {
|
|
26806
|
+
return fn();
|
|
26807
|
+
}
|
|
26808
|
+
var obj = arguments[length - 1];
|
|
26809
|
+
return isArray_default(obj) || typeof obj[methodname] !== "function" ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1));
|
|
26810
|
+
};
|
|
26811
|
+
}
|
|
26812
|
+
__name(_checkForMethod, "_checkForMethod");
|
|
26813
|
+
|
|
26814
|
+
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/slice.js
|
|
26815
|
+
var slice = /* @__PURE__ */ _curry3(/* @__PURE__ */ _checkForMethod("slice", /* @__PURE__ */ __name(function slice2(fromIndex, toIndex, list) {
|
|
26816
|
+
return Array.prototype.slice.call(list, fromIndex, toIndex);
|
|
26817
|
+
}, "slice")));
|
|
26818
|
+
var slice_default = slice;
|
|
26819
|
+
|
|
26820
|
+
// ../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/splitEvery.js
|
|
26821
|
+
var splitEvery = /* @__PURE__ */ _curry2(/* @__PURE__ */ __name(function splitEvery2(n, list) {
|
|
26822
|
+
if (n <= 0) {
|
|
26823
|
+
throw new Error("First argument to splitEvery must be a positive integer");
|
|
26824
|
+
}
|
|
26825
|
+
var result = [];
|
|
26826
|
+
var idx = 0;
|
|
26827
|
+
while (idx < list.length) {
|
|
26828
|
+
result.push(slice_default(idx, idx += n, list));
|
|
26829
|
+
}
|
|
26830
|
+
return result;
|
|
26831
|
+
}, "splitEvery"));
|
|
26832
|
+
var splitEvery_default = splitEvery;
|
|
26833
|
+
|
|
26733
26834
|
// ../../node_modules/.pnpm/graphql-request@6.1.0_encoding@0.1.13_graphql@16.10.0/node_modules/graphql-request/build/esm/defaultJsonSerializer.js
|
|
26734
26835
|
var defaultJsonSerializer = JSON;
|
|
26735
26836
|
|
|
@@ -31452,10 +31553,10 @@ var extras = {
|
|
|
31452
31553
|
gql["default"] = gql;
|
|
31453
31554
|
var lib_default2 = gql;
|
|
31454
31555
|
|
|
31455
|
-
// ../../node_modules/.pnpm/@fuel-ts+address@0.
|
|
31556
|
+
// ../../node_modules/.pnpm/@fuel-ts+address@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/address/dist/configs.mjs
|
|
31456
31557
|
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
31457
31558
|
|
|
31458
|
-
// ../../node_modules/.pnpm/@fuel-ts+transactions@0.
|
|
31559
|
+
// ../../node_modules/.pnpm/@fuel-ts+transactions@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/transactions/dist/configs.mjs
|
|
31459
31560
|
var CONTRACT_MAX_SIZE = 16 * 1024;
|
|
31460
31561
|
var MAX_SCRIPT_LENGTH = 1024 * 1024 * 1024;
|
|
31461
31562
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
|
@@ -31466,6 +31567,7 @@ var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
|
|
31466
31567
|
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
|
31467
31568
|
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
|
31468
31569
|
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
|
31570
|
+
var REVERT_WITH_LOG_SIGNAL = "0xffffffffffff0006";
|
|
31469
31571
|
var PANIC_REASONS = [
|
|
31470
31572
|
"ArithmeticError",
|
|
31471
31573
|
"ArithmeticOverflow",
|
|
@@ -31534,14 +31636,22 @@ var PANIC_REASONS = [
|
|
|
31534
31636
|
"WitnessNotFound"
|
|
31535
31637
|
];
|
|
31536
31638
|
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
|
31639
|
+
var SwaySignalErrors = {
|
|
31640
|
+
FAILED_REQUIRE_SIGNAL,
|
|
31641
|
+
FAILED_TRANSFER_TO_ADDRESS_SIGNAL,
|
|
31642
|
+
FAILED_ASSERT_EQ_SIGNAL,
|
|
31643
|
+
FAILED_ASSERT_SIGNAL,
|
|
31644
|
+
FAILED_ASSERT_NE_SIGNAL,
|
|
31645
|
+
REVERT_WITH_LOG_SIGNAL
|
|
31646
|
+
};
|
|
31537
31647
|
|
|
31538
|
-
// ../../node_modules/.pnpm/@fuel-ts+account@0.
|
|
31648
|
+
// ../../node_modules/.pnpm/@fuel-ts+account@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/account/dist/index.mjs
|
|
31539
31649
|
var asm = __toESM(require_node(), 1);
|
|
31540
31650
|
init_secp256k1();
|
|
31541
31651
|
import { EventEmitter } from "events";
|
|
31542
31652
|
var asm2 = __toESM(require_node(), 1);
|
|
31543
31653
|
|
|
31544
|
-
// ../../node_modules/.pnpm/@fuel-ts+merkle@0.
|
|
31654
|
+
// ../../node_modules/.pnpm/@fuel-ts+merkle@0.101.3_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/merkle/dist/index.mjs
|
|
31545
31655
|
var __defProp10 = Object.defineProperty;
|
|
31546
31656
|
var __name11 = /* @__PURE__ */ __name((target, value) => __defProp10(target, "name", { value, configurable: true }), "__name");
|
|
31547
31657
|
var EMPTY = "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
|
|
@@ -31985,7 +32095,7 @@ var SparseMerkleTree = class {
|
|
|
31985
32095
|
}
|
|
31986
32096
|
};
|
|
31987
32097
|
|
|
31988
|
-
// ../../node_modules/.pnpm/@fuel-ts+account@0.
|
|
32098
|
+
// ../../node_modules/.pnpm/@fuel-ts+account@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/account/dist/index.mjs
|
|
31989
32099
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
31990
32100
|
var __defProp11 = Object.defineProperty;
|
|
31991
32101
|
var __name12 = /* @__PURE__ */ __name((target, value) => __defProp11(target, "name", { value, configurable: true }), "__name");
|
|
@@ -33265,6 +33375,11 @@ var ChainInfoFragmentDoc = lib_default2`
|
|
|
33265
33375
|
consensusParameters {
|
|
33266
33376
|
...consensusParametersFragment
|
|
33267
33377
|
}
|
|
33378
|
+
latestBlock {
|
|
33379
|
+
header {
|
|
33380
|
+
consensusParametersVersion
|
|
33381
|
+
}
|
|
33382
|
+
}
|
|
33268
33383
|
}
|
|
33269
33384
|
${ConsensusParametersFragmentDoc}`;
|
|
33270
33385
|
var ContractBalanceFragmentDoc = lib_default2`
|
|
@@ -33738,7 +33853,7 @@ ${OutputContractCreatedFragmentDoc}
|
|
|
33738
33853
|
${DryRunFailureAssembleTxFragmentDoc}
|
|
33739
33854
|
${DryRunSuccessAssembleTxFragmentDoc}`;
|
|
33740
33855
|
var DryRunDocument = lib_default2`
|
|
33741
|
-
|
|
33856
|
+
query dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
|
|
33742
33857
|
dryRun(
|
|
33743
33858
|
txs: $encodedTransactions
|
|
33744
33859
|
utxoValidation: $utxoValidation
|
|
@@ -33992,8 +34107,11 @@ var setAndValidateGasAndFeeForAssembledTx = /* @__PURE__ */ __name12(async (para
|
|
|
33992
34107
|
}
|
|
33993
34108
|
return transactionRequest;
|
|
33994
34109
|
}, "setAndValidateGasAndFeeForAssembledTx");
|
|
34110
|
+
var ASSET_ID_REGEX = /[0-9a-fA-F]{32,64}/g;
|
|
33995
34111
|
var gqlErrorMessage = {
|
|
33996
34112
|
RPC_CONSISTENCY: /The required fuel block height is higher than the current block height. Required: \d+, Current: \d+/,
|
|
34113
|
+
INSUFFICIENT_FUNDS: /the target cannot be met due to insufficient coins available for [0-9a-fA-F]{32,64}. Collected: \d+/,
|
|
34114
|
+
MAX_COINS_REACHED: /the target for [0-9a-fA-F]{32,64} cannot be met due to exceeding the \d+ coin limit. Collected: \d+./,
|
|
33997
34115
|
NOT_ENOUGH_COINS_MAX_COINS: /the target cannot be met due to no coins available or exceeding the \d+ coin limit./,
|
|
33998
34116
|
ASSET_NOT_FOUND: /resource was not found in table/,
|
|
33999
34117
|
MULTIPLE_CHANGE_POLICIES: /The asset ([a-fA-F0-9]{64}) has multiple change policies/,
|
|
@@ -34009,6 +34127,46 @@ var mapGqlErrorMessage = /* @__PURE__ */ __name12((error) => {
|
|
|
34009
34127
|
error
|
|
34010
34128
|
);
|
|
34011
34129
|
}
|
|
34130
|
+
if (gqlErrorMessage.MAX_COINS_REACHED.test(error.message)) {
|
|
34131
|
+
const matches = error.message.match(ASSET_ID_REGEX);
|
|
34132
|
+
const assetId = matches ? `0x${matches[0]}` : null;
|
|
34133
|
+
const owner = matches ? `0x${matches[1]}` : null;
|
|
34134
|
+
let suffix = "";
|
|
34135
|
+
if (assetId) {
|
|
34136
|
+
suffix += `
|
|
34137
|
+
Asset ID: '${assetId}'.`;
|
|
34138
|
+
}
|
|
34139
|
+
if (owner) {
|
|
34140
|
+
suffix += `
|
|
34141
|
+
Owner: '${owner}'.`;
|
|
34142
|
+
}
|
|
34143
|
+
return new FuelError(
|
|
34144
|
+
ErrorCode.MAX_COINS_REACHED,
|
|
34145
|
+
`You have too many small value coins - consider combining UTXOs.${suffix}`,
|
|
34146
|
+
{ assetId, owner },
|
|
34147
|
+
error
|
|
34148
|
+
);
|
|
34149
|
+
}
|
|
34150
|
+
if (gqlErrorMessage.INSUFFICIENT_FUNDS.test(error.message)) {
|
|
34151
|
+
const matches = error.message.match(ASSET_ID_REGEX);
|
|
34152
|
+
const assetId = matches ? `0x${matches[0]}` : null;
|
|
34153
|
+
const owner = matches ? `0x${matches[1]}` : null;
|
|
34154
|
+
let suffix = "";
|
|
34155
|
+
if (assetId) {
|
|
34156
|
+
suffix += `
|
|
34157
|
+
Asset ID: '${assetId}'.`;
|
|
34158
|
+
}
|
|
34159
|
+
if (owner) {
|
|
34160
|
+
suffix += `
|
|
34161
|
+
Owner: '${owner}'.`;
|
|
34162
|
+
}
|
|
34163
|
+
return new FuelError(
|
|
34164
|
+
ErrorCode.INSUFFICIENT_FUNDS,
|
|
34165
|
+
`Insufficient funds.${suffix}`,
|
|
34166
|
+
{ assetId, owner },
|
|
34167
|
+
error
|
|
34168
|
+
);
|
|
34169
|
+
}
|
|
34012
34170
|
if (gqlErrorMessage.MULTIPLE_CHANGE_POLICIES.test(error.message)) {
|
|
34013
34171
|
const match = error.message.match(/asset ([a-fA-F0-9]{64})/);
|
|
34014
34172
|
const assetId = match?.[1] || "";
|
|
@@ -34297,7 +34455,7 @@ var outputify = /* @__PURE__ */ __name12((value) => {
|
|
|
34297
34455
|
var isMessageCoin = /* @__PURE__ */ __name12((message) => !("data" in message), "isMessageCoin");
|
|
34298
34456
|
var isCoin = /* @__PURE__ */ __name12((resource) => "id" in resource, "isCoin");
|
|
34299
34457
|
var deserializeChain = /* @__PURE__ */ __name12((chain) => {
|
|
34300
|
-
const { name, daHeight, consensusParameters } = chain;
|
|
34458
|
+
const { name, daHeight, consensusParameters, latestBlock } = chain;
|
|
34301
34459
|
const {
|
|
34302
34460
|
contractParams,
|
|
34303
34461
|
feeParams,
|
|
@@ -34348,11 +34506,12 @@ var deserializeChain = /* @__PURE__ */ __name12((chain) => {
|
|
|
34348
34506
|
maxScriptDataLength: bn(scriptParams.maxScriptDataLength)
|
|
34349
34507
|
},
|
|
34350
34508
|
gasCosts
|
|
34351
|
-
}
|
|
34509
|
+
},
|
|
34510
|
+
latestBlock
|
|
34352
34511
|
};
|
|
34353
34512
|
}, "deserializeChain");
|
|
34354
34513
|
var serializeChain = /* @__PURE__ */ __name12((chain) => {
|
|
34355
|
-
const { name, baseChainHeight, consensusParameters } = chain;
|
|
34514
|
+
const { name, baseChainHeight, consensusParameters, latestBlock } = chain;
|
|
34356
34515
|
const {
|
|
34357
34516
|
contractParameters,
|
|
34358
34517
|
feeParameters,
|
|
@@ -34403,7 +34562,8 @@ var serializeChain = /* @__PURE__ */ __name12((chain) => {
|
|
|
34403
34562
|
maxScriptDataLength: scriptParameters.maxScriptDataLength.toString()
|
|
34404
34563
|
},
|
|
34405
34564
|
gasCosts
|
|
34406
|
-
}
|
|
34565
|
+
},
|
|
34566
|
+
latestBlock
|
|
34407
34567
|
};
|
|
34408
34568
|
}, "serializeChain");
|
|
34409
34569
|
var deserializeNodeInfo = /* @__PURE__ */ __name12((nodeInfo) => {
|
|
@@ -34983,58 +35143,100 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
|
34983
35143
|
});
|
|
34984
35144
|
}, "assemblePanicError");
|
|
34985
35145
|
var stringify = /* @__PURE__ */ __name12((obj) => JSON.stringify(obj, null, 2), "stringify");
|
|
34986
|
-
var
|
|
35146
|
+
var assembleSignalErrorMessage = /* @__PURE__ */ __name12((reasonHex, logs, metadata) => {
|
|
34987
35147
|
let errorMessage = "The transaction reverted with an unknown reason.";
|
|
34988
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
|
34989
35148
|
let reason = "";
|
|
34990
|
-
|
|
34991
|
-
|
|
34992
|
-
|
|
34993
|
-
|
|
34994
|
-
|
|
34995
|
-
|
|
34996
|
-
|
|
34997
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
|
|
34998
|
-
break;
|
|
34999
|
-
}
|
|
35000
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
|
35001
|
-
const suffix = logs.length >= 2 ? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.` : ".";
|
|
35002
|
-
reason = "assert_eq";
|
|
35003
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${suffix}`;
|
|
35004
|
-
break;
|
|
35005
|
-
}
|
|
35006
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
|
35007
|
-
const suffix = logs.length >= 2 ? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.` : ".";
|
|
35008
|
-
reason = "assert_ne";
|
|
35009
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${suffix}`;
|
|
35010
|
-
break;
|
|
35011
|
-
}
|
|
35012
|
-
case FAILED_ASSERT_SIGNAL:
|
|
35013
|
-
reason = "assert";
|
|
35014
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
|
35015
|
-
break;
|
|
35016
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
|
35017
|
-
reason = "MissingOutputVariable";
|
|
35018
|
-
errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
|
|
35019
|
-
break;
|
|
35020
|
-
default:
|
|
35021
|
-
throw new FuelError(
|
|
35022
|
-
ErrorCode.UNKNOWN,
|
|
35023
|
-
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
|
35024
|
-
{
|
|
35025
|
-
...metadata,
|
|
35026
|
-
reason: "unknown"
|
|
35027
|
-
}
|
|
35028
|
-
);
|
|
35149
|
+
const lastLog = logs[logs.length - 1];
|
|
35150
|
+
const lastButOneLog = logs[logs.length - 2];
|
|
35151
|
+
switch (reasonHex) {
|
|
35152
|
+
case FAILED_REQUIRE_SIGNAL: {
|
|
35153
|
+
reason = "require";
|
|
35154
|
+
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
|
|
35155
|
+
break;
|
|
35029
35156
|
}
|
|
35157
|
+
case FAILED_ASSERT_EQ_SIGNAL: {
|
|
35158
|
+
const suffix = logs.length >= 2 ? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.` : ".";
|
|
35159
|
+
reason = "assert_eq";
|
|
35160
|
+
errorMessage = `The transaction reverted because of an "assert_eq" statement${suffix}`;
|
|
35161
|
+
break;
|
|
35162
|
+
}
|
|
35163
|
+
case FAILED_ASSERT_NE_SIGNAL: {
|
|
35164
|
+
const suffix = logs.length >= 2 ? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.` : ".";
|
|
35165
|
+
reason = "assert_ne";
|
|
35166
|
+
errorMessage = `The transaction reverted because of an "assert_ne" statement${suffix}`;
|
|
35167
|
+
break;
|
|
35168
|
+
}
|
|
35169
|
+
case FAILED_ASSERT_SIGNAL:
|
|
35170
|
+
reason = "assert";
|
|
35171
|
+
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
|
35172
|
+
break;
|
|
35173
|
+
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
|
35174
|
+
reason = "MissingOutputVariable";
|
|
35175
|
+
errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
|
|
35176
|
+
break;
|
|
35177
|
+
default:
|
|
35178
|
+
reason = `revert_with_log`;
|
|
35179
|
+
errorMessage = `The transaction reverted because a "revert_with_log" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
|
|
35180
|
+
break;
|
|
35181
|
+
}
|
|
35182
|
+
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
|
35183
|
+
...metadata,
|
|
35184
|
+
reason
|
|
35185
|
+
});
|
|
35186
|
+
}, "assembleSignalErrorMessage");
|
|
35187
|
+
function buildAbiErrorMessage(abiError, logs, metadata, reason) {
|
|
35188
|
+
const { pos, msg } = abiError;
|
|
35189
|
+
let errorMessage = "";
|
|
35190
|
+
const positionMessage = pos ? `
|
|
35191
|
+
|
|
35192
|
+
This error originated at ${JSON.stringify(pos, null, 2)}` : "";
|
|
35193
|
+
if (msg) {
|
|
35194
|
+
errorMessage = `A sway "panic" expression was invoked with the message: "${msg}".${positionMessage}`;
|
|
35195
|
+
} else {
|
|
35196
|
+
const value = logs[logs.length - 1];
|
|
35197
|
+
errorMessage = `A sway "panic" expression was invoked with the value: ${JSON.stringify(value)}.${positionMessage}`;
|
|
35198
|
+
}
|
|
35199
|
+
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
|
35200
|
+
...metadata,
|
|
35201
|
+
abiError,
|
|
35202
|
+
reason
|
|
35203
|
+
});
|
|
35204
|
+
}
|
|
35205
|
+
__name(buildAbiErrorMessage, "buildAbiErrorMessage");
|
|
35206
|
+
__name12(buildAbiErrorMessage, "buildAbiErrorMessage");
|
|
35207
|
+
function findErrorInAbis(statusReason, abis = []) {
|
|
35208
|
+
for (const abi2 of abis) {
|
|
35209
|
+
if (abi2.errorCodes?.[statusReason]) {
|
|
35210
|
+
return abi2.errorCodes[statusReason];
|
|
35211
|
+
}
|
|
35212
|
+
}
|
|
35213
|
+
return void 0;
|
|
35214
|
+
}
|
|
35215
|
+
__name(findErrorInAbis, "findErrorInAbis");
|
|
35216
|
+
__name12(findErrorInAbis, "findErrorInAbis");
|
|
35217
|
+
var assembleRevertError = /* @__PURE__ */ __name12((_receipts, logs, metadata, statusReason, abis) => {
|
|
35218
|
+
const match = statusReason.match(/Revert\((\d+)\)/);
|
|
35219
|
+
const reason = match?.[1] ?? statusReason;
|
|
35220
|
+
const reasonHex = bn(reason).toHex();
|
|
35221
|
+
if (Object.values(SwaySignalErrors).includes(reasonHex)) {
|
|
35222
|
+
return assembleSignalErrorMessage(reasonHex, logs, metadata);
|
|
35223
|
+
}
|
|
35224
|
+
let abiError;
|
|
35225
|
+
if (abis) {
|
|
35226
|
+
const abisArr = [abis.main, ...Object.values(abis.otherContractsAbis)];
|
|
35227
|
+
abiError = findErrorInAbis(reason, abisArr);
|
|
35228
|
+
}
|
|
35229
|
+
if (abiError) {
|
|
35230
|
+
return buildAbiErrorMessage(abiError, logs, metadata, reason);
|
|
35030
35231
|
}
|
|
35232
|
+
const errorMessage = `The transaction reverted with reason: ${reason}.`;
|
|
35031
35233
|
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
|
35032
35234
|
...metadata,
|
|
35033
35235
|
reason
|
|
35034
35236
|
});
|
|
35035
35237
|
}, "assembleRevertError");
|
|
35036
35238
|
var extractTxError = /* @__PURE__ */ __name12((params) => {
|
|
35037
|
-
const { receipts, statusReason, logs, groupedLogs } = params;
|
|
35239
|
+
const { receipts, statusReason, logs, groupedLogs, abis } = params;
|
|
35038
35240
|
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
|
35039
35241
|
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
|
35040
35242
|
const metadata = {
|
|
@@ -35048,7 +35250,7 @@ var extractTxError = /* @__PURE__ */ __name12((params) => {
|
|
|
35048
35250
|
if (isPanic) {
|
|
35049
35251
|
return assemblePanicError(statusReason, metadata);
|
|
35050
35252
|
}
|
|
35051
|
-
return assembleRevertError(receipts, logs, metadata);
|
|
35253
|
+
return assembleRevertError(receipts, logs, metadata, statusReason, abis);
|
|
35052
35254
|
}, "extractTxError");
|
|
35053
35255
|
var mergeQuantities = /* @__PURE__ */ __name12((...coinQuantities) => {
|
|
35054
35256
|
const resultMap = {};
|
|
@@ -35190,8 +35392,6 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
|
|
|
35190
35392
|
/** List of witnesses */
|
|
35191
35393
|
witnesses = [];
|
|
35192
35394
|
/**
|
|
35193
|
-
* @hidden
|
|
35194
|
-
*
|
|
35195
35395
|
* The current status of the transaction
|
|
35196
35396
|
*/
|
|
35197
35397
|
flag = { state: void 0, transactionId: void 0, summary: void 0 };
|
|
@@ -35208,7 +35408,8 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
|
|
|
35208
35408
|
witnessLimit,
|
|
35209
35409
|
inputs,
|
|
35210
35410
|
outputs,
|
|
35211
|
-
witnesses
|
|
35411
|
+
witnesses,
|
|
35412
|
+
flag
|
|
35212
35413
|
} = {}) {
|
|
35213
35414
|
this.tip = tip ? bn(tip) : void 0;
|
|
35214
35415
|
this.maturity = maturity && maturity > 0 ? maturity : void 0;
|
|
@@ -35218,6 +35419,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
|
|
|
35218
35419
|
this.inputs = inputs ?? [];
|
|
35219
35420
|
this.outputs = outputs ?? [];
|
|
35220
35421
|
this.witnesses = witnesses ?? [];
|
|
35422
|
+
this.flag = flag ?? { state: void 0, transactionId: void 0, summary: void 0 };
|
|
35221
35423
|
}
|
|
35222
35424
|
static getPolicyMeta(req) {
|
|
35223
35425
|
let policyTypes = 0;
|
|
@@ -36008,11 +36210,15 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
|
36008
36210
|
* @deprecated Use `provider.assembleTx` instead.
|
|
36009
36211
|
* Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
|
|
36010
36212
|
*/
|
|
36011
|
-
async estimateAndFund(account, {
|
|
36213
|
+
async estimateAndFund(account, {
|
|
36214
|
+
signatureCallback,
|
|
36215
|
+
quantities = [],
|
|
36216
|
+
skipAutoConsolidation
|
|
36217
|
+
} = {}) {
|
|
36012
36218
|
const txCost = await account.getTransactionCost(this, { signatureCallback, quantities });
|
|
36013
36219
|
this.maxFee = txCost.maxFee;
|
|
36014
36220
|
this.gasLimit = txCost.gasUsed;
|
|
36015
|
-
await account.fund(this, txCost);
|
|
36221
|
+
await account.fund(this, txCost, { skipAutoConsolidation });
|
|
36016
36222
|
return this;
|
|
36017
36223
|
}
|
|
36018
36224
|
/**
|
|
@@ -36633,6 +36839,40 @@ var calculateTXFeeForSummary = /* @__PURE__ */ __name12((params) => {
|
|
|
36633
36839
|
});
|
|
36634
36840
|
return maxFee;
|
|
36635
36841
|
}, "calculateTXFeeForSummary");
|
|
36842
|
+
var getFunctionCall = /* @__PURE__ */ __name12(({
|
|
36843
|
+
abi: abi2,
|
|
36844
|
+
receipt,
|
|
36845
|
+
offset,
|
|
36846
|
+
scriptData
|
|
36847
|
+
}) => {
|
|
36848
|
+
const [functionSelector, argumentsOffset] = new StdStringCoder().decode(scriptData, offset);
|
|
36849
|
+
const abiInterface = new Interface(abi2);
|
|
36850
|
+
const functionFragment = abiInterface.getFunction(functionSelector);
|
|
36851
|
+
const inputs = functionFragment.jsonFn.inputs;
|
|
36852
|
+
let argumentsProvided;
|
|
36853
|
+
if (inputs.length) {
|
|
36854
|
+
const functionArgsBytes = scriptData.slice(argumentsOffset);
|
|
36855
|
+
const decodedArguments = functionFragment.decodeArguments(functionArgsBytes);
|
|
36856
|
+
argumentsProvided = inputs.reduce((prev, input, index) => {
|
|
36857
|
+
const value = decodedArguments?.[index];
|
|
36858
|
+
const name = input.name;
|
|
36859
|
+
if (name) {
|
|
36860
|
+
return {
|
|
36861
|
+
...prev,
|
|
36862
|
+
// reparse to remove bn
|
|
36863
|
+
[name]: JSON.parse(JSON.stringify(value))
|
|
36864
|
+
};
|
|
36865
|
+
}
|
|
36866
|
+
return prev;
|
|
36867
|
+
}, {});
|
|
36868
|
+
}
|
|
36869
|
+
return {
|
|
36870
|
+
functionSignature: functionFragment.signature,
|
|
36871
|
+
functionName: functionFragment.name,
|
|
36872
|
+
argumentsProvided,
|
|
36873
|
+
...receipt.amount?.isZero() ? {} : { amount: receipt.amount, assetId: receipt.assetId }
|
|
36874
|
+
};
|
|
36875
|
+
}, "getFunctionCall");
|
|
36636
36876
|
function getInputsByTypes(inputs, types) {
|
|
36637
36877
|
return inputs.filter((i) => types.includes(i.type));
|
|
36638
36878
|
}
|
|
@@ -36991,12 +37231,46 @@ function getWithdrawFromFuelOperations({
|
|
|
36991
37231
|
}
|
|
36992
37232
|
__name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
|
|
36993
37233
|
__name12(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
|
|
36994
|
-
function
|
|
37234
|
+
function findBytesSegmentIndex(whole, segment) {
|
|
37235
|
+
for (let i = 0; i <= whole.length - segment.length; i++) {
|
|
37236
|
+
let match = true;
|
|
37237
|
+
for (let j = 0; j < segment.length; j++) {
|
|
37238
|
+
if (whole[i + j] !== segment[j]) {
|
|
37239
|
+
match = false;
|
|
37240
|
+
break;
|
|
37241
|
+
}
|
|
37242
|
+
}
|
|
37243
|
+
if (match) {
|
|
37244
|
+
return i;
|
|
37245
|
+
}
|
|
37246
|
+
}
|
|
37247
|
+
return -1;
|
|
37248
|
+
}
|
|
37249
|
+
__name(findBytesSegmentIndex, "findBytesSegmentIndex");
|
|
37250
|
+
__name12(findBytesSegmentIndex, "findBytesSegmentIndex");
|
|
37251
|
+
function getContractCalls(contractInput, abiMap, receipt, scriptData) {
|
|
37252
|
+
const calls = [];
|
|
36995
37253
|
const abi2 = abiMap?.[contractInput.contractID];
|
|
36996
|
-
if (!abi2) {
|
|
36997
|
-
return
|
|
37254
|
+
if (!abi2 || !scriptData) {
|
|
37255
|
+
return calls;
|
|
37256
|
+
}
|
|
37257
|
+
const bytesSegment = concat([
|
|
37258
|
+
arrayify(receipt.to),
|
|
37259
|
+
// Contract ID (32 bytes)
|
|
37260
|
+
toBytes(receipt.param1.toHex(), 8),
|
|
37261
|
+
// Function selector offset (8 bytes)
|
|
37262
|
+
toBytes(receipt.param2.toHex(), 8)
|
|
37263
|
+
// Function args offset (8 bytes)
|
|
37264
|
+
]);
|
|
37265
|
+
const segmentIndex = findBytesSegmentIndex(scriptData, bytesSegment);
|
|
37266
|
+
const canDecodeFunctionCall = segmentIndex !== -1;
|
|
37267
|
+
if (!canDecodeFunctionCall) {
|
|
37268
|
+
return calls;
|
|
36998
37269
|
}
|
|
36999
|
-
|
|
37270
|
+
const offset = segmentIndex + bytesSegment.length;
|
|
37271
|
+
const call2 = getFunctionCall({ abi: abi2, receipt, offset, scriptData });
|
|
37272
|
+
calls.push(call2);
|
|
37273
|
+
return calls;
|
|
37000
37274
|
}
|
|
37001
37275
|
__name(getContractCalls, "getContractCalls");
|
|
37002
37276
|
__name12(getContractCalls, "getContractCalls");
|
|
@@ -37010,14 +37284,14 @@ function getAssetsSent(receipt) {
|
|
|
37010
37284
|
}
|
|
37011
37285
|
__name(getAssetsSent, "getAssetsSent");
|
|
37012
37286
|
__name12(getAssetsSent, "getAssetsSent");
|
|
37013
|
-
function processCallReceipt(receipt, contractInput, inputs, abiMap,
|
|
37287
|
+
function processCallReceipt(receipt, contractInput, inputs, abiMap, scriptData, baseAssetId) {
|
|
37014
37288
|
const assetId = receipt.assetId === ZeroBytes32 ? baseAssetId : receipt.assetId;
|
|
37015
37289
|
const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
|
|
37016
37290
|
if (!input) {
|
|
37017
37291
|
return [];
|
|
37018
37292
|
}
|
|
37019
37293
|
const inputAddress = getInputAccountAddress(input);
|
|
37020
|
-
const calls = getContractCalls(contractInput, abiMap, receipt,
|
|
37294
|
+
const calls = getContractCalls(contractInput, abiMap, receipt, scriptData);
|
|
37021
37295
|
return [
|
|
37022
37296
|
{
|
|
37023
37297
|
name: "Contract call",
|
|
@@ -37043,7 +37317,6 @@ function getContractCallOperations({
|
|
|
37043
37317
|
receipts,
|
|
37044
37318
|
abiMap,
|
|
37045
37319
|
rawPayload,
|
|
37046
|
-
maxInputs,
|
|
37047
37320
|
baseAssetId
|
|
37048
37321
|
}) {
|
|
37049
37322
|
const contractCallReceipts = getReceiptsCall(receipts);
|
|
@@ -37053,16 +37326,15 @@ function getContractCallOperations({
|
|
|
37053
37326
|
if (!contractInput) {
|
|
37054
37327
|
return [];
|
|
37055
37328
|
}
|
|
37329
|
+
let scriptData;
|
|
37330
|
+
if (rawPayload) {
|
|
37331
|
+
const [transaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
|
37332
|
+
if (transaction.type === TransactionType.Script) {
|
|
37333
|
+
scriptData = arrayify(transaction.scriptData);
|
|
37334
|
+
}
|
|
37335
|
+
}
|
|
37056
37336
|
return contractCallReceipts.filter((receipt) => receipt.to === contractInput.contractID).flatMap(
|
|
37057
|
-
(receipt) => processCallReceipt(
|
|
37058
|
-
receipt,
|
|
37059
|
-
contractInput,
|
|
37060
|
-
inputs,
|
|
37061
|
-
abiMap,
|
|
37062
|
-
rawPayload,
|
|
37063
|
-
maxInputs,
|
|
37064
|
-
baseAssetId
|
|
37065
|
-
)
|
|
37337
|
+
(receipt) => processCallReceipt(receipt, contractInput, inputs, abiMap, scriptData, baseAssetId)
|
|
37066
37338
|
);
|
|
37067
37339
|
});
|
|
37068
37340
|
}
|
|
@@ -37528,7 +37800,9 @@ function getAllDecodedLogs(opts) {
|
|
|
37528
37800
|
const firstCallReceipt = receipts.find(
|
|
37529
37801
|
(r) => r.type === ReceiptType.Call && r.id === ZeroBytes32
|
|
37530
37802
|
);
|
|
37531
|
-
|
|
37803
|
+
if (firstCallReceipt) {
|
|
37804
|
+
mainContract = firstCallReceipt.to;
|
|
37805
|
+
}
|
|
37532
37806
|
}
|
|
37533
37807
|
return receipts.reduce(
|
|
37534
37808
|
({ logs, groupedLogs }, receipt) => {
|
|
@@ -37554,25 +37828,6 @@ var TransactionResponse = class _TransactionResponse {
|
|
|
37554
37828
|
static {
|
|
37555
37829
|
__name(this, "_TransactionResponse");
|
|
37556
37830
|
}
|
|
37557
|
-
/**
|
|
37558
|
-
* Constructor for `TransactionResponse`.
|
|
37559
|
-
*
|
|
37560
|
-
* @param tx - The transaction ID or TransactionRequest.
|
|
37561
|
-
* @param provider - The provider.
|
|
37562
|
-
*/
|
|
37563
|
-
constructor(tx, provider, chainId, abis, submitTxSubscription) {
|
|
37564
|
-
this.submitTxSubscription = submitTxSubscription;
|
|
37565
|
-
if (typeof tx === "string") {
|
|
37566
|
-
this.id = tx;
|
|
37567
|
-
} else {
|
|
37568
|
-
this.id = tx.getTransactionId(chainId);
|
|
37569
|
-
this.request = tx;
|
|
37570
|
-
}
|
|
37571
|
-
this.provider = provider;
|
|
37572
|
-
this.abis = abis;
|
|
37573
|
-
this.waitForResult = this.waitForResult.bind(this);
|
|
37574
|
-
this.waitForPreConfirmation = this.waitForPreConfirmation.bind(this);
|
|
37575
|
-
}
|
|
37576
37831
|
static {
|
|
37577
37832
|
__name12(this, "TransactionResponse");
|
|
37578
37833
|
}
|
|
@@ -37587,9 +37842,42 @@ var TransactionResponse = class _TransactionResponse {
|
|
|
37587
37842
|
request;
|
|
37588
37843
|
status;
|
|
37589
37844
|
abis;
|
|
37845
|
+
submitTxSubscription;
|
|
37846
|
+
preConfirmationStatus;
|
|
37590
37847
|
waitingForStreamData = false;
|
|
37591
37848
|
statusResolvers = /* @__PURE__ */ new Map();
|
|
37592
|
-
|
|
37849
|
+
/**
|
|
37850
|
+
* Constructor for `TransactionResponse`.
|
|
37851
|
+
*/
|
|
37852
|
+
constructor(constructorParams, provider, chainId, abis, submitTxSubscription) {
|
|
37853
|
+
let tx;
|
|
37854
|
+
let _provider;
|
|
37855
|
+
let _chainId;
|
|
37856
|
+
let _abis;
|
|
37857
|
+
if (typeof constructorParams === "object" && "provider" in constructorParams && arguments.length === 1) {
|
|
37858
|
+
tx = constructorParams.transactionRequestOrId;
|
|
37859
|
+
_provider = constructorParams.provider;
|
|
37860
|
+
_chainId = constructorParams.chainId;
|
|
37861
|
+
_abis = constructorParams.abis;
|
|
37862
|
+
this.submitTxSubscription = constructorParams.submitAndAwaitSubscription;
|
|
37863
|
+
} else {
|
|
37864
|
+
tx = constructorParams;
|
|
37865
|
+
_provider = provider;
|
|
37866
|
+
_chainId = chainId;
|
|
37867
|
+
_abis = abis;
|
|
37868
|
+
this.submitTxSubscription = submitTxSubscription;
|
|
37869
|
+
}
|
|
37870
|
+
if (typeof tx === "string") {
|
|
37871
|
+
this.id = tx;
|
|
37872
|
+
} else {
|
|
37873
|
+
this.id = tx.getTransactionId(_chainId);
|
|
37874
|
+
this.request = tx;
|
|
37875
|
+
}
|
|
37876
|
+
this.provider = _provider;
|
|
37877
|
+
this.abis = _abis;
|
|
37878
|
+
this.waitForResult = this.waitForResult.bind(this);
|
|
37879
|
+
this.waitForPreConfirmation = this.waitForPreConfirmation.bind(this);
|
|
37880
|
+
}
|
|
37593
37881
|
/**
|
|
37594
37882
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
|
37595
37883
|
* an instance of `TransactionResponse` and wait for the transaction to be fetched
|
|
@@ -37778,6 +38066,11 @@ var TransactionResponse = class _TransactionResponse {
|
|
|
37778
38066
|
if (statusChange.type === "PreconfirmationSuccessStatus" || statusChange.type === "PreconfirmationFailureStatus") {
|
|
37779
38067
|
this.preConfirmationStatus = statusChange;
|
|
37780
38068
|
this.resolveStatus("preConfirmation");
|
|
38069
|
+
const pendingConfirmationResolvers = this.statusResolvers.get("confirmation");
|
|
38070
|
+
if (!pendingConfirmationResolvers) {
|
|
38071
|
+
this.waitingForStreamData = false;
|
|
38072
|
+
break;
|
|
38073
|
+
}
|
|
37781
38074
|
}
|
|
37782
38075
|
if (statusChange.type === "SuccessStatus" || statusChange.type === "FailureStatus") {
|
|
37783
38076
|
this.resolveStatus("confirmation");
|
|
@@ -37821,6 +38114,7 @@ var TransactionResponse = class _TransactionResponse {
|
|
|
37821
38114
|
...transactionSummary
|
|
37822
38115
|
};
|
|
37823
38116
|
let { logs, groupedLogs } = { logs: [], groupedLogs: {} };
|
|
38117
|
+
let abis;
|
|
37824
38118
|
if (this.abis) {
|
|
37825
38119
|
({ logs, groupedLogs } = getAllDecodedLogs({
|
|
37826
38120
|
receipts: transactionSummary.receipts,
|
|
@@ -37829,6 +38123,7 @@ var TransactionResponse = class _TransactionResponse {
|
|
|
37829
38123
|
}));
|
|
37830
38124
|
transactionResult.logs = logs;
|
|
37831
38125
|
transactionResult.groupedLogs = groupedLogs;
|
|
38126
|
+
abis = this.abis;
|
|
37832
38127
|
}
|
|
37833
38128
|
const { receipts } = transactionResult;
|
|
37834
38129
|
const status = this.getTransactionStatus();
|
|
@@ -37838,7 +38133,8 @@ var TransactionResponse = class _TransactionResponse {
|
|
|
37838
38133
|
receipts,
|
|
37839
38134
|
statusReason: reason,
|
|
37840
38135
|
logs,
|
|
37841
|
-
groupedLogs
|
|
38136
|
+
groupedLogs,
|
|
38137
|
+
abis
|
|
37842
38138
|
});
|
|
37843
38139
|
}
|
|
37844
38140
|
return transactionResult;
|
|
@@ -38112,7 +38408,15 @@ var Provider = class _Provider {
|
|
|
38112
38408
|
if (_Provider.ENABLE_RPC_CONSISTENCY && _Provider.hasWriteOperationHappened(url)) {
|
|
38113
38409
|
_Provider.applyBlockHeight(fullRequest, url);
|
|
38114
38410
|
}
|
|
38115
|
-
|
|
38411
|
+
const response = await _Provider.fetchAndProcessBlockHeight(url, fullRequest, options);
|
|
38412
|
+
if (response.body === null) {
|
|
38413
|
+
throw new FuelError(
|
|
38414
|
+
ErrorCode.RESPONSE_BODY_EMPTY,
|
|
38415
|
+
"The response from the server is missing the body",
|
|
38416
|
+
{ timestamp: (/* @__PURE__ */ new Date()).toISOString(), request: request2, response }
|
|
38417
|
+
);
|
|
38418
|
+
}
|
|
38419
|
+
return response;
|
|
38116
38420
|
}, retryOptions);
|
|
38117
38421
|
}
|
|
38118
38422
|
static applyBlockHeight(request2, url) {
|
|
@@ -38135,13 +38439,15 @@ var Provider = class _Provider {
|
|
|
38135
38439
|
baseDelay: 500
|
|
38136
38440
|
};
|
|
38137
38441
|
for (let retriesLeft = retryOptions.maxRetries; retriesLeft > 0; --retriesLeft) {
|
|
38138
|
-
|
|
38139
|
-
|
|
38140
|
-
|
|
38141
|
-
|
|
38142
|
-
|
|
38143
|
-
|
|
38144
|
-
|
|
38442
|
+
if (response.body) {
|
|
38443
|
+
const { extensions } = await parseGraphqlResponse({
|
|
38444
|
+
response,
|
|
38445
|
+
isSubscription: url.endsWith("-sub")
|
|
38446
|
+
});
|
|
38447
|
+
_Provider.setCurrentBlockHeight(url, extensions?.current_fuel_block_height);
|
|
38448
|
+
if (!extensions?.fuel_block_height_precondition_failed) {
|
|
38449
|
+
break;
|
|
38450
|
+
}
|
|
38145
38451
|
}
|
|
38146
38452
|
const retryAttempt = retryOptions.maxRetries - retriesLeft + 1;
|
|
38147
38453
|
const sleepTime = getWaitDelay(retryOptions, retryAttempt);
|
|
@@ -38564,7 +38870,13 @@ var Provider = class _Provider {
|
|
|
38564
38870
|
transactionRequest.getTransactionId(await this.getChainId())
|
|
38565
38871
|
);
|
|
38566
38872
|
const chainId = await this.getChainId();
|
|
38567
|
-
return new TransactionResponse(
|
|
38873
|
+
return new TransactionResponse({
|
|
38874
|
+
transactionRequestOrId: transactionRequest,
|
|
38875
|
+
provider: this,
|
|
38876
|
+
chainId,
|
|
38877
|
+
abis,
|
|
38878
|
+
submitAndAwaitSubscription: subscription
|
|
38879
|
+
});
|
|
38568
38880
|
}
|
|
38569
38881
|
/**
|
|
38570
38882
|
* Executes a transaction without actually submitting it to the chain.
|
|
@@ -38810,7 +39122,9 @@ var Provider = class _Provider {
|
|
|
38810
39122
|
}
|
|
38811
39123
|
const chainInfo = _Provider.chainInfoCache[this.urlWithoutAuth];
|
|
38812
39124
|
const {
|
|
38813
|
-
|
|
39125
|
+
latestBlock: {
|
|
39126
|
+
header: { consensusParametersVersion: previous }
|
|
39127
|
+
}
|
|
38814
39128
|
} = chainInfo;
|
|
38815
39129
|
const {
|
|
38816
39130
|
chain: {
|
|
@@ -38912,7 +39226,7 @@ var Provider = class _Provider {
|
|
|
38912
39226
|
* @returns A promise that resolves to the transaction cost object.
|
|
38913
39227
|
*
|
|
38914
39228
|
* @deprecated Use provider.assembleTx instead
|
|
38915
|
-
* Check the migration guide https://docs.fuel.network/
|
|
39229
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
|
38916
39230
|
*/
|
|
38917
39231
|
async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
|
|
38918
39232
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
|
@@ -39056,7 +39370,7 @@ var Provider = class _Provider {
|
|
|
39056
39370
|
requiredBalances,
|
|
39057
39371
|
estimatePredicates,
|
|
39058
39372
|
excludeInput,
|
|
39059
|
-
reserveGas: reserveGas ? reserveGas.toString(10) : void 0
|
|
39373
|
+
reserveGas: reserveGas ? bn(reserveGas).toString(10) : void 0
|
|
39060
39374
|
});
|
|
39061
39375
|
if (status.type === "DryRunFailureStatus") {
|
|
39062
39376
|
const parsedReceipts = status.receipts.map(deserializeReceipt);
|
|
@@ -39068,8 +39382,8 @@ var Provider = class _Provider {
|
|
|
39068
39382
|
if (gqlTransaction.policies?.maxFee) {
|
|
39069
39383
|
request2.maxFee = bn(gqlTransaction.policies.maxFee);
|
|
39070
39384
|
}
|
|
39071
|
-
if (
|
|
39072
|
-
request2.gasLimit = bn(gqlTransaction.scriptGasLimit);
|
|
39385
|
+
if (request2.type === TransactionType.Script) {
|
|
39386
|
+
request2.gasLimit = bn(gqlTransaction.scriptGasLimit).add(bn(reserveGas));
|
|
39073
39387
|
}
|
|
39074
39388
|
const rawReceipts = status.receipts;
|
|
39075
39389
|
const chainId = await this.getChainId();
|
|
@@ -39657,7 +39971,11 @@ var Provider = class _Provider {
|
|
|
39657
39971
|
*/
|
|
39658
39972
|
async getTransactionResponse(transactionId) {
|
|
39659
39973
|
const chainId = await this.getChainId();
|
|
39660
|
-
return new TransactionResponse(
|
|
39974
|
+
return new TransactionResponse({
|
|
39975
|
+
transactionRequestOrId: transactionId,
|
|
39976
|
+
provider: this,
|
|
39977
|
+
chainId
|
|
39978
|
+
});
|
|
39661
39979
|
}
|
|
39662
39980
|
/**
|
|
39663
39981
|
* Returns Message for given nonce.
|
|
@@ -39708,18 +40026,21 @@ var Provider = class _Provider {
|
|
|
39708
40026
|
extractDryRunError(transactionRequest, receipts, reason) {
|
|
39709
40027
|
let logs = [];
|
|
39710
40028
|
let groupedLogs = {};
|
|
40029
|
+
let abis;
|
|
39711
40030
|
if (transactionRequest.type === TransactionType.Script && transactionRequest.abis) {
|
|
39712
40031
|
({ logs, groupedLogs } = getAllDecodedLogs({
|
|
39713
40032
|
receipts,
|
|
39714
40033
|
mainAbi: transactionRequest.abis.main,
|
|
39715
40034
|
externalAbis: transactionRequest.abis.otherContractsAbis
|
|
39716
40035
|
}));
|
|
40036
|
+
abis = transactionRequest.abis;
|
|
39717
40037
|
}
|
|
39718
40038
|
return extractTxError({
|
|
39719
40039
|
logs,
|
|
39720
40040
|
groupedLogs,
|
|
39721
40041
|
receipts,
|
|
39722
|
-
statusReason: reason
|
|
40042
|
+
statusReason: reason,
|
|
40043
|
+
abis
|
|
39723
40044
|
});
|
|
39724
40045
|
}
|
|
39725
40046
|
/**
|
|
@@ -39929,6 +40250,147 @@ var AbstractAccount = class {
|
|
|
39929
40250
|
__name12(this, "AbstractAccount");
|
|
39930
40251
|
}
|
|
39931
40252
|
};
|
|
40253
|
+
var CONSOLIDATABLE_ERROR_CODES = [ErrorCode.MAX_COINS_REACHED];
|
|
40254
|
+
var consolidateCoinsIfRequired = /* @__PURE__ */ __name12(async (opts) => {
|
|
40255
|
+
const { error: errorUnknown, account, skipAutoConsolidation = false } = opts;
|
|
40256
|
+
if (skipAutoConsolidation) {
|
|
40257
|
+
return false;
|
|
40258
|
+
}
|
|
40259
|
+
const error = FuelError.parse(errorUnknown);
|
|
40260
|
+
if (CONSOLIDATABLE_ERROR_CODES.includes(error.code)) {
|
|
40261
|
+
const { assetId, owner } = error.metadata;
|
|
40262
|
+
return account.startConsolidation({
|
|
40263
|
+
owner,
|
|
40264
|
+
assetId
|
|
40265
|
+
});
|
|
40266
|
+
}
|
|
40267
|
+
return false;
|
|
40268
|
+
}, "consolidateCoinsIfRequired");
|
|
40269
|
+
var getAllCoins = /* @__PURE__ */ __name12(async (account, assetId) => {
|
|
40270
|
+
const all = [];
|
|
40271
|
+
let hasNextPage = true;
|
|
40272
|
+
let after;
|
|
40273
|
+
while (hasNextPage) {
|
|
40274
|
+
const { coins, pageInfo } = await account.getCoins(assetId, { after });
|
|
40275
|
+
all.push(...coins);
|
|
40276
|
+
after = coins.pop()?.id;
|
|
40277
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
40278
|
+
}
|
|
40279
|
+
return { coins: all };
|
|
40280
|
+
}, "getAllCoins");
|
|
40281
|
+
var sortCoins = /* @__PURE__ */ __name12(({ coins }) => coins.sort((a, b) => b.amount.cmp(a.amount)), "sortCoins");
|
|
40282
|
+
var createOuputCoin = /* @__PURE__ */ __name12((opts) => {
|
|
40283
|
+
const { transactionId, outputs, baseAssetId } = opts;
|
|
40284
|
+
const outputChangeIndex = outputs.findIndex(
|
|
40285
|
+
(output) => output.type === OutputType.Change && output.assetId === baseAssetId
|
|
40286
|
+
);
|
|
40287
|
+
if (outputChangeIndex === -1) {
|
|
40288
|
+
throw new FuelError(ErrorCode.UNKNOWN, "No change output found");
|
|
40289
|
+
}
|
|
40290
|
+
const outputCoin = outputs[outputChangeIndex];
|
|
40291
|
+
const outputIndexPadded = Number(outputChangeIndex).toString().padStart(4, "0");
|
|
40292
|
+
return {
|
|
40293
|
+
id: `${transactionId}${outputIndexPadded}`,
|
|
40294
|
+
assetId: outputCoin.assetId,
|
|
40295
|
+
amount: outputCoin.amount,
|
|
40296
|
+
owner: new Address(outputCoin.to),
|
|
40297
|
+
blockCreated: bn(0),
|
|
40298
|
+
txCreatedIdx: bn(0)
|
|
40299
|
+
};
|
|
40300
|
+
}, "createOuputCoin");
|
|
40301
|
+
var consolidateCoins = /* @__PURE__ */ __name12(async ({
|
|
40302
|
+
account,
|
|
40303
|
+
assetId
|
|
40304
|
+
}) => {
|
|
40305
|
+
const chainInfo = await account.provider.getChain();
|
|
40306
|
+
const chainId = chainInfo.consensusParameters.chainId.toNumber();
|
|
40307
|
+
const gasPrice = await account.provider.estimateGasPrice(10);
|
|
40308
|
+
const maxInputs = chainInfo.consensusParameters.txParameters.maxInputs.toNumber();
|
|
40309
|
+
const baseAssetId = await account.provider.getBaseAssetId();
|
|
40310
|
+
const isBaseAsset = assetId === baseAssetId;
|
|
40311
|
+
const batchSize = maxInputs;
|
|
40312
|
+
const numberOfFundingCoins = maxInputs;
|
|
40313
|
+
let funding = [];
|
|
40314
|
+
let dust = [];
|
|
40315
|
+
if (isBaseAsset) {
|
|
40316
|
+
const coins = await getAllCoins(account, baseAssetId).then(sortCoins);
|
|
40317
|
+
funding = coins.slice(0, numberOfFundingCoins);
|
|
40318
|
+
dust = coins.slice(numberOfFundingCoins);
|
|
40319
|
+
} else {
|
|
40320
|
+
funding = await getAllCoins(account, baseAssetId).then(sortCoins).then((coins) => coins.slice(0, numberOfFundingCoins));
|
|
40321
|
+
dust = await getAllCoins(account, assetId).then(({ coins }) => coins);
|
|
40322
|
+
}
|
|
40323
|
+
if (funding.length === 0) {
|
|
40324
|
+
throw new FuelError(
|
|
40325
|
+
ErrorCode.INSUFFICIENT_FUNDS,
|
|
40326
|
+
`Insufficient funds to consolidate.
|
|
40327
|
+
Asset ID: ${baseAssetId}
|
|
40328
|
+
Owner: ${account.address.toB256()}`
|
|
40329
|
+
);
|
|
40330
|
+
}
|
|
40331
|
+
const batches = [
|
|
40332
|
+
...splitEvery_default(batchSize, funding),
|
|
40333
|
+
// We leave one coin for the funding coin
|
|
40334
|
+
...splitEvery_default(batchSize - 1, dust)
|
|
40335
|
+
];
|
|
40336
|
+
const txs = batches.map((batch) => {
|
|
40337
|
+
const request2 = new ScriptTransactionRequest({
|
|
40338
|
+
scriptData: "0x"
|
|
40339
|
+
});
|
|
40340
|
+
request2.addResources(batch);
|
|
40341
|
+
return request2;
|
|
40342
|
+
});
|
|
40343
|
+
const submitAll = /* @__PURE__ */ __name12(async (opts = {}) => {
|
|
40344
|
+
const txResponses = [];
|
|
40345
|
+
let previousTx;
|
|
40346
|
+
for (let i = 0; i < txs.length; i++) {
|
|
40347
|
+
let currentTx = txs[i];
|
|
40348
|
+
const step = i + 1;
|
|
40349
|
+
if (previousTx) {
|
|
40350
|
+
const coin = createOuputCoin({
|
|
40351
|
+
transactionId: previousTx.transactionId,
|
|
40352
|
+
outputs: previousTx.outputs,
|
|
40353
|
+
baseAssetId
|
|
40354
|
+
});
|
|
40355
|
+
currentTx.addResource(coin);
|
|
40356
|
+
}
|
|
40357
|
+
if ("populateTransactionPredicateData" in account && typeof account.populateTransactionPredicateData === "function") {
|
|
40358
|
+
currentTx = account.populateTransactionPredicateData(currentTx);
|
|
40359
|
+
currentTx = await account.provider.estimatePredicates(currentTx);
|
|
40360
|
+
}
|
|
40361
|
+
const fee = calculateGasFee({
|
|
40362
|
+
gasPrice,
|
|
40363
|
+
gas: currentTx.calculateMinGas(chainInfo),
|
|
40364
|
+
priceFactor: chainInfo.consensusParameters.feeParameters.gasPriceFactor,
|
|
40365
|
+
tip: currentTx.tip
|
|
40366
|
+
});
|
|
40367
|
+
currentTx.maxFee = fee;
|
|
40368
|
+
currentTx.gasLimit = bn(1e3);
|
|
40369
|
+
opts.onTransactionStart?.({
|
|
40370
|
+
tx: currentTx,
|
|
40371
|
+
step,
|
|
40372
|
+
assetId,
|
|
40373
|
+
transactionId: currentTx.getTransactionId(chainId)
|
|
40374
|
+
});
|
|
40375
|
+
const response = await account.sendTransaction(currentTx);
|
|
40376
|
+
const result = await response.waitForResult();
|
|
40377
|
+
txResponses.push(result);
|
|
40378
|
+
previousTx = {
|
|
40379
|
+
transactionId: response.id,
|
|
40380
|
+
outputs: result.transaction.outputs
|
|
40381
|
+
};
|
|
40382
|
+
}
|
|
40383
|
+
return {
|
|
40384
|
+
txResponses,
|
|
40385
|
+
errors: []
|
|
40386
|
+
};
|
|
40387
|
+
}, "submitAll");
|
|
40388
|
+
return {
|
|
40389
|
+
txs,
|
|
40390
|
+
totalFeeCost: txs.reduce((acc, request2) => acc.add(request2.maxFee), bn(0)),
|
|
40391
|
+
submitAll
|
|
40392
|
+
};
|
|
40393
|
+
}, "consolidateCoins");
|
|
39932
40394
|
var formatTransferToContractScriptData = /* @__PURE__ */ __name12((transferParams) => {
|
|
39933
40395
|
const numberCoder = new BigNumberCoder("u64");
|
|
39934
40396
|
return transferParams.reduce((acc, transferParam) => {
|
|
@@ -40042,10 +40504,24 @@ var Account = class extends AbstractAccount {
|
|
|
40042
40504
|
*
|
|
40043
40505
|
* @param quantities - Quantities of resources to be obtained.
|
|
40044
40506
|
* @param resourcesIdsToIgnore - IDs of resources to be excluded from the query (optional).
|
|
40507
|
+
* @param skipAutoConsolidation - Whether to skip the automatic consolidatation of coins process (optional).
|
|
40045
40508
|
* @returns A promise that resolves to an array of Resources.
|
|
40046
40509
|
*/
|
|
40047
|
-
async getResourcesToSpend(quantities, resourcesIdsToIgnore) {
|
|
40048
|
-
|
|
40510
|
+
async getResourcesToSpend(quantities, resourcesIdsToIgnore, { skipAutoConsolidation } = {}) {
|
|
40511
|
+
const getResourcesToSpend = /* @__PURE__ */ __name12(() => this.provider.getResourcesToSpend(this.address, quantities, resourcesIdsToIgnore), "getResourcesToSpend");
|
|
40512
|
+
try {
|
|
40513
|
+
return await getResourcesToSpend();
|
|
40514
|
+
} catch (error) {
|
|
40515
|
+
const shouldRetry = await consolidateCoinsIfRequired({
|
|
40516
|
+
error,
|
|
40517
|
+
account: this,
|
|
40518
|
+
skipAutoConsolidation
|
|
40519
|
+
});
|
|
40520
|
+
if (!shouldRetry) {
|
|
40521
|
+
throw error;
|
|
40522
|
+
}
|
|
40523
|
+
return await getResourcesToSpend();
|
|
40524
|
+
}
|
|
40049
40525
|
}
|
|
40050
40526
|
/**
|
|
40051
40527
|
* Retrieves coins owned by the account.
|
|
@@ -40092,9 +40568,9 @@ var Account = class extends AbstractAccount {
|
|
|
40092
40568
|
* @returns A promise that resolves to the funded transaction request.
|
|
40093
40569
|
*
|
|
40094
40570
|
* @deprecated Use provider.assembleTx instead
|
|
40095
|
-
* Check the migration guide https://docs.fuel.network/
|
|
40571
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
|
40096
40572
|
*/
|
|
40097
|
-
async fund(request2, params) {
|
|
40573
|
+
async fund(request2, params, { skipAutoConsolidation } = {}) {
|
|
40098
40574
|
const {
|
|
40099
40575
|
addedSignatures,
|
|
40100
40576
|
estimatedPredicates,
|
|
@@ -40140,7 +40616,8 @@ var Account = class extends AbstractAccount {
|
|
|
40140
40616
|
while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
|
|
40141
40617
|
const resources = await this.getResourcesToSpend(
|
|
40142
40618
|
missingQuantities,
|
|
40143
|
-
cacheRequestInputsResourcesFromOwner(request2.inputs, this.address)
|
|
40619
|
+
cacheRequestInputsResourcesFromOwner(request2.inputs, this.address),
|
|
40620
|
+
{ skipAutoConsolidation }
|
|
40144
40621
|
);
|
|
40145
40622
|
request2.addResources(resources);
|
|
40146
40623
|
request2.updatePredicateGasUsed(estimatedPredicates);
|
|
@@ -40178,7 +40655,7 @@ var Account = class extends AbstractAccount {
|
|
|
40178
40655
|
}
|
|
40179
40656
|
if (needsToBeFunded) {
|
|
40180
40657
|
throw new FuelError(
|
|
40181
|
-
ErrorCode.
|
|
40658
|
+
ErrorCode.INSUFFICIENT_FUNDS,
|
|
40182
40659
|
`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
|
|
40183
40660
|
);
|
|
40184
40661
|
}
|
|
@@ -40206,16 +40683,20 @@ var Account = class extends AbstractAccount {
|
|
|
40206
40683
|
* @param amount - The amount of coins to transfer.
|
|
40207
40684
|
* @param assetId - The asset ID of the coins to transfer (optional).
|
|
40208
40685
|
* @param txParams - The transaction parameters (optional).
|
|
40686
|
+
* @param skipAutoConsolidation - Whether to skip the automatic consolidatation of coins process (optional).
|
|
40209
40687
|
* @returns A promise that resolves to the prepared transaction request.
|
|
40210
40688
|
*/
|
|
40211
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
|
40689
|
+
async createTransfer(destination, amount, assetId, txParams = {}, { skipAutoConsolidation } = {}) {
|
|
40212
40690
|
let request2 = new ScriptTransactionRequest(txParams);
|
|
40213
40691
|
request2 = this.addTransfer(request2, {
|
|
40214
40692
|
destination,
|
|
40215
40693
|
amount,
|
|
40216
40694
|
assetId: assetId || await this.provider.getBaseAssetId()
|
|
40217
40695
|
});
|
|
40218
|
-
const { gasPrice, transactionRequest } = await this.assembleTx(
|
|
40696
|
+
const { gasPrice, transactionRequest } = await this.assembleTx({
|
|
40697
|
+
transactionRequest: request2,
|
|
40698
|
+
skipAutoConsolidation
|
|
40699
|
+
});
|
|
40219
40700
|
request2 = await setAndValidateGasAndFeeForAssembledTx({
|
|
40220
40701
|
gasPrice,
|
|
40221
40702
|
provider: this.provider,
|
|
@@ -40232,10 +40713,13 @@ var Account = class extends AbstractAccount {
|
|
|
40232
40713
|
* @param amount - The amount of coins to transfer.
|
|
40233
40714
|
* @param assetId - The asset ID of the coins to transfer (optional).
|
|
40234
40715
|
* @param txParams - The transaction parameters (optional).
|
|
40716
|
+
* @param skipAutoConsolidation - Whether to skip the automatic consolidatation of coins process (optional).
|
|
40235
40717
|
* @returns A promise that resolves to the transaction response.
|
|
40236
40718
|
*/
|
|
40237
|
-
async transfer(destination, amount, assetId, txParams = {}) {
|
|
40238
|
-
const request2 = await this.createTransfer(destination, amount, assetId, txParams
|
|
40719
|
+
async transfer(destination, amount, assetId, txParams = {}, { skipAutoConsolidation } = {}) {
|
|
40720
|
+
const request2 = await this.createTransfer(destination, amount, assetId, txParams, {
|
|
40721
|
+
skipAutoConsolidation
|
|
40722
|
+
});
|
|
40239
40723
|
return this.sendTransaction(request2, { estimateTxDependencies: false });
|
|
40240
40724
|
}
|
|
40241
40725
|
/**
|
|
@@ -40243,12 +40727,16 @@ var Account = class extends AbstractAccount {
|
|
|
40243
40727
|
*
|
|
40244
40728
|
* @param transferParams - An array of `TransferParams` objects representing the transfers to be made.
|
|
40245
40729
|
* @param txParams - Optional transaction parameters.
|
|
40730
|
+
* @param skipAutoConsolidation - Whether to skip the automatic consolidatation of coins process (optional).
|
|
40246
40731
|
* @returns A promise that resolves to a `TransactionResponse` object representing the transaction result.
|
|
40247
40732
|
*/
|
|
40248
|
-
async batchTransfer(transferParams, txParams = {}) {
|
|
40733
|
+
async batchTransfer(transferParams, txParams = {}, { skipAutoConsolidation } = {}) {
|
|
40249
40734
|
let request2 = new ScriptTransactionRequest(txParams);
|
|
40250
40735
|
request2 = this.addBatchTransfer(request2, transferParams);
|
|
40251
|
-
const { gasPrice, transactionRequest } = await this.assembleTx(
|
|
40736
|
+
const { gasPrice, transactionRequest } = await this.assembleTx({
|
|
40737
|
+
transactionRequest: request2,
|
|
40738
|
+
skipAutoConsolidation
|
|
40739
|
+
});
|
|
40252
40740
|
request2 = await setAndValidateGasAndFeeForAssembledTx({
|
|
40253
40741
|
gasPrice,
|
|
40254
40742
|
provider: this.provider,
|
|
@@ -40295,12 +40783,15 @@ var Account = class extends AbstractAccount {
|
|
|
40295
40783
|
* @param amount - The amount of coins to transfer.
|
|
40296
40784
|
* @param assetId - The asset ID of the coins to transfer (optional).
|
|
40297
40785
|
* @param txParams - The transaction parameters (optional).
|
|
40786
|
+
* @param skipAutoConsolidation - Whether to skip the automatic consolidatation of coins process (optional).
|
|
40298
40787
|
* @returns A promise that resolves to the transaction response.
|
|
40299
40788
|
*/
|
|
40300
|
-
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
|
40301
|
-
return this.batchTransferToContracts([{ amount, assetId, contractId }], txParams
|
|
40789
|
+
async transferToContract(contractId, amount, assetId, txParams = {}, { skipAutoConsolidation } = {}) {
|
|
40790
|
+
return this.batchTransferToContracts([{ amount, assetId, contractId }], txParams, {
|
|
40791
|
+
skipAutoConsolidation
|
|
40792
|
+
});
|
|
40302
40793
|
}
|
|
40303
|
-
async batchTransferToContracts(contractTransferParams, txParams = {}) {
|
|
40794
|
+
async batchTransferToContracts(contractTransferParams, txParams = {}, { skipAutoConsolidation } = {}) {
|
|
40304
40795
|
let request2 = new ScriptTransactionRequest({
|
|
40305
40796
|
...txParams
|
|
40306
40797
|
});
|
|
@@ -40327,7 +40818,11 @@ var Account = class extends AbstractAccount {
|
|
|
40327
40818
|
const { script, scriptData } = await assembleTransferToContractScript(transferParams);
|
|
40328
40819
|
request2.script = script;
|
|
40329
40820
|
request2.scriptData = scriptData;
|
|
40330
|
-
const { gasPrice, transactionRequest } = await this.assembleTx(
|
|
40821
|
+
const { gasPrice, transactionRequest } = await this.assembleTx({
|
|
40822
|
+
transactionRequest: request2,
|
|
40823
|
+
quantities,
|
|
40824
|
+
skipAutoConsolidation
|
|
40825
|
+
});
|
|
40331
40826
|
request2 = await setAndValidateGasAndFeeForAssembledTx({
|
|
40332
40827
|
gasPrice,
|
|
40333
40828
|
provider: this.provider,
|
|
@@ -40343,9 +40838,10 @@ var Account = class extends AbstractAccount {
|
|
|
40343
40838
|
* @param recipient - Address of the recipient on the base chain.
|
|
40344
40839
|
* @param amount - Amount of base asset.
|
|
40345
40840
|
* @param txParams - The transaction parameters (optional).
|
|
40841
|
+
* @param skipAutoConsolidation - Whether to skip the automatic consolidatation of coins process (optional).
|
|
40346
40842
|
* @returns A promise that resolves to the transaction response.
|
|
40347
40843
|
*/
|
|
40348
|
-
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
|
40844
|
+
async withdrawToBaseLayer(recipient, amount, txParams = {}, { skipAutoConsolidation } = {}) {
|
|
40349
40845
|
const recipientAddress = new Address(recipient);
|
|
40350
40846
|
const recipientDataArray = arrayify(
|
|
40351
40847
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
|
@@ -40362,7 +40858,11 @@ var Account = class extends AbstractAccount {
|
|
|
40362
40858
|
const baseAssetId = await this.provider.getBaseAssetId();
|
|
40363
40859
|
let request2 = new ScriptTransactionRequest(params);
|
|
40364
40860
|
const quantities = [{ amount: bn(amount), assetId: baseAssetId }];
|
|
40365
|
-
const { gasPrice, transactionRequest } = await this.assembleTx(
|
|
40861
|
+
const { gasPrice, transactionRequest } = await this.assembleTx({
|
|
40862
|
+
transactionRequest: request2,
|
|
40863
|
+
quantities,
|
|
40864
|
+
skipAutoConsolidation
|
|
40865
|
+
});
|
|
40366
40866
|
request2 = await setAndValidateGasAndFeeForAssembledTx({
|
|
40367
40867
|
gasPrice,
|
|
40368
40868
|
provider: this.provider,
|
|
@@ -40372,6 +40872,25 @@ var Account = class extends AbstractAccount {
|
|
|
40372
40872
|
});
|
|
40373
40873
|
return this.sendTransaction(request2);
|
|
40374
40874
|
}
|
|
40875
|
+
/**
|
|
40876
|
+
* Start the consolidation process
|
|
40877
|
+
*
|
|
40878
|
+
* @param owner - The B256 address of the owner.
|
|
40879
|
+
* @param assetId - The asset ID that requires consolidation.
|
|
40880
|
+
*/
|
|
40881
|
+
async startConsolidation(opts) {
|
|
40882
|
+
if (this._connector) {
|
|
40883
|
+
await this._connector.startConsolidation(opts);
|
|
40884
|
+
return false;
|
|
40885
|
+
}
|
|
40886
|
+
const { owner, assetId } = opts;
|
|
40887
|
+
if (owner !== this.address.toB256()) {
|
|
40888
|
+
return false;
|
|
40889
|
+
}
|
|
40890
|
+
const { submitAll } = await consolidateCoins({ account: this, assetId });
|
|
40891
|
+
await submitAll();
|
|
40892
|
+
return true;
|
|
40893
|
+
}
|
|
40375
40894
|
/**
|
|
40376
40895
|
* Consolidates base asset UTXOs into fewer, larger ones.
|
|
40377
40896
|
*
|
|
@@ -40391,6 +40910,7 @@ var Account = class extends AbstractAccount {
|
|
|
40391
40910
|
const isBaseAsset = baseAssetId === assetId;
|
|
40392
40911
|
let submitAll;
|
|
40393
40912
|
const consolidationParams = {
|
|
40913
|
+
assetId,
|
|
40394
40914
|
coins,
|
|
40395
40915
|
mode: params.mode,
|
|
40396
40916
|
outputNum: params.outputNum
|
|
@@ -40398,10 +40918,7 @@ var Account = class extends AbstractAccount {
|
|
|
40398
40918
|
if (isBaseAsset) {
|
|
40399
40919
|
({ submitAll } = await this.assembleBaseAssetConsolidationTxs(consolidationParams));
|
|
40400
40920
|
} else {
|
|
40401
|
-
|
|
40402
|
-
ErrorCode.UNSUPPORTED_FEATURE,
|
|
40403
|
-
"Consolidation for non-base assets is not supported yet."
|
|
40404
|
-
);
|
|
40921
|
+
({ submitAll } = await this.assembleNonBaseAssetConsolidationTxs(consolidationParams));
|
|
40405
40922
|
}
|
|
40406
40923
|
return submitAll();
|
|
40407
40924
|
}
|
|
@@ -40460,6 +40977,70 @@ var Account = class extends AbstractAccount {
|
|
|
40460
40977
|
const submitAll = this.prepareSubmitAll({ txs, mode });
|
|
40461
40978
|
return { txs, totalFeeCost, submitAll };
|
|
40462
40979
|
}
|
|
40980
|
+
async assembleNonBaseAssetConsolidationTxs(params) {
|
|
40981
|
+
const { assetId, coins, mode = "parallel", outputNum = 1 } = params;
|
|
40982
|
+
this.validateConsolidationTxsCoins(coins, assetId);
|
|
40983
|
+
const chainInfo = await this.provider.getChain();
|
|
40984
|
+
const maxInputsNumber = chainInfo.consensusParameters.txParameters.maxInputs.toNumber();
|
|
40985
|
+
const baseAssetId = chainInfo.consensusParameters.baseAssetId;
|
|
40986
|
+
const { coins: baseAssetCoins } = await this.provider.getCoins(this.address, baseAssetId);
|
|
40987
|
+
let totalFeeCost = bn(0);
|
|
40988
|
+
const txs = [];
|
|
40989
|
+
const gasPrice = await this.provider.estimateGasPrice(10);
|
|
40990
|
+
const consolidateMoreThanOneCoin = outputNum > 1;
|
|
40991
|
+
const assetCoinBatches = splitCoinsIntoBatches(coins, maxInputsNumber);
|
|
40992
|
+
assetCoinBatches.filter((batch) => batch.length > 1).forEach((coinBatch) => {
|
|
40993
|
+
const request2 = new ScriptTransactionRequest({
|
|
40994
|
+
script: "0x"
|
|
40995
|
+
});
|
|
40996
|
+
request2.addResources(coinBatch);
|
|
40997
|
+
if (consolidateMoreThanOneCoin) {
|
|
40998
|
+
Array.from({ length: outputNum - 1 }).forEach(() => {
|
|
40999
|
+
request2.addCoinOutput(this.address, 0, assetId);
|
|
41000
|
+
});
|
|
41001
|
+
}
|
|
41002
|
+
const minGas = request2.calculateMinGas(chainInfo);
|
|
41003
|
+
const fee = calculateGasFee({
|
|
41004
|
+
gasPrice,
|
|
41005
|
+
gas: minGas,
|
|
41006
|
+
priceFactor: chainInfo.consensusParameters.feeParameters.gasPriceFactor,
|
|
41007
|
+
tip: request2.tip
|
|
41008
|
+
});
|
|
41009
|
+
request2.maxFee = fee;
|
|
41010
|
+
if (consolidateMoreThanOneCoin) {
|
|
41011
|
+
const total = request2.inputs.filter(isRequestInputCoin).reduce((acc, input) => acc.add(input.amount), bn(0));
|
|
41012
|
+
const amountPerNewUtxo = total.div(outputNum + 1);
|
|
41013
|
+
request2.outputs.forEach((output) => {
|
|
41014
|
+
if (output.type === OutputType.Coin) {
|
|
41015
|
+
output.amount = amountPerNewUtxo;
|
|
41016
|
+
}
|
|
41017
|
+
});
|
|
41018
|
+
}
|
|
41019
|
+
totalFeeCost = totalFeeCost.add(fee);
|
|
41020
|
+
const baseAssetResources = [];
|
|
41021
|
+
let fundingFeeTotal = bn(0);
|
|
41022
|
+
while (fundingFeeTotal.lt(fee)) {
|
|
41023
|
+
const baseAssetCoin = baseAssetCoins.pop();
|
|
41024
|
+
if (!baseAssetCoin) {
|
|
41025
|
+
break;
|
|
41026
|
+
}
|
|
41027
|
+
baseAssetResources.push(baseAssetCoin);
|
|
41028
|
+
fundingFeeTotal = fundingFeeTotal.add(baseAssetCoin.amount);
|
|
41029
|
+
}
|
|
41030
|
+
const { inputs } = request2;
|
|
41031
|
+
request2.inputs = inputs.slice(0, maxInputsNumber - baseAssetResources.length);
|
|
41032
|
+
const removedCoins = coinBatch.slice(maxInputsNumber - baseAssetResources.length);
|
|
41033
|
+
request2.addResources(baseAssetResources);
|
|
41034
|
+
const lastCoinBatch = assetCoinBatches[assetCoinBatches.length - 1];
|
|
41035
|
+
lastCoinBatch.push(...removedCoins);
|
|
41036
|
+
if (lastCoinBatch.length > maxInputsNumber) {
|
|
41037
|
+
assetCoinBatches.push(lastCoinBatch.slice(maxInputsNumber));
|
|
41038
|
+
}
|
|
41039
|
+
txs.push(request2);
|
|
41040
|
+
});
|
|
41041
|
+
const submitAll = this.prepareSubmitAll({ txs, mode });
|
|
41042
|
+
return { txs, totalFeeCost, submitAll };
|
|
41043
|
+
}
|
|
40463
41044
|
/**
|
|
40464
41045
|
* Prepares a function to submit all transactions either sequentially or in parallel.
|
|
40465
41046
|
*
|
|
@@ -40511,7 +41092,7 @@ var Account = class extends AbstractAccount {
|
|
|
40511
41092
|
* @returns A promise that resolves to the transaction cost object.
|
|
40512
41093
|
*
|
|
40513
41094
|
* @deprecated Use provider.assembleTx instead
|
|
40514
|
-
* Check the migration guide https://docs.fuel.network/
|
|
41095
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
|
40515
41096
|
*/
|
|
40516
41097
|
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
|
|
40517
41098
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
|
@@ -40576,14 +41157,23 @@ var Account = class extends AbstractAccount {
|
|
|
40576
41157
|
* @param transactionRequestLike - The transaction request to sign.
|
|
40577
41158
|
* @returns A promise that resolves to the signature of the transaction.
|
|
40578
41159
|
*/
|
|
40579
|
-
async signTransaction(transactionRequestLike) {
|
|
41160
|
+
async signTransaction(transactionRequestLike, connectorOptions = {}) {
|
|
40580
41161
|
if (!this._connector) {
|
|
40581
41162
|
throw new FuelError(
|
|
40582
41163
|
ErrorCode.MISSING_CONNECTOR,
|
|
40583
41164
|
"A connector is required to sign transactions."
|
|
40584
41165
|
);
|
|
40585
41166
|
}
|
|
40586
|
-
|
|
41167
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
|
41168
|
+
const { transactionRequest: requestToSign, connectorsSendTxParams } = await this.setTransactionStateForConnectors({
|
|
41169
|
+
transactionRequest,
|
|
41170
|
+
connectorOptions
|
|
41171
|
+
});
|
|
41172
|
+
return this._connector.signTransaction(
|
|
41173
|
+
this.address.toString(),
|
|
41174
|
+
requestToSign,
|
|
41175
|
+
connectorsSendTxParams
|
|
41176
|
+
);
|
|
40587
41177
|
}
|
|
40588
41178
|
/**
|
|
40589
41179
|
* Sends a transaction to the network.
|
|
@@ -40593,24 +41183,16 @@ var Account = class extends AbstractAccount {
|
|
|
40593
41183
|
* @returns A promise that resolves to the transaction response.
|
|
40594
41184
|
*/
|
|
40595
41185
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
|
40596
|
-
|
|
41186
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
|
40597
41187
|
if (this._connector) {
|
|
40598
|
-
const
|
|
40599
|
-
|
|
40600
|
-
|
|
40601
|
-
|
|
40602
|
-
skipCustomFee,
|
|
40603
|
-
provider: {
|
|
40604
|
-
url: this.provider.url,
|
|
40605
|
-
cache: await serializeProviderCache(this.provider)
|
|
40606
|
-
},
|
|
40607
|
-
transactionState: transactionRequest.flag.state,
|
|
40608
|
-
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
|
40609
|
-
};
|
|
41188
|
+
const response = await this.setTransactionStateForConnectors({
|
|
41189
|
+
transactionRequest,
|
|
41190
|
+
connectorOptions
|
|
41191
|
+
});
|
|
40610
41192
|
const transaction = await this._connector.sendTransaction(
|
|
40611
41193
|
this.address.toString(),
|
|
40612
|
-
transactionRequest,
|
|
40613
|
-
|
|
41194
|
+
response.transactionRequest,
|
|
41195
|
+
response.connectorsSendTxParams
|
|
40614
41196
|
);
|
|
40615
41197
|
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
|
40616
41198
|
}
|
|
@@ -40673,16 +41255,32 @@ var Account = class extends AbstractAccount {
|
|
|
40673
41255
|
} : void 0;
|
|
40674
41256
|
}
|
|
40675
41257
|
/** @hidden * */
|
|
40676
|
-
async assembleTx(
|
|
41258
|
+
async assembleTx(opts) {
|
|
41259
|
+
const { transactionRequest, quantities = [], skipAutoConsolidation } = opts;
|
|
40677
41260
|
const outputQuantities = transactionRequest.outputs.filter((o) => o.type === OutputType.Coin).map(({ amount, assetId }) => ({ assetId: String(assetId), amount: bn(amount) }));
|
|
40678
41261
|
transactionRequest.gasLimit = bn(0);
|
|
40679
41262
|
transactionRequest.maxFee = bn(0);
|
|
40680
|
-
const
|
|
40681
|
-
|
|
40682
|
-
|
|
40683
|
-
|
|
40684
|
-
|
|
40685
|
-
|
|
41263
|
+
const assembleTx = /* @__PURE__ */ __name12(async () => {
|
|
41264
|
+
const { assembledRequest, gasPrice } = await this.provider.assembleTx({
|
|
41265
|
+
request: transactionRequest,
|
|
41266
|
+
accountCoinQuantities: mergeQuantities(outputQuantities, quantities),
|
|
41267
|
+
feePayerAccount: this
|
|
41268
|
+
});
|
|
41269
|
+
return { transactionRequest: assembledRequest, gasPrice };
|
|
41270
|
+
}, "assembleTx");
|
|
41271
|
+
try {
|
|
41272
|
+
return await assembleTx();
|
|
41273
|
+
} catch (error) {
|
|
41274
|
+
const shouldRetry = await consolidateCoinsIfRequired({
|
|
41275
|
+
error,
|
|
41276
|
+
account: this,
|
|
41277
|
+
skipAutoConsolidation
|
|
41278
|
+
});
|
|
41279
|
+
if (!shouldRetry) {
|
|
41280
|
+
throw error;
|
|
41281
|
+
}
|
|
41282
|
+
return await assembleTx();
|
|
41283
|
+
}
|
|
40686
41284
|
}
|
|
40687
41285
|
/** @hidden * */
|
|
40688
41286
|
validateTransferAmount(amount) {
|
|
@@ -40694,45 +41292,6 @@ var Account = class extends AbstractAccount {
|
|
|
40694
41292
|
}
|
|
40695
41293
|
}
|
|
40696
41294
|
/** @hidden * */
|
|
40697
|
-
async estimateAndFundTransaction(transactionRequest, txParams, costParams) {
|
|
40698
|
-
let request2 = transactionRequest;
|
|
40699
|
-
const txCost = await this.getTransactionCost(request2, costParams);
|
|
40700
|
-
request2 = this.validateGasLimitAndMaxFee({
|
|
40701
|
-
transactionRequest: request2,
|
|
40702
|
-
gasUsed: txCost.gasUsed,
|
|
40703
|
-
maxFee: txCost.maxFee,
|
|
40704
|
-
txParams
|
|
40705
|
-
});
|
|
40706
|
-
request2 = await this.fund(request2, txCost);
|
|
40707
|
-
return request2;
|
|
40708
|
-
}
|
|
40709
|
-
/** @hidden * */
|
|
40710
|
-
validateGasLimitAndMaxFee({
|
|
40711
|
-
gasUsed,
|
|
40712
|
-
maxFee,
|
|
40713
|
-
transactionRequest,
|
|
40714
|
-
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
|
|
40715
|
-
}) {
|
|
40716
|
-
const request2 = transactionRequestify(transactionRequest);
|
|
40717
|
-
if (!isDefined(setGasLimit)) {
|
|
40718
|
-
request2.gasLimit = gasUsed;
|
|
40719
|
-
} else if (gasUsed.gt(setGasLimit)) {
|
|
40720
|
-
throw new FuelError(
|
|
40721
|
-
ErrorCode.GAS_LIMIT_TOO_LOW,
|
|
40722
|
-
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
|
40723
|
-
);
|
|
40724
|
-
}
|
|
40725
|
-
if (!isDefined(setMaxFee)) {
|
|
40726
|
-
request2.maxFee = maxFee;
|
|
40727
|
-
} else if (maxFee.gt(setMaxFee)) {
|
|
40728
|
-
throw new FuelError(
|
|
40729
|
-
ErrorCode.MAX_FEE_TOO_LOW,
|
|
40730
|
-
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
|
40731
|
-
);
|
|
40732
|
-
}
|
|
40733
|
-
return request2;
|
|
40734
|
-
}
|
|
40735
|
-
/** @hidden * */
|
|
40736
41295
|
validateConsolidationTxsCoins(coins, assetId) {
|
|
40737
41296
|
if (coins.length <= 1) {
|
|
40738
41297
|
throw new FuelError(ErrorCode.NO_COINS_TO_CONSOLIDATE, "No coins to consolidate.");
|
|
@@ -40744,6 +41303,23 @@ var Account = class extends AbstractAccount {
|
|
|
40744
41303
|
);
|
|
40745
41304
|
}
|
|
40746
41305
|
}
|
|
41306
|
+
/** @hidden * */
|
|
41307
|
+
async setTransactionStateForConnectors(params) {
|
|
41308
|
+
const { transactionRequest: requestToPrepare, connectorOptions } = params;
|
|
41309
|
+
const { onBeforeSend, skipCustomFee = false } = connectorOptions;
|
|
41310
|
+
const transactionRequest = await this.prepareTransactionForSend(requestToPrepare);
|
|
41311
|
+
const connectorsSendTxParams = {
|
|
41312
|
+
onBeforeSend,
|
|
41313
|
+
skipCustomFee,
|
|
41314
|
+
provider: {
|
|
41315
|
+
url: this.provider.url,
|
|
41316
|
+
cache: await serializeProviderCache(this.provider)
|
|
41317
|
+
},
|
|
41318
|
+
transactionState: requestToPrepare.flag.state,
|
|
41319
|
+
transactionSummary: await this.prepareTransactionSummary(requestToPrepare)
|
|
41320
|
+
};
|
|
41321
|
+
return { transactionRequest, connectorsSendTxParams };
|
|
41322
|
+
}
|
|
40747
41323
|
};
|
|
40748
41324
|
var Signer = class _Signer {
|
|
40749
41325
|
static {
|
|
@@ -44549,6 +45125,14 @@ var Predicate = class _Predicate extends Account {
|
|
|
44549
45125
|
configurableConstants: overrides.configurableConstants ?? this.configurableConstants
|
|
44550
45126
|
});
|
|
44551
45127
|
}
|
|
45128
|
+
/**
|
|
45129
|
+
* Sets the predicate data.
|
|
45130
|
+
*
|
|
45131
|
+
* @param data - The data to be set for the predicate.
|
|
45132
|
+
*/
|
|
45133
|
+
setData(data) {
|
|
45134
|
+
this.predicateData = data;
|
|
45135
|
+
}
|
|
44552
45136
|
/**
|
|
44553
45137
|
* Processes the predicate data and returns the altered bytecode and interface.
|
|
44554
45138
|
*
|
|
@@ -44699,6 +45283,7 @@ var FuelConnectorMethods = /* @__PURE__ */ ((FuelConnectorMethods2) => {
|
|
|
44699
45283
|
FuelConnectorMethods2["isConnected"] = "isConnected";
|
|
44700
45284
|
FuelConnectorMethods2["accounts"] = "accounts";
|
|
44701
45285
|
FuelConnectorMethods2["currentAccount"] = "currentAccount";
|
|
45286
|
+
FuelConnectorMethods2["signTransaction"] = "signTransaction";
|
|
44702
45287
|
FuelConnectorMethods2["signMessage"] = "signMessage";
|
|
44703
45288
|
FuelConnectorMethods2["sendTransaction"] = "sendTransaction";
|
|
44704
45289
|
FuelConnectorMethods2["assets"] = "assets";
|
|
@@ -44711,6 +45296,7 @@ var FuelConnectorMethods = /* @__PURE__ */ ((FuelConnectorMethods2) => {
|
|
|
44711
45296
|
FuelConnectorMethods2["addABI"] = "addABI";
|
|
44712
45297
|
FuelConnectorMethods2["getABI"] = "getABI";
|
|
44713
45298
|
FuelConnectorMethods2["hasABI"] = "hasABI";
|
|
45299
|
+
FuelConnectorMethods2["startConsolidation"] = "startConsolidation";
|
|
44714
45300
|
return FuelConnectorMethods2;
|
|
44715
45301
|
})(FuelConnectorMethods || {});
|
|
44716
45302
|
var FuelConnectorEventTypes = /* @__PURE__ */ ((FuelConnectorEventTypes2) => {
|
|
@@ -44723,6 +45309,7 @@ var FuelConnectorEventTypes = /* @__PURE__ */ ((FuelConnectorEventTypes2) => {
|
|
|
44723
45309
|
FuelConnectorEventTypes2["currentNetwork"] = "currentNetwork";
|
|
44724
45310
|
FuelConnectorEventTypes2["assets"] = "assets";
|
|
44725
45311
|
FuelConnectorEventTypes2["abis"] = "abis";
|
|
45312
|
+
FuelConnectorEventTypes2["consolidateCoins"] = "consolidateCoins";
|
|
44726
45313
|
return FuelConnectorEventTypes2;
|
|
44727
45314
|
})(FuelConnectorEventTypes || {});
|
|
44728
45315
|
var FuelConnectorEventType = "FuelConnector";
|
|
@@ -44842,7 +45429,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
|
44842
45429
|
*
|
|
44843
45430
|
* @returns Transaction signature
|
|
44844
45431
|
*/
|
|
44845
|
-
async signTransaction(_address, _transaction) {
|
|
45432
|
+
async signTransaction(_address, _transaction, _params) {
|
|
44846
45433
|
throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
|
44847
45434
|
}
|
|
44848
45435
|
/**
|
|
@@ -44974,6 +45561,15 @@ var FuelConnector = class extends EventEmitter2 {
|
|
|
44974
45561
|
async hasABI(_id) {
|
|
44975
45562
|
throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
|
44976
45563
|
}
|
|
45564
|
+
/**
|
|
45565
|
+
* Start the consolidation of coins process
|
|
45566
|
+
*
|
|
45567
|
+
* @param owner - The B256 address of the owner.
|
|
45568
|
+
* @param assetId - The asset ID that requires consolidation.
|
|
45569
|
+
*/
|
|
45570
|
+
async startConsolidation(_opts) {
|
|
45571
|
+
throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
|
45572
|
+
}
|
|
44977
45573
|
/**
|
|
44978
45574
|
* Event listener for the connector.
|
|
44979
45575
|
*
|
|
@@ -45386,7 +45982,7 @@ var Fuel = class _Fuel extends FuelConnector {
|
|
|
45386
45982
|
}
|
|
45387
45983
|
};
|
|
45388
45984
|
|
|
45389
|
-
// ../../node_modules/.pnpm/@fuel-ts+program@0.
|
|
45985
|
+
// ../../node_modules/.pnpm/@fuel-ts+program@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/program/dist/index.mjs
|
|
45390
45986
|
var asm22 = __toESM(require_node(), 1);
|
|
45391
45987
|
var asm3 = __toESM(require_node(), 1);
|
|
45392
45988
|
var __defProp12 = Object.defineProperty;
|
|
@@ -45507,10 +46103,11 @@ function callResultToScriptResult(callResult) {
|
|
|
45507
46103
|
}
|
|
45508
46104
|
__name(callResultToScriptResult, "callResultToScriptResult");
|
|
45509
46105
|
__name13(callResultToScriptResult, "callResultToScriptResult");
|
|
45510
|
-
function decodeCallResult(
|
|
46106
|
+
function decodeCallResult(params) {
|
|
46107
|
+
const { callResult, scriptResultDecoder: scriptResultDecoder2, logs = [], groupedLogs = {}, abis } = params;
|
|
45511
46108
|
try {
|
|
45512
46109
|
const scriptResult = callResultToScriptResult(callResult);
|
|
45513
|
-
return
|
|
46110
|
+
return scriptResultDecoder2(scriptResult);
|
|
45514
46111
|
} catch (error) {
|
|
45515
46112
|
if (error.code === ErrorCode.SCRIPT_REVERTED) {
|
|
45516
46113
|
const statusReason = callResult?.dryRunStatus?.reason;
|
|
@@ -45518,7 +46115,8 @@ function decodeCallResult(callResult, decoder, logs = [], groupedLogs = {}) {
|
|
|
45518
46115
|
logs,
|
|
45519
46116
|
groupedLogs,
|
|
45520
46117
|
receipts: callResult.receipts,
|
|
45521
|
-
statusReason
|
|
46118
|
+
statusReason,
|
|
46119
|
+
abis
|
|
45522
46120
|
});
|
|
45523
46121
|
}
|
|
45524
46122
|
throw error;
|
|
@@ -45526,10 +46124,11 @@ function decodeCallResult(callResult, decoder, logs = [], groupedLogs = {}) {
|
|
|
45526
46124
|
}
|
|
45527
46125
|
__name(decodeCallResult, "decodeCallResult");
|
|
45528
46126
|
__name13(decodeCallResult, "decodeCallResult");
|
|
45529
|
-
function callResultToInvocationResult(
|
|
45530
|
-
|
|
46127
|
+
function callResultToInvocationResult(params) {
|
|
46128
|
+
const { callResult, call: call2, logs = [], groupedLogs = {}, abis } = params;
|
|
46129
|
+
return decodeCallResult({
|
|
45531
46130
|
callResult,
|
|
45532
|
-
(scriptResult) => {
|
|
46131
|
+
scriptResultDecoder: /* @__PURE__ */ __name13((scriptResult) => {
|
|
45533
46132
|
if (scriptResult.returnReceipt.type === ReceiptType.Revert) {
|
|
45534
46133
|
throw new FuelError(
|
|
45535
46134
|
ErrorCode.SCRIPT_REVERTED,
|
|
@@ -45556,9 +46155,11 @@ function callResultToInvocationResult(callResult, call2, logs, groupedLogs) {
|
|
|
45556
46155
|
value = decoded[0];
|
|
45557
46156
|
}
|
|
45558
46157
|
return value;
|
|
45559
|
-
},
|
|
45560
|
-
logs
|
|
45561
|
-
|
|
46158
|
+
}, "scriptResultDecoder"),
|
|
46159
|
+
logs,
|
|
46160
|
+
groupedLogs,
|
|
46161
|
+
abis
|
|
46162
|
+
});
|
|
45562
46163
|
}
|
|
45563
46164
|
__name(callResultToInvocationResult, "callResultToInvocationResult");
|
|
45564
46165
|
__name13(callResultToInvocationResult, "callResultToInvocationResult");
|
|
@@ -45627,15 +46228,29 @@ var ScriptRequest = class _ScriptRequest {
|
|
|
45627
46228
|
this.bytes = arrayify(callScript.script);
|
|
45628
46229
|
return callScript.data;
|
|
45629
46230
|
}
|
|
45630
|
-
|
|
45631
|
-
|
|
45632
|
-
|
|
45633
|
-
|
|
45634
|
-
|
|
45635
|
-
|
|
45636
|
-
|
|
45637
|
-
|
|
45638
|
-
|
|
46231
|
+
decodeCallResult(callResultOrParams, _logs, _groupedLogs, _abis) {
|
|
46232
|
+
let callResult;
|
|
46233
|
+
let logs;
|
|
46234
|
+
let groupedLogs;
|
|
46235
|
+
let abis;
|
|
46236
|
+
if (typeof callResultOrParams === "object" && "callResult" in callResultOrParams) {
|
|
46237
|
+
callResult = callResultOrParams.callResult;
|
|
46238
|
+
logs = callResultOrParams.logs ?? [];
|
|
46239
|
+
groupedLogs = callResultOrParams.groupedLogs ?? {};
|
|
46240
|
+
abis = callResultOrParams.abis;
|
|
46241
|
+
} else {
|
|
46242
|
+
callResult = callResultOrParams;
|
|
46243
|
+
logs = _logs ?? [];
|
|
46244
|
+
groupedLogs = _groupedLogs ?? {};
|
|
46245
|
+
abis = _abis;
|
|
46246
|
+
}
|
|
46247
|
+
return decodeCallResult({
|
|
46248
|
+
callResult,
|
|
46249
|
+
scriptResultDecoder: this.scriptResultDecoder,
|
|
46250
|
+
logs,
|
|
46251
|
+
groupedLogs,
|
|
46252
|
+
abis
|
|
46253
|
+
});
|
|
45639
46254
|
}
|
|
45640
46255
|
};
|
|
45641
46256
|
var DEFAULT_OPCODE_PARAMS = {
|
|
@@ -45709,7 +46324,13 @@ var scriptResultDecoder = /* @__PURE__ */ __name13((contractId) => (result) => {
|
|
|
45709
46324
|
return [new Uint8Array()];
|
|
45710
46325
|
});
|
|
45711
46326
|
}, "scriptResultDecoder");
|
|
45712
|
-
var decodeContractCallScriptResult = /* @__PURE__ */ __name13((
|
|
46327
|
+
var decodeContractCallScriptResult = /* @__PURE__ */ __name13((params) => {
|
|
46328
|
+
const { contractId, ...rest } = params;
|
|
46329
|
+
return decodeCallResult({
|
|
46330
|
+
...rest,
|
|
46331
|
+
scriptResultDecoder: scriptResultDecoder(contractId)
|
|
46332
|
+
});
|
|
46333
|
+
}, "decodeContractCallScriptResult");
|
|
45713
46334
|
var getCallInstructionsLength = /* @__PURE__ */ __name13((contractCalls) => contractCalls.reduce(
|
|
45714
46335
|
(sum, call2) => {
|
|
45715
46336
|
const offset = { ...DEFAULT_OPCODE_PARAMS };
|
|
@@ -45771,36 +46392,69 @@ var getContractCallScript = /* @__PURE__ */ __name13((functionScopes, maxInputs)
|
|
|
45771
46392
|
},
|
|
45772
46393
|
() => [new Uint8Array()]
|
|
45773
46394
|
), "getContractCallScript");
|
|
45774
|
-
|
|
46395
|
+
function extractInvocationResult(paramsOrFunctionScopes, _receipts, _isMultiCall, _logs, _groupedLogs, _abis) {
|
|
46396
|
+
let functionScopes;
|
|
46397
|
+
let receipts;
|
|
46398
|
+
let isMultiCall;
|
|
46399
|
+
let logs;
|
|
46400
|
+
let groupedLogs;
|
|
46401
|
+
let abis;
|
|
46402
|
+
if (typeof paramsOrFunctionScopes === "object" && !Array.isArray(paramsOrFunctionScopes)) {
|
|
46403
|
+
functionScopes = paramsOrFunctionScopes.functionScopes;
|
|
46404
|
+
receipts = paramsOrFunctionScopes.receipts;
|
|
46405
|
+
isMultiCall = paramsOrFunctionScopes.isMultiCall;
|
|
46406
|
+
logs = paramsOrFunctionScopes.logs ?? [];
|
|
46407
|
+
groupedLogs = paramsOrFunctionScopes.groupedLogs ?? {};
|
|
46408
|
+
abis = paramsOrFunctionScopes.abis;
|
|
46409
|
+
} else {
|
|
46410
|
+
functionScopes = paramsOrFunctionScopes;
|
|
46411
|
+
receipts = _receipts;
|
|
46412
|
+
isMultiCall = _isMultiCall;
|
|
46413
|
+
logs = _logs ?? [];
|
|
46414
|
+
groupedLogs = _groupedLogs ?? {};
|
|
46415
|
+
abis = _abis;
|
|
46416
|
+
}
|
|
45775
46417
|
const mainCallConfig = functionScopes[0]?.getCallConfig();
|
|
45776
46418
|
if (functionScopes.length === 1 && mainCallConfig && "bytes" in mainCallConfig.program) {
|
|
45777
|
-
return callResultToInvocationResult({
|
|
46419
|
+
return callResultToInvocationResult({
|
|
46420
|
+
callResult: { receipts },
|
|
46421
|
+
call: mainCallConfig,
|
|
46422
|
+
logs,
|
|
46423
|
+
groupedLogs,
|
|
46424
|
+
abis
|
|
46425
|
+
});
|
|
45778
46426
|
}
|
|
45779
|
-
const encodedResults = decodeContractCallScriptResult(
|
|
45780
|
-
{ receipts },
|
|
45781
|
-
(mainCallConfig?.program).id,
|
|
46427
|
+
const encodedResults = decodeContractCallScriptResult({
|
|
46428
|
+
callResult: { receipts },
|
|
46429
|
+
contractId: (mainCallConfig?.program).id,
|
|
45782
46430
|
logs,
|
|
45783
|
-
groupedLogs
|
|
45784
|
-
|
|
46431
|
+
groupedLogs,
|
|
46432
|
+
abis
|
|
46433
|
+
});
|
|
45785
46434
|
const decodedResults = encodedResults.map((encodedResult, i) => {
|
|
45786
46435
|
const { func } = functionScopes[i].getCallConfig();
|
|
45787
46436
|
return func.decodeOutput(encodedResult)?.[0];
|
|
45788
46437
|
});
|
|
45789
46438
|
return isMultiCall ? decodedResults : decodedResults?.[0];
|
|
45790
|
-
}
|
|
46439
|
+
}
|
|
46440
|
+
__name(extractInvocationResult, "extractInvocationResult");
|
|
46441
|
+
__name13(extractInvocationResult, "extractInvocationResult");
|
|
45791
46442
|
var buildFunctionResult = /* @__PURE__ */ __name13(async (params) => {
|
|
45792
46443
|
const { funcScope, isMultiCall, program, transactionResponse } = params;
|
|
45793
46444
|
const txResult = await transactionResponse.waitForResult();
|
|
45794
46445
|
const { receipts } = txResult;
|
|
45795
46446
|
const functionScopes = Array.isArray(funcScope) ? funcScope : [funcScope];
|
|
45796
46447
|
const mainCallConfig = functionScopes[0]?.getCallConfig();
|
|
46448
|
+
const { main, otherContractsAbis } = getAbisFromAllCalls(functionScopes);
|
|
46449
|
+
const abis = { main, otherContractsAbis };
|
|
45797
46450
|
const { logs, groupedLogs } = getAllResultLogs({ receipts, mainCallConfig, functionScopes });
|
|
45798
46451
|
const value = extractInvocationResult(
|
|
45799
46452
|
functionScopes,
|
|
45800
46453
|
receipts,
|
|
45801
46454
|
isMultiCall,
|
|
45802
46455
|
logs,
|
|
45803
|
-
groupedLogs
|
|
46456
|
+
groupedLogs,
|
|
46457
|
+
abis
|
|
45804
46458
|
);
|
|
45805
46459
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
|
45806
46460
|
const submitResult = {
|
|
@@ -45895,6 +46549,7 @@ var BaseInvocationScope = class {
|
|
|
45895
46549
|
program;
|
|
45896
46550
|
functionInvocationScopes = [];
|
|
45897
46551
|
txParameters;
|
|
46552
|
+
assembleTxParameters;
|
|
45898
46553
|
requiredCoins = [];
|
|
45899
46554
|
isMultiCall = false;
|
|
45900
46555
|
hasCallParamsGasLimit = false;
|
|
@@ -46034,7 +46689,7 @@ var BaseInvocationScope = class {
|
|
|
46034
46689
|
* @returns The transaction cost details.
|
|
46035
46690
|
*
|
|
46036
46691
|
* @deprecated Use contract.fundWithRequiredCoins instead
|
|
46037
|
-
* Check the migration guide https://docs.fuel.network/
|
|
46692
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
|
46038
46693
|
*/
|
|
46039
46694
|
async getTransactionCost() {
|
|
46040
46695
|
const request = clone_default(await this.getTransactionRequest());
|
|
@@ -46044,38 +46699,68 @@ var BaseInvocationScope = class {
|
|
|
46044
46699
|
signatureCallback: this.addSignersCallback
|
|
46045
46700
|
});
|
|
46046
46701
|
}
|
|
46047
|
-
|
|
46702
|
+
/**
|
|
46703
|
+
* Funds the transaction request with the required coins and returns it.
|
|
46704
|
+
*
|
|
46705
|
+
* @returns The transaction request.
|
|
46706
|
+
*/
|
|
46707
|
+
async fundWithRequiredCoins({
|
|
46708
|
+
skipAutoConsolidation
|
|
46709
|
+
} = {}) {
|
|
46048
46710
|
let request = await this.getTransactionRequest();
|
|
46049
46711
|
request = clone_default(request);
|
|
46712
|
+
let { feePayerAccount, accountCoinQuantities, ...restAssembleTxParams } = this.assembleTxParameters ?? {};
|
|
46050
46713
|
request.maxFee = bn(0);
|
|
46051
46714
|
request.gasLimit = bn(0);
|
|
46052
46715
|
const provider = this.getProvider();
|
|
46053
46716
|
const account = this.program.account ?? Wallet.generate({ provider });
|
|
46054
46717
|
const baseAssetId = await provider.getBaseAssetId();
|
|
46055
|
-
|
|
46056
|
-
|
|
46057
|
-
|
|
46058
|
-
|
|
46718
|
+
if (!feePayerAccount) {
|
|
46719
|
+
feePayerAccount = account;
|
|
46720
|
+
}
|
|
46721
|
+
if (!accountCoinQuantities) {
|
|
46722
|
+
const outputQuantities = request.outputs.filter((o) => o.type === OutputType.Coin).map(({ amount, assetId }) => ({ assetId: String(assetId), amount: bn(amount) }));
|
|
46723
|
+
accountCoinQuantities = mergeQuantities(outputQuantities, this.requiredCoins);
|
|
46724
|
+
if (!accountCoinQuantities.length) {
|
|
46725
|
+
accountCoinQuantities.push({ assetId: baseAssetId, amount: bn(0) });
|
|
46726
|
+
}
|
|
46727
|
+
}
|
|
46728
|
+
const assembleTx = /* @__PURE__ */ __name13(async () => {
|
|
46729
|
+
const { assembledRequest, gasPrice } = await provider.assembleTx({
|
|
46730
|
+
request,
|
|
46731
|
+
feePayerAccount,
|
|
46732
|
+
accountCoinQuantities,
|
|
46733
|
+
...restAssembleTxParams
|
|
46734
|
+
});
|
|
46735
|
+
await setAndValidateGasAndFeeForAssembledTx({
|
|
46736
|
+
gasPrice,
|
|
46737
|
+
provider,
|
|
46738
|
+
transactionRequest: assembledRequest,
|
|
46739
|
+
setGasLimit: this.txParameters?.gasLimit,
|
|
46740
|
+
setMaxFee: this.txParameters?.maxFee
|
|
46741
|
+
});
|
|
46742
|
+
return assembledRequest;
|
|
46743
|
+
}, "assembleTx");
|
|
46744
|
+
try {
|
|
46745
|
+
return await assembleTx();
|
|
46746
|
+
} catch (error) {
|
|
46747
|
+
const shouldRetry = await consolidateCoinsIfRequired({
|
|
46748
|
+
error,
|
|
46749
|
+
account,
|
|
46750
|
+
skipAutoConsolidation
|
|
46751
|
+
});
|
|
46752
|
+
if (!shouldRetry) {
|
|
46753
|
+
throw error;
|
|
46754
|
+
}
|
|
46755
|
+
return await assembleTx();
|
|
46059
46756
|
}
|
|
46060
|
-
let { assembledRequest, gasPrice } = await provider.assembleTx({
|
|
46061
|
-
request,
|
|
46062
|
-
feePayerAccount: account,
|
|
46063
|
-
accountCoinQuantities
|
|
46064
|
-
});
|
|
46065
|
-
assembledRequest = assembledRequest;
|
|
46066
|
-
await setAndValidateGasAndFeeForAssembledTx({
|
|
46067
|
-
gasPrice,
|
|
46068
|
-
provider,
|
|
46069
|
-
transactionRequest: assembledRequest,
|
|
46070
|
-
setGasLimit: this.txParameters?.gasLimit,
|
|
46071
|
-
setMaxFee: this.txParameters?.maxFee
|
|
46072
|
-
});
|
|
46073
|
-
return assembledRequest;
|
|
46074
46757
|
}
|
|
46075
46758
|
/**
|
|
46076
46759
|
* @deprecated - Should be removed with `addSigners`
|
|
46077
46760
|
*/
|
|
46078
|
-
async legacyFundWithRequiredCoins(
|
|
46761
|
+
async legacyFundWithRequiredCoins({
|
|
46762
|
+
skipAutoConsolidation
|
|
46763
|
+
} = {}) {
|
|
46079
46764
|
let transactionRequest = await this.getTransactionRequest();
|
|
46080
46765
|
transactionRequest = clone_default(transactionRequest);
|
|
46081
46766
|
const txCost = await this.getTransactionCost();
|
|
@@ -46085,7 +46770,7 @@ var BaseInvocationScope = class {
|
|
|
46085
46770
|
transactionRequest.addContractInputAndOutput(new Address(contractId));
|
|
46086
46771
|
});
|
|
46087
46772
|
transactionRequest.addVariableOutputs(outputVariables);
|
|
46088
|
-
await this.program.account?.fund(transactionRequest, txCost);
|
|
46773
|
+
await this.program.account?.fund(transactionRequest, txCost, { skipAutoConsolidation });
|
|
46089
46774
|
if (this.addSignersCallback) {
|
|
46090
46775
|
await this.addSignersCallback(transactionRequest);
|
|
46091
46776
|
}
|
|
@@ -46109,6 +46794,16 @@ var BaseInvocationScope = class {
|
|
|
46109
46794
|
request.addVariableOutputs(this.txParameters?.variableOutputs || 0);
|
|
46110
46795
|
return this;
|
|
46111
46796
|
}
|
|
46797
|
+
/**
|
|
46798
|
+
* Sets the transaction parameters.
|
|
46799
|
+
*
|
|
46800
|
+
* @param assembleTxParams - The assembleTx parameters to set when invoking the `provider.assembleTx` method.
|
|
46801
|
+
* @returns The current instance of the class.
|
|
46802
|
+
*/
|
|
46803
|
+
assembleTxParams(txParams) {
|
|
46804
|
+
this.assembleTxParameters = txParams;
|
|
46805
|
+
return this;
|
|
46806
|
+
}
|
|
46112
46807
|
/**
|
|
46113
46808
|
* Adds contracts to the invocation scope.
|
|
46114
46809
|
*
|
|
@@ -46166,7 +46861,7 @@ var BaseInvocationScope = class {
|
|
|
46166
46861
|
* @deprecated This method is deprecated and will be removed in a future versions.
|
|
46167
46862
|
* All signatures should be manually added to the transaction request witnesses. If your
|
|
46168
46863
|
* Sway program relies on in-code signature validation, visit this guide:
|
|
46169
|
-
* https://docs.fuel.network/
|
|
46864
|
+
* https://docs.fuel.network/docs/fuels-ts/cookbook/sway-script-with-signature-validation/
|
|
46170
46865
|
*/
|
|
46171
46866
|
addSigners(signers) {
|
|
46172
46867
|
this.addSignersCallback = (transactionRequest) => transactionRequest.addAccountWitnesses(signers);
|
|
@@ -46181,23 +46876,43 @@ var BaseInvocationScope = class {
|
|
|
46181
46876
|
await this.prepareTransaction();
|
|
46182
46877
|
return this.transactionRequest;
|
|
46183
46878
|
}
|
|
46879
|
+
/**
|
|
46880
|
+
* Sets the transaction request. Useful when you have used `getTransactionRequest` or
|
|
46881
|
+
* `fundWithRequiredCoins` from the scope to apply customizations to the transaction request.
|
|
46882
|
+
*
|
|
46883
|
+
* @param request - The transaction request to set.
|
|
46884
|
+
* @returns The current instance of the class.
|
|
46885
|
+
*/
|
|
46886
|
+
fromRequest(request) {
|
|
46887
|
+
this.transactionRequest = request;
|
|
46888
|
+
return this;
|
|
46889
|
+
}
|
|
46184
46890
|
/**
|
|
46185
46891
|
* Submits the contract call transaction and returns a promise that resolves to an object
|
|
46186
46892
|
* containing the transaction ID and a function to wait for the result. The promise will resolve
|
|
46187
46893
|
* as soon as the transaction is submitted to the node.
|
|
46188
46894
|
*
|
|
46895
|
+
* @param params - Optional parameters for the call.
|
|
46896
|
+
* - `skipAssembleTx`: A boolean indicating whether to skip assembling the transaction. This is useful
|
|
46897
|
+
* when customizations were made to the transaction request using the `assembleTx` method.
|
|
46898
|
+
*
|
|
46189
46899
|
* @returns A promise that resolves to an object containing:
|
|
46190
46900
|
* - `transactionId`: The ID of the submitted transaction.
|
|
46191
46901
|
* - `waitForResult`: A function that waits for the transaction result.
|
|
46902
|
+
* - `waitForPreConfirmation`: A function that waits for the transaction pre-confirmation.
|
|
46192
46903
|
* @template T - The type of the return value.
|
|
46193
46904
|
*/
|
|
46194
|
-
async call() {
|
|
46905
|
+
async call(params) {
|
|
46195
46906
|
assert2(this.program.account, "Wallet is required!");
|
|
46196
46907
|
let transactionRequest = await this.getTransactionRequest();
|
|
46197
|
-
|
|
46198
|
-
|
|
46199
|
-
|
|
46200
|
-
|
|
46908
|
+
const skipAssembleTx = params?.skipAssembleTx;
|
|
46909
|
+
const skipAutoConsolidation = params?.skipAutoConsolidation;
|
|
46910
|
+
if (!skipAssembleTx) {
|
|
46911
|
+
if (this.addSignersCallback) {
|
|
46912
|
+
transactionRequest = await this.legacyFundWithRequiredCoins({ skipAutoConsolidation });
|
|
46913
|
+
} else {
|
|
46914
|
+
transactionRequest = await this.fundWithRequiredCoins({ skipAutoConsolidation });
|
|
46915
|
+
}
|
|
46201
46916
|
}
|
|
46202
46917
|
const response = await this.program.account.sendTransaction(transactionRequest, {
|
|
46203
46918
|
estimateTxDependencies: false
|
|
@@ -46296,17 +47011,6 @@ var BaseInvocationScope = class {
|
|
|
46296
47011
|
const provider = this.program.provider;
|
|
46297
47012
|
return provider;
|
|
46298
47013
|
}
|
|
46299
|
-
/**
|
|
46300
|
-
* Obtains the ID of a transaction.
|
|
46301
|
-
*
|
|
46302
|
-
* @param chainId - the chainId to use to hash the transaction with
|
|
46303
|
-
* @returns the ID of the transaction.
|
|
46304
|
-
*/
|
|
46305
|
-
async getTransactionId(chainId) {
|
|
46306
|
-
const chainIdToHash = chainId ?? await this.getProvider().getChainId();
|
|
46307
|
-
const transactionRequest = await this.getTransactionRequest();
|
|
46308
|
-
return transactionRequest.getTransactionId(chainIdToHash);
|
|
46309
|
-
}
|
|
46310
47014
|
/**
|
|
46311
47015
|
* In case the gasLimit is *not* set by the user, this method sets a default value.
|
|
46312
47016
|
*/
|
|
@@ -46533,7 +47237,7 @@ var Contract = class {
|
|
|
46533
47237
|
}
|
|
46534
47238
|
};
|
|
46535
47239
|
|
|
46536
|
-
// ../../node_modules/.pnpm/@fuel-ts+script@0.
|
|
47240
|
+
// ../../node_modules/.pnpm/@fuel-ts+script@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/script/dist/index.mjs
|
|
46537
47241
|
var __defProp13 = Object.defineProperty;
|
|
46538
47242
|
var __name14 = /* @__PURE__ */ __name((target, value) => __defProp13(target, "name", { value, configurable: true }), "__name");
|
|
46539
47243
|
var ScriptInvocationScope = class extends FunctionInvocationScope {
|
|
@@ -46685,7 +47389,7 @@ var returnZeroScript2 = new ScriptRequest(
|
|
|
46685
47389
|
() => void 0
|
|
46686
47390
|
);
|
|
46687
47391
|
|
|
46688
|
-
// ../../node_modules/.pnpm/@fuel-ts+contract@0.
|
|
47392
|
+
// ../../node_modules/.pnpm/@fuel-ts+contract@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/contract/dist/index.mjs
|
|
46689
47393
|
var asm4 = __toESM(require_node(), 1);
|
|
46690
47394
|
var __defProp14 = Object.defineProperty;
|
|
46691
47395
|
var __name15 = /* @__PURE__ */ __name((target, value) => __defProp14(target, "name", { value, configurable: true }), "__name");
|
|
@@ -46839,30 +47543,6 @@ var ContractFactory = class _ContractFactory {
|
|
|
46839
47543
|
transactionRequest
|
|
46840
47544
|
};
|
|
46841
47545
|
}
|
|
46842
|
-
/**
|
|
46843
|
-
* Takes a transaction request, estimates it and funds it.
|
|
46844
|
-
*
|
|
46845
|
-
* @param request - the request to fund.
|
|
46846
|
-
* @param options - options for funding the request.
|
|
46847
|
-
* @returns a funded transaction request.
|
|
46848
|
-
*/
|
|
46849
|
-
async fundTransactionRequest(request, options = {}) {
|
|
46850
|
-
const account = this.getAccount();
|
|
46851
|
-
const { maxFee: setMaxFee } = options;
|
|
46852
|
-
const txCost = await account.getTransactionCost(request);
|
|
46853
|
-
if (isDefined(setMaxFee)) {
|
|
46854
|
-
if (txCost.maxFee.gt(setMaxFee)) {
|
|
46855
|
-
throw new FuelError(
|
|
46856
|
-
ErrorCode.MAX_FEE_TOO_LOW,
|
|
46857
|
-
`Max fee '${options.maxFee}' is lower than the required: '${txCost.maxFee}'.`
|
|
46858
|
-
);
|
|
46859
|
-
}
|
|
46860
|
-
} else {
|
|
46861
|
-
request.maxFee = txCost.maxFee;
|
|
46862
|
-
}
|
|
46863
|
-
await account.fund(request, txCost);
|
|
46864
|
-
return request;
|
|
46865
|
-
}
|
|
46866
47546
|
async assembleTx(request, options = {}) {
|
|
46867
47547
|
const account = this.getAccount();
|
|
46868
47548
|
const { maxFee: setMaxFee } = options;
|
|
@@ -47122,7 +47802,7 @@ var ContractFactory = class _ContractFactory {
|
|
|
47122
47802
|
}
|
|
47123
47803
|
};
|
|
47124
47804
|
|
|
47125
|
-
// ../../node_modules/.pnpm/@fuel-ts+recipes@0.
|
|
47805
|
+
// ../../node_modules/.pnpm/@fuel-ts+recipes@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/@fuel-ts/recipes/dist/index.mjs
|
|
47126
47806
|
var __defProp15 = Object.defineProperty;
|
|
47127
47807
|
var __name16 = /* @__PURE__ */ __name((target, value) => __defProp15(target, "name", { value, configurable: true }), "__name");
|
|
47128
47808
|
var abi = {
|
|
@@ -47770,7 +48450,7 @@ var Src14OwnedProxyFactory = class _Src14OwnedProxyFactory extends ContractFacto
|
|
|
47770
48450
|
}
|
|
47771
48451
|
};
|
|
47772
48452
|
|
|
47773
|
-
// ../../node_modules/.pnpm/fuels@0.
|
|
48453
|
+
// ../../node_modules/.pnpm/fuels@0.101.3_encoding@0.1.13_vitest@3.0.9_@types+node@22.8.6_tsx@4.15.7_yaml@2.7.1_/node_modules/fuels/dist/index.mjs
|
|
47774
48454
|
var __defProp16 = Object.defineProperty;
|
|
47775
48455
|
var __name17 = /* @__PURE__ */ __name((target, value) => __defProp16(target, "name", { value, configurable: true }), "__name");
|
|
47776
48456
|
function createConfig(config) {
|
|
@@ -64931,4 +65611,4 @@ long/index.js:
|
|
|
64931
65611
|
* SPDX-License-Identifier: Apache-2.0
|
|
64932
65612
|
*)
|
|
64933
65613
|
*/
|
|
64934
|
-
//# sourceMappingURL=chunk-
|
|
65614
|
+
//# sourceMappingURL=chunk-3RALZ4H6.js.map
|