In the SUI Move ts-sdk we have the command
tx.transferObjects([obj], address)
for public_transfer. Is there a command for public_share_object?
In the SUI Move ts-sdk we have the command
tx.transferObjects([obj], address)
for public_transfer. Is there a command for public_share_object?
Since I figured it out (by accident mind you comrades), here is the answer for everybody’s future reference:
myptb.move
module trysui::myptb;
use std::string::{String, utf8};
public struct Item has key, store {
id: UID,
name: String,
}
public struct Shop has key, store {
id: UID,
}
public fun mint(
name: vector<u8>,
ctx: &mut TxContext): (Item, Shop) {
let item = Item {
id: object::new(ctx),
name: utf8(name),
};
let shop = Shop {
id: object::new(ctx),
};
(item, shop)
}
PTB CLI
sui client publish
export PACKAGE=<packageId>
export TSHOP=$PACKAGE::myptb::Shop
touch exec.sh
chmod +x exec.sh
exec.sh
#!/usr/bin/bash
sui client ptb \
--move-call sui::tx_context::sender \
--assign sender \
--move-call $PACKAGE::myptb::mint '"mycats"' \
--assign res \
--assign item res.0 \
--assign shop res.1 \
--transfer-objects [item] sender \
--move-call sui::transfer::public_share_object "<$TSHOP>" shop
and finally
./exec.sh
Works like a dream.