ethereum-hooks 1.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/LICENSE +21 -0
  2. package/README.md +246 -0
  3. package/client/package.json +25 -0
  4. package/client/src/crypto_hooks/ens/useFetchAddressENSLookup.ts +18 -0
  5. package/client/src/crypto_hooks/ens/useFetchENSAddressLookup.ts +19 -0
  6. package/client/src/crypto_hooks/ens/useFetchENSIDLookup.ts +18 -0
  7. package/client/src/crypto_hooks/ens/useFetchENSNameLookup.ts +18 -0
  8. package/client/src/crypto_hooks/erc20Tokens/useFetchERC20CollectionOwners.ts +20 -0
  9. package/client/src/crypto_hooks/erc20Tokens/useFetchERC20CollectionTopCoins.ts +19 -0
  10. package/client/src/crypto_hooks/erc20Tokens/useFetchERC20CollectionTransfers.ts +20 -0
  11. package/client/src/crypto_hooks/erc20Tokens/useFetchERC20Holdings.ts +20 -0
  12. package/client/src/crypto_hooks/erc20Tokens/useFetchERC20Transfers.ts +20 -0
  13. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionAttributes.ts +20 -0
  14. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionData.ts +20 -0
  15. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionExtraData.ts +20 -0
  16. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionFloorPrice.ts +20 -0
  17. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionMarketCap.ts +20 -0
  18. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionSales.ts +20 -0
  19. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionTransfers.ts +20 -0
  20. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionTrends.ts +19 -0
  21. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721CollectionVolume.ts +19 -0
  22. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721Holdings.ts +20 -0
  23. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721LookupData.ts +20 -0
  24. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721OpenseaData.ts +20 -0
  25. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721RarityData.ts +20 -0
  26. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721SalesData.ts +20 -0
  27. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721TransferLookupData.ts +20 -0
  28. package/client/src/crypto_hooks/erc721Tokens/useFetchERC721TransfersData.ts +20 -0
  29. package/client/src/crypto_hooks/gas/useFetchGasLookup.ts +17 -0
  30. package/client/src/crypto_hooks/prices/useFetchERC20Price.ts +20 -0
  31. package/client/src/crypto_hooks/prices/useFetchERC721Price.ts +19 -0
  32. package/client/src/crypto_hooks/prices/useFetchETHPrice.ts +20 -0
  33. package/client/src/crypto_hooks/prices/useFetchLayerTwoPrice.ts +21 -0
  34. package/client/src/custom_hooks/useFetch.ts +34 -0
  35. package/client/src/types/FetchStateType.ts +6 -0
  36. package/client/src/types/LayerTwoType.ts +22 -0
  37. package/hook-server-design.png +0 -0
  38. package/hooksinformation.txt +49 -0
  39. package/package.json +36 -0
  40. package/server/Controller/ENS/AddressToENSController.ts +30 -0
  41. package/server/Controller/ENS/ENSIDController.ts +32 -0
  42. package/server/Controller/ENS/ENSNameController.ts +32 -0
  43. package/server/Controller/ENS/ENSToAddressController.ts +32 -0
  44. package/server/Controller/ERC20Tokens/ERC20CollectionOwnersController.ts +29 -0
  45. package/server/Controller/ERC20Tokens/ERC20CollectionTopCoinsController.ts +27 -0
  46. package/server/Controller/ERC20Tokens/ERC20CollectionTransfersController.ts +29 -0
  47. package/server/Controller/ERC20Tokens/ERC20HoldingsController.ts +29 -0
  48. package/server/Controller/ERC20Tokens/ERC20TransfersController.ts +29 -0
  49. package/server/Controller/ERC721Tokens/ERC721CollectionAttributesController.ts +29 -0
  50. package/server/Controller/ERC721Tokens/ERC721CollectionDataController.ts +29 -0
  51. package/server/Controller/ERC721Tokens/ERC721CollectionExtraDataController.ts +29 -0
  52. package/server/Controller/ERC721Tokens/ERC721CollectionFloorPriceController.ts +18 -0
  53. package/server/Controller/ERC721Tokens/ERC721CollectionMarketCapController.ts +29 -0
  54. package/server/Controller/ERC721Tokens/ERC721CollectionSalesController.ts +29 -0
  55. package/server/Controller/ERC721Tokens/ERC721CollectionTransfersController.ts +29 -0
  56. package/server/Controller/ERC721Tokens/ERC721CollectionTrendsController.ts +28 -0
  57. package/server/Controller/ERC721Tokens/ERC721CollectionVolumeController.ts +28 -0
  58. package/server/Controller/ERC721Tokens/ERC721HoldingsController.ts +29 -0
  59. package/server/Controller/ERC721Tokens/ERC721LookupDataController.ts +28 -0
  60. package/server/Controller/ERC721Tokens/ERC721OpenseaDataController.ts +29 -0
  61. package/server/Controller/ERC721Tokens/ERC721RarityDataController.ts +29 -0
  62. package/server/Controller/ERC721Tokens/ERC721SalesDataController.ts +34 -0
  63. package/server/Controller/ERC721Tokens/ERC721TransferLookupDataController.ts +28 -0
  64. package/server/Controller/ERC721Tokens/ERC721TransfersDataController.ts +29 -0
  65. package/server/Controller/Gas/GasLookupController.ts +26 -0
  66. package/server/Controller/Prices/ERC20PriceController.ts +43 -0
  67. package/server/Controller/Prices/ERC721PriceController.ts +28 -0
  68. package/server/Controller/Prices/ETHPriceController.ts +42 -0
  69. package/server/Controller/Prices/LayerTwoPriceController.ts +41 -0
  70. package/server/Routes/ENSRoutes/AddressToENSRoute.ts +9 -0
  71. package/server/Routes/ENSRoutes/ENSIDRoute.ts +8 -0
  72. package/server/Routes/ENSRoutes/ENSNameRoute.ts +9 -0
  73. package/server/Routes/ENSRoutes/ENSToAddressRoute.ts +9 -0
  74. package/server/Routes/ERC20TokensRoutes/ERC20CollectionOwnersRoute.ts +9 -0
  75. package/server/Routes/ERC20TokensRoutes/ERC20CollectionTopCoinsRoute.ts +9 -0
  76. package/server/Routes/ERC20TokensRoutes/ERC20CollectionTransfersRoute.ts +9 -0
  77. package/server/Routes/ERC20TokensRoutes/ERC20HoldingsRoute.ts +9 -0
  78. package/server/Routes/ERC20TokensRoutes/ERC20TransfersRoute.ts +9 -0
  79. package/server/Routes/ERC721TokensRoutes/ERC721CollectionAttributesRoutes.ts +9 -0
  80. package/server/Routes/ERC721TokensRoutes/ERC721CollectionDataRoutes.ts +9 -0
  81. package/server/Routes/ERC721TokensRoutes/ERC721CollectionExtraDataRoutes.ts +9 -0
  82. package/server/Routes/ERC721TokensRoutes/ERC721CollectionFloorPriceRoutes.ts +9 -0
  83. package/server/Routes/ERC721TokensRoutes/ERC721CollectionMarketCapRoutes.ts +9 -0
  84. package/server/Routes/ERC721TokensRoutes/ERC721CollectionSalesRoutes.ts +9 -0
  85. package/server/Routes/ERC721TokensRoutes/ERC721CollectionTransfersRoutes.ts +9 -0
  86. package/server/Routes/ERC721TokensRoutes/ERC721CollectionTrendsRoutes.ts +9 -0
  87. package/server/Routes/ERC721TokensRoutes/ERC721CollectionVolumeRoutes.ts +9 -0
  88. package/server/Routes/ERC721TokensRoutes/ERC721HoldingsRoutes.ts +9 -0
  89. package/server/Routes/ERC721TokensRoutes/ERC721LookupDataRoutes.ts +9 -0
  90. package/server/Routes/ERC721TokensRoutes/ERC721OpenseaDataRoutes.ts +9 -0
  91. package/server/Routes/ERC721TokensRoutes/ERC721RarityDataRoutes.ts +9 -0
  92. package/server/Routes/ERC721TokensRoutes/ERC721SalesDataRoutes.ts +9 -0
  93. package/server/Routes/ERC721TokensRoutes/ERC721TransferLookupDataRoutes.ts +9 -0
  94. package/server/Routes/ERC721TokensRoutes/ERC721TransfersDataRoutes.ts +9 -0
  95. package/server/Routes/GasRoutes/GasLookupRoute.ts +9 -0
  96. package/server/Routes/PriceRoutes/ERC20PriceRoute.ts +9 -0
  97. package/server/Routes/PriceRoutes/ERC721PriceRoute.ts +9 -0
  98. package/server/Routes/PriceRoutes/ETHPriceRoute.ts +9 -0
  99. package/server/Routes/PriceRoutes/LayerTwoPriceRoute.ts +9 -0
  100. package/server/package.json +25 -0
  101. package/server/server.ts +53 -0
  102. package/server/tsconfig.json +109 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Abdullah Muhammad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,246 @@
