|
|
@ -63,6 +63,7 @@ export class TruffleProvider extends HDNode { |
|
|
|
} |
|
|
|
} |
|
|
|
async send(...args: [RPCRequestPayload<any>, any]) { |
|
|
|
async send(...args: [RPCRequestPayload<any>, any]) { |
|
|
|
const { newArgs, id, params, newMethod, callback } = this.resolveArgs(...args); |
|
|
|
const { newArgs, id, params, newMethod, callback } = this.resolveArgs(...args); |
|
|
|
|
|
|
|
console.log({ newMethod, newArgs, id, params }); |
|
|
|
switch (newMethod) { |
|
|
|
switch (newMethod) { |
|
|
|
case 'hmy_accounts': { |
|
|
|
case 'hmy_accounts': { |
|
|
|
const accounts = this.getAccounts(); |
|
|
|
const accounts = this.getAccounts(); |
|
|
@ -120,6 +121,18 @@ export class TruffleProvider extends HDNode { |
|
|
|
); |
|
|
|
); |
|
|
|
return this.resolveResult(result); |
|
|
|
return this.resolveResult(result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case 'net_version': { |
|
|
|
|
|
|
|
callback(null, { |
|
|
|
|
|
|
|
result: String(this.messenger.chainId), |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
jsonrpc: '2.0', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
result: String(this.messenger.chainId), |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
jsonrpc: '2.0', |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
case 'hmy_getBlockByNumber': { |
|
|
|
case 'hmy_getBlockByNumber': { |
|
|
|
const result = await this.provider.send(newArgs, (err: any, res: any) => { |
|
|
|
const result = await this.provider.send(newArgs, (err: any, res: any) => { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -149,6 +162,7 @@ export class TruffleProvider extends HDNode { |
|
|
|
|
|
|
|
|
|
|
|
default: { |
|
|
|
default: { |
|
|
|
// hmy_getBlockByNumber
|
|
|
|
// hmy_getBlockByNumber
|
|
|
|
|
|
|
|
|
|
|
|
const result = await this.provider.send( |
|
|
|
const result = await this.provider.send( |
|
|
|
newArgs, |
|
|
|
newArgs, |
|
|
|
(err: any, res: ResponseMiddleware | any) => this.resolveCallback(err, res, callback), |
|
|
|
(err: any, res: ResponseMiddleware | any) => this.resolveCallback(err, res, callback), |
|
|
|