Beitrag
Teile dein Wissen.
Xavier.eth260
Mar 17, 2025
Experten Q&A
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
2
2
Teilen
Kommentare
Antworten
2dudley_smith124
Mar 18 2025, 04:59Also 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]
2
Kommentare
Ramirez177
Mar 17 2025, 18:13Im 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
1
Kommentare
Weißt du die Antwort?
Bitte melde dich an und teile sie.