|
| 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 |
0 commit comments