@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
40 lines (39 loc) • 1.41 kB
TypeScript
import { CoinbaseWallet } from "./Coinbase";
import { MetaMask } from "./MetaMask";
export declare enum BaseActionType {
IMPORT_WALLET_FROM_SEED = "importWalletFromSeed",
IMPORT_WALLET_FROM_PRIVATE_KEY = "importWalletFromPrivateKey",
SWITCH_NETWORK = "switchNetwork",
CONNECT_TO_DAPP = "connectToDapp",
HANDLE_TRANSACTION = "handleTransaction",
HANDLE_SIGNATURE = "handleSignature",
CHANGE_SPENDING_CAP = "changeSpendingCap",
REMOVE_SPENDING_CAP = "removeSpendingCap"
}
export declare enum ActionApprovalType {
APPROVE = "approve",
REJECT = "reject"
}
export type ActionOptions = {
approvalType?: ActionApprovalType;
[key: string]: unknown;
};
export type WalletSetupContext = {
localNodePort: number;
};
export type BaseWalletConfig = {
type: "metamask" | "coinbase";
password?: string;
walletSetup?: (wallet: MetaMask | CoinbaseWallet, context: WalletSetupContext) => Promise<void>;
};
export type MetaMaskConfig = {
type: "metamask";
walletSetup?: (wallet: MetaMask, context: WalletSetupContext) => Promise<void>;
} & BaseWalletConfig;
export type CoinbaseConfig = {
type: "coinbase";
walletSetup?: (wallet: CoinbaseWallet, context: WalletSetupContext) => Promise<void>;
} & BaseWalletConfig;
export declare abstract class BaseWallet {
abstract handleAction(action: BaseActionType, options: ActionOptions): Promise<void>;
}