@coinlist-co/react 0.11.1-rc.8cfcd2a → 0.11.1-rc.e102bdb

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,7 +1,7 @@
1
- import { al as PaginationParams, am as PaginatedResponse, m as Bps, an as Uint256, a as EthereumChain, Q as AssetDecimals, h as AssetSymbol, B as BlockchainAmount, n as EvmWalletAddress, ao as KnownAssetSymbol, u as Erc20Asset, b as EvmContractAddress, w as StablecoinSymbol, ap as DecimalString, i as OndoSwapTransaction, aq as SwapStatus, ar as Newtype } from '../config-C6vlghJY.cjs';
2
- export { as as AllowWalletParams, at as AllowWalletResponse, au as Asset, av as AssetCode, e as AssetId, A as AuthorizationCode, aw as Blockchain, Y as BuildOndoSwapTransactionParams, ax as Chain, ai as ClientCredentialsOAuth, ay as ClientId, aj as ClientSecret, az as CodeChallenge, C as CodeVerifier, c as CoinListTokenSaleNamespace, f as CoinListTokenSaleNamespaceImpl, r as Config, aA as ConnectExternalWalletParams, aB as CreateKycTokenParams, aC as CreateParticipationParams, aD as CreateWalletOwnershipChallengeParams, aE as Cursor, a0 as DebugEvent, aF as DocumentFormType, I as DocumentSubmission, aG as DocumentSubmissionStatus, aH as DocumentType, aI as ETHEREUM_CHAINS, E as Erc20Namespace, aJ as Erc20NamespaceImpl, aK as FaqItem, a1 as FrontlineEventId, aL as GetOndoQuoteParams, aM as GetOndoTradingStatusParams, aN as GetSwapAuthorizationParams, aO as GetSwapPreviewParams, aP as GetTokenAllowanceParams, aQ as GetTokenBalanceParams, aR as HexEncodedTransactionData, a2 as HttpError, a3 as HttpResponse, aS as Iso2CountryCode, K as KycLevelName, a4 as KycToken, aT as Link, aU as ListOptionAddressesParams, a5 as LogBinding, a6 as LogBindings, a7 as LogCause, a8 as LogLevel, a9 as LogScope, aa as LogValue, L as Logger, aV as MAX_ASSET_DECIMALS, aW as MAX_UINT_256, aX as Milestone, s as OAuthAccessToken, aY as OAuthRefreshToken, ah as OAuthSession, y as Offer, v as OfferDetail, O as OfferId, aZ as OfferOption, G as OfferOptionAddress, Z as OfferOptionAddressId, d as OfferOptionId, a_ as OfferOptionSlug, a$ as OfferSlug, b0 as OfferToken, x as OfferType, t as OffersNamespace, b1 as OffersNamespaceImpl, g as OndoNamespace, j as OndoNamespaceImpl, U as OndoQuote, b2 as OndoQuoteDuration, X as OndoQuoteSize, N as OndoTradingStatus, V as OrderBookSide, b3 as PKCEState, b4 as PaginatedResponseDto, P as Participation, b5 as ParticipationId, b6 as ParticipationStatus, b7 as ParticipationsPaginationParams, b8 as Pii, b9 as PiiAddress, ba as PiiJurisdiction, bb as PiiKind, M as PinoLoggerOptions, ab as ProductionLogLevel, bc as QueryParamValue, bd as QueryParamValues, ac as RedactedWalletError, be as RedirectUri, bf as RemoveOptionAddressParams, ad as RequestId, p as Requirement, bg as RequirementActionNeededReason, H as RequirementId, z as RequirementStatusInfo, F as RequirementStatusValue, D as RequirementType, R as RequirementsNamespace, q as RequirementsNamespaceImpl, bh as SOLANA_CHAINS, bi as STABLE_DECIMALS, ae as SafeEvent, af as SafeFields, bj as SolanaChain, bk as SubmitDocumentParams, k as SuperstateSwapNamespace, o as SuperstateSwapNamespaceImpl, bl as SwapAuthorization, bm as SwapContractRef, bn as SwapPreview, bo as TermItem, bp as Ticker, bq as TokenAllowance, br as TokenBalance, $ as TokenIdentifier, bs as TokenLogo, bt as TokenLogoImage, bu as TokenLogoUrl, _ as TokenMetadata, bv as TokenRole, T as TokensNamespace, bw as TokensNamespaceImpl, bx as Tx, ag as UnredactedFields, by as WalletAddress, J as WalletChallengeType, W as WalletError, bz as WalletOwnershipChallenge, bA as WalletProtocol, l as WalletsNamespace, bB as WalletsNamespaceImpl, bC as apiErrorCode, bD as assertUint256, bE as parseUint256 } from '../config-C6vlghJY.cjs';
3
- import { T as TxExplorerUrl, F as FormattedAmountAssetUi, d as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress, N as NonEmptyArray, S as SwapQuote } from '../collections-DrJFEDHl.cjs';
4
- export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, c as EvmSigner, E as EvmWallet, P as PKCEConfig, e as PKCEParams, W as WriteContractParams, g as generatePKCEParams } from '../collections-DrJFEDHl.cjs';
1
+ import { ao as PaginationParams, ap as PaginatedResponse, p as Bps, aq as Uint256, a as EthereumChain, X as AssetDecimals, h as AssetSymbol, B as BlockchainAmount, q as EvmWalletAddress, ar as KnownAssetSymbol, y as Erc20Asset, b as EvmContractAddress, x as StablecoinSymbol, as as DecimalString, i as OndoBuyTransaction, j as OndoSellTransaction, at as SwapStatus, au as Newtype } from '../config-CMl1bR3F.cjs';
2
+ export { av as AllowWalletParams, aw as AllowWalletResponse, ax as Asset, ay as AssetCode, e as AssetId, A as AuthorizationCode, az as Blockchain, Y as BuildOndoBuyParams, Z as BuildOndoSellParams, aA as BuildOndoSwapParamsCore, aB as Chain, al as ClientCredentialsOAuth, aC as ClientId, am as ClientSecret, aD as CodeChallenge, C as CodeVerifier, c as CoinListTokenSaleNamespace, f as CoinListTokenSaleNamespaceImpl, u as Config, aE as ConnectExternalWalletParams, aF as CreateKycTokenParams, aG as CreateParticipationParams, aH as CreateWalletOwnershipChallengeParams, aI as Cursor, a3 as DebugEvent, aJ as DocumentFormType, N as DocumentSubmission, aK as DocumentSubmissionStatus, aL as DocumentType, aM as ETHEREUM_CHAINS, E as Erc20Namespace, aN as Erc20NamespaceImpl, aO as FaqItem, a4 as FrontlineEventId, aP as GetOndoQuoteParams, aQ as GetOndoTradingStatusParams, aR as GetSwapAuthorizationParams, aS as GetSwapPreviewParams, aT as GetTokenAllowanceParams, aU as GetTokenBalanceParams, aV as HexEncodedTransactionData, a5 as HttpError, a6 as HttpResponse, aW as Iso2CountryCode, M as KycLevelName, a7 as KycToken, aX as Link, aY as ListOptionAddressesParams, a8 as LogBinding, a9 as LogBindings, aa as LogCause, ab as LogLevel, ac as LogScope, ad as LogValue, L as Logger, aZ as MAX_ASSET_DECIMALS, a_ as MAX_UINT_256, a$ as Milestone, v as OAuthAccessToken, b0 as OAuthRefreshToken, ak as OAuthSession, F as Offer, z as OfferDetail, O as OfferId, b1 as OfferOption, J as OfferOptionAddress, a0 as OfferOptionAddressId, d as OfferOptionId, b2 as OfferOptionSlug, b3 as OfferSlug, b4 as OfferToken, D as OfferType, w as OffersNamespace, b5 as OffersNamespaceImpl, g as OndoNamespace, m as OndoNamespaceImpl, _ as OndoQuote, b6 as OndoQuoteDuration, $ as OndoQuoteSize, b7 as OndoSellOutcome, k as OndoSwapTransactionCore, V as OndoTradingStatus, l as OrderBookSide, b8 as PKCEState, b9 as PaginatedResponseDto, P as Participation, ba as ParticipationId, bb as ParticipationStatus, bc as ParticipationsPaginationParams, bd as Pii, be as PiiAddress, bf as PiiJurisdiction, bg as PiiKind, U as PinoLoggerOptions, ae as ProductionLogLevel, bh as QueryParamValue, bi as QueryParamValues, af as RedactedWalletError, bj as RedirectUri, bk as RemoveOptionAddressParams, ag as RequestId, s as Requirement, bl as RequirementActionNeededReason, K as RequirementId, G as RequirementStatusInfo, I as RequirementStatusValue, H as RequirementType, R as RequirementsNamespace, t as RequirementsNamespaceImpl, bm as SOLANA_CHAINS, bn as STABLE_DECIMALS, ah as SafeEvent, ai as SafeFields, bo as SolanaChain, bp as SubmitDocumentParams, n as SuperstateSwapNamespace, r as SuperstateSwapNamespaceImpl, bq as SwapAuthorization, br as SwapContractRef, bs as SwapPreview, bt as TermItem, bu as Ticker, bv as TokenAllowance, bw as TokenBalance, a2 as TokenIdentifier, bx as TokenLogo, by as TokenLogoImage, bz as TokenLogoUrl, a1 as TokenMetadata, bA as TokenRole, T as TokensNamespace, bB as TokensNamespaceImpl, bC as Tx, aj as UnredactedFields, bD as WalletAddress, Q as WalletChallengeType, W as WalletError, bE as WalletOwnershipChallenge, bF as WalletProtocol, o as WalletsNamespace, bG as WalletsNamespaceImpl, bH as apiErrorCode, bI as assertUint256, bJ as parseUint256 } from '../config-CMl1bR3F.cjs';
3
+ import { T as TxExplorerUrl, F as FormattedAmountAssetUi, d as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress, N as NonEmptyArray, S as SwapQuote } from '../collections-BBI_XydI.cjs';
4
+ export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, c as EvmSigner, E as EvmWallet, P as PKCEConfig, e as PKCEParams, W as WriteContractParams, g as generatePKCEParams } from '../collections-BBI_XydI.cjs';
5
5
  import { Hash, TransactionReceipt } from 'viem';
