I am taking my first baby steps with Sui Move, coming from a modest background of Python, NodeJS and some rudimentary Rust. I am trying to create an NFT object Hunter with an added dynamic object field Image which contains the url for the image. My code is as below:
module nft_tutorial::hunt;
use sui::url::{Self, Url};
use sui::dynamic_object_field as ofield;
public struct Hunter has key {
id: UID,
}
public struct Image has key, store {
id: UID,
url: Url,
}
public entry fun create_hunter(ctx: &mut TxContext) {
transfer::transfer(Hunter {
id: object::new(ctx),
}, tx_context::sender(ctx));
}
public entry fun create_image(url: vector, ctx: &mut TxContext) {
transfer::transfer(Image {
id: object::new(ctx),
url: url::new_unsafe_from_bytes(url),
}, tx_context::sender(ctx));
}
public entry fun add_image(hunter: &mut Hunter, image: Image) {
ofield::add(&mut hunter.id, object::id(&image), image);
}
The script publishes OK and the first two entry funs (create_hunter & create_image) are executed properly and create the corresponging objects on SUI Explorer. However, when I attempt to execute the entry fun add_image I am greeted with an inactive window on suiscan where there are the inactive Arg0 and Arg1 (presumambly the UIDs of objects Hunter and Image) and an inactive Execute button. Thus I cannot execute the fun add_image.
I am at a stalemate. Am I doing something wrong or is it a peculiarity of Suiscan? I would greatly appreciate any suggestions.
I thank you in advance.
PS. If you are kind enough to run the whole thing, the please use any available image url.