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

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-MJ6YXZWH.js +22 -0
  3. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  4. package/dist/{chunk-VH34YC3Q.js → chunk-PWGUKS4Q.js} +199 -186
  5. package/dist/chunk-PWGUKS4Q.js.map +1 -0
  6. package/dist/{chunk-DCW7NQXH.js → chunk-QTBEDN7C.js} +52 -19
  7. package/dist/chunk-QTBEDN7C.js.map +1 -0
  8. package/dist/{chunk-MOE5S6CE.js → chunk-SVPFFLIT.js} +1314 -796
  9. package/dist/chunk-SVPFFLIT.js.map +1 -0
  10. package/dist/client/index.d.ts +3332 -4554
  11. package/dist/client/index.js +7374 -4387
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.d.ts +69 -71
  14. package/dist/server/index.js +327 -67
  15. package/dist/server/index.js.map +1 -1
  16. package/dist/{tokens-namespace-CIWBtgt2.d.cts → time-BDzqB806.d.ts} +1901 -2491
  17. package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-cvLsnMo_.d.ts} +74 -42
  18. package/dist/universal/index.d.ts +100 -1001
  19. package/dist/universal/index.js +52 -36
  20. package/package.json +18 -14
  21. package/dist/chunk-DCW7NQXH.js.map +0 -1
  22. package/dist/chunk-MOE5S6CE.js.map +0 -1
  23. package/dist/chunk-VH34YC3Q.js.map +0 -1
  24. package/dist/client/index.cjs +0 -16840
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -6592
  27. package/dist/server/index.cjs +0 -3878
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -354
  30. package/dist/token-registry-snapshot-BNBNuDu1.d.ts +0 -179
  31. package/dist/tokens-namespace-CIWBtgt2.d.ts +0 -3301
  32. package/dist/universal/index.cjs +0 -4028
  33. package/dist/universal/index.cjs.map +0 -1
  34. package/dist/universal/index.d.cts +0 -1276
