Publication
Partagez vos connaissances.
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
Réponses
2En fait, je l'ai compris en utilisant sui client ptb
:sui client ptb --move-call 0x2::transfer::public_freeze_object "<0x7a7e054896810bbbe031041ee131137c417fdf8320ba40ec47203e1ab4b8f7e1::example::Sword>" @0xbcb2c3c6b0f67828fce9702115b914414df767a35c8a541413787d0a1e66682e
, au moins sur le testnet. Vous avez juste besoin du type correct pour l'appel, même si je ne suis pas certain key
qu'il implémente un trait spécifique.
Il est possible d'appeler des fonctions publiques à partir de packages Sui Framework via la CLI Sui, mais avec certaines limitations. Par exemple, l'accès direct à certains modules système tels que 0x2 n'est pas encore entièrement pris en charge. Une solution de contournement courante consiste à publier un package personnalisé qui enveloppe la fonction souhaitéepublic_freeze_object
, vous permettant de l'appeler avec votre identifiant d'objet en tant que paramètre. Cela donne plus de flexibilité. N'hésitez pas à nous contacter si vous avez besoin d'aide pour créer ce package d'emballage !
Connaissez-vous la réponse ?
Veuillez vous connecter et la partager.
Move is an executable bytecode language used to implement custom transactions and smart contracts.