gasgasgas/js/booteth/eip1193.js

21 lines
540 B
JavaScript
Raw Normal View History

2023-09-03 14:54:09 +02:00
// 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);
};