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.4.0".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
71 72 73 |
# File 'lib/mobius/client.rb', line 71 def asset_code @asset_code ||= "MOBI" end |
.asset_issuer ⇒ Object
78 79 80 81 82 |
# File 'lib/mobius/client.rb', line 78 def asset_issuer return @asset_issuer if @asset_issuer return "GA6HCMBLTZS5VYYBCATRBRZ3BZJMAFUDKYYF6AH6MVCMGWMRDNSWJPIH" if network == :public "GDRWBLJURXUKM4RWDZDTPJNX6XBYFO3PSE4H4GPUL6H6RCUQVKTSD4AT" end |
.challenge_expires_in ⇒ Object
87 88 89 |
# File 'lib/mobius/client.rb', line 87 def challenge_expires_in @challenge_expires_in ||= 60 * 60 * 24 end |
.horizon_client ⇒ Object
64 65 66 |
# File 'lib/mobius/client.rb', line 64 def horizon_client @horizon_client ||= network == :test ? Stellar::Client.default_testnet : Stellar::Client.default end |
.mobius_host ⇒ Object
Mobius API host
46 47 48 |
# File 'lib/mobius/client.rb', line 46 def mobius_host @mobius_host ||= "https://mobius.network" end |
.strict_interval ⇒ Object
99 100 101 |
# File 'lib/mobius/client.rb', line 99 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.
57 58 59 |
# File 'lib/mobius/client.rb', line 57 def network @network ||= :test end |
.network=(value) ⇒ Object
50 51 52 53 |
# File 'lib/mobius/client.rb', line 50 def network=(value) @network = value Stellar.default_network = stellar_network end |
.on_network ⇒ Object
Runs block on selected Stellar network
104 105 106 107 108 |
# File 'lib/mobius/client.rb', line 104 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
92 93 94 |
# File 'lib/mobius/client.rb', line 92 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
111 112 113 |
# File 'lib/mobius/client.rb', line 111 def to_keypair(subject) Mobius::Client::Blockchain::KeyPairFactory.produce(subject) end |