-
Notifications
You must be signed in to change notification settings - Fork 3
/
aux.bash
68 lines (63 loc) · 2.27 KB
/
aux.bash
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
66
67
68
function generate-keys {
local WORKDIR=.coop-publisher-cli
local RESOURCES=resources
mkdir $WORKDIR
openssl genrsa -out $WORKDIR/key.pem 2048
openssl req -new -key $WORKDIR/key.pem -out $WORKDIR/certificate.csr
openssl x509 -req -in $WORKDIR/certificate.csr -signkey $WORKDIR/key.pem -out $WORKDIR/certificate.pem -extfile $RESOURCES/ssl-extensions-x509.conf -extensions v3_ca
openssl x509 -text -in $WORKDIR/certificate.pem
}
function coop-mint-fs {
resp=$(grpcurl -insecure -import-path ../coop-proto -proto ../coop-proto/publisher-service.proto -d @ localhost:5080 coop.publisher.Publisher/createMintFsTx <<EOF
{
"fsInfos": [
{
"fsId": "$(echo -ne someidA | base64)",
"gcAfter": {
"extended": "NEG_INF"
}
},
{
"fsId": "$(echo -ne someidB | base64)",
"gcAfter": {
"extended": "NEG_INF"
}
},
{
"fsId": "$(echo -ne someidC | base64)",
"gcAfter": {
"extended": "NEG_INF"
}
}
],
"submitter": {
"base16": "$SUBMITTER_WALLET"
}
}
EOF
)
echo "$resp"
rawTx=$(echo "$resp" | jq '.mintFsTx | .cborHex = .cborBase16 | del(.cborBase16) | .description = "" | .type = "Tx BabbageEra"')
echo "$resp" | jq '.info'
echo "$resp" | jq '.error'
echo "$rawTx" > .coop-publisher-cli/signed
}
function coop-gc-fs {
resp=$(grpcurl -insecure -import-path ../coop-proto -proto ../coop-proto/publisher-service.proto -d @ localhost:5080 coop.publisher.Publisher/createGcFsTx <<EOF
{
"fsIds": ["$(echo -ne someidB | base64)", "$(echo -ne someidA | base64)"],
"submitter": {
"base16": "$SUBMITTER_WALLET"
}
}
EOF
)
rawTx=$(echo "$resp" | jq '.gcFsTx | .cborHex = .cborBase16 | del(.cborBase16) | .description = "" | .type = "Tx BabbageEra"')
echo "$resp" | jq '.info'
echo "$resp" | jq '.error'
echo "$rawTx" > .coop-publisher-cli/signed
}
function run-grpcui {
make-exports
grpcui -insecure -import-path ../coop-proto -proto ../coop-proto/publisher-service.proto localhost:5080
}