For the complete documentation index, see llms.txt. This page is also available as Markdown.

Account Methods

Account methods of Papaya SDK for getting balance and user information

balanceOf()

Retrieves the token balance of an account in the Papaya protocol.

async balanceOf(account?: string): Promise<number>

Parameters:

  • account: (Optional) The address to check the balance of. If not provided, uses the connected signer's address.

Returns: The account balance in its raw blockchain format. Use formatOutput() to convert to a human-readable number.

Example:

// Get raw balance
const rawBalance = await papaya.balanceOf();

// Convert to human-readable format
const balance = formatOutput(BigInt(rawBalance), 18);
console.log(`My balance: ${balance} USDT`);

getUserInfo()

Gets detailed information about a user's account.

async getUserInfo(account?: string): Promise<UserInfo>

Parameters:

  • account: (Optional) The address to get info for. If not provided, uses the connected signer's address.

Returns: A UserInfo object with the following properties:

  • balance: The account balance in raw blockchain format

  • incomeRate: The rate at which the account is receiving subscriptions (raw format)

  • outgoingRate: The rate at which the account is paying subscriptions (raw format)

  • updated: The timestamp when the account was last updated

The incomeRate and outgoingRate values are rates in their raw blockchain format. You should use the utility functions to convert them to human-readable values, typically per month.

Example:

Last updated