Skip to main content

Models

The models provided here offer detailed information and methods to interact with specific account types. Each model includes an account property, which contains account information, and a refresh method to update the account data by fetching the latest information from the program.

Organization

Account Properties

PropertyTypeDescription
pdaPublicKeyThe program-derived account (PDA) public key.
authorityPublicKeyThe wallet owning the organization.
dateCreatedBNThe date of creation in seconds.
namestringThe name of the organization.
mainTokenMintPublicKeyThe main spl token the organization will interact with.
enforceWalletUniquenessbooleanA flag indicating whether wallet uniqueness is enforced.
allowMultiLevelbooleanA flag indicating whether multi-level organization structure is allowed.

Ambassador

Account Properties

PropertyTypeDescription
pdaPublicKeyThe program-derived account (PDA) public key.
authorityPublicKeyThe wallet owning the ambassador.
namestringThe name of the ambassador.

Member

Account Properties

PropertyTypeDescription
pdaPublicKeyThe program-derived account (PDA) public key.
referrerPublicKeyThe referrer's treasury public key.
ownerPublicKeyThe owner's treasury public key.
globalReferrerOfBuddyBuddyGlobalReferrerThe global referrer of the member.
namestringThe name of the member.
organizationstringThe organization name associated with the member.
referringMembersPublicKey[]An array of public keys representing the referring members (maximum length: 4).

Methods

async isMemberAvailable(organizationName: string, memberName: string): Promise<boolean>

Checks if a member name already is taken under a specific organization.

async getReferrer(): Promise<Treasury | null>

Retrieves the referrer's treasury associated with the member instance.

async getOwner(): Promise<Treasury>

Retrieves the owners's treasury associated with the member instance.

async getReferringMembers(): Promise<Member[]>

Retrieves an array of members that referred the current member.

Buddy

Account Properties

PropertyTypeDescription
pdaPublicKeyThe program-derived account (PDA) public key.
authorityPublicKeyThe authority public key.
buddyTypeBuddyTypeThe type of the buddy.
dateCreatedBNThe date of creation in seconds.
isFrozenbooleanA flag indicating whether the buddy is frozen / minted.
referrerTreasuryPdaPublicKeyThe referrer's treasury public key.
referrerTypeReferrerTypeThe type of the referrer.
namestringThe name of the buddy.

Methods

async isBuddyAvailable(name: string): Promise<boolean>

Checks if a buddy with the specified name exists.

async buyGlobalBuddy(buddyName: string): Promise<void>

Allows the current buddy to purchase a global buddy.

Treasury

Account Properties

PropertyTypeDescription
pdaPublicKeyThe program-derived account (PDA) public key.
amountNoMultiLevelBNThe amount without multi-level shares.
totalBpsnumberBPS amount of multi-level
mintPublicKeyThe mint public key.
ownersTreasuryOwner[]An array of owners with their respective shares.

Methods

async getOwners(): Promise<Buddy[]>

Retrieves an array of buddies who own shares in the treasury.

async getClaimableBalance(buddyPDA?: PublicKey): Promise<number>

Calculates the claimable balance for the treasury. (Removes rent (for SOL), multi-level take and buddylink fee).

async claim(buddyPDA?: PublicKey, isMultiLevel: boolean = true): Promise<void>

Allows a buddy to claim their share from the treasury.

async transferUp(buddyPDA: PublicKey, treasuryPDA: PublicKey): Promise<void>

Permission-less instruction allowing to move the referrer's cut and buddylink fee up a level.