@coinlist-co/react 0.12.2-rc.818bed6 → 0.12.2-rc.8a65e9d

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 (35) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-YMDYLYL3.js → chunk-2FZAXGVH.js} +996 -1225
  3. package/dist/chunk-2FZAXGVH.js.map +1 -0
  4. package/dist/{chunk-OUFI3D3Q.js → chunk-EAPBF7T2.js} +152 -240
  5. package/dist/chunk-EAPBF7T2.js.map +1 -0
  6. package/dist/chunk-IWQ6A52U.js +24 -0
  7. package/dist/chunk-IWQ6A52U.js.map +1 -0
  8. package/dist/{chunk-2HCSM3FB.js → chunk-OQ2ANYUF.js} +334 -27
  9. package/dist/chunk-OQ2ANYUF.js.map +1 -0
  10. package/dist/client/index.d.ts +3269 -5861
  11. package/dist/client/index.js +10650 -10797
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/client-credentials-BwcmPcn-.d.ts +13 -0
  14. package/dist/server/index.d.ts +54 -135
  15. package/dist/server/index.js +211 -171
  16. package/dist/server/index.js.map +1 -1
  17. package/dist/{time-DJU6E8KK.d.cts → time-ChSGmKZe.d.ts} +2177 -3470
  18. package/dist/{token-registry-snapshot-DGG5N27C.d.ts → token-registry-snapshot-DMubXr2c.d.ts} +22 -58
  19. package/dist/universal/index.d.ts +94 -1082
  20. package/dist/universal/index.js +25 -51
  21. package/package.json +18 -14
  22. package/dist/chunk-2HCSM3FB.js.map +0 -1
  23. package/dist/chunk-OUFI3D3Q.js.map +0 -1
  24. package/dist/chunk-YMDYLYL3.js.map +0 -1
  25. package/dist/client/index.cjs +0 -20774
  26. package/dist/client/index.cjs.map +0 -1
  27. package/dist/client/index.d.cts +0 -8328
  28. package/dist/server/index.cjs +0 -4580
  29. package/dist/server/index.cjs.map +0 -1
  30. package/dist/server/index.d.cts +0 -385
  31. package/dist/time-DJU6E8KK.d.ts +0 -4052
  32. package/dist/token-registry-snapshot-B0xCp3GD.d.cts +0 -245
  33. package/dist/universal/index.cjs +0 -4625
  34. package/dist/universal/index.cjs.map +0 -1
  35. package/dist/universal/index.d.cts +0 -1376
