Class: EvmNftTrade
moralis-monorepo / @moralisweb3/common-evm-utils / EvmNftTrade
Class: EvmNftTrade
@moralisweb3/common-evm-utils.EvmNftTrade
The EvmNftTrade is a representation of a published trade.
Use this class any time you work with a transaction.
Implements
MoralisDataObject
Table of contents
Methods
Accessors
- blockHash
- blockNumber
- blockTimestamp
- buyerAddress
- chain
- marketplaceAddress
- price
- priceTokenAddress
- result
- sellerAddress
- tokenAddress
- tokenIds
- transactionHash
- transactionIndex
Constructors
Methods
create
▸ Static
create(data
): EvmNftTrade
Create a new instance of EvmNftTrade from any valid transaction input
Example
const trade = EvmNftTrade.create(data);
Parameters
Name | Type | Description |
---|---|---|
data | EvmNftTradeish | the EvmNftTradeish type |
Returns
equals
▸ Static
equals(dataA
, dataB
): boolean
Check the equality between two Evm trades. It compares the chain
, blockNumber
, transactionIndex
and transactionHash
Example
EvmNftTrade.equals(dataA, dataB)
Parameters
Name | Type | Description |
---|---|---|
dataA | EvmNftTradeish | The first trade |
dataB | EvmNftTradeish | The second trade |
Returns
boolean
true if the trades are equal, false otherwise
parse
▸ Static
parse(data
): EvmNftTradeData
Parameters
Name | Type |
---|---|
data | EvmNftTradeInput |
Returns
equals
▸ equals(data
): boolean
Checks the equality of the current trade instance with another evm trade
Example
trade.equals(data)
Parameters
Name | Type | Description |
---|---|---|
data | EvmNftTradeish | the trade to compare with |
Returns
boolean
true if the trades are equal, false otherwise
Implementation of
MoralisDataObject.equals
format
▸ format(): Object
Example
trade.format()
Returns
Object
a JSON represention of the trade.
Name | Type |
---|---|
blockHash | string |
blockNumber | string |
blockTimestamp | string |
buyerAddress | string |
chain | string | number |
marketplaceAddress | string |
price | string |
priceTokenAddress | undefined | string |
sellerAddress | string |
tokenAddress | string |
tokenIds | string [] |
transactionHash | string |
transactionIndex | number |
Implementation of
MoralisDataObject.format
toJSON
▸ toJSON(): Object
Example
trade.toJSON()
Returns
Object
a JSON represention of the trade.
Name | Type |
---|---|
blockHash | string |
blockNumber | string |
blockTimestamp | string |
buyerAddress | string |
chain | string | number |
marketplaceAddress | string |
price | string |
priceTokenAddress | undefined | string |
sellerAddress | string |
tokenAddress | string |
tokenIds | string [] |
transactionHash | string |
transactionIndex | number |
Implementation of
MoralisDataObject.toJSON
Accessors
blockHash
• get
blockHash(): string
Example
trade.blockHash // "0x4de0bcef1450492bd5c2e7693cf644c40005868d0dcc8a7a50a80ef2efa88d1e"
Returns
string
the trade block hash
blockNumber
• get
blockNumber(): BigNumber
Example
trade.blockNumber // BigNumber
Returns
BigNumber
the trade block number
blockTimestamp
• get
blockTimestamp(): Date
Example
trade.blockTimestamp // Date
Returns
Date
the trade block timestamp
buyerAddress
• get
buyerAddress(): EvmAddress
Example
trade.buyerAddress // EvmAddress
Returns
the trade buyer address
chain
• get
chain(): EvmChain
Example
trade.chain // EvmChain
Returns
the trade chain
marketplaceAddress
• get
marketplaceAddress(): EvmAddress
Example
trade.marketplaceAddress // EvmAddress
Returns
the trade marketplace address
price
• get
price(): EvmNative
Example
trade.price // EvmNative
Returns
the trade price
priceTokenAddress
• get
priceTokenAddress(): undefined
| EvmAddress
Example
trade.priceTokenAddress // EvmAddress
Returns
undefined
| EvmAddress
the trade price token address
result
• get
result(): EvmNftTradeData
Example
trade.result
Returns
all the data without casting it to JSON.
sellerAddress
• get
sellerAddress(): EvmAddress
Example
trade.sellerAddress // EvmAddress
Returns
the trade seller address
tokenAddress
• get
tokenAddress(): EvmAddress
Example
trade.tokenAddress // EvmAddress
Returns
the trade token address
tokenIds
• get
tokenIds(): string
[]
Example
trade.tokenIds // ["16404"]
Returns
string
[]
the trade token Ids
transactionHash
• get
transactionHash(): string
Example
trade.transactionHash // "0x4de0bcef1450492bd5c2e7693cf644c40005868d0dcc8a7a50a80ef2efa88d1e"
Returns
string
the trade transaction hash
transactionIndex
• get
transactionIndex(): number
Example
trade.transactionIndex // 164
Returns
number
the trade transaction index
Constructors
constructor
• new EvmNftTrade(data
)
Parameters
Name | Type |
---|---|
data | EvmNftTradeInput |