diff --git a/packages/harmony-account/src/hdnode.ts b/packages/harmony-account/src/hdnode.ts index d90a05b..fb9ab33 100644 --- a/packages/harmony-account/src/hdnode.ts +++ b/packages/harmony-account/src/hdnode.ts @@ -49,8 +49,7 @@ export class HDNode { public provider: HttpProvider | WSProvider; public gasLimit: string; public gasPrice: string; - - private messenger: Messenger; + public messenger: Messenger; private shardID: number; private hdwallet: hdkey | undefined; private path: string; @@ -202,7 +201,18 @@ export class HDNode { const signerAccount = new Account(prv, this.messenger); const tx = new Transaction( - { ...txParams, from, to, gasLimit, gasPrice, value, nonce, data, shardID: this.shardID }, + { + ...txParams, + from, + to, + gasLimit, + gasPrice, + value, + nonce, + data, + shardID: this.shardID, + chainId: this.messenger.chainId, + }, this.messenger, TxStatus.INTIALIZED, ); diff --git a/packages/harmony-core/src/truffleProvider.ts b/packages/harmony-core/src/truffleProvider.ts index 6dfe49f..cf9253a 100644 --- a/packages/harmony-core/src/truffleProvider.ts +++ b/packages/harmony-core/src/truffleProvider.ts @@ -63,6 +63,7 @@ export class TruffleProvider extends HDNode { } async send(...args: [RPCRequestPayload, any]) { const { newArgs, id, params, newMethod, callback } = this.resolveArgs(...args); + console.log({ newMethod, newArgs, id, params }); switch (newMethod) { case 'hmy_accounts': { const accounts = this.getAccounts(); @@ -120,6 +121,18 @@ export class TruffleProvider extends HDNode { ); 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': { const result = await this.provider.send(newArgs, (err: any, res: any) => { try { @@ -149,6 +162,7 @@ export class TruffleProvider extends HDNode { default: { // hmy_getBlockByNumber + const result = await this.provider.send( newArgs, (err: any, res: ResponseMiddleware | any) => this.resolveCallback(err, res, callback),