@fuel-ts/account 0.0.0-rc-1889-20240322122653 → 0.0.0-rc-1356-20240322130951
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.d.ts +177 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/configs.d.ts +2 -3
- package/dist/configs.d.ts.map +1 -0
- package/dist/connectors/fuel-connector.d.ts +188 -0
- package/dist/connectors/fuel-connector.d.ts.map +1 -0
- package/dist/connectors/fuel.d.ts +133 -0
- package/dist/connectors/fuel.d.ts.map +1 -0
- package/dist/connectors/index.d.ts +5 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/types/connector-metadata.d.ts +12 -0
- package/dist/connectors/types/connector-metadata.d.ts.map +1 -0
- package/dist/connectors/types/connector-types.d.ts +34 -0
- package/dist/connectors/types/connector-types.d.ts.map +1 -0
- package/dist/connectors/types/data-type.d.ts +34 -0
- package/dist/connectors/types/data-type.d.ts.map +1 -0
- package/dist/connectors/types/events.d.ts +111 -0
- package/dist/connectors/types/events.d.ts.map +1 -0
- package/dist/connectors/types/index.d.ts +7 -0
- package/dist/connectors/types/index.d.ts.map +1 -0
- package/dist/connectors/types/local-storage.d.ts +11 -0
- package/dist/connectors/types/local-storage.d.ts.map +1 -0
- package/dist/connectors/types/target-object.d.ts +14 -0
- package/dist/connectors/types/target-object.d.ts.map +1 -0
- package/dist/connectors/utils/cache.d.ts +14 -0
- package/dist/connectors/utils/cache.d.ts.map +1 -0
- package/dist/connectors/utils/dispatch-fuel-connector-event.d.ts +7 -0
- package/dist/connectors/utils/dispatch-fuel-connector-event.d.ts.map +1 -0
- package/dist/connectors/utils/index.d.ts +4 -0
- package/dist/connectors/utils/index.d.ts.map +1 -0
- package/dist/connectors/utils/promises.d.ts +8 -0
- package/dist/connectors/utils/promises.d.ts.map +1 -0
- package/dist/hdwallet/hdwallet.d.ts +58 -0
- package/dist/hdwallet/hdwallet.d.ts.map +1 -0
- package/dist/hdwallet/index.d.ts +2 -0
- package/dist/hdwallet/index.d.ts.map +1 -0
- package/dist/index.d.ts +13 -904
- package/dist/index.d.ts.map +1 -0
- package/dist/index.global.js +461 -394
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +350 -314
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -212
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/index.d.ts +3 -0
- package/dist/mnemonic/index.d.ts.map +1 -0
- package/dist/mnemonic/mnemonic.d.ts +85 -0
- package/dist/mnemonic/mnemonic.d.ts.map +1 -0
- package/dist/mnemonic/utils.d.ts +8 -0
- package/dist/mnemonic/utils.d.ts.map +1 -0
- package/dist/predicate/index.d.ts +3 -0
- package/dist/predicate/index.d.ts.map +1 -0
- package/dist/predicate/predicate.d.ts +94 -0
- package/dist/predicate/predicate.d.ts.map +1 -0
- package/dist/predicate/utils/getPredicateRoot.d.ts +12 -0
- package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -0
- package/dist/predicate/utils/index.d.ts +2 -0
- package/dist/predicate/utils/index.d.ts.map +1 -0
- package/dist/providers/__generated__/operations.d.ts +3477 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -0
- package/dist/providers/assets/index.d.ts +5 -0
- package/dist/providers/assets/index.d.ts.map +1 -0
- package/dist/providers/assets/types.d.ts +36 -0
- package/dist/providers/assets/types.d.ts.map +1 -0
- package/dist/providers/assets/utils/index.d.ts +4 -0
- package/dist/providers/assets/utils/index.d.ts.map +1 -0
- package/dist/providers/assets/utils/network.d.ts +33 -0
- package/dist/providers/assets/utils/network.d.ts.map +1 -0
- package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
- package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
- package/dist/providers/assets/utils/url.d.ts +2 -0
- package/dist/providers/assets/utils/url.d.ts.map +1 -0
- package/dist/providers/chains.d.ts +11 -0
- package/dist/providers/chains.d.ts.map +1 -0
- package/dist/providers/coin-quantity.d.ts +21 -0
- package/dist/providers/coin-quantity.d.ts.map +1 -0
- package/dist/providers/coin.d.ts +15 -0
- package/dist/providers/coin.d.ts.map +1 -0
- package/dist/providers/fuel-graphql-subscriber.d.ts +23 -0
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/memory-cache.d.ts +11 -0
- package/dist/providers/memory-cache.d.ts.map +1 -0
- package/dist/providers/message.d.ts +60 -0
- package/dist/providers/message.d.ts.map +1 -0
- package/dist/providers/provider.d.ts +522 -0
- package/dist/providers/provider.d.ts.map +1 -0
- package/dist/providers/resource.d.ts +37 -0
- package/dist/providers/resource.d.ts.map +1 -0
- package/dist/providers/transaction-request/create-transaction-request.d.ts +73 -0
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -0
- package/dist/providers/transaction-request/errors.d.ts +25 -0
- package/dist/providers/transaction-request/errors.d.ts.map +1 -0
- package/dist/providers/transaction-request/hash-transaction.d.ts +9 -0
- package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -0
- package/dist/providers/transaction-request/index.d.ts +10 -0
- package/dist/providers/transaction-request/index.d.ts.map +1 -0
- package/dist/providers/transaction-request/input.d.ts +59 -0
- package/dist/providers/transaction-request/input.d.ts.map +1 -0
- package/dist/providers/transaction-request/output.d.ts +39 -0
- package/dist/providers/transaction-request/output.d.ts.map +1 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts +106 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -0
- package/dist/providers/transaction-request/scripts.d.ts +6 -0
- package/dist/providers/transaction-request/scripts.d.ts.map +1 -0
- package/dist/providers/transaction-request/storage-slot.d.ts +10 -0
- package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -0
- package/dist/providers/transaction-request/transaction-request.d.ts +259 -0
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -0
- package/dist/providers/transaction-request/types.d.ts +10 -0
- package/dist/providers/transaction-request/types.d.ts.map +1 -0
- package/dist/providers/transaction-request/utils.d.ts +4 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -0
- package/dist/providers/transaction-request/witness.d.ts +5 -0
- package/dist/providers/transaction-request/witness.d.ts.map +1 -0
- package/dist/providers/transaction-response/getDecodedLogs.d.ts +5 -0
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -0
- package/dist/providers/transaction-response/index.d.ts +3 -0
- package/dist/providers/transaction-response/index.d.ts.map +1 -0
- package/dist/providers/transaction-response/transaction-response.d.ts +106 -0
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +20 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -0
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +21 -0
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -0
- package/dist/providers/transaction-summary/call.d.ts +18 -0
- package/dist/providers/transaction-summary/call.d.ts.map +1 -0
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts +31 -0
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -0
- package/dist/providers/transaction-summary/index.d.ts +10 -0
- package/dist/providers/transaction-summary/index.d.ts.map +1 -0
- package/dist/providers/transaction-summary/input.d.ts +21 -0
- package/dist/providers/transaction-summary/input.d.ts.map +1 -0
- package/dist/providers/transaction-summary/operations.d.ts +40 -0
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -0
- package/dist/providers/transaction-summary/output.d.ts +15 -0
- package/dist/providers/transaction-summary/output.d.ts.map +1 -0
- package/dist/providers/transaction-summary/receipt.d.ts +7 -0
- package/dist/providers/transaction-summary/receipt.d.ts.map +1 -0
- package/dist/providers/transaction-summary/status.d.ts +9 -0
- package/dist/providers/transaction-summary/status.d.ts.map +1 -0
- package/dist/providers/transaction-summary/types.d.ts +146 -0
- package/dist/providers/transaction-summary/types.d.ts.map +1 -0
- package/dist/providers/utils/auto-retry-fetch.d.ts +36 -0
- package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -0
- package/dist/providers/utils/block-explorer.d.ts +14 -0
- package/dist/providers/utils/block-explorer.d.ts.map +1 -0
- package/dist/providers/utils/gas.d.ts +38 -0
- package/dist/providers/utils/gas.d.ts.map +1 -0
- package/dist/providers/utils/index.d.ts +5 -0
- package/dist/providers/utils/index.d.ts.map +1 -0
- package/dist/providers/utils/json.d.ts +7 -0
- package/dist/providers/utils/json.d.ts.map +1 -0
- package/dist/providers/utils/merge-quantities.d.ts +3 -0
- package/dist/providers/utils/merge-quantities.d.ts.map +1 -0
- package/dist/providers/utils/receipts.d.ts +10 -0
- package/dist/providers/utils/receipts.d.ts.map +1 -0
- package/dist/signer/index.d.ts +2 -0
- package/dist/signer/index.d.ts.map +1 -0
- package/dist/signer/signer.d.ts +64 -0
- package/dist/signer/signer.d.ts.map +1 -0
- package/dist/test-utils/asset-id.d.ts +9 -0
- package/dist/test-utils/asset-id.d.ts.map +1 -0
- package/dist/test-utils/generateTestWallet.d.ts +4 -0
- package/dist/test-utils/generateTestWallet.d.ts.map +1 -0
- package/dist/test-utils/index.d.ts +8 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/{test-utils.d.ts → test-utils/launchNode.d.ts} +19 -24
- package/dist/test-utils/launchNode.d.ts.map +1 -0
- package/dist/test-utils/seedTestWallet.d.ts +4 -0
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -0
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts +33 -0
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
- package/dist/test-utils/test-message.d.ts +28 -0
- package/dist/test-utils/test-message.d.ts.map +1 -0
- package/dist/test-utils/wallet-config.d.ts +49 -0
- package/dist/test-utils/wallet-config.d.ts.map +1 -0
- package/dist/test-utils.global.js +655 -310
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +452 -217
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +357 -124
- package/dist/test-utils.mjs.map +1 -1
- package/dist/utils/formatTransferToContractScriptData.d.ts +14 -0
- package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -0
- package/dist/wallet/base-wallet-unlocked.d.ts +73 -0
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -0
- package/dist/wallet/index.d.ts +4 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/keystore-wallet.d.ts +38 -0
- package/dist/wallet/keystore-wallet.d.ts.map +1 -0
- package/dist/wallet/wallet.d.ts +68 -0
- package/dist/wallet/wallet.d.ts.map +1 -0
- package/dist/wallet/wallets.d.ts +76 -0
- package/dist/wallet/wallets.d.ts.map +1 -0
- package/dist/wallet-manager/index.d.ts +6 -0
- package/dist/wallet-manager/index.d.ts.map +1 -0
- package/dist/wallet-manager/storages/memory-storage.d.ts +9 -0
- package/dist/wallet-manager/storages/memory-storage.d.ts.map +1 -0
- package/dist/wallet-manager/types.d.ts +42 -0
- package/dist/wallet-manager/types.d.ts.map +1 -0
- package/dist/wallet-manager/vaults/mnemonic-vault.d.ts +29 -0
- package/dist/wallet-manager/vaults/mnemonic-vault.d.ts.map +1 -0
- package/dist/wallet-manager/vaults/privatekey-vault.d.ts +29 -0
- package/dist/wallet-manager/vaults/privatekey-vault.d.ts.map +1 -0
- package/dist/wallet-manager/wallet-manager.d.ts +104 -0
- package/dist/wallet-manager/wallet-manager.d.ts.map +1 -0
- package/dist/wordlists/index.d.ts +5 -0
- package/dist/wordlists/index.d.ts.map +1 -0
- package/dist/wordlists/words/english.d.ts +2 -0
- package/dist/wordlists/words/english.d.ts.map +1 -0
- package/package.json +26 -21
- package/dist/account-E9nGNf5X.d.mts +0 -3837
- package/dist/account-E9nGNf5X.d.ts +0 -3837
- package/dist/configs.d.mts +0 -3
- package/dist/index.d.mts +0 -904
- package/dist/test-utils.d.mts +0 -66
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { B256Address, BytesLike } from '@fuel-ts/interfaces';
|
2
|
+
import { type BigNumberish } from '@fuel-ts/math';
|
3
|
+
interface IAssembleTransferToContractScriptParams {
|
4
|
+
hexlifiedContractId: B256Address;
|
5
|
+
amountToTransfer: BigNumberish;
|
6
|
+
assetId: BytesLike;
|
7
|
+
}
|
8
|
+
export declare const formatTransferToContractScriptData: (params: IAssembleTransferToContractScriptParams) => Uint8Array;
|
9
|
+
export declare const assembleTransferToContractScript: (params: IAssembleTransferToContractScriptParams) => Promise<{
|
10
|
+
script: Uint8Array;
|
11
|
+
scriptData: Uint8Array;
|
12
|
+
}>;
|
13
|
+
export {};
|
14
|
+
//# sourceMappingURL=formatTransferToContractScriptData.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatTransferToContractScriptData.d.ts","sourceRoot":"","sources":["../../src/utils/formatTransferToContractScriptData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAItD,UAAU,uCAAuC;IAC/C,mBAAmB,EAAE,WAAW,CAAC;IACjC,gBAAgB,EAAE,YAAY,CAAC;IAC/B,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,eAAO,MAAM,kCAAkC,WACrC,uCAAuC,eAehD,CAAC;AAEF,eAAO,MAAM,gCAAgC,WACnC,uCAAuC;;;EAmChD,CAAC"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import type { BytesLike } from '@fuel-ts/interfaces';
|
2
|
+
import { Account } from '../account';
|
3
|
+
import type { TransactionResponse, TransactionRequestLike, CallResult, Provider, ProviderSendTxParams, EstimateTransactionParams } from '../providers';
|
4
|
+
import { Signer } from '../signer';
|
5
|
+
/**
|
6
|
+
* `BaseWalletUnlocked` provides the base functionalities for an unlocked wallet.
|
7
|
+
*/
|
8
|
+
export declare class BaseWalletUnlocked extends Account {
|
9
|
+
/**
|
10
|
+
* Default HDWallet path.
|
11
|
+
*/
|
12
|
+
static defaultPath: string;
|
13
|
+
/**
|
14
|
+
* A function that returns the wallet's signer.
|
15
|
+
*/
|
16
|
+
signer: () => Signer;
|
17
|
+
/**
|
18
|
+
* Creates a new BaseWalletUnlocked instance.
|
19
|
+
*
|
20
|
+
* @param privateKey - The private key of the wallet.
|
21
|
+
* @param provider - A Provider instance (optional).
|
22
|
+
*/
|
23
|
+
constructor(privateKey: BytesLike, provider?: Provider);
|
24
|
+
/**
|
25
|
+
* Gets the private key of the wallet.
|
26
|
+
*
|
27
|
+
* @returns The private key of the wallet.
|
28
|
+
*/
|
29
|
+
get privateKey(): string;
|
30
|
+
/**
|
31
|
+
* Gets the public key of the wallet.
|
32
|
+
*
|
33
|
+
* @returns
|
34
|
+
*/
|
35
|
+
get publicKey(): string;
|
36
|
+
/**
|
37
|
+
* Signs a message with the wallet's private key.
|
38
|
+
*
|
39
|
+
* @param message - The message to sign.
|
40
|
+
* @returns A promise that resolves to the signature as a ECDSA 64 bytes string.
|
41
|
+
*/
|
42
|
+
signMessage(message: string): Promise<string>;
|
43
|
+
/**
|
44
|
+
* Signs a transaction with the wallet's private key.
|
45
|
+
*
|
46
|
+
* @param transactionRequestLike - The transaction request to sign.
|
47
|
+
* @returns A promise that resolves to the signature as a ECDSA 64 bytes string.
|
48
|
+
*/
|
49
|
+
signTransaction(transactionRequestLike: TransactionRequestLike): Promise<string>;
|
50
|
+
/**
|
51
|
+
* Populates a transaction with the witnesses signature.
|
52
|
+
*
|
53
|
+
* @param transactionRequestLike - The transaction request to populate.
|
54
|
+
* @returns The populated transaction request.
|
55
|
+
*/
|
56
|
+
populateTransactionWitnessesSignature(transactionRequestLike: TransactionRequestLike): Promise<import("../providers").TransactionRequest>;
|
57
|
+
/**
|
58
|
+
* Populates the witness signature for a transaction and sends it to the network using `provider.sendTransaction`.
|
59
|
+
*
|
60
|
+
* @param transactionRequestLike - The transaction request to send.
|
61
|
+
* @returns A promise that resolves to the TransactionResponse object.
|
62
|
+
*/
|
63
|
+
sendTransaction(transactionRequestLike: TransactionRequestLike, { estimateTxDependencies, awaitExecution }?: ProviderSendTxParams): Promise<TransactionResponse>;
|
64
|
+
/**
|
65
|
+
* Populates the witness signature for a transaction and sends a call to the network using `provider.call`.
|
66
|
+
*
|
67
|
+
* @param transactionRequestLike - The transaction request to simulate.
|
68
|
+
* @returns A promise that resolves to the CallResult object.
|
69
|
+
*/
|
70
|
+
simulateTransaction(transactionRequestLike: TransactionRequestLike, { estimateTxDependencies }?: EstimateTransactionParams): Promise<CallResult>;
|
71
|
+
encrypt(password: string): Promise<string>;
|
72
|
+
}
|
73
|
+
//# sourceMappingURL=base-wallet-unlocked.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base-wallet-unlocked.d.ts","sourceRoot":"","sources":["../../src/wallet/base-wallet-unlocked.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,OAAO;IAC7C;;OAEG;IACH,MAAM,CAAC,WAAW,SAA8B;IAEhD;;OAEG;IACH,MAAM,EAAE,MAAM,MAAM,CAAC;IAErB;;;;;OAKG;gBACS,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAMtD;;;;OAIG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;OAIG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD;;;;;OAKG;IACG,eAAe,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAStF;;;;;OAKG;IACG,qCAAqC,CAAC,sBAAsB,EAAE,sBAAsB;IAS1F;;;;;OAKG;IACG,eAAe,CACnB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,cAAc,EAAE,GAAE,oBAAyB,GAC3E,OAAO,CAAC,mBAAmB,CAAC;IAW/B;;;;;OAKG;IACG,mBAAmB,CACvB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,GAAE,yBAA8B,GAChE,OAAO,CAAC,UAAU,CAAC;IAchB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGjD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { AbstractAddress } from '@fuel-ts/interfaces';
|
2
|
+
export type KeystoreWallet = {
|
3
|
+
id: string;
|
4
|
+
version: number;
|
5
|
+
address: string;
|
6
|
+
crypto: KeystoreCrypto;
|
7
|
+
};
|
8
|
+
type KeystoreCrypto = {
|
9
|
+
cipher: 'aes-128-ctr';
|
10
|
+
cipherparams: {
|
11
|
+
iv: string;
|
12
|
+
};
|
13
|
+
ciphertext: string;
|
14
|
+
kdf: 'scrypt';
|
15
|
+
mac: string;
|
16
|
+
kdfparams: KDFParams;
|
17
|
+
};
|
18
|
+
type KDFParams = {
|
19
|
+
dklen: number;
|
20
|
+
n: number;
|
21
|
+
p: number;
|
22
|
+
r: number;
|
23
|
+
salt: string;
|
24
|
+
};
|
25
|
+
export declare const DEFAULT_KDF_PARAMS_LOG_N = 13;
|
26
|
+
export declare const DEFAULT_KDF_PARAMS_R = 8;
|
27
|
+
export declare const DEFAULT_KDF_PARAMS_P = 1;
|
28
|
+
export declare const DEFAULT_KEY_SIZE = 32;
|
29
|
+
export declare const DEFAULT_IV_SIZE = 16;
|
30
|
+
/**
|
31
|
+
* Removes the '0x' prefix from a hexadecimal string.
|
32
|
+
* If the prefix does not exist, it returns the original string.
|
33
|
+
*/
|
34
|
+
export declare const removeHexPrefix: (hexString: string) => string;
|
35
|
+
export declare function encryptKeystoreWallet(privateKey: string, address: string | AbstractAddress, password: string): Promise<string>;
|
36
|
+
export declare function decryptKeystoreWallet(jsonWallet: string, password: string): Promise<string>;
|
37
|
+
export {};
|
38
|
+
//# sourceMappingURL=keystore-wallet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"keystore-wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/keystore-wallet.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAI3D,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,QAAQ,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,eAAe,cAAe,MAAM,WAMhD,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,eAAe,EACjC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAkDjB;AAED,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgDjG"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { AbstractAddress, BytesLike } from '@fuel-ts/interfaces';
|
2
|
+
import type { Provider } from '../providers';
|
3
|
+
import { WalletLocked, WalletUnlocked } from './wallets';
|
4
|
+
/**
|
5
|
+
* `Wallet` provides methods to create locked and unlocked wallet instances.
|
6
|
+
*/
|
7
|
+
export declare class Wallet {
|
8
|
+
/**
|
9
|
+
* Creates a locked wallet instance from an address and a provider.
|
10
|
+
*
|
11
|
+
* @param address - The address of the wallet.
|
12
|
+
* @param provider - A Provider instance (optional).
|
13
|
+
* @returns A locked wallet instance.
|
14
|
+
*/
|
15
|
+
static fromAddress(address: string | AbstractAddress, provider?: Provider): WalletLocked;
|
16
|
+
/**
|
17
|
+
* Creates an unlocked wallet instance from a private key and a provider.
|
18
|
+
*
|
19
|
+
* @param privateKey - The private key of the wallet.
|
20
|
+
* @param provider - A Provider instance (optional).
|
21
|
+
* @returns An unlocked wallet instance.
|
22
|
+
*/
|
23
|
+
static fromPrivateKey(privateKey: BytesLike, provider?: Provider): WalletUnlocked;
|
24
|
+
/**
|
25
|
+
* Generate a new Wallet Unlocked with a random key pair.
|
26
|
+
*
|
27
|
+
* @param generateOptions - Options to customize the generation process (optional).
|
28
|
+
* @returns An unlocked wallet instance.
|
29
|
+
*/
|
30
|
+
static generate: typeof WalletUnlocked.generate;
|
31
|
+
/**
|
32
|
+
* Create a Wallet Unlocked from a seed.
|
33
|
+
*
|
34
|
+
* @param seed - The seed phrase.
|
35
|
+
* @param provider - A Provider instance (optional).
|
36
|
+
* @param path - The derivation path (optional).
|
37
|
+
* @returns An unlocked wallet instance.
|
38
|
+
*/
|
39
|
+
static fromSeed: typeof WalletUnlocked.fromSeed;
|
40
|
+
/**
|
41
|
+
* Create a Wallet Unlocked from a mnemonic phrase.
|
42
|
+
*
|
43
|
+
* @param mnemonic - The mnemonic phrase.
|
44
|
+
* @param provider - A Provider instance (optional).
|
45
|
+
* @param path - The derivation path (optional).
|
46
|
+
* @param passphrase - The passphrase for the mnemonic (optional).
|
47
|
+
* @returns An unlocked wallet instance.
|
48
|
+
*/
|
49
|
+
static fromMnemonic: typeof WalletUnlocked.fromMnemonic;
|
50
|
+
/**
|
51
|
+
* Create a Wallet Unlocked from an extended key.
|
52
|
+
*
|
53
|
+
* @param extendedKey - The extended key.
|
54
|
+
* @param provider - A Provider instance (optional).
|
55
|
+
* @returns An unlocked wallet instance.
|
56
|
+
*/
|
57
|
+
static fromExtendedKey: typeof WalletUnlocked.fromExtendedKey;
|
58
|
+
/**
|
59
|
+
* Create a Wallet Unlocked from an encrypted JSON.
|
60
|
+
*
|
61
|
+
* @param jsonWallet - The encrypted JSON keystore.
|
62
|
+
* @param password - The password to decrypt the JSON.
|
63
|
+
* @param provider - A Provider instance (optional).
|
64
|
+
* @returns An unlocked wallet instance.
|
65
|
+
*/
|
66
|
+
static fromEncryptedJson: typeof WalletUnlocked.fromEncryptedJson;
|
67
|
+
}
|
68
|
+
//# sourceMappingURL=wallet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD;;GAEG;AACH,qBAAa,MAAM;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,YAAY;IAIxF;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAIhE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,iCAA2B;IAE1C;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,iCAA2B;IAE1C;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,qCAA+B;IAElD;;;;;;OAMG;IACH,MAAM,CAAC,eAAe,wCAAkC;IAExD;;;;;;;OAOG;IACH,MAAM,CAAC,iBAAiB,0CAAoC;CAC7D"}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import type { BytesLike } from '@fuel-ts/interfaces';
|
2
|
+
import { Account } from '../account';
|
3
|
+
import type { Provider } from '../providers';
|
4
|
+
import { BaseWalletUnlocked } from './base-wallet-unlocked';
|
5
|
+
export interface GenerateOptions {
|
6
|
+
/** Additional entropy for the random bytes */
|
7
|
+
entropy?: BytesLike;
|
8
|
+
provider?: Provider;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* `WalletLocked` provides the functionalities for a locked wallet.
|
12
|
+
*/
|
13
|
+
export declare class WalletLocked extends Account {
|
14
|
+
/**
|
15
|
+
* Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.
|
16
|
+
*
|
17
|
+
* @param privateKey - The private key used to unlock the wallet.
|
18
|
+
* @returns An instance of WalletUnlocked.
|
19
|
+
*/
|
20
|
+
unlock(privateKey: BytesLike): WalletUnlocked;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* `WalletUnlocked` provides the functionalities for an unlocked wallet.
|
24
|
+
*/
|
25
|
+
export declare class WalletUnlocked extends BaseWalletUnlocked {
|
26
|
+
/**
|
27
|
+
* Locks the wallet and returns an instance of WalletLocked.
|
28
|
+
*
|
29
|
+
* @returns An instance of WalletLocked.
|
30
|
+
*/
|
31
|
+
lock(): WalletLocked;
|
32
|
+
/**
|
33
|
+
* Generate a new Wallet Unlocked with a random key pair.
|
34
|
+
*
|
35
|
+
* @param generateOptions - Options to customize the generation process (optional).
|
36
|
+
* @returns An instance of WalletUnlocked.
|
37
|
+
*/
|
38
|
+
static generate(generateOptions?: GenerateOptions): WalletUnlocked;
|
39
|
+
/**
|
40
|
+
* Create a Wallet Unlocked from a seed.
|
41
|
+
*
|
42
|
+
* @param seed - The seed phrase.
|
43
|
+
* @param provider - A Provider instance (optional).
|
44
|
+
* @param path - The derivation path (optional).
|
45
|
+
* @returns An instance of WalletUnlocked.
|
46
|
+
*/
|
47
|
+
static fromSeed(seed: string, path?: string, provider?: Provider): WalletUnlocked;
|
48
|
+
/**
|
49
|
+
* Create a Wallet Unlocked from a mnemonic phrase.
|
50
|
+
*
|
51
|
+
* @param mnemonic - The mnemonic phrase.
|
52
|
+
* @param provider - A Provider instance (optional).
|
53
|
+
* @param path - The derivation path (optional).
|
54
|
+
* @param passphrase - The passphrase for the mnemonic (optional).
|
55
|
+
* @returns An instance of WalletUnlocked.
|
56
|
+
*/
|
57
|
+
static fromMnemonic(mnemonic: string, path?: string, passphrase?: BytesLike, provider?: Provider): WalletUnlocked;
|
58
|
+
/**
|
59
|
+
* Create a Wallet Unlocked from an extended key.
|
60
|
+
*
|
61
|
+
* @param extendedKey - The extended key.
|
62
|
+
* @param provider - A Provider instance (optional).
|
63
|
+
* @returns An instance of WalletUnlocked.
|
64
|
+
*/
|
65
|
+
static fromExtendedKey(extendedKey: string, provider?: Provider): WalletUnlocked;
|
66
|
+
/**
|
67
|
+
* Create a Wallet Unlocked from an encrypted JSON.
|
68
|
+
*
|
69
|
+
* @param jsonWallet - The encrypted JSON keystore.
|
70
|
+
* @param password - The password to decrypt the JSON.
|
71
|
+
* @param provider - A Provider instance (optional).
|
72
|
+
* @returns An unlocked wallet instance.
|
73
|
+
*/
|
74
|
+
static fromEncryptedJson(jsonWallet: string, password: string, provider?: Provider): Promise<WalletUnlocked>;
|
75
|
+
}
|
76
|
+
//# sourceMappingURL=wallets.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/wallet/wallets.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,OAAO;IACvC;;;;;OAKG;IACH,MAAM,CAAC,UAAU,EAAE,SAAS,GAAG,cAAc;CAI9C;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;IACpD;;;;OAIG;IACH,IAAI,IAAI,YAAY;IAKpB;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,cAAc;IAMlE;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,cAAc;IAOjF;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,SAAS,EACtB,QAAQ,CAAC,EAAE,QAAQ,GAClB,cAAc;IAQjB;;;;;;OAMG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,cAAc;IAMhF;;;;;;;OAOG;WACU,iBAAiB,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAAC,cAAc,CAAC;CAK3B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { StorageAbstract } from '../types';
|
2
|
+
export declare class MemoryStorage implements StorageAbstract {
|
3
|
+
storage: Map<string, unknown>;
|
4
|
+
getItem<T>(key: string): Promise<T | null>;
|
5
|
+
setItem(key: string, value: string): Promise<void>;
|
6
|
+
removeItem(key: string): Promise<void>;
|
7
|
+
clear(): Promise<void>;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=memory-storage.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"memory-storage.d.ts","sourceRoot":"","sources":["../../../src/wallet-manager/storages/memory-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,qBAAa,aAAc,YAAW,eAAe;IACnD,OAAO,uBAA8B;IAE/B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAK1C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIlC,UAAU,CAAC,GAAG,EAAE,MAAM;IAItB,KAAK;CAGZ"}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import type { AbstractAddress } from '@fuel-ts/interfaces';
|
2
|
+
import type { WalletUnlocked } from '../wallet';
|
3
|
+
export type WalletManagerAccount = {
|
4
|
+
address: AbstractAddress;
|
5
|
+
publicKey: string;
|
6
|
+
vaultId?: number;
|
7
|
+
};
|
8
|
+
export type WalletManagerOptions = {
|
9
|
+
storage: StorageAbstract;
|
10
|
+
};
|
11
|
+
export type VaultConfig = {
|
12
|
+
type: string;
|
13
|
+
title?: string;
|
14
|
+
secret?: string;
|
15
|
+
};
|
16
|
+
export type VaultsState = Array<{
|
17
|
+
type: string;
|
18
|
+
title?: string;
|
19
|
+
data?: VaultConfig;
|
20
|
+
vault: Vault;
|
21
|
+
}>;
|
22
|
+
export interface WalletManagerState {
|
23
|
+
vaults: VaultsState;
|
24
|
+
}
|
25
|
+
export declare abstract class Vault<TOptions = {
|
26
|
+
secret?: string;
|
27
|
+
}> {
|
28
|
+
static readonly type: string;
|
29
|
+
constructor(_options: TOptions);
|
30
|
+
serialize(): TOptions;
|
31
|
+
getAccounts(): WalletManagerAccount[];
|
32
|
+
addAccount(): WalletManagerAccount;
|
33
|
+
exportAccount(_address: AbstractAddress): string;
|
34
|
+
getWallet(_address: AbstractAddress): WalletUnlocked;
|
35
|
+
}
|
36
|
+
export declare abstract class StorageAbstract {
|
37
|
+
abstract setItem(key: string, value: string): Promise<void>;
|
38
|
+
abstract getItem(key: string): Promise<string | null | undefined>;
|
39
|
+
abstract removeItem(key: string): Promise<void>;
|
40
|
+
abstract clear(): Promise<void>;
|
41
|
+
}
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/wallet-manager/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,eAAe,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,8BAAsB,KAAK,CAAC,QAAQ,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;IACxD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEjB,QAAQ,EAAE,QAAQ;IAI9B,SAAS,IAAI,QAAQ;IAIrB,WAAW,IAAI,oBAAoB,EAAE;IAIrC,UAAU,IAAI,oBAAoB;IAIlC,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;IAIhD,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,cAAc;CAGrD;AAED,8BAAsB,eAAe;IACnC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3D,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/C,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAChC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import type { AbstractAddress } from '@fuel-ts/interfaces';
|
2
|
+
import type { WalletUnlocked } from '../../wallet';
|
3
|
+
import type { Vault } from '../types';
|
4
|
+
export interface MnemonicVaultOptions {
|
5
|
+
secret?: string;
|
6
|
+
rootPath?: string;
|
7
|
+
numberOfAccounts?: number | null;
|
8
|
+
}
|
9
|
+
export declare class MnemonicVault implements Vault<MnemonicVaultOptions> {
|
10
|
+
#private;
|
11
|
+
static readonly type = "mnemonic";
|
12
|
+
pathKey: string;
|
13
|
+
rootPath: string;
|
14
|
+
numberOfAccounts: number;
|
15
|
+
constructor(options: MnemonicVaultOptions);
|
16
|
+
getDerivePath(index: number): string;
|
17
|
+
serialize(): MnemonicVaultOptions;
|
18
|
+
getAccounts(): {
|
19
|
+
publicKey: string;
|
20
|
+
address: AbstractAddress;
|
21
|
+
}[];
|
22
|
+
addAccount(): {
|
23
|
+
publicKey: string;
|
24
|
+
address: AbstractAddress;
|
25
|
+
};
|
26
|
+
exportAccount(address: string | AbstractAddress): string;
|
27
|
+
getWallet(address: string | AbstractAddress): WalletUnlocked;
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=mnemonic-vault.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mnemonic-vault.d.ts","sourceRoot":"","sources":["../../../src/wallet-manager/vaults/mnemonic-vault.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,qBAAa,aAAc,YAAW,KAAK,CAAC,oBAAoB,CAAC;;IAC/D,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAc;IAGlC,OAAO,SAAQ;IACf,QAAQ,EAAE,MAAM,CAA4C;IAC5D,gBAAgB,EAAE,MAAM,CAAK;gBAEjB,OAAO,EAAE,oBAAoB;IAOzC,aAAa,CAAC,KAAK,EAAE,MAAM;IAO3B,SAAS,IAAI,oBAAoB;IAQjC,WAAW;;;;IAiBX,UAAU;;;;IAUV,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,MAAM;IAkBxD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,cAAc;CAI7D"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import type { AbstractAddress } from '@fuel-ts/interfaces';
|
2
|
+
import type { WalletUnlocked } from '../../wallet';
|
3
|
+
import type { WalletManagerAccount, Vault } from '../types';
|
4
|
+
export interface PkVaultOptions {
|
5
|
+
secret?: string;
|
6
|
+
accounts?: Array<string>;
|
7
|
+
}
|
8
|
+
export declare class PrivateKeyVault implements Vault<PkVaultOptions> {
|
9
|
+
#private;
|
10
|
+
static readonly type = "privateKey";
|
11
|
+
/**
|
12
|
+
* If privateKey vault is initialized with a secretKey, it creates
|
13
|
+
* one account with the fallowing secret
|
14
|
+
*/
|
15
|
+
constructor(options?: PkVaultOptions);
|
16
|
+
serialize(): PkVaultOptions;
|
17
|
+
getPublicAccount(privateKey: string): {
|
18
|
+
address: AbstractAddress;
|
19
|
+
publicKey: string;
|
20
|
+
};
|
21
|
+
getAccounts(): WalletManagerAccount[];
|
22
|
+
addAccount(): {
|
23
|
+
address: AbstractAddress;
|
24
|
+
publicKey: string;
|
25
|
+
};
|
26
|
+
exportAccount(address: string | AbstractAddress): string;
|
27
|
+
getWallet(address: string | AbstractAddress): WalletUnlocked;
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=privatekey-vault.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"privatekey-vault.d.ts","sourceRoot":"","sources":["../../../src/wallet-manager/vaults/privatekey-vault.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE5D,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,qBAAa,eAAgB,YAAW,KAAK,CAAC,cAAc,CAAC;;IAC3D,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB;IAIpC;;;OAGG;gBACS,OAAO,GAAE,cAAmB;IAQxC,SAAS,IAAI,cAAc;IAM3B,gBAAgB,CAAC,UAAU,EAAE,MAAM;;;;IAQnC,WAAW,IAAI,oBAAoB,EAAE;IAIrC,UAAU;;;;IAQV,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,MAAM;IAgBxD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,cAAc;CAI7D"}
|
@@ -0,0 +1,104 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import type { AbstractAddress } from '@fuel-ts/interfaces';
|
3
|
+
import { EventEmitter } from 'events';
|
4
|
+
import type { WalletUnlocked } from '../wallet';
|
5
|
+
import type { StorageAbstract, WalletManagerAccount, VaultConfig, WalletManagerOptions, Vault } from './types';
|
6
|
+
import { MnemonicVault } from './vaults/mnemonic-vault';
|
7
|
+
import { PrivateKeyVault } from './vaults/privatekey-vault';
|
8
|
+
/**
|
9
|
+
* WalletManager is a upper package to manage multiple vaults like mnemonic and privateKeys.
|
10
|
+
*
|
11
|
+
* - VaultTypes can be add to `WalletManager.Vaults` enabling to add custom Vault types.
|
12
|
+
* - Storage can be instantiate when initializing enabling custom storage types.
|
13
|
+
*/
|
14
|
+
export declare class WalletManager extends EventEmitter {
|
15
|
+
#private;
|
16
|
+
/**
|
17
|
+
* Vaults
|
18
|
+
*
|
19
|
+
* Vaults are responsible to store secret keys and return an `Wallet` instance,
|
20
|
+
* to interact with the network.
|
21
|
+
*
|
22
|
+
* Each vault has access to its own state
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
static Vaults: (typeof MnemonicVault | typeof PrivateKeyVault)[];
|
26
|
+
/**
|
27
|
+
* Storage
|
28
|
+
*
|
29
|
+
* Persistent encrypted data. `The default storage works only on memory`.
|
30
|
+
*/
|
31
|
+
readonly storage: StorageAbstract;
|
32
|
+
readonly STORAGE_KEY: string;
|
33
|
+
constructor(options?: WalletManagerOptions);
|
34
|
+
get isLocked(): boolean;
|
35
|
+
/**
|
36
|
+
* Return the vault serialized object containing all the privateKeys,
|
37
|
+
* the format of the return depends on the Vault type.
|
38
|
+
*/
|
39
|
+
exportVault<T extends Vault>(vaultId: number): ReturnType<T['serialize']>;
|
40
|
+
/**
|
41
|
+
* List all vaults on the Wallet Manager, this function not return secret's
|
42
|
+
*/
|
43
|
+
getVaults(): Array<{
|
44
|
+
title?: string;
|
45
|
+
type: string;
|
46
|
+
vaultId: number;
|
47
|
+
}>;
|
48
|
+
/**
|
49
|
+
* List all accounts on the Wallet Manager not vault information is revealed
|
50
|
+
*/
|
51
|
+
getAccounts(): Array<WalletManagerAccount>;
|
52
|
+
/**
|
53
|
+
* Create a Wallet instance for the specific account
|
54
|
+
*/
|
55
|
+
getWallet(address: string | AbstractAddress): WalletUnlocked;
|
56
|
+
/**
|
57
|
+
* Export specific account privateKey
|
58
|
+
*/
|
59
|
+
exportPrivateKey(address: string | AbstractAddress): string;
|
60
|
+
/**
|
61
|
+
* Add account to a selected vault or on the first vault as default.
|
62
|
+
* If not vaults are adds it will return error
|
63
|
+
*/
|
64
|
+
addAccount(options?: {
|
65
|
+
vaultId: number;
|
66
|
+
}): Promise<WalletManagerAccount>;
|
67
|
+
/**
|
68
|
+
* Remove vault by index, by remove the vault you also remove all accounts
|
69
|
+
* created by the vault.
|
70
|
+
*/
|
71
|
+
removeVault(index: number): Promise<void>;
|
72
|
+
/**
|
73
|
+
* Add Vault, the `vaultConfig.type` will look for the Vaults supported if
|
74
|
+
* didn't found it will throw.
|
75
|
+
*/
|
76
|
+
addVault(vaultConfig: VaultConfig): Promise<void>;
|
77
|
+
/**
|
78
|
+
* Lock wallet. It removes passphrase from class instance, encrypt and hide all address and
|
79
|
+
* secrets.
|
80
|
+
*/
|
81
|
+
lock(): void;
|
82
|
+
/**
|
83
|
+
* Unlock wallet. It sets passphrase on WalletManger instance load all address from configured vaults.
|
84
|
+
* Vaults with secrets are not unlocked or instantiated on this moment.
|
85
|
+
*/
|
86
|
+
unlock(passphrase: string): Promise<void>;
|
87
|
+
/**
|
88
|
+
* Update WalletManager encryption passphrase
|
89
|
+
*/
|
90
|
+
updatePassphrase(oldpass: string, newpass: string): Promise<void>;
|
91
|
+
/**
|
92
|
+
* Retrieve and decrypt WalletManager state from storage
|
93
|
+
*/
|
94
|
+
loadState(): Promise<void>;
|
95
|
+
/**
|
96
|
+
* Store encrypted WalletManager state on storage
|
97
|
+
*/
|
98
|
+
private saveState;
|
99
|
+
/**
|
100
|
+
* Return a instantiable Class reference from `WalletManager.Vaults` supported list.
|
101
|
+
*/
|
102
|
+
private getVaultClass;
|
103
|
+
}
|
104
|
+
//# sourceMappingURL=wallet-manager.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wallet-manager.d.ts","sourceRoot":"","sources":["../../src/wallet-manager/wallet-manager.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,WAAW,EAEX,oBAAoB,EAEpB,KAAK,EACN,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAmB5D;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,YAAY;;IAC7C;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,oDAAoC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAuB;IAExD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAmB;gBAOnC,OAAO,CAAC,EAAE,oBAAoB;IAK1C,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;OAGG;IACH,WAAW,CAAC,CAAC,SAAS,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAOzE;;OAEG;IACH,SAAS,IAAI,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAQrE;;OAEG;IACH,WAAW,IAAI,KAAK,CAAC,oBAAoB,CAAC;IAO1C;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,cAAc;IAU5D;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAWlD;;;OAGG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;IAc9C;;;OAGG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM;IAK/B;;;OAGG;IACG,QAAQ,CAAC,WAAW,EAAE,WAAW;IAiBvC;;;OAGG;IACH,IAAI;IAUJ;;;OAGG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM;IAmB/B;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAgBvD;;OAEG;IACG,SAAS;IAUf;;OAEG;YACW,SAAS;IAuCvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAOtB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wordlists/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,oBAAY,QAAQ;IAClB,SAAS,YAAY;CACtB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"english.d.ts","sourceRoot":"","sources":["../../../src/wordlists/words/english.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAigEnB,CAAC"}
|