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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-OUFI3D3Q.js → chunk-IQAJ3L25.js} +173 -259
  3. package/dist/chunk-IQAJ3L25.js.map +1 -0
  4. package/dist/{chunk-2HCSM3FB.js → chunk-J45AY2FX.js} +10 -10
  5. package/dist/chunk-J45AY2FX.js.map +1 -0
  6. package/dist/{chunk-YMDYLYL3.js → chunk-M2TURNJH.js} +821 -801
  7. package/dist/chunk-M2TURNJH.js.map +1 -0
  8. package/dist/chunk-MJ6YXZWH.js +22 -0
  9. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  10. package/dist/client/index.d.ts +2840 -5756
  11. package/dist/client/index.js +8254 -9600
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.d.ts +4 -37
  14. package/dist/server/index.js +6 -4
  15. package/dist/server/index.js.map +1 -1
  16. package/dist/{time-DJU6E8KK.d.cts → time-DkU7jivQ.d.ts} +1913 -3256
  17. package/dist/{token-registry-snapshot-DGG5N27C.d.ts → token-registry-snapshot-D0OWXMe4.d.ts} +22 -58
  18. package/dist/universal/index.d.ts +80 -1080
  19. package/dist/universal/index.js +22 -50
  20. package/package.json +18 -14
  21. package/dist/chunk-2HCSM3FB.js.map +0 -1
  22. package/dist/chunk-OUFI3D3Q.js.map +0 -1
  23. package/dist/chunk-YMDYLYL3.js.map +0 -1
  24. package/dist/client/index.cjs +0 -20774
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -8328
  27. package/dist/server/index.cjs +0 -4580
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -385
  30. package/dist/time-DJU6E8KK.d.ts +0 -4052
  31. package/dist/token-registry-snapshot-B0xCp3GD.d.cts +0 -245
  32. package/dist/universal/index.cjs +0 -4625
  33. package/dist/universal/index.cjs.map +0 -1
  34. package/dist/universal/index.d.cts +0 -1376
