mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-24 02:24:18 +03:00
Merge pull request #6217 from urbit/i/6216/remove-unused-components
Remove unused components
This commit is contained in:
commit
9862ad256c
14
.github/workflows/pre-release.yml
vendored
14
.github/workflows/pre-release.yml
vendored
@ -1,14 +0,0 @@
|
||||
name: pre-release
|
||||
|
||||
on:
|
||||
release: null
|
||||
push:
|
||||
tags: 'urbit-v[0-9]+.[0-9]+-rc[0-9]+'
|
||||
|
||||
jobs:
|
||||
call-vere:
|
||||
uses: ./.github/workflows/vere.yml
|
||||
with:
|
||||
pace: 'soon'
|
||||
upload: true
|
||||
secrets: inherit
|
51
.github/workflows/release-docker.yml
vendored
51
.github/workflows/release-docker.yml
vendored
@ -1,51 +0,0 @@
|
||||
name: release-docker
|
||||
|
||||
on:
|
||||
release: null
|
||||
push:
|
||||
tags: 'urbit-v[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { os: ubuntu-latest, system: x86_64-linux }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v16
|
||||
with:
|
||||
extra_nix_config: |
|
||||
system-features = nixos-test benchmark big-parallel kvm
|
||||
- uses: cachix/cachix-action@v10
|
||||
with:
|
||||
name: ares
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
- uses: docker/docker-login-action@v1.8.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- uses: christian-korneck/update-container-description-action@v1
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
with:
|
||||
destination_container_repo: ${{ secrets.DOCKERHUB_USERNAME }}/urbit
|
||||
provider: dockerhub
|
||||
short_description: 'Urbit: a clean-slate OS and network for the 21st century'
|
||||
readme_file: 'pkg/docker-image/README.md'
|
||||
|
||||
- run: |
|
||||
version="$(cat ./pkg/urbit/version)"
|
||||
image="$(nix-build -A docker-image)"
|
||||
imageName="$(nix-instantiate --eval -A docker-image.imageName | cut -d'"' -f2)"
|
||||
imageTag="$(nix-instantiate --eval -A docker-image.imageTag | cut -d'"' -f2)"
|
||||
# Load the image from the nix-built tarball
|
||||
docker load -i $image
|
||||
docker tag "$imageName:$imageTag" ${{secrets.DOCKERHUB_USERNAME }}/urbit:v$version
|
||||
docker tag "$imageName:$imageTag" ${{secrets.DOCKERHUB_USERNAME }}/urbit:latest
|
||||
docker push ${{secrets.DOCKERHUB_USERNAME }}/urbit:v$version
|
||||
docker push ${{secrets.DOCKERHUB_USERNAME }}/urbit:latest
|
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
@ -1,14 +0,0 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
release: null
|
||||
push:
|
||||
tags: 'urbit-v[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
call-vere:
|
||||
uses: ./.github/workflows/vere.yml
|
||||
with:
|
||||
pace: 'live'
|
||||
upload: true
|
||||
secrets: inherit
|
44
.github/workflows/tarballs.yml
vendored
44
.github/workflows/tarballs.yml
vendored
@ -1,44 +0,0 @@
|
||||
name: tarballs
|
||||
|
||||
on:
|
||||
release: null
|
||||
push:
|
||||
tags: ['*']
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { os: ubuntu-latest, system: x86_64-linux }
|
||||
- { os: macos-latest, system: x86_64-darwin }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/cachix-action@v10
|
||||
with:
|
||||
name: ${{ secrets.CACHIX_NAME }}
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- uses: google-github-actions/setup-gcloud@v0.2.0
|
||||
with:
|
||||
version: '290.0.1'
|
||||
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
|
||||
project_id: ${{ secrets.GCS_PROJECT }}
|
||||
export_default_credentials: true
|
||||
|
||||
- run: nix-build -A tarball --arg enableStatic true
|
||||
|
||||
- name: Run upload to bootstrap.urbit.org
|
||||
run: |
|
||||
version="$(cat ./pkg/urbit/version)"
|
||||
system="$(nix-instantiate --eval --expr 'builtins.currentSystem')"
|
||||
system=${system:1:${#system}-2}
|
||||
target="gs://bootstrap.urbit.org/ci/urbit-v${version}-${system}-${GITHUB_SHA:0:9}.tgz"
|
||||
|
||||
gsutil cp -n ./result "$target"
|
||||
|
||||
echo "upload to $target complete."
|
@ -1,430 +0,0 @@
|
||||
:: btc-provider.hoon
|
||||
:: Proxy that serves a BTC full node and ElectRS address indexer
|
||||
::
|
||||
:: Subscriptions: none
|
||||
:: To Subscribers: /clients
|
||||
:: current connection state
|
||||
:: results/errors of RPC calls
|
||||
::
|
||||
:: Scrys
|
||||
:: x/is-whitelisted/SHIP: bool, whether ship is whitelisted
|
||||
::
|
||||
/- *bitcoin, json-rpc, *btc-provider
|
||||
/+ dbug, default-agent, bl=btc, groupl=group, resource
|
||||
~% %btc-provider-top ..part ~
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
state-1
|
||||
state-2
|
||||
==
|
||||
::
|
||||
+$ state-0 [%0 =host-info =whitelist]
|
||||
+$ state-1 [%1 =host-info =whitelist timer=(unit @da)]
|
||||
+$ state-2 [%2 =host-info =whitelist timer=(unit @da) interval=@dr]
|
||||
--
|
||||
%- agent:dbug
|
||||
=| state-2
|
||||
=* state -
|
||||
^- agent:gall
|
||||
=<
|
||||
~% %btc-provider-agent ..send-status ~
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
hc ~(. +> bowl)
|
||||
::
|
||||
++ on-init
|
||||
^- (quip card _this)
|
||||
=| wl=^whitelist
|
||||
:- ~
|
||||
%_ this
|
||||
host-info ['' connected=%.n %main block=0 clients=*(set ship)]
|
||||
whitelist wl(public %.n, kids %.n)
|
||||
timer ~
|
||||
interval ~m1
|
||||
==
|
||||
::
|
||||
++ on-save
|
||||
^- vase
|
||||
!>(state)
|
||||
::
|
||||
++ on-load
|
||||
|= old-state=vase
|
||||
^- (quip card _this)
|
||||
=/ old !<(versioned-state old-state)
|
||||
?- -.old
|
||||
%2
|
||||
[~ this(state old)]
|
||||
::
|
||||
%1
|
||||
`this(state [%2 host-info.old whitelist.old timer.old ~m1])
|
||||
::
|
||||
%0
|
||||
:_ this(state [%2 host-info.old whitelist.old ~ ~m1])
|
||||
?: =('' api-url.host-info.old) ~
|
||||
~[(start-ping-timer:hc ~s0)]
|
||||
==
|
||||
::
|
||||
++ on-poke
|
||||
~/ %on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
|^
|
||||
?> ?|((team:title our.bowl src.bowl) (is-client:hc src.bowl))
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%btc-provider-command
|
||||
?> (team:title our.bowl src.bowl)
|
||||
(handle-command !<(command vase))
|
||||
::
|
||||
%btc-provider-action
|
||||
(handle-action !<(action vase))
|
||||
::
|
||||
%noun
|
||||
?. =(q.vase %kick-timer) `state
|
||||
:_ state(timer `now.bowl)
|
||||
:* (start-ping-timer ~s0)
|
||||
?~ timer ~
|
||||
[[%pass /block-time %arvo %b %rest u.timer] ~]
|
||||
==
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ handle-command
|
||||
|= comm=command
|
||||
^- (quip card _state)
|
||||
?- -.comm
|
||||
%set-credentials
|
||||
:_ %_ state
|
||||
host-info [api-url.comm %.n network.comm 0 *(set ship)]
|
||||
timer `now.bowl
|
||||
==
|
||||
:* (start-ping-timer:hc ~s0)
|
||||
?~ timer ~
|
||||
[[%pass /block-time %arvo %b %rest u.timer] ~]
|
||||
==
|
||||
::
|
||||
%add-whitelist
|
||||
:- ~
|
||||
?- -.wt.comm
|
||||
%public
|
||||
state(public.whitelist %.y)
|
||||
::
|
||||
%kids
|
||||
state(kids.whitelist %.y)
|
||||
::
|
||||
%users
|
||||
state(users.whitelist (~(uni in users.whitelist) users.wt.comm))
|
||||
::
|
||||
%groups
|
||||
state(groups.whitelist (~(uni in groups.whitelist) groups.wt.comm))
|
||||
==
|
||||
::
|
||||
%remove-whitelist
|
||||
=. state
|
||||
?- -.wt.comm
|
||||
%public
|
||||
state(public.whitelist %.n)
|
||||
::
|
||||
%kids
|
||||
state(kids.whitelist %.n)
|
||||
::
|
||||
%users
|
||||
state(users.whitelist (~(dif in users.whitelist) users.wt.comm))
|
||||
::
|
||||
%groups
|
||||
state(groups.whitelist (~(dif in groups.whitelist) groups.wt.comm))
|
||||
==
|
||||
clean-client-list
|
||||
::
|
||||
%set-interval
|
||||
`state(interval inte.comm)
|
||||
==
|
||||
::
|
||||
:: +clean-client-list: remove clients who are no longer whitelisted
|
||||
:: called after a whitelist change
|
||||
::
|
||||
++ clean-client-list
|
||||
^- (quip card _state)
|
||||
=/ to-kick=(set ship)
|
||||
%- silt
|
||||
%+ murn ~(tap in clients.host-info)
|
||||
|= c=ship ^- (unit ship)
|
||||
?:((is-whitelisted:hc c) ~ `c)
|
||||
:_ state(clients.host-info (~(dif in clients.host-info) to-kick))
|
||||
%+ turn ~(tap in to-kick)
|
||||
|=(c=ship [%give %kick ~[/clients] `c])
|
||||
::
|
||||
:: if not connected, only %ping action is allowed
|
||||
::
|
||||
++ handle-action
|
||||
|= act=action
|
||||
^- (quip card _state)
|
||||
:_ state
|
||||
?. ?|(connected.host-info ?=(%ping -.act))
|
||||
~[(send-update:hc [%| %not-connected 500] ~)]
|
||||
:_ ~
|
||||
%+ req-card act
|
||||
^- action:rpc-types
|
||||
?- -.act
|
||||
%address-info [%get-address-info address.act]
|
||||
%tx-info [%get-tx-vals txid.act]
|
||||
%raw-tx [%get-raw-tx txid.act]
|
||||
%broadcast-tx [%broadcast-tx rawtx.act]
|
||||
%ping [%get-block-info ~]
|
||||
%block-info [%get-block-info block.act]
|
||||
%histogram [%get-histogram ~]
|
||||
%block-headers [%get-block-headers start.act count.act cp.act]
|
||||
%tx-from-pos [%get-tx-from-pos height.act pos.act merkle.act]
|
||||
%fee [%get-fee block.act]
|
||||
%psbt [%update-psbt psbt.act]
|
||||
==
|
||||
::
|
||||
++ req-card
|
||||
|= [act=action ract=action:rpc-types]
|
||||
=/ req=request:http
|
||||
(gen-request:bl host-info ract)
|
||||
[%pass (rpc-wire act) %arvo %i %request req *outbound-config:iris]
|
||||
::
|
||||
++ rpc-wire
|
||||
|= act=action
|
||||
^- wire
|
||||
/[-.act]/(scot %p src.bowl)/(scot %ux (cut 3 [0 20] eny.bowl))
|
||||
--
|
||||
::
|
||||
++ on-watch
|
||||
~/ %on-watch
|
||||
|= pax=path
|
||||
^- (quip card _this)
|
||||
:: checking provider permissions before trying to subscribe
|
||||
:: terrible hack until we have cross-ship scries
|
||||
::
|
||||
?: ?=([%permitted @ ~] pax)
|
||||
:_ this
|
||||
=/ jon=json
|
||||
%+ frond:enjs:format
|
||||
%'providerStatus'
|
||||
%- pairs:enjs:format
|
||||
:~ provider+s+(scot %p our.bowl)
|
||||
permitted+b+(is-whitelisted:hc src.bowl)
|
||||
==
|
||||
[%give %fact ~ %json !>(jon)]~
|
||||
::
|
||||
?> ?| ?=([%clients ~] pax)
|
||||
?& ?=([%clients @ ~] pax)
|
||||
=(src.bowl (slav %p i.t.pax))
|
||||
==
|
||||
==
|
||||
?. (is-whitelisted:hc src.bowl)
|
||||
~|("btc-provider: blocked client {<src.bowl>}" !!)
|
||||
~& > "btc-provider: accepted client {<src.bowl>}"
|
||||
`this(clients.host-info (~(put in clients.host-info) src.bowl))
|
||||
::
|
||||
++ on-arvo
|
||||
~/ %on-arvo
|
||||
|= [wir=wire =sign-arvo]
|
||||
|^
|
||||
^- (quip card _this)
|
||||
:: check for connectivity every 30 seconds
|
||||
::
|
||||
?: ?=([%ping-timer *] wir)
|
||||
`this
|
||||
?: ?=([%block-ping *] wir)
|
||||
:_ this(timer `(add now.bowl interval))
|
||||
:~ do-ping
|
||||
(start-ping-timer:hc interval)
|
||||
==
|
||||
=^ cards state
|
||||
?+ +<.sign-arvo (on-arvo:def wir sign-arvo)
|
||||
%http-response
|
||||
(handle-rpc-response wir client-response.sign-arvo)
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ do-ping
|
||||
^- card
|
||||
=/ act=action [%ping ~]
|
||||
:* %pass /ping/[(scot %da now.bowl)] %agent
|
||||
[our.bowl %btc-provider] %poke
|
||||
%btc-provider-action !>(act)
|
||||
==
|
||||
::
|
||||
:: Handles HTTP responses from RPC servers. Parses for errors,
|
||||
:: then handles response. For actions that require collating multiple
|
||||
:: RPC calls, uses req-card to call out to RPC again if more
|
||||
:: information is required.
|
||||
++ handle-rpc-response
|
||||
|= [=wire response=client-response:iris]
|
||||
^- (quip card _state)
|
||||
?. ?=(%finished -.response) `state
|
||||
=* status status-code.response-header.response
|
||||
:: handle error types: connection errors, RPC errors (in order)
|
||||
::
|
||||
=^ conn-err state
|
||||
(connection-error status)
|
||||
?^ conn-err
|
||||
:_ state(connected.host-info %.n)
|
||||
:~ (send-status:hc [%disconnected ~] ~)
|
||||
(send-update:hc [%| u.conn-err] ~)
|
||||
==
|
||||
::
|
||||
%+ handle-rpc-result wire
|
||||
%- parse-result:rpc:bl
|
||||
(get-rpc-response:bl response)
|
||||
::
|
||||
++ handle-rpc-result
|
||||
|= [=wire r=result:rpc-types]
|
||||
^- (quip card _state)
|
||||
=/ ship=(unit ship)
|
||||
(slaw %p (snag 1 wire))
|
||||
?+ -.wire ~|("Unexpected HTTP response" !!)
|
||||
%address-info
|
||||
?> ?=([%get-address-info *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %address-info +.r] ship)]
|
||||
::
|
||||
%tx-info
|
||||
?> ?=([%get-tx-vals *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %tx-info +.r] ship)]
|
||||
::
|
||||
%raw-tx
|
||||
?> ?=([%get-raw-tx *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %raw-tx +.r] ship)]
|
||||
::
|
||||
%broadcast-tx
|
||||
?> ?=([%broadcast-tx *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %broadcast-tx +.r] ship)]
|
||||
::
|
||||
%ping
|
||||
?> ?=([%get-block-info *] r)
|
||||
:_ state(connected.host-info %.y, block.host-info block.r)
|
||||
:_ ~
|
||||
%- send-status:hc
|
||||
:_ ~
|
||||
?: =(block.host-info block.r)
|
||||
[%connected network.host-info block.r fee.r]
|
||||
[%new-block network.host-info block.r fee.r blockhash.r blockfilter.r]
|
||||
::
|
||||
%block-info
|
||||
?> ?=([%get-block-info *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %block-info network.host-info +.r] ship)]
|
||||
::
|
||||
%histogram
|
||||
?> ?=([%get-histogram *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %histogram +.r] ship)]
|
||||
::
|
||||
%block-headers
|
||||
?> ?=([%get-block-headers *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %block-headers +.r] ship)]
|
||||
::
|
||||
%tx-from-pos
|
||||
?> ?=([%get-tx-from-pos *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %tx-from-pos +.r] ship)]
|
||||
::
|
||||
%fee
|
||||
?> ?=([%get-fee *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %fee +.r] ship)]
|
||||
::
|
||||
%psbt
|
||||
?> ?=([%update-psbt *] r)
|
||||
:_ state
|
||||
~[(send-update:hc [%.y %psbt +.r] ship)]
|
||||
==
|
||||
::
|
||||
++ connection-error
|
||||
|= status=@ud
|
||||
^- [(unit error) _state]
|
||||
?+ status [`[%rpc-error ~] state]
|
||||
%200 [~ state]
|
||||
%400 [`[%bad-request status] state]
|
||||
%401 [`[%no-auth status] state(connected.host-info %.n)]
|
||||
%502 [`[%not-connected status] state(connected.host-info %.n)]
|
||||
%504 [`[%not-connected status] state(connected.host-info %.n)]
|
||||
==
|
||||
--
|
||||
::
|
||||
++ on-peek
|
||||
~/ %on-peek
|
||||
|= pax=path
|
||||
^- (unit (unit cage))
|
||||
?+ pax (on-peek:def pax)
|
||||
[%x %is-whitelisted @t ~]
|
||||
``noun+!>((is-whitelisted:hc (ship (slav %p +>-.pax))))
|
||||
::
|
||||
[%x %is-client @t ~]
|
||||
``noun+!>((is-client:hc (ship (slav %p +>-.pax))))
|
||||
==
|
||||
::
|
||||
++ on-leave on-leave:def
|
||||
++ on-agent on-agent:def
|
||||
++ on-fail on-fail:def
|
||||
--
|
||||
:: helper core
|
||||
~% %btc-provider-helper ..card ~
|
||||
|_ =bowl:gall
|
||||
+* grp ~(. groupl bowl)
|
||||
++ send-status
|
||||
|= [=status ship=(unit ship)]
|
||||
^- card
|
||||
%- ?: ?=(%new-block -.status)
|
||||
~&(>> "%new-block: {<block.status>}" same)
|
||||
same
|
||||
=- [%give %fact ~[-] %btc-provider-status !>(status)]
|
||||
?~ ship /clients
|
||||
/clients/(scot %p u.ship)
|
||||
::
|
||||
++ send-update
|
||||
|= [=update ship=(unit ship)]
|
||||
^- card
|
||||
%- ?: ?=(%.y -.update)
|
||||
same
|
||||
~&(>> "prov. err: {<p.update>}" same)
|
||||
=- [%give %fact ~[-] %btc-provider-update !>(update)]
|
||||
?~ ship /clients
|
||||
/clients/(scot %p u.ship)
|
||||
::
|
||||
++ is-whitelisted
|
||||
~/ %is-whitelisted
|
||||
|= user=ship
|
||||
^- ?
|
||||
|^
|
||||
?| public.whitelist
|
||||
=(our.bowl user)
|
||||
?&(kids.whitelist is-kid)
|
||||
(~(has in users.whitelist) user)
|
||||
in-group
|
||||
==
|
||||
::
|
||||
++ is-kid
|
||||
=(our.bowl (sein:title our.bowl now.bowl user))
|
||||
::
|
||||
++ in-group
|
||||
=/ gs ~(tap in groups.whitelist)
|
||||
?. is-running:grp %.n
|
||||
|-
|
||||
?~ gs %.n
|
||||
?: (is-member:grp user i.gs)
|
||||
%.y
|
||||
$(gs t.gs)
|
||||
--
|
||||
::
|
||||
++ is-client
|
||||
|= user=ship
|
||||
^- ?
|
||||
(~(has in clients.host-info) user)
|
||||
::
|
||||
++ start-ping-timer
|
||||
|= interval=@dr
|
||||
^- card
|
||||
[%pass /block-ping %arvo %b %wait (add now.bowl interval)]
|
||||
--
|
File diff suppressed because it is too large
Load Diff
@ -1,2 +0,0 @@
|
||||
:~ %btc-wallet
|
||||
==
|
@ -1,11 +0,0 @@
|
||||
:~
|
||||
title+'Bitcoin'
|
||||
info+'A Bitcoin Wallet that lets you send and receive Bitcoin directly to and from other Urbit users'
|
||||
color+0xf9.8e40
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v3.7b5q1.gn30e.cpfem.abmqg.qh77v.glob' 0v3.7b5q1.gn30e.cpfem.abmqg.qh77v]
|
||||
image+'https://urbit.ewr1.vultrobjects.com/hastuc-dibtux/2021.8.24..02.57.38-bitcoin.svg'
|
||||
base+'bitcoin'
|
||||
version+[0 0 2]
|
||||
license+'MIT'
|
||||
website+'https://tlon.io'
|
||||
==
|
@ -1 +0,0 @@
|
||||
~mister-dister-dozzod-dozzod
|
@ -1,13 +0,0 @@
|
||||
:: Sends a raw RPC action to the BTC Provider
|
||||
::
|
||||
:: Commands:
|
||||
::
|
||||
::
|
||||
::
|
||||
/- *btc-provider
|
||||
::
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[act=action ~] ~]
|
||||
==
|
||||
[%btc-provider-action act]
|
@ -1,13 +0,0 @@
|
||||
:: Sends a command to the BTC Provider
|
||||
::
|
||||
:: Commands:
|
||||
::
|
||||
::
|
||||
::
|
||||
/- *btc-provider
|
||||
::
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[comm=command ~] ~]
|
||||
==
|
||||
[%btc-provider-command comm]
|
@ -1,5 +0,0 @@
|
||||
:- %say
|
||||
|= [[now=time * bec=beak] ~ ~]
|
||||
:- %noun
|
||||
:- %btc-wallet-hash
|
||||
.^(@uv %gx (en-beam bec(q %glob) /btc-wallet/noun))
|
@ -1,9 +0,0 @@
|
||||
:: Sends an action to btc-wallet
|
||||
::
|
||||
/- *btc-wallet
|
||||
::
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[act=action ~] ~]
|
||||
==
|
||||
[%btc-wallet-action act]
|
@ -1,9 +0,0 @@
|
||||
:: Sends a command to btc-wallet
|
||||
::
|
||||
/- *btc-wallet
|
||||
::
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[comm=command ~] ~]
|
||||
==
|
||||
[%btc-wallet-command comm]
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/agentio.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/azimuth.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/azimuthio.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/bip/b158.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/bip/b173.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/bip/b174.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/bip32.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/bip39.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/bip39/english.hoon
|
@ -1,248 +0,0 @@
|
||||
/- btc-wallet, btc-provider, bitcoin
|
||||
/+ bl=bitcoin
|
||||
|%
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
|%
|
||||
++ command
|
||||
|= jon=json
|
||||
^- command:btc-wallet
|
||||
%. jon
|
||||
%- of
|
||||
:~ set-provider+(mu ship)
|
||||
check-provider+ship
|
||||
check-payee+ship
|
||||
set-current-wallet+so
|
||||
add-wallet+add-wallet
|
||||
delete-wallet+so
|
||||
init-payment-external+init-payment-external
|
||||
init-payment+init-payment
|
||||
broadcast-tx+so
|
||||
gen-new-address+|=(json ~)
|
||||
==
|
||||
::
|
||||
++ ship (su ;~(pfix sig fed:ag))
|
||||
::
|
||||
++ add-wallet
|
||||
%- ot
|
||||
:~ xpub+so
|
||||
fprint+(at [ni ni ~])
|
||||
scan-to+(mu (at [ni ni ~]))
|
||||
max-gap+(mu ni)
|
||||
confs+(mu ni)
|
||||
==
|
||||
::
|
||||
++ init-payment-external
|
||||
%- ot
|
||||
:~ address+address
|
||||
value+ni
|
||||
feyb+ni
|
||||
note+(mu so)
|
||||
==
|
||||
::
|
||||
++ init-payment
|
||||
%- ot
|
||||
:~ payee+ship
|
||||
value+ni
|
||||
feyb+ni
|
||||
note+(mu so)
|
||||
==
|
||||
::
|
||||
++ address
|
||||
|= jon=json
|
||||
?> ?=([%s @t] jon)
|
||||
^- address:bitcoin
|
||||
(from-cord:adr:bl +.jon)
|
||||
--
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
++ status
|
||||
|= sta=status:btc-provider
|
||||
^- json
|
||||
%+ frond -.sta
|
||||
?- -.sta
|
||||
%connected (connected sta)
|
||||
%new-block (new-block sta)
|
||||
%disconnected ~
|
||||
==
|
||||
::
|
||||
++ connected
|
||||
|= sta=status:btc-provider
|
||||
?> ?=(%connected -.sta)
|
||||
%- pairs
|
||||
:~ network+s+network.sta
|
||||
block+(numb block.sta)
|
||||
fee+?~(fee.sta ~ (numb u.fee.sta))
|
||||
==
|
||||
::
|
||||
++ new-block
|
||||
|= sta=status:btc-provider
|
||||
?> ?=(%new-block -.sta)
|
||||
%- pairs
|
||||
:~ network+s+network.sta
|
||||
block+(numb block.sta)
|
||||
fee+?~(fee.sta ~ (numb u.fee.sta))
|
||||
blockhash+(hexb blockhash.sta)
|
||||
blockfilter+(hexb blockfilter.sta)
|
||||
==
|
||||
::
|
||||
++ hexb
|
||||
|= h=hexb:bitcoin
|
||||
^- json
|
||||
%- pairs
|
||||
:~ wid+(numb:enjs wid.h)
|
||||
dat+s+(scot %ux dat.h)
|
||||
==
|
||||
::
|
||||
++ update
|
||||
|= upd=update:btc-wallet
|
||||
^- json
|
||||
%+ frond -.upd
|
||||
?- -.upd
|
||||
%initial (initial upd)
|
||||
%change-provider (change-provider upd)
|
||||
%change-wallet (change-wallet upd)
|
||||
%psbt (psbt upd)
|
||||
%btc-state (btc-state btc-state.upd)
|
||||
%new-tx (hest hest.upd)
|
||||
%cancel-tx (hexb txid.upd)
|
||||
%new-address (address address.upd)
|
||||
%balance (balance balance.upd)
|
||||
%scan-progress (scan-progress main.upd change.upd)
|
||||
%error s+error.upd
|
||||
%broadcast-success ~
|
||||
==
|
||||
::
|
||||
++ initial
|
||||
|= upd=update:btc-wallet
|
||||
?> ?=(%initial -.upd)
|
||||
^- json
|
||||
%- pairs
|
||||
:~ provider+(provider provider.upd)
|
||||
wallet+?~(wallet.upd ~ [%s u.wallet.upd])
|
||||
balance+(balance balance.upd)
|
||||
history+(history history.upd)
|
||||
btc-state+(btc-state btc-state.upd)
|
||||
address+?~(address.upd ~ (address u.address.upd))
|
||||
==
|
||||
::
|
||||
++ change-provider
|
||||
|= upd=update:btc-wallet
|
||||
?> ?=(%change-provider -.upd)
|
||||
^- json
|
||||
(provider provider.upd)
|
||||
::
|
||||
++ change-wallet
|
||||
|= upd=update:btc-wallet
|
||||
?> ?=(%change-wallet -.upd)
|
||||
^- json
|
||||
%- pairs
|
||||
:~ wallet+?~(wallet.upd ~ [%s u.wallet.upd])
|
||||
balance+(balance balance.upd)
|
||||
history+(history history.upd)
|
||||
==
|
||||
::
|
||||
++ psbt
|
||||
|= upd=update:btc-wallet
|
||||
?> ?=(%psbt -.upd)
|
||||
^- json
|
||||
%- pairs
|
||||
:~ pb+s+pb.upd
|
||||
fee+(numb fee.upd)
|
||||
==
|
||||
::
|
||||
++ balance
|
||||
|= b=(unit [p=@ q=@])
|
||||
^- json
|
||||
?~ b ~
|
||||
%- pairs
|
||||
:~ confirmed+(numb p.u.b)
|
||||
unconfirmed+(numb q.u.b)
|
||||
==
|
||||
::
|
||||
++ scan-progress
|
||||
|= [main=(unit idx:bitcoin) change=(unit idx:bitcoin)]
|
||||
|^ ^- json
|
||||
%- pairs
|
||||
:~ main+(from-unit main)
|
||||
change+(from-unit change)
|
||||
==
|
||||
++ from-unit
|
||||
|= i=(unit idx:bitcoin)
|
||||
?~ i ~
|
||||
(numb u.i)
|
||||
--
|
||||
::
|
||||
++ btc-state
|
||||
|= bs=btc-state:btc-wallet
|
||||
^- json
|
||||
%- pairs
|
||||
:~ block+(numb block.bs)
|
||||
fee+?~(fee.bs ~ (numb u.fee.bs))
|
||||
date+(sect t.bs)
|
||||
==
|
||||
::
|
||||
++ provider
|
||||
|= p=(unit provider:btc-wallet)
|
||||
^- json
|
||||
?~ p ~
|
||||
%- pairs
|
||||
:~ host+(ship host.u.p)
|
||||
connected+b+connected.u.p
|
||||
==
|
||||
::
|
||||
++ history
|
||||
|= hy=history:btc-wallet
|
||||
^- json
|
||||
:- %o
|
||||
^- (map @t json)
|
||||
%- ~(rep by hy)
|
||||
|= [[=txid:btc-wallet h=hest:btc-wallet] out=(map @t json)]
|
||||
^- (map @t json)
|
||||
(~(put by out) (scot %ux dat.txid) (hest h))
|
||||
::
|
||||
++ hest
|
||||
|= h=hest:btc-wallet
|
||||
^- json
|
||||
%- pairs
|
||||
:~ xpub+s+xpub.h
|
||||
txid+(hexb txid.h)
|
||||
confs+(numb confs.h)
|
||||
recvd+?~(recvd.h ~ (sect u.recvd.h))
|
||||
inputs+(vals inputs.h)
|
||||
outputs+(vals outputs.h)
|
||||
note+?~(note.h ~ [%s u.note.h])
|
||||
==
|
||||
::
|
||||
++ vals
|
||||
|= vl=(list [=val:tx:bitcoin s=(unit @p)])
|
||||
^- json
|
||||
:- %a
|
||||
%+ turn vl
|
||||
|= [v=val:tx:bitcoin s=(unit @p)]
|
||||
%- pairs
|
||||
:~ val+(val v)
|
||||
ship+?~(s ~ (ship u.s))
|
||||
==
|
||||
::
|
||||
++ val
|
||||
|= v=val:tx:bitcoin
|
||||
^- json
|
||||
%- pairs
|
||||
:~ txid+(hexb txid.v)
|
||||
pos+(numb pos.v)
|
||||
address+(address address.v)
|
||||
value+(numb value.v)
|
||||
==
|
||||
::
|
||||
++ address
|
||||
|= a=address:bitcoin
|
||||
^- json
|
||||
?- -.a
|
||||
%base58 [%s (rsh [3 2] (scot %uc +.a))]
|
||||
%bech32 [%s +.a]
|
||||
==
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/bitcoin-utils.hoon
|
@ -1,300 +0,0 @@
|
||||
:: bitcoin.hoon
|
||||
:: top-level Bitcoin constants
|
||||
:: expose BIP libraries
|
||||
::
|
||||
/- *bitcoin
|
||||
/+ bech32=bip-b173, pbt=bip-b174, bcu=bitcoin-utils, bip-b158
|
||||
~% %bitcoin-lib ..part ~
|
||||
|%
|
||||
++ overhead-weight ^-(vbytes 11)
|
||||
++ input-weight
|
||||
~/ %input-weight
|
||||
|= =bipt
|
||||
^- vbytes
|
||||
?- bipt
|
||||
%44 148
|
||||
%49 91
|
||||
%84 68
|
||||
==
|
||||
++ output-weight
|
||||
|= =bipt
|
||||
^- vbytes
|
||||
?- bipt
|
||||
%44 34
|
||||
%49 32
|
||||
%84 31
|
||||
==
|
||||
::
|
||||
++ xpub-type
|
||||
|= =xpub
|
||||
^- [=bipt =network]
|
||||
=/ prefix=tape (scag 4 (trip xpub))
|
||||
?: =("tpub" prefix) [%44 %testnet]
|
||||
?: =("upub" prefix) [%49 %testnet]
|
||||
?: =("vpub" prefix) [%84 %testnet]
|
||||
?: =("xpub" prefix) [%44 %main]
|
||||
?: =("ypub" prefix) [%49 %main]
|
||||
?: =("zpub" prefix) [%84 %main]
|
||||
~|("invalid xpub: {<xpub>}" !!)
|
||||
::
|
||||
:: adr: address manipulation
|
||||
::
|
||||
++ adr
|
||||
~% %adr ..overhead-weight ~
|
||||
|%
|
||||
++ get-bipt
|
||||
~/ %get-bipt
|
||||
|= a=address
|
||||
^- bipt
|
||||
=/ spk=hexb (to-script-pubkey:adr a)
|
||||
?: =(25 wid.spk) %44
|
||||
?: =(23 wid.spk) %49
|
||||
?: =(22 wid.spk) %84
|
||||
?: =(34 wid.spk) %84
|
||||
~|("Invalid address" !!)
|
||||
::
|
||||
++ to-cord
|
||||
~/ %to-cord
|
||||
|= a=address ^- cord
|
||||
?: ?=([%base58 *] a)
|
||||
%- crip
|
||||
%+ slag 2
|
||||
(scow %uc +.a)
|
||||
+.a
|
||||
::
|
||||
++ from-pubkey
|
||||
~/ %from-pubkey
|
||||
|= [=bipt =network pubkey=hexb]
|
||||
^- address
|
||||
?- bipt
|
||||
%44
|
||||
:- %base58
|
||||
=< ^-(@uc dat)
|
||||
%- cat:byt:bcu
|
||||
:- ?- network
|
||||
%main 1^0x0
|
||||
%testnet 1^0x6f
|
||||
%regtest 1^0x6f
|
||||
==
|
||||
~[(hash-160:bcu pubkey)]
|
||||
::
|
||||
%49
|
||||
:- %base58
|
||||
=< ^-(@uc dat)
|
||||
%- cat:byt:bcu
|
||||
:~ ?- network
|
||||
%main 1^0x5
|
||||
%testnet 1^0xc4
|
||||
%regtest 1^0xc4
|
||||
==
|
||||
%- hash-160:bcu
|
||||
(cat:byt:bcu ~[2^0x14 (hash-160:bcu pubkey)])
|
||||
==
|
||||
::
|
||||
%84
|
||||
:- %bech32
|
||||
(need (encode-pubkey:bech32 network pubkey))
|
||||
==
|
||||
::
|
||||
++ from-cord
|
||||
~/ %from-cord
|
||||
|= addrc=@t
|
||||
|^
|
||||
=/ addrt=tape (trip addrc)
|
||||
^- address
|
||||
?: (is-base58 addrt)
|
||||
[%base58 `@uc`(scan addrt fim:ag)]
|
||||
?: (is-bech32 addrt)
|
||||
[%bech32 addrc]
|
||||
~|("Invalid address: {<addrc>}" !!)
|
||||
::
|
||||
++ is-base58
|
||||
|= at=tape
|
||||
^- ?
|
||||
?| =("n" (scag 1 at))
|
||||
=("m" (scag 1 at))
|
||||
=("1" (scag 1 at))
|
||||
=("3" (scag 1 at))
|
||||
=("2" (scag 1 at))
|
||||
==
|
||||
::
|
||||
++ is-bech32
|
||||
|= at=tape
|
||||
^- ?
|
||||
?| =("bc1" (scag 3 at))
|
||||
=("tb1" (scag 3 at))
|
||||
=("bcrt1" (scag 5 at))
|
||||
==
|
||||
--
|
||||
::
|
||||
++ to-script-pubkey
|
||||
~/ %to-script-pubkey
|
||||
|= =address
|
||||
^- hexb
|
||||
?- -.address
|
||||
%bech32
|
||||
=+ h=(from-address:bech32 +.address)
|
||||
%- cat:byt:bcu
|
||||
:~ 1^0x0
|
||||
1^wid.h
|
||||
h
|
||||
==
|
||||
::
|
||||
%base58
|
||||
=/ h=hexb [21 `@ux`+.address]
|
||||
=+ lead-byt=dat:(take:byt:bcu 1 h)
|
||||
=/ version-network=[bipt network]
|
||||
?: =(0x0 lead-byt) [%44 %main]
|
||||
?: =(0x6f lead-byt) [%44 %testnet]
|
||||
?: =(0x5 lead-byt) [%49 %main]
|
||||
?: =(0xc4 lead-byt) [%49 %testnet]
|
||||
~|("Invalid base58 address: {<+.address>}" !!)
|
||||
%- cat:byt:bcu
|
||||
?: ?=(%44 -.version-network)
|
||||
:~ 3^0x76.a914
|
||||
(drop:byt:bcu 1 h)
|
||||
2^0x88ac
|
||||
==
|
||||
:~ 2^0xa914
|
||||
(drop:byt:bcu 1 h)
|
||||
1^0x87
|
||||
==
|
||||
==
|
||||
--
|
||||
::
|
||||
:: +txu: transaction utility core
|
||||
:: - primarily used for calculating txids
|
||||
:: - ignores signatures in inputs
|
||||
::
|
||||
++ txu
|
||||
~% %bitcoin-lib-txu ..overhead-weight ~
|
||||
=, bcu
|
||||
|%
|
||||
++ en
|
||||
|%
|
||||
++ input
|
||||
|= i=input:tx
|
||||
^- hexb
|
||||
%- cat:byt
|
||||
:~ (flip:byt txid.i)
|
||||
(flip:byt 4^pos.i)
|
||||
?~ script-sig.i 1^0x0
|
||||
%- cat:byt
|
||||
~[(en:csiz wid.u.script-sig.i) u.script-sig.i]
|
||||
(flip:byt sequence.i)
|
||||
==
|
||||
::
|
||||
++ output
|
||||
|= o=output:tx
|
||||
^- hexb
|
||||
%- cat:byt
|
||||
:~ (flip:byt 8^value.o)
|
||||
1^wid.script-pubkey.o
|
||||
script-pubkey.o
|
||||
==
|
||||
--
|
||||
::
|
||||
++ de
|
||||
|%
|
||||
++ nversion
|
||||
|= b=hexb
|
||||
^- [nversion=@ud rest=hexb]
|
||||
:- dat:(flip:byt (take:byt 4 b))
|
||||
(drop:byt 4 b)
|
||||
::
|
||||
++ segwit
|
||||
|= b=hexb
|
||||
^- [segwit=(unit @ud) rest=hexb]
|
||||
?. =(1^0x0 (take:byt 1 b))
|
||||
[~ b]
|
||||
:- [~ dat:(take:byt 2 b)]
|
||||
(drop:byt 2 b)
|
||||
::
|
||||
++ script-sig
|
||||
|= b=hexb
|
||||
^- [sig=hexb rest=hexb]
|
||||
=^ siglen=hexb b (de:csiz b)
|
||||
:- (take:byt dat.siglen b)
|
||||
(drop:byt dat.siglen b)
|
||||
::
|
||||
++ sequence
|
||||
|= b=hexb
|
||||
^- [seq=hexb rest=hexb]
|
||||
[(flip:byt (take:byt 4 b)) (drop:byt 4 b)]
|
||||
::
|
||||
++ inputs
|
||||
|= b=hexb
|
||||
^- [is=(list input:tx) rest=hexb]
|
||||
|^
|
||||
=| acc=(list input:tx)
|
||||
=^ count b (dea:csiz b)
|
||||
|-
|
||||
?: =(0 count) [acc b]
|
||||
=^ i b (input b)
|
||||
$(acc (snoc acc i), count (dec count))
|
||||
::
|
||||
++ input
|
||||
|= b=hexb
|
||||
^- [i=input:tx rest=hexb]
|
||||
=/ txid (flip:byt (take:byt 32 b))
|
||||
=/ pos dat:(flip:byt (take:byt 4 (drop:byt 32 b)))
|
||||
=^ sig=hexb b (script-sig (drop:byt 36 b))
|
||||
=^ seq=hexb b (sequence b)
|
||||
:_ b
|
||||
[txid pos seq ?:((gth wid.sig 0) `sig ~) ~ 0]
|
||||
--
|
||||
::
|
||||
++ outputs
|
||||
|= b=hexb
|
||||
^- [os=(list output:tx) rest=hexb]
|
||||
=| acc=(list output:tx)
|
||||
=^ count b (dea:csiz b)
|
||||
|-
|
||||
?: =(0 count) [acc b]
|
||||
=/ value (flip:byt (take:byt 8 b))
|
||||
=^ scriptlen b (dea:csiz (drop:byt 8 b))
|
||||
%= $
|
||||
acc %+ snoc acc
|
||||
:- (take:byt scriptlen b)
|
||||
dat.value
|
||||
b (drop:byt scriptlen b)
|
||||
count (dec count)
|
||||
==
|
||||
--
|
||||
:: +basic-encode: encodes data in a format suitable for hashing
|
||||
::
|
||||
++ basic-encode
|
||||
|= =data:tx
|
||||
^- hexb
|
||||
%- cat:byt
|
||||
%- zing
|
||||
:~ ~[(flip:byt 4^nversion.data)]
|
||||
~[(en:csiz (lent is.data))]
|
||||
(turn is.data input:en)
|
||||
~[(en:csiz (lent os.data))]
|
||||
(turn os.data output:en)
|
||||
~[(flip:byt 4^locktime.data)]
|
||||
==
|
||||
++ get-id
|
||||
|= =data:tx
|
||||
^- hexb
|
||||
%- flip:byt
|
||||
%- dsha256
|
||||
(basic-encode data)
|
||||
::
|
||||
++ decode
|
||||
|= b=hexb
|
||||
^- data:tx
|
||||
=^ nversion b
|
||||
(nversion:de b)
|
||||
=^ segwit b
|
||||
(segwit:de b)
|
||||
=^ inputs b
|
||||
(inputs:de b)
|
||||
=^ outputs b
|
||||
(outputs:de b)
|
||||
=/ locktime=@ud
|
||||
dat:(take:byt 4 (flip:byt b))
|
||||
[inputs outputs locktime nversion segwit]
|
||||
--
|
||||
--
|
@ -1,215 +0,0 @@
|
||||
/- bp=btc-provider, json-rpc
|
||||
/+ bc=bitcoin, bcu=bitcoin-utils
|
||||
~% %btc-provider-lib ..part ~
|
||||
|%
|
||||
:: +from-epoch: time since Jan 1, 1970 in seconds.
|
||||
::
|
||||
++ from-epoch
|
||||
|= secs=@ud
|
||||
^- (unit @da)
|
||||
?: =(0 secs) ~
|
||||
[~ (add ~1970.1.1 `@dr`(mul secs ~s1))]
|
||||
::
|
||||
++ get-request
|
||||
|= url=@t
|
||||
^- request:http
|
||||
[%'GET' url ~ ~]
|
||||
::
|
||||
++ post-request
|
||||
|= [url=@t body=json]
|
||||
^- request:http
|
||||
:* %'POST'
|
||||
url
|
||||
~[['Content-Type' 'application/json']]
|
||||
=, html
|
||||
%- some
|
||||
%- as-octt:mimes
|
||||
(en-json body)
|
||||
==
|
||||
::
|
||||
++ gen-request
|
||||
|= [=host-info:bp ract=action:rpc-types:bp]
|
||||
^- request:http
|
||||
%+ rpc-action-to-http
|
||||
api-url.host-info ract
|
||||
::
|
||||
++ rpc
|
||||
~/ %rpc
|
||||
=, dejs:format
|
||||
|%
|
||||
++ parse-result
|
||||
|= res=response:json-rpc
|
||||
|^ ^- result:rpc-types:bp
|
||||
~| -.res
|
||||
?> ?=(%result -.res)
|
||||
?+ id.res ~|([%unsupported-result id.res] !!)
|
||||
%get-address-info
|
||||
[id.res (address-info res.res)]
|
||||
::
|
||||
%get-tx-vals
|
||||
[id.res (tx-vals res.res)]
|
||||
::
|
||||
%get-raw-tx
|
||||
[id.res (raw-tx res.res)]
|
||||
::
|
||||
%broadcast-tx
|
||||
[%broadcast-tx (broadcast-tx res.res)]
|
||||
::
|
||||
%get-block-count
|
||||
[id.res (ni res.res)]
|
||||
::
|
||||
%get-block-info
|
||||
[id.res (block-info res.res)]
|
||||
==
|
||||
::
|
||||
++ address-info
|
||||
%- ot
|
||||
:~ [%address (cu from-cord:adr:bc so)]
|
||||
[%utxos (as utxo)]
|
||||
[%used bo]
|
||||
[%block ni]
|
||||
==
|
||||
::
|
||||
++ utxo
|
||||
%- ot
|
||||
:~ ['tx_pos' ni]
|
||||
['tx_hash' (cu from-cord:hxb:bcu so)]
|
||||
[%height ni]
|
||||
[%value ni]
|
||||
[%recvd (cu from-epoch ni)]
|
||||
==
|
||||
::
|
||||
++ tx-vals
|
||||
%- ot
|
||||
:~ [%included bo]
|
||||
[%txid (cu from-cord:hxb:bcu so)]
|
||||
[%confs ni]
|
||||
[%recvd (cu from-epoch ni)]
|
||||
[%inputs (ar tx-val)]
|
||||
[%outputs (ar tx-val)]
|
||||
==
|
||||
::
|
||||
++ tx-val
|
||||
%- ot
|
||||
:~ [%txid (cu from-cord:hxb:bcu so)]
|
||||
[%pos ni]
|
||||
[%address (cu from-cord:adr:bc so)]
|
||||
[%value ni]
|
||||
==
|
||||
::
|
||||
++ raw-tx
|
||||
%- ot
|
||||
:~ [%txid (cu from-cord:hxb:bcu so)]
|
||||
[%rawtx (cu from-cord:hxb:bcu so)]
|
||||
==
|
||||
::
|
||||
++ broadcast-tx
|
||||
%- ot
|
||||
:~ [%txid (cu from-cord:hxb:bcu so)]
|
||||
[%broadcast bo]
|
||||
[%included bo]
|
||||
==
|
||||
::
|
||||
++ block-info
|
||||
%- ot
|
||||
:~ [%block ni]
|
||||
[%fee (mu ni)]
|
||||
[%blockhash (cu from-cord:hxb:bcu so)]
|
||||
[%blockfilter (cu from-cord:hxb:bcu so)]
|
||||
==
|
||||
--
|
||||
--
|
||||
::
|
||||
++ rpc-action-to-http
|
||||
|= [endpoint=@t ract=action:rpc-types:bp]
|
||||
|^ ^- request:http
|
||||
?- -.ract
|
||||
%get-address-info
|
||||
%- get-request
|
||||
%+ mk-url '/addresses/info/'
|
||||
(to-cord:adr:bc address.ract)
|
||||
::
|
||||
%get-tx-vals
|
||||
%- get-request
|
||||
%+ mk-url '/gettxvals/'
|
||||
(to-cord:hxb:bcu txid.ract)
|
||||
::
|
||||
%get-raw-tx
|
||||
%- get-request
|
||||
%+ mk-url '/getrawtx/'
|
||||
(to-cord:hxb:bcu txid.ract)
|
||||
::
|
||||
%broadcast-tx
|
||||
%- get-request
|
||||
%+ mk-url '/broadcasttx/'
|
||||
(to-cord:hxb:bcu rawtx.ract)
|
||||
::
|
||||
%get-block-count
|
||||
%- get-request
|
||||
(mk-url '/getblockcount' '')
|
||||
::
|
||||
%get-block-info
|
||||
%- get-request
|
||||
(mk-url '/getblockinfo' '')
|
||||
==
|
||||
++ mk-url
|
||||
|= [base=@t params=@t]
|
||||
%^ cat 3
|
||||
(cat 3 endpoint base) params
|
||||
--
|
||||
:: RPC/HTTP Utilities
|
||||
::
|
||||
++ httr-to-rpc-response
|
||||
|= hit=httr:eyre
|
||||
^- response:json-rpc
|
||||
~| hit
|
||||
=/ jon=json (need (de-json:html q:(need r.hit)))
|
||||
?. =(%2 (div p.hit 100))
|
||||
(parse-rpc-error jon)
|
||||
=, dejs-soft:format
|
||||
^- response:json-rpc
|
||||
=; dere
|
||||
=+ res=((ar dere) jon)
|
||||
?~ res (need (dere jon))
|
||||
[%batch u.res]
|
||||
|= jon=json
|
||||
^- (unit response:json-rpc)
|
||||
=/ res=[id=(unit @t) res=(unit json) err=(unit json)]
|
||||
%. jon
|
||||
=, dejs:format
|
||||
=- (ou -)
|
||||
:~ ['id' (uf ~ (mu so))]
|
||||
['result' (uf ~ (mu same))]
|
||||
['error' (uf ~ (mu same))]
|
||||
==
|
||||
?: ?=([^ * ~] res)
|
||||
`[%result [u.id.res ?~(res.res ~ u.res.res)]]
|
||||
~| jon
|
||||
`(parse-rpc-error jon)
|
||||
::
|
||||
++ get-rpc-response
|
||||
|= response=client-response:iris
|
||||
^- response:json-rpc
|
||||
?> ?=(%finished -.response)
|
||||
%- httr-to-rpc-response
|
||||
%+ to-httr:iris
|
||||
response-header.response
|
||||
full-file.response
|
||||
::
|
||||
++ parse-rpc-error
|
||||
|= =json
|
||||
^- response:json-rpc
|
||||
:- %error
|
||||
?~ json ['' '' '']
|
||||
%. json
|
||||
=, dejs:format
|
||||
=- (ou -)
|
||||
:~ =- ['id' (uf '' (cu - (mu so)))]
|
||||
|*(a=(unit) ?~(a '' u.a))
|
||||
:- 'error'
|
||||
=- (uf ['' ''] -)
|
||||
=- (cu |*(a=(unit) ?~(a ['' ''] u.a)) (mu (ou -)))
|
||||
:~ ['code' (uf '' no)]
|
||||
['message' (uf '' so)]
|
||||
== ==
|
||||
--
|
@ -1,636 +0,0 @@
|
||||
:: lib/btc.hoon
|
||||
::
|
||||
/- *btc-wallet, json-rpc, bp=btc-provider
|
||||
/+ bip32, bc=bitcoin, bcu=bitcoin-utils
|
||||
=, secp:crypto
|
||||
=+ ecc=secp256k1
|
||||
|%
|
||||
::
|
||||
:: Formerly lib/btc-wallet.hoon
|
||||
::
|
||||
::
|
||||
++ defaults
|
||||
|%
|
||||
++ max-gap 20
|
||||
++ confs 6
|
||||
--
|
||||
:: +fam: planet parent if s is a moon
|
||||
::
|
||||
++ fam
|
||||
|= [our=ship now=@da s=ship]
|
||||
^- ship
|
||||
?. =(%earl (clan:title s)) s
|
||||
(sein:title our now s)
|
||||
::
|
||||
++ num-confs
|
||||
|= [last-block=@ud =utxo:bc]
|
||||
?: =(0 height.utxo) 0
|
||||
(add 1 (sub last-block height.utxo))
|
||||
::
|
||||
++ from-xpub
|
||||
|= $: =xpub:bc
|
||||
=fprint:bc
|
||||
scan-to=(unit scon)
|
||||
max-gap=(unit @ud)
|
||||
confs=(unit @ud)
|
||||
==
|
||||
^- walt
|
||||
=/ [=bipt =network] (xpub-type:bc xpub)
|
||||
:* xpub
|
||||
network
|
||||
fprint
|
||||
+6:(from-extended:bip32 (trip xpub))
|
||||
bipt
|
||||
*wach
|
||||
[0 0]
|
||||
%.n
|
||||
(fall scan-to *scon)
|
||||
(fall max-gap max-gap:defaults)
|
||||
(fall confs confs:defaults)
|
||||
==
|
||||
:: +address-coords: find wallet info for the address, if any
|
||||
::
|
||||
++ address-coords
|
||||
|= [a=address ws=(list walt)]
|
||||
^- (unit [w=walt =chyg =idx])
|
||||
|^
|
||||
|- ?~ ws ~
|
||||
=/ res=(unit [=chyg =idx])
|
||||
(lookup i.ws)
|
||||
?^ res `[i.ws chyg.u.res idx.u.res]
|
||||
$(ws t.ws)
|
||||
::
|
||||
++ lookup
|
||||
|= w=walt
|
||||
^- (unit [=chyg =idx])
|
||||
=/ ad=(unit addi) (~(get by wach.w) a)
|
||||
?~(ad ~ `[chyg.u.ad idx.u.ad])
|
||||
--
|
||||
::
|
||||
++ new-txbu
|
||||
|= $: w=walt
|
||||
payee=(unit ship)
|
||||
=vbytes:bc
|
||||
is=(list insel)
|
||||
txos=(list txo)
|
||||
==
|
||||
^- txbu
|
||||
:* xpub.w
|
||||
payee
|
||||
vbytes
|
||||
%+ turn is
|
||||
|= i=insel
|
||||
[utxo.i ~ (~(hdkey wad w chyg.i) idx.i)]
|
||||
txos
|
||||
~
|
||||
==
|
||||
:: txb: transaction builder helpers
|
||||
::
|
||||
++ txb
|
||||
|_ t=txbu
|
||||
++ value
|
||||
^- [in=sats out=sats]
|
||||
:- %+ roll
|
||||
%+ turn txis.t
|
||||
|=(=txi value.utxo.txi)
|
||||
add
|
||||
(roll (turn txos.t |=(=txo value.txo)) add)
|
||||
::
|
||||
++ fee
|
||||
^- sats:bc
|
||||
=/ [in=sats out=sats] value
|
||||
(sub in out)
|
||||
::
|
||||
++ vbytes
|
||||
^- vbytes:bc
|
||||
%+ add overhead-weight:bc
|
||||
%+ add
|
||||
%+ roll
|
||||
(turn txis.t |=(t=txi (input-weight:bc bipt.hdkey.t)))
|
||||
add
|
||||
%+ roll
|
||||
(turn txos.t |=(t=txo (output-weight:bc (get-bipt:adr:bc address.t))))
|
||||
add
|
||||
++ tx-data
|
||||
|^
|
||||
^- data:tx:bc
|
||||
:* (turn txis.t txi-data)
|
||||
(turn txos.t txo-data)
|
||||
0 1 `1
|
||||
==
|
||||
::
|
||||
++ txi-data
|
||||
|= =txi
|
||||
:* txid.utxo.txi pos.utxo.txi
|
||||
4^0xffff.ffff ~ ~ value.utxo.txi
|
||||
==
|
||||
++ txo-data
|
||||
|= =txo
|
||||
:- (to-script-pubkey:adr:bc address.txo)
|
||||
value.txo
|
||||
--
|
||||
::
|
||||
++ get-txid
|
||||
^- txid
|
||||
(get-id:txu:bc tx-data)
|
||||
::
|
||||
++ get-rawtx
|
||||
(basic-encode:txu:bc tx-data)
|
||||
:: +add-output: append output (usually change) to txos
|
||||
::
|
||||
++ add-output
|
||||
|= =txo
|
||||
^- txbu
|
||||
:: todo update vbytes
|
||||
t(txos (snoc [txos.t] txo))
|
||||
:: +to-psbt: returns a based 64 PSBT if
|
||||
:: - all inputs have an associated rawtx
|
||||
::
|
||||
++ to-psbt
|
||||
^- (unit base64:psbt:bc)
|
||||
=/ ins=(list in:psbt:bc)
|
||||
%+ murn txis.t
|
||||
|= =txi
|
||||
?~ rawtx.txi ~
|
||||
`[utxo.txi u.rawtx.txi hdkey.txi]
|
||||
?: (lth (lent ins) (lent txis.t))
|
||||
~
|
||||
=/ outs=(list out:psbt:bc)
|
||||
%+ turn txos.t
|
||||
|=(=txo [address.txo hk.txo])
|
||||
`(encode:pbt:bc %.y get-rawtx get-txid ins outs)
|
||||
--
|
||||
:: wad: door for processing walts (wallets)
|
||||
:: parameterized on a walt and it's chyg account
|
||||
::
|
||||
++ wad
|
||||
|_ [w=walt =chyg]
|
||||
++ pubkey
|
||||
|= =idx:bc
|
||||
^- hexb:bc
|
||||
=/ pk=@ux
|
||||
%- compress-point:ecc
|
||||
pub:(derive-public:(~(derive-public bip32 wamp.w) chyg) idx)
|
||||
[(met 3 pk) pk]
|
||||
::
|
||||
++ hdkey
|
||||
|= =idx:bc
|
||||
^- hdkey:bc
|
||||
[fprint.w (~(pubkey wad w chyg) idx) network.w bipt.w chyg idx]
|
||||
::
|
||||
++ mk-address
|
||||
|= =idx:bc
|
||||
^- address:bc
|
||||
(from-pubkey:adr:bc bipt.w network.w (pubkey idx))
|
||||
:: +nixt-address: used to get change addresses
|
||||
:: - gets the current next available address
|
||||
:: - doesn't bump nixt-address if it's unused
|
||||
:: - if used, fall back to gen-address and make a new one
|
||||
::
|
||||
++ nixt-address
|
||||
^- (trel address:bc idx:bc walt)
|
||||
=/ addr (mk-address nixt-idx)
|
||||
~| "lib/btc-wallet-store: get-next-address: nixt shouldn't be blank"
|
||||
=/ =addi (~(got by wach.w) addr)
|
||||
?. used.addi
|
||||
[addr nixt-idx w]
|
||||
gen-address
|
||||
::
|
||||
:: +gen-address:
|
||||
:: - generates the next available address
|
||||
:: - watches it (using update address)
|
||||
::
|
||||
++ gen-address
|
||||
^- (trel address:bc idx:bc walt)
|
||||
=/ addr (mk-address nixt-idx)
|
||||
:* addr
|
||||
nixt-idx
|
||||
%+ update-address addr
|
||||
[%.n chyg nixt-idx *(set utxo:bc)]
|
||||
==
|
||||
:: +update-address
|
||||
:: - insert a new address
|
||||
:: - if it's used, move "nixt" to the next free address
|
||||
:: - watch address
|
||||
::
|
||||
++ update-address
|
||||
|= [a=address:bc =addi]
|
||||
^- walt
|
||||
?> =(chyg chyg.addi)
|
||||
?> =(a (mk-address idx.addi))
|
||||
=? w ?&(used.addi (is-nixt addi))
|
||||
bump-nixt
|
||||
w(wach (~(put by wach.w) a addi))
|
||||
::
|
||||
++ is-nixt
|
||||
|= =addi ^- ?
|
||||
?: ?=(%0 chyg.addi)
|
||||
=(idx.addi p.nixt.w)
|
||||
=(idx.addi q.nixt.w)
|
||||
++ nixt-idx
|
||||
?:(?=(%0 chyg) p.nixt.w q.nixt.w)
|
||||
:: +bump-nixt: return wallet with bumped nixt
|
||||
:: - find next unused address
|
||||
:: - watches that address
|
||||
:: - crashes if max-index is passed
|
||||
::
|
||||
++ bump-nixt
|
||||
|^ ^- walt
|
||||
=/ new-idx=idx:bc +(nixt-idx)
|
||||
|- ?> (lte new-idx max-index)
|
||||
=+ addr=(mk-address new-idx)
|
||||
=/ =addi
|
||||
%+ ~(gut by wach.w) addr
|
||||
[%.n chyg new-idx *(set utxo:bc)]
|
||||
?. used.addi
|
||||
%= w
|
||||
nixt (set-nixt new-idx)
|
||||
wach (~(put by wach.w) addr addi)
|
||||
==
|
||||
$(new-idx +(new-idx))
|
||||
::
|
||||
++ set-nixt
|
||||
|= =idx:bc ^- nixt
|
||||
?:(?=(%0 chyg) [idx q.nixt.w] [p.nixt.w idx])
|
||||
--
|
||||
--
|
||||
:: sut: select utxos
|
||||
::
|
||||
++ sut
|
||||
|_ [w=walt eny=@uvJ last-block=@ud payee=(unit ship) =feyb txos=(list txo)]
|
||||
++ dust-sats 3
|
||||
++ dust-threshold
|
||||
|= output-bipt=bipt:bc
|
||||
^- vbytes
|
||||
(mul dust-sats (input-weight:bc output-bipt))
|
||||
::
|
||||
++ target-value
|
||||
^- sats
|
||||
%+ roll (turn txos |=(=txo value.txo))
|
||||
|=([a=sats b=sats] (add a b))
|
||||
::
|
||||
++ base-weight
|
||||
^- vbytes
|
||||
%+ add overhead-weight:bc
|
||||
%+ roll
|
||||
%+ turn txos
|
||||
|=(=txo (output-weight:bc (get-bipt:adr:bc address.txo)))
|
||||
add
|
||||
::
|
||||
++ total-vbytes
|
||||
|= selected=(list insel)
|
||||
^- vbytes
|
||||
%+ add base-weight
|
||||
(mul (input-weight:bc bipt.w) (lent selected))
|
||||
:: value of an input after fee
|
||||
:: 0 if net is <= 0
|
||||
::
|
||||
++ net-value
|
||||
|= val=sats
|
||||
^- sats
|
||||
=/ cost (mul (input-weight:bc bipt.w) feyb)
|
||||
?: (lte val cost) 0
|
||||
(sub val cost)
|
||||
::
|
||||
:: +spendable: whether utxo has enough confs to spend
|
||||
::
|
||||
++ spendable
|
||||
|= =utxo:bc ^- ?
|
||||
(gte (num-confs last-block utxo) confs.w)
|
||||
:: +with-change:
|
||||
:: - choose UTXOs, if there are enough
|
||||
:: - return txbu and amount of change (if any)
|
||||
::
|
||||
++ with-change
|
||||
^- [tb=(unit txbu) chng=(unit sats)]
|
||||
=/ tb=(unit txbu) select-utxos
|
||||
?~ tb [~ ~]
|
||||
=+ excess=~(fee txb u.tb) :: (inputs - outputs)
|
||||
=/ new-fee=sats :: cost of this tx + one more output
|
||||
(mul feyb (add (output-weight:bc bipt.w) vbytes.u.tb))
|
||||
?. (gth excess new-fee)
|
||||
[tb ~]
|
||||
?. (gth (sub excess new-fee) (dust-threshold bipt.w))
|
||||
[tb ~]
|
||||
:- tb
|
||||
`(sub excess new-fee)
|
||||
:: Uses naive random selection. Should switch to branch-and-bound later.
|
||||
::
|
||||
++ select-utxos
|
||||
|^ ^- (unit txbu)
|
||||
?. %+ levy txos
|
||||
|= =txo
|
||||
%+ gth value.txo
|
||||
(dust-threshold (get-bipt:adr:bc address.txo))
|
||||
~|("One or more suggested outputs is dust." !!)
|
||||
=/ is=(unit (list insel))
|
||||
%- single-random-draw
|
||||
%- zing
|
||||
(turn ~(val by wach.w) to-insels)
|
||||
?~ is ~
|
||||
`(new-txbu w payee (total-vbytes u.is) u.is txos)
|
||||
::
|
||||
++ to-insels
|
||||
|= =addi
|
||||
^- (list insel)
|
||||
%+ turn ~(tap in utxos.addi)
|
||||
|=(=utxo:bc [utxo chyg.addi idx.addi])
|
||||
--
|
||||
:: single-random-draw
|
||||
:: randomly choose utxos until target is hit
|
||||
:: only use an insel if its net-value > 0
|
||||
::
|
||||
++ single-random-draw
|
||||
|= is=(list insel)
|
||||
^- (unit (list insel))
|
||||
=/ rng ~(. og eny)
|
||||
=/ target (add target-value (mul feyb base-weight)) :: add base fees to target
|
||||
=| [select=(list insel) total=sats:bc]
|
||||
|-
|
||||
?: =(~ is) ~
|
||||
=^ n rng (rads:rng (lent is))
|
||||
=/ i=insel (snag n is)
|
||||
?. (spendable utxo.i)
|
||||
$(is (oust [n 1] is))
|
||||
=/ net-val (net-value value.utxo.i)
|
||||
=? select (gth net-val 0)
|
||||
[i select]
|
||||
=/ new-total (add total net-val)
|
||||
?: (gte new-total target) `select
|
||||
%= $
|
||||
is (oust [n 1] is)
|
||||
total new-total
|
||||
==
|
||||
::
|
||||
--
|
||||
::
|
||||
::
|
||||
:: Formerly lib/btc-provider
|
||||
::
|
||||
::
|
||||
++ from-epoch
|
||||
|= secs=@ud
|
||||
^- (unit @da)
|
||||
?: =(0 secs) ~
|
||||
[~ (add ~1970.1.1 `@dr`(mul secs ~s1))]
|
||||
::
|
||||
++ get-request
|
||||
|= url=@t
|
||||
^- request:http
|
||||
[%'GET' url ~ ~]
|
||||
::
|
||||
++ post-request
|
||||
|= [url=@t body=json]
|
||||
^- request:http
|
||||
:* %'POST'
|
||||
url
|
||||
~[['Content-Type' 'application/json']]
|
||||
=, html
|
||||
%- some
|
||||
%- as-octt:mimes
|
||||
(en-json body)
|
||||
==
|
||||
::
|
||||
++ gen-request
|
||||
|= [=host-info:bp ract=action:rpc-types:bp]
|
||||
^- request:http
|
||||
%+ rpc-action-to-http
|
||||
api-url.host-info ract
|
||||
::
|
||||
++ rpc
|
||||
=, dejs:format
|
||||
|%
|
||||
++ parse-result
|
||||
|= res=response:json-rpc
|
||||
|^ ^- result:rpc-types:bp
|
||||
~| -.res
|
||||
?> ?=(%result -.res)
|
||||
?+ id.res ~|([%unsupported-result id.res] !!)
|
||||
%get-address-info
|
||||
[id.res (address-info res.res)]
|
||||
::
|
||||
%get-tx-vals
|
||||
[id.res (tx-vals res.res)]
|
||||
::
|
||||
%get-raw-tx
|
||||
[id.res (raw-tx res.res)]
|
||||
::
|
||||
%broadcast-tx
|
||||
[%broadcast-tx (broadcast-tx res.res)]
|
||||
::
|
||||
%get-block-count
|
||||
[id.res (ni res.res)]
|
||||
::
|
||||
%get-block-info
|
||||
[id.res (block-info res.res)]
|
||||
::
|
||||
%get-histogram
|
||||
[id.res ((ar (ar ni)) res.res)]
|
||||
::
|
||||
%get-block-headers
|
||||
[id.res (block-headers res.res)]
|
||||
::
|
||||
%get-tx-from-pos
|
||||
[id.res (tx-from-pos res.res)]
|
||||
::
|
||||
%get-fee
|
||||
[id.res (ne res.res)]
|
||||
::
|
||||
%update-psbt
|
||||
[id.res (so res.res)]
|
||||
==
|
||||
::
|
||||
++ address-info
|
||||
%- ot
|
||||
:~ [%address (cu from-cord:adr:bc so)]
|
||||
[%utxos (as utxo)]
|
||||
[%used bo]
|
||||
[%block ni]
|
||||
==
|
||||
++ utxo
|
||||
%- ot
|
||||
:~ ['tx_pos' ni]
|
||||
['tx_hash' (cu from-cord:hxb:bcu so)]
|
||||
[%height ni]
|
||||
[%value ni]
|
||||
[%recvd (cu from-epoch ni)]
|
||||
==
|
||||
++ tx-vals
|
||||
%- ot
|
||||
:~ [%included bo]
|
||||
[%txid (cu from-cord:hxb:bcu so)]
|
||||
[%confs ni]
|
||||
[%recvd (cu from-epoch ni)]
|
||||
[%inputs (ar tx-val)]
|
||||
[%outputs (ar tx-val)]
|
||||
==
|
||||
++ tx-val
|
||||
%- ot
|
||||
:~ [%txid (cu from-cord:hxb:bcu so)]
|
||||
[%pos ni]
|
||||
[%address (cu from-cord:adr:bc so)]
|
||||
[%value ni]
|
||||
==
|
||||
++ raw-tx
|
||||
%- ot
|
||||
:~ [%txid (cu from-cord:hxb:bcu so)]
|
||||
[%rawtx (cu from-cord:hxb:bcu so)]
|
||||
==
|
||||
++ broadcast-tx
|
||||
%- ot
|
||||
:~ [%txid (cu from-cord:hxb:bcu so)]
|
||||
[%broadcast bo]
|
||||
[%included bo]
|
||||
==
|
||||
++ block-info
|
||||
%- ot
|
||||
:~ [%block ni]
|
||||
[%fee (mu ni)]
|
||||
[%blockhash (cu from-cord:hxb:bcu so)]
|
||||
[%blockfilter (cu from-cord:hxb:bcu so)]
|
||||
==
|
||||
++ block-headers
|
||||
%- ot
|
||||
:~ [%count ni]
|
||||
[%hex (cu from-cord:hxb:bcu so)]
|
||||
[%max ni]
|
||||
[%root (cu:dejs-soft:format from-cord:hxb:bcu so:dejs-soft:format)]
|
||||
[%branch (ar (cu from-cord:hxb:bcu so))]
|
||||
==
|
||||
++ tx-from-pos
|
||||
%- ot
|
||||
:~ [%tx-hash (cu from-cord:hxb:bcu so)]
|
||||
[%merkle (ar (cu from-cord:hxb:bcu so))]
|
||||
==
|
||||
--
|
||||
--
|
||||
::
|
||||
++ rpc-action-to-http
|
||||
|= [endpoint=@t ract=action:rpc-types:bp]
|
||||
=, enjs:format
|
||||
|^ ^- request:http
|
||||
?- -.ract
|
||||
%get-address-info
|
||||
%- get-request
|
||||
%+ mk-url '/addresses/info/'
|
||||
(to-cord:adr:bc address.ract)
|
||||
::
|
||||
%get-tx-vals
|
||||
%- get-request
|
||||
%+ mk-url '/gettxvals/'
|
||||
(to-cord:hxb:bcu txid.ract)
|
||||
::
|
||||
%get-raw-tx
|
||||
%- get-request
|
||||
%+ mk-url '/getrawtx/'
|
||||
(to-cord:hxb:bcu txid.ract)
|
||||
::
|
||||
%broadcast-tx
|
||||
%- get-request
|
||||
%+ mk-url '/broadcasttx/'
|
||||
(to-cord:hxb:bcu rawtx.ract)
|
||||
::
|
||||
%get-block-count
|
||||
%- get-request
|
||||
(mk-url '/getblockcount' '')
|
||||
::
|
||||
%get-block-info
|
||||
=/ param=@t
|
||||
?~(block.ract '' (rsh [3 2] (scot %ui u.block.ract)))
|
||||
%- get-request
|
||||
(mk-url '/getblockinfo/' param)
|
||||
::
|
||||
%get-histogram
|
||||
%- get-request
|
||||
(mk-url '/feehistogram' '')
|
||||
::
|
||||
%get-block-headers
|
||||
%+ post-request
|
||||
%+ mk-url '/blockheaders' ''
|
||||
%- pairs
|
||||
:~ [%start (numb start.ract)]
|
||||
[%count (numb count.ract)]
|
||||
[%cp (numb (fall cp.ract 0))]
|
||||
==
|
||||
::
|
||||
%get-tx-from-pos
|
||||
%+ post-request
|
||||
%+ mk-url '/txfrompos' ''
|
||||
%- pairs
|
||||
:~ [%height (numb height.ract)]
|
||||
[%pos (numb pos.ract)]
|
||||
[%merkle %b merkle.ract]
|
||||
==
|
||||
::
|
||||
%get-fee
|
||||
%- get-request
|
||||
%+ mk-url '/estimatefee/'
|
||||
%- crip
|
||||
%+ scow %ud block.ract
|
||||
::
|
||||
%update-psbt
|
||||
%- get-request
|
||||
%+ mk-url '/updatepsbt/'
|
||||
%- en:base64:mimes:html [(lent (trip psbt.ract)) psbt.ract]
|
||||
==
|
||||
++ mk-url
|
||||
|= [base=@t params=@t]
|
||||
%^ cat 3
|
||||
(cat 3 endpoint base) params
|
||||
--
|
||||
:: RPC/HTTP Utilities
|
||||
::
|
||||
++ httr-to-rpc-response
|
||||
|= hit=httr:eyre
|
||||
^- response:json-rpc
|
||||
~| hit
|
||||
=/ jon=json (need (de-json:html q:(need r.hit)))
|
||||
?. =(%2 (div p.hit 100))
|
||||
(parse-rpc-error jon)
|
||||
=, dejs-soft:format
|
||||
^- response:json-rpc
|
||||
=; dere
|
||||
=+ res=((ar dere) jon)
|
||||
?~ res (need (dere jon))
|
||||
[%batch u.res]
|
||||
|= jon=json
|
||||
^- (unit response:json-rpc)
|
||||
=/ res=[id=(unit @t) res=(unit json) err=(unit json)]
|
||||
%. jon
|
||||
=, dejs:format
|
||||
=- (ou -)
|
||||
:~ ['id' (uf ~ (mu so))]
|
||||
['result' (uf ~ (mu same))]
|
||||
['error' (uf ~ (mu same))]
|
||||
==
|
||||
?: ?=([^ * ~] res)
|
||||
`[%result [u.id.res ?~(res.res ~ u.res.res)]]
|
||||
~| jon
|
||||
`(parse-rpc-error jon)
|
||||
::
|
||||
++ get-rpc-response
|
||||
|= response=client-response:iris
|
||||
^- response:json-rpc
|
||||
?> ?=(%finished -.response)
|
||||
%- httr-to-rpc-response
|
||||
%+ to-httr:iris
|
||||
response-header.response
|
||||
full-file.response
|
||||
::
|
||||
++ parse-rpc-error
|
||||
|= =json
|
||||
^- response:json-rpc
|
||||
:- %error
|
||||
?~ json ['' '' '']
|
||||
%. json
|
||||
=, dejs:format
|
||||
=- (ou -)
|
||||
:~ =- ['id' (uf '' (cu - (mu so)))]
|
||||
|*(a=(unit) ?~(a '' u.a))
|
||||
:- 'error'
|
||||
=- (uf ['' ''] -)
|
||||
=- (cu |*(a=(unit) ?~(a ['' ''] u.a)) (mu (ou -)))
|
||||
:~ ['code' (uf '' no)]
|
||||
['message' (uf '' so)]
|
||||
== ==
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/cram.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/dbug.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/default-agent.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/der.hoon
|
@ -1 +0,0 @@
|
||||
../../garden-dev/lib/docket.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/ethereum.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/ethio.hoon
|
@ -1,451 +0,0 @@
|
||||
/- *group, sur=group-store
|
||||
/+ resource
|
||||
^?
|
||||
=< [. sur]
|
||||
=, sur
|
||||
|%
|
||||
::
|
||||
++ dekebab
|
||||
|= str=cord
|
||||
^- cord
|
||||
=- (fall - str)
|
||||
%+ rush str
|
||||
=/ name
|
||||
%+ cook
|
||||
|= part=tape
|
||||
^- tape
|
||||
?~ part part
|
||||
:- (sub i.part 32)
|
||||
t.part
|
||||
(star low)
|
||||
%+ cook
|
||||
(cork (bake zing (list tape)) crip)
|
||||
;~(plug (star low) (more hep name))
|
||||
::
|
||||
++ enkebab
|
||||
|= str=cord
|
||||
^- cord
|
||||
~| str
|
||||
=- (fall - str)
|
||||
%+ rush str
|
||||
=/ name
|
||||
%+ cook
|
||||
|= part=tape
|
||||
^- tape
|
||||
?~ part part
|
||||
:- (add i.part 32)
|
||||
t.part
|
||||
;~(plug hig (star low))
|
||||
%+ cook
|
||||
|=(a=(list tape) (crip (zing (join "-" a))))
|
||||
;~(plug (star low) (star name))
|
||||
|
||||
++ migrate-path-map
|
||||
|* map=(map path *)
|
||||
=/ keys=(list path)
|
||||
(skim ~(tap in ~(key by map)) |=(=path =('~' (snag 0 path))))
|
||||
|-
|
||||
?~ keys
|
||||
map
|
||||
=* key i.keys
|
||||
?> ?=(^ key)
|
||||
=/ value
|
||||
(~(got by map) key)
|
||||
=. map
|
||||
(~(put by map) t.key value)
|
||||
=. map
|
||||
(~(del by map) key)
|
||||
$(keys t.keys, map (~(put by map) t.key value))
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
++ frond
|
||||
|= [p=@t q=json]
|
||||
^- json
|
||||
(frond:enjs:format (dekebab p) q)
|
||||
++ pairs
|
||||
|= a=(list [p=@t q=json])
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
%+ turn a
|
||||
|= [p=@t q=json]
|
||||
^- [@t json]
|
||||
[(dekebab p) q]
|
||||
::
|
||||
++ update
|
||||
|= =^update
|
||||
^- json
|
||||
%+ frond -.update
|
||||
?- -.update
|
||||
%add-group (add-group update)
|
||||
%add-members (add-members update)
|
||||
%add-tag (add-tag update)
|
||||
%remove-members (remove-members update)
|
||||
%remove-tag (remove-tag update)
|
||||
%initial (initial update)
|
||||
%initial-group (initial-group update)
|
||||
%remove-group (remove-group update)
|
||||
%change-policy (change-policy update)
|
||||
%expose (expose update)
|
||||
==
|
||||
::
|
||||
++ initial-group
|
||||
|= =^update
|
||||
?> ?=(%initial-group -.update)
|
||||
%- pairs
|
||||
:~ resource+(enjs:resource resource.update)
|
||||
group+(group group.update)
|
||||
==
|
||||
::
|
||||
++ initial
|
||||
|= =^initial
|
||||
?> ?=(%initial -.initial)
|
||||
%- pairs
|
||||
^- (list [@t json])
|
||||
%+ turn
|
||||
~(tap by groups.initial)
|
||||
|= [rid=resource grp=^group]
|
||||
^- [@t json]
|
||||
:_ (group grp)
|
||||
(enjs-path:resource rid)
|
||||
::
|
||||
++ group
|
||||
|= =^group
|
||||
^- json
|
||||
%- pairs
|
||||
:~ members+(set ship members.group)
|
||||
policy+(policy policy.group)
|
||||
tags+(tags tags.group)
|
||||
hidden+b+hidden.group
|
||||
==
|
||||
::
|
||||
++ rank
|
||||
|= =rank:title
|
||||
^- json
|
||||
[%s rank]
|
||||
++ tags
|
||||
|= =^tags
|
||||
^- json
|
||||
%- pairs
|
||||
%+ turn ~(tap by tags)
|
||||
|= [=^tag ships=(^set ^ship)]
|
||||
^- [@t json]
|
||||
:_ (set ship ships)
|
||||
?@ tag tag
|
||||
;: (cury cat 3)
|
||||
app.tag '\\'
|
||||
tag.tag '\\'
|
||||
(enjs-path:resource resource.tag)
|
||||
==
|
||||
::
|
||||
++ set
|
||||
|* [item=$-(* json) sit=(^set)]
|
||||
^- json
|
||||
:- %a
|
||||
%+ turn
|
||||
~(tap in sit)
|
||||
item
|
||||
::
|
||||
++ tag
|
||||
|= =^tag
|
||||
^- json
|
||||
?@ tag
|
||||
(frond %tag s+tag)
|
||||
%- pairs
|
||||
:~ app+s+app.tag
|
||||
tag+s+tag.tag
|
||||
resource+s+(enjs-path:resource resource.tag)
|
||||
==
|
||||
::
|
||||
++ policy
|
||||
|= =^policy
|
||||
%+ frond -.policy
|
||||
%- pairs
|
||||
?- -.policy
|
||||
%invite
|
||||
:~ pending+(set ship pending.policy)
|
||||
==
|
||||
%open
|
||||
:~ banned+(set ship banned.policy)
|
||||
ban-ranks+(set rank ban-ranks.policy)
|
||||
==
|
||||
==
|
||||
++ policy-diff
|
||||
|= =diff:^policy
|
||||
%+ frond -.diff
|
||||
|^
|
||||
?- -.diff
|
||||
%invite (invite +.diff)
|
||||
%open (open +.diff)
|
||||
%replace (policy +.diff)
|
||||
==
|
||||
++ open
|
||||
|= =diff:open:^policy
|
||||
%+ frond -.diff
|
||||
?- -.diff
|
||||
%allow-ranks (set rank ranks.diff)
|
||||
%ban-ranks (set rank ranks.diff)
|
||||
%allow-ships (set ship ships.diff)
|
||||
%ban-ships (set ship ships.diff)
|
||||
==
|
||||
++ invite
|
||||
|= =diff:invite:^policy
|
||||
%+ frond -.diff
|
||||
?- -.diff
|
||||
%add-invites (set ship invitees.diff)
|
||||
%remove-invites (set ship invitees.diff)
|
||||
==
|
||||
--
|
||||
::
|
||||
++ expose
|
||||
|= =^update
|
||||
^- json
|
||||
?> ?=(%expose -.update)
|
||||
(frond %resource (enjs:resource resource.update))
|
||||
::
|
||||
++ remove-group
|
||||
|= =^update
|
||||
^- json
|
||||
?> ?=(%remove-group -.update)
|
||||
(frond %resource (enjs:resource resource.update))
|
||||
::
|
||||
++ add-group
|
||||
|= =action
|
||||
^- json
|
||||
?> ?=(%add-group -.action)
|
||||
%- pairs
|
||||
:~ resource+(enjs:resource resource.action)
|
||||
policy+(policy policy.action)
|
||||
hidden+b+hidden.action
|
||||
==
|
||||
::
|
||||
++ add-members
|
||||
|= =action
|
||||
^- json
|
||||
?> ?=(%add-members -.action)
|
||||
%- pairs
|
||||
:~ resource+(enjs:resource resource.action)
|
||||
ships+(set ship ships.action)
|
||||
==
|
||||
::
|
||||
++ remove-members
|
||||
|= =action
|
||||
^- json
|
||||
?> ?=(%remove-members -.action)
|
||||
%- pairs
|
||||
:~ resource+(enjs:resource resource.action)
|
||||
ships+(set ship ships.action)
|
||||
==
|
||||
::
|
||||
++ add-tag
|
||||
|= =action
|
||||
^- json
|
||||
?> ?=(%add-tag -.action)
|
||||
%- pairs
|
||||
^- (list [p=@t q=json])
|
||||
:~ resource+(enjs:resource resource.action)
|
||||
tag+(tag tag.action)
|
||||
ships+(set ship ships.action)
|
||||
==
|
||||
::
|
||||
++ remove-tag
|
||||
|= =action
|
||||
^- json
|
||||
?> ?=(%remove-tag -.action)
|
||||
%- pairs
|
||||
:~ resource+(enjs:resource resource.action)
|
||||
tag+(tag tag.action)
|
||||
ships+(set ship ships.action)
|
||||
==
|
||||
::
|
||||
++ change-policy
|
||||
|= =action
|
||||
^- json
|
||||
?> ?=(%change-policy -.action)
|
||||
%- pairs
|
||||
:~ resource+(enjs:resource resource.action)
|
||||
diff+(policy-diff diff.action)
|
||||
==
|
||||
--
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
|%
|
||||
::
|
||||
++ ruk-jon
|
||||
|= [a=(map @t json) b=$-(@t @t)]
|
||||
^+ a
|
||||
=- (malt -)
|
||||
|-
|
||||
^- (list [@t json])
|
||||
?~ a ~
|
||||
:- [(b p.n.a) q.n.a]
|
||||
%+ weld
|
||||
$(a l.a)
|
||||
$(a r.a)
|
||||
::
|
||||
++ of
|
||||
|* wer=(pole [cord fist])
|
||||
|= jon=json
|
||||
?> ?=([%o [@ *] ~ ~] jon)
|
||||
|-
|
||||
?- wer
|
||||
:: [[key=@t wit=*] t=*]
|
||||
[[key=@t *] t=*]
|
||||
=> .(wer [[* wit] *]=wer)
|
||||
?: =(key.wer (enkebab p.n.p.jon))
|
||||
[key.wer ~|(val+q.n.p.jon (wit.wer q.n.p.jon))]
|
||||
?~ t.wer ~|(bad-key+p.n.p.jon !!)
|
||||
((of t.wer) jon)
|
||||
==
|
||||
++ ot
|
||||
|* wer=(pole [cord fist])
|
||||
|= jon=json
|
||||
~| jon
|
||||
%- (ot-raw:dejs:format wer)
|
||||
?> ?=(%o -.jon)
|
||||
(ruk-jon p.jon enkebab)
|
||||
::
|
||||
++ update
|
||||
^- $-(json ^update)
|
||||
|= jon=json
|
||||
^- ^update
|
||||
%. jon
|
||||
%- of
|
||||
:~
|
||||
add-group+add-group
|
||||
add-members+add-members
|
||||
remove-members+remove-members
|
||||
add-tag+add-tag
|
||||
remove-tag+remove-tag
|
||||
change-policy+change-policy
|
||||
remove-group+remove-group
|
||||
expose+expose
|
||||
==
|
||||
++ rank
|
||||
|= =json
|
||||
^- rank:title
|
||||
?> ?=(%s -.json)
|
||||
?: =('czar' p.json) %czar
|
||||
?: =('king' p.json) %king
|
||||
?: =('duke' p.json) %duke
|
||||
?: =('earl' p.json) %earl
|
||||
?: =('pawn' p.json) %pawn
|
||||
!!
|
||||
++ tag
|
||||
|= =json
|
||||
^- ^tag
|
||||
?> ?=(%o -.json)
|
||||
?. (~(has by p.json) 'app')
|
||||
=/ tag-json
|
||||
(~(got by p.json) 'tag')
|
||||
?> ?=(%s -.tag-json)
|
||||
?: =('admin' p.tag-json) %admin
|
||||
?: =('moderator' p.tag-json) %moderator
|
||||
?: =('janitor' p.tag-json) %janitor
|
||||
!!
|
||||
%. json
|
||||
%- ot
|
||||
:~ app+so
|
||||
resource+dejs-path:resource
|
||||
tag+so
|
||||
==
|
||||
|
||||
:: move to zuse also
|
||||
++ oj
|
||||
|* =fist
|
||||
^- $-(json (jug cord _(fist *json)))
|
||||
(om (as fist))
|
||||
++ tags
|
||||
^- $-(json ^tags)
|
||||
*$-(json ^tags)
|
||||
:: TODO: move to zuse
|
||||
++ ship
|
||||
(su ;~(pfix sig fed:ag))
|
||||
++ policy
|
||||
^- $-(json ^policy)
|
||||
%- of
|
||||
:~ invite+invite-policy
|
||||
open+open-policy
|
||||
==
|
||||
++ invite-policy
|
||||
%- ot
|
||||
:~ pending+(as ship)
|
||||
==
|
||||
++ open-policy
|
||||
%- ot
|
||||
:~ ban-ranks+(as rank)
|
||||
banned+(as ship)
|
||||
==
|
||||
++ open-policy-diff
|
||||
%- of
|
||||
:~ allow-ranks+(as rank)
|
||||
allow-ships+(as ship)
|
||||
ban-ranks+(as rank)
|
||||
ban-ships+(as ship)
|
||||
==
|
||||
++ invite-policy-diff
|
||||
%- of
|
||||
:~ add-invites+(as ship)
|
||||
remove-invites+(as ship)
|
||||
==
|
||||
++ policy-diff
|
||||
^- $-(json diff:^policy)
|
||||
%- of
|
||||
:~ invite+invite-policy-diff
|
||||
open+open-policy-diff
|
||||
replace+policy
|
||||
==
|
||||
::
|
||||
++ remove-group
|
||||
|= =json
|
||||
^- [resource ~]
|
||||
?> ?=(%o -.json)
|
||||
=/ rid=resource
|
||||
(dejs:resource (~(got by p.json) 'resource'))
|
||||
[rid ~]
|
||||
::
|
||||
++ expose
|
||||
|= =json
|
||||
^- [resource ~]
|
||||
?> ?=(%o -.json)
|
||||
=/ rid=resource
|
||||
(dejs:resource (~(got by p.json) 'resource'))
|
||||
[rid ~]
|
||||
::
|
||||
++ add-group
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
policy+policy
|
||||
hidden+bo
|
||||
==
|
||||
++ add-members
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
ships+(as ship)
|
||||
==
|
||||
++ remove-members
|
||||
^- $-(json [resource (set ^ship)])
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
ships+(as ship)
|
||||
==
|
||||
++ add-tag
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
tag+tag
|
||||
ships+(as ship)
|
||||
==
|
||||
++ remove-tag
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
tag+tag
|
||||
ships+(as ship)
|
||||
==
|
||||
++ change-policy
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
diff+policy-diff
|
||||
==
|
||||
--
|
||||
--
|
@ -1,137 +0,0 @@
|
||||
/- *group
|
||||
/+ store=group-store, resource
|
||||
::
|
||||
|_ =bowl:gall
|
||||
+$ card card:agent:gall
|
||||
::
|
||||
++ is-running
|
||||
.^(? %gu /(scot %p our.bowl)/group-store/(scot %da now.bowl))
|
||||
::
|
||||
++ resource-for-update
|
||||
|= =vase
|
||||
^- (list resource)
|
||||
=/ =update:store !<(update:store vase)
|
||||
?: ?=(%initial -.update)
|
||||
~
|
||||
~[resource.update]
|
||||
::
|
||||
++ scry-for
|
||||
|* [=mold =path]
|
||||
=. path
|
||||
(snoc path %noun)
|
||||
.^ mold
|
||||
%gx
|
||||
(scot %p our.bowl)
|
||||
%group-store
|
||||
(scot %da now.bowl)
|
||||
path
|
||||
==
|
||||
++ scry-tag
|
||||
|= [rid=resource =tag]
|
||||
^- (unit (set ship))
|
||||
=/ group
|
||||
(scry-group rid)
|
||||
?~ group
|
||||
~
|
||||
`(~(gut by tags.u.group) tag ~)
|
||||
::
|
||||
++ scry-group
|
||||
|= rid=resource
|
||||
^- (unit group)
|
||||
%+ scry-for ,(unit group)
|
||||
`path`groups+(en-path:resource rid)
|
||||
::
|
||||
++ scry-groups
|
||||
^- (set resource)
|
||||
.^ ,(set resource)
|
||||
%gy
|
||||
(scot %p our.bowl)
|
||||
%group-store
|
||||
(scot %da now.bowl)
|
||||
/groups
|
||||
==
|
||||
::
|
||||
++ members
|
||||
|= rid=resource
|
||||
^- (set ship)
|
||||
=; =group
|
||||
members.group
|
||||
(fall (scry-group rid) *group)
|
||||
::
|
||||
++ is-member
|
||||
|= [=ship group=resource]
|
||||
^- ?
|
||||
=- (~(has in -) ship)
|
||||
(members group)
|
||||
::
|
||||
++ is-admin
|
||||
|= [=ship group=resource]
|
||||
^- ?
|
||||
=/ tags tags:(fall (scry-group group) *^group)
|
||||
=/ admins=(set ^ship) (~(gut by tags) %admin ~)
|
||||
(~(has in admins) ship)
|
||||
:: +role-for-ship: get role for user
|
||||
::
|
||||
:: Returns ~ if no such group exists or user is not
|
||||
:: a member of the group. Returns [~ ~] if the user
|
||||
:: is a member with no additional role.
|
||||
++ role-for-ship
|
||||
|= [rid=resource =ship]
|
||||
^- (unit (unit role-tag))
|
||||
=/ grp=(unit group)
|
||||
(scry-group rid)
|
||||
?~ grp ~
|
||||
(role-for-ship-with-group u.grp rid ship)
|
||||
::
|
||||
++ role-for-ship-with-group
|
||||
|= [grp=group rid=resource =ship]
|
||||
^- (unit (unit role-tag))
|
||||
=* group grp
|
||||
=* policy policy.group
|
||||
=* tags tags.group
|
||||
=/ admins=(set ^ship)
|
||||
(~(gut by tags) %admin ~)
|
||||
?: (~(has in admins) ship)
|
||||
``%admin
|
||||
=/ mods
|
||||
(~(gut by tags) %moderator ~)
|
||||
?: (~(has in mods) ship)
|
||||
``%moderator
|
||||
=/ janitors
|
||||
(~(gut by tags) %janitor ~)
|
||||
?: (~(has in janitors) ship)
|
||||
``%janitor
|
||||
?: (~(has in members.group) ship)
|
||||
[~ ~]
|
||||
~
|
||||
::
|
||||
++ can-join
|
||||
|= [rid=resource =ship]
|
||||
^- ?
|
||||
%+ scry-for ,?
|
||||
^- path
|
||||
:- %groups
|
||||
(weld (en-path:resource rid) /join/(scot %p ship))
|
||||
::
|
||||
++ get-tagged-ships
|
||||
|= [rid=resource =tag]
|
||||
^- (set ship)
|
||||
=/ grp=(unit group)
|
||||
(scry-group rid)
|
||||
?~ grp ~
|
||||
(get-tagged-ships-with-group u.grp rid tag)
|
||||
::
|
||||
++ get-tagged-ships-with-group
|
||||
|= [grp=group rid=resource =tag]
|
||||
^- (set ship)
|
||||
(~(get ju tags.grp) tag)
|
||||
::
|
||||
++ is-managed
|
||||
|= rid=resource
|
||||
^- ?
|
||||
=/ group=(unit group)
|
||||
(scry-group rid)
|
||||
?~ group %.n
|
||||
!hidden.u.group
|
||||
::
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/jose.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/keygen.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/language-server/build.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/language-server/complete.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/language-server/easy-print.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/language-server/json.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/language-server/parser.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/language-server/rune-snippet.hoon
|
@ -1 +0,0 @@
|
||||
../../garden-dev/lib/mip.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/ph/io.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/lib/ph/util.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/pill.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/pkcs.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/primitive-rsa.hoon
|
@ -1,57 +0,0 @@
|
||||
/- sur=resource
|
||||
=< resource
|
||||
|%
|
||||
+$ resource resource:sur
|
||||
++ en-path
|
||||
|= =resource
|
||||
^- path
|
||||
~[%ship (scot %p entity.resource) name.resource]
|
||||
::
|
||||
++ de-path
|
||||
|= =path
|
||||
^- resource
|
||||
(need (de-path-soft path))
|
||||
::
|
||||
++ de-path-soft
|
||||
|= =path
|
||||
^- (unit resource)
|
||||
?. ?=([%ship @ @ *] path)
|
||||
~
|
||||
=/ ship
|
||||
(slaw %p i.t.path)
|
||||
?~ ship
|
||||
~
|
||||
`[u.ship i.t.t.path]
|
||||
::
|
||||
++ enjs
|
||||
|= =resource
|
||||
^- json
|
||||
=, enjs:format
|
||||
%- pairs
|
||||
:~ ship+(ship entity.resource)
|
||||
name+s+name.resource
|
||||
==
|
||||
::
|
||||
++ enjs-path
|
||||
|= =resource
|
||||
%- spat
|
||||
(en-path resource)
|
||||
::
|
||||
++ dejs-path
|
||||
%- su:dejs:format
|
||||
;~ pfix
|
||||
(jest '/ship/')
|
||||
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
|
||||
==
|
||||
::
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
^- $-(json resource)
|
||||
|= jon=json
|
||||
~| dejs+%resource
|
||||
%. jon
|
||||
%- ot
|
||||
:~ ship+(su ;~(pfix sig fed:ag))
|
||||
name+so
|
||||
==
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/ring.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/server.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/shoe.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/skeleton.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/sole.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/strand.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/strandio.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/test.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/lib/verb.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/belt.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/bill.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/blit.hoon
|
@ -1,12 +0,0 @@
|
||||
/- *btc-provider
|
||||
|_ act=action
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun act
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun action
|
||||
--
|
||||
--
|
@ -1,14 +0,0 @@
|
||||
/- *btc-provider
|
||||
/+ bitcoin-json
|
||||
|_ sta=status
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun sta
|
||||
++ json (status:enjs:bitcoin-json sta)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun status
|
||||
--
|
||||
--
|
@ -1,12 +0,0 @@
|
||||
/- *btc-provider
|
||||
|_ upd=update
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun upd
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun update
|
||||
--
|
||||
--
|
@ -1,12 +0,0 @@
|
||||
/- *btc-wallet
|
||||
|_ act=action
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun act
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun action
|
||||
--
|
||||
--
|
@ -1,14 +0,0 @@
|
||||
/- *btc-wallet
|
||||
/+ bitcoin-json
|
||||
|_ com=command
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun com
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun command
|
||||
++ json command:dejs:bitcoin-json
|
||||
--
|
||||
--
|
@ -1,12 +0,0 @@
|
||||
/- *btc-wallet
|
||||
|_ intr=internal
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun intr
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun internal
|
||||
--
|
||||
--
|
@ -1,14 +0,0 @@
|
||||
/- *btc-wallet
|
||||
/+ bitcoin-json
|
||||
|_ upd=update
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun upd
|
||||
++ json (update:enjs:bitcoin-json upd)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun update
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../garden-dev/mar/docket-0.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/hoon.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/htm.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/html.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/httr.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/hymn.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/js.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/json.hoon
|
@ -1 +0,0 @@
|
||||
../../../../base-dev/mar/json/rpc/response.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/kelvin.hoon
|
@ -1 +0,0 @@
|
||||
../../../../base-dev/mar/language-server/rpc/notification.hoon
|
@ -1 +0,0 @@
|
||||
../../../../base-dev/mar/language-server/rpc/request.hoon
|
@ -1 +0,0 @@
|
||||
../../../../base-dev/mar/language-server/rpc/response.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/mime.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/noun.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/path.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/png.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/purl.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/ship.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/mar/sole/action.hoon
|
@ -1 +0,0 @@
|
||||
../../../base-dev/mar/sole/effect.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/svg.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/tang.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/tape.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/txt-diff.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/txt.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/udon.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/umd.hoon
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/urb.hoon
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user