-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIWalletAdapter.ts
More file actions
54 lines (51 loc) · 1.23 KB
/
IWalletAdapter.ts
File metadata and controls
54 lines (51 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import {EventLog, Log} from "ethers";
import {ITransactionListener, ITransactionStatus} from "../ITokenScript";
import {IChainConfig} from "./EthersAdapter";
export interface RpcRequest {
jsonrpc: "2.0";
id: number;
method: string;
params: any[];
}
export interface RpcResponse {
jsonrpc: "2.0";
id: number;
result?: any;
error?: any;
}
/**
* The interface for integrating wallet connecton from the user-agent
*/
export interface IWalletAdapter {
readonly chainConfig: {[key: number]: IChainConfig};
getCurrentWalletAddress(): Promise<string>;
signPersonalMessage(message: string): Promise<string>;
call(
chain: number,
contractAddr: string,
method: string,
args: any[],
outputTypes: any[]|string[],
errorAbi?: any[]
): Promise<any>;
getEvents(
chain: number,
contractAddr: string,
type: string,
inputs: any[]
): Promise<Array<EventLog>>;
sendTransaction(
chain: number,
contractAddr: string,
method: string,
args: any[],
outputTypes: string[],
value?: bigint,
waitForConfirmation?: boolean,
listener?: ITransactionListener,
errorAbi?: any[]
): Promise<ITransactionStatus|false>;
getChain(): Promise<number>;
getRpcUrls(chainId: number): string[];
rpcProxy(request: RpcRequest): Promise<any>;
}