@@ -1,148 +1,53 @@
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';
1
+ import { al as ClientId, am as RedirectUri, an as CodeChallenge, ao as PKCEState, _ as CodeVerifier, h as OfferSwapContract, E as EthereumChain, b as EvmContractAddress, i as OndoBuyTransaction, B as BlockchainAmount, j as OndoSellTransaction, ap as RequestId, o as SwapQuote, p as Bps, aq as SwapStatus, a7 as AssetDecimals, a as AssetSymbol, q as EvmWalletAddress, ar as KnownAssetSymbol, H as Erc20Asset, S as StablecoinSymbol } from '../time-ChSGmKZe.js';
2
+ export { as as AllowWalletParams, at as AllowWalletResponse, au as Asset, av as AssetCode, aw as AssetId, L as AsyncOfferDetail, ax as AsyncOfferType, Z as AuthorizationCode, A as AuthorizationGrant, ay as BaseEvent, az as BuildCentrifugeVaultBuyParams, a1 as BuildOndoBuyParams, a3 as BuildOndoSellParams, aA as BuildOndoSwapParamsCore, aB as CentrifugeAssets, c as CentrifugeClaimDirection, aC as CentrifugeDepositPosition, d as CentrifugeNamespace, aD as CentrifugeOrderReason, aE as CentrifugeOrderability, aF as CentrifugeRedeemPosition, aG as CentrifugeShares, aa as CentrifugeVault, C as CentrifugeVaultBuyTransaction, aH as CentrifugeVaultClaimProceedsTransaction, aI as CentrifugeVaultClaimTransaction, a9 as CentrifugeVaultLeg, I as CentrifugeVaultLegId, aJ as CentrifugeVaultOffer, J as CentrifugeVaultOfferDetail, aK as CentrifugeVaultReason, a0 as CentrifugeVaultRef, aL as CentrifugeVaultResolution, $ as CentrifugeVaultStatus, aM as CentrifugeVaultTransactionCore, aN as CentrifugeWalletParams, aO as Chain, ak as ClientSecret, g as CoinListTokenSaleNamespace, aP as CoinListTokenSaleOffer, e as CoinListTokenSaleOfferDetail, w as Config, aQ as ConnectExternalWalletParams, aR as CreateKycTokenParams, aS as CreateParticipationParams, aT as CreateWalletOwnershipChallengeParams, aU as Cursor, aV as DebugEvent, aW as DecimalString, aX as DocumentFormType, af as DocumentSubmission, aY as DocumentSubmissionStatus, aZ as DocumentType, a_ as ETHEREUM_CHAINS, ad as EpochMillis, z as Erc20Namespace, a$ as FaqItem, b0 as FrontlineEventId, b1 as GetCentrifugeVaultStatusParams, b2 as GetOndoQuoteParams, b3 as GetOndoTradingStatusParams, b4 as GetSwapAuthorizationParams, b5 as GetSwapPreviewParams, b6 as GetSwapQuoteParams, b7 as GetTokenAllowanceParams, b8 as GetTokenBalanceParams, b9 as HexEncodedTransactionData, ba as Isin, bb as Iso2CountryCode, N as KycLevelName, bc as KycToken, bd as Link, be as ListOptionAddressesParams, bf as LogBinding, bg as LogBindings, bh as LogCause, bi as LogLevel, bj as LogScope, bk as LogValue, Y as Logger, bl as MAX_ASSET_DECIMALS, bm as MAX_UINT_256, bn as Milestone, bo as Millis, bp as Newtype, x as OAuthAccessToken, bq as OAuthRefreshToken, ah as OAuthSession, D as Offer, br as OfferBase, G as OfferDetail, bs as OfferDetailBase, bt as OfferEditorial, bu as OfferFundingContract, n as OfferId, bv as OfferOption, u as OfferOptionAddress, ae as OfferOptionAddressId, f as OfferOptionId, bw as OfferOptionSlug, bx as OfferSlug, by as OfferToken, bz as OfferType, O as OfferVaultContract, y as OffersNamespace, k as OndoNamespace, a4 as OndoQuote, bA as OndoQuoteDuration, a5 as OndoQuoteSize, bB as OndoSellOutcome, bC as OndoSwapOffer, a2 as OndoSwapOfferDetail, l as OndoSwapTransactionCore, a6 as OndoTradingStatus, m as OrderBookSide, aj as PaginatedResponse, ai as PaginationParams, P as Participation, ab as ParticipationId, ac as ParticipationStatus, bD as ParticipationsPaginationParams, bE as PauseFlags, bF as Pii, bG as PiiAddress, bH as PiiJurisdiction, bI as PiiKind, X as PinoLoggerOptions, bJ as ProductionLogLevel, bK as ReadCentrifugePositionParams, bL as RedactedWalletError, bM as RemoveOptionAddressParams, s as Requirement, bN as RequirementActionNeededReason, V as RequirementId, M as RequirementStatusInfo, U as RequirementStatusValue, Q 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, K as Seconds, bU as SolanaChain, bV as SubmitDocumentParams, r as SuperstateSwapNamespace, bW as SuperstateSwapOffer, a8 as SuperstateSwapOfferDetail, bX as SwapContractRef, bY as SwapPreview, bZ as TermItem, b_ as Ticker, ag 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, t as WalletChallengeType, W as WalletError, c6 as WalletOwnershipChallenge, c7 as WalletOwnershipChallengeParamsBase, c8 as WalletProtocol, v as WalletsNamespace, c9 as assertUint256, ca as isChain, cb as isOfferType, cc as parseUint256, cd as resolveCentrifugeVaults } from '../time-ChSGmKZe.js';
3
+ import { F as FormattedAmountAssetUi, T as TxExplorerUrl, d as FormattedAmountUi, b as FormattedPercentUi, S as ShortenedWalletAddress } from '../token-registry-snapshot-DMubXr2c.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-DMubXr2c.js';
5
+ import { Hash, Chain } from 'viem';
6
+ export { C as ClientCredentialsOAuth } from '../client-credentials-BwcmPcn-.js';
6
7
 
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[]>;
17
-
18
- /**
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.
23
- *
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.
32
- *
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.
36
- */
37
- declare const CENTRIFUGE_INDICATIVE_QUOTE_AMOUNT: BlockchainAmount;
38
-
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;
8
+ type PKCEParams = {
9
+ clientId: ClientId;
10
+ responseType: 'code';
11
+ redirectUri: RedirectUri;
12
+ codeChallenge: CodeChallenge;
13
+ codeChallengeMethod: 'S256';
14
+ state: PKCEState;
15
+ codeVerifier: CodeVerifier;
52
16
  };
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';
17
+ type PKCEConfig = {
18
+ clientId: ClientId;
19
+ redirectUri: RedirectUri;
65
20
  };
