@coinlist-co/react 0.12.2-rc.a59b344 → 0.12.2-rc.aa91ce3

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 (32) hide show
  1. package/dist/{chunk-UJYSXXJF.js → chunk-3OTYQADF.js} +62 -153
  2. package/dist/chunk-3OTYQADF.js.map +1 -0
  3. package/dist/{chunk-NBO5E2RO.js → chunk-IAY3F42Q.js} +863 -519
  4. package/dist/chunk-IAY3F42Q.js.map +1 -0
  5. package/dist/{chunk-4IZ2F732.js → chunk-QRVIBG6H.js} +2 -2
  6. package/dist/client/index.cjs +6031 -4024
  7. package/dist/client/index.cjs.map +1 -1
  8. package/dist/client/index.d.cts +758 -6
  9. package/dist/client/index.d.ts +758 -6
  10. package/dist/client/index.js +2449 -821
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/server/index.cjs +291 -26
  13. package/dist/server/index.cjs.map +1 -1
  14. package/dist/server/index.d.cts +9 -2
  15. package/dist/server/index.d.ts +9 -2
  16. package/dist/server/index.js +4 -2
  17. package/dist/server/index.js.map +1 -1
  18. package/dist/{tokens-namespace-D_XSpiS-.d.cts → time-DyjvzWso.d.cts} +634 -41
  19. package/dist/{tokens-namespace-D_XSpiS-.d.ts → time-DyjvzWso.d.ts} +634 -41
  20. package/dist/{token-registry-snapshot-BsAfBL_b.d.ts → token-registry-snapshot-Bldj1r5X.d.ts} +66 -2
  21. package/dist/{token-registry-snapshot-Cc_eA5zM.d.cts → token-registry-snapshot-CbNCYP_5.d.cts} +66 -2
  22. package/dist/universal/index.cjs +736 -461
  23. package/dist/universal/index.cjs.map +1 -1
  24. package/dist/universal/index.d.cts +59 -321
  25. package/dist/universal/index.d.ts +59 -321
  26. package/dist/universal/index.js +25 -7
  27. package/package.json +1 -1
  28. package/dist/chunk-NBO5E2RO.js.map +0 -1
  29. package/dist/chunk-UJYSXXJF.js.map +0 -1
  30. package/dist/time-CFocgYyl.d.cts +0 -50
  31. package/dist/time-DvgN98Q9.d.ts +0 -50
  32. /package/dist/{chunk-4IZ2F732.js.map → chunk-QRVIBG6H.js.map} +0 -0