6
6
 
7
7
  /**
@@ -270,7 +270,17 @@ declare const USDT: Erc20Asset;
270
270
  /** Lookups for the stablecoins the SDK's swap flows support out of the box. */
271
271
  declare const TOKEN_REGISTRY: {
272
272
  erc20: (symbol: KnownAssetSymbol) => Erc20Asset;
273
- contractAddress: (symbol: KnownAssetSymbol, chain: EthereumChain) => EvmContractAddress;
273
+ /**
274
+ * USDC's contract on `chain`. USDC is deployed on every chain the SDK
275
+ * models, so the table is total and the answer is never `null`.
276
+ */
277
+ usdcAddress: (chain: EthereumChain) => EvmContractAddress;
278
+ /**
279
+ * USDT's contract on `chain`, or `null` where Tether publishes none —
280
+ * Base Sepolia today. The honest answer, never a fake address a balance
281
+ * read would call.
282
+ */
283
+ usdtAddress: (chain: EthereumChain) => EvmContractAddress | null;
274
284
  };
275
285
 
276
286
  /** The Ondo integration contract on `chain`, or `null` where none is deployed. */
@@ -308,6 +318,36 @@ declare const ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5000;
308
318
  * coexist - and they mean different things anyway.
309
319
  */
310
320
  declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
321
+ /**
322
+ * The coin an Ondo sell settles into, for display only.
323
+ *
324
+ * The scale of every amount on a built transaction comes off the response, so
325
+ * this names the token and never sizes it - `receive_output_decimals` is the
326
+ * only authority on how many decimals the proceeds are counted in, and the two
327
+ * are allowed to disagree.
328
+ *
329
+ * Named apart from {@link ONDO_SUPPORTED_INPUT_ASSETS} rather than read out of
330
+ * it, though both are USDC today. On a buy USDC is what the user funds with
331
+ * and one of a list that may grow; on a sell it is what they settle into and
332
+ * there is one of it. Reading `ONDO_SUPPORTED_INPUT_ASSETS[0]` here would make
333
+ * the sell screen quietly follow whichever funding coin happened to be listed
334
+ * first.
335
+ */
336
+ declare const ONDO_SETTLEMENT_ASSET: StablecoinSymbol;
337
+ /**
338
+ * The order size the sidebar prices a sell against before the user names one.
339
+ *
340
+ * Sells are quoted by token amount rather than by notional: the fee comes out
341
+ * of dollars, and Ondo's price is size-aware, so a buy's quantity depends on
342
+ * the quote being asked for while a sell is sized by what the user already
343
+ * holds. One whole share is a size Ondo will price - small enough to be
344
+ * plausible for any asset, large enough that Ondo's minimum does not reject it
345
+ * and leave the panel permanently blank.
346
+ *
347
+ * The buy counterpart is {@link DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE}, which
348
+ * is a dollar figure for the same reason in reverse.
349
+ */
350
+ declare const DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
311
351
  /**
312
352
  * The coins an Ondo buy can be funded with, in display order, with the first
313
353
  * preselected.
@@ -319,13 +359,13 @@ declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
319
359
  declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
320
360
 
321
361
  /**
322
- * The price of one whole asset token in an Ondo swap transaction, in the
323
- * funding token's units.
362
+ * The price of one whole asset token in a built Ondo purchase, in the funding
363
+ * token's units - USD per share.
324
364
  *
325
- * `POST /v1/ondo/swap/transaction` publishes no price. Frontline drops
326
- * Ninshubur's deliberately, because `GET /v1/ondo/swap/quote` already serves
327
- * one under that name at a different scale, and echoing both would leave a
328
- * caller to guess which was which.
365
+ * Neither builder publishes a price. Frontline drops Ninshubur's deliberately,
366
+ * because `GET /v1/ondo/swap/quote` already serves one under that name at a
367
+ * different scale, and echoing both would leave a caller to guess which was
368
+ * which.
329
369
  *
330
370
  * Dividing the two amounts the response *does* carry is better than reading
331
371
  * the indicative one anyway: it is the price this transaction fills at, rather
@@ -333,7 +373,7 @@ declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
333
373
  *
334
374
  * **Fee-exclusive.** `notionalValue` is the deposit after CoinList's fee comes
335
375
  * off, so this is the price Ondo filled at, not the buyer's all-in cost per
336
- * token - that would be `payInputAmount / receiveOutputAmount`, and it is
376
+ * token - that would be `spendInputAmount / receiveOutputAmount`, and it is
337
377
  * higher. Fee-exclusive is what the review screen wants, because it renders
338
378
  * the fee on its own line: price x quantity, plus fee, comes to the total.
339
379
  * Making this all-in would double-count the fee against that breakdown.
@@ -341,11 +381,28 @@ declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
341
381
  * The two are equal until ENG-1718 turns a fee on, which frontline rejects
342
382
  * today. They diverge the moment it does, so the choice is load-bearing rather
343
383
  * than academic.
384
+ */
385
+ declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): BlockchainAmount;
386
+ /**
387
+ * The price of one whole asset token in a built Ondo sale, in the settlement
388
+ * token's units - USD per share, the same thing
389
+ * {@link computeOndoBuyPrice} answers with the ratio inverted.
390
+ *
391
+ * **Fee-exclusive, and it takes arithmetic to be so.** `expected.quantity` is
392
+ * published already net of `expected.fee`, so the proceeds are added back
393
+ * before dividing: what comes out is the price Ondo filled at, which is the
394
+ * buy arm's meaning rather than a second one. That is what lets one review row
395
+ * render on either screen, and what keeps the sell breakdown honest - the fee
396
+ * sits on its own line beside this, and a net price would count it twice.
344
397
  *
345
- * Denominated in the *funding* token's decimals, so it pairs with
346
- * `formattedUsdPrice` and with the fee and total rendered beside it.
398
+ * Read against {@link OndoSellTransaction.expected} alone. The `minimum` arm
399
+ * describes the same trade at a different outcome, and pricing that one would
400
+ * answer "the worst price this could fill at", which no screen asks for.
401
+ *
402
+ * The two readings coincide while frontline forces the fee to zero, which it
403
+ * does today. They diverge the day ENG-1718 lands.
347
404
  */
