@b3dotfun/sdk 0.0.5 → 0.0.6-alpha.2
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/dist/cjs/anyspend/constants/index.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/index.d.ts +7 -5
- package/dist/cjs/anyspend/react/components/index.js +15 -11
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +37 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +173 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +10 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +10 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +7 -1
- package/dist/cjs/anyspend/services/anyspend.js +3 -2
- package/dist/cjs/anyspend/types/order.d.ts +18 -0
- package/dist/cjs/anyspend/types/order.js +1 -0
- package/dist/cjs/anyspend/types/req-res/createOrder.d.ts +50 -0
- package/dist/cjs/anyspend/types/req-res/createOrder.js +1 -0
- package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.d.ts +35 -0
- package/dist/cjs/anyspend/types/req-res/getOrderHistory.d.ts +25 -0
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useB3EnsName.d.ts +9 -0
- package/dist/cjs/global-account/react/hooks/useB3EnsName.js +39 -0
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.d.ts +5 -1
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +74 -13
- package/dist/cjs/shared/constants/chains/supported.d.ts +13 -3
- package/dist/cjs/shared/constants/chains/supported.js +15 -9
- package/dist/cjs/shared/generated/coingecko-chains.json +1072 -0
- package/dist/esm/anyspend/constants/index.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +7 -5
- package/dist/esm/anyspend/react/components/index.js +7 -5
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +31 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +12 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +167 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +10 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +10 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +7 -1
- package/dist/esm/anyspend/services/anyspend.js +3 -2
- package/dist/esm/anyspend/types/order.d.ts +18 -0
- package/dist/esm/anyspend/types/order.js +1 -0
- package/dist/esm/anyspend/types/req-res/createOrder.d.ts +50 -0
- package/dist/esm/anyspend/types/req-res/createOrder.js +1 -0
- package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.d.ts +35 -0
- package/dist/esm/anyspend/types/req-res/getOrderHistory.d.ts +25 -0
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useB3EnsName.d.ts +9 -0
- package/dist/esm/global-account/react/hooks/useB3EnsName.js +32 -0
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.d.ts +5 -1
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +73 -13
- package/dist/esm/shared/constants/chains/supported.d.ts +13 -3
- package/dist/esm/shared/constants/chains/supported.js +13 -8
- package/dist/esm/shared/generated/coingecko-chains.json +1072 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/index.d.ts +7 -5
- package/dist/types/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +12 -0
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +10 -0
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +10 -0
- package/dist/types/anyspend/services/anyspend.d.ts +7 -1
- package/dist/types/anyspend/types/order.d.ts +18 -0
- package/dist/types/anyspend/types/req-res/createOrder.d.ts +50 -0
- package/dist/types/anyspend/types/req-res/getOrderAndTransactions.d.ts +35 -0
- package/dist/types/anyspend/types/req-res/getOrderHistory.d.ts +25 -0
- package/dist/types/global-account/react/hooks/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useB3EnsName.d.ts +9 -0
- package/dist/types/global-account/react/hooks/useTokenFromUrl.d.ts +5 -1
- package/dist/types/shared/constants/chains/supported.d.ts +13 -3
- package/package.json +6 -3
- package/src/anyspend/README.md +626 -0
- package/src/anyspend/constants/index.ts +2 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -2
- package/src/anyspend/react/components/index.ts +7 -5
- package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +120 -0
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +369 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +7 -4
- package/src/anyspend/services/anyspend.ts +5 -2
- package/src/anyspend/types/order.ts +1 -0
- package/src/anyspend/types/req-res/createOrder.ts +1 -0
- package/src/global-account/react/hooks/index.ts +2 -1
- package/src/global-account/react/hooks/useB3EnsName.ts +49 -0
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +95 -13
- package/src/shared/constants/chains/supported.ts +23 -8
- package/src/shared/generated/coingecko-chains.json +1072 -0
- /package/dist/cjs/{generated → shared/generated}/chain-networks.json +0 -0
- /package/dist/esm/{generated → shared/generated}/chain-networks.json +0 -0
- /package/src/{generated → shared/generated}/chain-networks.json +0 -0
|
@@ -53,6 +53,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
53
53
|
ipAddress?: string | undefined;
|
|
54
54
|
}>>;
|
|
55
55
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
56
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
56
57
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
57
58
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
58
59
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -238,6 +239,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
238
239
|
ipAddress?: string | undefined;
|
|
239
240
|
} | null;
|
|
240
241
|
creatorAddress: string | null;
|
|
242
|
+
partnerId: string | null;
|
|
241
243
|
oneClickBuyUrl: string | null;
|
|
242
244
|
stripePaymentIntentId: string | null;
|
|
243
245
|
permit: {
|
|
@@ -295,6 +297,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
295
297
|
ipAddress?: string | undefined;
|
|
296
298
|
} | null;
|
|
297
299
|
creatorAddress: string | null;
|
|
300
|
+
partnerId: string | null;
|
|
298
301
|
oneClickBuyUrl: string | null;
|
|
299
302
|
stripePaymentIntentId: string | null;
|
|
300
303
|
permit: {
|
|
@@ -341,6 +344,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
341
344
|
ipAddress?: string | undefined;
|
|
342
345
|
}>>;
|
|
343
346
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
347
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
344
348
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
345
349
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
346
350
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -610,6 +614,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
610
614
|
ipAddress?: string | undefined;
|
|
611
615
|
} | null;
|
|
612
616
|
creatorAddress: string | null;
|
|
617
|
+
partnerId: string | null;
|
|
613
618
|
oneClickBuyUrl: string | null;
|
|
614
619
|
stripePaymentIntentId: string | null;
|
|
615
620
|
permit: {
|
|
@@ -681,6 +686,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
681
686
|
ipAddress?: string | undefined;
|
|
682
687
|
} | null;
|
|
683
688
|
creatorAddress: string | null;
|
|
689
|
+
partnerId: string | null;
|
|
684
690
|
oneClickBuyUrl: string | null;
|
|
685
691
|
stripePaymentIntentId: string | null;
|
|
686
692
|
permit: {
|
|
@@ -727,6 +733,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
727
733
|
ipAddress?: string | undefined;
|
|
728
734
|
}>>;
|
|
729
735
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
736
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
730
737
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
731
738
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
732
739
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -946,6 +953,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
946
953
|
ipAddress?: string | undefined;
|
|
947
954
|
} | null;
|
|
948
955
|
creatorAddress: string | null;
|
|
956
|
+
partnerId: string | null;
|
|
949
957
|
oneClickBuyUrl: string | null;
|
|
950
958
|
stripePaymentIntentId: string | null;
|
|
951
959
|
permit: {
|
|
@@ -1009,6 +1017,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1009
1017
|
ipAddress?: string | undefined;
|
|
1010
1018
|
} | null;
|
|
1011
1019
|
creatorAddress: string | null;
|
|
1020
|
+
partnerId: string | null;
|
|
1012
1021
|
oneClickBuyUrl: string | null;
|
|
1013
1022
|
stripePaymentIntentId: string | null;
|
|
1014
1023
|
permit: {
|
|
@@ -1055,6 +1064,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1055
1064
|
ipAddress?: string | undefined;
|
|
1056
1065
|
}>>;
|
|
1057
1066
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
1067
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
1058
1068
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
1059
1069
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
1060
1070
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -1274,6 +1284,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1274
1284
|
ipAddress?: string | undefined;
|
|
1275
1285
|
} | null;
|
|
1276
1286
|
creatorAddress: string | null;
|
|
1287
|
+
partnerId: string | null;
|
|
1277
1288
|
oneClickBuyUrl: string | null;
|
|
1278
1289
|
stripePaymentIntentId: string | null;
|
|
1279
1290
|
permit: {
|
|
@@ -1337,6 +1348,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1337
1348
|
ipAddress?: string | undefined;
|
|
1338
1349
|
} | null;
|
|
1339
1350
|
creatorAddress: string | null;
|
|
1351
|
+
partnerId: string | null;
|
|
1340
1352
|
oneClickBuyUrl: string | null;
|
|
1341
1353
|
stripePaymentIntentId: string | null;
|
|
1342
1354
|
permit: {
|
|
@@ -1383,6 +1395,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1383
1395
|
ipAddress?: string | undefined;
|
|
1384
1396
|
}>>;
|
|
1385
1397
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
1398
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
1386
1399
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
1387
1400
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
1388
1401
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -1578,6 +1591,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1578
1591
|
ipAddress?: string | undefined;
|
|
1579
1592
|
} | null;
|
|
1580
1593
|
creatorAddress: string | null;
|
|
1594
|
+
partnerId: string | null;
|
|
1581
1595
|
oneClickBuyUrl: string | null;
|
|
1582
1596
|
stripePaymentIntentId: string | null;
|
|
1583
1597
|
permit: {
|
|
@@ -1638,6 +1652,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1638
1652
|
ipAddress?: string | undefined;
|
|
1639
1653
|
} | null;
|
|
1640
1654
|
creatorAddress: string | null;
|
|
1655
|
+
partnerId: string | null;
|
|
1641
1656
|
oneClickBuyUrl: string | null;
|
|
1642
1657
|
stripePaymentIntentId: string | null;
|
|
1643
1658
|
permit: {
|
|
@@ -1778,6 +1793,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1778
1793
|
ipAddress?: string | undefined;
|
|
1779
1794
|
} | null;
|
|
1780
1795
|
creatorAddress: string | null;
|
|
1796
|
+
partnerId: string | null;
|
|
1781
1797
|
oneClickBuyUrl: string | null;
|
|
1782
1798
|
stripePaymentIntentId: string | null;
|
|
1783
1799
|
permit: {
|
|
@@ -1849,6 +1865,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1849
1865
|
ipAddress?: string | undefined;
|
|
1850
1866
|
} | null;
|
|
1851
1867
|
creatorAddress: string | null;
|
|
1868
|
+
partnerId: string | null;
|
|
1852
1869
|
oneClickBuyUrl: string | null;
|
|
1853
1870
|
stripePaymentIntentId: string | null;
|
|
1854
1871
|
permit: {
|
|
@@ -1912,6 +1929,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1912
1929
|
ipAddress?: string | undefined;
|
|
1913
1930
|
} | null;
|
|
1914
1931
|
creatorAddress: string | null;
|
|
1932
|
+
partnerId: string | null;
|
|
1915
1933
|
oneClickBuyUrl: string | null;
|
|
1916
1934
|
stripePaymentIntentId: string | null;
|
|
1917
1935
|
permit: {
|
|
@@ -1975,6 +1993,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
1975
1993
|
ipAddress?: string | undefined;
|
|
1976
1994
|
} | null;
|
|
1977
1995
|
creatorAddress: string | null;
|
|
1996
|
+
partnerId: string | null;
|
|
1978
1997
|
oneClickBuyUrl: string | null;
|
|
1979
1998
|
stripePaymentIntentId: string | null;
|
|
1980
1999
|
permit: {
|
|
@@ -2033,6 +2052,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2033
2052
|
ipAddress?: string | undefined;
|
|
2034
2053
|
} | null;
|
|
2035
2054
|
creatorAddress: string | null;
|
|
2055
|
+
partnerId: string | null;
|
|
2036
2056
|
oneClickBuyUrl: string | null;
|
|
2037
2057
|
stripePaymentIntentId: string | null;
|
|
2038
2058
|
permit: {
|
|
@@ -2123,6 +2143,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2123
2143
|
ipAddress?: string | undefined;
|
|
2124
2144
|
} | null;
|
|
2125
2145
|
creatorAddress: string | null;
|
|
2146
|
+
partnerId: string | null;
|
|
2126
2147
|
oneClickBuyUrl: string | null;
|
|
2127
2148
|
stripePaymentIntentId: string | null;
|
|
2128
2149
|
permit: {
|
|
@@ -2194,6 +2215,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2194
2215
|
ipAddress?: string | undefined;
|
|
2195
2216
|
} | null;
|
|
2196
2217
|
creatorAddress: string | null;
|
|
2218
|
+
partnerId: string | null;
|
|
2197
2219
|
oneClickBuyUrl: string | null;
|
|
2198
2220
|
stripePaymentIntentId: string | null;
|
|
2199
2221
|
permit: {
|
|
@@ -2257,6 +2279,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2257
2279
|
ipAddress?: string | undefined;
|
|
2258
2280
|
} | null;
|
|
2259
2281
|
creatorAddress: string | null;
|
|
2282
|
+
partnerId: string | null;
|
|
2260
2283
|
oneClickBuyUrl: string | null;
|
|
2261
2284
|
stripePaymentIntentId: string | null;
|
|
2262
2285
|
permit: {
|
|
@@ -2320,6 +2343,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2320
2343
|
ipAddress?: string | undefined;
|
|
2321
2344
|
} | null;
|
|
2322
2345
|
creatorAddress: string | null;
|
|
2346
|
+
partnerId: string | null;
|
|
2323
2347
|
oneClickBuyUrl: string | null;
|
|
2324
2348
|
stripePaymentIntentId: string | null;
|
|
2325
2349
|
permit: {
|
|
@@ -2378,6 +2402,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2378
2402
|
ipAddress?: string | undefined;
|
|
2379
2403
|
} | null;
|
|
2380
2404
|
creatorAddress: string | null;
|
|
2405
|
+
partnerId: string | null;
|
|
2381
2406
|
oneClickBuyUrl: string | null;
|
|
2382
2407
|
stripePaymentIntentId: string | null;
|
|
2383
2408
|
permit: {
|
|
@@ -2472,6 +2497,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2472
2497
|
ipAddress?: string | undefined;
|
|
2473
2498
|
} | null;
|
|
2474
2499
|
creatorAddress: string | null;
|
|
2500
|
+
partnerId: string | null;
|
|
2475
2501
|
oneClickBuyUrl: string | null;
|
|
2476
2502
|
stripePaymentIntentId: string | null;
|
|
2477
2503
|
permit: {
|
|
@@ -2543,6 +2569,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2543
2569
|
ipAddress?: string | undefined;
|
|
2544
2570
|
} | null;
|
|
2545
2571
|
creatorAddress: string | null;
|
|
2572
|
+
partnerId: string | null;
|
|
2546
2573
|
oneClickBuyUrl: string | null;
|
|
2547
2574
|
stripePaymentIntentId: string | null;
|
|
2548
2575
|
permit: {
|
|
@@ -2606,6 +2633,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2606
2633
|
ipAddress?: string | undefined;
|
|
2607
2634
|
} | null;
|
|
2608
2635
|
creatorAddress: string | null;
|
|
2636
|
+
partnerId: string | null;
|
|
2609
2637
|
oneClickBuyUrl: string | null;
|
|
2610
2638
|
stripePaymentIntentId: string | null;
|
|
2611
2639
|
permit: {
|
|
@@ -2669,6 +2697,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2669
2697
|
ipAddress?: string | undefined;
|
|
2670
2698
|
} | null;
|
|
2671
2699
|
creatorAddress: string | null;
|
|
2700
|
+
partnerId: string | null;
|
|
2672
2701
|
oneClickBuyUrl: string | null;
|
|
2673
2702
|
stripePaymentIntentId: string | null;
|
|
2674
2703
|
permit: {
|
|
@@ -2727,6 +2756,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2727
2756
|
ipAddress?: string | undefined;
|
|
2728
2757
|
} | null;
|
|
2729
2758
|
creatorAddress: string | null;
|
|
2759
|
+
partnerId: string | null;
|
|
2730
2760
|
oneClickBuyUrl: string | null;
|
|
2731
2761
|
stripePaymentIntentId: string | null;
|
|
2732
2762
|
permit: {
|
|
@@ -2822,6 +2852,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2822
2852
|
ipAddress?: string | undefined;
|
|
2823
2853
|
} | null;
|
|
2824
2854
|
creatorAddress: string | null;
|
|
2855
|
+
partnerId: string | null;
|
|
2825
2856
|
oneClickBuyUrl: string | null;
|
|
2826
2857
|
stripePaymentIntentId: string | null;
|
|
2827
2858
|
permit: {
|
|
@@ -2893,6 +2924,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2893
2924
|
ipAddress?: string | undefined;
|
|
2894
2925
|
} | null;
|
|
2895
2926
|
creatorAddress: string | null;
|
|
2927
|
+
partnerId: string | null;
|
|
2896
2928
|
oneClickBuyUrl: string | null;
|
|
2897
2929
|
stripePaymentIntentId: string | null;
|
|
2898
2930
|
permit: {
|
|
@@ -2956,6 +2988,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
2956
2988
|
ipAddress?: string | undefined;
|
|
2957
2989
|
} | null;
|
|
2958
2990
|
creatorAddress: string | null;
|
|
2991
|
+
partnerId: string | null;
|
|
2959
2992
|
oneClickBuyUrl: string | null;
|
|
2960
2993
|
stripePaymentIntentId: string | null;
|
|
2961
2994
|
permit: {
|
|
@@ -3019,6 +3052,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
3019
3052
|
ipAddress?: string | undefined;
|
|
3020
3053
|
} | null;
|
|
3021
3054
|
creatorAddress: string | null;
|
|
3055
|
+
partnerId: string | null;
|
|
3022
3056
|
oneClickBuyUrl: string | null;
|
|
3023
3057
|
stripePaymentIntentId: string | null;
|
|
3024
3058
|
permit: {
|
|
@@ -3077,6 +3111,7 @@ export declare const zGetOrderAndTxsResponse: z.ZodObject<{
|
|
|
3077
3111
|
ipAddress?: string | undefined;
|
|
3078
3112
|
} | null;
|
|
3079
3113
|
creatorAddress: string | null;
|
|
3114
|
+
partnerId: string | null;
|
|
3080
3115
|
oneClickBuyUrl: string | null;
|
|
3081
3116
|
stripePaymentIntentId: string | null;
|
|
3082
3117
|
permit: {
|
|
@@ -35,6 +35,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
35
35
|
ipAddress?: string | undefined;
|
|
36
36
|
}>>;
|
|
37
37
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
38
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
38
39
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
39
40
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
40
41
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -220,6 +221,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
220
221
|
ipAddress?: string | undefined;
|
|
221
222
|
} | null;
|
|
222
223
|
creatorAddress: string | null;
|
|
224
|
+
partnerId: string | null;
|
|
223
225
|
oneClickBuyUrl: string | null;
|
|
224
226
|
stripePaymentIntentId: string | null;
|
|
225
227
|
permit: {
|
|
@@ -277,6 +279,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
277
279
|
ipAddress?: string | undefined;
|
|
278
280
|
} | null;
|
|
279
281
|
creatorAddress: string | null;
|
|
282
|
+
partnerId: string | null;
|
|
280
283
|
oneClickBuyUrl: string | null;
|
|
281
284
|
stripePaymentIntentId: string | null;
|
|
282
285
|
permit: {
|
|
@@ -323,6 +326,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
323
326
|
ipAddress?: string | undefined;
|
|
324
327
|
}>>;
|
|
325
328
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
329
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
326
330
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
327
331
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
328
332
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -592,6 +596,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
592
596
|
ipAddress?: string | undefined;
|
|
593
597
|
} | null;
|
|
594
598
|
creatorAddress: string | null;
|
|
599
|
+
partnerId: string | null;
|
|
595
600
|
oneClickBuyUrl: string | null;
|
|
596
601
|
stripePaymentIntentId: string | null;
|
|
597
602
|
permit: {
|
|
@@ -663,6 +668,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
663
668
|
ipAddress?: string | undefined;
|
|
664
669
|
} | null;
|
|
665
670
|
creatorAddress: string | null;
|
|
671
|
+
partnerId: string | null;
|
|
666
672
|
oneClickBuyUrl: string | null;
|
|
667
673
|
stripePaymentIntentId: string | null;
|
|
668
674
|
permit: {
|
|
@@ -709,6 +715,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
709
715
|
ipAddress?: string | undefined;
|
|
710
716
|
}>>;
|
|
711
717
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
718
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
712
719
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
713
720
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
714
721
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -928,6 +935,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
928
935
|
ipAddress?: string | undefined;
|
|
929
936
|
} | null;
|
|
930
937
|
creatorAddress: string | null;
|
|
938
|
+
partnerId: string | null;
|
|
931
939
|
oneClickBuyUrl: string | null;
|
|
932
940
|
stripePaymentIntentId: string | null;
|
|
933
941
|
permit: {
|
|
@@ -991,6 +999,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
991
999
|
ipAddress?: string | undefined;
|
|
992
1000
|
} | null;
|
|
993
1001
|
creatorAddress: string | null;
|
|
1002
|
+
partnerId: string | null;
|
|
994
1003
|
oneClickBuyUrl: string | null;
|
|
995
1004
|
stripePaymentIntentId: string | null;
|
|
996
1005
|
permit: {
|
|
@@ -1037,6 +1046,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1037
1046
|
ipAddress?: string | undefined;
|
|
1038
1047
|
}>>;
|
|
1039
1048
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
1049
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
1040
1050
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
1041
1051
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
1042
1052
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -1256,6 +1266,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1256
1266
|
ipAddress?: string | undefined;
|
|
1257
1267
|
} | null;
|
|
1258
1268
|
creatorAddress: string | null;
|
|
1269
|
+
partnerId: string | null;
|
|
1259
1270
|
oneClickBuyUrl: string | null;
|
|
1260
1271
|
stripePaymentIntentId: string | null;
|
|
1261
1272
|
permit: {
|
|
@@ -1319,6 +1330,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1319
1330
|
ipAddress?: string | undefined;
|
|
1320
1331
|
} | null;
|
|
1321
1332
|
creatorAddress: string | null;
|
|
1333
|
+
partnerId: string | null;
|
|
1322
1334
|
oneClickBuyUrl: string | null;
|
|
1323
1335
|
stripePaymentIntentId: string | null;
|
|
1324
1336
|
permit: {
|
|
@@ -1365,6 +1377,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1365
1377
|
ipAddress?: string | undefined;
|
|
1366
1378
|
}>>;
|
|
1367
1379
|
creatorAddress: z.ZodNullable<z.ZodString>;
|
|
1380
|
+
partnerId: z.ZodNullable<z.ZodString>;
|
|
1368
1381
|
oneClickBuyUrl: z.ZodNullable<z.ZodString>;
|
|
1369
1382
|
stripePaymentIntentId: z.ZodNullable<z.ZodString>;
|
|
1370
1383
|
permit: z.ZodNullable<z.ZodObject<{
|
|
@@ -1560,6 +1573,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1560
1573
|
ipAddress?: string | undefined;
|
|
1561
1574
|
} | null;
|
|
1562
1575
|
creatorAddress: string | null;
|
|
1576
|
+
partnerId: string | null;
|
|
1563
1577
|
oneClickBuyUrl: string | null;
|
|
1564
1578
|
stripePaymentIntentId: string | null;
|
|
1565
1579
|
permit: {
|
|
@@ -1620,6 +1634,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1620
1634
|
ipAddress?: string | undefined;
|
|
1621
1635
|
} | null;
|
|
1622
1636
|
creatorAddress: string | null;
|
|
1637
|
+
partnerId: string | null;
|
|
1623
1638
|
oneClickBuyUrl: string | null;
|
|
1624
1639
|
stripePaymentIntentId: string | null;
|
|
1625
1640
|
permit: {
|
|
@@ -1683,6 +1698,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1683
1698
|
ipAddress?: string | undefined;
|
|
1684
1699
|
} | null;
|
|
1685
1700
|
creatorAddress: string | null;
|
|
1701
|
+
partnerId: string | null;
|
|
1686
1702
|
oneClickBuyUrl: string | null;
|
|
1687
1703
|
stripePaymentIntentId: string | null;
|
|
1688
1704
|
permit: {
|
|
@@ -1754,6 +1770,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1754
1770
|
ipAddress?: string | undefined;
|
|
1755
1771
|
} | null;
|
|
1756
1772
|
creatorAddress: string | null;
|
|
1773
|
+
partnerId: string | null;
|
|
1757
1774
|
oneClickBuyUrl: string | null;
|
|
1758
1775
|
stripePaymentIntentId: string | null;
|
|
1759
1776
|
permit: {
|
|
@@ -1817,6 +1834,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1817
1834
|
ipAddress?: string | undefined;
|
|
1818
1835
|
} | null;
|
|
1819
1836
|
creatorAddress: string | null;
|
|
1837
|
+
partnerId: string | null;
|
|
1820
1838
|
oneClickBuyUrl: string | null;
|
|
1821
1839
|
stripePaymentIntentId: string | null;
|
|
1822
1840
|
permit: {
|
|
@@ -1880,6 +1898,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1880
1898
|
ipAddress?: string | undefined;
|
|
1881
1899
|
} | null;
|
|
1882
1900
|
creatorAddress: string | null;
|
|
1901
|
+
partnerId: string | null;
|
|
1883
1902
|
oneClickBuyUrl: string | null;
|
|
1884
1903
|
stripePaymentIntentId: string | null;
|
|
1885
1904
|
permit: {
|
|
@@ -1938,6 +1957,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
1938
1957
|
ipAddress?: string | undefined;
|
|
1939
1958
|
} | null;
|
|
1940
1959
|
creatorAddress: string | null;
|
|
1960
|
+
partnerId: string | null;
|
|
1941
1961
|
oneClickBuyUrl: string | null;
|
|
1942
1962
|
stripePaymentIntentId: string | null;
|
|
1943
1963
|
permit: {
|
|
@@ -2002,6 +2022,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
2002
2022
|
ipAddress?: string | undefined;
|
|
2003
2023
|
} | null;
|
|
2004
2024
|
creatorAddress: string | null;
|
|
2025
|
+
partnerId: string | null;
|
|
2005
2026
|
oneClickBuyUrl: string | null;
|
|
2006
2027
|
stripePaymentIntentId: string | null;
|
|
2007
2028
|
permit: {
|
|
@@ -2073,6 +2094,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
2073
2094
|
ipAddress?: string | undefined;
|
|
2074
2095
|
} | null;
|
|
2075
2096
|
creatorAddress: string | null;
|
|
2097
|
+
partnerId: string | null;
|
|
2076
2098
|
oneClickBuyUrl: string | null;
|
|
2077
2099
|
stripePaymentIntentId: string | null;
|
|
2078
2100
|
permit: {
|
|
@@ -2136,6 +2158,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
2136
2158
|
ipAddress?: string | undefined;
|
|
2137
2159
|
} | null;
|
|
2138
2160
|
creatorAddress: string | null;
|
|
2161
|
+
partnerId: string | null;
|
|
2139
2162
|
oneClickBuyUrl: string | null;
|
|
2140
2163
|
stripePaymentIntentId: string | null;
|
|
2141
2164
|
permit: {
|
|
@@ -2199,6 +2222,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
2199
2222
|
ipAddress?: string | undefined;
|
|
2200
2223
|
} | null;
|
|
2201
2224
|
creatorAddress: string | null;
|
|
2225
|
+
partnerId: string | null;
|
|
2202
2226
|
oneClickBuyUrl: string | null;
|
|
2203
2227
|
stripePaymentIntentId: string | null;
|
|
2204
2228
|
permit: {
|
|
@@ -2257,6 +2281,7 @@ export declare const zGetOrderHistoryResponse: z.ZodObject<{
|
|
|
2257
2281
|
ipAddress?: string | undefined;
|
|
2258
2282
|
} | null;
|
|
2259
2283
|
creatorAddress: string | null;
|
|
2284
|
+
partnerId: string | null;
|
|
2260
2285
|
oneClickBuyUrl: string | null;
|
|
2261
2286
|
stripePaymentIntentId: string | null;
|
|
2262
2287
|
permit: {
|
|
@@ -3,13 +3,14 @@ export { useAccountWallet } from "./useAccountWallet";
|
|
|
3
3
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
4
4
|
export { useAuthentication } from "./useAuthentication";
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
|
+
export { useB3EnsName } from "./useB3EnsName";
|
|
6
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
7
8
|
export { useBsmntProfile } from "./useBsmntProfile";
|
|
8
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
9
10
|
export { useClaim } from "./useClaim";
|
|
10
11
|
export { useConnect } from "./useConnect";
|
|
11
12
|
export { useExchangeRate } from "./useExchangeRate";
|
|
12
|
-
export { type TWSignerWithMetadata
|
|
13
|
+
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
13
14
|
export { useGetGeo } from "./useGetGeo";
|
|
14
15
|
export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
|
|
15
16
|
export { useHasMounted } from "./useHasMounted";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useOneBalance = exports.useOnchainName = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useClaim = exports.useChainSwitchWithAction = exports.useBsmntProfile = exports.useBestTransactionPath = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
|
|
3
|
+
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useOneBalance = exports.useOnchainName = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useClaim = exports.useChainSwitchWithAction = exports.useBsmntProfile = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
|
|
4
4
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
5
5
|
Object.defineProperty(exports, "useAccountAssets", { enumerable: true, get: function () { return useAccountAssets_1.useAccountAssets; } });
|
|
6
6
|
var useAccountWallet_1 = require("./useAccountWallet");
|
|
@@ -11,6 +11,8 @@ var useAuthentication_1 = require("./useAuthentication");
|
|
|
11
11
|
Object.defineProperty(exports, "useAuthentication", { enumerable: true, get: function () { return useAuthentication_1.useAuthentication; } });
|
|
12
12
|
var useB3BalanceFromAddresses_1 = require("./useB3BalanceFromAddresses");
|
|
13
13
|
Object.defineProperty(exports, "useB3BalanceFromAddresses", { enumerable: true, get: function () { return useB3BalanceFromAddresses_1.useB3BalanceFromAddresses; } });
|
|
14
|
+
var useB3EnsName_1 = require("./useB3EnsName");
|
|
15
|
+
Object.defineProperty(exports, "useB3EnsName", { enumerable: true, get: function () { return useB3EnsName_1.useB3EnsName; } });
|
|
14
16
|
var useBestTransactionPath_1 = require("./useBestTransactionPath");
|
|
15
17
|
Object.defineProperty(exports, "useBestTransactionPath", { enumerable: true, get: function () { return useBestTransactionPath_1.useBestTransactionPath; } });
|
|
16
18
|
var useBsmntProfile_1 = require("./useBsmntProfile");
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useB3EnsName = void 0;
|
|
7
|
+
const bsmnt_1 = __importDefault(require("../../../global-account/bsmnt"));
|
|
8
|
+
const constants_1 = require("../../../shared/constants");
|
|
9
|
+
const js_cookie_1 = __importDefault(require("js-cookie"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const useB3EnsName = () => {
|
|
12
|
+
const registerEns = (0, react_1.useCallback)(async (username, message, hash) => {
|
|
13
|
+
if (!bsmnt_1.default.authentication.authenticated) {
|
|
14
|
+
await bsmnt_1.default.authentication.authenticate({
|
|
15
|
+
strategy: "b3-jwt",
|
|
16
|
+
accessToken: js_cookie_1.default.get(constants_1.B3_AUTH_COOKIE_NAME) || ""
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const response = await bsmnt_1.default.service("profiles").registerUsername({
|
|
20
|
+
username,
|
|
21
|
+
message,
|
|
22
|
+
hash
|
|
23
|
+
}, {});
|
|
24
|
+
return response;
|
|
25
|
+
}, [bsmnt_1.default.authentication.authenticated]);
|
|
26
|
+
const getEns = (0, react_1.useCallback)(async (address) => {
|
|
27
|
+
const response = await fetch(`https://ens-gateway.b3.fun/address/${address}`);
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new Error(`Failed to fetch ENS name: ${response.statusText}`);
|
|
30
|
+
}
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
return data;
|
|
33
|
+
}, []);
|
|
34
|
+
return (0, react_1.useMemo)(() => ({
|
|
35
|
+
registerEns,
|
|
36
|
+
getEns
|
|
37
|
+
}), [registerEns, getEns]);
|
|
38
|
+
};
|
|
39
|
+
exports.useB3EnsName = useB3EnsName;
|
|
@@ -10,8 +10,12 @@ interface UseTokenFromUrlOptions {
|
|
|
10
10
|
prefix: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Hook to parse token data from URL parameters.
|
|
13
|
+
* Hook to parse token data from URL parameters and fetch additional token info.
|
|
14
14
|
* Looks for parameters: [prefix]Currency
|
|
15
15
|
*/
|
|
16
16
|
export declare function useTokenFromUrl({ defaultToken, prefix }: UseTokenFromUrlOptions): Token;
|
|
17
|
+
export declare function useTokenFromAddress({ address, chainId }: {
|
|
18
|
+
address: string;
|
|
19
|
+
chainId: number;
|
|
20
|
+
}): Token | undefined;
|
|
17
21
|
export {};
|
|
@@ -2,29 +2,90 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.useTokenFromUrl = useTokenFromUrl;
|
|
5
|
+
exports.useTokenFromAddress = useTokenFromAddress;
|
|
6
|
+
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
7
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
8
|
const navigation_1 = require("next/navigation");
|
|
9
|
+
async function fetchTokenInfo(network, address) {
|
|
10
|
+
const response = await fetch("https://api.b3.fun/tokens", {
|
|
11
|
+
method: "POST",
|
|
12
|
+
headers: {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
"X-Service-Method": "getCoinGeckoTokenInfo"
|
|
15
|
+
},
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
network,
|
|
18
|
+
address
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
throw new Error("Failed to fetch token info");
|
|
23
|
+
}
|
|
24
|
+
return response.json();
|
|
25
|
+
}
|
|
6
26
|
/**
|
|
7
|
-
* Hook to parse token data from URL parameters.
|
|
27
|
+
* Hook to parse token data from URL parameters and fetch additional token info.
|
|
8
28
|
* Looks for parameters: [prefix]Currency
|
|
9
29
|
*/
|
|
10
30
|
function useTokenFromUrl({ defaultToken, prefix }) {
|
|
11
31
|
const searchParams = (0, navigation_1.useSearchParams)();
|
|
12
|
-
if (!searchParams) {
|
|
13
|
-
return defaultToken;
|
|
14
|
-
}
|
|
15
32
|
// Get parameters from URL
|
|
16
|
-
const currencyParam = searchParams
|
|
17
|
-
const chainIdParam = searchParams
|
|
18
|
-
if
|
|
33
|
+
const currencyParam = searchParams?.get(`${prefix}Currency`);
|
|
34
|
+
const chainIdParam = searchParams?.get(`${prefix}ChainId`);
|
|
35
|
+
// Determine if we should fetch token info
|
|
36
|
+
const shouldFetchToken = Boolean(currencyParam && chainIdParam && currencyParam.toLowerCase() !== defaultToken.address.toLowerCase());
|
|
37
|
+
// Determine network based on chainId
|
|
38
|
+
const network = chainIdParam ? (0, supported_1.getCoingeckoChainInfo)(Number(chainIdParam)).coingecko_id : "";
|
|
39
|
+
const { data: tokenInfo, isError } = (0, react_query_1.useQuery)({
|
|
40
|
+
queryKey: ["tokenInfo", network, currencyParam],
|
|
41
|
+
queryFn: () => fetchTokenInfo(network, currencyParam),
|
|
42
|
+
enabled: shouldFetchToken,
|
|
43
|
+
staleTime: Infinity,
|
|
44
|
+
gcTime: Infinity
|
|
45
|
+
});
|
|
46
|
+
// Return default token if no params or same as default
|
|
47
|
+
if (!shouldFetchToken) {
|
|
19
48
|
return defaultToken;
|
|
20
49
|
}
|
|
21
|
-
//
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
50
|
+
// Return basic token info if API call fails or while loading
|
|
51
|
+
if (isError || !tokenInfo) {
|
|
52
|
+
return {
|
|
53
|
+
...defaultToken,
|
|
54
|
+
address: currencyParam,
|
|
55
|
+
chainId: Number(chainIdParam)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// Return enhanced token with API data
|
|
59
|
+
return {
|
|
60
|
+
address: tokenInfo.data.attributes.address,
|
|
61
|
+
chainId: Number(chainIdParam),
|
|
62
|
+
name: tokenInfo.data.attributes.name,
|
|
63
|
+
symbol: tokenInfo.data.attributes.symbol,
|
|
64
|
+
decimals: tokenInfo.data.attributes.decimals,
|
|
65
|
+
metadata: {
|
|
66
|
+
logoURI: tokenInfo.data.attributes.image_url
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function useTokenFromAddress({ address, chainId }) {
|
|
71
|
+
const { data: tokenInfo, isError } = (0, react_query_1.useQuery)({
|
|
72
|
+
queryKey: ["tokenInfo", address, chainId],
|
|
73
|
+
queryFn: () => fetchTokenInfo((0, supported_1.getCoingeckoChainInfo)(chainId).coingecko_id, address),
|
|
74
|
+
enabled: Boolean(address),
|
|
75
|
+
staleTime: Infinity,
|
|
76
|
+
gcTime: Infinity
|
|
77
|
+
});
|
|
78
|
+
if (isError || !tokenInfo) {
|
|
79
|
+
return undefined;
|
|
24
80
|
}
|
|
25
81
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
82
|
+
address,
|
|
83
|
+
chainId,
|
|
84
|
+
name: tokenInfo?.data.attributes.name || "",
|
|
85
|
+
symbol: tokenInfo?.data.attributes.symbol || "",
|
|
86
|
+
decimals: tokenInfo?.data.attributes.decimals || 18,
|
|
87
|
+
metadata: {
|
|
88
|
+
logoURI: tokenInfo?.data.attributes.image_url
|
|
89
|
+
}
|
|
29
90
|
};
|
|
30
91
|
}
|