solrengine-ui 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ff02121ebeec618fe5a5b9962b9e4e1b0e576fe730f199889dfb1823fc16d85
4
- data.tar.gz: 8571bceac6b425d252e8c6a8c98292c4a2706f9fe76750944c253c864cf3c507
3
+ metadata.gz: 757ed0c44b179f8169342a93dff5a504801dd18afa82af67f04158d7dbc3cd21
4
+ data.tar.gz: 647aaec20abb7091fe1672c4739eab475fc2ebe84b22cb577d8704244ac1ddec
5
5
  SHA512:
6
- metadata.gz: d72055fb826074db1f48534cd7e09ea81e6a155b94cc2383ca2cfe1d8329ca17e244b474d4265857910bcd81ef50d6b0334524fca7baa4bdcb24e2c447b8d173
7
- data.tar.gz: 2b7da4e67ef8ef73086a445764784d5657d9f13b98ff9b9a4cd30a273d9bb91bd558e5d6ba6520b05f1115b77293ac9fd653f0574f770fbc362bde96ef845c3f
6
+ metadata.gz: b4c43b03fdce1418f42053fa21cf657988dde2e7359570566e5b4cc6eb25f5381013959cab6b4049f03e6259c877a084ba41eb80a1480429888f1205ae062e67
7
+ data.tar.gz: 3da24e5feb18a4e62337262d8b98373203baad823e67cd6ecfc43f406e92a7d04f2bcc3fdf3387ed8b2394dd27f9cbcb3563522062b6db69f981818160de441c
@@ -1,7 +1,12 @@
1
1
  <div class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-5">
2
2
  <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Send SOL</h3>
3
3
  <% if connected? %>
4
- <form action="<%= action_url %>" method="post" class="space-y-4">
4
+ <form class="space-y-4"
5
+ data-controller="send-transaction"
6
+ data-send-transaction-wallet-address-value="<%= wallet_address %>"
7
+ data-send-transaction-rpc-url-value="<%= rpc_url %>"
8
+ data-send-transaction-chain-value="<%= chain %>"
9
+ data-action="submit->send-transaction#send">
5
10
  <div>
6
11
  <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">From</label>
7
12
  <div class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 px-3 py-2 rounded-lg">
@@ -10,16 +15,22 @@
10
15
  </div>
11
16
  <div>
12
17
  <label for="sui-send-recipient" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Recipient</label>
13
- <input type="text" name="recipient" id="sui-send-recipient" placeholder="Solana address" class="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" required />
18
+ <input type="text" name="recipient" id="sui-send-recipient" placeholder="Solana address" required
19
+ data-send-transaction-target="recipient"
20
+ class="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
14
21
  </div>
15
22
  <div>
16
23
  <label for="sui-send-amount" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Amount (SOL)</label>
17
- <input type="number" name="amount" id="sui-send-amount" step="0.000000001" min="0" placeholder="0.0" class="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" required />
24
+ <input type="number" name="amount" id="sui-send-amount" step="0.000000001" min="0" placeholder="0.0" required
25
+ data-send-transaction-target="amount"
26
+ class="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
18
27
  </div>
19
- <input type="hidden" name="network" value="<%= network %>" />
20
- <button type="submit" class="w-full py-2.5 px-4 bg-purple-600 hover:bg-purple-700 text-white font-medium rounded-lg text-sm transition-colors cursor-pointer">
28
+ <button type="submit"
29
+ data-send-transaction-target="submit"
30
+ class="w-full py-2.5 px-4 bg-purple-600 hover:bg-purple-700 text-white font-medium rounded-lg text-sm transition-colors cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed">
21
31
  Send Transaction
22
32
  </button>
33
+ <div data-send-transaction-target="status" class="hidden"></div>
23
34
  </form>
24
35
  <% else %>
25
36
  <p class="text-sm text-gray-500 dark:text-gray-400 text-center py-4">Connect your wallet to send SOL</p>
@@ -3,17 +3,35 @@
3
3
  module Solrengine
4
4
  module Ui
5
5
  class SendTransactionFormComponent < ViewComponent::Base
6
- attr_reader :wallet_address, :network, :action_url
6
+ PUBLIC_RPC_URLS = {
7
+ "mainnet-beta" => "https://api.mainnet-beta.solana.com",
8
+ "mainnet" => "https://api.mainnet-beta.solana.com",
9
+ "devnet" => "https://api.devnet.solana.com",
10
+ "testnet" => "https://api.testnet.solana.com"
11
+ }.freeze
7
12
 
8
- def initialize(wallet_address: nil, network: "devnet", action_url: "/transfers")
13
+ CHAIN_IDS = {
14
+ "mainnet-beta" => "solana:mainnet",
15
+ "mainnet" => "solana:mainnet",
16
+ "devnet" => "solana:devnet",
17
+ "testnet" => "solana:testnet"
18
+ }.freeze
19
+
20
+ attr_reader :wallet_address, :network, :rpc_url
21
+
22
+ def initialize(wallet_address: nil, network: "devnet", rpc_url: nil, **)
9
23
  @wallet_address = wallet_address
10
- @network = network
11
- @action_url = action_url
24
+ @network = network.to_s
25
+ @rpc_url = rpc_url || PUBLIC_RPC_URLS.fetch(@network, PUBLIC_RPC_URLS["devnet"])
12
26
  end
13
27
 
14
28
  def connected?
15
29
  wallet_address.present?
16
30
  end
31
+
32
+ def chain
33
+ CHAIN_IDS.fetch(network, "solana:devnet")
34
+ end
17
35
  end
18
36
  end
19
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Solrengine
4
4
  module Ui
5
- VERSION = "0.3.1"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
@@ -10,9 +10,7 @@ module Solrengine
10
10
 
11
11
  # @label In a flex container
12
12
  def in_flex_container
13
- render_with_template(
14
- template: "solrengine/ui/theme_toggle_component_preview/in_flex_container"
15
- )
13
+ render Solrengine::Ui::ThemeToggleComponent.new
16
14
  end
17
15
  end
18
16
  end
@@ -14,8 +14,18 @@ class Solrengine::Ui::TokenIconComponentPreview < Lookbook::Preview
14
14
  render(Solrengine::Ui::TokenIconComponent.new(symbol: "BONK"))
15
15
  end
16
16
 
17
- # @label Sizes
18
- def sizes
19
- render_with_template(template: "solrengine/ui/token_icon_component_preview/sizes")
17
+ # @label Small
18
+ def small
19
+ render(Solrengine::Ui::TokenIconComponent.new(symbol: "SOL", size: :sm))
20
+ end
21
+
22
+ # @label Medium
23
+ def medium
24
+ render(Solrengine::Ui::TokenIconComponent.new(symbol: "SOL", size: :md))
25
+ end
26
+
27
+ # @label Large
28
+ def large
29
+ render(Solrengine::Ui::TokenIconComponent.new(symbol: "SOL", size: :lg))
20
30
  end
21
31
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ostruct"
4
+
3
5
  module Solrengine
4
6
  module Ui
5
7
  class WalletButtonComponentPreview < Lookbook::Preview
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solrengine-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Ferrer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-15 00:00:00.000000000 Z
11
+ date: 2026-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: view_component