@@ -27,15 +27,22 @@ __export(universal_exports, {
27
27
  AssetIconUrl: () => AssetIconUrl,
28
28
  AssetId: () => AssetId,
29
29
  AssetSymbol: () => AssetSymbol,
30
+ AsyncOfferDetail: () => AsyncOfferDetail,
30
31
  AuthorizationCode: () => AuthorizationCode,
31
32
  BPS_DENOM: () => BPS_DENOM,
32
33
  Blockchain: () => Blockchain,
33
34
  BlockchainAmount: () => BlockchainAmount,
34
35
  Bps: () => Bps,
36
+ CENTRIFUGE_POLL_INTERVAL_MS: () => CENTRIFUGE_POLL_INTERVAL_MS,
37
+ CentrifugeNamespaceImpl: () => CentrifugeNamespaceImpl,
35
38
  CentrifugeVaultBuyTransaction: () => CentrifugeVaultBuyTransaction,
39
+ CentrifugeVaultClaimProceedsTransaction: () => CentrifugeVaultClaimProceedsTransaction,
36
40
  CentrifugeVaultClaimTransaction: () => CentrifugeVaultClaimTransaction,
41
+ CentrifugeVaultLeg: () => CentrifugeVaultLeg,
42
+ CentrifugeVaultLegId: () => CentrifugeVaultLegId,
37
43
  CentrifugeVaultPosition: () => CentrifugeVaultPosition,
38
44
  CentrifugeVaultQuote: () => CentrifugeVaultQuote,
45
+ CentrifugeVaultRedeemPosition: () => CentrifugeVaultRedeemPosition,
39
46
  CentrifugeVaultStatus: () => CentrifugeVaultStatus,
40
47
  Chain: () => Chain,
41
48
  ClientCredentialsOAuth: () => ClientCredentialsOAuth,
@@ -159,6 +166,7 @@ __export(universal_exports, {
159
166
  ValidationError: () => ValidationError,
160
167
  WalletAddress: () => WalletAddress,
161
168
  WalletOwnershipChallenge: () => WalletOwnershipChallenge,
169
+ WalletSelection: () => WalletSelection,
162
170
  WalletsNamespaceImpl: () => WalletsNamespaceImpl,
163
171
  apiErrorCode: () => apiErrorCode,
164
172
  applyBps: () => applyBps,
@@ -191,6 +199,7 @@ __export(universal_exports, {
191
199
  ondoQuoteOfferDeadline: () => ondoQuoteOfferDeadline,
192
200
  parseBlockchainAmount: () => parseBlockchainAmount,
193
201
  parseUint256: () => parseUint256,
202
+ resolveCentrifugeVaults: () => resolveCentrifugeVaults,
194
203
  shortenAddress: () => shortenAddress,
195
204
  superstateSwapContractAddress: () => superstateSwapContractAddress,
196
205
  swapSpender: () => swapSpender,
@@ -462,49 +471,8 @@ async function generatePKCEParams(config) {
462
471
  };
463
472
  }
464
473
 
465
- // src/universal/types/pagination.ts
466
- var Cursor = (value) => value;
467
- var PaginatedResponse = {
468
- fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
469
- /**
470
- * For a mapper that decides the page as a whole - one that drops items it
471
- * cannot map, such as `Offer.listFromDto` - rather than item by item. The
472
- * cursors are the wire's either way: dropping an item changes what the
473
- * page holds, not where the next page starts.
474
- */
475
- fromDtoPage: (dto, pageMapper) => ({
476
- data: pageMapper(dto.data),
477
- startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
478
- startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
479
- })
480
- };
481
- var PaginationParams = {
482
- toQueryParams: (params) => {
483
- const queryParams = {};
484
- if (params.after) {
485
- queryParams.starting_after = params.after;
486
- }
487
- if (params.before) {
488
- queryParams.starting_before = params.before;
489
- }
490
- if (params.limit) {
491
- queryParams.limit = params.limit;
492
- }
493
- return queryParams;
494
- }
495
- };
496
-
497
- // src/universal/types/asset.ts
498
- var AssetId = (value) => value;
499
- var AssetCode = (value) => value;
500
- var Asset = {
501
- fromDto: (dto) => ({
502
- id: AssetId(dto.id),
503
- code: AssetCode(dto.code),
504
- name: dto.name,
505
- fractionalDigits: dto.fractional_digits
506
- })
507
- };
474
+ // src/universal/core/shared/blockchain/math.ts
475
+ var import_viem = require("viem");
508
476
 
509
477
  // src/universal/types/errors.ts
510
478
  var NotImplementedError = class extends Error {
@@ -635,6 +603,65 @@ var StablecoinSymbol = (value) => value;
635
603
  var KnownAssetSymbol = StablecoinSymbol;
636
604
  var Bps = (value) => value;
637
605
 
606
+ // src/universal/core/shared/blockchain/math.ts
607
+ function blockchainAmountFromRawOrThrow({
608
+ label,
609
+ raw,
610
+ decimals
611
+ }) {
612
+ const trimmed = raw.trim();
613
+ if (trimmed === "") {
614
+ throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
615
+ }
616
+ let value;
617
+ try {
618
+ value = BigInt(trimmed);
619
+ } catch {
620
+ throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
621
+ }
622
+ try {
623
+ return BlockchainAmount({ raw: assertUint256(value), decimals });
624
+ } catch {
625
+ throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
626
+ }
627
+ }
628
+ function parseBlockchainAmount(amount, decimals) {
629
+ const trimmed = amount.trim();
630
+ if (trimmed === "") return { valid: false, reason: { type: "empty" } };
631
+ if (trimmed.startsWith("-")) {
632
+ return { valid: false, reason: { type: "negative" } };
633
+ }
634
+ if (/[eE]/.test(trimmed)) {
635
+ return { valid: false, reason: { type: "invalid-format" } };
636
+ }
637
+ if (trimmed === ".") {
638
+ return { valid: false, reason: { type: "invalid-format" } };
639
+ }
640
+ const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
641
+ if (!/^\d+(\.\d+)?$/.test(normalised)) {
642
+ return { valid: false, reason: { type: "invalid-format" } };
643
+ }
644
+ const [, fraction = ""] = normalised.split(".");
645
+ if (fraction.length > decimals) {
646
+ return {
647
+ valid: false,
648
+ reason: { type: "too-many-decimals", maxDecimals: decimals }
649
+ };
650
+ }
651
+ try {
652
+ const raw = (0, import_viem.parseUnits)(normalised, decimals);
653
+ if (raw > MAX_UINT_256) {
654
+ return { valid: false, reason: { type: "overflow" } };
655
+ }
656
+ return {
657
+ valid: true,
658
+ amount: BlockchainAmount({ raw, decimals })
659
+ };
660
+ } catch {
661
+ return { valid: false, reason: { type: "invalid-format" } };
662
+ }
663
+ }
664
+
638
665
  // src/universal/core/shared/utils/wire.ts
639
666
  function unknownTypeError(dto, model) {
640
667
  const type = dto.type;
@@ -660,20 +687,588 @@ function requiredDate(value, field) {
660
687
  }
661
688
  return date;
662
689
  }
663
- function dateOrNull(value, field) {
664
- return value === null ? null : requiredDate(value, field);
690
+ function dateOrNull(value, field) {
691
+ return value === null ? null : requiredDate(value, field);
692
+ }
693
+ function decimalOrNull(value) {
694
+ return value === null ? null : DecimalString(value);
695
+ }
696
+ function requiredArray(value, field) {
697
+ if (!Array.isArray(value)) {
698
+ throw new ValidationError(
699
+ `${field}: expected an array, got ${typeof value}`
700
+ );
701
+ }
702
+ return value;
703
+ }
704
+
705
+ // src/universal/types/providers/centrifuge/centrifuge.ts
706
+ var CentrifugeVaultQuote = {
707
+ fromDto: (dto) => {
708
+ const spendDecimals = AssetDecimals(dto.spend_input_decimals);
709
+ const shareDecimals = AssetDecimals(dto.share_decimals);
710
+ return {
711
+ chain: EthereumChain(dto.chain),
712
+ symbol: AssetSymbol(dto.symbol),
713
+ spendInputAmount: blockchainAmountFromRawOrThrow({
714
+ label: "spend_input_amount",
715
+ raw: dto.spend_input_amount,
716
+ decimals: spendDecimals
717
+ }),
718
+ estimatedShares: blockchainAmountFromRawOrThrow({
719
+ label: "estimated_shares",
720
+ raw: dto.estimated_shares,
721
+ decimals: shareDecimals
722
+ }),
723
+ indicativePrice: decimalOrNull(dto.indicative_price),
724
+ minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
725
+ label: "minimum_input_amount",
726
+ raw: dto.minimum_input_amount,
727
+ decimals: spendDecimals
728
+ }),
729
+ orderability: parseOrderability(
730
+ dto.can_order,
731
+ dto.reasons,
732
+ "CentrifugeVaultQuote"
733
+ )
734
+ };
735
+ }
736
+ };
737
+ var CentrifugeVaultStatus = {
738
+ fromDto: (dto) => ({
739
+ chain: EthereumChain(dto.chain),
740
+ symbol: AssetSymbol(dto.symbol),
741
+ vaultAddress: EvmContractAddress(dto.vault_address),
742
+ linked: dto.linked,
743
+ permissioned: dto.permissioned,
744
+ membershipValidUntil: dateOrNull(
745
+ dto.membership_valid_until,
746
+ "CentrifugeVaultStatus.membership_valid_until"
747
+ ),
748
+ halted: dto.halted,
749
+ priceUpdatedAt: dateOrNull(
750
+ dto.price_updated_at,
751
+ "CentrifugeVaultStatus.price_updated_at"
752
+ ),
753
+ orderability: parseOrderability(
754
+ dto.can_order,
755
+ dto.reasons,
756
+ "CentrifugeVaultStatus"
757
+ ),
758
+ asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
759
+ })
760
+ };
761
+ var CentrifugeVaultBuyTransaction = {
762
+ fromDto: (dto) => {
763
+ const spendInputAmount = blockchainAmountFromRawOrThrow({
764
+ label: "spend_input_amount",
765
+ raw: dto.spend_input_amount,
766
+ decimals: AssetDecimals(dto.spend_input_decimals)
767
+ });
768
+ if (spendInputAmount.raw <= 0n) {
769
+ throw new ValidationError(
770
+ `spend_input_amount: must be greater than zero ("${dto.spend_input_amount}") - a deposit of nothing is not a request`
771
+ );
772
+ }
773
+ return {
774
+ ...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
775
+ spendInputAmount,
776
+ estimatedShares: blockchainAmountFromRawOrThrow({
777
+ label: "estimated_shares",
778
+ raw: dto.estimated_shares,
779
+ decimals: AssetDecimals(dto.share_decimals)
780
+ })
781
+ };
782
+ }
783
+ };
784
+ var CentrifugeVaultClaimTransaction = {
785
+ fromDto: (dto) => ({
786
+ ...parseTransactionCore(dto, "CentrifugeVaultClaimTransaction"),
787
+ claimableShares: blockchainAmountFromRawOrThrow({
788
+ label: "claimable_shares",
789
+ raw: dto.claimable_shares,
790
+ decimals: AssetDecimals(dto.share_decimals)
791
+ })
792
+ })
793
+ };
794
+ var CentrifugeVaultPosition = {
795
+ fromDto: (dto) => {
796
+ const assetDecimals = AssetDecimals(dto.asset_decimals);
797
+ const shareDecimals = AssetDecimals(dto.share_decimals);
798
+ const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
799
+ const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
800
+ return {
801
+ chain: EthereumChain(dto.chain),
802
+ symbol: AssetSymbol(dto.symbol),
803
+ walletAddress: EvmWalletAddress(dto.wallet_address),
804
+ status: dto.status,
805
+ requested: asset("requested", dto.requested),
806
+ pending: asset("pending", dto.pending),
807
+ filledAssets: asset("filled_assets", dto.filled_assets),
808
+ earnedShares: shares("earned_shares", dto.earned_shares),
809
+ claimedShares: shares("claimed_shares", dto.claimed_shares),
810
+ claimableShares: shares("claimable_shares", dto.claimable_shares),
811
+ shareBalance: shares("share_balance", dto.share_balance),
812
+ averagePrice: decimalOrNull(dto.average_price),
813
+ frozen: dto.frozen,
814
+ asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
815
+ };
816
+ }
817
+ };
818
+ var CentrifugeVaultRedeemPosition = {
819
+ fromDto: (dto) => ({
820
+ chain: EthereumChain(dto.chain),
821
+ symbol: AssetSymbol(dto.symbol),
822
+ walletAddress: EvmWalletAddress(dto.wallet_address),
823
+ status: dto.status,
824
+ pending: blockchainAmountFromRawOrThrow({
825
+ label: "pending",
826
+ raw: dto.pending,
827
+ decimals: AssetDecimals(dto.share_decimals)
828
+ }),
829
+ claimableAssets: blockchainAmountFromRawOrThrow({
830
+ label: "claimable_assets",
831
+ raw: dto.claimable_assets,
832
+ decimals: AssetDecimals(dto.asset_decimals)
833
+ }),
834
+ frozen: dto.frozen,
835
+ asOf: requiredDate(dto.as_of, "CentrifugeVaultRedeemPosition.as_of")
836
+ })
837
+ };
838
+ var CentrifugeVaultLeg = {
839
+ /**
840
+ * What a claim on the leg would collect: shares for `invest`, the funding
841
+ * token for `redeem`.
842
+ */
843
+ claimable: (leg) => {
844
+ switch (leg.direction) {
845
+ case "invest":
846
+ return leg.position.claimableShares;
847
+ case "redeem":
848
+ return leg.position.claimableAssets;
849
+ default: {
850
+ const exhaustive = leg;
851
+ return exhaustive;
852
+ }
853
+ }
854
+ },
855
+ /** Whether the leg has anything queued or anything ready to claim. */
856
+ isActive: (leg) => leg.position.pending.raw > 0n || CentrifugeVaultLeg.claimable(leg).raw > 0n
857
+ };
858
+ var CentrifugeVaultLegId = {
859
+ /** Addresses compare case-insensitively: frontline echoes them lower case. */
860
+ of: (leg) => [
861
+ leg.direction,
862
+ leg.position.chain,
863
+ leg.position.walletAddress.toLowerCase()
864
+ ].join(":")
865
+ };
866
+ var CentrifugeVaultClaimProceedsTransaction = {
867
+ fromDto: (dto) => ({
868
+ ...parseTransactionCore(dto, "CentrifugeVaultClaimProceedsTransaction"),
869
+ claimableAssets: blockchainAmountFromRawOrThrow({
870
+ label: "claimable_assets",
871
+ raw: dto.claimable_assets,
872
+ decimals: AssetDecimals(dto.asset_decimals)
873
+ })
874
+ })
875
+ };
876
+ function parseOrderability(canOrder, reasons, model) {
877
+ const [first, ...rest] = reasons;
878
+ if (canOrder) {
879
+ if (first !== void 0) {
880
+ throw new ValidationError(
881
+ `${model}.reasons: expected none when can_order is true, got ${JSON.stringify(reasons)}`
882
+ );
883
+ }
884
+ return { type: "orderable" };
885
+ }
886
+ if (first === void 0) {
887
+ throw new ValidationError(
888
+ `${model}.reasons: expected at least one when can_order is false`
889
+ );
890
+ }
891
+ return { type: "blocked", reasons: [first, ...rest] };
892
+ }
893
+ function parseTransactionCore(dto, model) {
894
+ return {
895
+ tx: {
896
+ to: EvmContractAddress(dto.to),
897
+ data: HexEncodedTransactionData(dto.data)
898
+ },
899
+ expiresAt: dateOrNull(dto.expires_at, `${model}.expires_at`)
900
+ };
901
+ }
902
+
903
+ // src/universal/api/frontline/providers/centrifuge/centrifuge.ts
904
+ async function getCentrifugeVaultQuote(api, params) {
905
+ const dto = await api.send({
906
+ method: "GET",
907
+ url: "/v1/centrifuge/vault/quote",
908
+ queryParams: {
909
+ symbol: params.symbol,
910
+ chain: params.chain,
911
+ amount: params.amount.raw.toString()
912
+ },
913
+ attributes: Attributes.protected()
914
+ });
915
+ return CentrifugeVaultQuote.fromDto(dto);
916
+ }
917
+ async function getCentrifugeVaultStatus(api, params) {
918
+ const dto = await api.send({
919
+ method: "GET",
920
+ url: "/v1/centrifuge/vault/status",
921
+ queryParams: {
922
+ symbol: params.symbol,
923
+ chain: params.chain
924
+ },
925
+ attributes: Attributes.protected()
926
+ });
927
+ return CentrifugeVaultStatus.fromDto(dto);
928
+ }
929
+ async function getCentrifugeVaultPosition(api, params) {
930
+ const dto = await api.send({
931
+ method: "GET",
932
+ url: "/v1/centrifuge/vault/position",
933
+ queryParams: walletFields(params),
934
+ attributes: Attributes.protected()
935
+ });
936
+ return CentrifugeVaultPosition.fromDto(dto);
937
+ }
938
+ async function getCentrifugeVaultRedeemPosition(api, params) {
939
+ const dto = await api.send({
940
+ method: "GET",
941
+ url: "/v1/centrifuge/vault/redeem-position",
942
+ queryParams: walletFields(params),
943
+ attributes: Attributes.protected()
944
+ });
945
+ return CentrifugeVaultRedeemPosition.fromDto(dto);
946
+ }
947
+ async function createCentrifugeVaultClaim(api, params) {
948
+ const dto = await api.send({
949
+ method: "POST",
950
+ url: "/v1/centrifuge/vault/claim",
951
+ body: walletFields(params),
952
+ attributes: Attributes.protected()
953
+ });
954
+ return CentrifugeVaultClaimTransaction.fromDto(dto);
955
+ }
956
+ async function createCentrifugeVaultClaimProceeds(api, params) {
957
+ const dto = await api.send({
958
+ method: "POST",
959
+ url: "/v1/centrifuge/vault/claim-proceeds",
960
+ body: walletFields(params),
961
+ attributes: Attributes.protected()
962
+ });
963
+ return CentrifugeVaultClaimProceedsTransaction.fromDto(dto);
964
+ }
965
+ function walletFields(params) {
966
+ return {
967
+ symbol: params.symbol,
968
+ chain: params.chain,
969
+ wallet_address: params.walletAddress
970
+ };
971
+ }
972
+
973
+ // src/universal/core/shared/observability/log-cause.ts
974
+ var import_viem2 = require("viem");
975
+ function classifyLogCause(error) {
976
+ if (error instanceof HttpError) {
977
+ return httpCause(error);
978
+ }
979
+ if (error instanceof ValidationError) {
980
+ return { type: "validation", message: error.message };
981
+ }
982
+ if (error instanceof InvariantError) {
983
+ return { type: "invariant", message: error.message };
984
+ }
985
+ if (error instanceof MathError) {
986
+ return { type: "math", message: error.message };
987
+ }
988
+ if (error instanceof NotAuthenticatedError) {
989
+ return { type: "not-authenticated" };
990
+ }
991
+ if (error instanceof NotImplementedError) {
992
+ return { type: "not-implemented" };
993
+ }
994
+ if (error instanceof import_viem2.BaseError) {
995
+ const http = error.walk((e) => e instanceof HttpError);
996
+ if (http instanceof HttpError) {
997
+ return httpCause(http);
998
+ }
999
+ return { type: "rpc", reason: rpcFailureReason(error) };
1000
+ }
1001
+ return { type: "generic-error", name: errorName(error) };
1002
+ }
1003
+ function rpcFailureReason(error) {
1004
+ if (error.walk((e) => e instanceof import_viem2.ContractFunctionRevertedError)) {
1005
+ return "reverted";
1006
+ }
1007
+ if (error.walk((e) => e instanceof import_viem2.RpcError)) {
1008
+ return "node-rejected";
1009
+ }
1010
+ if (error.walk(
1011
+ (e) => e instanceof import_viem2.HttpRequestError || e instanceof import_viem2.WebSocketRequestError || e instanceof import_viem2.SocketClosedError || e instanceof import_viem2.TimeoutError
1012
+ )) {
1013
+ return "transport";
1014
+ }
1015
+ if (error instanceof import_viem2.ContractFunctionExecutionError) {
1016
+ return "malformed-response";
1017
+ }
1018
+ return "unknown";
1019
+ }
1020
+ function describeErrorUnredacted(error) {
1021
+ if (error instanceof HttpError) {
1022
+ return describeHttpErrorRedacted(error);
1023
+ }
1024
+ if (error instanceof Error) {
1025
+ return `${error.name}: ${error.message}`;
1026
+ }
1027
+ return `thrown non-error: ${stringifyUnredacted(error)}`;
1028
+ }
1029
+ function stringifyUnredacted(value) {
1030
+ if (value === void 0) return "";
1031
+ try {
1032
+ return JSON.stringify(
1033
+ value,
1034
+ (_key, item) => typeof item === "bigint" ? `${item}` : item
1035
+ ) ?? String(value);
1036
+ } catch (_) {
1037
+ return "<unserializable>";
1038
+ }
1039
+ }
1040
+ function describeHttpErrorRedacted(error) {
1041
+ const code = apiErrorCode(error);
1042
+ const status = error.response.status;
1043
+ return code === null ? `HttpError ${status}` : `HttpError ${status} (${code})`;
1044
+ }
1045
+ function errorName(error) {
1046
+ return error instanceof Error ? error.name : `non-error ${typeof error}`;
1047
+ }
1048
+ function httpCause(error) {
1049
+ return {
1050
+ type: "http",
1051
+ requestId: error.requestId,
1052
+ status: error.response.status,
1053
+ code: apiErrorCode(error),
1054
+ eventId: apiErrorEventId(error)
1055
+ };
1056
+ }
1057
+ function apiErrorEventId(error) {
1058
+ const body = error.response.body;
1059
+ if (typeof body !== "object" || body === null) return null;
1060
+ const eventId = body.event_id;
1061
+ return typeof eventId === "string" ? eventId : null;
1062
+ }
1063
+
1064
+ // src/universal/core/shared/observability/internal-logger.ts
1065
+ function internalLogger(logger, scope) {
1066
+ return logger ? scopedLogger(logger, scope, {}) : noopInternalLogger;
1067
+ }
1068
+ var LEVEL_RANK = {
1069
+ none: 0,
1070
+ error: 1,
1071
+ warn: 2,
1072
+ info: 3,
1073
+ debug: 4
1074
+ };
1075
+ function scopedLogger(logger, scope, bindings) {
1076
+ const admits = (level) => LEVEL_RANK[logger.level()] >= LEVEL_RANK[level];
1077
+ const safe = (event) => ({
1078
+ msg: event.msg,
1079
+ scope,
1080
+ bindings,
1081
+ fields: event.fields ?? {},
1082
+ ...event.cause === void 0 ? {} : { cause: event.cause }
1083
+ });
1084
+ const unredacted = (event) => ({
1085
+ msg: event.msg,
1086
+ scope,
1087
+ bindings,
1088
+ fields: event.fields ?? {}
1089
+ });
1090
+ const self = {
1091
+ child: (binding) => scopedLogger(logger, scope, { ...bindings, ...binding }),
1092
+ debug: (event) => {
1093
+ if (admits("debug")) logger.debug(() => unredacted(event()));
1094
+ },
1095
+ info: (event) => {
1096
+ if (admits("info")) logger.info(() => safe(event()));
1097
+ },
1098
+ warn: (event) => {
1099
+ if (admits("warn")) logger.warn(() => safe(event()));
1100
+ },
1101
+ error: (event) => {
1102
+ if (admits("error")) logger.error(() => safe(event()));
1103
+ },
1104
+ failure: (event, error) => {
1105
+ if (admits("debug"))
1106
+ logger.debug(() => unredacted(verbatim(event(), error)));
1107
+ if (admits("error")) logger.error(() => safe(classified(event(), error)));
1108
+ },
1109
+ warning: (event, error) => {
1110
+ if (admits("debug"))
1111
+ logger.debug(() => unredacted(verbatim(event(), error)));
1112
+ if (admits("warn")) logger.warn(() => safe(classified(event(), error)));
1113
+ },
1114
+ wrap: async (op, params, run) => {
1115
+ const opLog = self.child({ op });
1116
+ opLog.debug(() => ({ msg: "call", fields: { params } }));
1117
+ try {
1118
+ return await run();
1119
+ } catch (error) {
1120
+ opLog.failure(() => ({ msg: "call failed" }), error);
1121
+ throw error;
1122
+ }
1123
+ }
1124
+ };
1125
+ return self;
1126
+ }
1127
+ function verbatim(event, error) {
1128
+ return {
1129
+ msg: event.msg,
1130
+ fields: { ...event.fields, error: describeErrorUnredacted(error) }
1131
+ };
1132
+ }
1133
+ function classified(event, error) {
1134
+ return { ...event, cause: event.cause ?? classifyLogCause(error) };
1135
+ }
1136
+ var noopInternalLogger = {
1137
+ child: () => noopInternalLogger,
1138
+ debug: () => void 0,
1139
+ info: () => void 0,
1140
+ warn: () => void 0,
1141
+ error: () => void 0,
1142
+ failure: () => void 0,
1143
+ warning: () => void 0,
1144
+ wrap: (_op, _params, run) => run()
1145
+ };
1146
+
1147
+ // src/universal/core/checkout/centrifuge/centrifuge-namespace.ts
1148
+ var CentrifugeNamespaceImpl = class {
1149
+ constructor(ctx) {
1150
+ this.ctx = ctx;
1151
+ this.log = internalLogger(ctx.logger, "CENTRIFUGE");
1152
+ }
1153
+ async getQuote(params) {
1154
+ return this.log.wrap("getQuote", params, async () => {
1155
+ await this.ctx.ensureUserAuthenticated();
1156
+ return getCentrifugeVaultQuote(this.ctx.api, params);
1157
+ });
1158
+ }
1159
+ async getVaultStatus(params) {
1160
+ return this.log.wrap("getVaultStatus", params, async () => {
1161
+ await this.ctx.ensureUserAuthenticated();
1162
+ return getCentrifugeVaultStatus(this.ctx.api, params);
1163
+ });
1164
+ }
1165
+ async getPosition(params) {
1166
+ return this.log.wrap("getPosition", params, async () => {
1167
+ await this.ctx.ensureUserAuthenticated();
1168
+ return getCentrifugeVaultPosition(this.ctx.api, params);
1169
+ });
1170
+ }
1171
+ async getRedeemPosition(params) {
1172
+ return this.log.wrap("getRedeemPosition", params, async () => {
1173
+ await this.ctx.ensureUserAuthenticated();
1174
+ return getCentrifugeVaultRedeemPosition(this.ctx.api, params);
1175
+ });
1176
+ }
1177
+ async createClaim(params) {
1178
+ return this.log.wrap("createClaim", params, async () => {
1179
+ await this.ctx.ensureUserAuthenticated();
1180
+ return createCentrifugeVaultClaim(this.ctx.api, params);
1181
+ });
1182
+ }
1183
+ async createClaimProceeds(params) {
1184
+ return this.log.wrap("createClaimProceeds", params, async () => {
1185
+ await this.ctx.ensureUserAuthenticated();
1186
+ return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
1187
+ });
1188
+ }
1189
+ };
1190
+
1191
+ // src/universal/core/checkout/centrifuge/constants.ts
1192
+ var CENTRIFUGE_POLL_INTERVAL_MS = 15e3;
1193
+
1194
+ // src/universal/core/checkout/centrifuge/vaults.ts
1195
+ function resolveCentrifugeVaults(offer, lookup) {
1196
+ return offer.vaultContracts.map((contract) => {
1197
+ const { chain } = contract;
1198
+ if (!isEthereumChain(chain)) {
1199
+ return { type: "unresolved", chain, missing: "evm-chain" };
1200
+ }
1201
+ const onChain = (role) => offer.tokens.filter(
1202
+ (token) => token.role === role && token.chain === chain
1203
+ );
1204
+ const share = firstKnown(onChain("vault"), lookup);
1205
+ if (share === null) {
1206
+ return { type: "unresolved", chain, missing: "share-token" };
1207
+ }
1208
+ const funding = firstKnown(onChain("funding"), lookup);
1209
+ if (funding === null) {
1210
+ return { type: "unresolved", chain, missing: "funding-token" };
1211
+ }
1212
+ return {
1213
+ type: "resolved",
1214
+ vault: { chain, proxy: contract.address, share, funding }
1215
+ };
1216
+ });
1217
+ }
1218
+ function firstKnown(tokens, lookup) {
1219
+ for (const token of tokens) {
1220
+ const metadata = lookup(token);
1221
+ if (metadata !== null) return metadata;
1222
+ }
1223
+ return null;
665
1224
  }
666
- function decimalOrNull(value) {
667
- return value === null ? null : DecimalString(value);
1225
+ function isEthereumChain(chain) {
1226
+ return chain in ETHEREUM_CHAINS;
668
1227
  }
669
- function requiredArray(value, field) {
670
- if (!Array.isArray(value)) {
671
- throw new ValidationError(
672
- `${field}: expected an array, got ${typeof value}`
673
- );
1228
+
1229
+ // src/universal/types/pagination.ts
1230
+ var Cursor = (value) => value;
1231
+ var PaginatedResponse = {
1232
+ fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
1233
+ /**
1234
+ * For a mapper that decides the page as a whole - one that drops items it
1235
+ * cannot map, such as `Offer.listFromDto` - rather than item by item. The
1236
+ * cursors are the wire's either way: dropping an item changes what the
1237
+ * page holds, not where the next page starts.
1238
+ */
1239
+ fromDtoPage: (dto, pageMapper) => ({
1240
+ data: pageMapper(dto.data),
1241
+ startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
1242
+ startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
1243
+ })
1244
+ };
1245
+ var PaginationParams = {
1246
+ toQueryParams: (params) => {
1247
+ const queryParams = {};
1248
+ if (params.after) {
1249
+ queryParams.starting_after = params.after;
1250
+ }
1251
+ if (params.before) {
1252
+ queryParams.starting_before = params.before;
1253
+ }
1254
+ if (params.limit) {
1255
+ queryParams.limit = params.limit;
1256
+ }
1257
+ return queryParams;
674
1258
  }
675
- return value;
676
- }
1259
+ };
1260
+
1261
+ // src/universal/types/asset.ts
1262
+ var AssetId = (value) => value;
1263
+ var AssetCode = (value) => value;
1264
+ var Asset = {
1265
+ fromDto: (dto) => ({
1266
+ id: AssetId(dto.id),
1267
+ code: AssetCode(dto.code),
1268
+ name: dto.name,
1269
+ fractionalDigits: dto.fractional_digits
1270
+ })
1271
+ };
677
1272
 
678
1273
  // src/universal/types/offer.ts
679
1274
  var OfferId = (value) => value;
@@ -769,6 +1364,30 @@ var Ticker = (value) => value;
769
1364
  var Isin = (value) => value;
770
1365
 
771
1366
  // src/universal/types/offer-detail.ts
1367
+ var AsyncOfferDetail = {
1368
+ /**
1369
+ * Narrows an offer fetched generically, e.g. on an offer page, to one with
1370
+ * something to claim.
1371
+ *
1372
+ * An exhaustive `switch` rather than a list of async types, so a new offer
1373
+ * type is a compile error here until someone decides whether it settles
1374
+ * later.
1375
+ */
1376
+ is: (offer) => {
1377
+ switch (offer.type) {
1378
+ case "centrifuge::vault":
1379
+ return true;
1380
+ case "ondo::swap":
1381
+ case "superstate::swap":
1382
+ case "coinlist::token_sale":
1383
+ return false;
1384
+ default: {
1385
+ const exhaustive = offer;
1386
+ return exhaustive;
1387
+ }
1388
+ }
1389
+ }
1390
+ };
772
1391
  var OfferOptionId = (value) => value;
773
1392
  var OfferOptionSlug = (value) => value;
774
1393
  var OfferSwapContract = {
@@ -953,214 +1572,40 @@ var CreateParticipationParams = {
953
1572
  approval_transaction_hash: params.approvalTransactionHash
954
1573
  })
955
1574
  };
956
-
957
- // src/universal/api/frontline/providers/coin-list/token-sale.ts
958
- async function fetchParticipations(api, offerId) {
959
- return fetchAllPages(
960
- (params) => fetchParticipationsPage(api, params),
961
- { offerId }
962
- );
963
- }
964
- async function fetchParticipationsPage(api, params) {
965
- const pageDto = await api.send({
966
- method: "GET",
967
- url: "/v1/participations",
968
- queryParams: ParticipationsPaginationParams.toQueryParams(params),
969
- attributes: Attributes.protected()
970
- });
971
- return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
972
- }
973
- async function fetchParticipation(api, id) {
974
- const dto = await api.send({
975
- method: "GET",
976
- url: `/v1/participations/${id}`,
977
- attributes: Attributes.protected()
978
- });
979
- return Participation.fromDto(dto);
980
- }
981
- async function createParticipation(api, params) {
982
- const dto = await api.send({
983
- method: "POST",
984
- url: "/v1/participations",
985
- body: CreateParticipationParams.toDto(params),
986
- attributes: Attributes.protected()
987
- });
988
- return Participation.fromDto(dto);
989
- }
990
-
991
- // src/universal/core/shared/observability/log-cause.ts
992
- var import_viem = require("viem");
993
- function classifyLogCause(error) {
994
- if (error instanceof HttpError) {
995
- return httpCause(error);
996
- }
997
- if (error instanceof ValidationError) {
998
- return { type: "validation", message: error.message };
999
- }
1000
- if (error instanceof InvariantError) {
1001
- return { type: "invariant", message: error.message };
1002
- }
1003
- if (error instanceof MathError) {
1004
- return { type: "math", message: error.message };
1005
- }
1006
- if (error instanceof NotAuthenticatedError) {
1007
- return { type: "not-authenticated" };
1008
- }
1009
- if (error instanceof NotImplementedError) {
1010
- return { type: "not-implemented" };
1011
- }
1012
- if (error instanceof import_viem.BaseError) {
1013
- const http = error.walk((e) => e instanceof HttpError);
1014
- if (http instanceof HttpError) {
1015
- return httpCause(http);
1016
- }
1017
- return { type: "rpc", reason: rpcFailureReason(error) };
1018
- }
1019
- return { type: "generic-error", name: errorName(error) };
1020
- }
1021
- function rpcFailureReason(error) {
1022
- if (error.walk((e) => e instanceof import_viem.ContractFunctionRevertedError)) {
1023
- return "reverted";
1024
- }
1025
- if (error.walk((e) => e instanceof import_viem.RpcError)) {
1026
- return "node-rejected";
1027
- }
1028
- if (error.walk(
1029
- (e) => e instanceof import_viem.HttpRequestError || e instanceof import_viem.WebSocketRequestError || e instanceof import_viem.SocketClosedError || e instanceof import_viem.TimeoutError
1030
- )) {
1031
- return "transport";
1032
- }
1033
- if (error instanceof import_viem.ContractFunctionExecutionError) {
1034
- return "malformed-response";
1035
- }
1036
- return "unknown";
1037
- }
1038
- function describeErrorUnredacted(error) {
1039
- if (error instanceof HttpError) {
1040
- return describeHttpErrorRedacted(error);
1041
- }
1042
- if (error instanceof Error) {
1043
- return `${error.name}: ${error.message}`;
1044
- }
1045
- return `thrown non-error: ${stringifyUnredacted(error)}`;
1046
- }
1047
- function stringifyUnredacted(value) {
1048
- if (value === void 0) return "";
1049
- try {
1050
- return JSON.stringify(
1051
- value,
1052
- (_key, item) => typeof item === "bigint" ? `${item}` : item
1053
- ) ?? String(value);
1054
- } catch (_) {
1055
- return "<unserializable>";
1056
- }
1057
- }
1058
- function describeHttpErrorRedacted(error) {
1059
- const code = apiErrorCode(error);
1060
- const status = error.response.status;
1061
- return code === null ? `HttpError ${status}` : `HttpError ${status} (${code})`;
1062
- }
1063
- function errorName(error) {
1064
- return error instanceof Error ? error.name : `non-error ${typeof error}`;
1065
- }
1066
- function httpCause(error) {
1067
- return {
1068
- type: "http",
1069
- requestId: error.requestId,
1070
- status: error.response.status,
1071
- code: apiErrorCode(error),
1072
- eventId: apiErrorEventId(error)
1073
- };
1074
- }
1075
- function apiErrorEventId(error) {
1076
- const body = error.response.body;
1077
- if (typeof body !== "object" || body === null) return null;
1078
- const eventId = body.event_id;
1079
- return typeof eventId === "string" ? eventId : null;
1080
- }
1081
-
1082
- // src/universal/core/shared/observability/internal-logger.ts
1083
- function internalLogger(logger, scope) {
1084
- return logger ? scopedLogger(logger, scope, {}) : noopInternalLogger;
1085
- }
1086
- var LEVEL_RANK = {
1087
- none: 0,
1088
- error: 1,
1089
- warn: 2,
1090
- info: 3,
1091
- debug: 4
1092
- };
1093
- function scopedLogger(logger, scope, bindings) {
1094
- const admits = (level) => LEVEL_RANK[logger.level()] >= LEVEL_RANK[level];
1095
- const safe = (event) => ({
1096
- msg: event.msg,
1097
- scope,
1098
- bindings,
1099
- fields: event.fields ?? {},
1100
- ...event.cause === void 0 ? {} : { cause: event.cause }
1101
- });
1102
- const unredacted = (event) => ({
1103
- msg: event.msg,
1104
- scope,
1105
- bindings,
1106
- fields: event.fields ?? {}
1107
- });
1108
- const self = {
1109
- child: (binding) => scopedLogger(logger, scope, { ...bindings, ...binding }),
1110
- debug: (event) => {
1111
- if (admits("debug")) logger.debug(() => unredacted(event()));
1112
- },
1113
- info: (event) => {
1114
- if (admits("info")) logger.info(() => safe(event()));
1115
- },
1116
- warn: (event) => {
1117
- if (admits("warn")) logger.warn(() => safe(event()));
1118
- },
1119
- error: (event) => {
1120
- if (admits("error")) logger.error(() => safe(event()));
1121
- },
1122
- failure: (event, error) => {
1123
- if (admits("debug"))
1124
- logger.debug(() => unredacted(verbatim(event(), error)));
1125
- if (admits("error")) logger.error(() => safe(classified(event(), error)));
1126
- },
1127
- warning: (event, error) => {
1128
- if (admits("debug"))
1129
- logger.debug(() => unredacted(verbatim(event(), error)));
1130
- if (admits("warn")) logger.warn(() => safe(classified(event(), error)));
1131
- },
1132
- wrap: async (op, params, run) => {
1133
- const opLog = self.child({ op });
1134
- opLog.debug(() => ({ msg: "call", fields: { params } }));
1135
- try {
1136
- return await run();
1137
- } catch (error) {
1138
- opLog.failure(() => ({ msg: "call failed" }), error);
1139
- throw error;
1140
- }
1141
- }
1142
- };
1143
- return self;
1575
+
1576
+ // src/universal/api/frontline/providers/coin-list/token-sale.ts
1577
+ async function fetchParticipations(api, offerId) {
1578
+ return fetchAllPages(
1579
+ (params) => fetchParticipationsPage(api, params),
1580
+ { offerId }
1581
+ );
1144
1582
  }
1145
- function verbatim(event, error) {
1146
- return {
1147
- msg: event.msg,
1148
- fields: { ...event.fields, error: describeErrorUnredacted(error) }
1149
- };
1583
+ async function fetchParticipationsPage(api, params) {
1584
+ const pageDto = await api.send({
1585
+ method: "GET",
1586
+ url: "/v1/participations",
1587
+ queryParams: ParticipationsPaginationParams.toQueryParams(params),
1588
+ attributes: Attributes.protected()
1589
+ });
1590
+ return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
1150
1591
  }
1151
- function classified(event, error) {
1152
- return { ...event, cause: event.cause ?? classifyLogCause(error) };
1592
+ async function fetchParticipation(api, id) {
1593
+ const dto = await api.send({
1594
+ method: "GET",
1595
+ url: `/v1/participations/${id}`,
1596
+ attributes: Attributes.protected()
1597
+ });
1598
+ return Participation.fromDto(dto);
1599
+ }
1600
+ async function createParticipation(api, params) {
1601
+ const dto = await api.send({
1602
+ method: "POST",
1603
+ url: "/v1/participations",
1604
+ body: CreateParticipationParams.toDto(params),
1605
+ attributes: Attributes.protected()
1606
+ });
1607
+ return Participation.fromDto(dto);
1153
1608
  }
1154
- var noopInternalLogger = {
1155
- child: () => noopInternalLogger,
1156
- debug: () => void 0,
1157
- info: () => void 0,
1158
- warn: () => void 0,
1159
- error: () => void 0,
1160
- failure: () => void 0,
1161
- warning: () => void 0,
1162
- wrap: (_op, _params, run) => run()
1163
- };
1164
1609
 
1165
1610
  // src/universal/core/checkout/coin-list/token-sale-namespace.ts
1166
1611
  var CoinListTokenSaleNamespaceImpl = class {
@@ -1317,7 +1762,7 @@ function isOndoNotTradableError(error) {
1317
1762
  }
1318
1763
 
1319
1764
  // src/universal/core/shared/blockchain/formatters.ts
1320
- var import_viem2 = require("viem");
1765
+ var import_viem3 = require("viem");
1321
1766
 
1322
1767
  // src/universal/types/blockchain/ui.ts
1323
1768
  var FormattedAmountUi = (value) => value;
@@ -1388,7 +1833,7 @@ function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1388
1833
  };
1389
1834
  }
1390
1835
  function formatRawAmount(amount) {
1391
- return (0, import_viem2.formatUnits)(amount.raw, amount.decimals);
1836
+ return (0, import_viem3.formatUnits)(amount.raw, amount.decimals);
1392
1837
  }
1393
1838
  function formatCompactAmount(amount, locale) {
1394
1839
  const value = Number(formatRawAmount(amount));
@@ -1492,66 +1937,6 @@ function explorerBaseUrl(chain) {
1492
1937
  }
1493
1938
  }
1494
1939
 
1495
- // src/universal/core/shared/blockchain/math.ts
1496
- var import_viem3 = require("viem");
1497
- function blockchainAmountFromRawOrThrow({
1498
- label,
1499
- raw,
1500
- decimals
1501
- }) {
1502
- const trimmed = raw.trim();
1503
- if (trimmed === "") {
1504
- throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
1505
- }
1506
- let value;
1507
- try {
1508
- value = BigInt(trimmed);
1509
- } catch {
1510
- throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
1511
- }
1512
- try {
1513
- return BlockchainAmount({ raw: assertUint256(value), decimals });
1514
- } catch {
1515
- throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
1516
- }
1517
- }
1518
- function parseBlockchainAmount(amount, decimals) {
1519
- const trimmed = amount.trim();
1520
- if (trimmed === "") return { valid: false, reason: { type: "empty" } };
1521
- if (trimmed.startsWith("-")) {
1522
- return { valid: false, reason: { type: "negative" } };
1523
- }
1524
- if (/[eE]/.test(trimmed)) {
1525
- return { valid: false, reason: { type: "invalid-format" } };
1526
- }
1527
- if (trimmed === ".") {
1528
- return { valid: false, reason: { type: "invalid-format" } };
1529
- }
1530
- const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
1531
- if (!/^\d+(\.\d+)?$/.test(normalised)) {
1532
- return { valid: false, reason: { type: "invalid-format" } };
1533
- }
1534
- const [, fraction = ""] = normalised.split(".");
1535
- if (fraction.length > decimals) {
1536
- return {
1537
- valid: false,
1538
- reason: { type: "too-many-decimals", maxDecimals: decimals }
1539
- };
1540
- }
1541
- try {
1542
- const raw = (0, import_viem3.parseUnits)(normalised, decimals);
1543
- if (raw > MAX_UINT_256) {
1544
- return { valid: false, reason: { type: "overflow" } };
1545
- }
1546
- return {
1547
- valid: true,
1548
- amount: BlockchainAmount({ raw, decimals })
1549
- };
1550
- } catch {
1551
- return { valid: false, reason: { type: "invalid-format" } };
1552
- }
1553
- }
1554
-
1555
1940
  // src/universal/types/providers/ondo/ondo.ts
1556
1941
  var OndoTradingStatus = {
1557
1942
  fromDto: (dto) => {
@@ -3925,6 +4310,27 @@ var RedactedWalletError = {
3925
4310
  fromWalletError: (error) => error.type === "unknown" ? { type: "unknown" } : error
3926
4311
  };
3927
4312
 
4313
+ // src/universal/types/blockchain/wallet-selection.ts
4314
+ var WalletSelection = {
4315
+ /**
4316
+ * Every wallet in display order - embedded first, then the external one -
4317
+ * each address once. Addresses compare case-insensitively, so a host that
4318
+ * hands the same wallet over as both embedded and external sees it once.
4319
+ */
4320
+ all: (selection) => {
4321
+ const seen = /* @__PURE__ */ new Set();
4322
+ return [
4323
+ ...selection.embedded,
4324
+ ...selection.external === null ? [] : [selection.external]
4325
+ ].filter((wallet) => {
4326
+ const key = wallet.address.toLowerCase();
4327
+ if (seen.has(key)) return false;
4328
+ seen.add(key);
4329
+ return true;
4330
+ });
4331
+ }
4332
+ };
4333
+
3928
4334
  // src/universal/types/oauth-session.ts
3929
4335
  var ClientCredentialsOAuth = (value) => value;
3930
4336
  var OAuthRefreshToken = (value) => value;
@@ -3941,146 +4347,6 @@ var OAuthSession = {
3941
4347
  }
3942
4348
  };
3943
4349
 
3944
- // src/universal/types/providers/centrifuge/centrifuge.ts
3945
- var CentrifugeVaultQuote = {
3946
- fromDto: (dto) => {
3947
- const spendDecimals = AssetDecimals(dto.spend_input_decimals);
3948
- const shareDecimals = AssetDecimals(dto.share_decimals);
3949
- return {
3950
- chain: EthereumChain(dto.chain),
3951
- symbol: AssetSymbol(dto.symbol),
3952
- spendInputAmount: blockchainAmountFromRawOrThrow({
3953
- label: "spend_input_amount",
3954
- raw: dto.spend_input_amount,
3955
- decimals: spendDecimals
3956
- }),
3957
- estimatedShares: blockchainAmountFromRawOrThrow({
3958
- label: "estimated_shares",
3959
- raw: dto.estimated_shares,
3960
- decimals: shareDecimals
3961
- }),
3962
- indicativePrice: decimalOrNull(dto.indicative_price),
3963
- minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
3964
- label: "minimum_input_amount",
3965
- raw: dto.minimum_input_amount,
3966
- decimals: spendDecimals
3967
- }),
3968
- orderability: parseOrderability(
3969
- dto.can_order,
3970
- dto.reasons,
3971
- "CentrifugeVaultQuote"
3972
- )
3973
- };
3974
- }
3975
- };
3976
- var CentrifugeVaultStatus = {
3977
- fromDto: (dto) => ({
3978
- chain: EthereumChain(dto.chain),
3979
- symbol: AssetSymbol(dto.symbol),
3980
- vaultAddress: EvmContractAddress(dto.vault_address),
3981
- linked: dto.linked,
3982
- permissioned: dto.permissioned,
3983
- membershipValidUntil: dateOrNull(
3984
- dto.membership_valid_until,
3985
- "CentrifugeVaultStatus.membership_valid_until"
3986
- ),
3987
- halted: dto.halted,
3988
- priceUpdatedAt: dateOrNull(
3989
- dto.price_updated_at,
3990
- "CentrifugeVaultStatus.price_updated_at"
3991
- ),
3992
- orderability: parseOrderability(
3993
- dto.can_order,
3994
- dto.reasons,
3995
- "CentrifugeVaultStatus"
3996
- ),
3997
- asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
3998
- })
3999
- };
4000
- var CentrifugeVaultBuyTransaction = {
4001
- fromDto: (dto) => {
4002
- const spendInputAmount = blockchainAmountFromRawOrThrow({
4003
- label: "spend_input_amount",
4004
- raw: dto.spend_input_amount,
4005
- decimals: AssetDecimals(dto.spend_input_decimals)
4006
- });
4007
- if (spendInputAmount.raw <= 0n) {
4008
- throw new ValidationError(
4009
- `spend_input_amount: must be greater than zero ("${dto.spend_input_amount}") - a deposit of nothing is not a request`
4010
- );
4011
- }
4012
- return {
4013
- ...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
4014
- spendInputAmount,
4015
- estimatedShares: blockchainAmountFromRawOrThrow({
4016
- label: "estimated_shares",
4017
- raw: dto.estimated_shares,
4018
- decimals: AssetDecimals(dto.share_decimals)
4019
- })
4020
- };
4021
- }
4022
- };
4023
- var CentrifugeVaultClaimTransaction = {
4024
- fromDto: (dto) => ({
4025
- ...parseTransactionCore(dto, "CentrifugeVaultClaimTransaction"),
4026
- claimableShares: blockchainAmountFromRawOrThrow({
4027
- label: "claimable_shares",
4028
- raw: dto.claimable_shares,
4029
- decimals: AssetDecimals(dto.share_decimals)
4030
- })
4031
- })
4032
- };
4033
- var CentrifugeVaultPosition = {
4034
- fromDto: (dto) => {
4035
- const assetDecimals = AssetDecimals(dto.asset_decimals);
4036
- const shareDecimals = AssetDecimals(dto.share_decimals);
4037
- const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
4038
- const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
4039
- return {
4040
- chain: EthereumChain(dto.chain),
4041
- symbol: AssetSymbol(dto.symbol),
4042
- walletAddress: EvmWalletAddress(dto.wallet_address),
4043
- status: dto.status,
4044
- requested: asset("requested", dto.requested),
4045
- pending: asset("pending", dto.pending),
4046
- filledAssets: asset("filled_assets", dto.filled_assets),
4047
- earnedShares: shares("earned_shares", dto.earned_shares),
4048
- claimedShares: shares("claimed_shares", dto.claimed_shares),
4049
- claimableShares: shares("claimable_shares", dto.claimable_shares),
4050
- shareBalance: shares("share_balance", dto.share_balance),
4051
- averagePrice: decimalOrNull(dto.average_price),
4052
- frozen: dto.frozen,
4053
- asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
4054
- };
4055
- }
4056
- };
4057
- function parseOrderability(canOrder, reasons, model) {
4058
- const [first, ...rest] = reasons;
4059
- if (canOrder) {
4060
- if (first !== void 0) {
4061
- throw new ValidationError(
4062
- `${model}.reasons: expected none when can_order is true, got ${JSON.stringify(reasons)}`
4063
- );
4064
- }
4065
- return { type: "orderable" };
4066
- }
4067
- if (first === void 0) {
4068
- throw new ValidationError(
4069
- `${model}.reasons: expected at least one when can_order is false`
4070
- );
4071
- }
4072
- return { type: "blocked", reasons: [first, ...rest] };
4073
- }
4074
- function parseTransactionCore(dto, model) {
4075
- return {
4076
- tx: {
4077
- to: EvmContractAddress(dto.to),
4078
- data: HexEncodedTransactionData(dto.data)
4079
- },
4080
- expiresAt: dateOrNull(dto.expires_at, `${model}.expires_at`)
4081
- };
4082
- }
4083
-
4084
4350
  // src/universal/types/time.ts
4085
4351
  var MAX_EPOCH_MILLIS = 864e13;
4086
4352
  var EpochMillis = {
@@ -4147,15 +4413,22 @@ var User = {
4147
4413
  AssetIconUrl,
4148
4414
  AssetId,
4149
4415
  AssetSymbol,
4416
+ AsyncOfferDetail,
4150
4417
  AuthorizationCode,
4151
4418
  BPS_DENOM,
4152
4419
  Blockchain,
4153
4420
  BlockchainAmount,
4154
4421
  Bps,
4422
+ CENTRIFUGE_POLL_INTERVAL_MS,
4423
+ CentrifugeNamespaceImpl,
4155
4424
  CentrifugeVaultBuyTransaction,
4425
+ CentrifugeVaultClaimProceedsTransaction,
4156
4426
  CentrifugeVaultClaimTransaction,
4427
+ CentrifugeVaultLeg,
4428
+ CentrifugeVaultLegId,
4157
4429
  CentrifugeVaultPosition,
4158
4430
  CentrifugeVaultQuote,
4431
+ CentrifugeVaultRedeemPosition,
4159
4432
  CentrifugeVaultStatus,
4160
4433
  Chain,
4161
4434
  ClientCredentialsOAuth,
@@ -4279,6 +4552,7 @@ var User = {
4279
4552
  ValidationError,
4280
4553
  WalletAddress,
4281
4554
  WalletOwnershipChallenge,
4555
+ WalletSelection,
4282
4556
  WalletsNamespaceImpl,
4283
4557
  apiErrorCode,
4284
4558
  applyBps,
@@ -4311,6 +4585,7 @@ var User = {
4311
4585
  ondoQuoteOfferDeadline,
4312
4586
  parseBlockchainAmount,
4313
4587
  parseUint256,
4588
+ resolveCentrifugeVaults,
4314
4589
  shortenAddress,
4315
4590
  superstateSwapContractAddress,
4316
4591
  swapSpender,