Module: Stellar

Includes:
DSL
Defined in:
lib/stellar/dsl.rb,
lib/stellar/asset.rb,
lib/stellar/price.rb,
lib/stellar/convert.rb,
lib/stellar/version.rb,
lib/stellar/key_pair.rb,
lib/stellar/networks.rb,
lib/stellar/operation.rb,
lib/stellar/ledger_key.rb,
lib/stellar/signer_key.rb,
lib/stellar/thresholds.rb,
lib/stellar/transaction.rb,
lib/stellar/util/strkey.rb,
lib/stellar/account_flags.rb,
lib/stellar/muxed_account.rb,
lib/stellar/transaction_v0.rb,
lib/stellar/claim_predicate.rb,
lib/stellar/trust_line_flags.rb,
lib/stellar/transaction_builder.rb,
lib/stellar/fee_bump_transaction.rb,
lib/stellar/transaction_envelope.rb,
lib/stellar/path_payment_strict_receive_result.rb

Defined Under Namespace

Modules: Concerns, Convert, DSL, Networks, Util Classes: AccountFlags, Asset, ClaimPredicate, FeeBumpTransaction, KeyPair, LedgerKey, MuxedAccount, Operation, PathPaymentStrictReceiveResult, Price, SignerKey, Thresholds, Transaction, TransactionBuilder, TransactionEnvelope, TransactionV0, TrustLineFlags

Constant Summary collapse

ONE =
1_0000000
Deprecation =
ActiveSupport::Deprecation.new("next release", "stellar-base")
VERSION =
"0.27.0"

Class Method Summary collapse

Methods included from DSL

Asset, ClaimPredicate, Claimant, KeyPair, SignerKey

Class Method Details

.current_networkObject

Returns the passphrase for the network currently active per-thread with a fallback to `Stellar.default_network`


25
26
27
# File 'lib/stellar/networks.rb', line 25

def self.current_network
  network.presence || default_network
end

.current_network_idObject

Returns the id for the currently configured network, suitable for use in generating a signature base string or making the root account's keypair.


31
32
33
# File 'lib/stellar/networks.rb', line 31

def self.current_network_id
  Digest::SHA256.digest(current_network)
end

.on_network(passphrase, &block) ⇒ Object

Executes the provided block in the context of the provided network.


36
37
38
39
40
41
42
# File 'lib/stellar/networks.rb', line 36

def self.on_network(passphrase, &block)
  old = network
  self.network = passphrase
  block.call
ensure
  self.network = old
end