帖子

分享您的知识。

帖子

分享您的知识。

Xavier.eth.
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
分享
评论
.

答案

2
dudley_smith.
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
评论
.
Ramirez.
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答案
Sui.X.Peera.

赚取你的 1000 Sui 份额

获取声誉积分,并因帮助 Sui 社区成长而获得奖励。

奖励活动七月