/**
* This module provides the foundation for typesafe Coins.
*
* **Module ID:** `0x1::coin`
*
* @module
*/
import type * as p from "@movingco/prelude";
/**
* Core data structures
* Main structure representing a coin/token in an account's custody.
*
* Type name: `0x1::coin::Coin`
*/
export interface ICoin {
/** Amount of coin this address has. */
value: p.U64;
}
/**
* Information about a specific coin type. Stored on the creator of the coin's account.
*
* Type name: `0x1::coin::CoinInfo`
*/
export interface ICoinInfo {
name: string;
/**
* Symbol of the coin, usually a shorter version of the name.
* For example, Singapore Dollar is SGD.
*/
symbol: string;
/**
* Number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` coins should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*/
decimals: number;
/** Amount of this coin type in existence. */
supply: {
vec: ReadonlyArray
;
};
}
/**
* A holder of a specific coin types and associated event handles.
* These are kept in a single resource to ensure locality of data.
*
* Type name: `0x1::coin::CoinStore`
*/
export interface ICoinStore {
coin: {
/** Amount of coin this address has. */
value: p.U64;
};
frozen: boolean;
deposit_events: {
/** Total number of events emitted to this event stream. */
counter: p.U64;
/** A globally unique ID for this event stream. */
guid: {
id: {
/** If creation_num is `i`, this is the `i+1`th GUID created by `addr` */
creation_num: p.U64;
/** Address that created the GUID */
addr: p.RawAddress;
};
};
};
withdraw_events: {
/** Total number of events emitted to this event stream. */
counter: p.U64;
/** A globally unique ID for this event stream. */
guid: {
id: {
/** If creation_num is `i`, this is the `i+1`th GUID created by `addr` */
creation_num: p.U64;
/** Address that created the GUID */
addr: p.RawAddress;
};
};
};
}
/**
* Event emitted when some amount of a coin is deposited into an account.
*
* Type name: `0x1::coin::DepositEvent`
*/
export interface IDepositEvent {
amount: p.U64;
}
/**
* Event emitted when some amount of a coin is withdrawn from an account.
*
* Type name: `0x1::coin::WithdrawEvent`
*/
export interface IWithdrawEvent {
amount: p.U64;
}
/** Payload arguments for {@link entry.transfer}. */
export declare type TransferArgs = {
args: {
/** IDL type: `Address` */
to: p.RawAddress;
/** IDL type: `U64` */
amount: p.U64;
};
typeArgs: {
CoinType: string;
};
};
export * as entry from "./entry.js";
export * as entryNames from "./entryNames.js";
export { idl } from "./idl.js";
export * as payloads from "./payloads.js";
/** The address of the module. */
export declare const ADDRESS: "0x1";
/** The full module name. */
export declare const FULL_NAME: "0x1::coin";
/** The name of the module. */
export declare const NAME: "coin";
/** Module ID information. */
export declare const id: {
readonly ADDRESS: "0x1";
readonly FULL_NAME: "0x1::coin";
readonly NAME: "coin";
};
export * as errors from "./errors.js";
/** Module error codes. */
export declare const errorCodes: {
readonly "1": {
readonly name: "ECOIN_INFO_ADDRESS_MISMATCH";
readonly doc: "Address of account which is used to initialize a coin `CoinType` doesn't match the deployer of module";
};
readonly "2": {
readonly name: "ECOIN_INFO_ALREADY_PUBLISHED";
readonly doc: "`CoinType` is already initialized as a coin";
};
readonly "3": {
readonly name: "ECOIN_INFO_NOT_PUBLISHED";
readonly doc: "`CoinType` hasn't been initialized as a coin";
};
readonly "4": {
readonly name: "ECOIN_STORE_ALREADY_PUBLISHED";
readonly doc: "Account already has `CoinStore` registered for `CoinType`";
};
readonly "5": {
readonly name: "ECOIN_STORE_NOT_PUBLISHED";
readonly doc: "Account hasn't registered `CoinStore` for `CoinType`";
};
readonly "6": {
readonly name: "EINSUFFICIENT_BALANCE";
readonly doc: "Not enough coins to complete transaction";
};
readonly "7": {
readonly name: "EDESTRUCTION_OF_NONZERO_TOKEN";
readonly doc: "Cannot destroy non-zero coins";
};
readonly "8": {
readonly name: "ETOTAL_SUPPLY_OVERFLOW";
readonly doc: "Total supply of the coin has overflown. No additional coins can be minted";
};
readonly "9": {
readonly name: "EZERO_COIN_AMOUNT";
readonly doc: "Coin amount cannot be zero";
};
readonly "10": {
readonly name: "EFROZEN";
readonly doc: "CoinStore is frozen. Coins cannot be deposited or withdrawn";
};
};
/** All module function IDLs. */
export declare const functions: {
readonly transfer: {
readonly name: "transfer";
readonly doc: "Transfers `amount` of coins `CoinType` from `from` to `to`.";
readonly ty_args: readonly ["CoinType"];
readonly args: readonly [{
readonly name: "to";
readonly ty: "address";
}, {
readonly name: "amount";
readonly ty: "u64";
}];
};
};
/** All struct types with ability `key`. */
export declare const resources: {
readonly CoinInfo: "0x1::coin::CoinInfo";
readonly CoinStore: "0x1::coin::CoinStore";
};
/** All struct types. */
export declare const structs: {
readonly BurnCapability: "0x1::coin::BurnCapability";
readonly Coin: "0x1::coin::Coin";
readonly CoinInfo: "0x1::coin::CoinInfo";
readonly CoinStore: "0x1::coin::CoinStore";
readonly DepositEvent: "0x1::coin::DepositEvent";
readonly FreezeCapability: "0x1::coin::FreezeCapability";
readonly MintCapability: "0x1::coin::MintCapability";
readonly WithdrawEvent: "0x1::coin::WithdrawEvent";
};
/** This module provides the foundation for typesafe Coins. */
export declare const moduleDefinition: {
readonly errorCodes: {
readonly "1": {
readonly name: "ECOIN_INFO_ADDRESS_MISMATCH";
readonly doc: "Address of account which is used to initialize a coin `CoinType` doesn't match the deployer of module";
};
readonly "2": {
readonly name: "ECOIN_INFO_ALREADY_PUBLISHED";
readonly doc: "`CoinType` is already initialized as a coin";
};
readonly "3": {
readonly name: "ECOIN_INFO_NOT_PUBLISHED";
readonly doc: "`CoinType` hasn't been initialized as a coin";
};
readonly "4": {
readonly name: "ECOIN_STORE_ALREADY_PUBLISHED";
readonly doc: "Account already has `CoinStore` registered for `CoinType`";
};
readonly "5": {
readonly name: "ECOIN_STORE_NOT_PUBLISHED";
readonly doc: "Account hasn't registered `CoinStore` for `CoinType`";
};
readonly "6": {
readonly name: "EINSUFFICIENT_BALANCE";
readonly doc: "Not enough coins to complete transaction";
};
readonly "7": {
readonly name: "EDESTRUCTION_OF_NONZERO_TOKEN";
readonly doc: "Cannot destroy non-zero coins";
};
readonly "8": {
readonly name: "ETOTAL_SUPPLY_OVERFLOW";
readonly doc: "Total supply of the coin has overflown. No additional coins can be minted";
};
readonly "9": {
readonly name: "EZERO_COIN_AMOUNT";
readonly doc: "Coin amount cannot be zero";
};
readonly "10": {
readonly name: "EFROZEN";
readonly doc: "CoinStore is frozen. Coins cannot be deposited or withdrawn";
};
};
readonly functions: {
readonly transfer: {
readonly name: "transfer";
readonly doc: "Transfers `amount` of coins `CoinType` from `from` to `to`.";
readonly ty_args: readonly ["CoinType"];
readonly args: readonly [{
readonly name: "to";
readonly ty: "address";
}, {
readonly name: "amount";
readonly ty: "u64";
}];
};
};
readonly resources: {
readonly CoinInfo: "0x1::coin::CoinInfo";
readonly CoinStore: "0x1::coin::CoinStore";
};
readonly structs: {
readonly BurnCapability: "0x1::coin::BurnCapability";
readonly Coin: "0x1::coin::Coin";
readonly CoinInfo: "0x1::coin::CoinInfo";
readonly CoinStore: "0x1::coin::CoinStore";
readonly DepositEvent: "0x1::coin::DepositEvent";
readonly FreezeCapability: "0x1::coin::FreezeCapability";
readonly MintCapability: "0x1::coin::MintCapability";
readonly WithdrawEvent: "0x1::coin::WithdrawEvent";
};
readonly ADDRESS: "0x1";
readonly FULL_NAME: "0x1::coin";
readonly NAME: "coin";
};
//# sourceMappingURL=index.d.ts.map