@tangany/waas
Version:
node.js SDK for Tangany Wallet as a Service API
86 lines (85 loc) • 4.41 kB
TypeScript
import { EthereumContract } from "./eth-contract";
import { EthMonitorSearch } from "./eth-monitor-search";
import { ISearchOptions } from "./interfaces/common";
import { IEthereumTransaction, IEthStatus, ITransactionSearchParams } from "./interfaces/ethereum";
import { ITransactionEvent } from "./interfaces/ethereum-contract";
import { EthTransactionIterable } from "./iterables/auto-pagination/eth-transaction-iterable";
import { EthTransactionPageIterable } from "./iterables/pagewise/eth-transaction-page-iterable";
import { Waas } from "./waas";
import { IWaasMethod } from "./waas-method";
/**
* Instantiates a new Ethereum interface
* @param instance - {@link Waas} instance
* @param [txHash] - Ethereum transaction hash
*/
export declare class Ethereum implements IWaasMethod {
waas: Waas;
private readonly transactionHash?;
constructor(waas: Waas, transactionHash?: string | undefined);
get txHash(): string;
/**
* Establish a sticky session with a Ethereum full node by fetching and setting affinity cookies for the current Waas instance
*/
fetchAffinityCookie(): Promise<void>;
/**
* Returns the status for an Ethereum transaction. The transaction is not mined until a blockNr is assigned.
* @see [docs]{@link https://docs.tangany.com/#5b262285-c8a0-4e36-8a41-4a2b1f0cdb1b}
*/
get(): Promise<IEthereumTransaction>;
/**
* Returns an asynchronous iterable to iterate **page by page** through the transactions that matched the search parameters.
* @param [params] - Optional search parameters
* @see [docs]{@link https://docs.tangany.com/#63266651-76f9-4a4c-a971-0a39d6ede955}
*/
getTransactions(params?: ITransactionSearchParams): EthTransactionPageIterable;
/**
* Returns an asynchronous iterable that yields **one transaction object per iteration**.
* A page of transactions 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/#63266651-76f9-4a4c-a971-0a39d6ede955}
*/
getTransactions(params?: ITransactionSearchParams, options?: {
autoPagination: true;
}): EthTransactionIterable;
/**
* Returns an asynchronous iterable to iterate **page by page** through the transactions 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/#63266651-76f9-4a4c-a971-0a39d6ede955}
*/
getTransactions(params?: ITransactionSearchParams, options?: ISearchOptions): EthTransactionPageIterable;
/**
* Returns details of the event corresponding to the passed log index of the current transaction hash.
* @param index - Log index of the event that can be obtained by
*/
getEvent(index: number): Promise<ITransactionEvent>;
/**
* Helper: resolves when transaction is mined and rejects on errors or timeout
* Attention: method polls the API frequently and may result in excessive quota usage
* @param [timeout] - reject timeout in ms
* @param [ms] - milliseconds delay between API polling attempts
*/
wait(timeout?: number, ms?: number): Promise<IEthereumTransaction>;
/**
* Get status and information about Ethereum full-node.
* The status faulty indicates that one or more info properties are missing.
* The status unavailable is returned if all info properties are missing.
*/
getStatus(): Promise<IEthStatus>;
/**
* Queries the details for a given transaction hash.
* @param txHash - Either the transaction hash of this object instance or any other
*/
private getTransactionDetails;
/**
* Returns calls to interact with universal Ethereum smart contracts
* @param address - Smart contract address
*/
contract(address: string): EthereumContract;
/**
* Returns an object to interact with Ethereum-based monitors (possibly of different wallets).
*/
monitor(): EthMonitorSearch;
}