generated from moul/gno-hello
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
integrations.lib.sh
executable file
·59 lines (48 loc) · 1.63 KB
/
integrations.lib.sh
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
#!/bin/sh
GNO_WALLET=${GNO_WALLET:-moula}
GNO_HOME=${GNO_HOME:-~/.gno}
GNO_CHAINID=${GNO_CHAINID:-dev}
GNO_REMOTE=${GNO_REMOTE:-localhost:26657}
GNO_PKG_PATH=${GNO_PKG_PATH:-`cat pkgpath.txt`}
PUB_DOMAIN=${PUB_DOMAIN:-test3.gno.land}
PUB_REMOTE=${PUB_REMOTE:-test3.gno.land:36657}
PUB_CHAINID=${PUB_CHAINID:-test3}
GNO_CONTRACT_ENDPOINT=gno.land/${GNO_PKG_PATH}
pre() {
cat > README.md<<EOF
# [${GNO_PKG_PATH}](https://${PUB_DOMAIN}/${GNO_PKG_PATH})
_\`README.md\` generated by "make integration"._
## Examples
EOF
}
post() {
rm -rf .tmp/
cat >> README.md<<EOF
## \`gnodev test\`
\`\`\`console
foo@bar:~\$ gnodev test . --verbose
EOF
( set -e; gnodev test . --verbose; ) 2>&1 | tee -a README.md
cat >> README.md<<EOF
\`\`\`
## How to publish locally
\`\`\`sh
gnokey maketx addpkg "MYWALLET" --deposit "1ugnot" --gas-fee "1ugnot" --gas-wanted "5000000" --broadcast "true" --remote "localhost:26657" --chainid "dev" --pkgpath "${GNO_CONTRACT_ENDPOINT}" --pkgdir "."
\`\`\`
EOF
}
call() {
echo '```console' >> README.md
# simulate a console prompt; max 72 columns
echo "foo@bar:~\$ gnokey maketx call \"MYWALLET\" --gas-fee \"1ugnot\" --broadcast \"true\" --chainid \"${PUB_CHAINID}\" --remote \"${PUB_REMOTE}\" --gas-wanted \"500000\" $@" \
| fold -s -w 70 \
| sed '2,$s/^/> /' \
| sed '$ ! s/$/ \\/' \
>> README.md
(
set -ex
gnokey maketx call "${GNO_WALLET}" --gas-fee 1ugnot --broadcast true --chainid "${GNO_CHAINID}" --remote "${GNO_REMOTE}" --gas-wanted 500000 --home "${GNO_HOME=_HOME}" $@
) | tee -a README.md
echo '```' >> README.md
echo >> README.md
}