UNPKG

@covalenthq/client-sdk

Version:

<div align="center"> <a href="https://goldrush.dev/products/goldrush/" target="_blank" rel="noopener noreferrer"> <img alt="GoldRush TS SDK Logo" src="./repo-static/ts-sdk-banner.png" style="max-width: 100%;"/> </a> </div>

106 lines (105 loc) 8.18 kB
import { type Execution } from "../utils/functions/execution"; import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types"; import { type GetAllTransactionsForAddressQueryParamOpts, type GetTimeBucketTransactionsForAddressQueryParamOpts, type GetTransactionQueryParamOpts, type GetTransactionSummaryQueryParamOpts, type GetTransactionsForAddressV3QueryParamOpts, type GetTransactionsForBlockQueryParamOpts, type RecentTransactionsResponse, type TransactionResponse, type TransactionsBlockResponse, type TransactionsResponse, type TransactionsSummaryResponse, type TransactionsTimeBucketResponse } from "../utils/types/TransactionService.types"; /** * Transactions API * */ export declare class TransactionService { private execution; constructor(execution: Execution); /** * * Commonly used to fetch and render a single transaction including its decoded log events. * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {string} txHash - The transaction hash. * @param {GetTransactionQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `noLogs`: Omit log events. * - `withInternal`: Include internal transfers/transactions. * - `withState`: Include all transaction state changes with before and after values. * - `withInputData`: Include the transaction's input data such as the Method ID. * */ getTransaction(chainName: Chain, txHash: string, queryParamOpts?: GetTransactionQueryParamOpts): Promise<GoldRushResponse<TransactionResponse>>; /** * * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications. * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {GetAllTransactionsForAddressQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `noLogs`: Omit log events. * - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. * - `withInternal`: Include internal transfers/transactions. * - `withState`: Include all transaction state changes with before and after values. * - `withInputData`: Include the transaction's input data such as the Method ID. * */ getAllTransactionsForAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): AsyncIterable<GoldRushResponse<RecentTransactionsResponse>>; /** * * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications. * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {GetAllTransactionsForAddressQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `noLogs`: Omit log events. * - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. * - `withInternal`: Include internal transfers/transactions. * - `withState`: Include all transaction state changes with before and after values. * - `withInputData`: Include the transaction's input data such as the Method ID. * */ getAllTransactionsForAddressByPage(chainName: Chain, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<RecentTransactionsResponse>>; /** * * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions. * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {number} blockHeight - The requested block height. * @param {GetTransactionsForBlockQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `noLogs`: Omit log events. * */ getTransactionsForBlock(chainName: Chain, blockHeight: number | string | "latest", queryParamOpts?: GetTransactionsForBlockQueryParamOpts): Promise<GoldRushResponse<TransactionsBlockResponse>>; /** * * Commonly used to fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3. * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {GetTransactionSummaryQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `withGas`: Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions. * */ getTransactionSummary(chainName: Chain, walletAddress: string, queryParamOpts?: GetTransactionSummaryQueryParamOpts): Promise<GoldRushResponse<TransactionsSummaryResponse>>; /** * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {number} page - The requested page, 0-indexed. * @param {GetTransactionsForAddressV3QueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `noLogs`: Omit log events. * - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. * */ getTransactionsForAddressV3(chainName: Chain, walletAddress: string, page: number, queryParamOpts?: GetTransactionsForAddressV3QueryParamOpts): Promise<GoldRushResponse<TransactionsResponse>>; /** * * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {number} timeBucket - The 0-indexed 15-minute time bucket. E.g. 27 Feb 2023 05:23 GMT = 1677475383 (Unix time). 1677475383/900=1863861 timeBucket. * @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `noLogs`: Omit log events. * */ getTimeBucketTransactionsForAddress(chainName: Chain, walletAddress: string, timeBucket: number, queryParamOpts?: GetTimeBucketTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<TransactionsTimeBucketResponse>>; }