@coinlist-co/react 0.10.1 → 0.11.0
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.
- package/README.md +32 -0
- package/dist/{chunk-AQVCOWOV.js → chunk-B2HCVPCQ.js} +202 -318
- package/dist/chunk-B2HCVPCQ.js.map +1 -0
- package/dist/chunk-KDGNDAHA.js +146 -0
- package/dist/chunk-KDGNDAHA.js.map +1 -0
- package/dist/chunk-UIIXXLA7.js +1863 -0
- package/dist/chunk-UIIXXLA7.js.map +1 -0
- package/dist/client/index.cjs +10382 -3262
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +4219 -862
- package/dist/client/index.d.ts +4219 -862
- package/dist/client/index.js +8727 -2369
- package/dist/client/index.js.map +1 -1
- package/dist/collections-BhDkYmzV.d.cts +65 -0
- package/dist/collections-CZhHoQHr.d.ts +65 -0
- package/dist/config-B5mwS_2l.d.cts +1926 -0
- package/dist/config-B5mwS_2l.d.ts +1926 -0
- package/dist/server/index.cjs +981 -464
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +190 -163
- package/dist/server/index.d.ts +190 -163
- package/dist/server/index.js +151 -154
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +1810 -907
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +243 -132
- package/dist/shared/index.d.ts +243 -132
- package/dist/shared/index.js +96 -28
- package/package.json +10 -7
- package/dist/chunk-AQVCOWOV.js.map +0 -1
- package/dist/chunk-TBU3EBNM.js +0 -442
- package/dist/chunk-TBU3EBNM.js.map +0 -1
- package/dist/chunk-UOHD7US2.js +0 -855
- package/dist/chunk-UOHD7US2.js.map +0 -1
- package/dist/collections-Bv1Oxzu_.d.ts +0 -28
- package/dist/collections-DDyxbOPZ.d.cts +0 -28
- package/dist/requirement-oVZA1INj.d.cts +0 -1040
- package/dist/requirement-oVZA1INj.d.ts +0 -1040
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a5 as PaginationParams, a6 as PaginatedResponse, m as Bps, a7 as Uint256, a as EthereumChain, M as AssetDecimals, i as AssetSymbol, B as BlockchainAmount, E as EvmWalletAddress, a8 as KnownAssetSymbol, u as Erc20Asset, c as EvmContractAddress, w as StablecoinSymbol, a9 as DecimalString, j as OndoSwapTransaction, aa as SwapStatus, ab as Newtype } from '../config-B5mwS_2l.js';
|
|
2
|
+
export { ac as AllowWalletParams, ad as AllowWalletResponse, ae as Asset, af as AssetCode, f as AssetId, A as AuthorizationCode, ag as Blockchain, V as BuildOndoSwapTransactionParams, ah as Chain, a2 as ClientCredentialsOAuth, ai as ClientId, a3 as ClientSecret, aj as CodeChallenge, C as CodeVerifier, d as CoinListTokenSaleNamespace, g as CoinListTokenSaleNamespaceImpl, q as Config, ak as ConnectExternalWalletParams, al as CreateKycTokenParams, am as CreateParticipationParams, an as CreateWalletOwnershipChallengeParams, ao as Cursor, ap as DocumentFormType, J as DocumentSubmission, aq as DocumentSubmissionStatus, ar as DocumentType, as as ETHEREUM_CHAINS, b as Erc20Namespace, at as Erc20NamespaceImpl, au as FaqItem, av as GetOndoQuoteParams, aw as GetOndoTradingStatusParams, ax as GetSwapAuthorizationParams, ay as GetSwapPreviewParams, az as GetTokenAllowanceParams, aA as GetTokenBalanceParams, aB as HexEncodedTransactionData, _ as HttpError, $ as HttpResponse, aC as Iso2CountryCode, K as KycLevelName, a0 as KycToken, aD as Link, aE as ListOptionAddressesParams, aF as MAX_ASSET_DECIMALS, aG as MAX_UINT_256, aH as Milestone, r as OAuthAccessToken, aI as OAuthRefreshToken, a1 as OAuthSession, y as Offer, v as OfferDetail, O as OfferId, aJ as OfferOption, G as OfferOptionAddress, X as OfferOptionAddressId, e as OfferOptionId, aK as OfferOptionSlug, aL as OfferSlug, aM as OfferToken, x as OfferType, s as OffersNamespace, aN as OffersNamespaceImpl, h as OndoNamespace, k as OndoNamespaceImpl, N as OndoQuote, aO as OndoQuoteDuration, U as OndoQuoteSize, L as OndoTradingStatus, Q as OrderBookSide, aP as PKCEState, aQ as PaginatedResponseDto, P as Participation, aR as ParticipationId, aS as ParticipationStatus, aT as ParticipationsPaginationParams, aU as Pii, aV as PiiAddress, aW as PiiJurisdiction, aX as PiiKind, aY as QueryParamValue, aZ as QueryParamValues, a_ as RedirectUri, a$ as RemoveOptionAddressParams, o as Requirement, b0 as RequirementActionNeededReason, H as RequirementId, z as RequirementStatusInfo, F as RequirementStatusValue, D as RequirementType, R as RequirementsNamespace, p as RequirementsNamespaceImpl, b1 as SOLANA_CHAINS, b2 as STABLE_DECIMALS, b3 as SolanaChain, b4 as SubmitDocumentParams, l as SuperstateSwapNamespace, n as SuperstateSwapNamespaceImpl, b5 as SwapAuthorization, b6 as SwapContractRef, b7 as SwapPreview, b8 as TermItem, b9 as Ticker, ba as TokenAllowance, bb as TokenBalance, Z as TokenIdentifier, bc as TokenLogo, bd as TokenLogoImage, be as TokenLogoUrl, Y as TokenMetadata, bf as TokenRole, t as TokensNamespace, bg as TokensNamespaceImpl, T as Tx, bh as WalletAddress, I as WalletChallengeType, bi as WalletOwnershipChallenge, bj as WalletProtocol, W as WalletsNamespace, bk as WalletsNamespaceImpl, bl as apiErrorCode, bm as assertUint256 } from '../config-B5mwS_2l.js';
|
|
3
|
+
import { T as TxExplorerUrl, F as FormattedAmountAssetUi, c as FormattedAmountUi, b as FormattedPercentUi, a as ShortenedWalletAddress, N as NonEmptyArray, S as SwapQuote } from '../collections-CZhHoQHr.js';
|
|
4
|
+
export { A as AssetIconUrl, P as PKCEConfig, d as PKCEParams, g as generatePKCEParams } from '../collections-CZhHoQHr.js';
|
|
3
5
|
import { Hash, TransactionReceipt } from 'viem';
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
/** Basis-point denominator: 10_000 bps = 100%. */
|
|
19
|
+
declare const BPS_DENOM: Bps;
|
|
20
|
+
/**
|
|
21
|
+
* Applies a basis-point fraction to an amount, flooring the result.
|
|
22
|
+
* `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an
|
|
23
|
+
* overflow (bps far above BPS_DENOM) or a negative product is rejected.
|
|
24
|
+
*/
|
|
25
|
+
declare function applyBps(amount: Uint256, bps: Bps): Uint256;
|
|
26
|
+
|
|
27
|
+
declare function getChainId(chain: EthereumChain): number;
|
|
28
|
+
/**
|
|
29
|
+
* Resolves an EIP-155 chain id to the chain the SDK names it by — the inverse
|
|
30
|
+
* of {@link getChainId}, for backends that report a bare `chain_id`.
|
|
31
|
+
*
|
|
32
|
+
* @throws ValidationError on an unrecognised id. Defaulting to mainnet would
|
|
33
|
+
* let a testnet response read as a live one.
|
|
34
|
+
*/
|
|
35
|
+
declare function chainFromId(chainId: string): EthereumChain;
|
|
36
|
+
declare function getNetworkName(chain: EthereumChain): string;
|
|
37
|
+
declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
|
|
6
38
|
|
|
7
39
|
/**
|
|
8
40
|
* Minimal ERC-20 ABI the SDK writes against (mirrors viem's `erc20Abi`). The
|
|
@@ -156,6 +188,165 @@ declare const ERC20_ABI: readonly [{
|
|
|
156
188
|
readonly anonymous: false;
|
|
157
189
|
}];
|
|
158
190
|
|
|
191
|
+
declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
|
|
192
|
+
type FormatAmountOptions = {
|
|
193
|
+
maxFractionDigits?: AssetDecimals;
|
|
194
|
+
};
|
|
195
|
+
declare function formatAmount(amount: BlockchainAmount, locale: string, options?: FormatAmountOptions): FormattedAmountUi;
|
|
196
|
+
declare function formatRawAmount(amount: BlockchainAmount): string;
|
|
197
|
+
/**
|
|
198
|
+
* Formats a {@link BlockchainAmount} using compact notation (e.g. `1.37B`,
|
|
199
|
+
* `5M`). Compact notation only surfaces a couple of significant decimals, so
|
|
200
|
+
* the bigint → number narrowing here is intentional and safe: full precision
|
|
201
|
+
* is deliberately dropped in favour of a human-readable summary value.
|
|
202
|
+
*/
|
|
203
|
+
declare function formatCompactAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
|
|
204
|
+
declare function formatBpsAsPercent(bps: Bps, locale: string): FormattedPercentUi;
|
|
205
|
+
declare function usdAmount(amount: FormattedAmountUi): FormattedAmountAssetUi;
|
|
206
|
+
declare function assetAmount(amount: FormattedAmountUi, symbol: AssetSymbol): FormattedAmountAssetUi;
|
|
207
|
+
/** Placeholder shown when an amount is unavailable (e.g. a loading quote). */
|
|
208
|
+
declare const NA_AMOUNT_ASSET_UI: FormattedAmountAssetUi;
|
|
209
|
+
/**
|
|
210
|
+
* Formats a USD amount capped at 2 fractional digits, falling back to the
|
|
211
|
+
* {@link NA_AMOUNT_ASSET_UI} placeholder when the amount is absent.
|
|
212
|
+
*/
|
|
213
|
+
declare function formattedUsdPrice(amount: BlockchainAmount | null, locale: string): FormattedAmountAssetUi;
|
|
214
|
+
|
|
215
|
+
/** A typed, i18n-agnostic reason a raw amount string failed to parse. */
|
|
216
|
+
type AmountParseErrorReason = {
|
|
217
|
+
type: 'empty';
|
|
218
|
+
} | {
|
|
219
|
+
type: 'negative';
|
|
220
|
+
} | {
|
|
221
|
+
type: 'invalid-format';
|
|
222
|
+
} | {
|
|
223
|
+
type: 'too-many-decimals';
|
|
224
|
+
maxDecimals: AssetDecimals;
|
|
225
|
+
}
|
|
226
|
+
/** Scaled up by `decimals`, the amount no longer fits a uint256. */
|
|
227
|
+
| {
|
|
228
|
+
type: 'overflow';
|
|
229
|
+
};
|
|
230
|
+
type AmountParseResult = {
|
|
231
|
+
valid: true;
|
|
232
|
+
amount: BlockchainAmount;
|
|
233
|
+
} | {
|
|
234
|
+
valid: false;
|
|
235
|
+
reason: AmountParseErrorReason;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Wraps a raw uint256 base-unit string — what Ondo and the on-chain reads
|
|
239
|
+
* return ("100000000" is 100 USDC, not 100 wei-of-nothing) — in a
|
|
240
|
+
* {@link BlockchainAmount} at the given decimals. The value is already scaled,
|
|
241
|
+
* so `decimals` is only the unit tag that travels with it.
|
|
242
|
+
*
|
|
243
|
+
* Distinct from {@link parseBlockchainAmount}, which takes a *human decimal*
|
|
244
|
+
* string and scales it up. Feeding a raw amount to that one silently
|
|
245
|
+
* multiplies it by 10^decimals — pick by what the backend sends, not by which
|
|
246
|
+
* one is closer at hand.
|
|
247
|
+
*
|
|
248
|
+
* @throws ValidationError when the string is not a non-negative uint256
|
|
249
|
+
* integer. A backend that regresses to decimal strings fails loudly here
|
|
250
|
+
* rather than truncating.
|
|
251
|
+
*/
|
|
252
|
+
declare function blockchainAmountFromRawOrThrow({ label, raw, decimals, }: {
|
|
253
|
+
label: string;
|
|
254
|
+
raw: string;
|
|
255
|
+
decimals: AssetDecimals;
|
|
256
|
+
}): BlockchainAmount;
|
|
257
|
+
/**
|
|
258
|
+
* Parses a user-entered decimal string into a {@link BlockchainAmount} at the
|
|
259
|
+
* given token decimals. Rejects scientific notation, negatives, malformed
|
|
260
|
+
* input, more fractional digits than the token supports, and amounts that
|
|
261
|
+
* scale past uint256 — surfacing a typed {@link AmountParseErrorReason} so
|
|
262
|
+
* callers own the display copy.
|
|
263
|
+
*/
|
|
264
|
+
declare function parseBlockchainAmount(amount: string, decimals: AssetDecimals): AmountParseResult;
|
|
265
|
+
|
|
266
|
+
declare const USDC_SYMBOL: StablecoinSymbol;
|
|
267
|
+
declare const USDC: Erc20Asset;
|
|
268
|
+
declare const USDT_SYMBOL: StablecoinSymbol;
|
|
269
|
+
declare const USDT: Erc20Asset;
|
|
270
|
+
/** Lookups for the stablecoins the SDK's swap flows support out of the box. */
|
|
271
|
+
declare const TOKEN_REGISTRY: {
|
|
272
|
+
erc20: (symbol: KnownAssetSymbol) => Erc20Asset;
|
|
273
|
+
contractAddress: (symbol: KnownAssetSymbol, chain: EthereumChain) => EvmContractAddress;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/** The Ondo integration contract on `chain`, or `null` where none is deployed. */
|
|
277
|
+
declare function ondoSwapContractAddress(chain: EthereumChain): EvmContractAddress | null;
|
|
278
|
+
/**
|
|
279
|
+
* How often the Ondo checkout refreshes what it is allowed to poll: the market
|
|
280
|
+
* status and the indicative price. Both are free - neither spends an
|
|
281
|
+
* attestation - so this is paced for a price the user can trust rather than
|
|
282
|
+
* for cost.
|
|
283
|
+
*
|
|
284
|
+
* A built transaction is deliberately not on this timer. Building spends an
|
|
285
|
+
* attestation, so it happens once per order and once per refresh the user
|
|
286
|
+
* asks for.
|
|
287
|
+
*/
|
|
288
|
+
declare const ONDO_POLL_INTERVAL_MS = 15000;
|
|
289
|
+
/**
|
|
290
|
+
* How close to its deadline a built transaction stops being offerable.
|
|
291
|
+
*
|
|
292
|
+
* Placing an order is not instant - the wallet has to prompt, the user has to
|
|
293
|
+
* confirm, and the transaction has to reach a node - so calldata with a second
|
|
294
|
+
* left is one the contract will reject. Treating the last few seconds as
|
|
295
|
+
* already expired turns a paid-for revert into a refresh button.
|
|
296
|
+
*/
|
|
297
|
+
declare const ONDO_QUOTE_EXPIRY_THRESHOLD_MS = 5000;
|
|
298
|
+
/**
|
|
299
|
+
* The order size the sidebar prices against before the user names one.
|
|
300
|
+
*
|
|
301
|
+
* Ondo prices by size, so some amount has to be sent. $1,000 is a plausible
|
|
302
|
+
* order rather than a token one: a size so small that Ondo's minimum rejects
|
|
303
|
+
* it would leave the panel permanently blank.
|
|
304
|
+
*
|
|
305
|
+
* Named distinctly from `DEFAULT_AMOUNT_TO_COMPUTE_PRICE` in the swap
|
|
306
|
+
* constants, which is a raw `bigint` of USDC base units for a different
|
|
307
|
+
* endpoint. Both barrels are flat, so two constants of the same name could not
|
|
308
|
+
* coexist - and they mean different things anyway.
|
|
309
|
+
*/
|
|
310
|
+
declare const DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE: DecimalString;
|
|
311
|
+
/**
|
|
312
|
+
* The coins an Ondo buy can be funded with, in display order, with the first
|
|
313
|
+
* preselected.
|
|
314
|
+
*
|
|
315
|
+
* USDC alone today: it is what the Sepolia integration contract accepts. The
|
|
316
|
+
* amount step renders a single entry as a plain card and two or more as a
|
|
317
|
+
* picker, so adding one here is all it takes.
|
|
318
|
+
*/
|
|
319
|
+
declare const ONDO_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* The price of one whole asset token in an Ondo swap transaction, in the
|
|
323
|
+
* funding token's units.
|
|
324
|
+
*
|
|
325
|
+
* `POST /v1/ondo/swap/transaction` publishes no price. Frontline drops
|
|
326
|
+
* Ninshubur's deliberately, because `GET /v1/ondo/swap/quote` already serves
|
|
327
|
+
* one under that name at a different scale, and echoing both would leave a
|
|
328
|
+
* caller to guess which was which.
|
|
329
|
+
*
|
|
330
|
+
* Dividing the two amounts the response *does* carry is better than reading
|
|
331
|
+
* the indicative one anyway: it is the price this transaction fills at, rather
|
|
332
|
+
* than a poll that has since moved and was struck against a different size.
|
|
333
|
+
*
|
|
334
|
+
* **Fee-exclusive.** `notionalValue` is the deposit after CoinList's fee comes
|
|
335
|
+
* off, so this is the price Ondo filled at, not the buyer's all-in cost per
|
|
336
|
+
* token - that would be `payInputAmount / receiveOutputAmount`, and it is
|
|
337
|
+
* higher. Fee-exclusive is what the review screen wants, because it renders
|
|
338
|
+
* the fee on its own line: price x quantity, plus fee, comes to the total.
|
|
339
|
+
* Making this all-in would double-count the fee against that breakdown.
|
|
340
|
+
*
|
|
341
|
+
* The two are equal until ENG-1718 turns a fee on, which frontline rejects
|
|
342
|
+
* today. They diverge the moment it does, so the choice is load-bearing rather
|
|
343
|
+
* than academic.
|
|
344
|
+
*
|
|
345
|
+
* Denominated in the *funding* token's decimals, so it pairs with
|
|
346
|
+
* `formattedUsdPrice` and with the fee and total rendered beside it.
|
|
347
|
+
*/
|
|
348
|
+
declare function computeOndoPrice(transaction: Pick<OndoSwapTransaction, 'notionalValue' | 'receiveOutputAmount'>): BlockchainAmount;
|
|
349
|
+
|
|
159
350
|
declare const SUPERSTATE_SWAP_ABI: readonly [{
|
|
160
351
|
readonly type: "function";
|
|
161
352
|
readonly name: "authorized";
|
|
@@ -473,107 +664,6 @@ declare const SUPERSTATE_SWAP_ABI: readonly [{
|
|
|
473
664
|
}];
|
|
474
665
|
}];
|
|
475
666
|
|
|
476
|
-
/** Basis-point denominator: 10_000 bps = 100%. */
|
|
477
|
-
declare const BPS_DENOM: Bps;
|
|
478
|
-
/**
|
|
479
|
-
* Applies a basis-point fraction to an amount, flooring the result.
|
|
480
|
-
* `floor((amount × bps) / BPS_DENOM)`. The result is bounds-checked, so an
|
|
481
|
-
* overflow (bps far above BPS_DENOM) or a negative product is rejected.
|
|
482
|
-
*/
|
|
483
|
-
declare function applyBps(amount: Uint256, bps: Bps): Uint256;
|
|
484
|
-
|
|
485
|
-
type FormattedAmountUi = Newtype<string, 'FormattedAmountUi'>;
|
|
486
|
-
declare const FormattedAmountUi: (value: string) => FormattedAmountUi;
|
|
487
|
-
type FormattedPercentUi = Newtype<string, 'FormattedPercentUi'>;
|
|
488
|
-
declare const FormattedPercentUi: (value: string) => FormattedPercentUi;
|
|
489
|
-
type TxExplorerUrl = Newtype<string, 'TxExplorerUrl'>;
|
|
490
|
-
declare const TxExplorerUrl: (value: string) => TxExplorerUrl;
|
|
491
|
-
/**
|
|
492
|
-
* A wallet address shortened for display (e.g. `0x1234…5678`). Keeps a
|
|
493
|
-
* `0x${string}` base but drops the runtime `0x` narrowing.
|
|
494
|
-
*/
|
|
495
|
-
type ShortenedWalletAddress = Newtype<`0x${string}`, 'ShortenedWalletAddress'>;
|
|
496
|
-
declare const ShortenedWalletAddress: (value: string) => ShortenedWalletAddress;
|
|
497
|
-
type FormattedAmountAssetUi = Newtype<string, 'FormattedAmountAssetUi'>;
|
|
498
|
-
declare const FormattedAmountAssetUi: (value: string) => FormattedAmountAssetUi;
|
|
499
|
-
type AssetIconUrl = Newtype<string, 'AssetIconUrl'>;
|
|
500
|
-
declare const AssetIconUrl: (value: string) => AssetIconUrl;
|
|
501
|
-
|
|
502
|
-
declare function getChainId(chain: EthereumChain): number;
|
|
503
|
-
declare function getNetworkName(chain: EthereumChain): string;
|
|
504
|
-
declare function txExplorerUrl(chain: EthereumChain, txHash: Hash): TxExplorerUrl;
|
|
505
|
-
|
|
506
|
-
declare function shortenAddress(address: EvmWalletAddress): ShortenedWalletAddress;
|
|
507
|
-
type FormatAmountOptions = {
|
|
508
|
-
maxFractionDigits?: AssetDecimals;
|
|
509
|
-
};
|
|
510
|
-
declare function formatAmount(amount: BlockchainAmount, locale: string, options?: FormatAmountOptions): FormattedAmountUi;
|
|
511
|
-
declare function formatRawAmount(amount: BlockchainAmount): string;
|
|
512
|
-
/**
|
|
513
|
-
* Formats a {@link BlockchainAmount} using compact notation (e.g. `1.37B`,
|
|
514
|
-
* `5M`). Compact notation only surfaces a couple of significant decimals, so
|
|
515
|
-
* the bigint → number narrowing here is intentional and safe: full precision
|
|
516
|
-
* is deliberately dropped in favour of a human-readable summary value.
|
|
517
|
-
*/
|
|
518
|
-
declare function formatCompactAmount(amount: BlockchainAmount, locale: string): FormattedAmountUi;
|
|
519
|
-
declare function formatBpsAsPercent(bps: Bps, locale: string): FormattedPercentUi;
|
|
520
|
-
declare function usdAmount(amount: FormattedAmountUi): FormattedAmountAssetUi;
|
|
521
|
-
declare function assetAmount(amount: FormattedAmountUi, symbol: AssetSymbol): FormattedAmountAssetUi;
|
|
522
|
-
/** Placeholder shown when an amount is unavailable (e.g. a loading quote). */
|
|
523
|
-
declare const NA_AMOUNT_ASSET_UI: FormattedAmountAssetUi;
|
|
524
|
-
/**
|
|
525
|
-
* Formats a USD amount capped at 2 fractional digits, falling back to the
|
|
526
|
-
* {@link NA_AMOUNT_ASSET_UI} placeholder when the amount is absent.
|
|
527
|
-
*/
|
|
528
|
-
declare function formattedUsdPrice(amount: BlockchainAmount | null, locale: string): FormattedAmountAssetUi;
|
|
529
|
-
/** Formats a quote's implied price per output token as a USD amount. */
|
|
530
|
-
declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
|
|
531
|
-
|
|
532
|
-
/** A typed, i18n-agnostic reason a raw amount string failed to parse. */
|
|
533
|
-
type AmountParseErrorReason = {
|
|
534
|
-
type: 'empty';
|
|
535
|
-
} | {
|
|
536
|
-
type: 'negative';
|
|
537
|
-
} | {
|
|
538
|
-
type: 'invalid-format';
|
|
539
|
-
} | {
|
|
540
|
-
type: 'too-many-decimals';
|
|
541
|
-
maxDecimals: AssetDecimals;
|
|
542
|
-
};
|
|
543
|
-
type AmountParseResult = {
|
|
544
|
-
valid: true;
|
|
545
|
-
amount: BlockchainAmount;
|
|
546
|
-
} | {
|
|
547
|
-
valid: false;
|
|
548
|
-
reason: AmountParseErrorReason;
|
|
549
|
-
};
|
|
550
|
-
/**
|
|
551
|
-
* Parses a user-entered decimal string into a {@link BlockchainAmount} at the
|
|
552
|
-
* given token decimals. Rejects scientific notation, negatives, malformed
|
|
553
|
-
* input, and more fractional digits than the token supports — surfacing a
|
|
554
|
-
* typed {@link AmountParseErrorReason} so callers own the display copy.
|
|
555
|
-
*/
|
|
556
|
-
declare function parseBlockchainAmount(amount: string, decimals: AssetDecimals): AmountParseResult;
|
|
557
|
-
|
|
558
|
-
declare const SUPERSTATE_TOS_URL = "https://superstate.com/terms";
|
|
559
|
-
/** Poll interval for refreshing on-chain swap quotes and balances. */
|
|
560
|
-
declare const SWAP_POLL_INTERVAL_MS = 15000;
|
|
561
|
-
/**
|
|
562
|
-
* Notional input used to derive a display price-per-share when the user has
|
|
563
|
-
* not yet entered an amount (1 USDC at 6 decimals).
|
|
564
|
-
*/
|
|
565
|
-
declare const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
|
|
566
|
-
/** Slippage tolerances offered in the review step, in basis points. */
|
|
567
|
-
declare const SLIPPAGE_OPTIONS_BPS: Bps[];
|
|
568
|
-
/** Default slippage tolerance (0.5%). */
|
|
569
|
-
declare const DEFAULT_SLIPPAGE_BPS: Bps;
|
|
570
|
-
/**
|
|
571
|
-
* The Superstate swap contract on Ethereum Sepolia. The mainnet address is not
|
|
572
|
-
* yet finalized upstream, so it is intentionally not exported — callers pass
|
|
573
|
-
* the contract address explicitly.
|
|
574
|
-
*/
|
|
575
|
-
declare const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress;
|
|
576
|
-
|
|
577
667
|
/**
|
|
578
668
|
* Price of 1 output token in USD, assuming the input token is a $1 stablecoin.
|
|
579
669
|
*
|
|
@@ -612,35 +702,53 @@ declare function isStopped(status: SwapStatus): boolean;
|
|
|
612
702
|
*/
|
|
613
703
|
declare function decodeSwappedOutputAmount(receipt: TransactionReceipt, outputDecimals: AssetDecimals): BlockchainAmount | null;
|
|
614
704
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
705
|
+
/**
|
|
706
|
+
* Who issues the asset a Superstate swap pays out.
|
|
707
|
+
*
|
|
708
|
+
* A constant rather than a field off the offer: no frontline endpoint carries
|
|
709
|
+
* an issuer, and every offer this checkout serves is Superstate's by
|
|
710
|
+
* definition — `CheckoutContainer` routes here on `superstate::swap` alone.
|
|
711
|
+
*/
|
|
712
|
+
declare const SUPERSTATE_ISSUER_NAME = "Superstate";
|
|
713
|
+
/**
|
|
714
|
+
* The coins a Superstate swap can be funded with, in display order, with the
|
|
715
|
+
* first preselected.
|
|
716
|
+
*
|
|
717
|
+
* USDC alone today: it is what the deployed swap contract accepts. The amount
|
|
718
|
+
* step renders a single entry as a plain card and two or more as a picker, so
|
|
719
|
+
* adding one here is all it takes.
|
|
720
|
+
*/
|
|
721
|
+
declare const SUPERSTATE_SUPPORTED_INPUT_ASSETS: NonEmptyArray<StablecoinSymbol>;
|
|
722
|
+
/** Poll interval for refreshing on-chain swap quotes and balances. */
|
|
723
|
+
declare const SWAP_POLL_INTERVAL_MS = 15000;
|
|
724
|
+
/**
|
|
725
|
+
* Notional input used to derive a display price-per-share when the user has
|
|
726
|
+
* not yet entered an amount (1 USDC at 6 decimals).
|
|
727
|
+
*/
|
|
728
|
+
declare const DEFAULT_AMOUNT_TO_COMPUTE_PRICE = 1000000n;
|
|
729
|
+
/** Slippage tolerances offered in the review step, in basis points. */
|
|
730
|
+
declare const SLIPPAGE_OPTIONS_BPS: Bps[];
|
|
731
|
+
/** Default slippage tolerance (0.5%). */
|
|
732
|
+
declare const DEFAULT_SLIPPAGE_BPS: Bps;
|
|
733
|
+
/**
|
|
734
|
+
* The Superstate swap contract on Ethereum Sepolia, and therefore the ERC-20
|
|
735
|
+
* spender the user approves there.
|
|
736
|
+
*
|
|
737
|
+
* Exported in its own right for a partner driving `coinlist.superstate.execute`
|
|
738
|
+
* at Level 1, where the contract is an explicit parameter.
|
|
739
|
+
*/
|
|
740
|
+
declare const SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: EvmContractAddress;
|
|
741
|
+
/** The Superstate swap contract on `chain`, or `null` where none is deployed. */
|
|
742
|
+
declare function superstateSwapContractAddress(chain: EthereumChain): EvmContractAddress | null;
|
|
624
743
|
|
|
625
|
-
type PKCEParams = {
|
|
626
|
-
clientId: ClientId;
|
|
627
|
-
responseType: 'code';
|
|
628
|
-
redirectUri: RedirectUri;
|
|
629
|
-
codeChallenge: CodeChallenge;
|
|
630
|
-
codeChallengeMethod: 'S256';
|
|
631
|
-
state: PKCEState;
|
|
632
|
-
codeVerifier: CodeVerifier;
|
|
633
|
-
};
|
|
634
|
-
type PKCEConfig = {
|
|
635
|
-
clientId: ClientId;
|
|
636
|
-
redirectUri: RedirectUri;
|
|
637
|
-
};
|
|
638
744
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
745
|
+
* Formats a quote's implied price per output token as a USD amount.
|
|
746
|
+
*
|
|
747
|
+
* Lives with the provider rather than in `@/shared/core/blockchain/formatters`
|
|
748
|
+
* because {@link SwapQuote} and {@link computePrice} are Superstate's: the
|
|
749
|
+
* shared formatters stay provider-agnostic.
|
|
642
750
|
*/
|
|
643
|
-
declare function
|
|
751
|
+
declare function formattedPricePerShare(quote: SwapQuote | null, locale: string): FormattedAmountAssetUi;
|
|
644
752
|
|
|
645
753
|
/**
|
|
646
754
|
* Error thrown when a feature or code path is not yet implemented.
|
|
@@ -655,6 +763,9 @@ declare class NotImplementedError extends Error {
|
|
|
655
763
|
declare class NotAuthenticatedError extends Error {
|
|
656
764
|
constructor(message?: string);
|
|
657
765
|
}
|
|
766
|
+
declare class ValidationError extends Error {
|
|
767
|
+
constructor(message: string);
|
|
768
|
+
}
|
|
658
769
|
|
|
659
770
|
type UserDto = {
|
|
660
771
|
id: string;
|
|
@@ -673,4 +784,4 @@ declare const User: {
|
|
|
673
784
|
fromDto: (dto: UserDto) => User;
|
|
674
785
|
};
|
|
675
786
|
|
|
676
|
-
export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals,
|
|
787
|
+
export { type AmountParseErrorReason, type AmountParseResult, AssetDecimals, AssetSymbol, BPS_DENOM, BlockchainAmount, Bps, DEFAULT_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_ONDO_AMOUNT_TO_COMPUTE_PRICE, DEFAULT_SLIPPAGE_BPS, DecimalString, ERC20_ABI, Erc20Asset, EthereumChain, EvmContractAddress, EvmWalletAddress, type FormatAmountOptions, FormattedAmountAssetUi, FormattedAmountUi, FormattedPercentUi, KnownAssetSymbol, NA_AMOUNT_ASSET_UI, NonEmptyArray, NotAuthenticatedError, NotImplementedError, ONDO_POLL_INTERVAL_MS, ONDO_QUOTE_EXPIRY_THRESHOLD_MS, ONDO_SUPPORTED_INPUT_ASSETS, OndoSwapTransaction, PaginatedResponse, PaginationParams, SLIPPAGE_OPTIONS_BPS, SUPERSTATE_ISSUER_NAME, SUPERSTATE_SUPPORTED_INPUT_ASSETS, SUPERSTATE_SWAP_ABI, SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA, 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, computeOndoPrice, computePrice, computeSlip, decodeSwappedOutputAmount, fetchAllPages, formatAmount, formatBpsAsPercent, formatCompactAmount, formatRawAmount, formattedPricePerShare, formattedUsdPrice, getChainId, getNetworkName, isStopped, ondoSwapContractAddress, parseBlockchainAmount, shortenAddress, superstateSwapContractAddress, txExplorerUrl, usdAmount };
|