Multi-chain provider would require primarly two main methods to interface with a multi-chain cryptocurrency wallet: enable and request.
Enable method would translate the same JSON-RPC parameters of CAIP-25 as Javascript arguments
interface CAIP25Request {
id: number;
jsonrpc: "2.0";
method: "caip_handshake";
params: {
chains: string[];
methods: string[];
};
}
interface CAIP25Response {
id: number;
jsonrpc: "2.0";
result: {
accounts: string[];
};
}
interface CAIPXXProvider {
enable(chains: string[], methods: string[]): Promise<string[]>;
}
Request method would translate the same JSON-RPC parameters of CAIP-27 as Javascript arguments
interface CAIP27Request {
id: number;
jsonrpc: "2.0";
method: "caip_request";
params: {
chainId: string;
request: {
method: string;
params: any;
};
};
}
interface CAIP27Response {
id: number;
jsonrpc: "2.0";
result: any;
}
interface CAIPXXProvider {
request(chainId: string, request: { method: string; params: any }): Promise<string[]>;
}
interface CAIPXXProvider {
enable(chains: string[], methods: string[]): Promise<string[]>;
request(chainId: string, request: JsonRpcRequest): Promise<string[]>;
}