348
- declare function computeOndoPrice(transaction: Pick<OndoSwapTransaction, 'notionalValue' | 'receiveOutputAmount'>): BlockchainAmount;
405
+ declare function computeOndoSellPrice(transaction: OndoSellTransaction): BlockchainAmount;
349
406
 
350
407
  declare const SUPERSTATE_SWAP_ABI: readonly [{
351
408
  readonly type: "function";
@@ -779,6 +836,18 @@ declare class ValidationError extends Error {
779
836
  declare class InvariantError extends Error {
780
837
  constructor(message: string);
781
838
  }
839
+ /**
840
+ * Error thrown when an arithmetic operation has no answer to give: a division
841
+ * by zero, or a result that falls outside the range its type can represent.
842
+ *
843
+ * Distinct from {@link ValidationError}, which says a value arrived malformed.
844
+ * A `MathError` says every operand was well-formed and the operation on them
845
+ * still has no result, so the two are worth catching apart: one points at the
846
+ * response, the other at the arithmetic we asked for.
847
+ */
848
+ declare class MathError extends Error {
849
+ constructor(message: string);
850
+ }
782
851
 
783
852
  type UserDto = {
784
853
  id: string;
@@ -797,4 +866,4 @@ declare const User: {
797
866
  fromDto: (dto: UserDto) => User;
798
867
  };
799
868
 
800
- export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, InvariantError, KnownAssetSymbol, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_EXPIRY_THRESHOLD_MS, ONDO_SUPPORTED_INPUT_ASSETS, OndoSwapTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, ValidationError, applyBps, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isStopped, ondoSwapContractAddress, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, txExplorerUrl, usdAmount };
869
+ export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, InvariantError, KnownAssetSymbol, MathError, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_EXPIRY_THRESHOLD_MS, ONDO_SETTLEMENT_ASSET, ONDO_SUPPORTED_INPUT_ASSETS, OndoBuyTransaction, OndoSellTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, ValidationError, applyBps, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoBuyPrice, computeOndoSellPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isStopped, ondoSwapContractAddress, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, txExplorerUrl, usdAmount };
@@ -1,7 +1,7 @@
1
- import { al as PaginationParams, am as PaginatedResponse, m as Bps, an as Uint256, a as EthereumChain, Q as AssetDecimals, h as AssetSymbol, B as BlockchainAmount, n as EvmWalletAddress, ao as KnownAssetSymbol, u as Erc20Asset, b as EvmContractAddress, w as StablecoinSymbol, ap as DecimalString, i as OndoSwapTransaction, aq as SwapStatus, ar as Newtype } from '../config-C6vlghJY.js';
2
- export { as as AllowWalletParams, at as AllowWalletResponse, au as Asset, av as AssetCode, e as AssetId, A as AuthorizationCode, aw as Blockchain, Y as BuildOndoSwapTransactionParams, ax as Chain, ai as ClientCredentialsOAuth, ay as ClientId, aj as ClientSecret, az as CodeChallenge, C as CodeVerifier, c as CoinListTokenSaleNamespace, f as CoinListTokenSaleNamespaceImpl, r as Config, aA as ConnectExternalWalletParams, aB as CreateKycTokenParams, aC as CreateParticipationParams, aD as CreateWalletOwnershipChallengeParams, aE as Cursor, a0 as DebugEvent, aF as DocumentFormType, I as DocumentSubmission, aG as DocumentSubmissionStatus, aH as DocumentType, aI as ETHEREUM_CHAINS, E as Erc20Namespace, aJ as Erc20NamespaceImpl, aK as FaqItem, a1 as FrontlineEventId, aL as GetOndoQuoteParams, aM as GetOndoTradingStatusParams, aN as GetSwapAuthorizationParams, aO as GetSwapPreviewParams, aP as GetTokenAllowanceParams, aQ as GetTokenBalanceParams, aR as HexEncodedTransactionData, a2 as HttpError, a3 as HttpResponse, aS as Iso2CountryCode, K as KycLevelName, a4 as KycToken, aT as Link, aU as ListOptionAddressesParams, a5 as LogBinding, a6 as LogBindings, a7 as LogCause, a8 as LogLevel, a9 as LogScope, aa as LogValue, L as Logger, aV as MAX_ASSET_DECIMALS, aW as MAX_UINT_256, aX as Milestone, s as OAuthAccessToken, aY as OAuthRefreshToken, ah as OAuthSession, y as Offer, v as OfferDetail, O as OfferId, aZ as OfferOption, G as OfferOptionAddress, Z as OfferOptionAddressId, d as OfferOptionId, a_ as OfferOptionSlug, a$ as OfferSlug, b0 as OfferToken, x as OfferType, t as OffersNamespace, b1 as OffersNamespaceImpl, g as OndoNamespace, j as OndoNamespaceImpl, U as OndoQuote, b2 as OndoQuoteDuration, X as OndoQuoteSize, N as OndoTradingStatus, V as OrderBookSide, b3 as PKCEState, b4 as PaginatedResponseDto, P as Participation, b5 as ParticipationId, b6 as ParticipationStatus, b7 as ParticipationsPaginationParams, b8 as Pii, b9 as PiiAddress, ba as PiiJurisdiction, bb as PiiKind, M as PinoLoggerOptions, ab as ProductionLogLevel, bc as QueryParamValue, bd as QueryParamValues, ac as RedactedWalletError, be as RedirectUri, bf as RemoveOptionAddressParams, ad as RequestId, p as Requirement, bg as RequirementActionNeededReason, H as RequirementId, z as RequirementStatusInfo, F as RequirementStatusValue, D as RequirementType, R as RequirementsNamespace, q as RequirementsNamespaceImpl, bh as SOLANA_CHAINS, bi as STABLE_DECIMALS, ae as SafeEvent, af as SafeFields, bj as SolanaChain, bk as SubmitDocumentParams, k as SuperstateSwapNamespace, o as SuperstateSwapNamespaceImpl, bl as SwapAuthorization, bm as SwapContractRef, bn as SwapPreview, bo as TermItem, bp as Ticker, bq as TokenAllowance, br as TokenBalance, $ as TokenIdentifier, bs as TokenLogo, bt as TokenLogoImage, bu as TokenLogoUrl, _ as TokenMetadata, bv as TokenRole, T as TokensNamespace, bw as TokensNamespaceImpl, bx as Tx, ag as UnredactedFields, by as WalletAddress, J as WalletChallengeType, W as WalletError, bz as WalletOwnershipChallenge, bA as WalletProtocol, l as WalletsNamespace, bB as WalletsNamespaceImpl, bC as apiErrorCode, bD as assertUint256, bE as parseUint256 } from '../config-C6vlghJY.js';
3
- import { T as TxExplorerUrl, F as FormattedAmountAssetUi, d as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress, N as NonEmptyArray, S as SwapQuote } from '../collections-pLtrj6fw.js';
4
- export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, c as EvmSigner, E as EvmWallet, P as PKCEConfig, e as PKCEParams, W as WriteContractParams, g as generatePKCEParams } from '../collections-pLtrj6fw.js';
1
+ import { ao as PaginationParams, ap as PaginatedResponse, p as Bps, aq as Uint256, a as EthereumChain, X as AssetDecimals, h as AssetSymbol, B as BlockchainAmount, q as EvmWalletAddress, ar as KnownAssetSymbol, y as Erc20Asset, b as EvmContractAddress, x as StablecoinSymbol, as as DecimalString, i as OndoBuyTransaction, j as OndoSellTransaction, at as SwapStatus, au as Newtype } from '../config-CMl1bR3F.js';
2
+ export { av as AllowWalletParams, aw as AllowWalletResponse, ax as Asset, ay as AssetCode, e as AssetId, A as AuthorizationCode, az as Blockchain, Y as BuildOndoBuyParams, Z as BuildOndoSellParams, aA as BuildOndoSwapParamsCore, aB as Chain, al as ClientCredentialsOAuth, aC as ClientId, am as ClientSecret, aD as CodeChallenge, C as CodeVerifier, c as CoinListTokenSaleNamespace, f as CoinListTokenSaleNamespaceImpl, u as Config, aE as ConnectExternalWalletParams, aF as CreateKycTokenParams, aG as CreateParticipationParams, aH as CreateWalletOwnershipChallengeParams, aI as Cursor, a3 as DebugEvent, aJ as DocumentFormType, N as DocumentSubmission, aK as DocumentSubmissionStatus, aL as DocumentType, aM as ETHEREUM_CHAINS, E as Erc20Namespace, aN as Erc20NamespaceImpl, aO as FaqItem, a4 as FrontlineEventId, aP as GetOndoQuoteParams, aQ as GetOndoTradingStatusParams, aR as GetSwapAuthorizationParams, aS as GetSwapPreviewParams, aT as GetTokenAllowanceParams, aU as GetTokenBalanceParams, aV as HexEncodedTransactionData, a5 as HttpError, a6 as HttpResponse, aW as Iso2CountryCode, M as KycLevelName, a7 as KycToken, aX as Link, aY as ListOptionAddressesParams, a8 as LogBinding, a9 as LogBindings, aa as LogCause, ab as LogLevel, ac as LogScope, ad as LogValue, L as Logger, aZ as MAX_ASSET_DECIMALS, a_ as MAX_UINT_256, a$ as Milestone, v as OAuthAccessToken, b0 as OAuthRefreshToken, ak as OAuthSession, F as Offer, z as OfferDetail, O as OfferId, b1 as OfferOption, J as OfferOptionAddress, a0 as OfferOptionAddressId, d as OfferOptionId, b2 as OfferOptionSlug, b3 as OfferSlug, b4 as OfferToken, D as OfferType, w as OffersNamespace, b5 as OffersNamespaceImpl, g as OndoNamespace, m as OndoNamespaceImpl, _ as OndoQuote, b6 as OndoQuoteDuration, $ as OndoQuoteSize, b7 as OndoSellOutcome, k as OndoSwapTransactionCore, V as OndoTradingStatus, l as OrderBookSide, b8 as PKCEState, b9 as PaginatedResponseDto, P as Participation, ba as ParticipationId, bb as ParticipationStatus, bc as ParticipationsPaginationParams, bd as Pii, be as PiiAddress, bf as PiiJurisdiction, bg as PiiKind, U as PinoLoggerOptions, ae as ProductionLogLevel, bh as QueryParamValue, bi as QueryParamValues, af as RedactedWalletError, bj as RedirectUri, bk as RemoveOptionAddressParams, ag as RequestId, s as Requirement, bl as RequirementActionNeededReason, K as RequirementId, G as RequirementStatusInfo, I as RequirementStatusValue, H as RequirementType, R as RequirementsNamespace, t as RequirementsNamespaceImpl, bm as SOLANA_CHAINS, bn as STABLE_DECIMALS, ah as SafeEvent, ai as SafeFields, bo as SolanaChain, bp as SubmitDocumentParams, n as SuperstateSwapNamespace, r as SuperstateSwapNamespaceImpl, bq as SwapAuthorization, br as SwapContractRef, bs as SwapPreview, bt as TermItem, bu as Ticker, bv as TokenAllowance, bw as TokenBalance, a2 as TokenIdentifier, bx as TokenLogo, by as TokenLogoImage, bz as TokenLogoUrl, a1 as TokenMetadata, bA as TokenRole, T as TokensNamespace, bB as TokensNamespaceImpl, bC as Tx, aj as UnredactedFields, bD as WalletAddress, Q as WalletChallengeType, W as WalletError, bE as WalletOwnershipChallenge, bF as WalletProtocol, o as WalletsNamespace, bG as WalletsNamespaceImpl, bH as apiErrorCode, bI as assertUint256, bJ as parseUint256 } from '../config-CMl1bR3F.js';
3
+ import { T as TxExplorerUrl, F as FormattedAmountAssetUi, d as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress, N as NonEmptyArray, S as SwapQuote } from '../collections-BrX9rRWc.js';
4
+ export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, c as EvmSigner, E as EvmWallet, P as PKCEConfig, e as PKCEParams, W as WriteContractParams, g as generatePKCEParams } from '../collections-BrX9rRWc.js';
5
5
  import { Hash, TransactionReceipt } from 'viem';
