@fuel-ts/account 0.0.0-rc-1866-20240322113439 → 0.0.0-rc-1889-20240322122653
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/account-E9nGNf5X.d.mts +3837 -0
- package/dist/account-E9nGNf5X.d.ts +3837 -0
- package/dist/configs.d.mts +3 -0
- package/dist/configs.d.ts +3 -2
- package/dist/index.d.mts +904 -0
- package/dist/index.d.ts +904 -13
- package/dist/index.global.js +385 -454
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +202 -248
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +202 -250
- package/dist/index.mjs.map +1 -1
- package/dist/test-utils.d.mts +66 -0
- package/dist/{test-utils/launchNode.d.ts → test-utils.d.ts} +24 -12
- package/dist/test-utils.global.js +289 -332
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +102 -125
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +102 -127
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +21 -25
- package/dist/account.d.ts +0 -177
- package/dist/account.d.ts.map +0 -1
- package/dist/configs.d.ts.map +0 -1
- package/dist/connectors/fuel-connector.d.ts +0 -188
- package/dist/connectors/fuel-connector.d.ts.map +0 -1
- package/dist/connectors/fuel.d.ts +0 -133
- package/dist/connectors/fuel.d.ts.map +0 -1
- package/dist/connectors/index.d.ts +0 -5
- package/dist/connectors/index.d.ts.map +0 -1
- package/dist/connectors/types/connector-metadata.d.ts +0 -12
- package/dist/connectors/types/connector-metadata.d.ts.map +0 -1
- package/dist/connectors/types/connector-types.d.ts +0 -34
- package/dist/connectors/types/connector-types.d.ts.map +0 -1
- package/dist/connectors/types/data-type.d.ts +0 -34
- package/dist/connectors/types/data-type.d.ts.map +0 -1
- package/dist/connectors/types/events.d.ts +0 -111
- package/dist/connectors/types/events.d.ts.map +0 -1
- package/dist/connectors/types/index.d.ts +0 -7
- package/dist/connectors/types/index.d.ts.map +0 -1
- package/dist/connectors/types/local-storage.d.ts +0 -11
- package/dist/connectors/types/local-storage.d.ts.map +0 -1
- package/dist/connectors/types/target-object.d.ts +0 -14
- package/dist/connectors/types/target-object.d.ts.map +0 -1
- package/dist/connectors/utils/cache.d.ts +0 -14
- package/dist/connectors/utils/cache.d.ts.map +0 -1
- package/dist/connectors/utils/dispatch-fuel-connector-event.d.ts +0 -7
- package/dist/connectors/utils/dispatch-fuel-connector-event.d.ts.map +0 -1
- package/dist/connectors/utils/index.d.ts +0 -4
- package/dist/connectors/utils/index.d.ts.map +0 -1
- package/dist/connectors/utils/promises.d.ts +0 -8
- package/dist/connectors/utils/promises.d.ts.map +0 -1
- package/dist/hdwallet/hdwallet.d.ts +0 -58
- package/dist/hdwallet/hdwallet.d.ts.map +0 -1
- package/dist/hdwallet/index.d.ts +0 -2
- package/dist/hdwallet/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mnemonic/index.d.ts +0 -3
- package/dist/mnemonic/index.d.ts.map +0 -1
- package/dist/mnemonic/mnemonic.d.ts +0 -85
- package/dist/mnemonic/mnemonic.d.ts.map +0 -1
- package/dist/mnemonic/utils.d.ts +0 -8
- package/dist/mnemonic/utils.d.ts.map +0 -1
- package/dist/predicate/index.d.ts +0 -3
- package/dist/predicate/index.d.ts.map +0 -1
- package/dist/predicate/predicate.d.ts +0 -94
- package/dist/predicate/predicate.d.ts.map +0 -1
- package/dist/predicate/utils/getPredicateRoot.d.ts +0 -12
- package/dist/predicate/utils/getPredicateRoot.d.ts.map +0 -1
- package/dist/predicate/utils/index.d.ts +0 -2
- package/dist/predicate/utils/index.d.ts.map +0 -1
- package/dist/providers/__generated__/operations.d.ts +0 -3477
- package/dist/providers/__generated__/operations.d.ts.map +0 -1
- package/dist/providers/assets/index.d.ts +0 -5
- package/dist/providers/assets/index.d.ts.map +0 -1
- package/dist/providers/assets/types.d.ts +0 -36
- package/dist/providers/assets/types.d.ts.map +0 -1
- package/dist/providers/assets/utils/index.d.ts +0 -4
- package/dist/providers/assets/utils/index.d.ts.map +0 -1
- package/dist/providers/assets/utils/network.d.ts +0 -33
- package/dist/providers/assets/utils/network.d.ts.map +0 -1
- package/dist/providers/assets/utils/resolveIconPaths.d.ts +0 -14
- package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +0 -1
- package/dist/providers/assets/utils/url.d.ts +0 -2
- package/dist/providers/assets/utils/url.d.ts.map +0 -1
- package/dist/providers/chains.d.ts +0 -11
- package/dist/providers/chains.d.ts.map +0 -1
- package/dist/providers/coin-quantity.d.ts +0 -21
- package/dist/providers/coin-quantity.d.ts.map +0 -1
- package/dist/providers/coin.d.ts +0 -15
- package/dist/providers/coin.d.ts.map +0 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts +0 -23
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -13
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/memory-cache.d.ts +0 -11
- package/dist/providers/memory-cache.d.ts.map +0 -1
- package/dist/providers/message.d.ts +0 -60
- package/dist/providers/message.d.ts.map +0 -1
- package/dist/providers/provider.d.ts +0 -522
- package/dist/providers/provider.d.ts.map +0 -1
- package/dist/providers/resource.d.ts +0 -37
- package/dist/providers/resource.d.ts.map +0 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +0 -73
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +0 -1
- package/dist/providers/transaction-request/errors.d.ts +0 -25
- package/dist/providers/transaction-request/errors.d.ts.map +0 -1
- package/dist/providers/transaction-request/hash-transaction.d.ts +0 -9
- package/dist/providers/transaction-request/hash-transaction.d.ts.map +0 -1
- package/dist/providers/transaction-request/index.d.ts +0 -10
- package/dist/providers/transaction-request/index.d.ts.map +0 -1
- package/dist/providers/transaction-request/input.d.ts +0 -59
- package/dist/providers/transaction-request/input.d.ts.map +0 -1
- package/dist/providers/transaction-request/output.d.ts +0 -39
- package/dist/providers/transaction-request/output.d.ts.map +0 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +0 -106
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +0 -1
- package/dist/providers/transaction-request/scripts.d.ts +0 -6
- package/dist/providers/transaction-request/scripts.d.ts.map +0 -1
- package/dist/providers/transaction-request/storage-slot.d.ts +0 -10
- package/dist/providers/transaction-request/storage-slot.d.ts.map +0 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +0 -259
- package/dist/providers/transaction-request/transaction-request.d.ts.map +0 -1
- package/dist/providers/transaction-request/types.d.ts +0 -10
- package/dist/providers/transaction-request/types.d.ts.map +0 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -4
- package/dist/providers/transaction-request/utils.d.ts.map +0 -1
- package/dist/providers/transaction-request/witness.d.ts +0 -5
- package/dist/providers/transaction-request/witness.d.ts.map +0 -1
- package/dist/providers/transaction-response/getDecodedLogs.d.ts +0 -5
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +0 -1
- package/dist/providers/transaction-response/index.d.ts +0 -3
- package/dist/providers/transaction-response/index.d.ts.map +0 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +0 -106
- package/dist/providers/transaction-response/transaction-response.d.ts.map +0 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -20
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +0 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +0 -21
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +0 -1
- package/dist/providers/transaction-summary/call.d.ts +0 -18
- package/dist/providers/transaction-summary/call.d.ts.map +0 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts +0 -31
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +0 -1
- package/dist/providers/transaction-summary/index.d.ts +0 -10
- package/dist/providers/transaction-summary/index.d.ts.map +0 -1
- package/dist/providers/transaction-summary/input.d.ts +0 -21
- package/dist/providers/transaction-summary/input.d.ts.map +0 -1
- package/dist/providers/transaction-summary/operations.d.ts +0 -40
- package/dist/providers/transaction-summary/operations.d.ts.map +0 -1
- package/dist/providers/transaction-summary/output.d.ts +0 -15
- package/dist/providers/transaction-summary/output.d.ts.map +0 -1
- package/dist/providers/transaction-summary/receipt.d.ts +0 -7
- package/dist/providers/transaction-summary/receipt.d.ts.map +0 -1
- package/dist/providers/transaction-summary/status.d.ts +0 -9
- package/dist/providers/transaction-summary/status.d.ts.map +0 -1
- package/dist/providers/transaction-summary/types.d.ts +0 -146
- package/dist/providers/transaction-summary/types.d.ts.map +0 -1
- package/dist/providers/utils/auto-retry-fetch.d.ts +0 -36
- package/dist/providers/utils/auto-retry-fetch.d.ts.map +0 -1
- package/dist/providers/utils/block-explorer.d.ts +0 -14
- package/dist/providers/utils/block-explorer.d.ts.map +0 -1
- package/dist/providers/utils/gas.d.ts +0 -38
- package/dist/providers/utils/gas.d.ts.map +0 -1
- package/dist/providers/utils/index.d.ts +0 -6
- package/dist/providers/utils/index.d.ts.map +0 -1
- package/dist/providers/utils/json.d.ts +0 -7
- package/dist/providers/utils/json.d.ts.map +0 -1
- package/dist/providers/utils/merge-quantities.d.ts +0 -3
- package/dist/providers/utils/merge-quantities.d.ts.map +0 -1
- package/dist/providers/utils/receipts.d.ts +0 -10
- package/dist/providers/utils/receipts.d.ts.map +0 -1
- package/dist/providers/utils/sleep.d.ts +0 -3
- package/dist/providers/utils/sleep.d.ts.map +0 -1
- package/dist/signer/index.d.ts +0 -2
- package/dist/signer/index.d.ts.map +0 -1
- package/dist/signer/signer.d.ts +0 -64
- package/dist/signer/signer.d.ts.map +0 -1
- package/dist/test-utils/generateTestWallet.d.ts +0 -4
- package/dist/test-utils/generateTestWallet.d.ts.map +0 -1
- package/dist/test-utils/index.d.ts +0 -4
- package/dist/test-utils/index.d.ts.map +0 -1
- package/dist/test-utils/launchNode.d.ts.map +0 -1
- package/dist/test-utils/seedTestWallet.d.ts +0 -4
- package/dist/test-utils/seedTestWallet.d.ts.map +0 -1
- package/dist/utils/formatTransferToContractScriptData.d.ts +0 -14
- package/dist/utils/formatTransferToContractScriptData.d.ts.map +0 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +0 -73
- package/dist/wallet/base-wallet-unlocked.d.ts.map +0 -1
- package/dist/wallet/index.d.ts +0 -4
- package/dist/wallet/index.d.ts.map +0 -1
- package/dist/wallet/keystore-wallet.d.ts +0 -38
- package/dist/wallet/keystore-wallet.d.ts.map +0 -1
- package/dist/wallet/wallet.d.ts +0 -68
- package/dist/wallet/wallet.d.ts.map +0 -1
- package/dist/wallet/wallets.d.ts +0 -76
- package/dist/wallet/wallets.d.ts.map +0 -1
- package/dist/wallet-manager/index.d.ts +0 -6
- package/dist/wallet-manager/index.d.ts.map +0 -1
- package/dist/wallet-manager/storages/memory-storage.d.ts +0 -9
- package/dist/wallet-manager/storages/memory-storage.d.ts.map +0 -1
- package/dist/wallet-manager/types.d.ts +0 -42
- package/dist/wallet-manager/types.d.ts.map +0 -1
- package/dist/wallet-manager/vaults/mnemonic-vault.d.ts +0 -29
- package/dist/wallet-manager/vaults/mnemonic-vault.d.ts.map +0 -1
- package/dist/wallet-manager/vaults/privatekey-vault.d.ts +0 -29
- package/dist/wallet-manager/vaults/privatekey-vault.d.ts.map +0 -1
- package/dist/wallet-manager/wallet-manager.d.ts +0 -104
- package/dist/wallet-manager/wallet-manager.d.ts.map +0 -1
- package/dist/wordlists/index.d.ts +0 -5
- package/dist/wordlists/index.d.ts.map +0 -1
- package/dist/wordlists/words/english.d.ts +0 -2
- package/dist/wordlists/words/english.d.ts.map +0 -1
package/dist/test-utils.js
CHANGED
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
9
8
|
var __export = (target, all) => {
|
10
9
|
for (var name in all)
|
11
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -27,23 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
27
26
|
mod
|
28
27
|
));
|
29
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
30
|
-
var __publicField = (obj, key, value) => {
|
31
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
32
|
-
return value;
|
33
|
-
};
|
34
|
-
var __accessCheck = (obj, member, msg) => {
|
35
|
-
if (!member.has(obj))
|
36
|
-
throw TypeError("Cannot " + msg);
|
37
|
-
};
|
38
|
-
var __privateAdd = (obj, member, value) => {
|
39
|
-
if (member.has(obj))
|
40
|
-
throw TypeError("Cannot add the same private member more than once");
|
41
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
42
|
-
};
|
43
|
-
var __privateMethod = (obj, member, method) => {
|
44
|
-
__accessCheck(obj, member, "access private method");
|
45
|
-
return method;
|
46
|
-
};
|
47
29
|
|
48
30
|
// src/test-utils/index.ts
|
49
31
|
var test_utils_exports = {};
|
@@ -924,11 +906,12 @@ function getSdk(requester) {
|
|
924
906
|
// src/providers/fuel-graphql-subscriber.ts
|
925
907
|
var import_errors = require("@fuel-ts/errors");
|
926
908
|
var import_graphql = require("graphql");
|
927
|
-
var
|
909
|
+
var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
|
928
910
|
constructor(options) {
|
929
911
|
this.options = options;
|
930
912
|
}
|
931
913
|
stream;
|
914
|
+
static textDecoder = new TextDecoder();
|
932
915
|
async setStream() {
|
933
916
|
const { url, query, variables, fetchFn } = this.options;
|
934
917
|
const response = await fetchFn(`${url}-sub`, {
|
@@ -988,8 +971,6 @@ var _FuelGraphqlSubscriber = class {
|
|
988
971
|
return this;
|
989
972
|
}
|
990
973
|
};
|
991
|
-
var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
|
992
|
-
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
993
974
|
|
994
975
|
// src/providers/memory-cache.ts
|
995
976
|
var import_errors2 = require("@fuel-ts/errors");
|
@@ -1538,7 +1519,7 @@ var witnessify = (value) => {
|
|
1538
1519
|
};
|
1539
1520
|
|
1540
1521
|
// src/providers/transaction-request/transaction-request.ts
|
1541
|
-
var BaseTransactionRequest = class {
|
1522
|
+
var BaseTransactionRequest = class _BaseTransactionRequest {
|
1542
1523
|
/** Gas price for transaction */
|
1543
1524
|
gasPrice;
|
1544
1525
|
/** Block until which tx cannot be included */
|
@@ -1608,7 +1589,7 @@ var BaseTransactionRequest = class {
|
|
1608
1589
|
const inputs = this.inputs?.map(inputify) ?? [];
|
1609
1590
|
const outputs = this.outputs?.map(outputify) ?? [];
|
1610
1591
|
const witnesses = this.witnesses?.map(witnessify) ?? [];
|
1611
|
-
const { policyTypes, policies } =
|
1592
|
+
const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
|
1612
1593
|
return {
|
1613
1594
|
policyTypes,
|
1614
1595
|
inputs,
|
@@ -3146,7 +3127,7 @@ function assembleTransactionSummary(params) {
|
|
3146
3127
|
}
|
3147
3128
|
|
3148
3129
|
// src/providers/transaction-response/transaction-response.ts
|
3149
|
-
var TransactionResponse = class {
|
3130
|
+
var TransactionResponse = class _TransactionResponse {
|
3150
3131
|
/** Transaction ID */
|
3151
3132
|
id;
|
3152
3133
|
/** Current provider */
|
@@ -3174,7 +3155,7 @@ var TransactionResponse = class {
|
|
3174
3155
|
* @param provider - The provider.
|
3175
3156
|
*/
|
3176
3157
|
static async create(id, provider) {
|
3177
|
-
const response = new
|
3158
|
+
const response = new _TransactionResponse(id, provider);
|
3178
3159
|
await response.fetch();
|
3179
3160
|
return response;
|
3180
3161
|
}
|
@@ -3389,8 +3370,7 @@ var processGqlChain = (chain) => {
|
|
3389
3370
|
}
|
3390
3371
|
};
|
3391
3372
|
};
|
3392
|
-
var
|
3393
|
-
var _Provider = class {
|
3373
|
+
var Provider = class _Provider {
|
3394
3374
|
/**
|
3395
3375
|
* Constructor to initialize a Provider.
|
3396
3376
|
*
|
@@ -3401,27 +3381,25 @@ var _Provider = class {
|
|
3401
3381
|
*/
|
3402
3382
|
constructor(url, options = {}) {
|
3403
3383
|
this.url = url;
|
3404
|
-
/**
|
3405
|
-
* @hidden
|
3406
|
-
*/
|
3407
|
-
__privateAdd(this, _cacheInputs);
|
3408
|
-
__publicField(this, "operations");
|
3409
|
-
__publicField(this, "cache");
|
3410
|
-
__publicField(this, "options", {
|
3411
|
-
timeout: void 0,
|
3412
|
-
cacheUtxo: void 0,
|
3413
|
-
fetch: void 0,
|
3414
|
-
retryOptions: void 0
|
3415
|
-
});
|
3416
3384
|
this.options = { ...this.options, ...options };
|
3417
3385
|
this.url = url;
|
3418
3386
|
this.operations = this.createOperations();
|
3419
3387
|
this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
|
3420
3388
|
}
|
3389
|
+
operations;
|
3390
|
+
cache;
|
3421
3391
|
static clearChainAndNodeCaches() {
|
3422
3392
|
_Provider.nodeInfoCache = {};
|
3423
3393
|
_Provider.chainInfoCache = {};
|
3424
3394
|
}
|
3395
|
+
static chainInfoCache = {};
|
3396
|
+
static nodeInfoCache = {};
|
3397
|
+
options = {
|
3398
|
+
timeout: void 0,
|
3399
|
+
cacheUtxo: void 0,
|
3400
|
+
fetch: void 0,
|
3401
|
+
retryOptions: void 0
|
3402
|
+
};
|
3425
3403
|
static getFetchFn(options) {
|
3426
3404
|
const { retryOptions, timeout } = options;
|
3427
3405
|
return autoRetryFetch(async (...args) => {
|
@@ -3618,6 +3596,19 @@ var _Provider = class {
|
|
3618
3596
|
} = this.getChain();
|
3619
3597
|
return chainId.toNumber();
|
3620
3598
|
}
|
3599
|
+
/**
|
3600
|
+
* @hidden
|
3601
|
+
*/
|
3602
|
+
#cacheInputs(inputs) {
|
3603
|
+
if (!this.cache) {
|
3604
|
+
return;
|
3605
|
+
}
|
3606
|
+
inputs.forEach((input) => {
|
3607
|
+
if (input.type === import_transactions17.InputType.Coin) {
|
3608
|
+
this.cache?.set(input.id);
|
3609
|
+
}
|
3610
|
+
});
|
3611
|
+
}
|
3621
3612
|
/**
|
3622
3613
|
* Submits a transaction to the chain to be executed.
|
3623
3614
|
*
|
@@ -3630,7 +3621,7 @@ var _Provider = class {
|
|
3630
3621
|
// #region Provider-sendTransaction
|
3631
3622
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution = false } = {}) {
|
3632
3623
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
3633
|
-
|
3624
|
+
this.#cacheInputs(transactionRequest.inputs);
|
3634
3625
|
if (estimateTxDependencies) {
|
3635
3626
|
await this.estimateTxDependencies(transactionRequest);
|
3636
3627
|
}
|
@@ -4255,20 +4246,6 @@ var _Provider = class {
|
|
4255
4246
|
return new TransactionResponse(transactionId, this);
|
4256
4247
|
}
|
4257
4248
|
};
|
4258
|
-
var Provider = _Provider;
|
4259
|
-
_cacheInputs = new WeakSet();
|
4260
|
-
cacheInputs_fn = function(inputs) {
|
4261
|
-
if (!this.cache) {
|
4262
|
-
return;
|
4263
|
-
}
|
4264
|
-
inputs.forEach((input) => {
|
4265
|
-
if (input.type === import_transactions17.InputType.Coin) {
|
4266
|
-
this.cache?.set(input.id);
|
4267
|
-
}
|
4268
|
-
});
|
4269
|
-
};
|
4270
|
-
__publicField(Provider, "chainInfoCache", {});
|
4271
|
-
__publicField(Provider, "nodeInfoCache", {});
|
4272
4249
|
|
4273
4250
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4274
4251
|
var import_errors14 = require("@fuel-ts/errors");
|
@@ -4769,7 +4746,7 @@ var import_hasher2 = require("@fuel-ts/hasher");
|
|
4769
4746
|
var import_math18 = require("@fuel-ts/math");
|
4770
4747
|
var import_utils28 = require("@fuel-ts/utils");
|
4771
4748
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
4772
|
-
var Signer = class {
|
4749
|
+
var Signer = class _Signer {
|
4773
4750
|
address;
|
4774
4751
|
publicKey;
|
4775
4752
|
compressedPublicKey;
|
@@ -4848,7 +4825,7 @@ var Signer = class {
|
|
4848
4825
|
* @returns Address from signature
|
4849
4826
|
*/
|
4850
4827
|
static recoverAddress(data, signature) {
|
4851
|
-
return import_address5.Address.fromPublicKey(
|
4828
|
+
return import_address5.Address.fromPublicKey(_Signer.recoverPublicKey(data, signature));
|
4852
4829
|
}
|
4853
4830
|
/**
|
4854
4831
|
* Generate a random privateKey
|
@@ -4964,6 +4941,10 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
4964
4941
|
|
4965
4942
|
// src/wallet/base-wallet-unlocked.ts
|
4966
4943
|
var BaseWalletUnlocked = class extends Account {
|
4944
|
+
/**
|
4945
|
+
* Default HDWallet path.
|
4946
|
+
*/
|
4947
|
+
static defaultPath = "m/44'/1179993420'/0'/0/0";
|
4967
4948
|
/**
|
4968
4949
|
* A function that returns the wallet's signer.
|
4969
4950
|
*/
|
@@ -5069,10 +5050,6 @@ var BaseWalletUnlocked = class extends Account {
|
|
5069
5050
|
return encryptKeystoreWallet(this.privateKey, this.address, password);
|
5070
5051
|
}
|
5071
5052
|
};
|
5072
|
-
/**
|
5073
|
-
* Default HDWallet path.
|
5074
|
-
*/
|
5075
|
-
__publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
5076
5053
|
|
5077
5054
|
// src/hdwallet/hdwallet.ts
|
5078
5055
|
var import_errors19 = require("@fuel-ts/errors");
|
@@ -7276,7 +7253,7 @@ function assertMnemonic(words) {
|
|
7276
7253
|
throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
|
7277
7254
|
}
|
7278
7255
|
}
|
7279
|
-
var Mnemonic = class {
|
7256
|
+
var Mnemonic = class _Mnemonic {
|
7280
7257
|
wordlist;
|
7281
7258
|
/**
|
7282
7259
|
*
|
@@ -7293,7 +7270,7 @@ var Mnemonic = class {
|
|
7293
7270
|
* @returns Entropy hash
|
7294
7271
|
*/
|
7295
7272
|
mnemonicToEntropy(phrase) {
|
7296
|
-
return
|
7273
|
+
return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
|
7297
7274
|
}
|
7298
7275
|
/**
|
7299
7276
|
*
|
@@ -7301,7 +7278,7 @@ var Mnemonic = class {
|
|
7301
7278
|
* @returns Mnemonic phrase
|
7302
7279
|
*/
|
7303
7280
|
entropyToMnemonic(entropy) {
|
7304
|
-
return
|
7281
|
+
return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
|
7305
7282
|
}
|
7306
7283
|
/**
|
7307
7284
|
*
|
@@ -7342,8 +7319,8 @@ var Mnemonic = class {
|
|
7342
7319
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
7343
7320
|
*/
|
7344
7321
|
static mnemonicToMasterKeys(phrase, passphrase = "") {
|
7345
|
-
const seed =
|
7346
|
-
return
|
7322
|
+
const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
|
7323
|
+
return _Mnemonic.masterKeysFromSeed(seed);
|
7347
7324
|
}
|
7348
7325
|
/**
|
7349
7326
|
* Validates if given mnemonic is valid
|
@@ -7359,7 +7336,7 @@ var Mnemonic = class {
|
|
7359
7336
|
return false;
|
7360
7337
|
}
|
7361
7338
|
while (i < words.length) {
|
7362
|
-
if (
|
7339
|
+
if (_Mnemonic.binarySearch(words[i]) === false) {
|
7363
7340
|
return false;
|
7364
7341
|
}
|
7365
7342
|
i += 1;
|
@@ -7406,7 +7383,7 @@ var Mnemonic = class {
|
|
7406
7383
|
* @returns BIP-32 extended private key
|
7407
7384
|
*/
|
7408
7385
|
static seedToExtendedKey(seed, testnet = false) {
|
7409
|
-
const masterKey =
|
7386
|
+
const masterKey = _Mnemonic.masterKeysFromSeed(seed);
|
7410
7387
|
const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
|
7411
7388
|
const depth = "0x00";
|
7412
7389
|
const fingerprint = "0x00000000";
|
@@ -7438,7 +7415,7 @@ var Mnemonic = class {
|
|
7438
7415
|
*/
|
7439
7416
|
static generate(size = 32, extraEntropy = "") {
|
7440
7417
|
const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils32.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils32.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
|
7441
|
-
return
|
7418
|
+
return _Mnemonic.entropyToMnemonic(entropy);
|
7442
7419
|
}
|
7443
7420
|
};
|
7444
7421
|
var mnemonic_default = Mnemonic;
|
@@ -7478,7 +7455,7 @@ function parsePath(path2, depth = 0) {
|
|
7478
7455
|
(p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
|
7479
7456
|
);
|
7480
7457
|
}
|
7481
|
-
var HDWallet = class {
|
7458
|
+
var HDWallet = class _HDWallet {
|
7482
7459
|
depth = 0;
|
7483
7460
|
index = 0;
|
7484
7461
|
fingerprint = (0, import_utils34.hexlify)("0x00000000");
|
@@ -7544,7 +7521,7 @@ var HDWallet = class {
|
|
7544
7521
|
if (privateKey) {
|
7545
7522
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
7546
7523
|
const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
|
7547
|
-
return new
|
7524
|
+
return new _HDWallet({
|
7548
7525
|
privateKey: ki,
|
7549
7526
|
chainCode: IR,
|
7550
7527
|
index,
|
@@ -7554,7 +7531,7 @@ var HDWallet = class {
|
|
7554
7531
|
}
|
7555
7532
|
const signer = new Signer((0, import_utils34.hexlify)(IL));
|
7556
7533
|
const Ki = signer.addPoint(publicKey);
|
7557
|
-
return new
|
7534
|
+
return new _HDWallet({
|
7558
7535
|
publicKey: Ki,
|
7559
7536
|
chainCode: IR,
|
7560
7537
|
index,
|
@@ -7603,7 +7580,7 @@ var HDWallet = class {
|
|
7603
7580
|
*/
|
7604
7581
|
static fromSeed(seed) {
|
7605
7582
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
7606
|
-
return new
|
7583
|
+
return new _HDWallet({
|
7607
7584
|
chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
|
7608
7585
|
privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
|
7609
7586
|
});
|
@@ -7633,7 +7610,7 @@ var HDWallet = class {
|
|
7633
7610
|
if (key[0] !== 3) {
|
7634
7611
|
throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
7635
7612
|
}
|
7636
|
-
return new
|
7613
|
+
return new _HDWallet({
|
7637
7614
|
publicKey: key,
|
7638
7615
|
chainCode,
|
7639
7616
|
index,
|
@@ -7644,7 +7621,7 @@ var HDWallet = class {
|
|
7644
7621
|
if (key[0] !== 0) {
|
7645
7622
|
throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
|
7646
7623
|
}
|
7647
|
-
return new
|
7624
|
+
return new _HDWallet({
|
7648
7625
|
privateKey: key.slice(1),
|
7649
7626
|
chainCode,
|
7650
7627
|
index,
|
@@ -7667,7 +7644,7 @@ var WalletLocked = class extends Account {
|
|
7667
7644
|
return new WalletUnlocked(privateKey, this._provider);
|
7668
7645
|
}
|
7669
7646
|
};
|
7670
|
-
var WalletUnlocked = class extends BaseWalletUnlocked {
|
7647
|
+
var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
|
7671
7648
|
/**
|
7672
7649
|
* Locks the wallet and returns an instance of WalletLocked.
|
7673
7650
|
*
|
@@ -7685,7 +7662,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7685
7662
|
*/
|
7686
7663
|
static generate(generateOptions) {
|
7687
7664
|
const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
|
7688
|
-
return new
|
7665
|
+
return new _WalletUnlocked(privateKey, generateOptions?.provider);
|
7689
7666
|
}
|
7690
7667
|
/**
|
7691
7668
|
* Create a Wallet Unlocked from a seed.
|
@@ -7697,8 +7674,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7697
7674
|
*/
|
7698
7675
|
static fromSeed(seed, path2, provider) {
|
7699
7676
|
const hdWallet = hdwallet_default.fromSeed(seed);
|
7700
|
-
const childWallet = hdWallet.derivePath(path2 ||
|
7701
|
-
return new
|
7677
|
+
const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
|
7678
|
+
return new _WalletUnlocked(childWallet.privateKey, provider);
|
7702
7679
|
}
|
7703
7680
|
/**
|
7704
7681
|
* Create a Wallet Unlocked from a mnemonic phrase.
|
@@ -7712,8 +7689,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7712
7689
|
static fromMnemonic(mnemonic, path2, passphrase, provider) {
|
7713
7690
|
const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
|
7714
7691
|
const hdWallet = hdwallet_default.fromSeed(seed);
|
7715
|
-
const childWallet = hdWallet.derivePath(path2 ||
|
7716
|
-
return new
|
7692
|
+
const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
|
7693
|
+
return new _WalletUnlocked(childWallet.privateKey, provider);
|
7717
7694
|
}
|
7718
7695
|
/**
|
7719
7696
|
* Create a Wallet Unlocked from an extended key.
|
@@ -7724,7 +7701,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7724
7701
|
*/
|
7725
7702
|
static fromExtendedKey(extendedKey, provider) {
|
7726
7703
|
const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
|
7727
|
-
return new
|
7704
|
+
return new _WalletUnlocked(hdWallet.privateKey, provider);
|
7728
7705
|
}
|
7729
7706
|
/**
|
7730
7707
|
* Create a Wallet Unlocked from an encrypted JSON.
|
@@ -7736,7 +7713,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7736
7713
|
*/
|
7737
7714
|
static async fromEncryptedJson(jsonWallet, password, provider) {
|
7738
7715
|
const privateKey = await decryptKeystoreWallet(jsonWallet, password);
|
7739
|
-
return new
|
7716
|
+
return new _WalletUnlocked(privateKey, provider);
|
7740
7717
|
}
|
7741
7718
|
};
|
7742
7719
|
|
@@ -7762,50 +7739,50 @@ var Wallet = class {
|
|
7762
7739
|
static fromPrivateKey(privateKey, provider) {
|
7763
7740
|
return new WalletUnlocked(privateKey, provider);
|
7764
7741
|
}
|
7742
|
+
/**
|
7743
|
+
* Generate a new Wallet Unlocked with a random key pair.
|
7744
|
+
*
|
7745
|
+
* @param generateOptions - Options to customize the generation process (optional).
|
7746
|
+
* @returns An unlocked wallet instance.
|
7747
|
+
*/
|
7748
|
+
static generate = WalletUnlocked.generate;
|
7749
|
+
/**
|
7750
|
+
* Create a Wallet Unlocked from a seed.
|
7751
|
+
*
|
7752
|
+
* @param seed - The seed phrase.
|
7753
|
+
* @param provider - A Provider instance (optional).
|
7754
|
+
* @param path - The derivation path (optional).
|
7755
|
+
* @returns An unlocked wallet instance.
|
7756
|
+
*/
|
7757
|
+
static fromSeed = WalletUnlocked.fromSeed;
|
7758
|
+
/**
|
7759
|
+
* Create a Wallet Unlocked from a mnemonic phrase.
|
7760
|
+
*
|
7761
|
+
* @param mnemonic - The mnemonic phrase.
|
7762
|
+
* @param provider - A Provider instance (optional).
|
7763
|
+
* @param path - The derivation path (optional).
|
7764
|
+
* @param passphrase - The passphrase for the mnemonic (optional).
|
7765
|
+
* @returns An unlocked wallet instance.
|
7766
|
+
*/
|
7767
|
+
static fromMnemonic = WalletUnlocked.fromMnemonic;
|
7768
|
+
/**
|
7769
|
+
* Create a Wallet Unlocked from an extended key.
|
7770
|
+
*
|
7771
|
+
* @param extendedKey - The extended key.
|
7772
|
+
* @param provider - A Provider instance (optional).
|
7773
|
+
* @returns An unlocked wallet instance.
|
7774
|
+
*/
|
7775
|
+
static fromExtendedKey = WalletUnlocked.fromExtendedKey;
|
7776
|
+
/**
|
7777
|
+
* Create a Wallet Unlocked from an encrypted JSON.
|
7778
|
+
*
|
7779
|
+
* @param jsonWallet - The encrypted JSON keystore.
|
7780
|
+
* @param password - The password to decrypt the JSON.
|
7781
|
+
* @param provider - A Provider instance (optional).
|
7782
|
+
* @returns An unlocked wallet instance.
|
7783
|
+
*/
|
7784
|
+
static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
|
7765
7785
|
};
|
7766
|
-
/**
|
7767
|
-
* Generate a new Wallet Unlocked with a random key pair.
|
7768
|
-
*
|
7769
|
-
* @param generateOptions - Options to customize the generation process (optional).
|
7770
|
-
* @returns An unlocked wallet instance.
|
7771
|
-
*/
|
7772
|
-
__publicField(Wallet, "generate", WalletUnlocked.generate);
|
7773
|
-
/**
|
7774
|
-
* Create a Wallet Unlocked from a seed.
|
7775
|
-
*
|
7776
|
-
* @param seed - The seed phrase.
|
7777
|
-
* @param provider - A Provider instance (optional).
|
7778
|
-
* @param path - The derivation path (optional).
|
7779
|
-
* @returns An unlocked wallet instance.
|
7780
|
-
*/
|
7781
|
-
__publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
|
7782
|
-
/**
|
7783
|
-
* Create a Wallet Unlocked from a mnemonic phrase.
|
7784
|
-
*
|
7785
|
-
* @param mnemonic - The mnemonic phrase.
|
7786
|
-
* @param provider - A Provider instance (optional).
|
7787
|
-
* @param path - The derivation path (optional).
|
7788
|
-
* @param passphrase - The passphrase for the mnemonic (optional).
|
7789
|
-
* @returns An unlocked wallet instance.
|
7790
|
-
*/
|
7791
|
-
__publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
|
7792
|
-
/**
|
7793
|
-
* Create a Wallet Unlocked from an extended key.
|
7794
|
-
*
|
7795
|
-
* @param extendedKey - The extended key.
|
7796
|
-
* @param provider - A Provider instance (optional).
|
7797
|
-
* @returns An unlocked wallet instance.
|
7798
|
-
*/
|
7799
|
-
__publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
|
7800
|
-
/**
|
7801
|
-
* Create a Wallet Unlocked from an encrypted JSON.
|
7802
|
-
*
|
7803
|
-
* @param jsonWallet - The encrypted JSON keystore.
|
7804
|
-
* @param password - The password to decrypt the JSON.
|
7805
|
-
* @param provider - A Provider instance (optional).
|
7806
|
-
* @returns An unlocked wallet instance.
|
7807
|
-
*/
|
7808
|
-
__publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
7809
7786
|
|
7810
7787
|
// src/test-utils/seedTestWallet.ts
|
7811
7788
|
var import_crypto4 = require("@fuel-ts/crypto");
|