@@ -1,85 +1,92 @@
1
- import { au as PaginationParams, av as PaginatedResponse, aw as DecimalString, x as StablecoinSymbol, j as OndoBuyTransaction, B as BlockchainAmount, k as OndoSellTransaction, p as Bps, ax as SwapStatus, a0 as AssetDecimals, b as EvmContractAddress, a as EthereumChain, i as OfferSwapContract, ay as Uint256, h as AssetSymbol, q as EvmWalletAddress, az as KnownAssetSymbol, y as Erc20Asset, aA as Newtype } from '../tokens-namespace-CIWBtgt2.js';
2
- export { aB as AllowWalletParams, aC as AllowWalletResponse, aD as Asset, aE as AssetCode, e as AssetId, A as AuthorizationCode, aF as Blockchain, a1 as BuildOndoBuyParams, a2 as BuildOndoSellParams, aG as BuildOndoSwapParamsCore, aH as Chain, ar as ClientCredentialsOAuth, aI as ClientId, as as ClientSecret, aJ as CodeChallenge, C as CodeVerifier, c as CoinListTokenSaleNamespace, f as CoinListTokenSaleNamespaceImpl, aK as CoinListTokenSaleOffer, H as CoinListTokenSaleOfferDetail, u as Config, aL as ConnectExternalWalletParams, aM as CreateKycTokenParams, aN as CreateParticipationParams, aO as CreateWalletOwnershipChallengeParams, aP as Cursor, a8 as DebugEvent, aQ as DocumentFormType, Y as DocumentSubmission, aR as DocumentSubmissionStatus, aS as DocumentType, aT as ETHEREUM_CHAINS, E as Erc20Namespace, aU as Erc20NamespaceImpl, aV as FaqItem, a9 as FrontlineEventId, aW as GetOndoQuoteParams, aX as GetOndoTradingStatusParams, aY as GetSwapAuthorizationParams, aZ as GetSwapPreviewParams, a_ as GetTokenAllowanceParams, a$ as GetTokenBalanceParams, b0 as HexEncodedTransactionData, aa as HttpError, ab as HttpResponse, b1 as Isin, b2 as Iso2CountryCode, X as KycLevelName, ac as KycToken, b3 as Link, b4 as ListOptionAddressesParams, ad as LogBinding, ae as LogBindings, af as LogCause, ag as LogLevel, ah as LogScope, ai as LogValue, L as Logger, b5 as MAX_ASSET_DECIMALS, b6 as MAX_UINT_256, b7 as Milestone, v as OAuthAccessToken, b8 as OAuthRefreshToken, aq as OAuthSession, J as Offer, b9 as OfferBase, z as OfferDetail, ba as OfferDetailBase, bb as OfferEditorial, O as OfferId, bc as OfferOption, Q as OfferOptionAddress, a6 as OfferOptionAddressId, d as OfferOptionId, bd as OfferOptionSlug, be as OfferSlug, bf as OfferToken, F as OfferType, w as OffersNamespace, bg as OffersNamespaceImpl, g as OndoNamespace, n as OndoNamespaceImpl, a3 as OndoQuote, bh as OndoQuoteDuration, a4 as OndoQuoteSize, bi as OndoSellOutcome, bj as OndoSwapOffer, G as OndoSwapOfferDetail, l as OndoSwapTransactionCore, $ as OndoTradingStatus, m as OrderBookSide, bk as PKCEState, bl as PaginatedResponseDto, P as Participation, bm as ParticipationId, bn as ParticipationStatus, bo as ParticipationsPaginationParams, bp as PauseFlags, bq as Pii, br as PiiAddress, bs as PiiJurisdiction, bt as PiiKind, _ as PinoLoggerOptions, aj as ProductionLogLevel, bu as QueryParamValue, bv as QueryParamValues, ak as RedactedWalletError, bw as RedirectUri, bx as RemoveOptionAddressParams, al as RequestId, s as Requirement, by as RequirementActionNeededReason, V as RequirementId, K as RequirementStatusInfo, N as RequirementStatusValue, M as RequirementType, R as RequirementsNamespace, t as RequirementsNamespaceImpl, bz as RpcConfig, am as RpcFailureReason, bA as SOLANA_CHAINS, bB as STABLE_DECIMALS, an as SafeEvent, ao as SafeFields, bC as SolanaChain, bD as SubmitDocumentParams, S as SuperstateSwapNamespace, r as SuperstateSwapNamespaceImpl, bE as SuperstateSwapOffer, I as SuperstateSwapOfferDetail, bF as SwapContractRef, bG as SwapPreview, bH as TermItem, bI as Ticker, a5 as TokenIdentifier, a7 as TokenLogo, bJ as TokenLogoImage, bK as TokenLogoUrl, D as TokenMetadata, bL as TokenRole, T as TokensNamespace, bM as TokensNamespaceImpl, bN as Tx, ap as UnredactedFields, bO as WalletAddress, Z as WalletChallengeType, W as WalletError, bP as WalletOwnershipChallenge, bQ as WalletProtocol, o as WalletsNamespace, bR as WalletsNamespaceImpl, bS as apiErrorCode, bT as assertUint256, bU as isChain, bV as isOfferType, bW as parseUint256 } from '../tokens-namespace-CIWBtgt2.js';
3
- import { N as NonEmptyArray, S as SwapQuote, F as FormattedAmountAssetUi, T as TxExplorerUrl, e as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress } from '../token-registry-snapshot-BNBNuDu1.js';
4
- export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, d as EvmSigner, E as EvmWallet, P as PKCEConfig, f as PKCEParams, c as TokenRegistrySnapshot, W as WriteContractParams, g as generatePKCEParams, o as offerDisplayTokens } from '../token-registry-snapshot-BNBNuDu1.js';
5
- import { TransactionReceipt, Hash, Chain } from 'viem';
1
+ import { ak as RequestId, al as ClientId, am as RedirectUri, an as CodeChallenge, ao as PKCEState, C as CodeVerifier, j as OfferSwapContract, E as EthereumChain, b as EvmContractAddress, k as OndoBuyTransaction, B as BlockchainAmount, l as OndoSellTransaction, S as SwapQuote, p as Bps, ap as SwapStatus, a8 as AssetDecimals, a as AssetSymbol, q as EvmWalletAddress, aq as KnownAssetSymbol, I as Erc20Asset, H as StablecoinSymbol } from '../time-BDzqB806.js';
2
+ export { ar as AllowWalletParams, as as AllowWalletResponse, at as Asset, au as AssetCode, h as AssetId, N as AsyncOfferDetail, av as AsyncOfferType, A as AuthorizationCode, aw as BaseEvent, ax as Blockchain, a1 as BuildCentrifugeVaultBuyParams, a2 as BuildOndoBuyParams, a4 as BuildOndoSellParams, ay as BuildOndoSwapParamsCore, az as CentrifugeAssets, d as CentrifugeClaimDirection, aA as CentrifugeDepositPosition, e as CentrifugeNamespace, aB as CentrifugeOrderReason, aC as CentrifugeOrderability, aD as CentrifugeRedeemPosition, aE as CentrifugeShares, ab as CentrifugeVault, c as CentrifugeVaultBuyTransaction, aF as CentrifugeVaultClaimProceedsTransaction, aG as CentrifugeVaultClaimTransaction, aa as CentrifugeVaultLeg, K as CentrifugeVaultLegId, aH as CentrifugeVaultOffer, L as CentrifugeVaultOfferDetail, aI as CentrifugeVaultReason, a0 as CentrifugeVaultRef, aJ as CentrifugeVaultResolution, $ as CentrifugeVaultStatus, aK as CentrifugeVaultTransactionCore, aL as CentrifugeWalletParams, aM as Chain, ag as ClientCredentialsOAuth, aj as ClientSecret, i as CoinListTokenSaleNamespace, aN as CoinListTokenSaleOffer, J as CoinListTokenSaleOfferDetail, w as Config, aO as ConnectExternalWalletParams, aP as CreateKycTokenParams, aQ as CreateParticipationParams, aR as CreateWalletOwnershipChallengeParams, aS as Cursor, aT as DebugEvent, aU as DecimalString, aV as DocumentFormType, ad as DocumentSubmission, aW as DocumentSubmissionStatus, aX as DocumentType, aY as ETHEREUM_CHAINS, aZ as EpochMillis, z as Erc20Namespace, a_ as FaqItem, a$ as FrontlineEventId, b0 as GetCentrifugeVaultStatusParams, b1 as GetOndoQuoteParams, b2 as GetOndoTradingStatusParams, b3 as GetSwapAuthorizationParams, b4 as GetSwapPreviewParams, b5 as GetSwapQuoteParams, b6 as GetTokenAllowanceParams, b7 as GetTokenBalanceParams, b8 as HexEncodedTransactionData, b9 as Isin, ba as Iso2CountryCode, U as KycLevelName, bb as KycToken, bc as Link, bd as ListOptionAddressesParams, be as LogBinding, bf as LogBindings, bg as LogCause, bh as LogLevel, bi as LogScope, bj as LogValue, _ as Logger, bk as MAX_ASSET_DECIMALS, bl as MAX_UINT_256, bm as Milestone, bn as Millis, bo as Newtype, x as OAuthAccessToken, bp as OAuthRefreshToken, af as OAuthSession, D as Offer, bq as OfferBase, G as OfferDetail, br as OfferDetailBase, bs as OfferEditorial, f as OfferId, bt as OfferOption, u as OfferOptionAddress, ac as OfferOptionAddressId, g as OfferOptionId, bu as OfferOptionSlug, bv as OfferSlug, bw as OfferToken, bx as OfferType, O as OfferVaultContract, y as OffersNamespace, m as OndoNamespace, a5 as OndoQuote, by as OndoQuoteDuration, a6 as OndoQuoteSize, bz as OndoSellOutcome, bA as OndoSwapOffer, a3 as OndoSwapOfferDetail, n as OndoSwapTransactionCore, a7 as OndoTradingStatus, o as OrderBookSide, ai as PaginatedResponse, ah as PaginationParams, P as Participation, bB as ParticipationId, bC as ParticipationStatus, bD as ParticipationsPaginationParams, bE as PauseFlags, bF as Pii, bG as PiiAddress, bH as PiiJurisdiction, bI as PiiKind, Z as PinoLoggerOptions, bJ as ProductionLogLevel, bK as ReadCentrifugePositionParams, bL as RedactedWalletError, bM as RemoveOptionAddressParams, s as Requirement, bN as RequirementActionNeededReason, Y as RequirementId, Q as RequirementStatusInfo, X as RequirementStatusValue, V as RequirementType, R as RequirementsNamespace, bO as RpcConfig, bP as RpcFailureReason, bQ as SOLANA_CHAINS, bR as STABLE_DECIMALS, bS as SafeEvent, bT as SafeFields, M as Seconds, bU as SolanaChain, bV as SubmitDocumentParams, r as SuperstateSwapNamespace, bW as SuperstateSwapOffer, a9 as SuperstateSwapOfferDetail, bX as SwapContractRef, bY as SwapPreview, bZ as TermItem, b_ as Ticker, ae as TokenIdentifier, b$ as TokenLogo, c0 as TokenLogoImage, c1 as TokenLogoUrl, F as TokenMetadata, c2 as TokenRole, T as TokensNamespace, c3 as Tx, c4 as Uint256, c5 as UnredactedFields, c6 as WalletAddress, t as WalletChallengeType, W as WalletError, c7 as WalletOwnershipChallenge, c8 as WalletOwnershipChallengeParamsBase, c9 as WalletProtocol, v as WalletsNamespace, ca as assertUint256, cb as isChain, cc as isOfferType, cd as parseUint256, ce as resolveCentrifugeVaults } from '../time-BDzqB806.js';
3
+ import { F as FormattedAmountAssetUi, T as TxExplorerUrl, d as FormattedAmountUi, b as FormattedPercentUi, S as ShortenedWalletAddress } from '../token-registry-snapshot-cvLsnMo_.js';
4
+ export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, e as EvmSigner, E as EvmWallet, f as ExternalWalletAdapter, N as NonEmptyArray, g as TokenKey, c as TokenRegistrySnapshot, a as WalletLabelResolver, W as WalletSelection, h as WriteContractParams, o as offerDisplayTokens } from '../token-registry-snapshot-cvLsnMo_.js';
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.
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[]>;
17
-
18
- /**
19
- * How often the Ondo checkout refreshes what it is allowed to poll: the market
20
- * status and the indicative price. Both are free - neither spends an
21
- * attestation - so this is paced for a price the user can trust rather than
22
- * for cost.
23
- *
24
- * A built transaction is deliberately not on this timer. Building spends an
25
- * attestation, so it happens once per order and once per refresh the user
26
- * asks for.
27
- */
28
- declare const ONDO_POLL_INTERVAL_MS = 15000;
29
- /** Max time the review step offers a built quote. */
30
- declare const ONDO_QUOTE_MAX_TTL_MS = 15000;
31
- /**
32
- * The order size the sidebar prices against before the user names one.
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.
33
35
  *
34
- * Ondo prices by size, so some amount has to be sent. $1,000 is a plausible
35
- * order rather than a token one: a size so small that Ondo's minimum rejects
36
- * it would leave the panel permanently blank.
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.
37
40
  *
38
- * Named distinctly from `DEFAULT_AMOUNT_TO_COMPUTE_PRICE` in the swap
39
- * constants, which is a raw `bigint` of USDC base units for a different
40
- * endpoint. Both barrels are flat, so two constants of the same name could not
41
- * coexist - and they mean different things anyway.
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.
42
44
  */
