interface WalletConfig {
name?: string; // defaults to "default"
privateKey?: string;
sponsorGas?: boolean; // defaults to true if no privateKey and false if privateKey
}
type ReplayOnReorg = {
type: "replay";
};
type LogOnReorg = {
type: "log";
logLevel?: "error" | "info" | "warn"; // defaults to "error"
};
type Custom = {
type: "custom",
// your task will be sent with a payload the full transaction minus gas and nonce
task: string;
}
type OnReorgOptions = ReplayOnReorg | LogOnReorg | Custom;
export interface TransactionConfirmation {
// this the number of block confirmations before we resolve the promise
// i.e. "wait 5 blocks before proceeding to the next step in my task"
confirmations?: number;
onReorg?: {
action: OnReorgOptions;
depth: number;
};
}
interface IWallet {
readonly name: string;
writeContract<Args = unknown[]>(
chain: Chain,
contractAddress: string,
functionSig: string,
args: Args,
confirmation?: TransactionConfirmation,
retryConfig?: HostFunctionRetryConfig
): Promise<{ hash: string }>;
readContract<Args = unknown[]>(
chain: Chain,
contractAddress: string,
functionSig: string,
args: Args,
retryConfig?: HostFunctionRetryConfig
): Promise<{ hash: string }>;
simulate: (
chain: Chain,
contractAddress: string,
functionSig: string,
args: unknown[],
retryConfig?: HostFunctionRetryConfig
) => Promise<unknown>;
transfer(
chain: Chain,
amount: string;
recipient: string;
): Promise<{ hash: string }>;
}
type Wallet = (config: WalletConfig) => Promise<IWallet>;