Replies: 1 comment 2 replies
-
{
"type": "<command name>"
// additional data will go here
} Alternative proposal
Multicall
NOTE: YAML is used here instead of JSON to make appending easier Preparing a transaction and sending it are two orthogonal responsibilities. Mixing orthogonal responsibilities results in a code duplication (network arguments). multicall-input.yamlinvoke-tx-payload:
contract-address: "0x123"
input:
felt_arg: 1
struct_arg:
key1: 1
key2: 2
invoke-tx-payload:
contract-address: "0x321" transaction.yamltx:
status: "ACCEPTED_ON_L2"
hash: "0x123" |
Beta Was this translation helpful? Give feedback.
-
We plan to introduce an ability to output information from certain commands in JSON, to ease using
Protostar in scripts or IDEs. This feature will follow designs of Terraform
or kubectl / K8s Objects.
Affected commands
protostar build
protostar call
protostar declare
protostar deploy-account
protostar invoke
protostar test
How to turn JSON output on?
protostar declare ... --json
General format of output objects
All affected commands are supposed to output messages on
stdout
as NDJSON, that is:a series of JSON objects, not formatted, separated by newline (
\n
).The
type
field's purpose is to enable validating correct message objects are received on consumerside.
Some commands may skip
type
though, if the returned object comes directly from other source. This will happen, for example, inprotostar call
Most commands will output only one object, but output consumer logic should be prepared to handle
multiple objects in the future.
Any logs or extraneous messages will be routed to
stderr
.The exact shape of message objects for each command is subject for further decisions making.
Multicall
We are also slowly thinking about providing a way to atomically execute multiple transactions via
UDC.
In general this should be possible with SDKs, but we plan to offer simpler interface in Protostar
to ease one-off calls etc.
This proposal has to take into account the future
multicall
command which will do this.Because it is going to be very inconvenient to type multiple multicall commands in a single
protostar
invocation, the plan is to shift towards document-oriented model in this particularcase.
The format of multicall documents should closely follow format of output objects for consistency.
Again, the
type
field is for validation measures.The exact shape of multicall document is subject for future changes.
In the future, it would be nice to introduce interactive user interface/wizard for
multicall
.Beta Was this translation helpful? Give feedback.
All reactions