@coinlist-co/react 0.12.2-rc.0ff2d03 → 0.12.2-rc.3de3751

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.
@@ -1,4 +1,4 @@
1
- import { A as AuthorizationCode, C as CodeVerifier, af as OAuthSession, x as OAuthAccessToken, ag as ClientCredentialsOAuth, y as OffersNamespace, D as Offer, ah as PaginationParams, ai as PaginatedResponse, f as OfferId, G as OfferDetail, R as RequirementsNamespace, g as OfferOptionId, s as Requirement, v as WalletsNamespace, z as Erc20Namespace, i as CoinListTokenSaleNamespace, r as SuperstateSwapNamespace, m as OndoNamespace, e as CentrifugeNamespace, T as TokensNamespace, w as Config, aj as ClientSecret, M as Seconds, Z as PinoLoggerOptions, _ as Logger } from '../time-BDzqB806.js';
1
+ import { A as AuthorizationCode, C as CodeVerifier, ae as OAuthSession, x as OAuthAccessToken, af as ClientCredentialsOAuth, y as OffersNamespace, D as Offer, ag as PaginationParams, ah as PaginatedResponse, f as OfferId, G as OfferDetail, R as RequirementsNamespace, g as OfferOptionId, s as Requirement, v as WalletsNamespace, z as Erc20Namespace, i as CoinListTokenSaleNamespace, r as SuperstateSwapNamespace, m as OndoNamespace, e as CentrifugeNamespace, T as TokensNamespace, w as Config, ai as ClientSecret, M as Seconds, Z as PinoLoggerOptions, _ as Logger } from '../time-DkU7jivQ.js';
2
2
  import 'viem';
3
3
 
4
4
  interface SessionStore {
@@ -7,7 +7,7 @@ import {
7
7
  notifySessionExpired,
8
8
  publicClients,
9
9
  systemTime
10
- } from "../chunk-QTBEDN7C.js";
10
+ } from "../chunk-L7SVKXXW.js";
11
11
  import {
12
12
  ClientCredentialsOAuth,
13
13
  OAuthSession
@@ -37,7 +37,7 @@ import {
37
37
  internalLogger,
38
38
  isExpired,
39
39
  isRejectedToken
40
- } from "../chunk-SVPFFLIT.js";
40
+ } from "../chunk-HMLWCXAP.js";
41
41
 
42
42
  // src/server/core/api/api-client.ts
