import * as react from 'react'; import { FC, ReactNode } from 'react'; import { WalletAdapter, WalletReadyState, WalletName, RecordStatusFilter, AleoDeployment, RecordAccessGrant, AlgorithmGrant } from '@provablehq/aleo-wallet-standard'; import { Network, TransactionOptions, TransactionStatusResponse, TxHistoryResult } from '@provablehq/aleo-types'; import { WalletError, DecryptPermission } from '@provablehq/aleo-wallet-adaptor-core'; interface Wallet { adapter: WalletAdapter; readyState: WalletReadyState; } /** * Wallet context state */ interface WalletContextState { /** * All available wallet adapters */ wallets: Wallet[]; /** * The connected wallet adapter */ wallet: Wallet | null; /** * The connected account */ address: string | null; /** * Whether the wallet is connected */ connected: boolean; /** * Whether the wallet is connecting */ connecting: boolean; /** * Whether the wallet is disconnecting */ disconnecting: boolean; /** * Whether the wallet is reauthorizing after an account change */ reconnecting: boolean; /** * Whether the wallet is auto-connecting */ autoConnect: boolean; /** * The current network */ network: Network | null; /** * Select a wallet by name * @param name The name of the wallet to select */ selectWallet: (name: WalletName) => void; /** * Connect to the selected wallet */ connect: (network: Network) => Promise; /** * Disconnect from the connected wallet */ disconnect: () => Promise; /** * Execute a transaction */ executeTransaction: (options: TransactionOptions) => Promise<{ transactionId: string; } | undefined>; /** * Get transaction status */ transactionStatus: (transactionId: string) => Promise; /** * Sign a message */ signMessage: (message: Uint8Array | string) => Promise; /** * Switch the network */ switchNetwork: (network: Network) => Promise; /** * Decrypt a ciphertext */ decrypt: (cipherText: string) => Promise; /** * Request records */ requestRecords: (program: string, includePlaintext?: boolean, statusFilter?: RecordStatusFilter) => Promise; /** * Execute a deployment */ executeDeployment: (deployment: AleoDeployment) => Promise<{ transactionId: string; }>; /** * get transition view keys(tvk) for a transaction */ transitionViewKeys: (transactionId: string) => Promise; /** * get transaction of specific program * @param program The program ID * @returns array of transactionId */ requestTransactionHistory: (program: string) => Promise; /** * Return the algorithm names this wallet implements for `type: "derived"` * InputRequests. A dapp calls this before connect to pick which entries to * include in `algorithmsAllowed`. Wallets without derived-input support * return `[]`. */ algorithmsSupported: () => Promise; } /** * Wallet context */ declare const WalletContext: react.Context; /** * Custom hook to use the wallet context * @returns The wallet context state */ declare function useWalletContext(): WalletContextState; interface WalletProviderProps { children: ReactNode; wallets: WalletAdapter[]; network?: Network; autoConnect?: boolean; onError?: (error: WalletError) => void; localStorageKey?: string; decryptPermission?: DecryptPermission; programs?: string[]; /** * Opt-in record/field narrowing on top of `programs`. Forwarded to the * wallet's connect call. Only honored by wallets that support it (e.g. shield). */ recordAccess?: RecordAccessGrant; /** * When `false`, the dapp transacts without learning the user's address. * Defaults to `true`. Only valid with `decryptPermission: NoDecrypt`. */ readAddress?: boolean; /** * Strict opt-in allowlist for `type: "derived"` InputRequests. Each grant * authorizes exactly one (algorithm, program, function, inputPosition) * call site. Default undefined → every derived request is refused. */ algorithmsAllowed?: AlgorithmGrant[]; } declare const AleoWalletProvider: FC; /** * Custom hook to use the wallet * @returns The wallet context state */ declare function useWallet(): WalletContextState; export { AleoWalletProvider, type Wallet, WalletContext, type WalletContextState, useWallet, useWalletContext };