@coinlist-co/react 0.12.1-rc.a230abc → 0.12.1-rc.b45777f

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 (33) hide show
  1. package/dist/{chunk-HLL7IBIS.js → chunk-3ZZCK4IT.js} +9 -9
  2. package/dist/chunk-3ZZCK4IT.js.map +1 -0
  3. package/dist/{chunk-GFLU5OMP.js → chunk-D42IQHQZ.js} +649 -640
  4. package/dist/chunk-D42IQHQZ.js.map +1 -0
  5. package/dist/{chunk-RPE7XIBV.js → chunk-ZUVVNZJJ.js} +126 -126
  6. package/dist/chunk-ZUVVNZJJ.js.map +1 -0
  7. package/dist/client/index.cjs +1368 -1321
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +231 -165
  10. package/dist/client/index.d.ts +231 -165
  11. package/dist/client/index.js +537 -500
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/{collections-DZZFrizd.d.ts → collections-CMoojQ9M.d.ts} +1 -1
  14. package/dist/{collections-CAfs2Eww.d.cts → collections-koI4cjYa.d.cts} +1 -1
  15. package/dist/{config-D19ktBr0.d.cts → config-BmK0t-XO.d.cts} +82 -17
  16. package/dist/{config-D19ktBr0.d.ts → config-BmK0t-XO.d.ts} +82 -17
  17. package/dist/server/index.cjs +242 -234
  18. package/dist/server/index.cjs.map +1 -1
  19. package/dist/server/index.d.cts +4 -4
  20. package/dist/server/index.d.ts +4 -4
  21. package/dist/server/index.js +3 -3
  22. package/dist/server/index.js.map +1 -1
  23. package/dist/{shared → universal}/index.cjs +860 -848
  24. package/dist/universal/index.cjs.map +1 -0
  25. package/dist/{shared → universal}/index.d.cts +557 -557
  26. package/dist/{shared → universal}/index.d.ts +557 -557
  27. package/dist/{shared → universal}/index.js +4 -2
  28. package/package.json +6 -5
  29. package/dist/chunk-GFLU5OMP.js.map +0 -1
  30. package/dist/chunk-HLL7IBIS.js.map +0 -1
  31. package/dist/chunk-RPE7XIBV.js.map +0 -1
  32. package/dist/shared/index.cjs.map +0 -1
  33. /package/dist/{shared → universal}/index.js.map +0 -0
@@ -171,7 +171,7 @@ module.exports = __toCommonJS(client_exports);
171
171
  // src/client/CoinListProvider.tsx
172
172
  var import_react3 = require("react");
173
173
 
