Starknet/Cairo function (long)string parameter

80 Views Asked by At

Some internals of Starknet expect some string as the parameter.

error: Plugin diagnostic: selector macro argument must be a string

When heaving inputs serialized into type, which has property of felt252 for shortString (which should be enough) I'm struggling to find way of converting shortString into expected string here.

Q1: What type of the property for selector!() can I specify to make it properly work?

Q2: If above is not possible - is there a way of selecting contract ABI for call_contract_syscall()'s parameter from felt252 string?

1

There are 1 best solutions below

1
On

As it turned out starknet::call_contract_syscall()'s second parameter IS indeed felt252 and the macro selector!() transforms "string" into felt252 shortString. So the answer to my Q2 is to use shortString directly. Q1 is still remain if anyone's looking for that...