6
6
 
7
7
  /**
@@ -270,7 +270,17 @@ declare const USDT: Erc20Asset;
270
270
  /** Lookups for the stablecoins the SDK's swap flows support out of the box. */
271
271
  declare const TOKEN_REGISTRY: {
272
272
  erc20: (symbol: KnownAssetSymbol) => Erc20Asset;
273
- contractAddress: (symbol: KnownAssetSymbol, chain: EthereumChain) => EvmContractAddress;
273
+ /**
274
+ * USDC's contract on `chain`. USDC is deployed on every chain the SDK
275
+ * models, so the table is total and the answer is never `null`.
276
+ */
277
+ usdcAddress: (chain: EthereumChain) => EvmContractAddress;
278
+ /**
279
+ * USDT's contract on `chain`, or `null` where Tether publishes none —
280
+ * Base Sepolia today. The honest answer, never a fake address a balance
281
+ * read would call.
282
+ */
283
+ usdtAddress: (chain: EthereumChain) => EvmContractAddress | null;
274
284
  };
275
285
 
276
286
  /** The Ondo integration contract on `chain`, or `null` where none is deployed. */
@@ -308,6 +318,36 @@ declare const ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5000;
308
318
  * coexist - and they mean different things anyway.
309
319
  */
310
320
  declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
