Skip to content

Commit

Permalink
fix: fixed getting proxy contract wasm content
Browse files Browse the repository at this point in the history
  • Loading branch information
alenmestrov committed Dec 23, 2024
1 parent df5b56f commit 84ff731
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
31 changes: 26 additions & 5 deletions contracts/icp/context-config/deploy_devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==="
Expand Down
7 changes: 2 additions & 5 deletions contracts/icp/context-proxy/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 84ff731

Please sign in to comment.