-
Notifications
You must be signed in to change notification settings - Fork 0
Resource
Wowok Protocol edited this page May 23, 2024
·
2 revisions
Resource is address-owned object(not share object)
struct Resource has key, store {
id: UID,
description: String,
// Tag table: addresses can be grouped under a label or tag name (default directories like like, unlike, and collection are generated)
marks: Table<>,
words: sui_table::Table, // Remarks table: additional information can be noted for an address or object
}
The maximum length of remarks for an address is 100K
const MAX_WORDS_LEN:u64 = 102400;
Create a personal resource object
new(description:String) : Resource
create(resource: Resource) : address
Add an address to a tag (for example, liking an object will add it to the like tag); returns true on success
add(resource:&mut Resource, name:String, object:address) : bool
Remove an address from a tag, returns true on success
remove(resource:&mut Resource, name:String, object:address) : bool
Rename a tag
rename(resource:&mut Resource, old_name:String, new_name:String)
Clear all addresses in a tag
remove_all(resource:&mut Resource, name:String)
Add remarks for an address
words_add(resource:&mut Resource, object:address, words:String)
Remove remarks for an address
words_remove(resource:&mut Resource, object:address)
Errors
100800: Remarks for an address exceed the maximum length