Skip to content

Commit

Permalink
fix: πŸ› function send of ether engine
Browse files Browse the repository at this point in the history
Modify the return value of the send method in the ethers engine to
TransactionReceipt.

βœ… Closes: #8
  • Loading branch information
siriusyim committed Dec 15, 2023
1 parent 6612738 commit 6d32d7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/evm/engine/ether/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ export class EthersEvmEngine implements IEVMEngine {
}

try {
const result = await this.provider.broadcastTransaction(signed)
await this.provider.waitForTransaction(result.hash);
const tr = await this.provider.broadcastTransaction(signed)
const result = await this.provider.waitForTransaction(tr.hash);
return {
ok: true,
data: result,
Expand Down
5 changes: 4 additions & 1 deletion test/evm/sendValue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ describe("SendValue test(By privateKey) ", () => {
privateKey: process.env.PROOFSUBMITTERKEY,
value: ethersProof.generateWei("1", "gwei"),
})
const ethersTx = await ethersProof.getEtherProvider()?.getTransaction(
ethersResult.data.hash
)
assert.deepStrictEqual(ethersResult.ok, true)
assert.deepStrictEqual(ethersResult.data.value, BigInt(1000000000))
assert.deepStrictEqual(ethersTx?.value, BigInt(1000000000))
})
})
5 changes: 4 additions & 1 deletion test/evm/signAndSendSigned.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ describe("Sign and sendSigned test(By privateKey) ", () => {
}
)
const result = await ethersProof.sendSigned(signed.data!)
const tx = await ethersProof.getEtherProvider()?.getTransaction(
result.data.hash
)
assert.deepStrictEqual(result.ok, true)
assert.deepStrictEqual(result.data.value, BigInt(1000000000))
assert.deepStrictEqual(tx?.value, BigInt(1000000000))
})
})

0 comments on commit 6d32d7e

Please sign in to comment.