@fuel-ts/account 0.0.0-rc-1815-20240322115843 → 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 +390 -515
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +207 -309
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +207 -311
- 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 +294 -381
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +107 -174
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +107 -176
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +21 -25
- package/dist/account.d.ts +0 -184
- package/dist/account.d.ts.map +0 -1
- package/dist/configs.d.ts.map +0 -1
- package/dist/connectors/fuel-connector.d.ts +0 -198
- 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 -278
- 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,
|
@@ -1646,27 +1627,13 @@ var BaseTransactionRequest = class {
|
|
1646
1627
|
this.outputs.push(output);
|
1647
1628
|
return this.outputs.length - 1;
|
1648
1629
|
}
|
1649
|
-
/**
|
1650
|
-
* @hidden
|
1651
|
-
*
|
1652
|
-
* Pushes a witness to the list and returns the index
|
1653
|
-
*
|
1654
|
-
* @param signature - The signature to add to the witness.
|
1655
|
-
* @returns The index of the created witness.
|
1656
|
-
*/
|
1657
|
-
addWitness(signature) {
|
1658
|
-
this.witnesses.push(signature);
|
1659
|
-
return this.witnesses.length - 1;
|
1660
|
-
}
|
1661
1630
|
/**
|
1662
1631
|
* @hidden
|
1663
1632
|
*
|
1664
1633
|
* Creates an empty witness without any side effects and returns the index
|
1665
|
-
*
|
1666
|
-
* @returns The index of the created witness.
|
1667
1634
|
*/
|
1668
|
-
|
1669
|
-
this.
|
1635
|
+
createWitness() {
|
1636
|
+
this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
|
1670
1637
|
return this.witnesses.length - 1;
|
1671
1638
|
}
|
1672
1639
|
/**
|
@@ -1695,21 +1662,6 @@ var BaseTransactionRequest = class {
|
|
1695
1662
|
}
|
1696
1663
|
this.witnesses[index] = witness;
|
1697
1664
|
}
|
1698
|
-
/**
|
1699
|
-
* Helper function to add an external signature to the transaction.
|
1700
|
-
*
|
1701
|
-
* @param account - The account/s to sign to the transaction.
|
1702
|
-
* @returns The transaction with the signature witness added.
|
1703
|
-
*/
|
1704
|
-
async addAccountWitnesses(account) {
|
1705
|
-
const accounts = Array.isArray(account) ? account : [account];
|
1706
|
-
await Promise.all(
|
1707
|
-
accounts.map(async (acc) => {
|
1708
|
-
this.addWitness(await acc.signTransaction(this));
|
1709
|
-
})
|
1710
|
-
);
|
1711
|
-
return this;
|
1712
|
-
}
|
1713
1665
|
/**
|
1714
1666
|
* Gets the coin inputs for a transaction.
|
1715
1667
|
*
|
@@ -1775,7 +1727,7 @@ var BaseTransactionRequest = class {
|
|
1775
1727
|
} else {
|
1776
1728
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
1777
1729
|
if (typeof witnessIndex !== "number") {
|
1778
|
-
witnessIndex = this.
|
1730
|
+
witnessIndex = this.createWitness();
|
1779
1731
|
}
|
1780
1732
|
}
|
1781
1733
|
const input = {
|
@@ -1809,7 +1761,7 @@ var BaseTransactionRequest = class {
|
|
1809
1761
|
} else {
|
1810
1762
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
1811
1763
|
if (typeof witnessIndex !== "number") {
|
1812
|
-
witnessIndex = this.
|
1764
|
+
witnessIndex = this.createWitness();
|
1813
1765
|
}
|
1814
1766
|
}
|
1815
1767
|
const input = {
|
@@ -3175,7 +3127,7 @@ function assembleTransactionSummary(params) {
|
|
3175
3127
|
}
|
3176
3128
|
|
3177
3129
|
// src/providers/transaction-response/transaction-response.ts
|
3178
|
-
var TransactionResponse = class {
|
3130
|
+
var TransactionResponse = class _TransactionResponse {
|
3179
3131
|
/** Transaction ID */
|
3180
3132
|
id;
|
3181
3133
|
/** Current provider */
|
@@ -3203,7 +3155,7 @@ var TransactionResponse = class {
|
|
3203
3155
|
* @param provider - The provider.
|
3204
3156
|
*/
|
3205
3157
|
static async create(id, provider) {
|
3206
|
-
const response = new
|
3158
|
+
const response = new _TransactionResponse(id, provider);
|
3207
3159
|
await response.fetch();
|
3208
3160
|
return response;
|
3209
3161
|
}
|
@@ -3418,8 +3370,7 @@ var processGqlChain = (chain) => {
|
|
3418
3370
|
}
|
3419
3371
|
};
|
3420
3372
|
};
|
3421
|
-
var
|
3422
|
-
var _Provider = class {
|
3373
|
+
var Provider = class _Provider {
|
3423
3374
|
/**
|
3424
3375
|
* Constructor to initialize a Provider.
|
3425
3376
|
*
|
@@ -3430,27 +3381,25 @@ var _Provider = class {
|
|
3430
3381
|
*/
|
3431
3382
|
constructor(url, options = {}) {
|
3432
3383
|
this.url = url;
|
3433
|
-
/**
|
3434
|
-
* @hidden
|
3435
|
-
*/
|
3436
|
-
__privateAdd(this, _cacheInputs);
|
3437
|
-
__publicField(this, "operations");
|
3438
|
-
__publicField(this, "cache");
|
3439
|
-
__publicField(this, "options", {
|
3440
|
-
timeout: void 0,
|
3441
|
-
cacheUtxo: void 0,
|
3442
|
-
fetch: void 0,
|
3443
|
-
retryOptions: void 0
|
3444
|
-
});
|
3445
3384
|
this.options = { ...this.options, ...options };
|
3446
3385
|
this.url = url;
|
3447
3386
|
this.operations = this.createOperations();
|
3448
3387
|
this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
|
3449
3388
|
}
|
3389
|
+
operations;
|
3390
|
+
cache;
|
3450
3391
|
static clearChainAndNodeCaches() {
|
3451
3392
|
_Provider.nodeInfoCache = {};
|
3452
3393
|
_Provider.chainInfoCache = {};
|
3453
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
|
+
};
|
3454
3403
|
static getFetchFn(options) {
|
3455
3404
|
const { retryOptions, timeout } = options;
|
3456
3405
|
return autoRetryFetch(async (...args) => {
|
@@ -3647,6 +3596,19 @@ var _Provider = class {
|
|
3647
3596
|
} = this.getChain();
|
3648
3597
|
return chainId.toNumber();
|
3649
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
|
+
}
|
3650
3612
|
/**
|
3651
3613
|
* Submits a transaction to the chain to be executed.
|
3652
3614
|
*
|
@@ -3659,7 +3621,7 @@ var _Provider = class {
|
|
3659
3621
|
// #region Provider-sendTransaction
|
3660
3622
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution = false } = {}) {
|
3661
3623
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
3662
|
-
|
3624
|
+
this.#cacheInputs(transactionRequest.inputs);
|
3663
3625
|
if (estimateTxDependencies) {
|
3664
3626
|
await this.estimateTxDependencies(transactionRequest);
|
3665
3627
|
}
|
@@ -4284,20 +4246,6 @@ var _Provider = class {
|
|
4284
4246
|
return new TransactionResponse(transactionId, this);
|
4285
4247
|
}
|
4286
4248
|
};
|
4287
|
-
var Provider = _Provider;
|
4288
|
-
_cacheInputs = new WeakSet();
|
4289
|
-
cacheInputs_fn = function(inputs) {
|
4290
|
-
if (!this.cache) {
|
4291
|
-
return;
|
4292
|
-
}
|
4293
|
-
inputs.forEach((input) => {
|
4294
|
-
if (input.type === import_transactions17.InputType.Coin) {
|
4295
|
-
this.cache?.set(input.id);
|
4296
|
-
}
|
4297
|
-
});
|
4298
|
-
};
|
4299
|
-
__publicField(Provider, "chainInfoCache", {});
|
4300
|
-
__publicField(Provider, "nodeInfoCache", {});
|
4301
4249
|
|
4302
4250
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4303
4251
|
var import_errors14 = require("@fuel-ts/errors");
|
@@ -4736,21 +4684,6 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4736
4684
|
}
|
4737
4685
|
return this._connector.signMessage(this.address.toString(), message);
|
4738
4686
|
}
|
4739
|
-
/**
|
4740
|
-
* Signs a transaction with the wallet's private key.
|
4741
|
-
*
|
4742
|
-
* @param transactionRequestLike - The transaction request to sign.
|
4743
|
-
* @returns A promise that resolves to the signature of the transaction.
|
4744
|
-
*/
|
4745
|
-
async signTransaction(transactionRequestLike) {
|
4746
|
-
if (!this._connector) {
|
4747
|
-
throw new import_errors15.FuelError(
|
4748
|
-
import_errors15.ErrorCode.MISSING_CONNECTOR,
|
4749
|
-
"A connector is required to sign transactions."
|
4750
|
-
);
|
4751
|
-
}
|
4752
|
-
return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
|
4753
|
-
}
|
4754
4687
|
/**
|
4755
4688
|
* Sends a transaction to the network.
|
4756
4689
|
*
|
@@ -4813,7 +4746,7 @@ var import_hasher2 = require("@fuel-ts/hasher");
|
|
4813
4746
|
var import_math18 = require("@fuel-ts/math");
|
4814
4747
|
var import_utils28 = require("@fuel-ts/utils");
|
4815
4748
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
4816
|
-
var Signer = class {
|
4749
|
+
var Signer = class _Signer {
|
4817
4750
|
address;
|
4818
4751
|
publicKey;
|
4819
4752
|
compressedPublicKey;
|
@@ -4892,7 +4825,7 @@ var Signer = class {
|
|
4892
4825
|
* @returns Address from signature
|
4893
4826
|
*/
|
4894
4827
|
static recoverAddress(data, signature) {
|
4895
|
-
return import_address5.Address.fromPublicKey(
|
4828
|
+
return import_address5.Address.fromPublicKey(_Signer.recoverPublicKey(data, signature));
|
4896
4829
|
}
|
4897
4830
|
/**
|
4898
4831
|
* Generate a random privateKey
|
@@ -5008,6 +4941,10 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
5008
4941
|
|
5009
4942
|
// src/wallet/base-wallet-unlocked.ts
|
5010
4943
|
var BaseWalletUnlocked = class extends Account {
|
4944
|
+
/**
|
4945
|
+
* Default HDWallet path.
|
4946
|
+
*/
|
4947
|
+
static defaultPath = "m/44'/1179993420'/0'/0/0";
|
5011
4948
|
/**
|
5012
4949
|
* A function that returns the wallet's signer.
|
5013
4950
|
*/
|
@@ -5057,7 +4994,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5057
4994
|
*/
|
5058
4995
|
async signTransaction(transactionRequestLike) {
|
5059
4996
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
5060
|
-
const chainId = this.provider.
|
4997
|
+
const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
|
5061
4998
|
const hashedTransaction = transactionRequest.getTransactionId(chainId);
|
5062
4999
|
const signature = await this.signer().sign(hashedTransaction);
|
5063
5000
|
return (0, import_utils30.hexlify)(signature);
|
@@ -5113,10 +5050,6 @@ var BaseWalletUnlocked = class extends Account {
|
|
5113
5050
|
return encryptKeystoreWallet(this.privateKey, this.address, password);
|
5114
5051
|
}
|
5115
5052
|
};
|
5116
|
-
/**
|
5117
|
-
* Default HDWallet path.
|
5118
|
-
*/
|
5119
|
-
__publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
5120
5053
|
|
5121
5054
|
// src/hdwallet/hdwallet.ts
|
5122
5055
|
var import_errors19 = require("@fuel-ts/errors");
|
@@ -7320,7 +7253,7 @@ function assertMnemonic(words) {
|
|
7320
7253
|
throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
|
7321
7254
|
}
|
7322
7255
|
}
|
7323
|
-
var Mnemonic = class {
|
7256
|
+
var Mnemonic = class _Mnemonic {
|
7324
7257
|
wordlist;
|
7325
7258
|
/**
|
7326
7259
|
*
|
@@ -7337,7 +7270,7 @@ var Mnemonic = class {
|
|
7337
7270
|
* @returns Entropy hash
|
7338
7271
|
*/
|
7339
7272
|
mnemonicToEntropy(phrase) {
|
7340
|
-
return
|
7273
|
+
return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
|
7341
7274
|
}
|
7342
7275
|
/**
|
7343
7276
|
*
|
@@ -7345,7 +7278,7 @@ var Mnemonic = class {
|
|
7345
7278
|
* @returns Mnemonic phrase
|
7346
7279
|
*/
|
7347
7280
|
entropyToMnemonic(entropy) {
|
7348
|
-
return
|
7281
|
+
return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
|
7349
7282
|
}
|
7350
7283
|
/**
|
7351
7284
|
*
|
@@ -7386,8 +7319,8 @@ var Mnemonic = class {
|
|
7386
7319
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
7387
7320
|
*/
|
7388
7321
|
static mnemonicToMasterKeys(phrase, passphrase = "") {
|
7389
|
-
const seed =
|
7390
|
-
return
|
7322
|
+
const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
|
7323
|
+
return _Mnemonic.masterKeysFromSeed(seed);
|
7391
7324
|
}
|
7392
7325
|
/**
|
7393
7326
|
* Validates if given mnemonic is valid
|
@@ -7403,7 +7336,7 @@ var Mnemonic = class {
|
|
7403
7336
|
return false;
|
7404
7337
|
}
|
7405
7338
|
while (i < words.length) {
|
7406
|
-
if (
|
7339
|
+
if (_Mnemonic.binarySearch(words[i]) === false) {
|
7407
7340
|
return false;
|
7408
7341
|
}
|
7409
7342
|
i += 1;
|
@@ -7450,7 +7383,7 @@ var Mnemonic = class {
|
|
7450
7383
|
* @returns BIP-32 extended private key
|
7451
7384
|
*/
|
7452
7385
|
static seedToExtendedKey(seed, testnet = false) {
|
7453
|
-
const masterKey =
|
7386
|
+
const masterKey = _Mnemonic.masterKeysFromSeed(seed);
|
7454
7387
|
const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
|
7455
7388
|
const depth = "0x00";
|
7456
7389
|
const fingerprint = "0x00000000";
|
@@ -7482,7 +7415,7 @@ var Mnemonic = class {
|
|
7482
7415
|
*/
|
7483
7416
|
static generate(size = 32, extraEntropy = "") {
|
7484
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);
|
7485
|
-
return
|
7418
|
+
return _Mnemonic.entropyToMnemonic(entropy);
|
7486
7419
|
}
|
7487
7420
|
};
|
7488
7421
|
var mnemonic_default = Mnemonic;
|
@@ -7522,7 +7455,7 @@ function parsePath(path2, depth = 0) {
|
|
7522
7455
|
(p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
|
7523
7456
|
);
|
7524
7457
|
}
|
7525
|
-
var HDWallet = class {
|
7458
|
+
var HDWallet = class _HDWallet {
|
7526
7459
|
depth = 0;
|
7527
7460
|
index = 0;
|
7528
7461
|
fingerprint = (0, import_utils34.hexlify)("0x00000000");
|
@@ -7588,7 +7521,7 @@ var HDWallet = class {
|
|
7588
7521
|
if (privateKey) {
|
7589
7522
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
7590
7523
|
const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
|
7591
|
-
return new
|
7524
|
+
return new _HDWallet({
|
7592
7525
|
privateKey: ki,
|
7593
7526
|
chainCode: IR,
|
7594
7527
|
index,
|
@@ -7598,7 +7531,7 @@ var HDWallet = class {
|
|
7598
7531
|
}
|
7599
7532
|
const signer = new Signer((0, import_utils34.hexlify)(IL));
|
7600
7533
|
const Ki = signer.addPoint(publicKey);
|
7601
|
-
return new
|
7534
|
+
return new _HDWallet({
|
7602
7535
|
publicKey: Ki,
|
7603
7536
|
chainCode: IR,
|
7604
7537
|
index,
|
@@ -7647,7 +7580,7 @@ var HDWallet = class {
|
|
7647
7580
|
*/
|
7648
7581
|
static fromSeed(seed) {
|
7649
7582
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
7650
|
-
return new
|
7583
|
+
return new _HDWallet({
|
7651
7584
|
chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
|
7652
7585
|
privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
|
7653
7586
|
});
|
@@ -7677,7 +7610,7 @@ var HDWallet = class {
|
|
7677
7610
|
if (key[0] !== 3) {
|
7678
7611
|
throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
7679
7612
|
}
|
7680
|
-
return new
|
7613
|
+
return new _HDWallet({
|
7681
7614
|
publicKey: key,
|
7682
7615
|
chainCode,
|
7683
7616
|
index,
|
@@ -7688,7 +7621,7 @@ var HDWallet = class {
|
|
7688
7621
|
if (key[0] !== 0) {
|
7689
7622
|
throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
|
7690
7623
|
}
|
7691
|
-
return new
|
7624
|
+
return new _HDWallet({
|
7692
7625
|
privateKey: key.slice(1),
|
7693
7626
|
chainCode,
|
7694
7627
|
index,
|
@@ -7711,7 +7644,7 @@ var WalletLocked = class extends Account {
|
|
7711
7644
|
return new WalletUnlocked(privateKey, this._provider);
|
7712
7645
|
}
|
7713
7646
|
};
|
7714
|
-
var WalletUnlocked = class extends BaseWalletUnlocked {
|
7647
|
+
var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
|
7715
7648
|
/**
|
7716
7649
|
* Locks the wallet and returns an instance of WalletLocked.
|
7717
7650
|
*
|
@@ -7729,7 +7662,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7729
7662
|
*/
|
7730
7663
|
static generate(generateOptions) {
|
7731
7664
|
const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
|
7732
|
-
return new
|
7665
|
+
return new _WalletUnlocked(privateKey, generateOptions?.provider);
|
7733
7666
|
}
|
7734
7667
|
/**
|
7735
7668
|
* Create a Wallet Unlocked from a seed.
|
@@ -7741,8 +7674,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7741
7674
|
*/
|
7742
7675
|
static fromSeed(seed, path2, provider) {
|
7743
7676
|
const hdWallet = hdwallet_default.fromSeed(seed);
|
7744
|
-
const childWallet = hdWallet.derivePath(path2 ||
|
7745
|
-
return new
|
7677
|
+
const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
|
7678
|
+
return new _WalletUnlocked(childWallet.privateKey, provider);
|
7746
7679
|
}
|
7747
7680
|
/**
|
7748
7681
|
* Create a Wallet Unlocked from a mnemonic phrase.
|
@@ -7756,8 +7689,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7756
7689
|
static fromMnemonic(mnemonic, path2, passphrase, provider) {
|
7757
7690
|
const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
|
7758
7691
|
const hdWallet = hdwallet_default.fromSeed(seed);
|
7759
|
-
const childWallet = hdWallet.derivePath(path2 ||
|
7760
|
-
return new
|
7692
|
+
const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
|
7693
|
+
return new _WalletUnlocked(childWallet.privateKey, provider);
|
7761
7694
|
}
|
7762
7695
|
/**
|
7763
7696
|
* Create a Wallet Unlocked from an extended key.
|
@@ -7768,7 +7701,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7768
7701
|
*/
|
7769
7702
|
static fromExtendedKey(extendedKey, provider) {
|
7770
7703
|
const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
|
7771
|
-
return new
|
7704
|
+
return new _WalletUnlocked(hdWallet.privateKey, provider);
|
7772
7705
|
}
|
7773
7706
|
/**
|
7774
7707
|
* Create a Wallet Unlocked from an encrypted JSON.
|
@@ -7780,7 +7713,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7780
7713
|
*/
|
7781
7714
|
static async fromEncryptedJson(jsonWallet, password, provider) {
|
7782
7715
|
const privateKey = await decryptKeystoreWallet(jsonWallet, password);
|
7783
|
-
return new
|
7716
|
+
return new _WalletUnlocked(privateKey, provider);
|
7784
7717
|
}
|
7785
7718
|
};
|
7786
7719
|
|
@@ -7806,50 +7739,50 @@ var Wallet = class {
|
|
7806
7739
|
static fromPrivateKey(privateKey, provider) {
|
7807
7740
|
return new WalletUnlocked(privateKey, provider);
|
7808
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;
|
7809
7785
|
};
|
7810
|
-
/**
|
7811
|
-
* Generate a new Wallet Unlocked with a random key pair.
|
7812
|
-
*
|
7813
|
-
* @param generateOptions - Options to customize the generation process (optional).
|
7814
|
-
* @returns An unlocked wallet instance.
|
7815
|
-
*/
|
7816
|
-
__publicField(Wallet, "generate", WalletUnlocked.generate);
|
7817
|
-
/**
|
7818
|
-
* Create a Wallet Unlocked from a seed.
|
7819
|
-
*
|
7820
|
-
* @param seed - The seed phrase.
|
7821
|
-
* @param provider - A Provider instance (optional).
|
7822
|
-
* @param path - The derivation path (optional).
|
7823
|
-
* @returns An unlocked wallet instance.
|
7824
|
-
*/
|
7825
|
-
__publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
|
7826
|
-
/**
|
7827
|
-
* Create a Wallet Unlocked from a mnemonic phrase.
|
7828
|
-
*
|
7829
|
-
* @param mnemonic - The mnemonic phrase.
|
7830
|
-
* @param provider - A Provider instance (optional).
|
7831
|
-
* @param path - The derivation path (optional).
|
7832
|
-
* @param passphrase - The passphrase for the mnemonic (optional).
|
7833
|
-
* @returns An unlocked wallet instance.
|
7834
|
-
*/
|
7835
|
-
__publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
|
7836
|
-
/**
|
7837
|
-
* Create a Wallet Unlocked from an extended key.
|
7838
|
-
*
|
7839
|
-
* @param extendedKey - The extended key.
|
7840
|
-
* @param provider - A Provider instance (optional).
|
7841
|
-
* @returns An unlocked wallet instance.
|
7842
|
-
*/
|
7843
|
-
__publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
|
7844
|
-
/**
|
7845
|
-
* Create a Wallet Unlocked from an encrypted JSON.
|
7846
|
-
*
|
7847
|
-
* @param jsonWallet - The encrypted JSON keystore.
|
7848
|
-
* @param password - The password to decrypt the JSON.
|
7849
|
-
* @param provider - A Provider instance (optional).
|
7850
|
-
* @returns An unlocked wallet instance.
|
7851
|
-
*/
|
7852
|
-
__publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
7853
7786
|
|
7854
7787
|
// src/test-utils/seedTestWallet.ts
|
7855
7788
|
var import_crypto4 = require("@fuel-ts/crypto");
|