@coinlist-co/react 0.12.2-rc.abd9d38 → 0.12.2-rc.e1f6c82

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 (36) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-45LAPB7U.js → chunk-EKLUJZ7T.js} +10 -10
  3. package/dist/chunk-EKLUJZ7T.js.map +1 -0
  4. package/dist/{chunk-HDJEDOS4.js → chunk-GIE4UWB3.js} +1207 -799
  5. package/dist/chunk-GIE4UWB3.js.map +1 -0
  6. package/dist/chunk-MJ6YXZWH.js +22 -0
  7. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  8. package/dist/{chunk-M7WDZZPX.js → chunk-PIOQA6HW.js} +194 -190
  9. package/dist/chunk-PIOQA6HW.js.map +1 -0
  10. package/dist/client/index.d.ts +2977 -4267
  11. package/dist/client/index.js +8552 -5713
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.d.ts +7 -33
  14. package/dist/server/index.js +8 -4
  15. package/dist/server/index.js.map +1 -1
  16. package/dist/{tokens-namespace-DrwRi0AQ.d.cts → time-Bbqlt2x7.d.ts} +2081 -2734
  17. package/dist/{token-registry-snapshot-C-Qs3Lgs.d.ts → token-registry-snapshot-DttZXGvY.d.ts} +74 -42
  18. package/dist/universal/index.d.ts +59 -998
  19. package/dist/universal/index.js +38 -36
  20. package/package.json +18 -14
  21. package/dist/chunk-45LAPB7U.js.map +0 -1
  22. package/dist/chunk-HDJEDOS4.js.map +0 -1
  23. package/dist/chunk-M7WDZZPX.js.map +0 -1
  24. package/dist/client/index.cjs +0 -17098
  25. package/dist/client/index.cjs.map +0 -1
  26. package/dist/client/index.d.cts +0 -6660
  27. package/dist/server/index.cjs +0 -4240
  28. package/dist/server/index.cjs.map +0 -1
  29. package/dist/server/index.d.cts +0 -378
  30. package/dist/time-BOCS1TbH.d.cts +0 -50
  31. package/dist/time-C7mhO5_a.d.ts +0 -50
  32. package/dist/token-registry-snapshot-CpzLmsc2.d.cts +0 -179
  33. package/dist/tokens-namespace-DrwRi0AQ.d.ts +0 -3364
  34. package/dist/universal/index.cjs +0 -4135
  35. package/dist/universal/index.cjs.map +0 -1
  36. package/dist/universal/index.d.cts +0 -1314
