@coinlist-co/react 0.12.2-rc.818bed6 → 0.12.2-rc.99b1bd5

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 (34) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-OUFI3D3Q.js → chunk-IQAJ3L25.js} +173 -259
  3. package/dist/chunk-IQAJ3L25.js.map +1 -0
  4. package/dist/{chunk-2HCSM3FB.js → chunk-J45AY2FX.js} +10 -10
  5. package/dist/chunk-J45AY2FX.js.map +1 -0
  6. package/dist/{chunk-YMDYLYL3.js → chunk-M2TURNJH.js} +821 -801
  7. package/dist/chunk-M2TURNJH.js.map +1 -0
  8. package/dist/chunk-MJ6YXZWH.js +22 -0
  9. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  10. package/dist/client/index.d.ts +2840 -5756
  11. package/dist/client/index.js +8254 -9600
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.d.ts +4 -37
  14. package/dist/server/index.js +6 -4
  15. package/dist/server/index.js.map +1 -1
  16. package/dist/{time-DJU6E8KK.d.cts → time-DkU7jivQ.d.ts} +1913 -3256
  17. package/dist/{token-registry-snapshot-DGG5N27C.d.ts → token-registry-snapshot-D0OWXMe4.d.ts} +22 -58
  18. package/dist/universal/index.d.ts +80 -1080
  19. package/dist/universal/index.js +22 -50
  20. package/package.json +18 -14
  21. package/dist/chunk-2HCSM3FB.js.map +0 -1
  22. package/dist/chunk-OUFI3D3Q.js.map +0 -1
  23. package/dist/chunk-YMDYLYL3.js.map +0 -1
  24. package/dist/client/index.cjs +0 -20774
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -8328
  27. package/dist/server/index.cjs +0 -4580
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -385
  30. package/dist/time-DJU6E8KK.d.ts +0 -4052
  31. package/dist/token-registry-snapshot-B0xCp3GD.d.cts +0 -245
  32. package/dist/universal/index.cjs +0 -4625
  33. package/dist/universal/index.cjs.map +0 -1
  34. package/dist/universal/index.d.cts +0 -1376
