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

Feature Request: support for the `starkli storage` command write variable name #32

Closed wenzhenxiang closed 11 months ago

wenzhenxiang commented 1 year ago

request support for the starkli storage command, which would allow user to directly write a storage variable name and retrieve its value, doesn't require the user to calculate storage key.

thank you for your great work on starkli!

glihm commented 1 year ago

@wenzhenxiang thanks for the issue and sorry for the delay.

To set a storage value, you must send a transaction that calls a contract, which in turns can modify the storage.

Also, the RPC specification only allows getStorageAt, which is used to read the storage at the given contract address. This is why starkli storage gets the value.

If you need to do so for testing purposes, please check the progess of starknet-foundry where a cheatcode for setting storage manually will be available soon.

@xJonathanLEI can be closed, not in the scope of starkli.

xJonathanLEI commented 1 year ago

I think he means starkli storage ERC20_name.

glihm commented 12 months ago

oh, got you, sorry @wenzhenxiang and thank you @xJonathanLEI. Title was misleading me a bit then. x)

xJonathanLEI commented 11 months ago

Implemented in https://github.com/xJonathanLEI/starkli/commit/d0e96eb9be1cf1107cf3236a467d40ac05e30d80. Will be shipped in the next release.

You can now do:

starkli storage eth ERC20_name

or explicitly:

starkli storage addr:eth storage:ERC20_name