solrengine-ui 0.3.1 → 0.4.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f581b398d242514e6c5d1d6ff9fe3b3fc55e90c2d26e403010418ec14896b13
|
|
4
|
+
data.tar.gz: 49039f57c9bb07e2a671e7657ead45116e8444ac86a8edd2d9ca2f5cf32b751f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29a2a90fcd48d82aab8694d09ecf1b09a4e77a4bf9b776a5278a19390526a99a3c89ed9603bd1717c1f99b17cb76139985666fb0efcec0c53564f1e1eb09bb7b
|
|
7
|
+
data.tar.gz: 4104e55638cdfab3659969782b8d29e85f177195494fd5ef666daf08c40d65aecf312c56a71defd180132fbd704cf6a358e76d9a15f278a6a3db9986e2755ce8
|
|
@@ -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
|
|
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"
|
|
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"
|
|
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
|
-
<
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
@
|
|
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
|