Skip to content

finding Gas Limit using Abi file in swift #850

Discussion options

You must be logged in to vote

We had a similar question on Discord. Maybe it was from you: https://discord.com/channels/852230666292559882/855076147985776661/1217652210331025529

But to put it simple there's only one function to estimate gas that you'll need to execute a transaction and that is web3.eth.estimateGas.

Example:

        let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
        var tx = CodableTransaction(
            type: .eip1559,
            to: EthereumAddress("0xb47292B7bBedA4447564B8336E4eD1f93735e7C7")!,
            chainID: web3.provider.network!.chainID,
            value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether))
        )
        tx.from = Ethere…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vanijain3108
Comment options

Answer selected by vanijain3108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants