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

Send ERC20 token error And get token name error #262

Closed
wq19920109 opened this issue Apr 20, 2020 · 2 comments
Closed

Send ERC20 token error And get token name error #262

wq19920109 opened this issue Apr 20, 2020 · 2 comments

Comments

@wq19920109
Copy link

//trans
let fromAddress: Address = "0x65d1d0dfc525aff63aa2ffea0c3256c171b4ee6a"
let toAddress: Address = "0x95171276fda97ba1ff19af8481bf597bbcdfde83"
let amount = try NaturalUnits.init("1.23")
let amount18 = amount.number(with: 18)
let erc20 = ERC20(self.contractAddress)
erc20.options.from = fromAddress
let erc20Result = try erc20.transferFrom(owner: fromAddress, to: toAddress, amount: amount18)
The error is "Failed to fetch gas estimate"

//get token name
let token = ERC20(contractAddress)
let name = try token.name()
The error is notFound

Please help me to solve the issue , thanks

@wq19920109 wq19920109 changed the title Swnd ERC token error And get token name error Send ERC token error And get token name error Apr 20, 2020
@wq19920109 wq19920109 changed the title Send ERC token error And get token name error Send ERC20 token error And get token name error Apr 20, 2020
@AnnaYatsun1
Copy link
Contributor

AnnaYatsun1 commented Jun 30, 2021

You have an old example of using lib Now we get the name of token now we used ->
Go to https://infura.io/dashboard/ethereum
Create a new project. In new project you will have PROJECT ID

guard let url = URL(string: "https://kovan.infura.io/v3/your PROJECT ID"), let web3 = try? Web3.new(url) else { return } let w3sTokenAddress = EthereumAddress("")! let st20token = ERC20.init(web3: web3, provider: web3.provider, address: w3sTokenAddress)
label

@Iysbaera
Copy link
Collaborator

Iysbaera commented Nov 5, 2021

Authour of this issue haven't replied, so I suppose it was resolved and thus closing this issue.

To anyone still experiencing similar problems, feel free to reopen it.

@Iysbaera Iysbaera closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants