import { Coin } from "@3rdweb/contracts"; import { TransactionReceipt } from "@ethersproject/providers"; import { BigNumber, BigNumberish } from "ethers"; import { ModuleType, Role } from "../common"; import { Currency, CurrencyValue } from "../common/currency"; import { ModuleWithRoles } from "../core/module"; import { MetadataURIOrObject } from "../core/types"; import { ITransferable } from "../interfaces/contracts/ITransferable"; export interface ITokenMintArgs { address: string; amount: BigNumberish; } export interface ITokenMintFromArgs extends ITokenMintArgs { fromAddress: string; } /** * Create a standard crypto token or crypto currency. * * @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.getTokenModule("{{module_address}}"); * ``` * * @public */ export declare class TokenModule extends ModuleWithRoles implements ITransferable { static moduleType: ModuleType; static roles: readonly ["admin", "minter", "pauser", "transfer"]; /** * @override * @internal */ protected getModuleRoles(): readonly Role[]; /** * @internal */ protected connectContract(): Coin; /** * @internal */ protected getModuleType(): ModuleType; get(): Promise; getValue(value: BigNumberish): Promise; totalSupply(): Promise; balance(): Promise; /** * Get Token Balance * * @remarks Get a wallets token balance. * * @example * ```javascript * // Address of the wallet to check token balance * const address = "{{wallet_address}}"; * * const balance = await module.balanceOf(address); * console.log(balance); * ``` * * @returns The balance of a specific wallet. */ balanceOf(address: string): Promise; allowance(spender: string): Promise; /** * Get Token Allowance * * @remarks Get the allowance of one wallet over another's funds - the allowance of a different address for a token is the amount of tokens that the wallet is allowed to spend on behalf of the connected wallet. * * @example * ```javascript * // Address of the wallet who owns the funds * const address = "{{wallet_address}}"; * * // Address of the wallet to check token allowance * const otherAddress = "0x..."; * * const allowance = await module.allowanceOf(address, otherAddress); * console.log(allowance); * ``` * * @returns The allowance of one wallet over anothers funds. */ allowanceOf(owner: string, spender: string): Promise; /** * Get your wallet voting power for the current checkpoints * * @returns the amount of voting power in tokens */ getVoteBalance(): Promise; getVoteBalanceOf(account: string): Promise; /** * Get your voting delegatee address * * @returns the address of your vote delegatee */ getDelegation(): Promise; getDelegationOf(account: string): Promise; /** * Lets you delegate your voting power to the delegateeAddress * * @param delegateeAddress - delegatee wallet address * @alpha */ delegateTo(delegateeAddress: string): Promise; /** * Transfer Tokens * * @remarks Transfer tokens from the connected wallet to another wallet. * * @example * ```javascript * // Address of the wallet you want to send the tokens to * const toAddress = "0x..."; * * // The amount of tokens you want to send * const amount = 0; * * await module.transfer(toAddress, amount); * ``` */ transfer(to: string, amount: BigNumberish): Promise; setAllowance(spender: string, amount: BigNumber): Promise; mint(amount: BigNumberish): Promise; /** * Mint Tokens * * @remarks Mint tokens to a specified address * * @example * ```javascript * // Address of the wallet you want to mint the tokens to * const toAddress = "{{wallet_address}}"; * * // The amount of this token you want to mint * const amount = ethers.utils.parseEther("1.5"); * * await module.mintTo(toAddress, amount); * ``` */ mintTo(to: string, amount: BigNumberish): Promise; /** * Mint Tokens To Many Wallets * * @remarks Mint tokens to many different wallets * * @example * ```javascript * // Data of the tokens you want to mint * const data = [ * { * address: "{{wallet_address}}", // Address to mint tokens to * amount: 100, // How many tokens to mint to specified address * }, * { * address: "0x...", * amount: 100, * } * ] * * await module.mintBatchTo(data); * ``` */ mintBatchTo(args: ITokenMintArgs[]): Promise; /** * Lets you get a all token holders and their corresponding balances * @beta - This can be very slow for large numbers of token holders * @param queryParams - Optional query params * @returns - A JSON object of all token holders and their corresponding balances */ getAllHolderBalances(): Promise>; /** * Burn Tokens * * @remarks Burn tokens held by the connected wallet * * @example * ```javascript * // The amount of this token you want to burn * const amount = 100; * * await module.burn(amount); * ``` */ burn(amount: BigNumberish): Promise; burnFrom(from: string, amount: BigNumberish): Promise; /** * Transfer Tokens From Address * * @remarks Transfer tokens from one wallet to another * * @example * ```javascript * // Address of the wallet sending the tokens * const fromAddress = "{{wallet_address}}"; * // Address of the wallet you want to send the tokens to * const toAddress = "0x..."; * // The number of tokens you want to send * const amount = 100 * * // Note that the connected wallet must have approval to transfer the tokens of the fromAddress * await module.transferFrom(fromAddress, toAddress, amount); * ``` */ transferFrom(from: string, to: string, amount: BigNumberish): Promise; setModuleMetadata(metadata: MetadataURIOrObject): Promise; transferBatch(args: ITokenMintArgs[]): Promise; transferFromBatch(args: ITokenMintFromArgs[]): Promise; isTransferRestricted(): Promise; setRestrictedTransfer(restricted?: boolean): Promise; } /** * @deprecated - see {@link TokenModule} */ export declare class CurrencyModule extends TokenModule { }