43
- declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
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;
55
+ };
56
+ type PKCEConfig = {
57
+ clientId: ClientId;
58
+ redirectUri: RedirectUri;
59
+ };
44
60
  /**
45
- * The coin an Ondo sell settles into, for display only.
46
- *
47
- * The scale of every amount on a built transaction comes off the response, so
48
- * this names the token and never sizes it - `receive_output_decimals` is the
49
- * only authority on how many decimals the proceeds are counted in, and the two
50
- * are allowed to disagree.
51
- *
52
- * Named apart from {@link ONDO_SUPPORTED_INPUT_ASSETS} rather than read out of
53
- * it, though both are USDC today. On a buy USDC is what the user funds with
54
- * and one of a list that may grow; on a sell it is what they settle into and
55
- * there is one of it. Reading `ONDO_SUPPORTED_INPUT_ASSETS[0]` here would make
56
- * the sell screen quietly follow whichever funding coin happened to be listed
57
- * first.
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.
58
64
  */
59
- declare const ONDO_SETTLEMENT_ASSET: StablecoinSymbol;
65
+ declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
66
+
60
67
  /**
61
- * 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.
62
71
  *
63
- * Sells are quoted by token amount rather than by notional: the fee comes out
64
- * of dollars, and Ondo's price is size-aware, so a buy's quantity depends on
65
- * the quote being asked for while a sell is sized by what the user already
66
- * holds. One whole share is a size Ondo will price - small enough to be
67
- * plausible for any asset, large enough that Ondo's minimum does not reject it
68
- * 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.
69
77
  *
70
- * The buy counterpart is {@link DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE}, which
71
- * is a dollar figure for the same reason in reverse.
72
- */
73
- declare const DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
74
- /**
75
- * The coins an Ondo buy can be funded with, in display order, with the first
76
- * 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.
77
82
  *
78
- * USDC alone today: it is what the Sepolia integration contract accepts. The
79
- * amount step renders a single entry as a plain card and two or more as a
80
- * 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.
81
88
  */
82
- declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
89
+ declare function swapSpender(swapContracts: OfferSwapContract[], chain: EthereumChain): EvmContractAddress | null;
83
90
 
84
91
  /**
85
92
  * The price of one whole asset token in a built Ondo purchase, in the funding
@@ -126,696 +133,15 @@ declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): Blockchai
126
133
  * does today. They diverge the day ENG-1718 lands.
127
134
  */
128
135
  declare function computeOndoSellPrice(transaction: OndoSellTransaction): BlockchainAmount;
129
- /** The sooner of Ondo's deadline and now + {@link ONDO_QUOTE_MAX_TTL_MS}. */
130
- declare function ondoQuoteOfferDeadline(expiresAt: Date, nowMs?: number): Date;
131
136
 
132
137
  /**
133
- * The Superstate swap contract's ABI, generated verbatim from the shared
134
- * `TokenSwap` base contract:
138
+ * Whether `error` is the CoinList API refusing an Ondo quote because the
139
+ * market is not open, as opposed to a request that failed.
135
140
  *
136
- * ```
137
- * cd ../solidity && forge inspect TokenSwap abi --json --use 0.8.34
138
- * ```
139
- *
140
- * Generated rather than hand-trimmed to the four methods the SDK calls, so
141
- * regenerating after a contract change is one command and a paste. The custom
142
- * errors carry their weight in particular: viem decodes a revert against them,
143
- * so a `preview()` on a stopped contract surfaces as `IsStopped` rather than
144
- * as an opaque `0x`-prefixed blob.
145
- *
146
- * `status()` returns `Status { uint32 flags; State state }` where `State` is
147
- * `0 = Active | 1 = Paused | 2 = Stopped`. It replaced the older
148
- * `stopped() -> uint256` bitmask, which this contract still exposes but as a
149
- * `bool`; {@link SwapStatus} reads `status()` and nothing else.
141
+ * Total: anything that is not an `HttpError` carrying
142
+ * {@link ONDO_NOT_TRADABLE_CODE} is `false`.
150
143
  */