@@ -291,105 +291,74 @@ function isExpired({
291
291
  return now >= expiresAt - buffer;
292
292
  }
293
293
 
294
- // src/universal/core/shared/blockchain/erc20/abi.ts
295
- var ERC20_ABI = [
296
- {
297
- type: "function",
298
- name: "allowance",
299
- inputs: [
300
- { name: "owner", type: "address" },
301
- { name: "spender", type: "address" }
302
- ],
303
- outputs: [{ name: "", type: "uint256" }],
304
- stateMutability: "view"
305
- },
306
- {
307
- type: "function",
308
- name: "approve",
309
- inputs: [
310
- { name: "spender", type: "address" },
311
- { name: "amount", type: "uint256" }
312
- ],
313
- outputs: [{ name: "", type: "bool" }],
314
- stateMutability: "nonpayable"
315
- },
316
- {
317
- type: "function",
318
- name: "balanceOf",
319
- inputs: [{ name: "account", type: "address" }],
320
- outputs: [{ name: "", type: "uint256" }],
321
- stateMutability: "view"
322
- },
323
- {
324
- type: "function",
325
- name: "decimals",
326
- inputs: [],
327
- outputs: [{ name: "", type: "uint8" }],
328
- stateMutability: "view"
329
- },
330
- {
331
- type: "function",
332
- name: "name",
333
- inputs: [],
334
- outputs: [{ name: "", type: "string" }],
335
- stateMutability: "view"
336
- },
337
- {
338
- type: "function",
339
- name: "symbol",
340
- inputs: [],
341
- outputs: [{ name: "", type: "string" }],
342
- stateMutability: "view"
343
- },
344
- {
345
- type: "function",
346
- name: "totalSupply",
347
- inputs: [],
348
- outputs: [{ name: "", type: "uint256" }],
349
- stateMutability: "view"
350
- },
351
- {
352
- type: "function",
353
- name: "transfer",
354
- inputs: [
355
- { name: "recipient", type: "address" },
356
- { name: "amount", type: "uint256" }
357
- ],
358
- outputs: [{ name: "", type: "bool" }],
359
- stateMutability: "nonpayable"
360
- },
361
- {
362
- type: "function",
363
- name: "transferFrom",
364
- inputs: [
365
- { name: "sender", type: "address" },
366
- { name: "recipient", type: "address" },
367
- { name: "amount", type: "uint256" }
368
- ],
369
- outputs: [{ name: "", type: "bool" }],
370
- stateMutability: "nonpayable"
371
- },
372
- {
373
- type: "event",
374
- name: "Approval",
375
- inputs: [
376
- { name: "owner", type: "address", indexed: true },
377
- { name: "spender", type: "address", indexed: true },
378
- { name: "value", type: "uint256", indexed: false }
379
- ],
380
- anonymous: false
381
- },
382
- {
383
- type: "event",
384
- name: "Transfer",
385
- inputs: [
386
- { name: "from", type: "address", indexed: true },
387
- { name: "to", type: "address", indexed: true },
388
- { name: "value", type: "uint256", indexed: false }
389
- ],
390
- anonymous: false
294
+ // src/universal/types/blockchain/ui.ts
295
+ var FormattedAmountUi = (value) => value;
296
+ var FormattedPercentUi = (value) => value;
297
+ var TxExplorerUrl = (value) => value;
298
+ var ShortenedWalletAddress = (value) => value;
299
+ var FormattedAmountAssetUi = (value) => value;
300
+ var AssetIconUrl = (value) => value;
301
+
302
+ // src/universal/core/shared/blockchain/chain.ts
303
+ import { base, baseSepolia, mainnet, sepolia } from "viem/chains";
304
+ var VIEM_CHAINS = {
305
+ ethereum_mainnet: mainnet,
306
+ ethereum_sepolia: sepolia,
307
+ base_mainnet: base,
308
+ base_sepolia: baseSepolia
309
+ };
310
+ function viemChain(chain) {
311
+ return VIEM_CHAINS[chain];
312
+ }
313
+ function getChainId(chain) {
314
+ return VIEM_CHAINS[chain].id;
315
+ }
316
+ function chainFromId(chainId) {
317
+ const chains = Object.keys(VIEM_CHAINS);
318
+ const chain = chains.find((c) => String(VIEM_CHAINS[c].id) === chainId);
319
+ if (!chain) {
320
+ throw new ValidationError(`Unsupported EIP-155 chain id: "${chainId}"`);
391
321
  }
392
- ];
322
+ return chain;
323
+ }
324
+ function contractOn(contracts, chain) {
325
+ return contracts.find((contract) => contract.chain === chain)?.address ?? null;
326
+ }
327
+ function getNetworkName(chain) {
328
+ switch (chain) {
329
+ case "ethereum_mainnet":
330
+ return "Ethereum";
331
+ case "ethereum_sepolia":
332
+ return "Ethereum Sepolia";
333
+ case "base_mainnet":
334
+ return "Base";
335
+ case "base_sepolia":
336
+ return "Base Sepolia";
337
+ default: {
338
+ const _exhaustive = chain;
339
+ return _exhaustive;
340
+ }
341
+ }
342
+ }
343
+ function txExplorerUrl(chain, txHash) {
344
+ return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);
345
+ }
346
+ function explorerBaseUrl(chain) {
347
+ switch (chain) {
348
+ case "ethereum_mainnet":
349
+ return "https://etherscan.io";
350
+ case "ethereum_sepolia":
351
+ return "https://sepolia.etherscan.io";
352
+ case "base_mainnet":
353
+ return "https://basescan.org";
354
+ case "base_sepolia":
355
+ return "https://sepolia-explorer.base.org";
356
+ default: {
357
+ const _exhaustive = chain;
358
+ return _exhaustive;
359
+ }
360
+ }
361
+ }
393
362
 
394
363
  // src/universal/types/blockchain/core.ts
395
364
  var ETHEREUM_CHAINS = {
@@ -453,8 +422,18 @@ var BlockchainAmount = Object.assign(
453
422
  {
454
423
  add: (a, b) => combineAmounts(a, b, (x, y) => x + y),
455
424
  sub: (a, b) => combineAmounts(a, b, (x, y) => x - y),
456
- mul: multiplyAmounts,
457
- div: divideAmounts
425
+ /**
426
+ * `a * b`, in `a`'s decimals - a price times a quantity. Multiplies before
427
+ * it rescales, then truncates towards zero. The exact inverse of `div`.
428
+ */
429
+ mul: (a, b) => multiplyAmounts(a, b),
430
+ /**
431
+ * `a / b`, in `a`'s decimals - a price, a ratio. Rescales before it
432
+ * divides, then truncates towards zero.
433
+ *
434
+ * @throws MathError when `b` is zero.
435
+ */
436
+ div: (a, b) => divideAmounts(a, b)
458
437
  }
459
438
  );
460
439
  function multiplyAmounts(a, b) {
@@ -511,6 +490,36 @@ function blockchainAmountFromRawOrThrow({
511
490
  throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
512
491
  }
513
492
  }
493
+ function positiveAmountFromRawOrThrow({
494
+ label,
495
+ raw,
496
+ decimals,
497
+ reason
498
+ }) {
499
+ const amount = blockchainAmountFromRawOrThrow({ label, raw, decimals });
500
+ if (amount.raw === 0n) {
501
+ throw new ValidationError(
502
+ `${label}: must be greater than zero ("${raw}") - ${reason}`
503
+ );
504
+ }
505
+ return amount;
506
+ }
507
+ function pricePerShare({
508
+ usd,
509
+ shares
510
+ }) {
511
+ const price = BlockchainAmount.div(usd, shares);
512
+ return BlockchainAmount({
513
+ raw: assertPriceFits(price.raw),
514
+ decimals: price.decimals
515
+ });
516
+ }
517
+ function assertPriceFits(raw) {
518
+ if (raw > MAX_UINT_256) {
519
+ throw new MathError(`Price per share: out of uint256 bounds (${raw})`);
520
+ }
521
+ return raw;
522
+ }
514
523
  function parseBlockchainAmount(amount, decimals) {
515
524
  const trimmed = amount.trim();
516
525
  if (trimmed === "") return { valid: false, reason: { type: "empty" } };
@@ -624,10 +633,13 @@ function requiredDate(value, field) {
624
633
  return date;
625
634
  }
626
635
  function dateOrNull(value, field) {
627
- return value === null ? null : requiredDate(value, field);
636
+ return mapNullish(value, (date) => requiredDate(date, field));
628
637
  }
629
638
  function decimalOrNull(value) {
630
- return value === null ? null : DecimalString(value);
639
+ return mapNullish(value, DecimalString);
640
+ }
641
+ function mapNullish(value, parse) {
642
+ return value === null || value === void 0 ? null : parse(value);
631
643
  }
632
644
  function requiredArray(value, field) {
633
645
  if (!Array.isArray(value)) {
@@ -637,39 +649,14 @@ function requiredArray(value, field) {
637
649
  }
638
650
  return value;
639
651
  }
652
+ function txFromWire(wire) {
653
+ return {
654
+ to: EvmContractAddress(wire.to),
655
+ data: HexEncodedTransactionData(wire.data)
656
+ };
657
+ }
640
658
 
641
659
  // src/universal/types/providers/centrifuge/centrifuge.ts
642
- var CentrifugeVaultQuote = {
643
- fromDto: (dto) => {
644
- const spendDecimals = AssetDecimals(dto.spend_input_decimals);
645
- const shareDecimals = AssetDecimals(dto.share_decimals);
646
- return {
647
- chain: EthereumChain(dto.chain),
648
- symbol: AssetSymbol(dto.symbol),
649
- spendInputAmount: blockchainAmountFromRawOrThrow({
650
- label: "spend_input_amount",
651
- raw: dto.spend_input_amount,
652
- decimals: spendDecimals
653
- }),
654
- estimatedShares: blockchainAmountFromRawOrThrow({
655
- label: "estimated_shares",
656
- raw: dto.estimated_shares,
657
- decimals: shareDecimals
658
- }),
659
- indicativePrice: decimalOrNull(dto.indicative_price),
660
- minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
661
- label: "minimum_input_amount",
662
- raw: dto.minimum_input_amount,
663
- decimals: spendDecimals
664
- }),
665
- orderability: parseOrderability(
666
- dto.can_order,
667
- dto.reasons,
668
- "CentrifugeVaultQuote"
669
- )
670
- };
671
- }
672
- };
673
660
  var CentrifugeVaultStatus = {
674
661
  fromDto: (dto) => ({
675
662
  chain: EthereumChain(dto.chain),
@@ -696,23 +683,15 @@ var CentrifugeVaultStatus = {
696
683
  };
697
684
  var CentrifugeVaultBuyTransaction = {
698
685
  fromDto: (dto) => {
699
- const spendInputAmount = blockchainAmountFromRawOrThrow({
700
- label: "spend_input_amount",
701
- raw: dto.spend_input_amount,
702
- decimals: AssetDecimals(dto.spend_input_decimals)
703
- });
704
- if (spendInputAmount.raw <= 0n) {
705
- throw new ValidationError(
706
- `spend_input_amount: must be greater than zero ("${dto.spend_input_amount}") - a deposit of nothing is not a request`
707
- );
708
- }
709
686
  return {
710
687
  ...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
711
- spendInputAmount,
712
- estimatedShares: blockchainAmountFromRawOrThrow({
713
- label: "estimated_shares",
714
- raw: dto.estimated_shares,
715
- decimals: AssetDecimals(dto.share_decimals)
688
+ spendInputAmount: positiveAmountFromRawOrThrow({
689
+ label: "spend_input_amount",
690
+ raw: dto.spend_input_amount,
691
+ decimals: AssetDecimals(dto.spend_input_decimals),
692
+ // Frontline refuses an `amount` of zero, so a zero here is a changed
693
+ // encoding, not a small deposit - and not calldata worth signing.
694
+ reason: "a deposit of nothing is not a request"
716
695
  })
717
696
  };
718
697
  }
@@ -727,72 +706,41 @@ var CentrifugeVaultClaimTransaction = {
727
706
  })
728
707
  })
729
708
  };
730
- var CentrifugeVaultPosition = {
731
- fromDto: (dto) => {
732
- const assetDecimals = AssetDecimals(dto.asset_decimals);
733
- const shareDecimals = AssetDecimals(dto.share_decimals);
734
- const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
735
- const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
709
+ var CentrifugeAssets = (amount) => amount;
710
+ var CentrifugeShares = (amount) => amount;
711
+ var CentrifugeDepositPosition = {
712
+ fromContract: (raw, context) => {
713
+ const assets = (label, value) => CentrifugeAssets(contractAmount(label, value, context.assetDecimals));
736
714
  return {
737
- chain: EthereumChain(dto.chain),
738
- symbol: AssetSymbol(dto.symbol),
739
- walletAddress: EvmWalletAddress(dto.wallet_address),
740
- status: dto.status,
741
- requested: asset("requested", dto.requested),
742
- pending: asset("pending", dto.pending),
743
- filledAssets: asset("filled_assets", dto.filled_assets),
744
- earnedShares: shares("earned_shares", dto.earned_shares),
745
- claimedShares: shares("claimed_shares", dto.claimed_shares),
746
- claimableShares: shares("claimable_shares", dto.claimable_shares),
747
- shareBalance: shares("share_balance", dto.share_balance),
748
- averagePrice: decimalOrNull(dto.average_price),
749
- frozen: dto.frozen,
750
- asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
715
+ chain: context.chain,
716
+ proxy: context.proxy,
717
+ walletAddress: context.walletAddress,
718
+ pending: assets("pendingDepositRequest", raw.pendingDepositRequest),
719
+ claimable: assets("claimableDepositRequest", raw.claimableDepositRequest)
751
720
  };
752
721
  }
753
722
  };
754
- var CentrifugeVaultRedeemPosition = {
755
- fromDto: (dto) => ({
756
- chain: EthereumChain(dto.chain),
757
- symbol: AssetSymbol(dto.symbol),
758
- walletAddress: EvmWalletAddress(dto.wallet_address),
759
- status: dto.status,
760
- pending: blockchainAmountFromRawOrThrow({
761
- label: "pending",
762
- raw: dto.pending,
763
- decimals: AssetDecimals(dto.share_decimals)
764
- }),
765
- claimableAssets: blockchainAmountFromRawOrThrow({
766
- label: "claimable_assets",
767
- raw: dto.claimable_assets,
768
- decimals: AssetDecimals(dto.asset_decimals)
769
- }),
770
- frozen: dto.frozen,
771
- asOf: requiredDate(dto.as_of, "CentrifugeVaultRedeemPosition.as_of")
772
- })
723
+ var CentrifugeRedeemPosition = {
724
+ fromContract: (raw, context) => {
725
+ const shares = (label, value) => CentrifugeShares(contractAmount(label, value, context.shareDecimals));
726
+ return {
727
+ chain: context.chain,
728
+ proxy: context.proxy,
729
+ walletAddress: context.walletAddress,
730
+ pending: shares("pendingRedeemRequest", raw.pendingRedeemRequest),
731
+ claimable: shares("claimableRedeemRequest", raw.claimableRedeemRequest)
732
+ };
733
+ }
773
734
  };
774
735
  var CentrifugeVaultLeg = {
775
- /**
776
- * What a claim on the leg would collect: shares for `invest`, the funding
777
- * token for `redeem`.
778
- */
779
- claimable: (leg) => {
780
- switch (leg.direction) {
781
- case "invest":
782
- return leg.position.claimableShares;
783
- case "redeem":
784
- return leg.position.claimableAssets;
785
- default: {
786
- const exhaustive = leg;
787
- return exhaustive;
788
- }
789
- }
790
- },
791
736
  /** Whether the leg has anything queued or anything ready to claim. */
792
- isActive: (leg) => leg.position.pending.raw > 0n || CentrifugeVaultLeg.claimable(leg).raw > 0n
737
+ isActive: (leg) => leg.position.pending.raw > 0n || leg.position.claimable.raw > 0n
793
738
  };
739
+ function contractAmount(label, value, decimals) {
740
+ return BlockchainAmount({ raw: parseUint256(value, label), decimals });
741
+ }
794
742
  var CentrifugeVaultLegId = {
795
- /** Addresses compare case-insensitively: frontline echoes them lower case. */
743
+ /** Addresses compare case-insensitively: a host may pass either case. */
796
744
  of: (leg) => [
797
745
  leg.direction,
798
746
  leg.position.chain,
@@ -828,39 +776,37 @@ function parseOrderability(canOrder, reasons, model) {
828
776
  }
829
777
  function parseTransactionCore(dto, model) {
830
778
  return {
831
- tx: {
832
- to: EvmContractAddress(dto.to),
833
- data: HexEncodedTransactionData(dto.data)
834
- },
779
+ tx: txFromWire(dto),
835
780
  expiresAt: dateOrNull(dto.expires_at, `${model}.expires_at`)
836
781
  };
837
782
  }
838
783
 
784
+ // src/universal/api/frontline/providers/shared/spend-scale.ts
785
+ function assertSpendScaleAgrees({
786
+ published,
787
+ sized,
788
+ trade,
789
+ note
790
+ }) {
791
+ if (published === sized.decimals) return;
792
+ const because = note === void 0 ? "" : ` - ${note}`;
793
+ throw new ValidationError(
794
+ `spend_input_decimals: the ${trade} was priced in ${published} decimals but the order was sized in ${sized.decimals}${because}`
795
+ );
796
+ }
797
+
839
798
  // src/universal/api/frontline/providers/centrifuge/centrifuge.ts
840
- async function getCentrifugeVaultQuote(api, params) {
799
+ async function getCentrifugeVaultStatus(api, params) {
841
800
  const dto = await api.send({
842
801
  method: "GET",
843
- url: "/v1/centrifuge/vault/quote",
802
+ url: "/v1/centrifuge/vault/status",
844
803
  queryParams: {
845
804
  symbol: params.symbol,
846
- chain: params.chain,
847
- amount: params.amount.raw.toString()
805
+ chain: params.chain
848
806
  },
849
807
  attributes: Attributes.protected()
850
808
  });
851
- return CentrifugeVaultQuote.fromDto(dto);
852
- }
853
- async function getCentrifugeVaultStatus(api, params) {
854
- const dto = await api.send({
855
- method: "GET",
856
- url: "/v1/centrifuge/vault/status",
857
- queryParams: {
858
- symbol: params.symbol,
859
- chain: params.chain
860
- },
861
- attributes: Attributes.protected()
862
- });
863
- return CentrifugeVaultStatus.fromDto(dto);
809
+ return CentrifugeVaultStatus.fromDto(dto);
864
810
  }
865
811
  async function buildCentrifugeVaultBuy(api, params) {
866
812
  const dto = await api.send({
@@ -872,30 +818,12 @@ async function buildCentrifugeVaultBuy(api, params) {
872
818
  },
873
819
  attributes: Attributes.protected()
874
820
  });
875
- if (dto.spend_input_decimals !== params.amount.decimals) {
876
- throw new ValidationError(
877
- `spend_input_decimals: the request was priced in ${dto.spend_input_decimals} decimals but the deposit was sized in ${params.amount.decimals}`
878
- );
879
- }
880
- return CentrifugeVaultBuyTransaction.fromDto(dto);
881
- }
882
- async function getCentrifugeVaultPosition(api, params) {
883
- const dto = await api.send({
884
- method: "GET",
885
- url: "/v1/centrifuge/vault/position",
886
- queryParams: walletFields(params),
887
- attributes: Attributes.protected()
888
- });
889
- return CentrifugeVaultPosition.fromDto(dto);
890
- }
891
- async function getCentrifugeVaultRedeemPosition(api, params) {
892
- const dto = await api.send({
893
- method: "GET",
894
- url: "/v1/centrifuge/vault/redeem-position",
895
- queryParams: walletFields(params),
896
- attributes: Attributes.protected()
821
+ assertSpendScaleAgrees({
822
+ published: dto.spend_input_decimals,
823
+ sized: params.amount,
824
+ trade: "deposit"
897
825
  });
898
- return CentrifugeVaultRedeemPosition.fromDto(dto);
826
+ return CentrifugeVaultBuyTransaction.fromDto(dto);
899
827
  }
900
828
  async function createCentrifugeVaultClaim(api, params) {
901
829
  const dto = await api.send({
@@ -923,6 +851,86 @@ function walletFields(params) {
923
851
  };
924
852
  }
925
853
 
854
+ // src/universal/core/providers/checkout/centrifuge/blockchain/abi.ts
855
+ var CENTRIFUGE_PROXY_ABI = [
856
+ {
857
+ type: "function",
858
+ name: "pendingDepositRequest",
859
+ inputs: [{ name: "investor", type: "address" }],
860
+ outputs: [{ name: "", type: "uint256" }],
861
+ stateMutability: "view"
862
+ },
863
+ {
864
+ type: "function",
865
+ name: "claimableDepositRequest",
866
+ inputs: [{ name: "investor", type: "address" }],
867
+ outputs: [{ name: "", type: "uint256" }],
868
+ stateMutability: "view"
869
+ },
870
+ {
871
+ type: "function",
872
+ name: "pendingRedeemRequest",
873
+ inputs: [{ name: "investor", type: "address" }],
874
+ outputs: [{ name: "", type: "uint256" }],
875
+ stateMutability: "view"
876
+ },
877
+ {
878
+ type: "function",
879
+ name: "claimableRedeemRequest",
880
+ inputs: [{ name: "investor", type: "address" }],
881
+ outputs: [{ name: "", type: "uint256" }],
882
+ stateMutability: "view"
883
+ }
884
+ ];
885
+
886
+ // src/universal/api/rpc/providers/centrifuge/position.ts
887
+ async function readCentrifugeDepositPosition(clients, params) {
888
+ const client = clients(params.vault.chain);
889
+ const proxy = proxyOf(params);
890
+ const wallet = params.walletAddress;
891
+ const [pendingDepositRequest, claimableDepositRequest] = await client.multicall({
892
+ allowFailure: false,
893
+ contracts: [
894
+ { ...proxy, functionName: "pendingDepositRequest", args: [wallet] },
895
+ { ...proxy, functionName: "claimableDepositRequest", args: [wallet] }
896
+ ]
897
+ });
898
+ return CentrifugeDepositPosition.fromContract(
899
+ { pendingDepositRequest, claimableDepositRequest },
900
+ contextOf(params)
901
+ );
902
+ }
903
+ async function readCentrifugeRedeemPosition(clients, params) {
904
+ const client = clients(params.vault.chain);
905
+ const proxy = proxyOf(params);
906
+ const wallet = params.walletAddress;
907
+ const [pendingRedeemRequest, claimableRedeemRequest] = await client.multicall(
908
+ {
909
+ allowFailure: false,
910
+ contracts: [
911
+ { ...proxy, functionName: "pendingRedeemRequest", args: [wallet] },
912
+ { ...proxy, functionName: "claimableRedeemRequest", args: [wallet] }
913
+ ]
914
+ }
915
+ );
916
+ return CentrifugeRedeemPosition.fromContract(
917
+ { pendingRedeemRequest, claimableRedeemRequest },
918
+ contextOf(params)
919
+ );
920
+ }
921
+ function proxyOf(params) {
922
+ return { address: params.vault.proxy, abi: CENTRIFUGE_PROXY_ABI };
923
+ }
924
+ function contextOf(params) {
925
+ return {
926
+ chain: params.vault.chain,
927
+ proxy: params.vault.proxy,
928
+ walletAddress: params.walletAddress,
929
+ assetDecimals: params.vault.funding.decimals,
930
+ shareDecimals: params.vault.share.decimals
931
+ };
932
+ }
933
+
926
934
  // src/universal/core/shared/observability/log-cause.ts
927
935
  import {
928
936
  BaseError,
@@ -1106,35 +1114,31 @@ var noopInternalLogger = {
1106
1114
  wrap: (_op, _params, run) => run()
1107
1115
  };
1108
1116
 
1109
- // src/universal/core/checkout/centrifuge/centrifuge-namespace.ts
1117
+ // src/universal/core/providers/checkout/centrifuge/centrifuge-namespace.ts
1110
1118
  var CentrifugeNamespaceImpl = class {
1111
1119
  constructor(ctx) {
1112
1120
  this.ctx = ctx;
1113
1121
  this.log = internalLogger(ctx.logger, "CENTRIFUGE");
1114
1122
  }
1115
- async getQuote(params) {
1116
- return this.log.wrap("getQuote", params, async () => {
1117
- await this.ctx.ensureUserAuthenticated();
1118
- return getCentrifugeVaultQuote(this.ctx.api, params);
1119
- });
1120
- }
1121
1123
  async getVaultStatus(params) {
1122
1124
  return this.log.wrap("getVaultStatus", params, async () => {
1123
1125
  await this.ctx.ensureUserAuthenticated();
1124
1126
  return getCentrifugeVaultStatus(this.ctx.api, params);
1125
1127
  });
1126
1128
  }
1127
- async getPosition(params) {
1128
- return this.log.wrap("getPosition", params, async () => {
1129
- await this.ctx.ensureUserAuthenticated();
1130
- return getCentrifugeVaultPosition(this.ctx.api, params);
1131
- });
1129
+ async readDepositPosition(params) {
1130
+ return this.log.wrap(
1131
+ "readDepositPosition",
1132
+ params,
1133
+ () => readCentrifugeDepositPosition(this.ctx.rpc, params)
1134
+ );
1132
1135
  }
1133
- async getRedeemPosition(params) {
1134
- return this.log.wrap("getRedeemPosition", params, async () => {
1135
- await this.ctx.ensureUserAuthenticated();
1136
- return getCentrifugeVaultRedeemPosition(this.ctx.api, params);
1137
- });
1136
+ async readRedeemPosition(params) {
1137
+ return this.log.wrap(
1138
+ "readRedeemPosition",
1139
+ params,
1140
+ () => readCentrifugeRedeemPosition(this.ctx.rpc, params)
1141
+ );
1138
1142
  }
1139
1143
  async createClaim(params) {
1140
1144
  return this.log.wrap("createClaim", params, async () => {
@@ -1156,20 +1160,112 @@ var CentrifugeNamespaceImpl = class {
1156
1160
  }
1157
1161
  };
1158
1162
 
1159
- // src/universal/api/pagination.ts
1160
- async function fetchAllPages(fetchPage, baseParams) {
1161
- const items = [];
1162
- let cursor = null;
1163
- do {
1164
- const params = {
1165
- ...baseParams ?? {},
1166
- after: cursor ?? void 0
1167
- };
1168
- const page = await fetchPage(params);
1169
- items.push(...page.data);
1170
- cursor = page.startingAfter;
1171
- } while (cursor);
1172
- return items;
1163
+ // src/universal/core/shared/blockchain/formatters.ts
1164
+ import { formatUnits } from "viem";
1165
+ function shortenAddress(address) {
1166
+ const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
1167
+ return ShortenedWalletAddress(short);
1168
+ }
1169
+ function formatAmount(amount, locale, options) {
1170
+ const decimal = formatRawAmount(amount);
1171
+ let [integerPart, fractionPart = ""] = decimal.split(".");
1172
+ const maxFractionDigits = options?.maxFractionDigits;
1173
+ const minFractionDigits = Math.min(
1174
+ options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
1175
+ maxFractionDigits ?? amount.decimals,
1176
+ amount.decimals
1177
+ );
1178
+ if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1179
+ ({ integerPart, fractionPart } = roundFractionHalfUp(
1180
+ integerPart,
1181
+ fractionPart,
1182
+ maxFractionDigits
1183
+ ));
1184
+ }
1185
+ const trimmed = fractionPart.replace(/0+$/, "");
1186
+ const fraction = trimmed.padEnd(minFractionDigits, "0");
1187
+ const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1188
+ if (minFractionDigits === 0 && fraction === "") {
1189
+ return FormattedAmountUi(integerFormatted);
1190
+ }
1191
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1192
+ return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
1193
+ }
1194
+ function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1195
+ if (fractionPart.length <= maxFractionDigits) {
1196
+ return { integerPart, fractionPart };
1197
+ }
1198
+ if (maxFractionDigits === 0) {
1199
+ const roundUp = fractionPart[0] >= "5";
1200
+ const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
1201
+ return { integerPart: integer.toString(), fractionPart: "" };
1202
+ }
1203
+ const trimmed = fractionPart.slice(0, maxFractionDigits);
1204
+ if (fractionPart[maxFractionDigits] < "5") {
1205
+ return { integerPart, fractionPart: trimmed };
1206
+ }
1207
+ const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
1208
+ let carry = 1;
1209
+ for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
1210
+ const sum = digits[i] + carry;
1211
+ if (sum === 10) {
1212
+ digits[i] = 0;
1213
+ carry = 1;
1214
+ } else {
1215
+ digits[i] = sum;
1216
+ carry = 0;
1217
+ }
1218
+ }
1219
+ return {
1220
+ integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
1221
+ fractionPart: digits.join("")
1222
+ };
1223
+ }
1224
+ function formatRawAmount(amount) {
1225
+ return formatUnits(amount.raw, amount.decimals);
1226
+ }
1227
+ function formatCompactAmount(amount, locale) {
1228
+ const value = Number(formatRawAmount(amount));
1229
+ const formatted = new Intl.NumberFormat(locale, {
1230
+ notation: "compact",
1231
+ maximumFractionDigits: 2
1232
+ }).format(value);
1233
+ return FormattedAmountUi(formatted);
1234
+ }
1235
+ function formatBpsAsPercent(bps, locale) {
1236
+ const whole = bps / 100n;
1237
+ const fraction = bps % 100n;
1238
+ const wholeFormatted = whole.toLocaleString(locale);
1239
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1240
+ if (fraction === 0n) {
1241
+ return FormattedPercentUi(`${wholeFormatted}%`);
1242
+ }
1243
+ const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
1244
+ return FormattedPercentUi(
1245
+ `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
1246
+ );
1247
+ }
1248
+ function usdAmount(amount) {
1249
+ return FormattedAmountAssetUi(`$${amount}`);
1250
+ }
1251
+ function assetAmount(amount, symbol) {
1252
+ return FormattedAmountAssetUi(`${amount} ${symbol}`);
1253
+ }
1254
+ var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1255
+ var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
1256
+ var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
1257
+ function formatShareAmount(amount, locale) {
1258
+ return formatAmount(amount, locale, {
1259
+ maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
1260
+ minFractionDigits: SHARE_MIN_FRACTION_DIGITS
1261
+ });
1262
+ }
1263
+ var USD_FRACTION_DIGITS = AssetDecimals(2);
1264
+ function formattedUsdPrice(amount, locale) {
1265
+ if (!amount) return NA_AMOUNT_ASSET_UI;
1266
+ return usdAmount(
1267
+ formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
1268
+ );
1173
1269
  }
1174
1270
 
1175
1271
  // src/universal/types/pagination.ts
@@ -1474,8 +1570,6 @@ var Milestone = {
1474
1570
 
1475
1571
  // src/universal/types/providers/coin-list/token-sale.ts
1476
1572
  var ParticipationId = (value) => value;
1477
- var Blockchain = (value) => value;
1478
- var WalletAddress = (value) => value;
1479
1573
  var ParticipationsPaginationParams = {
1480
1574
  toQueryParams: (params) => {
1481
1575
  const queryParams = PaginationParams.toQueryParams(params);
@@ -1499,10 +1593,10 @@ var Participation = {
1499
1593
  amount: dto.amount,
1500
1594
  displayAmount: dto.amount_string,
1501
1595
  asset: Asset.fromDto(dto.asset),
1502
- chain: Blockchain(dto.chain),
1596
+ chain: isChain(dto.chain) ? dto.chain : null,
1503
1597
  insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
1504
1598
  updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
1505
- walletAddress: walletAddress ? WalletAddress(walletAddress) : null
1599
+ walletAddress: walletAddress ? EvmWalletAddress(walletAddress) : null
1506
1600
  };
1507
1601
  }
1508
1602
  };
@@ -1519,6 +1613,22 @@ var CreateParticipationParams = {
1519
1613
  })
1520
1614
  };
1521
1615
 
1616
+ // src/universal/api/pagination.ts
1617
+ async function fetchAllPages(fetchPage, baseParams) {
1618
+ const items = [];
1619
+ let cursor = null;
1620
+ do {
1621
+ const params = {
1622
+ ...baseParams ?? {},
1623
+ after: cursor ?? void 0
1624
+ };
1625
+ const page = await fetchPage(params);
1626
+ items.push(...page.data);
1627
+ cursor = page.startingAfter;
1628
+ } while (cursor);
1629
+ return items;
1630
+ }
1631
+
1522
1632
  // src/universal/api/frontline/providers/coin-list/token-sale.ts
1523
1633
  async function fetchParticipations(api, offerId) {
1524
1634
  return fetchAllPages(
@@ -1553,7 +1663,7 @@ async function createParticipation(api, params) {
1553
1663
  return Participation.fromDto(dto);
1554
1664
  }
1555
1665
 
1556
- // src/universal/core/checkout/coin-list/token-sale-namespace.ts
1666
+ // src/universal/core/providers/checkout/coin-list/token-sale-namespace.ts
1557
1667
  var CoinListTokenSaleNamespaceImpl = class {
1558
1668
  constructor(ctx) {
1559
1669
  this.ctx = ctx;
@@ -1585,180 +1695,6 @@ var CoinListTokenSaleNamespaceImpl = class {
1585
1695
  }
1586
1696
  };
1587
1697
 
1588
- // src/universal/types/blockchain/ui.ts
1589
- var FormattedAmountUi = (value) => value;
1590
- var FormattedPercentUi = (value) => value;
1591
- var TxExplorerUrl = (value) => value;
1592
- var ShortenedWalletAddress = (value) => value;
1593
- var FormattedAmountAssetUi = (value) => value;
1594
- var AssetIconUrl = (value) => value;
1595
-
1596
- // src/universal/core/shared/blockchain/formatters.ts
1597
- import { formatUnits } from "viem";
1598
- function shortenAddress(address) {
1599
- const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
1600
- return ShortenedWalletAddress(short);
1601
- }
1602
- function formatAmount(amount, locale, options) {
1603
- const decimal = formatRawAmount(amount);
1604
- let [integerPart, fractionPart = ""] = decimal.split(".");
1605
- const maxFractionDigits = options?.maxFractionDigits;
1606
- const minFractionDigits = Math.min(
1607
- options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
1608
- maxFractionDigits ?? amount.decimals,
1609
- amount.decimals
1610
- );
1611
- if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1612
- ({ integerPart, fractionPart } = roundFractionHalfUp(
1613
- integerPart,
1614
- fractionPart,
1615
- maxFractionDigits
1616
- ));
1617
- }
1618
- const trimmed = fractionPart.replace(/0+$/, "");
1619
- const fraction = trimmed.padEnd(minFractionDigits, "0");
1620
- const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1621
- if (minFractionDigits === 0 && fraction === "") {
1622
- return FormattedAmountUi(integerFormatted);
1623
- }
1624
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1625
- return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
1626
- }
1627
- function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1628
- if (fractionPart.length <= maxFractionDigits) {
1629
- return { integerPart, fractionPart };
1630
- }
1631
- if (maxFractionDigits === 0) {
1632
- const roundUp = fractionPart[0] >= "5";
1633
- const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
1634
- return { integerPart: integer.toString(), fractionPart: "" };
1635
- }
1636
- const trimmed = fractionPart.slice(0, maxFractionDigits);
1637
- if (fractionPart[maxFractionDigits] < "5") {
1638
- return { integerPart, fractionPart: trimmed };
1639
- }
1640
- const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
1641
- let carry = 1;
1642
- for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
1643
- const sum = digits[i] + carry;
1644
- if (sum === 10) {
1645
- digits[i] = 0;
1646
- carry = 1;
1647
- } else {
1648
- digits[i] = sum;
1649
- carry = 0;
1650
- }
1651
- }
1652
- return {
1653
- integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
1654
- fractionPart: digits.join("")
1655
- };
1656
- }
1657
- function formatRawAmount(amount) {
1658
- return formatUnits(amount.raw, amount.decimals);
1659
- }
1660
- function formatCompactAmount(amount, locale) {
1661
- const value = Number(formatRawAmount(amount));
1662
- const formatted = new Intl.NumberFormat(locale, {
1663
- notation: "compact",
1664
- maximumFractionDigits: 2
1665
- }).format(value);
1666
- return FormattedAmountUi(formatted);
1667
- }
1668
- function formatBpsAsPercent(bps, locale) {
1669
- const whole = bps / 100n;
1670
- const fraction = bps % 100n;
1671
- const wholeFormatted = whole.toLocaleString(locale);
1672
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1673
- if (fraction === 0n) {
1674
- return FormattedPercentUi(`${wholeFormatted}%`);
1675
- }
1676
- const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
1677
- return FormattedPercentUi(
1678
- `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
1679
- );
1680
- }
1681
- function usdAmount(amount) {
1682
- return FormattedAmountAssetUi(`$${amount}`);
1683
- }
1684
- function assetAmount(amount, symbol) {
1685
- return FormattedAmountAssetUi(`${amount} ${symbol}`);
1686
- }
1687
- var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1688
- var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
1689
- var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
1690
- function formatShareAmount(amount, locale) {
1691
- return formatAmount(amount, locale, {
1692
- maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
1693
- minFractionDigits: SHARE_MIN_FRACTION_DIGITS
1694
- });
1695
- }
1696
- var USD_FRACTION_DIGITS = AssetDecimals(2);
1697
- function formattedUsdPrice(amount, locale) {
1698
- if (!amount) return NA_AMOUNT_ASSET_UI;
1699
- return usdAmount(
1700
- formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
1701
- );
1702
- }
1703
-
1704
- // src/universal/core/shared/blockchain/chain.ts
1705
- import { base, baseSepolia, mainnet, sepolia } from "viem/chains";
1706
- var VIEM_CHAINS = {
1707
- ethereum_mainnet: mainnet,
1708
- ethereum_sepolia: sepolia,
1709
- base_mainnet: base,
1710
- base_sepolia: baseSepolia
1711
- };
1712
- function viemChain(chain) {
1713
- return VIEM_CHAINS[chain];
1714
- }
1715
- function getChainId(chain) {
1716
- return VIEM_CHAINS[chain].id;
1717
- }
1718
- function chainFromId(chainId) {
1719
- const chains = Object.keys(VIEM_CHAINS);
1720
- const chain = chains.find((c) => String(VIEM_CHAINS[c].id) === chainId);
1721
- if (!chain) {
1722
- throw new ValidationError(`Unsupported EIP-155 chain id: "${chainId}"`);
1723
- }
1724
- return chain;
1725
- }
1726
- function getNetworkName(chain) {
1727
- switch (chain) {
1728
- case "ethereum_mainnet":
1729
- return "Ethereum";
1730
- case "ethereum_sepolia":
1731
- return "Ethereum Sepolia";
1732
- case "base_mainnet":
1733
- return "Base";
1734
- case "base_sepolia":
1735
- return "Base Sepolia";
1736
- default: {
1737
- const _exhaustive = chain;
1738
- return _exhaustive;
1739
- }
1740
- }
1741
- }
1742
- function txExplorerUrl(chain, txHash) {
1743
- return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);
1744
- }
1745
- function explorerBaseUrl(chain) {
1746
- switch (chain) {
1747
- case "ethereum_mainnet":
1748
- return "https://etherscan.io";
1749
- case "ethereum_sepolia":
1750
- return "https://sepolia.etherscan.io";
1751
- case "base_mainnet":
1752
- return "https://basescan.org";
1753
- case "base_sepolia":
1754
- return "https://sepolia-explorer.base.org";
1755
- default: {
1756
- const _exhaustive = chain;
1757
- return _exhaustive;
1758
- }
1759
- }
1760
- }
1761
-
1762
1698
  // src/universal/types/providers/ondo/ondo.ts
1763
1699
  var OndoTradingStatus = {
1764
1700
  fromDto: (dto) => {
@@ -1813,7 +1749,7 @@ var OndoBuyTransaction = {
1813
1749
  raw: dto.notional_value,
1814
1750
  decimals: spendDecimals
1815
1751
  }),
1816
- receiveOutputAmount: parsePositiveAmount({
1752
+ receiveOutputAmount: positiveAmountFromRawOrThrow({
1817
1753
  label: "receive_output_amount",
1818
1754
  raw: dto.receive_output_amount,
1819
1755
  decimals: outputDecimals,
@@ -1832,7 +1768,7 @@ var OndoSellTransaction = {
1832
1768
  fromDto: (dto) => {
1833
1769
  const spendDecimals = AssetDecimals(dto.spend_input_decimals);
1834
1770
  const outputDecimals = AssetDecimals(dto.receive_output_decimals);
1835
- const expectedQuantity = parsePositiveAmount({
1771
+ const expectedQuantity = positiveAmountFromRawOrThrow({
1836
1772
  label: "expected_quantity",
1837
1773
  raw: dto.expected_quantity,
1838
1774
  decimals: outputDecimals,
@@ -1866,12 +1802,12 @@ var OndoSellTransaction = {
1866
1802
  };
1867
1803
  function parseSwapCore(dto, spendDecimals) {
1868
1804
  return {
1869
- tx: {
1870
- to: EvmContractAddress(dto.to),
1871
- data: HexEncodedTransactionData(dto.data)
1872
- },
1873
- expiresAt: parseExpiresAt(dto.expires_at),
1874
- spendInputAmount: parsePositiveAmount({
1805
+ tx: txFromWire(dto),
1806
+ // A transaction whose expiry cannot be read is not safely fillable - the
1807
+ // deadline is encoded in the calldata either way, so broadcasting against
1808
+ // an unknown one only spends gas on a revert.
1809
+ expiresAt: requiredDate(dto.expires_at, "expires_at"),
1810
+ spendInputAmount: positiveAmountFromRawOrThrow({
1875
1811
  label: "spend_input_amount",
1876
1812
  raw: dto.spend_input_amount,
1877
1813
  decimals: spendDecimals,
@@ -1889,7 +1825,7 @@ function parseSwapCore(dto, spendDecimals) {
1889
1825
  };
1890
1826
  }
1891
1827
  function parseMinimumQuantity(raw, decimals, expectedQuantity) {
1892
- const amount = parsePositiveAmount({
1828
+ const amount = positiveAmountFromRawOrThrow({
1893
1829
  label: "minimum_quantity",
1894
1830
  raw,
1895
1831
  decimals,
@@ -1902,27 +1838,6 @@ function parseMinimumQuantity(raw, decimals, expectedQuantity) {
1902
1838
  }
1903
1839
  return amount;
1904
1840
  }
1905
- function parsePositiveAmount({
1906
- label,
1907
- raw,
1908
- decimals,
1909
- reason
1910
- }) {
1911
- const amount = blockchainAmountFromRawOrThrow({ label, raw, decimals });
1912
- if (amount.raw <= 0n) {
1913
- throw new ValidationError(
1914
- `${label}: must be greater than zero ("${raw}") - ${reason}`
1915
- );
1916
- }
1917
- return amount;
1918
- }
1919
- function parseExpiresAt(value) {
1920
- const date = new Date(value);
1921
- if (Number.isNaN(date.getTime())) {
1922
- throw new ValidationError(`expires_at: not a date ("${value}")`);
1923
- }
1924
- return date;
1925
- }
1926
1841
 
1927
1842
  // src/universal/api/frontline/providers/ondo/ondo.ts
1928
1843
  async function getOndoTradingStatus(api, params) {
@@ -1988,18 +1903,6 @@ function swapBody(params) {
1988
1903
  amount: params.amount.raw.toString()
1989
1904
  };
1990
1905
  }
1991
- function assertSpendScaleAgrees({
1992
- published,
1993
- sized,
1994
- trade,
1995
- note
1996
- }) {
1997
- if (published === sized.decimals) return;
1998
- const because = note === void 0 ? "" : ` - ${note}`;
1999
- throw new ValidationError(
2000
- `spend_input_decimals: the ${trade} was priced in ${published} decimals but the order was sized in ${sized.decimals}${because}`
2001
- );
2002
- }
2003
1906
  function sizeParam(params) {
2004
1907
  const tokenAmount = "tokenAmount" in params ? params.tokenAmount : void 0;
2005
1908
  const notionalValue = "notionalValue" in params ? params.notionalValue : void 0;
@@ -2019,7 +1922,7 @@ function sizeParam(params) {
2019
1922
  return { notional_value: notionalValue };
2020
1923
  }
2021
1924
 
2022
- // src/universal/core/checkout/ondo/ondo-namespace.ts
1925
+ // src/universal/core/providers/checkout/ondo/ondo-namespace.ts
2023
1926
  var OndoNamespaceImpl = class {
2024
1927
  constructor(ctx) {
2025
1928
  this.ctx = ctx;
@@ -2051,7 +1954,101 @@ var OndoNamespaceImpl = class {
2051
1954
  }
2052
1955
  };
2053
1956
 
2054
- // src/universal/core/checkout/superstate/blockchain/abi.ts
1957
+ // src/universal/types/providers/superstate/swap.ts
1958
+ var SwapPreview = {
1959
+ /** Maps the contract's `Preview { input, fee, output }` struct. */
1960
+ fromContract: (preview) => ({
1961
+ inputAmount: parseUint256(preview.input, "SwapPreview.input"),
1962
+ fee: parseUint256(preview.fee, "SwapPreview.fee"),
1963
+ outputAmount: parseUint256(preview.output, "SwapPreview.output")
1964
+ })
1965
+ };
1966
+ var PauseFlags = (value) => value;
1967
+ var SwapStatus = {
1968
+ /**
1969
+ * Maps the contract's `Status { uint32 flags; State state }` struct, where
1970
+ * `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
1971
+ *
1972
+ * `flags` is carried onto the `paused` arm only. On the other two the
1973
+ * contract sets it to a self-identifying marker rather than to information -
1974
+ * so repeating it would invite a caller to read meaning into a constant.
1975
+ *
1976
+ * @throws ValidationError on a `state` outside the enum. A contract that has
1977
+ * grown a fourth state is one the SDK does not model, and guessing `active`
1978
+ * would let a halted swap read as a live one.
1979
+ */
1980
+ fromContract: (status) => {
1981
+ switch (status.state) {
1982
+ case 0:
1983
+ return { state: "active" };
1984
+ case 1:
1985
+ return { state: "paused", pausedLevels: PauseFlags(status.flags) };
1986
+ case 2:
1987
+ return { state: "stopped" };
1988
+ default:
1989
+ throw new ValidationError(
1990
+ `SwapStatus.state: unknown contract state (${status.state})`
1991
+ );
1992
+ }
1993
+ }
1994
+ };
1995
+ var AllowWalletResponse = {
1996
+ fromDto: (dto) => {
1997
+ switch (dto.action) {
1998
+ case "broadcast_transaction":
1999
+ return {
2000
+ action: "broadcast_transaction",
2001
+ tx: txFromWire(dto)
2002
+ };
2003
+ case "none":
2004
+ return {
2005
+ action: "none",
2006
+ alreadyAllowed: dto.already_allowed
2007
+ };
2008
+ default: {
2009
+ const _exhaustive = dto;
2010
+ return _exhaustive;
2011
+ }
2012
+ }
2013
+ }
2014
+ };
2015
+
2016
+ // src/universal/core/providers/checkout/superstate/blockchain/quote.ts
2017
+ var SwapQuote = {
2018
+ /**
2019
+ * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
2020
+ * input and fee are denominated in the input token; the output in the output
2021
+ * token.
2022
+ */
2023
+ fromPreview: (preview, inputDecimals, outputDecimals) => ({
2024
+ inputTokenAmount: BlockchainAmount({
2025
+ raw: preview.inputAmount,
2026
+ decimals: inputDecimals
2027
+ }),
2028
+ fee: BlockchainAmount({ raw: preview.fee, decimals: inputDecimals }),
2029
+ outputTokenAmount: BlockchainAmount({
2030
+ raw: preview.outputAmount,
2031
+ decimals: outputDecimals
2032
+ })
2033
+ })
2034
+ };
2035
+
2036
+ // src/universal/api/frontline/providers/superstate/swap.ts
2037
+ async function allowWallet(api, params) {
2038
+ const dto = await api.send({
2039
+ method: "POST",
2040
+ url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
2041
+ body: {
2042
+ wallet_address: params.walletAddress,
2043
+ chain: params.chain,
2044
+ signature: params.signature
2045
+ },
2046
+ attributes: Attributes.protected()
2047
+ });
2048
+ return AllowWalletResponse.fromDto(dto);
2049
+ }
2050
+
2051
+ // src/universal/core/providers/checkout/superstate/blockchain/abi.ts
2055
2052
  var SUPERSTATE_SWAP_ABI = [
2056
2053
  {
2057
2054
  type: "function",
@@ -2923,80 +2920,105 @@ var SUPERSTATE_SWAP_ABI = [
2923
2920
  }
2924
2921
  ];
2925
2922
 
2926
- // src/universal/types/providers/superstate/swap.ts
2927
- var SwapPreview = {
2928
- /** Maps the contract's `Preview { input, fee, output }` struct. */
2929
- fromContract: (preview) => ({
2930
- inputAmount: parseUint256(preview.input, "SwapPreview.input"),
2931
- fee: parseUint256(preview.fee, "SwapPreview.fee"),
2932
- outputAmount: parseUint256(preview.output, "SwapPreview.output")
2933
- })
2934
- };
2935
- var PauseFlags = (value) => value;
2936
- var SwapStatus = {
2937
- /**
2938
- * Maps the contract's `Status { uint32 flags; State state }` struct, where
2939
- * `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
2940
- *
2941
- * `flags` is carried onto the `paused` arm only. On the other two the
2942
- * contract sets it to a self-identifying marker rather than to information -
2943
- * so repeating it would invite a caller to read meaning into a constant.
2944
- *
2945
- * @throws ValidationError on a `state` outside the enum. A contract that has
2946
- * grown a fourth state is one the SDK does not model, and guessing `active`
2947
- * would let a halted swap read as a live one.
2948
- */
2949
- fromContract: (status) => {
2950
- switch (status.state) {
2951
- case 0:
2952
- return { state: "active" };
2953
- case 1:
2954
- return { state: "paused", pausedLevels: PauseFlags(status.flags) };
2955
- case 2:
2956
- return { state: "stopped" };
2957
- default:
2958
- throw new ValidationError(
2959
- `SwapStatus.state: unknown contract state (${status.state})`
2960
- );
2961
- }
2962
- }
2963
- };
2964
- var AllowWalletResponse = {
2965
- fromDto: (dto) => {
2966
- switch (dto.action) {
2967
- case "broadcast_transaction":
2968
- return {
2969
- action: "broadcast_transaction",
2970
- to: EvmContractAddress(dto.to),
2971
- data: HexEncodedTransactionData(dto.data)
2972
- };
2973
- case "none":
2974
- return {
2975
- action: "none",
2976
- alreadyAllowed: dto.already_allowed
2977
- };
2978
- default: {
2979
- const _exhaustive = dto;
2980
- return _exhaustive;
2981
- }
2982
- }
2923
+ // src/universal/core/shared/blockchain/erc20/abi.ts
2924
+ var ERC20_ABI = [
2925
+ {
2926
+ type: "function",
2927
+ name: "allowance",
2928
+ inputs: [
2929
+ { name: "owner", type: "address" },
2930
+ { name: "spender", type: "address" }
2931
+ ],
2932
+ outputs: [{ name: "", type: "uint256" }],
2933
+ stateMutability: "view"
2934
+ },
2935
+ {
2936
+ type: "function",
2937
+ name: "approve",
2938
+ inputs: [
2939
+ { name: "spender", type: "address" },
2940
+ { name: "amount", type: "uint256" }
2941
+ ],
2942
+ outputs: [{ name: "", type: "bool" }],
2943
+ stateMutability: "nonpayable"
2944
+ },
2945
+ {
2946
+ type: "function",
2947
+ name: "balanceOf",
2948
+ inputs: [{ name: "account", type: "address" }],
2949
+ outputs: [{ name: "", type: "uint256" }],
2950
+ stateMutability: "view"
2951
+ },
2952
+ {
2953
+ type: "function",
2954
+ name: "decimals",
2955
+ inputs: [],
2956
+ outputs: [{ name: "", type: "uint8" }],
2957
+ stateMutability: "view"
2958
+ },
2959
+ {
2960
+ type: "function",
2961
+ name: "name",
2962
+ inputs: [],
2963
+ outputs: [{ name: "", type: "string" }],
2964
+ stateMutability: "view"
2965
+ },
2966
+ {
2967
+ type: "function",
2968
+ name: "symbol",
2969
+ inputs: [],
2970
+ outputs: [{ name: "", type: "string" }],
2971
+ stateMutability: "view"
2972
+ },
2973
+ {
2974
+ type: "function",
2975
+ name: "totalSupply",
2976
+ inputs: [],
2977
+ outputs: [{ name: "", type: "uint256" }],
2978
+ stateMutability: "view"
2979
+ },
2980
+ {
2981
+ type: "function",
2982
+ name: "transfer",
2983
+ inputs: [
2984
+ { name: "recipient", type: "address" },
2985
+ { name: "amount", type: "uint256" }
2986
+ ],
2987
+ outputs: [{ name: "", type: "bool" }],
2988
+ stateMutability: "nonpayable"
2989
+ },
2990
+ {
2991
+ type: "function",
2992
+ name: "transferFrom",
2993
+ inputs: [
2994
+ { name: "sender", type: "address" },
2995
+ { name: "recipient", type: "address" },
2996
+ { name: "amount", type: "uint256" }
2997
+ ],
2998
+ outputs: [{ name: "", type: "bool" }],
2999
+ stateMutability: "nonpayable"
3000
+ },
3001
+ {
3002
+ type: "event",
3003
+ name: "Approval",
3004
+ inputs: [
3005
+ { name: "owner", type: "address", indexed: true },
3006
+ { name: "spender", type: "address", indexed: true },
3007
+ { name: "value", type: "uint256", indexed: false }
3008
+ ],
3009
+ anonymous: false
3010
+ },
3011
+ {
3012
+ type: "event",
3013
+ name: "Transfer",
3014
+ inputs: [
3015
+ { name: "from", type: "address", indexed: true },
3016
+ { name: "to", type: "address", indexed: true },
3017
+ { name: "value", type: "uint256", indexed: false }
3018
+ ],
3019
+ anonymous: false
2983
3020
  }
2984
- };
2985
-
2986
- // src/universal/api/frontline/providers/superstate/swap.ts
2987
- async function allowWallet(api, params) {
2988
- const dto = await api.send({
2989
- method: "POST",
2990
- url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
2991
- body: {
2992
- wallet_address: params.walletAddress,
2993
- chain: params.chain,
2994
- signature: params.signature
2995
- },
2996
- attributes: Attributes.protected()
2997
- });
2998
- return AllowWalletResponse.fromDto(dto);
2999
- }
3021
+ ];
3000
3022
 
3001
3023
  // src/universal/api/rpc/providers/superstate/swap.ts
3002
3024
  async function getSwapAuthorization(clients, params) {
@@ -3047,7 +3069,7 @@ async function getSwapOutputToken(clients, params) {
3047
3069
  };
3048
3070
  }
3049
3071
 
3050
- // src/universal/core/checkout/superstate/swap-namespace.ts
3072
+ // src/universal/core/providers/checkout/superstate/swap-namespace.ts
3051
3073
  var SuperstateSwapNamespaceImpl = class {
3052
3074
  constructor(ctx) {
3053
3075
  this.ctx = ctx;
@@ -3067,6 +3089,20 @@ var SuperstateSwapNamespaceImpl = class {
3067
3089
  async () => getSwapPreview(this.ctx.rpc, params)
3068
3090
  );
3069
3091
  }
3092
+ async getQuote(params) {
3093
+ return this.log.wrap("getQuote", params, async () => {
3094
+ const { amount, outputTokenDecimals, ...ref } = params;
3095
+ const preview = await getSwapPreview(this.ctx.rpc, {
3096
+ ...ref,
3097
+ amount: amount.raw
3098
+ });
3099
+ return SwapQuote.fromPreview(
3100
+ preview,
3101
+ amount.decimals,
3102
+ outputTokenDecimals
3103
+ );
3104
+ });
3105
+ }
3070
3106
  async getStatus(params) {
3071
3107
  return this.log.wrap(
3072
3108
  "getStatus",
@@ -3211,54 +3247,195 @@ async function fetchRequirementStatuses(api, offerId) {
3211
3247
  url: `/v1/offers/${offerId}/requirements/statuses`,
3212
3248
  attributes: Attributes.protected()
3213
3249
  });
3214
- return RequirementStatusInfo.fromStatusesDto(response);
3250
+ return RequirementStatusInfo.fromStatusesDto(response);
3251
+ }
3252
+
3253
+ // src/universal/core/requirements/requirements-namespace.ts
3254
+ var RequirementsNamespaceImpl = class {
3255
+ constructor(ctx) {
3256
+ this.ctx = ctx;
3257
+ this.log = internalLogger(ctx.logger, "REQUIREMENTS");
3258
+ }
3259
+ async forOffer(offerId) {
3260
+ return this.log.wrap("forOffer", offerId, async () => {
3261
+ await this.ctx.ensureUserAuthenticated();
3262
+ return fetchOfferRequirements(
3263
+ this.ctx.api,
3264
+ offerId,
3265
+ void 0
3266
+ );
3267
+ });
3268
+ }
3269
+ async statuses(offerId) {
3270
+ return this.log.wrap("statuses", offerId, async () => {
3271
+ await this.ctx.ensureUserAuthenticated();
3272
+ return fetchRequirementStatuses(this.ctx.api, offerId);
3273
+ });
3274
+ }
3275
+ async createKycToken(params) {
3276
+ return this.log.wrap("createKycToken", params, async () => {
3277
+ await this.ctx.ensureUserAuthenticated();
3278
+ return createKycToken(
3279
+ this.ctx.api,
3280
+ params?.levelName,
3281
+ params?.reset
3282
+ );
3283
+ });
3284
+ }
3285
+ async getPii() {
3286
+ return this.log.wrap("getPii", void 0, async () => {
3287
+ await this.ctx.ensureUserAuthenticated();
3288
+ return fetchPii(this.ctx.api);
3289
+ });
3290
+ }
3291
+ async submitDocument(params) {
3292
+ return this.log.wrap("submitDocument", params, async () => {
3293
+ await this.ctx.ensureUserAuthenticated();
3294
+ return submitDocument(
3295
+ this.ctx.api,
3296
+ params.documentType,
3297
+ params.fields
3298
+ );
3299
+ });
3300
+ }
3301
+ };
3302
+
3303
+ // src/universal/types/offer-option-address.ts
3304
+ var OfferOptionAddressId = (value) => value;
3305
+ var OfferOptionAddress = {
3306
+ /** Maps the API DTO into the SDK offer-option-address domain model. */
3307
+ fromDto: (dto) => ({
3308
+ id: OfferOptionAddressId(dto.id),
3309
+ offerOptionId: OfferOptionId(dto.offer_option_id),
3310
+ address: EvmWalletAddress(dto.address),
3311
+ protocol: dto.protocol,
3312
+ createdAt: new Date(dto.created_at)
3313
+ })
3314
+ };
3315
+ var ConnectExternalWalletParams = {
3316
+ /** Maps connect-wallet params into the API DTO payload. */
3317
+ toDto: (params) => ({
3318
+ offer_option_id: params.offerOptionId,
3319
+ wallet_address: params.walletAddress,
3320
+ chain: params.chain,
3321
+ signature: params.signature
3322
+ })
3323
+ };
3324
+
3325
+ // src/universal/types/wallet-ownership-challenge.ts
3326
+ var WalletOwnershipChallenge = {
3327
+ /** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
3328
+ fromDto: (dto) => ({
3329
+ message: dto.message,
3330
+ expiresAt: new Date(dto.expires_at)
3331
+ })
3332
+ };
3333
+ var CreateWalletOwnershipChallengeParams = {
3334
+ /**
3335
+ * Maps challenge-request params into the API DTO payload. The discriminated
3336
+ * union guarantees SIWE fields are present exactly when `challengeType` is
3337
+ * `siwe`, so the mapping narrows on the discriminant.
3338
+ */
3339
+ toDto: (params) => {
3340
+ switch (params.challengeType) {
3341
+ case "plain":
3342
+ return {
3343
+ wallet_address: params.walletAddress,
3344
+ chain: params.chain,
3345
+ challenge_type: "plain"
3346
+ };
3347
+ case "siwe":
3348
+ return {
3349
+ wallet_address: params.walletAddress,
3350
+ chain: params.chain,
3351
+ challenge_type: "siwe",
3352
+ domain: params.domain,
3353
+ uri: params.uri,
3354
+ statement: params.statement
3355
+ };
3356
+ default: {
3357
+ const _exhaustive = params;
3358
+ return _exhaustive;
3359
+ }
3360
+ }
3361
+ }
3362
+ };
3363
+
3364
+ // src/universal/api/frontline/wallet-connect.ts
3365
+ async function createWalletOwnershipChallenge(api, params) {
3366
+ const dto = await api.send({
3367
+ method: "POST",
3368
+ url: "/v1/wallet-ownership",
3369
+ body: CreateWalletOwnershipChallengeParams.toDto(params),
3370
+ attributes: Attributes.protected()
3371
+ });
3372
+ return WalletOwnershipChallenge.fromDto(dto);
3373
+ }
3374
+ async function connectExternalWallet(api, params) {
3375
+ const dto = await api.send({
3376
+ method: "POST",
3377
+ url: `/v1/offers/${params.offerId}/addresses`,
3378
+ body: ConnectExternalWalletParams.toDto(params),
3379
+ attributes: Attributes.protected()
3380
+ });
3381
+ return OfferOptionAddress.fromDto(dto);
3382
+ }
3383
+ async function listOptionAddresses(api, offerId, offerOptionId) {
3384
+ const { data } = await api.send({
3385
+ method: "GET",
3386
+ url: `/v1/offers/${offerId}/addresses`,
3387
+ queryParams: { offer_option_id: offerOptionId },
3388
+ attributes: Attributes.protected()
3389
+ });
3390
+ return data.map(OfferOptionAddress.fromDto);
3391
+ }
3392
+ async function removeOptionAddress(api, offerId, addressId) {
3393
+ const dto = await api.send({
3394
+ method: "DELETE",
3395
+ url: `/v1/offers/${offerId}/addresses/${addressId}`,
3396
+ attributes: Attributes.protected()
3397
+ });
3398
+ return OfferOptionAddress.fromDto(dto);
3215
3399
  }
3216
3400
 
3217
- // src/universal/core/requirements/requirements-namespace.ts
3218
- var RequirementsNamespaceImpl = class {
3401
+ // src/universal/core/wallets/wallets-namespace.ts
3402
+ var WalletsNamespaceImpl = class {
3219
3403
  constructor(ctx) {
3220
3404
  this.ctx = ctx;
3221
- this.log = internalLogger(ctx.logger, "REQUIREMENTS");
3405
+ this.log = internalLogger(ctx.logger, "WALLETS");
3222
3406
  }
3223
- async forOffer(offerId) {
3224
- return this.log.wrap("forOffer", offerId, async () => {
3407
+ async createOwnershipChallenge(params) {
3408
+ return this.log.wrap("createOwnershipChallenge", params, async () => {
3225
3409
  await this.ctx.ensureUserAuthenticated();
3226
- return fetchOfferRequirements(
3410
+ return createWalletOwnershipChallenge(
3227
3411
  this.ctx.api,
3228
- offerId,
3229
- void 0
3412
+ params
3230
3413
  );
3231
3414
  });
3232
3415
  }
3233
- async statuses(offerId) {
3234
- return this.log.wrap("statuses", offerId, async () => {
3416
+ async connectExternal(params) {
3417
+ return this.log.wrap("connectExternal", params, async () => {
3235
3418
  await this.ctx.ensureUserAuthenticated();
3236
- return fetchRequirementStatuses(this.ctx.api, offerId);
3419
+ return connectExternalWallet(this.ctx.api, params);
3237
3420
  });
3238
3421
  }
3239
- async createKycToken(params) {
3240
- return this.log.wrap("createKycToken", params, async () => {
3422
+ async list(params) {
3423
+ return this.log.wrap("list", params, async () => {
3241
3424
  await this.ctx.ensureUserAuthenticated();
3242
- return createKycToken(
3425
+ return listOptionAddresses(
3243
3426
  this.ctx.api,
3244
- params?.levelName,
3245
- params?.reset
3427
+ params.offerId,
3428
+ params.offerOptionId
3246
3429
  );
3247
3430
  });
3248
3431
  }
3249
- async getPii() {
3250
- return this.log.wrap("getPii", void 0, async () => {
3251
- await this.ctx.ensureUserAuthenticated();
3252
- return fetchPii(this.ctx.api);
3253
- });
3254
- }
3255
- async submitDocument(params) {
3256
- return this.log.wrap("submitDocument", params, async () => {
3432
+ async remove(params) {
3433
+ return this.log.wrap("remove", params, async () => {
3257
3434
  await this.ctx.ensureUserAuthenticated();
3258
- return submitDocument(
3435
+ return removeOptionAddress(
3259
3436
  this.ctx.api,
3260
- params.documentType,
3261
- params.fields
3437
+ params.offerId,
3438
+ params.addressId
3262
3439
  );
3263
3440
  });
3264
3441
  }
@@ -3686,163 +3863,6 @@ var TokensNamespaceImpl = class {
3686
3863
  }
3687
3864
  };
3688
3865
 
3689
- // src/universal/types/offer-option-address.ts
3690
- var OfferOptionAddressId = (value) => value;
3691
- var OfferOptionAddress = {
3692
- /** Maps the API DTO into the SDK offer-option-address domain model. */
3693
- fromDto: (dto) => ({
3694
- id: OfferOptionAddressId(dto.id),
3695
- offerOptionId: OfferOptionId(dto.offer_option_id),
3696
- address: EvmWalletAddress(dto.address),
3697
- protocol: dto.protocol,
3698
- createdAt: new Date(dto.created_at)
3699
- })
3700
- };
3701
- var ConnectExternalWalletParams = {
3702
- /** Maps connect-wallet params into the API DTO payload. */
3703
- toDto: (params) => ({
3704
- offer_option_id: params.offerOptionId,
3705
- wallet_address: params.walletAddress,
3706
- chain: params.chain,
3707
- signature: params.signature
3708
- })
3709
- };
3710
-
3711
- // src/universal/types/wallet-ownership-challenge.ts
3712
- var WalletOwnershipChallenge = {
3713
- /** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
3714
- fromDto: (dto) => ({
3715
- message: dto.message,
3716
- expiresAt: new Date(dto.expires_at)
3717
- })
3718
- };
3719
- var CreateWalletOwnershipChallengeParams = {
3720
- /**
3721
- * Maps challenge-request params into the API DTO payload. The discriminated
3722
- * union guarantees SIWE fields are present exactly when `challengeType` is
3723
- * `siwe`, so the mapping narrows on the discriminant.
3724
- */
3725
- toDto: (params) => {
3726
- switch (params.challengeType) {
3727
- case "plain":
3728
- return {
3729
- wallet_address: params.walletAddress,
3730
- chain: params.chain,
3731
- challenge_type: "plain"
3732
- };
3733
- case "siwe":
3734
- return {
3735
- wallet_address: params.walletAddress,
3736
- chain: params.chain,
3737
- challenge_type: "siwe",
3738
- domain: params.domain,
3739
- uri: params.uri,
3740
- statement: params.statement
3741
- };
3742
- default: {
3743
- const _exhaustive = params;
3744
- return _exhaustive;
3745
- }
3746
- }
3747
- }
3748
- };
3749
-
3750
- // src/universal/api/frontline/wallet-connect.ts
3751
- async function createWalletOwnershipChallenge(api, params) {
3752
- const dto = await api.send({
3753
- method: "POST",
3754
- url: "/v1/wallet-ownership",
3755
- body: CreateWalletOwnershipChallengeParams.toDto(params),
3756
- attributes: Attributes.protected()
3757
- });
3758
- return WalletOwnershipChallenge.fromDto(dto);
3759
- }
3760
- async function connectExternalWallet(api, params) {
3761
- const dto = await api.send({
3762
- method: "POST",
3763
- url: `/v1/offers/${params.offerId}/addresses`,
3764
- body: ConnectExternalWalletParams.toDto(params),
3765
- attributes: Attributes.protected()
3766
- });
3767
- return OfferOptionAddress.fromDto(dto);
3768
- }
3769
- async function listOptionAddresses(api, offerId, offerOptionId) {
3770
- const { data } = await api.send({
3771
- method: "GET",
3772
- url: `/v1/offers/${offerId}/addresses`,
3773
- queryParams: { offer_option_id: offerOptionId },
3774
- attributes: Attributes.protected()
3775
- });
3776
- return data.map(OfferOptionAddress.fromDto);
3777
- }
3778
- async function removeOptionAddress(api, offerId, addressId) {
3779
- const dto = await api.send({
3780
- method: "DELETE",
3781
- url: `/v1/offers/${offerId}/addresses/${addressId}`,
3782
- attributes: Attributes.protected()
3783
- });
3784
- return OfferOptionAddress.fromDto(dto);
3785
- }
3786
-
3787
- // src/universal/core/wallets/wallets-namespace.ts
3788
- var WalletsNamespaceImpl = class {
3789
- constructor(ctx) {
3790
- this.ctx = ctx;
3791
- this.log = internalLogger(ctx.logger, "WALLETS");
3792
- }
3793
- async createOwnershipChallenge(params) {
3794
- return this.log.wrap("createOwnershipChallenge", params, async () => {
3795
- await this.ctx.ensureUserAuthenticated();
3796
- return createWalletOwnershipChallenge(
3797
- this.ctx.api,
3798
- params
3799
- );
3800
- });
3801
- }
3802
- async connectExternal(params) {
3803
- return this.log.wrap("connectExternal", params, async () => {
3804
- await this.ctx.ensureUserAuthenticated();
3805
- return connectExternalWallet(this.ctx.api, params);
3806
- });
3807
- }
3808
- async list(params) {
3809
- return this.log.wrap("list", params, async () => {
3810
- await this.ctx.ensureUserAuthenticated();
3811
- return listOptionAddresses(
3812
- this.ctx.api,
3813
- params.offerId,
3814
- params.offerOptionId
3815
- );
3816
- });
3817
- }
3818
- async remove(params) {
3819
- return this.log.wrap("remove", params, async () => {
3820
- await this.ctx.ensureUserAuthenticated();
3821
- return removeOptionAddress(
3822
- this.ctx.api,
3823
- params.offerId,
3824
- params.addressId
3825
- );
3826
- });
3827
- }
3828
- };
3829
-
3830
- // src/universal/types/oauth-session.ts
3831
- var ClientCredentialsOAuth = (value) => value;
3832
- var OAuthRefreshToken = (value) => value;
3833
- var OAuthSession = {
3834
- fromDto: (dto) => {
3835
- const expiresAt = new Date(Date.now() + dto.expires_in * 1e3);
3836
- return {
3837
- accessToken: {
3838
- value: dto.access_token,
3839
- expiresAt
3840
- },
3841
- ...dto.refresh_token != null && dto.refresh_token !== "" ? { refreshToken: OAuthRefreshToken(dto.refresh_token) } : void 0
3842
- };
3843
- }
3844
- };
3845
-
3846
3866
  // src/universal/api/frontline/offers.ts
3847
3867
  async function fetchOffers(api, clientCreds) {
3848
3868
  return fetchAllPages((params) => fetchOffersPage(api, params, clientCreds));
@@ -3899,6 +3919,7 @@ export {
3899
3919
  ValidationError,
3900
3920
  InvariantError,
3901
3921
  MathError,
3922
+ classifyLogCause,
3902
3923
  describeErrorUnredacted,
3903
3924
  internalLogger,
3904
3925
  HttpClient,
@@ -3907,6 +3928,18 @@ export {
3907
3928
  Seconds,
3908
3929
  isExpired,
3909
3930
  ERC20_ABI,
3931
+ FormattedAmountUi,
3932
+ FormattedPercentUi,
3933
+ TxExplorerUrl,
3934
+ ShortenedWalletAddress,
3935
+ FormattedAmountAssetUi,
3936
+ AssetIconUrl,
3937
+ viemChain,
3938
+ getChainId,
3939
+ chainFromId,
3940
+ contractOn,
3941
+ getNetworkName,
3942
+ txExplorerUrl,
3910
3943
  ETHEREUM_CHAINS,
3911
3944
  EthereumChain,
3912
3945
  SOLANA_CHAINS,
@@ -3929,18 +3962,30 @@ export {
3929
3962
  KnownAssetSymbol,
3930
3963
  Bps,
3931
3964
  blockchainAmountFromRawOrThrow,
3965
+ positiveAmountFromRawOrThrow,
3966
+ pricePerShare,
3932
3967
  parseBlockchainAmount,
3933
- CentrifugeVaultQuote,
3934
3968
  CentrifugeVaultStatus,
3935
3969
  CentrifugeVaultBuyTransaction,
3936
3970
  CentrifugeVaultClaimTransaction,
3937
- CentrifugeVaultPosition,
3938
- CentrifugeVaultRedeemPosition,
3971
+ CentrifugeAssets,
3972
+ CentrifugeShares,
3973
+ CentrifugeDepositPosition,
3974
+ CentrifugeRedeemPosition,
3939
3975
  CentrifugeVaultLeg,
3940
3976
  CentrifugeVaultLegId,
3941
3977
  CentrifugeVaultClaimProceedsTransaction,
3942
3978
  CentrifugeNamespaceImpl,
3943
- fetchAllPages,
3979
+ shortenAddress,
3980
+ formatAmount,
3981
+ formatRawAmount,
3982
+ formatCompactAmount,
3983
+ formatBpsAsPercent,
3984
+ usdAmount,
3985
+ assetAmount,
3986
+ NA_AMOUNT_ASSET_UI,
3987
+ formatShareAmount,
3988
+ formattedUsdPrice,
3944
3989
  Cursor,
3945
3990
  PaginatedResponse,
3946
3991
  PaginationParams,
@@ -3967,33 +4012,10 @@ export {
3967
4012
  TermItem,
3968
4013
  Milestone,
3969
4014
  ParticipationId,
3970
- Blockchain,
3971
- WalletAddress,
3972
4015
  ParticipationsPaginationParams,
3973
4016
  Participation,
3974
4017
  CreateParticipationParams,
3975
4018
  CoinListTokenSaleNamespaceImpl,
3976
- FormattedAmountUi,
3977
- FormattedPercentUi,
3978
- TxExplorerUrl,
3979
- ShortenedWalletAddress,
3980
- FormattedAmountAssetUi,
3981
- AssetIconUrl,
3982
- shortenAddress,
3983
- formatAmount,
3984
- formatRawAmount,
3985
- formatCompactAmount,
3986
- formatBpsAsPercent,
3987
- usdAmount,
3988
- assetAmount,
3989
- NA_AMOUNT_ASSET_UI,
3990
- formatShareAmount,
3991
- formattedUsdPrice,
3992
- viemChain,
3993
- getChainId,
3994
- chainFromId,
3995
- getNetworkName,
3996
- txExplorerUrl,
3997
4019
  OndoTradingStatus,
3998
4020
  OndoQuote,
3999
4021
  OndoBuyTransaction,
@@ -4004,10 +4026,8 @@ export {
4004
4026
  PauseFlags,
4005
4027
  SwapStatus,
4006
4028
  AllowWalletResponse,
4029
+ SwapQuote,
4007
4030
  SuperstateSwapNamespaceImpl,
4008
- fetchOffers,
4009
- fetchOffersPage,
4010
- fetchOfferDetails,
4011
4031
  DocumentSubmission,
4012
4032
  KycToken,
4013
4033
  Iso2CountryCode,
@@ -4019,19 +4039,19 @@ export {
4019
4039
  RequirementStatusInfo,
4020
4040
  fetchOfferRequirements,
4021
4041
  RequirementsNamespaceImpl,
4022
- Erc20NamespaceImpl,
4023
- TokenLogoUrl,
4024
- TokenLogo,
4025
- TokenMetadata,
4026
- TokensNamespaceImpl,
4027
4042
  OfferOptionAddressId,
4028
4043
  OfferOptionAddress,
4029
4044
  ConnectExternalWalletParams,
4030
4045
  WalletOwnershipChallenge,
4031
4046
  CreateWalletOwnershipChallengeParams,
4032
4047
  WalletsNamespaceImpl,
4033
- ClientCredentialsOAuth,
4034
- OAuthRefreshToken,
4035
- OAuthSession
4048
+ fetchOffers,
4049
+ fetchOffersPage,
4050
+ fetchOfferDetails,
4051
+ Erc20NamespaceImpl,
4052
+ TokenLogoUrl,
4053
+ TokenLogo,
4054
+ TokenMetadata,
4055
+ TokensNamespaceImpl
4036
4056
  };
4037
- //# sourceMappingURL=chunk-YMDYLYL3.js.map
4057
+ //# sourceMappingURL=chunk-M2TURNJH.js.map