To make argument input easier and less error-prone, Starkli supports argument resolution, the process of expanding simple, human-readable input into actual field element arguments expected by the network.
By default, arguments are only parsed as raw field elements, accepting both decimal and hexadecimal representations.
To make arguments expandable, and thus trigger the resolution process, use the format
scheme is one of the supported schemes, and
content is the scheme-specific content.
addr scheme resolves the address name provided as
content into a full address using an address book under the current network ID. As of this writing, the actual address book feature hasn't been implemented, and a hard-coded address book is used instead, which contains only one entry
eth for the
ETH token address.
u256 scheme interprets
content as an unsigned 256-bit integer and resolves into 2 field element arguments for the low and high 128 bits, respectively. This scheme is useful for working with contracts expecting
u256 arguments, such as the standard ERC20 contract.
str scheme encodes
content as Cairo short string.
const scheme uses
content as the key to look up a hard-coded table to commonly used constant values. The current list of constants are:
selector scheme calculates the Starknet Keccak hash for the content to derive the function entryponit.
This scheme is currently the same as
selector, but support for offsets and maps (e.g.
ERC20_balances[0x1234]) might be added in the future to differentiate it.
scheme: prefix is required for opting in to argument resolution. However, there are a few exceptions:
addr:prefix can be omitted when an address is expected;
selector:prefix can be omitted when a selector is expected;
storage:prefix can be omitted in the
As an example, consider the
starkli invoke command. To use the
selector schemes, one would run:
starkli invoke addr:eth selector:transfer ...
However, since the first positional argument for the
starkli invoke is always expected to be an address, and the second one a selector, this command can be simplified into:
starkli invoke eth transfer ...