151
- declare const SUPERSTATE_SWAP_ABI: readonly [{
152
- readonly type: "function";
153
- readonly name: "KIND";
154
- readonly inputs: readonly [];
155
- readonly outputs: readonly [{
156
- readonly name: "";
157
- readonly type: "uint16";
158
- readonly internalType: "uint16";
159
- }];
160
- readonly stateMutability: "view";
161
- }, {
162
- readonly type: "function";
163
- readonly name: "ONE_HUNDRED_P";
164
- readonly inputs: readonly [];
165
- readonly outputs: readonly [{
166
- readonly name: "";
167
- readonly type: "uint256";
168
- readonly internalType: "uint256";
169
- }];
170
- readonly stateMutability: "view";
171
- }, {
172
- readonly type: "function";
173
- readonly name: "SWAP_LEVEL";
174
- readonly inputs: readonly [];
175
- readonly outputs: readonly [{
176
- readonly name: "";
177
- readonly type: "uint32";
178
- readonly internalType: "uint32";
179
- }];
180
- readonly stateMutability: "view";
181
- }, {
182
- readonly type: "function";
183
- readonly name: "VERSION";
184
- readonly inputs: readonly [];
185
- readonly outputs: readonly [{
186
- readonly name: "";
187
- readonly type: "uint16";
188
- readonly internalType: "uint16";
189
- }];
190
- readonly stateMutability: "view";
191
- }, {
192
- readonly type: "function";
193
- readonly name: "authorized";
194
- readonly inputs: readonly [{
195
- readonly name: "user";
196
- readonly type: "address";
197
- readonly internalType: "address";
198
- }];
199
- readonly outputs: readonly [{
200
- readonly name: "";
201
- readonly type: "bool";
202
- readonly internalType: "bool";
203
- }];
204
- readonly stateMutability: "view";
205
- }, {
206
- readonly type: "function";
207
- readonly name: "bpp";
208
- readonly inputs: readonly [{
209
- readonly name: "amount";
210
- readonly type: "uint256";
211
- readonly internalType: "uint256";
212
- }];
213
- readonly outputs: readonly [{
214
- readonly name: "";
215
- readonly type: "uint256";
216
- readonly internalType: "uint256";
217
- }];
218
- readonly stateMutability: "view";
219
- }, {
220
- readonly type: "function";
221
- readonly name: "bps";
222
- readonly inputs: readonly [];
223
- readonly outputs: readonly [{
224
- readonly name: "";
225
- readonly type: "uint256";
226
- readonly internalType: "uint256";
227
- }];
228
- readonly stateMutability: "view";
229
- }, {
230
- readonly type: "function";
231
- readonly name: "cancelOwnershipHandover";
232
- readonly inputs: readonly [];
233
- readonly outputs: readonly [];
234
- readonly stateMutability: "payable";
235
- }, {
236
- readonly type: "function";
237
- readonly name: "completeOwnershipHandover";
238
- readonly inputs: readonly [{
239
- readonly name: "pendingOwner";
240
- readonly type: "address";
241
- readonly internalType: "address";
242
- }];
243
- readonly outputs: readonly [];
244
- readonly stateMutability: "payable";
245
- }, {
246
- readonly type: "function";
247
- readonly name: "fee";
248
- readonly inputs: readonly [{
249
- readonly name: "amount";
250
- readonly type: "uint256";
251
- readonly internalType: "uint256";
252
- }];
253
- readonly outputs: readonly [{
254
- readonly name: "";
255
- readonly type: "uint256";
256
- readonly internalType: "uint256";
257
- }, {
258
- readonly name: "";
259
- readonly type: "uint256";
260
- readonly internalType: "uint256";
261
- }];
262
- readonly stateMutability: "view";
263
- }, {
264
- readonly type: "function";
265
- readonly name: "id";
266
- readonly inputs: readonly [];
267
- readonly outputs: readonly [{
268
- readonly name: "";
269
- readonly type: "bytes32";
270
- readonly internalType: "bytes32";
271
- }];
272
- readonly stateMutability: "view";
273
- }, {
274
- readonly type: "function";
275
- readonly name: "inputTokens";
276
- readonly inputs: readonly [{
277
- readonly name: "";
278
- readonly type: "address";
279
- readonly internalType: "address";
280
- }];
281
- readonly outputs: readonly [{
282
- readonly name: "";
283
- readonly type: "bool";
284
- readonly internalType: "bool";
285
- }];
286
- readonly stateMutability: "view";
287
- }, {
288
- readonly type: "function";
289
- readonly name: "outputToken";
290
- readonly inputs: readonly [];
291
- readonly outputs: readonly [{
292
- readonly name: "";
293
- readonly type: "address";
294
- readonly internalType: "address";
295
- }];
296
- readonly stateMutability: "view";
297
- }, {
298
- readonly type: "function";
299
- readonly name: "outputTokenBalance";
300
- readonly inputs: readonly [];
301
- readonly outputs: readonly [{
302
- readonly name: "";
303
- readonly type: "uint256";
304
- readonly internalType: "uint256";
305
- }];
306
- readonly stateMutability: "view";
307
- }, {
308
- readonly type: "function";
309
- readonly name: "owner";
310
- readonly inputs: readonly [];
311
- readonly outputs: readonly [{
312
- readonly name: "result";
313
- readonly type: "address";
314
- readonly internalType: "address";
315
- }];
316
- readonly stateMutability: "view";
317
- }, {
318
- readonly type: "function";
319
- readonly name: "ownershipHandoverExpiresAt";
320
- readonly inputs: readonly [{
321
- readonly name: "pendingOwner";
322
- readonly type: "address";
323
- readonly internalType: "address";
324
- }];
325
- readonly outputs: readonly [{
326
- readonly name: "result";
327
- readonly type: "uint256";
328
- readonly internalType: "uint256";
329
- }];
330
- readonly stateMutability: "view";
331
- }, {
332
- readonly type: "function";
333
- readonly name: "pause";
334
- readonly inputs: readonly [{
335
- readonly name: "level";
336
- readonly type: "uint32";
337
- readonly internalType: "uint32";
338
- }];
339
- readonly outputs: readonly [{
340
- readonly name: "";
341
- readonly type: "bool";
342
- readonly internalType: "bool";
343
- }];
344
- readonly stateMutability: "nonpayable";
345
- }, {
346
- readonly type: "function";
347
- readonly name: "paused";
348
- readonly inputs: readonly [];
349
- readonly outputs: readonly [{
350
- readonly name: "";
351
- readonly type: "uint32";
352
- readonly internalType: "uint32";
353
- }];
354
- readonly stateMutability: "view";
355
- }, {
356
- readonly type: "function";
357
- readonly name: "preview";
358
- readonly inputs: readonly [{
359
- readonly name: "token";
360
- readonly type: "address";
361
- readonly internalType: "address";
362
- }, {
363
- readonly name: "amount";
364
- readonly type: "uint256";
365
- readonly internalType: "uint256";
366
- }];
367
- readonly outputs: readonly [{
368
- readonly name: "";
369
- readonly type: "tuple";
370
- readonly internalType: "struct Preview";
371
- readonly components: readonly [{
372
- readonly name: "input";
373
- readonly type: "uint256";
374
- readonly internalType: "uint256";
375
- }, {
376
- readonly name: "fee";
377
- readonly type: "uint256";
378
- readonly internalType: "uint256";
379
- }, {
380
- readonly name: "output";
381
- readonly type: "uint256";
382
- readonly internalType: "uint256";
383
- }];
384
- }];
385
- readonly stateMutability: "view";
386
- }, {
387
- readonly type: "function";
388
- readonly name: "renounceOwnership";
389
- readonly inputs: readonly [];
390
- readonly outputs: readonly [];
391
- readonly stateMutability: "payable";
392
- }, {
393
- readonly type: "function";
394
- readonly name: "requestOwnershipHandover";
395
- readonly inputs: readonly [];
396
- readonly outputs: readonly [];
397
- readonly stateMutability: "payable";
398
- }, {
399
- readonly type: "function";
400
- readonly name: "setBps";
401
- readonly inputs: readonly [{
402
- readonly name: "points";
403
- readonly type: "uint256";
404
- readonly internalType: "uint256";
405
- }];
406
- readonly outputs: readonly [{
407
- readonly name: "";
408
- readonly type: "bool";
409
- readonly internalType: "bool";
410
- }];
411
- readonly stateMutability: "nonpayable";
412
- }, {
413
- readonly type: "function";
414
- readonly name: "setInputToken";
415
- readonly inputs: readonly [{
416
- readonly name: "token";
417
- readonly type: "address";
418
- readonly internalType: "address";
419
- }, {
420
- readonly name: "val";
421
- readonly type: "bool";
422
- readonly internalType: "bool";
423
- }];
424
- readonly outputs: readonly [{
425
- readonly name: "";
426
- readonly type: "bool";
427
- readonly internalType: "bool";
428
- }];
429
- readonly stateMutability: "nonpayable";
430
- }, {
431
- readonly type: "function";
432
- readonly name: "status";
433
- readonly inputs: readonly [];
434
- readonly outputs: readonly [{
435
- readonly name: "";
436
- readonly type: "tuple";
437
- readonly internalType: "struct Status";
438
- readonly components: readonly [{
439
- readonly name: "flags";
440
- readonly type: "uint32";
441
- readonly internalType: "uint32";
442
- }, {
443
- readonly name: "state";
444
- readonly type: "uint8";
445
- readonly internalType: "enum State";
446
- }];
447
- }];
448
- readonly stateMutability: "view";
449
- }, {
450
- readonly type: "function";
451
- readonly name: "stop";
452
- readonly inputs: readonly [];
453
- readonly outputs: readonly [{
454
- readonly name: "";
455
- readonly type: "bool";
456
- readonly internalType: "bool";
457
- }];
458
- readonly stateMutability: "nonpayable";
459
- }, {
460
- readonly type: "function";
461
- readonly name: "stopped";
462
- readonly inputs: readonly [];
463
- readonly outputs: readonly [{
464
- readonly name: "";
465
- readonly type: "bool";
466
- readonly internalType: "bool";
467
- }];
468
- readonly stateMutability: "view";
469
- }, {
470
- readonly type: "function";
471
- readonly name: "swap";
472
- readonly inputs: readonly [{
473
- readonly name: "token";
474
- readonly type: "address";
475
- readonly internalType: "address";
476
- }, {
477
- readonly name: "amount";
478
- readonly type: "uint256";
479
- readonly internalType: "uint256";
480
- }, {
481
- readonly name: "slip";
482
- readonly type: "uint256";
483
- readonly internalType: "uint256";
484
- }];
485
- readonly outputs: readonly [{
486
- readonly name: "";
487
- readonly type: "uint256";
488
- readonly internalType: "uint256";
489
- }];
490
- readonly stateMutability: "nonpayable";
491
- }, {
492
- readonly type: "function";
493
- readonly name: "tokenBalance";
494
- readonly inputs: readonly [{
495
- readonly name: "token";
496
- readonly type: "address";
497
- readonly internalType: "address";
498
- }];
499
- readonly outputs: readonly [{
500
- readonly name: "";
501
- readonly type: "uint256";
502
- readonly internalType: "uint256";
503
- }];
504
- readonly stateMutability: "view";
505
- }, {
506
- readonly type: "function";
507
- readonly name: "totals";
508
- readonly inputs: readonly [{
509
- readonly name: "user";
510
- readonly type: "address";
511
- readonly internalType: "address";
512
- }, {
513
- readonly name: "token";
514
- readonly type: "address";
515
- readonly internalType: "address";
516
- }];
517
- readonly outputs: readonly [{
518
- readonly name: "";
519
- readonly type: "tuple";
520
- readonly internalType: "struct SwapTotal";
521
- readonly components: readonly [{
522
- readonly name: "inputSum";
523
- readonly type: "uint256";
524
- readonly internalType: "uint256";
525
- }, {
526
- readonly name: "feeSum";
527
- readonly type: "uint256";
528
- readonly internalType: "uint256";
529
- }, {
530
- readonly name: "outputSum";
531
- readonly type: "uint256";
532
- readonly internalType: "uint256";
533
- }, {
534
- readonly name: "count";
535
- readonly type: "uint256";
536
- readonly internalType: "uint256";
537
- }];
538
- }];
539
- readonly stateMutability: "view";
540
- }, {
541
- readonly type: "function";
542
- readonly name: "totals";
543
- readonly inputs: readonly [{
544
- readonly name: "token";
545
- readonly type: "address";
546
- readonly internalType: "address";
547
- }];
548
- readonly outputs: readonly [{
549
- readonly name: "";
550
- readonly type: "tuple";
551
- readonly internalType: "struct SwapTotal";
552
- readonly components: readonly [{
553
- readonly name: "inputSum";
554
- readonly type: "uint256";
555
- readonly internalType: "uint256";
556
- }, {
557
- readonly name: "feeSum";
558
- readonly type: "uint256";
559
- readonly internalType: "uint256";
560
- }, {
561
- readonly name: "outputSum";
562
- readonly type: "uint256";
563
- readonly internalType: "uint256";
564
- }, {
565
- readonly name: "count";
566
- readonly type: "uint256";
567
- readonly internalType: "uint256";
568
- }];
569
- }];
570
- readonly stateMutability: "view";
571
- }, {
572
- readonly type: "function";
573
- readonly name: "transfer";
574
- readonly inputs: readonly [{
575
- readonly name: "to";
576
- readonly type: "address";
577
- readonly internalType: "address";
578
- }, {
579
- readonly name: "amount";
580
- readonly type: "uint256";
581
- readonly internalType: "uint256";
582
- }];
583
- readonly outputs: readonly [{
584
- readonly name: "";
585
- readonly type: "bool";
586
- readonly internalType: "bool";
587
- }];
588
- readonly stateMutability: "nonpayable";
589
- }, {
590
- readonly type: "function";
591
- readonly name: "transfer";
592
- readonly inputs: readonly [{
593
- readonly name: "to";
594
- readonly type: "address";
595
- readonly internalType: "address";
596
- }, {
597
- readonly name: "token";
598
- readonly type: "address";
599
- readonly internalType: "address";
600
- }, {
601
- readonly name: "amount";
602
- readonly type: "uint256";
603
- readonly internalType: "uint256";
604
- }];
605
- readonly outputs: readonly [{
606
- readonly name: "";
607
- readonly type: "bool";
608
- readonly internalType: "bool";
609
- }];
610
- readonly stateMutability: "nonpayable";
611
- }, {
612
- readonly type: "function";
613
- readonly name: "transferOwnership";
614
- readonly inputs: readonly [{
615
- readonly name: "newOwner";
616
- readonly type: "address";
617
- readonly internalType: "address";
618
- }];
619
- readonly outputs: readonly [];
620
- readonly stateMutability: "payable";
621
- }, {
622
- readonly type: "event";
623
- readonly name: "BpsUpdated";
624
- readonly inputs: readonly [{
625
- readonly name: "prev";
626
- readonly type: "uint256";
627
- readonly indexed: false;
628
- readonly internalType: "uint256";
629
- }, {
630
- readonly name: "next";
631
- readonly type: "uint256";
632
- readonly indexed: false;
633
- readonly internalType: "uint256";
634
- }];
635
- readonly anonymous: false;
636
- }, {
637
- readonly type: "event";
638
- readonly name: "InputTokenUpdated";
639
- readonly inputs: readonly [{
640
- readonly name: "token";
641
- readonly type: "address";
642
- readonly indexed: true;
643
- readonly internalType: "address";
644
- }, {
645
- readonly name: "prev";
646
- readonly type: "bool";
647
- readonly indexed: false;
648
- readonly internalType: "bool";
649
- }, {
650
- readonly name: "next";
651
- readonly type: "bool";
652
- readonly indexed: false;
653
- readonly internalType: "bool";
654
- }];
655
- readonly anonymous: false;
656
- }, {
657
- readonly type: "event";
658
- readonly name: "OwnershipHandoverCanceled";
659
- readonly inputs: readonly [{
660
- readonly name: "pendingOwner";
661
- readonly type: "address";
662
- readonly indexed: true;
663
- readonly internalType: "address";
664
- }];
665
- readonly anonymous: false;
666
- }, {
667
- readonly type: "event";
668
- readonly name: "OwnershipHandoverRequested";
669
- readonly inputs: readonly [{
670
- readonly name: "pendingOwner";
671
- readonly type: "address";
672
- readonly indexed: true;
673
- readonly internalType: "address";
674
- }];
675
- readonly anonymous: false;
676
- }, {
677
- readonly type: "event";
678
- readonly name: "OwnershipTransferred";
679
- readonly inputs: readonly [{
680
- readonly name: "oldOwner";
681
- readonly type: "address";
682
- readonly indexed: true;
683
- readonly internalType: "address";
684
- }, {
685
- readonly name: "newOwner";
686
- readonly type: "address";
687
- readonly indexed: true;
688
- readonly internalType: "address";
689
- }];
690
- readonly anonymous: false;
691
- }, {
692
- readonly type: "event";
693
- readonly name: "Paused";
694
- readonly inputs: readonly [{
695
- readonly name: "previous";
696
- readonly type: "uint32";
697
- readonly indexed: false;
698
- readonly internalType: "uint32";
699
- }, {
700
- readonly name: "next";
701
- readonly type: "uint32";
702
- readonly indexed: false;
703
- readonly internalType: "uint32";
704
- }];
705
- readonly anonymous: false;
706
- }, {
707
- readonly type: "event";
708
- readonly name: "Stopped";
709
- readonly inputs: readonly [];
710
- readonly anonymous: false;
711
- }, {
712
- readonly type: "event";
713
- readonly name: "Swapped";
714
- readonly inputs: readonly [{
715
- readonly name: "user";
716
- readonly type: "address";
717
- readonly indexed: true;
718
- readonly internalType: "address";
719
- }, {
720
- readonly name: "inputToken";
721
- readonly type: "address";
722
- readonly indexed: true;
723
- readonly internalType: "address";
724
- }, {
725
- readonly name: "outputToken";
726
- readonly type: "address";
727
- readonly indexed: true;
728
- readonly internalType: "address";
729
- }, {
730
- readonly name: "inputAmount";
731
- readonly type: "uint256";
732
- readonly indexed: false;
733
- readonly internalType: "uint256";
734
- }, {
735
- readonly name: "fee";
736
- readonly type: "uint256";
737
- readonly indexed: false;
738
- readonly internalType: "uint256";
739
- }, {
740
- readonly name: "outputAmount";
741
- readonly type: "uint256";
742
- readonly indexed: false;
743
- readonly internalType: "uint256";
744
- }];
745
- readonly anonymous: false;
746
- }, {
747
- readonly type: "event";
748
- readonly name: "Transferred";
749
- readonly inputs: readonly [{
750
- readonly name: "to";
751
- readonly type: "address";
752
- readonly indexed: true;
753
- readonly internalType: "address";
754
- }, {
755
- readonly name: "token";
756
- readonly type: "address";
757
- readonly indexed: true;
758
- readonly internalType: "address";
759
- }, {
760
- readonly name: "amount";
761
- readonly type: "uint256";
762
- readonly indexed: false;
763
- readonly internalType: "uint256";
764
- }];
765
- readonly anonymous: false;
766
- }, {
767
- readonly type: "error";
768
- readonly name: "AlreadyInitialized";
769
- readonly inputs: readonly [];
770
- }, {
771
- readonly type: "error";
772
- readonly name: "InsufficientAmount";
773
- readonly inputs: readonly [];
774
- }, {
775
- readonly type: "error";
776
- readonly name: "InvalidAddress";
777
- readonly inputs: readonly [];
778
- }, {
779
- readonly type: "error";
780
- readonly name: "InvalidAmount";
781
- readonly inputs: readonly [];
782
- }, {
783
- readonly type: "error";
784
- readonly name: "IsPaused";
785
- readonly inputs: readonly [{
786
- readonly name: "level";
787
- readonly type: "uint32";
788
- readonly internalType: "uint32";
789
- }];
790
- }, {
791
- readonly type: "error";
792
- readonly name: "IsStopped";
793
- readonly inputs: readonly [];
794
- }, {
795
- readonly type: "error";
796
- readonly name: "NewOwnerIsZeroAddress";
797
- readonly inputs: readonly [];
798
- }, {
799
- readonly type: "error";
800
- readonly name: "NoHandoverRequest";
801
- readonly inputs: readonly [];
802
- }, {
803
- readonly type: "error";
804
- readonly name: "SwapFailed";
805
- readonly inputs: readonly [{
806
- readonly name: "user";
807
- readonly type: "address";
808
- readonly internalType: "address";
809
- }, {
810
- readonly name: "token";
811
- readonly type: "address";
812
- readonly internalType: "address";
813
- }];
814
- }, {
815
- readonly type: "error";
816
- readonly name: "Unauthorized";
817
- readonly inputs: readonly [];
818
- }];
144
+ declare function isOndoNotTradableError(error: unknown): error is HttpError;
819
145
 
