Asset canister upload script

There is a CLI: agent-rs/icx-asset at main · dfinity/agent-rs · GitHub


Excellent! Thank you

1 Like

I want to add a npm package making this simple in JS, too


That would also be excellent

1 Like

That’s what I was going to do but I probably won’t now

1 Like

Can it be used locally? Do you know how that would be done? I passed it a local canister id and I get this error:

thread 'main' panicked at 'Could not create HTTP client.: reqwest::Error { kind: Builder, source: "Unknown TLS backend passed to `use_preconfigured_tls`" }', /home/lastmjs/.cargo/registry/src/
1 Like

If you’ve got the time and motivation to write it up, I’m happy to see if we could get you set up with a grant for it!

1 Like

I think I’m running into this issue: chore: update cargo dependencies by ericswanson-dfinity · Pull Request #285 · dfinity/agent-rs · GitHub

1 Like

Ah thanks for the offer, I should really get back to the TypeScript, Python CDKs and Sudograph. I’m taking a slight detour for this:

Checks a lot of boxes for me, Demergence has issues with streaming, easy to pick up too

I got it to work by installing the main branch

I’ve been doing that with a little zsh script, but it sounds like you’re up and running!


Offer is still there? I would be interested to give it a go if I have some help

I’m happy to off guidance if you need it too, @lastmjs on Telegram is best

Thanks I could definitely use some help.
I have a rough idea on where to start by calling the asset canister actor methods, but I have few questions:

1-What is the order of calling these methods or the order of the process? create_batch, commit_batch etc…

2- how do you authorize the actor from within the script? ‘dfx deploy’ do that automatically but I am not sure how to do that manually

I found how to authorize with your private key in here

That was really helpful

mind sharing that @jorgenbuilder ?:slight_smile:

1 Like

For those running into the same issue (I got it from using ic-repl), just make sure to update the Cargo.toml of the binary you’re trying to build like this:

-ic-agent = "0.9.0"
+ic-agent = { git = "" }

I tested it and it works great for local development. Can this be used to upload assets to a canister deployed on mainnet too?

Yes it can:

icx-asset --pem identity.pem --replica upload n6au6-3aaaa-aaaae-qaaxa-cai index.html
1 Like