ethereum-hooks 2.0.1 → 2.0.3
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.
- package/README.md +28 -2
- package/crypto_hooks/ens/index.ts +5 -0
- package/crypto_hooks/erc20Tokens/index.ts +6 -0
- package/crypto_hooks/erc721Tokens/index.ts +17 -0
- package/crypto_hooks/gas/index.ts +2 -0
- package/crypto_hooks/prices/index.ts +5 -0
- package/package.json +33 -4
- package/crypto_hooks/index.ts +0 -39
package/README.md
CHANGED
|
@@ -28,16 +28,42 @@ No backend setup or environment variables are required on your end.
|
|
|
28
28
|
|
|
29
29
|
## React Client Hooks
|
|
30
30
|
|
|
31
|
-
The hooks cover several areas of the Ethereum blockchain and can be used for Layer Two chains as well.
|
|
31
|
+
The hooks cover several areas of the Ethereum blockchain and can be used for Layer Two chains as well.
|
|
32
32
|
|
|
33
33
|
Each hook automatically connects to its dedicated AWS Lambda endpoint - no manual URL configuration is needed.
|
|
34
34
|
|
|
35
|
+
### Import Structure (v2.0.2+)
|
|
36
|
+
|
|
37
|
+
Starting with version 2.0.2, hooks are organized into grouped imports for better organization:
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
// ENS Hooks
|
|
41
|
+
import { useAddressENSLookup, useENSNameLookup, useENSAddressLookup, useENSIDLookup } from 'ethereum-hooks/ens';
|
|
42
|
+
|
|
43
|
+
// ERC20 Token Hooks
|
|
44
|
+
import { useERC20Holdings, useERC20Transfers, useERC20CollectionOwners } from 'ethereum-hooks/erc20';
|
|
45
|
+
|
|
46
|
+
// ERC721 Token Hooks
|
|
47
|
+
import { useERC721CollectionData, useERC721Holdings, useERC721LookupData } from 'ethereum-hooks/erc721';
|
|
48
|
+
|
|
49
|
+
// Gas Hooks
|
|
50
|
+
import { useGasLookup } from 'ethereum-hooks/gas';
|
|
51
|
+
|
|
52
|
+
// Price Hooks
|
|
53
|
+
import { useETHPrice, useERC20Price, useERC721Price, useLayerTwoPrice } from 'ethereum-hooks/prices';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This structured approach makes it easier to:
|
|
57
|
+
- Import only what you need
|
|
58
|
+
- Understand which category each hook belongs to
|
|
59
|
+
- Maintain cleaner import statements
|
|
60
|
+
|
|
35
61
|
Here is a quick example of how you can work with client hooks. The following is a code snippet for working with React.js:
|
|
36
62
|
|
|
37
63
|
<code>ENSToAddressPage.tsx</code>
|
|
38
64
|
```javascript
|
|
39
65
|
import React, { FC } from 'react';
|
|
40
|
-
import { useENSAddressLookup } from 'ethereum-hooks';
|
|
66
|
+
import { useENSAddressLookup } from 'ethereum-hooks/ens';
|
|
41
67
|
|
|
42
68
|
// Incorporating the ENS to Address Client Hook.. using Vitalik Buterin's address
|
|
43
69
|
// No server setup required - connects directly to AWS Lambda
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ERC20 Token Hooks
|
|
2
|
+
export { useERC20CollectionOwners } from './useERC20CollectionOwners';
|
|
3
|
+
export { useERC20CollectionTopCoins } from './useERC20CollectionTopCoins';
|
|
4
|
+
export { useERC20CollectionTransfers } from './useERC20CollectionTransfers';
|
|
5
|
+
export { useERC20Holdings } from './useERC20Holdings';
|
|
6
|
+
export { useERC20Transfers } from './useERC20Transfers';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// ERC721 Token Hooks
|
|
2
|
+
export { useERC721CollectionAttributes } from './useERC721CollectionAttributes';
|
|
3
|
+
export { useERC721CollectionData } from './useERC721CollectionData';
|
|
4
|
+
export { useERC721CollectionExtraData } from './useERC721CollectionExtraData';
|
|
5
|
+
export { useERC721CollectionFloorPrice } from './useERC721CollectionFloorPrice';
|
|
6
|
+
export { useERC721CollectionMarketCap } from './useERC721CollectionMarketCap';
|
|
7
|
+
export { useERC721CollectionSales } from './useERC721CollectionSales';
|
|
8
|
+
export { useERC721CollectionTransfers } from './useERC721CollectionTransfers';
|
|
9
|
+
export { useERC721CollectionTrends } from './useERC721CollectionTrends';
|
|
10
|
+
export { useERC721CollectionVolume } from './useERC721CollectionVolume';
|
|
11
|
+
export { useERC721Holdings } from './useERC721Holdings';
|
|
12
|
+
export { useERC721LookupData } from './useERC721LookupData';
|
|
13
|
+
export { useERC721OpenseaData } from './useERC721OpenseaData';
|
|
14
|
+
export { useERC721RarityData } from './useERC721RarityData';
|
|
15
|
+
export { useERC721SalesData } from './useERC721SalesData';
|
|
16
|
+
export { useERC721TransferLookupData } from './useERC721TransferLookupData';
|
|
17
|
+
export { useERC721TransfersData } from './useERC721TransfersData';
|
package/package.json
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ethereum-hooks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Resourceful NPM package that contains React hooks for working with the Ethereum Blockchain.",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
"./ens": {
|
|
7
|
+
"import": "./crypto_hooks/ens/index.js",
|
|
8
|
+
"require": "./crypto_hooks/ens/index.js",
|
|
9
|
+
"types": "./crypto_hooks/ens/index.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./erc20": {
|
|
12
|
+
"import": "./crypto_hooks/erc20Tokens/index.js",
|
|
13
|
+
"require": "./crypto_hooks/erc20Tokens/index.js",
|
|
14
|
+
"types": "./crypto_hooks/erc20Tokens/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./erc721": {
|
|
17
|
+
"import": "./crypto_hooks/erc721Tokens/index.js",
|
|
18
|
+
"require": "./crypto_hooks/erc721Tokens/index.js",
|
|
19
|
+
"types": "./crypto_hooks/erc721Tokens/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./gas": {
|
|
22
|
+
"import": "./crypto_hooks/gas/index.js",
|
|
23
|
+
"require": "./crypto_hooks/gas/index.js",
|
|
24
|
+
"types": "./crypto_hooks/gas/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./prices": {
|
|
27
|
+
"import": "./crypto_hooks/prices/index.js",
|
|
28
|
+
"require": "./crypto_hooks/prices/index.js",
|
|
29
|
+
"types": "./crypto_hooks/prices/index.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
7
32
|
"repository": {
|
|
8
33
|
"type": "git",
|
|
9
34
|
"url": "https://github.com/CodingAbdullah/ethereum-hooks.git"
|
|
@@ -21,7 +46,11 @@
|
|
|
21
46
|
"license": "MIT",
|
|
22
47
|
"private": false,
|
|
23
48
|
"files": [
|
|
24
|
-
"crypto_hooks/**/*",
|
|
49
|
+
"crypto_hooks/ens/**/*",
|
|
50
|
+
"crypto_hooks/erc20Tokens/**/*",
|
|
51
|
+
"crypto_hooks/erc721Tokens/**/*",
|
|
52
|
+
"crypto_hooks/gas/**/*",
|
|
53
|
+
"crypto_hooks/prices/**/*",
|
|
25
54
|
"custom_hooks/**/*",
|
|
26
55
|
"types/**/*"
|
|
27
56
|
],
|
package/crypto_hooks/index.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// ENS Hooks
|
|
2
|
-
export { useAddressENSLookup } from './ens/useAddressENSLookup';
|
|
3
|
-
export { useENSAddressLookup } from './ens/useENSAddressLookup';
|
|
4
|
-
export { useENSIDLookup } from './ens/useENSIDLookup';
|
|
5
|
-
export { useENSNameLookup } from './ens/useENSNameLookup';
|
|
6
|
-
|
|
7
|
-
// ERC20 Token Hooks
|
|
8
|
-
export { useERC20CollectionOwners } from './erc20Tokens/useERC20CollectionOwners';
|
|
9
|
-
export { useERC20CollectionTopCoins } from './erc20Tokens/useERC20CollectionTopCoins';
|
|
10
|
-
export { useERC20CollectionTransfers } from './erc20Tokens/useERC20CollectionTransfers';
|
|
11
|
-
export { useERC20Holdings } from './erc20Tokens/useERC20Holdings';
|
|
12
|
-
export { useERC20Transfers } from './erc20Tokens/useERC20Transfers';
|
|
13
|
-
|
|
14
|
-
// ERC721 Token Hooks
|
|
15
|
-
export { useERC721CollectionAttributes } from './erc721Tokens/useERC721CollectionAttributes';
|
|
16
|
-
export { useERC721CollectionData } from './erc721Tokens/useERC721CollectionData';
|
|
17
|
-
export { useERC721CollectionExtraData } from './erc721Tokens/useERC721CollectionExtraData';
|
|
18
|
-
export { useERC721CollectionFloorPrice } from './erc721Tokens/useERC721CollectionFloorPrice';
|
|
19
|
-
export { useERC721CollectionMarketCap } from './erc721Tokens/useERC721CollectionMarketCap';
|
|
20
|
-
export { useERC721CollectionSales } from './erc721Tokens/useERC721CollectionSales';
|
|
21
|
-
export { useERC721CollectionTransfers } from './erc721Tokens/useERC721CollectionTransfers';
|
|
22
|
-
export { useERC721CollectionTrends } from './erc721Tokens/useERC721CollectionTrends';
|
|
23
|
-
export { useERC721CollectionVolume } from './erc721Tokens/useERC721CollectionVolume';
|
|
24
|
-
export { useERC721Holdings } from './erc721Tokens/useERC721Holdings';
|
|
25
|
-
export { useERC721LookupData } from './erc721Tokens/useERC721LookupData';
|
|
26
|
-
export { useERC721OpenseaData } from './erc721Tokens/useERC721OpenseaData';
|
|
27
|
-
export { useERC721RarityData } from './erc721Tokens/useERC721RarityData';
|
|
28
|
-
export { useERC721SalesData } from './erc721Tokens/useERC721SalesData';
|
|
29
|
-
export { useERC721TransferLookupData } from './erc721Tokens/useERC721TransferLookupData';
|
|
30
|
-
export { useERC721TransfersData } from './erc721Tokens/useERC721TransfersData';
|
|
31
|
-
|
|
32
|
-
// Gas Hooks
|
|
33
|
-
export { useGasLookup } from './gas/useGasLookup';
|
|
34
|
-
|
|
35
|
-
// Price Hooks
|
|
36
|
-
export { useERC20Price } from './prices/useERC20Price';
|
|
37
|
-
export { useERC721Price } from './prices/useERC721Price';
|
|
38
|
-
export { useETHPrice } from './prices/useETHPrice';
|
|
39
|
-
export { useLayerTwoPrice } from './prices/useLayerTwoPrice';
|