Below is the script for creating a simple NFT and listing it as a dynamic object field in a shared struct.
module ptb::ptb_einfach;
use std::string::{Self, String};
use sui::dynamic_object_field as dof;
use sui::sui::SUI;
use sui::balance::{Self, Balance};
use sui::coin::{Self, Coin};
const EInsufficientFunds: u64 = 0;
const EIncorrectPayment: u64 = 1;
public struct Shop has key, store {
id: UID,
purse: Balance<SUI>,
}
public struct Item has key, store {
id: UID,
name: String,
price: u64,
}
fun init(ctx: &mut TxContext) {
transfer::public_share_object(Shop {
id: object::new(ctx),
purse: balance::zero(),
});
}
public fun mint(
name: vector<u8>,
price: u64,
ctx: &mut TxContext): Item {
Item {
id: object::new(ctx),
name: string::utf8(name),
price,
}
}
public fun list<T: key + store>(
shop: &mut Shop,
item: T) {
dof::add(&mut shop.id, true, item);
}
I can execute it no problem with the simple CLI but when attempting to replicate with the PTB CLI, I fail to input the type argument when calling the list func. The PTB command is below
#!/usr/bin/bash
sui client ptb \
--move-call $PACKAGE::ptb_einfach::mint '"toulis"' 231 \
--assign item \
--assign shop @$SHOP \
--move-call $PACKAGE::ptb_einfach::list shop item
and the error I get obviously get is
Encountered error when building PTB:
× Error when processing PTB
╭─[4:104]
3 │ --assign shop @0xa58a9351a3c5e9563ea55cfb4688f9c28853fa2068da625f44e37d1adc17a0c5
4 │ --move-call 0xbd09a93fbe5b007fd7771a4fdbece3e710608375212dc256c3bf6b0318b39788::ptb_einfach::list shop item
· ──┬─
· ╰── Not enough type parameters supplied for Move call
What is the appropriate way of inputing the type arg for an item created and assigned in a previous command line?