WIP: generate address

This commit is contained in:
timlucmiptev 2020-11-17 11:34:04 +02:00 committed by ixv
parent 57a3d2cef9
commit c1ba330910

View File

@ -91,7 +91,10 @@
(handle-provider-update:hc !<(update:bp q.cage.sign)) (handle-provider-update:hc !<(update:bp q.cage.sign))
:: ::
%btc-wallet-store-request %btc-wallet-store-request
(handle-request:hc !<(request:bws q.cage.sign)) (handle-wallet-store-request:hc !<(request:bws q.cage.sign))
::
%btc-wallet-store-update
(handle-wallet-store-update:hc !<(update:bws q.cage.sign))
== ==
[cards this] [cards this]
== ==
@ -118,12 +121,14 @@
`state(def-wallet `(snag 0 xs)) `state(def-wallet `(snag 0 xs))
:: ::
%req-pay-address %req-pay-address
:: TODO: gen-address in wallet-store ?< =(src.bowl payee.act) :: can't pay yourself
:: handle response in on-agent-> wallet-store update :_ state
:: TODO: check whether default-wallet has a value ?. =(payee.act our.bowl) :: forward poke to payee
?~ def-wallet ~& >>> "no default wallet" `state ~[(poke-wallet-hook payee.act act)]
:- ~[(poke-wallet-store [%generate-address u.def-wallet %0])] ?~ def-wallet ~|("btc-wallet-hook: no def-wallet set" !!)
state :~ %+ poke-wallet-store /[(scot %p src.bowl)]
[%generate-address u.def-wallet %0]
==
:: ::
%pay-address %pay-address
`state `state
@ -159,14 +164,14 @@
=/ ureq (~(get by padr) req-id.p.update) =/ ureq (~(get by padr) req-id.p.update)
?~ ureq `state ?~ ureq `state
:_ state(padr (~(del by padr) req-id.p.update)) :_ state(padr (~(del by padr) req-id.p.update))
:~ %- poke-wallet-store :~ %+ poke-wallet-store /
:* %address-info xpub.u.ureq chyg.u.ureq idx.u.ureq :* %address-info xpub.u.ureq chyg.u.ureq idx.u.ureq
utxos.body.p.update used.body.p.update blockcount.body.p.update utxos.body.p.update used.body.p.update blockcount.body.p.update
== ==
== ==
== ==
:: ::
++ handle-request ++ handle-wallet-store-request
|= req=request:bws |= req=request:bws
^- (quip card _state) ^- (quip card _state)
?- -.req ?- -.req
@ -180,6 +185,19 @@
~ ~
== ==
:: ::
++ handle-wallet-store-update
|= upd=update:bws
^- (quip card _state)
?- -.upd
%generate-address
:: TODO: add to piym
:: TODO: send to requesting wallet-hook
`state
::
%scan-done
`state
==
::
++ retry ++ retry
|= p=pend-addr |= p=pend-addr
^- (list card) ^- (list card)
@ -201,10 +219,19 @@
?~ provider %.n ?~ provider %.n
connected.u.provider connected.u.provider
:: ::
++ poke-wallet-store ++ poke-wallet-hook
|= act=action:bws ^- card |= [target=ship act=action]
^- card
:* %pass /[(scot %da now.bowl)] %agent :* %pass /[(scot %da now.bowl)] %agent
[our.bowl %btc-wallet-store] %poke [target %btc-wallet-hook] %poke
%btc-wallet-hook-action !>(act)
==
::
++ poke-wallet-store
|= [prefix=wire act=action:bws]
^- card
:* %pass (weld prefix /[(scot %da now.bowl)])
%agent [our.bowl %btc-wallet-store] %poke
%btc-wallet-store-action !>(act) %btc-wallet-store-action !>(act)
== ==
:: ::