UNPKG

@tangany/waas

Version:

node.js SDK for Tangany Wallet as a Service API

49 lines (48 loc) 2.81 kB
import { ISearchOptions } from "./interfaces/common"; import { IContractCall, IEventSearchParams } from "./interfaces/ethereum-contract"; import { EthEventIterable } from "./iterables/auto-pagination/eth-event-iterable"; import { EthEventPageIterable } from "./iterables/pagewise/eth-event-page-iterable"; import { ContractCallResult } from "./types/common"; import { Waas } from "./waas"; import { IWaasMethod } from "./waas-method"; /** * Set of methods regarding universal Ethereum smart contracts */ export declare class EthereumContract implements IWaasMethod { waas: Waas; readonly address: string; private readonly baseUrl; constructor(waas: Waas, address: string); /** * Returns an asynchronous iterable to iterate **page by page** through the Ethereum transaction events that matched the search parameters. * @param [params] - Optional search parameters * @see [docs]{@link https://docs.tangany.com/#d0eb8e46-01f4-4027-a9ff-c2cad21ef1da} */ getEvents(params?: IEventSearchParams): EthEventPageIterable; /** * Returns an asynchronous iterable that yields **one Ethereum event per iteration**. * A page of transaction events that match the search parameters is fetched and saved once, so that all items can be returned one by one. * After that, the next page is loaded from the API and processed item by item again. * @param [params] - Optional search parameters * @param [options] - Additional options that do not affect the API request but the SDK-side processing * @see [docs]{@link https://docs.tangany.com/#d0eb8e46-01f4-4027-a9ff-c2cad21ef1da} */ getEvents(params?: IEventSearchParams, options?: { autoPagination: true; }): EthEventIterable; /** * Returns an asynchronous iterable to iterate **page by page** through the Ethereum transaction events that matched the search parameters. * @param [params] - Optional search parameters * @param [options] - Additional options that do not affect the API request but the SDK-side processing * @see [docs]{@link https://docs.tangany.com/#d0eb8e46-01f4-4027-a9ff-c2cad21ef1da} */ getEvents(params?: IEventSearchParams, options?: ISearchOptions): EthEventPageIterable; /** * Executes readonly functions of arbitrary Ethereum smart contracts. * If the contract function does not require any input values, instead of the configuration object, * the overload with two parameters (function name and output data types) can be used. * The default value for the output types is ["uint256"]. So this argument can be omitted for appropriate functions. */ call(config: IContractCall): Promise<ContractCallResult>; call(functionName: string, types?: string[]): Promise<ContractCallResult>; }