0xPolygonMiden / miden-client

Client library that facilitates interaction with the Miden rollup
MIT License
32 stars 27 forks source link

Support default accounts #233

Closed igamigo closed 4 months ago

igamigo commented 5 months ago

Create a command for supporting default accounts on the CLI. That is, setting an account against which every transaction will be executed (and it would not have to be specified as a parameter). As part of this we should also refactor commands to always take the executor account as the first parameter instead of it depending on the transaction type (right now, mint and p2id utilize different ordering of parameters)

mFragaBA commented 4 months ago

small consideration, what happens for commands that take 2 or more accounts (e.g mint/p2id/p2idr)? should it be used as a default for both values? That is:

Now the account args should be with flags rather than positional. For example, suppose the default account id is 0x0123456789 and we want to do a transfer to 0x9876543210 of an asset from a faucet with id 0x00000001. We'd go from

cargo run --release --features testing,concurrent tx new mint 0x0123456789 0x9876543210 0x00000001 50 --note-type private

to:

cargo run --release --features testing,concurrent tx new mint 50 --target 0x9876543210 --faucet 0x00000001  --note-type private

Should we have one default faucet and one default regular account?

bobbinth commented 4 months ago

I would use default account only as the sender - i.e., if the sender is not provided, we use the default account for it (if one is set).

I do like the idea of using flags to indicate who is the sender and who is the recipient. We could use:

For faucet-related commends, I'm not sure default account should be taken into consideration. So, the mint command would always require --faucet and --target flags.

mFragaBA commented 4 months ago

closing as the PR got merged