diff --git a/README.md b/README.md index 755c482..5bc9ce8 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,8 @@ Coordinated Upgrade. - A Cadence 1.0 compatible contract serving as an update to your existing contract. Extending our example, if you're staging `A` in address `0x01`, you should have a contract named `A` that is Cadence 1.0 compatible. See the references below for more information on Cadence 1.0 language changes. -- Your contract as a hex string. - - Included in this repo is a Python util to hex-encode your contract which outputs your contract's code as a hex - string. With Python installed, run: - ```sh - python3 ./src/get_code_hex.py - ``` +- Your contract as a hex string. You can get this by running `./hex-encode.sh ` - **be sure to + explicitly state your contract's import addresses!** ### Staging Your Contract Update diff --git a/hex-encode.sh b/hex-encode.sh new file mode 100755 index 0000000..bab6d5e --- /dev/null +++ b/hex-encode.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Check if exactly one argument is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Hex encode the file's contents +cat "$1" | xxd -p | tr -d '\n' + diff --git a/src/get_code_hex.py b/src/get_code_hex.py deleted file mode 100644 index 894fe5b..0000000 --- a/src/get_code_hex.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys - -def get_code_hex(contract_path): - with open(contract_path, "r") as contract_file: - return bytes(contract_file.read(), "UTF-8").hex() - -def main(): - if len(sys.argv) != 2: - print("Usage: python3 get_code_hex.py ") - sys.exit() - print(get_code_hex(sys.argv[1])) - -if __name__ == "__main__": - main() \ No newline at end of file