Skip to main content

Class: EvmNftTransfer

moralis-monorepo / @moralisweb3/common-evm-utils / EvmNftTransfer

Class: EvmNftTransfer

@moralisweb3/common-evm-utils.EvmNftTransfer

The EvmNftTransfer is a representation of a completed NFT transfer.

Implements

  • MoralisDataObject

Table of contents

Methods

Accessors

Constructors

Properties

Methods

create

Static create(data): EvmNftTransfer

Create a new instance of EvmNftTransfer from any valid transfer input

Example

const transfer = EvmNftTransfer.create(data);

Parameters

NameTypeDescription
dataEvmNftTransferishthe EvmNftTransferish type

Returns

EvmNftTransfer


equals

Static equals(dataA, dataB): boolean

Check the equality between two NFT transfers. The compares the chain, blockHash, tokenId and logIndex.

Example

EvmNftTransfer.equals(dataA, dataB)

Parameters

NameTypeDescription
dataAEvmNftTransferishThe first transfer to compare
dataBEvmNftTransferishThe second transfer to compare

Returns

boolean

true if the transfers are equal, false otherwise


parse

Static parse(data): EvmNftTransferData

Parameters

NameType
dataEvmNftTransferInput

Returns

EvmNftTransferData


equals

equals(data): boolean

Checks the equality of the current transfer instance with another nft transfer

Example

transaction.equals(data)

Parameters

NameTypeDescription
dataEvmNftTransferishthe transfer to compare with

Returns

boolean

true if the transfers are equal, false otherwise

Implementation of

MoralisDataObject.equals


format

format(): Object

Example

transfer.format()

Returns

Object

a JSON represention of the transfer.

NameType
amount?number
blockHashstring
blockNumberstring
blockTimestampDate
chainstring
contractTypestring
fromAddressundefined | string
logIndexnumber
operatorundefined | string
possibleSpamboolean
toAddressstring
tokenAddressstring
tokenIdstring
transactionHashstring
transactionIndex?number
transactionType?string
valueundefined | string

Implementation of

MoralisDataObject.format


toJSON

toJSON(): Object

Example

transfer.toJSON()

Returns

Object

a JSON represention of the transfer.

NameType
amount?number
blockHashstring
blockNumberstring
blockTimestampDate
chainstring
contractTypestring
fromAddressundefined | string
logIndexnumber
operatorundefined | string
possibleSpamboolean
toAddressstring
tokenAddressstring
tokenIdstring
transactionHashstring
transactionIndex?number
transactionType?string
valueundefined | string

Implementation of

MoralisDataObject.toJSON

Accessors

amount

get amount(): undefined | number

Example

transfer.amount // 1

Returns

undefined | number

the amount of the transfer.


blockHash

get blockHash(): string

Example

transfer.blockHash // "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e"

Returns

string

the block hash of the transfer.


blockNumber

get blockNumber(): BigNumber

Example

transfer.blockNumber // BigNumber

Returns

BigNumber

the block number of the transfer.


blockTimestamp

get blockTimestamp(): Date

Example

transfer.blockTimestamp // Date

Returns

Date

the block timestamp of the transfer.


chain

get chain(): EvmChain

Example

transfer.chain // EvmChain

Returns

EvmChain

the chain of the transfer.


contractType

get contractType(): string

Example

transfer.contractType // "ERC721"

Returns

string

the contract type of the transfer.


fromAddress

get fromAddress(): undefined | EvmAddress

Example

transfer.fromAddress // EvmAddress

Returns

undefined | EvmAddress

the from address of the transfer.


logIndex

get logIndex(): number

Example

transfer.logIndex // 0

Returns

number

the log index of the transfer.


operator

get operator(): undefined | EvmAddress

Example

transfer.operator // EvmAddress

Returns

undefined | EvmAddress

the operator of the transfer.


possibleSpam

get possibleSpam(): boolean

Example

transfer.possibleSpam // true

Returns

boolean

possibility of the token being a spam token


result

get result(): EvmNftTransferData

Example

transfer.result

Returns

EvmNftTransferData

all the data without casting it to JSON.


toAddress

get toAddress(): EvmAddress

Example

transfer.toAddress // EvmAddress

Returns

EvmAddress

the to address of the transfer.


tokenAddress

get tokenAddress(): EvmAddress

Example

transfer.tokenAddress // EvmAddress

Returns

EvmAddress

the token address of the transfer.


tokenId

get tokenId(): string

Example

transfer.tokenId // "15"

Returns

string

the token id of the transfer.


transactionHash

get transactionHash(): string

Example

transfer.transactionHash // "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e"

Returns

string

the transaction hash of the transfer.


transactionIndex

get transactionIndex(): undefined | number

Example

transfer.transactionIndex // 123

Returns

undefined | number

the transaction index of the transfer.


transactionType

get transactionType(): undefined | string

Example

transfer.transactionType // "1"

Returns

undefined | string

the transaction type of the transfer.


value

get value(): undefined | EvmNative

Example

transfer.value // EvmNative

Returns

undefined | EvmNative

the value of the transfer.

Constructors

constructor

new EvmNftTransfer(data)

Parameters

NameType
dataEvmNftTransferInput

Properties

_data

Protected _data: EvmNftTransferData