@coinlist-co/react 0.12.2-rc.abd9d38 → 0.12.2-rc.e1f6c82

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 (36) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-45LAPB7U.js → chunk-EKLUJZ7T.js} +10 -10
  3. package/dist/chunk-EKLUJZ7T.js.map +1 -0
  4. package/dist/{chunk-HDJEDOS4.js → chunk-GIE4UWB3.js} +1207 -799
  5. package/dist/chunk-GIE4UWB3.js.map +1 -0
  6. package/dist/chunk-MJ6YXZWH.js +22 -0
  7. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  8. package/dist/{chunk-M7WDZZPX.js → chunk-PIOQA6HW.js} +194 -190
  9. package/dist/chunk-PIOQA6HW.js.map +1 -0
  10. package/dist/client/index.d.ts +2977 -4267
  11. package/dist/client/index.js +8552 -5713
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.d.ts +7 -33
  14. package/dist/server/index.js +8 -4
  15. package/dist/server/index.js.map +1 -1
  16. package/dist/{tokens-namespace-DrwRi0AQ.d.cts → time-Bbqlt2x7.d.ts} +2081 -2734
  17. package/dist/{token-registry-snapshot-C-Qs3Lgs.d.ts → token-registry-snapshot-DttZXGvY.d.ts} +74 -42
  18. package/dist/universal/index.d.ts +59 -998
  19. package/dist/universal/index.js +38 -36
  20. package/package.json +18 -14
  21. package/dist/chunk-45LAPB7U.js.map +0 -1
  22. package/dist/chunk-HDJEDOS4.js.map +0 -1
  23. package/dist/chunk-M7WDZZPX.js.map +0 -1
  24. package/dist/client/index.cjs +0 -17098
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -6660
  27. package/dist/server/index.cjs +0 -4240
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -378
  30. package/dist/time-BOCS1TbH.d.cts +0 -50
  31. package/dist/time-C7mhO5_a.d.ts +0 -50
  32. package/dist/token-registry-snapshot-CpzLmsc2.d.cts +0 -179
  33. package/dist/tokens-namespace-DrwRi0AQ.d.ts +0 -3364
  34. package/dist/universal/index.cjs +0 -4135
  35. package/dist/universal/index.cjs.map +0 -1
  36. package/dist/universal/index.d.cts +0 -1314
@@ -1,26 +1,6 @@
1
- import { aI as ClientId, bw as RedirectUri, aJ as CodeChallenge, bk as PKCEState, C as CodeVerifier, q as EvmWalletAddress, a as EthereumChain, bN as Tx, B as BlockchainAmount, bG as SwapPreview, a0 as AssetDecimals, aA as Newtype, D as TokenMetadata, aH as Chain, b as EvmContractAddress, bf as OfferToken } from './tokens-namespace-DrwRi0AQ.js';
1
+ import { q as EvmWalletAddress, E as EthereumChain, c3 as Tx, bo as Newtype, N as TokenMetadata, aM as Chain, b as EvmContractAddress, bw as OfferToken } from './time-Bbqlt2x7.js';
2
2
  import { Hex, Abi, Hash, TransactionReceipt } from 'viem';
3
3
 