1
+ # ethereum-hooks
2
+ A package containing useful hooks for working with the Ethereum blockchain using crypto APIs. The following resources will be referenced when building these hooks:
3
+
4
+ - <a href="https://docs.alchemy.com/reference/api-overview">Alchemy</a>
5
+ - <a href="https://docs.blocknative.com/">Blocknative</a>
6
+ - <a href="https://docs.coingecko.com/v3.0.1/reference/introduction">CoinGecko</a>
7
+ - <a href="https://docs.moralis.com/">Moralis</a>
8
+ - <a href="https://docs.opensea.io/reference/api-overview">Opensea</a>
9
+ - <a href="https://docs.transpose.io/">Transpose</a>
10
+
11
+ <br />
12
+
13
+ ## React Hooks Client-Server Setup
14
+ When working with this package, you will need to implement the typical MERN design pattern. Set up <code>.env</code> variables and set up the server to allow the client hooks to establish communication.
15
+
16
+ <b>You will need to set the following environment variables in your <code>.env</code> file: </b>
17
+
18
+ - <code>ALCHEMY_API_KEY</code>
19
+ - <code>BLK_API_KEY</code>
20
+ - <code>CLIENT_PORT</code>
21
+ - <code>COINGECKO_API_KEY</code>
22
+ - <code>MORALIS_API_KEY</code>
23
+ - <code>OPENSEA_API_KEY</code>
24
+ - <code>PORT</code>
25
+ - <code>TRANSPOSE_API_KEY</code>
26
+
27
+ The following diagram will help you understand the flow of how everything works:
28
+
29
+ <img src="https://genericbucket95.s3.us-east-2.amazonaws.com/hook-server-design.png" alt="Hook Server" width="600" height="400" />
30
+
31
+ <br />
32
+
33
+ ## Link to Published NPM Package
34
+ - <a href="https://www.npmjs.com/package/ethereum-hooks">Ethereum Hooks</a>
35
+
36
+ <br />
37
+
38
+ ## Server Setup
39
+
40
+ For this part, you will need to incorporate the server object exported from the <code>server.ts</code> file inside the server directory.
41
+ <b>You will need to build on top of this built-in server any additional routes and configurations as this server contains all the routes needed to effectively use the client hooks. </b>
42
+
43
+ <br />
44
+
45
+ ## React Client Hooks
46
+
47
+ The hooks cover several areas of the Ethereum blockchain and can be used for Layer Two chains as well. You will need to specify the <b>server port number</b> in order to access it for local development API calls.
48
+ A list of what chains are supported is provided below in the <code>Types</code> section.
49
+
50
+ The following table highlights the 30 different client hooks:
51
+
52
+ <table>
53
+ <tr>
54
+ <th>Category</th>
55
+ <th>Client Hook Name</th>
56
+ <th>Description</th>
57
+ <tr>
58
+ <tr>
59
+ <td>ENS</td>
60
+ <td><code>useFetchAddressENSLookup(address: string, port: number)</code></td>
61
+ <td>Fetch the equivalent ENS name from a given address</td>
62
+ </tr>
63
+ <tr>
64
+ <td>ENS</td>
65
+ <td><code>useFetchENSAddressLookup(ensName: string, port: number)</code></td>
66
+ <td>Fetch the equivalent ETH address from a given ENS name</td>
67
+ </tr>
68
+ <tr>
69
+ <td>ENS</td>
70
+ <td><code>useFetchENSIDLookup(id: string, port: number)</code></td>
71
+ <td>Fetch information of a given ENS ID</td>
72
+ </tr>
73
+ <tr>
74
+ <td>ENS</td>
75
+ <td><code>useFetchENSNameLookup(ensName: string, port: number)</code></td>
76
+ <td>Fetch information of a given ENS name</td>
77
+ </tr>
78
+ <tr>
79
+ <td>ERC20</td>
80
+ <td><code>useFetchERC20CollectionOwners(contractAddress: string, port: number)</code></td>
81
+ <td>Fetch list of owners of a particular ERC20 collection</td>
82
+ </tr>
83
+ <tr>
84
+ <td>ERC20</td>
85
+ <td><code>useFetchERC20CollectionTopCoins(port: number)</code></td>
86
+ <td>Fetch list of the top ERC20 collections</td>
87
+ </tr>
88
+ <tr>
89
+ <td>ERC20</td>
90
+ <td><code>useFetchERC20CollectionTransfers(contractAddress: string, port: number)</code></td>
91
+ <td>Fetch transfer activity of a particular ERC20 collection</td>
92
+ </tr>
93
+ <tr>
94
+ <td>ERC20</td>
95
+ <td><code>useFetchERC20Holdings(contractAddress: string, port: number)</code></td>
96
+ <td>Track wallet holdings of a particular ERC20 token activity</td>
97
+ </tr>
98
+ <tr>
99
+ <td>ERC20</td>
100
+ <td><code>useFetchERC20Transfers(contractAddress: string, port: number)</code></td>
101
+ <td>Track the transfer activity of a particular ERC20 token in a wallet</td>
102
+ </tr>
103
+ <tr>
104
+ <td>ERC721</td>
105
+ <td><code>useFetchERC721CollectionAttributes(contractAddress: string, port: number)</code></td>
106
+ <td>Fetch attributes of a particular ERC721 collection</td>
107
+ </tr>
108
+ <tr>
109
+ <td>ERC721</td>
110
+ <td><code>useFetchERC721CollectionData(contractAddress: string, port: number)</code></td>
111
+ <td>Fetch data of a particular ERC721 collection</td>
112
+ </tr>
113
+ <tr>
114
+ <td>ERC721</td>
115
+ <td><code>useFetchERC721CollectionExtraData(contractAddress: string, port: number)</code></td>
116
+ <td>Fetch extra data of a particular ERC721 collection</td>
117
+ </tr>
118
+ <tr>
119
+ <td>ERC721</td>
120
+ <td><code>useFetchERC721CollectionFloorPrice(contractAddress: string, port: number)</code></td>
121
+ <td>Fetch floor price data of a particular ERC721 collection</td>
122
+ </tr>
123
+ <tr>
124
+ <td>ERC721</td>
125
+ <td><code>useFetchERC721CollectionMarketCap(contractAddress: string, duration: 2 | 14 | 30, port: number)</code></td>
126
+ <td>Fetch market cap data of a particular ERC721 collection</td>
127
+ </tr>
128
+ <tr>
129
+ <td>ERC721</td>
130
+ <td><code>useFetchERC721CollectionSales(contractAddress: string, port: number)</code></td>
131
+ <td>Fetch sales data of a particular ERC721 collection</td>
132
+ </tr>
133
+ <tr>
134
+ <td>ERC721</td>
135
+ <td><code>useFetchERC721CollectionTransfers(contractAddress: string, port: number)</code></td>
136
+ <td>Fetch transfer activity of a particular ERC721 collection</td>
137
+ </tr>
138
+ <tr>
139
+ <td>ERC721</td>
140
+ <td><code>useFetchERC721CollectionTrends(port: number)</code></td>
141
+ <td>Fetch trending ERC721 collection data</td>
142
+ </tr>
143
+ <tr>
144
+ <td>ERC721</td>
145
+ <td><code>useFetchERC721CollectionVolume(port: number)</code></td>
146
+ <td>Fetch ERC721 collections by volume data</td>
147
+ </tr>
148
+ <tr>
149
+ <td>ERC721</td>
150
+ <td><code>useFetchERC721Holdings(walletAddress: string, port: number)</code></td>
151
+ <td>Fetch ERC721 holdings of a particular wallet</td>
152
+ </tr>
153
+ <tr>
154
+ <td>ERC721</td>
155
+ <td><code>useFetchERC721LookupData(contractAddress: string, tokenID: string, port: number)</code></td>
156
+ <td>Fetch data of a particular ERC721 token</td>
157
+ </tr>
158
+ <tr>
159
+ <td>ERC721</td>
160
+ <td><code>useFetchERC721OpenseaData(contractAddress: string, tokenID: string, port: number)</code></td>
161
+ <td>Fetch Opensea data of a particular ERC721 token</td>
162
+ </tr>
163
+ <tr>
164
+ <td>ERC721</td>
165
+ <td><code>useFetchERC721RarityData(contractAddress: string, tokenID: string, port: number)</code></td>
166
+ <td>Fetch rarity data of a particular ERC721 token</td>
167
+ </tr>
168
+ <tr>
169
+ <td>ERC721</td>
170
+ <td><code>useFetchERC721SalesData(contractAddress: string, tokenID: string, port: number)</code></td>
171
+ <td>Fetch sales data of a particular ERC721 token</td>
172
+ </tr>
173
+ <tr>
174
+ <td>ERC721</td>
175
+ <td><code>useFetchERC721TransferLookupData(contractAddress: string, tokenID: string, port: number)</code></td>
176
+ <td>Fetch transfer data of a particular ERC721 token</td>
177
+ </tr>
178
+ <tr>
179
+ <td>ERC721</td>
180
+ <td><code>useFetchERC721TransfersData(walletAddress: string, port: number)</code></td>
181
+ <td>Fetch ERC721 transfer activity of a particular wallet</td>
182
+ </tr>
183
+ <tr>
184
+ <td>Gas</td>
185
+ <td><code>useFetchGasLookup(port: number)</code></td>
186
+ <td>Fetch gas information related to Ethereum or a supported layer two</td>
187
+ </tr>
188
+ <tr>
189
+ <td>Prices</td>
190
+ <td><code>useFetchERC20Price(contractAddress: string, currentPrice: boolean, duration: 2 | 14 | 30, port: number)</code></td>
191
+ <td>Fetch pricing data of a particular ERC20 collection</td>
192
+ </tr>
193
+ <tr>
194
+ <td>Prices</td>
195
+ <td><code>useFetchERC721Price(contractAddress: string, tokenID: string, port: number)</code></td>
196
+ <td>Fetch pricing data of a particular ERC721 collection</td>
197
+ </tr>
198
+ <tr>
199
+ <td>Prices</td>
200
+ <td><code>useFetchETHPrice(currentPrice: boolean, duration: 2 | 14 | 30, port: number)</code></td>
201
+ <td>Fetch Ethereum price data</td>
202
+ </tr>
203
+ <tr>
204
+ <td>Prices</td>
205
+ <td><code>useFetchLayerTwoPrice(layerTwo: LayerTwoNetworks, currentPrice: boolean, duration: 2 | 14 | 30, port: number)</code></td>
206
+ <td>Fetch Layer Two price data</td>
207
+ </tr>
208
+ </table>
209
+
210
+ <br />
211
+
212
+ ## Custom Hooks
213
+ Custom hooks were used for development convenience and were fully incorporated into the main client hooks. The following table depicts the custom hooks:
214
+
215
+ <table>
216
+ <tr>
217
+ <th>Custom Hook</th>
218
+ <th>Function</th>
219
+ <tr>
220
+ <tr>
221
+ <td><code>useFetch</code></td>
222
+ <td>To fetch data readily using a set of defined parameters</td>
223
+ </tr>
224
+ </table>
225
+
226
+ <br />
227
+
228
+ ## Types
229
+ Custom data types were developed for fetch state and defining a set of available layer two networks
230
+
231
+ <table>
232
+ <tr>
233
+ <th>Custom Data Type</th>
234
+ <th>Function</th>
235
+ <tr>
236
+ <tr>
237
+ <td><code>FetchStateType</code></td>
238
+ <td>To fetch data readily using a set of defined parameters</td>
239
+ </tr>
240
+ <tr>
241
+ <td><code>LayerTwoType</code></td>
242
+ <td>
243
+ Set of defined Layer Two Networks: <code>optimism</code>, <code>arbitrum</code>, <code>matic-network</code>, <code>zksync</code>, <code>immutable-x</code>, <code>starknet</code>, <code>boba-network</code>, <code>sushi</code>, <code>metis-token</code>, <code>hermez-network-token</code>, <code>celer-network</code>, <code>havven</code>, <code>devve</code>, <code>loopring</code>, <code>biconomy</code>, <code>bancor</code>, <code>aave</code>, <code>perpetual-protocol</code>, <code>cartesi</code>, <code>zora</code>
244
+ </td>
245
+ </tr>
246
+ </table>
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "client",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@types/node": "^22.9.0",
13
+ "@types/react": "^18.3.12",
14
+ "@types/react-dom": "^18.3.1",
15
+ "axios": "^1.7.7",
16
+ "client": "file:",
17
+ "react": "^18.3.1",
18
+ "react-dom": "^18.3.1",
19
+ "react-router": "^6.27.0",
20
+ "react-router-dom": "^6.27.0",
21
+ "react-scripts": "^5.0.1",
22
+ "ts-node": "^10.9.2",
23
+ "typescript": "^5.7.2"
24
+ }
25
+ }
@@ -0,0 +1,18 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching Address to ENS Custom hook
4
+ export const useFetchAddressENSLookup = (address: string, port: number) => {
5
+ const URL = `http://localhost:${port}/address-to-ens-information`; // Define the API endpoint
6
+
7
+ const options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ address }),
10
+ headers: {
11
+ 'accept': 'application/json'
12
+ }
13
+ };
14
+
15
+ const state = useFetch(URL, options); // Use the custom hook to fetch data
16
+
17
+ return state; // Return the state from the custom hook
18
+ }
@@ -0,0 +1,19 @@
1
+ import axios from "axios";
2
+ import { useFetch } from "../../custom_hooks/useFetch";
3
+
4
+ // Fetching ENS to Address Custom hook
5
+ export const useFetchENSAddressLookup = (ensName: string, port: number) => {
6
+ const URL = `http://localhost:${port}/additional-address-to-ens-information`; // Define the API endpoint
7
+
8
+ const options = {
9
+ method: 'POST',
10
+ body: JSON.stringify({ ensName }),
11
+ headers: {
12
+ 'accept': 'application/json'
13
+ }
14
+ };
15
+
16
+ const state = useFetch(URL, options); // Use the custom hook to fetch data
17
+
18
+ return state; // Return the state from the custom hook
19
+ }
@@ -0,0 +1,18 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetch ENS ID lookups
4
+ export const useFetchENSIDLookup = (id: string, port: number) => {
5
+ const URL = `https://localhost:${port}/ens-transfers-by-id`; // Define the API endpoint
6
+
7
+ const options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ id }),
10
+ headers: {
11
+ 'accept': 'application/json'
12
+ }
13
+ };
14
+
15
+ const state = useFetch(URL, options); // Use the custom hook to fetch data
16
+
17
+ return state; // Return the state from the custom hook
18
+ }
@@ -0,0 +1,18 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetch ENS Name lookups
4
+ export const useFetchENSNameLookup = (ensName: string, port: number) => {
5
+ const URL = `https://localhost:${port}/ens-transfers-by-name`; // Define the API endpoint
6
+
7
+ const options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ ensName }),
10
+ headers: {
11
+ 'accept': 'application/json'
12
+ }
13
+ };
14
+
15
+ const state = useFetch(URL, options); // Use the custom hook to fetch data
16
+
17
+ return state; // Return the state from the custom hook
18
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC20 Prices Hook
4
+ export const useFetchERC20CollectionOwners = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc20-collection-owners`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,19 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC20 Collection Top Coins
4
+ export const useFetchERC20CollectionTopCoins = async (port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ headers : {
10
+ 'accept' : 'application/json'
11
+ }
12
+ }
13
+
14
+ // Use the custom hook to fetch data
15
+ const state = useFetch(`http://localhost:${port}/erc20-top-coins`, options);
16
+
17
+ // Return the state from the custom hook
18
+ return state;
19
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC20 Collection Transfers
4
+ export const useFetchERC20CollectionTransfers = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc20-collection-transfers`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC20 Collection Holdings
4
+ export const useFetchERC20Holdings = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc20-collection-holdings`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC20 Collection Transfers
4
+ export const useFetchERC20Transfers = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc20-collection-transfers`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Attributes Hook
4
+ export const useFetchERC721CollectionAttributes = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-attributes`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Data Hook
4
+ export const useFetchERC721CollectionData = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-data`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Data Hook
4
+ export const useFetchERC721CollectionExtraData = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-extra-data`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Floor Price Hook
4
+ export const useFetchERC721CollectionFloorPrice = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-floor-price`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Market Cap Hook
4
+ export const useFetchERC721CollectionMarketCap = async (contractAddress: string, duration: 2 | 14 | 30, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress, duration }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-market-cap`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Sales Hook
4
+ export const useFetchERC721CollectionSales = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-sales`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Transfers Hook
4
+ export const useFetchERC721CollectionTransfers = async (contractAddress: string, port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ body: JSON.stringify({ contractAddress }),
10
+ headers : {
11
+ 'accept' : 'application/json'
12
+ }
13
+ }
14
+
15
+ // Use the custom hook to fetch data
16
+ const state = useFetch(`http://localhost:${port}/erc721-collection-transfers`, options);
17
+
18
+ // Return the state from the custom hook
19
+ return state;
20
+ }
@@ -0,0 +1,19 @@
1
+ import { useFetch } from "../../custom_hooks/useFetch";
2
+
3
+ // Fetching ERC721 Collection Trends Hook
4
+ export const useFetchERC721CollectionTrends = async (port: number) => {
5
+
6
+ // Set options for request
7
+ let options = {
8
+ method: 'POST',
9
+ headers : {
10
+ 'accept' : 'application/json'
11
+ }
12
+ }
13
+
14
+ // Use the custom hook to fetch data
15
+ const state = useFetch(`http://localhost:${port}/erc721-collection-trends`, options);
16
+
17
+ // Return the state from the custom hook
18
+ return state;
19
+ }