mirror of
https://github.com/Retropex/knots-startos.git
synced 2025-05-12 19:30:45 +02:00
Merge 5e305ab06b
into 431ecc587c
This commit is contained in:
commit
ea5cc5bc5c
@ -82,6 +82,8 @@ ENV PATH=${BITCOIN_PREFIX}/bin:$PATH
|
||||
COPY --from=bitcoin-core /opt /opt
|
||||
COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \
|
||||
./docker_entrypoint.sh \
|
||||
./actions/getaddress.sh \
|
||||
./actions/getbalance.sh \
|
||||
./actions/reindex.sh \
|
||||
./actions/reindex_chainstate.sh \
|
||||
./actions/prioritise-transaction.sh \
|
||||
|
23
actions/getaddress.sh
Normal file
23
actions/getaddress.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/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
|
||||
|
||||
ADDRESS=$(bitcoin-cli getnewaddress "" "bech32")
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"$ADDRESS\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
27
actions/getbalance.sh
Normal file
27
actions/getbalance.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/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
|
||||
|
||||
TRUSTED=$(bitcoin-cli getbalances | jq -r '.mine.trusted')
|
||||
UNTRUSTED=$(bitcoin-cli getbalances | jq -r '.mine.untrusted_pending')
|
||||
IMMATURE=$(bitcoin-cli getbalances | jq -r '.mine.immature')
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"Your wallet balance: $TRUSTED BTC.
|
||||
Non confirmed balance: $UNTRUSTED BTC.
|
||||
Immanture balance from mining: $IMMATURE BTC.\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
@ -225,6 +225,36 @@ actions:
|
||||
range: "[-1000000,1000000]"
|
||||
default: 0
|
||||
nullable: true
|
||||
getaddress:
|
||||
name: "Get new address"
|
||||
description: "Get a new Bitcoin address."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: getaddress.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
getbalance:
|
||||
name: "Get wallet balance"
|
||||
description: "Get wallet balance."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: getbalance.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
migrations:
|
||||
from:
|
||||
"*":
|
||||
|
Loading…
Reference in New Issue
Block a user