@coinlist-co/react 0.12.2-rc.8a0d02a → 0.12.2-rc.99b1bd5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-IZJ4JSSC.js → chunk-IQAJ3L25.js} +173 -253
  3. package/dist/chunk-IQAJ3L25.js.map +1 -0
  4. package/dist/{chunk-3WW5FLT7.js → chunk-J45AY2FX.js} +10 -10
  5. package/dist/chunk-J45AY2FX.js.map +1 -0
  6. package/dist/{chunk-C6GF7MDF.js → chunk-M2TURNJH.js} +876 -800
  7. package/dist/chunk-M2TURNJH.js.map +1 -0
  8. package/dist/chunk-MJ6YXZWH.js +22 -0
  9. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  10. package/dist/client/index.d.ts +2836 -5619
  11. package/dist/client/index.js +7157 -8250
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.d.ts +2 -32
  14. package/dist/server/index.js +6 -4
  15. package/dist/server/index.js.map +1 -1
  16. package/dist/{time-CVZpAkGY.d.cts → time-DkU7jivQ.d.ts} +1907 -3185
  17. package/dist/{token-registry-snapshot-BkwA8KmD.d.ts → token-registry-snapshot-D0OWXMe4.d.ts} +22 -58
  18. package/dist/universal/index.d.ts +81 -1067
  19. package/dist/universal/index.js +22 -46
  20. package/package.json +18 -14
  21. package/dist/chunk-3WW5FLT7.js.map +0 -1
  22. package/dist/chunk-C6GF7MDF.js.map +0 -1
  23. package/dist/chunk-IZJ4JSSC.js.map +0 -1
  24. package/dist/client/index.cjs +0 -20460
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -8195
  27. package/dist/server/index.cjs +0 -4525
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -382
  30. package/dist/time-CVZpAkGY.d.ts +0 -3987
  31. package/dist/token-registry-snapshot-bR14QehS.d.cts +0 -245
  32. package/dist/universal/index.cjs +0 -4562
  33. package/dist/universal/index.cjs.map +0 -1
  34. package/dist/universal/index.d.cts +0 -1362
@@ -1,134 +1,92 @@
1
- import { aI as PaginationParams, aJ as PaginatedResponse, a as EthereumChain, b as EvmContractAddress, J as TokenMetadata, aL as OfferToken, K as CentrifugeVaultOfferDetail, aM as DecimalString, G as StablecoinSymbol, o as OndoBuyTransaction, B as BlockchainAmount, p as OndoSellTransaction, ap as HttpError, u as Bps, aN as SwapStatus, a9 as AssetDecimals, n as OfferSwapContract, aO as Uint256, d as AssetSymbol, v as EvmWalletAddress, aP as KnownAssetSymbol, H as Erc20Asset, aQ as Newtype } from '../time-CVZpAkGY.js';
2
- export { aR as AllowWalletParams, aS as AllowWalletResponse, aT as Asset, aU as AssetCode, k as AssetId, _ as AsyncOfferDetail, Z as AsyncOfferType, A as AuthorizationCode, aV as Blockchain, aa as BuildCentrifugeVaultBuyParams, ae as BuildOndoBuyParams, af as BuildOndoSellParams, aW as BuildOndoSwapParamsCore, f as CentrifugeClaimDirection, c as CentrifugeNamespace, g as CentrifugeNamespaceImpl, ab as CentrifugeOrderReason, ac as CentrifugeOrderability, aX as CentrifugePositionStatus, e as CentrifugeVaultBuyTransaction, aY as CentrifugeVaultClaimProceedsTransaction, aZ as CentrifugeVaultClaimTransaction, aj as CentrifugeVaultLeg, X as CentrifugeVaultLegId, a_ as CentrifugeVaultOffer, a$ as CentrifugeVaultPosition, b0 as CentrifugeVaultReason, b1 as CentrifugeVaultRedeemPosition, al as CentrifugeVaultStatus, b2 as CentrifugeVaultTransactionCore, b3 as CentrifugeWalletParams, b4 as Chain, aG as ClientCredentialsOAuth, b5 as ClientId, aK as ClientSecret, b6 as CodeChallenge, C as CodeVerifier, h as CoinListTokenSaleNamespace, l as CoinListTokenSaleNamespaceImpl, b7 as CoinListTokenSaleOffer, Q as CoinListTokenSaleOfferDetail, z as Config, b8 as ConnectExternalWalletParams, b9 as CreateKycTokenParams, ba as CreateParticipationParams, bb as CreateWalletOwnershipChallengeParams, bc as Cursor, an as DebugEvent, bd as DocumentFormType, a6 as DocumentSubmission, be as DocumentSubmissionStatus, bf as DocumentType, bg as ETHEREUM_CHAINS, bh as EpochMillis, E as Erc20Namespace, bi as Erc20NamespaceImpl, bj as FaqItem, ao as FrontlineEventId, bk as GetCentrifugeVaultStatusParams, bl as GetOndoQuoteParams, bm as GetOndoTradingStatusParams, bn as GetSwapAuthorizationParams, bo as GetSwapPreviewParams, bp as GetTokenAllowanceParams, bq as GetTokenBalanceParams, br as HexEncodedTransactionData, aq as HttpResponse, bs as Isin, bt as Iso2CountryCode, a5 as KycLevelName, ar as KycToken, bu as Link, bv as ListOptionAddressesParams, as as LogBinding, at as LogBindings, au as LogCause, av as LogLevel, aw as LogScope, ax as LogValue, L as Logger, bw as MAX_ASSET_DECIMALS, bx as MAX_UINT_256, by as Milestone, bz as Millis, D as OAuthAccessToken, bA as OAuthRefreshToken, aF as OAuthSession, $ as Offer, bB as OfferBase, I as OfferDetail, bC as OfferDetailBase, bD as OfferEditorial, i as OfferId, bE as OfferOption, a3 as OfferOptionAddress, ak as OfferOptionAddressId, j as OfferOptionId, bF as OfferOptionSlug, bG as OfferSlug, M as OfferType, O as OfferVaultContract, F as OffersNamespace, bH as OffersNamespaceImpl, m as OndoNamespace, s as OndoNamespaceImpl, ag as OndoQuote, bI as OndoQuoteDuration, ah as OndoQuoteSize, bJ as OndoSellOutcome, bK as OndoSwapOffer, N as OndoSwapOfferDetail, q as OndoSwapTransactionCore, ad as OndoTradingStatus, r as OrderBookSide, bL as PKCEState, bM as PaginatedResponseDto, P as Participation, bN as ParticipationId, bO as ParticipationStatus, bP as ParticipationsPaginationParams, bQ as PauseFlags, bR as Pii, bS as PiiAddress, bT as PiiJurisdiction, bU as PiiKind, a8 as PinoLoggerOptions, ay as ProductionLogLevel, bV as QueryParamValue, bW as QueryParamValues, az as RedactedWalletError, bX as RedirectUri, bY as RemoveOptionAddressParams, aA as RequestId, x as Requirement, bZ as RequirementActionNeededReason, a4 as RequirementId, a0 as RequirementStatusInfo, a2 as RequirementStatusValue, a1 as RequirementType, R as RequirementsNamespace, y as RequirementsNamespaceImpl, b_ as RpcConfig, aB as RpcFailureReason, b$ as SOLANA_CHAINS, c0 as STABLE_DECIMALS, aC as SafeEvent, aD as SafeFields, Y as Seconds, c1 as SolanaChain, c2 as SubmitDocumentParams, S as SuperstateSwapNamespace, w as SuperstateSwapNamespaceImpl, c3 as SuperstateSwapOffer, V as SuperstateSwapOfferDetail, c4 as SwapContractRef, c5 as SwapPreview, c6 as TermItem, c7 as Ticker, ai as TokenIdentifier, am as TokenLogo, c8 as TokenLogoImage, c9 as TokenLogoUrl, ca as TokenRole, T as TokensNamespace, cb as TokensNamespaceImpl, cc as Tx, aE as UnredactedFields, cd as WalletAddress, a7 as WalletChallengeType, W as WalletError, ce as WalletOwnershipChallenge, cf as WalletProtocol, t as WalletsNamespace, cg as WalletsNamespaceImpl, ch as apiErrorCode, ci as assertUint256, cj as isChain, ck as isExpired, cl as isOfferType, cm as parseUint256 } from '../time-CVZpAkGY.js';
3
- import { N as NonEmptyArray, S as SwapQuote, F as FormattedAmountAssetUi, T as TxExplorerUrl, h as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress } from '../token-registry-snapshot-BkwA8KmD.js';
4
- export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, e as EvmSigner, E as EvmWallet, f as ExternalWalletAdapter, P as PKCEConfig, i as PKCEParams, d as TokenRegistrySnapshot, c as WalletLabelResolver, W as WalletSelection, g as WriteContractParams, j as generatePKCEParams, o as offerDisplayTokens } from '../token-registry-snapshot-BkwA8KmD.js';
5
- import { TransactionReceipt, Hash, Chain } from 'viem';
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
+ import { Hash, Chain } from 'viem';
6
6
 
