OPNet
    Preparing search index...

    Interface IOP20Contract

    This interface represents the OP20 base contract. IOP20Contract

    Contracts

    import { Address } from '@btc-vision/transaction';
    import { IOP20Contract } from '../abi/shared/interfaces/IOP20Contract.js';
    import { OP_20_ABI } from '../abi/shared/json/OP_20_ABI.js';
    import { CallResult } from '../contracts/CallResult.js';
    import { getContract } from '../contracts/Contract.js';
    import { JSONRpcProvider } from '../providers/JSONRpcProvider.js';

    const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.org');
    const contract: IOP20Contract = getContract<IOP20Contract>(
    'bcrt1pyrs3eqwnrmd4ql3nwvx66yzp0wc24xd2t9pf8699ln340pjs7f3sar3tum',
    OP_20_ABI,
    provider,
    networks.regtest,
    );

    const address: Address = new Address([
    40, 11, 228, 172, 219, 50, 169, 155, 163, 235, 250, 102, 169, 29, 219, 65, 167, 183, 161, 210,
    254, 244, 21, 57, 153, 34, 205, 138, 4, 72, 92, 2,
    ]);

    const balanceExample = await contract.balanceOf(
    address
    );

    console.log('Balance:', balanceExample.properties.balance);
    interface IOP20Contract {
        address: string | Address;
        get p2opOrTweaked(): string;
        airdrop(map: AddressMap<bigint>): Promise<Airdrop>;
        airdropWithAmount(
            amount: bigint,
            addresses: Address[],
        ): Promise<AirdropWithAmount>;
        allowance(owner: Address, spender: Address): Promise<Allowance>;
        balanceOf(account: Address): Promise<BalanceOf>;
        burn(value: bigint): Promise<Burn>;
        currentGasParameters(): Promise<BlockGasParameters>;
        decimals(): Promise<Decimals>;
        decodeEvent(event: NetEvent): OPNetEvent;
        decodeEvents(events: ContractEvents | NetEvent[]): OPNetEvent<{}>[];
        decreaseAllowance(
            spender: Address,
            amount: bigint,
        ): Promise<DecreaseAllowance>;
        decreaseAllowanceBySignature(
            owner: Address,
            spender: Address,
            amount: bigint,
            deadline: bigint,
            signature: Uint8Array,
        ): Promise<DecreaseAllowanceBySignature>;
        deployer(): Promise<
            CallResult<
                { deployer: Address },
                OPNetEvent<ContractDecodedObjectResult>[],
            >,
        >;
        domainSeparator(): Promise<DomainSeparator>;
        encodeCalldata(method: string, ...args: unknown[]): Buffer;
        icon(): Promise<TokenIcon>;
        increaseAllowance(
            spender: Address,
            amount: bigint,
        ): Promise<IncreaseAllowance>;
        increaseAllowanceBySignature(
            owner: Address,
            spender: Address,
            amount: bigint,
            deadline: bigint,
            signature: Uint8Array,
        ): Promise<IncreaseAllowanceBySignature>;
        maximumSupply(): Promise<MaxSupply>;
        metadata(): Promise<TokenMetadata>;
        mint(address: Address, value: bigint): Promise<Mint>;
        name(): Promise<Name>;
        nonceOf(owner: Address): Promise<NonceOf>;
        safeTransfer(
            to: Address,
            amount: bigint,
            data: Uint8Array,
        ): Promise<SafeTransfer>;
        safeTransferFrom(
            from: Address,
            to: Address,
            amount: bigint,
            data: Uint8Array,
        ): Promise<SafeTransferFrom>;
        setAccessList(accessList: IAccessList): void;
        setSender(sender: Address): void;
        setSimulatedHeight(height: undefined | bigint): void;
        setTransactionDetails(tx: ParsedSimulatedTransaction): void;
        symbol(): Promise<SymbolOf>;
        totalSupply(): Promise<TotalSupply>;
        [key: symbol]: CallResult<{}, OPNetEvent<ContractDecodedObjectResult>[]>;
    }

    Hierarchy (View Summary)

    Indexable

    Index

    Properties

    address: string | Address

    Accessors

    Methods