174
- // src/shared/core/utils/crypto.ts
174
+ // src/universal/core/shared/utils/crypto.ts
175
175
  async function sha256(data) {
176
176
  const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
177
177
  const buffer = bytes.buffer.slice(
@@ -232,7 +232,7 @@ function getDeviceId() {
232
232
  return deviceId;
233
233
  }
234
234
 
235
- // src/shared/api/frontline/config.ts
235
+ // src/universal/api/frontline/config.ts
236
236
  var PUBLIC_API_BASE_URL = "https://api.coinlist.co";
237
237
  var HEADER_API_VERSION = "X-API-Version";
238
238
  var HEADER_USER_AGENT = "User-Agent";
@@ -245,7 +245,7 @@ var VERIFY_IDENTITY_PATH = "/verify-identity";
245
245
  var VERIFY_IDENTITY_ACCREDITATION_PATH = "/verify-identity/accreditation_full";
246
246
  var WALLET_PATH = "/wallet";
247
247
 
248
- // src/shared/api/http-attributes.ts
248
+ // src/universal/api/http-attributes.ts
249
249
  var empty = {};
250
250
  var concat = (left, right) => ({
251
251
  ...left,
@@ -324,7 +324,7 @@ function generateUserAgent() {
324
324
  return `${appInfo} (${deviceInfo}; ${devicePlatform}; ${deviceAppId}; ${finalDeviceId})`;
325
325
  }
326
326
 
327
- // src/shared/api/http.ts
327
+ // src/universal/api/http.ts
328
328
  var HttpError = class extends Error {
329
329
  constructor(response) {
330
330
  super(`Request failed with ${response.status} status`);
@@ -448,7 +448,7 @@ var Request = {
448
448
  concatAttributes
449
449
  };
450
450
 
451
- // src/shared/types/errors.ts
451
+ // src/universal/types/errors.ts
452
452
  var NotImplementedError = class extends Error {
453
453
  constructor(message = "Not implemented yet") {
454
454
  super(message);
@@ -480,7 +480,7 @@ var MathError = class extends Error {
480
480
  }
481
481
  };
482
482
 
483
- // src/shared/core/observability/log-cause.ts
483
+ // src/universal/core/shared/observability/log-cause.ts
484
484
  function classifyLogCause(error) {
485
485
  if (error instanceof HttpError) {
486
486
  return httpCause(error);
@@ -546,7 +546,7 @@ function apiErrorEventId(error) {
546
546
  return typeof eventId === "string" ? eventId : null;
547
547
  }
548
548
 
549
- // src/shared/core/observability/internal-logger.ts
549
+ // src/universal/core/shared/observability/internal-logger.ts
550
550
  function internalLogger(logger, scope) {
551
551
  return logger ? scopedLogger(logger, scope, {}) : noopInternalLogger;
552
552
  }
@@ -629,7 +629,7 @@ var noopInternalLogger = {
629
629
  wrap: (_op, _params, run) => run()
630
630
  };
631
631
 
632
- // src/shared/api/http-client.ts
632
+ // src/universal/api/http-client.ts
633
633
  var HttpClient = class {
634
634
  constructor(config, middleware = {}, logger = null, options = {}) {
635
635
  this.config = config;
@@ -785,7 +785,7 @@ function describeRequestUnredacted(request) {
785
785
  };
786
786
  }
787
787
 
788
- // src/shared/api/middleware/attach-session-middleware.ts
788
+ // src/universal/api/middleware/attach-session-middleware.ts
789
789
  function attachSessionMiddleware(fetchAccessToken) {
790
790
  return async (request) => {
791
791
  if (!Attributes.isProtected(request.attributes)) {
@@ -811,7 +811,7 @@ function attachSessionMiddleware(fetchAccessToken) {
811
811
  };
812
812
  }
813
813
 
814
- // src/shared/api/middleware/idempotency-key.ts
814
+ // src/universal/api/middleware/idempotency-key.ts
815
815
  var idempotencyKeyMiddleware = async (request) => {
816
816
  if (!Attributes.isIdempotent(request.attributes)) {
817
817
  return request;
@@ -829,7 +829,7 @@ var idempotencyKeyMiddleware = async (request) => {
829
829
  };
830
830
  };
831
831
 
832
- // src/shared/api/middleware/request-retry.ts
832
+ // src/universal/api/middleware/request-retry.ts
833
833
  var MAX_ATTEMPTS = 3;
834
834
  var INITIAL_DELAY_MS = 300;
835
835
  var MAX_DELAY_MS = 2e3;
@@ -864,7 +864,7 @@ function defaultDelay(ms) {
864
864
  }
865
865
  var requestRetryMiddleware = createRequestRetryMiddleware();
866
866
 
867
- // src/shared/api/middleware/session-renewal.ts
867
+ // src/universal/api/middleware/session-renewal.ts
868
868
  function renewSessionMiddleware(fetchAccessToken) {
869
869
  return async ({ request, response, retry }) => {
870
870
  if (response.status !== 401) {
@@ -889,7 +889,7 @@ function renewSessionMiddleware(fetchAccessToken) {
889
889
  };
890
890
  }
891
891
 
892
- // src/shared/api/authenticated-api-client.ts
892
+ // src/universal/api/authenticated-api-client.ts
893
893
  var AuthenticatedApiClient = class {
894
894
  constructor(config, fetchAccessToken, additionalBeforeRequest = [], logger = null) {
895
895
  this.httpClient = new HttpClient(
@@ -933,13 +933,13 @@ var ApiClient = class {
933
933
  }
934
934
  };
935
935
 
936
- // src/shared/types/oauth.ts
936
+ // src/universal/types/oauth.ts
937
937
  var AuthorizationCode = (value) => value;
938
938
  var CodeVerifier = (value) => value;
939
939
  var CodeChallenge = (value) => value;
940
940
  var PKCEState = (value) => value;
941
941
 
942
- // src/shared/core/auth/pkce.ts
942
+ // src/universal/core/auth/pkce.ts
943
943
  async function generatePKCEParams(config) {
944
944
  const state = generateSecureRandomBase64Url(32);
945
945
  const codeVerifier = generateSecureRandomBase64Url(32);
@@ -1044,7 +1044,7 @@ var ClientAuthNamespaceImpl = class {
1044
1044
  }
1045
1045
  };
1046
1046
 
1047
- // src/client/core/blockchain/wallet-error.ts
1047
+ // src/client/core/shared/blockchain/wallet-error.ts
1048
1048
  var import_viem = require("viem");
1049
1049
  function classifyWalletError(error, ctx) {
1050
1050
  if (causeOf(error, import_viem.UserRejectedRequestError)) {
@@ -1073,7 +1073,7 @@ function revertReason(error) {
1073
1073
  return error.reason ?? error.data?.errorName ?? error.signature ?? null;
1074
1074
  }
1075
1075
 
1076
- // src/shared/core/blockchain/erc20/abi.ts
1076
+ // src/universal/core/shared/blockchain/erc20/abi.ts
1077
1077
  var ERC20_ABI = [
1078
1078
  {
1079
1079
  type: "function",
@@ -1173,7 +1173,7 @@ var ERC20_ABI = [
1173
1173
  }
1174
1174
  ];
1175
1175
 
1176
- // src/client/core/blockchain/erc20/approval.ts
1176
+ // src/client/core/shared/blockchain/erc20/approval.ts
1177
1177
  async function ensureErc20Allowance({
1178
1178
  erc20,
1179
1179
  chain,
@@ -1271,7 +1271,7 @@ async function submitErc20Approval(args) {
1271
1271
  return { type: "ok", txHash: hash };
1272
1272
  }
1273
1273
 
1274
- // src/shared/api/pagination.ts
1274
+ // src/universal/api/pagination.ts
1275
1275
  async function fetchAllPages(fetchPage, baseParams) {
1276
1276
  const items = [];
1277
1277
  let cursor = null;
@@ -1287,7 +1287,44 @@ async function fetchAllPages(fetchPage, baseParams) {
1287
1287
  return items;
1288
1288
  }
1289
1289
 
1290
- // src/shared/types/blockchain/core.ts
1290
+ // src/universal/types/pagination.ts
1291
+ var Cursor = (value) => value;
1292
+ var PaginatedResponse = {
1293
+ fromDto: (dto, itemMapper) => ({
1294
+ data: dto.data.map(itemMapper),
1295
+ startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
1296
+ startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
1297
+ })
1298
+ };
1299
+ var PaginationParams = {
1300
+ toQueryParams: (params) => {
1301
+ const queryParams = {};
1302
+ if (params.after) {
1303
+ queryParams.starting_after = params.after;
1304
+ }
1305
+ if (params.before) {
1306
+ queryParams.starting_before = params.before;
1307
+ }
1308
+ if (params.limit) {
1309
+ queryParams.limit = params.limit;
1310
+ }
1311
+ return queryParams;
1312
+ }
1313
+ };
1314
+
1315
+ // src/universal/types/asset.ts
1316
+ var AssetId = (value) => value;
1317
+ var AssetCode = (value) => value;
1318
+ var Asset = {
1319
+ fromDto: (dto) => ({
1320
+ id: AssetId(dto.id),
1321
+ code: AssetCode(dto.code),
1322
+ name: dto.name,
1323
+ fractionalDigits: dto.fractional_digits
1324
+ })
1325
+ };
1326
+
1327
+ // src/universal/types/blockchain/core.ts
1291
1328
  var ETHEREUM_CHAINS = {
1292
1329
  ethereum_mainnet: true,
1293
1330
  ethereum_sepolia: true,
@@ -1377,392 +1414,288 @@ var AssetSymbol = (value) => value;
1377
1414
  var StablecoinSymbol = (value) => value;
1378
1415
  var Bps = (value) => value;
1379
1416
 
1380
- // src/shared/core/blockchain/bps.ts
1381
- var BPS_DENOM = Bps(10000n);
1382
- function applyBps(amount, bps) {
1383
- return assertUint256(amount * bps / BPS_DENOM);
1384
- }
1417
+ // src/universal/types/offer.ts
1418
+ var OfferId = (value) => value;
1419
+ var OfferSlug = (value) => value;
1420
+ var Offer = {
1421
+ fromDto: (dto) => {
1422
+ if (!Array.isArray(dto.tokens)) {
1423
+ throw new ValidationError(
1424
+ `Offer.tokens: expected an array, got ${typeof dto.tokens}`
1425
+ );
1426
+ }
1427
+ return {
1428
+ id: OfferId(dto.id),
1429
+ slug: OfferSlug(dto.slug),
1430
+ type: dto.type,
1431
+ tagline: dto.tagline,
1432
+ bannerUrl: dto.banner_url,
1433
+ logoUrl: dto.logo_url,
1434
+ startsAt: new Date(dto.starts_at),
1435
+ endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
1436
+ tokens: OfferToken.listFromDto(dto.tokens)
1437
+ };
1438
+ }
1439
+ };
1440
+ var OfferToken = {
1441
+ fromDto: (dto) => ({
1442
+ role: dto.role,
1443
+ chain: Chain(dto.chain),
1444
+ address: EvmContractAddress(dto.address)
1445
+ }),
1446
+ /**
1447
+ * Maps an offer's token list, dropping every token on a chain this SDK does
1448
+ * not name. Frontline's chain registry runs ahead of {@link Chain}, and a
1449
+ * plain `.map` would throw out of `Offer.fromDto` and, through
1450
+ * `PaginatedResponse.fromDto`, reject the whole offers page - which is how
1451
+ * one Base token blanked production's offers list. Dropping costs that
1452
+ * token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
1453
+ * so nobody could have looked it up anyway.
1454
+ *
1455
+ * Same shape as `TokenMetadata.fromRegistryDto`.
1456
+ */
1457
+ listFromDto: (dtos) => dtos.filter((dto) => isChain(dto.chain)).map(OfferToken.fromDto)
1458
+ };
1385
1459
 
1386
- // src/shared/types/blockchain/ui.ts
1387
- var FormattedAmountUi = (value) => value;
1388
- var FormattedPercentUi = (value) => value;
1389
- var TxExplorerUrl = (value) => value;
1390
- var ShortenedWalletAddress = (value) => value;
1391
- var FormattedAmountAssetUi = (value) => value;
1392
- var AssetIconUrl = (value) => value;
1460
+ // src/universal/types/trading.ts
1461
+ var Ticker = (value) => value;
1462
+ var Isin = (value) => value;
1393
1463
 
1394
- // src/shared/core/blockchain/chain.ts
1395
- var CHAIN_IDS = {
1396
- ethereum_mainnet: 1,
1397
- ethereum_sepolia: 11155111,
1398
- base_mainnet: 8453,
1399
- base_sepolia: 84532
1464
+ // src/universal/types/offer-detail.ts
1465
+ var OfferOptionId = (value) => value;
1466
+ var OfferOptionSlug = (value) => value;
1467
+ var OfferSwapContract = {
1468
+ fromDto: (dto) => ({
1469
+ chain: Chain(dto.chain),
1470
+ address: EvmContractAddress(dto.address)
1471
+ })
1400
1472
  };
1401
- function chainFromId(chainId) {
1402
- const chains = Object.keys(CHAIN_IDS);
1403
- const chain = chains.find((c) => String(CHAIN_IDS[c]) === chainId);
1404
- if (!chain) {
1405
- throw new ValidationError(`Unsupported EIP-155 chain id: "${chainId}"`);
1406
- }
1407
- return chain;
1408
- }
1409
- function getNetworkName(chain) {
1410
- switch (chain) {
1411
- case "ethereum_mainnet":
1412
- return "Ethereum";
1413
- case "ethereum_sepolia":
1414
- return "Ethereum Sepolia";
1415
- case "base_mainnet":
1416
- return "Base";
1417
- case "base_sepolia":
1418
- return "Base Sepolia";
1419
- default: {
1420
- const _exhaustive = chain;
1421
- return _exhaustive;
1473
+ var OfferDetail = {
1474
+ fromDto: (dto) => {
1475
+ if (!Array.isArray(dto.funding_assets)) {
1476
+ throw new ValidationError(
1477
+ `OfferDetail.funding_assets: expected an array, got ${typeof dto.funding_assets}`
1478
+ );
1422
1479
  }
1423
- }
1424
- }
1425
- function txExplorerUrl(chain, txHash) {
1426
- return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);
1427
- }
1428
- function explorerBaseUrl(chain) {
1429
- switch (chain) {
1430
- case "ethereum_mainnet":
1431
- return "https://etherscan.io";
1432
- case "ethereum_sepolia":
1433
- return "https://sepolia.etherscan.io";
1434
- case "base_mainnet":
1435
- return "https://basescan.org";
1436
- case "base_sepolia":
1437
- return "https://sepolia-explorer.base.org";
1438
- default: {
1439
- const _exhaustive = chain;
1440
- return _exhaustive;
1480
+ if (!Array.isArray(dto.options)) {
1481
+ throw new ValidationError(
1482
+ `OfferDetail.options: expected an array, got ${typeof dto.options}`
1483
+ );
1484
+ }
1485
+ if (!Array.isArray(dto.terms)) {
1486
+ throw new ValidationError(
1487
+ `OfferDetail.terms: expected an array, got ${typeof dto.terms}`
1488
+ );
1489
+ }
1490
+ if (!Array.isArray(dto.links)) {
1491
+ throw new ValidationError(
1492
+ `OfferDetail.links: expected an array, got ${typeof dto.links}`
1493
+ );
1494
+ }
1495
+ if (!Array.isArray(dto.faqs)) {
1496
+ throw new ValidationError(
1497
+ `OfferDetail.faqs: expected an array, got ${typeof dto.faqs}`
1498
+ );
1499
+ }
1500
+ if (!Array.isArray(dto.milestones)) {
1501
+ throw new ValidationError(
1502
+ `OfferDetail.milestones: expected an array, got ${typeof dto.milestones}`
1503
+ );
1504
+ }
1505
+ if (!Array.isArray(dto.tokens)) {
1506
+ throw new ValidationError(
1507
+ `OfferDetail.tokens: expected an array, got ${typeof dto.tokens}`
1508
+ );
1509
+ }
1510
+ const swapContracts = dto.swap_contracts === void 0 ? [] : dto.swap_contracts;
1511
+ if (!Array.isArray(swapContracts)) {
1512
+ throw new ValidationError(
1513
+ `OfferDetail.swap_contracts: expected an array, got ${typeof swapContracts}`
1514
+ );
1441
1515
  }
1516
+ const isin = notBlankStringOrNull(dto.isin);
1517
+ const ticker = notBlankStringOrNull(dto.ticker);
1518
+ return {
1519
+ id: OfferId(dto.id),
1520
+ slug: OfferSlug(dto.slug),
1521
+ type: dto.type,
1522
+ name: dto.name,
1523
+ asset: Asset.fromDto(dto.asset),
1524
+ fundingAssets: dto.funding_assets.map(Asset.fromDto),
1525
+ tokens: OfferToken.listFromDto(dto.tokens),
1526
+ swapContracts: swapContracts.map(OfferSwapContract.fromDto),
1527
+ about: notBlankStringOrNull(dto.about),
1528
+ tagline: dto.tagline,
1529
+ bannerUrl: dto.banner_url,
1530
+ logoUrl: dto.logo_url,
1531
+ category: dto.category,
1532
+ issuer: notBlankStringOrNull(dto.issuer),
1533
+ isin: isin === null ? null : Isin(isin),
1534
+ ticker: ticker === null ? null : Ticker(ticker),
1535
+ instrumentType: notBlankStringOrNull(dto.instrument_type),
1536
+ listingVenue: notBlankStringOrNull(dto.listing_venue),
1537
+ startsAt: new Date(dto.starts_at),
1538
+ endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
1539
+ faqs: dto.faqs.map(FaqItem.fromDto),
1540
+ links: dto.links.map(Link.fromDto),
1541
+ milestones: dto.milestones.map(Milestone.fromDto),
1542
+ options: dto.options.map(OfferOption.fromDto),
1543
+ terms: dto.terms.map(TermItem.fromDto)
1544
+ };
1442
1545
  }
1443
- }
1444
-
1445
- // src/shared/types/providers/superstate/swap.ts
1446
- var SwapAuthorization = {
1546
+ };
1547
+ var OfferOption = {
1447
1548
  fromDto: (dto) => ({
1448
- authorized: dto.authorized
1549
+ id: OfferOptionId(dto.id),
1550
+ slug: OfferOptionSlug(dto.slug),
1551
+ bidIncrement: dto.bid_increment,
1552
+ floorPriceUsd: dto.floor_price_usd,
1553
+ minimumPurchaseUsd: dto.minimum_purchase_usd,
1554
+ priceUsd: dto.price_usd,
1555
+ saleAgreementUrl: notBlankStringOrNull(dto.sale_agreement_url),
1556
+ totalTokenSupply: dto.total_token_supply
1449
1557
  })
1450
1558
  };
1451
- var SwapPreview = {
1559
+ var FaqItem = {
1452
1560
  fromDto: (dto) => ({
1453
- inputAmount: parseUint256(
1454
- BigInt(dto.pay_input_amount),
1455
- "SwapPreview.pay_input_amount"
1456
- ),
1457
- fee: parseUint256(BigInt(dto.fee), "SwapPreview.fee"),
1458
- outputAmount: parseUint256(
1459
- BigInt(dto.receive_output_amount),
1460
- "SwapPreview.receive_output_amount"
1461
- )
1561
+ question: notBlankStringOrNull(dto.question),
1562
+ answer: notBlankStringOrNull(dto.answer)
1462
1563
  })
1463
1564
  };
1464
- var SwapStatus = {
1565
+ var Link = {
1465
1566
  fromDto: (dto) => ({
1466
- stopped: parseUint256(BigInt(dto.stopped), "SwapStatus.stopped"),
1467
- swapLevel: parseUint256(BigInt(dto.swap_level), "SwapStatus.swap_level")
1567
+ label: notBlankStringOrNull(dto.label),
1568
+ url: notBlankStringOrNull(dto.url)
1468
1569
  })
1469
1570
  };
1470
- var TokenAllowance = {
1571
+ var TermItem = {
1471
1572
  fromDto: (dto) => ({
1472
- allowance: parseUint256(BigInt(dto.allowance), "TokenAllowance.allowance")
1573
+ key: notBlankStringOrNull(dto.key),
1574
+ value: notBlankStringOrNull(dto.value)
1473
1575
  })
1474
1576
  };
1475
- var TokenBalance = {
1577
+ var Milestone = {
1476
1578
  fromDto: (dto) => ({
1477
- balance: parseUint256(BigInt(dto.balance), "TokenBalance.balance")
1579
+ name: notBlankStringOrNull(dto.name),
1580
+ schedule: notBlankStringOrNull(dto.schedule),
1581
+ status: dto.status
1478
1582
  })
1479
1583
  };
1480
- var AllowWalletResponse = {
1481
- fromDto: (dto) => {
1482
- switch (dto.action) {
1483
- case "broadcast_transaction":
1484
- return {
1485
- action: "broadcast_transaction",
1486
- to: EvmContractAddress(dto.to),
1487
- data: HexEncodedTransactionData(dto.data)
1488
- };
1489
- case "none":
1490
- return {
1491
- action: "none",
1492
- alreadyAllowed: dto.already_allowed
1493
- };
1494
- default: {
1495
- const _exhaustive = dto;
1496
- return _exhaustive;
1497
- }
1584
+
1585
+ // src/universal/types/providers/coin-list/token-sale.ts
1586
+ var ParticipationId = (value) => value;
1587
+ var Blockchain = (value) => value;
1588
+ var WalletAddress = (value) => value;
1589
+ var ParticipationsPaginationParams = {
1590
+ toQueryParams: (params) => {
1591
+ const queryParams = PaginationParams.toQueryParams(params);
1592
+ if (params.offerId) {
1593
+ queryParams["filters[0][field]"] = "offer_id";
1594
+ queryParams["filters[0][op]"] = "==";
1595
+ queryParams["filters[0][value]"] = params.offerId;
1498
1596
  }
1597
+ return queryParams;
1598
+ }
1599
+ };
1600
+ var Participation = {
1601
+ /** Maps API DTO shape into the SDK participation domain model. */
1602
+ fromDto: (dto) => {
1603
+ const walletAddress = notBlankStringOrNull(dto.wallet_address);
1604
+ return {
1605
+ id: ParticipationId(dto.id),
1606
+ offerId: OfferId(dto.offer_id),
1607
+ offerOptionId: OfferOptionId(dto.offer_option_id),
1608
+ status: dto.status,
1609
+ amount: dto.amount,
1610
+ displayAmount: dto.amount_string,
1611
+ asset: Asset.fromDto(dto.asset),
1612
+ chain: Blockchain(dto.chain),
1613
+ insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
1614
+ updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
1615
+ walletAddress: walletAddress ? WalletAddress(walletAddress) : null
1616
+ };
1499
1617
  }
1500
1618
  };
1619
+ var CreateParticipationParams = {
1620
+ /** Maps participation creation params into API DTO payload. */
1621
+ toDto: (params) => ({
1622
+ offer_id: params.offerId,
1623
+ offer_option_id: params.offerOptionId,
1624
+ chain: params.chain,
1625
+ wallet_address: params.walletAddress,
1626
+ amount: params.amount,
1627
+ asset_id: params.assetId,
1628
+ approval_transaction_hash: params.approvalTransactionHash
1629
+ })
1630
+ };
1501
1631
 
1502
- // src/shared/api/frontline/providers/superstate/swap.ts
1503
- async function getSwapAuthorization(api, params) {
1504
- const dto = await api.send({
1505
- method: "GET",
1506
- url: "/v1/wallet/authorized",
1507
- queryParams: {
1508
- chain: params.chain,
1509
- contract_address: params.contractAddress,
1510
- wallet_address: params.walletAddress
1511
- },
1512
- attributes: Attributes.protected()
1513
- });
1514
- return SwapAuthorization.fromDto(dto);
1515
- }
1516
- async function getSwapOutputToken(api, params) {
1517
- const dto = await api.send({
1518
- method: "GET",
1519
- url: "/v1/swap/output-token",
1520
- queryParams: {
1521
- chain: params.chain,
1522
- contract_address: params.contractAddress
1523
- },
1524
- attributes: Attributes.protected()
1525
- });
1526
- return toErc20Asset(dto);
1527
- }
1528
- async function getSwapPreview(api, params) {
1529
- const dto = await api.send({
1530
- method: "GET",
1531
- url: "/v1/swap/preview",
1532
- queryParams: {
1533
- chain: params.chain,
1534
- contract_address: params.contractAddress,
1535
- input_token: params.inputToken,
1536
- amount: params.amount.toString()
1537
- },
1538
- attributes: Attributes.protected()
1539
- });
1540
- return SwapPreview.fromDto(dto);
1541
- }
1542
- async function getSwapStatus(api, params) {
1543
- const dto = await api.send({
1544
- method: "GET",
1545
- url: "/v1/swap/status",
1546
- queryParams: {
1547
- chain: params.chain,
1548
- contract_address: params.contractAddress
1549
- },
1550
- attributes: Attributes.protected()
1551
- });
1552
- return SwapStatus.fromDto(dto);
1632
+ // src/universal/api/frontline/providers/coin-list/token-sale.ts
1633
+ async function fetchParticipations(api, offerId) {
1634
+ return fetchAllPages(
1635
+ (params) => fetchParticipationsPage(api, params),
1636
+ { offerId }
1637
+ );
1553
1638
  }
1554
- async function getTokenAllowance(api, params) {
1555
- const dto = await api.send({
1639
+ async function fetchParticipationsPage(api, params) {
1640
+ const pageDto = await api.send({
1556
1641
  method: "GET",
1557
- url: "/v1/token/allowance",
1558
- queryParams: {
1559
- chain: params.chain,
1560
- token_address: params.tokenAddress,
1561
- owner: params.owner,
1562
- spender: params.spender
1563
- },
1642
+ url: "/v1/participations",
1643
+ queryParams: ParticipationsPaginationParams.toQueryParams(params),
1564
1644
  attributes: Attributes.protected()
1565
1645
  });
1566
- return TokenAllowance.fromDto(dto);
1646
+ return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
1567
1647
  }
1568
- async function getTokenBalance(api, params) {
1648
+ async function fetchParticipation(api, id) {
1569
1649
  const dto = await api.send({
1570
1650
  method: "GET",
1571
- url: "/v1/token/balance",
1572
- queryParams: {
1573
- chain: params.chain,
1574
- token_address: params.tokenAddress,
1575
- owner: params.owner
1576
- },
1651
+ url: `/v1/participations/${id}`,
1577
1652
  attributes: Attributes.protected()
1578
1653
  });
1579
- return TokenBalance.fromDto(dto);
1654
+ return Participation.fromDto(dto);
1580
1655
  }
1581
- async function allowWallet(api, params) {
1656
+ async function createParticipation(api, params) {
1582
1657
  const dto = await api.send({
1583
1658
  method: "POST",
1584
- url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
1585
- body: {
1586
- wallet_address: params.walletAddress,
1587
- chain: params.chain,
1588
- signature: params.signature
1589
- },
1659
+ url: "/v1/participations",
1660
+ body: CreateParticipationParams.toDto(params),
1590
1661
  attributes: Attributes.protected()
1591
1662
  });
1592
- return AllowWalletResponse.fromDto(dto);
1593
- }
1594
- function toErc20Asset(dto) {
1595
- return {
1596
- name: dto.name,
1597
- symbol: AssetSymbol(dto.symbol),
1598
- decimals: AssetDecimals(dto.decimals)
1599
- };
1663
+ return Participation.fromDto(dto);
1600
1664
  }
1601
1665
 
1602
- // src/shared/core/blockchain/erc20/erc20-namespace.ts
1603
- var Erc20NamespaceImpl = class {
1666
+ // src/universal/core/checkout/coin-list/token-sale-namespace.ts
1667
+ var CoinListTokenSaleNamespaceImpl = class {
1604
1668
  constructor(ctx) {
1605
1669
  this.ctx = ctx;
1606
- this.log = internalLogger(ctx.logger, "ERC20");
1670
+ this.log = internalLogger(ctx.logger, "TOKEN_SALE");
1607
1671
  }
1608
- async getAllowance(params) {
1609
- return this.log.wrap("getAllowance", params, async () => {
1672
+ async list(offerId) {
1673
+ return this.log.wrap("list", offerId, async () => {
1610
1674
  await this.ctx.ensureUserAuthenticated();
1611
- return getTokenAllowance(this.ctx.api, params);
1675
+ return fetchParticipations(this.ctx.api, offerId);
1612
1676
  });
1613
1677
  }
1614
- async getBalance(params) {
1615
- return this.log.wrap("getBalance", params, async () => {
1678
+ async listPage(params) {
1679
+ return this.log.wrap("listPage", params, async () => {
1616
1680
  await this.ctx.ensureUserAuthenticated();
1617
- return getTokenBalance(this.ctx.api, params);
1681
+ return fetchParticipationsPage(this.ctx.api, params);
1618
1682
  });
1619
1683
  }
1620
- };
1621
-
1622
- // src/shared/core/blockchain/formatters.ts
1623
- var import_viem2 = require("viem");
1624
- function shortenAddress(address) {
1625
- const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
1626
- return ShortenedWalletAddress(short);
1627
- }
1628
- function formatAmount(amount, locale, options) {
1629
- const decimal = formatRawAmount(amount);
1630
- let [integerPart, fractionPart = ""] = decimal.split(".");
1631
- const maxFractionDigits = options?.maxFractionDigits;
1632
- const minFractionDigits = maxFractionDigits !== void 0 ? Math.min(maxFractionDigits, amount.decimals) : Math.min(2, amount.decimals);
1633
- if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1634
- ({ integerPart, fractionPart } = roundFractionHalfUp(
1635
- integerPart,
1636
- fractionPart,
1637
- maxFractionDigits
1638
- ));
1639
- }
1640
- const fraction = minFractionDigits === 0 ? "" : fractionPart.padEnd(minFractionDigits, "0");
1641
- const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1642
- if (minFractionDigits === 0 && fraction === "") {
1643
- return FormattedAmountUi(integerFormatted);
1644
- }
1645
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1646
- return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
1647
- }
1648
- function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1649
- if (fractionPart.length <= maxFractionDigits) {
1650
- return { integerPart, fractionPart };
1651
- }
1652
- if (maxFractionDigits === 0) {
1653
- const roundUp = fractionPart[0] >= "5";
1654
- const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
1655
- return { integerPart: integer.toString(), fractionPart: "" };
1656
- }
1657
- const trimmed = fractionPart.slice(0, maxFractionDigits);
1658
- if (fractionPart[maxFractionDigits] < "5") {
1659
- return { integerPart, fractionPart: trimmed };
1660
- }
1661
- const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
1662
- let carry = 1;
1663
- for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
1664
- const sum = digits[i] + carry;
1665
- if (sum === 10) {
1666
- digits[i] = 0;
1667
- carry = 1;
1668
- } else {
1669
- digits[i] = sum;
1670
- carry = 0;
1671
- }
1684
+ async get(id) {
1685
+ return this.log.wrap("get", id, async () => {
1686
+ await this.ctx.ensureUserAuthenticated();
1687
+ return fetchParticipation(this.ctx.api, id);
1688
+ });
1672
1689
  }
1673
- return {
1674
- integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
1675
- fractionPart: digits.join("")
1676
- };
1677
- }
1678
- function formatRawAmount(amount) {
1679
- return (0, import_viem2.formatUnits)(amount.raw, amount.decimals);
1680
- }
1681
- function formatBpsAsPercent(bps, locale) {
1682
- const whole = bps / 100n;
1683
- const fraction = bps % 100n;
1684
- const wholeFormatted = whole.toLocaleString(locale);
1685
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1686
- if (fraction === 0n) {
1687
- return FormattedPercentUi(`${wholeFormatted}%`);
1690
+ async createParticipation(params) {
1691
+ return this.log.wrap("createParticipation", params, async () => {
1692
+ await this.ctx.ensureUserAuthenticated();
1693
+ return createParticipation(this.ctx.api, params);
1694
+ });
1688
1695
  }
1689
- const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
1690
- return FormattedPercentUi(
1691
- `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
1692
- );
1693
- }
1694
- function usdAmount(amount) {
1695
- return FormattedAmountAssetUi(`$${amount}`);
1696
- }
1697
- function assetAmount(amount, symbol) {
1698
- return FormattedAmountAssetUi(`${amount} ${symbol}`);
1699
- }
1700
- var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1701
- var USD_FRACTION_DIGITS = AssetDecimals(2);
1702
- function formattedUsdPrice(amount, locale) {
1703
- if (!amount) return NA_AMOUNT_ASSET_UI;
1704
- return usdAmount(
1705
- formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
1706
- );
1707
- }
1708
-
1709
- // src/shared/core/blockchain/math.ts
1710
- var import_viem3 = require("viem");
1711
- function blockchainAmountFromRawOrThrow({
1712
- label,
1713
- raw,
1714
- decimals
1715
- }) {
1716
- const trimmed = raw.trim();
1717
- if (trimmed === "") {
1718
- throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
1719
- }
1720
- let value;
1721
- try {
1722
- value = BigInt(trimmed);
1723
- } catch {
1724
- throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
1725
- }
1726
- try {
1727
- return BlockchainAmount({ raw: assertUint256(value), decimals });
1728
- } catch {
1729
- throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
1730
- }
1731
- }
1732
- function parseBlockchainAmount(amount, decimals) {
1733
- const trimmed = amount.trim();
1734
- if (trimmed === "") return { valid: false, reason: { type: "empty" } };
1735
- if (trimmed.startsWith("-")) {
1736
- return { valid: false, reason: { type: "negative" } };
1737
- }
1738
- if (/[eE]/.test(trimmed)) {
1739
- return { valid: false, reason: { type: "invalid-format" } };
1740
- }
1741
- if (!/^\d+(\.\d+)?$/.test(trimmed)) {
1742
- return { valid: false, reason: { type: "invalid-format" } };
1743
- }
1744
- const [, fraction = ""] = trimmed.split(".");
1745
- if (fraction.length > decimals) {
1746
- return {
1747
- valid: false,
1748
- reason: { type: "too-many-decimals", maxDecimals: decimals }
1749
- };
1750
- }
1751
- try {
1752
- const raw = (0, import_viem3.parseUnits)(trimmed, decimals);
1753
- if (raw > MAX_UINT_256) {
1754
- return { valid: false, reason: { type: "overflow" } };
1755
- }
1756
- return {
1757
- valid: true,
1758
- amount: BlockchainAmount({ raw, decimals })
1759
- };
1760
- } catch {
1761
- return { valid: false, reason: { type: "invalid-format" } };
1762
- }
1763
- }
1696
+ };
1764
1697
 
1765
- // src/shared/core/blockchain/token-registry.ts
1698
+ // src/universal/core/shared/blockchain/token-registry.ts
1766
1699
  var USDC_SYMBOL = StablecoinSymbol("USDC");
1767
1700
  var USDC = {
1768
1701
  name: "USD Coin",
@@ -1825,367 +1758,261 @@ var TOKEN_REGISTRY = {
1825
1758
  usdtAddress: (chain) => USDT_ADDRESSES[chain]
1826
1759
  };
1827
1760
 
1828
- // src/shared/types/pagination.ts
1829
- var Cursor = (value) => value;
1830
- var PaginatedResponse = {
1831
- fromDto: (dto, itemMapper) => ({
1832
- data: dto.data.map(itemMapper),
1833
- startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
1834
- startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
1835
- })
1836
- };
1837
- var PaginationParams = {
1838
- toQueryParams: (params) => {
1839
- const queryParams = {};
1840
- if (params.after) {
1841
- queryParams.starting_after = params.after;
1842
- }
1843
- if (params.before) {
1844
- queryParams.starting_before = params.before;
1845
- }
1846
- if (params.limit) {
1847
- queryParams.limit = params.limit;
1848
- }
1849
- return queryParams;
1761
+ // src/universal/core/checkout/ondo/constants.ts
1762
+ var ONDO_POLL_INTERVAL_MS = 15e3;
1763
+ var ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5e3;
1764
+ var DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE = DecimalString("1000");
1765
+ var ONDO_SETTLEMENT_ASSET = USDC_SYMBOL;
1766
+ var DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
1767
+ var ONDO_SUPPORTED_INPUT_ASSETS = [
1768
+ USDC_SYMBOL
1769
+ ];
1770
+
1771
+ // src/universal/core/checkout/ondo/math.ts
1772
+ function computeOndoBuyPrice(transaction) {
1773
+ const { notionalValue, receiveOutputAmount } = transaction;
1774
+ return pricePerShare({
1775
+ usd: notionalValue,
1776
+ shares: receiveOutputAmount
1777
+ });
1778
+ }
1779
+ function computeOndoSellPrice(transaction) {
1780
+ const { expected, spendInputAmount } = transaction;
1781
+ return pricePerShare({
1782
+ usd: grossProceeds(expected),
1783
+ shares: spendInputAmount
1784
+ });
1785
+ }
1786
+ function grossProceeds(expected) {
1787
+ const raw = expected.quantity.raw + expected.fee.raw;
1788
+ if (raw > MAX_UINT_256) {
1789
+ throw new MathError(`Ondo sell proceeds: out of uint256 bounds (${raw})`);
1850
1790
  }
1851
- };
1791
+ return BlockchainAmount.add(expected.quantity, expected.fee);
1792
+ }
1793
+ function pricePerShare({
1794
+ usd,
1795
+ shares
1796
+ }) {
1797
+ const price = BlockchainAmount.div(usd, shares);
1798
+ return BlockchainAmount({
1799
+ raw: assertPriceFits(price.raw),
1800
+ decimals: price.decimals
1801
+ });
1802
+ }
1803
+ function assertPriceFits(raw) {
1804
+ try {
1805
+ return assertUint256(raw);
1806
+ } catch {
1807
+ throw new MathError(`Ondo price: out of uint256 bounds (${raw})`);
1808
+ }
1809
+ }
1852
1810
 
1853
- // src/shared/types/asset.ts
1854
- var AssetId = (value) => value;
1855
- var AssetCode = (value) => value;
1856
- var Asset = {
1857
- fromDto: (dto) => ({
1858
- id: AssetId(dto.id),
1859
- code: AssetCode(dto.code),
1860
- name: dto.name,
1861
- fractionalDigits: dto.fractional_digits
1862
- })
1863
- };
1811
+ // src/universal/core/shared/blockchain/formatters.ts
1812
+ var import_viem2 = require("viem");
1864
1813
 
1865
- // src/shared/types/offer.ts
1866
- var OfferId = (value) => value;
1867
- var OfferSlug = (value) => value;
1868
- var Offer = {
1869
- fromDto: (dto) => {
1870
- if (!Array.isArray(dto.tokens)) {
1871
- throw new ValidationError(
1872
- `Offer.tokens: expected an array, got ${typeof dto.tokens}`
1873
- );
1814
+ // src/universal/types/blockchain/ui.ts
1815
+ var FormattedAmountUi = (value) => value;
1816
+ var FormattedPercentUi = (value) => value;
1817
+ var TxExplorerUrl = (value) => value;
1818
+ var ShortenedWalletAddress = (value) => value;
1819
+ var FormattedAmountAssetUi = (value) => value;
1820
+ var AssetIconUrl = (value) => value;
1821
+
1822
+ // src/universal/core/shared/blockchain/formatters.ts
1823
+ function shortenAddress(address) {
1824
+ const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
1825
+ return ShortenedWalletAddress(short);
1826
+ }
1827
+ function formatAmount(amount, locale, options) {
1828
+ const decimal = formatRawAmount(amount);
1829
+ let [integerPart, fractionPart = ""] = decimal.split(".");
1830
+ const maxFractionDigits = options?.maxFractionDigits;
1831
+ const minFractionDigits = maxFractionDigits !== void 0 ? Math.min(maxFractionDigits, amount.decimals) : Math.min(2, amount.decimals);
1832
+ if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1833
+ ({ integerPart, fractionPart } = roundFractionHalfUp(
1834
+ integerPart,
1835
+ fractionPart,
1836
+ maxFractionDigits
1837
+ ));
1838
+ }
1839
+ const fraction = minFractionDigits === 0 ? "" : fractionPart.padEnd(minFractionDigits, "0");
1840
+ const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1841
+ if (minFractionDigits === 0 && fraction === "") {
1842
+ return FormattedAmountUi(integerFormatted);
1843
+ }
1844
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1845
+ return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
1846
+ }
1847
+ function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1848
+ if (fractionPart.length <= maxFractionDigits) {
1849
+ return { integerPart, fractionPart };
1850
+ }
1851
+ if (maxFractionDigits === 0) {
1852
+ const roundUp = fractionPart[0] >= "5";
1853
+ const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
1854
+ return { integerPart: integer.toString(), fractionPart: "" };
1855
+ }
1856
+ const trimmed = fractionPart.slice(0, maxFractionDigits);
1857
+ if (fractionPart[maxFractionDigits] < "5") {
1858
+ return { integerPart, fractionPart: trimmed };
1859
+ }
1860
+ const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
1861
+ let carry = 1;
1862
+ for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
1863
+ const sum = digits[i] + carry;
1864
+ if (sum === 10) {
1865
+ digits[i] = 0;
1866
+ carry = 1;
1867
+ } else {
1868
+ digits[i] = sum;
1869
+ carry = 0;
1874
1870
  }
1875
- return {
1876
- id: OfferId(dto.id),
1877
- slug: OfferSlug(dto.slug),
1878
- type: dto.type,
1879
- tagline: dto.tagline,
1880
- bannerUrl: dto.banner_url,
1881
- logoUrl: dto.logo_url,
1882
- startsAt: new Date(dto.starts_at),
1883
- endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
1884
- tokens: OfferToken.listFromDto(dto.tokens)
1885
- };
1886
1871
  }
1872
+ return {
1873
+ integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
1874
+ fractionPart: digits.join("")
1875
+ };
1876
+ }
1877
+ function formatRawAmount(amount) {
1878
+ return (0, import_viem2.formatUnits)(amount.raw, amount.decimals);
1879
+ }
1880
+ function formatBpsAsPercent(bps, locale) {
1881
+ const whole = bps / 100n;
1882
+ const fraction = bps % 100n;
1883
+ const wholeFormatted = whole.toLocaleString(locale);
1884
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1885
+ if (fraction === 0n) {
1886
+ return FormattedPercentUi(`${wholeFormatted}%`);
1887
+ }
1888
+ const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
1889
+ return FormattedPercentUi(
1890
+ `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
1891
+ );
1892
+ }
1893
+ function usdAmount(amount) {
1894
+ return FormattedAmountAssetUi(`$${amount}`);
1895
+ }
1896
+ function assetAmount(amount, symbol) {
1897
+ return FormattedAmountAssetUi(`${amount} ${symbol}`);
1898
+ }
1899
+ var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1900
+ var USD_FRACTION_DIGITS = AssetDecimals(2);
1901
+ function formattedUsdPrice(amount, locale) {
1902
+ if (!amount) return NA_AMOUNT_ASSET_UI;
1903
+ return usdAmount(
1904
+ formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
1905
+ );
1906
+ }
1907
+
1908
+ // src/universal/core/shared/blockchain/chain.ts
1909
+ var CHAIN_IDS = {
1910
+ ethereum_mainnet: 1,
1911
+ ethereum_sepolia: 11155111,
1912
+ base_mainnet: 8453,
1913
+ base_sepolia: 84532
1887
1914
  };
1888
- var OfferToken = {
1889
- fromDto: (dto) => ({
1890
- role: dto.role,
1891
- chain: Chain(dto.chain),
1892
- address: EvmContractAddress(dto.address)
1893
- }),
1894
- /**
1895
- * Maps an offer's token list, dropping every token on a chain this SDK does
1896
- * not name. Frontline's chain registry runs ahead of {@link Chain}, and a
1897
- * plain `.map` would throw out of `Offer.fromDto` and, through
1898
- * `PaginatedResponse.fromDto`, reject the whole offers page - which is how
1899
- * one Base token blanked production's offers list. Dropping costs that
1900
- * token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
1901
- * so nobody could have looked it up anyway.
1902
- *
1903
- * Same shape as `TokenMetadata.fromRegistryDto`.
1904
- */
1905
- listFromDto: (dtos) => dtos.filter((dto) => isChain(dto.chain)).map(OfferToken.fromDto)
1906
- };
1907
-
1908
- // src/shared/types/offer-detail.ts
1909
- var OfferOptionId = (value) => value;
1910
- var OfferOptionSlug = (value) => value;
1911
- var OfferSwapContract = {
1912
- fromDto: (dto) => ({
1913
- chain: Chain(dto.chain),
1914
- address: EvmContractAddress(dto.address)
1915
- })
1916
- };
1917
- var OfferDetail = {
1918
- fromDto: (dto) => {
1919
- if (!Array.isArray(dto.funding_assets)) {
1920
- throw new ValidationError(
1921
- `OfferDetail.funding_assets: expected an array, got ${typeof dto.funding_assets}`
1922
- );
1923
- }
1924
- if (!Array.isArray(dto.options)) {
1925
- throw new ValidationError(
1926
- `OfferDetail.options: expected an array, got ${typeof dto.options}`
1927
- );
1928
- }
1929
- if (!Array.isArray(dto.terms)) {
1930
- throw new ValidationError(
1931
- `OfferDetail.terms: expected an array, got ${typeof dto.terms}`
1932
- );
1933
- }
1934
- if (!Array.isArray(dto.links)) {
1935
- throw new ValidationError(
1936
- `OfferDetail.links: expected an array, got ${typeof dto.links}`
1937
- );
1938
- }
1939
- if (!Array.isArray(dto.faqs)) {
1940
- throw new ValidationError(
1941
- `OfferDetail.faqs: expected an array, got ${typeof dto.faqs}`
1942
- );
1943
- }
1944
- if (!Array.isArray(dto.milestones)) {
1945
- throw new ValidationError(
1946
- `OfferDetail.milestones: expected an array, got ${typeof dto.milestones}`
1947
- );
1948
- }
1949
- if (!Array.isArray(dto.tokens)) {
1950
- throw new ValidationError(
1951
- `OfferDetail.tokens: expected an array, got ${typeof dto.tokens}`
1952
- );
1953
- }
1954
- const swapContracts = dto.swap_contracts === void 0 ? [] : dto.swap_contracts;
1955
- if (!Array.isArray(swapContracts)) {
1956
- throw new ValidationError(
1957
- `OfferDetail.swap_contracts: expected an array, got ${typeof swapContracts}`
1958
- );
1959
- }
1960
- return {
1961
- id: OfferId(dto.id),
1962
- slug: OfferSlug(dto.slug),
1963
- type: dto.type,
1964
- name: dto.name,
1965
- asset: Asset.fromDto(dto.asset),
1966
- fundingAssets: dto.funding_assets.map(Asset.fromDto),
1967
- tokens: OfferToken.listFromDto(dto.tokens),
1968
- swapContracts: swapContracts.map(OfferSwapContract.fromDto),
1969
- about: notBlankStringOrNull(dto.about),
1970
- tagline: dto.tagline,
1971
- bannerUrl: dto.banner_url,
1972
- logoUrl: dto.logo_url,
1973
- category: dto.category,
1974
- startsAt: new Date(dto.starts_at),
1975
- endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
1976
- faqs: dto.faqs.map(FaqItem.fromDto),
1977
- links: dto.links.map(Link.fromDto),
1978
- milestones: dto.milestones.map(Milestone.fromDto),
1979
- options: dto.options.map(OfferOption.fromDto),
1980
- terms: dto.terms.map(TermItem.fromDto)
1981
- };
1915
+ function chainFromId(chainId) {
1916
+ const chains = Object.keys(CHAIN_IDS);
1917
+ const chain = chains.find((c) => String(CHAIN_IDS[c]) === chainId);
1918
+ if (!chain) {
1919
+ throw new ValidationError(`Unsupported EIP-155 chain id: "${chainId}"`);
1982
1920
  }
1983
- };
1984
- var OfferOption = {
1985
- fromDto: (dto) => ({
1986
- id: OfferOptionId(dto.id),
1987
- slug: OfferOptionSlug(dto.slug),
1988
- bidIncrement: dto.bid_increment,
1989
- floorPriceUsd: dto.floor_price_usd,
1990
- minimumPurchaseUsd: dto.minimum_purchase_usd,
1991
- priceUsd: dto.price_usd,
1992
- saleAgreementUrl: notBlankStringOrNull(dto.sale_agreement_url),
1993
- totalTokenSupply: dto.total_token_supply
1994
- })
1995
- };
1996
- var FaqItem = {
1997
- fromDto: (dto) => ({
1998
- question: notBlankStringOrNull(dto.question),
1999
- answer: notBlankStringOrNull(dto.answer)
2000
- })
2001
- };
2002
- var Link = {
2003
- fromDto: (dto) => ({
2004
- label: notBlankStringOrNull(dto.label),
2005
- url: notBlankStringOrNull(dto.url)
2006
- })
2007
- };
2008
- var TermItem = {
2009
- fromDto: (dto) => ({
2010
- key: notBlankStringOrNull(dto.key),
2011
- value: notBlankStringOrNull(dto.value)
2012
- })
2013
- };
2014
- var Milestone = {
2015
- fromDto: (dto) => ({
2016
- name: notBlankStringOrNull(dto.name),
2017
- schedule: notBlankStringOrNull(dto.schedule),
2018
- status: dto.status
2019
- })
2020
- };
2021
-
2022
- // src/shared/types/providers/coin-list/token-sale.ts
2023
- var ParticipationId = (value) => value;
2024
- var Blockchain = (value) => value;
2025
- var WalletAddress = (value) => value;
2026
- var ParticipationsPaginationParams = {
2027
- toQueryParams: (params) => {
2028
- const queryParams = PaginationParams.toQueryParams(params);
2029
- if (params.offerId) {
2030
- queryParams["filters[0][field]"] = "offer_id";
2031
- queryParams["filters[0][op]"] = "==";
2032
- queryParams["filters[0][value]"] = params.offerId;
1921
+ return chain;
1922
+ }
1923
+ function getNetworkName(chain) {
1924
+ switch (chain) {
1925
+ case "ethereum_mainnet":
1926
+ return "Ethereum";
1927
+ case "ethereum_sepolia":
1928
+ return "Ethereum Sepolia";
1929
+ case "base_mainnet":
1930
+ return "Base";
1931
+ case "base_sepolia":
1932
+ return "Base Sepolia";
1933
+ default: {
1934
+ const _exhaustive = chain;
1935
+ return _exhaustive;
2033
1936
  }
2034
- return queryParams;
2035
1937
  }
2036
- };
2037
- var Participation = {
2038
- /** Maps API DTO shape into the SDK participation domain model. */
2039
- fromDto: (dto) => {
2040
- const walletAddress = notBlankStringOrNull(dto.wallet_address);
2041
- return {
2042
- id: ParticipationId(dto.id),
2043
- offerId: OfferId(dto.offer_id),
2044
- offerOptionId: OfferOptionId(dto.offer_option_id),
2045
- status: dto.status,
2046
- amount: dto.amount,
2047
- displayAmount: dto.amount_string,
2048
- asset: Asset.fromDto(dto.asset),
2049
- chain: Blockchain(dto.chain),
2050
- insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
2051
- updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
2052
- walletAddress: walletAddress ? WalletAddress(walletAddress) : null
2053
- };
2054
- }
2055
- };
2056
- var CreateParticipationParams = {
2057
- /** Maps participation creation params into API DTO payload. */
2058
- toDto: (params) => ({
2059
- offer_id: params.offerId,
2060
- offer_option_id: params.offerOptionId,
2061
- chain: params.chain,
2062
- wallet_address: params.walletAddress,
2063
- amount: params.amount,
2064
- asset_id: params.assetId,
2065
- approval_transaction_hash: params.approvalTransactionHash
2066
- })
2067
- };
2068
-
2069
- // src/shared/api/frontline/providers/coin-list/token-sale.ts
2070
- async function fetchParticipations(api, offerId) {
2071
- return fetchAllPages(
2072
- (params) => fetchParticipationsPage(api, params),
2073
- { offerId }
2074
- );
2075
1938
  }
2076
- async function fetchParticipationsPage(api, params) {
2077
- const pageDto = await api.send({
2078
- method: "GET",
2079
- url: "/v1/participations",
2080
- queryParams: ParticipationsPaginationParams.toQueryParams(params),
2081
- attributes: Attributes.protected()
2082
- });
2083
- return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
2084
- }
2085
- async function fetchParticipation(api, id) {
2086
- const dto = await api.send({
2087
- method: "GET",
2088
- url: `/v1/participations/${id}`,
2089
- attributes: Attributes.protected()
2090
- });
2091
- return Participation.fromDto(dto);
1939
+ function txExplorerUrl(chain, txHash) {
1940
+ return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);
2092
1941
  }
2093
- async function createParticipation(api, params) {
2094
- const dto = await api.send({
2095
- method: "POST",
2096
- url: "/v1/participations",
2097
- body: CreateParticipationParams.toDto(params),
2098
- attributes: Attributes.protected()
2099
- });
2100
- return Participation.fromDto(dto);
1942
+ function explorerBaseUrl(chain) {
1943
+ switch (chain) {
1944
+ case "ethereum_mainnet":
1945
+ return "https://etherscan.io";
1946
+ case "ethereum_sepolia":
1947
+ return "https://sepolia.etherscan.io";
1948
+ case "base_mainnet":
1949
+ return "https://basescan.org";
1950
+ case "base_sepolia":
1951
+ return "https://sepolia-explorer.base.org";
1952
+ default: {
1953
+ const _exhaustive = chain;
1954
+ return _exhaustive;
1955
+ }
1956
+ }
2101
1957
  }
2102
1958
 
2103
- // src/shared/core/checkout/coin-list/token-sale-namespace.ts
2104
- var CoinListTokenSaleNamespaceImpl = class {
2105
- constructor(ctx) {
2106
- this.ctx = ctx;
2107
- this.log = internalLogger(ctx.logger, "TOKEN_SALE");
1959
+ // src/universal/core/shared/blockchain/math.ts
1960
+ var import_viem3 = require("viem");
1961
+ function blockchainAmountFromRawOrThrow({
1962
+ label,
1963
+ raw,
1964
+ decimals
1965
+ }) {
1966
+ const trimmed = raw.trim();
1967
+ if (trimmed === "") {
1968
+ throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
2108
1969
  }
2109
- async list(offerId) {
2110
- return this.log.wrap("list", offerId, async () => {
2111
- await this.ctx.ensureUserAuthenticated();
2112
- return fetchParticipations(this.ctx.api, offerId);
2113
- });
1970
+ let value;
1971
+ try {
1972
+ value = BigInt(trimmed);
1973
+ } catch {
1974
+ throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
2114
1975
  }
2115
- async listPage(params) {
2116
- return this.log.wrap("listPage", params, async () => {
2117
- await this.ctx.ensureUserAuthenticated();
2118
- return fetchParticipationsPage(this.ctx.api, params);
2119
- });
1976
+ try {
1977
+ return BlockchainAmount({ raw: assertUint256(value), decimals });
1978
+ } catch {
1979
+ throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
2120
1980
  }
2121
- async get(id) {
2122
- return this.log.wrap("get", id, async () => {
2123
- await this.ctx.ensureUserAuthenticated();
2124
- return fetchParticipation(this.ctx.api, id);
2125
- });
1981
+ }
1982
+ function parseBlockchainAmount(amount, decimals) {
1983
+ const trimmed = amount.trim();
1984
+ if (trimmed === "") return { valid: false, reason: { type: "empty" } };
1985
+ if (trimmed.startsWith("-")) {
1986
+ return { valid: false, reason: { type: "negative" } };
2126
1987
  }
2127
- async createParticipation(params) {
2128
- return this.log.wrap("createParticipation", params, async () => {
2129
- await this.ctx.ensureUserAuthenticated();
2130
- return createParticipation(this.ctx.api, params);
2131
- });
1988
+ if (/[eE]/.test(trimmed)) {
1989
+ return { valid: false, reason: { type: "invalid-format" } };
2132
1990
  }
2133
- };
2134
-
2135
- // src/shared/core/checkout/ondo/constants.ts
2136
- var ONDO_POLL_INTERVAL_MS = 15e3;
2137
- var ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5e3;
2138
- var DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE = DecimalString("1000");
2139
- var ONDO_SETTLEMENT_ASSET = USDC_SYMBOL;
2140
- var DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
2141
- var ONDO_SUPPORTED_INPUT_ASSETS = [
2142
- USDC_SYMBOL
2143
- ];
2144
-
2145
- // src/shared/core/checkout/ondo/math.ts
2146
- function computeOndoBuyPrice(transaction) {
2147
- const { notionalValue, receiveOutputAmount } = transaction;
2148
- return pricePerShare({
2149
- usd: notionalValue,
2150
- shares: receiveOutputAmount
2151
- });
2152
- }
2153
- function computeOndoSellPrice(transaction) {
2154
- const { expected, spendInputAmount } = transaction;
2155
- return pricePerShare({
2156
- usd: grossProceeds(expected),
2157
- shares: spendInputAmount
2158
- });
2159
- }
2160
- function grossProceeds(expected) {
2161
- const raw = expected.quantity.raw + expected.fee.raw;
2162
- if (raw > MAX_UINT_256) {
2163
- throw new MathError(`Ondo sell proceeds: out of uint256 bounds (${raw})`);
1991
+ if (!/^\d+(\.\d+)?$/.test(trimmed)) {
1992
+ return { valid: false, reason: { type: "invalid-format" } };
1993
+ }
1994
+ const [, fraction = ""] = trimmed.split(".");
1995
+ if (fraction.length > decimals) {
1996
+ return {
1997
+ valid: false,
1998
+ reason: { type: "too-many-decimals", maxDecimals: decimals }
1999
+ };
2164
2000
  }
2165
- return BlockchainAmount.add(expected.quantity, expected.fee);
2166
- }
2167
- function pricePerShare({
2168
- usd,
2169
- shares
2170
- }) {
2171
- const price = BlockchainAmount.div(usd, shares);
2172
- return BlockchainAmount({
2173
- raw: assertPriceFits(price.raw),
2174
- decimals: price.decimals
2175
- });
2176
- }
2177
- function assertPriceFits(raw) {
2178
2001
  try {
2179
- return assertUint256(raw);
2002
+ const raw = (0, import_viem3.parseUnits)(trimmed, decimals);
2003
+ if (raw > MAX_UINT_256) {
2004
+ return { valid: false, reason: { type: "overflow" } };
2005
+ }
2006
+ return {
2007
+ valid: true,
2008
+ amount: BlockchainAmount({ raw, decimals })
2009
+ };
2180
2010
  } catch {
2181
- throw new MathError(`Ondo price: out of uint256 bounds (${raw})`);
2011
+ return { valid: false, reason: { type: "invalid-format" } };
2182
2012
  }
2183
2013
  }
2184
2014
 
2185
- // src/shared/types/trading.ts
2186
- var Ticker = (value) => value;
2187
-
2188
- // src/shared/types/providers/ondo/ondo.ts
2015
+ // src/universal/types/providers/ondo/ondo.ts
2189
2016
  var OndoTradingStatus = {
2190
2017
  fromDto: (dto) => {
2191
2018
  if (!dto.tradable) return { type: "not-tradable", side: dto.side };
@@ -2351,7 +2178,7 @@ function parseExpiresAt(value) {
2351
2178
  return date;
2352
2179
  }
2353
2180
 
2354
- // src/shared/api/frontline/providers/ondo/ondo.ts
2181
+ // src/universal/api/frontline/providers/ondo/ondo.ts
2355
2182
  async function getOndoTradingStatus(api, params) {
2356
2183
  const dto = await api.send({
2357
2184
  method: "GET",
@@ -2446,7 +2273,7 @@ function sizeParam(params) {
2446
2273
  return { notional_value: notionalValue };
2447
2274
  }
2448
2275
 
2449
- // src/shared/core/checkout/ondo/ondo-namespace.ts
2276
+ // src/universal/core/checkout/ondo/ondo-namespace.ts
2450
2277
  var OndoNamespaceImpl = class {
2451
2278
  constructor(ctx) {
2452
2279
  this.ctx = ctx;
@@ -2478,7 +2305,7 @@ var OndoNamespaceImpl = class {
2478
2305
  }
2479
2306
  };
2480
2307
 
2481
- // src/shared/core/checkout/superstate/blockchain/abi.ts
2308
+ // src/universal/core/checkout/superstate/blockchain/abi.ts
2482
2309
  var SUPERSTATE_SWAP_ABI = [
2483
2310
  {
2484
2311
  type: "function",
@@ -2700,7 +2527,13 @@ var SUPERSTATE_SWAP_ABI = [
2700
2527
  }
2701
2528
  ];
2702
2529
 
2703
- // src/shared/core/checkout/superstate/blockchain/math.ts
2530
+ // src/universal/core/shared/blockchain/bps.ts
2531
+ var BPS_DENOM = Bps(10000n);
2532
+ function applyBps(amount, bps) {
2533
+ return assertUint256(amount * bps / BPS_DENOM);
2534
+ }
2535
+
2536
+ // src/universal/core/checkout/superstate/blockchain/math.ts
2704
2537
  function computePrice({
2705
2538
  inputTokenAmount,
2706
2539
  outputTokenAmount
@@ -2718,7 +2551,7 @@ function computeSlip(amount, slippage) {
2718
2551
  return BlockchainAmount({ raw: slipRaw, decimals: amount.decimals });
2719
2552
  }
2720
2553
 
2721
- // src/shared/core/checkout/superstate/blockchain/quote.ts
2554
+ // src/universal/core/checkout/superstate/blockchain/quote.ts
2722
2555
  var SwapQuote = {
2723
2556
  /**
2724
2557
  * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
@@ -2738,12 +2571,12 @@ var SwapQuote = {
2738
2571
  })
2739
2572
  };
2740
2573
 
2741
- // src/shared/core/checkout/superstate/blockchain/status.ts
2574
+ // src/universal/core/checkout/superstate/blockchain/status.ts
2742
2575
  function isStopped(status) {
2743
2576
  return (status.stopped & status.swapLevel) !== 0n;
2744
2577
  }
2745
2578
 
2746
- // src/shared/core/checkout/superstate/blockchain/swapped-event.ts
2579
+ // src/universal/core/checkout/superstate/blockchain/swapped-event.ts
2747
2580
  var import_viem4 = require("viem");
2748
2581
  function decodeSwappedOutputAmount(receipt, outputDecimals) {
2749
2582
  try {
@@ -2761,7 +2594,7 @@ function decodeSwappedOutputAmount(receipt, outputDecimals) {
2761
2594
  }
2762
2595
  }
2763
2596
 
2764
- // src/shared/core/checkout/superstate/constants.ts
2597
+ // src/universal/core/checkout/superstate/constants.ts
2765
2598
  var SUPERSTATE_ISSUER_NAME = "Superstate";
2766
2599
  var SUPERSTATE_SUPPORTED_INPUT_ASSETS = [USDC_SYMBOL];
2767
2600
  var SWAP_POLL_INTERVAL_MS = 15e3;
@@ -2777,14 +2610,171 @@ var SUPERSTATE_SWAP_CONTRACT_ADDRESSES = {
2777
2610
  function superstateSwapContractAddress(chain) {
2778
2611
  return SUPERSTATE_SWAP_CONTRACT_ADDRESSES[chain] ?? null;
2779
2612
  }
2780
-
2781
- // src/shared/core/checkout/superstate/formatters.ts
2782
- function formattedPricePerShare(quote, locale) {
2783
- if (!quote) return NA_AMOUNT_ASSET_UI;
2784
- return formattedUsdPrice(computePrice(quote), locale);
2613
+
2614
+ // src/universal/core/checkout/superstate/formatters.ts
2615
+ function formattedPricePerShare(quote, locale) {
2616
+ if (!quote) return NA_AMOUNT_ASSET_UI;
2617
+ return formattedUsdPrice(computePrice(quote), locale);
2618
+ }
2619
+
2620
+ // src/universal/types/providers/superstate/swap.ts
2621
+ var SwapAuthorization = {
2622
+ fromDto: (dto) => ({
2623
+ authorized: dto.authorized
2624
+ })
2625
+ };
2626
+ var SwapPreview = {
2627
+ fromDto: (dto) => ({
2628
+ inputAmount: parseUint256(
2629
+ BigInt(dto.pay_input_amount),
2630
+ "SwapPreview.pay_input_amount"
2631
+ ),
2632
+ fee: parseUint256(BigInt(dto.fee), "SwapPreview.fee"),
2633
+ outputAmount: parseUint256(
2634
+ BigInt(dto.receive_output_amount),
2635
+ "SwapPreview.receive_output_amount"
2636
+ )
2637
+ })
2638
+ };
2639
+ var SwapStatus = {
2640
+ fromDto: (dto) => ({
2641
+ stopped: parseUint256(BigInt(dto.stopped), "SwapStatus.stopped"),
2642
+ swapLevel: parseUint256(BigInt(dto.swap_level), "SwapStatus.swap_level")
2643
+ })
2644
+ };
2645
+ var TokenAllowance = {
2646
+ fromDto: (dto) => ({
2647
+ allowance: parseUint256(BigInt(dto.allowance), "TokenAllowance.allowance")
2648
+ })
2649
+ };
2650
+ var TokenBalance = {
2651
+ fromDto: (dto) => ({
2652
+ balance: parseUint256(BigInt(dto.balance), "TokenBalance.balance")
2653
+ })
2654
+ };
2655
+ var AllowWalletResponse = {
2656
+ fromDto: (dto) => {
2657
+ switch (dto.action) {
2658
+ case "broadcast_transaction":
2659
+ return {
2660
+ action: "broadcast_transaction",
2661
+ to: EvmContractAddress(dto.to),
2662
+ data: HexEncodedTransactionData(dto.data)
2663
+ };
2664
+ case "none":
2665
+ return {
2666
+ action: "none",
2667
+ alreadyAllowed: dto.already_allowed
2668
+ };
2669
+ default: {
2670
+ const _exhaustive = dto;
2671
+ return _exhaustive;
2672
+ }
2673
+ }
2674
+ }
2675
+ };
2676
+
2677
+ // src/universal/api/frontline/providers/superstate/swap.ts
2678
+ async function getSwapAuthorization(api, params) {
2679
+ const dto = await api.send({
2680
+ method: "GET",
2681
+ url: "/v1/wallet/authorized",
2682
+ queryParams: {
2683
+ chain: params.chain,
2684
+ contract_address: params.contractAddress,
2685
+ wallet_address: params.walletAddress
2686
+ },
2687
+ attributes: Attributes.protected()
2688
+ });
2689
+ return SwapAuthorization.fromDto(dto);
2690
+ }
2691
+ async function getSwapOutputToken(api, params) {
2692
+ const dto = await api.send({
2693
+ method: "GET",
2694
+ url: "/v1/swap/output-token",
2695
+ queryParams: {
2696
+ chain: params.chain,
2697
+ contract_address: params.contractAddress
2698
+ },
2699
+ attributes: Attributes.protected()
2700
+ });
2701
+ return toErc20Asset(dto);
2702
+ }
2703
+ async function getSwapPreview(api, params) {
2704
+ const dto = await api.send({
2705
+ method: "GET",
2706
+ url: "/v1/swap/preview",
2707
+ queryParams: {
2708
+ chain: params.chain,
2709
+ contract_address: params.contractAddress,
2710
+ input_token: params.inputToken,
2711
+ amount: params.amount.toString()
2712
+ },
2713
+ attributes: Attributes.protected()
2714
+ });
2715
+ return SwapPreview.fromDto(dto);
2716
+ }
2717
+ async function getSwapStatus(api, params) {
2718
+ const dto = await api.send({
2719
+ method: "GET",
2720
+ url: "/v1/swap/status",
2721
+ queryParams: {
2722
+ chain: params.chain,
2723
+ contract_address: params.contractAddress
2724
+ },
2725
+ attributes: Attributes.protected()
2726
+ });
2727
+ return SwapStatus.fromDto(dto);
2728
+ }
2729
+ async function getTokenAllowance(api, params) {
2730
+ const dto = await api.send({
2731
+ method: "GET",
2732
+ url: "/v1/token/allowance",
2733
+ queryParams: {
2734
+ chain: params.chain,
2735
+ token_address: params.tokenAddress,
2736
+ owner: params.owner,
2737
+ spender: params.spender
2738
+ },
2739
+ attributes: Attributes.protected()
2740
+ });
2741
+ return TokenAllowance.fromDto(dto);
2742
+ }
2743
+ async function getTokenBalance(api, params) {
2744
+ const dto = await api.send({
2745
+ method: "GET",
2746
+ url: "/v1/token/balance",
2747
+ queryParams: {
2748
+ chain: params.chain,
2749
+ token_address: params.tokenAddress,
2750
+ owner: params.owner
2751
+ },
2752
+ attributes: Attributes.protected()
2753
+ });
2754
+ return TokenBalance.fromDto(dto);
2755
+ }
2756
+ async function allowWallet(api, params) {
2757
+ const dto = await api.send({
2758
+ method: "POST",
2759
+ url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
2760
+ body: {
2761
+ wallet_address: params.walletAddress,
2762
+ chain: params.chain,
2763
+ signature: params.signature
2764
+ },
2765
+ attributes: Attributes.protected()
2766
+ });
2767
+ return AllowWalletResponse.fromDto(dto);
2768
+ }
2769
+ function toErc20Asset(dto) {
2770
+ return {
2771
+ name: dto.name,
2772
+ symbol: AssetSymbol(dto.symbol),
2773
+ decimals: AssetDecimals(dto.decimals)
2774
+ };
2785
2775
  }
2786
2776
 
2787
- // src/shared/core/checkout/superstate/swap-namespace.ts
2777
+ // src/universal/core/checkout/superstate/swap-namespace.ts
2788
2778
  var SuperstateSwapNamespaceImpl = class {
2789
2779
  constructor(ctx) {
2790
2780
  this.ctx = ctx;
@@ -2822,7 +2812,7 @@ var SuperstateSwapNamespaceImpl = class {
2822
2812
  }
2823
2813
  };
2824
2814
 
2825
- // src/shared/api/frontline/offers.ts
2815
+ // src/universal/api/frontline/offers.ts
2826
2816
  async function fetchOffers(api, clientCreds) {
2827
2817
  return fetchAllPages((params) => fetchOffersPage(api, params, clientCreds));
2828
2818
  }
@@ -2851,7 +2841,7 @@ async function fetchOfferDetails(api, id, clientCreds) {
2851
2841
  return OfferDetail.fromDto(dto);
2852
2842
  }
2853
2843
 
2854
- // src/shared/core/offers/offers-namespace.ts
2844
+ // src/universal/core/offers/offers-namespace.ts
2855
2845
  var OffersNamespaceImpl = class {
2856
2846
  constructor(ctx) {
2857
2847
  this.ctx = ctx;
@@ -2877,12 +2867,12 @@ var OffersNamespaceImpl = class {
2877
2867
  }
2878
2868
  };
2879
2869
 
2880
- // src/shared/core/offers/swap-contracts.ts
2870
+ // src/universal/core/offers/swap-contracts.ts
2881
2871
  function swapSpender(swapContracts, chain) {
2882
2872
  return swapContracts.find((contract) => contract.chain === chain)?.address ?? null;
2883
2873
  }
2884
2874
 
2885
- // src/shared/types/document-submission.ts
2875
+ // src/universal/types/document-submission.ts
2886
2876
  var DocumentSubmission = {
2887
2877
  fromDto: (dto) => ({
2888
2878
  status: dto.status,
@@ -2890,7 +2880,7 @@ var DocumentSubmission = {
2890
2880
  })
2891
2881
  };
2892
2882
 
2893
- // src/shared/api/frontline/documents.ts
2883
+ // src/universal/api/frontline/documents.ts
2894
2884
  async function submitDocument(api, documentType, fields) {
2895
2885
  const dto = await api.send({
2896
2886
  method: "POST",
@@ -2901,14 +2891,14 @@ async function submitDocument(api, documentType, fields) {
2901
2891
  return DocumentSubmission.fromDto(dto);
2902
2892
  }
2903
2893
 
2904
- // src/shared/types/kyc.ts
2894
+ // src/universal/types/kyc.ts
2905
2895
  var KycToken = {
2906
2896
  fromDto: (dto) => ({
2907
2897
  token: dto.token
2908
2898
  })
2909
2899
  };
2910
2900
 
2911
- // src/shared/api/frontline/kyc.ts
2901
+ // src/universal/api/frontline/kyc.ts
2912
2902
  async function createKycToken(api, levelName, reset) {
2913
2903
  const dto = await api.send({
2914
2904
  method: "POST",
@@ -2922,7 +2912,7 @@ async function createKycToken(api, levelName, reset) {
2922
2912
  return KycToken.fromDto(dto);
2923
2913
  }
2924
2914
 
2925
- // src/shared/types/pii.ts
2915
+ // src/universal/types/pii.ts
2926
2916
  var Iso2CountryCode = (value) => value;
2927
2917
  var PiiJurisdiction = {
2928
2918
  fromDto: (dto) => ({
@@ -2950,7 +2940,7 @@ var Pii = {
2950
2940
  })
2951
2941
  };
2952
2942
 
2953
- // src/shared/api/frontline/pii.ts
2943
+ // src/universal/api/frontline/pii.ts
2954
2944
  async function fetchPii(api) {
2955
2945
  const dto = await api.send({
2956
2946
  method: "GET",
@@ -2960,7 +2950,7 @@ async function fetchPii(api) {
2960
2950
  return Pii.fromDto(dto);
2961
2951
  }
2962
2952
 
2963
- // src/shared/types/requirement.ts
2953
+ // src/universal/types/requirement.ts
2964
2954
  var RequirementId = (value) => value;
2965
2955
  var Requirement = {
2966
2956
  fromDto: (dto) => ({
@@ -2981,7 +2971,7 @@ var RequirementStatusInfo = {
2981
2971
  )
2982
2972
  };
2983
2973
 
2984
- // src/shared/api/frontline/requirements.ts
2974
+ // src/universal/api/frontline/requirements.ts
2985
2975
  async function fetchOfferRequirements(api, offerId, clientCreds) {
2986
2976
  const response = await api.send({
2987
2977
  method: "GET",
@@ -3007,7 +2997,7 @@ async function fetchRequirementStatuses(api, offerId) {
3007
2997
  return RequirementStatusInfo.fromStatusesDto(response);
3008
2998
  }
3009
2999
 
3010
- // src/shared/core/requirements/requirements-namespace.ts
3000
+ // src/universal/core/requirements/requirements-namespace.ts
3011
3001
  var RequirementsNamespaceImpl = class {
3012
3002
  constructor(ctx) {
3013
3003
  this.ctx = ctx;
@@ -3057,10 +3047,30 @@ var RequirementsNamespaceImpl = class {
3057
3047
  }
3058
3048
  };
3059
3049
 
3060
- // src/shared/api/nabu/tokens.ts
3050
+ // src/universal/core/shared/blockchain/erc20/erc20-namespace.ts
3051
+ var Erc20NamespaceImpl = class {
3052
+ constructor(ctx) {
3053
+ this.ctx = ctx;
3054
+ this.log = internalLogger(ctx.logger, "ERC20");
3055
+ }
3056
+ async getAllowance(params) {
3057
+ return this.log.wrap("getAllowance", params, async () => {
3058
+ await this.ctx.ensureUserAuthenticated();
3059
+ return getTokenAllowance(this.ctx.api, params);
3060
+ });
3061
+ }
3062
+ async getBalance(params) {
3063
+ return this.log.wrap("getBalance", params, async () => {
3064
+ await this.ctx.ensureUserAuthenticated();
3065
+ return getTokenBalance(this.ctx.api, params);
3066
+ });
3067
+ }
3068
+ };
3069
+
3070
+ // src/universal/api/nabu/tokens.ts
3061
3071
  var import_viem5 = require("viem");
3062
3072
 
3063
- // src/shared/types/token-metadata.ts
3073
+ // src/universal/types/token-metadata.ts
3064
3074
  var TokenLogoUrl = (value) => value;
3065
3075
  var TokenLogo = {
3066
3076
  /** `baseUrl` is the registry origin; registry URLs are root-relative. */
@@ -3143,7 +3153,7 @@ var resolveLogoUrl = (url, baseUrl) => TokenLogoUrl(
3143
3153
  url.startsWith("http") ? url : `${baseUrl.replace(/\/$/, "")}${url}`
3144
3154
  );
3145
3155
 
3146
- // src/shared/api/nabu/tokens.ts
3156
+ // src/universal/api/nabu/tokens.ts
3147
3157
  function createNabuApiClient(baseUrl, logger = null) {
3148
3158
  return new HttpClient({ baseUrl }, {}, logger);
3149
3159
  }
@@ -3234,10 +3244,10 @@ function checksummed(address) {
3234
3244
  }
3235
3245
  }
3236
3246
 
3237
- // src/shared/core/tokens/tokens-namespace.ts
3247
+ // src/universal/core/tokens/tokens-namespace.ts
3238
3248
  var TokensNamespaceImpl = class {
3239
3249
  /**
3240
- * Takes the registry origin rather than a `SharedNamespaceContext`: the
3250
+ * Takes the registry origin rather than a `UniversalNamespaceContext`: the
3241
3251
  * registry is unauthenticated and on its own host, so the frontline sender
3242
3252
  * and the auth check would both be dead weight here.
3243
3253
  */
@@ -3261,7 +3271,7 @@ var TokensNamespaceImpl = class {
3261
3271
  }
3262
3272
  };
3263
3273
 
3264
- // src/shared/types/offer-option-address.ts
3274
+ // src/universal/types/offer-option-address.ts
3265
3275
  var OfferOptionAddressId = (value) => value;
3266
3276
  var OfferOptionAddress = {
3267
3277
  /** Maps the API DTO into the SDK offer-option-address domain model. */
@@ -3283,7 +3293,7 @@ var ConnectExternalWalletParams = {
3283
3293
  })
3284
3294
  };
3285
3295
 
3286
- // src/shared/types/wallet-ownership-challenge.ts
3296
+ // src/universal/types/wallet-ownership-challenge.ts
3287
3297
  var WalletOwnershipChallenge = {
3288
3298
  /** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
3289
3299
  fromDto: (dto) => ({
@@ -3322,7 +3332,7 @@ var CreateWalletOwnershipChallengeParams = {
3322
3332
  }
3323
3333
  };
3324
3334
 
3325
- // src/shared/api/frontline/wallet-connect.ts
3335
+ // src/universal/api/frontline/wallet-connect.ts
3326
3336
  async function createWalletOwnershipChallenge(api, params) {
3327
3337
  const dto = await api.send({
3328
3338
  method: "POST",
@@ -3359,7 +3369,7 @@ async function removeOptionAddress(api, offerId, addressId) {
3359
3369
  return OfferOptionAddress.fromDto(dto);
3360
3370
  }
3361
3371
 
3362
- // src/shared/core/wallets/wallets-namespace.ts
3372
+ // src/universal/core/wallets/wallets-namespace.ts
3363
3373
  var WalletsNamespaceImpl = class {
3364
3374
  constructor(ctx) {
3365
3375
  this.ctx = ctx;
@@ -3402,7 +3412,7 @@ var WalletsNamespaceImpl = class {
3402
3412
  }
3403
3413
  };
3404
3414
 
3405
- // src/shared/types/blockchain/wallet-error.ts
3415
+ // src/universal/types/blockchain/wallet-error.ts
3406
3416
  var RedactedWalletError = {
3407
3417
  fromWalletError: (error) => error.type === "unknown" ? { type: "unknown" } : error
3408
3418
  };
@@ -3486,7 +3496,7 @@ async function executeTokenSale(params) {
3486
3496
  return { type: "success", participation, approvalTxHash };
3487
3497
  }
3488
3498
 
3489
- // src/client/core/observability/flow-logging.ts
3499
+ // src/client/core/shared/observability/flow-logging.ts
3490
3500
  async function withFlowLogging(log, flow, fields, onProgress, run) {
3491
3501
  const flowLog = log.child({ flow });
3492
3502
  flowLog.info(() => ({ msg: "flow started", fields }));
@@ -3936,7 +3946,7 @@ var ClientSuperstateSwapNamespaceImpl = class extends SuperstateSwapNamespaceImp
3936
3946
  }
3937
3947
  };
3938
3948
 
3939
- // src/client/core/utils/open-in-new-tab.ts
3949
+ // src/client/core/shared/utils/open-in-new-tab.ts
3940
3950
  function openInNewTab(url) {
3941
3951
  window.open(url, "_blank", "noopener,noreferrer");
3942
3952
  }
@@ -3994,7 +4004,7 @@ var ClientSupportNamespaceImpl = class {
3994
4004
  }
3995
4005
  };
3996
4006
 
3997
- // src/shared/api/nabu/config.ts
4007
+ // src/universal/api/nabu/config.ts
3998
4008
  var NABU_BASE_URL = "https://asset.coinlist.co";
3999
4009
 
4000
4010
  // src/client/core/coinlist-client.ts
@@ -6129,6 +6139,7 @@ var ISSUER_LABEL = "Issuer";
6129
6139
  var TICKER_SYMBOL_LABEL = "Ticker symbol";
6130
6140
  var ISIN_LABEL = "ISIN";
6131
6141
  var ASSET_TYPE_LABEL = "Asset type";
6142
+ var LISTING_VENUE_LABEL = "Listing venue";
6132
6143
  var NETWORK_LABEL = "Network";
6133
6144
  var PRICE_UNAVAILABLE = "-";
6134
6145
  function OndoSidebarView({
@@ -6160,6 +6171,7 @@ function detailRows2(state) {
6160
6171
  { label: TICKER_SYMBOL_LABEL, value: state.tickerSymbol },
6161
6172
  { label: ISIN_LABEL, value: state.isin },
6162
6173
  { label: ASSET_TYPE_LABEL, value: state.assetType },
6174
+ { label: LISTING_VENUE_LABEL, value: state.listingVenue },
6163
6175
  { label: NETWORK_LABEL, value: state.networkName }
6164
6176
  ];
6165
6177
  }
@@ -9482,12 +9494,14 @@ function useOndoSidebarViewModel({
9482
9494
  networkName: getNetworkName(chain),
9483
9495
  tokenMetadata
9484
9496
  }),
9485
- // No frontline endpoint carries any of these today, and the detail list
9486
- // drops a null row rather than dashing it.
9487
- issuer: null,
9488
- tickerSymbol: null,
9489
- isin: null,
9490
- assetType: null,
9497
+ // Reference data for the security the token tracks. Each is null on an
9498
+ // offer that tokenizes none, and the detail list drops a null row rather
9499
+ // than dashing it.
9500
+ issuer: offer.issuer,
9501
+ tickerSymbol: offer.ticker,
9502
+ isin: offer.isin,
9503
+ assetType: offer.instrumentType,
9504
+ listingVenue: offer.listingVenue,
9491
9505
  networkName: getNetworkName(chain),
9492
9506
  price: toPriceUi(priceState, tradingStatusState, locale)
9493
9507
  };
@@ -12633,12 +12647,17 @@ var LOADING_STATE3 = { type: "LOADING" };
12633
12647
  function useOffers(options = {}) {
12634
12648
  const { coinlist, isReady } = useCoinList();
12635
12649
  const log = useLogger("useOffers");
12636
- const { data: serverOffers } = options;
12650
+ const { data: serverOffers, enabled = true } = options;
12637
12651
  const [offersState, setOffersState] = (0, import_react36.useState)(
12638
12652
  serverOffers !== void 0 ? { type: "CONTENT", offers: serverOffers } : LOADING_STATE3
12639
12653
  );
12640
12654
  (0, import_react36.useEffect)(() => {
12641
12655
  let isCancelled = false;
12656
+ if (!enabled) {
12657
+ return () => {
12658
+ isCancelled = true;
12659
+ };
12660
+ }
12642
12661
  if (!isReady) {
12643
12662
  if (serverOffers === void 0) {
12644
12663
  setOffersState(LOADING_STATE3);
@@ -12674,7 +12693,7 @@ function useOffers(options = {}) {
12674
12693
  return () => {
12675
12694
  isCancelled = true;
12676
12695
  };
12677
- }, [coinlist, isReady, serverOffers, log]);
12696
+ }, [coinlist, isReady, enabled, serverOffers, log]);
12678
12697
  return { offersState };
12679
12698
  }
12680
12699
 
@@ -12701,8 +12720,8 @@ var OfferSaleCardUi = {
12701
12720
  var NOT_AUTHENTICATED_MESSAGE = "Sign in to view available offers.";
12702
12721
  var GENERIC_ERROR_MESSAGE = "Unable to load offers right now. Please try again.";
12703
12722
  function useOffersGridViewModel(options = {}) {
12704
- const { data, onOfferClick } = options;
12705
- const { offersState } = useOffers({ data });
12723
+ const { data, onOfferClick, enabled = true } = options;
12724
+ const { offersState } = useOffers({ data, enabled });
12706
12725
  const state = (0, import_react37.useMemo)(
12707
12726
  () => toUiState(offersState, onOfferClick !== void 0),
12708
12727
  [offersState, onOfferClick]
@@ -12761,13 +12780,18 @@ var import_jsx_runtime55 = require("react/jsx-runtime");
12761
12780
  function OffersGridContainer({
12762
12781
  data,
12763
12782
  onOfferClick,
12783
+ enabled = true,
12764
12784
  ...viewProps
12765
12785
  } = {}) {
12766
- const { state, onEvent } = useOffersGridViewModel({ data, onOfferClick });
12786
+ const { state, onEvent } = useOffersGridViewModel({
12787
+ data,
12788
+ onOfferClick,
12789
+ enabled
12790
+ });
12767
12791
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OffersGridView, { state, onEvent, ...viewProps });
12768
12792
  }
12769
12793
 
12770
- // src/client/components/requirements/checklist/ConnectedWalletList.tsx
12794
+ // src/client/components/requirements/ConnectedWalletList.tsx
12771
12795
  var import_react38 = require("react");
12772
12796
  var import_jsx_runtime56 = require("react/jsx-runtime");
12773
12797
  function ConnectedWalletRow({
@@ -12789,487 +12813,105 @@ function ConnectedWalletRow({
12789
12813
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12790
12814
  "span",
12791
12815
  {
12792
- title: wallet.address,
12793
- className: cn(
12794
- typeClasses.body,
12795
- "clcosdk:font-mono clcosdk:text-text-primary"
12796
- ),
12797
- children: wallet.shortAddress
12798
- }
12799
- ),
12800
- onRemove != null && (state === "confirming" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-2", children: [
12801
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12802
- "span",
12803
- {
12804
- className: cn(typeClasses.subhead, "clcosdk:text-text-secondary"),
12805
- children: "Remove?"
12806
- }
12807
- ),
12808
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ClButton, { size: "sm", variant: "destructive", onClick: remove, children: "Remove" }),
12809
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12810
- ClButton,
12811
- {
12812
- size: "sm",
12813
- variant: "ghost",
12814
- onClick: () => setState("idle"),
12815
- children: "Cancel"
12816
- }
12817
- )
12818
- ] }) : state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-2", children: [
12819
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: cn(typeClasses.subhead, "clcosdk:text-error"), children: "Couldn't remove." }),
12820
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12821
- ClButton,
12822
- {
12823
- size: "sm",
12824
- variant: "destructiveLink",
12825
- onClick: () => setState("confirming"),
12826
- children: "Try again"
12827
- }
12828
- )
12829
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12830
- ClButton,
12831
- {
12832
- size: "sm",
12833
- variant: "destructiveLink",
12834
- disabled: state === "removing",
12835
- onClick: () => setState("confirming"),
12836
- children: state === "removing" ? "Removing\u2026" : "Remove"
12837
- }
12838
- ))
12839
- ] });
12840
- }
12841
- function ConnectedWalletList(props) {
12842
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ConnectedWalletListBody, { ...props }) });
12843
- }
12844
- function ConnectedWalletListBody({
12845
- wallets,
12846
- onRemove,
12847
- onAdd,
12848
- addLabel = "Add wallet",
12849
- status = "ready",
12850
- className
12851
- }) {
12852
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
12853
- "div",
12854
- {
12855
- className: cn("clcosdk:flex clcosdk:flex-col clcosdk:gap-2", className),
12856
- children: [
12857
- status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AlertBanner, { variant: "info", content: "Loading your connected wallets\u2026" }) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12858
- AlertBanner,
12859
- {
12860
- variant: "error",
12861
- content: "Couldn't load your connected wallets."
12862
- }
12863
- ) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AlertBanner, { variant: "info", content: "No wallets connected yet." }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:divide-y clcosdk:divide-divider", children: wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12864
- ConnectedWalletRow,
12865
- {
12866
- wallet,
12867
- onRemove
12868
- },
12869
- wallet.id
12870
- )) }),
12871
- onAdd != null && status !== "loading" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12872
- ClButton,
12873
- {
12874
- size: "sm",
12875
- variant: "secondary",
12876
- onClick: onAdd,
12877
- className: "clcosdk:self-start",
12878
- children: addLabel
12879
- }
12880
- )
12881
- ]
12882
- }
12883
- );
12884
- }
12885
-
12886
- // src/client/components/requirements/checklist/RequirementItem.tsx
12887
- var import_lucide_react15 = require("lucide-react");
12888
-
12889
- // src/client/components/design-system/StepStatusIcon.tsx
12890
- var import_lucide_react14 = require("lucide-react");
12891
- var import_jsx_runtime57 = require("react/jsx-runtime");
12892
- var statusConfig = {
12893
- required: {
12894
- Icon: import_lucide_react14.Info,
12895
- colorClass: "clcosdk:text-warning",
12896
- fillClass: "clcosdk:[&_circle]:fill-warning-subtle"
12897
- },
12898
- pending: {
12899
- Icon: import_lucide_react14.Info,
12900
- colorClass: "clcosdk:text-warning",
12901
- fillClass: "clcosdk:[&_circle]:fill-warning-subtle"
12902
- },
12903
- completed: {
12904
- Icon: import_lucide_react14.CircleCheck,
12905
- colorClass: "clcosdk:text-success",
12906
- fillClass: "clcosdk:[&_circle]:fill-success-subtle"
12907
- },
12908
- rejected: {
12909
- Icon: import_lucide_react14.CircleX,
12910
- colorClass: "clcosdk:text-error",
12911
- fillClass: "clcosdk:[&_circle]:fill-error-subtle"
12912
- }
12913
- };
12914
- function StepStatusIcon({ status, className }) {
12915
- const { Icon, colorClass, fillClass } = statusConfig[status];
12916
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12917
- Icon,
12918
- {
12919
- className: cn(
12920
- "clcosdk:h-6 clcosdk:w-6 clcosdk:shrink-0",
12921
- colorClass,
12922
- fillClass,
12923
- className
12924
- ),
12925
- "aria-hidden": "true"
12926
- }
12927
- );
12928
- }
12929
-
12930
- // src/client/components/requirements/checklist/RequirementItem.tsx
12931
- var import_jsx_runtime58 = require("react/jsx-runtime");
12932
- function VerificationActionZone({
12933
- status,
12934
- onAction,
12935
- onContactSupport
12936
- }) {
12937
- switch (status) {
12938
- case "required":
12939
- if (onAction === null) return null;
12940
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Continue" });
12941
- case "pending":
12942
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12943
- AlertBanner,
12944
- {
12945
- variant: "warning",
12946
- content: "Under review. We'll notify you when complete."
12947
- }
12948
- );
12949
- case "completed":
12950
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlertBanner, { variant: "success", content: "Identity verified." });
12951
- case "rejected":
12952
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12953
- AlertBanner,
12954
- {
12955
- variant: "error",
12956
- content: onContactSupport === null ? "Verification rejected." : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
12957
- "Verification rejected.",
12958
- " ",
12959
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12960
- "button",
12961
- {
12962
- type: "button",
12963
- onClick: onContactSupport,
12964
- className: "clcosdk:underline",
12965
- children: "Contact support"
12966
- }
12967
- ),
12968
- "."
12969
- ] })
12970
- }
12971
- );
12972
- }
12973
- }
12974
- function WalletActionZone({
12975
- status,
12976
- multiWallet,
12977
- connectedWallets,
12978
- walletsStatus,
12979
- onAction,
12980
- onRemoveWallet
12981
- }) {
12982
- if (multiWallet) {
12983
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
12984
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12985
- ConnectedWalletList,
12986
- {
12987
- wallets: connectedWallets,
12988
- onRemove: onRemoveWallet,
12989
- onAdd: onAction ?? void 0,
12990
- status: walletsStatus
12991
- }
12992
- ),
12993
- status === "rejected" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12994
- AlertBanner,
12995
- {
12996
- variant: "error",
12997
- content: "One of these wallets is not eligible for this sale."
12998
- }
12999
- )
13000
- ] });
13001
- }
13002
- if (status === "completed") {
13003
- const connected = connectedWallets[0];
13004
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
13005
- onAction !== null && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClButton, { size: "sm", variant: "secondary", onClick: onAction, children: "Change wallet" }),
13006
- walletsStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13007
- AlertBanner,
13008
- {
13009
- variant: "info",
13010
- content: "Loading your connected wallet\u2026"
13011
- }
13012
- ) : walletsStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13013
- AlertBanner,
12816
+ title: wallet.address,
12817
+ className: cn(
12818
+ typeClasses.body,
12819
+ "clcosdk:font-mono clcosdk:text-text-primary"
12820
+ ),
12821
+ children: wallet.shortAddress
12822
+ }
12823
+ ),
12824
+ onRemove != null && (state === "confirming" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-2", children: [
12825
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12826
+ "span",
13014
12827
  {
13015
- variant: "error",
13016
- content: "Couldn't load your connected wallet."
12828
+ className: cn(typeClasses.subhead, "clcosdk:text-text-secondary"),
12829
+ children: "Remove?"
13017
12830
  }
13018
- ) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13019
- AlertBanner,
12831
+ ),
12832
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ClButton, { size: "sm", variant: "destructive", onClick: remove, children: "Remove" }),
12833
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12834
+ ClButton,
13020
12835
  {
13021
- variant: "success",
13022
- content: connected ? connected.shortAddress : "Wallet connected."
12836
+ size: "sm",
12837
+ variant: "ghost",
12838
+ onClick: () => setState("idle"),
12839
+ children: "Cancel"
13023
12840
  }
13024
12841
  )
13025
- ] });
13026
- }
13027
- if (status === "rejected") {
13028
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
13029
- onAction !== null && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" }),
13030
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13031
- AlertBanner,
12842
+ ] }) : state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-2", children: [
12843
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: cn(typeClasses.subhead, "clcosdk:text-error"), children: "Couldn't remove." }),
12844
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12845
+ ClButton,
13032
12846
  {
13033
- variant: "error",
13034
- content: "This wallet is not eligible for this sale."
12847
+ size: "sm",
12848
+ variant: "destructiveLink",
12849
+ onClick: () => setState("confirming"),
12850
+ children: "Try again"
13035
12851
  }
13036
12852
  )
13037
- ] });
13038
- }
13039
- if (onAction === null) return null;
13040
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" });
12853
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12854
+ ClButton,
12855
+ {
12856
+ size: "sm",
12857
+ variant: "destructiveLink",
12858
+ disabled: state === "removing",
12859
+ onClick: () => setState("confirming"),
12860
+ children: state === "removing" ? "Removing\u2026" : "Remove"
12861
+ }
12862
+ ))
12863
+ ] });
13041
12864
  }
13042
- function RequirementItem({
13043
- ui,
13044
- expanded = false,
13045
- onToggle,
13046
- className,
13047
- onAction,
13048
- onRemoveWallet,
13049
- walletsStatus,
13050
- onContactSupport
12865
+ function ConnectedWalletList(props) {
12866
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ConnectedWalletListBody, { ...props }) });
12867
+ }
12868
+ function ConnectedWalletListBody({
12869
+ wallets,
12870
+ onRemove,
12871
+ onAdd,
12872
+ addLabel = "Add wallet",
12873
+ status = "ready",
12874
+ className
13051
12875
  }) {
13052
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12876
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
13053
12877
  "div",
13054
12878
  {
13055
- className: cn(
13056
- "clcosdk:flex clcosdk:w-full clcosdk:flex-col",
13057
- className
13058
- ),
12879
+ className: cn("clcosdk:flex clcosdk:flex-col clcosdk:gap-2", className),
13059
12880
  children: [
13060
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
13061
- "button",
12881
+ status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AlertBanner, { variant: "info", content: "Loading your connected wallets\u2026" }) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12882
+ AlertBanner,
13062
12883
  {
13063
- type: "button",
13064
- onClick: onToggle,
13065
- "aria-expanded": expanded,
13066
- className: "clcosdk:flex clcosdk:h-14 clcosdk:w-full clcosdk:cursor-pointer clcosdk:items-center clcosdk:justify-between clcosdk:rounded-2xl clcosdk:px-2 clcosdk:transition-colors clcosdk:hover:bg-surface",
13067
- children: [
13068
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
13069
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(StepStatusIcon, { status: ui.status }),
13070
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13071
- "span",
13072
- {
13073
- className: cn(
13074
- typeClasses.body,
13075
- "clcosdk:whitespace-nowrap clcosdk:font-medium clcosdk:text-text-primary"
13076
- ),
13077
- children: ui.label
13078
- }
13079
- )
13080
- ] }),
13081
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13082
- import_lucide_react15.ChevronRight,
13083
- {
13084
- className: cn(
13085
- "clcosdk:h-6 clcosdk:w-6 clcosdk:shrink-0 clcosdk:text-text-secondary clcosdk:transition-transform clcosdk:duration-300",
13086
- expanded && "clcosdk:rotate-90"
13087
- ),
13088
- "aria-hidden": "true"
13089
- }
13090
- )
13091
- ]
12884
+ variant: "error",
12885
+ content: "Couldn't load your connected wallets."
13092
12886
  }
13093
- ),
13094
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13095
- "div",
12887
+ ) : wallets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AlertBanner, { variant: "info", content: "No wallets connected yet." }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:divide-y clcosdk:divide-divider", children: wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12888
+ ConnectedWalletRow,
13096
12889
  {
13097
- className: cn(
13098
- "clcosdk:grid clcosdk:transition-[grid-template-rows] clcosdk:duration-300 clcosdk:ease-in-out",
13099
- expanded ? "clcosdk:grid-rows-[1fr]" : "clcosdk:grid-rows-[0fr]"
13100
- ),
13101
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "clcosdk:min-h-0 clcosdk:overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:px-2 clcosdk:pb-4", children: [
13102
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13103
- "p",
13104
- {
13105
- className: cn(
13106
- typeClasses.subhead,
13107
- "clcosdk:text-text-secondary"
13108
- ),
13109
- children: ui.description
13110
- }
13111
- ),
13112
- ui.variant === "verification" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13113
- VerificationActionZone,
13114
- {
13115
- status: ui.status,
13116
- onAction,
13117
- onContactSupport
13118
- }
13119
- ) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13120
- WalletActionZone,
13121
- {
13122
- status: ui.status,
13123
- multiWallet: ui.multiWallet,
13124
- connectedWallets: ui.connectedWallets,
13125
- walletsStatus,
13126
- onAction,
13127
- onRemoveWallet
13128
- }
13129
- )
13130
- ] }) })
13131
- }
13132
- )
13133
- ]
13134
- }
13135
- ) });
13136
- }
13137
-
13138
- // src/client/components/requirements/checklist/RequirementsChecklistView.tsx
13139
- var import_jsx_runtime59 = require("react/jsx-runtime");
13140
- function RequirementsChecklistView(props) {
13141
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RequirementsChecklistViewBody, { ...props }) });
13142
- }
13143
- function RequirementsChecklistViewBody({
13144
- state,
13145
- onEvent,
13146
- loading,
13147
- error,
13148
- unauthenticatedState,
13149
- className
13150
- }) {
13151
- switch (state.type) {
13152
- case "loading":
13153
- return loading ?? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LoadingState2, {});
13154
- case "not-authenticated":
13155
- return unauthenticatedState ?? null;
13156
- case "error":
13157
- return error ?? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13158
- AlertBanner,
13159
- {
13160
- variant: "error",
13161
- icon: true,
13162
- content: "Unable to load requirements right now. Please try again.",
13163
- className: "clcosdk:w-full clcosdk:max-w-[28rem]"
13164
- }
13165
- );
13166
- case "content":
13167
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
13168
- "div",
13169
- {
13170
- className: cn(
13171
- "clcosdk:flex clcosdk:w-full clcosdk:flex-col clcosdk:gap-4",
13172
- className
13173
- ),
13174
- children: [
13175
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
13176
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
13177
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: state.description })
13178
- ] }),
13179
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:divide-y clcosdk:divide-divider", children: state.items.map((row) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13180
- RequirementItem,
13181
- {
13182
- ui: row.item,
13183
- expanded: row.expanded,
13184
- onToggle: () => onEvent({ type: "ON_TOGGLE_ITEM", requirementId: row.id }),
13185
- onAction: row.actionEnabled ? () => onEvent({
13186
- type: "ON_REQUIREMENT_ACTION",
13187
- requirementId: row.id
13188
- }) : null,
13189
- onRemoveWallet: row.wallets ? (id) => state.removeWallet(id) : void 0,
13190
- walletsStatus: row.wallets?.status,
13191
- onContactSupport: row.contactSupportEnabled ? () => onEvent({
13192
- type: "ON_CONTACT_SUPPORT",
13193
- requirementId: row.id
13194
- }) : null
13195
- },
13196
- row.id
13197
- )) }),
13198
- state.ineligible && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13199
- AlertBanner,
13200
- {
13201
- variant: "error",
13202
- icon: true,
13203
- content: "You are not eligible to participate."
13204
- }
13205
- ),
13206
- state.continueAction && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13207
- ClButton,
13208
- {
13209
- fullWidth: true,
13210
- disabled: !state.continueAction.enabled,
13211
- onClick: () => onEvent({ type: "ON_CONTINUE" }),
13212
- children: "Continue"
13213
- }
13214
- )
13215
- ]
13216
- }
13217
- );
13218
- default: {
13219
- const exhaustive = state;
13220
- return exhaustive;
13221
- }
13222
- }
13223
- }
13224
- function LoadingState2() {
13225
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13226
- "output",
13227
- {
13228
- "aria-live": "polite",
13229
- className: "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:bg-background clcosdk:p-6",
13230
- children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading requirements..." })
13231
- }
13232
- );
13233
- }
13234
-
13235
- // src/client/components/requirements/checklist/VerificationOverlay.tsx
13236
- var import_jsx_runtime60 = require("react/jsx-runtime");
13237
- function VerificationOverlay({
13238
- onClose,
13239
- children
13240
- }) {
13241
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(VerificationOverlayBody, { onClose, children }) });
13242
- }
13243
- function VerificationOverlayBody({
13244
- onClose,
13245
- children
13246
- }) {
13247
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13248
- "div",
13249
- {
13250
- role: "dialog",
13251
- "aria-modal": "true",
13252
- "aria-label": "Identity verification",
13253
- className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-overlay clcosdk:p-4",
13254
- children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "clcosdk:relative clcosdk:flex clcosdk:max-h-[92vh] clcosdk:w-full clcosdk:max-w-[760px] clcosdk:flex-col clcosdk:overflow-y-auto clcosdk:rounded-2xl clcosdk:bg-background clcosdk:p-6 clcosdk:pt-14", children: [
13255
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13256
- CloseButton,
12890
+ wallet,
12891
+ onRemove
12892
+ },
12893
+ wallet.id
12894
+ )) }),
12895
+ onAdd != null && status !== "loading" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12896
+ ClButton,
13257
12897
  {
13258
- onClick: onClose,
13259
- className: "clcosdk:absolute clcosdk:top-4 clcosdk:right-4"
12898
+ size: "sm",
12899
+ variant: "secondary",
12900
+ onClick: onAdd,
12901
+ className: "clcosdk:self-start",
12902
+ children: addLabel
13260
12903
  }
13261
- ),
13262
- children
13263
- ] })
12904
+ )
12905
+ ]
13264
12906
  }
13265
12907
  );
13266
12908
  }
13267
12909
 
13268
12910
  // src/client/components/requirements/identity-verification/IdentityVerificationView.tsx
13269
12911
  var import_websdk_react = __toESM(require("@sumsub/websdk-react"), 1);
13270
- var import_jsx_runtime61 = require("react/jsx-runtime");
12912
+ var import_jsx_runtime57 = require("react/jsx-runtime");
13271
12913
  function IdentityVerificationView(props) {
13272
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(IdentityVerificationViewBody, { ...props }) });
12914
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(IdentityVerificationViewBody, { ...props }) });
13273
12915
  }
13274
12916
  function IdentityVerificationViewBody({
13275
12917
  state,
@@ -13278,7 +12920,7 @@ function IdentityVerificationViewBody({
13278
12920
  }) {
13279
12921
  switch (state.type) {
13280
12922
  case "loading":
13281
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12923
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
13282
12924
  "output",
13283
12925
  {
13284
12926
  "aria-live": "polite",
@@ -13286,11 +12928,11 @@ function IdentityVerificationViewBody({
13286
12928
  "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center",
13287
12929
  className
13288
12930
  ),
13289
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading identity verification..." })
12931
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading identity verification..." })
13290
12932
  }
13291
12933
  );
13292
12934
  case "error":
13293
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12935
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
13294
12936
  "div",
13295
12937
  {
13296
12938
  className: cn(
@@ -13298,13 +12940,13 @@ function IdentityVerificationViewBody({
13298
12940
  className
13299
12941
  ),
13300
12942
  children: [
13301
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(AlertBanner, { variant: "error", icon: true, content: state.message }),
13302
- state.retryable && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ClButton, { size: "sm", onClick: () => onEvent({ type: "ON_RETRY" }), children: "Try again" })
12943
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(AlertBanner, { variant: "error", icon: true, content: state.message }),
12944
+ state.retryable && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ClButton, { size: "sm", onClick: () => onEvent({ type: "ON_RETRY" }), children: "Try again" })
13303
12945
  ]
13304
12946
  }
13305
12947
  );
13306
12948
  case "ready":
13307
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: cn("clcosdk:w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12949
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: cn("clcosdk:w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
13308
12950
  import_websdk_react.default,
13309
12951
  {
13310
12952
  accessToken: state.accessToken,
@@ -13455,7 +13097,7 @@ function useIdentityVerificationViewModel(options = {}) {
13455
13097
  }
13456
13098
 
13457
13099
  // src/client/components/requirements/identity-verification/IdentityVerificationContainer.tsx
13458
- var import_jsx_runtime62 = require("react/jsx-runtime");
13100
+ var import_jsx_runtime58 = require("react/jsx-runtime");
13459
13101
  function IdentityVerificationContainer({
13460
13102
  levelName,
13461
13103
  reset,
@@ -13464,25 +13106,374 @@ function IdentityVerificationContainer({
13464
13106
  onError,
13465
13107
  className
13466
13108
  }) {
13467
- const { state, onEvent } = useIdentityVerificationViewModel({
13468
- levelName,
13469
- reset,
13470
- locale,
13471
- onSubmitted,
13472
- onError
13473
- });
13474
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13475
- IdentityVerificationView,
13109
+ const { state, onEvent } = useIdentityVerificationViewModel({
13110
+ levelName,
13111
+ reset,
13112
+ locale,
13113
+ onSubmitted,
13114
+ onError
13115
+ });
13116
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
13117
+ IdentityVerificationView,
13118
+ {
13119
+ state,
13120
+ onEvent,
13121
+ className
13122
+ }
13123
+ );
13124
+ }
13125
+
13126
+ // src/client/components/requirements/RequirementItem.tsx
13127
+ var import_lucide_react15 = require("lucide-react");
13128
+
13129
+ // src/client/components/design-system/StepStatusIcon.tsx
13130
+ var import_lucide_react14 = require("lucide-react");
13131
+ var import_jsx_runtime59 = require("react/jsx-runtime");
13132
+ var statusConfig = {
13133
+ required: {
13134
+ Icon: import_lucide_react14.Info,
13135
+ colorClass: "clcosdk:text-warning",
13136
+ fillClass: "clcosdk:[&_circle]:fill-warning-subtle"
13137
+ },
13138
+ pending: {
13139
+ Icon: import_lucide_react14.Info,
13140
+ colorClass: "clcosdk:text-warning",
13141
+ fillClass: "clcosdk:[&_circle]:fill-warning-subtle"
13142
+ },
13143
+ completed: {
13144
+ Icon: import_lucide_react14.CircleCheck,
13145
+ colorClass: "clcosdk:text-success",
13146
+ fillClass: "clcosdk:[&_circle]:fill-success-subtle"
13147
+ },
13148
+ rejected: {
13149
+ Icon: import_lucide_react14.CircleX,
13150
+ colorClass: "clcosdk:text-error",
13151
+ fillClass: "clcosdk:[&_circle]:fill-error-subtle"
13152
+ }
13153
+ };
13154
+ function StepStatusIcon({ status, className }) {
13155
+ const { Icon, colorClass, fillClass } = statusConfig[status];
13156
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13157
+ Icon,
13158
+ {
13159
+ className: cn(
13160
+ "clcosdk:h-6 clcosdk:w-6 clcosdk:shrink-0",
13161
+ colorClass,
13162
+ fillClass,
13163
+ className
13164
+ ),
13165
+ "aria-hidden": "true"
13166
+ }
13167
+ );
13168
+ }
13169
+
13170
+ // src/client/components/requirements/RequirementItem.tsx
13171
+ var import_jsx_runtime60 = require("react/jsx-runtime");
13172
+ function VerificationActionZone({
13173
+ status,
13174
+ onAction,
13175
+ onContactSupport
13176
+ }) {
13177
+ switch (status) {
13178
+ case "required":
13179
+ if (onAction === null) return null;
13180
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Continue" });
13181
+ case "pending":
13182
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13183
+ AlertBanner,
13184
+ {
13185
+ variant: "warning",
13186
+ content: "Under review. We'll notify you when complete."
13187
+ }
13188
+ );
13189
+ case "completed":
13190
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(AlertBanner, { variant: "success", content: "Identity verified." });
13191
+ case "rejected":
13192
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13193
+ AlertBanner,
13194
+ {
13195
+ variant: "error",
13196
+ content: onContactSupport === null ? "Verification rejected." : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
13197
+ "Verification rejected.",
13198
+ " ",
13199
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13200
+ "button",
13201
+ {
13202
+ type: "button",
13203
+ onClick: onContactSupport,
13204
+ className: "clcosdk:underline",
13205
+ children: "Contact support"
13206
+ }
13207
+ ),
13208
+ "."
13209
+ ] })
13210
+ }
13211
+ );
13212
+ }
13213
+ }
13214
+ function WalletActionZone({
13215
+ status,
13216
+ multiWallet,
13217
+ connectedWallets,
13218
+ walletsStatus,
13219
+ onAction,
13220
+ onRemoveWallet
13221
+ }) {
13222
+ if (multiWallet) {
13223
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
13224
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13225
+ ConnectedWalletList,
13226
+ {
13227
+ wallets: connectedWallets,
13228
+ onRemove: onRemoveWallet,
13229
+ onAdd: onAction ?? void 0,
13230
+ status: walletsStatus
13231
+ }
13232
+ ),
13233
+ status === "rejected" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13234
+ AlertBanner,
13235
+ {
13236
+ variant: "error",
13237
+ content: "One of these wallets is not eligible for this sale."
13238
+ }
13239
+ )
13240
+ ] });
13241
+ }
13242
+ if (status === "completed") {
13243
+ const connected = connectedWallets[0];
13244
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
13245
+ onAction !== null && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ClButton, { size: "sm", variant: "secondary", onClick: onAction, children: "Change wallet" }),
13246
+ walletsStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13247
+ AlertBanner,
13248
+ {
13249
+ variant: "info",
13250
+ content: "Loading your connected wallet\u2026"
13251
+ }
13252
+ ) : walletsStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13253
+ AlertBanner,
13254
+ {
13255
+ variant: "error",
13256
+ content: "Couldn't load your connected wallet."
13257
+ }
13258
+ ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13259
+ AlertBanner,
13260
+ {
13261
+ variant: "success",
13262
+ content: connected ? connected.shortAddress : "Wallet connected."
13263
+ }
13264
+ )
13265
+ ] });
13266
+ }
13267
+ if (status === "rejected") {
13268
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
13269
+ onAction !== null && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" }),
13270
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13271
+ AlertBanner,
13272
+ {
13273
+ variant: "error",
13274
+ content: "This wallet is not eligible for this sale."
13275
+ }
13276
+ )
13277
+ ] });
13278
+ }
13279
+ if (onAction === null) return null;
13280
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ClButton, { size: "sm", onClick: onAction, children: "Connect wallet" });
13281
+ }
13282
+ function RequirementItem({
13283
+ ui,
13284
+ expanded = false,
13285
+ onToggle,
13286
+ className,
13287
+ onAction,
13288
+ onRemoveWallet,
13289
+ walletsStatus,
13290
+ onContactSupport
13291
+ }) {
13292
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13293
+ "div",
13294
+ {
13295
+ className: cn(
13296
+ "clcosdk:flex clcosdk:w-full clcosdk:flex-col",
13297
+ className
13298
+ ),
13299
+ children: [
13300
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13301
+ "button",
13302
+ {
13303
+ type: "button",
13304
+ onClick: onToggle,
13305
+ "aria-expanded": expanded,
13306
+ className: "clcosdk:flex clcosdk:h-14 clcosdk:w-full clcosdk:cursor-pointer clcosdk:items-center clcosdk:justify-between clcosdk:rounded-2xl clcosdk:px-2 clcosdk:transition-colors clcosdk:hover:bg-surface",
13307
+ children: [
13308
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
13309
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(StepStatusIcon, { status: ui.status }),
13310
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13311
+ "span",
13312
+ {
13313
+ className: cn(
13314
+ typeClasses.body,
13315
+ "clcosdk:whitespace-nowrap clcosdk:font-medium clcosdk:text-text-primary"
13316
+ ),
13317
+ children: ui.label
13318
+ }
13319
+ )
13320
+ ] }),
13321
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13322
+ import_lucide_react15.ChevronRight,
13323
+ {
13324
+ className: cn(
13325
+ "clcosdk:h-6 clcosdk:w-6 clcosdk:shrink-0 clcosdk:text-text-secondary clcosdk:transition-transform clcosdk:duration-300",
13326
+ expanded && "clcosdk:rotate-90"
13327
+ ),
13328
+ "aria-hidden": "true"
13329
+ }
13330
+ )
13331
+ ]
13332
+ }
13333
+ ),
13334
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13335
+ "div",
13336
+ {
13337
+ className: cn(
13338
+ "clcosdk:grid clcosdk:transition-[grid-template-rows] clcosdk:duration-300 clcosdk:ease-in-out",
13339
+ expanded ? "clcosdk:grid-rows-[1fr]" : "clcosdk:grid-rows-[0fr]"
13340
+ ),
13341
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "clcosdk:min-h-0 clcosdk:overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:px-2 clcosdk:pb-4", children: [
13342
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13343
+ "p",
13344
+ {
13345
+ className: cn(
13346
+ typeClasses.subhead,
13347
+ "clcosdk:text-text-secondary"
13348
+ ),
13349
+ children: ui.description
13350
+ }
13351
+ ),
13352
+ ui.variant === "verification" ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13353
+ VerificationActionZone,
13354
+ {
13355
+ status: ui.status,
13356
+ onAction,
13357
+ onContactSupport
13358
+ }
13359
+ ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13360
+ WalletActionZone,
13361
+ {
13362
+ status: ui.status,
13363
+ multiWallet: ui.multiWallet,
13364
+ connectedWallets: ui.connectedWallets,
13365
+ walletsStatus,
13366
+ onAction,
13367
+ onRemoveWallet
13368
+ }
13369
+ )
13370
+ ] }) })
13371
+ }
13372
+ )
13373
+ ]
13374
+ }
13375
+ ) });
13376
+ }
13377
+
13378
+ // src/client/components/requirements/RequirementsChecklistView.tsx
13379
+ var import_jsx_runtime61 = require("react/jsx-runtime");
13380
+ function RequirementsChecklistView(props) {
13381
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RequirementsChecklistViewBody, { ...props }) });
13382
+ }
13383
+ function RequirementsChecklistViewBody({
13384
+ state,
13385
+ onEvent,
13386
+ loading,
13387
+ error,
13388
+ unauthenticatedState,
13389
+ className
13390
+ }) {
13391
+ switch (state.type) {
13392
+ case "loading":
13393
+ return loading ?? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(LoadingState2, {});
13394
+ case "not-authenticated":
13395
+ return unauthenticatedState ?? null;
13396
+ case "error":
13397
+ return error ?? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
13398
+ AlertBanner,
13399
+ {
13400
+ variant: "error",
13401
+ icon: true,
13402
+ content: "Unable to load requirements right now. Please try again.",
13403
+ className: "clcosdk:w-full clcosdk:max-w-[28rem]"
13404
+ }
13405
+ );
13406
+ case "content":
13407
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
13408
+ "div",
13409
+ {
13410
+ className: cn(
13411
+ "clcosdk:flex clcosdk:w-full clcosdk:flex-col clcosdk:gap-4",
13412
+ className
13413
+ ),
13414
+ children: [
13415
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
13416
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
13417
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: state.description })
13418
+ ] }),
13419
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:divide-y clcosdk:divide-divider", children: state.items.map((row) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
13420
+ RequirementItem,
13421
+ {
13422
+ ui: row.item,
13423
+ expanded: row.expanded,
13424
+ onToggle: () => onEvent({ type: "ON_TOGGLE_ITEM", requirementId: row.id }),
13425
+ onAction: row.actionEnabled ? () => onEvent({
13426
+ type: "ON_REQUIREMENT_ACTION",
13427
+ requirementId: row.id
13428
+ }) : null,
13429
+ onRemoveWallet: row.wallets ? (id) => state.removeWallet(id) : void 0,
13430
+ walletsStatus: row.wallets?.status,
13431
+ onContactSupport: row.contactSupportEnabled ? () => onEvent({
13432
+ type: "ON_CONTACT_SUPPORT",
13433
+ requirementId: row.id
13434
+ }) : null
13435
+ },
13436
+ row.id
13437
+ )) }),
13438
+ state.ineligible && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
13439
+ AlertBanner,
13440
+ {
13441
+ variant: "error",
13442
+ icon: true,
13443
+ content: "You are not eligible to participate."
13444
+ }
13445
+ ),
13446
+ state.continueAction && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
13447
+ ClButton,
13448
+ {
13449
+ fullWidth: true,
13450
+ disabled: !state.continueAction.enabled,
13451
+ onClick: () => onEvent({ type: "ON_CONTINUE" }),
13452
+ children: "Continue"
13453
+ }
13454
+ )
13455
+ ]
13456
+ }
13457
+ );
13458
+ default: {
13459
+ const exhaustive = state;
13460
+ return exhaustive;
13461
+ }
13462
+ }
13463
+ }
13464
+ function LoadingState2() {
13465
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
13466
+ "output",
13476
13467
  {
13477
- state,
13478
- onEvent,
13479
- className
13468
+ "aria-live": "polite",
13469
+ className: "clcosdk:flex clcosdk:min-h-40 clcosdk:items-center clcosdk:justify-center clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:bg-background clcosdk:p-6",
13470
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Loading requirements..." })
13480
13471
  }
13481
13472
  );
13482
13473
  }
13483
13474
 
13484
13475
  // src/client/components/requirements/tax-document/TaxDocumentModalView.tsx
13485
- var import_jsx_runtime63 = require("react/jsx-runtime");
13476
+ var import_jsx_runtime62 = require("react/jsx-runtime");
13486
13477
  function TaxDocumentModalView({
13487
13478
  state,
13488
13479
  onEvent,
@@ -13491,7 +13482,7 @@ function TaxDocumentModalView({
13491
13482
  if (state.type === "hidden") {
13492
13483
  return null;
13493
13484
  }
13494
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-black/50 clcosdk:p-4", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
13485
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-black/50 clcosdk:p-4", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
13495
13486
  "div",
13496
13487
  {
13497
13488
  className: cn(
@@ -13499,11 +13490,11 @@ function TaxDocumentModalView({
13499
13490
  className
13500
13491
  ),
13501
13492
  children: [
13502
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:items-start clcosdk:justify-between clcosdk:gap-4", children: [
13503
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
13504
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CloseButton, { onClick: () => onEvent({ type: "ON_CLOSE" }) })
13493
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:items-start clcosdk:justify-between clcosdk:gap-4", children: [
13494
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h3", { className: cn(typeClasses.h3, "clcosdk:text-text-primary"), children: state.title }),
13495
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CloseButton, { onClick: () => onEvent({ type: "ON_CLOSE" }) })
13505
13496
  ] }),
13506
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Screen, { screen: state.screen, onEvent })
13497
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Screen, { screen: state.screen, onEvent })
13507
13498
  ]
13508
13499
  }
13509
13500
  ) }) });
@@ -13514,11 +13505,11 @@ function Screen({
13514
13505
  }) {
13515
13506
  switch (screen.type) {
13516
13507
  case "loading":
13517
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(LoadingScreen, {});
13508
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(LoadingScreen, {});
13518
13509
  case "error":
13519
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(AlertBanner, { variant: "error", icon: true, content: screen.message });
13510
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(AlertBanner, { variant: "error", icon: true, content: screen.message });
13520
13511
  case "review":
13521
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13512
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13522
13513
  ReviewScreen,
13523
13514
  {
13524
13515
  fields: screen.fields,
@@ -13529,9 +13520,9 @@ function Screen({
13529
13520
  }
13530
13521
  );
13531
13522
  case "editing":
13532
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(EditScreen, { fields: screen.fields, onEvent });
13523
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(EditScreen, { fields: screen.fields, onEvent });
13533
13524
  case "sign-only":
13534
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13525
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13535
13526
  SignOnlyScreen,
13536
13527
  {
13537
13528
  signing: screen.signing,
@@ -13546,14 +13537,14 @@ function Screen({
13546
13537
  }
13547
13538
  }
13548
13539
  function LoadingScreen() {
13549
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13540
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13550
13541
  "output",
13551
13542
  {
13552
13543
  "aria-live": "polite",
13553
13544
  className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4",
13554
- children: [0, 1, 2, 3, 4].map((row) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1", children: [
13555
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "clcosdk:h-3 clcosdk:w-28 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" }),
13556
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "clcosdk:h-5 clcosdk:w-48 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" })
13545
+ children: [0, 1, 2, 3, 4].map((row) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1", children: [
13546
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "clcosdk:h-3 clcosdk:w-28 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" }),
13547
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "clcosdk:h-5 clcosdk:w-48 clcosdk:animate-pulse clcosdk:rounded clcosdk:bg-surface" })
13557
13548
  ] }, row))
13558
13549
  }
13559
13550
  );
@@ -13565,9 +13556,9 @@ function ReviewScreen({
13565
13556
  signError,
13566
13557
  onEvent
13567
13558
  }) {
13568
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
13569
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Review your information below. If anything looks incorrect, edit before signing." }),
13570
- piiUnavailable && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13559
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
13560
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "Review your information below. If anything looks incorrect, edit before signing." }),
13561
+ piiUnavailable && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13571
13562
  AlertBanner,
13572
13563
  {
13573
13564
  variant: "info",
@@ -13575,27 +13566,27 @@ function ReviewScreen({
13575
13566
  content: "We don't have this information on file yet \u2014 please fill it in below."
13576
13567
  }
13577
13568
  ),
13578
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, displayValue }) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
13569
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, displayValue }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
13579
13570
  "div",
13580
13571
  {
13581
13572
  className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1",
13582
13573
  children: [
13583
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13574
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13584
13575
  "span",
13585
13576
  {
13586
13577
  className: cn(typeClasses.label, "clcosdk:text-text-secondary"),
13587
13578
  children: label
13588
13579
  }
13589
13580
  ),
13590
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: cn(typeClasses.body, "clcosdk:text-text-primary"), children: displayValue })
13581
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: cn(typeClasses.body, "clcosdk:text-text-primary"), children: displayValue })
13591
13582
  ]
13592
13583
  },
13593
13584
  field
13594
13585
  )) }),
13595
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: cn(typeClasses.caption, "clcosdk:text-text-secondary"), children: "By signing, you certify that the information above is accurate and that you are the beneficial owner of the income this form relates to. This document cannot be edited once signed." }),
13596
- signError && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(AlertBanner, { variant: "error", icon: true, content: signError }),
13597
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
13598
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13586
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: cn(typeClasses.caption, "clcosdk:text-text-secondary"), children: "By signing, you certify that the information above is accurate and that you are the beneficial owner of the income this form relates to. This document cannot be edited once signed." }),
13587
+ signError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(AlertBanner, { variant: "error", icon: true, content: signError }),
13588
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
13589
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13599
13590
  ClButton,
13600
13591
  {
13601
13592
  fullWidth: true,
@@ -13605,7 +13596,7 @@ function ReviewScreen({
13605
13596
  children: "Sign W-8BEN"
13606
13597
  }
13607
13598
  ),
13608
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13599
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13609
13600
  ClButton,
13610
13601
  {
13611
13602
  fullWidth: true,
@@ -13622,20 +13613,20 @@ function EditScreen({
13622
13613
  fields,
13623
13614
  onEvent
13624
13615
  }) {
13625
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
13626
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, placeholder, value }) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
13616
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
13617
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:border-t clcosdk:border-divider clcosdk:pt-4", children: fields.map(({ field, label, placeholder, value }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
13627
13618
  "label",
13628
13619
  {
13629
13620
  className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-1",
13630
13621
  children: [
13631
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13622
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13632
13623
  "span",
13633
13624
  {
13634
13625
  className: cn(typeClasses.label, "clcosdk:text-text-secondary"),
13635
13626
  children: label
13636
13627
  }
13637
13628
  ),
13638
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13629
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13639
13630
  "input",
13640
13631
  {
13641
13632
  type: "text",
@@ -13656,9 +13647,9 @@ function EditScreen({
13656
13647
  },
13657
13648
  field
13658
13649
  )) }),
13659
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
13660
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ClButton, { fullWidth: true, onClick: () => onEvent({ type: "ON_SAVE_EDIT" }), children: "Save & review" }),
13661
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13650
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
13651
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ClButton, { fullWidth: true, onClick: () => onEvent({ type: "ON_SAVE_EDIT" }), children: "Save & review" }),
13652
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13662
13653
  ClButton,
13663
13654
  {
13664
13655
  fullWidth: true,
@@ -13675,10 +13666,10 @@ function SignOnlyScreen({
13675
13666
  signError,
13676
13667
  onEvent
13677
13668
  }) {
13678
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
13679
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "As an entity investor, you must complete a W-8BEN-E to confirm your foreign tax status and claim applicable treaty benefits. You'll receive an email to complete the signing." }),
13680
- signError && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(AlertBanner, { variant: "error", icon: true, content: signError }),
13681
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13669
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-6", children: [
13670
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: cn(typeClasses.body, "clcosdk:text-text-secondary"), children: "As an entity investor, you must complete a W-8BEN-E to confirm your foreign tax status and claim applicable treaty benefits. You'll receive an email to complete the signing." }),
13671
+ signError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(AlertBanner, { variant: "error", icon: true, content: signError }),
13672
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13682
13673
  ClButton,
13683
13674
  {
13684
13675
  fullWidth: true,
@@ -13990,7 +13981,7 @@ function toFieldsUi(fields) {
13990
13981
  }
13991
13982
 
13992
13983
  // src/client/components/requirements/tax-document/TaxDocumentModalContainer.tsx
13993
- var import_jsx_runtime64 = require("react/jsx-runtime");
13984
+ var import_jsx_runtime63 = require("react/jsx-runtime");
13994
13985
  function TaxDocumentModalContainer({
13995
13986
  isOpen,
13996
13987
  onClose,
@@ -14002,7 +13993,7 @@ function TaxDocumentModalContainer({
14002
13993
  onClose,
14003
13994
  onSubmitted
14004
13995
  });
14005
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
13996
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
14006
13997
  TaxDocumentModalView,
14007
13998
  {
14008
13999
  state,
@@ -14012,6 +14003,39 @@ function TaxDocumentModalContainer({
14012
14003
  );
14013
14004
  }
14014
14005
 
14006
+ // src/client/components/requirements/VerificationOverlay.tsx
14007
+ var import_jsx_runtime64 = require("react/jsx-runtime");
14008
+ function VerificationOverlay({
14009
+ onClose,
14010
+ children
14011
+ }) {
14012
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(VerificationOverlayBody, { onClose, children }) });
14013
+ }
14014
+ function VerificationOverlayBody({
14015
+ onClose,
14016
+ children
14017
+ }) {
14018
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
14019
+ "div",
14020
+ {
14021
+ role: "dialog",
14022
+ "aria-modal": "true",
14023
+ "aria-label": "Identity verification",
14024
+ className: "clcosdk:fixed clcosdk:inset-0 clcosdk:z-50 clcosdk:flex clcosdk:items-center clcosdk:justify-center clcosdk:bg-overlay clcosdk:p-4",
14025
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "clcosdk:relative clcosdk:flex clcosdk:max-h-[92vh] clcosdk:w-full clcosdk:max-w-[760px] clcosdk:flex-col clcosdk:overflow-y-auto clcosdk:rounded-2xl clcosdk:bg-background clcosdk:p-6 clcosdk:pt-14", children: [
14026
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
14027
+ CloseButton,
14028
+ {
14029
+ onClick: onClose,
14030
+ className: "clcosdk:absolute clcosdk:top-4 clcosdk:right-4"
14031
+ }
14032
+ ),
14033
+ children
14034
+ ] })
14035
+ }
14036
+ );
14037
+ }
14038
+
14015
14039
  // src/client/components/requirements/wallet/ConnectWalletModalView.tsx
14016
14040
  var import_react43 = require("react");
14017
14041
  var import_jsx_runtime65 = require("react/jsx-runtime");
@@ -14407,60 +14431,9 @@ function ConnectWalletModalContainer({
14407
14431
  );
14408
14432
  }
14409
14433
 
14410
- // src/client/hooks/requirements/checklist/useRequirementsChecklistViewModel.ts
14434
+ // src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
14411
14435
  var import_react48 = require("react");
14412
14436
 
14413
- // src/client/hooks/requirements/checklist/useRequirementsChecklistViewModel.types.ts
14414
- var RequirementItemUi = {
14415
- fromDomain(req, statusInfo, label, description2, addresses = []) {
14416
- return {
14417
- variant: RequirementVariant.fromType(req.type),
14418
- status: statusInfo ? RequirementStatus.fromStatusValue(statusInfo.status) : "required",
14419
- label,
14420
- description: description2,
14421
- multiWallet: req.type === "whitelisted_wallet",
14422
- connectedWallets: addresses.map((address) => ({
14423
- id: address.id,
14424
- address: address.address,
14425
- shortAddress: shortenAddress(address.address)
14426
- }))
14427
- };
14428
- }
14429
- };
14430
- var RequirementVariant = {
14431
- fromType(type) {
14432
- switch (type) {
14433
- case "external_wallet":
14434
- case "whitelisted_wallet":
14435
- return "wallet";
14436
- default:
14437
- return "verification";
14438
- }
14439
- }
14440
- };
14441
- var RequirementStatus = {
14442
- fromStatusValue(status) {
14443
- switch (status) {
14444
- case "not_started":
14445
- case "action_needed":
14446
- return "required";
14447
- case "in_progress":
14448
- return "pending";
14449
- case "completed":
14450
- return "completed";
14451
- case "rejected":
14452
- return "rejected";
14453
- }
14454
- }
14455
- };
14456
- var ChecklistStatus = {
14457
- derive(statuses) {
14458
- if (statuses.some((s) => s.status === "rejected")) return "ineligible";
14459
- if (statuses.every((s) => s.status === "completed")) return "eligible";
14460
- return "inProgress";
14461
- }
14462
- };
14463
-
14464
14437
  // src/client/hooks/requirements/data/useOptionAddresses.ts
14465
14438
  var import_react46 = require("react");
14466
14439
  var LOADING_STATE6 = { type: "LOADING" };
@@ -14545,7 +14518,7 @@ var LOADING_STATE7 = { type: "LOADING" };
14545
14518
  function useRequirements(offerId, options = {}) {
14546
14519
  const { coinlist, isReady } = useCoinList();
14547
14520
  const log = useLogger("useRequirements");
14548
- const { data } = options;
14521
+ const { data, enabled = true } = options;
14549
14522
  const [requirementsState, setRequirementsState] = (0, import_react47.useState)(
14550
14523
  data !== void 0 ? { type: "CONTENT", ...data } : LOADING_STATE7
14551
14524
  );
@@ -14553,6 +14526,11 @@ function useRequirements(offerId, options = {}) {
14553
14526
  const refetch = (0, import_react47.useCallback)(() => setFetchKey((k) => k + 1), []);
14554
14527
  (0, import_react47.useEffect)(() => {
14555
14528
  let isCancelled = false;
14529
+ if (!enabled) {
14530
+ return () => {
14531
+ isCancelled = true;
14532
+ };
14533
+ }
14556
14534
  if (!isReady) {
14557
14535
  if (data === void 0) {
14558
14536
  setRequirementsState(LOADING_STATE7);
@@ -14605,11 +14583,62 @@ function useRequirements(offerId, options = {}) {
14605
14583
  return () => {
14606
14584
  isCancelled = true;
14607
14585
  };
14608
- }, [coinlist, isReady, offerId, fetchKey, log]);
14586
+ }, [coinlist, isReady, enabled, offerId, fetchKey, log]);
14609
14587
  return { requirementsState, refetch };
14610
14588
  }
14611
14589
 
14612
- // src/client/hooks/requirements/checklist/useRequirementsChecklistViewModel.ts
14590
+ // src/client/hooks/requirements/useRequirementsChecklistViewModel.types.ts
14591
+ var RequirementItemUi = {
14592
+ fromDomain(req, statusInfo, label, description2, addresses = []) {
14593
+ return {
14594
+ variant: RequirementVariant.fromType(req.type),
14595
+ status: statusInfo ? RequirementStatus.fromStatusValue(statusInfo.status) : "required",
14596
+ label,
14597
+ description: description2,
14598
+ multiWallet: req.type === "whitelisted_wallet",
14599
+ connectedWallets: addresses.map((address) => ({
14600
+ id: address.id,
14601
+ address: address.address,
14602
+ shortAddress: shortenAddress(address.address)
14603
+ }))
14604
+ };
14605
+ }
14606
+ };
14607
+ var RequirementVariant = {
14608
+ fromType(type) {
14609
+ switch (type) {
14610
+ case "external_wallet":
14611
+ case "whitelisted_wallet":
14612
+ return "wallet";
14613
+ default:
14614
+ return "verification";
14615
+ }
14616
+ }
14617
+ };
14618
+ var RequirementStatus = {
14619
+ fromStatusValue(status) {
14620
+ switch (status) {
14621
+ case "not_started":
14622
+ case "action_needed":
14623
+ return "required";
14624
+ case "in_progress":
14625
+ return "pending";
14626
+ case "completed":
14627
+ return "completed";
14628
+ case "rejected":
14629
+ return "rejected";
14630
+ }
14631
+ }
14632
+ };
14633
+ var ChecklistStatus = {
14634
+ derive(statuses) {
14635
+ if (statuses.some((s) => s.status === "rejected")) return "ineligible";
14636
+ if (statuses.every((s) => s.status === "completed")) return "eligible";
14637
+ return "inProgress";
14638
+ }
14639
+ };
14640
+
14641
+ // src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
14613
14642
  var DEFAULT_LABELS = {
14614
14643
  kyc_approved: "KYC Verification",
14615
14644
  external_wallet: "External Wallet",
@@ -14646,11 +14675,15 @@ function useRequirementsChecklistViewModel(options) {
14646
14675
  getLabel,
14647
14676
  getDescription,
14648
14677
  data,
14678
+ enabled = true,
14649
14679
  identityVerificationOptions
14650
14680
  } = options;
14651
14681
  const log = useLogger("useRequirementsChecklistViewModel");
14652
14682
  const { coinlist } = useCoinList();
14653
- const { requirementsState, refetch } = useRequirements(offerId, { data });
14683
+ const { requirementsState, refetch } = useRequirements(offerId, {
14684
+ data,
14685
+ enabled
14686
+ });
14654
14687
  const [expandedId, setExpandedId] = (0, import_react48.useState)(null);
14655
14688
  const [taxDocumentOpen, setTaxDocumentOpen] = (0, import_react48.useState)(false);
14656
14689
  const [connectWalletOpen, setConnectWalletOpen] = (0, import_react48.useState)(false);
@@ -14677,7 +14710,7 @@ function useRequirementsChecklistViewModel(options) {
14677
14710
  refetch: refetchAddresses,
14678
14711
  disconnect
14679
14712
  } = useOptionAddresses(offerId, optionId, {
14680
- enabled: hasWalletRequirement
14713
+ enabled: enabled && hasWalletRequirement
14681
14714
  });
14682
14715
  const removeWallet = (0, import_react48.useCallback)(
14683
14716
  async (addressId) => {
@@ -14924,16 +14957,20 @@ function toVerificationUi(verifyingRequirementId, statusById, identityVerificati
14924
14957
  };
14925
14958
  }
14926
14959
 
14927
- // src/client/components/requirements/checklist/RequirementsChecklistContainer.tsx
14960
+ // src/client/components/requirements/RequirementsChecklistContainer.tsx
14928
14961
  var import_jsx_runtime67 = require("react/jsx-runtime");
14929
14962
  function RequirementsChecklistContainer({
14930
14963
  loading,
14931
14964
  error,
14932
14965
  unauthenticatedState,
14933
14966
  className,
14967
+ enabled = true,
14934
14968
  ...options
14935
14969
  }) {
14936
- const { state, onEvent } = useRequirementsChecklistViewModel(options);
14970
+ const { state, onEvent } = useRequirementsChecklistViewModel({
14971
+ ...options,
14972
+ enabled
14973
+ });
14937
14974
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
14938
14975
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14939
14976
  RequirementsChecklistView,
@@ -14990,10 +15027,10 @@ function RequirementsChecklistContainer({
14990
15027
  ] });
14991
15028
  }
14992
15029
 
14993
- // src/client/core/observability/pino-client-logger.ts
15030
+ // src/client/core/shared/observability/pino-client-logger.ts
14994
15031
  var import_pino = require("pino");
14995
15032
 
14996
- // src/shared/core/observability/pino-logger.ts
15033
+ // src/universal/core/shared/observability/pino-logger.ts
14997
15034
  function toPinoRecord(event) {
14998
15035
  try {
14999
15036
  const record = {};
@@ -15119,7 +15156,7 @@ function reportRenderFailure(sink, error) {
15119
15156
  }
15120
15157
  }
15121
15158
 
15122
- // src/client/core/observability/pino-client-logger.ts
15159
+ // src/client/core/shared/observability/pino-client-logger.ts
15123
15160
  function pinoClientLogger(options) {
15124
15161
  return loggerOverPino(
15125
15162
  // `name` as a child binding rather than pino's `name` option: the option
@@ -15215,12 +15252,17 @@ var LOADING_STATE8 = { type: "LOADING" };
15215
15252
  function useParticipations(offerId, options = {}) {
15216
15253
  const { coinlist, isReady } = useCoinList();
15217
15254
  const log = useLogger("useParticipations");
15218
- const { data } = options;
15255
+ const { data, enabled = true } = options;
15219
15256
  const [participationsState, setParticipationsState] = (0, import_react50.useState)(
15220
15257
  data !== void 0 ? { type: "CONTENT", participations: data } : LOADING_STATE8
15221
15258
  );
15222
15259
  (0, import_react50.useEffect)(() => {
15223
15260
  let isCancelled = false;
15261
+ if (!enabled) {
15262
+ return () => {
15263
+ isCancelled = true;
15264
+ };
15265
+ }
15224
15266
  if (!isReady) {
15225
15267
  if (data === void 0) {
15226
15268
  setParticipationsState(LOADING_STATE8);
@@ -15256,7 +15298,7 @@ function useParticipations(offerId, options = {}) {
15256
15298
  return () => {
15257
15299
  isCancelled = true;
15258
15300
  };
15259
- }, [coinlist, isReady, offerId, data, log]);
15301
+ }, [coinlist, isReady, enabled, offerId, data, log]);
15260
15302
  return { participationsState };
15261
15303
  }
15262
15304
 
@@ -15266,12 +15308,17 @@ var LOADING_STATE9 = { type: "LOADING" };
15266
15308
  function useOfferDetails(offerId, options = {}) {
15267
15309
  const { coinlist, isReady } = useCoinList();
15268
15310
  const log = useLogger("useOfferDetails");
15269
- const { data } = options;
15311
+ const { data, enabled = true } = options;
15270
15312
  const [offerDetailsState, setOfferDetailsState] = (0, import_react51.useState)(
15271
15313
  data !== void 0 ? { type: "CONTENT", offerDetail: data } : LOADING_STATE9
15272
15314
  );
15273
15315
  (0, import_react51.useEffect)(() => {
15274
15316
  let isCancelled = false;
15317
+ if (!enabled) {
15318
+ return () => {
15319
+ isCancelled = true;
15320
+ };
15321
+ }
15275
15322
  if (!isReady) {
15276
15323
  if (data === void 0) {
15277
15324
  setOfferDetailsState(LOADING_STATE9);
@@ -15307,7 +15354,7 @@ function useOfferDetails(offerId, options = {}) {
15307
15354
  return () => {
15308
15355
  isCancelled = true;
15309
15356
  };
15310
- }, [coinlist, isReady, offerId, data, log]);
15357
+ }, [coinlist, isReady, enabled, offerId, data, log]);
15311
15358
  return { offerDetailsState };
15312
15359
  }
15313
15360