With Sui TS SDK. client objects “getOwnedObjects” method how do I filter out the type of object I want to get?
2 Likes
@tahlil It can be used in conjunction with the filter
option. As shown in the example, MatchAny
can also be used to perform an OR search. MatchAll
and MatchNone
are also options. The criteria can be narrowed down by Package
as well as StructType
.
const res = await client.getOwnedObjects({
owner: "<OWNER_ADDRESS>",
filter: {
MatchAny: [
{
StructType: "0x2::package::Publisher"
},
{
StructType: "0x2::package::UpgradeCap"
}
],
},
options: {
showType: true,
},
});
2 Likes