@fuel-ts/account 0.100.2 → 0.100.3
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/dist/index.global.js +128 -80
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +331 -278
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +265 -213
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-response/getAllDecodedLogs.d.ts +30 -0
- package/dist/providers/transaction-response/getAllDecodedLogs.d.ts.map +1 -0
- package/dist/providers/transaction-response/getDecodedLogs.d.ts +20 -1
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -1
- package/dist/providers/transaction-response/index.d.ts +1 -0
- package/dist/providers/transaction-response/index.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +3 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +4 -3
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/test-utils.global.js +83 -71
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +232 -216
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +179 -163
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
@@ -116,6 +116,7 @@ __export(src_exports, {
|
|
116
116
|
extractTxError: () => extractTxError,
|
117
117
|
fuelAssetsBaseUrl: () => fuelAssetsBaseUrl,
|
118
118
|
gasUsedByInputs: () => gasUsedByInputs,
|
119
|
+
getAllDecodedLogs: () => getAllDecodedLogs,
|
119
120
|
getAssetAmountInRequestInputs: () => getAssetAmountInRequestInputs,
|
120
121
|
getAssetById: () => getAssetById,
|
121
122
|
getAssetEth: () => getAssetEth,
|
@@ -916,12 +917,12 @@ var getAssetsByOwner = /* @__PURE__ */ __name(async (opts) => {
|
|
916
917
|
}, "getAssetsByOwner");
|
917
918
|
|
918
919
|
// src/account.ts
|
919
|
-
var
|
920
|
+
var import_abi_coder7 = require("@fuel-ts/abi-coder");
|
920
921
|
var import_address5 = require("@fuel-ts/address");
|
921
922
|
var import_crypto2 = require("@fuel-ts/crypto");
|
922
|
-
var
|
923
|
+
var import_errors21 = require("@fuel-ts/errors");
|
923
924
|
var import_math21 = require("@fuel-ts/math");
|
924
|
-
var
|
925
|
+
var import_transactions27 = require("@fuel-ts/transactions");
|
925
926
|
var import_utils34 = require("@fuel-ts/utils");
|
926
927
|
var import_ramda9 = require("ramda");
|
927
928
|
|
@@ -961,36 +962,15 @@ var addAmountToCoinQuantities = /* @__PURE__ */ __name((params) => {
|
|
961
962
|
|
962
963
|
// src/providers/provider.ts
|
963
964
|
var import_address3 = require("@fuel-ts/address");
|
964
|
-
var
|
965
|
+
var import_errors19 = require("@fuel-ts/errors");
|
965
966
|
var import_math18 = require("@fuel-ts/math");
|
966
|
-
var
|
967
|
+
var import_transactions24 = require("@fuel-ts/transactions");
|
967
968
|
var import_utils29 = require("@fuel-ts/utils");
|
968
969
|
var import_versions = require("@fuel-ts/versions");
|
969
970
|
var import_graphql_request = require("graphql-request");
|
970
971
|
var import_graphql_tag2 = __toESM(require("graphql-tag"));
|
971
972
|
var import_ramda8 = require("ramda");
|
972
973
|
|
973
|
-
// src/connectors/utils/promises.ts
|
974
|
-
var import_errors = require("@fuel-ts/errors");
|
975
|
-
function deferPromise() {
|
976
|
-
const defer = {};
|
977
|
-
defer.promise = new Promise((resolve, reject) => {
|
978
|
-
defer.reject = reject;
|
979
|
-
defer.resolve = resolve;
|
980
|
-
});
|
981
|
-
return defer;
|
982
|
-
}
|
983
|
-
__name(deferPromise, "deferPromise");
|
984
|
-
async function withTimeout(promise, timeout = 1050) {
|
985
|
-
const timeoutPromise = new Promise((resolve, reject) => {
|
986
|
-
setTimeout(() => {
|
987
|
-
reject(new import_errors.FuelError(import_errors.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
988
|
-
}, timeout);
|
989
|
-
});
|
990
|
-
return Promise.race([timeoutPromise, promise]);
|
991
|
-
}
|
992
|
-
__name(withTimeout, "withTimeout");
|
993
|
-
|
994
974
|
// src/providers/__generated__/operations.ts
|
995
975
|
var import_graphql_tag = __toESM(require("graphql-tag"));
|
996
976
|
var SubmittedStatusFragmentDoc = import_graphql_tag.default`
|
@@ -2049,35 +2029,35 @@ function getSdk(requester) {
|
|
2049
2029
|
__name(getSdk, "getSdk");
|
2050
2030
|
|
2051
2031
|
// src/providers/fuel-graphql-subscriber.ts
|
2052
|
-
var
|
2032
|
+
var import_errors2 = require("@fuel-ts/errors");
|
2053
2033
|
var import_graphql = require("graphql");
|
2054
2034
|
|
2055
2035
|
// src/providers/utils/handle-gql-error-message.ts
|
2056
|
-
var
|
2036
|
+
var import_errors = require("@fuel-ts/errors");
|
2057
2037
|
var mapGqlErrorMessage = /* @__PURE__ */ __name((error) => {
|
2058
2038
|
if (new RegExp("the target cannot be met due to no coins available or exceeding the \\d+ coin limit." /* NOT_ENOUGH_COINS_MAX_COINS */).test(error.message)) {
|
2059
|
-
return new
|
2060
|
-
|
2039
|
+
return new import_errors.FuelError(
|
2040
|
+
import_errors.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
2061
2041
|
`Insufficient funds or too many small value coins. Consider combining UTXOs.`,
|
2062
2042
|
{},
|
2063
2043
|
error
|
2064
2044
|
);
|
2065
2045
|
}
|
2066
2046
|
if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
|
2067
|
-
return new
|
2068
|
-
|
2047
|
+
return new import_errors.FuelError(
|
2048
|
+
import_errors.ErrorCode.ASSET_NOT_FOUND,
|
2069
2049
|
`Asset not found for given asset id.`,
|
2070
2050
|
{},
|
2071
2051
|
error
|
2072
2052
|
);
|
2073
2053
|
}
|
2074
|
-
return new
|
2054
|
+
return new import_errors.FuelError(import_errors.ErrorCode.INVALID_REQUEST, error.message, {}, error);
|
2075
2055
|
}, "mapGqlErrorMessage");
|
2076
2056
|
var mapGqlErrorWithIncompatibleNodeVersion = /* @__PURE__ */ __name((error, incompatibleNodeVersionMessage) => {
|
2077
2057
|
if (!incompatibleNodeVersionMessage) {
|
2078
2058
|
return error;
|
2079
2059
|
}
|
2080
|
-
return new
|
2060
|
+
return new import_errors.FuelError(
|
2081
2061
|
error.code,
|
2082
2062
|
`${error.message}
|
2083
2063
|
|
@@ -2096,7 +2076,7 @@ var assertGqlResponseHasNoErrors = /* @__PURE__ */ __name((errors, incompatibleN
|
|
2096
2076
|
}
|
2097
2077
|
const errorMessage = mappedErrors.map((err) => err.message).join("\n");
|
2098
2078
|
throw mapGqlErrorWithIncompatibleNodeVersion(
|
2099
|
-
new
|
2079
|
+
new import_errors.FuelError(import_errors.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
|
2100
2080
|
incompatibleNodeVersionMessage
|
2101
2081
|
);
|
2102
2082
|
}, "assertGqlResponseHasNoErrors");
|
@@ -2152,8 +2132,8 @@ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
|
|
2152
2132
|
try {
|
2153
2133
|
this.events.push(JSON.parse(match.replace(/^data:/, "")));
|
2154
2134
|
} catch (e) {
|
2155
|
-
throw new
|
2156
|
-
|
2135
|
+
throw new import_errors2.FuelError(
|
2136
|
+
import_errors2.ErrorCode.STREAM_PARSING_ERROR,
|
2157
2137
|
`Error while parsing stream data response: ${text}`
|
2158
2138
|
);
|
2159
2139
|
}
|
@@ -2173,13 +2153,13 @@ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
|
|
2173
2153
|
};
|
2174
2154
|
|
2175
2155
|
// src/providers/resource-cache.ts
|
2176
|
-
var
|
2156
|
+
var import_errors13 = require("@fuel-ts/errors");
|
2177
2157
|
var import_utils22 = require("@fuel-ts/utils");
|
2178
2158
|
|
2179
2159
|
// src/providers/transaction-request/input.ts
|
2180
2160
|
var import_abi_coder = require("@fuel-ts/abi-coder");
|
2181
2161
|
var import_configs = require("@fuel-ts/address/configs");
|
2182
|
-
var
|
2162
|
+
var import_errors3 = require("@fuel-ts/errors");
|
2183
2163
|
var import_math2 = require("@fuel-ts/math");
|
2184
2164
|
var import_transactions = require("@fuel-ts/transactions");
|
2185
2165
|
var import_utils3 = require("@fuel-ts/utils");
|
@@ -2243,8 +2223,8 @@ var inputify = /* @__PURE__ */ __name((value) => {
|
|
2243
2223
|
};
|
2244
2224
|
}
|
2245
2225
|
default: {
|
2246
|
-
throw new
|
2247
|
-
|
2226
|
+
throw new import_errors3.FuelError(
|
2227
|
+
import_errors3.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2248
2228
|
`Invalid transaction input type: ${type}.`
|
2249
2229
|
);
|
2250
2230
|
}
|
@@ -2253,7 +2233,7 @@ var inputify = /* @__PURE__ */ __name((value) => {
|
|
2253
2233
|
|
2254
2234
|
// src/providers/transaction-request/output.ts
|
2255
2235
|
var import_configs2 = require("@fuel-ts/address/configs");
|
2256
|
-
var
|
2236
|
+
var import_errors4 = require("@fuel-ts/errors");
|
2257
2237
|
var import_math3 = require("@fuel-ts/math");
|
2258
2238
|
var import_transactions2 = require("@fuel-ts/transactions");
|
2259
2239
|
var import_utils4 = require("@fuel-ts/utils");
|
@@ -2300,8 +2280,8 @@ var outputify = /* @__PURE__ */ __name((value) => {
|
|
2300
2280
|
};
|
2301
2281
|
}
|
2302
2282
|
default: {
|
2303
|
-
throw new
|
2304
|
-
|
2283
|
+
throw new import_errors4.FuelError(
|
2284
|
+
import_errors4.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2305
2285
|
`Invalid transaction output type: ${type}.`
|
2306
2286
|
);
|
2307
2287
|
}
|
@@ -2313,7 +2293,7 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
|
|
2313
2293
|
var import_address = require("@fuel-ts/address");
|
2314
2294
|
var import_configs6 = require("@fuel-ts/address/configs");
|
2315
2295
|
var import_crypto = require("@fuel-ts/crypto");
|
2316
|
-
var
|
2296
|
+
var import_errors9 = require("@fuel-ts/errors");
|
2317
2297
|
var import_math8 = require("@fuel-ts/math");
|
2318
2298
|
var import_transactions8 = require("@fuel-ts/transactions");
|
2319
2299
|
var import_utils10 = require("@fuel-ts/utils");
|
@@ -2333,7 +2313,7 @@ var import_configs4 = require("@fuel-ts/transactions/configs");
|
|
2333
2313
|
|
2334
2314
|
// src/providers/utils/serialization.ts
|
2335
2315
|
var import_configs3 = require("@fuel-ts/address/configs");
|
2336
|
-
var
|
2316
|
+
var import_errors5 = require("@fuel-ts/errors");
|
2337
2317
|
var import_math4 = require("@fuel-ts/math");
|
2338
2318
|
var import_transactions3 = require("@fuel-ts/transactions");
|
2339
2319
|
var import_utils5 = require("@fuel-ts/utils");
|
@@ -2670,7 +2650,7 @@ var deserializeReceipt = /* @__PURE__ */ __name((receipt) => {
|
|
2670
2650
|
return burnReceipt;
|
2671
2651
|
}
|
2672
2652
|
default:
|
2673
|
-
throw new
|
2653
|
+
throw new import_errors5.FuelError(import_errors5.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
|
2674
2654
|
}
|
2675
2655
|
}, "deserializeReceipt");
|
2676
2656
|
|
@@ -2695,7 +2675,7 @@ var getReceiptsWithMissingData = /* @__PURE__ */ __name((receipts) => receipts.r
|
|
2695
2675
|
var assembleReceiptByType = /* @__PURE__ */ __name((gqlReceipt) => deserializeReceipt(gqlReceipt), "assembleReceiptByType");
|
2696
2676
|
|
2697
2677
|
// src/providers/utils/block-explorer.ts
|
2698
|
-
var
|
2678
|
+
var import_errors6 = require("@fuel-ts/errors");
|
2699
2679
|
var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
|
2700
2680
|
var getPathFromInput = /* @__PURE__ */ __name((key, value) => {
|
2701
2681
|
const pathMap = {
|
@@ -2729,15 +2709,15 @@ var buildBlockExplorerUrl = /* @__PURE__ */ __name((options = {}) => {
|
|
2729
2709
|
}));
|
2730
2710
|
const hasAnyDefinedValues = definedValues.length > 0;
|
2731
2711
|
if (definedValues.length > 1) {
|
2732
|
-
throw new
|
2733
|
-
|
2712
|
+
throw new import_errors6.FuelError(
|
2713
|
+
import_errors6.ErrorCode.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2734
2714
|
`Only one of the following can be passed in to buildBlockExplorerUrl: ${customInputParams.map((param) => param.key).join(", ")}.`
|
2735
2715
|
);
|
2736
2716
|
}
|
2737
2717
|
if (path && definedValues.length > 0) {
|
2738
2718
|
const inputKeys = customInputParams.map(({ key }) => key).join(", ");
|
2739
|
-
throw new
|
2740
|
-
|
2719
|
+
throw new import_errors6.FuelError(
|
2720
|
+
import_errors6.ErrorCode.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2741
2721
|
`You cannot pass in a path to 'buildBlockExplorerUrl' along with any of the following: ${inputKeys}.`
|
2742
2722
|
);
|
2743
2723
|
}
|
@@ -2938,7 +2918,7 @@ function normalizeJSON(root) {
|
|
2938
2918
|
__name(normalizeJSON, "normalizeJSON");
|
2939
2919
|
|
2940
2920
|
// src/providers/utils/extract-tx-error.ts
|
2941
|
-
var
|
2921
|
+
var import_errors7 = require("@fuel-ts/errors");
|
2942
2922
|
var import_math6 = require("@fuel-ts/math");
|
2943
2923
|
var import_transactions6 = require("@fuel-ts/transactions");
|
2944
2924
|
var import_configs5 = require("@fuel-ts/transactions/configs");
|
@@ -2951,7 +2931,7 @@ You can read more about this error at:
|
|
2951
2931
|
|
2952
2932
|
${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
|
2953
2933
|
}
|
2954
|
-
return new
|
2934
|
+
return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
2955
2935
|
...metadata,
|
2956
2936
|
reason: statusReason
|
2957
2937
|
});
|
@@ -2992,8 +2972,8 @@ var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
|
|
2992
2972
|
errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
|
2993
2973
|
break;
|
2994
2974
|
default:
|
2995
|
-
throw new
|
2996
|
-
|
2975
|
+
throw new import_errors7.FuelError(
|
2976
|
+
import_errors7.ErrorCode.UNKNOWN,
|
2997
2977
|
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
2998
2978
|
{
|
2999
2979
|
...metadata,
|
@@ -3002,17 +2982,18 @@ var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
|
|
3002
2982
|
);
|
3003
2983
|
}
|
3004
2984
|
}
|
3005
|
-
return new
|
2985
|
+
return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
3006
2986
|
...metadata,
|
3007
2987
|
reason
|
3008
2988
|
});
|
3009
2989
|
}, "assembleRevertError");
|
3010
2990
|
var extractTxError = /* @__PURE__ */ __name((params) => {
|
3011
|
-
const { receipts, statusReason, logs } = params;
|
2991
|
+
const { receipts, statusReason, logs, groupedLogs } = params;
|
3012
2992
|
const isPanic = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Panic);
|
3013
2993
|
const isRevert = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Revert);
|
3014
2994
|
const metadata = {
|
3015
2995
|
logs,
|
2996
|
+
groupedLogs,
|
3016
2997
|
receipts,
|
3017
2998
|
panic: isPanic,
|
3018
2999
|
revert: isRevert,
|
@@ -3056,7 +3037,7 @@ var NoWitnessByOwnerError = class extends Error {
|
|
3056
3037
|
};
|
3057
3038
|
|
3058
3039
|
// src/providers/transaction-request/helpers.ts
|
3059
|
-
var
|
3040
|
+
var import_errors8 = require("@fuel-ts/errors");
|
3060
3041
|
var import_math7 = require("@fuel-ts/math");
|
3061
3042
|
var import_transactions7 = require("@fuel-ts/transactions");
|
3062
3043
|
var import_utils8 = require("@fuel-ts/utils");
|
@@ -3129,7 +3110,7 @@ var validateTransactionForAssetBurn = /* @__PURE__ */ __name((baseAssetId, trans
|
|
3129
3110
|
"Add the relevant change outputs to the transaction to avoid burning assets.",
|
3130
3111
|
"Or enable asset burn, upon sending the transaction."
|
3131
3112
|
].join("\n");
|
3132
|
-
throw new
|
3113
|
+
throw new import_errors8.FuelError(import_errors8.ErrorCode.ASSET_BURN_DETECTED, message);
|
3133
3114
|
}, "validateTransactionForAssetBurn");
|
3134
3115
|
|
3135
3116
|
// src/providers/transaction-request/witness.ts
|
@@ -3530,7 +3511,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
|
|
3530
3511
|
* @hidden
|
3531
3512
|
*/
|
3532
3513
|
metadataGas(_gasCosts) {
|
3533
|
-
throw new
|
3514
|
+
throw new import_errors9.FuelError(import_errors9.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
|
3534
3515
|
}
|
3535
3516
|
/**
|
3536
3517
|
* @hidden
|
@@ -4169,7 +4150,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
4169
4150
|
};
|
4170
4151
|
|
4171
4152
|
// src/providers/transaction-request/upgrade-transaction-request.ts
|
4172
|
-
var
|
4153
|
+
var import_errors11 = require("@fuel-ts/errors");
|
4173
4154
|
var import_hasher2 = require("@fuel-ts/hasher");
|
4174
4155
|
var import_transactions12 = require("@fuel-ts/transactions");
|
4175
4156
|
var import_utils18 = require("@fuel-ts/utils");
|
@@ -4276,7 +4257,7 @@ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTra
|
|
4276
4257
|
}
|
4277
4258
|
};
|
4278
4259
|
} else {
|
4279
|
-
throw new
|
4260
|
+
throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4280
4261
|
}
|
4281
4262
|
return {
|
4282
4263
|
type: import_transactions12.TransactionType.Upgrade,
|
@@ -4318,7 +4299,7 @@ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTra
|
|
4318
4299
|
txBytesSize
|
4319
4300
|
});
|
4320
4301
|
}
|
4321
|
-
throw new
|
4302
|
+
throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4322
4303
|
}
|
4323
4304
|
};
|
4324
4305
|
|
@@ -4439,7 +4420,7 @@ var AbstractScriptRequest = class {
|
|
4439
4420
|
};
|
4440
4421
|
|
4441
4422
|
// src/providers/transaction-request/utils.ts
|
4442
|
-
var
|
4423
|
+
var import_errors12 = require("@fuel-ts/errors");
|
4443
4424
|
var import_transactions14 = require("@fuel-ts/transactions");
|
4444
4425
|
var transactionRequestify = /* @__PURE__ */ __name((obj) => {
|
4445
4426
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
|
@@ -4463,8 +4444,8 @@ var transactionRequestify = /* @__PURE__ */ __name((obj) => {
|
|
4463
4444
|
return UploadTransactionRequest.from(obj);
|
4464
4445
|
}
|
4465
4446
|
default: {
|
4466
|
-
throw new
|
4467
|
-
|
4447
|
+
throw new import_errors12.FuelError(
|
4448
|
+
import_errors12.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
4468
4449
|
`Unsupported transaction type: ${type}.`
|
4469
4450
|
);
|
4470
4451
|
}
|
@@ -4486,8 +4467,8 @@ var ResourceCache = class {
|
|
4486
4467
|
constructor(ttl) {
|
4487
4468
|
this.ttl = ttl;
|
4488
4469
|
if (typeof ttl !== "number" || this.ttl <= 0) {
|
4489
|
-
throw new
|
4490
|
-
|
4470
|
+
throw new import_errors13.FuelError(
|
4471
|
+
import_errors13.ErrorCode.INVALID_TTL,
|
4491
4472
|
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
4492
4473
|
);
|
4493
4474
|
}
|
@@ -4571,7 +4552,7 @@ var ResourceCache = class {
|
|
4571
4552
|
};
|
4572
4553
|
|
4573
4554
|
// src/providers/transaction-response/transaction-response.ts
|
4574
|
-
var
|
4555
|
+
var import_errors17 = require("@fuel-ts/errors");
|
4575
4556
|
var import_math17 = require("@fuel-ts/math");
|
4576
4557
|
var import_transactions22 = require("@fuel-ts/transactions");
|
4577
4558
|
var import_utils26 = require("@fuel-ts/utils");
|
@@ -4649,12 +4630,12 @@ var calculateTXFeeForSummary = /* @__PURE__ */ __name((params) => {
|
|
4649
4630
|
|
4650
4631
|
// src/providers/transaction-summary/operations.ts
|
4651
4632
|
var import_configs11 = require("@fuel-ts/address/configs");
|
4652
|
-
var
|
4633
|
+
var import_errors15 = require("@fuel-ts/errors");
|
4653
4634
|
var import_math14 = require("@fuel-ts/math");
|
4654
4635
|
var import_transactions18 = require("@fuel-ts/transactions");
|
4655
4636
|
|
4656
4637
|
// src/providers/transaction-summary/input.ts
|
4657
|
-
var
|
4638
|
+
var import_errors14 = require("@fuel-ts/errors");
|
4658
4639
|
var import_math13 = require("@fuel-ts/math");
|
4659
4640
|
var import_transactions16 = require("@fuel-ts/transactions");
|
4660
4641
|
function getInputsByTypes(inputs, types) {
|
@@ -4734,8 +4715,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
4734
4715
|
return void 0;
|
4735
4716
|
}
|
4736
4717
|
if (contractInput.type !== import_transactions16.InputType.Contract) {
|
4737
|
-
throw new
|
4738
|
-
|
4718
|
+
throw new import_errors14.FuelError(
|
4719
|
+
import_errors14.ErrorCode.INVALID_TRANSACTION_INPUT,
|
4739
4720
|
`Contract input should be of type 'contract'.`
|
4740
4721
|
);
|
4741
4722
|
}
|
@@ -4837,8 +4818,8 @@ function getTransactionTypeName(transactionType) {
|
|
4837
4818
|
case import_transactions18.TransactionType.Upload:
|
4838
4819
|
return "Upload" /* Upload */;
|
4839
4820
|
default:
|
4840
|
-
throw new
|
4841
|
-
|
4821
|
+
throw new import_errors15.FuelError(
|
4822
|
+
import_errors15.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
4842
4823
|
`Unsupported transaction type: ${transactionType}.`
|
4843
4824
|
);
|
4844
4825
|
}
|
@@ -5252,7 +5233,7 @@ var extractBurnedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
|
|
5252
5233
|
}, "extractBurnedAssetsFromReceipts");
|
5253
5234
|
|
5254
5235
|
// src/providers/transaction-summary/status.ts
|
5255
|
-
var
|
5236
|
+
var import_errors16 = require("@fuel-ts/errors");
|
5256
5237
|
var import_math15 = require("@fuel-ts/math");
|
5257
5238
|
var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
|
5258
5239
|
switch (gqlStatus) {
|
@@ -5265,8 +5246,8 @@ var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
|
|
5265
5246
|
case "SqueezedOutStatus":
|
5266
5247
|
return "squeezedout" /* squeezedout */;
|
5267
5248
|
default:
|
5268
|
-
throw new
|
5269
|
-
|
5249
|
+
throw new import_errors16.FuelError(
|
5250
|
+
import_errors16.ErrorCode.INVALID_TRANSACTION_STATUS,
|
5270
5251
|
`Invalid transaction status: ${gqlStatus}.`
|
5271
5252
|
);
|
5272
5253
|
}
|
@@ -5398,11 +5379,12 @@ function assembleTransactionSummary(params) {
|
|
5398
5379
|
}
|
5399
5380
|
__name(assembleTransactionSummary, "assembleTransactionSummary");
|
5400
5381
|
|
5401
|
-
// src/providers/transaction-response/
|
5382
|
+
// src/providers/transaction-response/getAllDecodedLogs.ts
|
5402
5383
|
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
5403
5384
|
var import_configs12 = require("@fuel-ts/address/configs");
|
5404
5385
|
var import_transactions21 = require("@fuel-ts/transactions");
|
5405
|
-
function
|
5386
|
+
function getAllDecodedLogs(opts) {
|
5387
|
+
const { receipts, mainAbi, externalAbis = {} } = opts;
|
5406
5388
|
let mainContract = "";
|
5407
5389
|
if (mainAbi.programType === "contract") {
|
5408
5390
|
const firstCallReceipt = receipts.find(
|
@@ -5410,21 +5392,25 @@ function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
|
5410
5392
|
);
|
5411
5393
|
mainContract = firstCallReceipt.to;
|
5412
5394
|
}
|
5413
|
-
return receipts.reduce(
|
5414
|
-
|
5415
|
-
|
5416
|
-
|
5417
|
-
|
5418
|
-
|
5419
|
-
|
5420
|
-
|
5421
|
-
|
5395
|
+
return receipts.reduce(
|
5396
|
+
({ logs, groupedLogs }, receipt) => {
|
5397
|
+
if (receipt.type === import_transactions21.ReceiptType.LogData || receipt.type === import_transactions21.ReceiptType.Log) {
|
5398
|
+
const isLogFromMainAbi = receipt.id === import_configs12.ZeroBytes32 || mainContract === receipt.id;
|
5399
|
+
const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
|
5400
|
+
if (isDecodable) {
|
5401
|
+
const interfaceToUse = isLogFromMainAbi ? new import_abi_coder4.Interface(mainAbi) : new import_abi_coder4.Interface(externalAbis[receipt.id]);
|
5402
|
+
const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder4.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
|
5403
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
|
5404
|
+
logs.push(decodedLog);
|
5405
|
+
groupedLogs[receipt.id] = [...groupedLogs[receipt.id] || [], decodedLog];
|
5406
|
+
}
|
5422
5407
|
}
|
5423
|
-
|
5424
|
-
|
5425
|
-
|
5408
|
+
return { logs, groupedLogs };
|
5409
|
+
},
|
5410
|
+
{ logs: [], groupedLogs: {} }
|
5411
|
+
);
|
5426
5412
|
}
|
5427
|
-
__name(
|
5413
|
+
__name(getAllDecodedLogs, "getAllDecodedLogs");
|
5428
5414
|
|
5429
5415
|
// src/providers/transaction-response/transaction-response.ts
|
5430
5416
|
function mapGqlOutputsToTxOutputs(outputs) {
|
@@ -5629,8 +5615,8 @@ var TransactionResponse = class _TransactionResponse {
|
|
5629
5615
|
this.status = statusChange;
|
5630
5616
|
if (statusChange.type === "SqueezedOutStatus") {
|
5631
5617
|
this.unsetResourceCache();
|
5632
|
-
throw new
|
5633
|
-
|
5618
|
+
throw new import_errors17.FuelError(
|
5619
|
+
import_errors17.ErrorCode.TRANSACTION_SQUEEZED_OUT,
|
5634
5620
|
`Transaction Squeezed Out with reason: ${statusChange.reason}`
|
5635
5621
|
);
|
5636
5622
|
}
|
@@ -5656,14 +5642,15 @@ var TransactionResponse = class _TransactionResponse {
|
|
5656
5642
|
const transactionResult = {
|
5657
5643
|
...transactionSummary
|
5658
5644
|
};
|
5659
|
-
let logs = [];
|
5645
|
+
let { logs, groupedLogs } = { logs: [], groupedLogs: {} };
|
5660
5646
|
if (this.abis) {
|
5661
|
-
logs =
|
5662
|
-
transactionSummary.receipts,
|
5663
|
-
this.abis.main,
|
5664
|
-
this.abis.otherContractsAbis
|
5665
|
-
);
|
5647
|
+
({ logs, groupedLogs } = getAllDecodedLogs({
|
5648
|
+
receipts: transactionSummary.receipts,
|
5649
|
+
mainAbi: this.abis.main,
|
5650
|
+
externalAbis: this.abis.otherContractsAbis
|
5651
|
+
}));
|
5666
5652
|
transactionResult.logs = logs;
|
5653
|
+
transactionResult.groupedLogs = groupedLogs;
|
5667
5654
|
}
|
5668
5655
|
const { receipts } = transactionResult;
|
5669
5656
|
const status = this.status ?? this.gqlTransaction?.status;
|
@@ -5672,7 +5659,8 @@ var TransactionResponse = class _TransactionResponse {
|
|
5672
5659
|
throw extractTxError({
|
5673
5660
|
receipts,
|
5674
5661
|
statusReason: reason,
|
5675
|
-
logs
|
5662
|
+
logs,
|
5663
|
+
groupedLogs
|
5676
5664
|
});
|
5677
5665
|
}
|
5678
5666
|
return transactionResult;
|
@@ -5700,6 +5688,34 @@ var TransactionResponse = class _TransactionResponse {
|
|
5700
5688
|
}
|
5701
5689
|
};
|
5702
5690
|
|
5691
|
+
// src/providers/transaction-response/getDecodedLogs.ts
|
5692
|
+
var import_abi_coder5 = require("@fuel-ts/abi-coder");
|
5693
|
+
var import_configs13 = require("@fuel-ts/address/configs");
|
5694
|
+
var import_transactions23 = require("@fuel-ts/transactions");
|
5695
|
+
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
5696
|
+
let mainContract = "";
|
5697
|
+
if (mainAbi.programType === "contract") {
|
5698
|
+
const firstCallReceipt = receipts.find(
|
5699
|
+
(r) => r.type === import_transactions23.ReceiptType.Call && r.id === import_configs13.ZeroBytes32
|
5700
|
+
);
|
5701
|
+
mainContract = firstCallReceipt.to;
|
5702
|
+
}
|
5703
|
+
return receipts.reduce((logs, receipt) => {
|
5704
|
+
if (receipt.type === import_transactions23.ReceiptType.LogData || receipt.type === import_transactions23.ReceiptType.Log) {
|
5705
|
+
const isLogFromMainAbi = receipt.id === import_configs13.ZeroBytes32 || mainContract === receipt.id;
|
5706
|
+
const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
|
5707
|
+
if (isDecodable) {
|
5708
|
+
const interfaceToUse = isLogFromMainAbi ? new import_abi_coder5.Interface(mainAbi) : new import_abi_coder5.Interface(externalAbis[receipt.id]);
|
5709
|
+
const data = receipt.type === import_transactions23.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
|
5710
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
|
5711
|
+
logs.push(decodedLog);
|
5712
|
+
}
|
5713
|
+
}
|
5714
|
+
return logs;
|
5715
|
+
}, []);
|
5716
|
+
}
|
5717
|
+
__name(getDecodedLogs, "getDecodedLogs");
|
5718
|
+
|
5703
5719
|
// src/providers/utils/auto-retry-fetch.ts
|
5704
5720
|
var import_utils28 = require("@fuel-ts/utils");
|
5705
5721
|
function getWaitDelay(options, retryAttemptNum) {
|
@@ -5756,31 +5772,31 @@ var adjustResourcesToExclude = /* @__PURE__ */ __name((params) => {
|
|
5756
5772
|
}, "adjustResourcesToExclude");
|
5757
5773
|
|
5758
5774
|
// src/providers/utils/validate-pagination-args.ts
|
5759
|
-
var
|
5775
|
+
var import_errors18 = require("@fuel-ts/errors");
|
5760
5776
|
var validatePaginationArgs = /* @__PURE__ */ __name((params) => {
|
5761
5777
|
const { paginationLimit, inputArgs = {} } = params;
|
5762
5778
|
const { first, last, after, before } = inputArgs;
|
5763
5779
|
if (after && before) {
|
5764
|
-
throw new
|
5765
|
-
|
5780
|
+
throw new import_errors18.FuelError(
|
5781
|
+
import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5766
5782
|
'Pagination arguments "after" and "before" cannot be used together'
|
5767
5783
|
);
|
5768
5784
|
}
|
5769
5785
|
if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
|
5770
|
-
throw new
|
5771
|
-
|
5786
|
+
throw new import_errors18.FuelError(
|
5787
|
+
import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5772
5788
|
`Pagination limit for this query cannot exceed ${paginationLimit} items`
|
5773
5789
|
);
|
5774
5790
|
}
|
5775
5791
|
if (first && before) {
|
5776
|
-
throw new
|
5777
|
-
|
5792
|
+
throw new import_errors18.FuelError(
|
5793
|
+
import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5778
5794
|
'The use of pagination argument "first" with "before" is not supported'
|
5779
5795
|
);
|
5780
5796
|
}
|
5781
5797
|
if (last && after) {
|
5782
|
-
throw new
|
5783
|
-
|
5798
|
+
throw new import_errors18.FuelError(
|
5799
|
+
import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5784
5800
|
'The use of pagination argument "last" with "after" is not supported'
|
5785
5801
|
);
|
5786
5802
|
}
|
@@ -5895,7 +5911,7 @@ var Provider = class _Provider {
|
|
5895
5911
|
try {
|
5896
5912
|
parsedUrl = new URL(url);
|
5897
5913
|
} catch (error) {
|
5898
|
-
throw new
|
5914
|
+
throw new import_errors19.FuelError(import_errors19.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
|
5899
5915
|
}
|
5900
5916
|
const username = parsedUrl.username;
|
5901
5917
|
const password = parsedUrl.password;
|
@@ -5973,39 +5989,52 @@ var Provider = class _Provider {
|
|
5973
5989
|
* @returns A promise that resolves to the Chain and NodeInfo.
|
5974
5990
|
*/
|
5975
5991
|
async fetchChainAndNodeInfo(ignoreCache = false) {
|
5976
|
-
|
5977
|
-
|
5978
|
-
|
5979
|
-
|
5980
|
-
chain
|
5981
|
-
|
5982
|
-
|
5983
|
-
|
5984
|
-
|
5985
|
-
|
5986
|
-
|
5987
|
-
|
5988
|
-
|
5989
|
-
|
5990
|
-
|
5991
|
-
}
|
5992
|
-
const { promise, resolve } = deferPromise();
|
5993
|
-
_Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
|
5994
|
-
const data = await this.operations.getChainAndNodeInfo();
|
5995
|
-
nodeInfo = deserializeNodeInfo(data.nodeInfo);
|
5996
|
-
chain = deserializeChain(data.chain);
|
5997
|
-
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
5998
|
-
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
5999
|
-
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
6000
|
-
const now = Date.now();
|
6001
|
-
this.consensusParametersTimestamp = now;
|
6002
|
-
resolve(now);
|
6003
|
-
delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
5992
|
+
const nodeInfo = _Provider.nodeInfoCache[this.urlWithoutAuth];
|
5993
|
+
const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
|
5994
|
+
const hasCache = nodeInfo && chain;
|
5995
|
+
if (hasCache && !ignoreCache) {
|
5996
|
+
return { nodeInfo, chain };
|
5997
|
+
}
|
5998
|
+
const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
5999
|
+
if (inflightRequest) {
|
6000
|
+
return inflightRequest.then((data) => {
|
6001
|
+
this.consensusParametersTimestamp = data.consensusParametersTimestamp;
|
6002
|
+
return {
|
6003
|
+
nodeInfo: _Provider.nodeInfoCache[this.urlWithoutAuth],
|
6004
|
+
chain: _Provider.chainInfoCache[this.urlWithoutAuth]
|
6005
|
+
};
|
6006
|
+
});
|
6004
6007
|
}
|
6005
|
-
|
6006
|
-
chain,
|
6007
|
-
nodeInfo
|
6008
|
-
|
6008
|
+
const getChainAndNodeInfoFromNetwork = this.operations.getChainAndNodeInfo().then((data) => ({
|
6009
|
+
chain: deserializeChain(data.chain),
|
6010
|
+
nodeInfo: deserializeNodeInfo(data.nodeInfo),
|
6011
|
+
consensusParametersTimestamp: Date.now()
|
6012
|
+
})).then((data) => {
|
6013
|
+
_Provider.setIncompatibleNodeVersionMessage(data.nodeInfo);
|
6014
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = data.chain;
|
6015
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = data.nodeInfo;
|
6016
|
+
this.consensusParametersTimestamp = data.consensusParametersTimestamp;
|
6017
|
+
return data;
|
6018
|
+
}).catch((err) => {
|
6019
|
+
const error = new import_errors19.FuelError(
|
6020
|
+
import_errors19.FuelError.CODES.CONNECTION_REFUSED,
|
6021
|
+
"Unable to fetch chain and node info from the network",
|
6022
|
+
{ url: this.urlWithoutAuth },
|
6023
|
+
err
|
6024
|
+
);
|
6025
|
+
error.cause = { code: "ECONNREFUSED" };
|
6026
|
+
throw error;
|
6027
|
+
}).finally(() => {
|
6028
|
+
delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
6029
|
+
});
|
6030
|
+
_Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = getChainAndNodeInfoFromNetwork;
|
6031
|
+
return _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth].then((data) => {
|
6032
|
+
this.consensusParametersTimestamp = data.consensusParametersTimestamp;
|
6033
|
+
return {
|
6034
|
+
nodeInfo: _Provider.nodeInfoCache[this.urlWithoutAuth],
|
6035
|
+
chain: _Provider.chainInfoCache[this.urlWithoutAuth]
|
6036
|
+
};
|
6037
|
+
});
|
6009
6038
|
}
|
6010
6039
|
/**
|
6011
6040
|
* @hidden
|
@@ -6153,8 +6182,8 @@ var Provider = class _Provider {
|
|
6153
6182
|
async getAssetDetails(assetId) {
|
6154
6183
|
const { assetMetadata } = await this.getNodeFeatures();
|
6155
6184
|
if (!assetMetadata) {
|
6156
|
-
throw new
|
6157
|
-
|
6185
|
+
throw new import_errors19.FuelError(
|
6186
|
+
import_errors19.ErrorCode.UNSUPPORTED_FEATURE,
|
6158
6187
|
"The current node does not supports fetching asset details"
|
6159
6188
|
);
|
6160
6189
|
}
|
@@ -6185,14 +6214,14 @@ var Provider = class _Provider {
|
|
6185
6214
|
}
|
6186
6215
|
} = await this.getChain();
|
6187
6216
|
if ((0, import_math18.bn)(tx.inputs.length).gt(maxInputs)) {
|
6188
|
-
throw new
|
6189
|
-
|
6217
|
+
throw new import_errors19.FuelError(
|
6218
|
+
import_errors19.ErrorCode.MAX_INPUTS_EXCEEDED,
|
6190
6219
|
`The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`
|
6191
6220
|
);
|
6192
6221
|
}
|
6193
6222
|
if ((0, import_math18.bn)(tx.outputs.length).gt(maxOutputs)) {
|
6194
|
-
throw new
|
6195
|
-
|
6223
|
+
throw new import_errors19.FuelError(
|
6224
|
+
import_errors19.ErrorCode.MAX_OUTPUTS_EXCEEDED,
|
6196
6225
|
`The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`
|
6197
6226
|
);
|
6198
6227
|
}
|
@@ -6873,7 +6902,7 @@ var Provider = class _Provider {
|
|
6873
6902
|
},
|
6874
6903
|
transactionIds: block.transactions.map((tx) => tx.id),
|
6875
6904
|
transactions: block.transactions.map(
|
6876
|
-
(tx) => new
|
6905
|
+
(tx) => new import_transactions24.TransactionCoder().decode((0, import_utils29.arrayify)(tx.rawPayload), 0)?.[0]
|
6877
6906
|
)
|
6878
6907
|
};
|
6879
6908
|
}
|
@@ -6889,12 +6918,12 @@ var Provider = class _Provider {
|
|
6889
6918
|
return null;
|
6890
6919
|
}
|
6891
6920
|
try {
|
6892
|
-
return new
|
6921
|
+
return new import_transactions24.TransactionCoder().decode(
|
6893
6922
|
(0, import_utils29.arrayify)(transaction.rawPayload),
|
6894
6923
|
0
|
6895
6924
|
)?.[0];
|
6896
6925
|
} catch (error) {
|
6897
|
-
if (error instanceof
|
6926
|
+
if (error instanceof import_errors19.FuelError && error.code === import_errors19.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
|
6898
6927
|
console.warn("Unsupported transaction type encountered");
|
6899
6928
|
return null;
|
6900
6929
|
}
|
@@ -6915,12 +6944,12 @@ var Provider = class _Provider {
|
|
6915
6944
|
paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
|
6916
6945
|
})
|
6917
6946
|
});
|
6918
|
-
const coder = new
|
6947
|
+
const coder = new import_transactions24.TransactionCoder();
|
6919
6948
|
const transactions = edges.map(({ node: { rawPayload } }) => {
|
6920
6949
|
try {
|
6921
6950
|
return coder.decode((0, import_utils29.arrayify)(rawPayload), 0)[0];
|
6922
6951
|
} catch (error) {
|
6923
|
-
if (error instanceof
|
6952
|
+
if (error instanceof import_errors19.FuelError && error.code === import_errors19.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
|
6924
6953
|
console.warn("Unsupported transaction type encountered");
|
6925
6954
|
return null;
|
6926
6955
|
}
|
@@ -7035,7 +7064,7 @@ var Provider = class _Provider {
|
|
7035
7064
|
owner: new import_address3.Address(address).toB256()
|
7036
7065
|
});
|
7037
7066
|
const messages = edges.map(({ node }) => ({
|
7038
|
-
messageId:
|
7067
|
+
messageId: import_transactions24.InputMessageCoder.getMessageId({
|
7039
7068
|
sender: node.sender,
|
7040
7069
|
recipient: node.recipient,
|
7041
7070
|
nonce: node.nonce,
|
@@ -7046,7 +7075,7 @@ var Provider = class _Provider {
|
|
7046
7075
|
recipient: new import_address3.Address(node.recipient),
|
7047
7076
|
nonce: node.nonce,
|
7048
7077
|
amount: (0, import_math18.bn)(node.amount),
|
7049
|
-
data:
|
7078
|
+
data: import_transactions24.InputMessageCoder.decodeData(node.data),
|
7050
7079
|
daHeight: (0, import_math18.bn)(node.daHeight)
|
7051
7080
|
}));
|
7052
7081
|
return {
|
@@ -7069,8 +7098,8 @@ var Provider = class _Provider {
|
|
7069
7098
|
nonce
|
7070
7099
|
};
|
7071
7100
|
if (commitBlockId && commitBlockHeight) {
|
7072
|
-
throw new
|
7073
|
-
|
7101
|
+
throw new import_errors19.FuelError(
|
7102
|
+
import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
|
7074
7103
|
"commitBlockId and commitBlockHeight cannot be used together"
|
7075
7104
|
);
|
7076
7105
|
}
|
@@ -7252,7 +7281,7 @@ var Provider = class _Provider {
|
|
7252
7281
|
return null;
|
7253
7282
|
}
|
7254
7283
|
const message = {
|
7255
|
-
messageId:
|
7284
|
+
messageId: import_transactions24.InputMessageCoder.getMessageId({
|
7256
7285
|
sender: rawMessage.sender,
|
7257
7286
|
recipient: rawMessage.recipient,
|
7258
7287
|
nonce,
|
@@ -7263,7 +7292,7 @@ var Provider = class _Provider {
|
|
7263
7292
|
recipient: new import_address3.Address(rawMessage.recipient),
|
7264
7293
|
nonce,
|
7265
7294
|
amount: (0, import_math18.bn)(rawMessage.amount),
|
7266
|
-
data:
|
7295
|
+
data: import_transactions24.InputMessageCoder.decodeData(rawMessage.data),
|
7267
7296
|
daHeight: (0, import_math18.bn)(rawMessage.daHeight)
|
7268
7297
|
};
|
7269
7298
|
return message;
|
@@ -7289,15 +7318,17 @@ var Provider = class _Provider {
|
|
7289
7318
|
extractDryRunError(transactionRequest, receipts, dryRunStatus) {
|
7290
7319
|
const status = dryRunStatus;
|
7291
7320
|
let logs = [];
|
7321
|
+
let groupedLogs = {};
|
7292
7322
|
if (transactionRequest.abis) {
|
7293
|
-
logs =
|
7323
|
+
({ logs, groupedLogs } = getAllDecodedLogs({
|
7294
7324
|
receipts,
|
7295
|
-
transactionRequest.abis.main,
|
7296
|
-
transactionRequest.abis.otherContractsAbis
|
7297
|
-
);
|
7325
|
+
mainAbi: transactionRequest.abis.main,
|
7326
|
+
externalAbis: transactionRequest.abis.otherContractsAbis
|
7327
|
+
}));
|
7298
7328
|
}
|
7299
7329
|
return extractTxError({
|
7300
7330
|
logs,
|
7331
|
+
groupedLogs,
|
7301
7332
|
receipts,
|
7302
7333
|
statusReason: status.reason
|
7303
7334
|
});
|
@@ -7329,9 +7360,9 @@ var Provider = class _Provider {
|
|
7329
7360
|
};
|
7330
7361
|
|
7331
7362
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
7332
|
-
var
|
7363
|
+
var import_errors20 = require("@fuel-ts/errors");
|
7333
7364
|
var import_math19 = require("@fuel-ts/math");
|
7334
|
-
var
|
7365
|
+
var import_transactions25 = require("@fuel-ts/transactions");
|
7335
7366
|
var import_utils31 = require("@fuel-ts/utils");
|
7336
7367
|
async function getTransactionSummary(params) {
|
7337
7368
|
const { id, provider, abiMap } = params;
|
@@ -7339,12 +7370,12 @@ async function getTransactionSummary(params) {
|
|
7339
7370
|
transactionId: id
|
7340
7371
|
});
|
7341
7372
|
if (!gqlTransaction) {
|
7342
|
-
throw new
|
7343
|
-
|
7373
|
+
throw new import_errors20.FuelError(
|
7374
|
+
import_errors20.ErrorCode.TRANSACTION_NOT_FOUND,
|
7344
7375
|
`Transaction not found for given id: ${id}.`
|
7345
7376
|
);
|
7346
7377
|
}
|
7347
|
-
const [decodedTransaction] = new
|
7378
|
+
const [decodedTransaction] = new import_transactions25.TransactionCoder().decode(
|
7348
7379
|
(0, import_utils31.arrayify)(gqlTransaction.rawPayload),
|
7349
7380
|
0
|
7350
7381
|
);
|
@@ -7433,7 +7464,7 @@ async function getTransactionsSummaries(params) {
|
|
7433
7464
|
const transactions = edges.map((edge) => {
|
7434
7465
|
const { node: gqlTransaction } = edge;
|
7435
7466
|
const { id, rawPayload, status } = gqlTransaction;
|
7436
|
-
const [decodedTransaction] = new
|
7467
|
+
const [decodedTransaction] = new import_transactions25.TransactionCoder().decode((0, import_utils31.arrayify)(rawPayload), 0);
|
7437
7468
|
let txReceipts = [];
|
7438
7469
|
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
7439
7470
|
txReceipts = gqlTransaction.status.receipts;
|
@@ -7468,7 +7499,7 @@ __name(getTransactionsSummaries, "getTransactionsSummaries");
|
|
7468
7499
|
|
7469
7500
|
// src/providers/transaction-summary/assemble-transaction-summary-from-serialized.ts
|
7470
7501
|
var import_math20 = require("@fuel-ts/math");
|
7471
|
-
var
|
7502
|
+
var import_transactions26 = require("@fuel-ts/transactions");
|
7472
7503
|
var import_utils32 = require("@fuel-ts/utils");
|
7473
7504
|
var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) => {
|
7474
7505
|
const { provider, transactionSummary } = opts;
|
@@ -7482,7 +7513,7 @@ var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) =>
|
|
7482
7513
|
}
|
7483
7514
|
} = await provider.getChain();
|
7484
7515
|
const deserializedTransactionBytes = (0, import_utils32.arrayify)(transactionBytes);
|
7485
|
-
const [transaction] = new
|
7516
|
+
const [transaction] = new import_transactions26.TransactionCoder().decode(deserializedTransactionBytes, 0);
|
7486
7517
|
return assembleTransactionSummary({
|
7487
7518
|
id,
|
7488
7519
|
transaction,
|
@@ -7522,12 +7553,12 @@ var AbstractAccount = class {
|
|
7522
7553
|
};
|
7523
7554
|
|
7524
7555
|
// src/utils/formatTransferToContractScriptData.ts
|
7525
|
-
var
|
7556
|
+
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
7526
7557
|
var import_address4 = require("@fuel-ts/address");
|
7527
7558
|
var import_utils33 = require("@fuel-ts/utils");
|
7528
7559
|
var asm = __toESM(require("@fuels/vm-asm"));
|
7529
7560
|
var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
|
7530
|
-
const numberCoder = new
|
7561
|
+
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
7531
7562
|
return transferParams.reduce((acc, transferParam) => {
|
7532
7563
|
const { assetId, amount, contractId } = transferParam;
|
7533
7564
|
const encoded = numberCoder.encode(amount);
|
@@ -7540,7 +7571,7 @@ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferPar
|
|
7540
7571
|
await asm.initWasm();
|
7541
7572
|
let script = new Uint8Array();
|
7542
7573
|
transferParams.forEach((_, i) => {
|
7543
|
-
const offset = (
|
7574
|
+
const offset = (import_abi_coder6.CONTRACT_ID_LEN + import_abi_coder6.WORD_SIZE + import_abi_coder6.ASSET_ID_LEN) * i;
|
7544
7575
|
script = (0, import_utils33.concat)([
|
7545
7576
|
script,
|
7546
7577
|
// Load ScriptData into register 0x10.
|
@@ -7548,11 +7579,11 @@ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferPar
|
|
7548
7579
|
// Add the offset to 0x10 so it will point to the current contract ID, store in 0x11.
|
7549
7580
|
asm.addi(17, 16, offset).to_bytes(),
|
7550
7581
|
// Add CONTRACT_ID_LEN to 0x11 to point to the amount in the ScriptData, store in 0x12.
|
7551
|
-
asm.addi(18, 17,
|
7582
|
+
asm.addi(18, 17, import_abi_coder6.CONTRACT_ID_LEN).to_bytes(),
|
7552
7583
|
// Load word to the amount at 0x12 into register 0x13.
|
7553
7584
|
asm.lw(19, 18, 0).to_bytes(),
|
7554
7585
|
// Add WORD_SIZE to 0x12 to point to the asset ID in the ScriptData, store in 0x14.
|
7555
|
-
asm.addi(20, 18,
|
7586
|
+
asm.addi(20, 18, import_abi_coder6.WORD_SIZE).to_bytes(),
|
7556
7587
|
// Perform the transfer using contract ID in 0x11, amount in 0x13, and asset ID in 0x14.
|
7557
7588
|
asm.tr(17, 19, 20).to_bytes()
|
7558
7589
|
]);
|
@@ -7601,7 +7632,7 @@ var Account = class extends AbstractAccount {
|
|
7601
7632
|
*/
|
7602
7633
|
get provider() {
|
7603
7634
|
if (!this._provider) {
|
7604
|
-
throw new
|
7635
|
+
throw new import_errors21.FuelError(import_errors21.ErrorCode.MISSING_PROVIDER, "Provider not set");
|
7605
7636
|
}
|
7606
7637
|
return this._provider;
|
7607
7638
|
}
|
@@ -7760,8 +7791,8 @@ var Account = class extends AbstractAccount {
|
|
7760
7791
|
fundingAttempts += 1;
|
7761
7792
|
}
|
7762
7793
|
if (needsToBeFunded) {
|
7763
|
-
throw new
|
7764
|
-
|
7794
|
+
throw new import_errors21.FuelError(
|
7795
|
+
import_errors21.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
7765
7796
|
`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
|
7766
7797
|
);
|
7767
7798
|
}
|
@@ -7880,8 +7911,8 @@ var Account = class extends AbstractAccount {
|
|
7880
7911
|
const contractAddress = new import_address5.Address(transferParam.contractId);
|
7881
7912
|
const assetId = transferParam.assetId ? (0, import_utils34.hexlify)(transferParam.assetId) : defaultAssetId;
|
7882
7913
|
if (amount.lte(0)) {
|
7883
|
-
throw new
|
7884
|
-
|
7914
|
+
throw new import_errors21.FuelError(
|
7915
|
+
import_errors21.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
7885
7916
|
"Transfer amount must be a positive number."
|
7886
7917
|
);
|
7887
7918
|
}
|
@@ -7951,7 +7982,7 @@ var Account = class extends AbstractAccount {
|
|
7951
7982
|
const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
|
7952
7983
|
const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math21.bn)("100000000000000000") }];
|
7953
7984
|
const findAssetInput = /* @__PURE__ */ __name((assetId) => txRequestClone.inputs.find((input) => {
|
7954
|
-
if (input.type ===
|
7985
|
+
if (input.type === import_transactions27.InputType.Coin) {
|
7955
7986
|
return input.assetId === assetId;
|
7956
7987
|
}
|
7957
7988
|
if (isRequestInputMessageWithoutData(input)) {
|
@@ -7997,7 +8028,7 @@ var Account = class extends AbstractAccount {
|
|
7997
8028
|
*/
|
7998
8029
|
async signMessage(message) {
|
7999
8030
|
if (!this._connector) {
|
8000
|
-
throw new
|
8031
|
+
throw new import_errors21.FuelError(import_errors21.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
8001
8032
|
}
|
8002
8033
|
return this._connector.signMessage(this.address.toString(), message);
|
8003
8034
|
}
|
@@ -8009,8 +8040,8 @@ var Account = class extends AbstractAccount {
|
|
8009
8040
|
*/
|
8010
8041
|
async signTransaction(transactionRequestLike) {
|
8011
8042
|
if (!this._connector) {
|
8012
|
-
throw new
|
8013
|
-
|
8043
|
+
throw new import_errors21.FuelError(
|
8044
|
+
import_errors21.ErrorCode.MISSING_CONNECTOR,
|
8014
8045
|
"A connector is required to sign transactions."
|
8015
8046
|
);
|
8016
8047
|
}
|
@@ -8074,7 +8105,7 @@ var Account = class extends AbstractAccount {
|
|
8074
8105
|
*/
|
8075
8106
|
generateFakeResources(coins) {
|
8076
8107
|
return coins.map((coin) => ({
|
8077
|
-
id: (0, import_utils34.hexlify)((0, import_crypto2.randomBytes)(
|
8108
|
+
id: (0, import_utils34.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
|
8078
8109
|
owner: this.address,
|
8079
8110
|
blockCreated: (0, import_math21.bn)(1),
|
8080
8111
|
txCreatedIdx: (0, import_math21.bn)(1),
|
@@ -8106,8 +8137,8 @@ var Account = class extends AbstractAccount {
|
|
8106
8137
|
/** @hidden * */
|
8107
8138
|
validateTransferAmount(amount) {
|
8108
8139
|
if ((0, import_math21.bn)(amount).lte(0)) {
|
8109
|
-
throw new
|
8110
|
-
|
8140
|
+
throw new import_errors21.FuelError(
|
8141
|
+
import_errors21.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
8111
8142
|
"Transfer amount must be a positive number."
|
8112
8143
|
);
|
8113
8144
|
}
|
@@ -8136,16 +8167,16 @@ var Account = class extends AbstractAccount {
|
|
8136
8167
|
if (!(0, import_utils34.isDefined)(setGasLimit)) {
|
8137
8168
|
request2.gasLimit = gasUsed;
|
8138
8169
|
} else if (gasUsed.gt(setGasLimit)) {
|
8139
|
-
throw new
|
8140
|
-
|
8170
|
+
throw new import_errors21.FuelError(
|
8171
|
+
import_errors21.ErrorCode.GAS_LIMIT_TOO_LOW,
|
8141
8172
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
8142
8173
|
);
|
8143
8174
|
}
|
8144
8175
|
if (!(0, import_utils34.isDefined)(setMaxFee)) {
|
8145
8176
|
request2.maxFee = maxFee;
|
8146
8177
|
} else if (maxFee.gt(setMaxFee)) {
|
8147
|
-
throw new
|
8148
|
-
|
8178
|
+
throw new import_errors21.FuelError(
|
8179
|
+
import_errors21.ErrorCode.MAX_FEE_TOO_LOW,
|
8149
8180
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
8150
8181
|
);
|
8151
8182
|
}
|
@@ -8272,7 +8303,7 @@ var Signer = class _Signer {
|
|
8272
8303
|
// src/wallet/keystore-wallet.ts
|
8273
8304
|
var import_address7 = require("@fuel-ts/address");
|
8274
8305
|
var import_crypto4 = require("@fuel-ts/crypto");
|
8275
|
-
var
|
8306
|
+
var import_errors22 = require("@fuel-ts/errors");
|
8276
8307
|
var import_utils36 = require("@fuel-ts/utils");
|
8277
8308
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
8278
8309
|
var DEFAULT_KDF_PARAMS_R = 8;
|
@@ -8350,8 +8381,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
8350
8381
|
const macHashUint8Array = (0, import_crypto4.keccak256)(data);
|
8351
8382
|
const macHash = (0, import_crypto4.stringFromBuffer)(macHashUint8Array, "hex");
|
8352
8383
|
if (mac !== macHash) {
|
8353
|
-
throw new
|
8354
|
-
|
8384
|
+
throw new import_errors22.FuelError(
|
8385
|
+
import_errors22.ErrorCode.INVALID_PASSWORD,
|
8355
8386
|
"Failed to decrypt the keystore wallet, the provided password is incorrect."
|
8356
8387
|
);
|
8357
8388
|
}
|
@@ -8490,14 +8521,14 @@ var BaseWalletUnlocked = class extends Account {
|
|
8490
8521
|
|
8491
8522
|
// src/hdwallet/hdwallet.ts
|
8492
8523
|
var import_crypto6 = require("@fuel-ts/crypto");
|
8493
|
-
var
|
8524
|
+
var import_errors25 = require("@fuel-ts/errors");
|
8494
8525
|
var import_hasher7 = require("@fuel-ts/hasher");
|
8495
8526
|
var import_math23 = require("@fuel-ts/math");
|
8496
8527
|
var import_utils41 = require("@fuel-ts/utils");
|
8497
8528
|
|
8498
8529
|
// src/mnemonic/mnemonic.ts
|
8499
8530
|
var import_crypto5 = require("@fuel-ts/crypto");
|
8500
|
-
var
|
8531
|
+
var import_errors24 = require("@fuel-ts/errors");
|
8501
8532
|
var import_hasher6 = require("@fuel-ts/hasher");
|
8502
8533
|
var import_utils39 = require("@fuel-ts/utils");
|
8503
8534
|
|
@@ -10560,7 +10591,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
10560
10591
|
})(Language || {});
|
10561
10592
|
|
10562
10593
|
// src/mnemonic/utils.ts
|
10563
|
-
var
|
10594
|
+
var import_errors23 = require("@fuel-ts/errors");
|
10564
10595
|
var import_hasher5 = require("@fuel-ts/hasher");
|
10565
10596
|
var import_utils38 = require("@fuel-ts/utils");
|
10566
10597
|
function getLowerMask(bits) {
|
@@ -10614,8 +10645,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
10614
10645
|
for (let i = 0; i < words.length; i += 1) {
|
10615
10646
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
10616
10647
|
if (index === -1) {
|
10617
|
-
throw new
|
10618
|
-
|
10648
|
+
throw new import_errors23.FuelError(
|
10649
|
+
import_errors23.ErrorCode.INVALID_MNEMONIC,
|
10619
10650
|
`Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
|
10620
10651
|
);
|
10621
10652
|
}
|
@@ -10631,8 +10662,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
10631
10662
|
const checksumMask = getUpperMask(checksumBits);
|
10632
10663
|
const checksum = (0, import_utils38.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
10633
10664
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
10634
|
-
throw new
|
10635
|
-
|
10665
|
+
throw new import_errors23.FuelError(
|
10666
|
+
import_errors23.ErrorCode.INVALID_CHECKSUM,
|
10636
10667
|
"Checksum validation failed for the provided mnemonic."
|
10637
10668
|
);
|
10638
10669
|
}
|
@@ -10647,8 +10678,8 @@ var TestnetPRV = "0x04358394";
|
|
10647
10678
|
var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
|
10648
10679
|
function assertWordList(wordlist) {
|
10649
10680
|
if (wordlist.length !== 2048) {
|
10650
|
-
throw new
|
10651
|
-
|
10681
|
+
throw new import_errors24.FuelError(
|
10682
|
+
import_errors24.ErrorCode.INVALID_WORD_LIST,
|
10652
10683
|
`Expected word list length of 2048, but got ${wordlist.length}.`
|
10653
10684
|
);
|
10654
10685
|
}
|
@@ -10656,8 +10687,8 @@ function assertWordList(wordlist) {
|
|
10656
10687
|
__name(assertWordList, "assertWordList");
|
10657
10688
|
function assertEntropy(entropy) {
|
10658
10689
|
if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
|
10659
|
-
throw new
|
10660
|
-
|
10690
|
+
throw new import_errors24.FuelError(
|
10691
|
+
import_errors24.ErrorCode.INVALID_ENTROPY,
|
10661
10692
|
`Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
|
10662
10693
|
);
|
10663
10694
|
}
|
@@ -10668,7 +10699,7 @@ function assertMnemonic(words) {
|
|
10668
10699
|
const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
|
10669
10700
|
", "
|
10670
10701
|
)}] words, but got ${words.length}.`;
|
10671
|
-
throw new
|
10702
|
+
throw new import_errors24.FuelError(import_errors24.ErrorCode.INVALID_MNEMONIC, errorMsg);
|
10672
10703
|
}
|
10673
10704
|
}
|
10674
10705
|
__name(assertMnemonic, "assertMnemonic");
|
@@ -10790,8 +10821,8 @@ var Mnemonic = class _Mnemonic {
|
|
10790
10821
|
static masterKeysFromSeed(seed) {
|
10791
10822
|
const seedArray = (0, import_utils39.arrayify)(seed);
|
10792
10823
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
10793
|
-
throw new
|
10794
|
-
|
10824
|
+
throw new import_errors24.FuelError(
|
10825
|
+
import_errors24.ErrorCode.INVALID_SEED,
|
10795
10826
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
10796
10827
|
);
|
10797
10828
|
}
|
@@ -10872,7 +10903,7 @@ __name(isValidExtendedKey, "isValidExtendedKey");
|
|
10872
10903
|
function parsePath(path, depth = 0) {
|
10873
10904
|
const components = path.split("/");
|
10874
10905
|
if (components.length === 0 || components[0] === "m" && depth !== 0) {
|
10875
|
-
throw new
|
10906
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
|
10876
10907
|
}
|
10877
10908
|
if (components[0] === "m") {
|
10878
10909
|
components.shift();
|
@@ -10905,8 +10936,8 @@ var HDWallet = class _HDWallet {
|
|
10905
10936
|
this.privateKey = (0, import_utils41.hexlify)(config.privateKey);
|
10906
10937
|
} else {
|
10907
10938
|
if (!config.publicKey) {
|
10908
|
-
throw new
|
10909
|
-
|
10939
|
+
throw new import_errors25.FuelError(
|
10940
|
+
import_errors25.ErrorCode.HD_WALLET_ERROR,
|
10910
10941
|
"Both public and private Key cannot be missing. At least one should be provided."
|
10911
10942
|
);
|
10912
10943
|
}
|
@@ -10935,8 +10966,8 @@ var HDWallet = class _HDWallet {
|
|
10935
10966
|
const data = new Uint8Array(37);
|
10936
10967
|
if (index & HARDENED_INDEX) {
|
10937
10968
|
if (!privateKey) {
|
10938
|
-
throw new
|
10939
|
-
|
10969
|
+
throw new import_errors25.FuelError(
|
10970
|
+
import_errors25.ErrorCode.HD_WALLET_ERROR,
|
10940
10971
|
"Cannot derive a hardened index without a private Key."
|
10941
10972
|
);
|
10942
10973
|
}
|
@@ -10988,8 +11019,8 @@ var HDWallet = class _HDWallet {
|
|
10988
11019
|
*/
|
10989
11020
|
toExtendedKey(isPublic = false, testnet = false) {
|
10990
11021
|
if (this.depth >= 256) {
|
10991
|
-
throw new
|
10992
|
-
|
11022
|
+
throw new import_errors25.FuelError(
|
11023
|
+
import_errors25.ErrorCode.HD_WALLET_ERROR,
|
10993
11024
|
`Exceeded max depth of 255. Current depth: ${this.depth}.`
|
10994
11025
|
);
|
10995
11026
|
}
|
@@ -11020,10 +11051,10 @@ var HDWallet = class _HDWallet {
|
|
11020
11051
|
const bytes = (0, import_utils41.arrayify)(decoded);
|
11021
11052
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
11022
11053
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
11023
|
-
throw new
|
11054
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
11024
11055
|
}
|
11025
11056
|
if (!validChecksum) {
|
11026
|
-
throw new
|
11057
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
11027
11058
|
}
|
11028
11059
|
const depth = bytes[4];
|
11029
11060
|
const parentFingerprint = (0, import_utils41.hexlify)(bytes.slice(5, 9));
|
@@ -11031,14 +11062,14 @@ var HDWallet = class _HDWallet {
|
|
11031
11062
|
const chainCode = (0, import_utils41.hexlify)(bytes.slice(13, 45));
|
11032
11063
|
const key = bytes.slice(45, 78);
|
11033
11064
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
11034
|
-
throw new
|
11035
|
-
|
11065
|
+
throw new import_errors25.FuelError(
|
11066
|
+
import_errors25.ErrorCode.HD_WALLET_ERROR,
|
11036
11067
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
11037
11068
|
);
|
11038
11069
|
}
|
11039
11070
|
if (isPublicExtendedKey(bytes)) {
|
11040
11071
|
if (key[0] !== 3) {
|
11041
|
-
throw new
|
11072
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
11042
11073
|
}
|
11043
11074
|
return new _HDWallet({
|
11044
11075
|
publicKey: key,
|
@@ -11049,7 +11080,7 @@ var HDWallet = class _HDWallet {
|
|
11049
11080
|
});
|
11050
11081
|
}
|
11051
11082
|
if (key[0] !== 0) {
|
11052
|
-
throw new
|
11083
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
|
11053
11084
|
}
|
11054
11085
|
return new _HDWallet({
|
11055
11086
|
privateKey: key.slice(1),
|
@@ -11226,7 +11257,7 @@ var Wallet = class {
|
|
11226
11257
|
// src/wallet-manager/wallet-manager.ts
|
11227
11258
|
var import_address10 = require("@fuel-ts/address");
|
11228
11259
|
var import_crypto7 = require("@fuel-ts/crypto");
|
11229
|
-
var
|
11260
|
+
var import_errors28 = require("@fuel-ts/errors");
|
11230
11261
|
var import_events = require("events");
|
11231
11262
|
|
11232
11263
|
// src/wallet-manager/storages/memory-storage.ts
|
@@ -11252,7 +11283,7 @@ var MemoryStorage = class {
|
|
11252
11283
|
|
11253
11284
|
// src/wallet-manager/vaults/mnemonic-vault.ts
|
11254
11285
|
var import_address8 = require("@fuel-ts/address");
|
11255
|
-
var
|
11286
|
+
var import_errors26 = require("@fuel-ts/errors");
|
11256
11287
|
var MnemonicVault = class {
|
11257
11288
|
static {
|
11258
11289
|
__name(this, "MnemonicVault");
|
@@ -11311,8 +11342,8 @@ var MnemonicVault = class {
|
|
11311
11342
|
}
|
11312
11343
|
numberOfAccounts += 1;
|
11313
11344
|
} while (numberOfAccounts < this.numberOfAccounts);
|
11314
|
-
throw new
|
11315
|
-
|
11345
|
+
throw new import_errors26.FuelError(
|
11346
|
+
import_errors26.ErrorCode.WALLET_MANAGER_ERROR,
|
11316
11347
|
`Account with address '${address}' not found in derived wallets.`
|
11317
11348
|
);
|
11318
11349
|
}
|
@@ -11324,7 +11355,7 @@ var MnemonicVault = class {
|
|
11324
11355
|
|
11325
11356
|
// src/wallet-manager/vaults/privatekey-vault.ts
|
11326
11357
|
var import_address9 = require("@fuel-ts/address");
|
11327
|
-
var
|
11358
|
+
var import_errors27 = require("@fuel-ts/errors");
|
11328
11359
|
var PrivateKeyVault = class {
|
11329
11360
|
static {
|
11330
11361
|
__name(this, "PrivateKeyVault");
|
@@ -11368,8 +11399,8 @@ var PrivateKeyVault = class {
|
|
11368
11399
|
(pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
|
11369
11400
|
);
|
11370
11401
|
if (!privateKey) {
|
11371
|
-
throw new
|
11372
|
-
|
11402
|
+
throw new import_errors27.FuelError(
|
11403
|
+
import_errors27.ErrorCode.WALLET_MANAGER_ERROR,
|
11373
11404
|
`No private key found for address '${address}'.`
|
11374
11405
|
);
|
11375
11406
|
}
|
@@ -11391,7 +11422,7 @@ var ERROR_MESSAGES = {
|
|
11391
11422
|
};
|
11392
11423
|
function assert(condition, message) {
|
11393
11424
|
if (!condition) {
|
11394
|
-
throw new
|
11425
|
+
throw new import_errors28.FuelError(import_errors28.ErrorCode.WALLET_MANAGER_ERROR, message);
|
11395
11426
|
}
|
11396
11427
|
}
|
11397
11428
|
__name(assert, "assert");
|
@@ -11612,29 +11643,29 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
|
|
11612
11643
|
};
|
11613
11644
|
|
11614
11645
|
// src/wallet-manager/types.ts
|
11615
|
-
var
|
11646
|
+
var import_errors29 = require("@fuel-ts/errors");
|
11616
11647
|
var Vault = class {
|
11617
11648
|
static {
|
11618
11649
|
__name(this, "Vault");
|
11619
11650
|
}
|
11620
11651
|
static type;
|
11621
11652
|
constructor(_options) {
|
11622
|
-
throw new
|
11653
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11623
11654
|
}
|
11624
11655
|
serialize() {
|
11625
|
-
throw new
|
11656
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11626
11657
|
}
|
11627
11658
|
getAccounts() {
|
11628
|
-
throw new
|
11659
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11629
11660
|
}
|
11630
11661
|
addAccount() {
|
11631
|
-
throw new
|
11662
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11632
11663
|
}
|
11633
11664
|
exportAccount(_address) {
|
11634
|
-
throw new
|
11665
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11635
11666
|
}
|
11636
11667
|
getWallet(_address) {
|
11637
|
-
throw new
|
11668
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11638
11669
|
}
|
11639
11670
|
};
|
11640
11671
|
var StorageAbstract = class {
|
@@ -11644,18 +11675,18 @@ var StorageAbstract = class {
|
|
11644
11675
|
};
|
11645
11676
|
|
11646
11677
|
// src/predicate/predicate.ts
|
11647
|
-
var
|
11678
|
+
var import_abi_coder9 = require("@fuel-ts/abi-coder");
|
11648
11679
|
var import_address11 = require("@fuel-ts/address");
|
11649
|
-
var
|
11680
|
+
var import_errors31 = require("@fuel-ts/errors");
|
11650
11681
|
var import_utils45 = require("@fuel-ts/utils");
|
11651
11682
|
|
11652
11683
|
// src/utils/deployScriptOrPredicate.ts
|
11653
|
-
var
|
11684
|
+
var import_errors30 = require("@fuel-ts/errors");
|
11654
11685
|
var import_math24 = require("@fuel-ts/math");
|
11655
11686
|
var import_utils43 = require("@fuel-ts/utils");
|
11656
11687
|
|
11657
11688
|
// src/utils/predicate-script-loader-instructions.ts
|
11658
|
-
var
|
11689
|
+
var import_abi_coder8 = require("@fuel-ts/abi-coder");
|
11659
11690
|
var import_hasher8 = require("@fuel-ts/hasher");
|
11660
11691
|
var import_utils42 = require("@fuel-ts/utils");
|
11661
11692
|
var asm2 = __toESM(require("@fuels/vm-asm"));
|
@@ -11667,12 +11698,12 @@ var WORD_SIZE2 = 8;
|
|
11667
11698
|
var DATA_OFFSET_INDEX = 8;
|
11668
11699
|
var CONFIGURABLE_OFFSET_INDEX = 16;
|
11669
11700
|
function getBytecodeDataOffset(bytecode) {
|
11670
|
-
const [offset] = new
|
11701
|
+
const [offset] = new import_abi_coder8.BigNumberCoder("u64").decode(bytecode, DATA_OFFSET_INDEX);
|
11671
11702
|
return offset.toNumber();
|
11672
11703
|
}
|
11673
11704
|
__name(getBytecodeDataOffset, "getBytecodeDataOffset");
|
11674
11705
|
function getBytecodeConfigurableOffset(bytecode) {
|
11675
|
-
const [offset] = new
|
11706
|
+
const [offset] = new import_abi_coder8.BigNumberCoder("u64").decode(bytecode, CONFIGURABLE_OFFSET_INDEX);
|
11676
11707
|
return offset.toNumber();
|
11677
11708
|
}
|
11678
11709
|
__name(getBytecodeConfigurableOffset, "getBytecodeConfigurableOffset");
|
@@ -11817,7 +11848,7 @@ async function fundBlobTx(deployer, blobTxRequest) {
|
|
11817
11848
|
}).add(1);
|
11818
11849
|
totalCost = totalCost.add(minFee);
|
11819
11850
|
if (totalCost.gt(await deployer.getBalance())) {
|
11820
|
-
throw new
|
11851
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.FUNDS_TOO_LOW, "Insufficient balance to deploy predicate.");
|
11821
11852
|
}
|
11822
11853
|
const txCost = await deployer.getTransactionCost(blobTxRequest);
|
11823
11854
|
blobTxRequest.maxFee = txCost.maxFee;
|
@@ -11870,7 +11901,7 @@ async function deployScriptOrPredicate({
|
|
11870
11901
|
throw new Error();
|
11871
11902
|
}
|
11872
11903
|
} catch (err) {
|
11873
|
-
throw new
|
11904
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.TRANSACTION_FAILED, "Failed to deploy predicate chunk");
|
11874
11905
|
}
|
11875
11906
|
return loaderInstance;
|
11876
11907
|
}, "waitForResult");
|
@@ -12007,10 +12038,10 @@ var Predicate = class _Predicate extends Account {
|
|
12007
12038
|
*/
|
12008
12039
|
static processPredicateData(bytes, jsonAbi, configurableConstants) {
|
12009
12040
|
let predicateBytes = (0, import_utils45.arrayify)(bytes);
|
12010
|
-
const abiInterface = new
|
12041
|
+
const abiInterface = new import_abi_coder9.Interface(jsonAbi);
|
12011
12042
|
if (abiInterface.functions.main === void 0) {
|
12012
|
-
throw new
|
12013
|
-
|
12043
|
+
throw new import_errors31.FuelError(
|
12044
|
+
import_errors31.ErrorCode.ABI_MAIN_METHOD_MISSING,
|
12014
12045
|
'Cannot use ABI without "main" function.'
|
12015
12046
|
);
|
12016
12047
|
}
|
@@ -12070,15 +12101,15 @@ var Predicate = class _Predicate extends Account {
|
|
12070
12101
|
const mutatedBytes = bytes;
|
12071
12102
|
try {
|
12072
12103
|
if (Object.keys(abiInterface.configurables).length === 0) {
|
12073
|
-
throw new
|
12074
|
-
|
12104
|
+
throw new import_errors31.FuelError(
|
12105
|
+
import_errors31.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
|
12075
12106
|
"Predicate has no configurable constants to be set"
|
12076
12107
|
);
|
12077
12108
|
}
|
12078
12109
|
Object.entries(configurableConstants).forEach(([key, value]) => {
|
12079
12110
|
if (!abiInterface?.configurables[key]) {
|
12080
|
-
throw new
|
12081
|
-
|
12111
|
+
throw new import_errors31.FuelError(
|
12112
|
+
import_errors31.ErrorCode.CONFIGURABLE_NOT_FOUND,
|
12082
12113
|
`No configurable constant named '${key}' found in the Predicate`
|
12083
12114
|
);
|
12084
12115
|
}
|
@@ -12087,8 +12118,8 @@ var Predicate = class _Predicate extends Account {
|
|
12087
12118
|
mutatedBytes.set(encoded, offset);
|
12088
12119
|
});
|
12089
12120
|
} catch (err) {
|
12090
|
-
throw new
|
12091
|
-
|
12121
|
+
throw new import_errors31.FuelError(
|
12122
|
+
import_errors31.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
|
12092
12123
|
`Error setting configurable constants: ${err.message}.`
|
12093
12124
|
);
|
12094
12125
|
}
|
@@ -12144,7 +12175,7 @@ var Predicate = class _Predicate extends Account {
|
|
12144
12175
|
var import_errors34 = require("@fuel-ts/errors");
|
12145
12176
|
|
12146
12177
|
// src/connectors/fuel-connector.ts
|
12147
|
-
var
|
12178
|
+
var import_errors32 = require("@fuel-ts/errors");
|
12148
12179
|
var import_events2 = require("events");
|
12149
12180
|
|
12150
12181
|
// src/connectors/types/connector-types.ts
|
@@ -12225,7 +12256,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12225
12256
|
* @returns Always true.
|
12226
12257
|
*/
|
12227
12258
|
async ping() {
|
12228
|
-
throw new
|
12259
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12229
12260
|
}
|
12230
12261
|
/**
|
12231
12262
|
* Should return the current version of the connector
|
@@ -12234,7 +12265,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12234
12265
|
* @returns boolean - connection status.
|
12235
12266
|
*/
|
12236
12267
|
async version() {
|
12237
|
-
throw new
|
12268
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12238
12269
|
}
|
12239
12270
|
/**
|
12240
12271
|
* Should return true if the connector is connected
|
@@ -12243,7 +12274,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12243
12274
|
* @returns The connection status.
|
12244
12275
|
*/
|
12245
12276
|
async isConnected() {
|
12246
|
-
throw new
|
12277
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12247
12278
|
}
|
12248
12279
|
/**
|
12249
12280
|
* Should return all the accounts authorized for the
|
@@ -12252,7 +12283,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12252
12283
|
* @returns The accounts addresses strings
|
12253
12284
|
*/
|
12254
12285
|
async accounts() {
|
12255
|
-
throw new
|
12286
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12256
12287
|
}
|
12257
12288
|
/**
|
12258
12289
|
* Should start the connection process and return
|
@@ -12264,7 +12295,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12264
12295
|
* @returns boolean - connection status.
|
12265
12296
|
*/
|
12266
12297
|
async connect() {
|
12267
|
-
throw new
|
12298
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12268
12299
|
}
|
12269
12300
|
/**
|
12270
12301
|
* Should disconnect the current connection and
|
@@ -12274,7 +12305,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12274
12305
|
* @returns The connection status.
|
12275
12306
|
*/
|
12276
12307
|
async disconnect() {
|
12277
|
-
throw new
|
12308
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12278
12309
|
}
|
12279
12310
|
/**
|
12280
12311
|
* Should start the sign message process and return
|
@@ -12286,7 +12317,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12286
12317
|
* @returns Message signature
|
12287
12318
|
*/
|
12288
12319
|
async signMessage(_address, _message) {
|
12289
|
-
throw new
|
12320
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12290
12321
|
}
|
12291
12322
|
/**
|
12292
12323
|
* Should start the sign transaction process and return
|
@@ -12298,7 +12329,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12298
12329
|
* @returns Transaction signature
|
12299
12330
|
*/
|
12300
12331
|
async signTransaction(_address, _transaction) {
|
12301
|
-
throw new
|
12332
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12302
12333
|
}
|
12303
12334
|
/**
|
12304
12335
|
* Should start the send transaction process and return
|
@@ -12314,7 +12345,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12314
12345
|
* @returns The transaction id or transaction response
|
12315
12346
|
*/
|
12316
12347
|
async sendTransaction(_address, _transaction, _params) {
|
12317
|
-
throw new
|
12348
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12318
12349
|
}
|
12319
12350
|
/**
|
12320
12351
|
* Should return the current account selected inside the connector, if the account
|
@@ -12325,7 +12356,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12325
12356
|
* @returns The current account selected otherwise null.
|
12326
12357
|
*/
|
12327
12358
|
async currentAccount() {
|
12328
|
-
throw new
|
12359
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12329
12360
|
}
|
12330
12361
|
/**
|
12331
12362
|
* Should add the assets metadata to the connector and return true if the asset
|
@@ -12339,7 +12370,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12339
12370
|
* @returns True if the asset was added successfully
|
12340
12371
|
*/
|
12341
12372
|
async addAssets(_assets) {
|
12342
|
-
throw new
|
12373
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12343
12374
|
}
|
12344
12375
|
/**
|
12345
12376
|
* Should add the asset metadata to the connector and return true if the asset
|
@@ -12353,7 +12384,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12353
12384
|
* @returns True if the asset was added successfully
|
12354
12385
|
*/
|
12355
12386
|
async addAsset(_asset) {
|
12356
|
-
throw new
|
12387
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12357
12388
|
}
|
12358
12389
|
/**
|
12359
12390
|
* Should return all the assets added to the connector. If a connection is already established.
|
@@ -12361,7 +12392,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12361
12392
|
* @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
|
12362
12393
|
*/
|
12363
12394
|
async assets() {
|
12364
|
-
throw new
|
12395
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12365
12396
|
}
|
12366
12397
|
/**
|
12367
12398
|
* Should start the add network process and return true if the network was added successfully.
|
@@ -12372,7 +12403,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12372
12403
|
* @returns Return true if the network was added successfully
|
12373
12404
|
*/
|
12374
12405
|
async addNetwork(_networkUrl) {
|
12375
|
-
throw new
|
12406
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12376
12407
|
}
|
12377
12408
|
/**
|
12378
12409
|
* Should start the select network process and return true if the network has change successfully.
|
@@ -12383,7 +12414,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12383
12414
|
* @returns Return true if the network was added successfully
|
12384
12415
|
*/
|
12385
12416
|
async selectNetwork(_network) {
|
12386
|
-
throw new
|
12417
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12387
12418
|
}
|
12388
12419
|
/**
|
12389
12420
|
* Should return all the networks available from the connector. If the connection is already established.
|
@@ -12391,7 +12422,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12391
12422
|
* @returns Return all the networks added to the connector.
|
12392
12423
|
*/
|
12393
12424
|
async networks() {
|
12394
|
-
throw new
|
12425
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12395
12426
|
}
|
12396
12427
|
/**
|
12397
12428
|
* Should return the current network selected inside the connector. Even if the connection is not established.
|
@@ -12399,7 +12430,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12399
12430
|
* @returns Return the current network selected inside the connector.
|
12400
12431
|
*/
|
12401
12432
|
async currentNetwork() {
|
12402
|
-
throw new
|
12433
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12403
12434
|
}
|
12404
12435
|
/**
|
12405
12436
|
* Should add the ABI to the connector and return true if the ABI was added successfully.
|
@@ -12409,7 +12440,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12409
12440
|
* @returns Return true if the ABI was added successfully.
|
12410
12441
|
*/
|
12411
12442
|
async addABI(_contractId, _abi) {
|
12412
|
-
throw new
|
12443
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12413
12444
|
}
|
12414
12445
|
/**
|
12415
12446
|
* Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
|
@@ -12418,7 +12449,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12418
12449
|
* @returns The ABI if it exists, otherwise return null.
|
12419
12450
|
*/
|
12420
12451
|
async getABI(_id) {
|
12421
|
-
throw new
|
12452
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12422
12453
|
}
|
12423
12454
|
/**
|
12424
12455
|
* Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
|
@@ -12427,7 +12458,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12427
12458
|
* @returns Returns true if the abi exists or false if not.
|
12428
12459
|
*/
|
12429
12460
|
async hasABI(_id) {
|
12430
|
-
throw new
|
12461
|
+
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12431
12462
|
}
|
12432
12463
|
/**
|
12433
12464
|
* Event listener for the connector.
|
@@ -12472,6 +12503,27 @@ function dispatchFuelConnectorEvent(connector) {
|
|
12472
12503
|
}
|
12473
12504
|
__name(dispatchFuelConnectorEvent, "dispatchFuelConnectorEvent");
|
12474
12505
|
|
12506
|
+
// src/connectors/utils/promises.ts
|
12507
|
+
var import_errors33 = require("@fuel-ts/errors");
|
12508
|
+
function deferPromise() {
|
12509
|
+
const defer = {};
|
12510
|
+
defer.promise = new Promise((resolve, reject) => {
|
12511
|
+
defer.reject = reject;
|
12512
|
+
defer.resolve = resolve;
|
12513
|
+
});
|
12514
|
+
return defer;
|
12515
|
+
}
|
12516
|
+
__name(deferPromise, "deferPromise");
|
12517
|
+
async function withTimeout(promise, timeout = 1050) {
|
12518
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
12519
|
+
setTimeout(() => {
|
12520
|
+
reject(new import_errors33.FuelError(import_errors33.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
12521
|
+
}, timeout);
|
12522
|
+
});
|
12523
|
+
return Promise.race([timeoutPromise, promise]);
|
12524
|
+
}
|
12525
|
+
__name(withTimeout, "withTimeout");
|
12526
|
+
|
12475
12527
|
// src/connectors/fuel.ts
|
12476
12528
|
var HAS_CONNECTOR_TIMEOUT = 2e3;
|
12477
12529
|
var PING_CACHE_TIME = 5e3;
|
@@ -12908,6 +12960,7 @@ var Fuel = class _Fuel extends FuelConnector {
|
|
12908
12960
|
extractTxError,
|
12909
12961
|
fuelAssetsBaseUrl,
|
12910
12962
|
gasUsedByInputs,
|
12963
|
+
getAllDecodedLogs,
|
12911
12964
|
getAssetAmountInRequestInputs,
|
12912
12965
|
getAssetById,
|
12913
12966
|
getAssetEth,
|