From 17ea0917413df1f00450b797af54fc04c1badcd3 Mon Sep 17 00:00:00 2001 From: timlucmiptev Date: Mon, 21 Dec 2020 11:50:33 +0200 Subject: [PATCH] fix txinfo return --- PROVIDER.md | 7 +++++++ app/btc-wallet-hook.hoon | 1 + lib/btc-provider.hoon | 7 ++++--- sur/btc-provider.hoon | 2 +- sur/btc-wallet-hook.hoon | 23 ++++++++++++++++++----- sur/btc.hoon | 5 ++++- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/PROVIDER.md b/PROVIDER.md index 6a8c00c49..789d31dcf 100644 --- a/PROVIDER.md +++ b/PROVIDER.md @@ -21,6 +21,13 @@ :: 4 inputs, one output ``` +## TX Info for Non-Existent TX +``` + +:btc-provider|action ['reqid' %tx-info [%32 0x63a.bc87.c9e6.9f8f.4a76.d838.abc0.fd77.082f.9716.09a0.0b18.b45b.d3ab.793c.82df]] +:: should be %.n for included +``` + ## Generate a Raw TX from Inputs/Outputs ``` :btc-provider|command [%set-credentials api-url='http://localhost:50002'] diff --git a/app/btc-wallet-hook.hoon b/app/btc-wallet-hook.hoon index 7cd7c79fb..82720944d 100644 --- a/app/btc-wallet-hook.hoon +++ b/app/btc-wallet-hook.hoon @@ -288,6 +288,7 @@ == :: :: %txinfo + :: - TODO: handle case where tx is blank :: - insert into wallet-store history if pend-piym or poym matches txid :: - forward tx to wallet-store regardless :: diff --git a/lib/btc-provider.hoon b/lib/btc-provider.hoon index b8d34d852..7035c1b18 100644 --- a/lib/btc-provider.hoon +++ b/lib/btc-provider.hoon @@ -102,7 +102,7 @@ :: %get-raw-tx [id.res (raw-tx res.res)] - :: + :: %broadcast-tx [%broadcast-tx (broadcast-tx res.res)] :: @@ -126,9 +126,10 @@ [%value ni:dejs:format] [%recvd (cu:dejs:format from-epoch ni:dejs:format)] == - ++ tx-vals + ++ tx-vals %- ot:dejs:format - :~ [%txid (cu:dejs:format to-hash256 so:dejs:format)] + :~ [%included bo:dejs:format] + [%txid (cu:dejs:format to-hash256 so:dejs:format)] [%confs ni:dejs:format] [%recvd (cu:dejs:format from-epoch ni:dejs:format)] [%inputs (ar:dejs:format tx-val)] diff --git a/sur/btc-provider.hoon b/sur/btc-provider.hoon index 0ca314de1..5cc129618 100644 --- a/sur/btc-provider.hoon +++ b/sur/btc-provider.hoon @@ -32,7 +32,7 @@ $% [%connected block=@ud fee=@ud] [%disconnected ~] == -:: +:: ++ rpc-types |% +$ action diff --git a/sur/btc-wallet-hook.hoon b/sur/btc-wallet-hook.hoon index bb65cf9f1..de0f9eecd 100644 --- a/sur/btc-wallet-hook.hoon +++ b/sur/btc-wallet-hook.hoon @@ -29,16 +29,29 @@ :: - vout-n is the index of the output that has value :: +$ action + $% settings + local + peer + == ++$ settings $% [%set-provider provider=ship] [%set-default-wallet ~] - [%req-pay-address payee=ship value=sats feyb=(unit sats)] - [%gen-pay-address value=sats] - [%ret-pay-address =address payer=ship value=sats] - [%broadcast-tx signed=rawtx] - [%expect-payment =txid value=sats] [%clear-poym ~] [%force-retry ~] == ++$ local + $% [%req-pay-address payee=ship value=sats feyb=(unit sats)] + [%broadcast-tx signed=rawtx] + [%poym-add-txi] + [%poym-to-history] + == ++$ peer + $% [%gen-pay-address value=sats] + [%ret-pay-address =address payer=ship value=sats] + [%expect-payment =txid value=sats] + == +:: +:: +$ update $% request error diff --git a/sur/btc.hoon b/sur/btc.hoon index 3d73226e7..0127a6342 100644 --- a/sur/btc.hoon +++ b/sur/btc.hoon @@ -42,8 +42,11 @@ =address value=sats == + :: included: whether tx is in the mempool or blockchain + :: +$ info - $: =txid + $: included=? + =txid confs=@ud recvd=(unit @da) inputs=(list val)