ethereum-hooks 1.0.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +81 -117
  2. package/{client/src/crypto_hooks/ens/useFetchAddressENSLookup.ts → crypto_hooks/ens/useAddressENSLookup.ts} +2 -2
  3. package/{client/src/crypto_hooks/ens/useFetchENSAddressLookup.ts → crypto_hooks/ens/useENSAddressLookup.ts} +3 -4
  4. package/{client/src/crypto_hooks/ens/useFetchENSIDLookup.ts → crypto_hooks/ens/useENSIDLookup.ts} +2 -2
  5. package/{client/src/crypto_hooks/ens/useFetchENSNameLookup.ts → crypto_hooks/ens/useENSNameLookup.ts} +2 -2
  6. package/{client/src/crypto_hooks/erc20Tokens/useFetchERC20CollectionOwners.ts → crypto_hooks/erc20Tokens/useERC20CollectionOwners.ts} +3 -3
  7. package/{client/src/crypto_hooks/erc20Tokens/useFetchERC20CollectionTopCoins.ts → crypto_hooks/erc20Tokens/useERC20CollectionTopCoins.ts} +2 -2
  8. package/{client/src/crypto_hooks/erc20Tokens/useFetchERC20CollectionTransfers.ts → crypto_hooks/erc20Tokens/useERC20CollectionTransfers.ts} +3 -3
  9. package/{client/src/crypto_hooks/erc20Tokens/useFetchERC20Holdings.ts → crypto_hooks/erc20Tokens/useERC20Holdings.ts} +2 -2
  10. package/{client/src/crypto_hooks/erc20Tokens/useFetchERC20Transfers.ts → crypto_hooks/erc20Tokens/useERC20Transfers.ts} +2 -2
  11. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionAttributes.ts → crypto_hooks/erc721Tokens/useERC721CollectionAttributes.ts} +2 -2
  12. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionData.ts → crypto_hooks/erc721Tokens/useERC721CollectionData.ts} +2 -2
  13. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionExtraData.ts → crypto_hooks/erc721Tokens/useERC721CollectionExtraData.ts} +2 -2
  14. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionFloorPrice.ts → crypto_hooks/erc721Tokens/useERC721CollectionFloorPrice.ts} +2 -2
  15. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionMarketCap.ts → crypto_hooks/erc721Tokens/useERC721CollectionMarketCap.ts} +2 -2
  16. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionSales.ts → crypto_hooks/erc721Tokens/useERC721CollectionSales.ts} +2 -2
  17. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionTransfers.ts → crypto_hooks/erc721Tokens/useERC721CollectionTransfers.ts} +2 -2
  18. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionTrends.ts → crypto_hooks/erc721Tokens/useERC721CollectionTrends.ts} +2 -2
  19. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionVolume.ts → crypto_hooks/erc721Tokens/useERC721CollectionVolume.ts} +2 -2
  20. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721Holdings.ts → crypto_hooks/erc721Tokens/useERC721Holdings.ts} +2 -2
  21. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721LookupData.ts → crypto_hooks/erc721Tokens/useERC721LookupData.ts} +2 -2
  22. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721OpenseaData.ts → crypto_hooks/erc721Tokens/useERC721OpenseaData.ts} +2 -2
  23. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721RarityData.ts → crypto_hooks/erc721Tokens/useERC721RarityData.ts} +2 -2
  24. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721SalesData.ts → crypto_hooks/erc721Tokens/useERC721SalesData.ts} +2 -2
  25. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721TransferLookupData.ts → crypto_hooks/erc721Tokens/useERC721TransferLookupData.ts} +2 -2
  26. package/{client/src/crypto_hooks/erc721Tokens/useFetchERC721TransfersData.ts → crypto_hooks/erc721Tokens/useERC721TransfersData.ts} +2 -2
  27. package/{client/src/crypto_hooks/gas/useFetchGasLookup.ts → crypto_hooks/gas/useGasLookup.ts} +2 -2
  28. package/crypto_hooks/index.ts +39 -0
  29. package/{client/src/crypto_hooks/prices/useFetchERC20Price.ts → crypto_hooks/prices/useERC20Price.ts} +2 -2
  30. package/{client/src/crypto_hooks/prices/useFetchERC721Price.ts → crypto_hooks/prices/useERC721Price.ts} +2 -2
  31. package/{client/src/crypto_hooks/prices/useFetchETHPrice.ts → crypto_hooks/prices/useETHPrice.ts} +2 -2
  32. package/{client/src/crypto_hooks/prices/useFetchLayerTwoPrice.ts → crypto_hooks/prices/useLayerTwoPrice.ts} +2 -2
  33. package/package.json +19 -21
  34. package/client/package.json +0 -25
  35. package/hook-server-design.png +0 -0
  36. package/hooksinformation.txt +0 -49
  37. package/server/Controller/ENS/AddressToENSController.ts +0 -30
  38. package/server/Controller/ENS/ENSIDController.ts +0 -32
  39. package/server/Controller/ENS/ENSNameController.ts +0 -32
  40. package/server/Controller/ENS/ENSToAddressController.ts +0 -32
  41. package/server/Controller/ERC20Tokens/ERC20CollectionOwnersController.ts +0 -29
  42. package/server/Controller/ERC20Tokens/ERC20CollectionTopCoinsController.ts +0 -27
  43. package/server/Controller/ERC20Tokens/ERC20CollectionTransfersController.ts +0 -29
  44. package/server/Controller/ERC20Tokens/ERC20HoldingsController.ts +0 -29
  45. package/server/Controller/ERC20Tokens/ERC20TransfersController.ts +0 -29
  46. package/server/Controller/ERC721Tokens/ERC721CollectionAttributesController.ts +0 -29
  47. package/server/Controller/ERC721Tokens/ERC721CollectionDataController.ts +0 -29
  48. package/server/Controller/ERC721Tokens/ERC721CollectionExtraDataController.ts +0 -29
  49. package/server/Controller/ERC721Tokens/ERC721CollectionFloorPriceController.ts +0 -18
  50. package/server/Controller/ERC721Tokens/ERC721CollectionMarketCapController.ts +0 -29
  51. package/server/Controller/ERC721Tokens/ERC721CollectionSalesController.ts +0 -29
  52. package/server/Controller/ERC721Tokens/ERC721CollectionTransfersController.ts +0 -29
  53. package/server/Controller/ERC721Tokens/ERC721CollectionTrendsController.ts +0 -28
  54. package/server/Controller/ERC721Tokens/ERC721CollectionVolumeController.ts +0 -28
  55. package/server/Controller/ERC721Tokens/ERC721HoldingsController.ts +0 -29
  56. package/server/Controller/ERC721Tokens/ERC721LookupDataController.ts +0 -28
  57. package/server/Controller/ERC721Tokens/ERC721OpenseaDataController.ts +0 -29
  58. package/server/Controller/ERC721Tokens/ERC721RarityDataController.ts +0 -29
  59. package/server/Controller/ERC721Tokens/ERC721SalesDataController.ts +0 -34
  60. package/server/Controller/ERC721Tokens/ERC721TransferLookupDataController.ts +0 -28
  61. package/server/Controller/ERC721Tokens/ERC721TransfersDataController.ts +0 -29
  62. package/server/Controller/Gas/GasLookupController.ts +0 -26
  63. package/server/Controller/Prices/ERC20PriceController.ts +0 -43
  64. package/server/Controller/Prices/ERC721PriceController.ts +0 -28
  65. package/server/Controller/Prices/ETHPriceController.ts +0 -42
  66. package/server/Controller/Prices/LayerTwoPriceController.ts +0 -41
  67. package/server/Routes/ENSRoutes/AddressToENSRoute.ts +0 -9
  68. package/server/Routes/ENSRoutes/ENSIDRoute.ts +0 -8
  69. package/server/Routes/ENSRoutes/ENSNameRoute.ts +0 -9
  70. package/server/Routes/ENSRoutes/ENSToAddressRoute.ts +0 -9
  71. package/server/Routes/ERC20TokensRoutes/ERC20CollectionOwnersRoute.ts +0 -9
  72. package/server/Routes/ERC20TokensRoutes/ERC20CollectionTopCoinsRoute.ts +0 -9
  73. package/server/Routes/ERC20TokensRoutes/ERC20CollectionTransfersRoute.ts +0 -9
  74. package/server/Routes/ERC20TokensRoutes/ERC20HoldingsRoute.ts +0 -9
  75. package/server/Routes/ERC20TokensRoutes/ERC20TransfersRoute.ts +0 -9
  76. package/server/Routes/ERC721TokensRoutes/ERC721CollectionAttributesRoute.ts +0 -9
  77. package/server/Routes/ERC721TokensRoutes/ERC721CollectionDataRoute.ts +0 -9
  78. package/server/Routes/ERC721TokensRoutes/ERC721CollectionExtraDataRoute.ts +0 -9
  79. package/server/Routes/ERC721TokensRoutes/ERC721CollectionFloorPriceRoute.ts +0 -9
  80. package/server/Routes/ERC721TokensRoutes/ERC721CollectionMarketCapRoute.ts +0 -9
  81. package/server/Routes/ERC721TokensRoutes/ERC721CollectionSalesRoute.ts +0 -9
  82. package/server/Routes/ERC721TokensRoutes/ERC721CollectionTransfersRoute.ts +0 -9
  83. package/server/Routes/ERC721TokensRoutes/ERC721CollectionTrendsRoute.ts +0 -9
  84. package/server/Routes/ERC721TokensRoutes/ERC721CollectionVolumeRoute.ts +0 -9
  85. package/server/Routes/ERC721TokensRoutes/ERC721HoldingsRoute.ts +0 -9
  86. package/server/Routes/ERC721TokensRoutes/ERC721LookupDataRoute.ts +0 -9
  87. package/server/Routes/ERC721TokensRoutes/ERC721OpenseaDataRoute.ts +0 -9
  88. package/server/Routes/ERC721TokensRoutes/ERC721RarityDataRoute.ts +0 -9
  89. package/server/Routes/ERC721TokensRoutes/ERC721SalesDataRoute.ts +0 -9
  90. package/server/Routes/ERC721TokensRoutes/ERC721TransferLookupDataRoute.ts +0 -9
  91. package/server/Routes/ERC721TokensRoutes/ERC721TransfersDataRoute.ts +0 -9
  92. package/server/Routes/GasRoutes/GasLookupRoute.ts +0 -9
  93. package/server/Routes/PriceRoutes/ERC20PriceRoute.ts +0 -9
  94. package/server/Routes/PriceRoutes/ERC721PriceRoute.ts +0 -9
  95. package/server/Routes/PriceRoutes/ETHPriceRoute.ts +0 -9
  96. package/server/Routes/PriceRoutes/LayerTwoPriceRoute.ts +0 -9
  97. package/server/package.json +0 -25
  98. package/server/server.ts +0 -96
  99. package/server/tsconfig.json +0 -109
  100. /package/{client/src/custom_hooks → custom_hooks}/useFetch.ts +0 -0
  101. /package/{client/src/types → types}/FetchStateType.ts +0 -0
  102. /package/{client/src/types → types}/LayerTwoType.ts +0 -0
