@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.mjs
CHANGED
@@ -1,23 +1,3 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
-
var __publicField = (obj, key, value) => {
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
|
-
return value;
|
6
|
-
};
|
7
|
-
var __accessCheck = (obj, member, msg) => {
|
8
|
-
if (!member.has(obj))
|
9
|
-
throw TypeError("Cannot " + msg);
|
10
|
-
};
|
11
|
-
var __privateAdd = (obj, member, value) => {
|
12
|
-
if (member.has(obj))
|
13
|
-
throw TypeError("Cannot add the same private member more than once");
|
14
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
15
|
-
};
|
16
|
-
var __privateMethod = (obj, member, method) => {
|
17
|
-
__accessCheck(obj, member, "access private method");
|
18
|
-
return method;
|
19
|
-
};
|
20
|
-
|
21
1
|
// src/wallet/base-wallet-unlocked.ts
|
22
2
|
import { hashMessage } from "@fuel-ts/hasher";
|
23
3
|
import { hexlify as hexlify15 } from "@fuel-ts/utils";
|
@@ -891,11 +871,12 @@ function getSdk(requester) {
|
|
891
871
|
// src/providers/fuel-graphql-subscriber.ts
|
892
872
|
import { ErrorCode, FuelError } from "@fuel-ts/errors";
|
893
873
|
import { print } from "graphql";
|
894
|
-
var
|
874
|
+
var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
|
895
875
|
constructor(options) {
|
896
876
|
this.options = options;
|
897
877
|
}
|
898
878
|
stream;
|
879
|
+
static textDecoder = new TextDecoder();
|
899
880
|
async setStream() {
|
900
881
|
const { url, query, variables, fetchFn } = this.options;
|
901
882
|
const response = await fetchFn(`${url}-sub`, {
|
@@ -955,8 +936,6 @@ var _FuelGraphqlSubscriber = class {
|
|
955
936
|
return this;
|
956
937
|
}
|
957
938
|
};
|
958
|
-
var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
|
959
|
-
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
960
939
|
|
961
940
|
// src/providers/memory-cache.ts
|
962
941
|
import { ErrorCode as ErrorCode2, FuelError as FuelError2 } from "@fuel-ts/errors";
|
@@ -1516,7 +1495,7 @@ var witnessify = (value) => {
|
|
1516
1495
|
};
|
1517
1496
|
|
1518
1497
|
// src/providers/transaction-request/transaction-request.ts
|
1519
|
-
var BaseTransactionRequest = class {
|
1498
|
+
var BaseTransactionRequest = class _BaseTransactionRequest {
|
1520
1499
|
/** Gas price for transaction */
|
1521
1500
|
gasPrice;
|
1522
1501
|
/** Block until which tx cannot be included */
|
@@ -1586,7 +1565,7 @@ var BaseTransactionRequest = class {
|
|
1586
1565
|
const inputs = this.inputs?.map(inputify) ?? [];
|
1587
1566
|
const outputs = this.outputs?.map(outputify) ?? [];
|
1588
1567
|
const witnesses = this.witnesses?.map(witnessify) ?? [];
|
1589
|
-
const { policyTypes, policies } =
|
1568
|
+
const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
|
1590
1569
|
return {
|
1591
1570
|
policyTypes,
|
1592
1571
|
inputs,
|
@@ -1624,27 +1603,13 @@ var BaseTransactionRequest = class {
|
|
1624
1603
|
this.outputs.push(output);
|
1625
1604
|
return this.outputs.length - 1;
|
1626
1605
|
}
|
1627
|
-
/**
|
1628
|
-
* @hidden
|
1629
|
-
*
|
1630
|
-
* Pushes a witness to the list and returns the index
|
1631
|
-
*
|
1632
|
-
* @param signature - The signature to add to the witness.
|
1633
|
-
* @returns The index of the created witness.
|
1634
|
-
*/
|
1635
|
-
addWitness(signature) {
|
1636
|
-
this.witnesses.push(signature);
|
1637
|
-
return this.witnesses.length - 1;
|
1638
|
-
}
|
1639
1606
|
/**
|
1640
1607
|
* @hidden
|
1641
1608
|
*
|
1642
1609
|
* Creates an empty witness without any side effects and returns the index
|
1643
|
-
*
|
1644
|
-
* @returns The index of the created witness.
|
1645
1610
|
*/
|
1646
|
-
|
1647
|
-
this.
|
1611
|
+
createWitness() {
|
1612
|
+
this.witnesses.push(concat([ZeroBytes324, ZeroBytes324]));
|
1648
1613
|
return this.witnesses.length - 1;
|
1649
1614
|
}
|
1650
1615
|
/**
|
@@ -1673,21 +1638,6 @@ var BaseTransactionRequest = class {
|
|
1673
1638
|
}
|
1674
1639
|
this.witnesses[index] = witness;
|
1675
1640
|
}
|
1676
|
-
/**
|
1677
|
-
* Helper function to add an external signature to the transaction.
|
1678
|
-
*
|
1679
|
-
* @param account - The account/s to sign to the transaction.
|
1680
|
-
* @returns The transaction with the signature witness added.
|
1681
|
-
*/
|
1682
|
-
async addAccountWitnesses(account) {
|
1683
|
-
const accounts = Array.isArray(account) ? account : [account];
|
1684
|
-
await Promise.all(
|
1685
|
-
accounts.map(async (acc) => {
|
1686
|
-
this.addWitness(await acc.signTransaction(this));
|
1687
|
-
})
|
1688
|
-
);
|
1689
|
-
return this;
|
1690
|
-
}
|
1691
1641
|
/**
|
1692
1642
|
* Gets the coin inputs for a transaction.
|
1693
1643
|
*
|
@@ -1753,7 +1703,7 @@ var BaseTransactionRequest = class {
|
|
1753
1703
|
} else {
|
1754
1704
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
1755
1705
|
if (typeof witnessIndex !== "number") {
|
1756
|
-
witnessIndex = this.
|
1706
|
+
witnessIndex = this.createWitness();
|
1757
1707
|
}
|
1758
1708
|
}
|
1759
1709
|
const input = {
|
@@ -1787,7 +1737,7 @@ var BaseTransactionRequest = class {
|
|
1787
1737
|
} else {
|
1788
1738
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
1789
1739
|
if (typeof witnessIndex !== "number") {
|
1790
|
-
witnessIndex = this.
|
1740
|
+
witnessIndex = this.createWitness();
|
1791
1741
|
}
|
1792
1742
|
}
|
1793
1743
|
const input = {
|
@@ -3153,7 +3103,7 @@ function assembleTransactionSummary(params) {
|
|
3153
3103
|
}
|
3154
3104
|
|
3155
3105
|
// src/providers/transaction-response/transaction-response.ts
|
3156
|
-
var TransactionResponse = class {
|
3106
|
+
var TransactionResponse = class _TransactionResponse {
|
3157
3107
|
/** Transaction ID */
|
3158
3108
|
id;
|
3159
3109
|
/** Current provider */
|
@@ -3181,7 +3131,7 @@ var TransactionResponse = class {
|
|
3181
3131
|
* @param provider - The provider.
|
3182
3132
|
*/
|
3183
3133
|
static async create(id, provider) {
|
3184
|
-
const response = new
|
3134
|
+
const response = new _TransactionResponse(id, provider);
|
3185
3135
|
await response.fetch();
|
3186
3136
|
return response;
|
3187
3137
|
}
|
@@ -3396,8 +3346,7 @@ var processGqlChain = (chain) => {
|
|
3396
3346
|
}
|
3397
3347
|
};
|
3398
3348
|
};
|
3399
|
-
var
|
3400
|
-
var _Provider = class {
|
3349
|
+
var Provider = class _Provider {
|
3401
3350
|
/**
|
3402
3351
|
* Constructor to initialize a Provider.
|
3403
3352
|
*
|
@@ -3408,27 +3357,25 @@ var _Provider = class {
|
|
3408
3357
|
*/
|
3409
3358
|
constructor(url, options = {}) {
|
3410
3359
|
this.url = url;
|
3411
|
-
/**
|
3412
|
-
* @hidden
|
3413
|
-
*/
|
3414
|
-
__privateAdd(this, _cacheInputs);
|
3415
|
-
__publicField(this, "operations");
|
3416
|
-
__publicField(this, "cache");
|
3417
|
-
__publicField(this, "options", {
|
3418
|
-
timeout: void 0,
|
3419
|
-
cacheUtxo: void 0,
|
3420
|
-
fetch: void 0,
|
3421
|
-
retryOptions: void 0
|
3422
|
-
});
|
3423
3360
|
this.options = { ...this.options, ...options };
|
3424
3361
|
this.url = url;
|
3425
3362
|
this.operations = this.createOperations();
|
3426
3363
|
this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
|
3427
3364
|
}
|
3365
|
+
operations;
|
3366
|
+
cache;
|
3428
3367
|
static clearChainAndNodeCaches() {
|
3429
3368
|
_Provider.nodeInfoCache = {};
|
3430
3369
|
_Provider.chainInfoCache = {};
|
3431
3370
|
}
|
3371
|
+
static chainInfoCache = {};
|
3372
|
+
static nodeInfoCache = {};
|
3373
|
+
options = {
|
3374
|
+
timeout: void 0,
|
3375
|
+
cacheUtxo: void 0,
|
3376
|
+
fetch: void 0,
|
3377
|
+
retryOptions: void 0
|
3378
|
+
};
|
3432
3379
|
static getFetchFn(options) {
|
3433
3380
|
const { retryOptions, timeout } = options;
|
3434
3381
|
return autoRetryFetch(async (...args) => {
|
@@ -3625,6 +3572,19 @@ var _Provider = class {
|
|
3625
3572
|
} = this.getChain();
|
3626
3573
|
return chainId.toNumber();
|
3627
3574
|
}
|
3575
|
+
/**
|
3576
|
+
* @hidden
|
3577
|
+
*/
|
3578
|
+
#cacheInputs(inputs) {
|
3579
|
+
if (!this.cache) {
|
3580
|
+
return;
|
3581
|
+
}
|
3582
|
+
inputs.forEach((input) => {
|
3583
|
+
if (input.type === InputType6.Coin) {
|
3584
|
+
this.cache?.set(input.id);
|
3585
|
+
}
|
3586
|
+
});
|
3587
|
+
}
|
3628
3588
|
/**
|
3629
3589
|
* Submits a transaction to the chain to be executed.
|
3630
3590
|
*
|
@@ -3637,7 +3597,7 @@ var _Provider = class {
|
|
3637
3597
|
// #region Provider-sendTransaction
|
3638
3598
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution = false } = {}) {
|
3639
3599
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
3640
|
-
|
3600
|
+
this.#cacheInputs(transactionRequest.inputs);
|
3641
3601
|
if (estimateTxDependencies) {
|
3642
3602
|
await this.estimateTxDependencies(transactionRequest);
|
3643
3603
|
}
|
@@ -4262,20 +4222,6 @@ var _Provider = class {
|
|
4262
4222
|
return new TransactionResponse(transactionId, this);
|
4263
4223
|
}
|
4264
4224
|
};
|
4265
|
-
var Provider = _Provider;
|
4266
|
-
_cacheInputs = new WeakSet();
|
4267
|
-
cacheInputs_fn = function(inputs) {
|
4268
|
-
if (!this.cache) {
|
4269
|
-
return;
|
4270
|
-
}
|
4271
|
-
inputs.forEach((input) => {
|
4272
|
-
if (input.type === InputType6.Coin) {
|
4273
|
-
this.cache?.set(input.id);
|
4274
|
-
}
|
4275
|
-
});
|
4276
|
-
};
|
4277
|
-
__publicField(Provider, "chainInfoCache", {});
|
4278
|
-
__publicField(Provider, "nodeInfoCache", {});
|
4279
4225
|
|
4280
4226
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4281
4227
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
@@ -4714,21 +4660,6 @@ var Account = class extends AbstractAccount {
|
|
4714
4660
|
}
|
4715
4661
|
return this._connector.signMessage(this.address.toString(), message);
|
4716
4662
|
}
|
4717
|
-
/**
|
4718
|
-
* Signs a transaction with the wallet's private key.
|
4719
|
-
*
|
4720
|
-
* @param transactionRequestLike - The transaction request to sign.
|
4721
|
-
* @returns A promise that resolves to the signature of the transaction.
|
4722
|
-
*/
|
4723
|
-
async signTransaction(transactionRequestLike) {
|
4724
|
-
if (!this._connector) {
|
4725
|
-
throw new FuelError14(
|
4726
|
-
ErrorCode14.MISSING_CONNECTOR,
|
4727
|
-
"A connector is required to sign transactions."
|
4728
|
-
);
|
4729
|
-
}
|
4730
|
-
return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
|
4731
|
-
}
|
4732
4663
|
/**
|
4733
4664
|
* Sends a transaction to the network.
|
4734
4665
|
*
|
@@ -4791,7 +4722,7 @@ import { hash } from "@fuel-ts/hasher";
|
|
4791
4722
|
import { toBytes } from "@fuel-ts/math";
|
4792
4723
|
import { hexlify as hexlify13, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
|
4793
4724
|
import { secp256k1 } from "@noble/curves/secp256k1";
|
4794
|
-
var Signer = class {
|
4725
|
+
var Signer = class _Signer {
|
4795
4726
|
address;
|
4796
4727
|
publicKey;
|
4797
4728
|
compressedPublicKey;
|
@@ -4870,7 +4801,7 @@ var Signer = class {
|
|
4870
4801
|
* @returns Address from signature
|
4871
4802
|
*/
|
4872
4803
|
static recoverAddress(data, signature) {
|
4873
|
-
return Address4.fromPublicKey(
|
4804
|
+
return Address4.fromPublicKey(_Signer.recoverPublicKey(data, signature));
|
4874
4805
|
}
|
4875
4806
|
/**
|
4876
4807
|
* Generate a random privateKey
|
@@ -4994,6 +4925,10 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
4994
4925
|
|
4995
4926
|
// src/wallet/base-wallet-unlocked.ts
|
4996
4927
|
var BaseWalletUnlocked = class extends Account {
|
4928
|
+
/**
|
4929
|
+
* Default HDWallet path.
|
4930
|
+
*/
|
4931
|
+
static defaultPath = "m/44'/1179993420'/0'/0/0";
|
4997
4932
|
/**
|
4998
4933
|
* A function that returns the wallet's signer.
|
4999
4934
|
*/
|
@@ -5043,7 +4978,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5043
4978
|
*/
|
5044
4979
|
async signTransaction(transactionRequestLike) {
|
5045
4980
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
5046
|
-
const chainId = this.provider.
|
4981
|
+
const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
|
5047
4982
|
const hashedTransaction = transactionRequest.getTransactionId(chainId);
|
5048
4983
|
const signature = await this.signer().sign(hashedTransaction);
|
5049
4984
|
return hexlify15(signature);
|
@@ -5099,10 +5034,6 @@ var BaseWalletUnlocked = class extends Account {
|
|
5099
5034
|
return encryptKeystoreWallet(this.privateKey, this.address, password);
|
5100
5035
|
}
|
5101
5036
|
};
|
5102
|
-
/**
|
5103
|
-
* Default HDWallet path.
|
5104
|
-
*/
|
5105
|
-
__publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
5106
5037
|
|
5107
5038
|
// src/hdwallet/hdwallet.ts
|
5108
5039
|
import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
|
@@ -7306,7 +7237,7 @@ function assertMnemonic(words) {
|
|
7306
7237
|
throw new FuelError17(ErrorCode17.INVALID_MNEMONIC, errorMsg);
|
7307
7238
|
}
|
7308
7239
|
}
|
7309
|
-
var Mnemonic = class {
|
7240
|
+
var Mnemonic = class _Mnemonic {
|
7310
7241
|
wordlist;
|
7311
7242
|
/**
|
7312
7243
|
*
|
@@ -7323,7 +7254,7 @@ var Mnemonic = class {
|
|
7323
7254
|
* @returns Entropy hash
|
7324
7255
|
*/
|
7325
7256
|
mnemonicToEntropy(phrase) {
|
7326
|
-
return
|
7257
|
+
return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
|
7327
7258
|
}
|
7328
7259
|
/**
|
7329
7260
|
*
|
@@ -7331,7 +7262,7 @@ var Mnemonic = class {
|
|
7331
7262
|
* @returns Mnemonic phrase
|
7332
7263
|
*/
|
7333
7264
|
entropyToMnemonic(entropy) {
|
7334
|
-
return
|
7265
|
+
return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
|
7335
7266
|
}
|
7336
7267
|
/**
|
7337
7268
|
*
|
@@ -7372,8 +7303,8 @@ var Mnemonic = class {
|
|
7372
7303
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
7373
7304
|
*/
|
7374
7305
|
static mnemonicToMasterKeys(phrase, passphrase = "") {
|
7375
|
-
const seed =
|
7376
|
-
return
|
7306
|
+
const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
|
7307
|
+
return _Mnemonic.masterKeysFromSeed(seed);
|
7377
7308
|
}
|
7378
7309
|
/**
|
7379
7310
|
* Validates if given mnemonic is valid
|
@@ -7389,7 +7320,7 @@ var Mnemonic = class {
|
|
7389
7320
|
return false;
|
7390
7321
|
}
|
7391
7322
|
while (i < words.length) {
|
7392
|
-
if (
|
7323
|
+
if (_Mnemonic.binarySearch(words[i]) === false) {
|
7393
7324
|
return false;
|
7394
7325
|
}
|
7395
7326
|
i += 1;
|
@@ -7436,7 +7367,7 @@ var Mnemonic = class {
|
|
7436
7367
|
* @returns BIP-32 extended private key
|
7437
7368
|
*/
|
7438
7369
|
static seedToExtendedKey(seed, testnet = false) {
|
7439
|
-
const masterKey =
|
7370
|
+
const masterKey = _Mnemonic.masterKeysFromSeed(seed);
|
7440
7371
|
const prefix = arrayify17(testnet ? TestnetPRV : MainnetPRV);
|
7441
7372
|
const depth = "0x00";
|
7442
7373
|
const fingerprint = "0x00000000";
|
@@ -7468,7 +7399,7 @@ var Mnemonic = class {
|
|
7468
7399
|
*/
|
7469
7400
|
static generate(size = 32, extraEntropy = "") {
|
7470
7401
|
const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), arrayify17(extraEntropy)])) : randomBytes3(size);
|
7471
|
-
return
|
7402
|
+
return _Mnemonic.entropyToMnemonic(entropy);
|
7472
7403
|
}
|
7473
7404
|
};
|
7474
7405
|
var mnemonic_default = Mnemonic;
|
@@ -7508,7 +7439,7 @@ function parsePath(path2, depth = 0) {
|
|
7508
7439
|
(p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
|
7509
7440
|
);
|
7510
7441
|
}
|
7511
|
-
var HDWallet = class {
|
7442
|
+
var HDWallet = class _HDWallet {
|
7512
7443
|
depth = 0;
|
7513
7444
|
index = 0;
|
7514
7445
|
fingerprint = hexlify17("0x00000000");
|
@@ -7574,7 +7505,7 @@ var HDWallet = class {
|
|
7574
7505
|
if (privateKey) {
|
7575
7506
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
7576
7507
|
const ki = bn17(IL).add(privateKey).mod(N).toBytes(32);
|
7577
|
-
return new
|
7508
|
+
return new _HDWallet({
|
7578
7509
|
privateKey: ki,
|
7579
7510
|
chainCode: IR,
|
7580
7511
|
index,
|
@@ -7584,7 +7515,7 @@ var HDWallet = class {
|
|
7584
7515
|
}
|
7585
7516
|
const signer = new Signer(hexlify17(IL));
|
7586
7517
|
const Ki = signer.addPoint(publicKey);
|
7587
|
-
return new
|
7518
|
+
return new _HDWallet({
|
7588
7519
|
publicKey: Ki,
|
7589
7520
|
chainCode: IR,
|
7590
7521
|
index,
|
@@ -7633,7 +7564,7 @@ var HDWallet = class {
|
|
7633
7564
|
*/
|
7634
7565
|
static fromSeed(seed) {
|
7635
7566
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
7636
|
-
return new
|
7567
|
+
return new _HDWallet({
|
7637
7568
|
chainCode: arrayify18(masterKey.slice(32)),
|
7638
7569
|
privateKey: arrayify18(masterKey.slice(0, 32))
|
7639
7570
|
});
|
@@ -7663,7 +7594,7 @@ var HDWallet = class {
|
|
7663
7594
|
if (key[0] !== 3) {
|
7664
7595
|
throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid public extended key.");
|
7665
7596
|
}
|
7666
|
-
return new
|
7597
|
+
return new _HDWallet({
|
7667
7598
|
publicKey: key,
|
7668
7599
|
chainCode,
|
7669
7600
|
index,
|
@@ -7674,7 +7605,7 @@ var HDWallet = class {
|
|
7674
7605
|
if (key[0] !== 0) {
|
7675
7606
|
throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid private extended key.");
|
7676
7607
|
}
|
7677
|
-
return new
|
7608
|
+
return new _HDWallet({
|
7678
7609
|
privateKey: key.slice(1),
|
7679
7610
|
chainCode,
|
7680
7611
|
index,
|
@@ -7697,7 +7628,7 @@ var WalletLocked = class extends Account {
|
|
7697
7628
|
return new WalletUnlocked(privateKey, this._provider);
|
7698
7629
|
}
|
7699
7630
|
};
|
7700
|
-
var WalletUnlocked = class extends BaseWalletUnlocked {
|
7631
|
+
var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
|
7701
7632
|
/**
|
7702
7633
|
* Locks the wallet and returns an instance of WalletLocked.
|
7703
7634
|
*
|
@@ -7715,7 +7646,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7715
7646
|
*/
|
7716
7647
|
static generate(generateOptions) {
|
7717
7648
|
const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
|
7718
|
-
return new
|
7649
|
+
return new _WalletUnlocked(privateKey, generateOptions?.provider);
|
7719
7650
|
}
|
7720
7651
|
/**
|
7721
7652
|
* Create a Wallet Unlocked from a seed.
|
@@ -7727,8 +7658,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7727
7658
|
*/
|
7728
7659
|
static fromSeed(seed, path2, provider) {
|
7729
7660
|
const hdWallet = hdwallet_default.fromSeed(seed);
|
7730
|
-
const childWallet = hdWallet.derivePath(path2 ||
|
7731
|
-
return new
|
7661
|
+
const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
|
7662
|
+
return new _WalletUnlocked(childWallet.privateKey, provider);
|
7732
7663
|
}
|
7733
7664
|
/**
|
7734
7665
|
* Create a Wallet Unlocked from a mnemonic phrase.
|
@@ -7742,8 +7673,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7742
7673
|
static fromMnemonic(mnemonic, path2, passphrase, provider) {
|
7743
7674
|
const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
|
7744
7675
|
const hdWallet = hdwallet_default.fromSeed(seed);
|
7745
|
-
const childWallet = hdWallet.derivePath(path2 ||
|
7746
|
-
return new
|
7676
|
+
const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
|
7677
|
+
return new _WalletUnlocked(childWallet.privateKey, provider);
|
7747
7678
|
}
|
7748
7679
|
/**
|
7749
7680
|
* Create a Wallet Unlocked from an extended key.
|
@@ -7754,7 +7685,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7754
7685
|
*/
|
7755
7686
|
static fromExtendedKey(extendedKey, provider) {
|
7756
7687
|
const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
|
7757
|
-
return new
|
7688
|
+
return new _WalletUnlocked(hdWallet.privateKey, provider);
|
7758
7689
|
}
|
7759
7690
|
/**
|
7760
7691
|
* Create a Wallet Unlocked from an encrypted JSON.
|
@@ -7766,7 +7697,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
|
|
7766
7697
|
*/
|
7767
7698
|
static async fromEncryptedJson(jsonWallet, password, provider) {
|
7768
7699
|
const privateKey = await decryptKeystoreWallet(jsonWallet, password);
|
7769
|
-
return new
|
7700
|
+
return new _WalletUnlocked(privateKey, provider);
|
7770
7701
|
}
|
7771
7702
|
};
|
7772
7703
|
|
@@ -7792,50 +7723,50 @@ var Wallet = class {
|
|
7792
7723
|
static fromPrivateKey(privateKey, provider) {
|
7793
7724
|
return new WalletUnlocked(privateKey, provider);
|
7794
7725
|
}
|
7726
|
+
/**
|
7727
|
+
* Generate a new Wallet Unlocked with a random key pair.
|
7728
|
+
*
|
7729
|
+
* @param generateOptions - Options to customize the generation process (optional).
|
7730
|
+
* @returns An unlocked wallet instance.
|
7731
|
+
*/
|
7732
|
+
static generate = WalletUnlocked.generate;
|
7733
|
+
/**
|
7734
|
+
* Create a Wallet Unlocked from a seed.
|
7735
|
+
*
|
7736
|
+
* @param seed - The seed phrase.
|
7737
|
+
* @param provider - A Provider instance (optional).
|
7738
|
+
* @param path - The derivation path (optional).
|
7739
|
+
* @returns An unlocked wallet instance.
|
7740
|
+
*/
|
7741
|
+
static fromSeed = WalletUnlocked.fromSeed;
|
7742
|
+
/**
|
7743
|
+
* Create a Wallet Unlocked from a mnemonic phrase.
|
7744
|
+
*
|
7745
|
+
* @param mnemonic - The mnemonic phrase.
|
7746
|
+
* @param provider - A Provider instance (optional).
|
7747
|
+
* @param path - The derivation path (optional).
|
7748
|
+
* @param passphrase - The passphrase for the mnemonic (optional).
|
7749
|
+
* @returns An unlocked wallet instance.
|
7750
|
+
*/
|
7751
|
+
static fromMnemonic = WalletUnlocked.fromMnemonic;
|
7752
|
+
/**
|
7753
|
+
* Create a Wallet Unlocked from an extended key.
|
7754
|
+
*
|
7755
|
+
* @param extendedKey - The extended key.
|
7756
|
+
* @param provider - A Provider instance (optional).
|
7757
|
+
* @returns An unlocked wallet instance.
|
7758
|
+
*/
|
7759
|
+
static fromExtendedKey = WalletUnlocked.fromExtendedKey;
|
7760
|
+
/**
|
7761
|
+
* Create a Wallet Unlocked from an encrypted JSON.
|
7762
|
+
*
|
7763
|
+
* @param jsonWallet - The encrypted JSON keystore.
|
7764
|
+
* @param password - The password to decrypt the JSON.
|
7765
|
+
* @param provider - A Provider instance (optional).
|
7766
|
+
* @returns An unlocked wallet instance.
|
7767
|
+
*/
|
7768
|
+
static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
|
7795
7769
|
};
|
7796
|
-
/**
|
7797
|
-
* Generate a new Wallet Unlocked with a random key pair.
|
7798
|
-
*
|
7799
|
-
* @param generateOptions - Options to customize the generation process (optional).
|
7800
|
-
* @returns An unlocked wallet instance.
|
7801
|
-
*/
|
7802
|
-
__publicField(Wallet, "generate", WalletUnlocked.generate);
|
7803
|
-
/**
|
7804
|
-
* Create a Wallet Unlocked from a seed.
|
7805
|
-
*
|
7806
|
-
* @param seed - The seed phrase.
|
7807
|
-
* @param provider - A Provider instance (optional).
|
7808
|
-
* @param path - The derivation path (optional).
|
7809
|
-
* @returns An unlocked wallet instance.
|
7810
|
-
*/
|
7811
|
-
__publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
|
7812
|
-
/**
|
7813
|
-
* Create a Wallet Unlocked from a mnemonic phrase.
|
7814
|
-
*
|
7815
|
-
* @param mnemonic - The mnemonic phrase.
|
7816
|
-
* @param provider - A Provider instance (optional).
|
7817
|
-
* @param path - The derivation path (optional).
|
7818
|
-
* @param passphrase - The passphrase for the mnemonic (optional).
|
7819
|
-
* @returns An unlocked wallet instance.
|
7820
|
-
*/
|
7821
|
-
__publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
|
7822
|
-
/**
|
7823
|
-
* Create a Wallet Unlocked from an extended key.
|
7824
|
-
*
|
7825
|
-
* @param extendedKey - The extended key.
|
7826
|
-
* @param provider - A Provider instance (optional).
|
7827
|
-
* @returns An unlocked wallet instance.
|
7828
|
-
*/
|
7829
|
-
__publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
|
7830
|
-
/**
|
7831
|
-
* Create a Wallet Unlocked from an encrypted JSON.
|
7832
|
-
*
|
7833
|
-
* @param jsonWallet - The encrypted JSON keystore.
|
7834
|
-
* @param password - The password to decrypt the JSON.
|
7835
|
-
* @param provider - A Provider instance (optional).
|
7836
|
-
* @returns An unlocked wallet instance.
|
7837
|
-
*/
|
7838
|
-
__publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
7839
7770
|
|
7840
7771
|
// src/test-utils/seedTestWallet.ts
|
7841
7772
|
import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
|