/** 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 type { Address } from "./chain.dist"; /** A 128-bit integer. */ export type Uint128 = string; /** A 256-bit integer. */ export type Uint256 = string; /** A 128-bit decimal fraction. */ export type Decimal128 = string; /** A 256-bit decimal fraction. */ export type Decimal256 = string; /** Represents some amount of native token. */ export interface ICoin { amount: Uint128; denom: string; } /** A gas fee, payable in native tokens. */ export interface IFee { amount: readonly ICoin[]; gas: Uint128; } /** A constructable gas fee in native tokens. */ export declare class Fee implements IFee { gas: string; amount: ICoin[]; constructor(amount: Uint128 | number | bigint, denom: string, gas?: string); add(amount: Uint128 | number | bigint, denom: string): void; get [Symbol.toStringTag](): string; } /** Represents some amount of native token. */ export declare class Coin implements ICoin { readonly denom: string; readonly amount: string; constructor(amount: number | string, denom: string); } /** An identifiable token on a network. */ declare abstract class Token { /** The token's unique id. */ abstract get id(): string; /** Whether this token is fungible. */ abstract isFungible(): this is FungibleToken; } /** An abstract non-fungible token. */ declare abstract class NonFungibleToken extends Token { /** @returns false */ isFungible: () => boolean; } /** An abstract fungible token. */ declare abstract class FungibleToken extends Token { /** @returns true */ isFungible: () => boolean; /** Whether this token is natively supported by the chain. */ abstract isNative(): this is NativeToken; /** Whether this token is implemented by a smart contract. */ abstract isCustom(): this is CustomToken; static readonly addZeros: (n: number | Uint128, z: number) => Uint128; amount(amount: number | Uint128): TokenAmount; } /** An amount of a fungible token. */ declare class TokenAmount { token: FungibleToken; amount: Uint128; constructor(amount: string | number | bigint, token: FungibleToken); /** Pass this to send, initSend, execSend */ get asNativeBalance(): ICoin[]; get denom(): string; get [Symbol.toStringTag](): string; toString(): string; asCoin(): ICoin; asFee(gas?: Uint128): IFee; } /** The chain's natively implemented token (such as SCRT on Secret Network). */ declare class NativeToken extends FungibleToken { readonly denom: string; constructor(denom: string); /** The token's unique id. */ get id(): string; /** @returns false */ isCustom: () => boolean; /** @returns true */ isNative: () => boolean; fee(amount: string | number | bigint): IFee; } /** A contract-based token. */ declare class CustomToken extends FungibleToken { readonly address: Address; readonly codeHash?: string; constructor(address: Address, codeHash?: string); /** The token contract's address. */ get id(): string; /** @returns true */ isCustom: () => boolean; /** @returns false */ isNative: () => boolean; } /** A pair of tokens. */ declare class TokenPair { readonly a: Token; readonly b: Token; constructor(a: Token, b: Token); /** Reverse the pair. */ get reverse(): TokenPair; } /** A pair of token amounts. */ declare class TokenSwap { readonly a: TokenAmount | NonFungibleToken; readonly b: TokenAmount | NonFungibleToken; constructor(a: TokenAmount | NonFungibleToken, b: TokenAmount | NonFungibleToken); /** Reverse the pair. */ get reverse(): TokenSwap; } export { Token, FungibleToken as Fungible, NonFungibleToken as NonFungible, NativeToken as Native, CustomToken as Custom, TokenPair as Pair, TokenAmount as Amount, TokenSwap as Swap, }; //# sourceMappingURL=token.d.ts.map