Class: Solrengine::Ui::SendTransactionFormComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Solrengine::Ui::SendTransactionFormComponent
- Defined in:
- app/components/solrengine/ui/send_transaction_form_component.rb
Constant Summary collapse
- PUBLIC_RPC_URLS =
{ "mainnet-beta" => "https://api.mainnet-beta.solana.com", "mainnet" => "https://api.mainnet-beta.solana.com", "devnet" => "https://api.devnet.solana.com", "testnet" => "https://api.testnet.solana.com" }.freeze
- CHAIN_IDS =
{ "mainnet-beta" => "solana:mainnet", "mainnet" => "solana:mainnet", "devnet" => "solana:devnet", "testnet" => "solana:testnet" }.freeze
Instance Attribute Summary collapse
-
#network ⇒ Object
readonly
Returns the value of attribute network.
-
#rpc_url ⇒ Object
readonly
Returns the value of attribute rpc_url.
-
#wallet_address ⇒ Object
readonly
Returns the value of attribute wallet_address.
Instance Method Summary collapse
- #chain ⇒ Object
- #connected? ⇒ Boolean
-
#initialize(wallet_address: nil, network: "devnet", rpc_url: nil) ⇒ SendTransactionFormComponent
constructor
A new instance of SendTransactionFormComponent.
Constructor Details
#initialize(wallet_address: nil, network: "devnet", rpc_url: nil) ⇒ SendTransactionFormComponent
Returns a new instance of SendTransactionFormComponent.
22 23 24 25 26 |
# File 'app/components/solrengine/ui/send_transaction_form_component.rb', line 22 def initialize(wallet_address: nil, network: "devnet", rpc_url: nil, **) @wallet_address = wallet_address @network = network.to_s @rpc_url = rpc_url || PUBLIC_RPC_URLS.fetch(@network, PUBLIC_RPC_URLS["devnet"]) end |
Instance Attribute Details
#network ⇒ Object (readonly)
Returns the value of attribute network.
20 21 22 |
# File 'app/components/solrengine/ui/send_transaction_form_component.rb', line 20 def network @network end |
#rpc_url ⇒ Object (readonly)
Returns the value of attribute rpc_url.
20 21 22 |
# File 'app/components/solrengine/ui/send_transaction_form_component.rb', line 20 def rpc_url @rpc_url end |
#wallet_address ⇒ Object (readonly)
Returns the value of attribute wallet_address.
20 21 22 |
# File 'app/components/solrengine/ui/send_transaction_form_component.rb', line 20 def wallet_address @wallet_address end |
Instance Method Details
#chain ⇒ Object
32 33 34 |
# File 'app/components/solrengine/ui/send_transaction_form_component.rb', line 32 def chain CHAIN_IDS.fetch(network, "solana:devnet") end |
#connected? ⇒ Boolean
28 29 30 |
# File 'app/components/solrengine/ui/send_transaction_form_component.rb', line 28 def connected? wallet_address.present? end |