class Glueby::Configuration

Global configuration on runtime

The global configuration treats configurations for all modules in Glueby.

@example

Glueby.configure do |config|
  config.wallet_adapter = :activerecord
  config.rpc_config = { schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass' }
end

Attributes

fee_provider_bears[R]
fee_provider_bears?[R]

Public Class Methods

new() click to toggle source
# File lib/glueby/configuration.rb, line 16
def initialize
  @fee_provider_bears = false
end

Public Instance Methods

disable_fee_provider_bears!() click to toggle source

Use This to disable to use FeeProvider

# File lib/glueby/configuration.rb, line 50
def disable_fee_provider_bears!
  @fee_provider_bears = false
end
fee_provider_bears!() click to toggle source

Use This to enable to use FeeProvider to supply inputs for fees on each transaction that is created on Glueby.

# File lib/glueby/configuration.rb, line 45
def fee_provider_bears!
  @fee_provider_bears = true
end
fee_provider_config=(config) click to toggle source

Specify FeeProvider configuration. @param [Hash] config @option config [Integer] :fixed_fee - The fee that Fee Provider pays on each transaction. @option config [Integer] :utxo_pool_size - Fee Provider tries to keep the number of utxo in utxo pool as this size using `glueby:fee_provider:manage_utxo_pool` rake task

# File lib/glueby/configuration.rb, line 58
def fee_provider_config=(config)
  FeeProvider.configure(config)
end
rpc_config=(config) click to toggle source

Specify connection information to Tapyrus Core RPC. @param [Hash] config @option config [String] :schema - http or https @option config [String] :host - The host of the RPC endpoint @option config [Integer] :port - The port of the RPC endpoint @Option config [String] :user - The user for Basic Authorization of the RPC endpoint @Option config [String] :password - The password for Basic Authorization of the RPC endpoint

# File lib/glueby/configuration.rb, line 40
def rpc_config=(config)
  Glueby::Internal::RPC.configure(config)
end
wallet_adapter=(adapter) click to toggle source

Specify wallet adapter. @param [Symbol] adapter - The adapter type :activerecord or :core is currently supported.

# File lib/glueby/configuration.rb, line 22
def wallet_adapter=(adapter)
  case adapter
  when :core
    Glueby::Internal::Wallet.wallet_adapter = Glueby::Internal::Wallet::TapyrusCoreWalletAdapter.new
  when :activerecord
    Glueby::Internal::Wallet.wallet_adapter = Glueby::Internal::Wallet::ActiveRecordWalletAdapter.new
  else
    raise 'Not implemented'
  end
end