User

Defines:

public struct User has key {
        id: UID,
        avatar_hash: String,
        banner_hash: String,
        created_at: u64,
        description: String,
        key: String,
        owner: address,
        members: Membership,
        name: String,
        posts: Posts,
        soul: address,
        total_earnings: u64,
        updated_at: u64
}

Assert Description

The assert_user_description function has these effects:

  1. Throws error (370 - EInvalidUserDescription) if the description is longer than 370 characters

Assert Name

The assert_user_name function has these effects:

  1. Throws error (371 - EInvalidUsername) if the name is not between 3 - 20 characters, or contains characters that are not a-z, A-Z, or a dash at the beginning or end

Borrow Members

The borrow_members_mut function has these effects:

  1. Returns a mutable reference to the Membership table of the User

Borrow Posts

The borrow_posts_mut function has these effects:

  1. Returns a mutable reference to the Posts table of the User

Create

The create function has these effects:

  1. Asserts name & description values

  2. Creates and shares User

  3. Returns User address

Get Avatar

The get_avatar function has these effects:

  1. Returns the String avatar of the User

Get Banner

The get_banner function has these effects:

  1. Returns the String banner of the User

Get Description

The get_description function has these effects:

  1. Returns the String description of the Channel

Get Owner

The get_owner function has these effects:

  1. Returns the wallet address associated with the User

Get Key

The get_key function has these effects:

  1. Returns the String lowercase version of the User's name

Get Name

The get_name function has these effects:

  1. Returns the String name of the User

Update

The update function has these effects:

  1. Asserts description value

  2. Updates the User data

Last updated