import { ethers } from "ethers"; import * as solana from "@solana/web3.js"; import { ChainId, EVMChainId } from "@certusone/wormhole-sdk"; import * as sui from "@mysten/sui.js"; import { WalletToolBox } from "./walletToolBox.js"; import { Middleware } from "../../compose.middleware.js"; import { ProviderContext, UntypedProvider } from "../providers.middleware.js"; import { Logger } from "winston"; import { TokensByChain } from "./wallet-management.js"; import { Registry } from "prom-client"; import { Environment } from "../../environment.js"; import { DirectSecp256k1Wallet } from "@cosmjs/proto-signing"; export type EVMWallet = ethers.Wallet; export type SuiWallet = sui.RawSigner; export type SeiWallet = DirectSecp256k1Wallet; export type SolanaWallet = { conn: solana.Connection; payer: solana.Keypair; }; export type Wallet = EVMWallet | SolanaWallet | UntypedWallet | SuiWallet | SeiWallet; export type UntypedWallet = UntypedProvider & { privateKey: string; }; export interface Action { chainId: ChainId; f: ActionFunc; } export type ActionFunc = (walletToolBox: WalletToolBox, chaidId: ChainId) => Promise; export interface ActionWithCont { action: Action; pluginName: string; resolve: (t: T) => void; reject: (reason: any) => void; } export interface WorkerInfo { id: number; targetChainId: ChainId; targetChainName: string; walletPrivateKey: string; } export interface ActionExecutor { (chaindId: ChainId, f: ActionFunc): Promise; onSolana(f: ActionFunc): Promise; onEVM(chainId: EVMChainId, f: ActionFunc): Promise; onSei(f: ActionFunc): Promise; onSui(f: ActionFunc): Promise; } export interface WalletContext extends ProviderContext { wallets: ActionExecutor; } export interface WalletOpts { namespace: string; privateKeys: Partial<{ [k in ChainId]: any[]; }>; tokensByChain?: TokensByChain; logger?: Logger; metrics?: { enabled: boolean; registry: Registry; }; } export declare function wallets(env: Environment, opts: WalletOpts): Middleware;