mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
WIP: still fixing type errors
This commit is contained in:
parent
c7f3042740
commit
1d0d26becc
@ -201,7 +201,7 @@
|
|||||||
=+ fee=~(fee txb u.poym)
|
=+ fee=~(fee txb u.poym)
|
||||||
~& >> "{<vb>} vbytes, {<(div fee vb)>} sats/byte, {<fee>} sats fee"
|
~& >> "{<vb>} vbytes, {<(div fee vb)>} sats/byte, {<fee>} sats fee"
|
||||||
%- (slog [%leaf "PSBT: {<u.pb>}"]~)
|
%- (slog [%leaf "PSBT: {<u.pb>}"]~)
|
||||||
~[(send-update [%sign-tx u.poym])]
|
~
|
||||||
::
|
::
|
||||||
%close-pym
|
%close-pym
|
||||||
?> =(src.bowl our.bowl)
|
?> =(src.bowl our.bowl)
|
||||||
@ -218,18 +218,15 @@
|
|||||||
::
|
::
|
||||||
%fail-broadcast-tx
|
%fail-broadcast-tx
|
||||||
?> =(src.bowl our.bowl)
|
?> =(src.bowl our.bowl)
|
||||||
~& > "%fail-broadcast-tx"
|
~& >>> "%fail-broadcast-tx"
|
||||||
:_ state(poym ~)
|
`state(poym ~)
|
||||||
~[(send-update [%broadcast-tx-spent-utxos txid.act])]
|
|
||||||
::
|
::
|
||||||
%succeed-broadcast-tx
|
%succeed-broadcast-tx
|
||||||
?> =(src.bowl our.bowl)
|
?> =(src.bowl our.bowl)
|
||||||
~& > "%succeed-broadcast-tx"
|
~& > "%succeed-broadcast-tx"
|
||||||
:_ %_ state
|
:_ state
|
||||||
reqs (~(put by reqs) txid.act [%tx-info 0 txid.act])
|
|
||||||
==
|
|
||||||
?~ prov ~
|
?~ prov ~
|
||||||
:- (poke-provider host.u.prov [%tx-info txid.act])
|
:- (poke-provider [%tx-info txid.act])
|
||||||
?~ poym ~
|
?~ poym ~
|
||||||
?~ payee.u.poym ~
|
?~ payee.u.poym ~
|
||||||
:_ ~
|
:_ ~
|
||||||
@ -250,13 +247,11 @@
|
|||||||
=^ cards state
|
=^ cards state
|
||||||
(reuse-address src.bowl value.act)
|
(reuse-address src.bowl value.act)
|
||||||
?^ cards [cards state]
|
?^ cards [cards state]
|
||||||
:: if no reuseable address, call store to generate
|
|
||||||
::
|
|
||||||
=+ f=(fam src.bowl)
|
=+ f=(fam src.bowl)
|
||||||
=+ n=(~(gut by num-fam.piym) f 0)
|
=+ n=(~(gut by num-fam.piym) f 0)
|
||||||
?~ curr-xpub ~|("btc-wallet-hook: no curr-xpub set" !!)
|
?~ curr-xpub ~|("btc-wallet-hook: no curr-xpub set" !!)
|
||||||
?: (gte n fam-limit)
|
?: (gte n fam-limit.params)
|
||||||
~|("More than {<fam-limit>} addresses for moons + planet" !!)
|
~|("More than {<fam-limit.params>} addresses for moons + planet" !!)
|
||||||
=. state state(num-fam.piym (~(put by num-fam.piym) f +(n)))
|
=. state state(num-fam.piym (~(put by num-fam.piym) f +(n)))
|
||||||
=^ addr state
|
=^ addr state
|
||||||
(generate-address u.curr-xpub %0 `[src.bowl value.act])
|
(generate-address u.curr-xpub %0 `[src.bowl value.act])
|
||||||
@ -289,7 +284,7 @@
|
|||||||
?> (piym-matches u.pay)
|
?> (piym-matches u.pay)
|
||||||
:_ (update-pend-piym txid.act u.pay(pend `txid.act))
|
:_ (update-pend-piym txid.act u.pay(pend `txid.act))
|
||||||
?~ prov ~
|
?~ prov ~
|
||||||
~[(poke-provider host.u.prov [%tx-info txid.act])]
|
~[(poke-provider [%tx-info txid.act])]
|
||||||
::
|
::
|
||||||
++ piym-matches
|
++ piym-matches
|
||||||
|= p=payment
|
|= p=payment
|
||||||
@ -332,7 +327,7 @@
|
|||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
:_ %_ state
|
:_ %_ state
|
||||||
prov `[host.p %.y]
|
prov `[host.p %.y]
|
||||||
btc-state [block fee now.bowl]
|
btc-state [block fee now.bowl]
|
||||||
==
|
==
|
||||||
?: ?|(?!(connected.p) (lth block.btc-state block))
|
?: ?|(?!(connected.p) (lth block.btc-state block))
|
||||||
;:(weld retry-pend-piym retry-addrs retry-txs)
|
;:(weld retry-pend-piym retry-addrs retry-txs)
|
||||||
@ -422,8 +417,7 @@
|
|||||||
++ handle-address-info
|
++ handle-address-info
|
||||||
|= [=address utxos=(set utxo) used=?]
|
|= [=address utxos=(set utxo) used=?]
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
|^
|
=/ am (address-meta address ~(val by walts))
|
||||||
=/ am address-meta
|
|
||||||
?~ am `state
|
?~ am `state
|
||||||
=/ [w=walt =chyg =idx] u.am
|
=/ [w=walt =chyg =idx] u.am
|
||||||
=. walts
|
=. walts
|
||||||
@ -434,25 +428,14 @@
|
|||||||
:: if the wallet+chyg is being scanned, update the scan batch
|
:: if the wallet+chyg is being scanned, update the scan batch
|
||||||
:: if not, just get more-info for the address if still being scanned
|
:: if not, just get more-info for the address if still being scanned
|
||||||
::
|
::
|
||||||
=/ b (~(get by scans) [xpub chyg])
|
=/ b (~(get by scans) [xpub.w chyg])
|
||||||
?~ b `state
|
?~ b `state
|
||||||
=. scans
|
=. scans
|
||||||
(del-scanned u.b(has-used ?|(used has-used.u.b)) xpub.w chyg idx)
|
(del-scanned u.b(has-used ?|(used has-used.u.b)) xpub.w chyg idx)
|
||||||
?: empty:(scan-status xpub.w chyg)
|
?: empty:(scan-status xpub.w chyg)
|
||||||
(run-scan xpub.w)
|
(check-scan xpub.w)
|
||||||
`state
|
`state
|
||||||
::
|
::
|
||||||
++ address-meta
|
|
||||||
^- (unit [walt chyg idx])
|
|
||||||
=/ ws=(list walt) ~(val by walts)
|
|
||||||
|-
|
|
||||||
?~ ws ~
|
|
||||||
=/ res=(unit [chyg idx])
|
|
||||||
(address-loc i.ws address)
|
|
||||||
?^ res [i.ws chyg.u.res idx.u.res]
|
|
||||||
$(ws t.ws)
|
|
||||||
--
|
|
||||||
::
|
|
||||||
++ req-scan
|
++ req-scan
|
||||||
|= [b=batch =xpub =chyg]
|
|= [b=batch =xpub =chyg]
|
||||||
^- (list card)
|
^- (list card)
|
||||||
@ -545,13 +528,13 @@ $(ws t.ws)
|
|||||||
^- [(unit txbu) _state]
|
^- [(unit txbu) _state]
|
||||||
=/ uw (~(get by walts) xpub)
|
=/ uw (~(get by walts) xpub)
|
||||||
?~ uw
|
?~ uw
|
||||||
~|("btc-wallet-store: non-existent xpub" !!)
|
~|("btc-wallet: non-existent xpub" !!)
|
||||||
?. scanned.u.uw
|
?. scanned.u.uw
|
||||||
~|("btc-wallet-store: wallet not scanned yet" !!)
|
~|("btc-wallet: wallet not scanned yet" !!)
|
||||||
=/ [tb=(unit txbu) chng=(unit sats)]
|
=/ [tb=(unit txbu) chng=(unit sats)]
|
||||||
%~ with-change sut
|
%~ with-change sut
|
||||||
[u.uw eny.bowl block.btc-state payee feyb txos]
|
[u.uw eny.bowl block.btc-state payee feyb txos]
|
||||||
?~ tb ~&(>>> "btc-wallet-store: insufficient balance" `state)
|
?~ tb ~&(>>> "btc-wallet: insufficient balance" `state)
|
||||||
:: if no change, return txbu; else add change to txbu
|
:: if no change, return txbu; else add change to txbu
|
||||||
::
|
::
|
||||||
?~ chng [tb state]
|
?~ chng [tb state]
|
||||||
@ -565,9 +548,9 @@ $(ws t.ws)
|
|||||||
^- [address _state]
|
^- [address _state]
|
||||||
=/ uw=(unit walt) (~(get by walts) xpub)
|
=/ uw=(unit walt) (~(get by walts) xpub)
|
||||||
?~ uw
|
?~ uw
|
||||||
~|("btc-wallet-store: non-existent xpub" !!)
|
~|("btc-wallet: non-existent xpub" !!)
|
||||||
?. scanned.u.uw
|
?. scanned.u.uw
|
||||||
~|("btc-wallet-store: wallet not scanned yet" !!)
|
~|("btc-wallet: wallet not scanned yet" !!)
|
||||||
=/ [addr=address:btc =idx w=walt]
|
=/ [addr=address:btc =idx w=walt]
|
||||||
~(gen-address wad u.uw chyg)
|
~(gen-address wad u.uw chyg)
|
||||||
[addr state(walts (~(put by walts) xpub w))]
|
[addr state(walts (~(put by walts) xpub w))]
|
||||||
@ -602,7 +585,7 @@ $(ws t.ws)
|
|||||||
:: - checks whether the txid matches that signed tx
|
:: - checks whether the txid matches that signed tx
|
||||||
:: - if not, skip
|
:: - if not, skip
|
||||||
:: - clears poym
|
:: - clears poym
|
||||||
:: - returns card that adds hest to wallet-store history
|
:: - returns card that adds hest to history
|
||||||
::
|
::
|
||||||
++ poym-to-history
|
++ poym-to-history
|
||||||
|= ti=info:tx
|
|= ti=info:tx
|
||||||
@ -634,7 +617,7 @@ $(ws t.ws)
|
|||||||
:: - checks whether ti has a matching value output to piym
|
:: - checks whether ti has a matching value output to piym
|
||||||
:: - if no match found, just deletes pend-piym with this tx
|
:: - if no match found, just deletes pend-piym with this tx
|
||||||
:: stops peer from spamming txids
|
:: stops peer from spamming txids
|
||||||
:: - returns card that adds hest to wallet-store history
|
:: - returns card that adds hest to history
|
||||||
::
|
::
|
||||||
++ piym-to-history
|
++ piym-to-history
|
||||||
|= ti=info:tx
|
|= ti=info:tx
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
::
|
::
|
||||||
::
|
::
|
||||||
/- *btc-wallet-store
|
/- *btc-wallet
|
||||||
/+ bip32, btc, bp=btc-provider
|
/+ bip32, btc, bp=btc-provider
|
||||||
=, secp:crypto
|
=, secp:crypto
|
||||||
=+ ecc=secp256k1
|
=+ ecc=secp256k1
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
+$ command
|
+$ command
|
||||||
$% [%set-provider provider=ship =network]
|
$% [%set-provider provider=ship =network]
|
||||||
[%set-current-wallet =xpub]
|
[%set-current-wallet =xpub]
|
||||||
[%add-wallet =xpub]
|
[%add-wallet =xpub =fprint scan-to=(unit scon) max-gap=(unit @ud) confs=(unit @ud)]
|
||||||
[%delete-wallet =xpub]
|
[%delete-wallet =xpub]
|
||||||
[%req-pay-address payee=ship value=sats feyb=sats]
|
[%req-pay-address payee=ship value=sats feyb=sats]
|
||||||
[%broadcast-tx txhex=cord]
|
[%broadcast-tx txhex=cord]
|
||||||
@ -21,7 +21,7 @@
|
|||||||
+$ action
|
+$ action
|
||||||
:: local-only actions
|
:: local-only actions
|
||||||
::
|
::
|
||||||
$: [%close-pym ti=info:tx]
|
$% [%close-pym ti=info:tx]
|
||||||
[%add-poym-raw-txi =txid rawtx=hexb]
|
[%add-poym-raw-txi =txid rawtx=hexb]
|
||||||
[%fail-broadcast-tx =txid]
|
[%fail-broadcast-tx =txid]
|
||||||
[%succeed-broadcast-tx =txid]
|
[%succeed-broadcast-tx =txid]
|
||||||
|
Loading…
Reference in New Issue
Block a user