opnet
Version:
The perfect library for building Bitcoin-based applications.
100 lines (99 loc) • 3.98 kB
TypeScript
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 MintedEvent = {
to: Address;
amount: bigint;
};
export type TransferredEvent = {
operator: Address;
from: Address;
to: Address;
amount: bigint;
};
export type BurnedEvent = {
from: Address;
amount: bigint;
};
export type ApprovedEvent = {
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 TokenIcon = CallResult<{
icon: string;
}, []>;
export type DomainSeparator = CallResult<{
domainSeparator: Uint8Array;
}, []>;
export type NonceOf = CallResult<{
nonce: bigint;
}, []>;
export type TokenMetadata = CallResult<{
name: string;
symbol: string;
icon: string;
decimals: number;
totalSupply: bigint;
domainSeparator: Uint8Array;
}, [
]>;
export type SafeTransfer = CallResult<{}, [OPNetEvent<TransferredEvent>]>;
export type Transfer = CallResult<{}, [OPNetEvent<TransferredEvent>]>;
export type TransferFrom = CallResult<{}, [OPNetEvent<TransferredEvent>]>;
export type SafeTransferFrom = CallResult<{}, [OPNetEvent<TransferredEvent>]>;
export type IncreaseAllowance = CallResult<{}, [OPNetEvent<ApprovedEvent>]>;
export type DecreaseAllowance = CallResult<{}, [OPNetEvent<ApprovedEvent>]>;
export type IncreaseAllowanceBySignature = CallResult<{}, [OPNetEvent<ApprovedEvent>]>;
export type DecreaseAllowanceBySignature = CallResult<{}, [OPNetEvent<ApprovedEvent>]>;
export type Allowance = CallResult<{
remaining: bigint;
}, []>;
export type Burn = CallResult<{}, [OPNetEvent<BurnedEvent>]>;
export type Mint = CallResult<{}, [OPNetEvent<MintedEvent>]>;
export type Airdrop = CallResult<{}, OPNetEvent<MintedEvent>[]>;
export type AirdropWithAmount = CallResult<{}, OPNetEvent<MintedEvent>[]>;
export interface IOP20Contract extends IOP_NETContract {
balanceOf(account: Address): Promise<BalanceOf>;
name(): Promise<Name>;
symbol(): Promise<SymbolOf>;
totalSupply(): Promise<TotalSupply>;
maximumSupply(): Promise<MaxSupply>;
domainSeparator(): Promise<DomainSeparator>;
nonceOf(owner: Address): Promise<NonceOf>;
decimals(): Promise<Decimals>;
icon(): Promise<TokenIcon>;
transfer(to: Address, amount: bigint, data: Uint8Array): Promise<Transfer>;
safeTransfer(to: Address, amount: bigint, data: Uint8Array): Promise<SafeTransfer>;
transferFrom(from: Address, to: Address, amount: bigint): Promise<TransferFrom>;
safeTransferFrom(from: Address, to: Address, amount: bigint, data: Uint8Array): Promise<SafeTransferFrom>;
increaseAllowance(spender: Address, amount: bigint): Promise<IncreaseAllowance>;
decreaseAllowance(spender: Address, amount: bigint): Promise<DecreaseAllowance>;
metadata(): Promise<TokenMetadata>;
increaseAllowanceBySignature(owner: Address, spender: Address, amount: bigint, deadline: bigint, signature: Uint8Array): Promise<IncreaseAllowanceBySignature>;
decreaseAllowanceBySignature(owner: Address, spender: Address, amount: bigint, deadline: bigint, signature: Uint8Array): Promise<DecreaseAllowanceBySignature>;
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>;
}