4
- type PKCEParams = {
5
- clientId: ClientId;
6
- responseType: 'code';
7
- redirectUri: RedirectUri;
8
- codeChallenge: CodeChallenge;
9
- codeChallengeMethod: 'S256';
10
- state: PKCEState;
11
- codeVerifier: CodeVerifier;
12
- };
13
- type PKCEConfig = {
14
- clientId: ClientId;
15
- redirectUri: RedirectUri;
16
- };
17
- /**
18
- * Generates PKCE parameters for an OAuth2 authorization code flow.
19
- * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use
20
- * in server-side code and Next.js middleware.
21
- */
22
- declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
23
-
24
4
  type WriteContractParams = {
25
5
  abi: Abi;
26
6
  address: `0x${string}`;
@@ -70,24 +50,29 @@ interface EvmWallet extends EvmSigner {
70
50
  type ConnectWallet = EvmSigner & {
71
51
  readonly chain: EthereumChain;
72
52
  };
73
-
74
53
  /**
75
- * A read-only quote for a swap as domain amounts: how much goes in, the
76
- * protocol fee, and how much would come out. Derived from the raw
77
- * {@link SwapPreview} the swap contract returns.
54
+ * The host's connector for an external wallet, as two lambdas: one opens it,
55
+ * one tears the connection down. The SDK ships no wallet stack, so this is how
56
+ * a screen offers "Connect wallet" without knowing whether AppKit, Privy or the
57
+ * host's own modal is behind it.
58
+ *
59
+ * One product type rather than two optional lambdas, because they come as a
60
+ * pair: a screen that can connect a wallet must be able to let it go again,
61
+ * and a host that supports neither passes `null` for the whole adapter, which
62
+ * hides the connect affordance entirely.
78
63
  */
79
- type SwapQuote = {
80
- inputTokenAmount: BlockchainAmount;
81
- fee: BlockchainAmount;
82
- outputTokenAmount: BlockchainAmount;
83
- };
84
- declare const SwapQuote: {
64
+ type ExternalWalletAdapter = {
85
65
  /**
86
- * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
87
- * input and fee are denominated in the input token; the output in the output
88
- * token.
66
+ * Opens the host's wallet connector. Resolves once the attempt finishes; the
67
+ * SDK reads the outcome from the external wallet it is handed on the next
68
+ * render rather than from a return value, so a host that connects through a
69
+ * redirect still works.
70
+ *
71
+ * Rejecting is how a declined or failed connection is reported.
89
72
  */
90
- fromPreview: (preview: SwapPreview, inputDecimals: AssetDecimals, outputDecimals: AssetDecimals) => SwapQuote;
73
+ connect: () => Promise<void>;
74
+ /** Disconnects the external wallet. Resolves when it is gone. */
75
+ disconnect: () => Promise<void>;
91
76
  };
92
77
 
93
78
  type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
@@ -107,6 +92,51 @@ declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
107
92
  type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
108
93
  declare const AssetIconUrl: (value: string) => AssetIconUrl;
109
94
 
95
+ /**
96
+ * The wallets a screen reads for and acts from, supplied by the host.
97
+ *
98
+ * The SDK ships no wallet stack, so wallet discovery and connection are
99
+ * inverted onto the host: it hands over ready {@link EvmWallet}s, and an
100
+ * adapter for connecting an external one when it supports that. Every wallet
101
+ * here is one that can sign for itself, so a screen can broadcast from the
102
+ * wallet that holds a position.
103
+ *
104
+ * @alpha
105
+ */
106
+ type WalletSelection = {
107
+ /**
108
+ * The user's embedded (custodial) wallets, in display order. Empty when
109
+ * they have none, which is a normal state, not an error.
110
+ */
111
+ embedded: EvmWallet[];
112
+ /** The connected external wallet, or `null` while none is connected. */
113
+ external: EvmWallet | null;
114
+ /**
115
+ * The host's external-wallet connector, or `null` when it offers none - in
116
+ * which case the screen shows no connect affordance at all. A host may
117
+ * still pass a connected `external` without one, to show a wallet the user
118
+ * cannot change from here.
119
+ */
120
+ externalAdapter: ExternalWalletAdapter | null;
121
+ };
122
+ /** @alpha */
123
+ declare const WalletSelection: {
124
+ /**
125
+ * Every wallet in display order - embedded first, then the external one -
126
+ * each address once. Addresses compare case-insensitively, so a host that
127
+ * hands the same wallet over as both embedded and external sees it once.
128
+ */
129
+ all: (selection: WalletSelection) => EvmWallet[];
130
+ };
131
+ /**
132
+ * Names a wallet for display, e.g. `'CoinList Wallet'` for the user's
133
+ * embedded one. `null` means it has no name, and the screen shows its
134
+ * shortened address instead.
135
+ *
136
+ * @alpha
137
+ */
138
+ type WalletLabelResolver = (address: EvmWalletAddress) => string | null;
139
+
110
140
  /**
111
141
  * An array guaranteed to hold at least one element. Use it where an empty list
112
142
  * would be a bug (e.g. the set of assets a swap always offers).
@@ -162,13 +192,15 @@ declare const TokenRegistrySnapshot: {
162
192
  }) => TokenMetadata | null;
163
193
  };
164
194
  /**
165
- * The tokens an offer is *about*, most specific first: every `swap` entry,
166
- * then every `distribution` entry. `funding` entries name what a swap is paid
167
- * with (USDC, USDT) and never the asset on offer, so they are left out.
195
+ * The tokens an offer is *about*, most specific first: every `swap` or
196
+ * `vault` entry, then every `distribution` entry. `funding` entries name what
197
+ * an offer is paid with (USDC, USDT) and never the asset on offer, so they are
198
+ * left out.
168
199
  *
169
- * `swap` outranks `distribution` because a swap product names the asset it
170
- * hands over precisely, while a sale's distribution entry names the same
171
- * token for a sale product and is accepted as the fallback. The checkout's
200
+ * `swap` and `vault` rank together - no offer type carries both - and outrank
201
+ * `distribution` because a swap or vault product names the token it hands over
202
+ * precisely, while a sale's distribution entry names the same token for a sale
203
+ * product and is accepted as the fallback. The checkout's
172
204
  * per-chain lookup and the catalogue's any-chain lookup both read this
173
205
  * ordering, which is why it is stated once, here.
174
206
  */
@@ -176,4 +208,4 @@ declare function offerDisplayTokens(offer: {
176
208
  tokens: readonly OfferToken[];
177
209
  }): OfferToken[];
178
210
 
179
- export { AssetIconUrl as A, type BroadcastTxParams as B, type ConnectWallet as C, type EvmWallet as E, FormattedAmountAssetUi as F, type NonEmptyArray as N, type PKCEConfig as P, SwapQuote as S, TxExplorerUrl as T, type WriteContractParams as W, ShortenedWalletAddress as a, FormattedPercentUi as b, TokenRegistrySnapshot as c, type EvmSigner as d, FormattedAmountUi as e, type PKCEParams as f, generatePKCEParams as g, offerDisplayTokens as o };
211
+ export { AssetIconUrl as A, type BroadcastTxParams as B, type ConnectWallet as C, type EvmWallet as E, FormattedAmountAssetUi as F, type NonEmptyArray as N, ShortenedWalletAddress as S, TxExplorerUrl as T, WalletSelection as W, type WalletLabelResolver as a, FormattedPercentUi as b, TokenRegistrySnapshot as c, FormattedAmountUi as d, type EvmSigner as e, type ExternalWalletAdapter as f, type TokenKey as g, type WriteContractParams as h, offerDisplayTokens as o };