File tree Expand file tree Collapse file tree 7 files changed +89
-0
lines changed
Expand file tree Collapse file tree 7 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 4040 - name : Run tests
4141 run : |
4242 make test
43+ - name : Check examples
44+ run : |
45+ make clean-examples
46+ make examples
47+ git diff --exit-code examples
48+
49+
Original file line number Diff line number Diff line change 11include common.mk
22
3+ EXAMPLES := $(patsubst % .in,% .out,$(wildcard examples/* .in) )
4+
35# Check if Go's linkers flags are set in common.mk and add them as extra flags.
46ifneq ($(GOLDFLAGS ) ,)
57 GO_EXTRA_FLAGS += -ldflags $(GOLDFLAGS)
@@ -13,6 +15,15 @@ build:
1315 @$(ECHO ) " $( MAGENTA) *** Building Go code...$( OFF) "
1416 @$(GO ) build -v -o oasis $(GOFLAGS ) $(GO_EXTRA_FLAGS )
1517
18+ examples : build $(EXAMPLES )
19+
20+ examples/% .out : examples/% .in
21+ @rm -f $@
22+ @scripts/gen_example.sh $< $@
23+
24+ clean-examples :
25+ @rm -f examples/* .out
26+
1627# Format code.
1728fmt :
1829 @$(ECHO ) " $( CYAN) *** Running Go formatters...$( OFF) "
6475# List of targets that are not actual files.
6576.PHONY : \
6677 all build \
78+ examples \
79+ clean-examples \
6780 fmt \
6881 $(lint-targets ) lint \
6982 $(test-targets ) test \
Original file line number Diff line number Diff line change 1+ account deposit 10 test:dave --account test:alice
Original file line number Diff line number Diff line change 1+ You are about to sign the following transaction:
2+ Format: plain
3+ Method: consensus.Deposit
4+ Body:
5+ To: test:dave (oasis1qrk58a6j2qn065m6p06jgjyt032f7qucy5wqeqpt)
6+ Amount: 10.0 TEST
7+ Authorized signer(s):
8+ 1. NcPzNW3YU2T+ugNUtUWtoQnRvbOL9dYSaBfbjHLP1pE= (ed25519)
9+ Nonce: 0
10+ Fee:
11+ Amount: 0.001131 TEST
12+ Gas limit: 11310
13+ (gas price: 0.0000001 TEST per gas unit)
14+
15+ Network: testnet
16+ ParaTime: sapphire
17+ Account: test:alice
Original file line number Diff line number Diff line change 1+ CLI for interacting with the Oasis network
2+
3+ Usage:
4+ oasis [command]
5+
6+ Available Commands:
7+ account Account operations
8+ addressbook Manage addresses in the local address book
9+ completion Generate the autocompletion script for the specified shell
10+ contract WebAssembly smart contracts operations
11+ help Help about any command
12+ inspect Inspect the network
13+ network Manage network endpoints
14+ paratime Manage paratimes
15+ registry Registry operations
16+ tx Raw transaction operations
17+ wallet Manage accounts in the local wallet
18+
19+ Flags:
20+ --config string config file to use
21+ -h, --help help for oasis
22+ -v, --version version for oasis
23+
24+ Use "oasis [command] --help" for more information about a command.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ OASIS_CMD=./oasis
6+ IN=$1
7+ OUT=$2
8+
9+ # Runs Oasis CLI with command line arguments passed as $1 and stores output
10+ # to $2. Oasis CLI is automatically terminated when "Sign this transaction"
11+ # occurs on the output.
12+
13+ ${OASIS_CMD} $( cat $IN ) > $OUT &
14+ PID=$!
15+ while ! test -f $OUT || ! grep -q " Sign this transaction" " $OUT " && ps -p ${PID} > /dev/null
16+ do
17+ sleep 0.5
18+ done
19+
20+ kill -9 ${PID} 2& > /dev/null || true
21+
22+ # Trim "Sign this transaction" prompt.
23+ if tail -n 1 $OUT | grep -q " Sign this transaction"
24+ then
25+ head -n -1 $OUT > $OUT .tmp
26+ mv $OUT .tmp $OUT
27+ fi
You can’t perform that action at this time.
0 commit comments