mirror of
https://github.com/Retropex/knots-startos.git
synced 2025-05-12 11:20:46 +02:00
add sendall action
This commit is contained in:
parent
2e7b73f8c7
commit
5dc838cb86
@ -86,6 +86,7 @@ COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \
|
||||
./actions/getbalance.sh \
|
||||
./actions/reindex.sh \
|
||||
./actions/sendcoin.sh \
|
||||
./actions/sendall.sh \
|
||||
./actions/reindex_chainstate.sh \
|
||||
./actions/prioritise-transaction.sh \
|
||||
./check-rpc.sh \
|
||||
|
31
actions/sendall.sh
Normal file
31
actions/sendall.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! bitcoin-cli listwalletdir | jq -e '.wallets[] | select(.name == "coin")' &> /dev/null; then
|
||||
bitcoin-cli createwallet "coin" &> /dev/null
|
||||
fi
|
||||
|
||||
if ! bitcoin-cli getwalletinfo &> /dev/null; then
|
||||
bitcoin-cli loadwallet coin &> /dev/null
|
||||
fi
|
||||
|
||||
cat > input.json
|
||||
ADDRESS=$(jq -r '.["address"]' input.json)
|
||||
|
||||
FEE=$(jq -r '.["fee"]' input.json)
|
||||
if [ $FEE = "null" ]; then
|
||||
FEE="0"
|
||||
fi
|
||||
|
||||
TXID=$(bitcoin-cli -named sendall recipients="[\"$ADDRESS\"]" fee_rate=$FEE | jq -r '.txid')
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"txid: $TXID\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
@ -293,6 +293,36 @@ actions:
|
||||
range: "[0,1000000]"
|
||||
default: 0
|
||||
nullable: false
|
||||
sendall:
|
||||
name: "Send all bitcoin"
|
||||
description: "Send ALL bitcoin in the wallet."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: sendall.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
input-spec:
|
||||
address:
|
||||
type: string
|
||||
name: Address
|
||||
description: "The bitcoin address you want to send your bitcoins."
|
||||
placeholder: ""
|
||||
nullable: false
|
||||
fee:
|
||||
type: number
|
||||
name: Fee (sat/vbytes)
|
||||
description: "The amount of fee you want to pay for this transaction (in sat per vbytes)"
|
||||
integral: false
|
||||
range: "[0,1000000]"
|
||||
default: 0
|
||||
nullable: false
|
||||
migrations:
|
||||
from:
|
||||
"*":
|
||||
|
Loading…
Reference in New Issue
Block a user