Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.0-alpha.1: contract methods do not support BigNumbers as arguments. #3605

Closed
vlddm opened this issue Jun 29, 2020 · 1 comment
Closed
Labels
2.x 2.0 related issues Stale Has not received enough activity

Comments

@vlddm
Copy link
Contributor

vlddm commented Jun 29, 2020

import { ERC20Abi } from "./ERC20Abi.js";
import Web3 from "web3";

const web3 = new Web3();
const contract = new web3.eth.Contract(
  ERC20Abi,
  "0xdac17f958d2ee523a2206206994597c13d831ec7"
); //USDT
const amountBN = web3.utils.toBN(100 * 1e8);
const encoded = contract.methods
  .transfer("0x71294893dcc8fcbf802fad690a34d697c756f585", amountBN)
  .encodeABI();
console.log(encoded)

Error message: Error: invalid number value (arg="_value", coderType="uint256", value="2540be400", version=4.0.40)
Working fine if passed as string.
BN Arguments supported in 1.2.x at least.

@vlddm vlddm changed the title 2.0.0-alpha.1: contracts methods not supporting BigNumbers as arguments. 2.0.0-alpha.1: contracts methods does not support BigNumbers as arguments. Jun 29, 2020
@cgewecke cgewecke added the 2.x 2.0 related issues label Jun 29, 2020
@ryanio ryanio changed the title 2.0.0-alpha.1: contracts methods does not support BigNumbers as arguments. 2.0.0-alpha.1: contract methods do not support BigNumbers as arguments. Jun 29, 2020
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x 2.0 related issues Stale Has not received enough activity
Projects
None yet
Development

No branches or pull requests

2 participants