/** Fadroma. Copyright (C) 2023 Hack.bg. License: GNU AGPLv3 or custom. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . **/ import { Chain, Token } from '@fadroma/agent'; import type { CodeHash, Uint128, Address } from '@fadroma/agent'; import type { Permit } from "./snip-24.dist"; export declare class Snip20 extends Chain.Contract implements Token.Fungible { /** The full name of the token. */ name: string | null; /** The market symbol of the token. */ symbol: string | null; /** The decimal precision of the token. */ decimals: number | null; /** The total supply of the token. */ totalSupply: Uint128 | null; instance?: { address?: Address; codeHash?: CodeHash; }; /** Create a SNIP20 init message. */ static init({ symbol, decimals, admin, name, config, balances, prngSeed }: { symbol: string; decimals: number; admin: Address | { address: Address; }; name?: string; config?: Partial; balances?: Array<{ address: Address; amount: Uint128; }>; prngSeed?: string; }): Snip20InitMsg; /** Get a comparable token ID. */ get id(): string; /** Get a client to the Viewing Key API. */ get vk(): ViewingKeyClient; /** @returns self as plain Token.Custom with a *hidden (from serialization!)* * `client` property pointing to `this`. */ get asDescriptor(): Token.Custom; /** @returns true */ isFungible: () => boolean; /** @returns true */ isCustom: () => boolean; /** @returns false */ isNative: () => boolean; fetchMetadata(): Promise; getTokenInfo(): Promise; getBalance(address: Address, key: string): Promise; /** Change the admin of the token, who can set the minters */ changeAdmin: (address: string) => Promise; /** Set specific addresses to be minters, remove all others */ setMinters: (minters: Array) => Promise; /** Add addresses to be minters */ addMinters: (minters: Array) => Promise; /** Mint SNIP20 tokens */ mint: (amount: string | number | bigint, recipient?: string | undefined) => Promise; /** Burn SNIP20 tokens */ burn: (amount: string | number | bigint, memo?: string) => Promise; /** Deposit native tokens into the contract. */ deposit: (nativeToken: Token.ICoin[]) => Promise; /** Redeem an amount of a native token from the contract. */ redeem: (amount: string | number | bigint, denom?: string) => Promise; /** Get the current allowance from `owner` to `spender` */ getAllowance: (owner: Address, spender: Address, key: string) => Promise; /** Check the current allowance from `owner` to `spender`. */ checkAllowance: (spender: string, owner: string, key: string) => Promise; /** Increase allowance to spender */ increaseAllowance: (amount: string | number | bigint, spender: Address) => Promise; /** Decrease allowance to spender */ decreaseAllowance: (amount: string | number | bigint, spender: Address) => Promise; /** Transfer tokens to address */ transfer: (amount: string | number | bigint, recipient: Address) => Promise; transferFrom: (owner: Address, recipient: Address, amount: Uint128, memo?: string) => Promise; /** Send tokens to address. * Same as transfer but allows for receive callback. */ send: (amount: string | number | bigint, recipient: Address, callback?: string | object) => Promise; sendFrom: (owner: Address, amount: Uint128, recipient: String, hash?: CodeHash, msg?: string, memo?: string) => Promise; batchTransfer: (actions: TransferAction[]) => Promise; batchTransferFrom: (actions: TransferFromAction[]) => Promise; batchSend: (actions: SendAction[]) => Promise; batchSendFrom: (actions: SendFromAction[]) => Promise; amount(amount: Uint128): Token.Amount; } export interface Snip20BaseConfig { /** The full name of the token. */ name: string; /** The market symbol of the token. */ symbol: string; /** The decimal precision of the token. */ decimals: number; } export interface Snip20InitMsg extends Snip20BaseConfig { /** The admin of the token. */ admin: Address; /** The PRNG seed for the token. */ prng_seed: string; /** The settings for the token. */ config: Snip20InitConfig; /** Initial balances. */ initial_balances?: { address: Address; amount: Uint128; }[]; [name: string]: unknown; } export interface Snip20InitConfig { public_total_supply?: boolean; enable_mint?: boolean; enable_burn?: boolean; enable_deposit?: boolean; enable_redeem?: boolean; [name: string]: unknown; } export interface Snip20Allowance { spender: Address; owner: Address; allowance: Uint128; expiration?: number | null; } export interface Snip20TokenInfo { name: string; symbol: string; decimals: number; total_supply?: Uint128 | null; } export type Snip20Permit = Permit<'allowance' | 'balance' | 'history' | 'owner'>; export type QueryWithPermit = { with_permit: { query: Q; permit: P; }; }; export declare const createPermitMsg: (query: Q, permit: Snip20Permit) => { with_permit: { query: Q; permit: Snip20Permit; }; }; export interface TransferAction { recipient: Address; amount: Uint128; memo?: string; } export interface TransferFromAction { owner: Address; recipient: Address; amount: Uint128; memo?: string; } export interface SendAction { recipient: Address; recipient_code_hash?: CodeHash; amount: Uint128; msg?: string; memo?: string; } export interface SendFromAction { owner: Address; recipient_code_hash?: CodeHash; recipient: Address; amount: Uint128; msg?: string; memo?: string; } /** A viewing key. */ export type ViewingKey = string; /** A contract's viewing key methods. */ export declare class ViewingKeyClient extends Chain.Contract { /** Create a random viewing key. */ create(entropy?: string): Promise; /** Set a user-specified viewing key. */ set(key: ViewingKey): Promise; } //# sourceMappingURL=snip-20.d.ts.map