Simple demo displaying address of a fixed spending key

This commit is contained in:
Jack Grigg
2019-06-11 00:39:28 +01:00
parent a56c4c2630
commit 4caf14baa2
7 changed files with 214 additions and 10 deletions

View File

@@ -1,5 +1,32 @@
import * as wasm from 'zcash-client-backend-wasm'
import { Client } from 'zcash-client-backend-wasm'
export function greet () {
wasm.greet()
const COIN = 100000000
export class ZcashClient {
constructor (uiHandlers) {
this.client = Client.new()
this.uiHandlers = uiHandlers
}
updateUI () {
this.uiHandlers.updateBalance(this.client.balance() / COIN)
}
load (onFinished) {
var self = this
var loader = () => {
// Register event handlers
// Initial UI updates
self.uiHandlers.setAddress(self.client.address())
self.updateUI()
// Finished loading!
onFinished()
}
// document.addEventListener('DOMContentLoaded', loader, false)
loader()
}
}