@moralisweb3/common-streams-utils
Version:
1,473 lines (1,442 loc) • 149 kB
TypeScript
import { AptosNetworkInput, AptosNetwork, AptosAddressInput, AptosAddress } from '@moralisweb3/common-aptos-utils';
import * as _moralisweb3_common_core from '@moralisweb3/common-core';
import { MoralisDataObject, MoralisData, BigNumberish, BigNumber, MoralisDataObjectValue, MoralisDataFormatted, Camelize, ResponseAdapter, Operation, PaginatedResponseAdapter, PaginatedOperation } from '@moralisweb3/common-core';
import * as _moralisweb3_common_evm_utils from '@moralisweb3/common-evm-utils';
import { EvmAddressish, EvmAddress, EvmChainish, EvmChain, EvmNativeish, EvmNative, EvmSignature, EvmSimpleBlock } from '@moralisweb3/common-evm-utils';
import * as _ethersproject_abi from '@ethersproject/abi';
import { Interface } from '@ethersproject/abi';
import { INFTApproval, IWebhook } from '@moralisweb3/streams-typings';
type StreamStatus = 'active' | 'paused' | 'error' | 'terminated';
interface AptosStreamInput {
id: string;
allAddresses: boolean;
demo: boolean;
description: string;
includeChanges: boolean;
includeEvents: boolean;
includePayload: boolean;
isErrorSince: string | null;
network: AptosNetworkInput[];
status: StreamStatus;
statusMessage: string;
events: string[];
functions: string[];
tag: string;
webhookUrl: string;
amountOfAddresses: number;
}
interface AptosStreamData {
id: string;
allAddresses: boolean;
demo: boolean;
description: string;
includeChanges: boolean;
includeEvents: boolean;
includePayload: boolean;
isErrorSince: string | null;
network: AptosNetwork[];
status: StreamStatus;
statusMessage: string;
events: string[];
functions: string[];
tag: string;
webhookUrl: string;
amountOfAddresses: number;
}
type AptosStreamJSON = {
id: string;
allAddresses: boolean;
demo: boolean;
description: string;
includeChanges: boolean;
includeEvents: boolean;
includePayload: boolean;
isErrorSince: string | null;
network: string[];
status: StreamStatus;
statusMessage: string;
events: string[];
functions: string[];
tag: string;
webhookUrl: string;
amountOfAddresses: number;
};
type AptosStreamish = AptosStreamInput | AptosStream;
/**
* The AptosStream class is a representation of an Aptos Stream that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class AptosStream implements MoralisDataObject {
private _data;
constructor(data: AptosStreamInput);
/**
* Create a new instance of AptosStream
*
* @param data - the AptosStreamish type
* @example
* ```ts
* const aptosStream = AptosStream.create(data);
* ```
* @returns an instance of AptosStream
*/
static create(data: AptosStreamish): AptosStream;
private static parse;
/**
* Compares two AptosStream data. It checks a deep equality check of both values.
* @param valueA - the first AptosStreamish data to compare
* @param valueB - the second AptosStreamish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* AptosStream.equals(valueA, valueB);
* ```
*/
static equals(valueA: AptosStreamish, valueB: AptosStreamish): boolean;
/**
* Compares an AptosStreamish data to this AptosStream instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* aptosStream.equals(value);
* ```
*/
equals(value: AptosStreamish): boolean;
/**
* Converts the AptosStream instance to a JSON object.
* @returns JSON object of the AptosStream instance
* @example `aptosStream.toJSON()`
*/
toJSON(): AptosStreamJSON;
/**
* Converts the AptosStream instance to a JSON object.
* @returns JSON object of the AptosStream instance
* @example `aptosStream.format()`
*/
format(): AptosStreamJSON;
get network(): AptosNetwork[];
get webhookUrl(): string;
get description(): string;
get tag(): string;
get allAddresses(): boolean;
get id(): string;
get status(): StreamStatus;
get statusMessage(): string;
get demo(): boolean;
get includeChanges(): boolean;
get includeEvents(): boolean;
get includePayload(): boolean;
get isErrorSince(): string | null;
get events(): string[];
get functions(): string[];
get amountOfAddresses(): number;
}
/**
* This can be a string that starts with $ and is the path of any field in the stream data.
*/
type StreamSelectorInput = string;
/**
* Valid input for a new StreamSelector instance.
* This can be an existing StreamSelector or a valid input string.
*/
type StreamSelectorish = StreamSelector | StreamSelectorInput;
/**
* The StreamSelector class is a representation of a stream selector
*
* Use this class any time you want to use a value in your stream trigger data that is not a static value
*
* @category DataType
*/
declare class StreamSelector implements MoralisData {
private readonly _value;
/**
* Create a new instance of StreamSelector from any valid stream data field
*
* @example
* ```
* const receiverSelector = StreamSelector.create('$to')
* const selector = StreamSelector.create('$contract')
* ```
*/
constructor(data: StreamSelectorInput);
static isSelectorString(selector: StreamSelectorish): boolean;
static create(streamSelector: StreamSelectorish): StreamSelector;
private static parse;
/**
* Compares two StreamSelector data. It checks a deep equality check of both values.
* @param valueA - the first StreamSelectorish data to compare
* @param valueB - the second StreamSelectorish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamSelector.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamSelectorish, valueB: StreamSelectorish): boolean;
/**
* Compares an StreamSelectorish data to this StreamSelector instance.
* @param streamSelector - the streamSelector to compare
* @returns true if the streamSelector is equal to the current instance, false otherwise
* @example
* ```ts
* streamSelector.equals(streamSelector);
* ```
*/
equals(streamSelector: StreamSelectorish): boolean;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): string;
/**
* @returns the selector path
* @example '$from'
*/
get value(): string;
toJSON(): string;
}
interface StreamTriggerInput {
type: 'tx' | 'log' | 'erc20transfer' | 'erc20approval' | 'nfttransfer';
contractAddress: StreamSelectorish | EvmAddressish;
functionAbi: unknown;
inputs?: (string | string[])[];
topic0?: string;
callFrom?: StreamSelectorish | EvmAddressish;
}
interface StreamTriggerData {
type: 'tx' | 'log' | 'erc20transfer' | 'erc20approval' | 'nfttransfer';
contractAddress: StreamSelector | EvmAddress;
functionAbi: unknown;
inputs?: (string | string[])[];
topic0?: string;
callFrom?: StreamSelector | EvmAddress;
}
type StreamTriggerJSON = {
type: 'tx' | 'log' | 'erc20transfer' | 'erc20approval' | 'nfttransfer';
contractAddress: string;
functionAbi: any;
inputs?: (string | string[])[];
topic0?: string;
callFrom?: string;
};
type StreamTriggerish = StreamTrigger | StreamTriggerInput | StreamTriggerData;
/**
* The StreamTrigger class is a representation of a stream trigger that is used by the Moralis Stream API
*
* @category DataType
*/
declare class StreamTrigger implements MoralisDataObject {
private readonly _data;
constructor(data: StreamTriggerInput);
static create(data: StreamTriggerish): StreamTrigger;
private static parseSelectorOrAddress;
private static parse;
static equals(valueA: StreamTriggerish, valueB: StreamTriggerish): boolean;
/**
* Compares two StreamTrigger arrays. It checks a deep equality check of both values, meaning that all the values have to be on both arrays.
* @param valueA - the first StreamTriggerish[] data to compare
* @param valueB - the second StreamTriggerish[] data to compare
* @returns true if all values are equal, false otherwise
* @example
* ```ts
* StreamTrigger.arrayEquals(valueA, valueB);
* ```
*/
static arrayEquals(valueA: StreamTriggerish[], valueB: StreamTriggerish[]): boolean;
/**
* Compares an StreamTrigger data to this StreamTrigger instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* streamTrigger.equals(value);
* ```
*/
equals(value: StreamTriggerish): boolean;
/**
* Converts the StreamTrigger instance to a JSON object.
* @returns JSON object of the StreamTrigger instance
* @example `streamTrigger.toJSON()`
*/
toJSON(): StreamTriggerJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamTriggerJSON;
get type(): "tx" | "log" | "erc20transfer" | "erc20approval" | "nfttransfer";
get contractAddress(): StreamSelector | EvmAddress;
get functionAbi(): unknown;
get inputs(): (string | string[])[] | undefined;
get topic0(): string | undefined;
get callFrom(): StreamSelector | EvmAddress | undefined;
}
type EvmAbi = any[];
type EvmStreamAdvancedOptions = {
topic0: string;
filter?: Record<string, any>;
includeNativeTxs?: boolean;
};
type GetNativeBalanceType = 'tx' | 'log' | 'erc20transfer' | 'erc20approval' | 'nfttransfer' | 'internalTx';
interface EvmStreamInput {
webhookUrl: string;
description: string;
tag: string;
topic0?: string[] | null;
allAddresses?: boolean;
includeNativeTxs?: boolean;
includeContractLogs?: boolean;
includeInternalTxs?: boolean;
includeAllTxLogs?: boolean;
abi?: EvmAbi | null;
advancedOptions?: EvmStreamAdvancedOptions[] | null;
chainIds: EvmChainish[];
id: string;
status: string;
statusMessage: string;
triggers?: StreamTriggerish[] | null;
getNativeBalances?: {
selectors: string[];
type: GetNativeBalanceType;
}[];
}
interface EvmStreamData {
webhookUrl: string;
description: string;
tag: string;
topic0?: string[];
allAddresses: boolean;
includeNativeTxs: boolean;
includeContractLogs: boolean;
includeInternalTxs: boolean;
includeAllTxLogs: boolean;
abi?: EvmAbi;
advancedOptions?: EvmStreamAdvancedOptions[];
chains: EvmChain[];
id: string;
status: string;
statusMessage: string;
triggers?: StreamTrigger[];
getNativeBalances?: {
selectors: string[];
type: GetNativeBalanceType;
}[];
}
type EvmStreamJSON = {
webhookUrl: string;
description: string;
tag: string;
topic0?: string[];
allAddresses: boolean;
includeNativeTxs: boolean;
includeContractLogs: boolean;
includeInternalTxs: boolean;
includeAllTxLogs: boolean;
abi?: EvmAbi;
advancedOptions?: EvmStreamAdvancedOptions[];
chainIds: (string | number)[];
id: string;
status: string;
statusMessage: string;
triggers?: StreamTriggerJSON[];
getNativeBalances?: {
selectors: string[];
type: GetNativeBalanceType;
}[];
};
type EvmStreamish = EvmStreamInput | EvmStream;
/**
* The EvmStream class is a representation of Moralis Stream that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class EvmStream implements MoralisDataObject {
private _data;
constructor(data: EvmStreamInput);
/**
* Create a new instance of EvmStream
*
* @param data - the EvmStreamish type
* @example
* ```ts
* const evmStream = EvmStream.create(data);
* ```
* @returns an instance of EvmStream
*/
static create(data: EvmStreamish): EvmStream;
private static parse;
/**
* Compares two EvmStream data. It checks a deep equality check of both values.
* @param valueA - the first EvmStreamish data to compare
* @param valueB - the second EvmStreamish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* EvmStream.equals(valueA, valueB);
* ```
*/
static equals(valueA: EvmStreamish, valueB: EvmStreamish): boolean;
/**
* Compares an EvmStreamish data to this EvmStream instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* evmStream.equals(value);
* ```
*/
equals(value: EvmStreamish): boolean;
/**
* Converts the EvmStream instance to a JSON object.
* @returns JSON object of the EvmStream instance
* @example `evmStream.toJSON()`
*/
toJSON(): EvmStreamJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): EvmStreamJSON;
get chains(): EvmChain[];
get chainIds(): string[];
get webhookUrl(): string;
get description(): string;
get tag(): string;
get topic0(): string[] | undefined;
get allAddresses(): boolean;
get includeNativeTxs(): boolean;
get includeContractLogs(): boolean;
get includeInternalTxs(): boolean;
get includeAllTxLogs(): boolean;
get abi(): EvmAbi | undefined;
get advancedOptions(): EvmStreamAdvancedOptions[] | undefined;
get id(): string;
get status(): string;
get statusMessage(): string;
get triggers(): StreamTrigger[] | undefined;
get getNativeBalances(): {
selectors: string[];
type: GetNativeBalanceType;
}[] | undefined;
}
interface StreamNativeBalanceInput {
address: EvmAddressish;
balance: EvmNativeish;
}
interface StreamNativeBalanceData {
address: EvmAddress;
balance: EvmNative;
}
type StreamNativeBalanceJSON = {
address: string;
balance: string;
};
type StreamNativeBalanceish = StreamNativeBalance | StreamNativeBalanceInput | StreamNativeBalanceData;
/**
* The NativeBalance class is a representation of a nativeBalance-address pair
*
* @category DataType
*/
declare class StreamNativeBalance implements MoralisDataObject {
private readonly _data;
constructor(data: StreamNativeBalanceInput);
static create(data: StreamNativeBalanceish): StreamNativeBalance;
private static parse;
static equals(valueA: StreamNativeBalanceish, valueB: StreamNativeBalanceish): boolean;
/**
* Compares an NativeBalance data to this NativeBalance instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* nativeBalanceTrigger.equals(value);
* ```
*/
equals(value: StreamNativeBalanceish): boolean;
/**
* Converts the NativeBalance instance to a JSON object.
* @returns JSON object of the NativeBalance instance
* @example `nativeBalanceTrigger.toJSON()`
*/
toJSON(): StreamNativeBalanceJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamNativeBalanceJSON;
get address(): EvmAddress;
get balance(): EvmNative;
}
interface StreamTriggerOutputInput {
name: string;
value: string;
}
interface StreamTriggerOutputData {
name: string;
value: string;
}
type StreamTriggerOutputJSON = {
name: string;
value: string;
};
type StreamTriggerOutputish = StreamTriggerOutput | StreamTriggerOutputInput | StreamTriggerOutputData;
/**
* The StreamTrigger class is a representation of a stream trigger that is used by the Moralis Stream API
*
* @category DataType
*/
declare class StreamTriggerOutput implements MoralisDataObject {
private readonly _data;
constructor(data: StreamTriggerOutputInput);
static create(data: StreamTriggerOutputish): StreamTriggerOutput;
private static parse;
/**
* Compares two StreamTriggerOutput data. It checks a deep equality check of both values.
* @param valueA - the first StreamTriggerOutputish data to compare
* @param valueB - the second StreamTriggerOutputish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamTriggerOutput.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamTriggerOutputish, valueB: StreamTriggerOutputish): boolean;
/**
* Compares two StreamTriggerOutput arrays. It checks a deep equality check of both values, meaning that all the values have to be on both arrays.
* @param valueA - the first StreamTriggerOutputish[] data to compare
* @param valueB - the second StreamTriggerOutputish[] data to compare
* @returns true if all values are equal, false otherwise
* @example
* ```ts
* StreamTriggerOutput.arrayEquals(valueA, valueB);
* ```
*/
static arrayEquals(valueA: StreamTriggerOutputish[], valueB: StreamTriggerOutputish[]): boolean;
/**
* Compares an StreamTriggerOutputish data to this StreamTriggerOutput instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* streamTriggerOutput.equals(value);
* ```
*/
equals(value: StreamTriggerOutputish): boolean;
/**
* Converts the StreamTriggerOutput instance to a JSON object.
* @returns JSON object of the StreamTriggerOutput instance
* @example `streamTriggerOutput.toJSON()`
*/
toJSON(): StreamTriggerOutputJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamTriggerOutputJSON;
get name(): string;
get value(): string;
}
interface StreamErc1155ApprovalInput {
chain: EvmChainish;
transactionHash: string;
contract: EvmAddressish;
logIndex: number | string;
account: EvmAddressish;
operator: EvmAddressish;
approved: boolean;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutputish[];
}
interface StreamErc1155ApprovalData {
chain: EvmChain;
transactionHash: string;
contract: EvmAddress;
logIndex: number;
account: EvmAddress;
operator: EvmAddress;
approved: boolean;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutput[];
}
type StreamErc1155ApprovalJSON = {
chain: number | string;
transactionHash: string;
contract: string;
logIndex: number | string;
account: string;
operator: string;
approved: boolean;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamErc1155Approvalish = StreamErc1155ApprovalInput | StreamErc1155Approval;
/**
* The StreamErc1155Approval class is a representation of a nft approval (ERC1155) that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamErc1155Approval implements MoralisDataObject {
/**
* Create a new instance of StreamErc1155Approval
*
* @param data - the StreamErc1155Approvalish type
* @example
* ```ts
* const evmNftApproval = StreamErc1155Approval.create(data);
* ```
* @returns an instance of StreamErc1155Approval
*/
static create(data: StreamErc1155Approvalish): StreamErc1155Approval;
private _data;
constructor(data: StreamErc1155ApprovalInput);
private static parse;
/**
* Compares two StreamErc1155Approval data. It checks a deep equality check of both values.
* @param valueA - the first StreamErc1155Approvalish data to compare
* @param valueB - the second StreamErc1155Approvalish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamErc1155Approval.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamErc1155Approvalish, valueB: StreamErc1155Approvalish): boolean;
/**
* Compares an StreamErc1155Approvalish data to this StreamErc1155Approval instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* evmNftApproval.equals(value);
* ```
*/
equals(value: StreamErc1155Approvalish): boolean;
/**
* Converts the StreamErc1155Approval instance to a JSON object.
* @returns JSON object of the StreamErc1155Approval instance
* @example `evmNftApproval.toJSON()`
*/
toJSON(): StreamErc1155ApprovalJSON;
/**
* Converts the StreamErc1155Approval instance to a JSON object.
* @returns JSON object of the StreamErc1155Approval instance
* @example `evmNftApproval.format()`
*/
format(): StreamErc1155ApprovalJSON;
get chain(): EvmChain;
get approved(): boolean;
get transactionHash(): string;
get contract(): EvmAddress;
get logIndex(): number;
get account(): EvmAddress;
get operator(): EvmAddress;
get tokenContractType(): string;
get tokenName(): string;
get tokenSymbol(): string;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamErc721ApprovalInput {
chain: EvmChainish;
owner: EvmAddressish;
transactionHash: string;
contract: EvmAddressish;
logIndex: number | string;
approved: EvmAddressish;
tokenId: string;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutputish[];
}
interface StreamErc721ApprovalData {
chain: EvmChain;
owner: EvmAddress;
transactionHash: string;
contract: EvmAddress;
logIndex: number;
approved: EvmAddress;
tokenId: string;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutput[];
}
type StreamErc721ApprovalJSON = {
chain: number | string;
owner: string;
transactionHash: string;
contract: string;
logIndex: number;
approved: string;
tokenId: string;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamErc721Approvalish = StreamErc721ApprovalInput | StreamErc721Approval;
/**
* The StreamErc1155Approval class is a representation of a nft approval (ERC721) that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamErc721Approval implements MoralisDataObject {
/**
* Create a new instance of StreamErc721Approval
*
* @param data - the StreamErc721Approvalish type
* @example
* ```ts
* const evmNftApproval = StreamErc721Approval.create(data);
* ```
* @returns an instance of StreamErc721Approval
*/
static create(data: StreamErc721Approvalish): StreamErc721Approval;
private _data;
constructor(data: StreamErc721ApprovalInput);
private static parse;
/**
* Compares two StreamErc721Approval data. It checks a deep equality check of both values.
* @param valueA - the first StreamErc721Approvalish data to compare
* @param valueB - the second StreamErc721Approvalish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamErc721Approval.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamErc721Approvalish, valueB: StreamErc721Approvalish): boolean;
/**
* Compares an StreamErc721Approvalish data to this StreamErc721Approval instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* evmNftApproval.equals(value);
* ```
*/
equals(value: StreamErc721Approvalish): boolean;
/**
* Converts the StreamErc721Approval instance to a JSON object.
* @returns JSON object of the StreamErc721Approval instance
* @example `evmNftApproval.toJSON()`
*/
toJSON(): StreamErc721ApprovalJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamErc721ApprovalJSON;
get chain(): EvmChain;
get approved(): EvmAddress;
get owner(): EvmAddress;
get transactionHash(): string;
get contract(): EvmAddress;
get logIndex(): number;
get tokenId(): string;
get tokenContractType(): string;
get tokenName(): string;
get tokenSymbol(): string;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamErc20ApprovalInput {
chain: EvmChainish;
transactionHash: string;
contract: EvmAddressish;
logIndex: string | number;
owner: EvmAddressish;
spender: EvmAddressish;
value: BigNumberish;
tokenDecimals: number | string;
tokenName: string;
tokenSymbol: string;
valueWithDecimals?: null | string;
triggers?: StreamTriggerOutputish[];
}
interface StreamErc20ApprovalData {
chain: EvmChain;
transactionHash: string;
contract: EvmAddress;
logIndex: string | number;
owner: EvmAddress;
spender: EvmAddress;
value: BigNumber;
tokenDecimals?: number;
tokenName: string;
tokenSymbol: string;
valueWithDecimals?: string;
triggers?: StreamTriggerOutput[];
}
type StreamErc20ApprovalJSON = {
chain: number | string;
transactionHash: string;
contract: string;
logIndex: string | number;
owner: string;
spender: string;
value: string;
tokenDecimals?: number;
tokenName: string;
tokenSymbol: string;
valueWithDecimals?: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamErc20Approvalish = StreamErc20ApprovalInput | StreamErc20Approval;
/**
* The StreamErc20Transfer class is a representation of a erc20 approval that is returned by the Moralis Stream API
*
* @category DataTypexw
*/
declare class StreamErc20Approval implements MoralisDataObject {
/**
* Create a new instance of StreamErc20Approval
*
* @param data - the StreamErc20Approvalish type
* @example
* ```ts
* const erc20Approval = StreamErc20Approval.create(data);
* ```
* @returns an instance of StreamErc20Approval
*/
static create(data: StreamErc20Approvalish): StreamErc20Approval;
private _data;
constructor(data: StreamErc20ApprovalInput);
private static parse;
/**
* Compares two StreamErc20Approval data. It checks a deep equality check of both values.
* @param valueA - the first StreamErc20Approvalish data to compare
* @param valueB - the second StreamErc20Approvalish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamErc20Approval.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamErc20Approvalish, valueB: StreamErc20Approvalish): boolean;
/**
* Compares an StreamErc20Approvalish data to this StreamErc20Approval instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* erc20Approval.equals(value);
* ```
*/
equals(value: StreamErc20Approvalish): boolean;
/**
* Converts the StreamErc20Approval instance to a JSON object.
* @returns JSON object of the StreamErc20Approval instance
* @example `erc20Approval.toJSON()`
*/
toJSON(): StreamErc20ApprovalJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamErc20ApprovalJSON;
get chain(): EvmChain;
get transactionHash(): string;
get logIndex(): string | number;
get owner(): EvmAddress;
get spender(): EvmAddress;
get value(): BigNumber;
get contract(): EvmAddress;
get tokenName(): string;
get tokenSymbol(): string;
get tokenDecimals(): number | undefined;
get valueWithDecimals(): string | undefined;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamErc20TransferInput {
chain: EvmChainish;
transactionHash: string;
contract: EvmAddressish;
logIndex: string | number;
from: EvmAddressish;
to: EvmAddressish;
value: BigNumberish;
tokenDecimals: number | string;
tokenName: string;
tokenSymbol: string;
valueWithDecimals?: null | string;
triggers?: StreamTriggerOutputish[];
}
interface StreamErc20TransferData {
chain: EvmChain;
transactionHash: string;
contract: EvmAddress;
logIndex: string | number;
from: EvmAddress;
to: EvmAddress;
value: BigNumber;
tokenDecimals?: number;
tokenName: string;
tokenSymbol: string;
valueWithDecimals?: string;
triggers?: StreamTriggerOutput[];
}
type StreamErc20TransferJSON = {
chain: number | string;
transactionHash: string;
contract: string;
logIndex: string | number;
from: string;
to: string;
value: string;
tokenDecimals?: number;
tokenName: string;
tokenSymbol: string;
valueWithDecimals?: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamErc20Transferish = StreamErc20TransferInput | StreamErc20Transfer;
/**
* The StreamErc20Transfer class is a representation of a erc20 transfer that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamErc20Transfer implements MoralisDataObject {
private _data;
constructor(data: StreamErc20TransferInput);
/**
* Create a new instance of StreamErc20Transfer
*
* @param data - the StreamErc20Transferish type
* @example
* ```ts
* const erc20Transfer = StreamErc20Transfer.create(data);
* ```
* @returns an instance of StreamErc20Transfer
*/
static create(data: StreamErc20Transferish): StreamErc20Transfer;
private static parse;
/**
* Compares two StreamErc20Transfer data. It checks a deep equality check of both values.
* @param valueA - the first StreamErc20Transferish data to compare
* @param valueB - the second StreamErc20Transferish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamErc20Transfer.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamErc20Transferish, valueB: StreamErc20Transferish): boolean;
/**
* Compares an StreamErc20Transferish data to this StreamErc20Transfer instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* erc20Transfer.equals(value);
* ```
*/
equals(value: StreamErc20Transferish): boolean;
/**
* Converts the StreamErc20Transfer instance to a JSON object.
* @returns JSON object of the StreamErc20Transfer instance
* @example `erc20Transfer.toJSON()`
*/
toJSON(): StreamErc20TransferJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamErc20TransferJSON;
get chain(): EvmChain;
get transactionHash(): string;
get logIndex(): string | number;
get from(): EvmAddress;
get to(): EvmAddress;
get value(): BigNumber;
get contract(): EvmAddress;
get tokenName(): string;
get tokenSymbol(): string;
get tokenDecimals(): number | undefined;
get valueWithDecimals(): string | undefined;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamEvmInternalTransactionInput {
chain: EvmChainish;
from?: null | EvmAddressish;
to?: null | EvmAddressish;
value?: null | BigNumberish;
transactionHash: string;
gas?: null | BigNumberish;
triggers?: StreamTriggerOutputish[];
}
interface StreamEvmInternalTransactionData {
chain: EvmChain;
from?: EvmAddress;
to?: EvmAddress;
value?: BigNumber;
transactionHash: string;
gas?: BigNumber;
triggers?: StreamTriggerOutput[];
}
type StreamEvmInternalTransactionJSON = {
chain: string | number;
from?: string;
to?: string;
value?: string;
transactionHash: string;
gas?: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamEvmInternalTransactionish = StreamEvmInternalTransactionInput | StreamEvmInternalTransaction;
/**
* The StreamEvmInternalTransaction class is a representation of an internal transaction that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamEvmInternalTransaction implements MoralisDataObject {
private _data;
constructor(data: StreamEvmInternalTransactionInput);
/**
* Create a new instance of StreamEvmInternalTransactionish
*
* @param data - the StreamEvmInternalTransactionishish type
* @example
* ```ts
* const transaction = StreamEvmTransactionish.create(data);
* ```
* @returns an instance of StreamEvmInternalTransaction
*/
static create(data: StreamEvmInternalTransactionish): StreamEvmInternalTransaction;
private static parse;
/**
* Compares two StreamEvmInternalTransaction data. It checks a deep equality check of both values.
* @param valueA - the first StreamEvmInternalTransactionish data to compare
* @param valueB - the second StreamEvmInternalTransactionish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamEvmInternalTransaction.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamEvmInternalTransactionish, valueB: StreamEvmInternalTransactionish): boolean;
/**
* Compares an StreamEvmInternalTransactionish data to this StreamEvmInternalTransaction instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* evmInternalTransaction.equals(value);
* ```
*/
equals(value: StreamEvmInternalTransactionish): boolean;
/**
* Converts the StreamEvmInternalTransaction instance to a JSON object.
* @returns JSON object of the StreamEvmInternalTransaction instance
* @example `evmInternalTransaction.toJSON()`
*/
toJSON(): StreamEvmInternalTransactionJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamEvmInternalTransactionJSON;
get chain(): EvmChain;
get from(): EvmAddress | undefined;
get to(): EvmAddress | undefined;
get value(): BigNumber | undefined;
get transactionHash(): string;
get gas(): BigNumber | undefined;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamEvmNftTransferInput {
chain: EvmChainish;
transactionHash: string;
contract: EvmAddressish;
logIndex: string | number;
operator?: EvmAddressish | null;
from: EvmAddressish;
to: EvmAddressish;
tokenId: string;
amount: string | number;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutputish[];
}
interface StreamEvmNftTransferData {
chain: EvmChain;
transactionHash: string;
contract: EvmAddress;
logIndex: number;
operator?: EvmAddress;
from: EvmAddress;
to: EvmAddress;
tokenId: string;
amount: number;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutput[];
}
type StreamEvmNftTransferJSON = {
chain: string | number;
transactionHash: string;
contract: string;
logIndex: number;
operator?: string;
from: string;
to: string;
tokenId: string;
amount: number;
tokenContractType: string;
tokenName: string;
tokenSymbol: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamEvmNftTransferish = StreamEvmNftTransfer | StreamEvmNftTransferInput;
/**
* The StreamEvmNftTransfer class is a representation of a nft transfer (EREC721 or ERC1155) that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamEvmNftTransfer implements MoralisDataObject {
private _data;
constructor(data: StreamEvmNftTransferInput);
/**
* Create a new instance of StreamEvmNftTransferish
*
* @param data - the StreamEvmNftTransferishish type
* @example
* ```ts
* const transfer = StreamEvmTransactionish.create(data);
* ```
* @returns an instance of StreamEvmNftTransfer
*/
static create(data: StreamEvmNftTransferish): StreamEvmNftTransfer;
private static parse;
/**
* Compares two StreamEvmNftTransfer data. It checks a deep equality check of both values.
* @param valueA - the first StreamEvmNftTransferish data to compare
* @param valueB - the second StreamEvmNftTransferish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamEvmNftTransfer.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamEvmNftTransferish, valueB: StreamEvmNftTransferish): boolean;
/**
* Compares an StreamEvmNftTransferish data to this StreamEvmNftTransfer instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* transfer.equals(value);
* ```
*/
equals(value: StreamEvmNftTransferish): boolean;
/**
* Converts the StreamEvmNftTransfer instance to a JSON object.
* @returns JSON object of the StreamEvmNftTransfer instance
* @example `transfer.toJSON()`
*/
toJSON(): StreamEvmNftTransferJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamEvmNftTransferJSON;
get chain(): EvmChain;
get transactionHash(): string;
get from(): EvmAddress;
get to(): EvmAddress;
get contract(): EvmAddress;
get logIndex(): number;
get tokenId(): string;
get amount(): number;
get tokenContractType(): string;
get tokenName(): string;
get tokenSymbol(): string;
get operator(): EvmAddress | undefined;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamEvmTransactionInput {
chain: EvmChainish;
hash: string;
gas?: BigNumberish | null;
gasPrice?: BigNumberish | null;
nonce?: BigNumberish | null;
input?: string | null;
transactionIndex: number | string;
fromAddress: EvmAddressish;
toAddress?: EvmAddressish | null;
value?: BigNumberish | null;
type?: number | string | null;
receiptCumulativeGasUsed?: BigNumberish | null;
receiptGasUsed?: BigNumberish | null;
receiptContractAddress?: EvmAddressish | null;
receiptRoot?: string | null;
receiptStatus?: number | string | null;
r?: string | null;
s?: string | null;
v?: number | string | null;
triggers?: StreamTriggerOutputish[];
}
interface StreamEvmTransactionData {
chain: EvmChain;
hash: string;
gas?: BigNumber;
gasPrice?: BigNumber;
nonce?: BigNumber;
input?: string;
transactionIndex: number;
fromAddress: EvmAddress;
toAddress?: EvmAddress;
value?: BigNumber;
type?: number;
receiptCumulativeGasUsed?: BigNumber;
receiptGasUsed?: BigNumber;
receiptContractAddress?: EvmAddress;
receiptRoot?: string;
receiptStatus?: number;
signature?: EvmSignature;
triggers?: StreamTriggerOutput[];
}
type StreamEvmTransactionJSON = {
chain: string | number;
hash: string;
gas?: string;
gasPrice?: string;
nonce?: string;
input?: string;
transactionIndex: number;
fromAddress: string;
toAddress?: string;
value?: string;
type?: number;
receiptCumulativeGasUsed?: string;
receiptGasUsed?: string;
receiptContractAddress?: string;
receiptRoot?: string;
receiptStatus?: number;
r?: string;
s?: string;
v?: number;
triggers?: StreamTriggerOutputJSON[];
};
type StreamEvmTransactionish = StreamEvmTransaction | StreamEvmTransactionInput;
/**
* The StreamEvmTransaction class is a representation of a transaction that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamEvmTransaction implements MoralisDataObject {
private _data;
constructor({ ...data }: StreamEvmTransactionInput);
/**
* Create a new instance of StreamEvmTransactionish
*
* @param data - the StreamEvmTransactionishish type
* @example
* ```ts
* const transaction = StreamEvmTransactionish.create(data);
* ```
* @returns an instance of StreamEvmTransaction
*/
static create(data: StreamEvmTransactionish): StreamEvmTransaction;
private static parse;
/**
* Compares two StreamEvmTransaction data. It checks a deep equality check of both values.
* @param valueA - the first StreamEvmTransactionish data to compare
* @param valueB - the second StreamEvmTransactionish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamEvmTransaction.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamEvmTransactionish, valueB: StreamEvmTransactionish): boolean;
/**
* Compares an StreamEvmTransactionish data to this StreamEvmTransaction instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* transaction.equals(value);
* ```
*/
equals(value: StreamEvmTransactionish): boolean;
/**
* Converts the StreamEvmTransaction instance to a JSON object.
* @returns JSON object of the StreamEvmTransaction instance
* @example `transaction.toJSON()`
*/
toJSON(): StreamEvmTransactionJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamEvmTransactionJSON;
get chain(): EvmChain;
get input(): string | undefined;
get transactionIndex(): number;
get fromAddress(): EvmAddress;
get toAddress(): EvmAddress | undefined;
get receiptGasUsed(): BigNumber | undefined;
get receiptCumulativeGasUsed(): BigNumber | undefined;
get receiptContractAddress(): EvmAddress | undefined;
get signature(): EvmSignature | undefined;
get r(): string | undefined;
get s(): string | undefined;
get v(): number | undefined;
get hash(): string;
get gas(): BigNumber | undefined;
get gasPrice(): BigNumber | undefined;
get nonce(): BigNumber | undefined;
get value(): BigNumber | undefined;
get type(): number | undefined;
get receiptRoot(): string | undefined;
get receiptStatus(): number | undefined;
get triggers(): StreamTriggerOutput[] | undefined;
}
interface StreamEvmTransactionLogInput {
chain: EvmChainish;
logIndex: number | string;
transactionHash: string;
address: EvmAddressish;
data: string;
topic0?: string | null;
topic1?: string | null;
topic2?: string | null;
topic3?: string | null;
triggers?: StreamTriggerOutputish[];
}
interface StreamEvmTransactionLogData {
chain: EvmChain;
logIndex: number;
transactionHash: string;
address: EvmAddress;
data: string;
topic0?: string;
topic1?: string;
topic2?: string;
topic3?: string;
triggers?: StreamTriggerOutput[];
}
type StreamEvmTransactionLogJSON = {
chain: string | number;
logIndex: number;
transactionHash: string;
address: string;
data: string;
topic0?: string;
topic1?: string;
topic2?: string;
topic3?: string;
triggers?: StreamTriggerOutputJSON[];
};
type StreamEvmTransactionLogish = StreamEvmTransactionLog | StreamEvmTransactionLogInput;
/**
* The StreamEvmTransactionLog class is a representation of a transaction log that is returned by the Moralis Stream API
*
* @category DataType
*/
declare class StreamEvmTransactionLog implements MoralisDataObject {
private _data;
constructor({ ...data }: StreamEvmTransactionLogInput);
/**
* Create a new instance of StreamEvmTransactionLog
*
* @param data - the StreamEvmTransactionLogish type
* @example
* ```ts
* const transactionLog = StreamEvmTransactionLog.create(data);
* ```
* @returns an instance of StreamEvmTransactionLog
*/
static create(data: StreamEvmTransactionLogish): StreamEvmTransactionLog;
private static parse;
/**
* Compares two StreamEvmTransactionLog data. It checks a deep equality check of both values.
* @param valueA - the first StreamEvmTransactionLogish data to compare
* @param valueB - the second StreamEvmTransactionLogish data to compare
* @returns true if the values are equal, false otherwise
* @example
* ```ts
* StreamEvmTransactionLog.equals(valueA, valueB);
* ```
*/
static equals(valueA: StreamEvmTransactionLogish, valueB: StreamEvmTransactionLogish): boolean;
/**
* Compares an StreamEvmTransactionLogish data to this StreamEvmTransactionLog instance.
* @param value - the value to compare
* @returns true if the value is equal to the current instance, false otherwise
* @example
* ```ts
* transactionLog.equals(value);
* ```
*/
equals(value: StreamEvmTransactionLogish): boolean;
/**
* Converts the StreamEvmTransactionLog instance to a JSON object.
* @returns JSON object of the StreamEvmTransactionLog instance
* @example `transactionLog.toJSON()`
*/
toJSON(): StreamEvmTransactionLogJSON;
/**
* @deprecated This method will be removed soon. To format the value, use one of the properties.
*/
format(): StreamEvmTransactionLogJSON;
get chain(): EvmChain;
get logIndex(): number;
get transactionHash(): string;
get address(): EvmAddress;
get data(): string;
get topic0(): string | undefined;
get topic1(): string | undefined;
get topic2(): string | undefined;
get topic3(): string | undefined;
get triggers(): StreamTriggerOutput[] | undefined;
}
type StreamEvmNftTokenApprovalish = INFTApproval & {
chain: EvmChainish;
};
type StreamEvmNftTokenApprovalData = INFTApproval & {
chain: EvmChain;
};
/**
* The `StreamEvmNftTokenApproval` class is a representation of the NFT approval data.
*
* @category DataType
*/
declare class StreamEvmNftTokenApproval implements StreamEvmNftTokenApprovalData, MoralisDataObject {
private readonly data;
static create(data: StreamEvmNftTokenApprovalish): StreamEvmNftTokenApproval;
private constructor();
get chain(): EvmChain;
get contract(): string;
get account(): string;
get operator(): string;
get approvedAll(): boolean;
get tokenId(): string | null;
get transactionHash(): string;
get logIndex(): string;
get tokenContractType(): string;
get tokenName(): string;
get tokenSymbol(): string;
toJSON(): MoralisDataObjectValue;
format(): MoralisDataFormatted;
equals(value: this): boolean;
}
interface EvmStreamResultData {
chain: EvmChain;
retries: number;
confirmed: boolean;
block: EvmSimpleBlock;
erc20Transfers: StreamErc20Transfer[];
erc20Approvals: StreamErc20Approval[];
nftTransfers: StreamEvmNftTransfer[];
/**
* @deprecated Use `ntfTokenApprovals` instead. This property will be removed in the future.
*/
nftApprovals: {
ERC721: StreamErc721Approval[];
ERC1155: StreamErc1155Approval[];
};
ntfTokenApprovals: StreamEvmNftTokenApproval[];
logs: StreamEvmTransactionLog[];
txs: StreamEvmTransaction[];
txsInternal: StreamEvmInternalTransaction[];
abi: EvmAbi;
t