8000 eth/client: remove default gas limit attribute by q9f · Pull Request #235 · q9f/eth.rb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

eth/client: remove default gas limit attribute #235

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

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions lib/eth/client.rb
C73A
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ class Client
# The default transaction max fee per gas in Wei, defaults to {Tx::DEFAULT_GAS_PRICE}.
attr_accessor :max_fee_per_gas

# The default gas limit for the transaction, defaults to {Tx::DEFAULT_GAS_LIMIT}.
attr_accessor :gas_limit

# A custom error type if a contract interaction fails.
class ContractExecutionError < StandardError; end

# Creates a new RPC-Client, either by providing an HTTP/S host or
# an IPC path. Supports basic authentication with username and password.
#
# **Note**, this sets the folling gas defaults: {Tx::DEFAULT_PRIORITY_FEE},
# {Tx::DEFAULT_GAS_PRICE}, and {Tx::DEFAULT_GAS_LIMIT}. Use
# {#max_priority_fee_per_gas}, {#max_fee_per_gas}, and {#gas_limit} to set
# custom values prior to submitting transactions.
# **Note**, this sets the folling gas defaults: {Tx::DEFAULT_PRIORITY_FEE}
# and {Tx::DEFAULT_GAS_PRICE. Use {#max_priority_fee_per_gas} and
# {#max_fee_per_gas} to set custom values prior to submitting transactions.
#
# @param host [String] either an HTTP/S host or an IPC path.
# @return [Eth::Client::Ipc] an IPC client.
Expand All @@ -64,7 +60,6 @@ def initialize(_)
@id = 0
@max_priority_fee_per_gas = Tx::DEFAULT_PRIORITY_FEE
@max_fee_per_gas = Tx::DEFAULT_GAS_PRICE
@gas_limit = Tx::DEFAULT_GAS_LIMIT
end

# Gets the default account (coinbase) of the connected client.
Expand Down Expand Up @@ -144,7 +139,7 @@ def transfer(destination, amount, **kwargs)
params = {
value: amount,
to: destination,
gas_limit: gas_limit,
gas_limit: Tx::DEFAULT_GAS_LIMIT,
chain_id: chain_id,
}
send_transaction(params, kwargs[:legacy], kwargs[:sender_key], kwargs[:nonce])
Expand Down Expand Up @@ -252,7 +247,6 @@ def deploy(contract, *args, **kwargs)
# @param *args optional function arguments.
# @param **sender_key [Eth::Key] the sender private key.
# @param **legacy [Boolean] enables legacy transactions (pre-EIP-1559).
# @param **gas_limit [Integer] optional gas limit override for calling the contract.
# @return [Object] returns the result of the call.
def call(contract, function, *args, **kwargs)
func = contract.functions.select { |func| func.name == function }
Expand Down
1 change: 0 additions & 1 deletion spec/eth/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
expect(geth_ipc.default_account).to be_instance_of Address
expect(geth_ipc.max_priority_fee_per_gas).to eq Tx::DEFAULT_PRIORITY_FEE
expect(geth_ipc.max_fee_per_gas).to eq Tx::DEFAULT_GAS_PRICE
expect(geth_ipc.gas_limit).to eq Tx::DEFAULT_GAS_LIMIT
end

it "http can query basic methods" do
Expand Down
0