question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

abi.map is not a function error

See original GitHub issue

Reopening https://github.com/ethers-io/ethers.js/issues/1196


 const interface = new ethers.utils.Interface(FILL_ORDER_ABI);  <----- this line raise the error.
    const sig = "fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)";
 

    const data = interface.encodeFunctionData(sig, [orderTuple,fillAmount, signature])

The error;

TypeError: abi.map is not a function,

My abi ;

{"constant":false,"inputs":[
    {"components":[
        {"internalType":"address","name":"makerAddress","type":"address"},
        {"internalType":"address","name":"takerAddress","type":"address"},
        {"internalType":"address","name":"feeRecipientAddress","type":"address"},
        {"internalType":"address","name":"senderAddress","type":"address"},
        {"internalType":"uint256","name":"makerAssetAmount","type":"uint256"},
        {"internalType":"uint256","name":"takerAssetAmount","type":"uint256"},
        {"internalType":"uint256","name":"makerFee","type":"uint256"},
        {"internalType":"uint256","name":"takerFee","type":"uint256"},
        {"internalType":"uint256","name":"expirationTimeSeconds","type":"uint256"},
        {"internalType":"uint256","name":"salt","type":"uint256"},
        {"internalType":"bytes","name":"makerAssetData","type":"bytes"},
        {"internalType":"bytes","name":"takerAssetData","type":"bytes"},
        {"internalType":"bytes","name":"makerFeeAssetData","type":"bytes"},
        {"internalType":"bytes","name":"takerFeeAssetData","type":"bytes"}
        ],
        "internalType":"struct LibOrder.Order","name":"order","type":"tuple"
    },
        {"internalType":"uint256","name":"takerAssetFillAmount","type":"uint256"},
        {"internalType":"bytes","name":"signature","type":"bytes"}
    ],
    "name":"fillOrder",
    "outputs":[
        {"components":[
            {"internalType":"uint256","name":"makerAssetFilledAmount","type":"uint256"},
            {"internalType":"uint256","name":"takerAssetFilledAmount","type":"uint256"},
            {"internalType":"uint256","name":"makerFeePaid","type":"uint256"},
            {"internalType":"uint256","name":"takerFeePaid","type":"uint256"},
            {"internalType":"uint256","name":"protocolFeePaid","type":"uint256"}
            ],
        "internalType":"struct LibFillResults.FillResults",
        "name":"fillResults","type":"tuple"}
            ],
    "payable":true,
    "stateMutability":"payable",
    "type":"function"}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

20reactions
zemsecommented, Jan 13, 2021

Currently the value you have stored in abi var is actually an abi fragment. An abi is actually an array of abi fragments.

Change your const abi = {......} to const abi = [{......}]

2reactions
zemsecommented, Jan 13, 2021

Change the property gas to gasLimit

You can find list of accepted overrides/options here: https://github.com/ethers-io/ethers.js/blob/e0ccafb140ad8a10353a49909b8d425ba71b87de/packages/contracts/src.ts/index.ts#L17-L30

Read more comments on GitHub >

github_iconTop Results From Across the Web

abi.map not a function error trying to connect to uniswap
I've been following their docs on V3 but I can't get past this "abi.map is not a function" error. When I output the...
Read more >
I get an error for a function I don't even call
map , and the variable name suggests it's abi , though this is from ethers.js codebase not yours. Share.
Read more >
A brand new website interface for an even better experience!
abi.map is not a function error.
Read more >
[Hardhat] Having trouble passing an ABI to my contract object.
The only output I am getting is TypeError: abi.map is not a function. I assume this means that it is improperly reading the...
Read more >
Contract ABI Specification — Solidity 0.8.16 documentation
The return type of a function is not part of this signature. ... We define enc , the actual encoding, as a mapping...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found