@fuel-ts/account 0.100.0 → 0.100.1
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 +50 -25
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +220 -194
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -150
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts +2 -0
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -1
- package/dist/test-utils.global.js +42 -7
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +167 -130
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +132 -95
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
@@ -942,7 +942,7 @@ var getAssetsByOwner = async (opts) => {
|
|
942
942
|
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
943
943
|
var import_address5 = require("@fuel-ts/address");
|
944
944
|
var import_crypto2 = require("@fuel-ts/crypto");
|
945
|
-
var
|
945
|
+
var import_errors22 = require("@fuel-ts/errors");
|
946
946
|
var import_math21 = require("@fuel-ts/math");
|
947
947
|
var import_transactions26 = require("@fuel-ts/transactions");
|
948
948
|
var import_utils34 = require("@fuel-ts/utils");
|
@@ -984,7 +984,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
984
984
|
|
985
985
|
// src/providers/provider.ts
|
986
986
|
var import_address3 = require("@fuel-ts/address");
|
987
|
-
var
|
987
|
+
var import_errors20 = require("@fuel-ts/errors");
|
988
988
|
var import_math18 = require("@fuel-ts/math");
|
989
989
|
var import_transactions23 = require("@fuel-ts/transactions");
|
990
990
|
var import_utils29 = require("@fuel-ts/utils");
|
@@ -993,6 +993,25 @@ var import_graphql_request = require("graphql-request");
|
|
993
993
|
var import_graphql_tag2 = __toESM(require("graphql-tag"));
|
994
994
|
var import_ramda8 = require("ramda");
|
995
995
|
|
996
|
+
// src/connectors/utils/promises.ts
|
997
|
+
var import_errors = require("@fuel-ts/errors");
|
998
|
+
function deferPromise() {
|
999
|
+
const defer = {};
|
1000
|
+
defer.promise = new Promise((resolve, reject) => {
|
1001
|
+
defer.reject = reject;
|
1002
|
+
defer.resolve = resolve;
|
1003
|
+
});
|
1004
|
+
return defer;
|
1005
|
+
}
|
1006
|
+
async function withTimeout(promise, timeout = 1050) {
|
1007
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
1008
|
+
setTimeout(() => {
|
1009
|
+
reject(new import_errors.FuelError(import_errors.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
1010
|
+
}, timeout);
|
1011
|
+
});
|
1012
|
+
return Promise.race([timeoutPromise, promise]);
|
1013
|
+
}
|
1014
|
+
|
996
1015
|
// src/providers/__generated__/operations.ts
|
997
1016
|
var import_graphql_tag = __toESM(require("graphql-tag"));
|
998
1017
|
var SubmittedStatusFragmentDoc = import_graphql_tag.default`
|
@@ -2045,35 +2064,35 @@ function getSdk(requester) {
|
|
2045
2064
|
}
|
2046
2065
|
|
2047
2066
|
// src/providers/fuel-graphql-subscriber.ts
|
2048
|
-
var
|
2067
|
+
var import_errors3 = require("@fuel-ts/errors");
|
2049
2068
|
var import_graphql = require("graphql");
|
2050
2069
|
|
2051
2070
|
// src/providers/utils/handle-gql-error-message.ts
|
2052
|
-
var
|
2071
|
+
var import_errors2 = require("@fuel-ts/errors");
|
2053
2072
|
var mapGqlErrorMessage = (error) => {
|
2054
2073
|
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)) {
|
2055
|
-
return new
|
2056
|
-
|
2074
|
+
return new import_errors2.FuelError(
|
2075
|
+
import_errors2.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
2057
2076
|
`Insufficient funds or too many small value coins. Consider combining UTXOs.`,
|
2058
2077
|
{},
|
2059
2078
|
error
|
2060
2079
|
);
|
2061
2080
|
}
|
2062
2081
|
if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
|
2063
|
-
return new
|
2064
|
-
|
2082
|
+
return new import_errors2.FuelError(
|
2083
|
+
import_errors2.ErrorCode.ASSET_NOT_FOUND,
|
2065
2084
|
`Asset not found for given asset id.`,
|
2066
2085
|
{},
|
2067
2086
|
error
|
2068
2087
|
);
|
2069
2088
|
}
|
2070
|
-
return new
|
2089
|
+
return new import_errors2.FuelError(import_errors2.ErrorCode.INVALID_REQUEST, error.message, {}, error);
|
2071
2090
|
};
|
2072
2091
|
var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
|
2073
2092
|
if (!incompatibleNodeVersionMessage) {
|
2074
2093
|
return error;
|
2075
2094
|
}
|
2076
|
-
return new
|
2095
|
+
return new import_errors2.FuelError(
|
2077
2096
|
error.code,
|
2078
2097
|
`${error.message}
|
2079
2098
|
|
@@ -2092,7 +2111,7 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
|
|
2092
2111
|
}
|
2093
2112
|
const errorMessage = mappedErrors.map((err) => err.message).join("\n");
|
2094
2113
|
throw mapGqlErrorWithIncompatibleNodeVersion(
|
2095
|
-
new
|
2114
|
+
new import_errors2.FuelError(import_errors2.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
|
2096
2115
|
incompatibleNodeVersionMessage
|
2097
2116
|
);
|
2098
2117
|
};
|
@@ -2143,8 +2162,8 @@ var _FuelGraphqlSubscriber = class {
|
|
2143
2162
|
try {
|
2144
2163
|
this.events.push(JSON.parse(match.replace(/^data:/, "")));
|
2145
2164
|
} catch (e) {
|
2146
|
-
throw new
|
2147
|
-
|
2165
|
+
throw new import_errors3.FuelError(
|
2166
|
+
import_errors3.ErrorCode.STREAM_PARSING_ERROR,
|
2148
2167
|
`Error while parsing stream data response: ${text}`
|
2149
2168
|
);
|
2150
2169
|
}
|
@@ -2167,13 +2186,13 @@ __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
|
|
2167
2186
|
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
2168
2187
|
|
2169
2188
|
// src/providers/resource-cache.ts
|
2170
|
-
var
|
2189
|
+
var import_errors14 = require("@fuel-ts/errors");
|
2171
2190
|
var import_utils22 = require("@fuel-ts/utils");
|
2172
2191
|
|
2173
2192
|
// src/providers/transaction-request/input.ts
|
2174
2193
|
var import_abi_coder = require("@fuel-ts/abi-coder");
|
2175
2194
|
var import_configs = require("@fuel-ts/address/configs");
|
2176
|
-
var
|
2195
|
+
var import_errors4 = require("@fuel-ts/errors");
|
2177
2196
|
var import_math2 = require("@fuel-ts/math");
|
2178
2197
|
var import_transactions = require("@fuel-ts/transactions");
|
2179
2198
|
var import_utils3 = require("@fuel-ts/utils");
|
@@ -2237,8 +2256,8 @@ var inputify = (value) => {
|
|
2237
2256
|
};
|
2238
2257
|
}
|
2239
2258
|
default: {
|
2240
|
-
throw new
|
2241
|
-
|
2259
|
+
throw new import_errors4.FuelError(
|
2260
|
+
import_errors4.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2242
2261
|
`Invalid transaction input type: ${type}.`
|
2243
2262
|
);
|
2244
2263
|
}
|
@@ -2247,7 +2266,7 @@ var inputify = (value) => {
|
|
2247
2266
|
|
2248
2267
|
// src/providers/transaction-request/output.ts
|
2249
2268
|
var import_configs2 = require("@fuel-ts/address/configs");
|
2250
|
-
var
|
2269
|
+
var import_errors5 = require("@fuel-ts/errors");
|
2251
2270
|
var import_math3 = require("@fuel-ts/math");
|
2252
2271
|
var import_transactions2 = require("@fuel-ts/transactions");
|
2253
2272
|
var import_utils4 = require("@fuel-ts/utils");
|
@@ -2294,8 +2313,8 @@ var outputify = (value) => {
|
|
2294
2313
|
};
|
2295
2314
|
}
|
2296
2315
|
default: {
|
2297
|
-
throw new
|
2298
|
-
|
2316
|
+
throw new import_errors5.FuelError(
|
2317
|
+
import_errors5.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2299
2318
|
`Invalid transaction output type: ${type}.`
|
2300
2319
|
);
|
2301
2320
|
}
|
@@ -2307,7 +2326,7 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
|
|
2307
2326
|
var import_address = require("@fuel-ts/address");
|
2308
2327
|
var import_configs6 = require("@fuel-ts/address/configs");
|
2309
2328
|
var import_crypto = require("@fuel-ts/crypto");
|
2310
|
-
var
|
2329
|
+
var import_errors10 = require("@fuel-ts/errors");
|
2311
2330
|
var import_math8 = require("@fuel-ts/math");
|
2312
2331
|
var import_transactions8 = require("@fuel-ts/transactions");
|
2313
2332
|
var import_utils10 = require("@fuel-ts/utils");
|
@@ -2327,7 +2346,7 @@ var import_configs4 = require("@fuel-ts/transactions/configs");
|
|
2327
2346
|
|
2328
2347
|
// src/providers/utils/serialization.ts
|
2329
2348
|
var import_configs3 = require("@fuel-ts/address/configs");
|
2330
|
-
var
|
2349
|
+
var import_errors6 = require("@fuel-ts/errors");
|
2331
2350
|
var import_math4 = require("@fuel-ts/math");
|
2332
2351
|
var import_transactions3 = require("@fuel-ts/transactions");
|
2333
2352
|
var import_utils5 = require("@fuel-ts/utils");
|
@@ -2662,7 +2681,7 @@ var deserializeReceipt = (receipt) => {
|
|
2662
2681
|
return burnReceipt;
|
2663
2682
|
}
|
2664
2683
|
default:
|
2665
|
-
throw new
|
2684
|
+
throw new import_errors6.FuelError(import_errors6.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
|
2666
2685
|
}
|
2667
2686
|
};
|
2668
2687
|
|
@@ -2687,7 +2706,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
|
|
2687
2706
|
var assembleReceiptByType = (gqlReceipt) => deserializeReceipt(gqlReceipt);
|
2688
2707
|
|
2689
2708
|
// src/providers/utils/block-explorer.ts
|
2690
|
-
var
|
2709
|
+
var import_errors7 = require("@fuel-ts/errors");
|
2691
2710
|
var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
|
2692
2711
|
var getPathFromInput = (key, value) => {
|
2693
2712
|
const pathMap = {
|
@@ -2721,15 +2740,15 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
2721
2740
|
}));
|
2722
2741
|
const hasAnyDefinedValues = definedValues.length > 0;
|
2723
2742
|
if (definedValues.length > 1) {
|
2724
|
-
throw new
|
2725
|
-
|
2743
|
+
throw new import_errors7.FuelError(
|
2744
|
+
import_errors7.ErrorCode.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2726
2745
|
`Only one of the following can be passed in to buildBlockExplorerUrl: ${customInputParams.map((param) => param.key).join(", ")}.`
|
2727
2746
|
);
|
2728
2747
|
}
|
2729
2748
|
if (path && definedValues.length > 0) {
|
2730
2749
|
const inputKeys = customInputParams.map(({ key }) => key).join(", ");
|
2731
|
-
throw new
|
2732
|
-
|
2750
|
+
throw new import_errors7.FuelError(
|
2751
|
+
import_errors7.ErrorCode.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2733
2752
|
`You cannot pass in a path to 'buildBlockExplorerUrl' along with any of the following: ${inputKeys}.`
|
2734
2753
|
);
|
2735
2754
|
}
|
@@ -2918,7 +2937,7 @@ function normalizeJSON(root) {
|
|
2918
2937
|
}
|
2919
2938
|
|
2920
2939
|
// src/providers/utils/extract-tx-error.ts
|
2921
|
-
var
|
2940
|
+
var import_errors8 = require("@fuel-ts/errors");
|
2922
2941
|
var import_math6 = require("@fuel-ts/math");
|
2923
2942
|
var import_transactions6 = require("@fuel-ts/transactions");
|
2924
2943
|
var import_configs5 = require("@fuel-ts/transactions/configs");
|
@@ -2931,7 +2950,7 @@ You can read more about this error at:
|
|
2931
2950
|
|
2932
2951
|
${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
|
2933
2952
|
}
|
2934
|
-
return new
|
2953
|
+
return new import_errors8.FuelError(import_errors8.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
2935
2954
|
...metadata,
|
2936
2955
|
reason: statusReason
|
2937
2956
|
});
|
@@ -2972,8 +2991,8 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2972
2991
|
errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
|
2973
2992
|
break;
|
2974
2993
|
default:
|
2975
|
-
throw new
|
2976
|
-
|
2994
|
+
throw new import_errors8.FuelError(
|
2995
|
+
import_errors8.ErrorCode.UNKNOWN,
|
2977
2996
|
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
2978
2997
|
{
|
2979
2998
|
...metadata,
|
@@ -2982,7 +3001,7 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2982
3001
|
);
|
2983
3002
|
}
|
2984
3003
|
}
|
2985
|
-
return new
|
3004
|
+
return new import_errors8.FuelError(import_errors8.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
2986
3005
|
...metadata,
|
2987
3006
|
reason
|
2988
3007
|
});
|
@@ -3027,7 +3046,7 @@ var NoWitnessByOwnerError = class extends Error {
|
|
3027
3046
|
};
|
3028
3047
|
|
3029
3048
|
// src/providers/transaction-request/helpers.ts
|
3030
|
-
var
|
3049
|
+
var import_errors9 = require("@fuel-ts/errors");
|
3031
3050
|
var import_math7 = require("@fuel-ts/math");
|
3032
3051
|
var import_transactions7 = require("@fuel-ts/transactions");
|
3033
3052
|
var import_utils8 = require("@fuel-ts/utils");
|
@@ -3100,7 +3119,7 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
|
|
3100
3119
|
"Add the relevant change outputs to the transaction to avoid burning assets.",
|
3101
3120
|
"Or enable asset burn, upon sending the transaction."
|
3102
3121
|
].join("\n");
|
3103
|
-
throw new
|
3122
|
+
throw new import_errors9.FuelError(import_errors9.ErrorCode.ASSET_BURN_DETECTED, message);
|
3104
3123
|
};
|
3105
3124
|
|
3106
3125
|
// src/providers/transaction-request/witness.ts
|
@@ -3498,7 +3517,7 @@ var BaseTransactionRequest = class {
|
|
3498
3517
|
* @hidden
|
3499
3518
|
*/
|
3500
3519
|
metadataGas(_gasCosts) {
|
3501
|
-
throw new
|
3520
|
+
throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
|
3502
3521
|
}
|
3503
3522
|
/**
|
3504
3523
|
* @hidden
|
@@ -4121,7 +4140,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
4121
4140
|
};
|
4122
4141
|
|
4123
4142
|
// src/providers/transaction-request/upgrade-transaction-request.ts
|
4124
|
-
var
|
4143
|
+
var import_errors12 = require("@fuel-ts/errors");
|
4125
4144
|
var import_hasher2 = require("@fuel-ts/hasher");
|
4126
4145
|
var import_transactions12 = require("@fuel-ts/transactions");
|
4127
4146
|
var import_utils18 = require("@fuel-ts/utils");
|
@@ -4225,7 +4244,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4225
4244
|
}
|
4226
4245
|
};
|
4227
4246
|
} else {
|
4228
|
-
throw new
|
4247
|
+
throw new import_errors12.FuelError(import_errors12.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4229
4248
|
}
|
4230
4249
|
return {
|
4231
4250
|
type: import_transactions12.TransactionType.Upgrade,
|
@@ -4267,7 +4286,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4267
4286
|
txBytesSize
|
4268
4287
|
});
|
4269
4288
|
}
|
4270
|
-
throw new
|
4289
|
+
throw new import_errors12.FuelError(import_errors12.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4271
4290
|
}
|
4272
4291
|
};
|
4273
4292
|
|
@@ -4382,7 +4401,7 @@ var AbstractScriptRequest = class {
|
|
4382
4401
|
};
|
4383
4402
|
|
4384
4403
|
// src/providers/transaction-request/utils.ts
|
4385
|
-
var
|
4404
|
+
var import_errors13 = require("@fuel-ts/errors");
|
4386
4405
|
var import_transactions14 = require("@fuel-ts/transactions");
|
4387
4406
|
var transactionRequestify = (obj) => {
|
4388
4407
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
|
@@ -4406,8 +4425,8 @@ var transactionRequestify = (obj) => {
|
|
4406
4425
|
return UploadTransactionRequest.from(obj);
|
4407
4426
|
}
|
4408
4427
|
default: {
|
4409
|
-
throw new
|
4410
|
-
|
4428
|
+
throw new import_errors13.FuelError(
|
4429
|
+
import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
4411
4430
|
`Unsupported transaction type: ${type}.`
|
4412
4431
|
);
|
4413
4432
|
}
|
@@ -4426,8 +4445,8 @@ var ResourceCache = class {
|
|
4426
4445
|
constructor(ttl) {
|
4427
4446
|
this.ttl = ttl;
|
4428
4447
|
if (typeof ttl !== "number" || this.ttl <= 0) {
|
4429
|
-
throw new
|
4430
|
-
|
4448
|
+
throw new import_errors14.FuelError(
|
4449
|
+
import_errors14.ErrorCode.INVALID_TTL,
|
4431
4450
|
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
4432
4451
|
);
|
4433
4452
|
}
|
@@ -4511,7 +4530,7 @@ var ResourceCache = class {
|
|
4511
4530
|
};
|
4512
4531
|
|
4513
4532
|
// src/providers/transaction-response/transaction-response.ts
|
4514
|
-
var
|
4533
|
+
var import_errors18 = require("@fuel-ts/errors");
|
4515
4534
|
var import_math17 = require("@fuel-ts/math");
|
4516
4535
|
var import_transactions22 = require("@fuel-ts/transactions");
|
4517
4536
|
var import_utils26 = require("@fuel-ts/utils");
|
@@ -4589,12 +4608,12 @@ var calculateTXFeeForSummary = (params) => {
|
|
4589
4608
|
|
4590
4609
|
// src/providers/transaction-summary/operations.ts
|
4591
4610
|
var import_configs11 = require("@fuel-ts/address/configs");
|
4592
|
-
var
|
4611
|
+
var import_errors16 = require("@fuel-ts/errors");
|
4593
4612
|
var import_math14 = require("@fuel-ts/math");
|
4594
4613
|
var import_transactions18 = require("@fuel-ts/transactions");
|
4595
4614
|
|
4596
4615
|
// src/providers/transaction-summary/input.ts
|
4597
|
-
var
|
4616
|
+
var import_errors15 = require("@fuel-ts/errors");
|
4598
4617
|
var import_math13 = require("@fuel-ts/math");
|
4599
4618
|
var import_transactions16 = require("@fuel-ts/transactions");
|
4600
4619
|
function getInputsByTypes(inputs, types) {
|
@@ -4663,8 +4682,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
4663
4682
|
return void 0;
|
4664
4683
|
}
|
4665
4684
|
if (contractInput.type !== import_transactions16.InputType.Contract) {
|
4666
|
-
throw new
|
4667
|
-
|
4685
|
+
throw new import_errors15.FuelError(
|
4686
|
+
import_errors15.ErrorCode.INVALID_TRANSACTION_INPUT,
|
4668
4687
|
`Contract input should be of type 'contract'.`
|
4669
4688
|
);
|
4670
4689
|
}
|
@@ -4757,8 +4776,8 @@ function getTransactionTypeName(transactionType) {
|
|
4757
4776
|
case import_transactions18.TransactionType.Upload:
|
4758
4777
|
return "Upload" /* Upload */;
|
4759
4778
|
default:
|
4760
|
-
throw new
|
4761
|
-
|
4779
|
+
throw new import_errors16.FuelError(
|
4780
|
+
import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
4762
4781
|
`Unsupported transaction type: ${transactionType}.`
|
4763
4782
|
);
|
4764
4783
|
}
|
@@ -5144,7 +5163,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
5144
5163
|
};
|
5145
5164
|
|
5146
5165
|
// src/providers/transaction-summary/status.ts
|
5147
|
-
var
|
5166
|
+
var import_errors17 = require("@fuel-ts/errors");
|
5148
5167
|
var import_math15 = require("@fuel-ts/math");
|
5149
5168
|
var getTransactionStatusName = (gqlStatus) => {
|
5150
5169
|
switch (gqlStatus) {
|
@@ -5157,8 +5176,8 @@ var getTransactionStatusName = (gqlStatus) => {
|
|
5157
5176
|
case "SqueezedOutStatus":
|
5158
5177
|
return "squeezedout" /* squeezedout */;
|
5159
5178
|
default:
|
5160
|
-
throw new
|
5161
|
-
|
5179
|
+
throw new import_errors17.FuelError(
|
5180
|
+
import_errors17.ErrorCode.INVALID_TRANSACTION_STATUS,
|
5162
5181
|
`Invalid transaction status: ${gqlStatus}.`
|
5163
5182
|
);
|
5164
5183
|
}
|
@@ -5291,14 +5310,26 @@ function assembleTransactionSummary(params) {
|
|
5291
5310
|
|
5292
5311
|
// src/providers/transaction-response/getDecodedLogs.ts
|
5293
5312
|
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
5313
|
+
var import_configs12 = require("@fuel-ts/address/configs");
|
5294
5314
|
var import_transactions21 = require("@fuel-ts/transactions");
|
5295
5315
|
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
5316
|
+
let mainContract = "";
|
5317
|
+
if (mainAbi.programType === "contract") {
|
5318
|
+
const firstCallReceipt = receipts.find(
|
5319
|
+
(r) => r.type === import_transactions21.ReceiptType.Call && r.id === import_configs12.ZeroBytes32
|
5320
|
+
);
|
5321
|
+
mainContract = firstCallReceipt.to;
|
5322
|
+
}
|
5296
5323
|
return receipts.reduce((logs, receipt) => {
|
5297
5324
|
if (receipt.type === import_transactions21.ReceiptType.LogData || receipt.type === import_transactions21.ReceiptType.Log) {
|
5298
|
-
const
|
5299
|
-
const
|
5300
|
-
|
5301
|
-
|
5325
|
+
const isLogFromMainAbi = receipt.id === import_configs12.ZeroBytes32 || mainContract === receipt.id;
|
5326
|
+
const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
|
5327
|
+
if (isDecodable) {
|
5328
|
+
const interfaceToUse = isLogFromMainAbi ? new import_abi_coder4.Interface(mainAbi) : new import_abi_coder4.Interface(externalAbis[receipt.id]);
|
5329
|
+
const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder4.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
|
5330
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
|
5331
|
+
logs.push(decodedLog);
|
5332
|
+
}
|
5302
5333
|
}
|
5303
5334
|
return logs;
|
5304
5335
|
}, []);
|
@@ -5503,8 +5534,8 @@ var TransactionResponse = class {
|
|
5503
5534
|
this.status = statusChange;
|
5504
5535
|
if (statusChange.type === "SqueezedOutStatus") {
|
5505
5536
|
this.unsetResourceCache();
|
5506
|
-
throw new
|
5507
|
-
|
5537
|
+
throw new import_errors18.FuelError(
|
5538
|
+
import_errors18.ErrorCode.TRANSACTION_SQUEEZED_OUT,
|
5508
5539
|
`Transaction Squeezed Out with reason: ${statusChange.reason}`
|
5509
5540
|
);
|
5510
5541
|
}
|
@@ -5628,31 +5659,31 @@ var adjustResourcesToExclude = (params) => {
|
|
5628
5659
|
};
|
5629
5660
|
|
5630
5661
|
// src/providers/utils/validate-pagination-args.ts
|
5631
|
-
var
|
5662
|
+
var import_errors19 = require("@fuel-ts/errors");
|
5632
5663
|
var validatePaginationArgs = (params) => {
|
5633
5664
|
const { paginationLimit, inputArgs = {} } = params;
|
5634
5665
|
const { first, last, after, before } = inputArgs;
|
5635
5666
|
if (after && before) {
|
5636
|
-
throw new
|
5637
|
-
|
5667
|
+
throw new import_errors19.FuelError(
|
5668
|
+
import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5638
5669
|
'Pagination arguments "after" and "before" cannot be used together'
|
5639
5670
|
);
|
5640
5671
|
}
|
5641
5672
|
if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
|
5642
|
-
throw new
|
5643
|
-
|
5673
|
+
throw new import_errors19.FuelError(
|
5674
|
+
import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5644
5675
|
`Pagination limit for this query cannot exceed ${paginationLimit} items`
|
5645
5676
|
);
|
5646
5677
|
}
|
5647
5678
|
if (first && before) {
|
5648
|
-
throw new
|
5649
|
-
|
5679
|
+
throw new import_errors19.FuelError(
|
5680
|
+
import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5650
5681
|
'The use of pagination argument "first" with "before" is not supported'
|
5651
5682
|
);
|
5652
5683
|
}
|
5653
5684
|
if (last && after) {
|
5654
|
-
throw new
|
5655
|
-
|
5685
|
+
throw new import_errors19.FuelError(
|
5686
|
+
import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5656
5687
|
'The use of pagination argument "last" with "after" is not supported'
|
5657
5688
|
);
|
5658
5689
|
}
|
@@ -5736,6 +5767,7 @@ var _Provider = class {
|
|
5736
5767
|
}
|
5737
5768
|
/** @hidden */
|
5738
5769
|
static clearChainAndNodeCaches() {
|
5770
|
+
_Provider.inflightFetchChainAndNodeInfoRequests = {};
|
5739
5771
|
_Provider.nodeInfoCache = {};
|
5740
5772
|
_Provider.chainInfoCache = {};
|
5741
5773
|
}
|
@@ -5764,7 +5796,7 @@ var _Provider = class {
|
|
5764
5796
|
try {
|
5765
5797
|
parsedUrl = new URL(url);
|
5766
5798
|
} catch (error) {
|
5767
|
-
throw new
|
5799
|
+
throw new import_errors20.FuelError(import_errors20.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
|
5768
5800
|
}
|
5769
5801
|
const username = parsedUrl.username;
|
5770
5802
|
const password = parsedUrl.password;
|
@@ -5853,13 +5885,24 @@ var _Provider = class {
|
|
5853
5885
|
throw new Error(`Jumps to the catch block and re-fetch`);
|
5854
5886
|
}
|
5855
5887
|
} catch (_err) {
|
5888
|
+
const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
5889
|
+
if (inflightRequest) {
|
5890
|
+
const now2 = await inflightRequest;
|
5891
|
+
this.consensusParametersTimestamp = now2;
|
5892
|
+
return this.fetchChainAndNodeInfo();
|
5893
|
+
}
|
5894
|
+
const { promise, resolve } = deferPromise();
|
5895
|
+
_Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
|
5856
5896
|
const data = await this.operations.getChainAndNodeInfo();
|
5857
5897
|
nodeInfo = deserializeNodeInfo(data.nodeInfo);
|
5858
|
-
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
5859
5898
|
chain = deserializeChain(data.chain);
|
5899
|
+
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
5860
5900
|
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
5861
5901
|
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
5862
|
-
|
5902
|
+
const now = Date.now();
|
5903
|
+
this.consensusParametersTimestamp = now;
|
5904
|
+
resolve(now);
|
5905
|
+
delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
5863
5906
|
}
|
5864
5907
|
return {
|
5865
5908
|
chain,
|
@@ -6037,14 +6080,14 @@ var _Provider = class {
|
|
6037
6080
|
}
|
6038
6081
|
} = await this.getChain();
|
6039
6082
|
if ((0, import_math18.bn)(tx.inputs.length).gt(maxInputs)) {
|
6040
|
-
throw new
|
6041
|
-
|
6083
|
+
throw new import_errors20.FuelError(
|
6084
|
+
import_errors20.ErrorCode.MAX_INPUTS_EXCEEDED,
|
6042
6085
|
`The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`
|
6043
6086
|
);
|
6044
6087
|
}
|
6045
6088
|
if ((0, import_math18.bn)(tx.outputs.length).gt(maxOutputs)) {
|
6046
|
-
throw new
|
6047
|
-
|
6089
|
+
throw new import_errors20.FuelError(
|
6090
|
+
import_errors20.ErrorCode.MAX_OUTPUTS_EXCEEDED,
|
6048
6091
|
`The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`
|
6049
6092
|
);
|
6050
6093
|
}
|
@@ -6743,7 +6786,7 @@ var _Provider = class {
|
|
6743
6786
|
0
|
6744
6787
|
)?.[0];
|
6745
6788
|
} catch (error) {
|
6746
|
-
if (error instanceof
|
6789
|
+
if (error instanceof import_errors20.FuelError && error.code === import_errors20.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
|
6747
6790
|
console.warn("Unsupported transaction type encountered");
|
6748
6791
|
return null;
|
6749
6792
|
}
|
@@ -6769,7 +6812,7 @@ var _Provider = class {
|
|
6769
6812
|
try {
|
6770
6813
|
return coder.decode((0, import_utils29.arrayify)(rawPayload), 0)[0];
|
6771
6814
|
} catch (error) {
|
6772
|
-
if (error instanceof
|
6815
|
+
if (error instanceof import_errors20.FuelError && error.code === import_errors20.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
|
6773
6816
|
console.warn("Unsupported transaction type encountered");
|
6774
6817
|
return null;
|
6775
6818
|
}
|
@@ -6947,8 +6990,8 @@ var _Provider = class {
|
|
6947
6990
|
nonce
|
6948
6991
|
};
|
6949
6992
|
if (commitBlockId && commitBlockHeight) {
|
6950
|
-
throw new
|
6951
|
-
|
6993
|
+
throw new import_errors20.FuelError(
|
6994
|
+
import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
|
6952
6995
|
"commitBlockId and commitBlockHeight cannot be used together"
|
6953
6996
|
);
|
6954
6997
|
}
|
@@ -7203,6 +7246,8 @@ cacheInputs_fn = function(inputs, transactionId) {
|
|
7203
7246
|
this.cache.set(transactionId, inputs);
|
7204
7247
|
};
|
7205
7248
|
/** @hidden */
|
7249
|
+
__publicField(Provider, "inflightFetchChainAndNodeInfoRequests", {});
|
7250
|
+
/** @hidden */
|
7206
7251
|
__publicField(Provider, "chainInfoCache", {});
|
7207
7252
|
/** @hidden */
|
7208
7253
|
__publicField(Provider, "nodeInfoCache", {});
|
@@ -7210,7 +7255,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
7210
7255
|
__publicField(Provider, "incompatibleNodeVersionMessage", "");
|
7211
7256
|
|
7212
7257
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
7213
|
-
var
|
7258
|
+
var import_errors21 = require("@fuel-ts/errors");
|
7214
7259
|
var import_math19 = require("@fuel-ts/math");
|
7215
7260
|
var import_transactions24 = require("@fuel-ts/transactions");
|
7216
7261
|
var import_utils31 = require("@fuel-ts/utils");
|
@@ -7220,8 +7265,8 @@ async function getTransactionSummary(params) {
|
|
7220
7265
|
transactionId: id
|
7221
7266
|
});
|
7222
7267
|
if (!gqlTransaction) {
|
7223
|
-
throw new
|
7224
|
-
|
7268
|
+
throw new import_errors21.FuelError(
|
7269
|
+
import_errors21.ErrorCode.TRANSACTION_NOT_FOUND,
|
7225
7270
|
`Transaction not found for given id: ${id}.`
|
7226
7271
|
);
|
7227
7272
|
}
|
@@ -7472,7 +7517,7 @@ var Account = class extends AbstractAccount {
|
|
7472
7517
|
*/
|
7473
7518
|
get provider() {
|
7474
7519
|
if (!this._provider) {
|
7475
|
-
throw new
|
7520
|
+
throw new import_errors22.FuelError(import_errors22.ErrorCode.MISSING_PROVIDER, "Provider not set");
|
7476
7521
|
}
|
7477
7522
|
return this._provider;
|
7478
7523
|
}
|
@@ -7631,8 +7676,8 @@ var Account = class extends AbstractAccount {
|
|
7631
7676
|
fundingAttempts += 1;
|
7632
7677
|
}
|
7633
7678
|
if (needsToBeFunded) {
|
7634
|
-
throw new
|
7635
|
-
|
7679
|
+
throw new import_errors22.FuelError(
|
7680
|
+
import_errors22.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
7636
7681
|
`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
|
7637
7682
|
);
|
7638
7683
|
}
|
@@ -7751,8 +7796,8 @@ var Account = class extends AbstractAccount {
|
|
7751
7796
|
const contractAddress = new import_address5.Address(transferParam.contractId);
|
7752
7797
|
const assetId = transferParam.assetId ? (0, import_utils34.hexlify)(transferParam.assetId) : defaultAssetId;
|
7753
7798
|
if (amount.lte(0)) {
|
7754
|
-
throw new
|
7755
|
-
|
7799
|
+
throw new import_errors22.FuelError(
|
7800
|
+
import_errors22.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
7756
7801
|
"Transfer amount must be a positive number."
|
7757
7802
|
);
|
7758
7803
|
}
|
@@ -7868,7 +7913,7 @@ var Account = class extends AbstractAccount {
|
|
7868
7913
|
*/
|
7869
7914
|
async signMessage(message) {
|
7870
7915
|
if (!this._connector) {
|
7871
|
-
throw new
|
7916
|
+
throw new import_errors22.FuelError(import_errors22.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
7872
7917
|
}
|
7873
7918
|
return this._connector.signMessage(this.address.toString(), message);
|
7874
7919
|
}
|
@@ -7880,8 +7925,8 @@ var Account = class extends AbstractAccount {
|
|
7880
7925
|
*/
|
7881
7926
|
async signTransaction(transactionRequestLike) {
|
7882
7927
|
if (!this._connector) {
|
7883
|
-
throw new
|
7884
|
-
|
7928
|
+
throw new import_errors22.FuelError(
|
7929
|
+
import_errors22.ErrorCode.MISSING_CONNECTOR,
|
7885
7930
|
"A connector is required to sign transactions."
|
7886
7931
|
);
|
7887
7932
|
}
|
@@ -7977,8 +8022,8 @@ var Account = class extends AbstractAccount {
|
|
7977
8022
|
/** @hidden * */
|
7978
8023
|
validateTransferAmount(amount) {
|
7979
8024
|
if ((0, import_math21.bn)(amount).lte(0)) {
|
7980
|
-
throw new
|
7981
|
-
|
8025
|
+
throw new import_errors22.FuelError(
|
8026
|
+
import_errors22.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
7982
8027
|
"Transfer amount must be a positive number."
|
7983
8028
|
);
|
7984
8029
|
}
|
@@ -8007,16 +8052,16 @@ var Account = class extends AbstractAccount {
|
|
8007
8052
|
if (!(0, import_utils34.isDefined)(setGasLimit)) {
|
8008
8053
|
request2.gasLimit = gasUsed;
|
8009
8054
|
} else if (gasUsed.gt(setGasLimit)) {
|
8010
|
-
throw new
|
8011
|
-
|
8055
|
+
throw new import_errors22.FuelError(
|
8056
|
+
import_errors22.ErrorCode.GAS_LIMIT_TOO_LOW,
|
8012
8057
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
8013
8058
|
);
|
8014
8059
|
}
|
8015
8060
|
if (!(0, import_utils34.isDefined)(setMaxFee)) {
|
8016
8061
|
request2.maxFee = maxFee;
|
8017
8062
|
} else if (maxFee.gt(setMaxFee)) {
|
8018
|
-
throw new
|
8019
|
-
|
8063
|
+
throw new import_errors22.FuelError(
|
8064
|
+
import_errors22.ErrorCode.MAX_FEE_TOO_LOW,
|
8020
8065
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
8021
8066
|
);
|
8022
8067
|
}
|
@@ -8140,7 +8185,7 @@ var Signer = class {
|
|
8140
8185
|
// src/wallet/keystore-wallet.ts
|
8141
8186
|
var import_address7 = require("@fuel-ts/address");
|
8142
8187
|
var import_crypto4 = require("@fuel-ts/crypto");
|
8143
|
-
var
|
8188
|
+
var import_errors23 = require("@fuel-ts/errors");
|
8144
8189
|
var import_utils36 = require("@fuel-ts/utils");
|
8145
8190
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
8146
8191
|
var DEFAULT_KDF_PARAMS_R = 8;
|
@@ -8217,8 +8262,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
8217
8262
|
const macHashUint8Array = (0, import_crypto4.keccak256)(data);
|
8218
8263
|
const macHash = (0, import_crypto4.stringFromBuffer)(macHashUint8Array, "hex");
|
8219
8264
|
if (mac !== macHash) {
|
8220
|
-
throw new
|
8221
|
-
|
8265
|
+
throw new import_errors23.FuelError(
|
8266
|
+
import_errors23.ErrorCode.INVALID_PASSWORD,
|
8222
8267
|
"Failed to decrypt the keystore wallet, the provided password is incorrect."
|
8223
8268
|
);
|
8224
8269
|
}
|
@@ -8353,14 +8398,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
8353
8398
|
|
8354
8399
|
// src/hdwallet/hdwallet.ts
|
8355
8400
|
var import_crypto6 = require("@fuel-ts/crypto");
|
8356
|
-
var
|
8401
|
+
var import_errors26 = require("@fuel-ts/errors");
|
8357
8402
|
var import_hasher7 = require("@fuel-ts/hasher");
|
8358
8403
|
var import_math23 = require("@fuel-ts/math");
|
8359
8404
|
var import_utils41 = require("@fuel-ts/utils");
|
8360
8405
|
|
8361
8406
|
// src/mnemonic/mnemonic.ts
|
8362
8407
|
var import_crypto5 = require("@fuel-ts/crypto");
|
8363
|
-
var
|
8408
|
+
var import_errors25 = require("@fuel-ts/errors");
|
8364
8409
|
var import_hasher6 = require("@fuel-ts/hasher");
|
8365
8410
|
var import_utils39 = require("@fuel-ts/utils");
|
8366
8411
|
|
@@ -10423,7 +10468,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
10423
10468
|
})(Language || {});
|
10424
10469
|
|
10425
10470
|
// src/mnemonic/utils.ts
|
10426
|
-
var
|
10471
|
+
var import_errors24 = require("@fuel-ts/errors");
|
10427
10472
|
var import_hasher5 = require("@fuel-ts/hasher");
|
10428
10473
|
var import_utils38 = require("@fuel-ts/utils");
|
10429
10474
|
function getLowerMask(bits) {
|
@@ -10472,8 +10517,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
10472
10517
|
for (let i = 0; i < words.length; i += 1) {
|
10473
10518
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
10474
10519
|
if (index === -1) {
|
10475
|
-
throw new
|
10476
|
-
|
10520
|
+
throw new import_errors24.FuelError(
|
10521
|
+
import_errors24.ErrorCode.INVALID_MNEMONIC,
|
10477
10522
|
`Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
|
10478
10523
|
);
|
10479
10524
|
}
|
@@ -10489,8 +10534,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
10489
10534
|
const checksumMask = getUpperMask(checksumBits);
|
10490
10535
|
const checksum = (0, import_utils38.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
10491
10536
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
10492
|
-
throw new
|
10493
|
-
|
10537
|
+
throw new import_errors24.FuelError(
|
10538
|
+
import_errors24.ErrorCode.INVALID_CHECKSUM,
|
10494
10539
|
"Checksum validation failed for the provided mnemonic."
|
10495
10540
|
);
|
10496
10541
|
}
|
@@ -10504,16 +10549,16 @@ var TestnetPRV = "0x04358394";
|
|
10504
10549
|
var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
|
10505
10550
|
function assertWordList(wordlist) {
|
10506
10551
|
if (wordlist.length !== 2048) {
|
10507
|
-
throw new
|
10508
|
-
|
10552
|
+
throw new import_errors25.FuelError(
|
10553
|
+
import_errors25.ErrorCode.INVALID_WORD_LIST,
|
10509
10554
|
`Expected word list length of 2048, but got ${wordlist.length}.`
|
10510
10555
|
);
|
10511
10556
|
}
|
10512
10557
|
}
|
10513
10558
|
function assertEntropy(entropy) {
|
10514
10559
|
if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
|
10515
|
-
throw new
|
10516
|
-
|
10560
|
+
throw new import_errors25.FuelError(
|
10561
|
+
import_errors25.ErrorCode.INVALID_ENTROPY,
|
10517
10562
|
`Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
|
10518
10563
|
);
|
10519
10564
|
}
|
@@ -10523,7 +10568,7 @@ function assertMnemonic(words) {
|
|
10523
10568
|
const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
|
10524
10569
|
", "
|
10525
10570
|
)}] words, but got ${words.length}.`;
|
10526
|
-
throw new
|
10571
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.INVALID_MNEMONIC, errorMsg);
|
10527
10572
|
}
|
10528
10573
|
}
|
10529
10574
|
var Mnemonic = class {
|
@@ -10641,8 +10686,8 @@ var Mnemonic = class {
|
|
10641
10686
|
static masterKeysFromSeed(seed) {
|
10642
10687
|
const seedArray = (0, import_utils39.arrayify)(seed);
|
10643
10688
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
10644
|
-
throw new
|
10645
|
-
|
10689
|
+
throw new import_errors25.FuelError(
|
10690
|
+
import_errors25.ErrorCode.INVALID_SEED,
|
10646
10691
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
10647
10692
|
);
|
10648
10693
|
}
|
@@ -10719,7 +10764,7 @@ function isValidExtendedKey(extendedKey) {
|
|
10719
10764
|
function parsePath(path, depth = 0) {
|
10720
10765
|
const components = path.split("/");
|
10721
10766
|
if (components.length === 0 || components[0] === "m" && depth !== 0) {
|
10722
|
-
throw new
|
10767
|
+
throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
|
10723
10768
|
}
|
10724
10769
|
if (components[0] === "m") {
|
10725
10770
|
components.shift();
|
@@ -10748,8 +10793,8 @@ var HDWallet = class {
|
|
10748
10793
|
this.privateKey = (0, import_utils41.hexlify)(config.privateKey);
|
10749
10794
|
} else {
|
10750
10795
|
if (!config.publicKey) {
|
10751
|
-
throw new
|
10752
|
-
|
10796
|
+
throw new import_errors26.FuelError(
|
10797
|
+
import_errors26.ErrorCode.HD_WALLET_ERROR,
|
10753
10798
|
"Both public and private Key cannot be missing. At least one should be provided."
|
10754
10799
|
);
|
10755
10800
|
}
|
@@ -10778,8 +10823,8 @@ var HDWallet = class {
|
|
10778
10823
|
const data = new Uint8Array(37);
|
10779
10824
|
if (index & HARDENED_INDEX) {
|
10780
10825
|
if (!privateKey) {
|
10781
|
-
throw new
|
10782
|
-
|
10826
|
+
throw new import_errors26.FuelError(
|
10827
|
+
import_errors26.ErrorCode.HD_WALLET_ERROR,
|
10783
10828
|
"Cannot derive a hardened index without a private Key."
|
10784
10829
|
);
|
10785
10830
|
}
|
@@ -10831,8 +10876,8 @@ var HDWallet = class {
|
|
10831
10876
|
*/
|
10832
10877
|
toExtendedKey(isPublic = false, testnet = false) {
|
10833
10878
|
if (this.depth >= 256) {
|
10834
|
-
throw new
|
10835
|
-
|
10879
|
+
throw new import_errors26.FuelError(
|
10880
|
+
import_errors26.ErrorCode.HD_WALLET_ERROR,
|
10836
10881
|
`Exceeded max depth of 255. Current depth: ${this.depth}.`
|
10837
10882
|
);
|
10838
10883
|
}
|
@@ -10863,10 +10908,10 @@ var HDWallet = class {
|
|
10863
10908
|
const bytes = (0, import_utils41.arrayify)(decoded);
|
10864
10909
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
10865
10910
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
10866
|
-
throw new
|
10911
|
+
throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
10867
10912
|
}
|
10868
10913
|
if (!validChecksum) {
|
10869
|
-
throw new
|
10914
|
+
throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
10870
10915
|
}
|
10871
10916
|
const depth = bytes[4];
|
10872
10917
|
const parentFingerprint = (0, import_utils41.hexlify)(bytes.slice(5, 9));
|
@@ -10874,14 +10919,14 @@ var HDWallet = class {
|
|
10874
10919
|
const chainCode = (0, import_utils41.hexlify)(bytes.slice(13, 45));
|
10875
10920
|
const key = bytes.slice(45, 78);
|
10876
10921
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
10877
|
-
throw new
|
10878
|
-
|
10922
|
+
throw new import_errors26.FuelError(
|
10923
|
+
import_errors26.ErrorCode.HD_WALLET_ERROR,
|
10879
10924
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
10880
10925
|
);
|
10881
10926
|
}
|
10882
10927
|
if (isPublicExtendedKey(bytes)) {
|
10883
10928
|
if (key[0] !== 3) {
|
10884
|
-
throw new
|
10929
|
+
throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
10885
10930
|
}
|
10886
10931
|
return new HDWallet({
|
10887
10932
|
publicKey: key,
|
@@ -10892,7 +10937,7 @@ var HDWallet = class {
|
|
10892
10937
|
});
|
10893
10938
|
}
|
10894
10939
|
if (key[0] !== 0) {
|
10895
|
-
throw new
|
10940
|
+
throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
|
10896
10941
|
}
|
10897
10942
|
return new HDWallet({
|
10898
10943
|
privateKey: key.slice(1),
|
@@ -11060,7 +11105,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
|
11060
11105
|
// src/wallet-manager/wallet-manager.ts
|
11061
11106
|
var import_address10 = require("@fuel-ts/address");
|
11062
11107
|
var import_crypto7 = require("@fuel-ts/crypto");
|
11063
|
-
var
|
11108
|
+
var import_errors29 = require("@fuel-ts/errors");
|
11064
11109
|
var import_events = require("events");
|
11065
11110
|
|
11066
11111
|
// src/wallet-manager/storages/memory-storage.ts
|
@@ -11083,7 +11128,7 @@ var MemoryStorage = class {
|
|
11083
11128
|
|
11084
11129
|
// src/wallet-manager/vaults/mnemonic-vault.ts
|
11085
11130
|
var import_address8 = require("@fuel-ts/address");
|
11086
|
-
var
|
11131
|
+
var import_errors27 = require("@fuel-ts/errors");
|
11087
11132
|
var _secret;
|
11088
11133
|
var MnemonicVault = class {
|
11089
11134
|
constructor(options) {
|
@@ -11139,8 +11184,8 @@ var MnemonicVault = class {
|
|
11139
11184
|
}
|
11140
11185
|
numberOfAccounts += 1;
|
11141
11186
|
} while (numberOfAccounts < this.numberOfAccounts);
|
11142
|
-
throw new
|
11143
|
-
|
11187
|
+
throw new import_errors27.FuelError(
|
11188
|
+
import_errors27.ErrorCode.WALLET_MANAGER_ERROR,
|
11144
11189
|
`Account with address '${address}' not found in derived wallets.`
|
11145
11190
|
);
|
11146
11191
|
}
|
@@ -11154,7 +11199,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
|
|
11154
11199
|
|
11155
11200
|
// src/wallet-manager/vaults/privatekey-vault.ts
|
11156
11201
|
var import_address9 = require("@fuel-ts/address");
|
11157
|
-
var
|
11202
|
+
var import_errors28 = require("@fuel-ts/errors");
|
11158
11203
|
var _privateKeys;
|
11159
11204
|
var PrivateKeyVault = class {
|
11160
11205
|
/**
|
@@ -11195,8 +11240,8 @@ var PrivateKeyVault = class {
|
|
11195
11240
|
(pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
|
11196
11241
|
);
|
11197
11242
|
if (!privateKey) {
|
11198
|
-
throw new
|
11199
|
-
|
11243
|
+
throw new import_errors28.FuelError(
|
11244
|
+
import_errors28.ErrorCode.WALLET_MANAGER_ERROR,
|
11200
11245
|
`No private key found for address '${address}'.`
|
11201
11246
|
);
|
11202
11247
|
}
|
@@ -11220,7 +11265,7 @@ var ERROR_MESSAGES = {
|
|
11220
11265
|
};
|
11221
11266
|
function assert(condition, message) {
|
11222
11267
|
if (!condition) {
|
11223
|
-
throw new
|
11268
|
+
throw new import_errors29.FuelError(import_errors29.ErrorCode.WALLET_MANAGER_ERROR, message);
|
11224
11269
|
}
|
11225
11270
|
}
|
11226
11271
|
var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
|
@@ -11446,25 +11491,25 @@ deserializeVaults_fn = function(vaults) {
|
|
11446
11491
|
__publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
|
11447
11492
|
|
11448
11493
|
// src/wallet-manager/types.ts
|
11449
|
-
var
|
11494
|
+
var import_errors30 = require("@fuel-ts/errors");
|
11450
11495
|
var Vault = class {
|
11451
11496
|
constructor(_options) {
|
11452
|
-
throw new
|
11497
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11453
11498
|
}
|
11454
11499
|
serialize() {
|
11455
|
-
throw new
|
11500
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11456
11501
|
}
|
11457
11502
|
getAccounts() {
|
11458
|
-
throw new
|
11503
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11459
11504
|
}
|
11460
11505
|
addAccount() {
|
11461
|
-
throw new
|
11506
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11462
11507
|
}
|
11463
11508
|
exportAccount(_address) {
|
11464
|
-
throw new
|
11509
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11465
11510
|
}
|
11466
11511
|
getWallet(_address) {
|
11467
|
-
throw new
|
11512
|
+
throw new import_errors30.FuelError(import_errors30.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
|
11468
11513
|
}
|
11469
11514
|
};
|
11470
11515
|
__publicField(Vault, "type");
|
@@ -11474,11 +11519,11 @@ var StorageAbstract = class {
|
|
11474
11519
|
// src/predicate/predicate.ts
|
11475
11520
|
var import_abi_coder8 = require("@fuel-ts/abi-coder");
|
11476
11521
|
var import_address11 = require("@fuel-ts/address");
|
11477
|
-
var
|
11522
|
+
var import_errors32 = require("@fuel-ts/errors");
|
11478
11523
|
var import_utils45 = require("@fuel-ts/utils");
|
11479
11524
|
|
11480
11525
|
// src/utils/deployScriptOrPredicate.ts
|
11481
|
-
var
|
11526
|
+
var import_errors31 = require("@fuel-ts/errors");
|
11482
11527
|
var import_math24 = require("@fuel-ts/math");
|
11483
11528
|
var import_utils43 = require("@fuel-ts/utils");
|
11484
11529
|
|
@@ -11640,7 +11685,7 @@ async function fundBlobTx(deployer, blobTxRequest) {
|
|
11640
11685
|
}).add(1);
|
11641
11686
|
totalCost = totalCost.add(minFee);
|
11642
11687
|
if (totalCost.gt(await deployer.getBalance())) {
|
11643
|
-
throw new
|
11688
|
+
throw new import_errors31.FuelError(import_errors31.ErrorCode.FUNDS_TOO_LOW, "Insufficient balance to deploy predicate.");
|
11644
11689
|
}
|
11645
11690
|
const txCost = await deployer.getTransactionCost(blobTxRequest);
|
11646
11691
|
blobTxRequest.maxFee = txCost.maxFee;
|
@@ -11691,7 +11736,7 @@ async function deployScriptOrPredicate({
|
|
11691
11736
|
throw new Error();
|
11692
11737
|
}
|
11693
11738
|
} catch (err) {
|
11694
|
-
throw new
|
11739
|
+
throw new import_errors31.FuelError(import_errors31.ErrorCode.TRANSACTION_FAILED, "Failed to deploy predicate chunk");
|
11695
11740
|
}
|
11696
11741
|
return loaderInstance;
|
11697
11742
|
};
|
@@ -11826,8 +11871,8 @@ var Predicate = class extends Account {
|
|
11826
11871
|
let predicateBytes = (0, import_utils45.arrayify)(bytes);
|
11827
11872
|
const abiInterface = new import_abi_coder8.Interface(jsonAbi);
|
11828
11873
|
if (abiInterface.functions.main === void 0) {
|
11829
|
-
throw new
|
11830
|
-
|
11874
|
+
throw new import_errors32.FuelError(
|
11875
|
+
import_errors32.ErrorCode.ABI_MAIN_METHOD_MISSING,
|
11831
11876
|
'Cannot use ABI without "main" function.'
|
11832
11877
|
);
|
11833
11878
|
}
|
@@ -11887,15 +11932,15 @@ var Predicate = class extends Account {
|
|
11887
11932
|
const mutatedBytes = bytes;
|
11888
11933
|
try {
|
11889
11934
|
if (Object.keys(abiInterface.configurables).length === 0) {
|
11890
|
-
throw new
|
11891
|
-
|
11935
|
+
throw new import_errors32.FuelError(
|
11936
|
+
import_errors32.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
|
11892
11937
|
"Predicate has no configurable constants to be set"
|
11893
11938
|
);
|
11894
11939
|
}
|
11895
11940
|
Object.entries(configurableConstants).forEach(([key, value]) => {
|
11896
11941
|
if (!abiInterface?.configurables[key]) {
|
11897
|
-
throw new
|
11898
|
-
|
11942
|
+
throw new import_errors32.FuelError(
|
11943
|
+
import_errors32.ErrorCode.CONFIGURABLE_NOT_FOUND,
|
11899
11944
|
`No configurable constant named '${key}' found in the Predicate`
|
11900
11945
|
);
|
11901
11946
|
}
|
@@ -11904,8 +11949,8 @@ var Predicate = class extends Account {
|
|
11904
11949
|
mutatedBytes.set(encoded, offset);
|
11905
11950
|
});
|
11906
11951
|
} catch (err) {
|
11907
|
-
throw new
|
11908
|
-
|
11952
|
+
throw new import_errors32.FuelError(
|
11953
|
+
import_errors32.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
|
11909
11954
|
`Error setting configurable constants: ${err.message}.`
|
11910
11955
|
);
|
11911
11956
|
}
|
@@ -11961,7 +12006,7 @@ var Predicate = class extends Account {
|
|
11961
12006
|
var import_errors34 = require("@fuel-ts/errors");
|
11962
12007
|
|
11963
12008
|
// src/connectors/fuel-connector.ts
|
11964
|
-
var
|
12009
|
+
var import_errors33 = require("@fuel-ts/errors");
|
11965
12010
|
var import_events2 = require("events");
|
11966
12011
|
|
11967
12012
|
// src/connectors/types/connector-types.ts
|
@@ -12036,7 +12081,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12036
12081
|
* @returns Always true.
|
12037
12082
|
*/
|
12038
12083
|
async ping() {
|
12039
|
-
throw new
|
12084
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12040
12085
|
}
|
12041
12086
|
/**
|
12042
12087
|
* Should return the current version of the connector
|
@@ -12045,7 +12090,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12045
12090
|
* @returns boolean - connection status.
|
12046
12091
|
*/
|
12047
12092
|
async version() {
|
12048
|
-
throw new
|
12093
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12049
12094
|
}
|
12050
12095
|
/**
|
12051
12096
|
* Should return true if the connector is connected
|
@@ -12054,7 +12099,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12054
12099
|
* @returns The connection status.
|
12055
12100
|
*/
|
12056
12101
|
async isConnected() {
|
12057
|
-
throw new
|
12102
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12058
12103
|
}
|
12059
12104
|
/**
|
12060
12105
|
* Should return all the accounts authorized for the
|
@@ -12063,7 +12108,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12063
12108
|
* @returns The accounts addresses strings
|
12064
12109
|
*/
|
12065
12110
|
async accounts() {
|
12066
|
-
throw new
|
12111
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12067
12112
|
}
|
12068
12113
|
/**
|
12069
12114
|
* Should start the connection process and return
|
@@ -12075,7 +12120,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12075
12120
|
* @returns boolean - connection status.
|
12076
12121
|
*/
|
12077
12122
|
async connect() {
|
12078
|
-
throw new
|
12123
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12079
12124
|
}
|
12080
12125
|
/**
|
12081
12126
|
* Should disconnect the current connection and
|
@@ -12085,7 +12130,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12085
12130
|
* @returns The connection status.
|
12086
12131
|
*/
|
12087
12132
|
async disconnect() {
|
12088
|
-
throw new
|
12133
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12089
12134
|
}
|
12090
12135
|
/**
|
12091
12136
|
* Should start the sign message process and return
|
@@ -12097,7 +12142,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12097
12142
|
* @returns Message signature
|
12098
12143
|
*/
|
12099
12144
|
async signMessage(_address, _message) {
|
12100
|
-
throw new
|
12145
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12101
12146
|
}
|
12102
12147
|
/**
|
12103
12148
|
* Should start the sign transaction process and return
|
@@ -12109,7 +12154,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12109
12154
|
* @returns Transaction signature
|
12110
12155
|
*/
|
12111
12156
|
async signTransaction(_address, _transaction) {
|
12112
|
-
throw new
|
12157
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12113
12158
|
}
|
12114
12159
|
/**
|
12115
12160
|
* Should start the send transaction process and return
|
@@ -12125,7 +12170,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12125
12170
|
* @returns The transaction id or transaction response
|
12126
12171
|
*/
|
12127
12172
|
async sendTransaction(_address, _transaction, _params) {
|
12128
|
-
throw new
|
12173
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12129
12174
|
}
|
12130
12175
|
/**
|
12131
12176
|
* Should return the current account selected inside the connector, if the account
|
@@ -12136,7 +12181,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12136
12181
|
* @returns The current account selected otherwise null.
|
12137
12182
|
*/
|
12138
12183
|
async currentAccount() {
|
12139
|
-
throw new
|
12184
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12140
12185
|
}
|
12141
12186
|
/**
|
12142
12187
|
* Should add the assets metadata to the connector and return true if the asset
|
@@ -12150,7 +12195,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12150
12195
|
* @returns True if the asset was added successfully
|
12151
12196
|
*/
|
12152
12197
|
async addAssets(_assets) {
|
12153
|
-
throw new
|
12198
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12154
12199
|
}
|
12155
12200
|
/**
|
12156
12201
|
* Should add the asset metadata to the connector and return true if the asset
|
@@ -12164,7 +12209,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12164
12209
|
* @returns True if the asset was added successfully
|
12165
12210
|
*/
|
12166
12211
|
async addAsset(_asset) {
|
12167
|
-
throw new
|
12212
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12168
12213
|
}
|
12169
12214
|
/**
|
12170
12215
|
* Should return all the assets added to the connector. If a connection is already established.
|
@@ -12172,7 +12217,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12172
12217
|
* @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
|
12173
12218
|
*/
|
12174
12219
|
async assets() {
|
12175
|
-
throw new
|
12220
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12176
12221
|
}
|
12177
12222
|
/**
|
12178
12223
|
* Should start the add network process and return true if the network was added successfully.
|
@@ -12183,7 +12228,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12183
12228
|
* @returns Return true if the network was added successfully
|
12184
12229
|
*/
|
12185
12230
|
async addNetwork(_networkUrl) {
|
12186
|
-
throw new
|
12231
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12187
12232
|
}
|
12188
12233
|
/**
|
12189
12234
|
* Should start the select network process and return true if the network has change successfully.
|
@@ -12194,7 +12239,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12194
12239
|
* @returns Return true if the network was added successfully
|
12195
12240
|
*/
|
12196
12241
|
async selectNetwork(_network) {
|
12197
|
-
throw new
|
12242
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12198
12243
|
}
|
12199
12244
|
/**
|
12200
12245
|
* Should return all the networks available from the connector. If the connection is already established.
|
@@ -12202,7 +12247,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12202
12247
|
* @returns Return all the networks added to the connector.
|
12203
12248
|
*/
|
12204
12249
|
async networks() {
|
12205
|
-
throw new
|
12250
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12206
12251
|
}
|
12207
12252
|
/**
|
12208
12253
|
* Should return the current network selected inside the connector. Even if the connection is not established.
|
@@ -12210,7 +12255,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12210
12255
|
* @returns Return the current network selected inside the connector.
|
12211
12256
|
*/
|
12212
12257
|
async currentNetwork() {
|
12213
|
-
throw new
|
12258
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12214
12259
|
}
|
12215
12260
|
/**
|
12216
12261
|
* Should add the ABI to the connector and return true if the ABI was added successfully.
|
@@ -12220,7 +12265,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12220
12265
|
* @returns Return true if the ABI was added successfully.
|
12221
12266
|
*/
|
12222
12267
|
async addABI(_contractId, _abi) {
|
12223
|
-
throw new
|
12268
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12224
12269
|
}
|
12225
12270
|
/**
|
12226
12271
|
* Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
|
@@ -12229,7 +12274,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12229
12274
|
* @returns The ABI if it exists, otherwise return null.
|
12230
12275
|
*/
|
12231
12276
|
async getABI(_id) {
|
12232
|
-
throw new
|
12277
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12233
12278
|
}
|
12234
12279
|
/**
|
12235
12280
|
* Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
|
@@ -12238,7 +12283,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
12238
12283
|
* @returns Returns true if the abi exists or false if not.
|
12239
12284
|
*/
|
12240
12285
|
async hasABI(_id) {
|
12241
|
-
throw new
|
12286
|
+
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12242
12287
|
}
|
12243
12288
|
/**
|
12244
12289
|
* Event listener for the connector.
|
@@ -12281,25 +12326,6 @@ function dispatchFuelConnectorEvent(connector) {
|
|
12281
12326
|
);
|
12282
12327
|
}
|
12283
12328
|
|
12284
|
-
// src/connectors/utils/promises.ts
|
12285
|
-
var import_errors33 = require("@fuel-ts/errors");
|
12286
|
-
function deferPromise() {
|
12287
|
-
const defer = {};
|
12288
|
-
defer.promise = new Promise((resolve, reject) => {
|
12289
|
-
defer.reject = reject;
|
12290
|
-
defer.resolve = resolve;
|
12291
|
-
});
|
12292
|
-
return defer;
|
12293
|
-
}
|
12294
|
-
async function withTimeout(promise, timeout = 1050) {
|
12295
|
-
const timeoutPromise = new Promise((resolve, reject) => {
|
12296
|
-
setTimeout(() => {
|
12297
|
-
reject(new import_errors33.FuelError(import_errors33.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
12298
|
-
}, timeout);
|
12299
|
-
});
|
12300
|
-
return Promise.race([timeoutPromise, promise]);
|
12301
|
-
}
|
12302
|
-
|
12303
12329
|
// src/connectors/fuel.ts
|
12304
12330
|
var HAS_CONNECTOR_TIMEOUT = 2e3;
|
12305
12331
|
var PING_CACHE_TIME = 5e3;
|