
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
abigen-extended
Advanced tools
Based on the contract ABI, **abigen** create some Go code to interact with our smart contract functions in a pleasant way (automatic type binding, parsing logs, etc…).
Based on the contract ABI, abigen create some Go code to interact with our smart contract functions in a pleasant way (automatic type binding, parsing logs, etc…).
But this is not enough to having a full control on our Smart Contract, indeed some features are missing:
That's why we have created this tool. Basically it use abigen under the hood and add some code at the bottom on the file.
Install abigen: https://geth.ethereum.org/docs/install-and-build/installing-geth
# Install the package
npm install -g abigen-extended
# Or with yarn
yarn global add abigen-extended
abigen-extended --abi <PATH_TO_ABI_FILE> --out <PATH_TO_GO_FILE> --pkg <GO_PACKAGE_NAME>
For the rest of the readme, I suppose we use the following command for importing WETH contract:
abigen-extended --abi weth.abi.json --out weth.go --pkg weth
wethContract, err := weth.NewWeth(address, client)
wethContract.Address // Get the instance address
wethContract.Backend // Get the client instance
wethContract.ABI // Get the parsed ABI
weth.EVENT_APPROVAL_HASH // Hash of approval event
weth.EVENT_TRANSFER_HASH // Hash of transfer event
// ...
events, err := wethContract.ParseReceiptTransfer(receipt) // Get all parsed transfer logs from the receipt
// Perform static call on transfer (non payable)
transferSuccess, err := wethContract.StaticTransfer(&bind.CallOpts{ From: address }, receiver, amount)
// Perform static call on deposit (payable)
err := wethContract.StaticDeposit(&bind.CallOpts{ From: address }, payableETHValue)
FAQs
Based on the contract ABI, **abigen** create some Go code to interact with our smart contract functions in a pleasant way (automatic type binding, parsing logs, etc…).
We found that abigen-extended demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.