skeleton view

This commit is contained in:
timlucmiptev 2020-11-22 16:49:55 +02:00 committed by ixv
parent 17a5ef4566
commit 8d90e96251
5 changed files with 107 additions and 2 deletions

View File

@ -76,8 +76,13 @@
==
[cards this]
::
:: TODO: handle /sign-me path
++ on-watch on-watch:def
++ on-watch
|= pax=path
^- (quip card _this)
?+ pax (on-watch:def pax)
[%sign-me ~]
`this
==
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent

65
app/btc-wallet-view.hoon Normal file
View File

@ -0,0 +1,65 @@
:: btc-wallet-view.hoon
:: receive signing requests from btc-wallet-hook
::
/- *btc-wallet-view
/+ dbug, default-agent
|%
+$ versioned-state
$% state-0
==
::
+$ state-0 [%0 counter=@]
::
+$ card card:agent:gall
::
--
%- agent:dbug
=| state-0
=* state -
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card _this)
~& > '%btc-wallet-view initialized successfully'
=/ filea [%file-server-action !>([%serve-dir /'~btc-wallet' /app/btc-wallet %.n %.y])]
:_ this
:~ [%pass /srv %agent [our.bowl %file-server] %poke filea]
[%pass /u/[(scot %da now.bowl)] %agent [our.bowl %btc-wallet-hook] %watch /sign-me]
==
++ on-save
^- vase
!>(state)
++ on-load
|= old-state=vase
^- (quip card _this)
~& > '%btc-wallet-view recompiled successfully'
`this(state !<(versioned-state old-state))
++ on-poke
|= [=mark =vase]
|^ ^- (quip card _this)
?+ mark (on-poke:def mark vase)
%btc-wallet-view-action
(handle-action !<(action vase))
==
++ handle-action
|= =action
~& >>> action
`this
--
::
++ on-watch
|= =path
^- (quip card _this)
?+ path (on-watch:def path)
[%primary ~]
`this
==
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent on-agent:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--

View File

@ -5,6 +5,16 @@
=, secp:crypto
=+ ecc=secp256k1
|%
++ enjs
=, enjs:format
|%
::
++ txbu
|= =^txbu
^- json
[%s 'txbu placeholder']
--
::
++ defaults
|%
++ max-gap 20

20
lib/btc-wallet-view.hoon Normal file
View File

@ -0,0 +1,20 @@
/- sur=btc-wallet-view
^?
=< [sur .]
=, sur
|%
++ dejs
=, dejs:format
|%
++ action
|= jon=json
^- ^action
=< (parse-json jon)
|%
++ parse-json
%- of
:~ [%blank so]
==
--
--
--

5
sur/btc-wallet-view.hoon Normal file
View File

@ -0,0 +1,5 @@
|%
+$ action
$% [%blank ~]
==
--