@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.mjs
CHANGED
@@ -731,7 +731,7 @@ var getAssetsByOwner = async (opts) => {
|
|
731
731
|
import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
|
732
732
|
import { Address as Address4 } from "@fuel-ts/address";
|
733
733
|
import { randomBytes as randomBytes2 } from "@fuel-ts/crypto";
|
734
|
-
import { ErrorCode as ErrorCode18, FuelError as
|
734
|
+
import { ErrorCode as ErrorCode18, FuelError as FuelError21 } from "@fuel-ts/errors";
|
735
735
|
import { bn as bn20 } from "@fuel-ts/math";
|
736
736
|
import { InputType as InputType7 } from "@fuel-ts/transactions";
|
737
737
|
import { arrayify as arrayify16, hexlify as hexlify17, isDefined as isDefined3 } from "@fuel-ts/utils";
|
@@ -773,7 +773,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
773
773
|
|
774
774
|
// src/providers/provider.ts
|
775
775
|
import { Address as Address2, isB256 } from "@fuel-ts/address";
|
776
|
-
import { ErrorCode as ErrorCode16, FuelError as
|
776
|
+
import { ErrorCode as ErrorCode16, FuelError as FuelError19 } from "@fuel-ts/errors";
|
777
777
|
import { bn as bn17 } from "@fuel-ts/math";
|
778
778
|
import { InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
|
779
779
|
import { arrayify as arrayify12, hexlify as hexlify16, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
|
@@ -782,6 +782,25 @@ import { GraphQLClient } from "graphql-request";
|
|
782
782
|
import gql2 from "graphql-tag";
|
783
783
|
import { clone as clone8 } from "ramda";
|
784
784
|
|
785
|
+
// src/connectors/utils/promises.ts
|
786
|
+
import { FuelError } from "@fuel-ts/errors";
|
787
|
+
function deferPromise() {
|
788
|
+
const defer = {};
|
789
|
+
defer.promise = new Promise((resolve, reject) => {
|
790
|
+
defer.reject = reject;
|
791
|
+
defer.resolve = resolve;
|
792
|
+
});
|
793
|
+
return defer;
|
794
|
+
}
|
795
|
+
async function withTimeout(promise, timeout = 1050) {
|
796
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
797
|
+
setTimeout(() => {
|
798
|
+
reject(new FuelError(FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
799
|
+
}, timeout);
|
800
|
+
});
|
801
|
+
return Promise.race([timeoutPromise, promise]);
|
802
|
+
}
|
803
|
+
|
785
804
|
// src/providers/__generated__/operations.ts
|
786
805
|
import gql from "graphql-tag";
|
787
806
|
var SubmittedStatusFragmentDoc = gql`
|
@@ -1834,14 +1853,14 @@ function getSdk(requester) {
|
|
1834
1853
|
}
|
1835
1854
|
|
1836
1855
|
// src/providers/fuel-graphql-subscriber.ts
|
1837
|
-
import { ErrorCode as ErrorCode2, FuelError as
|
1856
|
+
import { ErrorCode as ErrorCode2, FuelError as FuelError3 } from "@fuel-ts/errors";
|
1838
1857
|
import { print } from "graphql";
|
1839
1858
|
|
1840
1859
|
// src/providers/utils/handle-gql-error-message.ts
|
1841
|
-
import { ErrorCode, FuelError } from "@fuel-ts/errors";
|
1860
|
+
import { ErrorCode, FuelError as FuelError2 } from "@fuel-ts/errors";
|
1842
1861
|
var mapGqlErrorMessage = (error) => {
|
1843
1862
|
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)) {
|
1844
|
-
return new
|
1863
|
+
return new FuelError2(
|
1845
1864
|
ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
1846
1865
|
`Insufficient funds or too many small value coins. Consider combining UTXOs.`,
|
1847
1866
|
{},
|
@@ -1849,20 +1868,20 @@ var mapGqlErrorMessage = (error) => {
|
|
1849
1868
|
);
|
1850
1869
|
}
|
1851
1870
|
if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
|
1852
|
-
return new
|
1871
|
+
return new FuelError2(
|
1853
1872
|
ErrorCode.ASSET_NOT_FOUND,
|
1854
1873
|
`Asset not found for given asset id.`,
|
1855
1874
|
{},
|
1856
1875
|
error
|
1857
1876
|
);
|
1858
1877
|
}
|
1859
|
-
return new
|
1878
|
+
return new FuelError2(ErrorCode.INVALID_REQUEST, error.message, {}, error);
|
1860
1879
|
};
|
1861
1880
|
var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
|
1862
1881
|
if (!incompatibleNodeVersionMessage) {
|
1863
1882
|
return error;
|
1864
1883
|
}
|
1865
|
-
return new
|
1884
|
+
return new FuelError2(
|
1866
1885
|
error.code,
|
1867
1886
|
`${error.message}
|
1868
1887
|
|
@@ -1881,7 +1900,7 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
|
|
1881
1900
|
}
|
1882
1901
|
const errorMessage = mappedErrors.map((err) => err.message).join("\n");
|
1883
1902
|
throw mapGqlErrorWithIncompatibleNodeVersion(
|
1884
|
-
new
|
1903
|
+
new FuelError2(ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
|
1885
1904
|
incompatibleNodeVersionMessage
|
1886
1905
|
);
|
1887
1906
|
};
|
@@ -1932,7 +1951,7 @@ var _FuelGraphqlSubscriber = class {
|
|
1932
1951
|
try {
|
1933
1952
|
this.events.push(JSON.parse(match.replace(/^data:/, "")));
|
1934
1953
|
} catch (e) {
|
1935
|
-
throw new
|
1954
|
+
throw new FuelError3(
|
1936
1955
|
ErrorCode2.STREAM_PARSING_ERROR,
|
1937
1956
|
`Error while parsing stream data response: ${text}`
|
1938
1957
|
);
|
@@ -1956,13 +1975,13 @@ __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
|
|
1956
1975
|
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
1957
1976
|
|
1958
1977
|
// src/providers/resource-cache.ts
|
1959
|
-
import { FuelError as
|
1978
|
+
import { FuelError as FuelError13, ErrorCode as ErrorCode10 } from "@fuel-ts/errors";
|
1960
1979
|
import { hexlify as hexlify14 } from "@fuel-ts/utils";
|
1961
1980
|
|
1962
1981
|
// src/providers/transaction-request/input.ts
|
1963
1982
|
import { BYTES_32, UTXO_ID_LEN } from "@fuel-ts/abi-coder";
|
1964
1983
|
import { ZeroBytes32 } from "@fuel-ts/address/configs";
|
1965
|
-
import { ErrorCode as ErrorCode3, FuelError as
|
1984
|
+
import { ErrorCode as ErrorCode3, FuelError as FuelError4 } from "@fuel-ts/errors";
|
1966
1985
|
import { bn as bn2, toNumber } from "@fuel-ts/math";
|
1967
1986
|
import { InputType } from "@fuel-ts/transactions";
|
1968
1987
|
import { arrayify, hexlify as hexlify2 } from "@fuel-ts/utils";
|
@@ -2026,7 +2045,7 @@ var inputify = (value) => {
|
|
2026
2045
|
};
|
2027
2046
|
}
|
2028
2047
|
default: {
|
2029
|
-
throw new
|
2048
|
+
throw new FuelError4(
|
2030
2049
|
ErrorCode3.INVALID_TRANSACTION_INPUT,
|
2031
2050
|
`Invalid transaction input type: ${type}.`
|
2032
2051
|
);
|
@@ -2036,7 +2055,7 @@ var inputify = (value) => {
|
|
2036
2055
|
|
2037
2056
|
// src/providers/transaction-request/output.ts
|
2038
2057
|
import { ZeroBytes32 as ZeroBytes322 } from "@fuel-ts/address/configs";
|
2039
|
-
import { ErrorCode as ErrorCode4, FuelError as
|
2058
|
+
import { ErrorCode as ErrorCode4, FuelError as FuelError5 } from "@fuel-ts/errors";
|
2040
2059
|
import { bn as bn3 } from "@fuel-ts/math";
|
2041
2060
|
import { OutputType } from "@fuel-ts/transactions";
|
2042
2061
|
import { hexlify as hexlify3 } from "@fuel-ts/utils";
|
@@ -2083,7 +2102,7 @@ var outputify = (value) => {
|
|
2083
2102
|
};
|
2084
2103
|
}
|
2085
2104
|
default: {
|
2086
|
-
throw new
|
2105
|
+
throw new FuelError5(
|
2087
2106
|
ErrorCode4.INVALID_TRANSACTION_INPUT,
|
2088
2107
|
`Invalid transaction output type: ${type}.`
|
2089
2108
|
);
|
@@ -2096,7 +2115,7 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
|
|
2096
2115
|
import { Address, addressify } from "@fuel-ts/address";
|
2097
2116
|
import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
|
2098
2117
|
import { randomBytes } from "@fuel-ts/crypto";
|
2099
|
-
import { FuelError as
|
2118
|
+
import { FuelError as FuelError10 } from "@fuel-ts/errors";
|
2100
2119
|
import { bn as bn8 } from "@fuel-ts/math";
|
2101
2120
|
import {
|
2102
2121
|
PolicyType,
|
@@ -2122,7 +2141,7 @@ import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs
|
|
2122
2141
|
|
2123
2142
|
// src/providers/utils/serialization.ts
|
2124
2143
|
import { ZeroBytes32 as ZeroBytes323 } from "@fuel-ts/address/configs";
|
2125
|
-
import { ErrorCode as ErrorCode5, FuelError as
|
2144
|
+
import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/errors";
|
2126
2145
|
import { bn as bn4 } from "@fuel-ts/math";
|
2127
2146
|
import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
|
2128
2147
|
import { hexlify as hexlify4, arrayify as arrayify2 } from "@fuel-ts/utils";
|
@@ -2457,7 +2476,7 @@ var deserializeReceipt = (receipt) => {
|
|
2457
2476
|
return burnReceipt;
|
2458
2477
|
}
|
2459
2478
|
default:
|
2460
|
-
throw new
|
2479
|
+
throw new FuelError6(ErrorCode5.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
|
2461
2480
|
}
|
2462
2481
|
};
|
2463
2482
|
|
@@ -2482,7 +2501,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
|
|
2482
2501
|
var assembleReceiptByType = (gqlReceipt) => deserializeReceipt(gqlReceipt);
|
2483
2502
|
|
2484
2503
|
// src/providers/utils/block-explorer.ts
|
2485
|
-
import { ErrorCode as ErrorCode6, FuelError as
|
2504
|
+
import { ErrorCode as ErrorCode6, FuelError as FuelError7 } from "@fuel-ts/errors";
|
2486
2505
|
var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
|
2487
2506
|
var getPathFromInput = (key, value) => {
|
2488
2507
|
const pathMap = {
|
@@ -2516,14 +2535,14 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
2516
2535
|
}));
|
2517
2536
|
const hasAnyDefinedValues = definedValues.length > 0;
|
2518
2537
|
if (definedValues.length > 1) {
|
2519
|
-
throw new
|
2538
|
+
throw new FuelError7(
|
2520
2539
|
ErrorCode6.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2521
2540
|
`Only one of the following can be passed in to buildBlockExplorerUrl: ${customInputParams.map((param) => param.key).join(", ")}.`
|
2522
2541
|
);
|
2523
2542
|
}
|
2524
2543
|
if (path && definedValues.length > 0) {
|
2525
2544
|
const inputKeys = customInputParams.map(({ key }) => key).join(", ");
|
2526
|
-
throw new
|
2545
|
+
throw new FuelError7(
|
2527
2546
|
ErrorCode6.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2528
2547
|
`You cannot pass in a path to 'buildBlockExplorerUrl' along with any of the following: ${inputKeys}.`
|
2529
2548
|
);
|
@@ -2713,7 +2732,7 @@ function normalizeJSON(root) {
|
|
2713
2732
|
}
|
2714
2733
|
|
2715
2734
|
// src/providers/utils/extract-tx-error.ts
|
2716
|
-
import { ErrorCode as ErrorCode7, FuelError as
|
2735
|
+
import { ErrorCode as ErrorCode7, FuelError as FuelError8 } from "@fuel-ts/errors";
|
2717
2736
|
import { bn as bn6 } from "@fuel-ts/math";
|
2718
2737
|
import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
|
2719
2738
|
import {
|
@@ -2734,7 +2753,7 @@ You can read more about this error at:
|
|
2734
2753
|
|
2735
2754
|
${PANIC_DOC_URL}#variant.${statusReason}`;
|
2736
2755
|
}
|
2737
|
-
return new
|
2756
|
+
return new FuelError8(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
|
2738
2757
|
...metadata,
|
2739
2758
|
reason: statusReason
|
2740
2759
|
});
|
@@ -2775,7 +2794,7 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2775
2794
|
errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
|
2776
2795
|
break;
|
2777
2796
|
default:
|
2778
|
-
throw new
|
2797
|
+
throw new FuelError8(
|
2779
2798
|
ErrorCode7.UNKNOWN,
|
2780
2799
|
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
2781
2800
|
{
|
@@ -2785,7 +2804,7 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2785
2804
|
);
|
2786
2805
|
}
|
2787
2806
|
}
|
2788
|
-
return new
|
2807
|
+
return new FuelError8(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
|
2789
2808
|
...metadata,
|
2790
2809
|
reason
|
2791
2810
|
});
|
@@ -2830,7 +2849,7 @@ var NoWitnessByOwnerError = class extends Error {
|
|
2830
2849
|
};
|
2831
2850
|
|
2832
2851
|
// src/providers/transaction-request/helpers.ts
|
2833
|
-
import { ErrorCode as ErrorCode8, FuelError as
|
2852
|
+
import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2834
2853
|
import { bn as bn7 } from "@fuel-ts/math";
|
2835
2854
|
import { InputType as InputType2, OutputType as OutputType2 } from "@fuel-ts/transactions";
|
2836
2855
|
import { hexlify as hexlify6 } from "@fuel-ts/utils";
|
@@ -2903,7 +2922,7 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
|
|
2903
2922
|
"Add the relevant change outputs to the transaction to avoid burning assets.",
|
2904
2923
|
"Or enable asset burn, upon sending the transaction."
|
2905
2924
|
].join("\n");
|
2906
|
-
throw new
|
2925
|
+
throw new FuelError9(ErrorCode8.ASSET_BURN_DETECTED, message);
|
2907
2926
|
};
|
2908
2927
|
|
2909
2928
|
// src/providers/transaction-request/witness.ts
|
@@ -3301,7 +3320,7 @@ var BaseTransactionRequest = class {
|
|
3301
3320
|
* @hidden
|
3302
3321
|
*/
|
3303
3322
|
metadataGas(_gasCosts) {
|
3304
|
-
throw new
|
3323
|
+
throw new FuelError10(FuelError10.CODES.NOT_IMPLEMENTED, "Not implemented");
|
3305
3324
|
}
|
3306
3325
|
/**
|
3307
3326
|
* @hidden
|
@@ -3924,7 +3943,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3924
3943
|
};
|
3925
3944
|
|
3926
3945
|
// src/providers/transaction-request/upgrade-transaction-request.ts
|
3927
|
-
import { FuelError as
|
3946
|
+
import { FuelError as FuelError11 } from "@fuel-ts/errors";
|
3928
3947
|
import { hash } from "@fuel-ts/hasher";
|
3929
3948
|
import {
|
3930
3949
|
TransactionType as TransactionType5,
|
@@ -4031,7 +4050,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4031
4050
|
}
|
4032
4051
|
};
|
4033
4052
|
} else {
|
4034
|
-
throw new
|
4053
|
+
throw new FuelError11(FuelError11.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4035
4054
|
}
|
4036
4055
|
return {
|
4037
4056
|
type: TransactionType5.Upgrade,
|
@@ -4073,7 +4092,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4073
4092
|
txBytesSize
|
4074
4093
|
});
|
4075
4094
|
}
|
4076
|
-
throw new
|
4095
|
+
throw new FuelError11(FuelError11.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4077
4096
|
}
|
4078
4097
|
};
|
4079
4098
|
|
@@ -4188,7 +4207,7 @@ var AbstractScriptRequest = class {
|
|
4188
4207
|
};
|
4189
4208
|
|
4190
4209
|
// src/providers/transaction-request/utils.ts
|
4191
|
-
import { ErrorCode as ErrorCode9, FuelError as
|
4210
|
+
import { ErrorCode as ErrorCode9, FuelError as FuelError12 } from "@fuel-ts/errors";
|
4192
4211
|
import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
|
4193
4212
|
var transactionRequestify = (obj) => {
|
4194
4213
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
|
@@ -4212,7 +4231,7 @@ var transactionRequestify = (obj) => {
|
|
4212
4231
|
return UploadTransactionRequest.from(obj);
|
4213
4232
|
}
|
4214
4233
|
default: {
|
4215
|
-
throw new
|
4234
|
+
throw new FuelError12(
|
4216
4235
|
ErrorCode9.UNSUPPORTED_TRANSACTION_TYPE,
|
4217
4236
|
`Unsupported transaction type: ${type}.`
|
4218
4237
|
);
|
@@ -4232,7 +4251,7 @@ var ResourceCache = class {
|
|
4232
4251
|
constructor(ttl) {
|
4233
4252
|
this.ttl = ttl;
|
4234
4253
|
if (typeof ttl !== "number" || this.ttl <= 0) {
|
4235
|
-
throw new
|
4254
|
+
throw new FuelError13(
|
4236
4255
|
ErrorCode10.INVALID_TTL,
|
4237
4256
|
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
4238
4257
|
);
|
@@ -4317,7 +4336,7 @@ var ResourceCache = class {
|
|
4317
4336
|
};
|
4318
4337
|
|
4319
4338
|
// src/providers/transaction-response/transaction-response.ts
|
4320
|
-
import { ErrorCode as ErrorCode14, FuelError as
|
4339
|
+
import { ErrorCode as ErrorCode14, FuelError as FuelError17 } from "@fuel-ts/errors";
|
4321
4340
|
import { bn as bn16 } from "@fuel-ts/math";
|
4322
4341
|
import { OutputType as OutputType8, TransactionCoder as TransactionCoder4, TxPointerCoder } from "@fuel-ts/transactions";
|
4323
4342
|
import { arrayify as arrayify11, assertUnreachable } from "@fuel-ts/utils";
|
@@ -4395,12 +4414,12 @@ var calculateTXFeeForSummary = (params) => {
|
|
4395
4414
|
|
4396
4415
|
// src/providers/transaction-summary/operations.ts
|
4397
4416
|
import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
|
4398
|
-
import { ErrorCode as ErrorCode12, FuelError as
|
4417
|
+
import { ErrorCode as ErrorCode12, FuelError as FuelError15 } from "@fuel-ts/errors";
|
4399
4418
|
import { bn as bn13 } from "@fuel-ts/math";
|
4400
4419
|
import { ReceiptType as ReceiptType5, TransactionType as TransactionType9 } from "@fuel-ts/transactions";
|
4401
4420
|
|
4402
4421
|
// src/providers/transaction-summary/input.ts
|
4403
|
-
import { ErrorCode as ErrorCode11, FuelError as
|
4422
|
+
import { ErrorCode as ErrorCode11, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4404
4423
|
import { BN } from "@fuel-ts/math";
|
4405
4424
|
import { InputType as InputType6 } from "@fuel-ts/transactions";
|
4406
4425
|
function getInputsByTypes(inputs, types) {
|
@@ -4469,7 +4488,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
4469
4488
|
return void 0;
|
4470
4489
|
}
|
4471
4490
|
if (contractInput.type !== InputType6.Contract) {
|
4472
|
-
throw new
|
4491
|
+
throw new FuelError14(
|
4473
4492
|
ErrorCode11.INVALID_TRANSACTION_INPUT,
|
4474
4493
|
`Contract input should be of type 'contract'.`
|
4475
4494
|
);
|
@@ -4563,7 +4582,7 @@ function getTransactionTypeName(transactionType) {
|
|
4563
4582
|
case TransactionType9.Upload:
|
4564
4583
|
return "Upload" /* Upload */;
|
4565
4584
|
default:
|
4566
|
-
throw new
|
4585
|
+
throw new FuelError15(
|
4567
4586
|
ErrorCode12.UNSUPPORTED_TRANSACTION_TYPE,
|
4568
4587
|
`Unsupported transaction type: ${transactionType}.`
|
4569
4588
|
);
|
@@ -4950,7 +4969,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
4950
4969
|
};
|
4951
4970
|
|
4952
4971
|
// src/providers/transaction-summary/status.ts
|
4953
|
-
import { ErrorCode as ErrorCode13, FuelError as
|
4972
|
+
import { ErrorCode as ErrorCode13, FuelError as FuelError16 } from "@fuel-ts/errors";
|
4954
4973
|
import { bn as bn14 } from "@fuel-ts/math";
|
4955
4974
|
var getTransactionStatusName = (gqlStatus) => {
|
4956
4975
|
switch (gqlStatus) {
|
@@ -4963,7 +4982,7 @@ var getTransactionStatusName = (gqlStatus) => {
|
|
4963
4982
|
case "SqueezedOutStatus":
|
4964
4983
|
return "squeezedout" /* squeezedout */;
|
4965
4984
|
default:
|
4966
|
-
throw new
|
4985
|
+
throw new FuelError16(
|
4967
4986
|
ErrorCode13.INVALID_TRANSACTION_STATUS,
|
4968
4987
|
`Invalid transaction status: ${gqlStatus}.`
|
4969
4988
|
);
|
@@ -5097,14 +5116,26 @@ function assembleTransactionSummary(params) {
|
|
5097
5116
|
|
5098
5117
|
// src/providers/transaction-response/getDecodedLogs.ts
|
5099
5118
|
import { Interface as Interface2, BigNumberCoder } from "@fuel-ts/abi-coder";
|
5119
|
+
import { ZeroBytes32 as ZeroBytes3210 } from "@fuel-ts/address/configs";
|
5100
5120
|
import { ReceiptType as ReceiptType7 } from "@fuel-ts/transactions";
|
5101
5121
|
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
5122
|
+
let mainContract = "";
|
5123
|
+
if (mainAbi.programType === "contract") {
|
5124
|
+
const firstCallReceipt = receipts.find(
|
5125
|
+
(r) => r.type === ReceiptType7.Call && r.id === ZeroBytes3210
|
5126
|
+
);
|
5127
|
+
mainContract = firstCallReceipt.to;
|
5128
|
+
}
|
5102
5129
|
return receipts.reduce((logs, receipt) => {
|
5103
5130
|
if (receipt.type === ReceiptType7.LogData || receipt.type === ReceiptType7.Log) {
|
5104
|
-
const
|
5105
|
-
const
|
5106
|
-
|
5107
|
-
|
5131
|
+
const isLogFromMainAbi = receipt.id === ZeroBytes3210 || mainContract === receipt.id;
|
5132
|
+
const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
|
5133
|
+
if (isDecodable) {
|
5134
|
+
const interfaceToUse = isLogFromMainAbi ? new Interface2(mainAbi) : new Interface2(externalAbis[receipt.id]);
|
5135
|
+
const data = receipt.type === ReceiptType7.Log ? new BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
|
5136
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
|
5137
|
+
logs.push(decodedLog);
|
5138
|
+
}
|
5108
5139
|
}
|
5109
5140
|
return logs;
|
5110
5141
|
}, []);
|
@@ -5309,7 +5340,7 @@ var TransactionResponse = class {
|
|
5309
5340
|
this.status = statusChange;
|
5310
5341
|
if (statusChange.type === "SqueezedOutStatus") {
|
5311
5342
|
this.unsetResourceCache();
|
5312
|
-
throw new
|
5343
|
+
throw new FuelError17(
|
5313
5344
|
ErrorCode14.TRANSACTION_SQUEEZED_OUT,
|
5314
5345
|
`Transaction Squeezed Out with reason: ${statusChange.reason}`
|
5315
5346
|
);
|
@@ -5434,30 +5465,30 @@ var adjustResourcesToExclude = (params) => {
|
|
5434
5465
|
};
|
5435
5466
|
|
5436
5467
|
// src/providers/utils/validate-pagination-args.ts
|
5437
|
-
import { FuelError as
|
5468
|
+
import { FuelError as FuelError18, ErrorCode as ErrorCode15 } from "@fuel-ts/errors";
|
5438
5469
|
var validatePaginationArgs = (params) => {
|
5439
5470
|
const { paginationLimit, inputArgs = {} } = params;
|
5440
5471
|
const { first, last, after, before } = inputArgs;
|
5441
5472
|
if (after && before) {
|
5442
|
-
throw new
|
5473
|
+
throw new FuelError18(
|
5443
5474
|
ErrorCode15.INVALID_INPUT_PARAMETERS,
|
5444
5475
|
'Pagination arguments "after" and "before" cannot be used together'
|
5445
5476
|
);
|
5446
5477
|
}
|
5447
5478
|
if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
|
5448
|
-
throw new
|
5479
|
+
throw new FuelError18(
|
5449
5480
|
ErrorCode15.INVALID_INPUT_PARAMETERS,
|
5450
5481
|
`Pagination limit for this query cannot exceed ${paginationLimit} items`
|
5451
5482
|
);
|
5452
5483
|
}
|
5453
5484
|
if (first && before) {
|
5454
|
-
throw new
|
5485
|
+
throw new FuelError18(
|
5455
5486
|
ErrorCode15.INVALID_INPUT_PARAMETERS,
|
5456
5487
|
'The use of pagination argument "first" with "before" is not supported'
|
5457
5488
|
);
|
5458
5489
|
}
|
5459
5490
|
if (last && after) {
|
5460
|
-
throw new
|
5491
|
+
throw new FuelError18(
|
5461
5492
|
ErrorCode15.INVALID_INPUT_PARAMETERS,
|
5462
5493
|
'The use of pagination argument "last" with "after" is not supported'
|
5463
5494
|
);
|
@@ -5542,6 +5573,7 @@ var _Provider = class {
|
|
5542
5573
|
}
|
5543
5574
|
/** @hidden */
|
5544
5575
|
static clearChainAndNodeCaches() {
|
5576
|
+
_Provider.inflightFetchChainAndNodeInfoRequests = {};
|
5545
5577
|
_Provider.nodeInfoCache = {};
|
5546
5578
|
_Provider.chainInfoCache = {};
|
5547
5579
|
}
|
@@ -5570,7 +5602,7 @@ var _Provider = class {
|
|
5570
5602
|
try {
|
5571
5603
|
parsedUrl = new URL(url);
|
5572
5604
|
} catch (error) {
|
5573
|
-
throw new
|
5605
|
+
throw new FuelError19(FuelError19.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
|
5574
5606
|
}
|
5575
5607
|
const username = parsedUrl.username;
|
5576
5608
|
const password = parsedUrl.password;
|
@@ -5659,13 +5691,24 @@ var _Provider = class {
|
|
5659
5691
|
throw new Error(`Jumps to the catch block and re-fetch`);
|
5660
5692
|
}
|
5661
5693
|
} catch (_err) {
|
5694
|
+
const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
5695
|
+
if (inflightRequest) {
|
5696
|
+
const now2 = await inflightRequest;
|
5697
|
+
this.consensusParametersTimestamp = now2;
|
5698
|
+
return this.fetchChainAndNodeInfo();
|
5699
|
+
}
|
5700
|
+
const { promise, resolve } = deferPromise();
|
5701
|
+
_Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
|
5662
5702
|
const data = await this.operations.getChainAndNodeInfo();
|
5663
5703
|
nodeInfo = deserializeNodeInfo(data.nodeInfo);
|
5664
|
-
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
5665
5704
|
chain = deserializeChain(data.chain);
|
5705
|
+
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
5666
5706
|
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
5667
5707
|
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
5668
|
-
|
5708
|
+
const now = Date.now();
|
5709
|
+
this.consensusParametersTimestamp = now;
|
5710
|
+
resolve(now);
|
5711
|
+
delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
|
5669
5712
|
}
|
5670
5713
|
return {
|
5671
5714
|
chain,
|
@@ -5843,13 +5886,13 @@ var _Provider = class {
|
|
5843
5886
|
}
|
5844
5887
|
} = await this.getChain();
|
5845
5888
|
if (bn17(tx.inputs.length).gt(maxInputs)) {
|
5846
|
-
throw new
|
5889
|
+
throw new FuelError19(
|
5847
5890
|
ErrorCode16.MAX_INPUTS_EXCEEDED,
|
5848
5891
|
`The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`
|
5849
5892
|
);
|
5850
5893
|
}
|
5851
5894
|
if (bn17(tx.outputs.length).gt(maxOutputs)) {
|
5852
|
-
throw new
|
5895
|
+
throw new FuelError19(
|
5853
5896
|
ErrorCode16.MAX_OUTPUTS_EXCEEDED,
|
5854
5897
|
`The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`
|
5855
5898
|
);
|
@@ -6549,7 +6592,7 @@ var _Provider = class {
|
|
6549
6592
|
0
|
6550
6593
|
)?.[0];
|
6551
6594
|
} catch (error) {
|
6552
|
-
if (error instanceof
|
6595
|
+
if (error instanceof FuelError19 && error.code === ErrorCode16.UNSUPPORTED_TRANSACTION_TYPE) {
|
6553
6596
|
console.warn("Unsupported transaction type encountered");
|
6554
6597
|
return null;
|
6555
6598
|
}
|
@@ -6575,7 +6618,7 @@ var _Provider = class {
|
|
6575
6618
|
try {
|
6576
6619
|
return coder.decode(arrayify12(rawPayload), 0)[0];
|
6577
6620
|
} catch (error) {
|
6578
|
-
if (error instanceof
|
6621
|
+
if (error instanceof FuelError19 && error.code === ErrorCode16.UNSUPPORTED_TRANSACTION_TYPE) {
|
6579
6622
|
console.warn("Unsupported transaction type encountered");
|
6580
6623
|
return null;
|
6581
6624
|
}
|
@@ -6753,7 +6796,7 @@ var _Provider = class {
|
|
6753
6796
|
nonce
|
6754
6797
|
};
|
6755
6798
|
if (commitBlockId && commitBlockHeight) {
|
6756
|
-
throw new
|
6799
|
+
throw new FuelError19(
|
6757
6800
|
ErrorCode16.INVALID_INPUT_PARAMETERS,
|
6758
6801
|
"commitBlockId and commitBlockHeight cannot be used together"
|
6759
6802
|
);
|
@@ -7009,6 +7052,8 @@ cacheInputs_fn = function(inputs, transactionId) {
|
|
7009
7052
|
this.cache.set(transactionId, inputs);
|
7010
7053
|
};
|
7011
7054
|
/** @hidden */
|
7055
|
+
__publicField(Provider, "inflightFetchChainAndNodeInfoRequests", {});
|
7056
|
+
/** @hidden */
|
7012
7057
|
__publicField(Provider, "chainInfoCache", {});
|
7013
7058
|
/** @hidden */
|
7014
7059
|
__publicField(Provider, "nodeInfoCache", {});
|
@@ -7016,7 +7061,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
7016
7061
|
__publicField(Provider, "incompatibleNodeVersionMessage", "");
|
7017
7062
|
|
7018
7063
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
7019
|
-
import { ErrorCode as ErrorCode17, FuelError as
|
7064
|
+
import { ErrorCode as ErrorCode17, FuelError as FuelError20 } from "@fuel-ts/errors";
|
7020
7065
|
import { bn as bn18 } from "@fuel-ts/math";
|
7021
7066
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
7022
7067
|
import { arrayify as arrayify13 } from "@fuel-ts/utils";
|
@@ -7026,7 +7071,7 @@ async function getTransactionSummary(params) {
|
|
7026
7071
|
transactionId: id
|
7027
7072
|
});
|
7028
7073
|
if (!gqlTransaction) {
|
7029
|
-
throw new
|
7074
|
+
throw new FuelError20(
|
7030
7075
|
ErrorCode17.TRANSACTION_NOT_FOUND,
|
7031
7076
|
`Transaction not found for given id: ${id}.`
|
7032
7077
|
);
|
@@ -7278,7 +7323,7 @@ var Account = class extends AbstractAccount {
|
|
7278
7323
|
*/
|
7279
7324
|
get provider() {
|
7280
7325
|
if (!this._provider) {
|
7281
|
-
throw new
|
7326
|
+
throw new FuelError21(ErrorCode18.MISSING_PROVIDER, "Provider not set");
|
7282
7327
|
}
|
7283
7328
|
return this._provider;
|
7284
7329
|
}
|
@@ -7437,7 +7482,7 @@ var Account = class extends AbstractAccount {
|
|
7437
7482
|
fundingAttempts += 1;
|
7438
7483
|
}
|
7439
7484
|
if (needsToBeFunded) {
|
7440
|
-
throw new
|
7485
|
+
throw new FuelError21(
|
7441
7486
|
ErrorCode18.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
7442
7487
|
`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
|
7443
7488
|
);
|
@@ -7557,7 +7602,7 @@ var Account = class extends AbstractAccount {
|
|
7557
7602
|
const contractAddress = new Address4(transferParam.contractId);
|
7558
7603
|
const assetId = transferParam.assetId ? hexlify17(transferParam.assetId) : defaultAssetId;
|
7559
7604
|
if (amount.lte(0)) {
|
7560
|
-
throw new
|
7605
|
+
throw new FuelError21(
|
7561
7606
|
ErrorCode18.INVALID_TRANSFER_AMOUNT,
|
7562
7607
|
"Transfer amount must be a positive number."
|
7563
7608
|
);
|
@@ -7674,7 +7719,7 @@ var Account = class extends AbstractAccount {
|
|
7674
7719
|
*/
|
7675
7720
|
async signMessage(message) {
|
7676
7721
|
if (!this._connector) {
|
7677
|
-
throw new
|
7722
|
+
throw new FuelError21(ErrorCode18.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
7678
7723
|
}
|
7679
7724
|
return this._connector.signMessage(this.address.toString(), message);
|
7680
7725
|
}
|
@@ -7686,7 +7731,7 @@ var Account = class extends AbstractAccount {
|
|
7686
7731
|
*/
|
7687
7732
|
async signTransaction(transactionRequestLike) {
|
7688
7733
|
if (!this._connector) {
|
7689
|
-
throw new
|
7734
|
+
throw new FuelError21(
|
7690
7735
|
ErrorCode18.MISSING_CONNECTOR,
|
7691
7736
|
"A connector is required to sign transactions."
|
7692
7737
|
);
|
@@ -7783,7 +7828,7 @@ var Account = class extends AbstractAccount {
|
|
7783
7828
|
/** @hidden * */
|
7784
7829
|
validateTransferAmount(amount) {
|
7785
7830
|
if (bn20(amount).lte(0)) {
|
7786
|
-
throw new
|
7831
|
+
throw new FuelError21(
|
7787
7832
|
ErrorCode18.INVALID_TRANSFER_AMOUNT,
|
7788
7833
|
"Transfer amount must be a positive number."
|
7789
7834
|
);
|
@@ -7813,7 +7858,7 @@ var Account = class extends AbstractAccount {
|
|
7813
7858
|
if (!isDefined3(setGasLimit)) {
|
7814
7859
|
request2.gasLimit = gasUsed;
|
7815
7860
|
} else if (gasUsed.gt(setGasLimit)) {
|
7816
|
-
throw new
|
7861
|
+
throw new FuelError21(
|
7817
7862
|
ErrorCode18.GAS_LIMIT_TOO_LOW,
|
7818
7863
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
7819
7864
|
);
|
@@ -7821,7 +7866,7 @@ var Account = class extends AbstractAccount {
|
|
7821
7866
|
if (!isDefined3(setMaxFee)) {
|
7822
7867
|
request2.maxFee = maxFee;
|
7823
7868
|
} else if (maxFee.gt(setMaxFee)) {
|
7824
|
-
throw new
|
7869
|
+
throw new FuelError21(
|
7825
7870
|
ErrorCode18.MAX_FEE_TOO_LOW,
|
7826
7871
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
7827
7872
|
);
|
@@ -7955,7 +8000,7 @@ import {
|
|
7955
8000
|
encryptJsonWalletData,
|
7956
8001
|
randomUUID
|
7957
8002
|
} from "@fuel-ts/crypto";
|
7958
|
-
import { ErrorCode as ErrorCode19, FuelError as
|
8003
|
+
import { ErrorCode as ErrorCode19, FuelError as FuelError22 } from "@fuel-ts/errors";
|
7959
8004
|
import { hexlify as hexlify19 } from "@fuel-ts/utils";
|
7960
8005
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
7961
8006
|
var DEFAULT_KDF_PARAMS_R = 8;
|
@@ -8032,7 +8077,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
8032
8077
|
const macHashUint8Array = keccak256(data);
|
8033
8078
|
const macHash = stringFromBuffer(macHashUint8Array, "hex");
|
8034
8079
|
if (mac !== macHash) {
|
8035
|
-
throw new
|
8080
|
+
throw new FuelError22(
|
8036
8081
|
ErrorCode19.INVALID_PASSWORD,
|
8037
8082
|
"Failed to decrypt the keystore wallet, the provided password is incorrect."
|
8038
8083
|
);
|
@@ -8168,14 +8213,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
8168
8213
|
|
8169
8214
|
// src/hdwallet/hdwallet.ts
|
8170
8215
|
import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
|
8171
|
-
import { ErrorCode as ErrorCode22, FuelError as
|
8216
|
+
import { ErrorCode as ErrorCode22, FuelError as FuelError25 } from "@fuel-ts/errors";
|
8172
8217
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
8173
8218
|
import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
8174
8219
|
import { arrayify as arrayify20, hexlify as hexlify22, concat as concat6, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
|
8175
8220
|
|
8176
8221
|
// src/mnemonic/mnemonic.ts
|
8177
8222
|
import { randomBytes as randomBytes5, pbkdf2, computeHmac } from "@fuel-ts/crypto";
|
8178
|
-
import { ErrorCode as ErrorCode21, FuelError as
|
8223
|
+
import { ErrorCode as ErrorCode21, FuelError as FuelError24 } from "@fuel-ts/errors";
|
8179
8224
|
import { sha256 as sha2563 } from "@fuel-ts/hasher";
|
8180
8225
|
import { arrayify as arrayify19, hexlify as hexlify21, concat as concat5, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
|
8181
8226
|
|
@@ -10238,7 +10283,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
10238
10283
|
})(Language || {});
|
10239
10284
|
|
10240
10285
|
// src/mnemonic/utils.ts
|
10241
|
-
import { ErrorCode as ErrorCode20, FuelError as
|
10286
|
+
import { ErrorCode as ErrorCode20, FuelError as FuelError23 } from "@fuel-ts/errors";
|
10242
10287
|
import { sha256 as sha2562 } from "@fuel-ts/hasher";
|
10243
10288
|
import { arrayify as arrayify18 } from "@fuel-ts/utils";
|
10244
10289
|
function getLowerMask(bits) {
|
@@ -10287,7 +10332,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
10287
10332
|
for (let i = 0; i < words.length; i += 1) {
|
10288
10333
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
10289
10334
|
if (index === -1) {
|
10290
|
-
throw new
|
10335
|
+
throw new FuelError23(
|
10291
10336
|
ErrorCode20.INVALID_MNEMONIC,
|
10292
10337
|
`Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
|
10293
10338
|
);
|
@@ -10304,7 +10349,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
10304
10349
|
const checksumMask = getUpperMask(checksumBits);
|
10305
10350
|
const checksum = arrayify18(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
10306
10351
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
10307
|
-
throw new
|
10352
|
+
throw new FuelError23(
|
10308
10353
|
ErrorCode20.INVALID_CHECKSUM,
|
10309
10354
|
"Checksum validation failed for the provided mnemonic."
|
10310
10355
|
);
|
@@ -10319,7 +10364,7 @@ var TestnetPRV = "0x04358394";
|
|
10319
10364
|
var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
|
10320
10365
|
function assertWordList(wordlist) {
|
10321
10366
|
if (wordlist.length !== 2048) {
|
10322
|
-
throw new
|
10367
|
+
throw new FuelError24(
|
10323
10368
|
ErrorCode21.INVALID_WORD_LIST,
|
10324
10369
|
`Expected word list length of 2048, but got ${wordlist.length}.`
|
10325
10370
|
);
|
@@ -10327,7 +10372,7 @@ function assertWordList(wordlist) {
|
|
10327
10372
|
}
|
10328
10373
|
function assertEntropy(entropy) {
|
10329
10374
|
if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
|
10330
|
-
throw new
|
10375
|
+
throw new FuelError24(
|
10331
10376
|
ErrorCode21.INVALID_ENTROPY,
|
10332
10377
|
`Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
|
10333
10378
|
);
|
@@ -10338,7 +10383,7 @@ function assertMnemonic(words) {
|
|
10338
10383
|
const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
|
10339
10384
|
", "
|
10340
10385
|
)}] words, but got ${words.length}.`;
|
10341
|
-
throw new
|
10386
|
+
throw new FuelError24(ErrorCode21.INVALID_MNEMONIC, errorMsg);
|
10342
10387
|
}
|
10343
10388
|
}
|
10344
10389
|
var Mnemonic = class {
|
@@ -10456,7 +10501,7 @@ var Mnemonic = class {
|
|
10456
10501
|
static masterKeysFromSeed(seed) {
|
10457
10502
|
const seedArray = arrayify19(seed);
|
10458
10503
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
10459
|
-
throw new
|
10504
|
+
throw new FuelError24(
|
10460
10505
|
ErrorCode21.INVALID_SEED,
|
10461
10506
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
10462
10507
|
);
|
@@ -10534,7 +10579,7 @@ function isValidExtendedKey(extendedKey) {
|
|
10534
10579
|
function parsePath(path, depth = 0) {
|
10535
10580
|
const components = path.split("/");
|
10536
10581
|
if (components.length === 0 || components[0] === "m" && depth !== 0) {
|
10537
|
-
throw new
|
10582
|
+
throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, `invalid path - ${path}`);
|
10538
10583
|
}
|
10539
10584
|
if (components[0] === "m") {
|
10540
10585
|
components.shift();
|
@@ -10563,7 +10608,7 @@ var HDWallet = class {
|
|
10563
10608
|
this.privateKey = hexlify22(config.privateKey);
|
10564
10609
|
} else {
|
10565
10610
|
if (!config.publicKey) {
|
10566
|
-
throw new
|
10611
|
+
throw new FuelError25(
|
10567
10612
|
ErrorCode22.HD_WALLET_ERROR,
|
10568
10613
|
"Both public and private Key cannot be missing. At least one should be provided."
|
10569
10614
|
);
|
@@ -10593,7 +10638,7 @@ var HDWallet = class {
|
|
10593
10638
|
const data = new Uint8Array(37);
|
10594
10639
|
if (index & HARDENED_INDEX) {
|
10595
10640
|
if (!privateKey) {
|
10596
|
-
throw new
|
10641
|
+
throw new FuelError25(
|
10597
10642
|
ErrorCode22.HD_WALLET_ERROR,
|
10598
10643
|
"Cannot derive a hardened index without a private Key."
|
10599
10644
|
);
|
@@ -10646,7 +10691,7 @@ var HDWallet = class {
|
|
10646
10691
|
*/
|
10647
10692
|
toExtendedKey(isPublic = false, testnet = false) {
|
10648
10693
|
if (this.depth >= 256) {
|
10649
|
-
throw new
|
10694
|
+
throw new FuelError25(
|
10650
10695
|
ErrorCode22.HD_WALLET_ERROR,
|
10651
10696
|
`Exceeded max depth of 255. Current depth: ${this.depth}.`
|
10652
10697
|
);
|
@@ -10678,10 +10723,10 @@ var HDWallet = class {
|
|
10678
10723
|
const bytes = arrayify20(decoded);
|
10679
10724
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
10680
10725
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
10681
|
-
throw new
|
10726
|
+
throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
10682
10727
|
}
|
10683
10728
|
if (!validChecksum) {
|
10684
|
-
throw new
|
10729
|
+
throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
10685
10730
|
}
|
10686
10731
|
const depth = bytes[4];
|
10687
10732
|
const parentFingerprint = hexlify22(bytes.slice(5, 9));
|
@@ -10689,14 +10734,14 @@ var HDWallet = class {
|
|
10689
10734
|
const chainCode = hexlify22(bytes.slice(13, 45));
|
10690
10735
|
const key = bytes.slice(45, 78);
|
10691
10736
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
10692
|
-
throw new
|
10737
|
+
throw new FuelError25(
|
10693
10738
|
ErrorCode22.HD_WALLET_ERROR,
|
10694
10739
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
10695
10740
|
);
|
10696
10741
|
}
|
10697
10742
|
if (isPublicExtendedKey(bytes)) {
|
10698
10743
|
if (key[0] !== 3) {
|
10699
|
-
throw new
|
10744
|
+
throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Invalid public extended key.");
|
10700
10745
|
}
|
10701
10746
|
return new HDWallet({
|
10702
10747
|
publicKey: key,
|
@@ -10707,7 +10752,7 @@ var HDWallet = class {
|
|
10707
10752
|
});
|
10708
10753
|
}
|
10709
10754
|
if (key[0] !== 0) {
|
10710
|
-
throw new
|
10755
|
+
throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Invalid private extended key.");
|
10711
10756
|
}
|
10712
10757
|
return new HDWallet({
|
10713
10758
|
privateKey: key.slice(1),
|
@@ -10875,7 +10920,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
|
10875
10920
|
// src/wallet-manager/wallet-manager.ts
|
10876
10921
|
import { Address as Address9 } from "@fuel-ts/address";
|
10877
10922
|
import { encrypt, decrypt } from "@fuel-ts/crypto";
|
10878
|
-
import { ErrorCode as ErrorCode25, FuelError as
|
10923
|
+
import { ErrorCode as ErrorCode25, FuelError as FuelError28 } from "@fuel-ts/errors";
|
10879
10924
|
import { EventEmitter } from "events";
|
10880
10925
|
|
10881
10926
|
// src/wallet-manager/storages/memory-storage.ts
|
@@ -10898,7 +10943,7 @@ var MemoryStorage = class {
|
|
10898
10943
|
|
10899
10944
|
// src/wallet-manager/vaults/mnemonic-vault.ts
|
10900
10945
|
import { Address as Address7 } from "@fuel-ts/address";
|
10901
|
-
import { ErrorCode as ErrorCode23, FuelError as
|
10946
|
+
import { ErrorCode as ErrorCode23, FuelError as FuelError26 } from "@fuel-ts/errors";
|
10902
10947
|
var _secret;
|
10903
10948
|
var MnemonicVault = class {
|
10904
10949
|
constructor(options) {
|
@@ -10954,7 +10999,7 @@ var MnemonicVault = class {
|
|
10954
10999
|
}
|
10955
11000
|
numberOfAccounts += 1;
|
10956
11001
|
} while (numberOfAccounts < this.numberOfAccounts);
|
10957
|
-
throw new
|
11002
|
+
throw new FuelError26(
|
10958
11003
|
ErrorCode23.WALLET_MANAGER_ERROR,
|
10959
11004
|
`Account with address '${address}' not found in derived wallets.`
|
10960
11005
|
);
|
@@ -10969,7 +11014,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
|
|
10969
11014
|
|
10970
11015
|
// src/wallet-manager/vaults/privatekey-vault.ts
|
10971
11016
|
import { Address as Address8 } from "@fuel-ts/address";
|
10972
|
-
import { ErrorCode as ErrorCode24, FuelError as
|
11017
|
+
import { ErrorCode as ErrorCode24, FuelError as FuelError27 } from "@fuel-ts/errors";
|
10973
11018
|
var _privateKeys;
|
10974
11019
|
var PrivateKeyVault = class {
|
10975
11020
|
/**
|
@@ -11010,7 +11055,7 @@ var PrivateKeyVault = class {
|
|
11010
11055
|
(pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
|
11011
11056
|
);
|
11012
11057
|
if (!privateKey) {
|
11013
|
-
throw new
|
11058
|
+
throw new FuelError27(
|
11014
11059
|
ErrorCode24.WALLET_MANAGER_ERROR,
|
11015
11060
|
`No private key found for address '${address}'.`
|
11016
11061
|
);
|
@@ -11035,7 +11080,7 @@ var ERROR_MESSAGES = {
|
|
11035
11080
|
};
|
11036
11081
|
function assert(condition, message) {
|
11037
11082
|
if (!condition) {
|
11038
|
-
throw new
|
11083
|
+
throw new FuelError28(ErrorCode25.WALLET_MANAGER_ERROR, message);
|
11039
11084
|
}
|
11040
11085
|
}
|
11041
11086
|
var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
|
@@ -11261,25 +11306,25 @@ deserializeVaults_fn = function(vaults) {
|
|
11261
11306
|
__publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
|
11262
11307
|
|
11263
11308
|
// src/wallet-manager/types.ts
|
11264
|
-
import { ErrorCode as ErrorCode26, FuelError as
|
11309
|
+
import { ErrorCode as ErrorCode26, FuelError as FuelError29 } from "@fuel-ts/errors";
|
11265
11310
|
var Vault = class {
|
11266
11311
|
constructor(_options) {
|
11267
|
-
throw new
|
11312
|
+
throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
|
11268
11313
|
}
|
11269
11314
|
serialize() {
|
11270
|
-
throw new
|
11315
|
+
throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
|
11271
11316
|
}
|
11272
11317
|
getAccounts() {
|
11273
|
-
throw new
|
11318
|
+
throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
|
11274
11319
|
}
|
11275
11320
|
addAccount() {
|
11276
|
-
throw new
|
11321
|
+
throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
|
11277
11322
|
}
|
11278
11323
|
exportAccount(_address) {
|
11279
|
-
throw new
|
11324
|
+
throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
|
11280
11325
|
}
|
11281
11326
|
getWallet(_address) {
|
11282
|
-
throw new
|
11327
|
+
throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
|
11283
11328
|
}
|
11284
11329
|
};
|
11285
11330
|
__publicField(Vault, "type");
|
@@ -11289,11 +11334,11 @@ var StorageAbstract = class {
|
|
11289
11334
|
// src/predicate/predicate.ts
|
11290
11335
|
import { Interface as Interface3 } from "@fuel-ts/abi-coder";
|
11291
11336
|
import { Address as Address10 } from "@fuel-ts/address";
|
11292
|
-
import { ErrorCode as ErrorCode28, FuelError as
|
11337
|
+
import { ErrorCode as ErrorCode28, FuelError as FuelError31 } from "@fuel-ts/errors";
|
11293
11338
|
import { arrayify as arrayify23, hexlify as hexlify24 } from "@fuel-ts/utils";
|
11294
11339
|
|
11295
11340
|
// src/utils/deployScriptOrPredicate.ts
|
11296
|
-
import { FuelError as
|
11341
|
+
import { FuelError as FuelError30, ErrorCode as ErrorCode27 } from "@fuel-ts/errors";
|
11297
11342
|
import { bn as bn22 } from "@fuel-ts/math";
|
11298
11343
|
import { arrayify as arrayify21 } from "@fuel-ts/utils";
|
11299
11344
|
|
@@ -11455,7 +11500,7 @@ async function fundBlobTx(deployer, blobTxRequest) {
|
|
11455
11500
|
}).add(1);
|
11456
11501
|
totalCost = totalCost.add(minFee);
|
11457
11502
|
if (totalCost.gt(await deployer.getBalance())) {
|
11458
|
-
throw new
|
11503
|
+
throw new FuelError30(ErrorCode27.FUNDS_TOO_LOW, "Insufficient balance to deploy predicate.");
|
11459
11504
|
}
|
11460
11505
|
const txCost = await deployer.getTransactionCost(blobTxRequest);
|
11461
11506
|
blobTxRequest.maxFee = txCost.maxFee;
|
@@ -11506,7 +11551,7 @@ async function deployScriptOrPredicate({
|
|
11506
11551
|
throw new Error();
|
11507
11552
|
}
|
11508
11553
|
} catch (err) {
|
11509
|
-
throw new
|
11554
|
+
throw new FuelError30(ErrorCode27.TRANSACTION_FAILED, "Failed to deploy predicate chunk");
|
11510
11555
|
}
|
11511
11556
|
return loaderInstance;
|
11512
11557
|
};
|
@@ -11641,7 +11686,7 @@ var Predicate = class extends Account {
|
|
11641
11686
|
let predicateBytes = arrayify23(bytes);
|
11642
11687
|
const abiInterface = new Interface3(jsonAbi);
|
11643
11688
|
if (abiInterface.functions.main === void 0) {
|
11644
|
-
throw new
|
11689
|
+
throw new FuelError31(
|
11645
11690
|
ErrorCode28.ABI_MAIN_METHOD_MISSING,
|
11646
11691
|
'Cannot use ABI without "main" function.'
|
11647
11692
|
);
|
@@ -11702,14 +11747,14 @@ var Predicate = class extends Account {
|
|
11702
11747
|
const mutatedBytes = bytes;
|
11703
11748
|
try {
|
11704
11749
|
if (Object.keys(abiInterface.configurables).length === 0) {
|
11705
|
-
throw new
|
11750
|
+
throw new FuelError31(
|
11706
11751
|
ErrorCode28.INVALID_CONFIGURABLE_CONSTANTS,
|
11707
11752
|
"Predicate has no configurable constants to be set"
|
11708
11753
|
);
|
11709
11754
|
}
|
11710
11755
|
Object.entries(configurableConstants).forEach(([key, value]) => {
|
11711
11756
|
if (!abiInterface?.configurables[key]) {
|
11712
|
-
throw new
|
11757
|
+
throw new FuelError31(
|
11713
11758
|
ErrorCode28.CONFIGURABLE_NOT_FOUND,
|
11714
11759
|
`No configurable constant named '${key}' found in the Predicate`
|
11715
11760
|
);
|
@@ -11719,7 +11764,7 @@ var Predicate = class extends Account {
|
|
11719
11764
|
mutatedBytes.set(encoded, offset);
|
11720
11765
|
});
|
11721
11766
|
} catch (err) {
|
11722
|
-
throw new
|
11767
|
+
throw new FuelError31(
|
11723
11768
|
ErrorCode28.INVALID_CONFIGURABLE_CONSTANTS,
|
11724
11769
|
`Error setting configurable constants: ${err.message}.`
|
11725
11770
|
);
|
@@ -11776,7 +11821,7 @@ var Predicate = class extends Account {
|
|
11776
11821
|
import { ErrorCode as ErrorCode29, FuelError as FuelError33 } from "@fuel-ts/errors";
|
11777
11822
|
|
11778
11823
|
// src/connectors/fuel-connector.ts
|
11779
|
-
import { FuelError as
|
11824
|
+
import { FuelError as FuelError32 } from "@fuel-ts/errors";
|
11780
11825
|
import { EventEmitter as EventEmitter2 } from "events";
|
11781
11826
|
|
11782
11827
|
// src/connectors/types/connector-types.ts
|
@@ -11851,7 +11896,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11851
11896
|
* @returns Always true.
|
11852
11897
|
*/
|
11853
11898
|
async ping() {
|
11854
|
-
throw new
|
11899
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11855
11900
|
}
|
11856
11901
|
/**
|
11857
11902
|
* Should return the current version of the connector
|
@@ -11860,7 +11905,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11860
11905
|
* @returns boolean - connection status.
|
11861
11906
|
*/
|
11862
11907
|
async version() {
|
11863
|
-
throw new
|
11908
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11864
11909
|
}
|
11865
11910
|
/**
|
11866
11911
|
* Should return true if the connector is connected
|
@@ -11869,7 +11914,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11869
11914
|
* @returns The connection status.
|
11870
11915
|
*/
|
11871
11916
|
async isConnected() {
|
11872
|
-
throw new
|
11917
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11873
11918
|
}
|
11874
11919
|
/**
|
11875
11920
|
* Should return all the accounts authorized for the
|
@@ -11878,7 +11923,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11878
11923
|
* @returns The accounts addresses strings
|
11879
11924
|
*/
|
11880
11925
|
async accounts() {
|
11881
|
-
throw new
|
11926
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11882
11927
|
}
|
11883
11928
|
/**
|
11884
11929
|
* Should start the connection process and return
|
@@ -11890,7 +11935,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11890
11935
|
* @returns boolean - connection status.
|
11891
11936
|
*/
|
11892
11937
|
async connect() {
|
11893
|
-
throw new
|
11938
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11894
11939
|
}
|
11895
11940
|
/**
|
11896
11941
|
* Should disconnect the current connection and
|
@@ -11900,7 +11945,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11900
11945
|
* @returns The connection status.
|
11901
11946
|
*/
|
11902
11947
|
async disconnect() {
|
11903
|
-
throw new
|
11948
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11904
11949
|
}
|
11905
11950
|
/**
|
11906
11951
|
* Should start the sign message process and return
|
@@ -11912,7 +11957,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11912
11957
|
* @returns Message signature
|
11913
11958
|
*/
|
11914
11959
|
async signMessage(_address, _message) {
|
11915
|
-
throw new
|
11960
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11916
11961
|
}
|
11917
11962
|
/**
|
11918
11963
|
* Should start the sign transaction process and return
|
@@ -11924,7 +11969,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11924
11969
|
* @returns Transaction signature
|
11925
11970
|
*/
|
11926
11971
|
async signTransaction(_address, _transaction) {
|
11927
|
-
throw new
|
11972
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11928
11973
|
}
|
11929
11974
|
/**
|
11930
11975
|
* Should start the send transaction process and return
|
@@ -11940,7 +11985,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11940
11985
|
* @returns The transaction id or transaction response
|
11941
11986
|
*/
|
11942
11987
|
async sendTransaction(_address, _transaction, _params) {
|
11943
|
-
throw new
|
11988
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11944
11989
|
}
|
11945
11990
|
/**
|
11946
11991
|
* Should return the current account selected inside the connector, if the account
|
@@ -11951,7 +11996,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11951
11996
|
* @returns The current account selected otherwise null.
|
11952
11997
|
*/
|
11953
11998
|
async currentAccount() {
|
11954
|
-
throw new
|
11999
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11955
12000
|
}
|
11956
12001
|
/**
|
11957
12002
|
* Should add the assets metadata to the connector and return true if the asset
|
@@ -11965,7 +12010,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11965
12010
|
* @returns True if the asset was added successfully
|
11966
12011
|
*/
|
11967
12012
|
async addAssets(_assets) {
|
11968
|
-
throw new
|
12013
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11969
12014
|
}
|
11970
12015
|
/**
|
11971
12016
|
* Should add the asset metadata to the connector and return true if the asset
|
@@ -11979,7 +12024,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11979
12024
|
* @returns True if the asset was added successfully
|
11980
12025
|
*/
|
11981
12026
|
async addAsset(_asset) {
|
11982
|
-
throw new
|
12027
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11983
12028
|
}
|
11984
12029
|
/**
|
11985
12030
|
* Should return all the assets added to the connector. If a connection is already established.
|
@@ -11987,7 +12032,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11987
12032
|
* @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
|
11988
12033
|
*/
|
11989
12034
|
async assets() {
|
11990
|
-
throw new
|
12035
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
11991
12036
|
}
|
11992
12037
|
/**
|
11993
12038
|
* Should start the add network process and return true if the network was added successfully.
|
@@ -11998,7 +12043,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
11998
12043
|
* @returns Return true if the network was added successfully
|
11999
12044
|
*/
|
12000
12045
|
async addNetwork(_networkUrl) {
|
12001
|
-
throw new
|
12046
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12002
12047
|
}
|
12003
12048
|
/**
|
12004
12049
|
* Should start the select network process and return true if the network has change successfully.
|
@@ -12009,7 +12054,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
12009
12054
|
* @returns Return true if the network was added successfully
|
12010
12055
|
*/
|
12011
12056
|
async selectNetwork(_network) {
|
12012
|
-
throw new
|
12057
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12013
12058
|
}
|
12014
12059
|
/**
|
12015
12060
|
* Should return all the networks available from the connector. If the connection is already established.
|
@@ -12017,7 +12062,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
12017
12062
|
* @returns Return all the networks added to the connector.
|
12018
12063
|
*/
|
12019
12064
|
async networks() {
|
12020
|
-
throw new
|
12065
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12021
12066
|
}
|
12022
12067
|
/**
|
12023
12068
|
* Should return the current network selected inside the connector. Even if the connection is not established.
|
@@ -12025,7 +12070,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
12025
12070
|
* @returns Return the current network selected inside the connector.
|
12026
12071
|
*/
|
12027
12072
|
async currentNetwork() {
|
12028
|
-
throw new
|
12073
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12029
12074
|
}
|
12030
12075
|
/**
|
12031
12076
|
* Should add the ABI to the connector and return true if the ABI was added successfully.
|
@@ -12035,7 +12080,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
12035
12080
|
* @returns Return true if the ABI was added successfully.
|
12036
12081
|
*/
|
12037
12082
|
async addABI(_contractId, _abi) {
|
12038
|
-
throw new
|
12083
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12039
12084
|
}
|
12040
12085
|
/**
|
12041
12086
|
* Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
|
@@ -12044,7 +12089,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
12044
12089
|
* @returns The ABI if it exists, otherwise return null.
|
12045
12090
|
*/
|
12046
12091
|
async getABI(_id) {
|
12047
|
-
throw new
|
12092
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12048
12093
|
}
|
12049
12094
|
/**
|
12050
12095
|
* Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
|
@@ -12053,7 +12098,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
12053
12098
|
* @returns Returns true if the abi exists or false if not.
|
12054
12099
|
*/
|
12055
12100
|
async hasABI(_id) {
|
12056
|
-
throw new
|
12101
|
+
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
12057
12102
|
}
|
12058
12103
|
/**
|
12059
12104
|
* Event listener for the connector.
|
@@ -12096,25 +12141,6 @@ function dispatchFuelConnectorEvent(connector) {
|
|
12096
12141
|
);
|
12097
12142
|
}
|
12098
12143
|
|
12099
|
-
// src/connectors/utils/promises.ts
|
12100
|
-
import { FuelError as FuelError32 } from "@fuel-ts/errors";
|
12101
|
-
function deferPromise() {
|
12102
|
-
const defer = {};
|
12103
|
-
defer.promise = new Promise((resolve, reject) => {
|
12104
|
-
defer.reject = reject;
|
12105
|
-
defer.resolve = resolve;
|
12106
|
-
});
|
12107
|
-
return defer;
|
12108
|
-
}
|
12109
|
-
async function withTimeout(promise, timeout = 1050) {
|
12110
|
-
const timeoutPromise = new Promise((resolve, reject) => {
|
12111
|
-
setTimeout(() => {
|
12112
|
-
reject(new FuelError32(FuelError32.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
12113
|
-
}, timeout);
|
12114
|
-
});
|
12115
|
-
return Promise.race([timeoutPromise, promise]);
|
12116
|
-
}
|
12117
|
-
|
12118
12144
|
// src/connectors/fuel.ts
|
12119
12145
|
var HAS_CONNECTOR_TIMEOUT = 2e3;
|
12120
12146
|
var PING_CACHE_TIME = 5e3;
|