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

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