820
146
  /**
821
147
  * Price of 1 output token in USD, assuming the input token is a $1 stablecoin.
@@ -854,52 +180,10 @@ declare const SWAP_LEVEL = 2;
854
180
  */
855
181
  declare function isSwapAvailable(status: SwapStatus): boolean;
856
182
 
857
- /**
858
- * Decodes the confirmed output amount from the `Swapped` event in a swap
859
- * transaction receipt.
860
- *
861
- * Returns `null` when the event is absent or the amount is not a valid uint256
862
- * so callers can fall back to the quote's expected output — the swap already
863
- * confirmed on-chain, so a missing/undecodable event should not fail the flow.
864
- */
865
- declare function decodeSwappedOutputAmount(receipt: TransactionReceipt, outputDecimals: AssetDecimals): BlockchainAmount | null;
866
-
867
- /**
868
- * Who issues the asset a Superstate swap pays out.
869
- *
870
- * A constant rather than a field off the offer: no frontline endpoint carries
871
- * an issuer, and every offer this checkout serves is Superstate's by
872
- * definition — `CheckoutContainer` routes here on `superstate::swap` alone.
873
- */
874
- declare const SUPERSTATE_ISSUER_NAME = "Superstate";
875
- /**
876
- * The coins a Superstate swap can be funded with, in display order, with the
877
- * first preselected.
878
- *
879
- * USDC alone today: it is what the deployed swap contract accepts. The amount
880
- * step renders a single entry as a plain card and two or more as a picker, so
881
- * adding one here is all it takes.
882
- */
883
- declare const SUPERSTATE_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
884
- /** Poll interval for refreshing on-chain swap quotes and balances. */
885
- declare const SWAP_POLL_INTERVAL_MS = 15000;
886
- /**
887
- * Notional input used to derive a display price-per-share when the user has
888
- * not yet entered an amount (1 USDC at 6 decimals).
889
- */
890
- declare const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
891
183
  /** Slippage tolerances offered in the review step, in basis points. */
