How to interact with your account address stored objects?

I’m a Smart Contract Engineer coming from Cadence, the programming language used for smart contracts on Flow, learning Move. I believe I figured out by myself the answer to the post, but it didn’t seem trivial to me so I thought it will be worth it to share my guesses so someone with Move experience can confirm I’m on the right track and help me answer a couple of questions I couldn’t find the answer…

First, you will need to get the ID of the object using the RPC API, specifically the suix_getOwnedObjects call, probably filtering by object type.
Then you will build a PTB including as an Input the object you want to interact with, using its ID. My first unsolved question is what the exact syntax for the different object ownerships will be, since the example on PTB features accessing a shared object and I can’t find any docs for it.
In your PTB commands, you will include a MoveCall that will call the public Struct Method you want to use on your object, passing your input object as a parameter to the call. If I’m right on this, it leads to my second question, how to get a reference and a mutable reference to your object when passing the input object as an argument?

Maybe I’m missing something on the big picture about how dapps on Sui are build.
For context I was writing a smart contract implementing a Merkle Mountain Range on Move as a learning project, it was fairly easy to write the test for it thanks to testing_scenario but accomplishing the same steps in a whole dapp seems way more complicated.

Cheers!

3 Likes