@coinlist-co/react 0.12.2-rc.31c2f50 → 0.12.2-rc.3de3751

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-NBO5E2RO.js → chunk-HMLWCXAP.js} +1329 -945
  3. package/dist/chunk-HMLWCXAP.js.map +1 -0
  4. package/dist/{chunk-4IZ2F732.js → chunk-L7SVKXXW.js} +10 -10
  5. package/dist/chunk-L7SVKXXW.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-UJYSXXJF.js → chunk-RLOYYAMO.js} +193 -364
  9. package/dist/chunk-RLOYYAMO.js.map +1 -0
  10. package/dist/client/index.d.ts +3302 -4561
  11. package/dist/client/index.js +9396 -7549
  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-D_XSpiS-.d.ts → time-DkU7jivQ.d.ts} +2179 -2906
  17. package/dist/{token-registry-snapshot-BsAfBL_b.d.ts → token-registry-snapshot-D0OWXMe4.d.ts} +62 -34
  18. package/dist/universal/index.d.ts +84 -1337
  19. package/dist/universal/index.js +39 -47
  20. package/package.json +18 -14
  21. package/dist/chunk-4IZ2F732.js.map +0 -1
  22. package/dist/chunk-NBO5E2RO.js.map +0 -1
  23. package/dist/chunk-UJYSXXJF.js.map +0 -1
  24. package/dist/client/index.cjs +0 -17133
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -6671
  27. package/dist/server/index.cjs +0 -4269
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -378
  30. package/dist/time-CFocgYyl.d.cts +0 -50
  31. package/dist/time-DvgN98Q9.d.ts +0 -50
  32. package/dist/token-registry-snapshot-Cc_eA5zM.d.cts +0 -181
  33. package/dist/tokens-namespace-D_XSpiS-.d.cts +0 -3436
  34. package/dist/universal/index.cjs +0 -4321
  35. package/dist/universal/index.cjs.map +0 -1
  36. package/dist/universal/index.d.cts +0 -1629
@@ -1,26 +1,6 @@
1
- import { aL as ClientId, bA as RedirectUri, aM as CodeChallenge, bo as PKCEState, C as CodeVerifier, q as EvmWalletAddress, a as EthereumChain, aB as Tx, B as BlockchainAmount, bK as SwapPreview, a1 as AssetDecimals, aC as Newtype, D as TokenMetadata, aK as Chain, b as EvmContractAddress, bi as OfferToken } from './tokens-namespace-D_XSpiS-.js';
1
+ import { q as EvmWalletAddress, E as EthereumChain, c2 as Tx, bn as Newtype, F as TokenMetadata, aL as Chain, b as EvmContractAddress, bv as OfferToken } from './time-DkU7jivQ.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,25 +50,73 @@ interface EvmWallet extends EvmSigner {
70
50
  type ConnectWallet = EvmSigner & {
71
51
  readonly chain: EthereumChain;
72
52
  };
53
+ /**
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.
63
+ */
64
+ type ExternalWalletAdapter = {
65
+ /**
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.
72
+ */
73
+ connect: () => Promise<void>;
74
+ /** Disconnects the external wallet. Resolves when it is gone. */
75
+ disconnect: () => Promise<void>;
76
+ };
73
77
 
74
78
  /**
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.
79
+ * The wallets a screen reads for and acts from, supplied by the host.
80
+ *
81
+ * The SDK ships no wallet stack, so wallet discovery and connection are
82
+ * inverted onto the host: it hands over ready {@link EvmWallet}s, and an
83
+ * adapter for connecting an external one when it supports that. Every wallet
84
+ * here is one that can sign for itself, so a screen can broadcast from the
85
+ * wallet that holds a position.
78
86
  */
79
- type SwapQuote = {
80
- inputTokenAmount: BlockchainAmount;
81
- fee: BlockchainAmount;
82
- outputTokenAmount: BlockchainAmount;
87
+ type WalletSelection = {
88
+ /**
89
+ * The user's embedded (custodial) wallets, in display order. Empty when
90
+ * they have none, which is a normal state, not an error.
91
+ */
92
+ embedded: EvmWallet[];
93
+ /** The connected external wallet, or `null` while none is connected. */
94
+ external: EvmWallet | null;
95
+ /**
96
+ * The host's external-wallet connector, or `null` when it offers none - in
97
+ * which case the screen shows no connect affordance at all. A host may
98
+ * still pass a connected `external` without one, to show a wallet the user
99
+ * cannot change from here.
100
+ */
101
+ externalAdapter: ExternalWalletAdapter | null;
83
102
  };
84
- declare const SwapQuote: {
103
+ /** Operations over a {@link WalletSelection}. */
104
+ declare const WalletSelection: {
85
105
  /**
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.
106
+ * Every wallet in display order - embedded first, then the external one -
107
+ * each address once. Addresses compare case-insensitively, so a host that
108
+ * hands the same wallet over as both embedded and external sees it once.
89
109
  */
90
- fromPreview: (preview: SwapPreview, inputDecimals: AssetDecimals, outputDecimals: AssetDecimals) => SwapQuote;
110
+ all: (selection: WalletSelection) => EvmWallet[];
91
111
  };
112
+ /**
113
+ * Names a wallet for display, e.g. `'CoinList Wallet'` for the user's
114
+ * embedded one. `null` means it has no name, and the screen shows its
115
+ * shortened address instead.
116
+ *
117
+ * @alpha
118
+ */
119
+ type WalletLabelResolver = (address: EvmWalletAddress) => string | null;
92
120
 
93
121
  type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
94
122
  declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
@@ -178,4 +206,4 @@ declare function offerDisplayTokens(offer: {
178
206
  tokens: readonly OfferToken[];
179
207
  }): OfferToken[];
180
208
 
181
- 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 };
209
+ 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 };