import type { Address, AvatarRow, ContractRunner, TokenBalanceRow, GroupMembershipRow, GroupRow, TransactionRequest } from '@aboutcircles/sdk-types'; import type { TransactionReceipt, Hex } from 'viem'; import type { Core } from '@aboutcircles/sdk-core'; import { CommonAvatar } from './CommonAvatar.js'; import { type ProxyInviter, type ReferralPreviewList } from '@aboutcircles/sdk-invitations'; /** * HumanAvatar class implementation * Provides a simplified, user-friendly wrapper around Circles protocol for human avatars * * This class represents a human avatar in the Circles ecosystem and provides * methods for managing trust relationships, personal token minting, transfers, and more. */ export declare class HumanAvatar extends CommonAvatar { constructor(address: Address, core: Core, contractRunner?: ContractRunner, avatarInfo?: AvatarRow); readonly balances: { getTotal: () => Promise; getTokenBalances: () => Promise; getTotalSupply: () => Promise; }; private readonly _invitations; private readonly _inviteFarm; readonly invitation: { /** * Get a referral code for inviting a new user who doesn't have a Safe wallet yet. * Generates private key, finds proxy inviters, builds tx batch, saves referral data. * @returns Transactions to execute and the private key to share with invitee */ getReferralCode: () => Promise<{ transactions: TransactionRequest[]; privateKey: Hex; }>; /** * Invite a user who already has a Safe wallet but is not yet registered in Circles. * @param invitee Address of the invitee (must have existing Safe, NOT registered in Circles) */ invite: (invitee: Address) => Promise; /** * Get proxy inviters who can facilitate invitations. * These are addresses that trust this avatar, are trusted by the invitation module, * and have sufficient balance (96 CRC per invite). */ getProxyInviters: () => Promise; /** * Number of free invites this avatar can claim as an eligible Gnosis Pay user. * Returns 0 when not eligible (or the grantee contract is not configured). * When > 0, `invite()` / `getReferralCode()` automatically use the free-invite * path instead of proxy inviters or farm quota. */ getClaimableFreeInvites: () => Promise; /** * Find a path from this avatar to the invitation module. * @param proxyInviterAddress Optional specific proxy inviter to route through */ findInvitePath: (proxyInviterAddress?: Address) => Promise; /** * Compute the deterministic Safe address for a given signer using CREATE2. * @param signer The signer public address */ computeAddress: (signer: Address) => Address; /** * Generate batch referrals using the InvitationFarm (for new users without a Safe). * @param count Number of referrals to generate */ generateReferrals: (count: number) => Promise<{ secrets: Hex[]; signers: Address[]; transactionReceipt: TransactionReceipt; }>; /** Get the remaining invite quota for this avatar */ getQuota: () => Promise; /** Get the invitation fee (96 CRC) */ getInvitationFee: () => Promise; /** Get the invitation module address from the farm */ getInvitationModule: () => Promise
; /** * List referrals for this avatar with key previews. * @param limit Max referrals to return (default 10) * @param offset Pagination offset (default 0) */ listReferrals: (limit?: number, offset?: number) => Promise; }; readonly personalToken: { /** * Get the available amount of personal tokens that can be minted * * This method calls the HubV2 contract's calculateIssuance function which returns: * - Total issuance amount: The total amount of tokens that can be minted * - Start period: The period when minting started * - End period: The current period * * @returns Object containing issuance amount (in atto-circles), start period, and end period * * @example * ```typescript * const { amount, startPeriod, endPeriod } = await avatar.personalToken.getMintableAmount(); * console.log('Mintable amount:', CirclesConverter.attoCirclesToCircles(amount), 'CRC'); * console.log('Start period:', startPeriod.toString()); * console.log('End period:', endPeriod.toString()); * ``` */ getMintableAmount: () => Promise<{ amount: bigint; startPeriod: bigint; endPeriod: bigint; }>; /** * Mint personal Circles tokens * This claims all available personal tokens that have accrued since last mint * * @returns Transaction response * * @example * ```typescript * const receipt = await avatar.personalToken.mint(); * console.log('Minted tokens, tx hash:', receipt.hash); * ``` */ mint: () => Promise; /** * Stop personal token minting * This permanently stops the ability to mint new personal tokens * * WARNING: This action is irreversible! * * @returns Transaction response * * @example * ```typescript * const receipt = await avatar.personalToken.stop(); * console.log('Stopped minting, tx hash:', receipt.hash); * ``` */ stop: () => Promise; }; readonly groupToken: { /** * Mint group tokens by transferring collateral to the group's mint handler * Uses pathfinding to transfer tokens along the trust network, including wrapped tokens * * @param group The group address to mint tokens from * @param amount Amount of tokens to transfer to the mint handler (in atto-circles) * @returns Transaction receipt * * @example * ```typescript * // Mint group tokens by sending 100 CRC to the group's mint handler * const receipt = await avatar.groupToken.mint('0xGroupAddress...', BigInt(100e18)); * ``` */ mint: (group: Address, amount: bigint) => Promise; /** * Get the maximum amount that can be minted for a group * This calculates the maximum transferable amount to the group's mint handler * including wrapped token balances * * @param group The group address * @returns Maximum mintable amount in atto-circles * * @example * ```typescript * const maxMintable = await avatar.groupToken.getMaxMintableAmount('0xGroupAddress...'); * console.log('Can mint up to:', maxMintable.toString(), 'atto-circles'); * ``` */ getMaxMintableAmount: (group: Address) => Promise; /** * Automatically redeem collateral tokens from a Base Group's treasury * * Performs automatic redemption by determining trusted collaterals and using pathfinder for optimal flow. * Only supports Base Group types. The function uses pathfinder to determine the optimal redemption path * and validates that sufficient liquidity exists before attempting redemption. * * @param group The address of the Base Group from which to redeem collateral tokens * @param amount The amount of group tokens to redeem for collateral (must be > 0 and <= max redeemable) * @returns A Promise resolving to the transaction receipt upon successful automatic redemption * * @example * ```typescript * // Redeem 100 group tokens for collateral * const receipt = await avatar.groupToken.redeem('0xGroupAddress...', BigInt(100e18)); * ``` */ redeem: (group: Address, amount: bigint) => Promise; properties: { /** * Get the owner of a specific group * @param group The group address * @returns The owner address of the group */ owner: (group: Address) => Promise
; /** * Get the mint handler address of a specific group * @param group The group address * @returns The mint handler address */ mintHandler: (group: Address) => Promise
; /** * Get the treasury (redemption handler) address of a specific group * @param group The group address * @returns The treasury address where redemptions are handled */ treasury: (group: Address) => Promise
; /** * Get the service address of a specific group * @param group The group address * @returns The service address */ service: (group: Address) => Promise
; /** * Get the fee collection address of a specific group * @param group The group address * @returns The fee collection address */ feeCollection: (group: Address) => Promise
; /** * Get all membership conditions for a specific group * @param group The group address * @returns Array of membership condition addresses */ getMembershipConditions: (group: Address) => Promise; }; }; readonly group: { properties: { /** * Get the owner of a specific group * @param group The group address * @returns The owner address of the group */ owner: (group: Address) => Promise
; /** * Get the mint handler address of a specific group * @param group The group address * @returns The mint handler address */ mintHandler: (group: Address) => Promise
; /** * Get the treasury (redemption handler) address of a specific group * @param group The group address * @returns The treasury address where redemptions are handled */ treasury: (group: Address) => Promise
; /** * Get the service address of a specific group * @param group The group address * @returns The service address */ service: (group: Address) => Promise
; /** * Get the fee collection address of a specific group * @param group The group address * @returns The fee collection address */ feeCollection: (group: Address) => Promise
; /** * Get all membership conditions for a specific group * @param group The group address * @returns Array of membership condition addresses */ getMembershipConditions: (group: Address) => Promise; }; /** * Get group memberships for this avatar using cursor-based pagination * * Returns a PagedQuery instance for iterating through all groups that this avatar is a member of, * including membership details such as expiry time and when the membership was created. * * @param limit Number of memberships per page (default: 50) * @param sortOrder Sort order for results (default: 'DESC') * @returns PagedQuery instance for iterating through memberships * * @example * ```typescript * const query = avatar.group.getGroupMemberships(); * * // Get first page * await query.queryNextPage(); * console.log(`Member of ${query.currentPage.size} groups (page 1)`); * * // Iterate through all memberships * while (await query.queryNextPage()) { * query.currentPage.results.forEach(membership => { * console.log(`Group: ${membership.group}`); * console.log(`Expiry: ${new Date(membership.expiryTime * 1000).toLocaleDateString()}`); * }); * } * ``` */ getGroupMemberships: (limit?: number) => Promise>; /** * Get detailed information about all groups this avatar is a member of * * This method fetches group memberships and enriches them with full group details including * name, symbol, owner, treasury, mint handler, member count, and other properties. * * @param limit Maximum number of memberships to return (default: 50) * @returns Array of group detail rows * * @example * ```typescript * // Get detailed information about all group memberships * const groups = await avatar.group.getGroupMembershipsWithDetails(); * * groups.forEach(group => { * console.log(`Group: ${group.name} (${group.symbol})`); * console.log(`Owner: ${group.owner}`); * console.log(`Member count: ${group.memberCount}`); * console.log(`Treasury: ${group.treasury}`); * }); * ``` */ getGroupMembershipsWithDetails: (limit?: number) => Promise; }; } //# sourceMappingURL=HumanAvatar.d.ts.map