7
+ type HttpResponse<TBody = unknown> = {
8
+ status: number;
9
+ headers?: Record<string, string>;
10
+ body: TBody | null;
11
+ /**
12
+ * The id of the request that produced this response, stamped by
13
+ * {@link HttpClient} so that whoever turns a non-2xx into an
14
+ * {@link HttpError} can carry it without threading the request alongside.
15
+ * Absent when the response did not come from an `HttpClient`.
16
+ */
17
+ requestId?: RequestId;
18
+ };
19
+ declare class HttpError<TBody = unknown> extends Error {
20
+ readonly response: HttpResponse<TBody>;
21
+ constructor(response: HttpResponse<TBody>);
22
+ /**
23
+ * Correlates this failure with the `[HTTP]` log lines for the same request,
24
+ * which carry the method, the URL, the duration and every retry. `null` when
25
+ * the response did not come from an {@link HttpClient}.
26
+ *
27
+ * Worth quoting in a bug report: it is what makes a log excerpt readable.
28
+ */
29
+ get requestId(): RequestId | null;
30
+ }
7
31
  /**
8
- * Walks every page of a cursor-paginated endpoint and returns the flattened
9
- * result.
32
+ * The machine-readable `code` frontline attaches to an error, or `null` for
33
+ * anything else - a non-HTTP failure, or an error body that carries only a
34
+ * message.
10
35
  *
11
- * Lives in the API layer rather than beside `PaginationParams` because it
12
- * drives requests: it is the auto-paginating half that `list()` is built on,
13
- * while the params and the response envelope are domain models the client and
14
- * the server both name.
15
- */
16
- declare function fetchAllPages<A, P extends PaginationParams = PaginationParams>(fetchPage: (params: P) => Promise<PaginatedResponse<A>>, baseParams?: Omit<P, keyof PaginationParams>): Promise<A[]>;
17
-
18
- /**
19
- * How often the Centrifuge checkout refreshes the vault status. The read is
20
- * free - it spends no attestation - so this is paced for a gate the user can
21
- * trust rather than for cost.
22
- */
23
- declare const CENTRIFUGE_POLL_INTERVAL_MS = 15000;
24
-
25
- /**
26
- * One chain a vault offer runs on, with everything a screen needs to read and
27
- * show a position there: the proxy every request and claim goes through, the
28
- * share token it issues, and the funding token it is paid in.
36
+ * Frontline answers a failure with `{ type, message, code?, errors?,
37
+ * event_id? }`, and `code` is the only part of it meant to be branched on:
38
+ * `message` is prose that may be reworded, and `type` distinguishes
39
+ * `invalid_request_error` from `api_error` without saying which one.
29
40
  *
30
- * The share token's `symbol` is what every `/v1/centrifuge/vault/*` call is
31
- * keyed by.
41
+ * Reach for this only where a code has a distinct remedy the user can act on.
42
+ * Mapping the whole vocabulary would couple the SDK to strings frontline does
43
+ * not version; falling back to a generic failure is the right default.
32
44
  */
