xJonathanLEI / starkli

Starkli (/ˈstɑːrklaɪ/), a ⚡ blazing ⚡ fast ⚡ CLI tool for Starknet powered by 🦀 starknet-rs 🦀
https://book.starkli.rs
Apache License 2.0
164 stars 47 forks source link

feat: deploying contracts via UDC #1

Closed milancermak closed 1 year ago

milancermak commented 1 year ago

It would be awesome to have a one step deploy command. Basically this new way of deploying using UDC in the CLI.

I think I remember your intention with starkli is to replace the starknet command, so this would be beyond its scope, but I wonder if I can nerd snipe you into doing it regardless 😇

Bonus point: if the command is passed a .cairo file, it would also do the compile & declare steps 💥

xJonathanLEI commented 1 year ago

What I had in mind was for this tool to have at least what starknet has to offer, so that it can become a drop-in replacement in some compatibility mode. But it's certainly meant to do a lot more than that.

Regarding the UDC, yeah this is something I would love to implement. We can technically do it today with the current starknet-rs version (if fact we do that internally in some of our applications), but it's probably better to wait a bit on https://github.com/xJonathanLEI/starknet-rs/issues/232, which I plan to work on very soon.

xJonathanLEI commented 1 year ago

On top of that, I think the immediate goal of this CLI tool would be, instead of becoming the starknet replacement asap, to become a handy command line client for the JSON-RPC protocol. I find it very annoying to do it by hand with curl. I want to do starkli get-transaction 0x..... and it's done.

xJonathanLEI commented 1 year ago

https://github.com/xJonathanLEI/starknet-rs/pull/279 is merged and UDC is now natively supported in starknet-rs. I think the only missing part is loading an account configuration (address, flavor, signer). For starter we can only support single owner account first. Will take a look at how other CLI does this, especially the private key / signer part.

xJonathanLEI commented 1 year ago

Just looked at how the CLI from the official cairo-lang does it. Can't say I like it. It just puts the private key in plain text alongside the account information. I will come up with something different.

Ideally signer and account configuration are decoupled, where the user is free to supply any supported signer:

Let's start with plain text signer support first, and add the keystore part soon.

xJonathanLEI commented 1 year ago

https://github.com/xJonathanLEI/starknet-rs/pull/291 was just merged. It's now possible to use a JSON-RPC client with accounts. We should now finally be ready to implement this.

xJonathanLEI commented 1 year ago

Finally! 6 months after this issue was opened: https://github.com/xJonathanLEI/starkli/commit/9fa855dd590f6fe76bd30bd42f0b8e222003ceec

You can now do:

$ starkli deploy --keystore /path/to/keystore --account /path/to/account CLASS_HASH CTOR_ARG_0 CTOR_ARG_1

It only supports keystore now and there's a lot of temporary code, but it works!

milancermak commented 1 year ago