Move.

Post

Share your knowledge.

kryptoschain.
Feb 14, 2025
Expert Q&A

How to call `public fun`s from Sui framework using CLI?

Hey folks, I'm trying to call public functions from the Sui framework using the Sui CLI. For instance, if someone transfers an object to me and I don't want it, how can I freeze it? I thought about using sui client call, but I'm having trouble with the module identifier. Is publishing a wrapper package the only way, or is there a CLI command I'm missing?

  • Move CLI
  • Move
0
2
Share
Comments
.

Answers

2
Mister_CocaCola.
Feb 17 2025, 15:37

I actually figured this out using sui client ptb: sui client ptb --move-call 0x2::transfer::public_freeze_object "<0x7a7e054896810bbbe031041ee131137c417fdf8320ba40ec47203e1ab4b8f7e1::example::Sword>" @0xbcb2c3c6b0f67828fce9702115b914414df767a35c8a541413787d0a1e66682e, at least on the testnet. You just need the correct type for the call, although I'm not certain if the key makes it implement a specific trait.

1
Comments
.
tomek.
Feb 17 2025, 15:37

It's possible to call public functions from Sui framework packages via the Sui CLI, but with some limitations. For instance, accessing certain system modules like 0x2 directly isn't fully supported yet. A common workaround is to publish a custom package that wraps the desired function like public_freeze_object, allowing you to call it with your object ID as a parameter. This gives more flexibility. Feel free to reach out if you need help creating this wrapper package!

0
Comments
.

Do you know the answer?

Please log in and share it.

We use cookies to ensure you get the best experience on our website.
More info