33
- type CentrifugeVault = {
34
- chain: EthereumChain;
35
- proxy: EvmContractAddress;
36
- share: TokenMetadata;
37
- funding: TokenMetadata;
45
+ declare function apiErrorCode(error: unknown): string | null;
46
+
47
+ type PKCEParams = {
48
+ clientId: ClientId;
49
+ responseType: 'code';
50
+ redirectUri: RedirectUri;
51
+ codeChallenge: CodeChallenge;
52
+ codeChallengeMethod: 'S256';
53
+ state: PKCEState;
54
+ codeVerifier: CodeVerifier;
38
55
  };
39
- /**
40
- * The vaults an offer runs on, or why a chain could not be resolved: one
41
- * entry per `vaultContracts` chain, in the offer's order.
42
- */
43
- type CentrifugeVaultResolution = {
44
- type: 'resolved';
45
- vault: CentrifugeVault;
46
- } | {
47
- type: 'unresolved';
48
- chain: OfferToken['chain'];
49
- /** Which token the offer or the registry could not name. */
50
- missing: 'share-token' | 'funding-token' | 'evm-chain';
56
+ type PKCEConfig = {
57
+ clientId: ClientId;
58
+ redirectUri: RedirectUri;
51
59
  };
52
60
  /**
53
- * Resolves each chain of a vault offer to its share and funding tokens.
54
- *
55
- * The offer names tokens by role and address only - the share token as
56
- * `vault`, the coin it is paid in as `funding` - so `lookup` turns each into
57
- * metadata. A function rather than a registry snapshot, so this module does
58
- * not depend on where the metadata comes from.
59
- *
60
- * A chain whose tokens cannot be named is reported rather than dropped: its
61
- * position cannot be read without the symbol, and a caller has to know it is
62
- * not showing it. When a chain lists several funding tokens, the first one
63
- * `lookup` knows wins - a vault is priced in one.
61
+ * Generates PKCE parameters for an OAuth2 authorization code flow.
62
+ * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use
63
+ * in server-side code and Next.js middleware.
64
64
  */
65
- declare function resolveCentrifugeVaults(offer: CentrifugeVaultOfferDetail, lookup: (token: OfferToken) => TokenMetadata | null): CentrifugeVaultResolution[];
65
+ declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
66
66
 
67
67
  /**
68
- * How often the Ondo checkout refreshes what it is allowed to poll: the market
69
- * status and the indicative price. Both are free - neither spends an
70
- * attestation - so this is paced for a price the user can trust rather than
71
- * for cost.
72
- *
73
- * A built transaction is deliberately not on this timer. Building spends an
74
- * attestation, so it happens once per order and once per refresh the user
75
- * asks for.
76
- */
77
- declare const ONDO_POLL_INTERVAL_MS = 15000;
78
- /** Max time the review step offers a built quote. */
79
- declare const ONDO_QUOTE_MAX_TTL_MS = 15000;
80
- /**
81
- * The order size the sidebar prices against before the user names one.
82
- *
83
- * Ondo prices by size, so some amount has to be sent. $1,000 is a plausible
84
- * order rather than a token one: a size so small that Ondo's minimum rejects
85
- * it would leave the panel permanently blank.
86
- *
87
- * Named distinctly from `DEFAULT_AMOUNT_TO_COMPUTE_PRICE` in the swap
88
- * constants, which is a raw `bigint` of USDC base units for a different
89
- * endpoint. Both barrels are flat, so two constants of the same name could not
90
- * coexist - and they mean different things anyway.
91
- */
92
- declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
93
- /**
94
- * The coin an Ondo sell settles into, for display only.
95
- *
96
- * The scale of every amount on a built transaction comes off the response, so
97
- * this names the token and never sizes it - `receive_output_decimals` is the
98
- * only authority on how many decimals the proceeds are counted in, and the two
99
- * are allowed to disagree.
100
- *
101
- * Named apart from {@link ONDO_SUPPORTED_INPUT_ASSETS} rather than read out of
102
- * it, though both are USDC today. On a buy USDC is what the user funds with
103
- * and one of a list that may grow; on a sell it is what they settle into and
104
- * there is one of it. Reading `ONDO_SUPPORTED_INPUT_ASSETS[0]` here would make
105
- * the sell screen quietly follow whichever funding coin happened to be listed
106
- * first.
107
- */
108
- declare const ONDO_SETTLEMENT_ASSET: StablecoinSymbol;
109
- /**
110
- * The order size the sidebar prices a sell against before the user names one.
68
+ * The CoinList contract a swap on `chain` settles through, and therefore the
69
+ * ERC-20 spender the user approves - or `null` where this offer cannot be
70
+ * swapped on that chain.
111
71
  *
112
- * Sells are quoted by token amount rather than by notional: the fee comes out
113
- * of dollars, and Ondo's price is size-aware, so a buy's quantity depends on
114
- * the quote being asked for while a sell is sized by what the user already
115
- * holds. One whole share is a size Ondo will price - small enough to be
116
- * plausible for any asset, large enough that Ondo's minimum does not reject it
117
- * and leave the panel permanently blank.
72
+ * Read off the offer rather than held as a constant because the address varies
73
+ * by environment, not only by chain: beta and production both run
74
+ * `ethereum_sepolia` and deploy a different contract on each, and one constant
75
+ * cannot name both. Frontline resolves it per environment and serves the
76
+ * answer on the offer.
118
77
  *
119
- * The buy counterpart is {@link DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE}, which
120
- * is a dollar figure for the same reason in reverse.
121
- */
122
- declare const DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
123
- /**
124
- * The coins an Ondo buy can be funded with, in display order, with the first
125
- * preselected.
78
+ * The array varies per *offer* as well as per chain - frontline drops a chain
79
+ * whose funding and swap tokens do not both resolve for this asset - so an
80
+ * array read for one symbol must not be reused for another. An empty array
81
+ * means "cannot swap here", which is an answer rather than an error.
126
82
  *
127
- * USDC alone today: it is what the Sepolia integration contract accepts. The
128
- * amount step renders a single entry as a plain card and two or more as a
129
- * picker, so adding one here is all it takes.
83
+ * A capability rather than a provider slice, and named for the data it reads
84
+ * rather than for its first caller: `swap_contracts` is an offer field, and
85
+ * `universal-core-isolation-and-sharing` would stop Superstate reusing this if
86
+ * it lived under `checkout/ondo/`. Superstate has not migrated yet - it still
87
+ * reads `superstateSwapContractAddress` - so Ondo is the only caller today.
130
88
  */
131
- declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
89
+ declare function swapSpender(swapContracts: OfferSwapContract[], chain: EthereumChain): EvmContractAddress | null;
132
90
 
133
91
  /**
134
92
  * The price of one whole asset token in a built Ondo purchase, in the funding
@@ -175,20 +133,7 @@ declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): Blockchai
175
133
  * does today. They diverge the day ENG-1718 lands.
176
134
  */
177
135
  declare function computeOndoSellPrice(transaction: OndoSellTransaction): BlockchainAmount;
178
- /** The sooner of Ondo's deadline and now + {@link ONDO_QUOTE_MAX_TTL_MS}. */
179
- declare function ondoQuoteOfferDeadline(expiresAt: Date, nowMs?: number): Date;
180
136
 
181
- /**
182
- * The CoinList API's error code for an Ondo quote refused because the asset
183
- * cannot be traded right now: the market is closed or paused, or the asset is
184
- * paused or closed for the session. It arrives on a 409.
185
- *
186
- * One code for all four of Ondo's reasons, because the remedy is the same:
187
- * wait for the market to open. Ondo pauses for a moment at every US session
188
- * change (04:00 and 16:00 ET), so a poll can land on one even while
189
- * `getTradingStatus` reported the asset tradable a second earlier.
190
- */
191
- declare const ONDO_NOT_TRADABLE_CODE = "not_tradable";
192
137
  /**
193
138
  * Whether `error` is the CoinList API refusing an Ondo quote because the
194
139
  * market is not open, as opposed to a request that failed.
@@ -199,701 +144,14 @@ declare const ONDO_NOT_TRADABLE_CODE = "not_tradable";
199
144
  declare function isOndoNotTradableError(error: unknown): error is HttpError;
200
145
 
201
146
  /**
202
- * The Superstate swap contract's ABI, generated verbatim from the shared
203
- * `TokenSwap` base contract:
204
- *
205
- * ```
206
- * cd ../solidity && forge inspect TokenSwap abi --json --use 0.8.34
207
- * ```
208
- *
209
- * Generated rather than hand-trimmed to the four methods the SDK calls, so
210
- * regenerating after a contract change is one command and a paste. The custom
211
- * errors carry their weight in particular: viem decodes a revert against them,
212
- * so a `preview()` on a stopped contract surfaces as `IsStopped` rather than
213
- * as an opaque `0x`-prefixed blob.
214
- *
215
- * `status()` returns `Status { uint32 flags; State state }` where `State` is
216
- * `0 = Active | 1 = Paused | 2 = Stopped`. It replaced the older
217
- * `stopped() -> uint256` bitmask, which this contract still exposes but as a
218
- * `bool`; {@link SwapStatus} reads `status()` and nothing else.
219
- */
220
- declare const SUPERSTATE_SWAP_ABI: readonly [{
221
- readonly type: "function";
222
- readonly name: "KIND";
223
- readonly inputs: readonly [];
224
- readonly outputs: readonly [{
225
- readonly name: "";
226
- readonly type: "uint16";
227
- readonly internalType: "uint16";
228
- }];
229
- readonly stateMutability: "view";
230
- }, {
231
- readonly type: "function";
232
- readonly name: "ONE_HUNDRED_P";
233
- readonly inputs: readonly [];
234
- readonly outputs: readonly [{
235
- readonly name: "";
236
- readonly type: "uint256";
237
- readonly internalType: "uint256";
238
- }];
239
- readonly stateMutability: "view";
240
- }, {
241
- readonly type: "function";
242
- readonly name: "SWAP_LEVEL";
243
- readonly inputs: readonly [];
244
- readonly outputs: readonly [{
245
- readonly name: "";
246
- readonly type: "uint32";
247
- readonly internalType: "uint32";
248
- }];
249
- readonly stateMutability: "view";
250
- }, {
251
- readonly type: "function";
252
- readonly name: "VERSION";
253
- readonly inputs: readonly [];
254
- readonly outputs: readonly [{
255
- readonly name: "";
256
- readonly type: "uint16";
257
- readonly internalType: "uint16";
258
- }];
259
- readonly stateMutability: "view";
260
- }, {
261
- readonly type: "function";
262
- readonly name: "authorized";
263
- readonly inputs: readonly [{
264
- readonly name: "user";
265
- readonly type: "address";
266
- readonly internalType: "address";
267
- }];
268
- readonly outputs: readonly [{
269
- readonly name: "";
270
- readonly type: "bool";
271
- readonly internalType: "bool";
272
- }];
273
- readonly stateMutability: "view";
274
- }, {
275
- readonly type: "function";
276
- readonly name: "bpp";
277
- readonly inputs: readonly [{
278
- readonly name: "amount";
279
- readonly type: "uint256";
280
- readonly internalType: "uint256";
281
- }];
282
- readonly outputs: readonly [{
283
- readonly name: "";
284
- readonly type: "uint256";
285
- readonly internalType: "uint256";
286
- }];
287
- readonly stateMutability: "view";
288
- }, {
289
- readonly type: "function";
290
- readonly name: "bps";
291
- readonly inputs: readonly [];
292
- readonly outputs: readonly [{
293
- readonly name: "";
294
- readonly type: "uint256";
295
- readonly internalType: "uint256";
296
- }];
297
- readonly stateMutability: "view";
298
- }, {
299
- readonly type: "function";
300
- readonly name: "cancelOwnershipHandover";
301
- readonly inputs: readonly [];
302
- readonly outputs: readonly [];
303
- readonly stateMutability: "payable";
304
- }, {
305
- readonly type: "function";
306
- readonly name: "completeOwnershipHandover";
307
- readonly inputs: readonly [{
308
- readonly name: "pendingOwner";
309
- readonly type: "address";
310
- readonly internalType: "address";
311
- }];
312
- readonly outputs: readonly [];
313
- readonly stateMutability: "payable";
314
- }, {
315
- readonly type: "function";
316
- readonly name: "fee";
317
- readonly inputs: readonly [{
318
- readonly name: "amount";
319
- readonly type: "uint256";
320
- readonly internalType: "uint256";
321
- }];
322
- readonly outputs: readonly [{
323
- readonly name: "";
324
- readonly type: "uint256";
325
- readonly internalType: "uint256";
326
- }, {
327
- readonly name: "";
328
- readonly type: "uint256";
329
- readonly internalType: "uint256";
330
- }];
331
- readonly stateMutability: "view";
332
- }, {
333
- readonly type: "function";
334
- readonly name: "id";
335
- readonly inputs: readonly [];
336
- readonly outputs: readonly [{
337
- readonly name: "";
338
- readonly type: "bytes32";
339
- readonly internalType: "bytes32";
340
- }];
341
- readonly stateMutability: "view";
342
- }, {
343
- readonly type: "function";
344
- readonly name: "inputTokens";
345
- readonly inputs: readonly [{
346
- readonly name: "";
347
- readonly type: "address";
348
- readonly internalType: "address";
349
- }];
350
- readonly outputs: readonly [{
351
- readonly name: "";
352
- readonly type: "bool";
353
- readonly internalType: "bool";
354
- }];
355
- readonly stateMutability: "view";
356
- }, {
357
- readonly type: "function";
358
- readonly name: "outputToken";
359
- readonly inputs: readonly [];
360
- readonly outputs: readonly [{
361
- readonly name: "";
362
- readonly type: "address";
363
- readonly internalType: "address";
364
- }];
365
- readonly stateMutability: "view";
366
- }, {
367
- readonly type: "function";
368
- readonly name: "outputTokenBalance";
369
- readonly inputs: readonly [];
370
- readonly outputs: readonly [{
371
- readonly name: "";
372
- readonly type: "uint256";
373
- readonly internalType: "uint256";
374
- }];
375
- readonly stateMutability: "view";
376
- }, {
377
- readonly type: "function";
378
- readonly name: "owner";
379
- readonly inputs: readonly [];
380
- readonly outputs: readonly [{
381
- readonly name: "result";
382
- readonly type: "address";
383
- readonly internalType: "address";
384
- }];
385
- readonly stateMutability: "view";
386
- }, {
387
- readonly type: "function";
388
- readonly name: "ownershipHandoverExpiresAt";
389
- readonly inputs: readonly [{
390
- readonly name: "pendingOwner";
391
- readonly type: "address";
392
- readonly internalType: "address";
393
- }];
394
- readonly outputs: readonly [{
395
- readonly name: "result";
396
- readonly type: "uint256";
397
- readonly internalType: "uint256";
398
- }];
399
- readonly stateMutability: "view";
400
- }, {
401
- readonly type: "function";
402
- readonly name: "pause";
403
- readonly inputs: readonly [{
404
- readonly name: "level";
405
- readonly type: "uint32";
406
- readonly internalType: "uint32";
407
- }];
408
- readonly outputs: readonly [{
409
- readonly name: "";
410
- readonly type: "bool";
411
- readonly internalType: "bool";
412
- }];
413
- readonly stateMutability: "nonpayable";
414
- }, {
415
- readonly type: "function";
416
- readonly name: "paused";
417
- readonly inputs: readonly [];
418
- readonly outputs: readonly [{
419
- readonly name: "";
420
- readonly type: "uint32";
421
- readonly internalType: "uint32";
422
- }];
423
- readonly stateMutability: "view";
424
- }, {
425
- readonly type: "function";
426
- readonly name: "preview";
427
- readonly inputs: readonly [{
428
- readonly name: "token";
429
- readonly type: "address";
430
- readonly internalType: "address";
431
- }, {
432
- readonly name: "amount";
433
- readonly type: "uint256";
434
- readonly internalType: "uint256";
435
- }];
436
- readonly outputs: readonly [{
437
- readonly name: "";
438
- readonly type: "tuple";
439
- readonly internalType: "struct Preview";
440
- readonly components: readonly [{
441
- readonly name: "input";
442
- readonly type: "uint256";
443
- readonly internalType: "uint256";
444
- }, {
445
- readonly name: "fee";
446
- readonly type: "uint256";
447
- readonly internalType: "uint256";
448
- }, {
449
- readonly name: "output";
450
- readonly type: "uint256";
451
- readonly internalType: "uint256";
452
- }];
453
- }];
454
- readonly stateMutability: "view";
455
- }, {
456
- readonly type: "function";
457
- readonly name: "renounceOwnership";
458
- readonly inputs: readonly [];
459
- readonly outputs: readonly [];
460
- readonly stateMutability: "payable";
461
- }, {
462
- readonly type: "function";
463
- readonly name: "requestOwnershipHandover";
464
- readonly inputs: readonly [];
465
- readonly outputs: readonly [];
466
- readonly stateMutability: "payable";
467
- }, {
468
- readonly type: "function";
469
- readonly name: "setBps";
470
- readonly inputs: readonly [{
471
- readonly name: "points";
472
- readonly type: "uint256";
473
- readonly internalType: "uint256";
474
- }];
475
- readonly outputs: readonly [{
476
- readonly name: "";
477
- readonly type: "bool";
478
- readonly internalType: "bool";
479
- }];
480
- readonly stateMutability: "nonpayable";
481
- }, {
482
- readonly type: "function";
483
- readonly name: "setInputToken";
484
- readonly inputs: readonly [{
485
- readonly name: "token";
486
- readonly type: "address";
487
- readonly internalType: "address";
488
- }, {
489
- readonly name: "val";
490
- readonly type: "bool";
491
- readonly internalType: "bool";
492
- }];
493
- readonly outputs: readonly [{
494
- readonly name: "";
495
- readonly type: "bool";
496
- readonly internalType: "bool";
497
- }];
498
- readonly stateMutability: "nonpayable";
499
- }, {
500
- readonly type: "function";
501
- readonly name: "status";
502
- readonly inputs: readonly [];
503
- readonly outputs: readonly [{
504
- readonly name: "";
505
- readonly type: "tuple";
506
- readonly internalType: "struct Status";
507
- readonly components: readonly [{
508
- readonly name: "flags";
509
- readonly type: "uint32";
510
- readonly internalType: "uint32";
511
- }, {
512
- readonly name: "state";
513
- readonly type: "uint8";
514
- readonly internalType: "enum State";
515
- }];
516
- }];
517
- readonly stateMutability: "view";
518
- }, {
519
- readonly type: "function";
520
- readonly name: "stop";
521
- readonly inputs: readonly [];
522
- readonly outputs: readonly [{
523
- readonly name: "";
524
- readonly type: "bool";
525
- readonly internalType: "bool";
526
- }];
527
- readonly stateMutability: "nonpayable";
528
- }, {
529
- readonly type: "function";
530
- readonly name: "stopped";
531
- readonly inputs: readonly [];
532
- readonly outputs: readonly [{
533
- readonly name: "";
534
- readonly type: "bool";
535
- readonly internalType: "bool";
536
- }];
537
- readonly stateMutability: "view";
538
- }, {
539
- readonly type: "function";
540
- readonly name: "swap";
541
- readonly inputs: readonly [{
542
- readonly name: "token";
543
- readonly type: "address";
544
- readonly internalType: "address";
545
- }, {
546
- readonly name: "amount";
547
- readonly type: "uint256";
548
- readonly internalType: "uint256";
549
- }, {
550
- readonly name: "slip";
551
- readonly type: "uint256";
552
- readonly internalType: "uint256";
553
- }];
554
- readonly outputs: readonly [{
555
- readonly name: "";
556
- readonly type: "uint256";
557
- readonly internalType: "uint256";
558
- }];
559
- readonly stateMutability: "nonpayable";
560
- }, {
561
- readonly type: "function";
562
- readonly name: "tokenBalance";
563
- readonly inputs: readonly [{
564
- readonly name: "token";
565
- readonly type: "address";
566
- readonly internalType: "address";
567
- }];
568
- readonly outputs: readonly [{
569
- readonly name: "";
570
- readonly type: "uint256";
571
- readonly internalType: "uint256";
572
- }];
573
- readonly stateMutability: "view";
574
- }, {
575
- readonly type: "function";
576
- readonly name: "totals";
577
- readonly inputs: readonly [{
578
- readonly name: "user";
579
- readonly type: "address";
580
- readonly internalType: "address";
581
- }, {
582
- readonly name: "token";
583
- readonly type: "address";
584
- readonly internalType: "address";
585
- }];
586
- readonly outputs: readonly [{
587
- readonly name: "";
588
- readonly type: "tuple";
589
- readonly internalType: "struct SwapTotal";
590
- readonly components: readonly [{
591
- readonly name: "inputSum";
592
- readonly type: "uint256";
593
- readonly internalType: "uint256";
594
- }, {
595
- readonly name: "feeSum";
596
- readonly type: "uint256";
597
- readonly internalType: "uint256";
598
- }, {
599
- readonly name: "outputSum";
600
- readonly type: "uint256";
601
- readonly internalType: "uint256";
602
- }, {
603
- readonly name: "count";
604
- readonly type: "uint256";
605
- readonly internalType: "uint256";
606
- }];
607
- }];
608
- readonly stateMutability: "view";
609
- }, {
610
- readonly type: "function";
611
- readonly name: "totals";
612
- readonly inputs: readonly [{
613
- readonly name: "token";
614
- readonly type: "address";
615
- readonly internalType: "address";
616
- }];
617
- readonly outputs: readonly [{
618
- readonly name: "";
619
- readonly type: "tuple";
620
- readonly internalType: "struct SwapTotal";
621
- readonly components: readonly [{
622
- readonly name: "inputSum";
623
- readonly type: "uint256";
624
- readonly internalType: "uint256";
625
- }, {
626
- readonly name: "feeSum";
627
- readonly type: "uint256";
628
- readonly internalType: "uint256";
629
- }, {
630
- readonly name: "outputSum";
631
- readonly type: "uint256";
632
- readonly internalType: "uint256";
633
- }, {
634
- readonly name: "count";
635
- readonly type: "uint256";
636
- readonly internalType: "uint256";
637
- }];
638
- }];
639
- readonly stateMutability: "view";
640
- }, {
641
- readonly type: "function";
642
- readonly name: "transfer";
643
- readonly inputs: readonly [{
644
- readonly name: "to";
645
- readonly type: "address";
646
- readonly internalType: "address";
647
- }, {
648
- readonly name: "amount";
649
- readonly type: "uint256";
650
- readonly internalType: "uint256";
651
- }];
652
- readonly outputs: readonly [{
653
- readonly name: "";
654
- readonly type: "bool";
655
- readonly internalType: "bool";
656
- }];
657
- readonly stateMutability: "nonpayable";
658
- }, {
659
- readonly type: "function";
660
- readonly name: "transfer";
661
- readonly inputs: readonly [{
662
- readonly name: "to";
663
- readonly type: "address";
664
- readonly internalType: "address";
665
- }, {
666
- readonly name: "token";
667
- readonly type: "address";
668
- readonly internalType: "address";
669
- }, {
670
- readonly name: "amount";
671
- readonly type: "uint256";
672
- readonly internalType: "uint256";
673
- }];
674
- readonly outputs: readonly [{
675
- readonly name: "";
676
- readonly type: "bool";
677
- readonly internalType: "bool";
678
- }];
679
- readonly stateMutability: "nonpayable";
680
- }, {
681
- readonly type: "function";
682
- readonly name: "transferOwnership";
683
- readonly inputs: readonly [{
684
- readonly name: "newOwner";
685
- readonly type: "address";
686
- readonly internalType: "address";
687
- }];
688
- readonly outputs: readonly [];
689
- readonly stateMutability: "payable";
690
- }, {
691
- readonly type: "event";
692
- readonly name: "BpsUpdated";
693
- readonly inputs: readonly [{
694
- readonly name: "prev";
695
- readonly type: "uint256";
696
- readonly indexed: false;
697
- readonly internalType: "uint256";
698
- }, {
699
- readonly name: "next";
700
- readonly type: "uint256";
701
- readonly indexed: false;
702
- readonly internalType: "uint256";
703
- }];
704
- readonly anonymous: false;
705
- }, {
706
- readonly type: "event";
707
- readonly name: "InputTokenUpdated";
708
- readonly inputs: readonly [{
709
- readonly name: "token";
710
- readonly type: "address";
711
- readonly indexed: true;
712
- readonly internalType: "address";
713
- }, {
714
- readonly name: "prev";
715
- readonly type: "bool";
716
- readonly indexed: false;
717
- readonly internalType: "bool";
718
- }, {
719
- readonly name: "next";
720
- readonly type: "bool";
721
- readonly indexed: false;
722
- readonly internalType: "bool";
723
- }];
724
- readonly anonymous: false;
725
- }, {
726
- readonly type: "event";
727
- readonly name: "OwnershipHandoverCanceled";
728
- readonly inputs: readonly [{
729
- readonly name: "pendingOwner";
730
- readonly type: "address";
731
- readonly indexed: true;
732
- readonly internalType: "address";
733
- }];
734
- readonly anonymous: false;
735
- }, {
736
- readonly type: "event";
737
- readonly name: "OwnershipHandoverRequested";
738
- readonly inputs: readonly [{
739
- readonly name: "pendingOwner";
740
- readonly type: "address";
741
- readonly indexed: true;
742
- readonly internalType: "address";
743
- }];
744
- readonly anonymous: false;
745
- }, {
746
- readonly type: "event";
747
- readonly name: "OwnershipTransferred";
748
- readonly inputs: readonly [{
749
- readonly name: "oldOwner";
750
- readonly type: "address";
751
- readonly indexed: true;
752
- readonly internalType: "address";
753
- }, {
754
- readonly name: "newOwner";
755
- readonly type: "address";
756
- readonly indexed: true;
757
- readonly internalType: "address";
758
- }];
759
- readonly anonymous: false;
760
- }, {
761
- readonly type: "event";
762
- readonly name: "Paused";
763
- readonly inputs: readonly [{
764
- readonly name: "previous";
765
- readonly type: "uint32";
766
- readonly indexed: false;
767
- readonly internalType: "uint32";
768
- }, {
769
- readonly name: "next";
770
- readonly type: "uint32";
771
- readonly indexed: false;
772
- readonly internalType: "uint32";
773
- }];
774
- readonly anonymous: false;
775
- }, {
776
- readonly type: "event";
777
- readonly name: "Stopped";
778
- readonly inputs: readonly [];
779
- readonly anonymous: false;
780
- }, {
781
- readonly type: "event";
782
- readonly name: "Swapped";
783
- readonly inputs: readonly [{
784
- readonly name: "user";
785
- readonly type: "address";
786
- readonly indexed: true;
787
- readonly internalType: "address";
788
- }, {
789
- readonly name: "inputToken";
790
- readonly type: "address";
791
- readonly indexed: true;
792
- readonly internalType: "address";
793
- }, {
794
- readonly name: "outputToken";
795
- readonly type: "address";
796
- readonly indexed: true;
797
- readonly internalType: "address";
798
- }, {
799
- readonly name: "inputAmount";
800
- readonly type: "uint256";
801
- readonly indexed: false;
802
- readonly internalType: "uint256";
803
- }, {
804
- readonly name: "fee";
805
- readonly type: "uint256";
806
- readonly indexed: false;
807
- readonly internalType: "uint256";
808
- }, {
809
- readonly name: "outputAmount";
810
- readonly type: "uint256";
811
- readonly indexed: false;
812
- readonly internalType: "uint256";
813
- }];
814
- readonly anonymous: false;
815
- }, {
816
- readonly type: "event";
817
- readonly name: "Transferred";
818
- readonly inputs: readonly [{
819
- readonly name: "to";
820
- readonly type: "address";
821
- readonly indexed: true;
822
- readonly internalType: "address";
823
- }, {
824
- readonly name: "token";
825
- readonly type: "address";
826
- readonly indexed: true;
827
- readonly internalType: "address";
828
- }, {
829
- readonly name: "amount";
830
- readonly type: "uint256";
831
- readonly indexed: false;
832
- readonly internalType: "uint256";
833
- }];
834
- readonly anonymous: false;
835
- }, {
836
- readonly type: "error";
837
- readonly name: "AlreadyInitialized";
838
- readonly inputs: readonly [];
839
- }, {
840
- readonly type: "error";
841
- readonly name: "InsufficientAmount";
842
- readonly inputs: readonly [];
843
- }, {
844
- readonly type: "error";
845
- readonly name: "InvalidAddress";
846
- readonly inputs: readonly [];
847
- }, {
848
- readonly type: "error";
849
- readonly name: "InvalidAmount";
850
- readonly inputs: readonly [];
851
- }, {
852
- readonly type: "error";
853
- readonly name: "IsPaused";
854
- readonly inputs: readonly [{
855
- readonly name: "level";
856
- readonly type: "uint32";
857
- readonly internalType: "uint32";
858
- }];
859
- }, {
860
- readonly type: "error";
861
- readonly name: "IsStopped";
862
- readonly inputs: readonly [];
863
- }, {
864
- readonly type: "error";
865
- readonly name: "NewOwnerIsZeroAddress";
866
- readonly inputs: readonly [];
867
- }, {
868
- readonly type: "error";
869
- readonly name: "NoHandoverRequest";
870
- readonly inputs: readonly [];
871
- }, {
872
- readonly type: "error";
873
- readonly name: "SwapFailed";
874
- readonly inputs: readonly [{
875
- readonly name: "user";
876
- readonly type: "address";
877
- readonly internalType: "address";
878
- }, {
879
- readonly name: "token";
880
- readonly type: "address";
881
- readonly internalType: "address";
882
- }];
883
- }, {
884
- readonly type: "error";
885
- readonly name: "Unauthorized";
886
- readonly inputs: readonly [];
887
- }];
888
-
889
- /**
890
- * 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).
891
150
  *
892
- * `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.
893
153
  *
894
- * The multiplication happens before the division so we never lose precision to
895
- * integer truncation early. This mirrors standard fixed-point practice on-chain.
896
- * Returned decimals match the input token decimals (always the stablecoin's 6).
154
+ * @throws MathError when the price is out of uint256 bounds.
897
155
  */
898
156
  declare function computePrice({ inputTokenAmount, outputTokenAmount, }: SwapQuote): BlockchainAmount | null;
899
157
  /**
@@ -923,52 +181,10 @@ declare const SWAP_LEVEL = 2;
923
181
  */
924
182
  declare function isSwapAvailable(status: SwapStatus): boolean;
925
183
 
926
- /**
927
- * Decodes the confirmed output amount from the `Swapped` event in a swap
928
- * transaction receipt.
929
- *
930
- * Returns `null` when the event is absent or the amount is not a valid uint256
931
- * so callers can fall back to the quote's expected output — the swap already
932
- * confirmed on-chain, so a missing/undecodable event should not fail the flow.
933
- */
934
- declare function decodeSwappedOutputAmount(receipt: TransactionReceipt, outputDecimals: AssetDecimals): BlockchainAmount | null;
935
-
936
- /**
937
- * Who issues the asset a Superstate swap pays out.
938
- *
939
- * A constant rather than a field off the offer: no frontline endpoint carries
940
- * an issuer, and every offer this checkout serves is Superstate's by
941
- * definition — `CheckoutContainer` routes here on `superstate::swap` alone.
942
- */
943
- declare const SUPERSTATE_ISSUER_NAME = "Superstate";
944
- /**
945
- * The coins a Superstate swap can be funded with, in display order, with the
946
- * first preselected.
947
- *
948
- * USDC alone today: it is what the deployed swap contract accepts. The amount
949
- * step renders a single entry as a plain card and two or more as a picker, so
950
- * adding one here is all it takes.
951
- */
952
- declare const SUPERSTATE_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
953
- /** Poll interval for refreshing on-chain swap quotes and balances. */
954
- declare const SWAP_POLL_INTERVAL_MS = 15000;
955
- /**
956
- * Notional input used to derive a display price-per-share when the user has
957
- * not yet entered an amount (1 USDC at 6 decimals).
958
- */
959
- declare const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
960
184
  /** Slippage tolerances offered in the review step, in basis points. */
961
185
  declare const SLIPPAGE_OPTIONS_BPS: Bps[];
962
186
  /** Default slippage tolerance (0.5%). */
963
187
  declare const DEFAULT_SLIPPAGE_BPS: Bps;
964
- /**
965
- * The deployed Superstate swap contract on Ethereum Sepolia, and therefore the
966
- * ERC-20 spender the user approves there.
967
- *
968
- * Exported in its own right for a partner driving `coinlist.superstate.execute`
969
- * at Level 1, where the contract is an explicit parameter.
970
- */
971
- declare const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress;
972
188
  /**
973
189
  * The Superstate swap contract on `chain`, or `null` where none is deployed.
974
190
  *
@@ -989,39 +205,6 @@ declare function superstateSwapContractAddress(chain: EthereumChain): EvmContrac
989
205
  */
990
206
  declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
991
207
 
992
- /**
993
- * The CoinList contract a swap on `chain` settles through, and therefore the
994
- * ERC-20 spender the user approves - or `null` where this offer cannot be
995
- * swapped on that chain.
996
- *
997
- * Read off the offer rather than held as a constant because the address varies
998
- * by environment, not only by chain: beta and production both run
999
- * `ethereum_sepolia` and deploy a different contract on each, and one constant
1000
- * cannot name both. Frontline resolves it per environment and serves the
1001
- * answer on the offer.
1002
- *
1003
- * The array varies per *offer* as well as per chain - frontline drops a chain
1004
- * whose funding and swap tokens do not both resolve for this asset - so an
1005
- * array read for one symbol must not be reused for another. An empty array
1006
- * means "cannot swap here", which is an answer rather than an error.
1007
- *
1008
- * A capability rather than a provider slice, and named for the data it reads
1009
- * rather than for its first caller: `swap_contracts` is an offer field, and
1010
- * `universal-core-isolation-and-sharing` would stop Superstate reusing this if
1011
- * it lived under `checkout/ondo/`. Superstate has not migrated yet - it still
1012
- * reads `superstateSwapContractAddress` - so Ondo is the only caller today.
1013
- */
1014
- declare function swapSpender(swapContracts: OfferSwapContract[], chain: EthereumChain): EvmContractAddress | null;
1015
-
1016
- /** Basis-point denominator: 10_000 bps = 100%. */
1017
- declare const BPS_DENOM: Bps;
1018
- /**
1019
- * Applies a basis-point fraction to an amount, flooring the result.
1020
- * `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an
1021
- * overflow (bps far above BPS_DENOM) or a negative product is rejected.
1022
- */
1023
- declare function applyBps(amount: Uint256, bps: Bps): Uint256;
1024
-
1025
208
  /** The viem chain definition the SDK reads and writes this chain through. */
1026
209
  declare function viemChain(chain: EthereumChain): Chain;
1027
210
  declare function getChainId(chain: EthereumChain): number;
@@ -1036,158 +219,6 @@ declare function chainFromId(chainId: string): EthereumChain;
1036
219
  declare function getNetworkName(chain: EthereumChain): string;
1037
220
  declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
1038
221
 
1039
- /**
1040
- * Minimal ERC-20 ABI the SDK writes against (mirrors viem's `erc20Abi`). The
1041
- * swap flow uses `approve`; `allowance`/`balanceOf`/`decimals`/`symbol`/`name`
1042
- * are included so reads share a single SDK-owned ABI.
1043
- */
1044
- declare const ERC20_ABI: readonly [{
1045
- readonly type: "function";
1046
- readonly name: "allowance";
1047
- readonly inputs: readonly [{
1048
- readonly name: "owner";
1049
- readonly type: "address";
1050
- }, {
1051
- readonly name: "spender";
1052
- readonly type: "address";
1053
- }];
1054
- readonly outputs: readonly [{
1055
- readonly name: "";
1056
- readonly type: "uint256";
1057
- }];
1058
- readonly stateMutability: "view";
1059
- }, {
1060
- readonly type: "function";
1061
- readonly name: "approve";
1062
- readonly inputs: readonly [{
1063
- readonly name: "spender";
1064
- readonly type: "address";
1065
- }, {
1066
- readonly name: "amount";
1067
- readonly type: "uint256";
1068
- }];
1069
- readonly outputs: readonly [{
1070
- readonly name: "";
1071
- readonly type: "bool";
1072
- }];
1073
- readonly stateMutability: "nonpayable";
1074
- }, {
1075
- readonly type: "function";
1076
- readonly name: "balanceOf";
1077
- readonly inputs: readonly [{
1078
- readonly name: "account";
1079
- readonly type: "address";
1080
- }];
1081
- readonly outputs: readonly [{
1082
- readonly name: "";
1083
- readonly type: "uint256";
1084
- }];
1085
- readonly stateMutability: "view";
1086
- }, {
1087
- readonly type: "function";
1088
- readonly name: "decimals";
1089
- readonly inputs: readonly [];
1090
- readonly outputs: readonly [{
1091
- readonly name: "";
1092
- readonly type: "uint8";
1093
- }];
1094
- readonly stateMutability: "view";
1095
- }, {
1096
- readonly type: "function";
1097
- readonly name: "name";
1098
- readonly inputs: readonly [];
1099
- readonly outputs: readonly [{
1100
- readonly name: "";
1101
- readonly type: "string";
1102
- }];
1103
- readonly stateMutability: "view";
1104
- }, {
1105
- readonly type: "function";
1106
- readonly name: "symbol";
1107
- readonly inputs: readonly [];
1108
- readonly outputs: readonly [{
1109
- readonly name: "";
1110
- readonly type: "string";
1111
- }];
1112
- readonly stateMutability: "view";
1113
- }, {
1114
- readonly type: "function";
1115
- readonly name: "totalSupply";
1116
- readonly inputs: readonly [];
1117
- readonly outputs: readonly [{
1118
- readonly name: "";
1119
- readonly type: "uint256";
1120
- }];
1121
- readonly stateMutability: "view";
1122
- }, {
1123
- readonly type: "function";
1124
- readonly name: "transfer";
1125
- readonly inputs: readonly [{
1126
- readonly name: "recipient";
1127
- readonly type: "address";
1128
- }, {
1129
- readonly name: "amount";
1130
- readonly type: "uint256";
1131
- }];
1132
- readonly outputs: readonly [{
1133
- readonly name: "";
1134
- readonly type: "bool";
1135
- }];
1136
- readonly stateMutability: "nonpayable";
1137
- }, {
1138
- readonly type: "function";
1139
- readonly name: "transferFrom";
1140
- readonly inputs: readonly [{
1141
- readonly name: "sender";
1142
- readonly type: "address";
1143
- }, {
1144
- readonly name: "recipient";
1145
- readonly type: "address";
1146
- }, {
1147
- readonly name: "amount";
1148
- readonly type: "uint256";
1149
- }];
1150
- readonly outputs: readonly [{
1151
- readonly name: "";
1152
- readonly type: "bool";
1153
- }];
1154
- readonly stateMutability: "nonpayable";
1155
- }, {
1156
- readonly type: "event";
1157
- readonly name: "Approval";
1158
- readonly inputs: readonly [{
1159
- readonly name: "owner";
1160
- readonly type: "address";
1161
- readonly indexed: true;
1162
- }, {
1163
- readonly name: "spender";
1164
- readonly type: "address";
1165
- readonly indexed: true;
1166
- }, {
1167
- readonly name: "value";
1168
- readonly type: "uint256";
1169
- readonly indexed: false;
1170
- }];
1171
- readonly anonymous: false;
1172
- }, {
1173
- readonly type: "event";
1174
- readonly name: "Transfer";
1175
- readonly inputs: readonly [{
1176
- readonly name: "from";
1177
- readonly type: "address";
1178
- readonly indexed: true;
1179
- }, {
1180
- readonly name: "to";
1181
- readonly type: "address";
1182
- readonly indexed: true;
1183
- }, {
1184
- readonly name: "value";
1185
- readonly type: "uint256";
1186
- readonly indexed: false;
1187
- }];
1188
- readonly anonymous: false;
1189
- }];
1190
-
1191
222
  declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
1192
223
  type FormatAmountOptions = {
1193
224
  maxFractionDigits?: AssetDecimals;
@@ -1342,21 +373,4 @@ declare class MathError extends Error {
1342
373
  constructor(message: string);
1343
374
  }
1344
375
 
1345
- type UserDto = {
1346
- id: string;
1347
- email: string;
1348
- };
1349
-
1350
- type UserId = Newtype<string, 'UserId'>;
1351
- declare const UserId: (value: string) => UserId;
1352
- type UserEmail = Newtype<string, 'UserEmail'>;
1353
- declare const UserEmail: (value: string) => UserEmail;
1354
- type User = {
1355
- id: UserId;
1356
- email: UserEmail;
1357
- };
1358
- declare const User: {
1359
- fromDto: (dto: UserDto) => User;
1360
- };
1361
-
1362
- export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, CENTRIFUGE_POLL_INTERVAL_MS, type CentrifugeVault, CentrifugeVaultOfferDetail, type CentrifugeVaultResolution, 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, HttpError, InvariantError, KnownAssetSymbol, MathError, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_NOT_TRADABLE_CODE, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_MAX_TTL_MS, ONDO_SETTLEMENT_ASSET, ONDO_SUPPORTED_INPUT_ASSETS, OfferSwapContract, OfferToken, OndoBuyTransaction, OndoSellTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SWAP_LEVEL, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TokenMetadata, 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, formatShareAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isOndoNotTradableError, isSwapAvailable, ondoQuoteOfferDeadline, parseBlockchainAmount, resolveCentrifugeVaults, shortenAddress, superstateSwapContractAddress, swapSpender, txExplorerUrl, usdAmount, viemChain };
376
+ export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BlockchainAmount, Bps, ClientId, CodeChallenge, CodeVerifier, DEFAULT_SLIPPAGE_BPS, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, HttpError, type HttpResponse, InvariantError, KnownAssetSymbol, MathError, NA_AMOUNT_ASSET_UI, NotAuthenticatedError, NotImplementedError, OfferSwapContract, OndoBuyTransaction, OndoSellTransaction, type PKCEConfig, type PKCEParams, PKCEState, RedirectUri, RequestId, SLIPPAGE_OPTIONS_BPS, SWAP_LEVEL, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, ValidationError, apiErrorCode, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoBuyPrice, computeOndoSellPrice, computePrice, computeSlip, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formatShareAmount, formattedPricePerShare, formattedUsdPrice, generatePKCEParams, getChainId, getNetworkName, isOndoNotTradableError, isSwapAvailable, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, swapSpender, txExplorerUrl, usdAmount, viemChain };