@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
package/README.md CHANGED
@@ -5,3 +5,35 @@ This package is documented at:
5
5
  https://docs.coinlist.co/
6
6
 
7
7
  Please refer to the docs site for installation, configuration, and integration guides.
8
+
9
+ ## Local development
10
+
11
+ The toolchain (Node 24, TypeScript) is pinned by `flake.nix` and frozen by `flake.lock`.
12
+
13
+ Prerequisites:
14
+
15
+ 1. Nix — install with the [Determinate Systems installer](https://github.com/DeterminateSystems/nix-installer),
16
+ which enables flakes out of the box and supports clean uninstalls:
17
+
18
+ ```bash
19
+ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
20
+ ```
21
+
22
+ 2. [direnv](https://direnv.net/) and [nix-direnv](https://github.com/nix-community/nix-direnv)
23
+ (direnv on its own does not provide `use flake`).
24
+
25
+ ```bash
26
+ direnv allow # activates the dev shell on every cd into the repo
27
+ ```
28
+
29
+ Without direnv, enter the same shell manually:
30
+
31
+ ```bash
32
+ nix develop
33
+ ```
34
+
35
+ The flake provides the toolchain, not `node_modules` — install JS dependencies as usual:
36
+
37
+ ```bash
38
+ npm ci
39
+ ```
@@ -2,16 +2,55 @@ import {
2
2
  AssetDecimals,
3
3
  BlockchainAmount,
4
4
  Bps,
5
+ DecimalString,
5
6
  EvmContractAddress,
6
7
  MAX_UINT_256,
8
+ NA_AMOUNT_ASSET_UI,
7
9
  StablecoinSymbol,
10
+ ValidationError,
8
11
  arrayBufferToBase64Url,
9
12
  assertUint256,
13
+ fetchOfferDetails,
14
+ fetchOffers,
15
+ fetchOffersPage,
16
+ formattedUsdPrice,
10
17
  generateSecureRandomBase64Url,
11
18
  sha256
12
- } from "./chunk-UOHD7US2.js";
19
+ } from "./chunk-UIIXXLA7.js";
20
+
21
+ // src/shared/types/oauth.ts
22
+ var AuthorizationCode = (value) => value;
23
+ var CodeVerifier = (value) => value;
24
+ var CodeChallenge = (value) => value;
25
+ var PKCEState = (value) => value;
26
+ var RedirectUri = (value) => value;
27
+ var ClientId = (value) => value;
28
+ var ClientSecret = (value) => value;
29
+
30
+ // src/shared/core/auth/pkce.ts
31
+ async function generatePKCEParams(config) {
32
+ const state = generateSecureRandomBase64Url(32);
33
+ const codeVerifier = generateSecureRandomBase64Url(32);
34
+ const codeChallengeRaw = await sha256(codeVerifier);
35
+ const codeChallenge = arrayBufferToBase64Url(codeChallengeRaw, false);
36
+ return {
37
+ clientId: config.clientId,
38
+ responseType: "code",
39
+ redirectUri: config.redirectUri,
40
+ codeChallenge: CodeChallenge(codeChallenge),
41
+ codeChallengeMethod: "S256",
42
+ state: PKCEState(state),
43
+ codeVerifier: CodeVerifier(codeVerifier)
44
+ };
45
+ }
13
46
 
14
- // src/shared/core/blockchain/abis/erc20.ts
47
+ // src/shared/core/blockchain/bps.ts
48
+ var BPS_DENOM = Bps(10000n);
49
+ function applyBps(amount, bps) {
50
+ return assertUint256(amount * bps / BPS_DENOM);
51
+ }
52
+
53
+ // src/shared/core/blockchain/erc20/abi.ts
15
54
  var ERC20_ABI = [
16
55
  {
17
56
  type: "function",
@@ -111,7 +150,98 @@ var ERC20_ABI = [
111
150
  }
112
151
  ];
113
152
 
114
- // src/shared/core/blockchain/abis/superstate-swap.ts
153
+ // src/shared/core/blockchain/token-registry.ts
154
+ var USDC_SYMBOL = StablecoinSymbol("USDC");
155
+ var USDC = {
156
+ name: "USD Coin",
157
+ symbol: USDC_SYMBOL,
158
+ decimals: AssetDecimals(6)
159
+ };
160
+ var USDT_SYMBOL = StablecoinSymbol("USDT");
161
+ var USDT = {
162
+ name: "Tether USD",
163
+ symbol: USDT_SYMBOL,
164
+ decimals: AssetDecimals(6)
165
+ };
166
+ var USDC_ADDRESSES = {
167
+ ethereum_mainnet: EvmContractAddress(
168
+ "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
169
+ ),
170
+ ethereum_sepolia: EvmContractAddress(
171
+ "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
172
+ )
173
+ };
174
+ var USDT_ADDRESSES = {
175
+ ethereum_mainnet: EvmContractAddress(
176
+ "0xdac17f958d2ee523a2206206994597c13d831ec7"
177
+ ),
178
+ ethereum_sepolia: EvmContractAddress(
179
+ "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06"
180
+ )
181
+ };
182
+ var TOKEN_REGISTRY = {
183
+ erc20: (symbol) => {
184
+ switch (symbol) {
185
+ case "USDC":
186
+ return USDC;
187
+ case "USDT":
188
+ return USDT;
189
+ default:
190
+ throw new Error(`Unknown asset symbol: ${symbol}`);
191
+ }
192
+ },
193
+ contractAddress: (symbol, chain) => {
194
+ switch (symbol) {
195
+ case "USDC":
196
+ return USDC_ADDRESSES[chain];
197
+ case "USDT":
198
+ return USDT_ADDRESSES[chain];
199
+ default:
200
+ throw new Error(`Unknown asset symbol: ${symbol}`);
201
+ }
202
+ }
203
+ };
204
+
205
+ // src/shared/core/checkout/ondo/constants.ts
206
+ var ONDO_SWAP_CONTRACT_ADDRESSES = {
207
+ ethereum_sepolia: EvmContractAddress(
208
+ "0xFF9c5Ade32d9B4102469Bd5F3817CB0061b25feC"
209
+ )
210
+ };
211
+ function ondoSwapContractAddress(chain) {
212
+ return ONDO_SWAP_CONTRACT_ADDRESSES[chain] ?? null;
213
+ }
214
+ var ONDO_POLL_INTERVAL_MS = 15e3;
215
+ var ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5e3;
216
+ var DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE = DecimalString("1000");
217
+ var ONDO_SUPPORTED_INPUT_ASSETS = [
218
+ USDC_SYMBOL
219
+ ];
220
+
221
+ // src/shared/core/checkout/ondo/math.ts
222
+ function computeOndoPrice(transaction) {
223
+ const { notionalValue, receiveOutputAmount } = transaction;
224
+ if (receiveOutputAmount.raw <= 0n) {
225
+ throw new ValidationError(
226
+ "Ondo price: receiveOutputAmount must be greater than zero"
227
+ );
228
+ }
229
+ const scaled = notionalValue.raw * 10n ** BigInt(receiveOutputAmount.decimals);
230
+ const raw = scaled / receiveOutputAmount.raw;
231
+ return BlockchainAmount({
232
+ raw: assertPriceFits(raw),
233
+ decimals: notionalValue.decimals
234
+ });
235
+ }
236
+ function assertPriceFits(raw) {
237
+ try {
238
+ return assertUint256(raw);
239
+ } catch {
240
+ throw new ValidationError(`Ondo price: out of uint256 bounds (${raw})`);
241
+ }
242
+ }
243
+
244
+ // src/shared/core/checkout/superstate/blockchain/abi.ts
115
245
  var SUPERSTATE_SWAP_ABI = [
116
246
  {
117
247
  type: "function",
@@ -333,65 +463,7 @@ var SUPERSTATE_SWAP_ABI = [
333
463
  }
334
464
  ];
335
465
 
336
- // src/shared/core/blockchain/bps.ts
337
- var BPS_DENOM = Bps(10000n);
338
- function applyBps(amount, bps) {
339
- return assertUint256(amount * bps / BPS_DENOM);
340
- }
341
-
342
- // src/shared/types/blockchain/ui.ts
343
- var FormattedAmountUi = (value) => value;
344
- var FormattedPercentUi = (value) => value;
345
- var TxExplorerUrl = (value) => value;
346
- var ShortenedWalletAddress = (value) => value;
347
- var FormattedAmountAssetUi = (value) => value;
348
- var AssetIconUrl = (value) => value;
349
-
350
- // src/shared/core/blockchain/chain.ts
351
- function getChainId(chain) {
352
- switch (chain) {
353
- case "ethereum_mainnet":
354
- return 1;
355
- case "ethereum_sepolia":
356
- return 11155111;
357
- default: {
358
- const _exhaustive = chain;
359
- return _exhaustive;
360
- }
361
- }
362
- }
363
- function getNetworkName(chain) {
364
- switch (chain) {
365
- case "ethereum_mainnet":
366
- return "Ethereum";
367
- case "ethereum_sepolia":
368
- return "Ethereum Sepolia";
369
- default: {
370
- const _exhaustive = chain;
371
- return _exhaustive;
372
- }
373
- }
374
- }
375
- function txExplorerUrl(chain, txHash) {
376
- return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);
377
- }
378
- function explorerBaseUrl(chain) {
379
- switch (chain) {
380
- case "ethereum_mainnet":
381
- return "https://etherscan.io";
382
- case "ethereum_sepolia":
383
- return "https://sepolia.etherscan.io";
384
- default: {
385
- const _exhaustive = chain;
386
- return _exhaustive;
387
- }
388
- }
389
- }
390
-
391
- // src/shared/core/blockchain/formatters.ts
392
- import { formatUnits } from "viem";
393
-
394
- // src/shared/core/blockchain/swap/math.ts
466
+ // src/shared/core/checkout/superstate/blockchain/math.ts
395
467
  function computePrice({
396
468
  inputTokenAmount,
397
469
  outputTokenAmount
@@ -409,149 +481,7 @@ function computeSlip(amount, slippage) {
409
481
  return BlockchainAmount({ raw: slipRaw, decimals: amount.decimals });
410
482
  }
411
483
 
412
- // src/shared/core/blockchain/formatters.ts
413
- function shortenAddress(address) {
414
- const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
415
- return ShortenedWalletAddress(short);
416
- }
417
- function formatAmount(amount, locale, options) {
418
- const decimal = formatRawAmount(amount);
419
- let [integerPart, fractionPart = ""] = decimal.split(".");
420
- const maxFractionDigits = options?.maxFractionDigits;
421
- const minFractionDigits = maxFractionDigits !== void 0 ? Math.min(maxFractionDigits, amount.decimals) : Math.min(2, amount.decimals);
422
- if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
423
- ({ integerPart, fractionPart } = roundFractionHalfUp(
424
- integerPart,
425
- fractionPart,
426
- maxFractionDigits
427
- ));
428
- }
429
- const fraction = minFractionDigits === 0 ? "" : fractionPart.padEnd(minFractionDigits, "0");
430
- const integerFormatted = BigInt(integerPart).toLocaleString(locale);
431
- if (minFractionDigits === 0 && fraction === "") {
432
- return FormattedAmountUi(integerFormatted);
433
- }
434
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
435
- return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
436
- }
437
- function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
438
- if (fractionPart.length <= maxFractionDigits) {
439
- return { integerPart, fractionPart };
440
- }
441
- if (maxFractionDigits === 0) {
442
- const roundUp = fractionPart[0] >= "5";
443
- const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
444
- return { integerPart: integer.toString(), fractionPart: "" };
445
- }
446
- const trimmed = fractionPart.slice(0, maxFractionDigits);
447
- if (fractionPart[maxFractionDigits] < "5") {
448
- return { integerPart, fractionPart: trimmed };
449
- }
450
- const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
451
- let carry = 1;
452
- for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
453
- const sum = digits[i] + carry;
454
- if (sum === 10) {
455
- digits[i] = 0;
456
- carry = 1;
457
- } else {
458
- digits[i] = sum;
459
- carry = 0;
460
- }
461
- }
462
- return {
463
- integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
464
- fractionPart: digits.join("")
465
- };
466
- }
467
- function formatRawAmount(amount) {
468
- return formatUnits(amount.raw, amount.decimals);
469
- }
470
- function formatCompactAmount(amount, locale) {
471
- const value = Number(formatRawAmount(amount));
472
- const formatted = new Intl.NumberFormat(locale, {
473
- notation: "compact",
474
- maximumFractionDigits: 2
475
- }).format(value);
476
- return FormattedAmountUi(formatted);
477
- }
478
- function formatBpsAsPercent(bps, locale) {
479
- const whole = bps / 100n;
480
- const fraction = bps % 100n;
481
- const wholeFormatted = whole.toLocaleString(locale);
482
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
483
- if (fraction === 0n) {
484
- return FormattedPercentUi(`${wholeFormatted}%`);
485
- }
486
- const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
487
- return FormattedPercentUi(
488
- `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
489
- );
490
- }
491
- function usdAmount(amount) {
492
- return FormattedAmountAssetUi(`$${amount}`);
493
- }
494
- function assetAmount(amount, symbol) {
495
- return FormattedAmountAssetUi(`${amount} ${symbol}`);
496
- }
497
- var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
498
- var USD_FRACTION_DIGITS = AssetDecimals(2);
499
- function formattedUsdPrice(amount, locale) {
500
- if (!amount) return NA_AMOUNT_ASSET_UI;
501
- return usdAmount(
502
- formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
503
- );
504
- }
505
- function formattedPricePerShare(quote, locale) {
506
- if (!quote) return NA_AMOUNT_ASSET_UI;
507
- return formattedUsdPrice(computePrice(quote), locale);
508
- }
509
-
510
- // src/shared/core/blockchain/math.ts
511
- import { parseUnits } from "viem";
512
- function parseBlockchainAmount(amount, decimals) {
513
- const trimmed = amount.trim();
514
- if (trimmed === "") return { valid: false, reason: { type: "empty" } };
515
- if (trimmed.startsWith("-")) {
516
- return { valid: false, reason: { type: "negative" } };
517
- }
518
- if (/[eE]/.test(trimmed)) {
519
- return { valid: false, reason: { type: "invalid-format" } };
520
- }
521
- if (!/^\d+(\.\d+)?$/.test(trimmed)) {
522
- return { valid: false, reason: { type: "invalid-format" } };
523
- }
524
- const [, fraction = ""] = trimmed.split(".");
525
- if (fraction.length > decimals) {
526
- return {
527
- valid: false,
528
- reason: { type: "too-many-decimals", maxDecimals: decimals }
529
- };
530
- }
531
- try {
532
- return {
533
- valid: true,
534
- amount: BlockchainAmount({
535
- raw: parseUnits(trimmed, decimals),
536
- decimals
537
- })
538
- };
539
- } catch {
540
- return { valid: false, reason: { type: "invalid-format" } };
541
- }
542
- }
543
-
544
- // src/shared/core/blockchain/swap/constants.ts
545
- var SUPERSTATE_TOS_URL = "https://superstate.com/terms";
546
- var SWAP_POLL_INTERVAL_MS = 15e3;
547
- var DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
548
- var SLIPPAGE_OPTIONS_BPS = [25n, 50n, 100n, 200n, 500n].map(
549
- (n) => Bps(n)
550
- );
551
- var DEFAULT_SLIPPAGE_BPS = Bps(50n);
552
- var SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA = EvmContractAddress("0x84f8e9a6C9Cc12fe911259372EfCa5582C4ae557");
553
-
554
- // src/shared/core/blockchain/swap/quote.ts
484
+ // src/shared/core/checkout/superstate/blockchain/quote.ts
555
485
  var SwapQuote = {
556
486
  /**
557
487
  * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
@@ -571,12 +501,12 @@ var SwapQuote = {
571
501
  })
572
502
  };
573
503
 
574
- // src/shared/core/blockchain/swap/status.ts
504
+ // src/shared/core/checkout/superstate/blockchain/status.ts
575
505
  function isStopped(status) {
576
506
  return (status.stopped & status.swapLevel) !== 0n;
577
507
  }
578
508
 
579
- // src/shared/core/blockchain/swap/swapped-event.ts
509
+ // src/shared/core/checkout/superstate/blockchain/swapped-event.ts
580
510
  import { parseEventLogs } from "viem";
581
511
  function decodeSwappedOutputAmount(receipt, outputDecimals) {
582
512
  try {
@@ -594,84 +524,48 @@ function decodeSwappedOutputAmount(receipt, outputDecimals) {
594
524
  }
595
525
  }
596
526
 
597
- // src/shared/core/blockchain/token-registry.ts
598
- var USDC_SYMBOL = StablecoinSymbol("USDC");
599
- var USDC = {
600
- name: "USD Coin",
601
- symbol: USDC_SYMBOL,
602
- decimals: AssetDecimals(6)
603
- };
604
- var USDT_SYMBOL = StablecoinSymbol("USDT");
605
- var USDT = {
606
- name: "Tether USD",
607
- symbol: USDT_SYMBOL,
608
- decimals: AssetDecimals(6)
609
- };
610
- var USDC_ADDRESSES = {
611
- ethereum_mainnet: EvmContractAddress(
612
- "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
613
- ),
614
- ethereum_sepolia: EvmContractAddress(
615
- "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
616
- )
617
- };
618
- var USDT_ADDRESSES = {
619
- ethereum_mainnet: EvmContractAddress(
620
- "0xdac17f958d2ee523a2206206994597c13d831ec7"
621
- ),
622
- ethereum_sepolia: EvmContractAddress(
623
- "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06"
624
- )
625
- };
626
- var TOKEN_REGISTRY = {
627
- erc20: (symbol) => {
628
- switch (symbol) {
629
- case "USDC":
630
- return USDC;
631
- case "USDT":
632
- return USDT;
633
- default:
634
- throw new Error(`Unknown asset symbol: ${symbol}`);
635
- }
636
- },
637
- contractAddress: (symbol, chain) => {
638
- switch (symbol) {
639
- case "USDC":
640
- return USDC_ADDRESSES[chain];
641
- case "USDT":
642
- return USDT_ADDRESSES[chain];
643
- default:
644
- throw new Error(`Unknown asset symbol: ${symbol}`);
645
- }
646
- }
527
+ // src/shared/core/checkout/superstate/constants.ts
528
+ var SUPERSTATE_ISSUER_NAME = "Superstate";
529
+ var SUPERSTATE_SUPPORTED_INPUT_ASSETS = [USDC_SYMBOL];
530
+ var SWAP_POLL_INTERVAL_MS = 15e3;
531
+ var DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
532
+ var SLIPPAGE_OPTIONS_BPS = [25n, 50n, 100n, 200n, 500n].map(
533
+ (n) => Bps(n)
534
+ );
535
+ var DEFAULT_SLIPPAGE_BPS = Bps(50n);
536
+ var SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA = EvmContractAddress("0x84f8e9a6C9Cc12fe911259372EfCa5582C4ae557");
537
+ var SUPERSTATE_SWAP_CONTRACT_ADDRESSES = {
538
+ ethereum_sepolia: SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA
647
539
  };
540
+ function superstateSwapContractAddress(chain) {
541
+ return SUPERSTATE_SWAP_CONTRACT_ADDRESSES[chain] ?? null;
542
+ }
648
543
 
649
- // src/shared/types/oauth.ts
650
- var AuthorizationCode = (value) => value;
651
- var CodeVerifier = (value) => value;
652
- var CodeChallenge = (value) => value;
653
- var PKCEState = (value) => value;
654
- var RedirectUri = (value) => value;
655
- var ClientId = (value) => value;
656
- var ClientSecret = (value) => value;
657
-
658
- // src/shared/pkce.ts
659
- async function generatePKCEParams(config) {
660
- const state = generateSecureRandomBase64Url(32);
661
- const codeVerifier = generateSecureRandomBase64Url(32);
662
- const codeChallengeRaw = await sha256(codeVerifier);
663
- const codeChallenge = arrayBufferToBase64Url(codeChallengeRaw, false);
664
- return {
665
- clientId: config.clientId,
666
- responseType: "code",
667
- redirectUri: config.redirectUri,
668
- codeChallenge: CodeChallenge(codeChallenge),
669
- codeChallengeMethod: "S256",
670
- state: PKCEState(state),
671
- codeVerifier: CodeVerifier(codeVerifier)
672
- };
544
+ // src/shared/core/checkout/superstate/formatters.ts
545
+ function formattedPricePerShare(quote, locale) {
546
+ if (!quote) return NA_AMOUNT_ASSET_UI;
547
+ return formattedUsdPrice(computePrice(quote), locale);
673
548
  }
674
549
 
550
+ // src/shared/core/offers/offers-namespace.ts
551
+ var OffersNamespaceImpl = class {
552
+ constructor(ctx) {
553
+ this.ctx = ctx;
554
+ }
555
+ async list() {
556
+ await this.ctx.ensureUserAuthenticated();
557
+ return fetchOffers(this.ctx.api, void 0);
558
+ }
559
+ async listPage(params) {
560
+ await this.ctx.ensureUserAuthenticated();
561
+ return fetchOffersPage(this.ctx.api, params, void 0);
562
+ }
563
+ async get(id) {
564
+ await this.ctx.ensureUserAuthenticated();
565
+ return fetchOfferDetails(this.ctx.api, id, void 0);
566
+ }
567
+ };
568
+
675
569
  // src/shared/types/user.ts
676
570
  var UserId = (value) => value;
677
571
  var UserEmail = (value) => value;
@@ -683,56 +577,46 @@ var User = {
683
577
  };
684
578
 
685
579
  export {
580
+ AuthorizationCode,
581
+ CodeVerifier,
582
+ CodeChallenge,
583
+ PKCEState,
584
+ RedirectUri,
585
+ ClientId,
586
+ ClientSecret,
587
+ generatePKCEParams,
686
588
  ERC20_ABI,
687
- SUPERSTATE_SWAP_ABI,
688
589
  BPS_DENOM,
689
590
  applyBps,
591
+ USDC_SYMBOL,
592
+ USDC,
593
+ USDT_SYMBOL,
594
+ USDT,
595
+ TOKEN_REGISTRY,
596
+ ondoSwapContractAddress,
597
+ ONDO_POLL_INTERVAL_MS,
598
+ ONDO_QUOTE_EXPIRY_THRESHOLD_MS,
599
+ DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE,
600
+ ONDO_SUPPORTED_INPUT_ASSETS,
601
+ computeOndoPrice,
602
+ SUPERSTATE_SWAP_ABI,
690
603
  computePrice,
691
604
  computeSlip,
605
+ SwapQuote,
692
606
  isStopped,
693
607
  decodeSwappedOutputAmount,
694
- FormattedAmountUi,
695
- FormattedPercentUi,
696
- TxExplorerUrl,
697
- ShortenedWalletAddress,
698
- FormattedAmountAssetUi,
699
- AssetIconUrl,
700
- getChainId,
701
- getNetworkName,
702
- txExplorerUrl,
703
- shortenAddress,
704
- formatAmount,
705
- formatRawAmount,
706
- formatCompactAmount,
707
- formatBpsAsPercent,
708
- usdAmount,
709
- assetAmount,
710
- NA_AMOUNT_ASSET_UI,
711
- formattedUsdPrice,
712
- formattedPricePerShare,
713
- parseBlockchainAmount,
714
- SUPERSTATE_TOS_URL,
608
+ SUPERSTATE_ISSUER_NAME,
609
+ SUPERSTATE_SUPPORTED_INPUT_ASSETS,
715
610
  SWAP_POLL_INTERVAL_MS,
716
611
  DEFAULT_AMOUNT_TO_COMPUTE_PRICE,
717
612
  SLIPPAGE_OPTIONS_BPS,
718
613
  DEFAULT_SLIPPAGE_BPS,
719
614
  SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
720
- SwapQuote,
721
- USDC_SYMBOL,
722
- USDC,
723
- USDT_SYMBOL,
724
- USDT,
725
- TOKEN_REGISTRY,
726
- AuthorizationCode,
727
- CodeVerifier,
728
- CodeChallenge,
729
- PKCEState,
730
- RedirectUri,
731
- ClientId,
732
- ClientSecret,
733
- generatePKCEParams,
615
+ superstateSwapContractAddress,
616
+ formattedPricePerShare,
617
+ OffersNamespaceImpl,
734
618
  UserId,
735
619
  UserEmail,
736
620
  User
737
621
  };
738
- //# sourceMappingURL=chunk-AQVCOWOV.js.map
622
+ //# sourceMappingURL=chunk-B2HCVPCQ.js.map