21 lines
540 B
JavaScript
21 lines
540 B
JavaScript
// only pass it jsonrpcapiprovider or subclass
|
|
function EIP1193DevWallet(baseProvider) {
|
|
self.baseProvider = baseProvider;
|
|
self.request = self._request_jsonrpc;
|
|
}
|
|
|
|
EIP1193DevWallet.prototype.request_jsonrpc = async function(args) {
|
|
let r = null;
|
|
switch(args.method) {
|
|
default:
|
|
r = await self.baseProvider.send(args.method, args.params);
|
|
}
|
|
console.debug('provider result', r);
|
|
return r;
|
|
};
|
|
|
|
EIP1193DevWallet.prototype.request = async function(args) {
|
|
console.debug('provider args', args);
|
|
return this.request_jsonrpc(args);
|
|
};
|