@@ -1,1314 +0,0 @@
1
- import { at as PaginationParams, au as PaginatedResponse, aw as DecimalString, x as StablecoinSymbol, j as OndoBuyTransaction, B as BlockchainAmount, k as OndoSellTransaction, aa as HttpError, p as Bps, ax as SwapStatus, a0 as AssetDecimals, b as EvmContractAddress, a as EthereumChain, i as OfferSwapContract, ay as Uint256, h as AssetSymbol, q as EvmWalletAddress, az as KnownAssetSymbol, y as Erc20Asset, aA as Newtype } from '../tokens-namespace-DrwRi0AQ.cjs';
2
- export { aB as AllowWalletParams, aC as AllowWalletResponse, aD as Asset, aE as AssetCode, e as AssetId, A as AuthorizationCode, aF as Blockchain, a1 as BuildOndoBuyParams, a2 as BuildOndoSellParams, aG as BuildOndoSwapParamsCore, aH as Chain, ar as ClientCredentialsOAuth, aI as ClientId, av as ClientSecret, aJ as CodeChallenge, C as CodeVerifier, c as CoinListTokenSaleNamespace, f as CoinListTokenSaleNamespaceImpl, aK as CoinListTokenSaleOffer, H as CoinListTokenSaleOfferDetail, u as Config, aL as ConnectExternalWalletParams, aM as CreateKycTokenParams, aN as CreateParticipationParams, aO as CreateWalletOwnershipChallengeParams, aP as Cursor, a8 as DebugEvent, aQ as DocumentFormType, Y as DocumentSubmission, aR as DocumentSubmissionStatus, aS as DocumentType, aT as ETHEREUM_CHAINS, E as Erc20Namespace, aU as Erc20NamespaceImpl, aV as FaqItem, a9 as FrontlineEventId, aW as GetOndoQuoteParams, aX as GetOndoTradingStatusParams, aY as GetSwapAuthorizationParams, aZ as GetSwapPreviewParams, a_ as GetTokenAllowanceParams, a$ as GetTokenBalanceParams, b0 as HexEncodedTransactionData, ab as HttpResponse, b1 as Isin, b2 as Iso2CountryCode, X as KycLevelName, ac as KycToken, b3 as Link, b4 as ListOptionAddressesParams, ad as LogBinding, ae as LogBindings, af as LogCause, ag as LogLevel, ah as LogScope, ai as LogValue, L as Logger, b5 as MAX_ASSET_DECIMALS, b6 as MAX_UINT_256, b7 as Milestone, v as OAuthAccessToken, b8 as OAuthRefreshToken, aq as OAuthSession, J as Offer, b9 as OfferBase, z as OfferDetail, ba as OfferDetailBase, bb as OfferEditorial, O as OfferId, bc as OfferOption, Q as OfferOptionAddress, a6 as OfferOptionAddressId, d as OfferOptionId, bd as OfferOptionSlug, be as OfferSlug, bf as OfferToken, F as OfferType, w as OffersNamespace, bg as OffersNamespaceImpl, g as OndoNamespace, n as OndoNamespaceImpl, a3 as OndoQuote, bh as OndoQuoteDuration, a4 as OndoQuoteSize, bi as OndoSellOutcome, bj as OndoSwapOffer, G as OndoSwapOfferDetail, l as OndoSwapTransactionCore, $ as OndoTradingStatus, m as OrderBookSide, bk as PKCEState, bl as PaginatedResponseDto, P as Participation, bm as ParticipationId, bn as ParticipationStatus, bo as ParticipationsPaginationParams, bp as PauseFlags, bq as Pii, br as PiiAddress, bs as PiiJurisdiction, bt as PiiKind, _ as PinoLoggerOptions, aj as ProductionLogLevel, bu as QueryParamValue, bv as QueryParamValues, ak as RedactedWalletError, bw as RedirectUri, bx as RemoveOptionAddressParams, al as RequestId, s as Requirement, by as RequirementActionNeededReason, V as RequirementId, K as RequirementStatusInfo, N as RequirementStatusValue, M as RequirementType, R as RequirementsNamespace, t as RequirementsNamespaceImpl, bz as RpcConfig, am as RpcFailureReason, bA as SOLANA_CHAINS, bB as STABLE_DECIMALS, an as SafeEvent, ao as SafeFields, bC as SolanaChain, bD as SubmitDocumentParams, S as SuperstateSwapNamespace, r as SuperstateSwapNamespaceImpl, bE as SuperstateSwapOffer, I as SuperstateSwapOfferDetail, bF as SwapContractRef, bG as SwapPreview, bH as TermItem, bI as Ticker, a5 as TokenIdentifier, a7 as TokenLogo, bJ as TokenLogoImage, bK as TokenLogoUrl, D as TokenMetadata, bL as TokenRole, T as TokensNamespace, bM as TokensNamespaceImpl, bN as Tx, ap as UnredactedFields, bO as WalletAddress, Z as WalletChallengeType, W as WalletError, bP as WalletOwnershipChallenge, bQ as WalletProtocol, o as WalletsNamespace, bR as WalletsNamespaceImpl, bS as apiErrorCode, bT as assertUint256, bU as isChain, bV as isOfferType, bW as parseUint256 } from '../tokens-namespace-DrwRi0AQ.cjs';
3
- import { N as NonEmptyArray, S as SwapQuote, F as FormattedAmountAssetUi, T as TxExplorerUrl, e as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress } from '../token-registry-snapshot-CpzLmsc2.cjs';
4
- export { A as AssetIconUrl, B as BroadcastTxParams, C as ConnectWallet, d as EvmSigner, E as EvmWallet, P as PKCEConfig, f as PKCEParams, c as TokenRegistrySnapshot, W as WriteContractParams, g as generatePKCEParams, o as offerDisplayTokens } from '../token-registry-snapshot-CpzLmsc2.cjs';
5
- import { TransactionReceipt, Hash, Chain } from 'viem';
6
- export { E as EpochMillis, M as Millis, S as Seconds, i as isExpired } from '../time-BOCS1TbH.cjs';
7
-
8
- /**
9
- * Walks every page of a cursor-paginated endpoint and returns the flattened
10
- * result.
11
- *
12
- * Lives in the API layer rather than beside `PaginationParams` because it
13
- * drives requests: it is the auto-paginating half that `list()` is built on,
14
- * while the params and the response envelope are domain models the client and
15
- * the server both name.
16
- */
17
- declare function fetchAllPages<A, P extends PaginationParams = PaginationParams>(fetchPage: (params: P) => Promise<PaginatedResponse<A>>, baseParams?: Omit<P, keyof PaginationParams>): Promise<A[]>;
18
-
19
- /**
20
- * How often the Ondo checkout refreshes what it is allowed to poll: the market
21
- * status and the indicative price. Both are free - neither spends an
22
- * attestation - so this is paced for a price the user can trust rather than
23
- * for cost.
24
- *
25
- * A built transaction is deliberately not on this timer. Building spends an
26
- * attestation, so it happens once per order and once per refresh the user
27
- * asks for.
28
- */
29
- declare const ONDO_POLL_INTERVAL_MS = 15000;
30
- /** Max time the review step offers a built quote. */
31
- declare const ONDO_QUOTE_MAX_TTL_MS = 15000;
32
- /**
33
- * The order size the sidebar prices against before the user names one.
34
- *
35
- * Ondo prices by size, so some amount has to be sent. $1,000 is a plausible
36
- * order rather than a token one: a size so small that Ondo's minimum rejects
37
- * it would leave the panel permanently blank.
38
- *
39
- * Named distinctly from `DEFAULT_AMOUNT_TO_COMPUTE_PRICE` in the swap
40
- * constants, which is a raw `bigint` of USDC base units for a different
41
- * endpoint. Both barrels are flat, so two constants of the same name could not
42
- * coexist - and they mean different things anyway.
43
- */
44
- declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
45
- /**
46
- * The coin an Ondo sell settles into, for display only.
47
- *
48
- * The scale of every amount on a built transaction comes off the response, so
49
- * this names the token and never sizes it - `receive_output_decimals` is the
50
- * only authority on how many decimals the proceeds are counted in, and the two
51
- * are allowed to disagree.
52
- *
53
- * Named apart from {@link ONDO_SUPPORTED_INPUT_ASSETS} rather than read out of
54
- * it, though both are USDC today. On a buy USDC is what the user funds with
55
- * and one of a list that may grow; on a sell it is what they settle into and
56
- * there is one of it. Reading `ONDO_SUPPORTED_INPUT_ASSETS[0]` here would make
57
- * the sell screen quietly follow whichever funding coin happened to be listed
58
- * first.
59
- */
60
- declare const ONDO_SETTLEMENT_ASSET: StablecoinSymbol;
61
- /**
62
- * The order size the sidebar prices a sell against before the user names one.
63
- *
64
- * Sells are quoted by token amount rather than by notional: the fee comes out
65
- * of dollars, and Ondo's price is size-aware, so a buy's quantity depends on
66
- * the quote being asked for while a sell is sized by what the user already
67
- * holds. One whole share is a size Ondo will price - small enough to be
68
- * plausible for any asset, large enough that Ondo's minimum does not reject it
69
- * and leave the panel permanently blank.
70
- *
71
- * The buy counterpart is {@link DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE}, which
72
- * is a dollar figure for the same reason in reverse.
73
- */
74
- declare const DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE = 1;
75
- /**
76
- * The coins an Ondo buy can be funded with, in display order, with the first
77
- * preselected.
78
- *
79
- * USDC alone today: it is what the Sepolia integration contract accepts. The
80
- * amount step renders a single entry as a plain card and two or more as a
81
- * picker, so adding one here is all it takes.
82
- */
83
- declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
84
-
85
- /**
86
- * The price of one whole asset token in a built Ondo purchase, in the funding
87
- * token's units - USD per share.
88
- *
89
- * Neither builder publishes a price. Frontline drops Ninshubur's deliberately,
90
- * because `GET /v1/ondo/swap/quote` already serves one under that name at a
91
- * different scale, and echoing both would leave a caller to guess which was
92
- * which.
93
- *
94
- * Dividing the two amounts the response *does* carry is better than reading
95
- * the indicative one anyway: it is the price this transaction fills at, rather
96
- * than a poll that has since moved and was struck against a different size.
97
- *
98
- * **Fee-exclusive.** `notionalValue` is the deposit after CoinList's fee comes
99
- * off, so this is the price Ondo filled at, not the buyer's all-in cost per
100
- * token - that would be `spendInputAmount / receiveOutputAmount`, and it is
101
- * higher. Fee-exclusive is what the review screen wants, because it renders
102
- * the fee on its own line: price x quantity, plus fee, comes to the total.
103
- * Making this all-in would double-count the fee against that breakdown.
104
- *
105
- * The two are equal until ENG-1718 turns a fee on, which frontline rejects
106
- * today. They diverge the moment it does, so the choice is load-bearing rather
107
- * than academic.
108
- */
109
- declare function computeOndoBuyPrice(transaction: OndoBuyTransaction): BlockchainAmount;
110
- /**
111
- * The price of one whole asset token in a built Ondo sale, in the settlement
112
- * token's units - USD per share, the same thing
113
- * {@link computeOndoBuyPrice} answers with the ratio inverted.
114
- *
115
- * **Fee-exclusive, and it takes arithmetic to be so.** `expected.quantity` is
116
- * published already net of `expected.fee`, so the proceeds are added back
117
- * before dividing: what comes out is the price Ondo filled at, which is the
118
- * buy arm's meaning rather than a second one. That is what lets one review row
119
- * render on either screen, and what keeps the sell breakdown honest - the fee
120
- * sits on its own line beside this, and a net price would count it twice.
121
- *
122
- * Read against {@link OndoSellTransaction.expected} alone. The `minimum` arm
123
- * describes the same trade at a different outcome, and pricing that one would
124
- * answer "the worst price this could fill at", which no screen asks for.
125
- *
126
- * The two readings coincide while frontline forces the fee to zero, which it
127
- * does today. They diverge the day ENG-1718 lands.
128
- */
129
- declare function computeOndoSellPrice(transaction: OndoSellTransaction): BlockchainAmount;
130
- /** The sooner of Ondo's deadline and now + {@link ONDO_QUOTE_MAX_TTL_MS}. */
131
- declare function ondoQuoteOfferDeadline(expiresAt: Date, nowMs?: number): Date;
132
-
133
- /**
134
- * The CoinList API's error code for an Ondo quote refused because the asset
135
- * cannot be traded right now: the market is closed or paused, or the asset is
136
- * paused or closed for the session. It arrives on a 409.
137
- *
138
- * One code for all four of Ondo's reasons, because the remedy is the same:
139
- * wait for the market to open. Ondo pauses for a moment at every US session
140
- * change (04:00 and 16:00 ET), so a poll can land on one even while
141
- * `getTradingStatus` reported the asset tradable a second earlier.
142
- */
143
- declare const ONDO_NOT_TRADABLE_CODE = "not_tradable";
144
- /**
145
- * Whether `error` is the CoinList API refusing an Ondo quote because the
146
- * market is not open, as opposed to a request that failed.
147
- *
148
- * Total: anything that is not an `HttpError` carrying
149
- * {@link ONDO_NOT_TRADABLE_CODE} is `false`.
150
- */
151
- declare function isOndoNotTradableError(error: unknown): error is HttpError;
152
-
153
- /**
154
- * The Superstate swap contract's ABI, generated verbatim from the shared
155
- * `TokenSwap` base contract:
156
- *
157
- * ```
158
- * cd ../solidity && forge inspect TokenSwap abi --json --use 0.8.34
159
- * ```
160
- *
161
- * Generated rather than hand-trimmed to the four methods the SDK calls, so
162
- * regenerating after a contract change is one command and a paste. The custom
163
- * errors carry their weight in particular: viem decodes a revert against them,
164
- * so a `preview()` on a stopped contract surfaces as `IsStopped` rather than
165
- * as an opaque `0x`-prefixed blob.
166
- *
167
- * `status()` returns `Status { uint32 flags; State state }` where `State` is
168
- * `0 = Active | 1 = Paused | 2 = Stopped`. It replaced the older
169
- * `stopped() -> uint256` bitmask, which this contract still exposes but as a
170
- * `bool`; {@link SwapStatus} reads `status()` and nothing else.
171
- */
172
- declare const SUPERSTATE_SWAP_ABI: readonly [{
173
- readonly type: "function";
174
- readonly name: "KIND";
175
- readonly inputs: readonly [];
176
- readonly outputs: readonly [{
177
- readonly name: "";
178
- readonly type: "uint16";
179
- readonly internalType: "uint16";
180
- }];
181
- readonly stateMutability: "view";
182
- }, {
183
- readonly type: "function";
184
- readonly name: "ONE_HUNDRED_P";
185
- readonly inputs: readonly [];
186
- readonly outputs: readonly [{
187
- readonly name: "";
188
- readonly type: "uint256";
189
- readonly internalType: "uint256";
190
- }];
191
- readonly stateMutability: "view";
192
- }, {
193
- readonly type: "function";
194
- readonly name: "SWAP_LEVEL";
195
- readonly inputs: readonly [];
196
- readonly outputs: readonly [{
197
- readonly name: "";
198
- readonly type: "uint32";
199
- readonly internalType: "uint32";
200
- }];
201
- readonly stateMutability: "view";
202
- }, {
203
- readonly type: "function";
204
- readonly name: "VERSION";
205
- readonly inputs: readonly [];
206
- readonly outputs: readonly [{
207
- readonly name: "";
208
- readonly type: "uint16";
209
- readonly internalType: "uint16";
210
- }];
211
- readonly stateMutability: "view";
212
- }, {
213
- readonly type: "function";
214
- readonly name: "authorized";
215
- readonly inputs: readonly [{
216
- readonly name: "user";
217
- readonly type: "address";
218
- readonly internalType: "address";
219
- }];
220
- readonly outputs: readonly [{
221
- readonly name: "";
222
- readonly type: "bool";
223
- readonly internalType: "bool";
224
- }];
225
- readonly stateMutability: "view";
226
- }, {
227
- readonly type: "function";
228
- readonly name: "bpp";
229
- readonly inputs: readonly [{
230
- readonly name: "amount";
231
- readonly type: "uint256";
232
- readonly internalType: "uint256";
233
- }];
234
- readonly outputs: readonly [{
235
- readonly name: "";
236
- readonly type: "uint256";
237
- readonly internalType: "uint256";
238
- }];
239
- readonly stateMutability: "view";
240
- }, {
241
- readonly type: "function";
242
- readonly name: "bps";
243
- readonly inputs: readonly [];
244
- readonly outputs: readonly [{
245
- readonly name: "";
246
- readonly type: "uint256";
247
- readonly internalType: "uint256";
248
- }];
249
- readonly stateMutability: "view";
250
- }, {
251
- readonly type: "function";
252
- readonly name: "cancelOwnershipHandover";
253
- readonly inputs: readonly [];
254
- readonly outputs: readonly [];
255
- readonly stateMutability: "payable";
256
- }, {
257
- readonly type: "function";
258
- readonly name: "completeOwnershipHandover";
259
- readonly inputs: readonly [{
260
- readonly name: "pendingOwner";
261
- readonly type: "address";
262
- readonly internalType: "address";
263
- }];
264
- readonly outputs: readonly [];
265
- readonly stateMutability: "payable";
266
- }, {
267
- readonly type: "function";
268
- readonly name: "fee";
269
- readonly inputs: readonly [{
270
- readonly name: "amount";
271
- readonly type: "uint256";
272
- readonly internalType: "uint256";
273
- }];
274
- readonly outputs: readonly [{
275
- readonly name: "";
276
- readonly type: "uint256";
277
- readonly internalType: "uint256";
278
- }, {
279
- readonly name: "";
280
- readonly type: "uint256";
281
- readonly internalType: "uint256";
282
- }];
283
- readonly stateMutability: "view";
284
- }, {
285
- readonly type: "function";
286
- readonly name: "id";
287
- readonly inputs: readonly [];
288
- readonly outputs: readonly [{
289
- readonly name: "";
290
- readonly type: "bytes32";
291
- readonly internalType: "bytes32";
292
- }];
293
- readonly stateMutability: "view";
294
- }, {
295
- readonly type: "function";
296
- readonly name: "inputTokens";
297
- readonly inputs: readonly [{
298
- readonly name: "";
299
- readonly type: "address";
300
- readonly internalType: "address";
301
- }];
302
- readonly outputs: readonly [{
303
- readonly name: "";
304
- readonly type: "bool";
305
- readonly internalType: "bool";
306
- }];
307
- readonly stateMutability: "view";
308
- }, {
309
- readonly type: "function";
310
- readonly name: "outputToken";
311
- readonly inputs: readonly [];
312
- readonly outputs: readonly [{
313
- readonly name: "";
314
- readonly type: "address";
315
- readonly internalType: "address";
316
- }];
317
- readonly stateMutability: "view";
318
- }, {
319
- readonly type: "function";
320
- readonly name: "outputTokenBalance";
321
- readonly inputs: readonly [];
322
- readonly outputs: readonly [{
323
- readonly name: "";
324
- readonly type: "uint256";
325
- readonly internalType: "uint256";
326
- }];
327
- readonly stateMutability: "view";
328
- }, {
329
- readonly type: "function";
330
- readonly name: "owner";
331
- readonly inputs: readonly [];
332
- readonly outputs: readonly [{
333
- readonly name: "result";
334
- readonly type: "address";
335
- readonly internalType: "address";
336
- }];
337
- readonly stateMutability: "view";
338
- }, {
339
- readonly type: "function";
340
- readonly name: "ownershipHandoverExpiresAt";
341
- readonly inputs: readonly [{
342
- readonly name: "pendingOwner";
343
- readonly type: "address";
344
- readonly internalType: "address";
345
- }];
346
- readonly outputs: readonly [{
347
- readonly name: "result";
348
- readonly type: "uint256";
349
- readonly internalType: "uint256";
350
- }];
351
- readonly stateMutability: "view";
352
- }, {
353
- readonly type: "function";
354
- readonly name: "pause";
355
- readonly inputs: readonly [{
356
- readonly name: "level";
357
- readonly type: "uint32";
358
- readonly internalType: "uint32";
359
- }];
360
- readonly outputs: readonly [{
361
- readonly name: "";
362
- readonly type: "bool";
363
- readonly internalType: "bool";
364
- }];
365
- readonly stateMutability: "nonpayable";
366
- }, {
367
- readonly type: "function";
368
- readonly name: "paused";
369
- readonly inputs: readonly [];
370
- readonly outputs: readonly [{
371
- readonly name: "";
372
- readonly type: "uint32";
373
- readonly internalType: "uint32";
374
- }];
375
- readonly stateMutability: "view";
376
- }, {
377
- readonly type: "function";
378
- readonly name: "preview";
379
- readonly inputs: readonly [{
380
- readonly name: "token";
381
- readonly type: "address";
382
- readonly internalType: "address";
383
- }, {
384
- readonly name: "amount";
385
- readonly type: "uint256";
386
- readonly internalType: "uint256";
387
- }];
388
- readonly outputs: readonly [{
389
- readonly name: "";
390
- readonly type: "tuple";
391
- readonly internalType: "struct Preview";
392
- readonly components: readonly [{
393
- readonly name: "input";
394
- readonly type: "uint256";
395
- readonly internalType: "uint256";
396
- }, {
397
- readonly name: "fee";
398
- readonly type: "uint256";
399
- readonly internalType: "uint256";
400
- }, {
401
- readonly name: "output";
402
- readonly type: "uint256";
403
- readonly internalType: "uint256";
404
- }];
405
- }];
406
- readonly stateMutability: "view";
407
- }, {
408
- readonly type: "function";
409
- readonly name: "renounceOwnership";
410
- readonly inputs: readonly [];
411
- readonly outputs: readonly [];
412
- readonly stateMutability: "payable";
413
- }, {
414
- readonly type: "function";
415
- readonly name: "requestOwnershipHandover";
416
- readonly inputs: readonly [];
417
- readonly outputs: readonly [];
418
- readonly stateMutability: "payable";
419
- }, {
420
- readonly type: "function";
421
- readonly name: "setBps";
422
- readonly inputs: readonly [{
423
- readonly name: "points";
424
- readonly type: "uint256";
425
- readonly internalType: "uint256";
426
- }];
427
- readonly outputs: readonly [{
428
- readonly name: "";
429
- readonly type: "bool";
430
- readonly internalType: "bool";
431
- }];
432
- readonly stateMutability: "nonpayable";
433
- }, {
434
- readonly type: "function";
435
- readonly name: "setInputToken";
436
- readonly inputs: readonly [{
437
- readonly name: "token";
438
- readonly type: "address";
439
- readonly internalType: "address";
440
- }, {
441
- readonly name: "val";
442
- readonly type: "bool";
443
- readonly internalType: "bool";
444
- }];
445
- readonly outputs: readonly [{
446
- readonly name: "";
447
- readonly type: "bool";
448
- readonly internalType: "bool";
449
- }];
450
- readonly stateMutability: "nonpayable";
451
- }, {
452
- readonly type: "function";
453
- readonly name: "status";
454
- readonly inputs: readonly [];
455
- readonly outputs: readonly [{
456
- readonly name: "";
457
- readonly type: "tuple";
458
- readonly internalType: "struct Status";
459
- readonly components: readonly [{
460
- readonly name: "flags";
461
- readonly type: "uint32";
462
- readonly internalType: "uint32";
463
- }, {
464
- readonly name: "state";
465
- readonly type: "uint8";
466
- readonly internalType: "enum State";
467
- }];
468
- }];
469
- readonly stateMutability: "view";
470
- }, {
471
- readonly type: "function";
472
- readonly name: "stop";
473
- readonly inputs: readonly [];
474
- readonly outputs: readonly [{
475
- readonly name: "";
476
- readonly type: "bool";
477
- readonly internalType: "bool";
478
- }];
479
- readonly stateMutability: "nonpayable";
480
- }, {
481
- readonly type: "function";
482
- readonly name: "stopped";
483
- readonly inputs: readonly [];
484
- readonly outputs: readonly [{
485
- readonly name: "";
486
- readonly type: "bool";
487
- readonly internalType: "bool";
488
- }];
489
- readonly stateMutability: "view";
490
- }, {
491
- readonly type: "function";
492
- readonly name: "swap";
493
- readonly inputs: readonly [{
494
- readonly name: "token";
495
- readonly type: "address";
496
- readonly internalType: "address";
497
- }, {
498
- readonly name: "amount";
499
- readonly type: "uint256";
500
- readonly internalType: "uint256";
501
- }, {
502
- readonly name: "slip";
503
- readonly type: "uint256";
504
- readonly internalType: "uint256";
505
- }];
506
- readonly outputs: readonly [{
507
- readonly name: "";
508
- readonly type: "uint256";
509
- readonly internalType: "uint256";
510
- }];
511
- readonly stateMutability: "nonpayable";
512
- }, {
513
- readonly type: "function";
514
- readonly name: "tokenBalance";
515
- readonly inputs: readonly [{
516
- readonly name: "token";
517
- readonly type: "address";
518
- readonly internalType: "address";
519
- }];
520
- readonly outputs: readonly [{
521
- readonly name: "";
522
- readonly type: "uint256";
523
- readonly internalType: "uint256";
524
- }];
525
- readonly stateMutability: "view";
526
- }, {
527
- readonly type: "function";
528
- readonly name: "totals";
529
- readonly inputs: readonly [{
530
- readonly name: "user";
531
- readonly type: "address";
532
- readonly internalType: "address";
533
- }, {
534
- readonly name: "token";
535
- readonly type: "address";
536
- readonly internalType: "address";
537
- }];
538
- readonly outputs: readonly [{
539
- readonly name: "";
540
- readonly type: "tuple";
541
- readonly internalType: "struct SwapTotal";
542
- readonly components: readonly [{
543
- readonly name: "inputSum";
544
- readonly type: "uint256";
545
- readonly internalType: "uint256";
546
- }, {
547
- readonly name: "feeSum";
548
- readonly type: "uint256";
549
- readonly internalType: "uint256";
550
- }, {
551
- readonly name: "outputSum";
552
- readonly type: "uint256";
553
- readonly internalType: "uint256";
554
- }, {
555
- readonly name: "count";
556
- readonly type: "uint256";
557
- readonly internalType: "uint256";
558
- }];
559
- }];
560
- readonly stateMutability: "view";
561
- }, {
562
- readonly type: "function";
563
- readonly name: "totals";
564
- readonly inputs: readonly [{
565
- readonly name: "token";
566
- readonly type: "address";
567
- readonly internalType: "address";
568
- }];
569
- readonly outputs: readonly [{
570
- readonly name: "";
571
- readonly type: "tuple";
572
- readonly internalType: "struct SwapTotal";
573
- readonly components: readonly [{
574
- readonly name: "inputSum";
575
- readonly type: "uint256";
576
- readonly internalType: "uint256";
577
- }, {
578
- readonly name: "feeSum";
579
- readonly type: "uint256";
580
- readonly internalType: "uint256";
581
- }, {
582
- readonly name: "outputSum";
583
- readonly type: "uint256";
584
- readonly internalType: "uint256";
585
- }, {
586
- readonly name: "count";
587
- readonly type: "uint256";
588
- readonly internalType: "uint256";
589
- }];
590
- }];
591
- readonly stateMutability: "view";
592
- }, {
593
- readonly type: "function";
594
- readonly name: "transfer";
595
- readonly inputs: readonly [{
596
- readonly name: "to";
597
- readonly type: "address";
598
- readonly internalType: "address";
599
- }, {
600
- readonly name: "amount";
601
- readonly type: "uint256";
602
- readonly internalType: "uint256";
603
- }];
604
- readonly outputs: readonly [{
605
- readonly name: "";
606
- readonly type: "bool";
607
- readonly internalType: "bool";
608
- }];
609
- readonly stateMutability: "nonpayable";
610
- }, {
611
- readonly type: "function";
612
- readonly name: "transfer";
613
- readonly inputs: readonly [{
614
- readonly name: "to";
615
- readonly type: "address";
616
- readonly internalType: "address";
617
- }, {
618
- readonly name: "token";
619
- readonly type: "address";
620
- readonly internalType: "address";
621
- }, {
622
- readonly name: "amount";
623
- readonly type: "uint256";
624
- readonly internalType: "uint256";
625
- }];
626
- readonly outputs: readonly [{
627
- readonly name: "";
628
- readonly type: "bool";
629
- readonly internalType: "bool";
630
- }];
631
- readonly stateMutability: "nonpayable";
632
- }, {
633
- readonly type: "function";
634
- readonly name: "transferOwnership";
635
- readonly inputs: readonly [{
636
- readonly name: "newOwner";
637
- readonly type: "address";
638
- readonly internalType: "address";
639
- }];
640
- readonly outputs: readonly [];
641
- readonly stateMutability: "payable";
642
- }, {
643
- readonly type: "event";
644
- readonly name: "BpsUpdated";
645
- readonly inputs: readonly [{
646
- readonly name: "prev";
647
- readonly type: "uint256";
648
- readonly indexed: false;
649
- readonly internalType: "uint256";
650
- }, {
651
- readonly name: "next";
652
- readonly type: "uint256";
653
- readonly indexed: false;
654
- readonly internalType: "uint256";
655
- }];
656
- readonly anonymous: false;
657
- }, {
658
- readonly type: "event";
659
- readonly name: "InputTokenUpdated";
660
- readonly inputs: readonly [{
661
- readonly name: "token";
662
- readonly type: "address";
663
- readonly indexed: true;
664
- readonly internalType: "address";
665
- }, {
666
- readonly name: "prev";
667
- readonly type: "bool";
668
- readonly indexed: false;
669
- readonly internalType: "bool";
670
- }, {
671
- readonly name: "next";
672
- readonly type: "bool";
673
- readonly indexed: false;
674
- readonly internalType: "bool";
675
- }];
676
- readonly anonymous: false;
677
- }, {
678
- readonly type: "event";
679
- readonly name: "OwnershipHandoverCanceled";
680
- readonly inputs: readonly [{
681
- readonly name: "pendingOwner";
682
- readonly type: "address";
683
- readonly indexed: true;
684
- readonly internalType: "address";
685
- }];
686
- readonly anonymous: false;
687
- }, {
688
- readonly type: "event";
689
- readonly name: "OwnershipHandoverRequested";
690
- readonly inputs: readonly [{
691
- readonly name: "pendingOwner";
692
- readonly type: "address";
693
- readonly indexed: true;
694
- readonly internalType: "address";
695
- }];
696
- readonly anonymous: false;
697
- }, {
698
- readonly type: "event";
699
- readonly name: "OwnershipTransferred";
700
- readonly inputs: readonly [{
701
- readonly name: "oldOwner";
702
- readonly type: "address";
703
- readonly indexed: true;
704
- readonly internalType: "address";
705
- }, {
706
- readonly name: "newOwner";
707
- readonly type: "address";
708
- readonly indexed: true;
709
- readonly internalType: "address";
710
- }];
711
- readonly anonymous: false;
712
- }, {
713
- readonly type: "event";
714
- readonly name: "Paused";
715
- readonly inputs: readonly [{
716
- readonly name: "previous";
717
- readonly type: "uint32";
718
- readonly indexed: false;
719
- readonly internalType: "uint32";
720
- }, {
721
- readonly name: "next";
722
- readonly type: "uint32";
723
- readonly indexed: false;
724
- readonly internalType: "uint32";
725
- }];
726
- readonly anonymous: false;
727
- }, {
728
- readonly type: "event";
729
- readonly name: "Stopped";
730
- readonly inputs: readonly [];
731
- readonly anonymous: false;
732
- }, {
733
- readonly type: "event";
734
- readonly name: "Swapped";
735
- readonly inputs: readonly [{
736
- readonly name: "user";
737
- readonly type: "address";
738
- readonly indexed: true;
739
- readonly internalType: "address";
740
- }, {
741
- readonly name: "inputToken";
742
- readonly type: "address";
743
- readonly indexed: true;
744
- readonly internalType: "address";
745
- }, {
746
- readonly name: "outputToken";
747
- readonly type: "address";
748
- readonly indexed: true;
749
- readonly internalType: "address";
750
- }, {
751
- readonly name: "inputAmount";
752
- readonly type: "uint256";
753
- readonly indexed: false;
754
- readonly internalType: "uint256";
755
- }, {
756
- readonly name: "fee";
757
- readonly type: "uint256";
758
- readonly indexed: false;
759
- readonly internalType: "uint256";
760
- }, {
761
- readonly name: "outputAmount";
762
- readonly type: "uint256";
763
- readonly indexed: false;
764
- readonly internalType: "uint256";
765
- }];
766
- readonly anonymous: false;
767
- }, {
768
- readonly type: "event";
769
- readonly name: "Transferred";
770
- readonly inputs: readonly [{
771
- readonly name: "to";
772
- readonly type: "address";
773
- readonly indexed: true;
774
- readonly internalType: "address";
775
- }, {
776
- readonly name: "token";
777
- readonly type: "address";
778
- readonly indexed: true;
779
- readonly internalType: "address";
780
- }, {
781
- readonly name: "amount";
782
- readonly type: "uint256";
783
- readonly indexed: false;
784
- readonly internalType: "uint256";
785
- }];
786
- readonly anonymous: false;
787
- }, {
788
- readonly type: "error";
789
- readonly name: "AlreadyInitialized";
790
- readonly inputs: readonly [];
791
- }, {
792
- readonly type: "error";
793
- readonly name: "InsufficientAmount";
794
- readonly inputs: readonly [];
795
- }, {
796
- readonly type: "error";
797
- readonly name: "InvalidAddress";
798
- readonly inputs: readonly [];
799
- }, {
800
- readonly type: "error";
801
- readonly name: "InvalidAmount";
802
- readonly inputs: readonly [];
803
- }, {
804
- readonly type: "error";
805
- readonly name: "IsPaused";
806
- readonly inputs: readonly [{
807
- readonly name: "level";
808
- readonly type: "uint32";
809
- readonly internalType: "uint32";
810
- }];
811
- }, {
812
- readonly type: "error";
813
- readonly name: "IsStopped";
814
- readonly inputs: readonly [];
815
- }, {
816
- readonly type: "error";
817
- readonly name: "NewOwnerIsZeroAddress";
818
- readonly inputs: readonly [];
819
- }, {
820
- readonly type: "error";
821
- readonly name: "NoHandoverRequest";
822
- readonly inputs: readonly [];
823
- }, {
824
- readonly type: "error";
825
- readonly name: "SwapFailed";
826
- readonly inputs: readonly [{
827
- readonly name: "user";
828
- readonly type: "address";
829
- readonly internalType: "address";
830
- }, {
831
- readonly name: "token";
832
- readonly type: "address";
833
- readonly internalType: "address";
834
- }];
835
- }, {
836
- readonly type: "error";
837
- readonly name: "Unauthorized";
838
- readonly inputs: readonly [];
839
- }];
840
-
841
- /**
842
- * Price of 1 output token in USD, assuming the input token is a $1 stablecoin.
843
- *
844
- * `raw_price = inputTokenAmount.raw × 10^outputDecimals ÷ outputTokenAmount.raw`
845
- *
846
- * The multiplication happens before the division so we never lose precision to
847
- * integer truncation early. This mirrors standard fixed-point practice on-chain.
848
- * Returned decimals match the input token decimals (always the stablecoin's 6).
849
- */
850
- declare function computePrice({ inputTokenAmount, outputTokenAmount, }: SwapQuote): BlockchainAmount | null;
851
- /**
852
- * Applies slippage to an amount, returning the minimum acceptable amount:
853
- * `amount × (BPS_DENOM − slippage) / BPS_DENOM`. Throws when `slippage` exceeds
854
- * `BPS_DENOM` (the retained fraction would be negative).
855
- */
856
- declare function computeSlip(amount: BlockchainAmount, slippage: Bps): BlockchainAmount;
857
-
858
- /**
859
- * The bit `Operable.paused` sets for the swap operation, mirroring the
860
- * contract's `SWAP_LEVEL` constant.
861
- *
862
- * A constant rather than a `SWAP_LEVEL()` read: it is `constant` in the
863
- * contract, so reading it would spend a round-trip to be told the same number
864
- * every time.
865
- */
866
- declare const SWAP_LEVEL = 2;
867
- /**
868
- * Whether the contract will actually accept a swap right now.
869
- *
870
- * Not the same question as "is it active". `paused` is a bitmask over
871
- * *operations*, so a contract can suspend something unrelated and go on
872
- * swapping; only the {@link SWAP_LEVEL} bit stops it. Reading `state ===
873
- * 'active'` instead would refuse swaps the contract is perfectly willing to
874
- * make.
875
- */
876
- declare function isSwapAvailable(status: SwapStatus): boolean;
877
-
878
- /**
879
- * Decodes the confirmed output amount from the `Swapped` event in a swap
880
- * transaction receipt.
881
- *
882
- * Returns `null` when the event is absent or the amount is not a valid uint256
883
- * so callers can fall back to the quote's expected output — the swap already
884
- * confirmed on-chain, so a missing/undecodable event should not fail the flow.
885
- */
886
- declare function decodeSwappedOutputAmount(receipt: TransactionReceipt, outputDecimals: AssetDecimals): BlockchainAmount | null;
887
-
888
- /**
889
- * Who issues the asset a Superstate swap pays out.
890
- *
891
- * A constant rather than a field off the offer: no frontline endpoint carries
892
- * an issuer, and every offer this checkout serves is Superstate's by
893
- * definition — `CheckoutContainer` routes here on `superstate::swap` alone.
894
- */
895
- declare const SUPERSTATE_ISSUER_NAME = "Superstate";
896
- /**
897
- * The coins a Superstate swap can be funded with, in display order, with the
898
- * first preselected.
899
- *
900
- * USDC alone today: it is what the deployed swap contract accepts. The amount
901
- * step renders a single entry as a plain card and two or more as a picker, so
902
- * adding one here is all it takes.
903
- */
904
- declare const SUPERSTATE_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
905
- /** Poll interval for refreshing on-chain swap quotes and balances. */
906
- declare const SWAP_POLL_INTERVAL_MS = 15000;
907
- /**
908
- * Notional input used to derive a display price-per-share when the user has
909
- * not yet entered an amount (1 USDC at 6 decimals).
910
- */
911
- declare const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
912
- /** Slippage tolerances offered in the review step, in basis points. */
913
- declare const SLIPPAGE_OPTIONS_BPS: Bps[];
914
- /** Default slippage tolerance (0.5%). */
915
- declare const DEFAULT_SLIPPAGE_BPS: Bps;
916
- /**
917
- * The deployed Superstate swap contract on Ethereum Sepolia, and therefore the
918
- * ERC-20 spender the user approves there.
919
- *
920
- * Exported in its own right for a partner driving `coinlist.superstate.execute`
921
- * at Level 1, where the contract is an explicit parameter.
922
- */
923
- declare const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress;
924
- /**
925
- * The Superstate swap contract on `chain`, or `null` where none is deployed.
926
- *
927
- * TODO(ENG-1734): Ondo now reads its spender off the offer's `swap_contracts`
928
- * via `swapSpender`, which is why that helper sits in `shared/core/offers/`
929
- * rather than under a provider. Superstate still resolves from this table, so
930
- * two mechanisms answer one question. Migrate once frontline serves
931
- * `swap_contracts` on Superstate offers too.
932
- */
933
- declare function superstateSwapContractAddress(chain: EthereumChain): EvmContractAddress | null;
934
-
935
- /**
936
- * Formats a quote's implied price per output token as a USD amount.
937
- *
938
- * Lives with the provider rather than in `@/universal/core/shared/blockchain/formatters`
939
- * because {@link SwapQuote} and {@link computePrice} are Superstate's: the
940
- * shared formatters stay provider-agnostic.
941
- */
942
- declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
943
-
944
- /**
945
- * The CoinList contract a swap on `chain` settles through, and therefore the
946
- * ERC-20 spender the user approves - or `null` where this offer cannot be
947
- * swapped on that chain.
948
- *
949
- * Read off the offer rather than held as a constant because the address varies
950
- * by environment, not only by chain: beta and production both run
951
- * `ethereum_sepolia` and deploy a different contract on each, and one constant
952
- * cannot name both. Frontline resolves it per environment and serves the
953
- * answer on the offer.
954
- *
955
- * The array varies per *offer* as well as per chain - frontline drops a chain
956
- * whose funding and swap tokens do not both resolve for this asset - so an
957
- * array read for one symbol must not be reused for another. An empty array
958
- * means "cannot swap here", which is an answer rather than an error.
959
- *
960
- * A capability rather than a provider slice, and named for the data it reads
961
- * rather than for its first caller: `swap_contracts` is an offer field, and
962
- * `universal-core-isolation-and-sharing` would stop Superstate reusing this if
963
- * it lived under `checkout/ondo/`. Superstate has not migrated yet - it still
964
- * reads `superstateSwapContractAddress` - so Ondo is the only caller today.
965
- */
966
- declare function swapSpender(swapContracts: OfferSwapContract[], chain: EthereumChain): EvmContractAddress | null;
967
-
968
- /** Basis-point denominator: 10_000 bps = 100%. */
969
- declare const BPS_DENOM: Bps;
970
- /**
971
- * Applies a basis-point fraction to an amount, flooring the result.
972
- * `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an
973
- * overflow (bps far above BPS_DENOM) or a negative product is rejected.
974
- */
975
- declare function applyBps(amount: Uint256, bps: Bps): Uint256;
976
-
977
- /** The viem chain definition the SDK reads and writes this chain through. */
978
- declare function viemChain(chain: EthereumChain): Chain;
979
- declare function getChainId(chain: EthereumChain): number;
980
- /**
981
- * Resolves an EIP-155 chain id to the chain the SDK names it by — the inverse
982
- * of {@link getChainId}, for backends that report a bare `chain_id`.
983
- *
984
- * @throws ValidationError on an unrecognised id. Defaulting to mainnet would
985
- * let a testnet response read as a live one.
986
- */
987
- declare function chainFromId(chainId: string): EthereumChain;
988
- declare function getNetworkName(chain: EthereumChain): string;
989
- declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
990
-
991
- /**
992
- * Minimal ERC-20 ABI the SDK writes against (mirrors viem's `erc20Abi`). The
993
- * swap flow uses `approve`; `allowance`/`balanceOf`/`decimals`/`symbol`/`name`
994
- * are included so reads share a single SDK-owned ABI.
995
- */
996
- declare const ERC20_ABI: readonly [{
997
- readonly type: "function";
998
- readonly name: "allowance";
999
- readonly inputs: readonly [{
1000
- readonly name: "owner";
1001
- readonly type: "address";
1002
- }, {
1003
- readonly name: "spender";
1004
- readonly type: "address";
1005
- }];
1006
- readonly outputs: readonly [{
1007
- readonly name: "";
1008
- readonly type: "uint256";
1009
- }];
1010
- readonly stateMutability: "view";
1011
- }, {
1012
- readonly type: "function";
1013
- readonly name: "approve";
1014
- readonly inputs: readonly [{
1015
- readonly name: "spender";
1016
- readonly type: "address";
1017
- }, {
1018
- readonly name: "amount";
1019
- readonly type: "uint256";
1020
- }];
1021
- readonly outputs: readonly [{
1022
- readonly name: "";
1023
- readonly type: "bool";
1024
- }];
1025
- readonly stateMutability: "nonpayable";
1026
- }, {
1027
- readonly type: "function";
1028
- readonly name: "balanceOf";
1029
- readonly inputs: readonly [{
1030
- readonly name: "account";
1031
- readonly type: "address";
1032
- }];
1033
- readonly outputs: readonly [{
1034
- readonly name: "";
1035
- readonly type: "uint256";
1036
- }];
1037
- readonly stateMutability: "view";
1038
- }, {
1039
- readonly type: "function";
1040
- readonly name: "decimals";
1041
- readonly inputs: readonly [];
1042
- readonly outputs: readonly [{
1043
- readonly name: "";
1044
- readonly type: "uint8";
1045
- }];
1046
- readonly stateMutability: "view";
1047
- }, {
1048
- readonly type: "function";
1049
- readonly name: "name";
1050
- readonly inputs: readonly [];
1051
- readonly outputs: readonly [{
1052
- readonly name: "";
1053
- readonly type: "string";
1054
- }];
1055
- readonly stateMutability: "view";
1056
- }, {
1057
- readonly type: "function";
1058
- readonly name: "symbol";
1059
- readonly inputs: readonly [];
1060
- readonly outputs: readonly [{
1061
- readonly name: "";
1062
- readonly type: "string";
1063
- }];
1064
- readonly stateMutability: "view";
1065
- }, {
1066
- readonly type: "function";
1067
- readonly name: "totalSupply";
1068
- readonly inputs: readonly [];
1069
- readonly outputs: readonly [{
1070
- readonly name: "";
1071
- readonly type: "uint256";
1072
- }];
1073
- readonly stateMutability: "view";
1074
- }, {
1075
- readonly type: "function";
1076
- readonly name: "transfer";
1077
- readonly inputs: readonly [{
1078
- readonly name: "recipient";
1079
- readonly type: "address";
1080
- }, {
1081
- readonly name: "amount";
1082
- readonly type: "uint256";
1083
- }];
1084
- readonly outputs: readonly [{
1085
- readonly name: "";
1086
- readonly type: "bool";
1087
- }];
1088
- readonly stateMutability: "nonpayable";
1089
- }, {
1090
- readonly type: "function";
1091
- readonly name: "transferFrom";
1092
- readonly inputs: readonly [{
1093
- readonly name: "sender";
1094
- readonly type: "address";
1095
- }, {
1096
- readonly name: "recipient";
1097
- readonly type: "address";
1098
- }, {
1099
- readonly name: "amount";
1100
- readonly type: "uint256";
1101
- }];
1102
- readonly outputs: readonly [{
1103
- readonly name: "";
1104
- readonly type: "bool";
1105
- }];
1106
- readonly stateMutability: "nonpayable";
1107
- }, {
1108
- readonly type: "event";
1109
- readonly name: "Approval";
1110
- readonly inputs: readonly [{
1111
- readonly name: "owner";
1112
- readonly type: "address";
1113
- readonly indexed: true;
1114
- }, {
1115
- readonly name: "spender";
1116
- readonly type: "address";
1117
- readonly indexed: true;
1118
- }, {
1119
- readonly name: "value";
1120
- readonly type: "uint256";
1121
- readonly indexed: false;
1122
- }];
1123
- readonly anonymous: false;
1124
- }, {
1125
- readonly type: "event";
1126
- readonly name: "Transfer";
1127
- readonly inputs: readonly [{
1128
- readonly name: "from";
1129
- readonly type: "address";
1130
- readonly indexed: true;
1131
- }, {
1132
- readonly name: "to";
1133
- readonly type: "address";
1134
- readonly indexed: true;
1135
- }, {
1136
- readonly name: "value";
1137
- readonly type: "uint256";
1138
- readonly indexed: false;
1139
- }];
1140
- readonly anonymous: false;
1141
- }];
1142
-
1143
- declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
1144
- type FormatAmountOptions = {
1145
- maxFractionDigits?: AssetDecimals;
1146
- /**
1147
- * Trailing zeros are kept down to this many places. Defaults to
1148
- * `maxFractionDigits` when that is set, otherwise 2 (or the token's own
1149
- * decimals, when fewer). A figure that wants a cap and a shorter floor —
1150
- * a share headline — passes both.
1151
- */
1152
- minFractionDigits?: AssetDecimals;
1153
- };
1154
- declare function formatAmount(amount: BlockchainAmount, locale: string, options?: FormatAmountOptions): FormattedAmountUi;
1155
- declare function formatRawAmount(amount: BlockchainAmount): string;
1156
- /**
1157
- * Formats a {@link BlockchainAmount} using compact notation (e.g. `1.37B`,
1158
- * `5M`). Compact notation only surfaces a couple of significant decimals, so
1159
- * the bigint → number narrowing here is intentional and safe: full precision
1160
- * is deliberately dropped in favour of a human-readable summary value.
1161
- */
1162
- declare function formatCompactAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
1163
- declare function formatBpsAsPercent(bps: Bps, locale: string): FormattedPercentUi;
1164
- declare function usdAmount(amount: FormattedAmountUi): FormattedAmountAssetUi;
1165
- declare function assetAmount(amount: FormattedAmountUi, symbol: AssetSymbol): FormattedAmountAssetUi;
1166
- /** Placeholder shown when an amount is unavailable (e.g. a loading quote). */
1167
- declare const NA_AMOUNT_ASSET_UI: FormattedAmountAssetUi;
1168
- /**
1169
- * A share quantity for a headline: at most 6 decimal places, at least 2, with
1170
- * the zeros between those dropped.
1171
- *
1172
- * An 18-decimal fill (`0.002689383776381483`) otherwise takes the whole
1173
- * confirmation row and the fund name collapses to an ellipsis. Places past 6
1174
- * are dust at share scale. The chain amount is unchanged, and the transaction
1175
- * link still carries the exact figure.
1176
- */
1177
- declare function formatShareAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
1178
- /**
1179
- * Formats a USD amount capped at 2 fractional digits, falling back to the
1180
- * {@link NA_AMOUNT_ASSET_UI} placeholder when the amount is absent.
1181
- */
1182
- declare function formattedUsdPrice(amount: BlockchainAmount | null, locale: string): FormattedAmountAssetUi;
1183
-
1184
- /** A typed, i18n-agnostic reason a raw amount string failed to parse. */
1185
- type AmountParseErrorReason = {
1186
- type: 'empty';
1187
- } | {
1188
- type: 'negative';
1189
- } | {
1190
- type: 'invalid-format';
1191
- } | {
1192
- type: 'too-many-decimals';
1193
- maxDecimals: AssetDecimals;
1194
- }
1195
- /** Scaled up by `decimals`, the amount no longer fits a uint256. */
1196
- | {
1197
- type: 'overflow';
1198
- };
1199
- type AmountParseResult = {
1200
- valid: true;
1201
- amount: BlockchainAmount;
1202
- } | {
1203
- valid: false;
1204
- reason: AmountParseErrorReason;
1205
- };
1206
- /**
1207
- * Wraps a raw uint256 base-unit string — what Ondo and the on-chain reads
1208
- * return ("100000000" is 100 USDC, not 100 wei-of-nothing) — in a
1209
- * {@link BlockchainAmount} at the given decimals. The value is already scaled,
1210
- * so `decimals` is only the unit tag that travels with it.
1211
- *
1212
- * Distinct from {@link parseBlockchainAmount}, which takes a *human decimal*
1213
- * string and scales it up. Feeding a raw amount to that one silently
1214
- * multiplies it by 10^decimals — pick by what the backend sends, not by which
1215
- * one is closer at hand.
1216
- *
1217
- * @throws ValidationError when the string is not a non-negative uint256
1218
- * integer. A backend that regresses to decimal strings fails loudly here
1219
- * rather than truncating.
1220
- */
1221
- declare function blockchainAmountFromRawOrThrow({ label, raw, decimals, }: {
1222
- label: string;
1223
- raw: string;
1224
- decimals: AssetDecimals;
1225
- }): BlockchainAmount;
1226
- /**
1227
- * Parses a user-entered decimal string into a {@link BlockchainAmount} at the
1228
- * given token decimals. Rejects scientific notation, negatives, malformed
1229
- * input, more fractional digits than the token supports, and amounts that
1230
- * scale past uint256 — surfacing a typed {@link AmountParseErrorReason} so
1231
- * callers own the display copy.
1232
- */
1233
- declare function parseBlockchainAmount(amount: string, decimals: AssetDecimals): AmountParseResult;
1234
-
1235
- declare const USDC_SYMBOL: StablecoinSymbol;
1236
- declare const USDC: Erc20Asset;
1237
- declare const USDT_SYMBOL: StablecoinSymbol;
1238
- declare const USDT: Erc20Asset;
1239
- /** Lookups for the stablecoins the SDK's swap flows support out of the box. */
1240
- declare const TOKEN_REGISTRY: {
1241
- erc20: (symbol: KnownAssetSymbol) => Erc20Asset;
1242
- /**
1243
- * USDC's contract on `chain`. USDC is deployed on every chain the SDK
1244
- * models, so the table is total and the answer is never `null`.
1245
- */
1246
- usdcAddress: (chain: EthereumChain) => EvmContractAddress;
1247
- /**
1248
- * USDT's contract on `chain`, or `null` where Tether publishes none —
1249
- * Base Sepolia today. The honest answer, never a fake address a balance
1250
- * read would call.
1251
- */
1252
- usdtAddress: (chain: EthereumChain) => EvmContractAddress | null;
1253
- };
1254
-
1255
- /**
1256
- * Error thrown when a feature or code path is not yet implemented.
1257
- */
1258
- declare class NotImplementedError extends Error {
1259
- constructor(message?: string);
1260
- }
1261
- /**
1262
- * Error thrown when accessing a feature that requires authentication
1263
- * without being authenticated.
1264
- */
1265
- declare class NotAuthenticatedError extends Error {
1266
- constructor(message?: string);
1267
- }
1268
- declare class ValidationError extends Error {
1269
- constructor(message: string);
1270
- }
1271
- /**
1272
- * Error thrown when the SDK computes something impossible: a value outside
1273
- * uint256 after its own arithmetic, a symbol missing from a registry the SDK
1274
- * itself ships. Distinct from {@link ValidationError}, which means the backend
1275
- * sent a shape the SDK does not understand.
1276
- *
1277
- * The two have different remedies, which is the whole reason they are separate
1278
- * types: a {@link ValidationError} is worth reporting to CoinList, an
1279
- * `InvariantError` is an SDK bug worth reporting against the SDK.
1280
- */
1281
- declare class InvariantError extends Error {
1282
- constructor(message: string);
1283
- }
1284
- /**
1285
- * Error thrown when an arithmetic operation has no answer to give: a division
1286
- * by zero, or a result that falls outside the range its type can represent.
1287
- *
1288
- * Distinct from {@link ValidationError}, which says a value arrived malformed.
1289
- * A `MathError` says every operand was well-formed and the operation on them
1290
- * still has no result, so the two are worth catching apart: one points at the
1291
- * response, the other at the arithmetic we asked for.
1292
- */
1293
- declare class MathError extends Error {
1294
- constructor(message: string);
1295
- }
1296
-
1297
- type UserDto = {
1298
- id: string;
1299
- email: string;
1300
- };
1301
-
1302
- type UserId = Newtype<string, 'UserId'>;
1303
- declare const UserId: (value: string) => UserId;
1304
- type UserEmail = Newtype<string, 'UserEmail'>;
1305
- declare const UserEmail: (value: string) => UserEmail;
1306
- type User = {
1307
- id: UserId;
1308
- email: UserEmail;
1309
- };
1310
- declare const User: {
1311
- fromDto: (dto: UserDto) => User;
1312
- };
1313
-
1314
- export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, 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, OndoBuyTransaction, OndoSellTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, SWAP_LEVEL, SWAP_POLL_INTERVAL_MS, ShortenedWalletAddress, StablecoinSymbol, SwapQuote, SwapStatus, TOKEN_REGISTRY, TxExplorerUrl, USDC, USDC_SYMBOL, USDT, USDT_SYMBOL, Uint256, User, UserEmail, UserId, ValidationError, applyBps, assetAmount, blockchainAmountFromRawOrThrow, chainFromId, computeOndoBuyPrice, computeOndoSellPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formatShareAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isOndoNotTradableError, isSwapAvailable, ondoQuoteOfferDeadline, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, swapSpender, txExplorerUrl, usdAmount, viemChain };