@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/index.d.ts
CHANGED
@@ -1,13 +1,904 @@
|
|
1
|
-
import './
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
import { T as TransactionRequestLike, a as TransactionRequest, b as TransactionResultReceipt, G as GqlTransactionStatusesNames, c as TransactionStatus, d as GraphqlTransactionStatus, e as TransactionSummary, f as TransactionTypeName, O as OperationCoin, g as Operation, I as InputParam, R as ReceiptParam, h as InputOutputParam, i as GetOperationParams, j as RawPayloadParam, k as GetTransferOperationsParams, P as Provider, A as AbiMap, l as TransactionResult, m as GqlGetTransactionsByOwnerQueryVariables, n as GqlPageInfo, o as GqlGasCosts, p as GqlReceiptFragmentFragment, M as MintedAsset, B as BurnedAsset, q as GqlConsensusParameters, r as GqlFeeParameters, s as GqlDependentCost, t as TransactionRequestInput, N as NetworkEthereum, u as NetworkFuel, v as Asset, w as AssetEth, x as AssetFuel, y as Assets, W as WalletLocked, z as WalletUnlocked, F as FuelConnector, C as Network$1, D as Account } from './account-E9nGNf5X.js';
|
2
|
+
export { bj as AccountEvent, bi as AccountsEvent, b7 as AddressType, bp as AssetsEvent, aF as BaseTransactionRequest, aE as BaseTransactionRequestLike, H as BaseWalletUnlocked, a0 as Block, ah as BlockHeader, b4 as BlockId, _ as CallResult, a2 as ChainInfo, b8 as ChainName, az as ChangeTransactionRequestOutput, Z as Coin, U as CoinQuantity, Q as CoinQuantityLike, at as CoinTransactionRequestInput, ax as CoinTransactionRequestOutput, bk as ConnectionEvent, bo as ConnectorEvent, bb as ConnectorMetadata, bn as ConnectorsEvent, aB as ContractCreatedTransactionRequestOutput, a1 as ContractResult, av as ContractTransactionRequestInput, ay as ContractTransactionRequestOutput, aH as CreateTransactionRequest, aG as CreateTransactionRequestLike, a6 as CursorPaginationArgs, aa as EstimatePredicateParams, a9 as EstimateTransactionParams, $ as EstimateTxDependenciesReturns, ao as ExcludeResourcesOption, a_ as FailureStatus, bg as FuelABI, be as FuelConnectorEventType, bd as FuelConnectorEventTypes, bq as FuelConnectorEvents, br as FuelConnectorEventsType, bc as FuelConnectorMethods, bh as FuelEventArg, J as GenerateOptions, aY as GqlTransaction, X as IAddAmountToAssetParams, ag as MerkleProof, ae as Message, af as MessageCoin, ai as MessageProof, aj as MessageStatus, au as MessageTransactionRequestInput, bl as NetworkEvent, bm as NetworksEvent, a3 as NodeInfo, a4 as NodeInfoAndConsensusParameters, b6 as OperationFunctionCall, b5 as OperationName, b9 as OperationTransactionAddress, ba as OutputParam, L as Predicate, K as PredicateParams, b2 as ProgramState, ac as ProviderCallParams, a7 as ProviderOptions, ad as ProviderSendTxParams, ak as RawCoin, al as RawMessage, am as RawResource, b1 as Reason, an as Resource, aJ as ScriptTransactionRequest, aI as ScriptTransactionRequestLike, S as Signer, b0 as SqueezedOutStatus, a$ as SubmittedStatus, aZ as SuccessStatus, b3 as Time, a5 as TransactionCost, ab as TransactionCostParams, aC as TransactionRequestOutput, aX as TransactionResponse, aW as TransactionResultBurnReceipt, aK as TransactionResultCallReceipt, aQ as TransactionResultLogDataReceipt, aP as TransactionResultLogReceipt, aU as TransactionResultMessageOutReceipt, aV as TransactionResultMintReceipt, aN as TransactionResultPanicReceipt, aM as TransactionResultReturnDataReceipt, aL as TransactionResultReturnReceipt, aO as TransactionResultRevertReceipt, aT as TransactionResultScriptResultReceipt, aS as TransactionResultTransferOutReceipt, aR as TransactionResultTransferReceipt, E as TxParamsType, a8 as UTXOValidationParams, aA as VariableTransactionRequestOutput, bf as Version, Y as addAmountToAsset, V as coinQuantityfy, aw as inputify, ar as isCoin, as as isMessage, ap as isRawCoin, aq as isRawMessage, aD as outputify } from './account-E9nGNf5X.js';
|
3
|
+
import { BytesLike, AbstractAddress, AbstractScriptRequest } from '@fuel-ts/interfaces';
|
4
|
+
import { EventEmitter } from 'events';
|
5
|
+
import { Interface } from '@fuel-ts/abi-coder';
|
6
|
+
import * as _fuel_ts_transactions from '@fuel-ts/transactions';
|
7
|
+
import { Output, OutputType, OutputContractCreated, OutputCoin, OutputChange, OutputContract, OutputVariable, Input, InputType, InputCoin, InputMessage, InputContract, ReceiptType, TransactionType, Transaction, ReceiptRevert, ReceiptPanic, ReceiptCall, ReceiptReturn, ReceiptReturnData, ReceiptLog, ReceiptLogData, ReceiptTransfer, ReceiptTransferOut, ReceiptScriptResult, ReceiptMessageOut, ReceiptMint, ReceiptBurn } from '@fuel-ts/transactions';
|
8
|
+
export { TransactionType } from '@fuel-ts/transactions';
|
9
|
+
import { BN, BNInput } from '@fuel-ts/math';
|
10
|
+
import '@fuel-ts/address';
|
11
|
+
import 'ethers';
|
12
|
+
import 'graphql';
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @hidden
|
16
|
+
*
|
17
|
+
* Calculates the predicate root for a given bytecode and chain ID.
|
18
|
+
*
|
19
|
+
* @param bytecode - The bytecode represented as a BytesLike object.
|
20
|
+
* @param chainId - The ID of the chain associated with the bytecode.
|
21
|
+
* @returns The predicate root as a string.
|
22
|
+
*/
|
23
|
+
declare const getPredicateRoot: (bytecode: BytesLike) => string;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* @hidden
|
27
|
+
*/
|
28
|
+
declare class ChangeOutputCollisionError extends Error {
|
29
|
+
name: string;
|
30
|
+
message: string;
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* @hidden
|
34
|
+
*/
|
35
|
+
declare class NoWitnessAtIndexError extends Error {
|
36
|
+
readonly index: number;
|
37
|
+
name: string;
|
38
|
+
constructor(index: number);
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* @hidden
|
42
|
+
*/
|
43
|
+
declare class NoWitnessByOwnerError extends Error {
|
44
|
+
readonly owner: AbstractAddress;
|
45
|
+
name: string;
|
46
|
+
constructor(owner: AbstractAddress);
|
47
|
+
}
|
48
|
+
|
49
|
+
/** @hidden */
|
50
|
+
declare const returnZeroScript: AbstractScriptRequest<void>;
|
51
|
+
/** @hidden */
|
52
|
+
declare const withdrawScript: AbstractScriptRequest<void>;
|
53
|
+
|
54
|
+
/** @hidden */
|
55
|
+
declare const transactionRequestify: (obj: TransactionRequestLike) => TransactionRequest;
|
56
|
+
|
57
|
+
/** @hidden */
|
58
|
+
declare function getDecodedLogs<T = unknown>(receipts: Array<TransactionResultReceipt>, abiInterface: Interface): T[];
|
59
|
+
|
60
|
+
/** @hidden */
|
61
|
+
declare function getOutputsByType<T = Output>(outputs: Output[], type: OutputType): T[];
|
62
|
+
/** @hidden */
|
63
|
+
declare function getOutputsContractCreated(outputs: Output[]): OutputContractCreated[];
|
64
|
+
/** @hidden */
|
65
|
+
declare function getOutputsCoin(outputs: Output[]): OutputCoin[];
|
66
|
+
/** @hidden */
|
67
|
+
declare function getOutputsChange(outputs: Output[]): OutputChange[];
|
68
|
+
/** @hidden */
|
69
|
+
declare function getOutputsContract(outputs: Output[]): OutputContract[];
|
70
|
+
/** @hidden */
|
71
|
+
declare function getOutputsVariable(outputs: Output[]): OutputVariable[];
|
72
|
+
|
73
|
+
/** @hidden */
|
74
|
+
declare function getInputsByTypes<T = Input>(inputs: Input[], types: Array<InputType>): T[];
|
75
|
+
/** @hidden */
|
76
|
+
declare function getInputsByType<T = Input>(inputs: Input[], type: InputType): T[];
|
77
|
+
/** @hidden */
|
78
|
+
declare function getInputsCoin(inputs: Input[]): InputCoin[];
|
79
|
+
/** @hidden */
|
80
|
+
declare function getInputsMessage(inputs: Input[]): InputMessage[];
|
81
|
+
/** @hidden */
|
82
|
+
declare function getInputsCoinAndMessage(inputs: Input[]): (InputCoin | InputMessage)[];
|
83
|
+
/** @hidden */
|
84
|
+
declare function getInputsContract(inputs: Input[]): InputContract[];
|
85
|
+
/** @hidden */
|
86
|
+
declare function getInputFromAssetId(inputs: Input[], assetId: string): InputCoin | InputMessage | undefined;
|
87
|
+
/** @hidden */
|
88
|
+
declare function getInputContractFromIndex(inputs: Input[], inputIndex: number): InputContract | undefined;
|
89
|
+
/** @hidden */
|
90
|
+
declare function getInputAccountAddress(input: Input): string;
|
91
|
+
|
92
|
+
/** @hidden */
|
93
|
+
declare const getTransactionStatusName: (gqlStatus: GqlTransactionStatusesNames) => TransactionStatus;
|
94
|
+
type IProcessGraphqlStatusResponse = Pick<TransactionSummary, 'time' | 'blockId' | 'isStatusPending' | 'isStatusSuccess' | 'isStatusFailure' | 'status'>;
|
95
|
+
/** @hidden */
|
96
|
+
declare const processGraphqlStatus: (gqlTransactionStatus?: GraphqlTransactionStatus) => IProcessGraphqlStatusResponse;
|
97
|
+
|
98
|
+
/** @hidden */
|
99
|
+
declare function getReceiptsByType<T = TransactionResultReceipt>(receipts: TransactionResultReceipt[], type: ReceiptType): T[];
|
100
|
+
/** @hidden */
|
101
|
+
declare function getTransactionTypeName(transactionType: TransactionType): TransactionTypeName;
|
102
|
+
/** @hidden */
|
103
|
+
declare function isType(transactionType: TransactionType, type: TransactionTypeName): boolean;
|
104
|
+
/** @hidden */
|
105
|
+
declare function isTypeMint(transactionType: TransactionType): boolean;
|
106
|
+
/** @hidden */
|
107
|
+
declare function isTypeCreate(transactionType: TransactionType): boolean;
|
108
|
+
/** @hidden */
|
109
|
+
declare function isTypeScript(transactionType: TransactionType): boolean;
|
110
|
+
/** @hidden */
|
111
|
+
declare function hasSameAssetId(a: OperationCoin): (b: OperationCoin) => boolean;
|
112
|
+
/** @hidden */
|
113
|
+
declare function getReceiptsCall(receipts: TransactionResultReceipt[]): _fuel_ts_transactions.ReceiptCall[];
|
114
|
+
/** @hidden */
|
115
|
+
declare function getReceiptsMessageOut(receipts: TransactionResultReceipt[]): _fuel_ts_transactions.ReceiptMessageOut[];
|
116
|
+
/** @hidden */
|
117
|
+
declare function addOperation(operations: Operation[], toAdd: Operation): Operation[];
|
118
|
+
/** @hidden */
|
119
|
+
declare function getReceiptsTransferOut(receipts: TransactionResultReceipt[]): _fuel_ts_transactions.ReceiptTransferOut[];
|
120
|
+
/** @hidden */
|
121
|
+
declare function getWithdrawFromFuelOperations({ inputs, receipts, }: InputParam & ReceiptParam): Operation[];
|
122
|
+
/** @hidden */
|
123
|
+
declare function getContractCallOperations({ inputs, outputs, receipts, abiMap, rawPayload, maxInputs, }: InputOutputParam & ReceiptParam & Pick<GetOperationParams, 'abiMap' | 'maxInputs'> & RawPayloadParam): Operation[];
|
124
|
+
/** @hidden */
|
125
|
+
declare function getTransferOperations({ inputs, outputs, receipts, }: GetTransferOperationsParams): Operation[];
|
126
|
+
/** @hidden */
|
127
|
+
declare function getPayProducerOperations(outputs: Output[]): Operation[];
|
128
|
+
/** @hidden */
|
129
|
+
declare function getContractCreatedOperations({ inputs, outputs }: InputOutputParam): Operation[];
|
130
|
+
/** @hidden */
|
131
|
+
declare function getOperations({ transactionType, inputs, outputs, receipts, abiMap, rawPayload, maxInputs, }: GetOperationParams): Operation[];
|
132
|
+
|
133
|
+
/** @hidden */
|
134
|
+
interface GetTransactionSummaryParams {
|
135
|
+
id: string;
|
136
|
+
provider: Provider;
|
137
|
+
abiMap?: AbiMap;
|
138
|
+
}
|
139
|
+
declare function getTransactionSummary<TTransactionType = void>(params: GetTransactionSummaryParams): Promise<TransactionResult>;
|
140
|
+
interface GetTransactionSummaryFromRequestParams {
|
141
|
+
transactionRequest: TransactionRequest;
|
142
|
+
provider: Provider;
|
143
|
+
abiMap?: AbiMap;
|
144
|
+
}
|
145
|
+
/** @hidden */
|
146
|
+
declare function getTransactionSummaryFromRequest<TTransactionType = void>(params: GetTransactionSummaryFromRequestParams): Promise<TransactionSummary<TTransactionType>>;
|
147
|
+
interface GetTransactionsSummariesParams {
|
148
|
+
provider: Provider;
|
149
|
+
filters: GqlGetTransactionsByOwnerQueryVariables;
|
150
|
+
abiMap?: AbiMap;
|
151
|
+
}
|
152
|
+
interface GetTransactionsSummariesReturns {
|
153
|
+
transactions: TransactionResult[];
|
154
|
+
pageInfo: GqlPageInfo;
|
155
|
+
}
|
156
|
+
/** @hidden */
|
157
|
+
declare function getTransactionsSummaries(params: GetTransactionsSummariesParams): Promise<GetTransactionsSummariesReturns>;
|
158
|
+
|
159
|
+
interface AssembleTransactionSummaryParams {
|
160
|
+
gasPerByte: BN;
|
161
|
+
gasPriceFactor: BN;
|
162
|
+
transaction: Transaction;
|
163
|
+
id?: string;
|
164
|
+
transactionBytes: Uint8Array;
|
165
|
+
gqlTransactionStatus?: GraphqlTransactionStatus;
|
166
|
+
receipts: TransactionResultReceipt[];
|
167
|
+
abiMap?: AbiMap;
|
168
|
+
maxInputs: BN;
|
169
|
+
gasCosts: GqlGasCosts;
|
170
|
+
}
|
171
|
+
/** @hidden */
|
172
|
+
declare function assembleTransactionSummary<TTransactionType = void>(params: AssembleTransactionSummaryParams): TransactionSummary<TTransactionType>;
|
173
|
+
|
174
|
+
declare const processGqlReceipt: (gqlReceipt: GqlReceiptFragmentFragment) => TransactionResultReceipt;
|
175
|
+
declare const extractMintedAssetsFromReceipts: (receipts: Array<TransactionResultReceipt>) => MintedAsset[];
|
176
|
+
declare const extractBurnedAssetsFromReceipts: (receipts: Array<TransactionResultReceipt>) => BurnedAsset[];
|
177
|
+
|
178
|
+
type FeeParams = Pick<GqlFeeParameters, 'gasPerByte' | 'gasPriceFactor'> | {
|
179
|
+
gasPerByte: BN | number;
|
180
|
+
gasPriceFactor: BN | number;
|
181
|
+
};
|
182
|
+
type CalculateTransactionFeeParams = {
|
183
|
+
gasUsed: BN;
|
184
|
+
rawPayload: string;
|
185
|
+
consensusParameters: Pick<GqlConsensusParameters, 'gasCosts'> & {
|
186
|
+
feeParams: FeeParams;
|
187
|
+
};
|
188
|
+
};
|
189
|
+
declare const calculateTransactionFee: (params: CalculateTransactionFeeParams) => {
|
190
|
+
fee: BN;
|
191
|
+
minFee: BN;
|
192
|
+
maxFee: BN;
|
193
|
+
feeFromGasUsed: BN;
|
194
|
+
};
|
195
|
+
|
196
|
+
/** @hidden */
|
197
|
+
declare const getReceiptsWithMissingData: (receipts: Array<TransactionResultReceipt>) => {
|
198
|
+
missingOutputVariables: Array<ReceiptRevert>;
|
199
|
+
missingOutputContractIds: Array<ReceiptPanic>;
|
200
|
+
};
|
201
|
+
declare function assembleReceiptByType(receipt: GqlReceiptFragmentFragment): ReceiptCall | ReceiptReturn | ReceiptReturnData | ReceiptPanic | ReceiptRevert | ReceiptLog | ReceiptLogData | ReceiptTransfer | ReceiptTransferOut | ReceiptScriptResult | ReceiptMessageOut | ReceiptMint | ReceiptBurn;
|
202
|
+
|
203
|
+
/**
|
204
|
+
* @hidden
|
205
|
+
*
|
206
|
+
* Builds a block explorer url based on and the given path, block explorer URL and provider URL
|
207
|
+
*/
|
208
|
+
declare const buildBlockExplorerUrl: (options?: {
|
209
|
+
blockExplorerUrl?: string;
|
210
|
+
path?: string;
|
211
|
+
providerUrl?: string;
|
212
|
+
address?: string;
|
213
|
+
txId?: string;
|
214
|
+
blockNumber?: number;
|
215
|
+
}) => string;
|
216
|
+
|
217
|
+
/** @hidden */
|
218
|
+
declare const calculatePriceWithFactor: (gas: BN, gasPrice: BN, priceFactor: BN) => BN;
|
219
|
+
/** @hidden */
|
220
|
+
declare const getGasUsedFromReceipts: (receipts: Array<TransactionResultReceipt>) => BN;
|
221
|
+
declare function resolveGasDependentCosts(byteSize: BNInput, gasDependentCost: GqlDependentCost): BN;
|
222
|
+
declare function gasUsedByInputs(inputs: Array<TransactionRequestInput | Input>, txBytesSize: number, gasCosts: GqlGasCosts): BN;
|
223
|
+
interface IGetMinGasParams {
|
224
|
+
inputs: Array<TransactionRequestInput | Input>;
|
225
|
+
gasCosts: GqlGasCosts;
|
226
|
+
txBytesSize: number;
|
227
|
+
metadataGas: BN;
|
228
|
+
gasPerByte: BN;
|
229
|
+
}
|
230
|
+
declare function getMinGas(params: IGetMinGasParams): BN;
|
231
|
+
interface IGetMaxGasParams {
|
232
|
+
witnessesLength: number;
|
233
|
+
witnessLimit?: BN;
|
234
|
+
gasPerByte: BN;
|
235
|
+
minGas: BN;
|
236
|
+
gasLimit?: BN;
|
237
|
+
}
|
238
|
+
declare function getMaxGas(params: IGetMaxGasParams): BN;
|
239
|
+
declare function calculateMetadataGasForTxCreate({ gasCosts, stateRootSize, txBytesSize, contractBytesSize, }: {
|
240
|
+
gasCosts: GqlGasCosts;
|
241
|
+
contractBytesSize: BN;
|
242
|
+
stateRootSize: number;
|
243
|
+
txBytesSize: number;
|
244
|
+
}): BN;
|
245
|
+
declare function calculateMetadataGasForTxScript({ gasCosts, txBytesSize, }: {
|
246
|
+
gasCosts: GqlGasCosts;
|
247
|
+
txBytesSize: number;
|
248
|
+
}): BN;
|
249
|
+
|
250
|
+
/**
|
251
|
+
* Stringify Transaction to a JSON object
|
252
|
+
* compatible with the Transaction class constructor.
|
253
|
+
*/
|
254
|
+
/** @hidden */
|
255
|
+
declare function normalizeJSON(root: any): any;
|
256
|
+
|
257
|
+
/** @hidden */
|
258
|
+
declare function sleep(time: number): Promise<unknown>;
|
259
|
+
|
260
|
+
type Network = NetworkEthereum | NetworkFuel;
|
261
|
+
type NetworkTypes = NetworkEthereum['type'] | NetworkFuel['type'];
|
262
|
+
type NetworkTypeToNetwork<T> = T extends 'ethereum' ? NetworkEthereum : T extends 'fuel' ? NetworkFuel : Network;
|
263
|
+
/**
|
264
|
+
* Returns the default chainId for the given network
|
265
|
+
*/
|
266
|
+
declare const getDefaultChainId: (networkType: NetworkTypes) => number | undefined;
|
267
|
+
type GetAssetNetworkParams<T extends NetworkTypes | undefined> = {
|
268
|
+
asset: Asset;
|
269
|
+
chainId?: number;
|
270
|
+
networkType: T;
|
271
|
+
};
|
272
|
+
/**
|
273
|
+
* Returns the asset's network on the given network
|
274
|
+
* eg. getAssetNetwork({ asset, chainId: 1, networkType: 'ethereum' }) will return the asset's details on Ethereum mainnet
|
275
|
+
*/
|
276
|
+
declare const getAssetNetwork: <T extends NetworkTypes | undefined>({ asset, chainId, networkType, }: GetAssetNetworkParams<T>) => NetworkTypeToNetwork<T>;
|
277
|
+
/**
|
278
|
+
* Returns the asset's details on the given network alongwith the asset itself
|
279
|
+
* eg. getAssetWithNetwork({ asset, chainId: 1, networkType: 'ethereum' }) will return the asset's details on Ethereum mainnet and the asset itself
|
280
|
+
*/
|
281
|
+
declare const getAssetWithNetwork: <T extends NetworkTypes>({ asset, chainId, networkType, }: GetAssetNetworkParams<T>) => AssetEth | AssetFuel | undefined;
|
282
|
+
/**
|
283
|
+
* Returns the asset's details on Ethereum
|
284
|
+
*/
|
285
|
+
declare const getAssetEth: (asset: Asset, chainId?: number) => AssetEth | undefined;
|
286
|
+
/**
|
287
|
+
* Returns the asset's details on Fuel
|
288
|
+
*/
|
289
|
+
declare const getAssetFuel: (asset: Asset, chainId?: number) => AssetFuel | undefined;
|
290
|
+
|
291
|
+
/**
|
292
|
+
* Returns the list of assets with the icon paths 'resolved'. eg. `./eth.svg` -> `https://some-url.com/eth.svg`
|
293
|
+
* @param assets - List of assets
|
294
|
+
* @param basePath - Base path for the icon URLs (default: './')
|
295
|
+
* @returns The assets with the icon paths resolved
|
296
|
+
*/
|
297
|
+
declare function resolveIconPaths(assets: Assets, basePath?: string): {
|
298
|
+
icon: string;
|
299
|
+
name: string;
|
300
|
+
symbol: string;
|
301
|
+
networks: (NetworkEthereum | NetworkFuel)[];
|
302
|
+
}[];
|
303
|
+
|
304
|
+
declare function urlJoin(baseUrl: string | undefined, ...paths: Array<string>): string;
|
305
|
+
|
306
|
+
declare const assets: Assets;
|
307
|
+
|
308
|
+
declare const CHAIN_IDS: {
|
309
|
+
eth: {
|
310
|
+
sepolia: number;
|
311
|
+
foundry: number;
|
312
|
+
};
|
313
|
+
fuel: {
|
314
|
+
beta5: number;
|
315
|
+
devnet: number;
|
316
|
+
};
|
317
|
+
};
|
318
|
+
|
319
|
+
/**
|
320
|
+
* `Wallet` provides methods to create locked and unlocked wallet instances.
|
321
|
+
*/
|
322
|
+
declare class Wallet {
|
323
|
+
/**
|
324
|
+
* Creates a locked wallet instance from an address and a provider.
|
325
|
+
*
|
326
|
+
* @param address - The address of the wallet.
|
327
|
+
* @param provider - A Provider instance (optional).
|
328
|
+
* @returns A locked wallet instance.
|
329
|
+
*/
|
330
|
+
static fromAddress(address: string | AbstractAddress, provider?: Provider): WalletLocked;
|
331
|
+
/**
|
332
|
+
* Creates an unlocked wallet instance from a private key and a provider.
|
333
|
+
*
|
334
|
+
* @param privateKey - The private key of the wallet.
|
335
|
+
* @param provider - A Provider instance (optional).
|
336
|
+
* @returns An unlocked wallet instance.
|
337
|
+
*/
|
338
|
+
static fromPrivateKey(privateKey: BytesLike, provider?: Provider): WalletUnlocked;
|
339
|
+
/**
|
340
|
+
* Generate a new Wallet Unlocked with a random key pair.
|
341
|
+
*
|
342
|
+
* @param generateOptions - Options to customize the generation process (optional).
|
343
|
+
* @returns An unlocked wallet instance.
|
344
|
+
*/
|
345
|
+
static generate: typeof WalletUnlocked.generate;
|
346
|
+
/**
|
347
|
+
* Create a Wallet Unlocked from a seed.
|
348
|
+
*
|
349
|
+
* @param seed - The seed phrase.
|
350
|
+
* @param provider - A Provider instance (optional).
|
351
|
+
* @param path - The derivation path (optional).
|
352
|
+
* @returns An unlocked wallet instance.
|
353
|
+
*/
|
354
|
+
static fromSeed: typeof WalletUnlocked.fromSeed;
|
355
|
+
/**
|
356
|
+
* Create a Wallet Unlocked from a mnemonic phrase.
|
357
|
+
*
|
358
|
+
* @param mnemonic - The mnemonic phrase.
|
359
|
+
* @param provider - A Provider instance (optional).
|
360
|
+
* @param path - The derivation path (optional).
|
361
|
+
* @param passphrase - The passphrase for the mnemonic (optional).
|
362
|
+
* @returns An unlocked wallet instance.
|
363
|
+
*/
|
364
|
+
static fromMnemonic: typeof WalletUnlocked.fromMnemonic;
|
365
|
+
/**
|
366
|
+
* Create a Wallet Unlocked from an extended key.
|
367
|
+
*
|
368
|
+
* @param extendedKey - The extended key.
|
369
|
+
* @param provider - A Provider instance (optional).
|
370
|
+
* @returns An unlocked wallet instance.
|
371
|
+
*/
|
372
|
+
static fromExtendedKey: typeof WalletUnlocked.fromExtendedKey;
|
373
|
+
/**
|
374
|
+
* Create a Wallet Unlocked from an encrypted JSON.
|
375
|
+
*
|
376
|
+
* @param jsonWallet - The encrypted JSON keystore.
|
377
|
+
* @param password - The password to decrypt the JSON.
|
378
|
+
* @param provider - A Provider instance (optional).
|
379
|
+
* @returns An unlocked wallet instance.
|
380
|
+
*/
|
381
|
+
static fromEncryptedJson: typeof WalletUnlocked.fromEncryptedJson;
|
382
|
+
}
|
383
|
+
|
384
|
+
type WalletManagerAccount = {
|
385
|
+
address: AbstractAddress;
|
386
|
+
publicKey: string;
|
387
|
+
vaultId?: number;
|
388
|
+
};
|
389
|
+
type WalletManagerOptions = {
|
390
|
+
storage: StorageAbstract;
|
391
|
+
};
|
392
|
+
type VaultConfig = {
|
393
|
+
type: string;
|
394
|
+
title?: string;
|
395
|
+
secret?: string;
|
396
|
+
};
|
397
|
+
type VaultsState = Array<{
|
398
|
+
type: string;
|
399
|
+
title?: string;
|
400
|
+
data?: VaultConfig;
|
401
|
+
vault: Vault;
|
402
|
+
}>;
|
403
|
+
interface WalletManagerState {
|
404
|
+
vaults: VaultsState;
|
405
|
+
}
|
406
|
+
declare abstract class Vault<TOptions = {
|
407
|
+
secret?: string;
|
408
|
+
}> {
|
409
|
+
static readonly type: string;
|
410
|
+
constructor(_options: TOptions);
|
411
|
+
serialize(): TOptions;
|
412
|
+
getAccounts(): WalletManagerAccount[];
|
413
|
+
addAccount(): WalletManagerAccount;
|
414
|
+
exportAccount(_address: AbstractAddress): string;
|
415
|
+
getWallet(_address: AbstractAddress): WalletUnlocked;
|
416
|
+
}
|
417
|
+
declare abstract class StorageAbstract {
|
418
|
+
abstract setItem(key: string, value: string): Promise<void>;
|
419
|
+
abstract getItem(key: string): Promise<string | null | undefined>;
|
420
|
+
abstract removeItem(key: string): Promise<void>;
|
421
|
+
abstract clear(): Promise<void>;
|
422
|
+
}
|
423
|
+
|
424
|
+
interface MnemonicVaultOptions {
|
425
|
+
secret?: string;
|
426
|
+
rootPath?: string;
|
427
|
+
numberOfAccounts?: number | null;
|
428
|
+
}
|
429
|
+
declare class MnemonicVault implements Vault<MnemonicVaultOptions> {
|
430
|
+
#private;
|
431
|
+
static readonly type = "mnemonic";
|
432
|
+
pathKey: string;
|
433
|
+
rootPath: string;
|
434
|
+
numberOfAccounts: number;
|
435
|
+
constructor(options: MnemonicVaultOptions);
|
436
|
+
getDerivePath(index: number): string;
|
437
|
+
serialize(): MnemonicVaultOptions;
|
438
|
+
getAccounts(): {
|
439
|
+
publicKey: string;
|
440
|
+
address: AbstractAddress;
|
441
|
+
}[];
|
442
|
+
addAccount(): {
|
443
|
+
publicKey: string;
|
444
|
+
address: AbstractAddress;
|
445
|
+
};
|
446
|
+
exportAccount(address: string | AbstractAddress): string;
|
447
|
+
getWallet(address: string | AbstractAddress): WalletUnlocked;
|
448
|
+
}
|
449
|
+
|
450
|
+
interface PkVaultOptions {
|
451
|
+
secret?: string;
|
452
|
+
accounts?: Array<string>;
|
453
|
+
}
|
454
|
+
declare class PrivateKeyVault implements Vault<PkVaultOptions> {
|
455
|
+
#private;
|
456
|
+
static readonly type = "privateKey";
|
457
|
+
/**
|
458
|
+
* If privateKey vault is initialized with a secretKey, it creates
|
459
|
+
* one account with the fallowing secret
|
460
|
+
*/
|
461
|
+
constructor(options?: PkVaultOptions);
|
462
|
+
serialize(): PkVaultOptions;
|
463
|
+
getPublicAccount(privateKey: string): {
|
464
|
+
address: AbstractAddress;
|
465
|
+
publicKey: string;
|
466
|
+
};
|
467
|
+
getAccounts(): WalletManagerAccount[];
|
468
|
+
addAccount(): {
|
469
|
+
address: AbstractAddress;
|
470
|
+
publicKey: string;
|
471
|
+
};
|
472
|
+
exportAccount(address: string | AbstractAddress): string;
|
473
|
+
getWallet(address: string | AbstractAddress): WalletUnlocked;
|
474
|
+
}
|
475
|
+
|
476
|
+
/**
|
477
|
+
* WalletManager is a upper package to manage multiple vaults like mnemonic and privateKeys.
|
478
|
+
*
|
479
|
+
* - VaultTypes can be add to `WalletManager.Vaults` enabling to add custom Vault types.
|
480
|
+
* - Storage can be instantiate when initializing enabling custom storage types.
|
481
|
+
*/
|
482
|
+
declare class WalletManager extends EventEmitter {
|
483
|
+
#private;
|
484
|
+
/**
|
485
|
+
* Vaults
|
486
|
+
*
|
487
|
+
* Vaults are responsible to store secret keys and return an `Wallet` instance,
|
488
|
+
* to interact with the network.
|
489
|
+
*
|
490
|
+
* Each vault has access to its own state
|
491
|
+
*
|
492
|
+
*/
|
493
|
+
static Vaults: (typeof MnemonicVault | typeof PrivateKeyVault)[];
|
494
|
+
/**
|
495
|
+
* Storage
|
496
|
+
*
|
497
|
+
* Persistent encrypted data. `The default storage works only on memory`.
|
498
|
+
*/
|
499
|
+
readonly storage: StorageAbstract;
|
500
|
+
readonly STORAGE_KEY: string;
|
501
|
+
constructor(options?: WalletManagerOptions);
|
502
|
+
get isLocked(): boolean;
|
503
|
+
/**
|
504
|
+
* Return the vault serialized object containing all the privateKeys,
|
505
|
+
* the format of the return depends on the Vault type.
|
506
|
+
*/
|
507
|
+
exportVault<T extends Vault>(vaultId: number): ReturnType<T['serialize']>;
|
508
|
+
/**
|
509
|
+
* List all vaults on the Wallet Manager, this function not return secret's
|
510
|
+
*/
|
511
|
+
getVaults(): Array<{
|
512
|
+
title?: string;
|
513
|
+
type: string;
|
514
|
+
vaultId: number;
|
515
|
+
}>;
|
516
|
+
/**
|
517
|
+
* List all accounts on the Wallet Manager not vault information is revealed
|
518
|
+
*/
|
519
|
+
getAccounts(): Array<WalletManagerAccount>;
|
520
|
+
/**
|
521
|
+
* Create a Wallet instance for the specific account
|
522
|
+
*/
|
523
|
+
getWallet(address: string | AbstractAddress): WalletUnlocked;
|
524
|
+
/**
|
525
|
+
* Export specific account privateKey
|
526
|
+
*/
|
527
|
+
exportPrivateKey(address: string | AbstractAddress): string;
|
528
|
+
/**
|
529
|
+
* Add account to a selected vault or on the first vault as default.
|
530
|
+
* If not vaults are adds it will return error
|
531
|
+
*/
|
532
|
+
addAccount(options?: {
|
533
|
+
vaultId: number;
|
534
|
+
}): Promise<WalletManagerAccount>;
|
535
|
+
/**
|
536
|
+
* Remove vault by index, by remove the vault you also remove all accounts
|
537
|
+
* created by the vault.
|
538
|
+
*/
|
539
|
+
removeVault(index: number): Promise<void>;
|
540
|
+
/**
|
541
|
+
* Add Vault, the `vaultConfig.type` will look for the Vaults supported if
|
542
|
+
* didn't found it will throw.
|
543
|
+
*/
|
544
|
+
addVault(vaultConfig: VaultConfig): Promise<void>;
|
545
|
+
/**
|
546
|
+
* Lock wallet. It removes passphrase from class instance, encrypt and hide all address and
|
547
|
+
* secrets.
|
548
|
+
*/
|
549
|
+
lock(): void;
|
550
|
+
/**
|
551
|
+
* Unlock wallet. It sets passphrase on WalletManger instance load all address from configured vaults.
|
552
|
+
* Vaults with secrets are not unlocked or instantiated on this moment.
|
553
|
+
*/
|
554
|
+
unlock(passphrase: string): Promise<void>;
|
555
|
+
/**
|
556
|
+
* Update WalletManager encryption passphrase
|
557
|
+
*/
|
558
|
+
updatePassphrase(oldpass: string, newpass: string): Promise<void>;
|
559
|
+
/**
|
560
|
+
* Retrieve and decrypt WalletManager state from storage
|
561
|
+
*/
|
562
|
+
loadState(): Promise<void>;
|
563
|
+
/**
|
564
|
+
* Store encrypted WalletManager state on storage
|
565
|
+
*/
|
566
|
+
private saveState;
|
567
|
+
/**
|
568
|
+
* Return a instantiable Class reference from `WalletManager.Vaults` supported list.
|
569
|
+
*/
|
570
|
+
private getVaultClass;
|
571
|
+
}
|
572
|
+
|
573
|
+
declare class MemoryStorage implements StorageAbstract {
|
574
|
+
storage: Map<string, unknown>;
|
575
|
+
getItem<T>(key: string): Promise<T | null>;
|
576
|
+
setItem(key: string, value: string): Promise<void>;
|
577
|
+
removeItem(key: string): Promise<void>;
|
578
|
+
clear(): Promise<void>;
|
579
|
+
}
|
580
|
+
|
581
|
+
declare class LocalStorage implements StorageAbstract {
|
582
|
+
private storage;
|
583
|
+
constructor(localStorage: Storage);
|
584
|
+
setItem(key: string, value: string): Promise<void>;
|
585
|
+
getItem(key: string): Promise<string | null | undefined>;
|
586
|
+
removeItem(key: string): Promise<void>;
|
587
|
+
clear(): Promise<void>;
|
588
|
+
}
|
589
|
+
|
590
|
+
/**
|
591
|
+
* Target Object that represents the global event bus used by Fuel Connector Manager.
|
592
|
+
* On browser the default target is the window or document. For other environments
|
593
|
+
* the event bus should be provided.
|
594
|
+
*/
|
595
|
+
interface TargetObject {
|
596
|
+
on?: (event: string, callback: any) => void;
|
597
|
+
off?: (event: string, callback: any) => void;
|
598
|
+
emit?: (event: string, data: any) => void;
|
599
|
+
addEventListener?: (event: string, callback: any) => void;
|
600
|
+
removeEventListener?: (event: string, callback: any) => void;
|
601
|
+
postMessage?: (message: string) => void;
|
602
|
+
}
|
603
|
+
|
604
|
+
type FuelConfig = {
|
605
|
+
connectors?: Array<FuelConnector>;
|
606
|
+
storage?: StorageAbstract | null;
|
607
|
+
targetObject?: TargetObject;
|
608
|
+
};
|
609
|
+
type FuelConnectorSelectOptions = {
|
610
|
+
emitEvents?: boolean;
|
611
|
+
};
|
612
|
+
type Status = {
|
613
|
+
installed: boolean;
|
614
|
+
connected: boolean;
|
615
|
+
};
|
616
|
+
declare class Fuel extends FuelConnector {
|
617
|
+
static STORAGE_KEY: string;
|
618
|
+
static defaultConfig: FuelConfig;
|
619
|
+
private _storage?;
|
620
|
+
private _connectors;
|
621
|
+
private _targetObject;
|
622
|
+
private _unsubscribes;
|
623
|
+
private _targetUnsubscribe;
|
624
|
+
private _pingCache;
|
625
|
+
private _currentConnector?;
|
626
|
+
constructor(config?: FuelConfig);
|
627
|
+
/**
|
628
|
+
* Return the target object to listen for global events.
|
629
|
+
*/
|
630
|
+
private getTargetObject;
|
631
|
+
/**
|
632
|
+
* Return the storage used.
|
633
|
+
*/
|
634
|
+
private getStorage;
|
635
|
+
/**
|
636
|
+
* Setup the default connector from the storage.
|
637
|
+
*/
|
638
|
+
private setDefaultConnector;
|
639
|
+
/**
|
640
|
+
* Start listener for all the events of the current
|
641
|
+
* connector and emit them to the Fuel instance
|
642
|
+
*/
|
643
|
+
private setupConnectorEvents;
|
644
|
+
/**
|
645
|
+
* Call method from the current connector.
|
646
|
+
*/
|
647
|
+
private callMethod;
|
648
|
+
/**
|
649
|
+
* Create a method for each method proxy that is available on the Common interface
|
650
|
+
* and call the method from the current connector.
|
651
|
+
*/
|
652
|
+
private setupMethods;
|
653
|
+
/**
|
654
|
+
* Fetch the status of a connector and set the installed and connected
|
655
|
+
* status.
|
656
|
+
*/
|
657
|
+
private fetchConnectorStatus;
|
658
|
+
/**
|
659
|
+
* Fetch the status of all connectors and set the installed and connected
|
660
|
+
* status.
|
661
|
+
*/
|
662
|
+
private fetchConnectorsStatus;
|
663
|
+
/**
|
664
|
+
* Fetch the status of a connector and set the installed and connected
|
665
|
+
* status. If no connector is provided it will ping the current connector.
|
666
|
+
*/
|
667
|
+
private pingConnector;
|
668
|
+
/**
|
669
|
+
* Setup a listener for the FuelConnector event and add the connector
|
670
|
+
* to the list of new connectors.
|
671
|
+
*/
|
672
|
+
private setupConnectorListener;
|
673
|
+
/**
|
674
|
+
* Add a new connector to the list of connectors.
|
675
|
+
*/
|
676
|
+
private addConnector;
|
677
|
+
private triggerConnectorEvents;
|
678
|
+
/**
|
679
|
+
* Get a connector from the list of connectors.
|
680
|
+
*/
|
681
|
+
getConnector: (connector: FuelConnector | string) => FuelConnector | null;
|
682
|
+
/**
|
683
|
+
* Return the list of connectors with the status of installed and connected.
|
684
|
+
*/
|
685
|
+
connectors(): Promise<Array<FuelConnector>>;
|
686
|
+
/**
|
687
|
+
* Set the current connector to be used.
|
688
|
+
*/
|
689
|
+
selectConnector(connectorName: string, options?: FuelConnectorSelectOptions): Promise<boolean>;
|
690
|
+
/**
|
691
|
+
* Return the current selected connector.
|
692
|
+
*/
|
693
|
+
currentConnector(): FuelConnector | null | undefined;
|
694
|
+
/**
|
695
|
+
* Return true if any connector is available.
|
696
|
+
*/
|
697
|
+
hasConnector(): Promise<boolean>;
|
698
|
+
hasWallet(): Promise<boolean>;
|
699
|
+
/**
|
700
|
+
* Return a Fuel Provider instance with extends features to work with
|
701
|
+
* connectors.
|
702
|
+
*
|
703
|
+
* @deprecated getProvider is deprecated and is going to be removed in the future, use getWallet instead.
|
704
|
+
*/
|
705
|
+
getProvider(providerOrNetwork?: Provider | Network$1): Promise<Provider>;
|
706
|
+
/**
|
707
|
+
* Return a Fuel Provider instance with extends features to work with
|
708
|
+
* connectors.
|
709
|
+
*/
|
710
|
+
private _getProvider;
|
711
|
+
/**
|
712
|
+
* Return a Fuel Wallet Locked instance with extends features to work with
|
713
|
+
* connectors.
|
714
|
+
*/
|
715
|
+
getWallet(address: string | AbstractAddress, providerOrNetwork?: Provider | Network$1): Promise<Account>;
|
716
|
+
/**
|
717
|
+
* Remove all open listeners this is useful when you want to
|
718
|
+
* remove the Fuel instance and avoid memory leaks.
|
719
|
+
*/
|
720
|
+
unsubscribe(): void;
|
721
|
+
/**
|
722
|
+
* Clean all the data from the storage.
|
723
|
+
*/
|
724
|
+
clean(): Promise<void>;
|
725
|
+
/**
|
726
|
+
* Removes all listeners and cleans the storage.
|
727
|
+
*/
|
728
|
+
destroy(): Promise<void>;
|
729
|
+
}
|
730
|
+
|
731
|
+
type CacheFor = {
|
732
|
+
[key: string]: {
|
733
|
+
timeout: number;
|
734
|
+
value: unknown;
|
735
|
+
} | null;
|
736
|
+
};
|
737
|
+
type CacheForOptions = {
|
738
|
+
key: string;
|
739
|
+
cache: CacheFor;
|
740
|
+
cacheTime: number;
|
741
|
+
};
|
742
|
+
declare function cacheFor<F extends (...args: unknown[]) => Promise<unknown>>(fn: F, { cache, cacheTime, key }: CacheForOptions): F;
|
743
|
+
|
744
|
+
/**
|
745
|
+
* Fuel Connector Event is a custom event that can be used by the connector to
|
746
|
+
* inform the Fuel Connector Manager that a new connector is available.
|
747
|
+
*/
|
748
|
+
declare function dispatchFuelConnectorEvent(connector: FuelConnector): void;
|
749
|
+
|
750
|
+
type DeferPromise<R = unknown> = {
|
751
|
+
promise: Promise<R>;
|
752
|
+
resolve: (value: R) => void;
|
753
|
+
reject: (error: unknown) => void;
|
754
|
+
};
|
755
|
+
declare function deferPromise<R = unknown>(): DeferPromise<R>;
|
756
|
+
declare function withTimeout<F extends Promise<unknown>, RT = Awaited<F>>(promise: F, timeout?: number): Promise<RT>;
|
757
|
+
|
758
|
+
type HDWalletConfig = {
|
759
|
+
privateKey?: BytesLike;
|
760
|
+
publicKey?: BytesLike;
|
761
|
+
chainCode: BytesLike;
|
762
|
+
depth?: number;
|
763
|
+
index?: number;
|
764
|
+
parentFingerprint?: string;
|
765
|
+
};
|
766
|
+
declare class HDWallet {
|
767
|
+
depth: number;
|
768
|
+
index: number;
|
769
|
+
fingerprint: string;
|
770
|
+
parentFingerprint: string;
|
771
|
+
privateKey?: string;
|
772
|
+
publicKey: string;
|
773
|
+
chainCode: BytesLike;
|
774
|
+
/**
|
775
|
+
* HDWallet is a implementation of the BIP-0044 and BIP-0032, Multi-Account Hierarchy for Deterministic Wallets
|
776
|
+
*
|
777
|
+
* @param config - Wallet configurations
|
778
|
+
*/
|
779
|
+
constructor(config: HDWalletConfig);
|
780
|
+
get extendedKey(): string;
|
781
|
+
/**
|
782
|
+
* Derive the current HDWallet instance navigating only on the index.
|
783
|
+
* `Ex.: m/44'/0 -> Ex.: m/44'/1 -> m/44'/2`. [Learn more](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
|
784
|
+
*
|
785
|
+
* @param index - Index of the child HDWallet.
|
786
|
+
* @returns A new instance of HDWallet on the derived index
|
787
|
+
*/
|
788
|
+
deriveIndex(index: number): HDWallet;
|
789
|
+
/**
|
790
|
+
* Derive the current HDWallet instance to the path. [Learn more](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
|
791
|
+
*
|
792
|
+
* @param path - The string representation of the child HDWallet. `Ex.: m/44'/0'/0'/0/0`
|
793
|
+
* @returns A new instance of HDWallet on the derived path
|
794
|
+
*/
|
795
|
+
derivePath(path: string): HDWallet;
|
796
|
+
/**
|
797
|
+
* Get the extendKey as defined on BIP-32 from the provided seed
|
798
|
+
*
|
799
|
+
* @param isPublic - enable to export public extendedKey, it not required when HDWallet didn't have the privateKey.
|
800
|
+
* @param testnet - Inform if should use testnet or mainnet prefix, default value is true (`mainnet`).
|
801
|
+
* @returns BIP-32 extended private key
|
802
|
+
*/
|
803
|
+
toExtendedKey(isPublic?: boolean, testnet?: boolean): string;
|
804
|
+
/**
|
805
|
+
* Create HDWallet instance from seed
|
806
|
+
*
|
807
|
+
* @param seed - Seed
|
808
|
+
* @returns A new instance of HDWallet
|
809
|
+
*/
|
810
|
+
static fromSeed(seed: string): HDWallet;
|
811
|
+
static fromExtendedKey(extendedKey: string): HDWallet;
|
812
|
+
}
|
813
|
+
|
814
|
+
type MnemonicPhrase = string | Array<string>;
|
815
|
+
|
816
|
+
declare const MNEMONIC_SIZES: number[];
|
817
|
+
declare class Mnemonic {
|
818
|
+
wordlist: Array<string>;
|
819
|
+
/**
|
820
|
+
*
|
821
|
+
* @param wordlist - Provide a wordlist with the list of words used to generate the mnemonic phrase. The default value is the English list.
|
822
|
+
* @returns Mnemonic instance
|
823
|
+
*/
|
824
|
+
constructor(wordlist?: Array<string>);
|
825
|
+
/**
|
826
|
+
*
|
827
|
+
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
828
|
+
* @returns Entropy hash
|
829
|
+
*/
|
830
|
+
mnemonicToEntropy(phrase: MnemonicPhrase): string;
|
831
|
+
/**
|
832
|
+
*
|
833
|
+
* @param entropy - Entropy source to the mnemonic phrase.
|
834
|
+
* @returns Mnemonic phrase
|
835
|
+
*/
|
836
|
+
entropyToMnemonic(entropy: BytesLike): string;
|
837
|
+
/**
|
838
|
+
*
|
839
|
+
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
840
|
+
* @param wordlist - Provide a wordlist with the list of words used to generate the mnemonic phrase. The default value is the English list.
|
841
|
+
* @returns Mnemonic phrase
|
842
|
+
*/
|
843
|
+
static mnemonicToEntropy(phrase: MnemonicPhrase, wordlist?: Array<string>): string;
|
844
|
+
/**
|
845
|
+
* @param entropy - Entropy source to the mnemonic phrase.
|
846
|
+
* @param testnet - Inform if should use testnet or mainnet prefix, default value is true (`mainnet`).
|
847
|
+
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
848
|
+
*/
|
849
|
+
static entropyToMnemonic(entropy: BytesLike, wordlist?: Array<string>): string;
|
850
|
+
/**
|
851
|
+
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
852
|
+
* @param passphrase - Add additional security to protect the generated seed with a memorized passphrase. `Note: if the owner forgot the passphrase, all wallets and accounts derive from the phrase will be lost.`
|
853
|
+
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
854
|
+
*/
|
855
|
+
static mnemonicToSeed(phrase: MnemonicPhrase, passphrase?: BytesLike): string;
|
856
|
+
/**
|
857
|
+
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
858
|
+
* @param passphrase - Add additional security to protect the generated seed with a memorized passphrase. `Note: if the owner forgot the passphrase, all wallets and accounts derive from the phrase will be lost.`
|
859
|
+
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
860
|
+
*/
|
861
|
+
static mnemonicToMasterKeys(phrase: MnemonicPhrase, passphrase?: BytesLike): Uint8Array;
|
862
|
+
/**
|
863
|
+
* Validates if given mnemonic is valid
|
864
|
+
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
865
|
+
* @returns true if phrase is a valid mnemonic
|
866
|
+
*/
|
867
|
+
static isMnemonicValid(phrase: string): boolean;
|
868
|
+
static binarySearch(target: string): boolean;
|
869
|
+
/**
|
870
|
+
* @param seed - BIP39 seed
|
871
|
+
* @param testnet - Inform if should use testnet or mainnet prefix, the default value is true (`mainnet`).
|
872
|
+
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
873
|
+
*/
|
874
|
+
static masterKeysFromSeed(seed: string): Uint8Array;
|
875
|
+
/**
|
876
|
+
* Get the extendKey as defined on BIP-32 from the provided seed
|
877
|
+
*
|
878
|
+
* @param seed - BIP39 seed
|
879
|
+
* @param testnet - Inform if should use testnet or mainnet prefix, default value is true (`mainnet`).
|
880
|
+
* @returns BIP-32 extended private key
|
881
|
+
*/
|
882
|
+
static seedToExtendedKey(seed: string, testnet?: boolean): string;
|
883
|
+
/**
|
884
|
+
* Create a new mnemonic using a randomly generated number as entropy.
|
885
|
+
* As defined in BIP39, the entropy must be a multiple of 32 bits, and its size must be between 128 and 256 bits.
|
886
|
+
* Therefore, the possible values for `strength` are 128, 160, 192, 224, and 256.
|
887
|
+
* If not provided, the default entropy length will be set to 256 bits.
|
888
|
+
* The return is a list of words that encodes the generated entropy.
|
889
|
+
*
|
890
|
+
*
|
891
|
+
* @param size - Number of bytes used as an entropy
|
892
|
+
* @param extraEntropy - Optional extra entropy to increase randomness
|
893
|
+
* @returns A randomly generated mnemonic
|
894
|
+
*/
|
895
|
+
static generate(size?: number, extraEntropy?: BytesLike): string;
|
896
|
+
}
|
897
|
+
|
898
|
+
declare const english: string[];
|
899
|
+
|
900
|
+
declare enum Language {
|
901
|
+
'english' = "english"
|
902
|
+
}
|
903
|
+
|
904
|
+
export { AbiMap, Account, type AssembleTransactionSummaryParams, Asset, AssetEth, AssetFuel, Assets, BurnedAsset, CHAIN_IDS, type CacheFor, type CalculateTransactionFeeParams, ChangeOutputCollisionError, type DeferPromise, Fuel, type FuelConfig, FuelConnector, type FuelConnectorSelectOptions, type GetAssetNetworkParams, GetOperationParams, type GetTransactionSummaryFromRequestParams, type GetTransactionSummaryParams, type GetTransactionsSummariesParams, type GetTransactionsSummariesReturns, GetTransferOperationsParams, GqlTransactionStatusesNames, GraphqlTransactionStatus, HDWallet, type IGetMaxGasParams, type IGetMinGasParams, InputOutputParam, InputParam, Language, LocalStorage, MNEMONIC_SIZES, MemoryStorage, MintedAsset, Mnemonic, type MnemonicPhrase, MnemonicVault, type MnemonicVaultOptions, Network$1 as Network, NetworkEthereum, NetworkFuel, type NetworkTypes, NoWitnessAtIndexError, NoWitnessByOwnerError, Operation, OperationCoin, type PkVaultOptions, PrivateKeyVault, Provider, RawPayloadParam, ReceiptParam, type Status, StorageAbstract, type TargetObject, TransactionRequest, TransactionRequestInput, TransactionRequestLike, TransactionResult, TransactionResultReceipt, TransactionStatus, TransactionSummary, TransactionTypeName, Vault, type VaultConfig, type VaultsState, Wallet, WalletLocked, WalletManager, type WalletManagerAccount, type WalletManagerOptions, type WalletManagerState, WalletUnlocked, addOperation, assembleReceiptByType, assembleTransactionSummary, assets, buildBlockExplorerUrl, cacheFor, calculateMetadataGasForTxCreate, calculateMetadataGasForTxScript, calculatePriceWithFactor, calculateTransactionFee, deferPromise, dispatchFuelConnectorEvent, english, extractBurnedAssetsFromReceipts, extractMintedAssetsFromReceipts, gasUsedByInputs, getAssetEth, getAssetFuel, getAssetNetwork, getAssetWithNetwork, getContractCallOperations, getContractCreatedOperations, getDecodedLogs, getDefaultChainId, getGasUsedFromReceipts, getInputAccountAddress, getInputContractFromIndex, getInputFromAssetId, getInputsByType, getInputsByTypes, getInputsCoin, getInputsCoinAndMessage, getInputsContract, getInputsMessage, getMaxGas, getMinGas, getOperations, getOutputsByType, getOutputsChange, getOutputsCoin, getOutputsContract, getOutputsContractCreated, getOutputsVariable, getPayProducerOperations, getPredicateRoot, getReceiptsByType, getReceiptsCall, getReceiptsMessageOut, getReceiptsTransferOut, getReceiptsWithMissingData, getTransactionStatusName, getTransactionSummary, getTransactionSummaryFromRequest, getTransactionTypeName, getTransactionsSummaries, getTransferOperations, getWithdrawFromFuelOperations, hasSameAssetId, isType, isTypeCreate, isTypeMint, isTypeScript, normalizeJSON, processGqlReceipt, processGraphqlStatus, resolveGasDependentCosts, resolveIconPaths, returnZeroScript, sleep, transactionRequestify, urlJoin, withTimeout, withdrawScript };
|