@0xsequence/hooks 6.0.0-beta.4 → 6.0.0
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/LICENSE +1 -1
- package/dist/esm/contexts/ConfigContext.d.ts +2 -0
- package/dist/esm/contexts/ConfigContext.d.ts.map +1 -1
- package/dist/esm/contexts/ConfigContext.js +2 -0
- package/dist/esm/contexts/ConfigContext.js.map +1 -1
- package/dist/esm/hooks/Indexer/useGetTransactionHistory.d.ts +2 -0
- package/dist/esm/hooks/Indexer/useGetTransactionHistory.d.ts.map +1 -1
- package/dist/esm/hooks/Indexer/useIndexerClient.d.ts +2 -2
- package/dist/esm/hooks/Indexer/useIndexerClient.d.ts.map +1 -1
- package/dist/esm/hooks/Indexer/useIndexerClient.js +1 -1
- package/dist/esm/hooks/Indexer/useIndexerClient.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts +2 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts +2 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts +2 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts +2 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.js.map +1 -1
- package/dist/esm/hooks/Metadata/useGetContractInfo.d.ts.map +1 -1
- package/dist/esm/hooks/Metadata/useGetContractInfo.js +1 -1
- package/dist/esm/hooks/Metadata/useGetContractInfo.js.map +1 -1
- package/dist/esm/hooks/useNetwork.d.ts +1 -1
- package/dist/esm/hooks/useNetwork.d.ts.map +1 -1
- package/dist/esm/hooks/useNetwork.js +1 -1
- package/dist/esm/hooks/useNetwork.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tests/IndexerGateway/useGetTokenBalancesByContract.test.js.map +1 -1
- package/dist/esm/tests/IndexerGateway/useGetTokenBalancesDetails.test.js.map +1 -1
- package/dist/esm/tests/IndexerGateway/useGetTokenBalancesSummary.test.js.map +1 -1
- package/dist/esm/utils/helpers.d.ts.map +1 -1
- package/dist/esm/utils/helpers.js +2 -0
- package/dist/esm/utils/helpers.js.map +1 -1
- package/dist/esm/utils/networks.d.ts +83 -0
- package/dist/esm/utils/networks.d.ts.map +1 -0
- package/dist/esm/utils/networks.js +52 -0
- package/dist/esm/utils/networks.js.map +1 -0
- package/package.json +15 -18
- package/dist/cjs/constants.d.ts +0 -29
- package/dist/cjs/constants.d.ts.map +0 -1
- package/dist/cjs/constants.js +0 -33
- package/dist/cjs/constants.js.map +0 -1
- package/dist/cjs/contexts/ConfigContext.d.ts +0 -27
- package/dist/cjs/contexts/ConfigContext.d.ts.map +0 -1
- package/dist/cjs/contexts/ConfigContext.js +0 -30
- package/dist/cjs/contexts/ConfigContext.js.map +0 -1
- package/dist/cjs/hooks/API/useAPIClient.d.ts +0 -39
- package/dist/cjs/hooks/API/useAPIClient.d.ts.map +0 -1
- package/dist/cjs/hooks/API/useAPIClient.js +0 -51
- package/dist/cjs/hooks/API/useAPIClient.js.map +0 -1
- package/dist/cjs/hooks/API/useGetCoinPrices.d.ts +0 -49
- package/dist/cjs/hooks/API/useGetCoinPrices.d.ts.map +0 -1
- package/dist/cjs/hooks/API/useGetCoinPrices.js +0 -78
- package/dist/cjs/hooks/API/useGetCoinPrices.js.map +0 -1
- package/dist/cjs/hooks/API/useGetCollectiblePrices.d.ts +0 -54
- package/dist/cjs/hooks/API/useGetCollectiblePrices.d.ts.map +0 -1
- package/dist/cjs/hooks/API/useGetCollectiblePrices.js +0 -83
- package/dist/cjs/hooks/API/useGetCollectiblePrices.js.map +0 -1
- package/dist/cjs/hooks/API/useGetExchangeRate.d.ts +0 -42
- package/dist/cjs/hooks/API/useGetExchangeRate.d.ts.map +0 -1
- package/dist/cjs/hooks/API/useGetExchangeRate.js +0 -63
- package/dist/cjs/hooks/API/useGetExchangeRate.js.map +0 -1
- package/dist/cjs/hooks/API/useGetWaasStatus.d.ts +0 -48
- package/dist/cjs/hooks/API/useGetWaasStatus.d.ts.map +0 -1
- package/dist/cjs/hooks/API/useGetWaasStatus.js +0 -49
- package/dist/cjs/hooks/API/useGetWaasStatus.js.map +0 -1
- package/dist/cjs/hooks/Builder/useDetectContractVersion.d.ts +0 -30
- package/dist/cjs/hooks/Builder/useDetectContractVersion.d.ts.map +0 -1
- package/dist/cjs/hooks/Builder/useDetectContractVersion.js +0 -26
- package/dist/cjs/hooks/Builder/useDetectContractVersion.js.map +0 -1
- package/dist/cjs/hooks/Combination/useGetSwapQuote.d.ts +0 -97
- package/dist/cjs/hooks/Combination/useGetSwapQuote.d.ts.map +0 -1
- package/dist/cjs/hooks/Combination/useGetSwapQuote.js +0 -123
- package/dist/cjs/hooks/Combination/useGetSwapQuote.js.map +0 -1
- package/dist/cjs/hooks/Combination/useGetSwapRoutes.d.ts +0 -61
- package/dist/cjs/hooks/Combination/useGetSwapRoutes.d.ts.map +0 -1
- package/dist/cjs/hooks/Combination/useGetSwapRoutes.js +0 -83
- package/dist/cjs/hooks/Combination/useGetSwapRoutes.js.map +0 -1
- package/dist/cjs/hooks/Indexer/useGetTransactionHistory.d.ts +0 -97
- package/dist/cjs/hooks/Indexer/useGetTransactionHistory.d.ts.map +0 -1
- package/dist/cjs/hooks/Indexer/useGetTransactionHistory.js +0 -131
- package/dist/cjs/hooks/Indexer/useGetTransactionHistory.js.map +0 -1
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.d.ts +0 -76
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.d.ts.map +0 -1
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.js +0 -115
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.js.map +0 -1
- package/dist/cjs/hooks/Indexer/useIndexerClient.d.ts +0 -102
- package/dist/cjs/hooks/Indexer/useIndexerClient.d.ts.map +0 -1
- package/dist/cjs/hooks/Indexer/useIndexerClient.js +0 -145
- package/dist/cjs/hooks/Indexer/useIndexerClient.js.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts +0 -35
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.js +0 -55
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.js.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalance.d.ts +0 -50
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalance.d.ts.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalance.js +0 -88
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalance.js.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts +0 -61
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.js +0 -85
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.js.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts +0 -99
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.js +0 -136
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.js.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts +0 -74
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.js +0 -111
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.js.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.d.ts +0 -29
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.d.ts.map +0 -1
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.js +0 -41
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.js.map +0 -1
- package/dist/cjs/hooks/Metadata/useGetContractInfo.d.ts +0 -68
- package/dist/cjs/hooks/Metadata/useGetContractInfo.d.ts.map +0 -1
- package/dist/cjs/hooks/Metadata/useGetContractInfo.js +0 -96
- package/dist/cjs/hooks/Metadata/useGetContractInfo.js.map +0 -1
- package/dist/cjs/hooks/Metadata/useGetMultipleContractsInfo.d.ts +0 -95
- package/dist/cjs/hooks/Metadata/useGetMultipleContractsInfo.d.ts.map +0 -1
- package/dist/cjs/hooks/Metadata/useGetMultipleContractsInfo.js +0 -118
- package/dist/cjs/hooks/Metadata/useGetMultipleContractsInfo.js.map +0 -1
- package/dist/cjs/hooks/Metadata/useGetTokenMetadata.d.ts +0 -89
- package/dist/cjs/hooks/Metadata/useGetTokenMetadata.d.ts.map +0 -1
- package/dist/cjs/hooks/Metadata/useGetTokenMetadata.js +0 -123
- package/dist/cjs/hooks/Metadata/useGetTokenMetadata.js.map +0 -1
- package/dist/cjs/hooks/Metadata/useMetadataClient.d.ts +0 -39
- package/dist/cjs/hooks/Metadata/useMetadataClient.d.ts.map +0 -1
- package/dist/cjs/hooks/Metadata/useMetadataClient.js +0 -51
- package/dist/cjs/hooks/Metadata/useMetadataClient.js.map +0 -1
- package/dist/cjs/hooks/useClearCachedBalances.d.ts +0 -4
- package/dist/cjs/hooks/useClearCachedBalances.d.ts.map +0 -1
- package/dist/cjs/hooks/useClearCachedBalances.js +0 -17
- package/dist/cjs/hooks/useClearCachedBalances.js.map +0 -1
- package/dist/cjs/hooks/useClipboard.d.ts +0 -6
- package/dist/cjs/hooks/useClipboard.d.ts.map +0 -1
- package/dist/cjs/hooks/useClipboard.js +0 -34
- package/dist/cjs/hooks/useClipboard.js.map +0 -1
- package/dist/cjs/hooks/useConfig.d.ts +0 -47
- package/dist/cjs/hooks/useConfig.d.ts.map +0 -1
- package/dist/cjs/hooks/useConfig.js +0 -59
- package/dist/cjs/hooks/useConfig.js.map +0 -1
- package/dist/cjs/hooks/useNetwork.d.ts +0 -2
- package/dist/cjs/hooks/useNetwork.d.ts.map +0 -1
- package/dist/cjs/hooks/useNetwork.js +0 -9
- package/dist/cjs/hooks/useNetwork.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -27
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -67
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/tests/API/useGetCoinPrices.test.d.ts +0 -2
- package/dist/cjs/tests/API/useGetCoinPrices.test.d.ts.map +0 -1
- package/dist/cjs/tests/API/useGetCoinPrices.test.js +0 -36
- package/dist/cjs/tests/API/useGetCoinPrices.test.js.map +0 -1
- package/dist/cjs/tests/API/useGetCollectiblePrices.test.d.ts +0 -2
- package/dist/cjs/tests/API/useGetCollectiblePrices.test.d.ts.map +0 -1
- package/dist/cjs/tests/API/useGetCollectiblePrices.test.js +0 -36
- package/dist/cjs/tests/API/useGetCollectiblePrices.test.js.map +0 -1
- package/dist/cjs/tests/API/useGetExchangeRate.test.d.ts +0 -2
- package/dist/cjs/tests/API/useGetExchangeRate.test.d.ts.map +0 -1
- package/dist/cjs/tests/API/useGetExchangeRate.test.js +0 -29
- package/dist/cjs/tests/API/useGetExchangeRate.test.js.map +0 -1
- package/dist/cjs/tests/Combination/useGetSwapQuote.test.d.ts +0 -2
- package/dist/cjs/tests/Combination/useGetSwapQuote.test.d.ts.map +0 -1
- package/dist/cjs/tests/Combination/useGetSwapQuote.test.js +0 -57
- package/dist/cjs/tests/Combination/useGetSwapQuote.test.js.map +0 -1
- package/dist/cjs/tests/Indexer/useGetTransactionHistory.test.d.ts +0 -2
- package/dist/cjs/tests/Indexer/useGetTransactionHistory.test.d.ts.map +0 -1
- package/dist/cjs/tests/Indexer/useGetTransactionHistory.test.js +0 -35
- package/dist/cjs/tests/Indexer/useGetTransactionHistory.test.js.map +0 -1
- package/dist/cjs/tests/Indexer/useGetTransactionHistorySummary.test.d.ts +0 -2
- package/dist/cjs/tests/Indexer/useGetTransactionHistorySummary.test.d.ts.map +0 -1
- package/dist/cjs/tests/Indexer/useGetTransactionHistorySummary.test.js +0 -34
- package/dist/cjs/tests/Indexer/useGetTransactionHistorySummary.test.js.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetNativeTokenBalance.test.d.ts +0 -2
- package/dist/cjs/tests/IndexerGateway/useGetNativeTokenBalance.test.d.ts.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetNativeTokenBalance.test.js +0 -34
- package/dist/cjs/tests/IndexerGateway/useGetNativeTokenBalance.test.js.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetSingleTokenBalanceSummary.test.d.ts +0 -2
- package/dist/cjs/tests/IndexerGateway/useGetSingleTokenBalanceSummary.test.d.ts.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetSingleTokenBalanceSummary.test.js +0 -35
- package/dist/cjs/tests/IndexerGateway/useGetSingleTokenBalanceSummary.test.js.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesByContract.test.d.ts +0 -2
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesByContract.test.d.ts.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesByContract.test.js +0 -38
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesByContract.test.js.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesDetails.test.d.ts +0 -2
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesDetails.test.d.ts.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesDetails.test.js +0 -38
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesDetails.test.js.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesSummary.test.d.ts +0 -2
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesSummary.test.d.ts.map +0 -1
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesSummary.test.js +0 -38
- package/dist/cjs/tests/IndexerGateway/useGetTokenBalancesSummary.test.js.map +0 -1
- package/dist/cjs/tests/Metadata/useGetContractInfo.test.d.ts +0 -2
- package/dist/cjs/tests/Metadata/useGetContractInfo.test.d.ts.map +0 -1
- package/dist/cjs/tests/Metadata/useGetContractInfo.test.js +0 -33
- package/dist/cjs/tests/Metadata/useGetContractInfo.test.js.map +0 -1
- package/dist/cjs/tests/Metadata/useGetMultipleContractsInfo.test.d.ts +0 -2
- package/dist/cjs/tests/Metadata/useGetMultipleContractsInfo.test.d.ts.map +0 -1
- package/dist/cjs/tests/Metadata/useGetMultipleContractsInfo.test.js +0 -39
- package/dist/cjs/tests/Metadata/useGetMultipleContractsInfo.test.js.map +0 -1
- package/dist/cjs/tests/Metadata/useGetTokenMetadata.test.d.ts +0 -2
- package/dist/cjs/tests/Metadata/useGetTokenMetadata.test.d.ts.map +0 -1
- package/dist/cjs/tests/Metadata/useGetTokenMetadata.test.js +0 -34
- package/dist/cjs/tests/Metadata/useGetTokenMetadata.test.js.map +0 -1
- package/dist/cjs/tests/createWrapper.d.ts +0 -7
- package/dist/cjs/tests/createWrapper.d.ts.map +0 -1
- package/dist/cjs/tests/createWrapper.js +0 -29
- package/dist/cjs/tests/createWrapper.js.map +0 -1
- package/dist/cjs/tests/fixtures/nativeTokenBalance.d.ts +0 -7
- package/dist/cjs/tests/fixtures/nativeTokenBalance.d.ts.map +0 -1
- package/dist/cjs/tests/fixtures/nativeTokenBalance.js +0 -10
- package/dist/cjs/tests/fixtures/nativeTokenBalance.js.map +0 -1
- package/dist/cjs/tests/handlers.d.ts +0 -2
- package/dist/cjs/tests/handlers.d.ts.map +0 -1
- package/dist/cjs/tests/handlers.js +0 -274
- package/dist/cjs/tests/handlers.js.map +0 -1
- package/dist/cjs/tests/setup.d.ts +0 -3
- package/dist/cjs/tests/setup.d.ts.map +0 -1
- package/dist/cjs/tests/setup.js +0 -16
- package/dist/cjs/tests/setup.js.map +0 -1
- package/dist/cjs/tests/simple.test.d.ts +0 -2
- package/dist/cjs/tests/simple.test.d.ts.map +0 -1
- package/dist/cjs/tests/simple.test.js +0 -64
- package/dist/cjs/tests/simple.test.js.map +0 -1
- package/dist/cjs/tests/useConfig.test.d.ts +0 -2
- package/dist/cjs/tests/useConfig.test.d.ts.map +0 -1
- package/dist/cjs/tests/useConfig.test.js +0 -15
- package/dist/cjs/tests/useConfig.test.js.map +0 -1
- package/dist/cjs/types/hooks.d.ts +0 -5
- package/dist/cjs/types/hooks.d.ts.map +0 -1
- package/dist/cjs/types/hooks.js +0 -3
- package/dist/cjs/types/hooks.js.map +0 -1
- package/dist/cjs/utils/envstring.d.ts +0 -2
- package/dist/cjs/utils/envstring.d.ts.map +0 -1
- package/dist/cjs/utils/envstring.js +0 -10
- package/dist/cjs/utils/envstring.js.map +0 -1
- package/dist/cjs/utils/helpers.d.ts +0 -12
- package/dist/cjs/utils/helpers.d.ts.map +0 -1
- package/dist/cjs/utils/helpers.js +0 -66
- package/dist/cjs/utils/helpers.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/hooks",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "React hooks for Sequence Web SDK",
|
|
5
5
|
"repository": "https://github.com/0xsequence/web-sdk/tree/master/packages/hooks",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Sequence Platforms ULC",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"main": "dist/
|
|
9
|
+
"main": "dist/esm/index.js",
|
|
10
10
|
"module": "dist/esm/index.js",
|
|
11
11
|
"types": "dist/esm/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
"./package.json": "./package.json",
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
16
|
-
"import": "./dist/esm/index.js"
|
|
15
|
+
"types": "./dist/esm/index.d.ts",
|
|
16
|
+
"import": "./dist/esm/index.js",
|
|
17
|
+
"default": "./dist/esm/index.js"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"dist"
|
|
21
22
|
],
|
|
22
23
|
"peerDependencies": {
|
|
23
|
-
"@0xsequence/api": ">=
|
|
24
|
-
"@0xsequence/indexer": ">=
|
|
25
|
-
"@0xsequence/metadata": ">=
|
|
26
|
-
"@0xsequence/
|
|
24
|
+
"@0xsequence/api": ">=3.0.0",
|
|
25
|
+
"@0xsequence/indexer": ">=3.0.0",
|
|
26
|
+
"@0xsequence/metadata": ">=3.0.0",
|
|
27
|
+
"@0xsequence/wallet-primitives": ">=3.0.0",
|
|
27
28
|
"@tanstack/react-query": ">= 5",
|
|
28
29
|
"react": ">= 17",
|
|
29
30
|
"react-dom": ">= 17",
|
|
30
|
-
"viem": ">= 2.
|
|
31
|
+
"viem": ">= 2.45.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@0xsequence/
|
|
34
|
-
"@0xsequence/indexer": "^2.3.38",
|
|
35
|
-
"@0xsequence/metadata": "^2.3.38",
|
|
36
|
-
"@0xsequence/network": "^2.3.38",
|
|
34
|
+
"@0xsequence/wallet-primitives": "^3.0.0",
|
|
37
35
|
"@tanstack/react-query": "^5.74.11",
|
|
38
36
|
"@testing-library/jest-dom": "^6.6.3",
|
|
39
37
|
"@testing-library/react": "^16.3.0",
|
|
@@ -44,17 +42,16 @@
|
|
|
44
42
|
"react": "^19.1.0",
|
|
45
43
|
"react-dom": "^19.1.0",
|
|
46
44
|
"typescript": "^5.8.3",
|
|
47
|
-
"viem": "^2.
|
|
45
|
+
"viem": "^2.45.1",
|
|
48
46
|
"vite": "^6.3.4",
|
|
49
47
|
"vitest": "^2.1.9"
|
|
50
48
|
},
|
|
51
49
|
"scripts": {
|
|
52
|
-
"build": "pnpm build:clean && pnpm build:esm
|
|
53
|
-
"build:cjs": "tsc --module commonjs --moduleResolution node --verbatimModuleSyntax false --declaration --declarationMap --outDir dist/cjs && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json",
|
|
50
|
+
"build": "pnpm build:clean && pnpm build:esm",
|
|
54
51
|
"build:esm": "tsc --verbatimModuleSyntax false --declaration --declarationMap --outDir dist/esm",
|
|
55
52
|
"build:clean": "rimraf -g ./dist",
|
|
56
53
|
"build:check": "attw --pack .",
|
|
57
|
-
"dev": "tsc --watch --
|
|
54
|
+
"dev": "tsc --watch --verbatimModuleSyntax false --declaration --declarationMap --outDir dist/esm",
|
|
58
55
|
"test": "vitest --run",
|
|
59
56
|
"test:watch": "vitest",
|
|
60
57
|
"typecheck": "tsc --noEmit"
|
package/dist/cjs/constants.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const QUERY_KEYS: {
|
|
2
|
-
useGetNativeTokenBalance: string;
|
|
3
|
-
useGetTokenBalancesSummary: string;
|
|
4
|
-
useGetTokenBalancesDetails: string;
|
|
5
|
-
useGetTokenBalancesByContract: string;
|
|
6
|
-
useGetTokenMetadata: string;
|
|
7
|
-
useGetTransactionHistory: string;
|
|
8
|
-
useGetTransactionHistorySummary: string;
|
|
9
|
-
useGetContractInfo: string;
|
|
10
|
-
useGetMultipleContractInfo: string;
|
|
11
|
-
useGetSingleTokenBalance: string;
|
|
12
|
-
useGetExchangeRate: string;
|
|
13
|
-
useGetCoinPrices: string;
|
|
14
|
-
useGetCollectiblePrices: string;
|
|
15
|
-
useGetSwapQuote: string;
|
|
16
|
-
useGetSwapRoutes: string;
|
|
17
|
-
useDetectContractVersion: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const time: {
|
|
20
|
-
oneSecond: number;
|
|
21
|
-
oneMinute: number;
|
|
22
|
-
oneHour: number;
|
|
23
|
-
};
|
|
24
|
-
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
25
|
-
export declare const NATIVE_TOKEN_ADDRESS_0X_SWAP = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
26
|
-
export declare const ACCOUNT_ADDRESS = "0x345458cfD2F0c808455342CD0A6e07a09f893292";
|
|
27
|
-
export declare const WAAS_STATUS_URL = "https://waas.sequence.app/status";
|
|
28
|
-
export declare const DEFAULT_SLIPPAGE_BPS = 150;
|
|
29
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAiBtB,CAAA;AAED,eAAO,MAAM,IAAI;;;;CAIhB,CAAA;AAED,eAAO,MAAM,YAAY,+CAA+C,CAAA;AAGxE,eAAO,MAAM,4BAA4B,+CAA+C,CAAA;AAExF,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAE3E,eAAO,MAAM,eAAe,qCAAqC,CAAA;AAEjE,eAAO,MAAM,oBAAoB,MAAM,CAAA"}
|
package/dist/cjs/constants.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_SLIPPAGE_BPS = exports.WAAS_STATUS_URL = exports.ACCOUNT_ADDRESS = exports.NATIVE_TOKEN_ADDRESS_0X_SWAP = exports.ZERO_ADDRESS = exports.time = exports.QUERY_KEYS = void 0;
|
|
4
|
-
exports.QUERY_KEYS = {
|
|
5
|
-
useGetNativeTokenBalance: 'useGetNativeTokenBalance',
|
|
6
|
-
useGetTokenBalancesSummary: 'useGetTokenBalancesSummary',
|
|
7
|
-
useGetTokenBalancesDetails: 'useGetTokenBalancesDetails',
|
|
8
|
-
useGetTokenBalancesByContract: 'useGetTokenBalancesByContract',
|
|
9
|
-
useGetTokenMetadata: 'useGetTokenMetadata',
|
|
10
|
-
useGetTransactionHistory: 'useGetTransactionHistory',
|
|
11
|
-
useGetTransactionHistorySummary: 'useGetTransactionHistorySummary',
|
|
12
|
-
useGetContractInfo: 'useGetContractInfo',
|
|
13
|
-
useGetMultipleContractInfo: 'useGetMultipleContractInfo',
|
|
14
|
-
useGetSingleTokenBalance: 'useGetSingleTokenBalance',
|
|
15
|
-
useGetExchangeRate: 'useGetExchangeRate',
|
|
16
|
-
useGetCoinPrices: 'useGetCoinPrices',
|
|
17
|
-
useGetCollectiblePrices: 'useGetCollectiblePrices',
|
|
18
|
-
useGetSwapQuote: 'useGetSwapQuote',
|
|
19
|
-
useGetSwapRoutes: 'useGetSwapRoutes',
|
|
20
|
-
useDetectContractVersion: 'useDetectContractVersion'
|
|
21
|
-
};
|
|
22
|
-
exports.time = {
|
|
23
|
-
oneSecond: 1 * 1000,
|
|
24
|
-
oneMinute: 60 * 1000,
|
|
25
|
-
oneHour: 60 * 60 * 1000
|
|
26
|
-
};
|
|
27
|
-
exports.ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
28
|
-
// Address displayed for native tokens by the swap API
|
|
29
|
-
exports.NATIVE_TOKEN_ADDRESS_0X_SWAP = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
|
|
30
|
-
exports.ACCOUNT_ADDRESS = '0x345458cfD2F0c808455342CD0A6e07a09f893292';
|
|
31
|
-
exports.WAAS_STATUS_URL = 'https://waas.sequence.app/status';
|
|
32
|
-
exports.DEFAULT_SLIPPAGE_BPS = 150;
|
|
33
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,wBAAwB,EAAE,0BAA0B;IACpD,0BAA0B,EAAE,4BAA4B;IACxD,0BAA0B,EAAE,4BAA4B;IACxD,6BAA6B,EAAE,+BAA+B;IAC9D,mBAAmB,EAAE,qBAAqB;IAC1C,wBAAwB,EAAE,0BAA0B;IACpD,+BAA+B,EAAE,iCAAiC;IAClE,kBAAkB,EAAE,oBAAoB;IACxC,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EAAE,0BAA0B;IACpD,kBAAkB,EAAE,oBAAoB;IACxC,gBAAgB,EAAE,kBAAkB;IACpC,uBAAuB,EAAE,yBAAyB;IAClD,eAAe,EAAE,iBAAiB;IAClC,gBAAgB,EAAE,kBAAkB;IACpC,wBAAwB,EAAE,0BAA0B;CACrD,CAAA;AAEY,QAAA,IAAI,GAAG;IAClB,SAAS,EAAE,CAAC,GAAG,IAAI;IACnB,SAAS,EAAE,EAAE,GAAG,IAAI;IACpB,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;CACxB,CAAA;AAEY,QAAA,YAAY,GAAG,4CAA4C,CAAA;AAExE,sDAAsD;AACzC,QAAA,4BAA4B,GAAG,4CAA4C,CAAA;AAE3E,QAAA,eAAe,GAAG,4CAA4C,CAAA;AAE9D,QAAA,eAAe,GAAG,kCAAkC,CAAA;AAEpD,QAAA,oBAAoB,GAAG,GAAG,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export interface SequenceHooksEnv {
|
|
2
|
-
indexerGatewayUrl: string;
|
|
3
|
-
metadataUrl: string;
|
|
4
|
-
apiUrl: string;
|
|
5
|
-
indexerUrl: string;
|
|
6
|
-
imageProxyUrl: string;
|
|
7
|
-
builderUrl: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SequenceHooksConfigProviderValue {
|
|
10
|
-
projectAccessKey: string;
|
|
11
|
-
env?: Partial<SequenceHooksEnv>;
|
|
12
|
-
jwt?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface SequenceHooksConfig {
|
|
15
|
-
projectAccessKey: string;
|
|
16
|
-
env: Required<SequenceHooksEnv>;
|
|
17
|
-
jwt: string | undefined;
|
|
18
|
-
setJWT: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
19
|
-
}
|
|
20
|
-
export declare const SequenceHooksContext: import("react").Context<SequenceHooksConfig | null>;
|
|
21
|
-
interface SequenceHooksProviderProps {
|
|
22
|
-
children: React.ReactNode;
|
|
23
|
-
config: SequenceHooksConfigProviderValue;
|
|
24
|
-
}
|
|
25
|
-
export declare const SequenceHooksProvider: (props: SequenceHooksProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=ConfigContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ConfigContext.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gCAAgC;IAC/C,gBAAgB,EAAE,MAAM,CAAA;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,MAAM,CAAA;IACxB,GAAG,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IAC/B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;CACjE;AAWD,eAAO,MAAM,oBAAoB,qDAAkD,CAAA;AAEnF,UAAU,0BAA0B;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,EAAE,gCAAgC,CAAA;CACzC;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,4CActE,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.SequenceHooksProvider = exports.SequenceHooksContext = void 0;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const defaultEnv = {
|
|
8
|
-
indexerGatewayUrl: 'https://indexer.sequence.app',
|
|
9
|
-
metadataUrl: 'https://metadata.sequence.app',
|
|
10
|
-
apiUrl: 'https://api.sequence.app',
|
|
11
|
-
indexerUrl: 'https://indexer.sequence.app',
|
|
12
|
-
imageProxyUrl: 'https://imgproxy.sequence.xyz/',
|
|
13
|
-
builderUrl: 'https://api.sequence.build'
|
|
14
|
-
};
|
|
15
|
-
exports.SequenceHooksContext = (0, react_1.createContext)(null);
|
|
16
|
-
const SequenceHooksProvider = (props) => {
|
|
17
|
-
const [jwt, setJWT] = (0, react_1.useState)(props.config.jwt);
|
|
18
|
-
const config = {
|
|
19
|
-
...props.config,
|
|
20
|
-
env: {
|
|
21
|
-
...defaultEnv,
|
|
22
|
-
...props.config.env
|
|
23
|
-
},
|
|
24
|
-
jwt,
|
|
25
|
-
setJWT
|
|
26
|
-
};
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(exports.SequenceHooksContext.Provider, { value: config, children: props.children });
|
|
28
|
-
};
|
|
29
|
-
exports.SequenceHooksProvider = SequenceHooksProvider;
|
|
30
|
-
//# sourceMappingURL=ConfigContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigContext.js","sourceRoot":"","sources":["../../../src/contexts/ConfigContext.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;AAEZ,iCAA+C;AAwB/C,MAAM,UAAU,GAA+B;IAC7C,iBAAiB,EAAE,8BAA8B;IACjD,WAAW,EAAE,+BAA+B;IAC5C,MAAM,EAAE,0BAA0B;IAClC,UAAU,EAAE,8BAA8B;IAC1C,aAAa,EAAE,gCAAgC;IAC/C,UAAU,EAAE,4BAA4B;CACzC,CAAA;AAEY,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAA6B,IAAI,CAAC,CAAA;AAO5E,MAAM,qBAAqB,GAAG,CAAC,KAAiC,EAAE,EAAE;IACzE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAqB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAEpE,MAAM,MAAM,GAAwB;QAClC,GAAG,KAAK,CAAC,MAAM;QACf,GAAG,EAAE;YACH,GAAG,UAAU;YACb,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG;SACpB;QACD,GAAG;QACH,MAAM;KACP,CAAA;IAED,OAAO,uBAAC,4BAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,KAAK,CAAC,QAAQ,GAAiC,CAAA;AACvG,CAAC,CAAA;AAdY,QAAA,qBAAqB,yBAcjC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { SequenceAPIClient } from '@0xsequence/api';
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access the Sequence API client instance.
|
|
4
|
-
*
|
|
5
|
-
* This hook provides a memoized instance of the Sequence API client that can be used
|
|
6
|
-
* to interact with Sequence services. The client is configured with the project's
|
|
7
|
-
* access key and environment-specific API URL.
|
|
8
|
-
*
|
|
9
|
-
* The API client provides access to various Sequence services including:
|
|
10
|
-
* - Exchange rates and pricing
|
|
11
|
-
* - Token swaps and quotes
|
|
12
|
-
* - Wallet linking and management
|
|
13
|
-
* - Token metadata and balances
|
|
14
|
-
*
|
|
15
|
-
* The client instance is memoized based on the project access key, meaning a new
|
|
16
|
-
* instance is only created when the access key changes.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @returns {SequenceAPIClient} A configured instance of the Sequence API client
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* const apiClient = useAPIClient()
|
|
24
|
-
*
|
|
25
|
-
* // Get exchange rates
|
|
26
|
-
* const rate = await apiClient.getExchangeRate({ toCurrency: 'EUR' })
|
|
27
|
-
*
|
|
28
|
-
* // Get swap quote
|
|
29
|
-
* const quote = await apiClient.getSwapQuote({
|
|
30
|
-
* chainId: 1,
|
|
31
|
-
* userAddress: '0x...',
|
|
32
|
-
* sellCurrencyAddress: '0x...',
|
|
33
|
-
* buyCurrencyAddress: '0x...',
|
|
34
|
-
* sellAmount: '1000000000000000000'
|
|
35
|
-
* })
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare const useAPIClient: () => SequenceAPIClient;
|
|
39
|
-
//# sourceMappingURL=useAPIClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAPIClient.d.ts","sourceRoot":"","sources":["../../../../src/hooks/API/useAPIClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAKnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,YAAY,yBAQxB,CAAA"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAPIClient = void 0;
|
|
4
|
-
const api_1 = require("@0xsequence/api");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const useConfig_js_1 = require("../useConfig.js");
|
|
7
|
-
/**
|
|
8
|
-
* Hook to access the Sequence API client instance.
|
|
9
|
-
*
|
|
10
|
-
* This hook provides a memoized instance of the Sequence API client that can be used
|
|
11
|
-
* to interact with Sequence services. The client is configured with the project's
|
|
12
|
-
* access key and environment-specific API URL.
|
|
13
|
-
*
|
|
14
|
-
* The API client provides access to various Sequence services including:
|
|
15
|
-
* - Exchange rates and pricing
|
|
16
|
-
* - Token swaps and quotes
|
|
17
|
-
* - Wallet linking and management
|
|
18
|
-
* - Token metadata and balances
|
|
19
|
-
*
|
|
20
|
-
* The client instance is memoized based on the project access key, meaning a new
|
|
21
|
-
* instance is only created when the access key changes.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @returns {SequenceAPIClient} A configured instance of the Sequence API client
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* const apiClient = useAPIClient()
|
|
29
|
-
*
|
|
30
|
-
* // Get exchange rates
|
|
31
|
-
* const rate = await apiClient.getExchangeRate({ toCurrency: 'EUR' })
|
|
32
|
-
*
|
|
33
|
-
* // Get swap quote
|
|
34
|
-
* const quote = await apiClient.getSwapQuote({
|
|
35
|
-
* chainId: 1,
|
|
36
|
-
* userAddress: '0x...',
|
|
37
|
-
* sellCurrencyAddress: '0x...',
|
|
38
|
-
* buyCurrencyAddress: '0x...',
|
|
39
|
-
* sellAmount: '1000000000000000000'
|
|
40
|
-
* })
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
const useAPIClient = () => {
|
|
44
|
-
const { projectAccessKey, jwt, env } = (0, useConfig_js_1.useConfig)();
|
|
45
|
-
const apiClient = (0, react_1.useMemo)(() => {
|
|
46
|
-
return new api_1.SequenceAPIClient(env.apiUrl, projectAccessKey, jwt);
|
|
47
|
-
}, [projectAccessKey, jwt]);
|
|
48
|
-
return apiClient;
|
|
49
|
-
};
|
|
50
|
-
exports.useAPIClient = useAPIClient;
|
|
51
|
-
//# sourceMappingURL=useAPIClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAPIClient.js","sourceRoot":"","sources":["../../../../src/hooks/API/useAPIClient.ts"],"names":[],"mappings":";;;AAAA,yCAAmD;AACnD,iCAA+B;AAE/B,kDAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACI,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,wBAAS,GAAE,CAAA;IAElD,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC7B,OAAO,IAAI,uBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,CAAA;IAE3B,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AARY,QAAA,YAAY,gBAQxB"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type Token } from '@0xsequence/api';
|
|
2
|
-
import type { HooksOptions } from '../../types/hooks.js';
|
|
3
|
-
/**
|
|
4
|
-
* Hook to fetch current prices for a list of tokens.
|
|
5
|
-
*
|
|
6
|
-
* This hook uses React Query to fetch and cache token prices from the Sequence API.
|
|
7
|
-
* Prices are automatically refreshed every minute to ensure they stay current.
|
|
8
|
-
*
|
|
9
|
-
* @see {@link https://docs.sequence.xyz/sdk/web/hooks-sdk/hooks/useGetCoinPrices} for more detailed documentation.
|
|
10
|
-
*
|
|
11
|
-
* @param tokens - Array of tokens to get prices for. Each token must include:
|
|
12
|
-
* - chainId: The chain ID where the token exists
|
|
13
|
-
* - contractAddress: The token's contract address (use ZERO_ADDRESS for native tokens)
|
|
14
|
-
*
|
|
15
|
-
* @param options - Optional configuration options:
|
|
16
|
-
* - retry: Whether to retry failed requests (defaults to false)
|
|
17
|
-
* - disabled: Whether to disable the query
|
|
18
|
-
*
|
|
19
|
-
* @returns React Query result object containing:
|
|
20
|
-
* - data: Array of token prices when available
|
|
21
|
-
* - isLoading: Whether the initial request is in progress
|
|
22
|
-
* - error: Any error that occurred
|
|
23
|
-
* - isError: Whether an error occurred
|
|
24
|
-
* - isSuccess: Whether the request was successful
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* const { data: prices, isLoading, error } = useGetCoinPrices([
|
|
29
|
-
* {
|
|
30
|
-
* chainId: 1,
|
|
31
|
-
* contractAddress: ZERO_ADDRESS // ETH
|
|
32
|
-
* },
|
|
33
|
-
* {
|
|
34
|
-
* chainId: 137,
|
|
35
|
-
* contractAddress: '0x...' // USDC on Polygon
|
|
36
|
-
* }
|
|
37
|
-
* ])
|
|
38
|
-
*
|
|
39
|
-
* if (isLoading) {
|
|
40
|
-
* return <div>Loading prices...</div>
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
|
-
* if (prices) {
|
|
44
|
-
* console.log('ETH price:', prices[0].price.value)
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare const useGetCoinPrices: (tokens: Token[], options?: HooksOptions) => import("@tanstack/react-query").UseQueryResult<import("@0xsequence/api").TokenPrice[], Error>;
|
|
49
|
-
//# sourceMappingURL=useGetCoinPrices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetCoinPrices.d.ts","sourceRoot":"","sources":["../../../../src/hooks/API/useGetCoinPrices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAI/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAsBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,KAAK,EAAE,EAAE,UAAU,YAAY,kGAUvE,CAAA"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGetCoinPrices = void 0;
|
|
4
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const constants_js_1 = require("../../constants.js");
|
|
6
|
-
const useAPIClient_js_1 = require("./useAPIClient.js");
|
|
7
|
-
/**
|
|
8
|
-
* Helper function to fetch coin prices from the Sequence API.
|
|
9
|
-
*
|
|
10
|
-
* @param apiClient - The Sequence API client instance
|
|
11
|
-
* @param tokens - Array of tokens to get prices for, each containing chainId and contractAddress
|
|
12
|
-
* @returns Array of token prices, or empty array if no tokens provided
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
const getCoinPrices = async (apiClient, tokens) => {
|
|
16
|
-
if (tokens.length === 0) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
const res = await apiClient.getCoinPrices({ tokens });
|
|
20
|
-
return res?.tokenPrices || [];
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Hook to fetch current prices for a list of tokens.
|
|
24
|
-
*
|
|
25
|
-
* This hook uses React Query to fetch and cache token prices from the Sequence API.
|
|
26
|
-
* Prices are automatically refreshed every minute to ensure they stay current.
|
|
27
|
-
*
|
|
28
|
-
* @see {@link https://docs.sequence.xyz/sdk/web/hooks-sdk/hooks/useGetCoinPrices} for more detailed documentation.
|
|
29
|
-
*
|
|
30
|
-
* @param tokens - Array of tokens to get prices for. Each token must include:
|
|
31
|
-
* - chainId: The chain ID where the token exists
|
|
32
|
-
* - contractAddress: The token's contract address (use ZERO_ADDRESS for native tokens)
|
|
33
|
-
*
|
|
34
|
-
* @param options - Optional configuration options:
|
|
35
|
-
* - retry: Whether to retry failed requests (defaults to false)
|
|
36
|
-
* - disabled: Whether to disable the query
|
|
37
|
-
*
|
|
38
|
-
* @returns React Query result object containing:
|
|
39
|
-
* - data: Array of token prices when available
|
|
40
|
-
* - isLoading: Whether the initial request is in progress
|
|
41
|
-
* - error: Any error that occurred
|
|
42
|
-
* - isError: Whether an error occurred
|
|
43
|
-
* - isSuccess: Whether the request was successful
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* const { data: prices, isLoading, error } = useGetCoinPrices([
|
|
48
|
-
* {
|
|
49
|
-
* chainId: 1,
|
|
50
|
-
* contractAddress: ZERO_ADDRESS // ETH
|
|
51
|
-
* },
|
|
52
|
-
* {
|
|
53
|
-
* chainId: 137,
|
|
54
|
-
* contractAddress: '0x...' // USDC on Polygon
|
|
55
|
-
* }
|
|
56
|
-
* ])
|
|
57
|
-
*
|
|
58
|
-
* if (isLoading) {
|
|
59
|
-
* return <div>Loading prices...</div>
|
|
60
|
-
* }
|
|
61
|
-
*
|
|
62
|
-
* if (prices) {
|
|
63
|
-
* console.log('ETH price:', prices[0].price.value)
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
const useGetCoinPrices = (tokens, options) => {
|
|
68
|
-
const apiClient = (0, useAPIClient_js_1.useAPIClient)();
|
|
69
|
-
return (0, react_query_1.useQuery)({
|
|
70
|
-
queryKey: [constants_js_1.QUERY_KEYS.useGetCoinPrices, tokens, options],
|
|
71
|
-
queryFn: () => getCoinPrices(apiClient, tokens),
|
|
72
|
-
retry: options?.retry ?? false,
|
|
73
|
-
staleTime: constants_js_1.time.oneMinute,
|
|
74
|
-
enabled: tokens.length > 0 && !options?.disabled
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
exports.useGetCoinPrices = useGetCoinPrices;
|
|
78
|
-
//# sourceMappingURL=useGetCoinPrices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetCoinPrices.js","sourceRoot":"","sources":["../../../../src/hooks/API/useGetCoinPrices.ts"],"names":[],"mappings":";;;AACA,uDAAgD;AAEhD,qDAAqD;AAGrD,uDAAgD;AAEhD;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,SAA4B,EAAE,MAAe,EAAE,EAAE;IAC5E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAErD,OAAO,GAAG,EAAE,WAAW,IAAI,EAAE,CAAA;AAC/B,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACI,MAAM,gBAAgB,GAAG,CAAC,MAAe,EAAE,OAAsB,EAAE,EAAE;IAC1E,MAAM,SAAS,GAAG,IAAA,8BAAY,GAAE,CAAA;IAEhC,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,yBAAU,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC;QACxD,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC;QAC/C,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK;QAC9B,SAAS,EAAE,mBAAI,CAAC,SAAS;QACzB,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ;KACjD,CAAC,CAAA;AACJ,CAAC,CAAA;AAVY,QAAA,gBAAgB,oBAU5B"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { type Token } from '@0xsequence/api';
|
|
2
|
-
import type { HooksOptions } from '../../types/hooks.js';
|
|
3
|
-
/**
|
|
4
|
-
* Hook to fetch current market prices for NFTs/collectibles.
|
|
5
|
-
*
|
|
6
|
-
* This hook uses React Query to fetch and cache collectible prices from the Sequence API.
|
|
7
|
-
* Prices are automatically refreshed every minute to ensure they stay current.
|
|
8
|
-
* Used in various UI components to display NFT valuations, particularly in collection views
|
|
9
|
-
* and transaction details.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link https://docs.sequence.xyz/sdk/web/hooks-sdk/hooks/useGetCollectiblePrices} for more detailed documentation.
|
|
12
|
-
*
|
|
13
|
-
* @param tokens - Array of tokens to get prices for. Each token must include:
|
|
14
|
-
* - chainId: The chain ID where the NFT exists
|
|
15
|
-
* - contractAddress: The NFT collection's contract address
|
|
16
|
-
* - tokenId: The specific token ID within the collection
|
|
17
|
-
*
|
|
18
|
-
* @param options - Optional configuration options:
|
|
19
|
-
* - retry: Whether to retry failed requests (defaults to false)
|
|
20
|
-
* - disabled: Whether to disable the query
|
|
21
|
-
*
|
|
22
|
-
* @returns React Query result object containing:
|
|
23
|
-
* - data: Array of token prices when available, each containing:
|
|
24
|
-
* - price: The price for the collection
|
|
25
|
-
* - price24hChange: The price change for the collection in the last 24 hours (if available)
|
|
26
|
-
* - floorPrice: The floor price for the collection (if available)
|
|
27
|
-
* - buyPrice: Current market buy price (if available)
|
|
28
|
-
* - sellPrice: Current market sell price (if available)
|
|
29
|
-
* - isLoading: Whether the initial request is in progress
|
|
30
|
-
* - error: Any error that occurred
|
|
31
|
-
* - isError: Whether an error occurred
|
|
32
|
-
* - isSuccess: Whether the request was successful
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```tsx
|
|
36
|
-
* const { data: prices, isLoading } = useGetCollectiblePrices([
|
|
37
|
-
* {
|
|
38
|
-
* chainId: 1,
|
|
39
|
-
* contractAddress: '0x...', // NFT collection address
|
|
40
|
-
* tokenId: '123' // Specific NFT ID
|
|
41
|
-
* }
|
|
42
|
-
* ])
|
|
43
|
-
*
|
|
44
|
-
* if (isLoading) {
|
|
45
|
-
* return <div>Loading prices...</div>
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
* if (prices?.[0]) {
|
|
49
|
-
* console.log('Price:', prices[0].price.value)
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare const useGetCollectiblePrices: (tokens: Token[], options?: HooksOptions) => import("@tanstack/react-query").UseQueryResult<import("@0xsequence/api").TokenPrice[], Error>;
|
|
54
|
-
//# sourceMappingURL=useGetCollectiblePrices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetCollectiblePrices.d.ts","sourceRoot":"","sources":["../../../../src/hooks/API/useGetCollectiblePrices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAI/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAsBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,KAAK,EAAE,EAAE,UAAU,YAAY,kGAU9E,CAAA"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGetCollectiblePrices = void 0;
|
|
4
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const constants_js_1 = require("../../constants.js");
|
|
6
|
-
const useAPIClient_js_1 = require("./useAPIClient.js");
|
|
7
|
-
/**
|
|
8
|
-
* Helper function to fetch collectible prices from the Sequence API.
|
|
9
|
-
*
|
|
10
|
-
* @param apiClient - The Sequence API client instance
|
|
11
|
-
* @param tokens - Array of tokens to get prices for. Each token should include chainId, contractAddress, and tokenId
|
|
12
|
-
* @returns Array of token prices with floor, buy, and sell prices, or empty array if no tokens provided
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
const getCollectiblePrices = async (apiClient, tokens) => {
|
|
16
|
-
if (tokens.length === 0) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
const res = await apiClient.getCollectiblePrices({ tokens });
|
|
20
|
-
return res?.tokenPrices || [];
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Hook to fetch current market prices for NFTs/collectibles.
|
|
24
|
-
*
|
|
25
|
-
* This hook uses React Query to fetch and cache collectible prices from the Sequence API.
|
|
26
|
-
* Prices are automatically refreshed every minute to ensure they stay current.
|
|
27
|
-
* Used in various UI components to display NFT valuations, particularly in collection views
|
|
28
|
-
* and transaction details.
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://docs.sequence.xyz/sdk/web/hooks-sdk/hooks/useGetCollectiblePrices} for more detailed documentation.
|
|
31
|
-
*
|
|
32
|
-
* @param tokens - Array of tokens to get prices for. Each token must include:
|
|
33
|
-
* - chainId: The chain ID where the NFT exists
|
|
34
|
-
* - contractAddress: The NFT collection's contract address
|
|
35
|
-
* - tokenId: The specific token ID within the collection
|
|
36
|
-
*
|
|
37
|
-
* @param options - Optional configuration options:
|
|
38
|
-
* - retry: Whether to retry failed requests (defaults to false)
|
|
39
|
-
* - disabled: Whether to disable the query
|
|
40
|
-
*
|
|
41
|
-
* @returns React Query result object containing:
|
|
42
|
-
* - data: Array of token prices when available, each containing:
|
|
43
|
-
* - price: The price for the collection
|
|
44
|
-
* - price24hChange: The price change for the collection in the last 24 hours (if available)
|
|
45
|
-
* - floorPrice: The floor price for the collection (if available)
|
|
46
|
-
* - buyPrice: Current market buy price (if available)
|
|
47
|
-
* - sellPrice: Current market sell price (if available)
|
|
48
|
-
* - isLoading: Whether the initial request is in progress
|
|
49
|
-
* - error: Any error that occurred
|
|
50
|
-
* - isError: Whether an error occurred
|
|
51
|
-
* - isSuccess: Whether the request was successful
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```tsx
|
|
55
|
-
* const { data: prices, isLoading } = useGetCollectiblePrices([
|
|
56
|
-
* {
|
|
57
|
-
* chainId: 1,
|
|
58
|
-
* contractAddress: '0x...', // NFT collection address
|
|
59
|
-
* tokenId: '123' // Specific NFT ID
|
|
60
|
-
* }
|
|
61
|
-
* ])
|
|
62
|
-
*
|
|
63
|
-
* if (isLoading) {
|
|
64
|
-
* return <div>Loading prices...</div>
|
|
65
|
-
* }
|
|
66
|
-
*
|
|
67
|
-
* if (prices?.[0]) {
|
|
68
|
-
* console.log('Price:', prices[0].price.value)
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
const useGetCollectiblePrices = (tokens, options) => {
|
|
73
|
-
const apiClient = (0, useAPIClient_js_1.useAPIClient)();
|
|
74
|
-
return (0, react_query_1.useQuery)({
|
|
75
|
-
queryKey: [constants_js_1.QUERY_KEYS.useGetCollectiblePrices, tokens, options],
|
|
76
|
-
queryFn: () => getCollectiblePrices(apiClient, tokens),
|
|
77
|
-
retry: options?.retry ?? false,
|
|
78
|
-
staleTime: constants_js_1.time.oneMinute,
|
|
79
|
-
enabled: tokens.length > 0 && !options?.disabled
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
exports.useGetCollectiblePrices = useGetCollectiblePrices;
|
|
83
|
-
//# sourceMappingURL=useGetCollectiblePrices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetCollectiblePrices.js","sourceRoot":"","sources":["../../../../src/hooks/API/useGetCollectiblePrices.ts"],"names":[],"mappings":";;;AACA,uDAAgD;AAEhD,qDAAqD;AAGrD,uDAAgD;AAEhD;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAG,KAAK,EAAE,SAA4B,EAAE,MAAe,EAAE,EAAE;IACnF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAE5D,OAAO,GAAG,EAAE,WAAW,IAAI,EAAE,CAAA;AAC/B,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACI,MAAM,uBAAuB,GAAG,CAAC,MAAe,EAAE,OAAsB,EAAE,EAAE;IACjF,MAAM,SAAS,GAAG,IAAA,8BAAY,GAAE,CAAA;IAEhC,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,yBAAU,CAAC,uBAAuB,EAAE,MAAM,EAAE,OAAO,CAAC;QAC/D,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC;QACtD,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK;QAC9B,SAAS,EAAE,mBAAI,CAAC,SAAS;QACzB,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ;KACjD,CAAC,CAAA;AACJ,CAAC,CAAA;AAVY,QAAA,uBAAuB,2BAUnC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { HooksOptions } from '../../types/hooks.js';
|
|
2
|
-
/**
|
|
3
|
-
* Hook to fetch current exchange rates from USD to other currencies.
|
|
4
|
-
*
|
|
5
|
-
* This hook uses React Query to fetch and cache exchange rates from the Sequence API.
|
|
6
|
-
* Rates are automatically refreshed every 10 minutes to ensure they stay current.
|
|
7
|
-
* Used throughout the wallet widget and checkout components to display fiat values
|
|
8
|
-
* for tokens and NFTs.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link https://docs.sequence.xyz/sdk/web/hooks-sdk/hooks/useGetExchangeRate} for more detailed documentation.
|
|
11
|
-
*
|
|
12
|
-
* @param toCurrency - The target currency code (e.g., 'EUR', 'GBP', 'JPY').
|
|
13
|
-
* If 'USD' is provided, returns 1 as the conversion rate.
|
|
14
|
-
*
|
|
15
|
-
* @param options - Optional configuration options:
|
|
16
|
-
* - retry: Whether to retry failed requests (defaults to false)
|
|
17
|
-
* - disabled: Whether to disable the query
|
|
18
|
-
*
|
|
19
|
-
* @returns React Query result object containing:
|
|
20
|
-
* - data: The exchange rate value from USD to the target currency
|
|
21
|
-
* - isLoading: Whether the initial request is in progress
|
|
22
|
-
* - error: Any error that occurred
|
|
23
|
-
* - isError: Whether an error occurred
|
|
24
|
-
* - isSuccess: Whether the request was successful
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* const { data: rate = 1, isLoading } = useGetExchangeRate('EUR')
|
|
29
|
-
*
|
|
30
|
-
* // Convert USD amount to EUR
|
|
31
|
-
* const usdAmount = 100
|
|
32
|
-
* const eurAmount = usdAmount * rate
|
|
33
|
-
*
|
|
34
|
-
* if (isLoading) {
|
|
35
|
-
* return <div>Loading rates...</div>
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* console.log(`${usdAmount} USD = ${eurAmount} EUR`)
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare const useGetExchangeRate: (toCurrency: string, options?: HooksOptions) => import("@tanstack/react-query").UseQueryResult<number, Error>;
|
|
42
|
-
//# sourceMappingURL=useGetExchangeRate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetExchangeRate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/API/useGetExchangeRate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAIxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM,EAAE,UAAU,YAAY,kEAkB5E,CAAA"}
|