@@ -1,1376 +0,0 @@
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.cjs';
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.cjs';
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-B0xCp3GD.cjs';
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-B0xCp3GD.cjs';
5
- import { TransactionReceipt, Hash, Chain } from 'viem';
6
-
7
- /**
8
- * Walks every page of a cursor-paginated endpoint and returns the flattened
9
- * result.
10
- *
11
- * Lives in the API layer rather than beside `PaginationParams` because it
12
- * drives requests: it is the auto-paginating half that `list()` is built on,
13
- * while the params and the response envelope are domain models the client and
14
- * the server both name.
15
- */
16
- declare function fetchAllPages<A, P extends PaginationParams = PaginationParams>(fetchPage: (params: P) => Promise<PaginatedResponse<A>>, baseParams?: Omit<P, keyof PaginationParams>): Promise<A[]>;
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;
52
- };
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';
65
- };
66
- /**
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.
78
- */
79
- declare function resolveCentrifugeVaults(offer: CentrifugeVaultOfferDetail, lookup: (token: OfferToken) => TokenMetadata | null): CentrifugeVaultResolution[];
80
-
81
- /**
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.
125
- *
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.
132
- *
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.
140
- *
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.
144
- */
145
- declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
146
-
147
- /**
148
- * The price of one whole asset token in a built Ondo purchase, in the funding
149
- * token's units - USD per share.
150
- *
151
- * Neither builder publishes a price. Frontline drops Ninshubur's deliberately,
152
- * because `GET /v1/ondo/swap/quote` already serves one under that name at a
153
- * different scale, and echoing both would leave a caller to guess which was
154
- * which.
155
- *
156
- * Dividing the two amounts the response *does* carry is better than reading
157
- * the indicative one anyway: it is the price this transaction fills at, rather
158
- * than a poll that has since moved and was struck against a different size.
159
- *
160
- * **Fee-exclusive.** `notionalValue` is the deposit after CoinList's fee comes
161
- * off, so this is the price Ondo filled at, not the buyer's all-in cost per
162
- * token - that would be `spendInputAmount / receiveOutputAmount`, and it is
163
- * higher. Fee-exclusive is what the review screen wants, because it renders
164
- * the fee on its own line: price x quantity, plus fee, comes to the total.
165
- * Making this all-in would double-count the fee against that breakdown.
166
- *
167
- * The two are equal until ENG-1718 turns a fee on, which frontline rejects
168
- * today. They diverge the moment it does, so the choice is load-bearing rather
169
- * than academic.
170
- */
171
- declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): BlockchainAmount;
172
- /**
173
- * The price of one whole asset token in a built Ondo sale, in the settlement
174
- * token's units - USD per share, the same thing
175
- * {@link computeOndoBuyPrice} answers with the ratio inverted.
176
- *
177
- * **Fee-exclusive, and it takes arithmetic to be so.** `expected.quantity` is
178
- * published already net of `expected.fee`, so the proceeds are added back
179
- * before dividing: what comes out is the price Ondo filled at, which is the
180
- * buy arm's meaning rather than a second one. That is what lets one review row
181
- * render on either screen, and what keeps the sell breakdown honest - the fee
182
- * sits on its own line beside this, and a net price would count it twice.
183
- *
184
- * Read against {@link OndoSellTransaction.expected} alone. The `minimum` arm
185
- * describes the same trade at a different outcome, and pricing that one would
186
- * answer "the worst price this could fill at", which no screen asks for.
187
- *
188
- * The two readings coincide while frontline forces the fee to zero, which it
189
- * does today. They diverge the day ENG-1718 lands.
190
- */
191
- 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
-
195
- /**
196
- * The CoinList API's error code for an Ondo quote refused because the asset
197
- * cannot be traded right now: the market is closed or paused, or the asset is
198
- * paused or closed for the session. It arrives on a 409.
199
- *
200
- * One code for all four of Ondo's reasons, because the remedy is the same:
201
- * wait for the market to open. Ondo pauses for a moment at every US session
202
- * change (04:00 and 16:00 ET), so a poll can land on one even while
203
- * `getTradingStatus` reported the asset tradable a second earlier.
204
- */
205
- declare const ONDO_NOT_TRADABLE_CODE = "not_tradable";
206
- /**
207
- * Whether `error` is the CoinList API refusing an Ondo quote because the
208
- * market is not open, as opposed to a request that failed.
209
- *
210
- * Total: anything that is not an `HttpError` carrying
211
- * {@link ONDO_NOT_TRADABLE_CODE} is `false`.
212
- */
213
- declare function isOndoNotTradableError(error: unknown): error is HttpError;
214
-
215
- /**
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.
905
- *
906
- * `raw_price = inputTokenAmount.raw × 10^outputDecimals ÷ outputTokenAmount.raw`
907
- *
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).
911
- */
912
- declare function computePrice({ inputTokenAmount, outputTokenAmount, }: SwapQuote): BlockchainAmount | null;
913
- /**
914
- * Applies slippage to an amount, returning the minimum acceptable amount:
915
- * `amount × (BPS_DENOM − slippage) / BPS_DENOM`. Throws when `slippage` exceeds
916
- * `BPS_DENOM` (the retained fraction would be negative).
917
- */
918
- declare function computeSlip(amount: BlockchainAmount, slippage: Bps): BlockchainAmount;
919
-
920
- /**
921
- * The bit `Operable.paused` sets for the swap operation, mirroring the
922
- * contract's `SWAP_LEVEL` constant.
923
- *
924
- * A constant rather than a `SWAP_LEVEL()` read: it is `constant` in the
925
- * contract, so reading it would spend a round-trip to be told the same number
926
- * every time.
927
- */
928
- declare const SWAP_LEVEL = 2;
929
- /**
930
- * Whether the contract will actually accept a swap right now.
931
- *
932
- * Not the same question as "is it active". `paused` is a bitmask over
933
- * *operations*, so a contract can suspend something unrelated and go on
934
- * swapping; only the {@link SWAP_LEVEL} bit stops it. Reading `state ===
935
- * 'active'` instead would refuse swaps the contract is perfectly willing to
936
- * make.
937
- */
938
- declare function isSwapAvailable(status: SwapStatus): boolean;
939
-
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
- /** Slippage tolerances offered in the review step, in basis points. */
975
- declare const SLIPPAGE_OPTIONS_BPS: Bps[];
976
- /** Default slippage tolerance (0.5%). */
977
- 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
- /**
987
- * The Superstate swap contract on `chain`, or `null` where none is deployed.
988
- *
989
- * TODO(ENG-1734): Ondo now reads its spender off the offer's `swap_contracts`
990
- * via `swapSpender`, which is why that helper sits in `shared/core/offers/`
991
- * rather than under a provider. Superstate still resolves from this table, so
992
- * two mechanisms answer one question. Migrate once frontline serves
993
- * `swap_contracts` on Superstate offers too.
994
- */
995
- declare function superstateSwapContractAddress(chain: EthereumChain): EvmContractAddress | null;
996
-
997
- /**
998
- * Formats a quote's implied price per output token as a USD amount.
999
- *
1000
- * Lives with the provider rather than in `@/universal/core/shared/blockchain/formatters`
1001
- * because {@link SwapQuote} and {@link computePrice} are Superstate's: the
1002
- * shared formatters stay provider-agnostic.
1003
- */
1004
- declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
1005
-
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
- /** The viem chain definition the SDK reads and writes this chain through. */
1040
- declare function viemChain(chain: EthereumChain): Chain;
1041
- declare function getChainId(chain: EthereumChain): number;
1042
- /**
1043
- * Resolves an EIP-155 chain id to the chain the SDK names it by — the inverse
1044
- * of {@link getChainId}, for backends that report a bare `chain_id`.
1045
- *
1046
- * @throws ValidationError on an unrecognised id. Defaulting to mainnet would
1047
- * let a testnet response read as a live one.
1048
- */
1049
- declare function chainFromId(chainId: string): EthereumChain;
1050
- declare function getNetworkName(chain: EthereumChain): string;
1051
- declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
1052
-
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
- declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
1206
- type FormatAmountOptions = {
1207
- maxFractionDigits?: AssetDecimals;
1208
- /**
1209
- * Trailing zeros are kept down to this many places. Defaults to
1210
- * `maxFractionDigits` when that is set, otherwise 2 (or the token's own
1211
- * decimals, when fewer). A figure that wants a cap and a shorter floor —
1212
- * a share headline — passes both.
1213
- */
1214
- minFractionDigits?: AssetDecimals;
1215
- };
1216
- declare function formatAmount(amount: BlockchainAmount, locale: string, options?: FormatAmountOptions): FormattedAmountUi;
1217
- declare function formatRawAmount(amount: BlockchainAmount): string;
1218
- /**
1219
- * Formats a {@link BlockchainAmount} using compact notation (e.g. `1.37B`,
1220
- * `5M`). Compact notation only surfaces a couple of significant decimals, so
1221
- * the bigint → number narrowing here is intentional and safe: full precision
1222
- * is deliberately dropped in favour of a human-readable summary value.
1223
- */
1224
- declare function formatCompactAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
1225
- declare function formatBpsAsPercent(bps: Bps, locale: string): FormattedPercentUi;
1226
- declare function usdAmount(amount: FormattedAmountUi): FormattedAmountAssetUi;
1227
- declare function assetAmount(amount: FormattedAmountUi, symbol: AssetSymbol): FormattedAmountAssetUi;
1228
- /** Placeholder shown when an amount is unavailable (e.g. a loading quote). */
1229
- declare const NA_AMOUNT_ASSET_UI: FormattedAmountAssetUi;
1230
- /**
1231
- * A share quantity for a headline: at most 6 decimal places, at least 2, with
1232
- * the zeros between those dropped.
1233
- *
1234
- * An 18-decimal fill (`0.002689383776381483`) otherwise takes the whole
1235
- * confirmation row and the fund name collapses to an ellipsis. Places past 6
1236
- * are dust at share scale. The chain amount is unchanged, and the transaction
1237
- * link still carries the exact figure.
1238
- */
1239
- declare function formatShareAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
1240
- /**
1241
- * Formats a USD amount capped at 2 fractional digits, falling back to the
1242
- * {@link NA_AMOUNT_ASSET_UI} placeholder when the amount is absent.
1243
- */
1244
- declare function formattedUsdPrice(amount: BlockchainAmount | null, locale: string): FormattedAmountAssetUi;
1245
-
1246
- /** A typed, i18n-agnostic reason a raw amount string failed to parse. */
1247
- type AmountParseErrorReason = {
1248
- type: 'empty';
1249
- } | {
1250
- type: 'negative';
1251
- } | {
1252
- type: 'invalid-format';
1253
- } | {
1254
- type: 'too-many-decimals';
1255
- maxDecimals: AssetDecimals;
1256
- }
1257
- /** Scaled up by `decimals`, the amount no longer fits a uint256. */
1258
- | {
1259
- type: 'overflow';
1260
- };
1261
- type AmountParseResult = {
1262
- valid: true;
1263
- amount: BlockchainAmount;
1264
- } | {
1265
- valid: false;
1266
- reason: AmountParseErrorReason;
1267
- };
1268
- /**
1269
- * Wraps a raw uint256 base-unit string — what Ondo and the on-chain reads
1270
- * return ("100000000" is 100 USDC, not 100 wei-of-nothing) — in a
1271
- * {@link BlockchainAmount} at the given decimals. The value is already scaled,
1272
- * so `decimals` is only the unit tag that travels with it.
1273
- *
1274
- * Distinct from {@link parseBlockchainAmount}, which takes a *human decimal*
1275
- * string and scales it up. Feeding a raw amount to that one silently
1276
- * multiplies it by 10^decimals — pick by what the backend sends, not by which
1277
- * one is closer at hand.
1278
- *
1279
- * @throws ValidationError when the string is not a non-negative uint256
1280
- * integer. A backend that regresses to decimal strings fails loudly here
1281
- * rather than truncating.
1282
- */
1283
- declare function blockchainAmountFromRawOrThrow({ label, raw, decimals, }: {
1284
- label: string;
1285
- raw: string;
1286
- decimals: AssetDecimals;
1287
- }): BlockchainAmount;
1288
- /**
1289
- * Parses a user-entered decimal string into a {@link BlockchainAmount} at the
1290
- * given token decimals. Rejects scientific notation, negatives, malformed
1291
- * input, more fractional digits than the token supports, and amounts that
1292
- * scale past uint256 — surfacing a typed {@link AmountParseErrorReason} so
1293
- * callers own the display copy.
1294
- */
1295
- declare function parseBlockchainAmount(amount: string, decimals: AssetDecimals): AmountParseResult;
1296
-
1297
- declare const USDC_SYMBOL: StablecoinSymbol;
1298
- declare const USDC: Erc20Asset;
1299
- declare const USDT_SYMBOL: StablecoinSymbol;
1300
- declare const USDT: Erc20Asset;
1301
- /** Lookups for the stablecoins the SDK's swap flows support out of the box. */
1302
- declare const TOKEN_REGISTRY: {
1303
- erc20: (symbol: KnownAssetSymbol) => Erc20Asset;
1304
- /**
1305
- * USDC's contract on `chain`. USDC is deployed on every chain the SDK
1306
- * models, so the table is total and the answer is never `null`.
1307
- */
1308
- usdcAddress: (chain: EthereumChain) => EvmContractAddress;
1309
- /**
1310
- * USDT's contract on `chain`, or `null` where Tether publishes none —
1311
- * Base Sepolia today. The honest answer, never a fake address a balance
1312
- * read would call.
1313
- */
1314
- usdtAddress: (chain: EthereumChain) => EvmContractAddress | null;
1315
- };
1316
-
1317
- /**
1318
- * Error thrown when a feature or code path is not yet implemented.
1319
- */
1320
- declare class NotImplementedError extends Error {
1321
- constructor(message?: string);
1322
- }
1323
- /**
1324
- * Error thrown when accessing a feature that requires authentication
1325
- * without being authenticated.
1326
- */
1327
- declare class NotAuthenticatedError extends Error {
1328
- constructor(message?: string);
1329
- }
1330
- declare class ValidationError extends Error {
1331
- constructor(message: string);
1332
- }
1333
- /**
1334
- * Error thrown when the SDK computes something impossible: a value outside
1335
- * uint256 after its own arithmetic, a symbol missing from a registry the SDK
1336
- * itself ships. Distinct from {@link ValidationError}, which means the backend
1337
- * sent a shape the SDK does not understand.
1338
- *
1339
- * The two have different remedies, which is the whole reason they are separate
1340
- * types: a {@link ValidationError} is worth reporting to CoinList, an
1341
- * `InvariantError` is an SDK bug worth reporting against the SDK.
1342
- */
1343
- declare class InvariantError extends Error {
1344
- constructor(message: string);
1345
- }
1346
- /**
1347
- * Error thrown when an arithmetic operation has no answer to give: a division
1348
- * by zero, or a result that falls outside the range its type can represent.
1349
- *
1350
- * Distinct from {@link ValidationError}, which says a value arrived malformed.
1351
- * A `MathError` says every operand was well-formed and the operation on them
1352
- * still has no result, so the two are worth catching apart: one points at the
1353
- * response, the other at the arithmetic we asked for.
1354
- */
1355
- declare class MathError extends Error {
1356
- constructor(message: string);
1357
- }
1358
-
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 };