Class: X402::Payments::Configuration
- Inherits:
-
Object
- Object
- X402::Payments::Configuration
- Defined in:
- lib/x402/payments/configuration.rb
Instance Attribute Summary collapse
-
#chain ⇒ Object
Returns the value of attribute chain.
-
#default_pay_to ⇒ Object
Returns the value of attribute default_pay_to.
-
#max_timeout_seconds ⇒ Object
Returns the value of attribute max_timeout_seconds.
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#rpc_urls ⇒ Object
Returns the value of attribute rpc_urls.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
8 9 10 11 12 13 14 |
# File 'lib/x402/payments/configuration.rb', line 8 def initialize @default_pay_to = ENV.fetch("X402_PAY_TO", nil) @private_key = ENV.fetch("X402_PRIVATE_KEY", nil) @chain = ENV.fetch("X402_CHAIN", "base-sepolia") @max_timeout_seconds = ENV.fetch("X402_MAX_TIMEOUT_SECONDS", "600").to_i @rpc_urls = {} end |
Instance Attribute Details
#chain ⇒ Object
Returns the value of attribute chain.
6 7 8 |
# File 'lib/x402/payments/configuration.rb', line 6 def chain @chain end |
#default_pay_to ⇒ Object
Returns the value of attribute default_pay_to.
6 7 8 |
# File 'lib/x402/payments/configuration.rb', line 6 def default_pay_to @default_pay_to end |
#max_timeout_seconds ⇒ Object
Returns the value of attribute max_timeout_seconds.
6 7 8 |
# File 'lib/x402/payments/configuration.rb', line 6 def max_timeout_seconds @max_timeout_seconds end |
#private_key ⇒ Object
Returns the value of attribute private_key.
6 7 8 |
# File 'lib/x402/payments/configuration.rb', line 6 def private_key @private_key end |
#rpc_urls ⇒ Object
Returns the value of attribute rpc_urls.
6 7 8 |
# File 'lib/x402/payments/configuration.rb', line 6 def rpc_urls @rpc_urls end |
Instance Method Details
#validate! ⇒ Object
16 17 18 19 20 |
# File 'lib/x402/payments/configuration.rb', line 16 def validate! raise ConfigurationError, "default_pay_to is required" if default_pay_to.nil? || default_pay_to.empty? raise ConfigurationError, "private_key is required" if private_key.nil? || private_key.empty? raise ConfigurationError, "chain is required" if chain.nil? || chain.empty? end |