Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bindings/go/examples/dev_inspect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func main() {
iotaNamesPackageAddress,
registryModule,
lookupFn,
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("iota_names"), iota_sdk.PtbArgumentRes("name")},
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("iota_names"), iota_sdk.PtbArgumentAssigned("name")},
nil,
[]string{"name_record_opt"},
)
Expand All @@ -102,7 +102,7 @@ func main() {
stdAddress,
optionModule,
borrowFn,
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("name_record_opt")},
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("name_record_opt")},
[]*iota_sdk.TypeTag{iota_sdk.TypeTagNewStruct(nameRecordType)},
[]string{"name_record"},
)
Expand All @@ -112,7 +112,7 @@ func main() {
iotaNamesPackageAddress,
nameRecordModule,
targetAddressFn,
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("name_record")},
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("name_record")},
nil,
[]string{"target_address_opt"},
)
Expand All @@ -122,7 +122,7 @@ func main() {
stdAddress,
optionModule,
borrowFn,
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("target_address_opt")},
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("target_address_opt")},
[]*iota_sdk.TypeTag{iota_sdk.TypeTagNewAddress()},
[]string{"target_address"},
)
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/examples/prepare_send_iota_multi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {

for idx, r := range recipients {
recipient := addrFromHex(r.address)
builder.TransferObjects(recipient, []*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes(labels[idx])})
builder.TransferObjects(recipient, []*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned(labels[idx])})
}

txn, err := builder.Finish()
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/examples/prepare_split_coins/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
)
builder.TransferObjects(
sender,
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("coin1"), iota_sdk.PtbArgumentRes("coin2"), iota_sdk.PtbArgumentRes("coin3")},
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("coin1"), iota_sdk.PtbArgumentAssigned("coin2"), iota_sdk.PtbArgumentAssigned("coin3")},
)

txn, err := builder.Finish()
Expand Down
6 changes: 3 additions & 3 deletions bindings/go/examples/publish_upgrade/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func main() {
// Publish the package and receive the upgrade cap in return
builderPublish.Publish(packageData, "upgrade_cap")
// Transfer the upgrade cap to the sender address
builderPublish.TransferObjects(sender, []*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("upgrade_cap")})
builderPublish.TransferObjects(sender, []*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("upgrade_cap")})
txPublish, err := builderPublish.Finish()
if err.(*iota_sdk.SdkFfiError) != nil {
log.Fatalf("Failed to finish transaction: %v", err)
Expand Down Expand Up @@ -164,15 +164,15 @@ func main() {

// Upgrade the package to receive an upgrade receipt
upgradeReceiptName := "upgrade_receipt"
builderUpgrade.Upgrade(packageId, packageData, iota_sdk.PtbArgumentRes(upgradeTicketName), &upgradeReceiptName)
builderUpgrade.Upgrade(packageId, packageData, iota_sdk.PtbArgumentAssigned(upgradeTicketName), &upgradeReceiptName)

// Commit the upgrade using the receipt
commitUpgrade, _ := iota_sdk.NewIdentifier("commit_upgrade")
builderUpgrade.MoveCall(
iota_sdk.AddressFramework(),
packageIdent,
commitUpgrade,
[]*iota_sdk.PtbArgument{upgradeCapArg, iota_sdk.PtbArgumentRes(upgradeReceiptName)},
[]*iota_sdk.PtbArgument{upgradeCapArg, iota_sdk.PtbArgumentAssigned(upgradeReceiptName)},
nil,
nil,
)
Expand Down
10 changes: 5 additions & 5 deletions bindings/go/examples/tx_command_results/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func main() {

builder.SplitCoins(
iota_sdk.PtbArgumentGas(),
// Use the named results of previous commands to use as arguments
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("res0"), iota_sdk.PtbArgumentRes("res1")},
// For nested results, a tuple or vec can be used to name them
// Use the assigned results of previous commands to use as arguments
[]*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("res0"), iota_sdk.PtbArgumentAssigned("res1")},
// For nested results, a tuple or vec can be used to assign them
[]string{"coin0", "coin1"},
)

// Use named results as arguments
builder.TransferObjects(sender, []*iota_sdk.PtbArgument{iota_sdk.PtbArgumentRes("coin0"), iota_sdk.PtbArgumentRes("coin1")})
// Use assigned results as arguments
builder.TransferObjects(sender, []*iota_sdk.PtbArgument{iota_sdk.PtbArgumentAssigned("coin0"), iota_sdk.PtbArgumentAssigned("coin1")})

txn, err := builder.Finish()
if err.(*iota_sdk.SdkFfiError) != nil {
Expand Down
30 changes: 15 additions & 15 deletions bindings/go/iota_sdk/iota_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -8804,6 +8804,15 @@ func uniffiCheckChecksums() {
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_assigned()
})
if checksum != 10192 {
// If this happens try cleaning and rebuilding your project
panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_assigned: UniFFI API checksum mismatch")
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_bool()
})
Expand Down Expand Up @@ -8930,15 +8939,6 @@ func uniffiCheckChecksums() {
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_res()
})
if checksum != 47661 {
// If this happens try cleaning and rebuilding your project
panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_res: UniFFI API checksum mismatch")
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_shared()
})
Expand Down Expand Up @@ -22736,6 +22736,12 @@ func PtbArgumentAddressVecFromHex(addresses []string) (*PtbArgument, error) {
}
}

