diff --git a/app/btc-provider.hoon b/app/btc-provider.hoon index 93d9fb431..60f7bdb55 100644 --- a/app/btc-provider.hoon +++ b/app/btc-provider.hoon @@ -164,7 +164,7 @@ [%raw-tx @ *] ?> ?=([%get-raw-tx *] resp) :_ state - ~[(send-update [%.y (get-req-id wire) %raw-tx rawtx.resp])] + ~[(send-update [%.y (get-req-id wire) %raw-tx +.resp])] :: [%ping @ *] ?> ?=([%get-block-and-fee *] resp) diff --git a/app/btc-wallet-hook.hoon b/app/btc-wallet-hook.hoon index 86901e5d7..05fa9348e 100644 --- a/app/btc-wallet-hook.hoon +++ b/app/btc-wallet-hook.hoon @@ -33,7 +33,6 @@ def-wallet=(unit xpub) moon-limit=@ud =pend-addr - =pend-txbu =piym =poym =piym-watch @@ -191,6 +190,7 @@ == :: %raw-tx + :: TODO: check whether in poym ~& >> rawtx.body.p.upd `state == @@ -225,10 +225,11 @@ :: txbus can potentially use the same UTXO inputs, so if another payment :: was in process of fetching raw-txs for a txbu, replace it :: - =/ ri=req-id:bp (gen-req-id:bp eny.bowl) - :_ state(poym [ri payee.upd txbu.upd]) + =/ txids=(list txid) + %+ turn txis.txbu.upd + |= =txi:bws txid.utxo.txi + :_ state(poym [payee.upd txbu.upd]) :: TODO: send all its input tx-ids out for feedback - ~ :: %scan-done ?~ def-wallet @@ -269,11 +270,20 @@ (get-address-info ri host.u.provider a.req) :: ++ get-address-info - |= [ri=req-id:bp host=ship a=address] ^- card + |= [ri=req-id:bp host=ship a=address] + ^- card :* %pass /[(scot %da now.bowl)] %agent [host %btc-provider] %poke %btc-provider-action !>([ri %address-info a]) == :: +++ get-raw-tx + |= [host=ship =txid] + ^- card + =/ ri=req-id:bp (gen-req-id:bp eny.bowl) + :* %pass /[(scot %da now.bowl)] %agent [host %btc-provider] + %poke %btc-provider-action !>(ri %raw-tx txid) + == +:: ++ provider-connected ^- ? ?~ provider %.n diff --git a/lib/btc-provider.hoon b/lib/btc-provider.hoon index 69c64aea6..1a7faed69 100644 --- a/lib/btc-provider.hoon +++ b/lib/btc-provider.hoon @@ -95,7 +95,10 @@ [%value ni:dejs:format] == ++ raw-tx - (cu:dejs:format to-btc-byts so:dejs:format) + %- ot:dejs:format + :~ [%txid (cu:dejs:format to-hash256 so:dejs:format)] + [%rawtx (cu:dejs:format to-btc-byts so:dejs:format)] + == ++ block-and-fee %- ot:dejs:format :~ [%blockcount ni:dejs:format] diff --git a/sur/btc-provider.hoon b/sur/btc-provider.hoon index 5b6675f43..2b963f2bb 100644 --- a/sur/btc-provider.hoon +++ b/sur/btc-provider.hoon @@ -15,7 +15,7 @@ +$ result [=req-id body=result-body] +$ result-body $% [%address-info utxos=(set utxo) used=? blockcount=@ud] - [%raw-tx =rawtx] + [%raw-tx =txid =rawtx] == +$ error $% [%not-connected status=@ud] @@ -41,7 +41,7 @@ :: +$ response $% [%get-address-info utxos=(set utxo) used=? blockcount=@ud] - [%get-raw-tx =rawtx] + [%get-raw-tx =txid =rawtx] [%get-block-count blockcount=@ud] [%get-block-and-fee blockcount=@ud fee=sats] == diff --git a/sur/btc-wallet-hook.hoon b/sur/btc-wallet-hook.hoon index da8bd1a00..10f51c5a4 100644 --- a/sur/btc-wallet-hook.hoon +++ b/sur/btc-wallet-hook.hoon @@ -2,7 +2,6 @@ |% :: req-id: hash of [xpub chyg idx] :: pend: lookup of req-id -> requests from wallet-store -:: pend-txbu: lookup req-id -> txbu (to fetch and assoc rawtx info with txid) :: :: payment: a payment expected from another ship :: - address: address generated for this payment @@ -14,12 +13,11 @@ :: +$ btc-state [blockcount=@ud fee=sats t=@da] +$ pend-addr (map req-id:bp request:bws) -+$ pend-txbu (map req-id:bp ship) :: +$ payment [=address payer=ship value=sats] :: +$ piym (jar ship payment) -+$ poym [=req-id:bp payee=(unit ship) =txbu:bws] ++$ poym [payee=(unit ship) =txbu] +$ piym-watch (map address ship) +$ poym-watch (map address ship) ::