Beitrag
Teile dein Wissen.
How to assign multiple variables from a tuple in CLI for PTB?
I'm working with the CLI and calling a function 0x2::transfer_policy::confirm_request
that returns a tuple (item, paid, from)
. I want to use these values in a PTB command. How can I assign each element of this tuple to separate variables using CLI?
- Move CLI
- Move
Antworten
2Also nur um nach Ashoks Hinzufügung zu bestätigen, würdest du im PTB-Befehl etwas Ähnliches tun wie:
sui client ptb \
--move-call [...] \
--assign result \
--assign item result.0 \
--assign paid result.1 \
--assign from result.2
[...the rest of the PTB]
Im Moment nicht. Sie können sie individuell zuweisen, indem Sie den Tupelindex verwenden. Zum Beispiel erhalten Sie das Tupel als Ergebnis, sodass Sie einfach jedes Element abrufen und es separat zuweisen können. Das kannst du wie folgt machen:
--assign item result.0
--assign paid result.1
--assign from result.2
Weißt du die Antwort?
Bitte melde dich an und teile sie.
Move is an executable bytecode language used to implement custom transactions and smart contracts.
Verdiene deinen Anteil an 1000 Sui
Sammle Reputationspunkte und erhalte Belohnungen für deine Hilfe beim Wachstum der Sui-Community.

- ... SUI0xduckmove+628
- ... SUIHaGiang+493
- ... SUIharry phan+442
- ... SUIMoonBags+424
- ... SUIBenjamin XDV+378
- ... SUIMeaning.Sui+367
- ... SUI