892
184
  declare const SLIPPAGE_OPTIONS_BPS: Bps[];
893
185
  /** Default slippage tolerance (0.5%). */
894
186
  declare const DEFAULT_SLIPPAGE_BPS: Bps;
895
- /**
896
- * The deployed Superstate swap contract on Ethereum Sepolia, and therefore the
897
- * ERC-20 spender the user approves there.
898
- *
899
- * Exported in its own right for a partner driving `coinlist.superstate.execute`
900
- * at Level 1, where the contract is an explicit parameter.
901
- */
902
- declare const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress;
903
187
  /**
904
188
  * The Superstate swap contract on `chain`, or `null` where none is deployed.
905
189
  *
@@ -920,39 +204,6 @@ declare function superstateSwapContractAddress(chain: EthereumChain): EvmContrac
920
204
  */
921
205
  declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
922
206
 
923
- /**
924
- * The CoinList contract a swap on `chain` settles through, and therefore the
925
- * ERC-20 spender the user approves - or `null` where this offer cannot be
926
- * swapped on that chain.
927
- *
928
- * Read off the offer rather than held as a constant because the address varies
929
- * by environment, not only by chain: beta and production both run
930
- * `ethereum_sepolia` and deploy a different contract on each, and one constant
931
- * cannot name both. Frontline resolves it per environment and serves the
932
- * answer on the offer.
933
- *
934
- * The array varies per *offer* as well as per chain - frontline drops a chain
935
- * whose funding and swap tokens do not both resolve for this asset - so an
936
- * array read for one symbol must not be reused for another. An empty array
937
- * means "cannot swap here", which is an answer rather than an error.
938
- *
939
- * A capability rather than a provider slice, and named for the data it reads
940
- * rather than for its first caller: `swap_contracts` is an offer field, and
941
- * `universal-core-isolation-and-sharing` would stop Superstate reusing this if
942
- * it lived under `checkout/ondo/`. Superstate has not migrated yet - it still
943
- * reads `superstateSwapContractAddress` - so Ondo is the only caller today.
944
- */
945
- declare function swapSpender(swapContracts: OfferSwapContract[], chain: EthereumChain): EvmContractAddress | null;
946
-
947
- /** Basis-point denominator: 10_000 bps = 100%. */
948
- declare const BPS_DENOM: Bps;
949
- /**
950
- * Applies a basis-point fraction to an amount, flooring the result.
951
- * `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an
952
- * overflow (bps far above BPS_DENOM) or a negative product is rejected.
953
- */
954
- declare function applyBps(amount: Uint256, bps: Bps): Uint256;
955
-
956
207
  /** The viem chain definition the SDK reads and writes this chain through. */
