From e03fc94c0b384938ae1598b3847a3f45ed903af0 Mon Sep 17 00:00:00 2001 From: admin-aftermath Date: Wed, 21 Jun 2023 20:52:13 -0700 Subject: [PATCH] chore: added `has_type` accessor --- suifrens/accessories/sources/accessories.move | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/suifrens/accessories/sources/accessories.move b/suifrens/accessories/sources/accessories.move index b05c65c..ccb6e70 100644 --- a/suifrens/accessories/sources/accessories.move +++ b/suifrens/accessories/sources/accessories.move @@ -84,6 +84,13 @@ module accessories::accessories { // === Reads === + /// Accessor to allow third-party apps to query if a `SuiFren` has an accessory + /// with the given `type`. + public fun has_type (sf: &SuiFren, type: String): bool { + let uid = suifrens::uid(sf); + dof::exists_(uid, AccessoryKey { type }) + } + /// Accessor for the `name` field of the `Accessory`. public fun name(accessory: &Accessory): String { accessory.name