@coinlist-co/react 0.10.1 → 0.11.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.
Files changed (38) hide show
  1. package/README.md +32 -0
  2. package/dist/{chunk-AQVCOWOV.js → chunk-B2HCVPCQ.js} +202 -318
  3. package/dist/chunk-B2HCVPCQ.js.map +1 -0
  4. package/dist/chunk-KDGNDAHA.js +146 -0
  5. package/dist/chunk-KDGNDAHA.js.map +1 -0
  6. package/dist/chunk-UIIXXLA7.js +1863 -0
  7. package/dist/chunk-UIIXXLA7.js.map +1 -0
  8. package/dist/client/index.cjs +10382 -3262
  9. package/dist/client/index.cjs.map +1 -1
  10. package/dist/client/index.d.cts +4219 -862
  11. package/dist/client/index.d.ts +4219 -862
  12. package/dist/client/index.js +8727 -2369
  13. package/dist/client/index.js.map +1 -1
  14. package/dist/collections-BhDkYmzV.d.cts +65 -0
  15. package/dist/collections-CZhHoQHr.d.ts +65 -0
  16. package/dist/config-B5mwS_2l.d.cts +1926 -0
  17. package/dist/config-B5mwS_2l.d.ts +1926 -0
  18. package/dist/server/index.cjs +981 -464
  19. package/dist/server/index.cjs.map +1 -1
  20. package/dist/server/index.d.cts +190 -163
  21. package/dist/server/index.d.ts +190 -163
  22. package/dist/server/index.js +151 -154
  23. package/dist/server/index.js.map +1 -1
  24. package/dist/shared/index.cjs +1810 -907
  25. package/dist/shared/index.cjs.map +1 -1
  26. package/dist/shared/index.d.cts +243 -132
  27. package/dist/shared/index.d.ts +243 -132
  28. package/dist/shared/index.js +96 -28
  29. package/package.json +10 -7
  30. package/dist/chunk-AQVCOWOV.js.map +0 -1
  31. package/dist/chunk-TBU3EBNM.js +0 -442
  32. package/dist/chunk-TBU3EBNM.js.map +0 -1
  33. package/dist/chunk-UOHD7US2.js +0 -855
  34. package/dist/chunk-UOHD7US2.js.map +0 -1
  35. package/dist/collections-Bv1Oxzu_.d.ts +0 -28
  36. package/dist/collections-DDyxbOPZ.d.cts +0 -28
  37. package/dist/requirement-oVZA1INj.d.cts +0 -1040
  38. package/dist/requirement-oVZA1INj.d.ts +0 -1040
