@coinlist-co/react 0.5.1 → 0.9.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 (40) hide show
  1. package/dist/{chunk-5E3P7AMH.js → chunk-AAER5LOL.js} +3 -1
  2. package/dist/chunk-AAER5LOL.js.map +1 -0
  3. package/dist/chunk-I5YTJ5SL.js +644 -0
  4. package/dist/chunk-I5YTJ5SL.js.map +1 -0
  5. package/dist/{chunk-N3WBC2VS.js → chunk-MKCOK3DF.js} +68 -57
  6. package/dist/chunk-MKCOK3DF.js.map +1 -0
  7. package/dist/chunk-Z2HAA2TI.js +768 -0
  8. package/dist/chunk-Z2HAA2TI.js.map +1 -0
  9. package/dist/client/index.cjs +3360 -556
  10. package/dist/client/index.cjs.map +1 -1
  11. package/dist/client/index.d.cts +921 -18
  12. package/dist/client/index.d.ts +921 -18
  13. package/dist/client/index.js +2275 -392
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/collections-B84Vw55t.d.cts +28 -0
  16. package/dist/collections-BQbFJS3g.d.ts +28 -0
  17. package/dist/requirement-C2w45Q11.d.cts +969 -0
  18. package/dist/requirement-C2w45Q11.d.ts +969 -0
  19. package/dist/server/index.cjs +521 -37
  20. package/dist/server/index.cjs.map +1 -1
  21. package/dist/server/index.d.cts +116 -9
  22. package/dist/server/index.d.ts +116 -9
  23. package/dist/server/index.js +95 -28
  24. package/dist/server/index.js.map +1 -1
  25. package/dist/shared/index.cjs +1264 -42
  26. package/dist/shared/index.cjs.map +1 -1
  27. package/dist/shared/index.d.cts +644 -3
  28. package/dist/shared/index.d.ts +644 -3
  29. package/dist/shared/index.js +220 -5
  30. package/dist/shared/index.js.map +1 -1
  31. package/package.json +33 -30
  32. package/dist/chunk-5E3P7AMH.js.map +0 -1
  33. package/dist/chunk-CRACFEJ4.js +0 -17
  34. package/dist/chunk-CRACFEJ4.js.map +0 -1
  35. package/dist/chunk-N3WBC2VS.js.map +0 -1
  36. package/dist/chunk-V6WO67RO.js +0 -311
  37. package/dist/chunk-V6WO67RO.js.map +0 -1
  38. package/dist/client/styles.css +0 -2
  39. package/dist/requirement-BEO42QOr.d.cts +0 -387
  40. package/dist/requirement-BEO42QOr.d.ts +0 -387
