Skip to content

Commit cf0db7a

Browse files
authored
Merge pull request #765 from input-output-hk/test/mint-handle-localnet
test(e2e): mint handles on localnet start
2 parents acdcfde + 0628ea3 commit cf0db7a

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

packages/e2e/local-network/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Supported OS:
2121
1. Run `./scripts/install.sh` to install necessary binaries.
2222
2. Run `./scripts/make-babbage.sh` to create all the keys, certificates and genesis files.
2323
3. Run `./scrips/start.sh` to start the nodes.
24-
4. Run `export CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-spo1/node.sock` for `cardano-cli` to work.
24+
4. Run `export CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-sp1/node.sock` for `cardano-cli` to work.
2525
5. (Optional) Run `export PATH=$PATH:$PWD/bin` so you can use `cardano-cli` instead of `./bin/cardano-cli`.
2626
6. Check the network: `./bin/cardano-cli query tip --testnet-magic 888`
2727

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
handleNames=("HelloHandle" "TestHandle" "DoubleHandle")
4+
handleHexes=("48656c6c6f48616e646c65" "5465737448616e646c65" "446f75626c6548616e646c65")
5+
6+
cat >network-files/utxo-keys/minting-policy.json <<EOL
7+
{
8+
"keyHash": "$(cardano-cli address key-hash --payment-verification-key-file network-files/utxo-keys/utxo1.vkey)",
9+
"type": "sig"
10+
}
11+
EOL
12+
13+
# Generate the policy ID from the script file and save it
14+
policyid=$(cardano-cli transaction policyid --script-file network-files/utxo-keys/minting-policy.json)
15+
16+
cat >network-files/utxo-keys/handles-metadata.json <<EOL
17+
{ "721":
18+
{"${policyid}":
19+
{
20+
"${handleNames[0]}": {"core": {"og": 0, "prefix": "$", "version": 0, "termsofuse": "https://cardanofoundation.org/en/terms-and-conditions/", "handleEncoding": "utf-8"}, "name": "${handleNames[0]}", "image": "ipfs://some-hash", "website": "https://cardano.org/", "description": "The Handle Standard", "augmentations": []},
21+
"${handleNames[1]}": {"core": {"og": 0, "prefix": "$", "version": 0, "termsofuse": "https://cardanofoundation.org/en/terms-and-conditions/", "handleEncoding": "utf-8"}, "name": "${handleNames[1]}", "image": "ipfs://some-hash", "website": "https://cardano.org/", "description": "The Handle Standard", "augmentations": []},
22+
"${handleNames[2]}": {"core": {"og": 0, "prefix": "$", "version": 0, "termsofuse": "https://cardanofoundation.org/en/terms-and-conditions/", "handleEncoding": "utf-8"}, "name": "${handleNames[2]}", "image": "ipfs://some-hash", "website": "https://cardano.org/", "description": "The Handle Standard", "augmentations": []},
23+
"${handleNames[3]}": {"core": {"og": 0, "prefix": "$", "version": 0, "termsofuse": "https://cardanofoundation.org/en/terms-and-conditions/", "handleEncoding": "utf-8"}, "name": "${handleNames[3]}", "image": "ipfs://some-hash", "website": "https://cardano.org/", "description": "The Handle Standard", "augmentations": []}
24+
}
25+
}}
26+
EOL
27+
28+
29+
addr=$(cardano-cli address build --payment-verification-key-file network-files/utxo-keys/utxo1.vkey --testnet-magic 888)
30+
faucetAddr="addr_test1qqen0wpmhg7fhkus45lyv4wju26cecgu6avplrnm6dgvuk6qel5hu3u3q0fht53ly97yx95hkt56j37ch07pesf6s4pqh5gd4e"
31+
utxo=$(cardano-cli query utxo --address "$addr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}')
32+
33+
tokenList="1 ${policyid}.${handleHexes[0]}+1 ${policyid}.${handleHexes[1]}+2 ${policyid}.${handleHexes[2]}"
34+
35+
cardano-cli transaction build \
36+
--babbage-era \
37+
--change-address "$addr" \
38+
--tx-in "$utxo" \
39+
--tx-out "$faucetAddr"+10000000+"$tokenList" \
40+
--mint "$tokenList" \
41+
--mint-script-file network-files/utxo-keys/minting-policy.json \
42+
--metadata-json-file network-files/utxo-keys/handles-metadata.json \
43+
--testnet-magic 888 \
44+
--out-file handle-tx.raw
45+
46+
cardano-cli transaction sign \
47+
--tx-body-file handle-tx.raw \
48+
--signing-key-file network-files/utxo-keys/utxo1.skey \
49+
--testnet-magic 888 \
50+
--out-file handle-tx.signed
51+
52+
cardano-cli transaction submit --testnet-magic 888 --tx-file handle-tx.signed

packages/e2e/local-network/scripts/mint-tokens.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ done
4747

4848
cardano-cli transaction build \
4949
--babbage-era \
50-
--change-address "$faucetAddr" \
50+
--change-address "$addr" \
5151
--tx-in "$utxo" \
5252
--tx-out "$faucetAddr"+10000000+"$tokenList" \
5353
--mint "$tokenList" \

packages/e2e/local-network/scripts/start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ done
3232
CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-sp1/node.sock ./scripts/plutus-transaction.sh
3333
CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-sp1/node.sock ./scripts/reference-input-transaction.sh
3434
CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-sp1/node.sock ./scripts/mint-tokens.sh
35+
sleep 10
36+
CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-sp1/node.sock ./scripts/mint-handles.sh
3537
CARDANO_NODE_SOCKET_PATH=$PWD/network-files/node-sp1/node.sock ./scripts/setup-wallets.sh
3638

3739
wait

0 commit comments

Comments
 (0)