interface Provider {
    network: NetworkType;
    balance(address: string): Promise<bigint>;
    callContract(contract: string, method: string, data: any[], abi: any[]): Promise<undefined | Result>;
    getEventLogs(contract: string): Promise<EventLogs>;
    getTxReceipts(tx: {
        hash160: string;
        sender: string;
        txid: string;
    }, abi: any[], contract?: string): Promise<TransactionReceipt[]>;
    searchEventLogs(contract: string, topics?: string[], fromBlock?: number, toBlock?: number): Promise<EventLogs>;
    sendToContract(contract: string, method: string, data: any[], value: string, gasLimit: number, gasPrice: number, abi: any[]): Promise<any>;
}

Implemented by

Properties

network: NetworkType

Methods

  • Perform calltocontract

    Parameters

    • contract: string

      The contract address

    • method: string

      The contract method to call

    • data: any[]

      The arguments

    • abi: any[]

      The contract abi

    Returns Promise<undefined | Result>

    see Result

  • Get receipts from a transaction

    Parameters

    • tx: {
          hash160: string;
          sender: string;
          txid: string;
      }

      transaction object

      • hash160: string
      • sender: string
      • txid: string
    • abi: any[]

      The abi for the contract that was called

    • Optionalcontract: string

      the contract address, if there is one

    Returns Promise<TransactionReceipt[]>

    an array of TransactionReceipt objects

  • Search events from a contract

    Parameters

    • contract: string

      transaction object

    • Optionaltopics: string[]

      the topics to filter by

    • OptionalfromBlock: number

      the starting block height to filter by defaults to 0

    • OptionaltoBlock: number

      the end block height to filter by, defaults to -1 for most recent block

    Returns Promise<EventLogs>

    an EventLogs object

  • Perform sendtocontract

    Parameters

    • contract: string

      The contract address

    • method: string

      The contract method to send to

    • data: any[]

      The arguments to use

    • value: string

      The amount to send to the contract

    • gasLimit: number

      The amount of gas units allowed

    • gasPrice: number

      The satoshi price per gas

    • abi: any[]

      The contract abi

    Returns Promise<any>

    see Result