@@ -0,0 +1,65 @@
1
+ import { ai as ClientId, a_ as RedirectUri, aj as CodeChallenge, aP as PKCEState, C as CodeVerifier, B as BlockchainAmount, b7 as SwapPreview, M as AssetDecimals, ab as Newtype } from './config-B5mwS_2l.cjs';
2
+
3
+ type PKCEParams = {
4
+ clientId: ClientId;
5
+ responseType: 'code';
6
+ redirectUri: RedirectUri;
7
+ codeChallenge: CodeChallenge;
8
+ codeChallengeMethod: 'S256';
9
+ state: PKCEState;
10
+ codeVerifier: CodeVerifier;
11
+ };
12
+ type PKCEConfig = {
13
+ clientId: ClientId;
14
+ redirectUri: RedirectUri;
15
+ };
16
+ /**
17
+ * Generates PKCE parameters for an OAuth2 authorization code flow.
18
+ * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use
19
+ * in server-side code and Next.js middleware.
20
+ */
21
+ declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
22
+
23
+ /**
24
+ * A read-only quote for a swap as domain amounts: how much goes in, the
25
+ * protocol fee, and how much would come out. Derived from the raw
26
+ * {@link SwapPreview} the swap contract returns.
27
+ */
28
+ type SwapQuote = {
29
+ inputTokenAmount: BlockchainAmount;
30
+ fee: BlockchainAmount;
31
+ outputTokenAmount: BlockchainAmount;
32
+ };
33
+ declare const SwapQuote: {
34
+ /**
35
+ * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
36
+ * input and fee are denominated in the input token; the output in the output
37
+ * token.
38
+ */
39
+ fromPreview: (preview: SwapPreview, inputDecimals: AssetDecimals, outputDecimals: AssetDecimals) => SwapQuote;
40
+ };
41
+
42
+ type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
43
+ declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
44
+ type FormattedPercentUi = Newtype<string, 'FormattedPercentUi'>;
45
+ declare const FormattedPercentUi: (value: string) => FormattedPercentUi;
46
+ type TxExplorerUrl = Newtype<string, 'TxExplorerUrl'>;
47
+ declare const TxExplorerUrl: (value: string) => TxExplorerUrl;
48
+ /**
49
+ * A wallet address shortened for display (e.g. `0x1234…5678`). Keeps a
50
+ * `0x${string}` base but drops the runtime `0x` narrowing.
51
+ */
52
+ type ShortenedWalletAddress = Newtype<`0x${string}`, 'ShortenedWalletAddress'>;
53
+ declare const ShortenedWalletAddress: (value: string) => ShortenedWalletAddress;
54
+ type FormattedAmountAssetUi = Newtype<string, 'FormattedAmountAssetUi'>;
55
+ declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
56
+ type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
57
+ declare const AssetIconUrl: (value: string) => AssetIconUrl;
58
+
59
+ /**
60
+ * An array guaranteed to hold at least one element. Use it where an empty list
61
+ * would be a bug (e.g. the set of assets a swap always offers).
62
+ */
63
+ type NonEmptyArray<T> = [T, ...T[]];
64
+
65
+ export { AssetIconUrl as A, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, ShortenedWalletAddress as a, FormattedPercentUi as b, FormattedAmountUi as c, type PKCEParams as d, generatePKCEParams as g };
@@ -0,0 +1,65 @@
1
+ import { ai as ClientId, a_ as RedirectUri, aj as CodeChallenge, aP as PKCEState, C as CodeVerifier, B as BlockchainAmount, b7 as SwapPreview, M as AssetDecimals, ab as Newtype } from './config-B5mwS_2l.js';
2
+
3
+ type PKCEParams = {
4
+ clientId: ClientId;
5
+ responseType: 'code';
6
+ redirectUri: RedirectUri;
7
+ codeChallenge: CodeChallenge;
8
+ codeChallengeMethod: 'S256';
9
+ state: PKCEState;
10
+ codeVerifier: CodeVerifier;
11
+ };
12
+ type PKCEConfig = {
13
+ clientId: ClientId;
14
+ redirectUri: RedirectUri;
15
+ };
16
+ /**
17
+ * Generates PKCE parameters for an OAuth2 authorization code flow.
18
+ * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use
19
+ * in server-side code and Next.js middleware.
20
+ */
21
+ declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
22
+
23
+ /**
24
+ * A read-only quote for a swap as domain amounts: how much goes in, the
25
+ * protocol fee, and how much would come out. Derived from the raw
26
+ * {@link SwapPreview} the swap contract returns.
27
+ */
28
+ type SwapQuote = {
29
+ inputTokenAmount: BlockchainAmount;
30
+ fee: BlockchainAmount;
31
+ outputTokenAmount: BlockchainAmount;
32
+ };
33
+ declare const SwapQuote: {
34
+ /**
35
+ * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
36
+ * input and fee are denominated in the input token; the output in the output
37
+ * token.
38
+ */
39
+ fromPreview: (preview: SwapPreview, inputDecimals: AssetDecimals, outputDecimals: AssetDecimals) => SwapQuote;
40
+ };
41
+
42
+ type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
43
+ declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
44
+ type FormattedPercentUi = Newtype<string, 'FormattedPercentUi'>;
45
+ declare const FormattedPercentUi: (value: string) => FormattedPercentUi;
46
+ type TxExplorerUrl = Newtype<string, 'TxExplorerUrl'>;
47
+ declare const TxExplorerUrl: (value: string) => TxExplorerUrl;
48
+ /**
49
+ * A wallet address shortened for display (e.g. `0x1234…5678`). Keeps a
50
+ * `0x${string}` base but drops the runtime `0x` narrowing.
51
+ */
52
+ type ShortenedWalletAddress = Newtype<`0x${string}`, 'ShortenedWalletAddress'>;
53
+ declare const ShortenedWalletAddress: (value: string) => ShortenedWalletAddress;
54
+ type FormattedAmountAssetUi = Newtype<string, 'FormattedAmountAssetUi'>;
55
+ declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
56
+ type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
57
+ declare const AssetIconUrl: (value: string) => AssetIconUrl;
58
+
59
+ /**
60
+ * An array guaranteed to hold at least one element. Use it where an empty list
61
+ * would be a bug (e.g. the set of assets a swap always offers).
62
+ */
63
+ type NonEmptyArray<T> = [T, ...T[]];
64
+
65
+ export { AssetIconUrl as A, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, ShortenedWalletAddress as a, FormattedPercentUi as b, FormattedAmountUi as c, type PKCEParams as d, generatePKCEParams as g };