From 84ff731ebbe39d3bc05f1e9baf1e17c69601be7a Mon Sep 17 00:00:00 2001 From: alenmestrov Date: Mon, 23 Dec 2024 16:36:44 +0100 Subject: [PATCH] fix: fixed getting proxy contract wasm content --- contracts/icp/context-config/deploy_devnet.sh | 31 ++++++++++++++++--- contracts/icp/context-proxy/dfx.json | 7 ++--- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/contracts/icp/context-config/deploy_devnet.sh b/contracts/icp/context-config/deploy_devnet.sh index 69d608d9b..60ff1f17a 100755 --- a/contracts/icp/context-config/deploy_devnet.sh +++ b/contracts/icp/context-config/deploy_devnet.sh @@ -87,11 +87,32 @@ dfx build dfx canister install context_contract --mode=install dfx canister install ledger --mode=install --argument "$LEDGER_INIT_ARG" -# Set proxy code in context config -dfx canister call context_contract set_proxy_code "( - blob \"../context-proxy/res/calimero_context_proxy_icp.wasm\", - principal \"$LEDGER_ID\" -)" +# Get the directory where the script is located +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# Build path relative to the script location +WASM_FILE="${SCRIPT_DIR}/../context-proxy/res/calimero_context_proxy_icp.wasm" + +# Verify file exists +if [ ! -f "$WASM_FILE" ]; then + echo "Error: WASM file not found at: $WASM_FILE" + exit 1 +fi + +# Then modify the script to use a consistent reading method +WASM_CONTENTS=$(xxd -p "$WASM_FILE" | tr -d '\n' | sed 's/\(..\)/\\\1/g') + +TEMP_CMD=$(mktemp) +echo "( + blob \"${WASM_CONTENTS}\", + principal \"${LEDGER_ID}\" +)" > "$TEMP_CMD" + +# Execute the command using the temporary file +dfx canister call context_contract set_proxy_code --argument-file "$TEMP_CMD" + +# Clean up +rm "$TEMP_CMD" # Print all relevant information at the end echo -e "\n=== Deployment Summary ===" diff --git a/contracts/icp/context-proxy/dfx.json b/contracts/icp/context-proxy/dfx.json index da878d82d..1a5ef2754 100644 --- a/contracts/icp/context-proxy/dfx.json +++ b/contracts/icp/context-proxy/dfx.json @@ -20,11 +20,8 @@ }, "networks": { "local": { - "bind": "127.0.0.1:8080", - "type": "persistent", - "replica": { - "subnet_type": "system" - } + "bind": "127.0.0.1:4943", + "type": "persistent" } }, "output_env_file": ".env",