web3.js
web3.js copied to clipboard
Import only web3-eth-abi ?
I got trouble finding docs about import only this package. I've tried:
import * as web3EthAbi from 'web3-eth-abi';
web3EthAbi.encodeFunctionCall();
// Got "cannot read property 'utils' of undefined"
import web3EthAbi from 'web3-eth-abi';
web3EthAbi.encodeFunctionCall();
// Got "cannot read property 'encodeFunctionCall' of undefined"
How should I import it?
Hi @blueberry6401 let me know if this works for you:
import { encodeFunctionCall } from "web3-eth-abi";
encodeFunctionCall(...)
//OR
const { encodeFunctionCall } = require("web3-eth-abi");
encodeFunctionCall(...)
Anyway, when I tried this one, it worked well:
import * as web3abi from "web3-eth-abi";
web3abi.encodeFunctionCall();
Hi @blueberry6401, closing this due to no response. Let me know if you are still having a problem utilizing the solution above.