43
43
  var ApiClient = class {
@@ -1007,14 +1007,6 @@ interface PaginatedResponse<T> {
1007
1007
  type ParticipationId = Newtype<string, 'ParticipationId'>;
1008
1008
  /** Casts a string into a typed {@link ParticipationId}. */
1009
1009
  declare const ParticipationId: (value: string) => ParticipationId;
1010
- /** Blockchain identifier for where a participation is funded. */
1011
- type Blockchain = Newtype<string, 'Blockchain'>;
1012
- /** Casts a string into a typed {@link Blockchain}. */
1013
- declare const Blockchain: (value: string) => Blockchain;
1014
- /** Wallet address used for a participation. */
1015
- type WalletAddress = Newtype<`0x${string}`, 'WalletAddress'>;
1016
- /** Casts a `0x`-prefixed string into a typed {@link WalletAddress}. */
1017
- declare const WalletAddress: (value: `0x${string}`) => WalletAddress;
1018
1010
  /** Possible participation lifecycle states returned by the API. */
1019
1011
  type ParticipationStatus = 'prepared' | 'pending' | 'submitted' | 'completed' | 'failed' | 'remit_submitted' | 'remitted' | 'remit_failed';
1020
1012
  /** Domain model for a participation returned by CoinList APIs. */
@@ -1033,14 +1025,20 @@ type Participation = {
1033
1025
  displayAmount: string;
1034
1026
  /** Asset metadata for the participation amount. */
1035
1027
  asset: Asset;
1036
- /** Funding chain identifier. */
1037
- chain: Blockchain;
1028
+ /**
1029
+ * The chain the participation is funded on, or null when frontline names
1030
+ * one this SDK does not model yet. Lenient on purpose: participations are
1031
+ * listed, and one record on a newer chain must not fail the whole list -
1032
+ * the same reason `isChain` drops what it cannot name elsewhere, except a
1033
+ * participation is the user's own money and is kept rather than dropped.
1034
+ */
1035
+ chain: Chain | null;
1038
1036
  /** Creation timestamp, if returned by API. */
1039
1037
  insertedAt: Date | null;
1040
1038
  /** Last update timestamp, if returned by API. */
1041
1039
  updatedAt: Date | null;
1042
1040
  /** Wallet used for participation, blank values normalized to null. */
1043
- walletAddress: WalletAddress | null;
1041
+ walletAddress: EvmWalletAddress | null;
1044
1042
  };
1045
1043
  /** Parameters required to create a new participation. */
1046
1044
  type CreateParticipationParams = {
@@ -1048,10 +1046,10 @@ type CreateParticipationParams = {
1048
1046
  offerId: OfferId;
1049
1047
  /** Offer option selected for participation. */
1050
1048
  offerOptionId: OfferOptionId;
1051
- /** Blockchain for funding. */
1052
- chain: Blockchain;
1049
+ /** Chain the participation is funded on. */
1050
+ chain: EthereumChain;
1053
1051
  /** Wallet address that funds the participation. */
1054
- walletAddress: WalletAddress;
1052
+ walletAddress: EvmWalletAddress;
1055
1053
  /**
1056
1054
  * Decimal token amount to participate with (e.g. `"100"` for 100 USDC), NOT
1057
1055
  * raw base units. The backend rescales this by the asset's decimals to verify
@@ -1583,8 +1581,8 @@ type SwapStatus = {
1583
1581
  */
1584
1582
  type AllowWalletResponse = {
1585
1583
  action: 'broadcast_transaction';
1586
- to: EvmContractAddress;
1587
- data: HexEncodedTransactionData;
1584
+ /** Broadcast as-is: the allow-list call, already encoded. */
1585
+ tx: Tx;
1588
1586
  } | {
1589
1587
  action: 'none';
1590
1588
  alreadyAllowed: boolean;
@@ -2708,4 +2706,4 @@ declare const Seconds: {
2708
2706
  toMillis: (value: Seconds) => Millis;
2709
2707
  };
2710
2708
 
2711
- export { type CentrifugeVaultStatus as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, type Offer as D, EthereumChain as E, type TokenMetadata as F, type OfferDetail as G, StablecoinSymbol as H, type Erc20Asset as I, type CoinListTokenSaleOfferDetail as J, CentrifugeVaultLegId as K, type CentrifugeVaultOfferDetail as L, Seconds as M, AsyncOfferDetail as N, type OfferVaultContract as O, type Participation as P, type RequirementStatusInfo as Q, type RequirementsNamespace as R, type SwapQuote as S, type TokensNamespace as T, type KycLevelName as U, type RequirementType as V, type WalletError as W, type RequirementStatusValue as X, RequirementId as Y, type PinoLoggerOptions as Z, type Logger as _, AssetSymbol as a, type FrontlineEventId as a$, type CentrifugeVaultRef as a0, type BuildCentrifugeVaultBuyParams as a1, type BuildOndoBuyParams as a2, type OndoSwapOfferDetail as a3, type BuildOndoSellParams as a4, type OndoQuote as a5, type OndoQuoteSize as a6, type OndoTradingStatus as a7, AssetDecimals as a8, type SuperstateSwapOfferDetail as a9, type CentrifugeDepositPosition as aA, type CentrifugeOrderReason as aB, type CentrifugeOrderability as aC, type CentrifugeRedeemPosition as aD, CentrifugeShares as aE, type CentrifugeVaultClaimProceedsTransaction as aF, type CentrifugeVaultClaimTransaction as aG, type CentrifugeVaultOffer as aH, type CentrifugeVaultReason as aI, type CentrifugeVaultResolution as aJ, type CentrifugeVaultTransactionCore as aK, type CentrifugeWalletParams as aL, Chain as aM, type CoinListTokenSaleOffer as aN, type ConnectExternalWalletParams as aO, type CreateKycTokenParams as aP, type CreateParticipationParams as aQ, type CreateWalletOwnershipChallengeParams as aR, Cursor as aS, type DebugEvent as aT, DecimalString as aU, type DocumentFormType as aV, type DocumentSubmissionStatus as aW, type DocumentType as aX, ETHEREUM_CHAINS as aY, EpochMillis as aZ, type FaqItem as a_, CentrifugeVaultLeg as aa, type CentrifugeVault as ab, OfferOptionAddressId as ac, type DocumentSubmission as ad, type TokenIdentifier as ae, type OAuthSession as af, ClientCredentialsOAuth as ag, type PaginationParams as ah, type PaginatedResponse as ai, ClientSecret as aj, type RequestId as ak, ClientId as al, RedirectUri as am, CodeChallenge as an, PKCEState as ao, type SwapStatus as ap, KnownAssetSymbol as aq, type AllowWalletParams as ar, type AllowWalletResponse as as, type Asset as at, AssetCode as au, type AsyncOfferType as av, type BaseEvent as aw, Blockchain as ax, type BuildOndoSwapParamsCore as ay, CentrifugeAssets as az, EvmContractAddress as b, type TokenLogo as b$, type GetCentrifugeVaultStatusParams as b0, type GetOndoQuoteParams as b1, type GetOndoTradingStatusParams as b2, type GetSwapAuthorizationParams as b3, type GetSwapPreviewParams as b4, type GetSwapQuoteParams as b5, type GetTokenAllowanceParams as b6, type GetTokenBalanceParams as b7, HexEncodedTransactionData as b8, Isin as b9, type OndoSwapOffer as bA, ParticipationId as bB, type ParticipationStatus as bC, type ParticipationsPaginationParams as bD, PauseFlags as bE, type Pii as bF, type PiiAddress as bG, type PiiJurisdiction as bH, type PiiKind as bI, type ProductionLogLevel as bJ, type ReadCentrifugePositionParams as bK, type RedactedWalletError as bL, type RemoveOptionAddressParams as bM, type RequirementActionNeededReason as bN, type RpcConfig as bO, type RpcFailureReason as bP, SOLANA_CHAINS as bQ, STABLE_DECIMALS as bR, type SafeEvent as bS, type SafeFields as bT, SolanaChain as bU, type SubmitDocumentParams as bV, type SuperstateSwapOffer as bW, type SwapContractRef as bX, type SwapPreview as bY, type TermItem as bZ, Ticker as b_, Iso2CountryCode as ba, type KycToken as bb, type Link as bc, type ListOptionAddressesParams as bd, type LogBinding as be, type LogBindings as bf, type LogCause as bg, type LogLevel as bh, type LogScope as bi, type LogValue as bj, MAX_ASSET_DECIMALS as bk, MAX_UINT_256 as bl, type Milestone as bm, Millis as bn, type Newtype as bo, OAuthRefreshToken as bp, type OfferBase as bq, type OfferDetailBase as br, type OfferEditorial as bs, type OfferOption as bt, OfferOptionSlug as bu, OfferSlug as bv, type OfferToken as bw, type OfferType as bx, type OndoQuoteDuration as by, type OndoSellOutcome as bz, type CentrifugeVaultBuyTransaction as c, type TokenLogoImage as c0, TokenLogoUrl as c1, type TokenRole as c2, type Tx as c3, type Uint256 as c4, type UnredactedFields as c5, WalletAddress as c6, type WalletOwnershipChallenge as c7, type WalletOwnershipChallengeParamsBase as c8, type WalletProtocol as c9, assertUint256 as ca, isChain as cb, isOfferType as cc, parseUint256 as cd, resolveCentrifugeVaults as ce, type CentrifugeClaimDirection as d, type CentrifugeNamespace as e, OfferId as f, OfferOptionId as g, AssetId as h, type CoinListTokenSaleNamespace as i, type OfferSwapContract as j, type OndoBuyTransaction as k, type OndoSellTransaction as l, type OndoNamespace as m, type OndoSwapTransactionCore as n, type OrderBookSide as o, Bps as p, EvmWalletAddress as q, type SuperstateSwapNamespace as r, type Requirement as s, type WalletChallengeType as t, type OfferOptionAddress as u, type WalletsNamespace as v, type Config as w, type OAuthAccessToken as x, type OffersNamespace as y, type Erc20Namespace as z };
2709
+ export { type CentrifugeVaultStatus as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, type Offer as D, EthereumChain as E, type TokenMetadata as F, type OfferDetail as G, StablecoinSymbol as H, type Erc20Asset as I, type CoinListTokenSaleOfferDetail as J, CentrifugeVaultLegId as K, type CentrifugeVaultOfferDetail as L, Seconds as M, AsyncOfferDetail as N, type OfferVaultContract as O, type Participation as P, type RequirementStatusInfo as Q, type RequirementsNamespace as R, type SwapQuote as S, type TokensNamespace as T, type KycLevelName as U, type RequirementType as V, type WalletError as W, type RequirementStatusValue as X, RequirementId as Y, type PinoLoggerOptions as Z, type Logger as _, AssetSymbol as a, type GetCentrifugeVaultStatusParams as a$, type CentrifugeVaultRef as a0, type BuildOndoBuyParams as a1, type OndoSwapOfferDetail as a2, type BuildOndoSellParams as a3, type OndoQuote as a4, type OndoQuoteSize as a5, type OndoTradingStatus as a6, AssetDecimals as a7, type SuperstateSwapOfferDetail as a8, CentrifugeVaultLeg as a9, type CentrifugeOrderReason as aA, type CentrifugeOrderability as aB, type CentrifugeRedeemPosition as aC, CentrifugeShares as aD, type CentrifugeVaultClaimProceedsTransaction as aE, type CentrifugeVaultClaimTransaction as aF, type CentrifugeVaultOffer as aG, type CentrifugeVaultReason as aH, type CentrifugeVaultResolution as aI, type CentrifugeVaultTransactionCore as aJ, type CentrifugeWalletParams as aK, Chain as aL, type CoinListTokenSaleOffer as aM, type ConnectExternalWalletParams as aN, type CreateKycTokenParams as aO, type CreateParticipationParams as aP, type CreateWalletOwnershipChallengeParams as aQ, Cursor as aR, type DebugEvent as aS, DecimalString as aT, type DocumentFormType as aU, type DocumentSubmissionStatus as aV, type DocumentType as aW, ETHEREUM_CHAINS as aX, EpochMillis as aY, type FaqItem as aZ, type FrontlineEventId as a_, type CentrifugeVault as aa, OfferOptionAddressId as ab, type DocumentSubmission as ac, type TokenIdentifier as ad, type OAuthSession as ae, ClientCredentialsOAuth as af, type PaginationParams as ag, type PaginatedResponse as ah, ClientSecret as ai, type RequestId as aj, ClientId as ak, RedirectUri as al, CodeChallenge as am, PKCEState as an, type SwapStatus as ao, KnownAssetSymbol as ap, type AllowWalletParams as aq, type AllowWalletResponse as ar, type Asset as as, AssetCode as at, type AsyncOfferType as au, type BaseEvent as av, type BuildCentrifugeVaultBuyParams as aw, type BuildOndoSwapParamsCore as ax, CentrifugeAssets as ay, type CentrifugeDepositPosition as az, EvmContractAddress as b, type TokenLogoImage as b$, type GetOndoQuoteParams as b0, type GetOndoTradingStatusParams as b1, type GetSwapAuthorizationParams as b2, type GetSwapPreviewParams as b3, type GetSwapQuoteParams as b4, type GetTokenAllowanceParams as b5, type GetTokenBalanceParams as b6, HexEncodedTransactionData as b7, Isin as b8, Iso2CountryCode as b9, ParticipationId as bA, type ParticipationStatus as bB, type ParticipationsPaginationParams as bC, PauseFlags as bD, type Pii as bE, type PiiAddress as bF, type PiiJurisdiction as bG, type PiiKind as bH, type ProductionLogLevel as bI, type ReadCentrifugePositionParams as bJ, type RedactedWalletError as bK, type RemoveOptionAddressParams as bL, type RequirementActionNeededReason as bM, type RpcConfig as bN, type RpcFailureReason as bO, SOLANA_CHAINS as bP, STABLE_DECIMALS as bQ, type SafeEvent as bR, type SafeFields as bS, SolanaChain as bT, type SubmitDocumentParams as bU, type SuperstateSwapOffer as bV, type SwapContractRef as bW, type SwapPreview as bX, type TermItem as bY, Ticker as bZ, type TokenLogo as b_, type KycToken as ba, type Link as bb, type ListOptionAddressesParams as bc, type LogBinding as bd, type LogBindings as be, type LogCause as bf, type LogLevel as bg, type LogScope as bh, type LogValue as bi, MAX_ASSET_DECIMALS as bj, MAX_UINT_256 as bk, type Milestone as bl, Millis as bm, type Newtype as bn, OAuthRefreshToken as bo, type OfferBase as bp, type OfferDetailBase as bq, type OfferEditorial as br, type OfferOption as bs, OfferOptionSlug as bt, OfferSlug as bu, type OfferToken as bv, type OfferType as bw, type OndoQuoteDuration as bx, type OndoSellOutcome as by, type OndoSwapOffer as bz, type CentrifugeVaultBuyTransaction as c, TokenLogoUrl as c0, type TokenRole as c1, type Tx as c2, type Uint256 as c3, type UnredactedFields as c4, type WalletOwnershipChallenge as c5, type WalletOwnershipChallengeParamsBase as c6, type WalletProtocol as c7, assertUint256 as c8, isChain as c9, isOfferType as ca, parseUint256 as cb, resolveCentrifugeVaults as cc, type CentrifugeClaimDirection as d, type CentrifugeNamespace as e, OfferId as f, OfferOptionId as g, AssetId as h, type CoinListTokenSaleNamespace as i, type OfferSwapContract as j, type OndoBuyTransaction as k, type OndoSellTransaction as l, type OndoNamespace as m, type OndoSwapTransactionCore as n, type OrderBookSide as o, Bps as p, EvmWalletAddress as q, type SuperstateSwapNamespace as r, type Requirement as s, type WalletChallengeType as t, type OfferOptionAddress as u, type WalletsNamespace as v, type Config as w, type OAuthAccessToken as x, type OffersNamespace as y, type Erc20Namespace as z };
@@ -1,4 +1,4 @@
1
- import { q as EvmWalletAddress, E as EthereumChain, c3 as Tx, bo as Newtype, F as TokenMetadata, aM as Chain, b as EvmContractAddress, bw as OfferToken } from './time-BDzqB806.js';
1
+ import { q as EvmWalletAddress, E as EthereumChain, c2 as Tx, bn as Newtype, F as TokenMetadata, aL as Chain, b as EvmContractAddress, bv as OfferToken } from './time-DkU7jivQ.js';
2
2
  import { Hex, Abi, Hash, TransactionReceipt } from 'viem';
3
3
 
4
4
  type WriteContractParams = {
@@ -75,23 +75,6 @@ type ExternalWalletAdapter = {
75
75
  disconnect: () => Promise<void>;
76
76
  };
77
77
 
78
- type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
79
- declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
80
- type FormattedPercentUi = Newtype<string, 'FormattedPercentUi'>;
81
- declare const FormattedPercentUi: (value: string) => FormattedPercentUi;
82
- type TxExplorerUrl = Newtype<string, 'TxExplorerUrl'>;
83
- declare const TxExplorerUrl: (value: string) => TxExplorerUrl;
84
- /**
85
- * A wallet address shortened for display (e.g. `0x1234…5678`). Keeps a
86
- * `0x${string}` base but drops the runtime `0x` narrowing.
87
- */
88
- type ShortenedWalletAddress = Newtype<`0x${string}`, 'ShortenedWalletAddress'>;
89
- declare const ShortenedWalletAddress: (value: string) => ShortenedWalletAddress;
90
- type FormattedAmountAssetUi = Newtype<string, 'FormattedAmountAssetUi'>;
91
- declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
92
- type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
93
- declare const AssetIconUrl: (value: string) => AssetIconUrl;
94
-
95
78
  /**
96
79
  * The wallets a screen reads for and acts from, supplied by the host.
97
80
  *
@@ -100,8 +83,6 @@ declare const AssetIconUrl: (value: string) => AssetIconUrl;
100
83
  * adapter for connecting an external one when it supports that. Every wallet
101
84
  * here is one that can sign for itself, so a screen can broadcast from the
102
85
  * wallet that holds a position.
103
- *
104
- * @alpha
105
86
  */
106
87
  type WalletSelection = {
107
88
  /**
@@ -119,7 +100,7 @@ type WalletSelection = {
119
100
  */
120
101
  externalAdapter: ExternalWalletAdapter | null;
121
102
  };
122
- /** @alpha */
103
+ /** Operations over a {@link WalletSelection}. */
123
104
  declare const WalletSelection: {
124
105
  /**
125
106
  * Every wallet in display order - embedded first, then the external one -
@@ -137,6 +118,23 @@ declare const WalletSelection: {
137
118
  */
138
119
  type WalletLabelResolver = (address: EvmWalletAddress) => string | null;
139
120
 
121
+ type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
122
+ declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
123
+ type FormattedPercentUi = Newtype<string, 'FormattedPercentUi'>;
124
+ declare const FormattedPercentUi: (value: string) => FormattedPercentUi;
125
+ type TxExplorerUrl = Newtype<string, 'TxExplorerUrl'>;
126
+ declare const TxExplorerUrl: (value: string) => TxExplorerUrl;
127
+ /**
128
+ * A wallet address shortened for display (e.g. `0x1234…5678`). Keeps a
129
+ * `0x${string}` base but drops the runtime `0x` narrowing.
130
+ */
131
+ type ShortenedWalletAddress = Newtype<`0x${string}`, 'ShortenedWalletAddress'>;
132
+ declare const ShortenedWalletAddress: (value: string) => ShortenedWalletAddress;
133
+ type FormattedAmountAssetUi = Newtype<string, 'FormattedAmountAssetUi'>;
134
+ declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
135
+ type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
136
+ declare const AssetIconUrl: (value: string) => AssetIconUrl;
137
+
140
138
  /**
141
139
  * An array guaranteed to hold at least one element. Use it where an empty list
142
140
  * would be a bug (e.g. the set of assets a swap always offers).
@@ -1,7 +1,7 @@
1
- import { ak as RequestId, al as ClientId, am as RedirectUri, an as CodeChallenge, ao as PKCEState, C as CodeVerifier, j as OfferSwapContract, E as EthereumChain, b as EvmContractAddress, k as OndoBuyTransaction, B as BlockchainAmount, l as OndoSellTransaction, S as SwapQuote, p as Bps, ap as SwapStatus, a8 as AssetDecimals, a as AssetSymbol, q as EvmWalletAddress, aq as KnownAssetSymbol, I as Erc20Asset, H as StablecoinSymbol } from '../time-BDzqB806.js';
2
- export { ar as AllowWalletParams, as as AllowWalletResponse, at as Asset, au as AssetCode, h as AssetId, N as AsyncOfferDetail, av as AsyncOfferType, A as AuthorizationCode, aw as BaseEvent, ax as Blockchain, a1 as BuildCentrifugeVaultBuyParams, a2 as BuildOndoBuyParams, a4 as BuildOndoSellParams, ay as BuildOndoSwapParamsCore, az as CentrifugeAssets, d as CentrifugeClaimDirection, aA as CentrifugeDepositPosition, e as CentrifugeNamespace, aB as CentrifugeOrderReason, aC as CentrifugeOrderability, aD as CentrifugeRedeemPosition, aE as CentrifugeShares, ab as CentrifugeVault, c as CentrifugeVaultBuyTransaction, aF as CentrifugeVaultClaimProceedsTransaction, aG as CentrifugeVaultClaimTransaction, aa as CentrifugeVaultLeg, K as CentrifugeVaultLegId, aH as CentrifugeVaultOffer, L as CentrifugeVaultOfferDetail, aI as CentrifugeVaultReason, a0 as CentrifugeVaultRef, aJ as CentrifugeVaultResolution, $ as CentrifugeVaultStatus, aK as CentrifugeVaultTransactionCore, aL as CentrifugeWalletParams, aM as Chain, ag as ClientCredentialsOAuth, aj as ClientSecret, i as CoinListTokenSaleNamespace, aN as CoinListTokenSaleOffer, J as CoinListTokenSaleOfferDetail, w as Config, aO as ConnectExternalWalletParams, aP as CreateKycTokenParams, aQ as CreateParticipationParams, aR as CreateWalletOwnershipChallengeParams, aS as Cursor, aT as DebugEvent, aU as DecimalString, aV as DocumentFormType, ad as DocumentSubmission, aW as DocumentSubmissionStatus, aX as DocumentType, aY as ETHEREUM_CHAINS, aZ as EpochMillis, z as Erc20Namespace, a_ as FaqItem, a$ as FrontlineEventId, b0 as GetCentrifugeVaultStatusParams, b1 as GetOndoQuoteParams, b2 as GetOndoTradingStatusParams, b3 as GetSwapAuthorizationParams, b4 as GetSwapPreviewParams, b5 as GetSwapQuoteParams, b6 as GetTokenAllowanceParams, b7 as GetTokenBalanceParams, b8 as HexEncodedTransactionData, b9 as Isin, ba as Iso2CountryCode, U as KycLevelName, bb as KycToken, bc as Link, bd as ListOptionAddressesParams, be as LogBinding, bf as LogBindings, bg as LogCause, bh as LogLevel, bi as LogScope, bj as LogValue, _ as Logger, bk as MAX_ASSET_DECIMALS, bl as MAX_UINT_256, bm as Milestone, bn as Millis, bo as Newtype, x as OAuthAccessToken, bp as OAuthRefreshToken, af as OAuthSession, D as Offer, bq as OfferBase, G as OfferDetail, br as OfferDetailBase, bs as OfferEditorial, f as OfferId, bt as OfferOption, u as OfferOptionAddress, ac as OfferOptionAddressId, g as OfferOptionId, bu as OfferOptionSlug, bv as OfferSlug, bw as OfferToken, bx as OfferType, O as OfferVaultContract, y as OffersNamespace, m as OndoNamespace, a5 as OndoQuote, by as OndoQuoteDuration, a6 as OndoQuoteSize, bz as OndoSellOutcome, bA as OndoSwapOffer, a3 as OndoSwapOfferDetail, n as OndoSwapTransactionCore, a7 as OndoTradingStatus, o as OrderBookSide, ai as PaginatedResponse, ah as PaginationParams, P as Participation, bB as ParticipationId, bC as ParticipationStatus, bD as ParticipationsPaginationParams, bE as PauseFlags, bF as Pii, bG as PiiAddress, bH as PiiJurisdiction, bI as PiiKind, Z as PinoLoggerOptions, bJ as ProductionLogLevel, bK as ReadCentrifugePositionParams, bL as RedactedWalletError, bM as RemoveOptionAddressParams, s as Requirement, bN as RequirementActionNeededReason, Y as RequirementId, Q as RequirementStatusInfo, X as RequirementStatusValue, V as RequirementType, R as RequirementsNamespace, bO as RpcConfig, bP as RpcFailureReason, bQ as SOLANA_CHAINS, bR as STABLE_DECIMALS, bS as SafeEvent, bT as SafeFields, M as Seconds, bU as SolanaChain, bV as SubmitDocumentParams, r as SuperstateSwapNamespace, bW as SuperstateSwapOffer, a9 as SuperstateSwapOfferDetail, bX as SwapContractRef, bY as SwapPreview, bZ as TermItem, b_ as Ticker, ae as TokenIdentifier, b$ as TokenLogo, c0 as TokenLogoImage, c1 as TokenLogoUrl, F as TokenMetadata, c2 as TokenRole, T as TokensNamespace, c3 as Tx, c4 as Uint256, c5 as UnredactedFields, c6 as WalletAddress, t as WalletChallengeType, W as WalletError, c7 as WalletOwnershipChallenge, c8 as WalletOwnershipChallengeParamsBase, c9 as WalletProtocol, v as WalletsNamespace, ca as assertUint256, cb as isChain, cc as isOfferType, cd as parseUint256, ce as resolveCentrifugeVaults } from '../time-BDzqB806.js';
3
- import { F as FormattedAmountAssetUi, T as TxExplorerUrl, d as FormattedAmountUi, b as FormattedPercentUi, S as ShortenedWalletAddress } from '../token-registry-snapshot-cvLsnMo_.js';
4
- export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, e as EvmSigner, E as EvmWallet, f as ExternalWalletAdapter, N as NonEmptyArray, g as TokenKey, c as TokenRegistrySnapshot, a as WalletLabelResolver, W as WalletSelection, h as WriteContractParams, o as offerDisplayTokens } from '../token-registry-snapshot-cvLsnMo_.js';
1
+ import { aj as RequestId, ak as ClientId, al as RedirectUri, am as CodeChallenge, an as PKCEState, C as CodeVerifier, j as OfferSwapContract, E as EthereumChain, b as EvmContractAddress, k as OndoBuyTransaction, B as BlockchainAmount, l as OndoSellTransaction, S as SwapQuote, p as Bps, ao as SwapStatus, a7 as AssetDecimals, a as AssetSymbol, q as EvmWalletAddress, ap as KnownAssetSymbol, I as Erc20Asset, H as StablecoinSymbol } from '../time-DkU7jivQ.js';
2
+ export { aq as AllowWalletParams, ar as AllowWalletResponse, as as Asset, at as AssetCode, h as AssetId, N as AsyncOfferDetail, au as AsyncOfferType, A as AuthorizationCode, av as BaseEvent, aw as BuildCentrifugeVaultBuyParams, a1 as BuildOndoBuyParams, a3 as BuildOndoSellParams, ax as BuildOndoSwapParamsCore, ay as CentrifugeAssets, d as CentrifugeClaimDirection, az as CentrifugeDepositPosition, e as CentrifugeNamespace, aA as CentrifugeOrderReason, aB as CentrifugeOrderability, aC as CentrifugeRedeemPosition, aD as CentrifugeShares, aa as CentrifugeVault, c as CentrifugeVaultBuyTransaction, aE as CentrifugeVaultClaimProceedsTransaction, aF as CentrifugeVaultClaimTransaction, a9 as CentrifugeVaultLeg, K as CentrifugeVaultLegId, aG as CentrifugeVaultOffer, L as CentrifugeVaultOfferDetail, aH as CentrifugeVaultReason, a0 as CentrifugeVaultRef, aI as CentrifugeVaultResolution, $ as CentrifugeVaultStatus, aJ as CentrifugeVaultTransactionCore, aK as CentrifugeWalletParams, aL as Chain, af as ClientCredentialsOAuth, ai as ClientSecret, i as CoinListTokenSaleNamespace, aM as CoinListTokenSaleOffer, J as CoinListTokenSaleOfferDetail, w as Config, aN as ConnectExternalWalletParams, aO as CreateKycTokenParams, aP as CreateParticipationParams, aQ as CreateWalletOwnershipChallengeParams, aR as Cursor, aS as DebugEvent, aT as DecimalString, aU as DocumentFormType, ac as DocumentSubmission, aV as DocumentSubmissionStatus, aW as DocumentType, aX as ETHEREUM_CHAINS, aY as EpochMillis, z as Erc20Namespace, aZ as FaqItem, a_ as FrontlineEventId, a$ as GetCentrifugeVaultStatusParams, b0 as GetOndoQuoteParams, b1 as GetOndoTradingStatusParams, b2 as GetSwapAuthorizationParams, b3 as GetSwapPreviewParams, b4 as GetSwapQuoteParams, b5 as GetTokenAllowanceParams, b6 as GetTokenBalanceParams, b7 as HexEncodedTransactionData, b8 as Isin, b9 as Iso2CountryCode, U as KycLevelName, ba as KycToken, bb as Link, bc as ListOptionAddressesParams, bd as LogBinding, be as LogBindings, bf as LogCause, bg as LogLevel, bh as LogScope, bi as LogValue, _ as Logger, bj as MAX_ASSET_DECIMALS, bk as MAX_UINT_256, bl as Milestone, bm as Millis, bn as Newtype, x as OAuthAccessToken, bo as OAuthRefreshToken, ae as OAuthSession, D as Offer, bp as OfferBase, G as OfferDetail, bq as OfferDetailBase, br as OfferEditorial, f as OfferId, bs as OfferOption, u as OfferOptionAddress, ab as OfferOptionAddressId, g as OfferOptionId, bt as OfferOptionSlug, bu as OfferSlug, bv as OfferToken, bw as OfferType, O as OfferVaultContract, y as OffersNamespace, m as OndoNamespace, a4 as OndoQuote, bx as OndoQuoteDuration, a5 as OndoQuoteSize, by as OndoSellOutcome, bz as OndoSwapOffer, a2 as OndoSwapOfferDetail, n as OndoSwapTransactionCore, a6 as OndoTradingStatus, o as OrderBookSide, ah as PaginatedResponse, ag as PaginationParams, P as Participation, bA as ParticipationId, bB as ParticipationStatus, bC as ParticipationsPaginationParams, bD as PauseFlags, bE as Pii, bF as PiiAddress, bG as PiiJurisdiction, bH as PiiKind, Z as PinoLoggerOptions, bI as ProductionLogLevel, bJ as ReadCentrifugePositionParams, bK as RedactedWalletError, bL as RemoveOptionAddressParams, s as Requirement, bM as RequirementActionNeededReason, Y as RequirementId, Q as RequirementStatusInfo, X as RequirementStatusValue, V as RequirementType, R as RequirementsNamespace, bN as RpcConfig, bO as RpcFailureReason, bP as SOLANA_CHAINS, bQ as STABLE_DECIMALS, bR as SafeEvent, bS as SafeFields, M as Seconds, bT as SolanaChain, bU as SubmitDocumentParams, r as SuperstateSwapNamespace, bV as SuperstateSwapOffer, a8 as SuperstateSwapOfferDetail, bW as SwapContractRef, bX as SwapPreview, bY as TermItem, bZ as Ticker, ad as TokenIdentifier, b_ as TokenLogo, b$ as TokenLogoImage, c0 as TokenLogoUrl, F as TokenMetadata, c1 as TokenRole, T as TokensNamespace, c2 as Tx, c3 as Uint256, c4 as UnredactedFields, t as WalletChallengeType, W as WalletError, c5 as WalletOwnershipChallenge, c6 as WalletOwnershipChallengeParamsBase, c7 as WalletProtocol, v as WalletsNamespace, c8 as assertUint256, c9 as isChain, ca as isOfferType, cb as parseUint256, cc as resolveCentrifugeVaults } from '../time-DkU7jivQ.js';
3
+ import { F as FormattedAmountAssetUi, T as TxExplorerUrl, d as FormattedAmountUi, b as FormattedPercentUi, S as ShortenedWalletAddress } from '../token-registry-snapshot-D0OWXMe4.js';
4
+ export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, e as EvmSigner, E as EvmWallet, f as ExternalWalletAdapter, N as NonEmptyArray, g as TokenKey, c as TokenRegistrySnapshot, a as WalletLabelResolver, W as WalletSelection, h as WriteContractParams, o as offerDisplayTokens } from '../token-registry-snapshot-D0OWXMe4.js';
5
5
  import { Hash, Chain } from 'viem';
6
6
 
7
7
  type HttpResponse<TBody = unknown> = {
@@ -144,13 +144,14 @@ declare function computeOndoSellPrice(transaction: OndoSellTransaction): Blockch
144
144
  declare function isOndoNotTradableError(error: unknown): error is HttpError;
145
145
 
146
146
  /**
147
- * Price of 1 output token in USD, assuming the input token is a $1 stablecoin.
147
+ * Price of 1 output token in USD, assuming the input token is a $1 stablecoin:
148
+ * the quote's input divided by its output, via {@link pricePerShare}.
149
+ * Returned decimals match the input token decimals (always the stablecoin's 6).
148
150
  *
149
- * `raw_price = inputTokenAmount.raw × 10^outputDecimals ÷ outputTokenAmount.raw`
151
+ * `null` for a quote that fills nothing, which is an answer here rather than
152
+ * a corrupt amount: there is no price to show for it.
150
153
  *
151
- * The multiplication happens before the division so we never lose precision to
152
- * integer truncation early. This mirrors standard fixed-point practice on-chain.
153
- * Returned decimals match the input token decimals (always the stablecoin's 6).
154
+ * @throws MathError when the price is out of uint256 bounds.
154
155
  */
155
156
  declare function computePrice({ inputTokenAmount, outputTokenAmount, }: SwapQuote): BlockchainAmount | null;
156
157
  /**
@@ -37,7 +37,7 @@ import {
37
37
  resolveCentrifugeVaults,
38
38
  superstateSwapContractAddress,
39
39
  swapSpender
40
- } from "../chunk-PWGUKS4Q.js";
40
+ } from "../chunk-RLOYYAMO.js";
41
41
  import {
42
42
  ClientCredentialsOAuth,
43
43
  OAuthRefreshToken,
@@ -52,7 +52,6 @@ import {
52
52
  AssetId,
53
53
  AssetSymbol,
54
54
  AsyncOfferDetail,
55
- Blockchain,
56
55
  BlockchainAmount,
57
56
  Bps,
58
57
  CentrifugeAssets,
@@ -149,7 +148,6 @@ import {
149
148
  TokensNamespaceImpl,
150
149
  TxExplorerUrl,
151
150
  ValidationError,
152
- WalletAddress,
153
151
  WalletOwnershipChallenge,
154
152
  WalletsNamespaceImpl,
155
153
  apiErrorCode,
@@ -157,6 +155,7 @@ import {
157
155
  assetAmount,
158
156
  blockchainAmountFromRawOrThrow,
159
157
  chainFromId,
158
+ contractOn,
160
159
  formatAmount,
161
160
  formatBpsAsPercent,
162
161
  formatCompactAmount,
@@ -170,11 +169,13 @@ import {
170
169
  isOfferType,
171
170
  parseBlockchainAmount,
172
171
  parseUint256,
172
+ positiveAmountFromRawOrThrow,
173
+ pricePerShare,
173
174
  shortenAddress,
174
175
  txExplorerUrl,
175
176
  usdAmount,
176
177
  viemChain
177
- } from "../chunk-SVPFFLIT.js";
178
+ } from "../chunk-HMLWCXAP.js";
178
179
  export {
179
180
  AllowWalletResponse,
180
181
  Asset,
@@ -185,7 +186,6 @@ export {
185
186
  AssetSymbol,
186
187
  AsyncOfferDetail,
187
188
  AuthorizationCode,
188
- Blockchain,
189
189
  BlockchainAmount,
190
190
  Bps,
191
191
  CentrifugeAssets,
@@ -308,7 +308,6 @@ export {
308
308
  USDT,
309
309
  USDT_SYMBOL,
310
310
  ValidationError,
311
- WalletAddress,
312
311
  WalletOwnershipChallenge,
313
312
  WalletSelection,
314
313
  WalletsNamespaceImpl,
@@ -321,6 +320,7 @@ export {
321
320
  computeOndoSellPrice,
322
321
  computePrice,
323
322
  computeSlip,
323
+ contractOn,
324
324
  formatAmount,
325
325
  formatBpsAsPercent,
326
326
  formatCompactAmount,
@@ -340,6 +340,8 @@ export {
340
340
  ondoQuoteOfferDeadline,
341
341
  parseBlockchainAmount,
342
342
  parseUint256,
343
+ positiveAmountFromRawOrThrow,
344
+ pricePerShare,
343
345
  resolveCentrifugeVaults,
344
346
  shortenAddress,
345
347
  superstateSwapContractAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinlist-co/react",
3
- "version": "0.12.2-rc.0ff2d03",
3
+ "version": "0.12.2-rc.3de3751",
4
4
  "description": "CoinList Partner SDK",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/universal/types/oauth.ts","../src/universal/core/auth/pkce.ts","../src/universal/types/blockchain/wallet-error.ts","../src/universal/core/offers/swap-contracts.ts","../src/universal/core/shared/blockchain/bps.ts","../src/universal/core/providers/checkout/superstate/blockchain/math.ts","../src/universal/core/providers/checkout/superstate/blockchain/status.ts","../src/universal/core/offers/offers-namespace.ts","../src/universal/core/tokens/token-registry-snapshot.ts","../src/universal/core/shared/blockchain/token-registry.ts","../src/universal/core/providers/checkout/ondo/not-tradable.ts","../src/universal/core/providers/checkout/ondo/constants.ts","../src/universal/core/providers/checkout/ondo/math.ts","../src/universal/core/providers/checkout/superstate/constants.ts","../src/universal/core/providers/checkout/superstate/formatters.ts","../src/universal/types/blockchain/wallet-selection.ts","../src/universal/core/providers/checkout/centrifuge/vaults.ts"],"sourcesContent":["import type { Newtype } from '@/universal/types/newtype';\n\nexport type AuthorizationCode = Newtype<string, 'AuthorizationCode'>;\nexport const AuthorizationCode = (value: string): AuthorizationCode =>\n value as AuthorizationCode;\n\nexport type CodeVerifier = Newtype<string, 'CodeVerifier'>;\nexport const CodeVerifier = (value: string): CodeVerifier =>\n value as CodeVerifier;\n\nexport type CodeChallenge = Newtype<string, 'CodeChallenge'>;\nexport const CodeChallenge = (value: string): CodeChallenge =>\n value as CodeChallenge;\n\nexport type PKCEState = Newtype<string, 'PKCEState'>;\nexport const PKCEState = (value: string) => value as PKCEState;\n\nexport type RedirectUri = Newtype<string, 'RedirectUri'>;\nexport const RedirectUri = (value: string): RedirectUri => value as RedirectUri;\n\nexport type ClientId = Newtype<string, 'ClientId'>;\nexport const ClientId = (value: string): ClientId => value as ClientId;\n\nexport type ClientSecret = Newtype<string, 'ClientSecret'>;\nexport const ClientSecret = (value: string): ClientSecret =>\n value as ClientSecret;\n","import {\n arrayBufferToBase64Url,\n generateSecureRandomBase64Url,\n sha256,\n} from '@/universal/core/shared/utils/crypto';\nimport type {\n CodeChallenge as CodeChallengeType,\n CodeVerifier as CodeVerifierType,\n PKCEState as PKCEStateType,\n} from '@/universal/types/oauth';\nimport {\n type ClientId,\n CodeChallenge,\n CodeVerifier,\n PKCEState,\n type RedirectUri,\n} from '@/universal/types/oauth';\n\nexport type PKCEParams = {\n clientId: ClientId;\n responseType: 'code';\n redirectUri: RedirectUri;\n codeChallenge: CodeChallengeType;\n codeChallengeMethod: 'S256';\n state: PKCEStateType;\n codeVerifier: CodeVerifierType;\n};\n\nexport type PKCEConfig = {\n clientId: ClientId;\n redirectUri: RedirectUri;\n};\n\n/**\n * Generates PKCE parameters for an OAuth2 authorization code flow.\n * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use\n * in server-side code and Next.js middleware.\n */\nexport async function generatePKCEParams(\n config: PKCEConfig\n): Promise<PKCEParams> {\n const state = generateSecureRandomBase64Url(32);\n const codeVerifier = generateSecureRandomBase64Url(32);\n const codeChallengeRaw = await sha256(codeVerifier);\n const codeChallenge = arrayBufferToBase64Url(codeChallengeRaw, false);\n\n return {\n clientId: config.clientId,\n responseType: 'code',\n redirectUri: config.redirectUri,\n codeChallenge: CodeChallenge(codeChallenge),\n codeChallengeMethod: 'S256',\n state: PKCEState(state),\n codeVerifier: CodeVerifier(codeVerifier),\n };\n}\n","import type { Hash } from 'viem';\n\n/**\n * A classified wallet or transaction failure. The SDK derives this from\n * whatever the {@link EvmWallet} throws, so hosts get a stable, typed error\n * shape regardless of the wallet library underneath.\n *\n * Lives here rather than beside its classifier because it is the failure half\n * of the {@link EvmWallet} contract, and because both `@/universal` and\n * `@/client` name it: {@link LogCause} carries one, and classifying a thrown\n * error into one needs viem's error classes, which are browser-side.\n */\nexport type WalletError =\n | { type: 'user_rejected' }\n | { type: 'insufficient_funds' }\n | {\n type: 'contract_reverted';\n /**\n * What the contract said, when it said anything: a `require` string, a\n * panic description, a custom error's name, or the four-byte selector of\n * an error the ABI could not decode.\n *\n * `null` when a revert carried no data, since the string the RPC node\n * offers in its place is not the contract's - see `classifyWalletError`.\n * Nullable rather than optional so that every arm has to answer the\n * question: \"it reverted and said nothing\" is a fact about the revert,\n * and a caller should have to read it rather than miss it.\n *\n * Never the custom error's arguments. A name is a compile-time\n * identifier; its operands are runtime values - an address, a balance -\n * and those are `'debug'` material.\n */\n reason: string | null;\n }\n | { type: 'timeout'; hash: Hash }\n | { type: 'unknown'; cause: unknown };\n\n/**\n * A {@link WalletError} as it may be reported above `'debug'`: the\n * classification, never the throw.\n *\n * Only the `unknown` arm differs, and it differs because it is the one arm\n * carrying a value the SDK did not author - the raw error the wallet library\n * threw, whose message and metadata hold the transaction's `from`, `to`,\n * `value` and calldata. The other four carry compile-time constants or a\n * server-minted identifier already, so they pass through as they stand.\n *\n * This exists as a type rather than as a scrub some function remembers to\n * apply: `LogCause` names it, so an arm that grew a raw field would fail the\n * build instead of quietly reaching {@link Logger.error}.\n */\nexport type RedactedWalletError =\n | Exclude<WalletError, { type: 'unknown' }>\n | { type: 'unknown' };\n\n/** @internal */\nexport const RedactedWalletError = {\n fromWalletError: (error: WalletError): RedactedWalletError =>\n error.type === 'unknown' ? { type: 'unknown' } : error,\n};\n","import type {\n EthereumChain,\n EvmContractAddress,\n} from '@/universal/types/blockchain/core';\nimport type { OfferSwapContract } from '@/universal/types/offer-detail';\n\n/**\n * The CoinList contract a swap on `chain` settles through, and therefore the\n * ERC-20 spender the user approves - or `null` where this offer cannot be\n * swapped on that chain.\n *\n * Read off the offer rather than held as a constant because the address varies\n * by environment, not only by chain: beta and production both run\n * `ethereum_sepolia` and deploy a different contract on each, and one constant\n * cannot name both. Frontline resolves it per environment and serves the\n * answer on the offer.\n *\n * The array varies per *offer* as well as per chain - frontline drops a chain\n * whose funding and swap tokens do not both resolve for this asset - so an\n * array read for one symbol must not be reused for another. An empty array\n * means \"cannot swap here\", which is an answer rather than an error.\n *\n * A capability rather than a provider slice, and named for the data it reads\n * rather than for its first caller: `swap_contracts` is an offer field, and\n * `universal-core-isolation-and-sharing` would stop Superstate reusing this if\n * it lived under `checkout/ondo/`. Superstate has not migrated yet - it still\n * reads `superstateSwapContractAddress` - so Ondo is the only caller today.\n */\nexport function swapSpender(\n swapContracts: OfferSwapContract[],\n chain: EthereumChain\n): EvmContractAddress | null {\n return (\n swapContracts.find((contract) => contract.chain === chain)?.address ?? null\n );\n}\n","import {\n assertUint256,\n Bps,\n type Uint256,\n} from '@/universal/types/blockchain/core';\n\n/** Basis-point denominator: 10_000 bps = 100%. */\nexport const BPS_DENOM: Bps = Bps(10_000n);\n\n/**\n * Applies a basis-point fraction to an amount, flooring the result.\n * `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an\n * overflow (bps far above BPS_DENOM) or a negative product is rejected.\n */\nexport function applyBps(amount: Uint256, bps: Bps): Uint256 {\n return assertUint256((amount * bps) / BPS_DENOM);\n}\n","import type { SwapQuote } from '@/universal/core/providers/checkout/superstate/blockchain/quote';\nimport { applyBps, BPS_DENOM } from '@/universal/core/shared/blockchain/bps';\nimport {\n assertUint256,\n BlockchainAmount,\n Bps,\n} from '@/universal/types/blockchain/core';\n\n/**\n * Price of 1 output token in USD, assuming the input token is a $1 stablecoin.\n *\n * `raw_price = inputTokenAmount.raw × 10^outputDecimals ÷ outputTokenAmount.raw`\n *\n * The multiplication happens before the division so we never lose precision to\n * integer truncation early. This mirrors standard fixed-point practice on-chain.\n * Returned decimals match the input token decimals (always the stablecoin's 6).\n */\nexport function computePrice({\n inputTokenAmount,\n outputTokenAmount,\n}: SwapQuote): BlockchainAmount | null {\n if (outputTokenAmount.raw === 0n) return null;\n\n const scale = 10n ** BigInt(outputTokenAmount.decimals);\n const raw = assertUint256(\n (inputTokenAmount.raw * scale) / outputTokenAmount.raw\n );\n\n return BlockchainAmount({ raw, decimals: inputTokenAmount.decimals });\n}\n\n/**\n * Applies slippage to an amount, returning the minimum acceptable amount:\n * `amount × (BPS_DENOM − slippage) / BPS_DENOM`. Throws when `slippage` exceeds\n * `BPS_DENOM` (the retained fraction would be negative).\n */\nexport function computeSlip(\n amount: BlockchainAmount,\n slippage: Bps\n): BlockchainAmount {\n const retained = Bps(assertUint256(BPS_DENOM - slippage));\n const slipRaw = applyBps(amount.raw, retained);\n return BlockchainAmount({ raw: slipRaw, decimals: amount.decimals });\n}\n","import type { SwapStatus } from '@/universal/types/providers/superstate/swap';\n\n/**\n * The bit `Operable.paused` sets for the swap operation, mirroring the\n * contract's `SWAP_LEVEL` constant.\n *\n * A constant rather than a `SWAP_LEVEL()` read: it is `constant` in the\n * contract, so reading it would spend a round-trip to be told the same number\n * every time.\n */\nexport const SWAP_LEVEL = 2;\n\n/**\n * Whether the contract will actually accept a swap right now.\n *\n * Not the same question as \"is it active\". `paused` is a bitmask over\n * *operations*, so a contract can suspend something unrelated and go on\n * swapping; only the {@link SWAP_LEVEL} bit stops it. Reading `state ===\n * 'active'` instead would refuse swaps the contract is perfectly willing to\n * make.\n */\nexport function isSwapAvailable(status: SwapStatus): boolean {\n switch (status.state) {\n case 'active':\n return true;\n case 'stopped':\n return false;\n case 'paused':\n return (status.pausedLevels & SWAP_LEVEL) === 0;\n default: {\n const _exhaustive: never = status;\n return _exhaustive;\n }\n }\n}\n","import * as offersApi from '@/universal/api/frontline/offers';\nimport type { UniversalNamespaceContext } from '@/universal/core/shared/namespace-context';\nimport {\n type InternalLogger,\n internalLogger,\n} from '@/universal/core/shared/observability/internal-logger';\nimport type { Offer, OfferId } from '@/universal/types/offer';\nimport type { OfferDetail } from '@/universal/types/offer-detail';\nimport type {\n PaginatedResponse,\n PaginationParams,\n} from '@/universal/types/pagination';\n\n/**\n * Reads over CoinList's offers: the catalogue a user can browse, and the full\n * detail of a single offer.\n *\n * Every method requires an authenticated user and throws\n * {@link NotAuthenticatedError} otherwise. On the server, the same reads are\n * additionally available with an app-level token — see\n * `ServerOffersNamespace`.\n */\nexport interface OffersNamespace {\n /**\n * Fetches every offer, iterating through all pages. Prefer {@link listPage}\n * when you render a paginated list yourself.\n */\n list(): Promise<Offer[]>;\n\n /**\n * Fetches a single page of offers. Pass the previous response's\n * `startingAfter` as `after` to advance.\n */\n listPage(params: PaginationParams): Promise<PaginatedResponse<Offer>>;\n\n /**\n * Fetches the full detail of one offer, including its options. Note this\n * returns {@link OfferDetail} — a richer model than the {@link Offer}\n * summaries {@link list} returns.\n */\n get(id: OfferId): Promise<OfferDetail>;\n}\n\n/** @internal */\nexport class OffersNamespaceImpl implements OffersNamespace {\n private readonly log: InternalLogger;\n\n constructor(private readonly ctx: UniversalNamespaceContext) {\n this.log = internalLogger(ctx.logger, 'OFFERS');\n }\n\n async list(): Promise<Offer[]> {\n return this.log.wrap('list', undefined, async () => {\n await this.ctx.ensureUserAuthenticated();\n return offersApi.fetchOffers(this.ctx.api, undefined);\n });\n }\n\n async listPage(params: PaginationParams): Promise<PaginatedResponse<Offer>> {\n return this.log.wrap('listPage', params, async () => {\n await this.ctx.ensureUserAuthenticated();\n return offersApi.fetchOffersPage(this.ctx.api, params, undefined);\n });\n }\n\n async get(id: OfferId): Promise<OfferDetail> {\n return this.log.wrap('get', id, async () => {\n await this.ctx.ensureUserAuthenticated();\n return offersApi.fetchOfferDetails(this.ctx.api, id, undefined);\n });\n }\n}\n","import type {\n Chain,\n EvmContractAddress,\n} from '@/universal/types/blockchain/core';\nimport type { OfferToken } from '@/universal/types/offer';\nimport type { TokenMetadata } from '@/universal/types/token-metadata';\n\n/**\n * One `coinlist.tokens.list()` answer, indexed for the lookups a catalogue\n * makes: by the `(chain, address)` pairs `Offer.tokens` carries.\n *\n * The registry is fetched whole - a few hundred tokens across every chain in\n * one request - and then asked one question per offer. Building the index\n * once is what keeps that a map lookup per card rather than a scan of the\n * snapshot per card. The same rule frontline-web and every other host wrote\n * for themselves, kept here so that none of them has to.\n */\nexport type TokenRegistrySnapshot = {\n /** Every token the snapshot lists, in registry order. */\n readonly tokens: readonly TokenMetadata[];\n /** `chain:address` (address lowercased) to its metadata. */\n readonly byKey: ReadonlyMap<string, TokenMetadata>;\n};\n\n/**\n * A token as a lookup names it. `Chain` rather than `EthereumChain` because\n * `OfferToken.chain` is the wider type; a Solana entry simply never matches,\n * since the snapshot models EVM chains only.\n */\nexport type TokenKey = { chain: Chain; address: EvmContractAddress };\n\nexport const TokenRegistrySnapshot = {\n /** Indexes a `tokens.list()` result. `[]` is a valid, empty snapshot. */\n fromTokens: (tokens: readonly TokenMetadata[]): TokenRegistrySnapshot => ({\n tokens,\n byKey: new Map(\n tokens.map((token) => [registryKey(token.identifier), token])\n ),\n }),\n\n /**\n * The registry's entry for one token, or `null` when it lists none. The\n * registry is curated, so `null` is an ordinary answer rather than an\n * error, and callers fall back to their own display defaults.\n */\n get: (\n snapshot: TokenRegistrySnapshot,\n token: TokenKey\n ): TokenMetadata | null => snapshot.byKey.get(registryKey(token)) ?? null,\n\n /**\n * The registry's entry for the token an offer is *about*, or `null` when\n * it lists none of them.\n *\n * Resolution follows {@link offerDisplayTokens}: the token a sale\n * distributes or a swap hands over, never the funding token the user pays\n * with. An offer deployed on several chains carries one such token per\n * chain, and the first the registry knows wins - they are the same asset,\n * so any listed one answers for the offer.\n */\n forOffer: (\n snapshot: TokenRegistrySnapshot,\n offer: { tokens: readonly OfferToken[] }\n ): TokenMetadata | null => {\n for (const token of offerDisplayTokens(offer)) {\n const metadata = TokenRegistrySnapshot.get(snapshot, token);\n if (metadata !== null) {\n return metadata;\n }\n }\n return null;\n },\n};\n\n/**\n * The tokens an offer is *about*, most specific first: every `swap` or\n * `vault` entry, then every `distribution` entry. `funding` entries name what\n * an offer is paid with (USDC, USDT) and never the asset on offer, so they are\n * left out.\n *\n * `swap` and `vault` rank together - no offer type carries both - and outrank\n * `distribution` because a swap or vault product names the token it hands over\n * precisely, while a sale's distribution entry names the same token for a sale\n * product and is accepted as the fallback. The checkout's\n * per-chain lookup and the catalogue's any-chain lookup both read this\n * ordering, which is why it is stated once, here.\n */\nexport function offerDisplayTokens(offer: {\n tokens: readonly OfferToken[];\n}): OfferToken[] {\n const swaps = offer.tokens.filter(\n (token) => token.role === 'swap' || token.role === 'vault'\n );\n const distributions = offer.tokens.filter(\n (token) => token.role === 'distribution'\n );\n return [...swaps, ...distributions];\n}\n\n/**\n * The registry serves EIP-55 checksummed addresses while an offer may carry\n * any casing, so an EVM address compares case-insensitively. Every chain the\n * registry snapshot models is an EVM chain (`TokenMetadata.identifier.chain`\n * is an `EthereumChain`), so lowercasing is safe for every entry it holds.\n */\nfunction registryKey(token: TokenKey): string {\n return `${token.chain}:${token.address.toLowerCase()}`;\n}\n","import {\n AssetDecimals,\n type Erc20Asset,\n type EthereumChain,\n EvmContractAddress,\n type KnownAssetSymbol,\n StablecoinSymbol,\n} from '@/universal/types/blockchain/core';\nimport { InvariantError } from '@/universal/types/errors';\n\nexport const USDC_SYMBOL: StablecoinSymbol = StablecoinSymbol('USDC');\nexport const USDC: Erc20Asset = {\n name: 'USD Coin',\n symbol: USDC_SYMBOL,\n decimals: AssetDecimals(6),\n};\n\nexport const USDT_SYMBOL: StablecoinSymbol = StablecoinSymbol('USDT');\nexport const USDT: Erc20Asset = {\n name: 'Tether USD',\n symbol: USDT_SYMBOL,\n decimals: AssetDecimals(6),\n};\n\n/** ERC-20 contract addresses for a supported stablecoin, keyed by chain. */\ntype TokenAddresses = Record<EthereumChain, EvmContractAddress>;\n\nconst USDC_ADDRESSES: TokenAddresses = {\n ethereum_mainnet: EvmContractAddress(\n '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'\n ),\n ethereum_sepolia: EvmContractAddress(\n '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238'\n ),\n base_mainnet: EvmContractAddress(\n '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'\n ),\n base_sepolia: EvmContractAddress(\n '0x036CbD53842c5426634e7929541eC2318f3dCF7e'\n ),\n};\n\n/**\n * USDT is not deployed on every chain the SDK models: Tether publishes no\n * Base Sepolia token. The table stays total, with that one absence an\n * explicit `null`, so a new {@link EthereumChain} is still a compile error\n * here until the author decides whether USDT exists on it — the same\n * exhaustiveness the rest of the chain model relies on. A lookup then\n * answers the honest `null` rather than calling a fake address.\n */\nconst USDT_ADDRESSES: Record<EthereumChain, EvmContractAddress | null> = {\n ethereum_mainnet: EvmContractAddress(\n '0xdac17f958d2ee523a2206206994597c13d831ec7'\n ),\n ethereum_sepolia: EvmContractAddress(\n '0x7169D38820dfd117C3FA1f22a697dBA58d90BA06'\n ),\n base_mainnet: EvmContractAddress(\n '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2'\n ),\n base_sepolia: null,\n};\n\n/** Lookups for the stablecoins the SDK's swap flows support out of the box. */\nexport const TOKEN_REGISTRY = {\n erc20: (symbol: KnownAssetSymbol): Erc20Asset => {\n switch (symbol) {\n case 'USDC':\n return USDC;\n case 'USDT':\n return USDT;\n default:\n throw new InvariantError(`Unknown asset symbol: ${symbol}`);\n }\n },\n /**\n * USDC's contract on `chain`. USDC is deployed on every chain the SDK\n * models, so the table is total and the answer is never `null`.\n */\n usdcAddress: (chain: EthereumChain): EvmContractAddress =>\n USDC_ADDRESSES[chain],\n /**\n * USDT's contract on `chain`, or `null` where Tether publishes none —\n * Base Sepolia today. The honest answer, never a fake address a balance\n * read would call.\n */\n usdtAddress: (chain: EthereumChain): EvmContractAddress | null =>\n USDT_ADDRESSES[chain],\n};\n","import { apiErrorCode, type HttpError } from '@/universal/api/http';\n\n/**\n * The CoinList API's error code for an Ondo quote refused because the asset\n * cannot be traded right now: the market is closed or paused, or the asset is\n * paused or closed for the session. It arrives on a 409.\n *\n * One code for all four of Ondo's reasons, because the remedy is the same:\n * wait for the market to open. Ondo pauses for a moment at every US session\n * change (04:00 and 16:00 ET), so a poll can land on one even while\n * `getTradingStatus` reported the asset tradable a second earlier.\n *\n * @internal\n */\nexport const ONDO_NOT_TRADABLE_CODE = 'not_tradable';\n\n/**\n * Whether `error` is the CoinList API refusing an Ondo quote because the\n * market is not open, as opposed to a request that failed.\n *\n * Total: anything that is not an `HttpError` carrying\n * {@link ONDO_NOT_TRADABLE_CODE} is `false`.\n */\nexport function isOndoNotTradableError(error: unknown): error is HttpError {\n return apiErrorCode(error) === ONDO_NOT_TRADABLE_CODE;\n}\n","import { USDC_SYMBOL } from '@/universal/core/shared/blockchain/token-registry';\nimport {\n DecimalString,\n type StablecoinSymbol,\n} from '@/universal/types/blockchain/core';\nimport type { NonEmptyArray } from '@/universal/types/collections';\n\n/**\n * How often the Ondo checkout refreshes what it is allowed to poll: the market\n * status and the indicative price. Both are free - neither spends an\n * attestation - so this is paced for a price the user can trust rather than\n * for cost.\n *\n * A built transaction is deliberately not on this timer. Building spends an\n * attestation, so it happens once per order and once per refresh the user\n * asks for.\n */\nexport const ONDO_POLL_INTERVAL_MS = 15_000;\n\n/** Max time the review step offers a built quote. */\nexport const ONDO_QUOTE_MAX_TTL_MS = 15_000;\n\n/**\n * The order size the sidebar prices against before the user names one.\n *\n * Ondo prices by size, so some amount has to be sent. $1,000 is a plausible\n * order rather than a token one: a size so small that Ondo's minimum rejects\n * it would leave the panel permanently blank.\n *\n * Named distinctly from `DEFAULT_AMOUNT_TO_COMPUTE_PRICE` in the swap\n * constants, which is a raw `bigint` of USDC base units for a different\n * endpoint. Both barrels are flat, so two constants of the same name could not\n * coexist - and they mean different things anyway.\n */\nexport const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE = DecimalString('1000');\n\n/**\n * The coin an Ondo sell settles into, for display only.\n *\n * The scale of every amount on a built transaction comes off the response, so\n * this names the token and never sizes it - `receive_output_decimals` is the\n * only authority on how many decimals the proceeds are counted in, and the two\n * are allowed to disagree.\n *\n * Named apart from {@link ONDO_SUPPORTED_INPUT_ASSETS} rather than read out of\n * it, though both are USDC today. On a buy USDC is what the user funds with\n * and one of a list that may grow; on a sell it is what they settle into and\n * there is one of it. Reading `ONDO_SUPPORTED_INPUT_ASSETS[0]` here would make\n * the sell screen quietly follow whichever funding coin happened to be listed\n * first.\n */\nexport const ONDO_SETTLEMENT_ASSET: StablecoinSymbol = USDC_SYMBOL;\n\n/**\n * The order size the sidebar prices a sell against before the user names one.\n *\n * Sells are quoted by token amount rather than by notional: the fee comes out\n * of dollars, and Ondo's price is size-aware, so a buy's quantity depends on\n * the quote being asked for while a sell is sized by what the user already\n * holds. One whole share is a size Ondo will price - small enough to be\n * plausible for any asset, large enough that Ondo's minimum does not reject it\n * and leave the panel permanently blank.\n *\n * The buy counterpart is {@link DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE}, which\n * is a dollar figure for the same reason in reverse.\n */\nexport const DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;\n\n/**\n * The coins an Ondo buy can be funded with, in display order, with the first\n * preselected.\n *\n * USDC alone today: it is what the Sepolia integration contract accepts. The\n * amount step renders a single entry as a plain card and two or more as a\n * picker, so adding one here is all it takes.\n */\nexport const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol> = [\n USDC_SYMBOL,\n];\n","import { ONDO_QUOTE_MAX_TTL_MS } from '@/universal/core/providers/checkout/ondo/constants';\nimport {\n assertUint256,\n BlockchainAmount,\n MAX_UINT_256,\n type Uint256,\n} from '@/universal/types/blockchain/core';\nimport { MathError } from '@/universal/types/errors';\nimport type {\n OndoBuyTransaction,\n OndoSellOutcome,\n OndoSellTransaction,\n} from '@/universal/types/providers/ondo/ondo';\n\n/**\n * The price of one whole asset token in a built Ondo purchase, in the funding\n * token's units - USD per share.\n *\n * Neither builder publishes a price. Frontline drops Ninshubur's deliberately,\n * because `GET /v1/ondo/swap/quote` already serves one under that name at a\n * different scale, and echoing both would leave a caller to guess which was\n * which.\n *\n * Dividing the two amounts the response *does* carry is better than reading\n * the indicative one anyway: it is the price this transaction fills at, rather\n * than a poll that has since moved and was struck against a different size.\n *\n * **Fee-exclusive.** `notionalValue` is the deposit after CoinList's fee comes\n * off, so this is the price Ondo filled at, not the buyer's all-in cost per\n * token - that would be `spendInputAmount / receiveOutputAmount`, and it is\n * higher. Fee-exclusive is what the review screen wants, because it renders\n * the fee on its own line: price x quantity, plus fee, comes to the total.\n * Making this all-in would double-count the fee against that breakdown.\n *\n * The two are equal until ENG-1718 turns a fee on, which frontline rejects\n * today. They diverge the moment it does, so the choice is load-bearing rather\n * than academic.\n */\nexport function computeOndoBuyPrice(\n transaction: OndoBuyTransaction\n): BlockchainAmount {\n const { notionalValue, receiveOutputAmount } = transaction;\n return pricePerShare({\n usd: notionalValue,\n shares: receiveOutputAmount,\n });\n}\n\n/**\n * The price of one whole asset token in a built Ondo sale, in the settlement\n * token's units - USD per share, the same thing\n * {@link computeOndoBuyPrice} answers with the ratio inverted.\n *\n * **Fee-exclusive, and it takes arithmetic to be so.** `expected.quantity` is\n * published already net of `expected.fee`, so the proceeds are added back\n * before dividing: what comes out is the price Ondo filled at, which is the\n * buy arm's meaning rather than a second one. That is what lets one review row\n * render on either screen, and what keeps the sell breakdown honest - the fee\n * sits on its own line beside this, and a net price would count it twice.\n *\n * Read against {@link OndoSellTransaction.expected} alone. The `minimum` arm\n * describes the same trade at a different outcome, and pricing that one would\n * answer \"the worst price this could fill at\", which no screen asks for.\n *\n * The two readings coincide while frontline forces the fee to zero, which it\n * does today. They diverge the day ENG-1718 lands.\n */\nexport function computeOndoSellPrice(\n transaction: OndoSellTransaction\n): BlockchainAmount {\n const { expected, spendInputAmount } = transaction;\n return pricePerShare({\n usd: grossProceeds(expected),\n shares: spendInputAmount,\n });\n}\n\n/**\n * The sooner of Ondo's deadline and now + {@link ONDO_QUOTE_MAX_TTL_MS}.\n *\n * @internal\n */\nexport function ondoQuoteOfferDeadline(\n expiresAt: Date,\n nowMs: number = Date.now()\n): Date {\n return new Date(Math.min(expiresAt.getTime(), nowMs + ONDO_QUOTE_MAX_TTL_MS));\n}\n\n/**\n * What Ondo returned before CoinList took its cut: the published quantity with\n * the fee charged on it added back.\n *\n * Bounded before the addition rather than after. The two amounts are parsed\n * independently, each a uint256 in its own right, so nothing in the mapper\n * stops their sum leaving the range - and `BlockchainAmount.add` answers an\n * out-of-range sum with an `InvariantError`, which says the SDK's own\n * arithmetic went wrong. It did not: a gross that no uint256 can hold is a\n * corrupt response, the same kind of thing {@link assertPriceFits} reports, and\n * it has to say so here rather than take the checkout down mid-render.\n *\n * The addition itself is still `BlockchainAmount.add`, so the two amounts\n * disagreeing about their scale stays an `InvariantError`. That one really is\n * internal: `OndoSellTransaction.fromDto` reads both off\n * `receive_output_decimals`.\n */\nfunction grossProceeds(expected: OndoSellOutcome): BlockchainAmount {\n const raw = expected.quantity.raw + expected.fee.raw;\n if (raw > MAX_UINT_256) {\n throw new MathError(`Ondo sell proceeds: out of uint256 bounds (${raw})`);\n }\n return BlockchainAmount.add(expected.quantity, expected.fee);\n}\n\n/**\n * USD per whole share, in the USD amount's decimals.\n *\n * Both prices bottom out here so the scaling, the rounding and the bound are\n * written once: whichever side the amounts came off, a price is one dollar\n * amount divided by one asset amount.\n *\n * {@link BlockchainAmount.div} owns the arithmetic - it scales the numerator\n * by the asset's exponent so the quotient lands back in the funding token's,\n * truncates towards zero so the total a price implies never overstates what\n * was paid, and refuses a zero share quantity rather than dividing by it.\n * That last guard is unreachable through either `fromDto`, which rejects a\n * non-positive amount on both sides of the trade at the boundary - both of\n * them, because which one lands in the denominator here flips with the\n * direction. It matters because this runs during render, where a bare BigInt\n * division would take the checkout down with a RangeError instead of failing\n * one step.\n *\n * What is Ondo's rather than every amount's is the uint256 bound: `div`\n * deliberately does not check one, because scaling can carry a legal pair out\n * of range, and here that can only mean a corrupt response.\n */\nfunction pricePerShare({\n usd,\n shares,\n}: {\n usd: BlockchainAmount;\n shares: BlockchainAmount;\n}): BlockchainAmount {\n const price = BlockchainAmount.div(usd, shares);\n return BlockchainAmount({\n raw: assertPriceFits(price.raw),\n decimals: price.decimals,\n });\n}\n\n/**\n * A price past uint256 needs an output amount of a few base units against a\n * notional no real balance holds. It cannot come off the wire, so it is a\n * corrupt response rather than an expensive order.\n */\nfunction assertPriceFits(raw: bigint): Uint256 {\n try {\n return assertUint256(raw);\n } catch {\n throw new MathError(`Ondo price: out of uint256 bounds (${raw})`);\n }\n}\n","import { USDC_SYMBOL } from '@/universal/core/shared/blockchain/token-registry';\nimport {\n Bps,\n type EthereumChain,\n EvmContractAddress,\n type StablecoinSymbol,\n} from '@/universal/types/blockchain/core';\nimport type { NonEmptyArray } from '@/universal/types/collections';\n\n/**\n * Who issues the asset a Superstate swap pays out.\n *\n * A constant rather than a field off the offer: no frontline endpoint carries\n * an issuer, and every offer this checkout serves is Superstate's by\n * definition — `CheckoutContainer` routes here on `superstate::swap` alone.\n *\n * @internal\n */\nexport const SUPERSTATE_ISSUER_NAME = 'Superstate';\n\n/**\n * The coins a Superstate swap can be funded with, in display order, with the\n * first preselected.\n *\n * USDC alone today: it is what the deployed swap contract accepts. The amount\n * step renders a single entry as a plain card and two or more as a picker, so\n * adding one here is all it takes.\n *\n * @internal\n */\nexport const SUPERSTATE_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol> =\n [USDC_SYMBOL];\n\n/**\n * Poll interval for refreshing on-chain swap quotes and balances.\n *\n * @internal\n */\nexport const SWAP_POLL_INTERVAL_MS = 15_000;\n\n/**\n * Notional input used to derive a display price-per-share when the user has\n * not yet entered an amount (1 USDC at 6 decimals).\n *\n * @internal\n */\nexport const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1_000_000n;\n\n/** Slippage tolerances offered in the review step, in basis points. */\nexport const SLIPPAGE_OPTIONS_BPS: Bps[] = [25n, 50n, 100n, 200n, 500n].map(\n (n) => Bps(n)\n);\n\n/** Default slippage tolerance (0.5%). */\nexport const DEFAULT_SLIPPAGE_BPS: Bps = Bps(50n);\n\n/**\n * The deployed Superstate swap contract on Ethereum Sepolia, and therefore the\n * ERC-20 spender the user approves there.\n *\n * Exported in its own right for a partner driving `coinlist.superstate.execute`\n * at Level 1, where the contract is an explicit parameter.\n *\n * @internal\n */\nexport const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress =\n EvmContractAddress('0x27E8CE9Ca1A1E98Bc4009F08Dc596bFcf88aCED1');\n\n/**\n * The Superstate swap contract per chain.\n *\n * Mainnet is absent, not zeroed: the production address is not finalized\n * upstream, and a zero address would be approved happily and revert only later.\n * A chain with no entry has no checkout — `useSuperstateSwapCheckoutViewModel`\n * reports it as the flow-level error rather than quoting against nothing.\n */\nconst SUPERSTATE_SWAP_CONTRACT_ADDRESSES: Partial<\n Record<EthereumChain, EvmContractAddress>\n> = {\n ethereum_sepolia: SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,\n};\n\n/**\n * The Superstate swap contract on `chain`, or `null` where none is deployed.\n *\n * TODO(ENG-1734): Ondo now reads its spender off the offer's `swap_contracts`\n * via `swapSpender`, which is why that helper sits in `shared/core/offers/`\n * rather than under a provider. Superstate still resolves from this table, so\n * two mechanisms answer one question. Migrate once frontline serves\n * `swap_contracts` on Superstate offers too.\n */\nexport function superstateSwapContractAddress(\n chain: EthereumChain\n): EvmContractAddress | null {\n return SUPERSTATE_SWAP_CONTRACT_ADDRESSES[chain] ?? null;\n}\n","import { computePrice } from '@/universal/core/providers/checkout/superstate/blockchain/math';\nimport type { SwapQuote } from '@/universal/core/providers/checkout/superstate/blockchain/quote';\nimport {\n formattedUsdPrice,\n NA_AMOUNT_ASSET_UI,\n} from '@/universal/core/shared/blockchain/formatters';\nimport type { FormattedAmountAssetUi } from '@/universal/types/blockchain/ui';\n\n/**\n * Formats a quote's implied price per output token as a USD amount.\n *\n * Lives with the provider rather than in `@/universal/core/shared/blockchain/formatters`\n * because {@link SwapQuote} and {@link computePrice} are Superstate's: the\n * shared formatters stay provider-agnostic.\n */\nexport function formattedPricePerShare(\n quote: SwapQuote | null,\n locale: string\n): FormattedAmountAssetUi {\n if (!quote) return NA_AMOUNT_ASSET_UI;\n return formattedUsdPrice(computePrice(quote), locale);\n}\n","import type { EvmWalletAddress } from '@/universal/types/blockchain/core';\nimport type {\n EvmWallet,\n ExternalWalletAdapter,\n} from '@/universal/types/blockchain/evm-wallet';\n\n/**\n * The wallets a screen reads for and acts from, supplied by the host.\n *\n * The SDK ships no wallet stack, so wallet discovery and connection are\n * inverted onto the host: it hands over ready {@link EvmWallet}s, and an\n * adapter for connecting an external one when it supports that. Every wallet\n * here is one that can sign for itself, so a screen can broadcast from the\n * wallet that holds a position.\n *\n * @alpha\n */\nexport type WalletSelection = {\n /**\n * The user's embedded (custodial) wallets, in display order. Empty when\n * they have none, which is a normal state, not an error.\n */\n embedded: EvmWallet[];\n /** The connected external wallet, or `null` while none is connected. */\n external: EvmWallet | null;\n /**\n * The host's external-wallet connector, or `null` when it offers none - in\n * which case the screen shows no connect affordance at all. A host may\n * still pass a connected `external` without one, to show a wallet the user\n * cannot change from here.\n */\n externalAdapter: ExternalWalletAdapter | null;\n};\n\n/** @alpha */\nexport const WalletSelection = {\n /**\n * Every wallet in display order - embedded first, then the external one -\n * each address once. Addresses compare case-insensitively, so a host that\n * hands the same wallet over as both embedded and external sees it once.\n */\n all: (selection: WalletSelection): EvmWallet[] => {\n const seen = new Set<string>();\n return [\n ...selection.embedded,\n ...(selection.external === null ? [] : [selection.external]),\n ].filter((wallet) => {\n const key = wallet.address.toLowerCase();\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n },\n};\n\n/**\n * Names a wallet for display, e.g. `'CoinList Wallet'` for the user's\n * embedded one. `null` means it has no name, and the screen shows its\n * shortened address instead.\n *\n * @alpha\n */\nexport type WalletLabelResolver = (address: EvmWalletAddress) => string | null;\n","import {\n ETHEREUM_CHAINS,\n type EthereumChain,\n type EvmContractAddress,\n} from '@/universal/types/blockchain/core';\nimport type { OfferToken } from '@/universal/types/offer';\nimport type { CentrifugeVaultOfferDetail } from '@/universal/types/offer-detail';\nimport type { TokenMetadata } from '@/universal/types/token-metadata';\n\n/**\n * One chain a vault offer runs on, with everything a screen needs to read and\n * show a position there: the proxy every request and claim goes through, the\n * share token it issues, and the funding token it is paid in.\n *\n * The share token's `symbol` is the one amounts are labelled with. Vault\n * routes are keyed by the offer's asset code, from `centrifugeShareSymbol`.\n *\n * @alpha\n */\nexport type CentrifugeVault = {\n chain: EthereumChain;\n proxy: EvmContractAddress;\n share: TokenMetadata;\n funding: TokenMetadata;\n};\n\n/**\n * The vaults an offer runs on, or why a chain could not be resolved: one\n * entry per `vaultContracts` chain, in the offer's order.\n *\n * @alpha\n */\nexport type CentrifugeVaultResolution =\n | { type: 'resolved'; vault: CentrifugeVault }\n | {\n type: 'unresolved';\n chain: OfferToken['chain'];\n /** Which token the offer or the registry could not name. */\n missing: 'share-token' | 'funding-token' | 'evm-chain';\n };\n\n/**\n * Resolves each chain of a vault offer to its share and funding tokens.\n *\n * The offer names tokens by role and address only - the share token as\n * `vault`, the coin it is paid in as `funding` - so `lookup` turns each into\n * metadata. A function rather than a registry snapshot, so this module does\n * not depend on where the metadata comes from.\n *\n * A chain whose tokens cannot be named is reported rather than dropped: its\n * position cannot be read without the symbol, and a caller has to know it is\n * not showing it. When a chain lists several funding tokens, the first one\n * `lookup` knows wins - a vault is priced in one.\n *\n * @alpha\n */\nexport function resolveCentrifugeVaults(\n offer: CentrifugeVaultOfferDetail,\n lookup: (token: OfferToken) => TokenMetadata | null\n): CentrifugeVaultResolution[] {\n return offer.vaultContracts.map((contract) => {\n const { chain } = contract;\n if (!isEthereumChain(chain)) {\n return { type: 'unresolved', chain, missing: 'evm-chain' };\n }\n const onChain = (role: OfferToken['role']) =>\n offer.tokens.filter(\n (token) => token.role === role && token.chain === chain\n );\n const share = firstKnown(onChain('vault'), lookup);\n if (share === null) {\n return { type: 'unresolved', chain, missing: 'share-token' };\n }\n const funding = firstKnown(onChain('funding'), lookup);\n if (funding === null) {\n return { type: 'unresolved', chain, missing: 'funding-token' };\n }\n return {\n type: 'resolved',\n vault: { chain, proxy: contract.address, share, funding },\n };\n });\n}\n\nfunction firstKnown(\n tokens: OfferToken[],\n lookup: (token: OfferToken) => TokenMetadata | null\n): TokenMetadata | null {\n for (const token of tokens) {\n const metadata = lookup(token);\n if (metadata !== null) return metadata;\n }\n return null;\n}\n\nfunction isEthereumChain(chain: OfferToken['chain']): chain is EthereumChain {\n return chain in ETHEREUM_CHAINS;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,oBAAoB,CAAC,UAChC;AAGK,IAAM,eAAe,CAAC,UAC3B;AAGK,IAAM,gBAAgB,CAAC,UAC5B;AAGK,IAAM,YAAY,CAAC,UAAkB;AAGrC,IAAM,cAAc,CAAC,UAA+B;AAGpD,IAAM,WAAW,CAAC,UAA4B;AAG9C,IAAM,eAAe,CAAC,UAC3B;;;ACaF,eAAsB,mBACpB,QACqB;AACrB,QAAM,QAAQ,8BAA8B,EAAE;AAC9C,QAAM,eAAe,8BAA8B,EAAE;AACrD,QAAM,mBAAmB,MAAM,OAAO,YAAY;AAClD,QAAM,gBAAgB,uBAAuB,kBAAkB,KAAK;AAEpE,SAAO;AAAA,IACL,UAAU,OAAO;AAAA,IACjB,cAAc;AAAA,IACd,aAAa,OAAO;AAAA,IACpB,eAAe,cAAc,aAAa;AAAA,IAC1C,qBAAqB;AAAA,IACrB,OAAO,UAAU,KAAK;AAAA,IACtB,cAAc,aAAa,YAAY;AAAA,EACzC;AACF;;;ACCO,IAAM,s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