Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

Commit 3ec2c8a

Browse files
devenv: utils: use container based cli (#229)
Signed-off-by: Tyler Baker <[email protected]>
1 parent 9dabedd commit 3ec2c8a

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

devenv/sbtc/bin/sbtc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
docker exec -it sbtc sbtc $@
3+
docker exec -it sbtc sbtc "$@"

devenv/utils/deposit.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ stacks_address=$(source $dir/get_credentials.sh | jq -r '.credentials["1"].stack
1313

1414
amount=$((RANDOM%9000+1000))
1515

16-
json=$(sbtc deposit \
16+
json=$($dir/../sbtc/bin/sbtc deposit \
1717
-w $btc_wif \
1818
-n regtest \
1919
-r $stacks_address \
2020
-a $amount \
2121
-d $btc_p2tr_address \
22-
-u localhost:60401)
22+
-u electrs:60401)
23+
24+
echo $json
2325

2426
if [ $? -ne 0 ]; then
2527
echo 'The deposit failed, did you forget to run "mine_btc.sh"?'
@@ -28,4 +30,6 @@ fi
2830

2931
tx=$(echo -n $json | jq -r .hex)
3032

31-
sbtc broadcast localhost:60401 $tx | jq -r .
33+
echo $tx
34+
35+
$dir/../sbtc/bin/sbtc broadcast electrs:60401 $tx | jq -r .

devenv/utils/get_credentials.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
22

3+
dir="$(dirname "$0")"
4+
35
# Returns the default credentials for the devnet
46

57
mnemonic="twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw"
68

7-
sbtc generate-from -s testnet -b regtest --accounts 2 mnemonic "$mnemonic"
9+
$dir/../sbtc/bin/sbtc generate-from -s testnet -b regtest --accounts 2 mnemonic "$mnemonic"

devenv/utils/mine_btc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ fi
1212

1313
btc_address=$(source $dir/get_credentials.sh | jq -r '.credentials["1"].bitcoin.p2wpkh.address')
1414

15-
bitcoin-cli -rpcconnect=localhost -rpcport=18443 -rpcuser=devnet -rpcpassword=devnet generatetoaddress $num_blocks $btc_address
15+
$dir/../bitcoin/bin/bitcoin-cli generatetoaddress $num_blocks $btc_address

devenv/utils/withdraw.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ stacks_wif=$(source $dir/get_credentials.sh | jq -r '.credentials["1"].stacks.wi
1818
amount=$((RANDOM%1000+1000))
1919
fulfillment_fee=$((RANDOM%1000+1000))
2020

21-
json=$(sbtc withdraw \
21+
json=$($dir/../sbtc/bin/sbtc withdraw \
2222
-w $btc_wif \
2323
-n regtest \
2424
-d $stacks_wif \
2525
-b $btc_address \
2626
-a $amount \
2727
-f $fulfillment_fee \
2828
-p $btc_p2tr_address \
29-
-u localhost:60401)
29+
-u electrs:60401)
3030

3131

3232
if [ $? -ne 0 ]; then
@@ -36,4 +36,4 @@ fi
3636

3737
tx=$(echo -n $json | jq -r .hex)
3838

39-
sbtc broadcast localhost:60401 $tx | jq -r .
39+
$dir/../sbtc/bin/sbtc broadcast electrs:60401 $tx | jq -r .

0 commit comments

Comments
 (0)