func PtbArgumentAssigned(name string) *PtbArgument {
return FfiConverterPtbArgumentINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_ptbargument_assigned(FfiConverterStringINSTANCE.Lower(name),_uniffiStatus)
}))
}

func PtbArgumentBool(value bool) *PtbArgument {
return FfiConverterPtbArgumentINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_ptbargument_bool(FfiConverterBoolINSTANCE.Lower(value),_uniffiStatus)
Expand Down Expand Up @@ -22844,12 +22850,6 @@ func PtbArgumentReceivingFromHex(hex string) (*PtbArgument, error) {
}
}

func PtbArgumentRes(name string) *PtbArgument {
return FfiConverterPtbArgumentINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_ptbargument_res(FfiConverterStringINSTANCE.Lower(name),_uniffiStatus)
}))
}

func PtbArgumentShared(id *ObjectId) *PtbArgument {
return FfiConverterPtbArgumentINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_ptbargument_shared(FfiConverterObjectIdINSTANCE.Lower(id),_uniffiStatus)
Expand Down
22 changes: 11 additions & 11 deletions bindings/go/iota_sdk/iota_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -3479,6 +3479,11 @@ void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_address_vec(RustBuffer addr
void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_address_vec_from_hex(RustBuffer addresses, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_ASSIGNED
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_ASSIGNED
void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_assigned(RustBuffer name, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_BOOL
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_BOOL
void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_bool(int8_t value, RustCallStatus *out_status
Expand Down Expand Up @@ -3550,11 +3555,6 @@ void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_receiving(void* id, RustCal
void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_receiving_from_hex(RustBuffer hex, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_RES
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_RES
void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_res(RustBuffer name, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_SHARED
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_PTBARGUMENT_SHARED
void* uniffi_iota_sdk_ffi_fn_constructor_ptbargument_shared(void* id, RustCallStatus *out_status
Expand Down Expand Up @@ -13127,6 +13127,12 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_address_vec(void
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_ADDRESS_VEC_FROM_HEX
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_address_vec_from_hex(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_ASSIGNED
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_ASSIGNED
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_assigned(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_BOOL
Expand Down Expand Up @@ -13211,12 +13217,6 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_receiving(void
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_RECEIVING_FROM_HEX
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_receiving_from_hex(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_RES
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_RES
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ptbargument_res(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_PTBARGUMENT_SHARED
Expand Down
8 changes: 4 additions & 4 deletions bindings/kotlin/examples/DevInspect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fun main() = runBlocking {
iotaNamesPackageAddress,
Identifier("registry"),
Identifier("lookup"),
listOf(PtbArgument.res("iota_names"), PtbArgument.res("name")),
listOf(PtbArgument.assigned("iota_names"), PtbArgument.assigned("name")),
emptyList(),
listOf("name_record_opt"),
)
Expand All @@ -66,7 +66,7 @@ fun main() = runBlocking {
stdAddress,
Identifier("option"),
Identifier("borrow"),
listOf(PtbArgument.res("name_record_opt")),
listOf(PtbArgument.assigned("name_record_opt")),
listOf(
TypeTag.newStruct(
StructTag(
Expand All @@ -84,7 +84,7 @@ fun main() = runBlocking {
iotaNamesPackageAddress,
Identifier("name_record"),
Identifier("target_address"),
listOf(PtbArgument.res("name_record")),
listOf(PtbArgument.assigned("name_record")),
emptyList(),
listOf("target_address_opt"),
)
Expand All @@ -94,7 +94,7 @@ fun main() = runBlocking {
stdAddress,
Identifier("option"),
Identifier("borrow"),
listOf(PtbArgument.res("target_address_opt")),
listOf(PtbArgument.assigned("target_address_opt")),
listOf(TypeTag.newAddress()),
listOf("target_address"),
)
Expand Down
5 changes: 4 additions & 1 deletion bindings/kotlin/examples/PrepareSendIotaMulti.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ fun main() = runBlocking {
builder.splitCoins(PtbArgument.objectId(coinId), amounts, labels)

for ((i, r) in recipients.withIndex()) {
builder.transferObjects(Address.fromHex(r.first), listOf(PtbArgument.res(labels[i])))
builder.transferObjects(
Address.fromHex(r.first),
listOf(PtbArgument.assigned(labels[i])),
)
}

val txn = builder.finish()
Expand Down
6 changes: 5 additions & 1 deletion bindings/kotlin/examples/PrepareSplitCoins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ fun main() = runBlocking {
)
.transferObjects(
sender,
listOf(PtbArgument.res("coin1"), PtbArgument.res("coin2"), PtbArgument.res("coin3")),
listOf(
PtbArgument.assigned("coin1"),
PtbArgument.assigned("coin2"),
PtbArgument.assigned("coin3"),
),
)

val txn = builder.finish()
Expand Down
6 changes: 3 additions & 3 deletions bindings/kotlin/examples/PublishUpgrade.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fun main() = runBlocking {
// Publish the package and receive the upgrade cap in return
builderPublish.publish(packageData, "upgrade_cap")
// Transfer the upgrade cap to the sender address
builderPublish.transferObjects(sender, listOf(PtbArgument.res("upgrade_cap")))
builderPublish.transferObjects(sender, listOf(PtbArgument.assigned("upgrade_cap")))
val txPublish = builderPublish.finish()

// Perform a dry-run first to check if everything is correct
Expand Down Expand Up @@ -131,7 +131,7 @@ fun main() = runBlocking {
builderUpgrade.upgrade(
packageId = packageId,
packageData = packageData,
upgradeTicket = PtbArgument.res("upgrade_ticket"),
upgradeTicket = PtbArgument.assigned("upgrade_ticket"),
name = "upgrade_receipt",
)

Expand All @@ -140,7 +140,7 @@ fun main() = runBlocking {
`package` = Address.framework(),
module = Identifier("package"),
function = Identifier("commit_upgrade"),
arguments = listOf(upgradeCapArg, PtbArgument.res("upgrade_receipt")),
arguments = listOf(upgradeCapArg, PtbArgument.assigned("upgrade_receipt")),
)

// Finalize the PTB
Expand Down
13 changes: 8 additions & 5 deletions bindings/kotlin/examples/TxCommandResults.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ fun main() = runBlocking {

builder.splitCoins(
PtbArgument.gas(),
// Use the named results of previous commands to use as arguments
listOf(PtbArgument.res("res0"), PtbArgument.res("res1")),
// For nested results, a tuple or vec can be used to name them
// Use the assigned results of previous commands to use as arguments
listOf(PtbArgument.assigned("res0"), PtbArgument.assigned("res1")),
// For nested results, a tuple or vec can be used to assign them
listOf("coin0", "coin1"),
)

// Use named results as arguments
builder.transferObjects(sender, listOf(PtbArgument.res("coin0"), PtbArgument.res("coin1")))
// Use assigned results as arguments
builder.transferObjects(
sender,
listOf(PtbArgument.assigned("coin0"), PtbArgument.assigned("coin1")),
)

val txn = builder.finish()

Expand Down
Loading