-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from MoralisWeb3/feat/restructure-docs
restructure tutorial docs
- Loading branch information
Showing
45 changed files
with
387 additions
and
113 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
154 changes: 154 additions & 0 deletions
154
.../evm/nft-api/06-NFT Marketdata/how-to-get-lowest-price-of-nft-by-marketplace.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
--- | ||
title: "How to get lowest price of an NFT by Markeplace" | ||
slug: "../../how-to-get-lowest-price-of-nft-by-marketplace" | ||
description: "Learn how to get lowest price of an NFT by Markeplace using the Moralis NFT API." | ||
sidebar_label: "Get NFT lowest price" | ||
--- | ||
|
||
## Prerequisites | ||
|
||
Before getting started, make sure you have the following ready: | ||
|
||
- Node v.14+ or Python | ||
- NPM/Yarn or Pip | ||
|
||
## Step 1: Setup Moralis | ||
|
||
import SetupMoralis from '/docs/partials/\_install-moralis-sdk.mdx'; | ||
|
||
<SetupMoralis node="moralis @moralisweb3/common-evm-utils" python="moralis" /> | ||
|
||
## Step 2: Get All Transfers Of An NFT | ||
|
||
In order to get lowest price of an NFT, Moralis provides you with an [getNFTLowestPrice](/web3-data-api/evm/reference/get-nft-lowest-price) endpoint. | ||
|
||
Here you'll need three parameters: `address`, `marketplace`, and `chain`. | ||
|
||
Once you have obtained the `address`, `marketplace` and `chain`, you can copy the following code: | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
<Tabs groupId="programming-language"> | ||
<TabItem value="javascript" label="index.js (JavaScript)" default> | ||
|
||
```javascript index.js | ||
const Moralis = require("moralis").default; | ||
const { EvmChain } = require("@moralisweb3/common-evm-utils"); | ||
|
||
const runApp = async () => { | ||
await Moralis.start({ | ||
apiKey: "YOUR_API_KEY", | ||
// ...and any other configuration | ||
}); | ||
|
||
const address = "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"; | ||
|
||
const chain = EvmChain.ETHEREUM; | ||
|
||
const marketplace = "opensea"; | ||
|
||
const response = await Moralis.EvmApi.nft.getNFTLowestPrice({ | ||
address, | ||
chain, | ||
marketplace, | ||
}); | ||
|
||
console.log(response.toJSON()); | ||
}; | ||
|
||
runApp(); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="typescript" label="index.ts (TypeScript)"> | ||
|
||
```typescript index.ts | ||
import Moralis from "moralis"; | ||
import { EvmChain } from "@moralisweb3/common-evm-utils"; | ||
|
||
const runApp = async () => { | ||
await Moralis.start({ | ||
apiKey: "YOUR_API_KEY", | ||
// ...and any other configuration | ||
}); | ||
|
||
const address = "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"; | ||
|
||
const chain = EvmChain.ETHEREUM; | ||
|
||
const marketplace = "opensea"; | ||
|
||
const response = await Moralis.EvmApi.nft.getNFTLowestPrice({ | ||
address, | ||
chain, | ||
marketplace, | ||
}); | ||
|
||
console.log(response.toJSON()); | ||
}; | ||
|
||
runApp(); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="python" label="index.py (Python)"> | ||
|
||
```python index.py | ||
from moralis import evm_api | ||
|
||
api_key = "YOUR_API_KEY" | ||
params = { | ||
"chain": "eth", | ||
"marketplace": "opensea", | ||
"address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" | ||
} | ||
|
||
result = evm_api.nft.get_nft_lowest_price( | ||
api_key=api_key, | ||
params=params, | ||
) | ||
|
||
print(result) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
## Step 3: Run the script | ||
|
||
import RunTheScript from '/docs/partials/\_run-the-script.mdx'; | ||
|
||
<RunTheScript /> | ||
|
||
In your terminal, you should see the following JSON response: | ||
|
||
```json | ||
{ | ||
"transaction_hash": "0x7f144f0ba4a412b8b683b126e10962754d80f1010531f57f425e499c23983c9a", | ||
"transaction_index": "47", | ||
"token_ids": [ | ||
"3644" | ||
], | ||
"seller_address": "0xdacc47d22370a3cc940160efbe62750c47900f44", | ||
"buyer_address": "0x756dcf63d25ba456c492a892db61719e5861a872", | ||
"token_address": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", | ||
"marketplace_address": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", | ||
"price": "33460000000000000000", | ||
"block_timestamp": "2023-07-23T13:58:47.000Z", | ||
"block_number": "17756263", | ||
"block_hash": "0x75706cd5532f12eaeeece29bbe926e2afd435fd6c9d71fc9c893094bd751dc14" | ||
} | ||
``` | ||
|
||
Congratulations 🥳 You just got lowest price of an NFT with just a few lines of code using the Moralis NFT API! | ||
|
||
## API Reference | ||
|
||
If you want to know more details on the endpoint and optional parameters, check out: | ||
|
||
- [getNFTLowestPrice](/web3-data-api/evm/reference/get-nft-lowest-price) | ||
|
||
## Support | ||
|
||
If you face any trouble following the tutorial, feel free to reach out to our community engineers in our [Discord](https://moralis.io/discord) or [Forum](https://forum.moralis.io) to get 24/7 developer support. |
167 changes: 167 additions & 0 deletions
167
...-data-api/evm/nft-api/06-NFT Marketdata/how-to-get-nft-trades-by-marketplace.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
--- | ||
title: "How to get NFT trades by Markeplace" | ||
slug: "../../how-to-get-all-nft-trades" | ||
description: "Learn how to get NFT trades by Markeplace using the Moralis NFT API." | ||
sidebar_label: "Get NFT trades by Markeplace" | ||
--- | ||
|
||
## Prerequisites | ||
|
||
Before getting started, make sure you have the following ready: | ||
|
||
- Node v.14+ or Python | ||
- NPM/Yarn or Pip | ||
|
||
## Step 1: Setup Moralis | ||
|
||
import SetupMoralis from '/docs/partials/\_install-moralis-sdk.mdx'; | ||
|
||
<SetupMoralis node="moralis @moralisweb3/common-evm-utils" python="moralis" /> | ||
|
||
## Step 2: Get All Transfers Of An NFT | ||
|
||
In order to get all the trades of an NFT by marketplace, Moralis provides you with an [getNFTTrades](/web3-data-api/evm/reference/get-nft-trades) endpoint. | ||
|
||
Here you'll need three parameters: `address`, `marketplace`, and `chain`. | ||
|
||
Once you have obtained the `address`, `marketplace` and `chain`, you can copy the following code: | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
<Tabs groupId="programming-language"> | ||
<TabItem value="javascript" label="index.js (JavaScript)" default> | ||
|
||
```javascript index.js | ||
const Moralis = require("moralis").default; | ||
const { EvmChain } = require("@moralisweb3/common-evm-utils"); | ||
|
||
const runApp = async () => { | ||
await Moralis.start({ | ||
apiKey: "YOUR_API_KEY", | ||
// ...and any other configuration | ||
}); | ||
|
||
const address = "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"; | ||
|
||
const chain = EvmChain.ETHEREUM; | ||
|
||
const marketplace = "opensea"; | ||
|
||
const response = await Moralis.EvmApi.nft.getNFTTrades({ | ||
address, | ||
chain, | ||
marketplace, | ||
}); | ||
|
||
console.log(response.toJSON()); | ||
}; | ||
|
||
runApp(); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="typescript" label="index.ts (TypeScript)"> | ||
|
||
```typescript index.ts | ||
import Moralis from "moralis"; | ||
import { EvmChain } from "@moralisweb3/common-evm-utils"; | ||
|
||
const runApp = async () => { | ||
await Moralis.start({ | ||
apiKey: "YOUR_API_KEY", | ||
// ...and any other configuration | ||
}); | ||
|
||
const address = "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"; | ||
|
||
const chain = EvmChain.ETHEREUM; | ||
|
||
const marketplace = "opensea"; | ||
|
||
const response = await Moralis.EvmApi.nft.getNFTTrades({ | ||
address, | ||
chain, | ||
marketplace, | ||
}); | ||
|
||
console.log(response.toJSON()); | ||
}; | ||
|
||
runApp(); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="python" label="index.py (Python)"> | ||
|
||
```python index.py | ||
from moralis import evm_api | ||
|
||
api_key = "YOUR_API_KEY" | ||
params = { | ||
"chain": "eth", | ||
"marketplace": "opensea", | ||
"address": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB" | ||
} | ||
|
||
result = evm_api.nft.get_nft_trades( | ||
api_key=api_key, | ||
params=params, | ||
) | ||
|
||
print(result) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
## Step 3: Run the script | ||
|
||
import RunTheScript from '/docs/partials/\_run-the-script.mdx'; | ||
|
||
<RunTheScript /> | ||
|
||
In your terminal, you should see the following JSON response: | ||
|
||
```json | ||
{ | ||
"total": null, | ||
"page": 0, | ||
"page_size": 100, | ||
"cursor": null, | ||
"result": [ | ||
{ | ||
"transaction_hash": "0x5eba5d8d84c20a7f30b92d74afaee764d9476b62a1637b017319c721269245ed", | ||
"transaction_index": "90", | ||
"token_ids": [ | ||
"1002", | ||
"7228", | ||
"1", | ||
"1" | ||
], | ||
"seller_address": "0xe7f35f06a80a6a2a5edc823379fa147d9f9948a8", | ||
"buyer_address": "0xd7c708080553068217a2fe6f44eccf9cac309915", | ||
"token_address": "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb", | ||
"marketplace_address": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b", | ||
"price": "18980000000000000000", | ||
"price_token_address": "0x60e4d786628fea6478f785a6d7e704777c86a7c6", | ||
"block_timestamp": "2022-03-18T22:21:07.000Z", | ||
"block_number": "14413068", | ||
"block_hash": "0x50e740dd733efc1e7252e3863e76368624d146e1a8447fab32c9697685cf581d", | ||
"verified_collection": true | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Congratulations 🥳 You just got all the trades of an NFT with just a few lines of code using the Moralis NFT API! | ||
|
||
## API Reference | ||
|
||
If you want to know more details on the endpoint and optional parameters, check out: | ||
|
||
- [getNFTTrades](/web3-data-api/evm/reference/get-nft-trades) | ||
|
||
## Support | ||
|
||
If you face any trouble following the tutorial, feel free to reach out to our community engineers in our [Discord](https://moralis.io/discord) or [Forum](https://forum.moralis.io) to get 24/7 developer support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
82ba205
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./
docs-git-main-moralis-web3.vercel.app
docs-gold-iota.vercel.app
docs-moralis-web3.vercel.app
docs.moralis.io