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

How to write Contract ABI functions swift ios #111

Open
text4lilac opened this issue Dec 25, 2021 · 0 comments
Open

How to write Contract ABI functions swift ios #111

text4lilac opened this issue Dec 25, 2021 · 0 comments

Comments

@text4lilac
Copy link

i have made an demo app using walletconnectswift library for connecting to rainbow wallet and i want to write contract functions given in this link below:
https://ropsten.etherscan.io/address/0x1c5509db908b34d81566f48780caa22e918c228a#writeContract

i have tried but not working. can i get an example of how it works. can i get example of approve function

the code i have tried is below:

let web3 = Web3(rpcURL: "https://ropsten.infura.io/v3/4cca371cb77c4935bdb1a1381b2ffbe2")
guard let contractAddress = getAddress(hex: "0x1C5509DB908b34D81566f48780Caa22E918C228a") else { return }

    guard let spenderAddress = getAddress(hex: Constants.spenderAddress) else { return }
    
    contract = web3.eth.Contract(type: GenericERC20Contract.self, address: contractAddress)
    
    contract.approve(spender: spenderAddress, value: 10000).call { result, error in
        
    }

but it gives me error that operation cannot be completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant