From 11f4c3586dc5371abad00f395c8a454b62aa2142 Mon Sep 17 00:00:00 2001 From: Eduardo Pereira Date: Thu, 21 Mar 2019 10:00:24 -0300 Subject: [PATCH] Update test --- src/client.ts | 12 +++++++++--- src/tests/e2e/loom-provider-subscribe.ts | 4 ++-- src/tests/evm-helpers.ts | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/client.ts b/src/client.ts index 3c29b900..df59db21 100644 --- a/src/client.ts +++ b/src/client.ts @@ -443,9 +443,12 @@ export class Client extends EventEmitter { * @param txHash Transaction hash returned by call transaction. * @return EvmTxReceipt The corresponding transaction receipt. */ - async getEvmTxReceiptAsync(txHash: Uint8Array): Promise { + async getEvmTxReceiptAsync(txHashArr: Uint8Array): Promise { + const txHash = Uint8ArrayToB64(txHashArr) + debugLog(`Get EVM receipt for ${txHash}`) + const result = await this._readClient.sendAsync('evmtxreceipt', { - txHash: Uint8ArrayToB64(txHash) + txHash }) if (result) { return EvmTxReceipt.deserializeBinary(bufferToProtobufBytes(B64ToUint8Array(result))) @@ -641,8 +644,11 @@ export class Client extends EventEmitter { hashHexStr: string, full: boolean = true ): Promise { + const hash = Buffer.from(hashHexStr.slice(2), 'hex').toString('base64') + debugLog(`Evm block by hash ${hash}`) + const result = await this._readClient.sendAsync('getevmblockbyhash', { - hash: Buffer.from(hashHexStr.slice(2), 'hex').toString('base64'), + hash, full }) if (result) { diff --git a/src/tests/e2e/loom-provider-subscribe.ts b/src/tests/e2e/loom-provider-subscribe.ts index 170f005b..7ca3f749 100644 --- a/src/tests/e2e/loom-provider-subscribe.ts +++ b/src/tests/e2e/loom-provider-subscribe.ts @@ -143,7 +143,7 @@ test('LoomProvider + Subscribe Test 2', async t => { t.end() }) -test('LoomProvider + BlockByNumber transaction issue', async t => { +test.only('LoomProvider + BlockByNumber transaction issue', async t => { let client try { @@ -197,7 +197,7 @@ test('LoomProvider + BlockByNumber transaction issue', async t => { // Subscribe for new heads using eth_subscribe const ehtGetBlockByHashResult = await execAndWaitForMillisecondsAsync( loomProvider.sendAsync({ - id: 1, + id: 1000, method: 'eth_getBlockByHash', params: [tx.blockHash] }) diff --git a/src/tests/evm-helpers.ts b/src/tests/evm-helpers.ts index d58a3e34..3a401c75 100644 --- a/src/tests/evm-helpers.ts +++ b/src/tests/evm-helpers.ts @@ -14,7 +14,7 @@ export async function deployContract(loomProvider: LoomProvider, contractData: s ).toString() const ethSendTransactionDeployResult = await loomProvider.sendAsync({ - id: 1, + id: 100, method: 'eth_sendTransaction', params: [ { @@ -28,7 +28,7 @@ export async function deployContract(loomProvider: LoomProvider, contractData: s }) const ethGetTransactionReceiptResult = await loomProvider.sendAsync({ - id: 2, + id: 200, method: 'eth_getTransactionReceipt', params: [ethSendTransactionDeployResult.result] })