@@ -1,5 +1,646 @@
1
- import { N as Newtype } from '../requirement-BEO42QOr.js';
2
- export { p as Asset, q as AssetCode, r as AssetId, A as AuthorizationCode, B as Blockchain, s as ClientId, o as ClientSecret, t as CodeChallenge, C as CodeVerifier, a as Config, i as CreateParticipationParams, u as Cursor, F as FaqItem, L as Link, M as Milestone, O as OAuthAccessToken, v as OAuthRefreshToken, n as OAuthSession, b as Offer, e as OfferDetail, d as OfferId, w as OfferOption, j as OfferOptionId, x as OfferOptionSlug, y as OfferSlug, c as PaginatedResponse, z as PaginatedResponseDto, P as PaginationParams, f as Participation, h as ParticipationId, D as ParticipationStatus, g as ParticipationsPaginationParams, E as RedirectUri, R as Requirement, G as RequirementId, k as RequirementStatusInfo, m as RequirementStatusValue, l as RequirementType, T as TermItem, W as WalletAddress, H as fetchAllPages } from '../requirement-BEO42QOr.js';
1
+ import { B as Bps, U as Uint256, N as Newtype, a as EthereumChain, F as AssetDecimals, L as AssetSymbol, c as BlockchainAmount, E as EvmWalletAddress, b as EvmContractAddress, M as SwapStatus, Q as KnownAssetSymbol, z as Erc20Asset, G as StablecoinSymbol, T as ClientId, V as RedirectUri, X as CodeChallenge, Y as PKCEState, d as CodeVerifier } from '../requirement-C2w45Q11.js';
2
+ export { Z as AllowWalletParams, _ as AllowWalletResponse, $ as Asset, a0 as AssetCode, a1 as AssetId, A as AuthorizationCode, a2 as Blockchain, I as ClientCredentialsOAuth, J as ClientSecret, C as CoinListSwapNamespace, e as Config, o as ConnectExternalWalletParams, m as CreateParticipationParams, n as CreateWalletOwnershipChallengeParams, a3 as Cursor, a4 as DocumentFormType, u as DocumentSubmission, a5 as DocumentSubmissionStatus, D as DocumentType, a6 as FaqItem, a7 as GetSwapAuthorizationParams, a8 as GetSwapPreviewParams, a9 as GetTokenAllowanceParams, aa as GetTokenBalanceParams, ab as HexEncodedTransactionData, ac as Iso2CountryCode, K as KycLevelName, v as KycToken, ad as Link, ae as MAX_UINT_256, af as Milestone, f as OAuthAccessToken, ag as OAuthRefreshToken, H as OAuthSession, g as Offer, i as OfferDetail, O as OfferId, ah as OfferOption, p as OfferOptionAddress, r as OfferOptionAddressId, q as OfferOptionId, ai as OfferOptionSlug, aj as OfferSlug, h as PaginatedResponse, ak as PaginatedResponseDto, P as PaginationParams, j as Participation, l as ParticipationId, al as ParticipationStatus, k as ParticipationsPaginationParams, t as Pii, am as PiiAddress, an as PiiJurisdiction, ao as PiiKind, R as Requirement, ap as RequirementActionNeededReason, aq as RequirementId, s as RequirementStatusInfo, y as RequirementStatusValue, x as RequirementType, ar as SwapAuthorization, as as SwapContractRef, S as SwapNamespaceImpl, at as SwapPreview, au as TermItem, av as TokenAllowance, aw as TokenBalance, ax as WalletAddress, w as WalletChallengeType, W as WalletOwnershipChallenge, ay as WalletProtocol, az as assertUint256, aA as fetchAllPages } from '../requirement-C2w45Q11.js';
3
+ import { Hash, TransactionReceipt } from 'viem';
4
+ import { S as SwapQuote } from '../collections-BQbFJS3g.js';
5
+ export { N as NonEmptyArray } from '../collections-BQbFJS3g.js';
6
+
7
+ /**
8
+ * Minimal ERC-20 ABI the SDK writes against (mirrors viem's `erc20Abi`). The
9
+ * swap flow uses `approve`; `allowance`/`balanceOf`/`decimals`/`symbol`/`name`
10
+ * are included so reads share a single SDK-owned ABI.
11
+ */
12
+ declare const ERC20_ABI: readonly [{
13
+ readonly type: "function";
14
+ readonly name: "allowance";
15
+ readonly inputs: readonly [{
16
+ readonly name: "owner";
17
+ readonly type: "address";
18
+ }, {
19
+ readonly name: "spender";
20
+ readonly type: "address";
21
+ }];
22
+ readonly outputs: readonly [{
23
+ readonly name: "";
24
+ readonly type: "uint256";
25
+ }];
26
+ readonly stateMutability: "view";
27
+ }, {
28
+ readonly type: "function";
29
+ readonly name: "approve";
30
+ readonly inputs: readonly [{
31
+ readonly name: "spender";
32
+ readonly type: "address";
33
+ }, {
34
+ readonly name: "amount";
35
+ readonly type: "uint256";
36
+ }];
37
+ readonly outputs: readonly [{
38
+ readonly name: "";
39
+ readonly type: "bool";
40
+ }];
41
+ readonly stateMutability: "nonpayable";
42
+ }, {
43
+ readonly type: "function";
44
+ readonly name: "balanceOf";
45
+ readonly inputs: readonly [{
46
+ readonly name: "account";
47
+ readonly type: "address";
48
+ }];
49
+ readonly outputs: readonly [{
50
+ readonly name: "";
51
+ readonly type: "uint256";
52
+ }];
53
+ readonly stateMutability: "view";
54
+ }, {
55
+ readonly type: "function";
56
+ readonly name: "decimals";
57
+ readonly inputs: readonly [];
58
+ readonly outputs: readonly [{
59
+ readonly name: "";
60
+ readonly type: "uint8";
61
+ }];
62
+ readonly stateMutability: "view";
63
+ }, {
64
+ readonly type: "function";
65
+ readonly name: "name";
66
+ readonly inputs: readonly [];
67
+ readonly outputs: readonly [{
68
+ readonly name: "";
69
+ readonly type: "string";
70
+ }];
71
+ readonly stateMutability: "view";
72
+ }, {
73
+ readonly type: "function";
74
+ readonly name: "symbol";
75
+ readonly inputs: readonly [];
76
+ readonly outputs: readonly [{
77
+ readonly name: "";
78
+ readonly type: "string";
79
+ }];
80
+ readonly stateMutability: "view";
81
+ }, {
82
+ readonly type: "function";
83
+ readonly name: "totalSupply";
84
+ readonly inputs: readonly [];
85
+ readonly outputs: readonly [{
86
+ readonly name: "";
87
+ readonly type: "uint256";
88
+ }];
89
+ readonly stateMutability: "view";
90
+ }, {
91
+ readonly type: "function";
92
+ readonly name: "transfer";
93
+ readonly inputs: readonly [{
94
+ readonly name: "recipient";
95
+ readonly type: "address";
96
+ }, {
97
+ readonly name: "amount";
98
+ readonly type: "uint256";
99
+ }];
100
+ readonly outputs: readonly [{
101
+ readonly name: "";
102
+ readonly type: "bool";
103
+ }];
104
+ readonly stateMutability: "nonpayable";
105
+ }, {
106
+ readonly type: "function";
107
+ readonly name: "transferFrom";
108
+ readonly inputs: readonly [{
109
+ readonly name: "sender";
110
+ readonly type: "address";
111
+ }, {
112
+ readonly name: "recipient";
113
+ readonly type: "address";
114
+ }, {
115
+ readonly name: "amount";
116
+ readonly type: "uint256";
117
+ }];
118
+ readonly outputs: readonly [{
119
+ readonly name: "";
120
+ readonly type: "bool";
121
+ }];
122
+ readonly stateMutability: "nonpayable";
123
+ }, {
124
+ readonly type: "event";
125
+ readonly name: "Approval";
126
+ readonly inputs: readonly [{
127
+ readonly name: "owner";
128
+ readonly type: "address";
129
+ readonly indexed: true;
130
+ }, {
131
+ readonly name: "spender";
132
+ readonly type: "address";
133
+ readonly indexed: true;
134
+ }, {
135
+ readonly name: "value";
136
+ readonly type: "uint256";
137
+ readonly indexed: false;
138
+ }];
139
+ readonly anonymous: false;
140
+ }, {
141
+ readonly type: "event";
142
+ readonly name: "Transfer";
143
+ readonly inputs: readonly [{
144
+ readonly name: "from";
145
+ readonly type: "address";
146
+ readonly indexed: true;
147
+ }, {
148
+ readonly name: "to";
149
+ readonly type: "address";
150
+ readonly indexed: true;
151
+ }, {
152
+ readonly name: "value";
153
+ readonly type: "uint256";
154
+ readonly indexed: false;
155
+ }];
156
+ readonly anonymous: false;
157
+ }];
158
+
159
+ declare const SUPERSTATE_SWAP_ABI: readonly [{
160
+ readonly type: "function";
161
+ readonly name: "authorized";
162
+ readonly inputs: readonly [{
163
+ readonly name: "user";
164
+ readonly type: "address";
165
+ readonly internalType: "address";
166
+ }];
167
+ readonly outputs: readonly [{
168
+ readonly name: "";
169
+ readonly type: "bool";
170
+ readonly internalType: "bool";
171
+ }];
172
+ readonly stateMutability: "view";
173
+ }, {
174
+ readonly type: "function";
175
+ readonly name: "stopped";
176
+ readonly inputs: readonly [];
177
+ readonly outputs: readonly [{
178
+ readonly name: "";
179
+ readonly type: "uint256";
180
+ readonly internalType: "uint256";
181
+ }];
182
+ readonly stateMutability: "view";
183
+ }, {
184
+ readonly type: "function";
185
+ readonly name: "SWAP_LEVEL";
186
+ readonly inputs: readonly [];
187
+ readonly outputs: readonly [{
188
+ readonly name: "";
189
+ readonly type: "uint256";
190
+ readonly internalType: "uint256";
191
+ }];
192
+ readonly stateMutability: "view";
193
+ }, {
194
+ readonly type: "function";
195
+ readonly name: "preview";
196
+ readonly inputs: readonly [{
197
+ readonly name: "token";
198
+ readonly type: "address";
199
+ readonly internalType: "address";
200
+ }, {
201
+ readonly name: "amount";
202
+ readonly type: "uint256";
203
+ readonly internalType: "uint256";
204
+ }];
205
+ readonly outputs: readonly [{
206
+ readonly name: "";
207
+ readonly type: "tuple";
208
+ readonly internalType: "struct Preview";
209
+ readonly components: readonly [{
210
+ readonly name: "input";
211
+ readonly type: "uint256";
212
+ readonly internalType: "uint256";
213
+ }, {
214
+ readonly name: "fee";
215
+ readonly type: "uint256";
216
+ readonly internalType: "uint256";
217
+ }, {
218
+ readonly name: "output";
219
+ readonly type: "uint256";
220
+ readonly internalType: "uint256";
221
+ }];
222
+ }];
223
+ readonly stateMutability: "view";
224
+ }, {
225
+ readonly type: "function";
226
+ readonly name: "swap";
227
+ readonly inputs: readonly [{
228
+ readonly name: "token";
229
+ readonly type: "address";
230
+ readonly internalType: "address";
231
+ }, {
232
+ readonly name: "amount";
233
+ readonly type: "uint256";
234
+ readonly internalType: "uint256";
235
+ }, {
236
+ readonly name: "slip";
237
+ readonly type: "uint256";
238
+ readonly internalType: "uint256";
239
+ }];
240
+ readonly outputs: readonly [{
241
+ readonly name: "";
242
+ readonly type: "uint256";
243
+ readonly internalType: "uint256";
244
+ }];
245
+ readonly stateMutability: "nonpayable";
246
+ }, {
247
+ readonly type: "function";
248
+ readonly name: "tokenBalance";
249
+ readonly inputs: readonly [{
250
+ readonly name: "token";
251
+ readonly type: "address";
252
+ readonly internalType: "address";
253
+ }];
254
+ readonly outputs: readonly [{
255
+ readonly name: "";
256
+ readonly type: "uint256";
257
+ readonly internalType: "uint256";
258
+ }];
259
+ readonly stateMutability: "view";
260
+ }, {
261
+ readonly type: "function";
262
+ readonly name: "outputToken";
263
+ readonly inputs: readonly [];
264
+ readonly outputs: readonly [{
265
+ readonly name: "";
266
+ readonly type: "address";
267
+ readonly internalType: "address";
268
+ }];
269
+ readonly stateMutability: "view";
270
+ }, {
271
+ readonly type: "function";
272
+ readonly name: "outputTokenBalance";
273
+ readonly inputs: readonly [];
274
+ readonly outputs: readonly [{
275
+ readonly name: "";
276
+ readonly type: "uint256";
277
+ readonly internalType: "uint256";
278
+ }];
279
+ readonly stateMutability: "view";
280
+ }, {
281
+ readonly type: "function";
282
+ readonly name: "totals";
283
+ readonly inputs: readonly [{
284
+ readonly name: "token";
285
+ readonly type: "address";
286
+ readonly internalType: "address";
287
+ }];
288
+ readonly outputs: readonly [{
289
+ readonly name: "";
290
+ readonly type: "tuple";
291
+ readonly internalType: "struct SwapTotal";
292
+ readonly components: readonly [{
293
+ readonly name: "inputSum";
294
+ readonly type: "uint256";
295
+ readonly internalType: "uint256";
296
+ }, {
297
+ readonly name: "feeSum";
298
+ readonly type: "uint256";
299
+ readonly internalType: "uint256";
300
+ }, {
301
+ readonly name: "outputSum";
302
+ readonly type: "uint256";
303
+ readonly internalType: "uint256";
304
+ }, {
305
+ readonly name: "count";
306
+ readonly type: "uint256";
307
+ readonly internalType: "uint256";
308
+ }];
309
+ }];
310
+ readonly stateMutability: "view";
311
+ }, {
312
+ readonly type: "function";
313
+ readonly name: "totals";
314
+ readonly inputs: readonly [{
315
+ readonly name: "user";
316
+ readonly type: "address";
317
+ readonly internalType: "address";
318
+ }, {
319
+ readonly name: "token";
320
+ readonly type: "address";
321
+ readonly internalType: "address";
322
+ }];
323
+ readonly outputs: readonly [{
324
+ readonly name: "";
325
+ readonly type: "tuple";
326
+ readonly internalType: "struct SwapTotal";
327
+ readonly components: readonly [{
328
+ readonly name: "inputSum";
329
+ readonly type: "uint256";
330
+ readonly internalType: "uint256";
331
+ }, {
332
+ readonly name: "feeSum";
333
+ readonly type: "uint256";
334
+ readonly internalType: "uint256";
335
+ }, {
336
+ readonly name: "outputSum";
337
+ readonly type: "uint256";
338
+ readonly internalType: "uint256";
339
+ }, {
340
+ readonly name: "count";
341
+ readonly type: "uint256";
342
+ readonly internalType: "uint256";
343
+ }];
344
+ }];
345
+ readonly stateMutability: "view";
346
+ }, {
347
+ readonly type: "function";
348
+ readonly name: "transfer";
349
+ readonly inputs: readonly [{
350
+ readonly name: "to";
351
+ readonly type: "address";
352
+ readonly internalType: "address";
353
+ }, {
354
+ readonly name: "amount";
355
+ readonly type: "uint256";
356
+ readonly internalType: "uint256";
357
+ }];
358
+ readonly outputs: readonly [{
359
+ readonly name: "";
360
+ readonly type: "bool";
361
+ readonly internalType: "bool";
362
+ }];
363
+ readonly stateMutability: "nonpayable";
364
+ }, {
365
+ readonly type: "function";
366
+ readonly name: "transfer";
367
+ readonly inputs: readonly [{
368
+ readonly name: "to";
369
+ readonly type: "address";
370
+ readonly internalType: "address";
371
+ }, {
372
+ readonly name: "token";
373
+ readonly type: "address";
374
+ readonly internalType: "address";
375
+ }, {
376
+ readonly name: "amount";
377
+ readonly type: "uint256";
378
+ readonly internalType: "uint256";
379
+ }];
380
+ readonly outputs: readonly [{
381
+ readonly name: "";
382
+ readonly type: "bool";
383
+ readonly internalType: "bool";
384
+ }];
385
+ readonly stateMutability: "nonpayable";
386
+ }, {
387
+ readonly type: "function";
388
+ readonly name: "setBps";
389
+ readonly inputs: readonly [{
390
+ readonly name: "points";
391
+ readonly type: "uint256";
392
+ readonly internalType: "uint256";
393
+ }];
394
+ readonly outputs: readonly [{
395
+ readonly name: "";
396
+ readonly type: "bool";
397
+ readonly internalType: "bool";
398
+ }];
399
+ readonly stateMutability: "nonpayable";
400
+ }, {
401
+ readonly type: "event";
402
+ readonly name: "Swapped";
403
+ readonly inputs: readonly [{
404
+ readonly name: "user";
405
+ readonly type: "address";
406
+ readonly indexed: true;
407
+ readonly internalType: "address";
408
+ }, {
409
+ readonly name: "inputToken";
410
+ readonly type: "address";
411
+ readonly indexed: true;
412
+ readonly internalType: "address";
413
+ }, {
414
+ readonly name: "outputToken";
415
+ readonly type: "address";
416
+ readonly indexed: true;
417
+ readonly internalType: "address";
418
+ }, {
419
+ readonly name: "inputAmount";
420
+ readonly type: "uint256";
421
+ readonly indexed: false;
422
+ readonly internalType: "uint256";
423
+ }, {
424
+ readonly name: "outputAmount";
425
+ readonly type: "uint256";
426
+ readonly indexed: false;
427
+ readonly internalType: "uint256";
428
+ }];
429
+ readonly anonymous: false;
430
+ }, {
431
+ readonly type: "event";
432
+ readonly name: "Transferred";
433
+ readonly inputs: readonly [{
434
+ readonly name: "to";
435
+ readonly type: "address";
436
+ readonly indexed: true;
437
+ readonly internalType: "address";
438
+ }, {
439
+ readonly name: "token";
440
+ readonly type: "address";
441
+ readonly indexed: true;
442
+ readonly internalType: "address";
443
+ }, {
444
+ readonly name: "amount";
445
+ readonly type: "uint256";
446
+ readonly indexed: false;
447
+ readonly internalType: "uint256";
448
+ }];
449
+ readonly anonymous: false;
450
+ }, {
451
+ readonly type: "error";
452
+ readonly name: "InvalidAddress";
453
+ readonly inputs: readonly [];
454
+ }, {
455
+ readonly type: "error";
456
+ readonly name: "InsufficientAmount";
457
+ readonly inputs: readonly [];
458
+ }, {
459
+ readonly type: "error";
460
+ readonly name: "InvalidAmount";
461
+ readonly inputs: readonly [];
462
+ }, {
463
+ readonly type: "error";
464
+ readonly name: "SwapFailed";
465
+ readonly inputs: readonly [{
466
+ readonly name: "user";
467
+ readonly type: "address";
468
+ readonly internalType: "address";
469
+ }, {
470
+ readonly name: "token";
471
+ readonly type: "address";
472
+ readonly internalType: "address";
473
+ }];
474
+ }];
475
+
476
+ /** Basis-point denominator: 10_000 bps = 100%. */
477
+ declare const BPS_DENOM: Bps;
478
+ /**
479
+ * Applies a basis-point fraction to an amount, flooring the result.
480
+ * `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an
481
+ * overflow (bps far above BPS_DENOM) or a negative product is rejected.
482
+ */
483
+ declare function applyBps(amount: Uint256, bps: Bps): Uint256;
484
+
485
+ type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
486
+ declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
487
+ type FormattedPercentUi = Newtype<string, 'FormattedPercentUi'>;
488
+ declare const FormattedPercentUi: (value: string) => FormattedPercentUi;
489
+ type TxExplorerUrl = Newtype<string, 'TxExplorerUrl'>;
490
+ declare const TxExplorerUrl: (value: string) => TxExplorerUrl;
491
+ /**
492
+ * A wallet address shortened for display (e.g. `0x1234…5678`). Keeps a
493
+ * `0x${string}` base but drops the runtime `0x` narrowing.
494
+ */
495
+ type ShortenedWalletAddress = Newtype<`0x${string}`, 'ShortenedWalletAddress'>;
496
+ declare const ShortenedWalletAddress: (value: string) => ShortenedWalletAddress;
497
+ type FormattedAmountAssetUi = Newtype<string, 'FormattedAmountAssetUi'>;
498
+ declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
499
+ type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
500
+ declare const AssetIconUrl: (value: string) => AssetIconUrl;
501
+
502
+ declare function getChainId(chain: EthereumChain): number;
503
+ declare function getNetworkName(chain: EthereumChain): string;
504
+ declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
505
+
506
+ declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
507
+ type FormatAmountOptions = {
508
+ maxFractionDigits?: AssetDecimals;
509
+ };
510
+ declare function formatAmount(amount: BlockchainAmount, locale: string, options?: FormatAmountOptions): FormattedAmountUi;
511
+ declare function formatRawAmount(amount: BlockchainAmount): string;
512
+ /**
513
+ * Formats a {@link BlockchainAmount} using compact notation (e.g. `1.37B`,
514
+ * `5M`). Compact notation only surfaces a couple of significant decimals, so
515
+ * the bigint → number narrowing here is intentional and safe: full precision
516
+ * is deliberately dropped in favour of a human-readable summary value.
517
+ */
518
+ declare function formatCompactAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
519
+ declare function formatBpsAsPercent(bps: Bps, locale: string): FormattedPercentUi;
520
+ declare function usdAmount(amount: FormattedAmountUi): FormattedAmountAssetUi;
521
+ declare function assetAmount(amount: FormattedAmountUi, symbol: AssetSymbol): FormattedAmountAssetUi;
522
+ /** Placeholder shown when an amount is unavailable (e.g. a loading quote). */
523
+ declare const NA_AMOUNT_ASSET_UI: FormattedAmountAssetUi;
524
+ /**
525
+ * Formats a USD amount capped at 2 fractional digits, falling back to the
526
+ * {@link NA_AMOUNT_ASSET_UI} placeholder when the amount is absent.
527
+ */
528
+ declare function formattedUsdPrice(amount: BlockchainAmount | null, locale: string): FormattedAmountAssetUi;
529
+ /** Formats a quote's implied price per output token as a USD amount. */
530
+ declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
531
+
532
+ /** A typed, i18n-agnostic reason a raw amount string failed to parse. */
533
+ type AmountParseErrorReason = {
534
+ type: 'empty';
535
+ } | {
536
+ type: 'negative';
537
+ } | {
538
+ type: 'invalid-format';
539
+ } | {
540
+ type: 'too-many-decimals';
541
+ maxDecimals: AssetDecimals;
542
+ };
543
+ type AmountParseResult = {
544
+ valid: true;
545
+ amount: BlockchainAmount;
546
+ } | {
547
+ valid: false;
548
+ reason: AmountParseErrorReason;
549
+ };
550
+ /**
551
+ * Parses a user-entered decimal string into a {@link BlockchainAmount} at the
552
+ * given token decimals. Rejects scientific notation, negatives, malformed
553
+ * input, and more fractional digits than the token supports — surfacing a
554
+ * typed {@link AmountParseErrorReason} so callers own the display copy.
555
+ */
556
+ declare function parseBlockchainAmount(amount: string, decimals: AssetDecimals): AmountParseResult;
557
+
558
+ declare const SUPERSTATE_TOS_URL = "https://superstate.com/terms";
559
+ /** Poll interval for refreshing on-chain swap quotes and balances. */
560
+ declare const SWAP_POLL_INTERVAL_MS = 15000;
561
+ /**
562
+ * Notional input used to derive a display price-per-share when the user has
563
+ * not yet entered an amount (1 USDC at 6 decimals).
564
+ */
565
+ declare const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
566
+ /** Slippage tolerances offered in the review step, in basis points. */
567
+ declare const SLIPPAGE_OPTIONS_BPS: Bps[];
568
+ /** Default slippage tolerance (0.5%). */
569
+ declare const DEFAULT_SLIPPAGE_BPS: Bps;
570
+ /**
571
+ * The Superstate swap contract on Ethereum Sepolia. The mainnet address is not
572
+ * yet finalized upstream, so it is intentionally not exported — callers pass
573
+ * the contract address explicitly.
574
+ */
575
+ declare const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress;
576
+
577
+ /**
578
+ * Price of 1 output token in USD, assuming the input token is a $1 stablecoin.
579
+ *
580
+ * `raw_price = inputTokenAmount.raw × 10^outputDecimals ÷ outputTokenAmount.raw`
581
+ *
582
+ * The multiplication happens before the division so we never lose precision to
583
+ * integer truncation early. This mirrors standard fixed-point practice on-chain.
584
+ * Returned decimals match the input token decimals (always the stablecoin's 6).
585
+ */
586
+ declare function computePrice({ inputTokenAmount, outputTokenAmount, }: SwapQuote): BlockchainAmount | null;
587
+ /**
588
+ * Applies slippage to an amount, returning the minimum acceptable amount:
589
+ * `amount × (BPS_DENOM − slippage) / BPS_DENOM`. Throws when `slippage` exceeds
590
+ * `BPS_DENOM` (the retained fraction would be negative).
591
+ */
592
+ declare function computeSlip(amount: BlockchainAmount, slippage: Bps): BlockchainAmount;
593
+
594
+ /**
595
+ * Interprets the on-chain swap availability read from `stopped()` and
596
+ * `SWAP_LEVEL()`.
597
+ *
598
+ * The contract tracks paused operations as a bitmask in `stopped`. The swap is
599
+ * stopped when the SWAP_LEVEL flag is set:
600
+ *
601
+ * (stopped & SWAP_LEVEL) != 0 -> stopped (not active)
602
+ */
603
+ declare function isStopped(status: SwapStatus): boolean;
604
+
605
+ /**
606
+ * Decodes the confirmed output amount from the `Swapped` event in a swap
607
+ * transaction receipt.
608
+ *
609
+ * Returns `null` when the event is absent or the amount is not a valid uint256
610
+ * so callers can fall back to the quote's expected output — the swap already
611
+ * confirmed on-chain, so a missing/undecodable event should not fail the flow.
612
+ */
613
+ declare function decodeSwappedOutputAmount(receipt: TransactionReceipt, outputDecimals: AssetDecimals): BlockchainAmount | null;
614
+
615
+ declare const USDC_SYMBOL: StablecoinSymbol;
616
+ declare const USDC: Erc20Asset;
617
+ declare const USDT_SYMBOL: StablecoinSymbol;
618
+ declare const USDT: Erc20Asset;
619
+ /** Lookups for the stablecoins the SDK's swap flows support out of the box. */
620
+ declare const TOKEN_REGISTRY: {
621
+ erc20: (symbol: KnownAssetSymbol) => Erc20Asset;
622
+ contractAddress: (symbol: KnownAssetSymbol, chain: EthereumChain) => EvmContractAddress;
623
+ };
624
+
625
+ type PKCEParams = {
626
+ clientId: ClientId;
627
+ responseType: 'code';
628
+ redirectUri: RedirectUri;
629
+ codeChallenge: CodeChallenge;
630
+ codeChallengeMethod: 'S256';
631
+ state: PKCEState;
632
+ codeVerifier: CodeVerifier;
633
+ };
634
+ type PKCEConfig = {
635
+ clientId: ClientId;
636
+ redirectUri: RedirectUri;
637
+ };
638
+ /**
639
+ * Generates PKCE parameters for an OAuth2 authorization code flow.
640
+ * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use
641
+ * in server-side code and Next.js middleware.
642
+ */
643
+ declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
3
644
 
4
645
  /**
5
646
  * Error thrown when a feature or code path is not yet implemented.
@@ -32,4 +673,4 @@ declare const User: {
32
673
  fromDto: (dto: UserDto) => User;
33
674
  };
34
675
 
35
- export { NotAuthenticatedError, NotImplementedError, User, UserEmail, UserId };
676
+ export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetIconUrl, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, ClientId, CodeChallenge, CodeVerifier, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, KnownAssetSymbol, NA_AMOUNT_ASSET_UI, NotAuthenticatedError, NotImplementedError, type PKCEConfig, type PKCEParams, PKCEState, RedirectUri, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SUPERSTATE_TOS_URL, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, applyBps, assetAmount, computePrice, computeSlip, decodeSwappedOutputAmount, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, generatePKCEParams, getChainId, getNetworkName, isStopped, parseBlockchainAmount, shortenAddress, txExplorerUrl, usdAmount };