321
+ /**
322
+ * The coin an Ondo sell settles into, for display only.
323
+ *
324
+ * The scale of every amount on a built transaction comes off the response, so
325
+ * this names the token and never sizes it - `receive_output_decimals` is the
326
+ * only authority on how many decimals the proceeds are counted in, and the two
327
+ * are allowed to disagree.
328
+ *
329
+ * Named apart from {@link ONDO_SUPPORTED_INPUT_ASSETS} rather than read out of
330
+ * it, though both are USDC today. On a buy USDC is what the user funds with
331
+ * and one of a list that may grow; on a sell it is what they settle into and
332
+ * there is one of it. Reading `ONDO_SUPPORTED_INPUT_ASSETS[0]` here would make
333
+ * the sell screen quietly follow whichever funding coin happened to be listed
334
+ * first.
335
+ */
336
+ declare const ONDO_SETTLEMENT_ASSET: StablecoinSymbol;
337
+ /**
338
+ * The order size the sidebar prices a sell against before the user names one.
339
+ *
340
+ * Sells are quoted by token amount rather than by notional: the fee comes out
341
+ * of dollars, and Ondo's price is size-aware, so a buy's quantity depends on
342
+ * the quote being asked for while a sell is sized by what the user already
343
+ * holds. One whole share is a size Ondo will price - small enough to be
344
+ * plausible for any asset, large enough that Ondo's minimum does not reject it
345
+ * and leave the panel permanently blank.
346
+ *
347
+ * The buy counterpart is {@link DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE}, which
348
+ * is a dollar figure for the same reason in reverse.
349
+ */
350
+ declare const DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
311
351
  /**
312
352
  * The coins an Ondo buy can be funded with, in display order, with the first
313
353
  * preselected.
@@ -319,13 +359,13 @@ declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
319
359
  declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
320
360
 
321
361
  /**
322
- * The price of one whole asset token in an Ondo swap transaction, in the
323
- * funding token's units.
362
+ * The price of one whole asset token in a built Ondo purchase, in the funding
363
+ * token's units - USD per share.
324
364
  *
325
- * `POST /v1/ondo/swap/transaction` publishes no price. Frontline drops
326
- * Ninshubur's deliberately, because `GET /v1/ondo/swap/quote` already serves
327
- * one under that name at a different scale, and echoing both would leave a
328
- * caller to guess which was which.
365
+ * Neither builder publishes a price. Frontline drops Ninshubur's deliberately,
366
+ * because `GET /v1/ondo/swap/quote` already serves one under that name at a
367
+ * different scale, and echoing both would leave a caller to guess which was
368
+ * which.
329
369
  *
330
370
  * Dividing the two amounts the response *does* carry is better than reading
331
371
  * the indicative one anyway: it is the price this transaction fills at, rather
@@ -333,7 +373,7 @@ declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
333
373
  *
334
374
  * **Fee-exclusive.** `notionalValue` is the deposit after CoinList's fee comes
335
375
  * off, so this is the price Ondo filled at, not the buyer's all-in cost per
336
- * token - that would be `payInputAmount / receiveOutputAmount`, and it is
376
+ * token - that would be `spendInputAmount / receiveOutputAmount`, and it is
337
377
  * higher. Fee-exclusive is what the review screen wants, because it renders
338
378
  * the fee on its own line: price x quantity, plus fee, comes to the total.
339
379
  * Making this all-in would double-count the fee against that breakdown.
@@ -341,11 +381,28 @@ declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
341
381
  * The two are equal until ENG-1718 turns a fee on, which frontline rejects
342
382
  * today. They diverge the moment it does, so the choice is load-bearing rather
343
383
  * than academic.
384
+ */
385
+ declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): BlockchainAmount;
386
+ /**
387
+ * The price of one whole asset token in a built Ondo sale, in the settlement
388
+ * token's units - USD per share, the same thing
389
+ * {@link computeOndoBuyPrice} answers with the ratio inverted.
390
+ *
391
+ * **Fee-exclusive, and it takes arithmetic to be so.** `expected.quantity` is
392
+ * published already net of `expected.fee`, so the proceeds are added back
393
+ * before dividing: what comes out is the price Ondo filled at, which is the
394
+ * buy arm's meaning rather than a second one. That is what lets one review row
395
+ * render on either screen, and what keeps the sell breakdown honest - the fee
396
+ * sits on its own line beside this, and a net price would count it twice.
344
397
  *
345
- * Denominated in the *funding* token's decimals, so it pairs with
346
- * `formattedUsdPrice` and with the fee and total rendered beside it.
398
+ * Read against {@link OndoSellTransaction.expected} alone. The `minimum` arm
399
+ * describes the same trade at a different outcome, and pricing that one would
400
+ * answer "the worst price this could fill at", which no screen asks for.
401
+ *
402
+ * The two readings coincide while frontline forces the fee to zero, which it
403
+ * does today. They diverge the day ENG-1718 lands.
347
404
  */
348
- declare function computeOndoPrice(transaction: Pick<OndoSwapTransaction, 'notionalValue' | 'receiveOutputAmount'>): BlockchainAmount;
405
+ declare function computeOndoSellPrice(transaction: OndoSellTransaction): BlockchainAmount;
349
406
 