66
21
  /**
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.
22
+ * Generates PKCE parameters for an OAuth2 authorization code flow.
23
+ * Pure crypto — no React, no DOM beyond Web Crypto API. Safe to use
24
+ * in server-side code and Next.js middleware.
78
25
  */
79
- declare function resolveCentrifugeVaults(offer: CentrifugeVaultOfferDetail, lookup: (token: OfferToken) => TokenMetadata | null): CentrifugeVaultResolution[];
26
+ declare function generatePKCEParams(config: PKCEConfig): Promise<PKCEParams>;
80
27
 
81
28
  /**
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.
29
+ * The CoinList contract a swap on `chain` settles through, and therefore the
30
+ * ERC-20 spender the user approves - or `null` where this offer cannot be
31
+ * swapped on that chain.
125
32
  *
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.
33
+ * Read off the offer rather than held as a constant because the address varies
34
+ * by environment, not only by chain: beta and production both run
35
+ * `ethereum_sepolia` and deploy a different contract on each, and one constant
36
+ * cannot name both. Frontline resolves it per environment and serves the
37
+ * answer on the offer.
132
38
  *
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.
39
+ * The array varies per *offer* as well as per chain - frontline drops a chain
40
+ * whose funding and swap tokens do not both resolve for this asset - so an
41
+ * array read for one symbol must not be reused for another. An empty array
42
+ * means "cannot swap here", which is an answer rather than an error.
140
43
  *
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.
44
+ * A capability rather than a provider slice, and named for the data it reads
45
+ * rather than for its first caller: `swap_contracts` is an offer field, and
46
+ * `universal-core-isolation-and-sharing` would stop Superstate reusing this if
47
+ * it lived under `checkout/ondo/`. Superstate has not migrated yet - it still
48
+ * reads `superstateSwapContractAddress` - so Ondo is the only caller today.
144
49
  */
145
- declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
50
+ declare function swapSpender(swapContracts: OfferSwapContract[], chain: EthereumChain): EvmContractAddress | null;
146
51
 
147
52
  /**
148
53
  * The price of one whole asset token in a built Ondo purchase, in the funding
@@ -189,20 +94,47 @@ declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): Blockchai
189
94
  * does today. They diverge the day ENG-1718 lands.
190
95
  */
191
96
  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
97
 
98
+ type HttpResponse<TBody = unknown> = {
99
+ status: number;
100
+ headers?: Record<string, string>;
101
+ body: TBody | null;
102
+ /**
103
+ * The id of the request that produced this response, stamped by
104
+ * {@link HttpClient} so that whoever turns a non-2xx into an
105
+ * {@link HttpError} can carry it without threading the request alongside.
106
+ * Absent when the response did not come from an `HttpClient`.
107
+ */
108
+ requestId?: RequestId;
109
+ };
110
+ declare class HttpError<TBody = unknown> extends Error {
111
+ readonly response: HttpResponse<TBody>;
112
+ constructor(response: HttpResponse<TBody>);
113
+ /**
114
+ * Correlates this failure with the `[HTTP]` log lines for the same request,
115
+ * which carry the method, the URL, the duration and every retry. `null` when
116
+ * the response did not come from an {@link HttpClient}.
117
+ *
118
+ * Worth quoting in a bug report: it is what makes a log excerpt readable.
119
+ */
120
+ get requestId(): RequestId | null;
121
+ }
195
122
  /**
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.
123
+ * The machine-readable `code` frontline attaches to an error, or `null` for
124
+ * anything else - a non-HTTP failure, or an error body that carries only a
125
+ * message.
126
+ *
127
+ * Frontline answers a failure with `{ type, message, code?, errors?,
128
+ * event_id? }`, and `code` is the only part of it meant to be branched on:
129
+ * `message` is prose that may be reworded, and `type` distinguishes
130
+ * `invalid_request_error` from `api_error` without saying which one.
199
131
  *
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.
132
+ * Reach for this only where a code has a distinct remedy the user can act on.
133
+ * Mapping the whole vocabulary would couple the SDK to strings frontline does
134
+ * not version; falling back to a generic failure is the right default.
204
135
  */
