Module: Mobius::Client
- Defined in:
- lib/mobius/client.rb,
lib/mobius/client/version.rb
Defined Under Namespace
Modules: Auth, Blockchain Classes: App, Error, FriendBot
Constant Summary collapse
- VERSION =
"0.2.1".freeze
Class Attribute Summary collapse
- .asset_code ⇒ Object
- .asset_issuer ⇒ Object
- .challenge_expires_in ⇒ Object
- .horizon_client ⇒ Object
-
.mobius_host ⇒ Object
Mobius API host.
- .strict_interval ⇒ Object
Class Method Summary collapse
-
.network ⇒ Object
Stellar network to use (:test || :public).
- .network=(value) ⇒ Object
-
.on_network ⇒ Object
Runs block on selected Stellar network.
-
.stellar_asset ⇒ Object
Stellar::Asset instance of asset used for payments.
-
.to_keypair(subject) ⇒ Object
Converts given argument to Stellar::KeyPair.
Class Attribute Details
.asset_code ⇒ Object
67 68 69 |
# File 'lib/mobius/client.rb', line 67 def asset_code @asset_code ||= "MOBI" end |
.asset_issuer ⇒ Object
74 75 76 77 78 |
# File 'lib/mobius/client.rb', line 74 def asset_issuer return @asset_issuer if @asset_issuer return "GA6HCMBLTZS5VYYBCATRBRZ3BZJMAFUDKYYF6AH6MVCMGWMRDNSWJPIH" if network == :public "GDRWBLJURXUKM4RWDZDTPJNX6XBYFO3PSE4H4GPUL6H6RCUQVKTSD4AT" end |
.challenge_expires_in ⇒ Object
83 84 85 |
# File 'lib/mobius/client.rb', line 83 def challenge_expires_in @challenge_expires_in ||= 60 * 60 * 24 end |
.horizon_client ⇒ Object
60 61 62 |
# File 'lib/mobius/client.rb', line 60 def horizon_client @horizon_client ||= network == :test ? Stellar::Client.default_testnet : Stellar::Client.default end |
.mobius_host ⇒ Object
Mobius API host
42 43 44 |
# File 'lib/mobius/client.rb', line 42 def mobius_host @mobius_host ||= "https://mobius.network" end |
.strict_interval ⇒ Object
95 96 97 |
# File 'lib/mobius/client.rb', line 95 def strict_interval @strict_interval ||= 10 end |
Class Method Details
.network ⇒ Object
Stellar network to use (:test || :public). See notes on thread-safety in ruby-stellar-base. Safe to set on startup.
53 54 55 |
# File 'lib/mobius/client.rb', line 53 def network @network ||= :test end |
.network=(value) ⇒ Object
46 47 48 49 |
# File 'lib/mobius/client.rb', line 46 def network=(value) @network = value Stellar.default_network = stellar_network end |
.on_network ⇒ Object
Runs block on selected Stellar network
100 101 102 103 104 |
# File 'lib/mobius/client.rb', line 100 def on_network Stellar.on_network(stellar_network) do yield if block_given? end end |
.stellar_asset ⇒ Object
Stellar::Asset instance of asset used for payments
88 89 90 |
# File 'lib/mobius/client.rb', line 88 def stellar_asset @stellar_asset ||= Stellar::Asset.alphanum4(asset_code, Stellar::KeyPair.from_address(asset_issuer)) end |
.to_keypair(subject) ⇒ Object
Converts given argument to Stellar::KeyPair
107 108 109 |
# File 'lib/mobius/client.rb', line 107 def to_keypair(subject) Mobius::Client::Blockchain::KeyPairFactory.produce(subject) end |