350
407
  declare const SUPERSTATE_SWAP_ABI: readonly [{
351
408
  readonly type: "function";
@@ -779,6 +836,18 @@ declare class ValidationError extends Error {
779
836
  declare class InvariantError extends Error {
780
837
  constructor(message: string);
781
838
  }
839
+ /**
840
+ * Error thrown when an arithmetic operation has no answer to give: a division
841
+ * by zero, or a result that falls outside the range its type can represent.
842
+ *
843
+ * Distinct from {@link ValidationError}, which says a value arrived malformed.
844
+ * A `MathError` says every operand was well-formed and the operation on them
845
+ * still has no result, so the two are worth catching apart: one points at the
846
+ * response, the other at the arithmetic we asked for.
847
+ */
848
+ declare class MathError extends Error {
849
+ constructor(message: string);
850
+ }
782
851
 
783
852
  type UserDto = {
784
853
  id: string;
@@ -797,4 +866,4 @@ declare const User: {
797
866
  fromDto: (dto: UserDto) => User;
798
867
  };
799
868
 
800
- export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, InvariantError, KnownAssetSymbol, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_EXPIRY_THRESHOLD_MS, ONDO_SUPPORTED_INPUT_ASSETS, OndoSwapTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, ValidationError, applyBps, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isStopped, ondoSwapContractAddress, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, txExplorerUrl, usdAmount };
869
+ export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, InvariantError, KnownAssetSymbol, MathError, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_EXPIRY_THRESHOLD_MS, ONDO_SETTLEMENT_ASSET, ONDO_SUPPORTED_INPUT_ASSETS, OndoBuyTransaction, OndoSellTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, ValidationError, applyBps, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoBuyPrice, computeOndoSellPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isStopped, ondoSwapContractAddress, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, txExplorerUrl, usdAmount };
@@ -7,10 +7,12 @@ import {
7
7
  CodeVerifier,
8
8
  DEFAULT_AMOUNT_TO_COMPUTE_PRICE,
9
9
  DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE,
10
+ DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE,
10
11
  DEFAULT_SLIPPAGE_BPS,
11
12
  ERC20_ABI,
12
13
  ONDO_POLL_INTERVAL_MS,
13
14
  ONDO_QUOTE_EXPIRY_THRESHOLD_MS,
15
+ ONDO_SETTLEMENT_ASSET,
14
16
  ONDO_SUPPORTED_INPUT_ASSETS,
15
17
  OffersNamespaceImpl,
16
18
  PKCEState,
@@ -32,7 +34,8 @@ import {
32
34
  UserEmail,
33
35
  UserId,
34
36
  applyBps,
35
- computeOndoPrice,
37
+ computeOndoBuyPrice,
38
+ computeOndoSellPrice,
36
39
  computePrice,
37
40
  computeSlip,
38
41
  decodeSwappedOutputAmount,
@@ -41,7 +44,7 @@ import {
41
44
  isStopped,
42
45
  ondoSwapContractAddress,
43
46
  superstateSwapContractAddress
44
- } from "../chunk-5KYO7OOX.js";
47
+ } from "../chunk-LSPZETDH.js";
45
48
  import {
46
49
  AllowWalletResponse,
47
50
  Asset,
@@ -80,6 +83,7 @@ import {
80
83
  Link,
81
84
  MAX_ASSET_DECIMALS,
82
85
  MAX_UINT_256,
86
+ MathError,
83
87
  Milestone,
84
88
  NA_AMOUNT_ASSET_UI,
85
89
  NotAuthenticatedError,
@@ -96,9 +100,10 @@ import {
96
100
  OfferOptionSlug,
97
101
  OfferSlug,
98
102
  OfferToken,
103
+ OndoBuyTransaction,
99
104
  OndoNamespaceImpl,
100
105
  OndoQuote,
101
- OndoSwapTransaction,
106
+ OndoSellTransaction,
102
107
  OndoTradingStatus,
103
108
  PaginatedResponse,
104
109
  PaginationParams,
@@ -152,7 +157,7 @@ import {
152
157
  shortenAddress,
153
158
  txExplorerUrl,
154
159
  usdAmount
155
- } from "../chunk-ZVB6KWZ2.js";
160
+ } from "../chunk-7CTH4KPU.js";
156
161
  export {
157
162
  AllowWalletResponse,
158
163
  Asset,
@@ -179,6 +184,7 @@ export {
179
184
  Cursor,
180
185
  DEFAULT_AMOUNT_TO_COMPUTE_PRICE,
181
186
  DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE,
187
+ DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE,
182
188
  DEFAULT_SLIPPAGE_BPS,
183
189
  DecimalString,
184
190
  DocumentSubmission,
@@ -201,6 +207,7 @@ export {
201
207
  Link,
202
208
  MAX_ASSET_DECIMALS,
203
209
  MAX_UINT_256,
210
+ MathError,
204
211
  Milestone,
205
212
  NA_AMOUNT_ASSET_UI,
206
213
  NotAuthenticatedError,
@@ -209,6 +216,7 @@ export {
209
216
  OAuthSession,
210
217
  ONDO_POLL_INTERVAL_MS,
211
218
  ONDO_QUOTE_EXPIRY_THRESHOLD_MS,
219
+ ONDO_SETTLEMENT_ASSET,
212
220
  ONDO_SUPPORTED_INPUT_ASSETS,
213
221
  Offer,
214
222
  OfferDetail,
@@ -221,9 +229,10 @@ export {
221
229
  OfferSlug,
222
230
  OfferToken,
223
231
  OffersNamespaceImpl,
232
+ OndoBuyTransaction,
224
233
  OndoNamespaceImpl,
225
234
  OndoQuote,
226
- OndoSwapTransaction,
235
+ OndoSellTransaction,
227
236
  OndoTradingStatus,
228
237
  PKCEState,
229
238
  PaginatedResponse,
@@ -283,7 +292,8 @@ export {
283
292
  assetAmount,
284
293
  blockchainAmountFromRawOrThrow,
285
294
  chainFromId,
286
- computeOndoPrice,
295
+ computeOndoBuyPrice,
296
+ computeOndoSellPrice,
287
297
  computePrice,
288
298
  computeSlip,
289
299
  decodeSwappedOutputAmount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinlist-co/react",
3
- "version": "0.11.1-rc.8cfcd2a",
3
+ "version": "0.11.1-rc.e102bdb",
4
4
  "description": "CoinList Partner SDK",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/shared/types/oauth.ts","../src/shared/core/auth/pkce.ts","../src/shared/core/blockchain/bps.ts","../src/shared/core/blockchain/erc20/abi.ts","../src/shared/core/blockchain/token-registry.ts","../src/shared/core/checkout/ondo/constants.ts","../src/shared/core/checkout/ondo/math.ts","../src/shared/core/checkout/superstate/blockchain/abi.ts","../src/shared/core/checkout/superstate/blockchain/math.ts","../src/shared/core/checkout/superstate/blockchain/quote.ts","../src/shared/core/checkout/superstate/blockchain/status.ts","../src/shared/core/checkout/superstate/blockchain/swapped-event.ts","../src/shared/core/checkout/superstate/constants.ts","../src/shared/core/checkout/superstate/formatters.ts","../src/shared/core/offers/offers-namespace.ts","../src/shared/types/blockchain/wallet-error.ts","../src/shared/types/user.ts"],"sourcesContent":["import type { Newtype } from '@/shared/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 '@/shared/core/utils/crypto';\nimport type {\n CodeChallenge as CodeChallengeType,\n CodeVerifier as CodeVerifierType,\n PKCEState as PKCEStateType,\n} from '@/shared/types/oauth';\nimport {\n type ClientId,\n CodeChallenge,\n CodeVerifier,\n PKCEState,\n type RedirectUri,\n} from '@/shared/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 {\n assertUint256,\n Bps,\n type Uint256,\n} from '@/shared/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","/**\n * Minimal ERC-20 ABI the SDK writes against (mirrors viem's `erc20Abi`). The\n * swap flow uses `approve`; `allowance`/`balanceOf`/`decimals`/`symbol`/`name`\n * are included so reads share a single SDK-owned ABI.\n */\nexport const ERC20_ABI = [\n {\n type: 'function',\n name: 'allowance',\n inputs: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n ],\n outputs: [{ name: '', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'approve',\n inputs: [\n { name: 'spender', type: 'address' },\n { name: 'amount', type: 'uint256' },\n ],\n outputs: [{ name: '', type: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'balanceOf',\n inputs: [{ name: 'account', type: 'address' }],\n outputs: [{ name: '', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'decimals',\n inputs: [],\n outputs: [{ name: '', type: 'uint8' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'name',\n inputs: [],\n outputs: [{ name: '', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'symbol',\n inputs: [],\n outputs: [{ name: '', type: 'string' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'totalSupply',\n inputs: [],\n outputs: [{ name: '', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'transfer',\n inputs: [\n { name: 'recipient', type: 'address' },\n { name: 'amount', type: 'uint256' },\n ],\n outputs: [{ name: '', type: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'transferFrom',\n inputs: [\n { name: 'sender', type: 'address' },\n { name: 'recipient', type: 'address' },\n { name: 'amount', type: 'uint256' },\n ],\n outputs: [{ name: '', type: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n name: 'Approval',\n inputs: [\n { name: 'owner', type: 'address', indexed: true },\n { name: 'spender', type: 'address', indexed: true },\n { name: 'value', type: 'uint256', indexed: false },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'Transfer',\n inputs: [\n { name: 'from', type: 'address', indexed: true },\n { name: 'to', type: 'address', indexed: true },\n { name: 'value', type: 'uint256', indexed: false },\n ],\n anonymous: false,\n },\n] as const;\n","import {\n AssetDecimals,\n type Erc20Asset,\n type EthereumChain,\n EvmContractAddress,\n type KnownAssetSymbol,\n StablecoinSymbol,\n} from '@/shared/types/blockchain/core';\nimport { InvariantError } from '@/shared/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};\n\nconst USDT_ADDRESSES: TokenAddresses = {\n ethereum_mainnet: EvmContractAddress(\n '0xdac17f958d2ee523a2206206994597c13d831ec7'\n ),\n ethereum_sepolia: EvmContractAddress(\n '0x7169D38820dfd117C3FA1f22a697dBA58d90BA06'\n ),\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 contractAddress: (\n symbol: KnownAssetSymbol,\n chain: EthereumChain\n ): EvmContractAddress => {\n switch (symbol) {\n case 'USDC':\n return USDC_ADDRESSES[chain];\n case 'USDT':\n return USDT_ADDRESSES[chain];\n default:\n throw new InvariantError(`Unknown asset symbol: ${symbol}`);\n }\n },\n};\n","import { USDC_SYMBOL } from '@/shared/core/blockchain/token-registry';\nimport {\n DecimalString,\n type EthereumChain,\n EvmContractAddress,\n type StablecoinSymbol,\n} from '@/shared/types/blockchain/core';\nimport type { NonEmptyArray } from '@/shared/types/collections';\n\n/**\n * The CoinList integration contract an Ondo swap is sent to, and therefore the\n * ERC-20 spender the user approves.\n *\n * It is a constant rather than a value read off the built transaction because\n * the approval has to happen *before* the transaction is built: the calldata\n * is only good for a minute, and an approval takes most of one to mine. The\n * built transaction's `tx.to` is checked against this before broadcasting, so a\n * stale constant fails loudly instead of sending a transaction that reverts on\n * `transferFrom`.\n *\n * Mainnet is absent, not zeroed: Ondo's production integration contract is not\n * deployed yet, and a zero address would be approved happily and revert only\n * later. Flows return `unsupported-chain` for a chain with no entry.\n *\n * The Sepolia entry is production's deployment. Beta has its own, so an SDK\n * pointed at beta fails `spender-mismatch` until ENG-1734 serves the address\n * off the offer.\n */\nconst ONDO_SWAP_CONTRACT_ADDRESSES: Partial<\n Record<EthereumChain, EvmContractAddress>\n> = {\n ethereum_sepolia: EvmContractAddress(\n '0x7014019ed51Edab984a71D30F2707D2dB2316A7A'\n ),\n};\n\n/** The Ondo integration contract on `chain`, or `null` where none is deployed. */\nexport function ondoSwapContractAddress(\n chain: EthereumChain\n): EvmContractAddress | null {\n return ONDO_SWAP_CONTRACT_ADDRESSES[chain] ?? null;\n}\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/**\n * How close to its deadline a built transaction stops being offerable.\n *\n * Placing an order is not instant - the wallet has to prompt, the user has to\n * confirm, and the transaction has to reach a node - so calldata with a second\n * left is one the contract will reject. Treating the last few seconds as\n * already expired turns a paid-for revert into a refresh button.\n */\nexport const ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5_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 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 {\n assertUint256,\n BlockchainAmount,\n type Uint256,\n} from '@/shared/types/blockchain/core';\nimport { ValidationError } from '@/shared/types/errors';\nimport type { OndoSwapTransaction } from '@/shared/types/providers/ondo/ondo';\n\n/**\n * The price of one whole asset token in an Ondo swap transaction, in the\n * funding token's units.\n *\n * `POST /v1/ondo/swap/transaction` publishes no price. Frontline drops\n * Ninshubur's deliberately, because `GET /v1/ondo/swap/quote` already serves\n * one under that name at a different scale, and echoing both would leave a\n * caller to guess which was 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 `payInputAmount / 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 *\n * Denominated in the *funding* token's decimals, so it pairs with\n * `formattedUsdPrice` and with the fee and total rendered beside it.\n */\nexport function computeOndoPrice(\n transaction: Pick<\n OndoSwapTransaction,\n 'notionalValue' | 'receiveOutputAmount'\n >\n): BlockchainAmount {\n const { notionalValue, receiveOutputAmount } = transaction;\n\n // Unreachable through `OndoSwapTransaction.fromDto`, which rejects a\n // non-positive output at the boundary - frontline refuses to emit one. The\n // guard is here because this runs during render, where a RangeError from a\n // bare BigInt division would take the checkout down instead of a step.\n if (receiveOutputAmount.raw <= 0n) {\n throw new ValidationError(\n 'Ondo price: receiveOutputAmount must be greater than zero'\n );\n }\n\n // Scale the numerator by the asset's exponent so the quotient lands back in\n // the funding token's, which is the scale every other amount on the review\n // screen is in. Floor division: a price is truncated towards zero rather\n // than rounded, so the total it implies never overstates what was paid.\n const scaled =\n notionalValue.raw * 10n ** BigInt(receiveOutputAmount.decimals);\n const raw = scaled / receiveOutputAmount.raw;\n\n return BlockchainAmount({\n raw: assertPriceFits(raw),\n decimals: notionalValue.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 ValidationError(`Ondo price: out of uint256 bounds (${raw})`);\n }\n}\n","export const SUPERSTATE_SWAP_ABI = [\n {\n type: 'function',\n name: 'authorized',\n inputs: [{ name: 'user', type: 'address', internalType: 'address' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'stopped',\n inputs: [],\n outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'SWAP_LEVEL',\n inputs: [],\n outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'preview',\n inputs: [\n { name: 'token', type: 'address', internalType: 'address' },\n { name: 'amount', type: 'uint256', internalType: 'uint256' },\n ],\n outputs: [\n {\n name: '',\n type: 'tuple',\n internalType: 'struct Preview',\n components: [\n { name: 'input', type: 'uint256', internalType: 'uint256' },\n { name: 'fee', type: 'uint256', internalType: 'uint256' },\n { name: 'output', type: 'uint256', internalType: 'uint256' },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'swap',\n inputs: [\n { name: 'token', type: 'address', internalType: 'address' },\n { name: 'amount', type: 'uint256', internalType: 'uint256' },\n { name: 'slip', type: 'uint256', internalType: 'uint256' },\n ],\n outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'tokenBalance',\n inputs: [{ name: 'token', type: 'address', internalType: 'address' }],\n outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'outputToken',\n inputs: [],\n outputs: [{ name: '', type: 'address', internalType: 'address' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'outputTokenBalance',\n inputs: [],\n outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'totals',\n inputs: [{ name: 'token', type: 'address', internalType: 'address' }],\n outputs: [\n {\n name: '',\n type: 'tuple',\n internalType: 'struct SwapTotal',\n components: [\n { name: 'inputSum', type: 'uint256', internalType: 'uint256' },\n { name: 'feeSum', type: 'uint256', internalType: 'uint256' },\n { name: 'outputSum', type: 'uint256', internalType: 'uint256' },\n { name: 'count', type: 'uint256', internalType: 'uint256' },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'totals',\n inputs: [\n { name: 'user', type: 'address', internalType: 'address' },\n { name: 'token', type: 'address', internalType: 'address' },\n ],\n outputs: [\n {\n name: '',\n type: 'tuple',\n internalType: 'struct SwapTotal',\n components: [\n { name: 'inputSum', type: 'uint256', internalType: 'uint256' },\n { name: 'feeSum', type: 'uint256', internalType: 'uint256' },\n { name: 'outputSum', type: 'uint256', internalType: 'uint256' },\n { name: 'count', type: 'uint256', internalType: 'uint256' },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'transfer',\n inputs: [\n { name: 'to', type: 'address', internalType: 'address' },\n { name: 'amount', type: 'uint256', internalType: 'uint256' },\n ],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'transfer',\n inputs: [\n { name: 'to', type: 'address', internalType: 'address' },\n { name: 'token', type: 'address', internalType: 'address' },\n { name: 'amount', type: 'uint256', internalType: 'uint256' },\n ],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'setBps',\n inputs: [{ name: 'points', type: 'uint256', internalType: 'uint256' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n name: 'Swapped',\n inputs: [\n { name: 'user', type: 'address', indexed: true, internalType: 'address' },\n {\n name: 'inputToken',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'outputToken',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'inputAmount',\n type: 'uint256',\n indexed: false,\n internalType: 'uint256',\n },\n {\n name: 'outputAmount',\n type: 'uint256',\n indexed: false,\n internalType: 'uint256',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'Transferred',\n inputs: [\n { name: 'to', type: 'address', indexed: true, internalType: 'address' },\n {\n name: 'token',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n indexed: false,\n internalType: 'uint256',\n },\n ],\n anonymous: false,\n },\n {\n type: 'error',\n name: 'InvalidAddress',\n inputs: [],\n },\n {\n type: 'error',\n name: 'InsufficientAmount',\n inputs: [],\n },\n {\n type: 'error',\n name: 'InvalidAmount',\n inputs: [],\n },\n {\n type: 'error',\n name: 'SwapFailed',\n inputs: [\n { name: 'user', type: 'address', internalType: 'address' },\n { name: 'token', type: 'address', internalType: 'address' },\n ],\n },\n] as const;\n","import { applyBps, BPS_DENOM } from '@/shared/core/blockchain/bps';\nimport type { SwapQuote } from '@/shared/core/checkout/superstate/blockchain/quote';\nimport {\n assertUint256,\n BlockchainAmount,\n Bps,\n} from '@/shared/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 {\n type AssetDecimals,\n BlockchainAmount,\n} from '@/shared/types/blockchain/core';\nimport type { SwapPreview } from '@/shared/types/providers/superstate/swap';\n\n/**\n * A read-only quote for a swap as domain amounts: how much goes in, the\n * protocol fee, and how much would come out. Derived from the raw\n * {@link SwapPreview} the swap contract returns.\n */\nexport type SwapQuote = {\n inputTokenAmount: BlockchainAmount;\n fee: BlockchainAmount;\n outputTokenAmount: BlockchainAmount;\n};\n\nexport const SwapQuote = {\n /**\n * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The\n * input and fee are denominated in the input token; the output in the output\n * token.\n */\n fromPreview: (\n preview: SwapPreview,\n inputDecimals: AssetDecimals,\n outputDecimals: AssetDecimals\n ): SwapQuote => ({\n inputTokenAmount: BlockchainAmount({\n raw: preview.inputAmount,\n decimals: inputDecimals,\n }),\n fee: BlockchainAmount({ raw: preview.fee, decimals: inputDecimals }),\n outputTokenAmount: BlockchainAmount({\n raw: preview.outputAmount,\n decimals: outputDecimals,\n }),\n }),\n};\n","import type { SwapStatus } from '@/shared/types/providers/superstate/swap';\n\n/**\n * Interprets the on-chain swap availability read from `stopped()` and\n * `SWAP_LEVEL()`.\n *\n * The contract tracks paused operations as a bitmask in `stopped`. The swap is\n * stopped when the SWAP_LEVEL flag is set:\n *\n * (stopped & SWAP_LEVEL) != 0 -> stopped (not active)\n */\nexport function isStopped(status: SwapStatus): boolean {\n return (status.stopped & status.swapLevel) !== 0n;\n}\n","import { parseEventLogs, type TransactionReceipt } from 'viem';\nimport { SUPERSTATE_SWAP_ABI } from '@/shared/core/checkout/superstate/blockchain/abi';\nimport {\n type AssetDecimals,\n BlockchainAmount,\n MAX_UINT_256,\n} from '@/shared/types/blockchain/core';\n\n/**\n * Decodes the confirmed output amount from the `Swapped` event in a swap\n * transaction receipt.\n *\n * Returns `null` when the event is absent or the amount is not a valid uint256\n * so callers can fall back to the quote's expected output — the swap already\n * confirmed on-chain, so a missing/undecodable event should not fail the flow.\n */\nexport function decodeSwappedOutputAmount(\n receipt: TransactionReceipt,\n outputDecimals: AssetDecimals\n): BlockchainAmount | null {\n try {\n const [swapped] = parseEventLogs({\n abi: SUPERSTATE_SWAP_ABI,\n eventName: 'Swapped',\n logs: receipt.logs,\n });\n if (!swapped) return null;\n\n const raw = swapped.args.outputAmount;\n if (raw < 0n || raw > MAX_UINT_256) return null;\n return BlockchainAmount({ raw, decimals: outputDecimals });\n } catch {\n // Undecodable log (ABI mismatch / malformed) — fall back to the\n // quote. The swap already confirmed on-chain, so never fail here.\n return null;\n }\n}\n","import { USDC_SYMBOL } from '@/shared/core/blockchain/token-registry';\nimport {\n Bps,\n type EthereumChain,\n EvmContractAddress,\n type StablecoinSymbol,\n} from '@/shared/types/blockchain/core';\nimport type { NonEmptyArray } from '@/shared/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 */\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 */\nexport const SUPERSTATE_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol> =\n [USDC_SYMBOL];\n\n/** Poll interval for refreshing on-chain swap quotes and balances. */\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 */\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 Superstate swap contract on Ethereum Sepolia, and therefore the ERC-20\n * 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 */\nexport const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress =\n EvmContractAddress('0x84f8e9a6C9Cc12fe911259372EfCa5582C4ae557');\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/** The Superstate swap contract on `chain`, or `null` where none is deployed. */\nexport function superstateSwapContractAddress(\n chain: EthereumChain\n): EvmContractAddress | null {\n return SUPERSTATE_SWAP_CONTRACT_ADDRESSES[chain] ?? null;\n}\n","import {\n formattedUsdPrice,\n NA_AMOUNT_ASSET_UI,\n} from '@/shared/core/blockchain/formatters';\nimport { computePrice } from '@/shared/core/checkout/superstate/blockchain/math';\nimport type { SwapQuote } from '@/shared/core/checkout/superstate/blockchain/quote';\nimport type { FormattedAmountAssetUi } from '@/shared/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 `@/shared/core/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 * as offersApi from '@/shared/api/frontline/offers';\nimport type { SharedNamespaceContext } from '@/shared/core/namespace-context';\nimport {\n type InternalLogger,\n internalLogger,\n} from '@/shared/core/observability/internal-logger';\nimport type { Offer, OfferId } from '@/shared/types/offer';\nimport type { OfferDetail } from '@/shared/types/offer-detail';\nimport type {\n PaginatedResponse,\n PaginationParams,\n} from '@/shared/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\nexport class OffersNamespaceImpl implements OffersNamespace {\n private readonly log: InternalLogger;\n\n constructor(private readonly ctx: SharedNamespaceContext) {\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 { 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 `@/shared` 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\nexport const RedactedWalletError = {\n fromWalletError: (error: WalletError): RedactedWalletError =>\n error.type === 'unknown' ? { type: 'unknown' } : error,\n};\n","import type { UserDto } from '@/shared/types/dto/user';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type UserId = Newtype<string, 'UserId'>;\nexport const UserId = (value: string) => value as UserId;\nexport type UserEmail = Newtype<string, 'UserEmail'>;\nexport const UserEmail = (value: string) => value as UserEmail;\n\nexport type User = {\n id: UserId;\n email: UserEmail;\n};\n\nexport const User = {\n fromDto: (dto: UserDto): User => ({\n id: UserId(dto.id),\n email: UserEmail(dto.email),\n }),\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;;;AChDO,IAAM,YAAiB,IAAI,MAAO;AAOlC,SAAS,SAAS,QAAiB,KAAmB;AAC3D,SAAO,cAAe,SAAS,MAAO,SAA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