Skip to content

Commit

Permalink
Merge pull request #214 from MoralisWeb3/feat/restructure-docs
Browse files Browse the repository at this point in the history
restructure tutorial docs
  • Loading branch information
JohnVersus authored Jul 26, 2023
2 parents 068a94b + 378eb0a commit 82ba205
Show file tree
Hide file tree
Showing 45 changed files with 387 additions and 113 deletions.
54 changes: 0 additions & 54 deletions docs/01-web3-data-api/evm/balance-api/balance-api.md

This file was deleted.

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.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Report Spam"
slug: "../../report-nft-spam"
description: "NFT spam detection is designed to provide an extra layer of protection and help you easily identify potentially harmful contracts."
sidebar_position: 6
sidebar_position: 1
---

## Prerequisites
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "How to get historical ERC20 token price"
slug: "../../how-to-get-historical-erc20-token-price"
description: "Learn how to get historical ERC20 token price using Moralis Token API."
sidebar_label: "Get ERC20 token historical price"
sidebar_position: 1
---

## Prerequisites
Expand Down
Loading

1 comment on commit 82ba205

@vercel
Copy link

@vercel vercel bot commented on 82ba205 Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.