帖子
分享您的知识。
Xavier.eth260
Mar 17, 2025
专家问答
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
分享
评论
答案
2dudley_smith124
Mar 18 2025, 04:59因此,在添加 Ashok 之后,为了确认一下,在 PTB 命令中你会做类似的事情:
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
评论
Ramirez177
Mar 17 2025, 18:13目前不是. 你可以使用元组索引单独分配它们. 例如,你会得到元组作为结果,所以你可以获取每个元素并单独分配它. 您可以按如下方式执行此操作:
--assign item result.0
--assign paid result.1
--assign from result.2
1
评论
你知道答案吗?
请登录并分享。
Move is an executable bytecode language used to implement custom transactions and smart contracts.
148帖子240答案

奖励活动七月
- ... SUI0xduckmove+489
- ... SUIBenjamin XDV+373
- ... SUIharry phan+332
- ... SUI
- ... SUIHaGiang+298
- ... SUIMoonBags+298
- ... SUIThorfin+248