-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtusk.yml
65 lines (61 loc) · 1.64 KB
/
tusk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
interpreter: bash -c
usage: arenactl
options:
launchdir:
default:
command: echo $PWD
walletsdir:
default: .local/dev/wallets
openai-api-key:
default:
command: echo $ARENASTATE_OPENAI_API_KEY
tasks:
fileorvalue:
usage: "echo the value, if value is a file read it from that."
args:
keyorfile:
run:
- command:
exec: |
set -e
if [ -f "${keyorfile}" ]; then
printf "%s" "$(<${keyorfile})"
else
echo -n "${keyorfile}"
fi
named-wallet:
usage: "echo the named private key, don't use with production keys"
args:
name:
options:
address:
type: bool
short: "a"
no-hh-alias:
type: bool
default: false
run:
- command:
exec: |
set -e
! ${no-hh-alias} && [[ "${name}" =~ ^hardhat:.* ]] && echo -n "${name}" && exit 0
WALLETS_DIR=$(cd ${launchdir} && pwd)/${walletsdir}
SUFFIX=.key
${address} && SUFFIX=.addr
[ ! -f ${WALLETS_DIR}/${name}${SUFFIX} ] && echo "${name}${SUFFIX} not found" && exit 1
printf "%s" "$(<${WALLETS_DIR}/${name}${SUFFIX})"
new-wallet:
args:
name:
options:
dir:
default: .local/dev/wallets
run:
- command:
exec: |
set -e
DIR=${dir}
mkdir -p $DIR
cast wallet new > $DIR/${name}.txt
cat $DIR/${name}.txt | egrep "^Address: " | cut -d ' ' -f2 > $DIR/${name}.addr
cat $DIR/${name}.txt | egrep "^Private Key: " | cut -d ' ' -f3 > $DIR/${name}.key