import type { AptosConnectWalletConfig } from "@aptos-connect/wallet-adapter-plugin"; import { type AccountAuthenticator, type AnyRawTransaction, type InputSubmitTransactionData, Network, type PendingTransactionResponse, type TransactionSubmitter } from "@aptos-labs/ts-sdk"; import { type AccountInfo, type AptosChangeNetworkOutput, type AptosSignAndSubmitTransactionOutput, type AptosSignInInput, type AptosSignInOutput, type AptosSignMessageInput, type AptosSignMessageOutput, type AptosWallet, type NetworkInfo } from "@aptos-labs/wallet-standard"; import EventEmitter from "eventemitter3"; export type { AccountAddress, AccountAuthenticator, AnyPublicKey, AnyRawTransaction, InputGenerateTransactionOptions, InputSubmitTransactionData, Network, PendingTransactionResponse, TransactionSubmitter, } from "@aptos-labs/ts-sdk"; export type { AccountInfo, AptosChangeNetworkOutput, AptosSignAndSubmitTransactionOutput, AptosSignMessageInput, AptosSignMessageOutput, AptosSignTransactionOutputV1_1, NetworkInfo, } from "@aptos-labs/wallet-standard"; import { WalletReadyState } from "./constants"; import type { AvailableWallets, InputTransactionData } from "./utils/types"; export type AdapterWallet = AptosWallet & { readyState?: WalletReadyState; isAptosNativeWallet?: boolean; /** A fallback wallet to use when this wallet is not installed */ fallbackWallet?: AdapterWallet; }; export type AdapterNotDetectedWallet = Omit & { readyState: WalletReadyState.NotDetected; }; export interface DappConfig { network: Network; /** * If provided, the wallet adapter will submit transactions using the provided * transaction submitter rather than via the wallet. */ transactionSubmitter?: TransactionSubmitter; aptosApiKeys?: Partial>; aptosConnectDappId?: string; aptosConnect?: Omit; /** * @deprecated will be removed in a future version */ mizuwallet?: { manifestURL: string; appId?: string; }; /** * @deprecated will be removed in a future version */ msafeWalletConfig?: { appId?: string; appUrl?: string; }; crossChainWallets?: boolean; } export declare interface WalletCoreEvents { connect(account: AccountInfo | null): void; disconnect(): void; standardWalletsAdded(wallets: AdapterWallet): void; standardWalletsHiddenAdded(wallets: AdapterWallet): void; standardNotDetectedWalletAdded(wallets: AdapterNotDetectedWallet): void; networkChange(network: NetworkInfo | null): void; accountChange(account: AccountInfo | null): void; } export type AdapterAccountInfo = Omit & { ansName?: string; }; export declare class WalletCore extends EventEmitter { private _wallet; private readonly _sdkWallets; private _standard_wallets; private _standard_not_detected_wallets; private _standard_wallets_hidden; private _network; private _connecting; private _connected; private _account; private _dappConfig; private _optInWallets; private _hideWallets; private _disableTelemetry; private readonly ga4; constructor(optInWallets?: ReadonlyArray, dappConfig?: DappConfig, disableTelemetry?: boolean, hideWallets?: ReadonlyArray); private fetchExtensionAIP62AptosWallets; /** * Set AIP-62 extension wallets * * @param extensionwWallets */ private setExtensionAIP62Wallets; /** * Set AIP-62 SDK wallets */ private fetchSDKAIP62AptosWallets; private isAptosNativeWallet; private appendNotDetectedStandardSupportedWallets; /** * A function that excludes an AIP-62 compatible wallet the dapp doesnt want to include * * @param wallet AdapterWallet | AdapterNotDetectedWallet * @returns boolean */ excludeWallet(wallet: AdapterWallet | AdapterNotDetectedWallet): boolean; /** * A function that hides an AIP-62 compatible wallet from normal display. * * @param wallet AdapterWallet | AdapterNotDetectedWallet * @returns boolean */ hideWallet(wallet: AdapterWallet | AdapterNotDetectedWallet): boolean; private recordEvent; /** * Helper function to ensure wallet exists * * @param wallet A wallet */ private ensureWalletExists; /** * Helper function to ensure account exists * * @param account An account */ private ensureAccountExists; /** * Queries and sets ANS name for the current connected wallet account */ private setAnsName; /** * Function to cleat wallet adapter data. * * - Removes current connected wallet state * - Removes current connected account state * - Removes current connected network state * - Removes autoconnect local storage value */ private clearData; /** * Sets the connected wallet * * @param wallet A wallet */ setWallet(wallet: AptosWallet | null): void; /** * Sets the connected account * * @param account An account */ setAccount(account: AccountInfo | null): void; /** * Sets the connected network * * @param network A network */ setNetwork(network: NetworkInfo | null): void; /** * Helper function to detect whether a wallet is connected * * @returns boolean */ isConnected(): boolean; /** * Getter to fetch all detected wallets */ get wallets(): ReadonlyArray; /** * Getter to fetch all hidden wallets */ get hiddenWallets(): ReadonlyArray; get notDetectedWallets(): ReadonlyArray; /** * Getter for the current connected wallet * * @return wallet info * @throws WalletNotSelectedError */ get wallet(): AptosWallet | null; /** * Getter for the current connected account * * @return account info * @throws WalletAccountError */ get account(): AccountInfo | null; /** * Getter for the current wallet network * * @return network info * @throws WalletGetNetworkError */ get network(): NetworkInfo | null; /** * Helper function to run some checks before we connect with a wallet. * * @param walletName. The wallet name we want to connect with. */ connect(walletName: string): Promise; /** * Signs into the wallet by connecting and signing an authentication messages. * * For more information, visit: https://siwa.aptos.dev * * @param args * @param args.input The AptosSignInInput which defines how the SIWA Message should be constructed * @param args.walletName The name of the wallet to sign into * @returns The AptosSignInOutput which contains the account and signature information */ signIn(args: { input: AptosSignInInput; walletName: string; }): Promise; /** * Connects a wallet to the dapp. * On connect success, we set the current account and the network, and keeping the selected wallet * name in LocalStorage to support autoConnect function. * * @param selectedWallet. The wallet we want to connect. * @emit emits "connect" event * @throws WalletConnectionError */ private connectWallet; /** * Disconnect the current connected wallet. On success, we clear the * current account, current network and LocalStorage data. * * @emit emits "disconnect" event * @throws WalletDisconnectionError */ disconnect(): Promise; /** * Signs and submits a transaction to chain * * @param transactionInput InputTransactionData * @returns AptosSignAndSubmitTransactionOutput */ signAndSubmitTransaction(transactionInput: InputTransactionData): Promise; /** * Signs a transaction * * This method supports 2 input types - * 1. A raw transaction that was already built by the dapp, * 2. A transaction data input as JSON. This is for the wallet to be able to simulate before signing * * @param transactionOrPayload AnyRawTransaction | InputTransactionData * @param asFeePayer optional. A flag indicates to sign the transaction as the fee payer * @param options optional. Transaction options * * @returns AccountAuthenticator */ signTransaction(args: { transactionOrPayload: AnyRawTransaction | InputTransactionData; asFeePayer?: boolean; }): Promise<{ authenticator: AccountAuthenticator; rawTransaction: Uint8Array; }>; /** * Sign a message (doesnt submit to chain). * * @param message - AptosSignMessageInput * * @return response from the wallet's signMessage function * @throws WalletSignMessageError */ signMessage(message: AptosSignMessageInput): Promise; /** * Submits transaction to chain * * @param transaction - InputSubmitTransactionData * @returns PendingTransactionResponse */ submitTransaction(transaction: InputSubmitTransactionData): Promise; /** Event for when account has changed on the wallet @return the new account info @throws WalletAccountChangeError */ onAccountChange(): Promise; /** Event for when network has changed on the wallet @return the new network info @throws WalletNetworkChangeError */ onNetworkChange(): Promise; /** * Sends a change network request to the wallet to change the connected network * * @param network - Network * @returns AptosChangeNetworkOutput */ changeNetwork(network: Network): Promise; /** * Signs a message and verifies the signer * @param message - AptosSignMessageInput * @returns boolean */ signMessageAndVerify(message: AptosSignMessageInput): Promise; } //# sourceMappingURL=WalletCore.d.ts.map