User Views
The User Views module provides methods for querying user profile information, referral relationships, and fee-related data within the Mirage ecosystem.
Profile and Referral Information
getReferralDepositAddress
Retrieves the deposit address where referral rewards are sent for a specific user.
async getReferralDepositAddress(
userAddress: string
): Promise<string>Example:
const depositAddress = await mirageClient.userProfile.views.getReferralDepositAddress(
"0x123..." // User address
)getUserProfileExists
Checks if a user profile exists for the given address.
async getUserProfileExists(
userAddress: string
): Promise<boolean>Example:
const exists = await mirageClient.userProfile.views.getUserProfileExists(
"0x123..." // User address
)
console.log(exists) // true or falsegetUserReferrerAddress
Retrieves the address of the user who referred the specified user. For example, if Alice refers Bob, calling this with Bob's address returns Alice's address.
async getUserReferrerAddress(
userAddress: string
): Promise<string>Example:
const referrerAddress = await mirageClient.userProfile.views.getUserReferrerAddress(
"0x123..." // User address (referree)
)Fee and Rate Information
getCurrentPeriodFeeRate
Retrieves the current period's referral fee rate for a specific user.
async getCurrentPeriodFeeRate(
userAddress: string
): Promise<number>Example:
const feeRate = await mirageClient.userProfile.views.getCurrentPeriodFeeRate(
"0x123..." // User address
)getUserProfileFeeVolume
Retrieves an array containing the fee volumes for the last period and current period.
async getUserProfileFeeVolume(
userAddress: string
): Promise<number[]>Example:
const [lastPeriod, currentPeriod] = await mirageClient.userProfile.views.getUserProfileFeeVolume(
"0x123..." // User address
)
console.log(`Last Period: ${lastPeriod}, Current Period: ${currentPeriod}`)getNextReferralRate
Retrieves the next referral rate that will apply to the user on the following referral period.
async getNextReferralRate(
userAddress: string
): Promise<number>Example:
const nextRate = await mirageClient.userProfile.views.getNextReferralRate(
"0x123..." // User address
)