957
208
  declare function viemChain(chain: EthereumChain): Chain;
958
209
  declare function getChainId(chain: EthereumChain): number;
@@ -967,161 +218,16 @@ declare function chainFromId(chainId: string): EthereumChain;
967
218
  declare function getNetworkName(chain: EthereumChain): string;
968
219
  declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
969
220
 
970
- /**
971
- * Minimal ERC-20 ABI the SDK writes against (mirrors viem's `erc20Abi`). The
972
- * swap flow uses `approve`; `allowance`/`balanceOf`/`decimals`/`symbol`/`name`
973
- * are included so reads share a single SDK-owned ABI.
974
- */
975
- declare const ERC20_ABI: readonly [{
976
- readonly type: "function";
977
- readonly name: "allowance";
978
- readonly inputs: readonly [{
979
- readonly name: "owner";
980
- readonly type: "address";
981
- }, {
982
- readonly name: "spender";
983
- readonly type: "address";
984
- }];
985
- readonly outputs: readonly [{
986
- readonly name: "";
987
- readonly type: "uint256";
988
- }];
989
- readonly stateMutability: "view";
990
- }, {
991
- readonly type: "function";
992
- readonly name: "approve";
993
- readonly inputs: readonly [{
994
- readonly name: "spender";
995
- readonly type: "address";
996
- }, {
997
- readonly name: "amount";
998
- readonly type: "uint256";
999
- }];
1000
- readonly outputs: readonly [{
1001
- readonly name: "";
1002
- readonly type: "bool";
1003
- }];
1004
- readonly stateMutability: "nonpayable";
1005
- }, {
1006
- readonly type: "function";
1007
- readonly name: "balanceOf";
1008
- readonly inputs: readonly [{
1009
- readonly name: "account";
1010
- readonly type: "address";
1011
- }];
1012
- readonly outputs: readonly [{
1013
- readonly name: "";
1014
- readonly type: "uint256";
1015
- }];
1016
- readonly stateMutability: "view";
1017
- }, {
1018
- readonly type: "function";
1019
- readonly name: "decimals";
1020
- readonly inputs: readonly [];
1021
- readonly outputs: readonly [{
1022
- readonly name: "";
1023
- readonly type: "uint8";
1024
- }];
1025
- readonly stateMutability: "view";
1026
- }, {
1027
- readonly type: "function";
1028
- readonly name: "name";
1029
- readonly inputs: readonly [];
1030
- readonly outputs: readonly [{
1031
- readonly name: "";
1032
- readonly type: "string";
1033
- }];
1034
- readonly stateMutability: "view";
1035
- }, {
1036
- readonly type: "function";
1037
- readonly name: "symbol";
1038
- readonly inputs: readonly [];
1039
- readonly outputs: readonly [{
1040
- readonly name: "";
1041
- readonly type: "string";
1042
- }];
1043
- readonly stateMutability: "view";
1044
- }, {
1045
- readonly type: "function";
1046
- readonly name: "totalSupply";
1047
- readonly inputs: readonly [];
1048
- readonly outputs: readonly [{
1049
- readonly name: "";
1050
- readonly type: "uint256";
1051
- }];
1052
- readonly stateMutability: "view";
1053
- }, {
1054
- readonly type: "function";
1055
- readonly name: "transfer";
1056
- readonly inputs: readonly [{
1057
- readonly name: "recipient";
1058
- readonly type: "address";
1059
- }, {
1060
- readonly name: "amount";
1061
- readonly type: "uint256";
1062
- }];
1063
- readonly outputs: readonly [{
1064
- readonly name: "";
1065
- readonly type: "bool";
1066
- }];
1067
- readonly stateMutability: "nonpayable";
1068
- }, {
1069
- readonly type: "function";
1070
- readonly name: "transferFrom";
1071
- readonly inputs: readonly [{
1072
- readonly name: "sender";
1073
- readonly type: "address";
1074
- }, {
1075
- readonly name: "recipient";
1076
- readonly type: "address";
1077
- }, {
1078
- readonly name: "amount";
1079
- readonly type: "uint256";
1080
- }];
1081
- readonly outputs: readonly [{
1082
- readonly name: "";
1083
- readonly type: "bool";
1084
- }];
1085
- readonly stateMutability: "nonpayable";
1086
- }, {
1087
- readonly type: "event";
1088
- readonly name: "Approval";
1089
- readonly inputs: readonly [{
1090
- readonly name: "owner";
1091
- readonly type: "address";
1092
- readonly indexed: true;
1093
- }, {
1094
- readonly name: "spender";
1095
- readonly type: "address";
1096
- readonly indexed: true;
1097
- }, {
1098
- readonly name: "value";
1099
- readonly type: "uint256";
1100
- readonly indexed: false;
1101
- }];
1102
- readonly anonymous: false;
1103
- }, {
1104
- readonly type: "event";
1105
- readonly name: "Transfer";
1106
- readonly inputs: readonly [{
1107
- readonly name: "from";
1108
- readonly type: "address";
1109
- readonly indexed: true;
1110
- }, {
1111
- readonly name: "to";
1112
- readonly type: "address";
1113
- readonly indexed: true;
1114
- }, {
1115
- readonly name: "value";
1116
- readonly type: "uint256";
1117
- readonly indexed: false;
1118
- }];
1119
- readonly anonymous: false;
1120
- }];
1121
-
1122
221
  declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