205
- declare const ONDO_NOT_TRADABLE_CODE = "not_tradable";
136
+ declare function apiErrorCode(error: unknown): string | null;
137
+
206
138
  /**
207
139
  * Whether `error` is the CoinList API refusing an Ondo quote because the
208
140
  * market is not open, as opposed to a request that failed.
@@ -213,701 +145,14 @@ declare const ONDO_NOT_TRADABLE_CODE = "not_tradable";
213
145
  declare function isOndoNotTradableError(error: unknown): error is HttpError;
214
146
 
215
147
  /**
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.
148
+ * Price of 1 output token in USD, assuming the input token is a $1 stablecoin:
149
+ * the quote's input divided by its output, via {@link pricePerShare}.
150
+ * Returned decimals match the input token decimals (always the stablecoin's 6).
905
151
  *
906
- * `raw_price = inputTokenAmount.raw × 10^outputDecimals ÷ outputTokenAmount.raw`
152
+ * `null` for a quote that fills nothing, which is an answer here rather than
153
+ * a corrupt amount: there is no price to show for it.
907
154
  *
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).
155
+ * @throws MathError when the price is out of uint256 bounds.
911
156
  */
912
157
  declare function computePrice({ inputTokenAmount, outputTokenAmount, }: SwapQuote): BlockchainAmount | null;
913
158
  /**
@@ -937,52 +182,10 @@ declare const SWAP_LEVEL = 2;
937
182
  */
938
183
  declare function isSwapAvailable(status: SwapStatus): boolean;
939
184
 
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
185
  /** Slippage tolerances offered in the review step, in basis points. */
975
186
  declare const SLIPPAGE_OPTIONS_BPS: Bps[];
976
187
  /** Default slippage tolerance (0.5%). */
977
188
  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
189
  /**
987
190
  * The Superstate swap contract on `chain`, or `null` where none is deployed.
988
191
  *
@@ -1003,39 +206,6 @@ declare function superstateSwapContractAddress(chain: EthereumChain): EvmContrac
1003
206
  */
1004
207
  declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
1005
208
 
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
209
  /** The viem chain definition the SDK reads and writes this chain through. */
1040
210
  declare function viemChain(chain: EthereumChain): Chain;
1041
211
  declare function getChainId(chain: EthereumChain): number;
@@ -1050,158 +220,6 @@ declare function chainFromId(chainId: string): EthereumChain;
1050
220
  declare function getNetworkName(chain: EthereumChain): string;
1051
221
  declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
1052
222
 
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
223
  declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
1206
224
  type FormatAmountOptions = {
1207
225
  maxFractionDigits?: AssetDecimals;
@@ -1312,6 +330,17 @@ declare const TOKEN_REGISTRY: {
1312
330
  * read would call.
1313
331
  */
1314
332
  usdtAddress: (chain: EthereumChain) => EvmContractAddress | null;
333
+ /**
334
+ * `symbol`'s contract on `chain`, or `null` where it has none - one lookup
335
+ * over both tables, for a caller that holds the symbol as data.
336
+ */
337
+ address: (symbol: StablecoinSymbol, chain: EthereumChain) => EvmContractAddress | null;
338
+ /**
339
+ * The stablecoin a backend asset code names, or `null` for a code the
340
+ * registry does not support. Matched exactly: frontline spells its codes
341
+ * the way the registry does, and a near miss is a different asset.
342
+ */
343
+ stablecoin: (code: string) => StablecoinSymbol | null;
1315
344
  };
1316
345
 
1317
346
  /**
@@ -1356,21 +385,4 @@ declare class MathError extends Error {
1356
385
  constructor(message: string);
1357
386
  }
1358
387
 
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 };
388
+ 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 };