@@ -1,27 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC20 Collection Top Coins data
6
- export const ERC20CollectionTopCoinsController = (req: Request, res: Response) => {
7
- // Add ERC20 Top Coins Controller data parameters
8
- const options = {
9
- method: 'GET',
10
- headers: {
11
- 'accept': 'application/json',
12
- 'content-type': 'application/json',
13
- 'X-API-KEY' : process.env.MORALIS_API_KEY
14
- }
15
- }
16
-
17
- // Conditionally making API calls for ERC20 Top Coins Controller
18
- axios.get('https://deep-index.moralis.io/api/v2.2/market-data/erc20s/top-tokens', options)
19
- .then(response => {
20
- res.status(200).json({
21
- information: response.data
22
- });
23
- })
24
- .catch(() => {
25
- res.status(400).json({});
26
- });
27
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC20 Collection Transfers data
6
- export const ERC20CollectionTransfersController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC20 Collection Transfers Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC20 Collection Transfers Controller
20
- axios.get("https://deep-index.moralis.io/api/v2.2/erc20/" + contractAddress + '/transfers', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC20 Collection Holdings data
6
- export const ERC20HoldingsController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC20 Collection Holdings Controller Holdings data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC20 Collection Holdings Controller
20
- axios.get('https://deep-index.moralis.io/api/v2/' + contractAddress + '/erc20?chain=eth', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC20 Collection Transfers data
6
- export const ERC20TransfersController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC20 Collection Transfers Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC20 Collection Transfers Controller
20
- axios.get('https://deep-index.moralis.io/api/v2/' + contractAddress + '/erc20/transfers?chain=eth', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Attributes data
6
- export const ERC721CollectionAttributesController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Collection Attributes Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC721 Collection Attributes Controller
20
- axios.get('https://deep-index.moralis.io/api/v2.2/nft/' + contractAddress + '/traits', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Data
6
- export const ERC721CollectionDataController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Collection Controller Data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC721 Collection Data Controller
20
- axios.get('https://deep-index.moralis.io/api/v2/nft' + contractAddress, options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Extra Collection Data
6
- export const ERC721CollectionExtraDataController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Collection Controller Extra Data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC721 Collection Extra Data Controller
20
- axios.get('https://deep-index.moralis.io/api/v2.2/nft/' + contractAddress + '/metadata', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,18 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- const sdk = require('api')('@alchemy-docs/v1.0#3yq3i17l9sqr4d6'); // SDK ID for Alchemy package found through docs
4
-
5
- // Controller function for fetching ERC721 Floor Price Data
6
- export const ERC721CollectionFloorPriceController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
- // Run backend request
9
- sdk.server('https://eth-mainnet.g.alchemy.com/nft/v2');
10
-
11
- sdk.getFloorPrice({ apiKey: process.env.ALCHEMY_API_KEY, contractAddress })
12
- .then((response: any) =>
13
- res.status(200).json({ information: response })
14
- )
15
- .catch(() => {
16
- res.status(400).json({});
17
- });
18
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Market Cap Controller data
6
- export const ERC721CollectionMarketCapController = (req: Request, res: Response) => {
7
- const { contractAddress, duration } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Collection Market Cap Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json'
15
- }
16
- }
17
-
18
- // Conditionally making API calls for ERC721 Collection Market Cap Controller
19
- axios.get('https://api.coingecko.com/api/v3/coins/ethereum/contract/' + contractAddress +
20
- '/market_chart?vs_currency=usd&days=' + duration + '&interval=daily', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Sales Controller data
6
- export const ERC721CollectionSalesController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Collection Market Cap Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC721 Collection Sales Controller
20
- axios.get('https://deep-index.moralis.io/api/v2/nft/' + contractAddress + '/trades', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Transfers Controller data
6
- export const ERC721CollectionTransfersController = (req: Request, res: Response) => {
7
- const { contractAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Collection Transfers Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC721 Collection Transfers Controller
20
- axios.get('https://deep-index.moralis.io/api/v2/nft' + contractAddress + '/transfers', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,28 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Trends Controller data
6
- export const ERC721CollectionTrendsController = (req: Request, res: Response) => {
7
-
8
- // Add ERC721 Collection Trends Controller data parameters
9
- const options = {
10
- method: 'GET',
11
- headers: {
12
- 'accept': 'application/json',
13
- 'content-type': 'application/json',
14
- 'X-API-KEY' : process.env.MORALIS_API_KEY
15
- }
16
- }
17
-
18
- // Conditionally making API calls for ERC721 Collection Trends Controller
19
- axios.get('https://deep-index.moralis.io/api/v2.2/market-data/nfts/hottest-collections', options)
20
- .then(response => {
21
- res.status(200).json({
22
- information: response.data
23
- });
24
- })
25
- .catch(() => {
26
- res.status(400).json({});
27
- });
28
- }
@@ -1,28 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Collection Volume Controller data
6
- export const ERC721CollectionVolumeController = (req: Request, res: Response) => {
7
-
8
- // Add ERC721 Collection Volume Controller data parameters
9
- const options = {
10
- method: 'GET',
11
- headers: {
12
- 'accept': 'application/json',
13
- 'content-type': 'application/json',
14
- 'X-API-KEY' : process.env.MORALIS_API_KEY
15
- }
16
- }
17
-
18
- // Conditionally making API calls for ERC721 Collection Volume Controller
19
- axios.get('"https://deep-index.moralis.io/api/v2.2/market-data/nfts/top-collections', options)
20
- .then(response => {
21
- res.status(200).json({
22
- information: response.data
23
- });
24
- })
25
- .catch(() => {
26
- res.status(400).json({});
27
- });
28
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Holdings Controller data
6
- export const ERC721HoldingsController = (req: Request, res: Response) => {
7
- const { walletAddress } = JSON.parse(req.body.body);
8
-
9
- // Add ERC721 Holdings Controller data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- // Conditionally making API calls for ERC721 Holdings Controller
20
- axios.get('https://deep-index.moralis.io/api/v2.2/' + walletAddress + '/nft/collections?chain=eth', options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,28 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Lookup Data Controller
6
- export const ERC721LookupDataController = (req: Request, res: Response) => {
7
- const { contractAddress, tokenID } = JSON.parse(req.body.body);
8
-
9
- const options = {
10
- method: 'GET',
11
- headers: {
12
- 'accept' : 'application/json',
13
- 'content-type': 'application/json',
14
- 'X-API-KEY' : process.env.MORALIS_API_KEY
15
- }
16
- }
17
-
18
- // Making request to Moralis API for finding ERC721 token lookup information
19
- axios.get('https://deep-index.moralis.io/api/v2/nft/' + contractAddress + "/" + tokenID + "?chain=eth" + "&format=decimal", options)
20
- .then(response =>
21
- res.status(200).json({
22
- information: response.data
23
- })
24
- )
25
- .catch(() => {
26
- res.status(400).json({});
27
- });
28
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Opensea Data Controller
6
- export const ERC721OpenseaDataController = (req: Request, res: Response) => {
7
- const { contractAddress, tokenID } = JSON.parse(req.body.body);
8
-
9
- // Setting options to make authenticated API calls to retrieve ERC721 Opensea token information
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept' : 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.OPENSEA_API_KEY
16
- }
17
- };
18
-
19
- // Making request to Opensea API to retrieve ERC721 Opensea token information
20
- axios.get('https://api.opensea.io/api/v2/chain/ethereum/contract' + contractAddress + '/nfts/' + tokenID, options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: [response.data]
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Rarity Data Controller
6
- export const ERC721RarityDataController = (req: Request, res: Response) => {
7
- const { contractAddress, tokenID } = JSON.parse(req.body.body);
8
-
9
- // Setting options to make authenticated API calls to retrieve ERC721 token rarity information
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept' : 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- };
18
-
19
- // Making request to Alchemy API for finding ERC721 token rarity
20
- axios.get('https://eth-mainnet.g.alchemy.com/nft/v2/' + process.env.ALCHEMY_API_KEY + "/computeRarity?contractAddress=" + contractAddress + "&tokenId=" + tokenID, options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: { data: response.data }
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,34 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Sales data Controller
6
- export const ERC721SalesDataController = (req: Request, res: Response) => {
7
- const { contractAddress, tokenID } = JSON.parse(req.body.body); // Parse information for make API call
8
-
9
- // Setting params and options for ERC721 token sales data
10
- const params = {
11
- "chain_id": "ethereum",
12
- "contract_address": contractAddress,
13
- "token_id": tokenID
14
- }
15
-
16
- const options = {
17
- headers: {
18
- 'accept' : 'application/json',
19
- 'content-type': 'application/json',
20
- 'X-API-KEY' : process.env.TRANSPOSE_API_KEY
21
- }
22
- }
23
-
24
- // Making request to Transpose API for finding ERC721 token sales information
25
- axios.get("https://api.transpose.io/nft/sales-by-token-id?" + new URLSearchParams(params), options)
26
- .then(response => {
27
- res.status(200).json({
28
- information: response.data
29
- });
30
- })
31
- .catch(() => {
32
- res.status(400).json({});
33
- });
34
- }
@@ -1,28 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Transfer Lookup data Controller
6
- export const ERC721TransferLookupDataController = (req: Request, res: Response) => {
7
- const { contractAddress, tokenID } = JSON.parse(req.body.body); // Parse information for make API call
8
-
9
- const options = {
10
- method: 'GET',
11
- headers: {
12
- 'accept' : 'application/json',
13
- 'content-type': 'application/json',
14
- 'X-API-KEY' : process.env.MORALIS_API_KEY
15
- }
16
- }
17
-
18
- // Making request to Moralis API for finding ERC721 Token Transfer Lookup information
19
- axios.get('https://deep-index.moralis.io/api/v2/nft/' + contractAddress + "/" + tokenID + '/transfers?chain=eth&format=decimal', options)
20
- .then(response =>
21
- res.status(200).json({
22
- information: response.data
23
- })
24
- )
25
- .catch(() => {
26
- res.status(400).json({});
27
- });
28
- }
@@ -1,29 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC721 Transfers data Controller
6
- export const ERC721TransfersDataController = (req: Request, res: Response) => {
7
- const { walletAddress } = JSON.parse(req.body.body); // Parse information for make API call
8
-
9
- // Pass in API key for backend request
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept' : 'application/json',
14
- 'content-type': 'application/json',
15
- 'X-API-KEY' : process.env.MORALIS_API_KEY
16
- }
17
- }
18
-
19
- axios.get('https://deep-index.moralis.io/api/v2/' + walletAddress +
20
- '/nft/transfers?chain=eth&format=decimal&direction=both', options) // Pass in address and chain values
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- })
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
@@ -1,26 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from "express";
3
- import axios from "axios";
4
-
5
- // Controller function for fetching Ethereum gas information
6
- export const gasTrackInformation = (req: Request, res: Response) => {
7
-
8
- // Add blocknative credentials
9
- const options = {
10
- method: 'GET',
11
- headers: {
12
- 'content-type': 'application/json',
13
- 'Authorization' : process.env.BLK_API_KEY
14
- }
15
- }
16
-
17
- axios.get('https://api.blocknative.com/gasprices/blockprices', options)
18
- .then(response => {
19
- res.status(200).json({
20
- information: response.data
21
- })
22
- })
23
- .catch(() => {
24
- res.status(400).json({});
25
- });
26
- }
@@ -1,43 +0,0 @@
1
- require('dotenv').config({ path: '../.env' });
2
- import { Request, Response } from 'express';
3
- import axios from "axios";
4
-
5
- // Controller function for fetching ERC20 Pricing information
6
- export const ERC20PriceController = (req: Request, res: Response) => {
7
- const { contractAddress, currentPrice, duration } = JSON.parse(req.body.body);
8
-
9
- // Add ERC20 price options data parameters
10
- const options = {
11
- method: 'GET',
12
- headers: {
13
- 'accept': 'application.json',
14
- 'content-type': 'application/json'
15
- }
16
- }
17
-
18
- // Conditionally fetching ERC20 pricing
19
- if (currentPrice) {
20
- axios.get('https://api.coingecko.com/api/v3/coins/ethereum/contract/' + contractAddress, options)
21
- .then(response => {
22
- res.status(200).json({
23
- information: response.data
24
- });
25
- })
26
- .catch(() => {
27
- res.status(400).json({});
28
- });
29
- }
30
- else {
31
- // Conditionally making API calls for ERC20 Pricing
32
- axios.get('https://api.coingecko.com/api/v3/coins/ethereum/contract/' + contractAddress +
33
- '/market_chart?vs_currency=usd&days=' + duration + '&interval=daily', options)
34
- .then(response => {
35
- res.status(200).json({
36
- information: response.data
37
- });
38
- })
39
- .catch(() => {
40
- res.status(400).json({});
41
- });
42
- }
43
- }