UNPKG

opnet

Version:

The perfect library for building Bitcoin-based applications.

83 lines (82 loc) 2.56 kB
import { Address, AddressMap } from '@btc-vision/transaction'; import { CallResult } from '../../../../contracts/CallResult.js'; import { OPNetEvent } from '../../../../contracts/OPNetEvent.js'; import { IOP_NETContract } from './IOP_NETContract.js'; export type MintEvent = { to: Address; amount: bigint; }; export type TransferEvent = { from: Address; to: Address; amount: bigint; }; export type BurnEvent = { amount: bigint; }; export type ApproveEvent = { owner: Address; spender: Address; value: bigint; }; export type Name = CallResult<{ name: string; }, []>; export type BalanceOf = CallResult<{ balance: bigint; }, []>; export type SymbolOf = CallResult<{ symbol: string; }, []>; export type TotalSupply = CallResult<{ totalSupply: bigint; }, []>; export type MaxSupply = CallResult<{ maximumSupply: bigint; }, []>; export type Decimals = CallResult<{ decimals: number; }, []>; export type Transfer = CallResult<{ success: boolean; }, [ OPNetEvent<TransferEvent> ]>; export type TransferFrom = CallResult<{ success: boolean; }, [OPNetEvent<TransferEvent>]>; export type Approve = CallResult<{ success: boolean; }, [OPNetEvent<ApproveEvent>]>; export type Allowance = CallResult<{ remaining: bigint; }, []>; export type Burn = CallResult<{ success: boolean; }, [OPNetEvent<BurnEvent>]>; export type Mint = CallResult<{ success: boolean; }, [OPNetEvent<MintEvent>]>; export type Airdrop = CallResult<{ success: boolean; }, OPNetEvent<MintEvent>[]>; export type AirdropWithAmount = CallResult<{ success: boolean; }, OPNetEvent<MintEvent>[]>; export interface IOP_20Contract extends IOP_NETContract { balanceOf(account: Address): Promise<BalanceOf>; name(): Promise<Name>; symbol(): Promise<SymbolOf>; totalSupply(): Promise<TotalSupply>; maximumSupply(): Promise<MaxSupply>; decimals(): Promise<Decimals>; transfer(recipient: Address, amount: bigint): Promise<Transfer>; transferFrom(sender: Address, recipient: Address, amount: bigint): Promise<TransferFrom>; approve(spender: Address, amount: bigint): Promise<Approve>; approveFrom(spender: Address, amount: bigint, signature: Uint8Array): Promise<Approve>; allowance(owner: Address, spender: Address): Promise<Allowance>; burn(value: bigint): Promise<Burn>; mint(address: Address, value: bigint): Promise<Mint>; airdrop(map: AddressMap<bigint>): Promise<Airdrop>; airdropWithAmount(amount: bigint, addresses: Address[]): Promise<AirdropWithAmount>; }