opnet
Version:
The perfect library for building Bitcoin-based applications.
108 lines (107 loc) • 4.04 kB
TypeScript
import { Address, AddressMap } from '../../../../../node_modules/@btc-vision/transaction/build/index.js';
import { CallResult } from '../../../../contracts/CallResult.js';
import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
import { IOP_NETContract } from './IOP_NETContract.js';
export type TransferredEvent = {
readonly operator: Address;
readonly from: Address;
readonly to: Address;
readonly amount: bigint;
};
export type ApprovedEvent = {
readonly owner: Address;
readonly spender: Address;
readonly amount: bigint;
};
export type BurnedEvent = {
readonly from: Address;
readonly amount: bigint;
};
export type MintedEvent = {
readonly to: Address;
readonly amount: bigint;
};
export type Name = CallResult<{
name: string;
}, [
]>;
export type SymbolOf = CallResult<{
symbol: string;
}, [
]>;
export type TokenIcon = CallResult<{
icon: string;
}, [
]>;
export type Decimals = CallResult<{
decimals: number;
}, [
]>;
export type TotalSupply = CallResult<{
totalSupply: bigint;
}, [
]>;
export type MaxSupply = CallResult<{
maximumSupply: bigint;
}, [
]>;
export type DomainSeparator = CallResult<{
domainSeparator: Uint8Array;
}, [
]>;
export type BalanceOf = CallResult<{
balance: bigint;
}, [
]>;
export type NonceOf = CallResult<{
nonce: bigint;
}, [
]>;
export type Allowance = CallResult<{
remaining: bigint;
}, [
]>;
export type Transfer = CallResult<{}, [OPNetEvent<TransferredEvent>]>;
export type TransferFrom = CallResult<{}, [OPNetEvent<TransferredEvent>]>;
export type SafeTransfer = 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 Burn = CallResult<{}, [OPNetEvent<BurnedEvent>]>;
export type Mint = CallResult<{}, OPNetEvent<MintedEvent>[]>;
export type Airdrop = CallResult<{}, OPNetEvent<MintedEvent>[]>;
export type TokenMetadata = CallResult<{
name: string;
symbol: string;
icon: string;
decimals: number;
totalSupply: bigint;
domainSeparator: Uint8Array;
}, [
]>;
export interface IOP20Contract extends IOP_NETContract {
name(): Promise<Name>;
symbol(): Promise<SymbolOf>;
icon(): Promise<TokenIcon>;
decimals(): Promise<Decimals>;
totalSupply(): Promise<TotalSupply>;
maximumSupply(): Promise<MaxSupply>;
domainSeparator(): Promise<DomainSeparator>;
balanceOf(owner: Address): Promise<BalanceOf>;
nonceOf(owner: Address): Promise<NonceOf>;
allowance(owner: Address, spender: Address): Promise<Allowance>;
transfer(to: Address, amount: bigint): Promise<Transfer>;
transferFrom(from: Address, to: Address, amount: bigint): Promise<TransferFrom>;
safeTransfer(to: Address, amount: bigint, data: Uint8Array): Promise<SafeTransfer>;
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>;
increaseAllowanceBySignature(owner: Uint8Array, ownerTweakedPublicKey: Uint8Array, spender: Address, amount: bigint, deadline: bigint, signature: Uint8Array): Promise<IncreaseAllowanceBySignature>;
decreaseAllowanceBySignature(owner: Uint8Array, ownerTweakedPublicKey: Uint8Array, spender: Address, amount: bigint, deadline: bigint, signature: Uint8Array): Promise<DecreaseAllowanceBySignature>;
burn(amount: bigint): Promise<Burn>;
metadata(): Promise<TokenMetadata>;
mint(address: Address, amount: bigint): Promise<Mint>;
airdrop(addressAndAmount: AddressMap<bigint>): Promise<Airdrop>;
}