Trying to upload a wasm through canister call but it seems that it doesn't want base 64?

This is the code I’m using to create an argument file. It passes but the wasm isn’t in the right format and fails.

Is there a different encoding icp expects of blobs?

echo " \
  (record { owner = principal \"$(dfx identity get-principal)\"}, \
  \"This is a proposal for a WebAssembly module.\", \
  \"My Wasm Proposal\", \
  blob \"$(base64 < "$1")\", \
  null, \
  opt \"Test App Name\")" >> argFile.txt

The IC expects Candid-encoded blobs. I think the easiest way we have right now is to use ic-repl to work with files. Search for file(path) in the docs.

Is that a rust cli tool to do it? Is there any alternative that doesn’t force me to download and install something? I’m trying to use as little dependencies as possible for a tutorial.

I regularly hit that problem too. Let me ask the team what they use for that

I can write a typescript script to do it if that is possible. This is a typescript tutorial so that would be viable.

It’s not base64. Just hex representation of the raw bytes, e.g. blob "\00\61\73\6d\01\00...."

ahh well now I have new problems lol

Error: Failed update call.
Caused by: Failed update call.
  The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type "", content: Request 0xae6fe6aa2858b80968095cd3a380294540048b62b9b5c689200d581cd152faea is too large. Message byte size 3115507 is larger than the max allowed 2097152.

solution to this post is

hex_string=$(xxd -p file.wasm)

# Add slashes between each byte in the hex string
hex_string_with_slashes=$(sed 's/../&\//g; s/.$//' <<< "$hex_string")

You can try to compress the Wasm and provide .wasm.gz blob.