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