mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-07-30 20:01:26 +00:00
ZcashClient.sendToAddress()
This commit is contained in:
@@ -14,6 +14,19 @@
|
||||
<h2 id="zcash-client-address"></h2>
|
||||
<p>That's your Zcash address!</p>
|
||||
<h2 id="zcash-client-balance"></h2>
|
||||
<table id="zcash-client-yes-balance">
|
||||
<tr>
|
||||
<td><label for="zcash-client-send-to-address">To:</label></td>
|
||||
<td><input id="zcash-client-send-to-address" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="zcash-client-send-value">Amount:</label></td>
|
||||
<td><input id="zcash-client-send-value" type="number" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button id="zcash-client-send-action">Send!</button></td>
|
||||
</tr>
|
||||
</div>
|
||||
<p id="zcash-client-no-balance">You have no TAZ. Go <a href="https://faucet.testnet.z.cash/" target="blank">here</a> to get some!</p>
|
||||
<p id="zcash-client-sync-status">Syncing...</p>
|
||||
</div>
|
||||
|
@@ -2,7 +2,11 @@ import { ZcashClient } from 'zcash-client-sdk'
|
||||
|
||||
const address = document.getElementById('zcash-client-address')
|
||||
const balance = document.getElementById('zcash-client-balance')
|
||||
const yesBalance = document.getElementById('zcash-client-yes-balance')
|
||||
const noBalance = document.getElementById('zcash-client-no-balance')
|
||||
const sendToAddress = document.getElementById('zcash-client-send-to-address')
|
||||
const sendValue = document.getElementById('zcash-client-send-value')
|
||||
const sendAction = document.getElementById('zcash-client-send-action')
|
||||
const syncStatus = document.getElementById('zcash-client-sync-status')
|
||||
|
||||
var zcashClient = new ZcashClient('http://localhost:8081', {
|
||||
@@ -12,8 +16,10 @@ var zcashClient = new ZcashClient('http://localhost:8081', {
|
||||
updateBalance: (newBalance) => {
|
||||
balance.textContent = `Balance: ${newBalance} TAZ`
|
||||
if (newBalance > 0) {
|
||||
yesBalance.style.display = ''
|
||||
noBalance.style.display = 'none'
|
||||
} else {
|
||||
yesBalance.style.display = 'none'
|
||||
noBalance.style.display = ''
|
||||
}
|
||||
},
|
||||
@@ -31,6 +37,20 @@ var zcashClient = new ZcashClient('http://localhost:8081', {
|
||||
})
|
||||
|
||||
zcashClient.load(() => {
|
||||
// Register event handlers
|
||||
sendAction.onclick = () => {
|
||||
sendAction.disabled = true
|
||||
sendAction.textContent = 'Sending...'
|
||||
|
||||
var to = sendToAddress.value
|
||||
var value = sendValue.value
|
||||
|
||||
zcashClient.sendToAddress(to, value, () => {
|
||||
sendAction.disabled = false
|
||||
sendAction.textContent = 'Send!'
|
||||
})
|
||||
}
|
||||
|
||||
// Loading complete, show the wallet
|
||||
document.getElementById('zcash-client-loading').remove()
|
||||
document.getElementById('zcash-client-content').style.display = ''
|
||||
|
Reference in New Issue
Block a user