import { Royalty } from "@3rdweb/contracts"; import { BigNumber } from "ethers"; import { ModuleType } from "../common"; import { Currency, CurrencyValue } from "../common/currency"; import { Module } from "../core/module"; import { SplitRecipient } from "../types/SplitRecipient"; export interface ISplitsModule { /** * Returns a list of all recipients with their * respective split percentages. * */ getAllRecipients(): Promise; /** * Get the split percentage of a recipient. * * @param address - The address of the recipient. */ getRecipientSplitPercentage(address: string): Promise; /** * Returns the amount of royalty available for a recipient * to withdraw in the native currency. * * @param address - The address of the recipient to check the balance of. */ balanceOf(address: string): Promise; /** * Returns the amount of royalty available for a recipient * to withdraw in the native currency in a specific currency. * * @param walletAddress - The address of the recipient to check the balance of. * @param tokenAddress - The address of the currency to check the balance in. */ balanceOfToken(walletAddress: string, tokenAddress: string): Promise; /** * Transaction that will withdraw the split amount of royalty that * the `address` is owed and transfer it to the wallet. * * @param address - The address to withdraw royalties for. */ withdraw(address: string): Promise; /** * Transaction that will withdraw the split amount of royalty that * the `address` is owed and transfer it to the wallet, in the * currency specified by `tokenAddress`. * * For example: If the native currency of a chain is ETH but the user * wants to withdraw their split in $MATIC, they should pass * the address of the $MATIC token as the `tokenAddress` parameter. * * @param walletAddress - The address to withdraw royalties for. */ withdrawToken(walletAddress: string, tokenAddress: string): Promise; /** * Distributes all funds to the recipients. */ distribute(): Promise; /** * Distributes all funds to the recipients in the specified currency. * * @param tokenAddress - The address of the currency to distribute the funds in. */ distributeToken(tokenAddress: string): Promise; } /** * Create custom royalty splits to distribute funds. * * @example * * ```javascript * import { ThirdwebSDK } from "@3rdweb/sdk"; * * // You can switch out this provider with any wallet or provider setup you like. * const provider = ethers.Wallet.createRandom(); * const sdk = new ThirdwebSDK(provider); * const module = sdk.getSplitsModule("{{module_address}}"); * ``` * * @public */ export declare class SplitsModule extends Module implements ISplitsModule { static moduleType: ModuleType; /** * @internal */ protected connectContract(): Royalty; /** * @internal */ protected getModuleType(): ModuleType; get(): Promise; /** * Get Recipients * * @remarks Get the data about the shares of every split recipient on the module * * @example * ```javascript * const recipients = await module.getAllRecepients(); * console.log(recipients); * ``` */ getAllRecipients(): Promise; /** * * Returns all the recipients and their balances in the native currency. * @returns A map of recipient addresses to their balances in the native currency. * */ balanceOfAllRecipients(): Promise<{ [key: string]: BigNumber; }>; /** * * Returns all the recipients and their balances in a non-native currency. * @param tokenAddress - The address of the currency to check the balances in. * @returns A map of recipient addresses to their balances in the specified currency. * */ balanceOfTokenAllRecipients(tokenAddress: string): Promise<{ [key: string]: CurrencyValue; }>; getRecipientSplitPercentage(address: string): Promise; /** * Get Funds * * @remarks Get the amount of funds in the native currency held by the module thats owed to a specific recipient. * * @example * ```javascript * // The address to check the funds of * const address = "{{wallet_address}}"; * const funds = await module.balanceOf(address); * console.log(funds); * ``` */ balanceOf(address: string): Promise; /** * Get Token Funds * * @remarks Get the amount of funds in the non-native tokens held by the module thats owed to a specific recipient. * * @example * ```javascript * // The address to check the funds of * const address = "{{wallet_address}}"; * // The address of the currency to check the contracts funds of * const tokenAddress = "0x..." * const funds = await module.balanceOfToken(address, tokenAddress); * console.log(funds); * ``` */ balanceOfToken(walletAddress: string, tokenAddress: string): Promise; withdraw(address: string): Promise; private _pendingPayment; withdrawToken(walletAddress: string, tokenAddress: string): Promise; /** * Distribute Funds * * @remarks Distribute funds held by the contract in the native currency to all recipients. * * @example * ```javascript * await module.distribute(); * ``` */ distribute(): Promise; /** * Distribute Funds * * @remarks Distribute funds held by the contract in the native currency to all recipients. * * @example * ```javascript * // The address of the currency to distribute funds * const tokenAddress = "0x..." * await module.distributeToken(tokenAddress); * ``` */ distributeToken(tokenAddress: string): Promise; }