New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hardhat-logger

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat-logger

Show transaction params befor hardhat send transaction to evm

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

hardhat-logger

Show transaction params before hardhat send transaction to network

Installation

npm install hardhat-logger

or

yarn add hardhat-logger

Import the plugin in your hardhat.config.ts or hardhat.config.js:

//hardhat.config.ts

import {logger, MatcherType} from 'hardhat-logger'//or const {logger} = require('hardhat-logger');

// type MatcherType = string | string[] | RegExp | ((args: {method: string; params?: unknown[] | object;}) => boolean);

const matcher: MatcherType  = /eth_getBalance/; 
logger(matcher); // or without arguments logger() 

here what you see if you run npx hardhat test in Lock hardhat example

...
{
  method: 'eth_getBalance',
  params: [
    '0x5FbDB2315678afecb367f032d93F642f64180aa3',
    '0x3'
  ]
}
{
  method: 'eth_getBalance',
  params: [
    '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
    '0x2'
  ]
}
...

Use the function for more complex filtering. It's also possible to change args to check some guesses on the fly.

//show only 'eth_sendTransaction' and change gas for the transaction
const matcher = (args: {method: string, params?: any}) => {
  if(args.method === 'eth_sendTransaction') {    
    args.params[0].gas = '0x1C9C38';
    return true;
  }

  return false;
};

logger(matcher);

and result

...
{
  method: 'eth_sendTransaction',
  params: [
    {
      gas: '0x1C9C38',
      from: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
      to: '0x5fbdb2315678afecb367f032d93f642f64180aa3',
      data: '0x3ccfd60b',
      maxFeePerGas: '0x32b1a62c',
      maxPriorityFeePerGas: '0x0'
    }
  ]
}
...

Keywords

FAQs

Package last updated on 03 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc