Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardonunesp committed Mar 21, 2019
1 parent e7c6e31 commit 11f4c35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<EvmTxReceipt | null> {
async getEvmTxReceiptAsync(txHashArr: Uint8Array): Promise<EvmTxReceipt | null> {
const txHash = Uint8ArrayToB64(txHashArr)
debugLog(`Get EVM receipt for ${txHash}`)

const result = await this._readClient.sendAsync<string>('evmtxreceipt', {
txHash: Uint8ArrayToB64(txHash)
txHash
})
if (result) {
return EvmTxReceipt.deserializeBinary(bufferToProtobufBytes(B64ToUint8Array(result)))
Expand Down Expand Up @@ -641,8 +644,11 @@ export class Client extends EventEmitter {
hashHexStr: string,
full: boolean = true
): Promise<EthBlockInfo | null> {
const hash = Buffer.from(hashHexStr.slice(2), 'hex').toString('base64')
debugLog(`Evm block by hash ${hash}`)

const result = await this._readClient.sendAsync<string>('getevmblockbyhash', {
hash: Buffer.from(hashHexStr.slice(2), 'hex').toString('base64'),
hash,
full
})
if (result) {
Expand Down
4 changes: 2 additions & 2 deletions src/tests/e2e/loom-provider-subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
})
Expand Down
4 changes: 2 additions & 2 deletions src/tests/evm-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand All @@ -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]
})
Expand Down

0 comments on commit 11f4c35

Please sign in to comment.