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 Transaction issue, processingError(desc: "Failed to fetch gas estimate") #356

Closed
Najim-hub opened this issue Aug 6, 2021 · 3 comments

Comments

@Najim-hub
Copy link

Attached is the proper code, and this is my method; I've gone through the recent case and tried everything and it doesn't work, can someone help me?
` */
let value: String = "0.000000033" // In Ether
let walletAddress = EthereumAddress(self.AccountNumber)! // Your wallet address
let toAdres = EthereumAddress(/To Address/)!
let contract = Web3.InfuraMainnetWeb3().contract(Web3.Utils.coldWalletABI, at: toAdres, abiVersion: 2)!

                let amount = Web3.Utils.parseToBigUInt(value, units: .eth)
                var options = TransactionOptions.defaultOptions
        options.value = amount
        options.from = walletAddress
        options.gasPrice = .automatic
        options.gasLimit = .automatic

                // @@@ use [fallback](see [web3swift/Web3/Web3+Utils.swift])
                let tx = contract.write("fallback"/*"transfer"*/, parameters: [AnyObject](), extraData: Data(), transactionOptions: options)

                do {
                    // @@@ write transaction requires password, because it consumes gas
                    let transaction = try tx?.send( password: self.Password )
                    
                    print("output", transaction?.transaction.description as Any)
                } catch(let err) {
                  print("err", err)
                }
            }
}`
@AlleniCode
Copy link

I can't see what's wrong with your code, make sure your internet connection is ok, or you can try this for test:

options.gasLimit = .manual(BigUInt(21000))
options.gasPrice = .manual(BigUInt(30000000000))

@dangell7
Copy link

99% this is issue with parameters. To properly diagnose your issue we would need the ABI for the specific function or smart contract .sol

@Iysbaera
Copy link
Collaborator

Iysbaera commented Nov 5, 2021

Hey, @Najim-hub have your initial issue been resolved? Please let us know if it can be closed.

If you still experience any problems, feel free to add more details in this issue or open another one.

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

5 participants