Skip to content

Commit

Permalink
feat(ethereum): use triple equal signs
Browse files Browse the repository at this point in the history
  • Loading branch information
denizenging committed Oct 8, 2023
1 parent 76cbb07 commit 94acfcd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/ethereum/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const execute = async (
): Promise<PluginResult> => {
const web3 = new Web3(ctx.fetchConnect()[0]);

if (kind == EthereumRequestKind.EthereumNonce) {
if (kind === EthereumRequestKind.EthereumNonce) {
const address = ctx.fetch('address') as string;
const nonce = await web3.eth.getTransactionCount(address);
return ctx.pass(nonce.toString());
}

if (kind == EthereumRequestKind.EthereumGasPrice) {
if (kind === EthereumRequestKind.EthereumGasPrice) {
const gasPrice = await web3.eth.getGasPrice();
return ctx.pass(gasPrice.toString());
}
Expand All @@ -43,11 +43,10 @@ export const execute = async (
address.map((addr) => web3.eth.getBalance(addr as string))
);
return ctx.pass(balances.map((b) => b.toString()));
} else {
return ctx.pass((await web3.eth.getBalance(address as string)).toString());
}
return ctx.pass((await web3.eth.getBalance(address as string)).toString());
}
// if (kind == EthereumRequestKind.EthereumBytes) {
// if (kind === EthereumRequestKind.EthereumBytes) {
// const tag = ctx.fetch('transaction_id') as string;
// const receipt = await web3.eth.getTransactionReceipt(
// tag.startsWith('0x') ? tag : '0x' + tag
Expand Down

0 comments on commit 94acfcd

Please sign in to comment.