1123
222
  type FormatAmountOptions = {
1124
223
  maxFractionDigits?: AssetDecimals;
224
+ /**
225
+ * Trailing zeros are kept down to this many places. Defaults to
226
+ * `maxFractionDigits` when that is set, otherwise 2 (or the token's own
227
+ * decimals, when fewer). A figure that wants a cap and a shorter floor —
228
+ * a share headline — passes both.
229
+ */
230
+ minFractionDigits?: AssetDecimals;
1125
231
  };
1126
232
  declare function formatAmount(amount: BlockchainAmount, locale: string, options?: FormatAmountOptions): FormattedAmountUi;
1127
233
  declare function formatRawAmount(amount: BlockchainAmount): string;
@@ -1137,6 +243,16 @@ declare function usdAmount(amount: FormattedAmountUi): FormattedAmountAssetUi;
1137
243
  declare function assetAmount(amount: FormattedAmountUi, symbol: AssetSymbol): FormattedAmountAssetUi;
1138
244
  /** Placeholder shown when an amount is unavailable (e.g. a loading quote). */
1139
245
  declare const NA_AMOUNT_ASSET_UI: FormattedAmountAssetUi;
246
+ /**
247
+ * A share quantity for a headline: at most 6 decimal places, at least 2, with
248
+ * the zeros between those dropped.
249
+ *
250
+ * An 18-decimal fill (`0.002689383776381483`) otherwise takes the whole
251
+ * confirmation row and the fund name collapses to an ellipsis. Places past 6
252
+ * are dust at share scale. The chain amount is unchanged, and the transaction
253
+ * link still carries the exact figure.
254
+ */
255
+ declare function formatShareAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
1140
256
  /**
1141
257
  * Formats a USD amount capped at 2 fractional digits, falling back to the
1142
258
  * {@link NA_AMOUNT_ASSET_UI} placeholder when the amount is absent.
@@ -1256,21 +372,4 @@ declare class MathError extends Error {
1256
372
  constructor(message: string);
1257
373
  }
1258
374
 
1259
- type UserDto = {
1260
- id: string;
1261
- email: string;
1262
- };
1263
-
1264
- type UserId = Newtype<string, 'UserId'>;
1265
- declare const UserId: (value: string) => UserId;
1266
- type UserEmail = Newtype<string, 'UserEmail'>;
1267
- declare const UserEmail: (value: string) => UserEmail;
1268
- type User = {
1269
- id: UserId;
1270
- email: UserEmail;
1271
- };
1272
- declare const User: {
1273
- fromDto: (dto: UserDto) => User;
1274
- };
1275
-
1276
- export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, InvariantError, KnownAssetSymbol, MathError, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_MAX_TTL_MS, ONDO_SETTLEMENT_ASSET, ONDO_SUPPORTED_INPUT_ASSETS, OfferSwapContract, 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, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, ValidationError, applyBps, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoBuyPrice, computeOndoSellPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isSwapAvailable, ondoQuoteOfferDeadline, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, swapSpender, txExplorerUrl, usdAmount, viemChain };
375
+ 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 };