@coinlist-co/react 0.12.2-rc.726778a → 0.12.2-rc.818bed6
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/dist/{chunk-C6F5FOFP.js → chunk-2HCSM3FB.js} +52 -19
- package/dist/chunk-2HCSM3FB.js.map +1 -0
- package/dist/{chunk-3UQPCAU4.js → chunk-OUFI3D3Q.js} +84 -4
- package/dist/chunk-OUFI3D3Q.js.map +1 -0
- package/dist/{chunk-IRV5YU42.js → chunk-YMDYLYL3.js} +941 -442
- package/dist/chunk-YMDYLYL3.js.map +1 -0
- package/dist/client/index.cjs +12358 -8385
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1965 -227
- package/dist/client/index.d.ts +1965 -227
- package/dist/client/index.js +8766 -5370
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +842 -142
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +72 -41
- package/dist/server/index.d.ts +72 -41
- package/dist/server/index.js +323 -65
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.cts → time-DJU6E8KK.d.cts} +943 -192
- package/dist/{tokens-namespace-CIWBtgt2.d.ts → time-DJU6E8KK.d.ts} +943 -192
- package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-B0xCp3GD.d.cts} +74 -8
- package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-DGG5N27C.d.ts} +74 -8
- package/dist/universal/index.cjs +1022 -440
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +88 -5
- package/dist/universal/index.d.ts +88 -5
- package/dist/universal/index.js +46 -2
- package/package.json +1 -1
- package/dist/chunk-3UQPCAU4.js.map +0 -1
- package/dist/chunk-C6F5FOFP.js.map +0 -1
- package/dist/chunk-IRV5YU42.js.map +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
3
|
-
import { A as AuthorizationCode, C as CodeVerifier, L as Logger, W as WalletError, E as Erc20Namespace, a as EthereumChain, b as EvmContractAddress, B as BlockchainAmount, c as
|
|
4
|
-
export {
|
|
5
|
-
import { P as PKCEConfig, E as EvmWallet, S as SwapQuote, A as AssetIconUrl,
|
|
6
|
-
export { B as BroadcastTxParams,
|
|
3
|
+
import { A as AuthorizationCode, C as CodeVerifier, L as Logger, W as WalletError, E as Erc20Namespace, a as EthereumChain, b as EvmContractAddress, B as BlockchainAmount, c as CentrifugeNamespace, d as AssetSymbol, O as OfferVaultContract, e as CentrifugeVaultBuyTransaction, f as CentrifugeClaimDirection, g as CentrifugeNamespaceImpl, U as UniversalNamespaceContext, h as CoinListTokenSaleNamespace, i as OfferId, j as OfferOptionId, k as AssetId, P as Participation, l as CoinListTokenSaleNamespaceImpl, m as OndoNamespace, n as OfferSwapContract, o as OndoBuyTransaction, p as OndoSellTransaction, q as OndoSwapTransactionCore, r as OrderBookSide, s as OndoNamespaceImpl, S as SuperstateSwapNamespace, t as WalletsNamespace, u as Bps, v as EvmWalletAddress, w as SuperstateSwapNamespaceImpl, R as RequirementsNamespace, x as Requirement, y as RequirementsNamespaceImpl, z as Config, D as OAuthAccessToken, F as OffersNamespace, T as TokensNamespace, G as DecimalString, H as StablecoinSymbol, I as Erc20Asset, J as OfferDetail, K as TokenMetadata, M as CentrifugeVaultOfferDetail, N as OfferType, Q as OndoSwapOfferDetail, V as CoinListTokenSaleOfferDetail, X as SuperstateSwapOfferDetail, Y as CentrifugeVaultLegId, Z as Seconds, _ as AsyncOfferType, $ as AsyncOfferDetail, a0 as Offer, a1 as RequirementStatusInfo, a2 as RequirementType, a3 as RequirementStatusValue, a4 as OfferOptionAddress, a5 as RequirementId, a6 as KycLevelName, a7 as DocumentSubmission, a8 as WalletChallengeType, a9 as PinoLoggerOptions, aa as AssetDecimals, ab as BuildCentrifugeVaultBuyParams, ac as CentrifugeVaultQuote, ad as CentrifugeOrderReason, ae as CentrifugeOrderability, af as OndoTradingStatus, ag as BuildOndoBuyParams, ah as BuildOndoSellParams, ai as OndoQuote, aj as OndoQuoteSize, ak as TokenIdentifier, al as CentrifugeVaultLeg, am as OfferOptionAddressId, an as CentrifugeVaultStatus, ao as TokenLogo } from '../time-DJU6E8KK.js';
|
|
4
|
+
export { ap as DebugEvent, aq as FrontlineEventId, ar as HttpError, as as HttpResponse, at as KycToken, au as LogBinding, av as LogBindings, aw as LogCause, ax as LogLevel, ay as LogScope, az as LogValue, aA as ProductionLogLevel, aB as RedactedWalletError, aC as RequestId, aD as RpcFailureReason, aE as SafeEvent, aF as SafeFields, aG as UnredactedFields } from '../time-DJU6E8KK.js';
|
|
5
|
+
import { P as PKCEConfig, E as EvmWallet, S as SwapQuote, A as AssetIconUrl, F as FormattedAmountAssetUi, a as ShortenedWalletAddress, b as FormattedPercentUi, T as TxExplorerUrl, W as WalletSelection, c as WalletLabelResolver, C as ConnectWallet, N as NonEmptyArray, d as TokenRegistrySnapshot } from '../token-registry-snapshot-DGG5N27C.js';
|
|
6
|
+
export { B as BroadcastTxParams, e as EvmSigner, f as ExternalWalletAdapter, g as WriteContractParams } from '../token-registry-snapshot-DGG5N27C.js';
|
|
7
7
|
import { Hash } from 'viem';
|
|
8
8
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
9
9
|
import { VariantProps } from 'class-variance-authority';
|
|
@@ -165,6 +165,268 @@ declare function submitErc20Approval<Phase extends string>(args: {
|
|
|
165
165
|
emit: (phase: Phase) => void;
|
|
166
166
|
}): Promise<SubmitErc20ApprovalResult>;
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Progress phases emitted while a request is being prepared, in order. An
|
|
170
|
+
* allowance that already covers the deposit skips the approval phases.
|
|
171
|
+
*/
|
|
172
|
+
type CentrifugeBuyPreparationPhase = Erc20AllowancePhase | 'building-transaction';
|
|
173
|
+
/**
|
|
174
|
+
* A step-tagged reason a preparation failed.
|
|
175
|
+
*
|
|
176
|
+
* `insufficient-allowance` is the one with a remedy that is not a new
|
|
177
|
+
* approval: the approval this flow just mined is not the one frontline sees,
|
|
178
|
+
* usually because its node is a block behind. Retrying reads it again.
|
|
179
|
+
*/
|
|
180
|
+
type CentrifugeBuyPreparationError = {
|
|
181
|
+
step: 'unsupported-chain';
|
|
182
|
+
chain: EthereumChain;
|
|
183
|
+
} | Erc20AllowanceError | {
|
|
184
|
+
step: 'insufficient-allowance';
|
|
185
|
+
} | {
|
|
186
|
+
step: 'build-transaction';
|
|
187
|
+
};
|
|
188
|
+
type CentrifugeBuyPreparationResult = {
|
|
189
|
+
type: 'success';
|
|
190
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
191
|
+
} | {
|
|
192
|
+
type: 'error';
|
|
193
|
+
error: CentrifugeBuyPreparationError;
|
|
194
|
+
};
|
|
195
|
+
type PrepareCentrifugeBuyParams = {
|
|
196
|
+
centrifuge: CentrifugeNamespace;
|
|
197
|
+
erc20: Erc20Namespace;
|
|
198
|
+
wallet: EvmWallet;
|
|
199
|
+
/** The vault's share token symbol, e.g. `deJTRSY`. */
|
|
200
|
+
symbol: AssetSymbol;
|
|
201
|
+
chain: EthereumChain;
|
|
202
|
+
/**
|
|
203
|
+
* The offer's `vault_contracts`. The proxy is the spender, and it has to be
|
|
204
|
+
* known before the buy response arrives: the approval mines first, and
|
|
205
|
+
* `tx.to` comes too late to approve against.
|
|
206
|
+
*/
|
|
207
|
+
vaultContracts: OfferVaultContract[];
|
|
208
|
+
/** The funding token being spent. Approval only; frontline resolves its own. */
|
|
209
|
+
tokenAddress: EvmContractAddress;
|
|
210
|
+
/** How much of the funding token to deposit, in its base units. */
|
|
211
|
+
amount: BlockchainAmount;
|
|
212
|
+
onProgress?: (phase: CentrifugeBuyPreparationPhase) => void;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Gets a deposit ready to broadcast: ensures the vault proxy may pull
|
|
216
|
+
* `amount` of the funding token, then builds the calldata that queues the
|
|
217
|
+
* request.
|
|
218
|
+
*
|
|
219
|
+
* The review step runs this when the user places the request, not when they
|
|
220
|
+
* confirm the amount. A Centrifuge quote does not expire, so approving on the
|
|
221
|
+
* amount step would make them sign again if they edit the amount. The
|
|
222
|
+
* allowance still has to land before the build: frontline refuses calldata
|
|
223
|
+
* the proxy cannot pull.
|
|
224
|
+
*
|
|
225
|
+
* Total: every failure is returned step-tagged rather than thrown.
|
|
226
|
+
*/
|
|
227
|
+
declare function prepareCentrifugeBuy(params: PrepareCentrifugeBuyParams): Promise<CentrifugeBuyPreparationResult>;
|
|
228
|
+
/** Progress phases emitted by {@link placeCentrifugeRequest}, in order. */
|
|
229
|
+
type CentrifugeBuyPlacementPhase = 'broadcasting-request' | 'confirming-request';
|
|
230
|
+
/**
|
|
231
|
+
* A step-tagged reason {@link placeCentrifugeRequest} failed.
|
|
232
|
+
*
|
|
233
|
+
* `request-expired` is a refusal to broadcast: the deadline is inside the
|
|
234
|
+
* calldata, so sending it would revert and cost gas. A null deadline never
|
|
235
|
+
* takes this arm.
|
|
236
|
+
*
|
|
237
|
+
* `request` means the wallet never sent it, so placing again is safe.
|
|
238
|
+
* `request-unconfirmed` means it was sent and the receipt wait failed: the
|
|
239
|
+
* deposit may still mine, and placing again can queue a second one.
|
|
240
|
+
*/
|
|
241
|
+
type CentrifugeBuyPlacementError = {
|
|
242
|
+
step: 'request-expired';
|
|
243
|
+
} | {
|
|
244
|
+
step: 'request';
|
|
245
|
+
cause: WalletError;
|
|
246
|
+
} | {
|
|
247
|
+
step: 'request-unconfirmed';
|
|
248
|
+
txHash: Hash;
|
|
249
|
+
cause: WalletError;
|
|
250
|
+
} | {
|
|
251
|
+
step: 'request-reverted';
|
|
252
|
+
};
|
|
253
|
+
type CentrifugeBuyPlacementResult = {
|
|
254
|
+
type: 'success';
|
|
255
|
+
txHash: Hash;
|
|
256
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
257
|
+
} | {
|
|
258
|
+
type: 'error';
|
|
259
|
+
error: CentrifugeBuyPlacementError;
|
|
260
|
+
};
|
|
261
|
+
type PlaceCentrifugeRequestParams = {
|
|
262
|
+
wallet: EvmWallet;
|
|
263
|
+
/**
|
|
264
|
+
* The request to place, from {@link prepareCentrifugeBuy}. Broadcasting it
|
|
265
|
+
* queues the deposit. It does not buy shares.
|
|
266
|
+
*/
|
|
267
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
268
|
+
/** The chain it was built for. The response does not say. */
|
|
269
|
+
chain: EthereumChain;
|
|
270
|
+
/**
|
|
271
|
+
* Now, as the caller sees it. A parameter so the expiry check is testable.
|
|
272
|
+
*/
|
|
273
|
+
now?: Date;
|
|
274
|
+
onProgress?: (phase: CentrifugeBuyPlacementPhase) => void;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Broadcasts a built deposit request and waits for it to mine.
|
|
278
|
+
*
|
|
279
|
+
* A transaction with no deadline (`expiresAt === null`) is broadcast as-is.
|
|
280
|
+
* One with a deadline that has passed is refused before the wallet is asked.
|
|
281
|
+
*/
|
|
282
|
+
declare function placeCentrifugeRequest(params: PlaceCentrifugeRequestParams): Promise<CentrifugeBuyPlacementResult>;
|
|
283
|
+
/**
|
|
284
|
+
* Every phase {@link buyCentrifuge} can emit, in order. An allowance that
|
|
285
|
+
* already covers the deposit skips the approval phases.
|
|
286
|
+
*/
|
|
287
|
+
type CentrifugeBuyPhase = CentrifugeBuyPreparationPhase | CentrifugeBuyPlacementPhase;
|
|
288
|
+
/** A step-tagged reason {@link buyCentrifuge} failed. The step says which half. */
|
|
289
|
+
type CentrifugeBuyError = CentrifugeBuyPreparationError | CentrifugeBuyPlacementError;
|
|
290
|
+
type CentrifugeBuyResult = {
|
|
291
|
+
type: 'success';
|
|
292
|
+
txHash: Hash;
|
|
293
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
294
|
+
} | {
|
|
295
|
+
type: 'error';
|
|
296
|
+
error: CentrifugeBuyError;
|
|
297
|
+
};
|
|
298
|
+
type BuyCentrifugeParams = Omit<PrepareCentrifugeBuyParams, 'onProgress'> & Pick<PlaceCentrifugeRequestParams, 'now'> & {
|
|
299
|
+
onProgress?: (phase: CentrifugeBuyPhase) => void;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Places a deposit request end to end: approves the vault proxy for `amount`,
|
|
303
|
+
* builds the calldata, and broadcasts it.
|
|
304
|
+
*
|
|
305
|
+
* The one call for a partner driving this from their own screen. The checkout
|
|
306
|
+
* keeps the two halves, because it has to drop a build that finishes after
|
|
307
|
+
* the user has left and must not broadcast it.
|
|
308
|
+
*
|
|
309
|
+
* Success means the request was placed. The fund fulfils it later.
|
|
310
|
+
* Broadcasting it does not buy shares.
|
|
311
|
+
*
|
|
312
|
+
* Total: every failure is returned step-tagged rather than thrown.
|
|
313
|
+
*/
|
|
314
|
+
declare function buyCentrifuge(params: BuyCentrifugeParams): Promise<CentrifugeBuyResult>;
|
|
315
|
+
|
|
316
|
+
/** Progress phases emitted by {@link claimCentrifugeVault}, in order. */
|
|
317
|
+
type CentrifugeClaimPhase = 'preparing' | 'awaiting-wallet' | 'confirming';
|
|
318
|
+
/**
|
|
319
|
+
* A step-tagged reason a claim failed.
|
|
320
|
+
*
|
|
321
|
+
* `prepare` reasons are split out where the remedy differs: a wallet with
|
|
322
|
+
* nothing to claim has already been paid (a fill was claimed elsewhere, or a
|
|
323
|
+
* new request auto-claimed it), and a frozen wallet needs the issuer, not a
|
|
324
|
+
* retry. Everything else at that step is offered a retry.
|
|
325
|
+
*
|
|
326
|
+
* A mined transaction that reverted is a `confirm` failure carrying a
|
|
327
|
+
* `contract_reverted` cause, so a caller switches on one arm for "the chain
|
|
328
|
+
* said no" whether the wallet or the receipt reported it.
|
|
329
|
+
*/
|
|
330
|
+
type CentrifugeClaimError = {
|
|
331
|
+
step: 'prepare';
|
|
332
|
+
reason: 'nothing-to-claim' | 'frozen' | 'generic';
|
|
333
|
+
} | {
|
|
334
|
+
step: 'broadcast';
|
|
335
|
+
cause: WalletError;
|
|
336
|
+
} | {
|
|
337
|
+
step: 'confirm';
|
|
338
|
+
cause: WalletError;
|
|
339
|
+
};
|
|
340
|
+
type CentrifugeClaimResult = {
|
|
341
|
+
type: 'success';
|
|
342
|
+
direction: CentrifugeClaimDirection;
|
|
343
|
+
txHash: Hash;
|
|
344
|
+
/**
|
|
345
|
+
* What the calldata was built to collect: shares for `invest`, the
|
|
346
|
+
* funding token for `redeem`. A floor rather than an exact figure - a
|
|
347
|
+
* fill landing before the broadcast raises it, and the claim collects
|
|
348
|
+
* everything.
|
|
349
|
+
*/
|
|
350
|
+
claimed: BlockchainAmount;
|
|
351
|
+
} | {
|
|
352
|
+
type: 'error';
|
|
353
|
+
error: CentrifugeClaimError;
|
|
354
|
+
};
|
|
355
|
+
type ClaimCentrifugeVaultParams = {
|
|
356
|
+
centrifuge: CentrifugeNamespace;
|
|
357
|
+
/**
|
|
358
|
+
* The wallet that holds the position, and the one that broadcasts: the
|
|
359
|
+
* proxy credits the sender, so no other wallet can claim for it.
|
|
360
|
+
*/
|
|
361
|
+
wallet: EvmWallet;
|
|
362
|
+
chain: EthereumChain;
|
|
363
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
364
|
+
symbol: AssetSymbol;
|
|
365
|
+
direction: CentrifugeClaimDirection;
|
|
366
|
+
onProgress?: (phase: CentrifugeClaimPhase) => void;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Claims everything a wallet has claimable on one side of a vault: builds the
|
|
370
|
+
* calldata, broadcasts it from that wallet and waits for it to mine.
|
|
371
|
+
*
|
|
372
|
+
* One function for both directions because the API forks only at the build
|
|
373
|
+
* step - `/claim` and `/claim-proceeds` are two endpoints - while broadcasting
|
|
374
|
+
* reads calldata and nothing else. Total: every failure comes back as a step
|
|
375
|
+
* tag rather than a throw.
|
|
376
|
+
*
|
|
377
|
+
* Nothing is approved first. A claim moves tokens out of the proxy, not out of
|
|
378
|
+
* the wallet, so there is no allowance to grant.
|
|
379
|
+
*/
|
|
380
|
+
declare function claimCentrifugeVault(params: ClaimCentrifugeVaultParams): Promise<CentrifugeClaimResult>;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The Centrifuge namespace plus the halves of a vault trade that need a
|
|
384
|
+
* wallet - placing a request and claiming what a fill made claimable - and so
|
|
385
|
+
* cannot live on the shared namespace.
|
|
386
|
+
*
|
|
387
|
+
* {@link ClientCentrifugeNamespace.buy} is the one call: approve, build, and
|
|
388
|
+
* broadcast. The two halves stay beside it. The checkout runs them itself so
|
|
389
|
+
* it can drop a build that finishes after the user has left, and a host that
|
|
390
|
+
* wants to show the calldata before broadcasting can do the same. The amount
|
|
391
|
+
* step calls neither. The request settles later. Broadcasting it does not
|
|
392
|
+
* buy shares.
|
|
393
|
+
*/
|
|
394
|
+
interface ClientCentrifugeNamespace extends CentrifugeNamespace {
|
|
395
|
+
/**
|
|
396
|
+
* Approves the vault proxy for `amount`, builds the request, and broadcasts
|
|
397
|
+
* it. Returns a step-tagged result rather than throwing.
|
|
398
|
+
*
|
|
399
|
+
* Success means the request was placed. The fund fulfils it later.
|
|
400
|
+
*/
|
|
401
|
+
buy(params: Omit<BuyCentrifugeParams, 'centrifuge' | 'erc20'>): Promise<CentrifugeBuyResult>;
|
|
402
|
+
/**
|
|
403
|
+
* Approves the vault proxy to pull `amount` of the funding token, then
|
|
404
|
+
* builds the request that spends it. Returns a step-tagged result rather
|
|
405
|
+
* than throwing.
|
|
406
|
+
*/
|
|
407
|
+
prepareBuy(params: Omit<PrepareCentrifugeBuyParams, 'centrifuge' | 'erc20'>): Promise<CentrifugeBuyPreparationResult>;
|
|
408
|
+
/**
|
|
409
|
+
* Broadcasts a built request and waits for it to mine, refusing one whose
|
|
410
|
+
* deadline has passed. Returns a step-tagged result rather than throwing.
|
|
411
|
+
*
|
|
412
|
+
* Success means the request was placed. The fund fulfils it later.
|
|
413
|
+
*/
|
|
414
|
+
placeRequest(params: PlaceCentrifugeRequestParams): Promise<CentrifugeBuyPlacementResult>;
|
|
415
|
+
/**
|
|
416
|
+
* Claims everything the wallet has claimable on one side of the vault and
|
|
417
|
+
* waits for it to mine. Returns a step-tagged result rather than throwing.
|
|
418
|
+
*/
|
|
419
|
+
claim(params: Omit<ClaimCentrifugeVaultParams, 'centrifuge'>): Promise<CentrifugeClaimResult>;
|
|
420
|
+
}
|
|
421
|
+
declare class ClientCentrifugeNamespaceImpl extends CentrifugeNamespaceImpl implements ClientCentrifugeNamespace {
|
|
422
|
+
private readonly erc20;
|
|
423
|
+
constructor(ctx: UniversalNamespaceContext, erc20: Erc20Namespace);
|
|
424
|
+
buy(params: Omit<BuyCentrifugeParams, 'centrifuge' | 'erc20'>): Promise<CentrifugeBuyResult>;
|
|
425
|
+
prepareBuy(params: Omit<PrepareCentrifugeBuyParams, 'centrifuge' | 'erc20'>): Promise<CentrifugeBuyPreparationResult>;
|
|
426
|
+
placeRequest(params: PlaceCentrifugeRequestParams): Promise<CentrifugeBuyPlacementResult>;
|
|
427
|
+
claim(params: Omit<ClaimCentrifugeVaultParams, 'centrifuge'>): Promise<CentrifugeClaimResult>;
|
|
428
|
+
}
|
|
429
|
+
|
|
168
430
|
/**
|
|
169
431
|
* Progress phases emitted by {@link executeTokenSale}, in the order they occur.
|
|
170
432
|
* The `resetting-allowance`/`confirming-allowance-reset` phases only occur when
|
|
@@ -698,10 +960,24 @@ declare class ClientSupportNamespaceImpl implements ClientSupportNamespace {
|
|
|
698
960
|
|
|
699
961
|
interface ClientConfig extends Config {
|
|
700
962
|
/**
|
|
701
|
-
* The SDK user must provide this function. It
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
963
|
+
* The SDK user must provide this function. It fetches a valid
|
|
964
|
+
* {@link OAuthAccessToken} from your backend. If your backend is in
|
|
965
|
+
* TypeScript, serve `CoinListServer#auth.getAccessToken` from it.
|
|
966
|
+
*
|
|
967
|
+
* Two answers, and they must not be confused:
|
|
968
|
+
*
|
|
969
|
+
* - **Resolve `null`** when there is no session - e.g. your endpoint
|
|
970
|
+
* answered 204. After a 401 the SDK asks once more a second later before
|
|
971
|
+
* it believes it, then signs the user out and calls
|
|
972
|
+
* {@link Config.onSessionExpired}.
|
|
973
|
+
* - **Throw** when you could not find out - a 5xx, a network failure. The
|
|
974
|
+
* SDK keeps its current auth state and fails only the request in hand.
|
|
975
|
+
*
|
|
976
|
+
* So a backend that answers "no session" for its own failures turns every
|
|
977
|
+
* outage into a logout. Map those to an error status and throw on it.
|
|
978
|
+
*
|
|
979
|
+
* The SDK calls this at most once at a time: concurrent requests that all
|
|
980
|
+
* need a new token share one call.
|
|
705
981
|
*/
|
|
706
982
|
getAccessToken: () => Promise<OAuthAccessToken | null>;
|
|
707
983
|
/**
|
|
@@ -790,6 +1066,18 @@ interface CoinListClient {
|
|
|
790
1066
|
* {@link ClientOndoNamespace}.
|
|
791
1067
|
*/
|
|
792
1068
|
readonly ondo: ClientOndoNamespace;
|
|
1069
|
+
/**
|
|
1070
|
+
* Centrifuge vault deposits and claims: an indicative quote, the vault-wide
|
|
1071
|
+
* ordering gate, each wallet's position, the two halves of placing a
|
|
1072
|
+
* request, and the claim that settles a filled one - e.g.
|
|
1073
|
+
* `coinlist.centrifuge.getQuote({ ... })`.
|
|
1074
|
+
*
|
|
1075
|
+
* The reads are free to poll. The quote has no expiry: it is indicative,
|
|
1076
|
+
* the fund prices fulfilment later, and a countdown would imply a
|
|
1077
|
+
* commitment the API does not make. `prepareBuy` and `placeRequest` are
|
|
1078
|
+
* not polled. Broadcasting places a request. It does not buy shares.
|
|
1079
|
+
*/
|
|
1080
|
+
readonly centrifuge: ClientCentrifugeNamespace;
|
|
793
1081
|
/**
|
|
794
1082
|
* Token display metadata (name, symbol, decimals, logos) from CoinList's
|
|
795
1083
|
* public token registry, keyed by chain + contract address — e.g.
|
|
@@ -810,6 +1098,10 @@ interface CoinListClient {
|
|
|
810
1098
|
* the user's {@link AuthState}. This is called automatically by
|
|
811
1099
|
* {@link CoinListProvider}; you typically do not need to call it yourself
|
|
812
1100
|
* unless you are using the client outside of the provider.
|
|
1101
|
+
*
|
|
1102
|
+
* @throws whatever {@link ClientConfig.getAccessToken} throws. The auth
|
|
1103
|
+
* state is then left as it was (`'unknown'` on a first call), since a
|
|
1104
|
+
* failure to find out is not a logout.
|
|
813
1105
|
*/
|
|
814
1106
|
init(): Promise<AuthState>;
|
|
815
1107
|
}
|
|
@@ -879,7 +1171,7 @@ type CoinListStyleScopeProps = {
|
|
|
879
1171
|
declare function CoinListStyleScope({ children }: CoinListStyleScopeProps): react.JSX.Element;
|
|
880
1172
|
|
|
881
1173
|
declare const buttonVariants: (props?: ({
|
|
882
|
-
variant?: "link" | "primary" | "gradient" | "secondary" | "destructive" | "ghost" | "destructiveLink" | null | undefined;
|
|
1174
|
+
variant?: "link" | "primary" | "gradient" | "secondary" | "destructive" | "outline" | "ghost" | "destructiveLink" | null | undefined;
|
|
883
1175
|
size?: "default" | "sm" | "lg" | "cta" | "icon" | null | undefined;
|
|
884
1176
|
radius?: "pill" | "rounded" | null | undefined;
|
|
885
1177
|
fullWidth?: boolean | null | undefined;
|
|
@@ -955,6 +1247,26 @@ interface CoinListSignInCardViewProps {
|
|
|
955
1247
|
*/
|
|
956
1248
|
declare function CoinListSignInCardView({ state, onEvent, className, }: CoinListSignInCardViewProps): ReactNode;
|
|
957
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* A deposit request that has been broadcast and mined.
|
|
1252
|
+
*
|
|
1253
|
+
* Named without `Buy` so it does not collide with the dialog component when
|
|
1254
|
+
* both are re-exported from the client barrel.
|
|
1255
|
+
*
|
|
1256
|
+
* Success means the request was placed. The fund fulfils it later, at a price
|
|
1257
|
+
* set then. {@link estimatedShares} is the estimate from the calldata, not a
|
|
1258
|
+
* quantity the wallet received.
|
|
1259
|
+
*/
|
|
1260
|
+
type CentrifugeOrderPlaced = {
|
|
1261
|
+
wallet: EvmWallet;
|
|
1262
|
+
/** What the request deposits, in the funding token's base units. */
|
|
1263
|
+
amount: BlockchainAmount;
|
|
1264
|
+
/** The indicative price when the request was placed, if one was in hand. */
|
|
1265
|
+
indicativePrice: DecimalString | null;
|
|
1266
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
1267
|
+
txHash: Hash;
|
|
1268
|
+
};
|
|
1269
|
+
|
|
958
1270
|
/**
|
|
959
1271
|
* A filled Ondo order, as the confirmation dialog and the host's
|
|
960
1272
|
* `onOrderConfirmed` callback need it.
|
|
@@ -1261,6 +1573,23 @@ type CheckoutSelectableInputAssetUi = {
|
|
|
1261
1573
|
rawBalance: bigint;
|
|
1262
1574
|
selected: boolean;
|
|
1263
1575
|
};
|
|
1576
|
+
/**
|
|
1577
|
+
* One fundable stablecoin as the amount step's pay-with row.
|
|
1578
|
+
*
|
|
1579
|
+
* `balance` is `null` before the first read settles and after one that
|
|
1580
|
+
* failed. It renders as zero; the field above says why the CTA does not
|
|
1581
|
+
* treat that as a genuine empty wallet.
|
|
1582
|
+
*
|
|
1583
|
+
* `selected` is a parameter because a step with one funding asset is always
|
|
1584
|
+
* selected, and a step with several has to say which.
|
|
1585
|
+
*/
|
|
1586
|
+
declare function toInputAssetUi({ symbol, balance, selected, networkName, locale, }: {
|
|
1587
|
+
symbol: StablecoinSymbol;
|
|
1588
|
+
balance: bigint | null;
|
|
1589
|
+
selected: boolean;
|
|
1590
|
+
networkName: string;
|
|
1591
|
+
locale: string;
|
|
1592
|
+
}): CheckoutSelectableInputAssetUi;
|
|
1264
1593
|
|
|
1265
1594
|
/**
|
|
1266
1595
|
* Step 3 of the Superstate checkout: what the swap comes to, the slippage it
|
|
@@ -1499,6 +1828,7 @@ type CheckoutConfigByOfferType = {
|
|
|
1499
1828
|
'ondo::swap': OndoCheckoutConfig;
|
|
1500
1829
|
'superstate::swap': SuperstateCheckoutConfig;
|
|
1501
1830
|
'coinlist::token_sale': CoinListTokenSaleCheckoutConfig;
|
|
1831
|
+
'centrifuge::vault': CentrifugeVaultCheckoutConfig;
|
|
1502
1832
|
};
|
|
1503
1833
|
type OndoCheckoutConfig = {
|
|
1504
1834
|
/**
|
|
@@ -1566,13 +1896,42 @@ type SuperstateCheckoutConfig = {
|
|
|
1566
1896
|
type CoinListTokenSaleCheckoutConfig = {
|
|
1567
1897
|
render: (offer: CoinListTokenSaleOfferDetail) => ReactNode;
|
|
1568
1898
|
};
|
|
1899
|
+
/**
|
|
1900
|
+
* What a Centrifuge vault deposit needs that the offer cannot tell it.
|
|
1901
|
+
*
|
|
1902
|
+
* The share symbol is per-asset and this config is per-integration, so
|
|
1903
|
+
* `symbol` takes the offer. It is called only for a `centrifuge::vault`
|
|
1904
|
+
* offer, when that branch is mounted.
|
|
1905
|
+
*/
|
|
1906
|
+
type CentrifugeVaultCheckoutConfig = {
|
|
1907
|
+
/**
|
|
1908
|
+
* The share token symbol, e.g. `deJTRSY`.
|
|
1909
|
+
*
|
|
1910
|
+
* The SDK cannot read it off the offer: the symbol a vault trades under is
|
|
1911
|
+
* the provider's, and it can disagree with `offer.asset.code`. A host whose
|
|
1912
|
+
* catalogue does agree can return `AssetSymbol(offer.asset.code)`.
|
|
1913
|
+
*/
|
|
1914
|
+
symbol: (offer: CentrifugeVaultOfferDetail) => AssetSymbol;
|
|
1915
|
+
/**
|
|
1916
|
+
* The fund the token tracks. Frontline does not send this yet. Omit it, or
|
|
1917
|
+
* return `null`, and the asset-details row stays hidden.
|
|
1918
|
+
*/
|
|
1919
|
+
underlyingFund?: (offer: CentrifugeVaultOfferDetail) => string | null;
|
|
1920
|
+
/**
|
|
1921
|
+
* Trailing yield as display copy, e.g. `3.60%`. Omit it, or return `null`,
|
|
1922
|
+
* and the corner stays empty.
|
|
1923
|
+
*/
|
|
1924
|
+
apy?: (offer: CentrifugeVaultOfferDetail) => string | null;
|
|
1925
|
+
/** Fired once the request has mined. The dialog shows either way. */
|
|
1926
|
+
onOrderPlaced?: (order: CentrifugeOrderPlaced) => void;
|
|
1927
|
+
};
|
|
1569
1928
|
/**
|
|
1570
1929
|
* The parts of {@link CheckoutConfig} only the host can know.
|
|
1571
1930
|
*
|
|
1572
1931
|
* What is missing from this list is what {@link defaultCheckoutConfig} can fill
|
|
1573
1932
|
* in on its own.
|
|
1574
1933
|
*/
|
|
1575
|
-
type RequiredCheckoutConfig = Pick<CheckoutConfig, 'ondo::swap' | 'coinlist::token_sale'>;
|
|
1934
|
+
type RequiredCheckoutConfig = Pick<CheckoutConfig, 'ondo::swap' | 'coinlist::token_sale' | 'centrifuge::vault'>;
|
|
1576
1935
|
/**
|
|
1577
1936
|
* Fills in the config entries that have a sensible default, so a host only
|
|
1578
1937
|
* writes the ones that do not.
|
|
@@ -1588,6 +1947,9 @@ type RequiredCheckoutConfig = Pick<CheckoutConfig, 'ondo::swap' | 'coinlist::tok
|
|
|
1588
1947
|
* side: () => 'buy',
|
|
1589
1948
|
* },
|
|
1590
1949
|
* 'coinlist::token_sale': { render: (offer) => <MyTokenSalePage offer={offer} /> },
|
|
1950
|
+
* 'centrifuge::vault': {
|
|
1951
|
+
* symbol: (offer) => AssetSymbol(offer.asset.code),
|
|
1952
|
+
* },
|
|
1591
1953
|
* });
|
|
1592
1954
|
* ```
|
|
1593
1955
|
*/
|
|
@@ -1677,6 +2039,9 @@ interface CheckoutContainerProps {
|
|
|
1677
2039
|
* const config = defaultCheckoutConfig({
|
|
1678
2040
|
* 'ondo::swap': { symbol: (o) => AssetSymbol(o.asset.code), side: () => 'sell' },
|
|
1679
2041
|
* 'coinlist::token_sale': { render: (o) => <MyTokenSalePage offer={o} /> },
|
|
2042
|
+
* 'centrifuge::vault': {
|
|
2043
|
+
* symbol: (offer) => AssetSymbol(offer.asset.code),
|
|
2044
|
+
* },
|
|
1680
2045
|
* });
|
|
1681
2046
|
* ```
|
|
1682
2047
|
*
|
|
@@ -1724,38 +2089,28 @@ interface CheckoutContainerProps {
|
|
|
1724
2089
|
declare function CheckoutContainer({ offer, chain, wallets, config, enabled, className, }: CheckoutContainerProps): ReactNode;
|
|
1725
2090
|
|
|
1726
2091
|
/**
|
|
1727
|
-
* Step 2 of the
|
|
2092
|
+
* Step 2 of the Centrifuge checkout: how much of the funding token to deposit.
|
|
1728
2093
|
*
|
|
1729
|
-
*
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
2094
|
+
* Nothing here touches the chain. Confirming checks the amount in memory and
|
|
2095
|
+
* hands it up. The review step approves and places the request together,
|
|
2096
|
+
* because a Centrifuge quote does not expire.
|
|
1732
2097
|
*/
|
|
1733
|
-
type
|
|
2098
|
+
type CentrifugeBuyAmountUiState = {
|
|
1734
2099
|
type: 'incomplete';
|
|
1735
2100
|
} | {
|
|
1736
2101
|
type: 'active';
|
|
1737
|
-
/**
|
|
1738
|
-
* Exactly what the user has typed, not a parsed number: the field is
|
|
1739
|
-
* mid-edit, and `'1.'` is a legal thing to be holding.
|
|
1740
|
-
*/
|
|
2102
|
+
/** Exactly what the user has typed. `'1.'` is a legal thing to hold. */
|
|
1741
2103
|
amountInput: string;
|
|
1742
|
-
/** The wallet the funds come from, per step 1. */
|
|
1743
2104
|
walletAddress: ShortenedWalletAddress;
|
|
1744
|
-
/**
|
|
1745
|
-
* Every supported input asset, in display order, whether or not the user
|
|
1746
|
-
* holds any. One entry renders as a plain card, two or more as a picker.
|
|
1747
|
-
*/
|
|
1748
2105
|
inputAssets: CheckoutSelectableInputAssetUi[];
|
|
1749
2106
|
confirmCta: CheckoutCtaUi;
|
|
1750
|
-
/** Validation or approval failure, e.g. `Insufficient USDC`. */
|
|
1751
2107
|
error: string | null;
|
|
1752
2108
|
} | {
|
|
1753
2109
|
type: 'complete';
|
|
1754
2110
|
inputAsset: CheckoutAssetUi;
|
|
1755
|
-
/** The confirmed amount with its symbol, e.g. `1,000.00 USDC`. */
|
|
1756
2111
|
amountFormatted: FormattedAmountAssetUi;
|
|
1757
2112
|
};
|
|
1758
|
-
type
|
|
2113
|
+
type CentrifugeBuyAmountUiEvent = {
|
|
1759
2114
|
type: 'ON_AMOUNT_CHANGE';
|
|
1760
2115
|
value: string;
|
|
1761
2116
|
} | {
|
|
@@ -1769,77 +2124,461 @@ type OndoBuyAmountUiEvent = {
|
|
|
1769
2124
|
type: 'ON_EDIT_AMOUNT';
|
|
1770
2125
|
};
|
|
1771
2126
|
|
|
1772
|
-
interface
|
|
1773
|
-
state:
|
|
1774
|
-
onEvent: (event:
|
|
2127
|
+
interface CentrifugeBuyAmountViewProps {
|
|
2128
|
+
state: CentrifugeBuyAmountUiState;
|
|
2129
|
+
onEvent: (event: CentrifugeBuyAmountUiEvent) => void;
|
|
1775
2130
|
className?: string;
|
|
1776
2131
|
}
|
|
1777
2132
|
/**
|
|
1778
|
-
* Step 2 of the
|
|
2133
|
+
* Step 2 of the Centrifuge checkout. Pure: amounts arrive already formatted, and
|
|
1779
2134
|
* every interaction leaves through `onEvent`.
|
|
1780
2135
|
*
|
|
1781
2136
|
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
1782
2137
|
* needed around it.
|
|
1783
2138
|
*/
|
|
1784
|
-
declare function
|
|
2139
|
+
declare function CentrifugeBuyAmountView(props: CentrifugeBuyAmountViewProps): ReactNode;
|
|
2140
|
+
|
|
2141
|
+
interface CentrifugeBuyCheckoutContainerProps {
|
|
2142
|
+
/** The vault being deposited into: names the asset and supplies its logo. */
|
|
2143
|
+
offer: CentrifugeVaultOfferDetail;
|
|
2144
|
+
/** Share token symbol, e.g. `deJTRSY`. */
|
|
2145
|
+
symbol: AssetSymbol;
|
|
2146
|
+
chain: EthereumChain;
|
|
2147
|
+
wallets: CheckoutWalletSelection;
|
|
2148
|
+
/**
|
|
2149
|
+
* Default `true`. `false` turns off every request and timer, for a checkout
|
|
2150
|
+
* that is mounted but not on screen yet.
|
|
2151
|
+
*/
|
|
2152
|
+
enabled?: boolean;
|
|
2153
|
+
/** Fired once the request has mined. The dialog shows either way. */
|
|
2154
|
+
onOrderPlaced?: (order: CentrifugeOrderPlaced) => void;
|
|
2155
|
+
/**
|
|
2156
|
+
* The fund the token tracks, e.g. `Janus Henderson Treasury Fund`.
|
|
2157
|
+
* Frontline does not send this yet, so pass `null` and the row stays hidden.
|
|
2158
|
+
*/
|
|
2159
|
+
underlyingFund: string | null;
|
|
2160
|
+
/**
|
|
2161
|
+
* Trailing yield as display copy, e.g. `3.60%`. Frontline does not send
|
|
2162
|
+
* this yet, so pass `null` and the corner stays empty.
|
|
2163
|
+
*/
|
|
2164
|
+
apy: string | null;
|
|
2165
|
+
className?: string;
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* The Centrifuge buy checkout a host mounts.
|
|
2169
|
+
*
|
|
2170
|
+
* Renders {@link CentrifugeBuyCheckoutView} from
|
|
2171
|
+
* {@link useCentrifugeBuyCheckoutViewModel}. Placing a request does not buy
|
|
2172
|
+
* shares. The fund fulfils it later.
|
|
2173
|
+
*/
|
|
2174
|
+
declare function CentrifugeBuyCheckoutContainer({ offer, symbol, chain, wallets, enabled, onOrderPlaced, underlyingFund, apy, className, }: CentrifugeBuyCheckoutContainerProps): ReactNode;
|
|
1785
2175
|
|
|
1786
2176
|
/**
|
|
1787
|
-
* Step 3 of the
|
|
2177
|
+
* Step 3 of the Centrifuge checkout: the estimate, and placing the request.
|
|
1788
2178
|
*
|
|
1789
|
-
*
|
|
1790
|
-
* the skeleton renders from a state that carries no order details at all —
|
|
1791
|
-
* there is nothing for the viewmodel to invent while the first quote is in
|
|
1792
|
-
* flight. Once details exist they stay on screen through every later refresh,
|
|
1793
|
-
* and it is `quote` that reports whether they can still be acted on.
|
|
2179
|
+
* The numbers are indicative. Placing the request does not buy shares.
|
|
1794
2180
|
*/
|
|
1795
|
-
type
|
|
2181
|
+
type CentrifugeBuyReviewUiState = {
|
|
1796
2182
|
type: 'incomplete';
|
|
1797
|
-
}
|
|
1798
|
-
/** The first quote is in flight; nothing to show yet. */
|
|
1799
|
-
| {
|
|
2183
|
+
} | {
|
|
1800
2184
|
type: 'loading';
|
|
1801
|
-
}
|
|
1802
|
-
/** No quote could be loaded at all. */
|
|
1803
|
-
| {
|
|
2185
|
+
} | {
|
|
1804
2186
|
type: 'error';
|
|
1805
2187
|
} | {
|
|
1806
2188
|
type: 'active';
|
|
1807
|
-
/**
|
|
1808
|
-
|
|
1809
|
-
/**
|
|
1810
|
-
|
|
1811
|
-
/**
|
|
2189
|
+
/** The funding token, shown beside the amount being deposited. */
|
|
2190
|
+
inputAsset: CheckoutAssetUi;
|
|
2191
|
+
/** What the request deposits, e.g. `100.00 USDC`. */
|
|
2192
|
+
investAmount: FormattedAmountAssetUi;
|
|
2193
|
+
/**
|
|
2194
|
+
* Shares at the price read now, e.g. `0.095238 deJTRSY`. The view
|
|
2195
|
+
* marks it approximate: the fund prices the deposit later.
|
|
2196
|
+
*/
|
|
2197
|
+
approximateAmount: FormattedAmountAssetUi;
|
|
2198
|
+
/** Where the shares land — the wallet confirmed in step 1. */
|
|
1812
2199
|
recipientAddress: ShortenedWalletAddress;
|
|
1813
|
-
/** Price of one whole token, e.g. `$378.99`. */
|
|
1814
|
-
pricePerShare: FormattedAmountAssetUi;
|
|
1815
2200
|
/**
|
|
1816
|
-
*
|
|
1817
|
-
*
|
|
1818
|
-
* than showing a placeholder.
|
|
2201
|
+
* Always a formatted zero. This product charges no CoinList fee, and
|
|
2202
|
+
* the row stays so the total is the amount invested.
|
|
1819
2203
|
*/
|
|
1820
|
-
coinlistFee: FormattedAmountAssetUi
|
|
1821
|
-
/** What the user pays
|
|
2204
|
+
coinlistFee: FormattedAmountAssetUi;
|
|
2205
|
+
/** What the user pays. Equal to {@link investAmount}: no fee comes off. */
|
|
1822
2206
|
total: FormattedAmountAssetUi;
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
2207
|
+
/**
|
|
2208
|
+
* A newer estimate is on the way. The one on screen stays, and the
|
|
2209
|
+
* request can still be placed: this quote does not expire.
|
|
2210
|
+
*/
|
|
2211
|
+
isRefreshing: boolean;
|
|
2212
|
+
placeRequestCta: CheckoutCtaUi;
|
|
1826
2213
|
error: string | null;
|
|
1827
2214
|
};
|
|
2215
|
+
type CentrifugeBuyReviewUiEvent = {
|
|
2216
|
+
type: 'ON_REFRESH_ESTIMATE';
|
|
2217
|
+
} | {
|
|
2218
|
+
type: 'ON_RETRY';
|
|
2219
|
+
} | {
|
|
2220
|
+
type: 'ON_PLACE_REQUEST';
|
|
2221
|
+
};
|
|
2222
|
+
|
|
1828
2223
|
/**
|
|
1829
|
-
*
|
|
2224
|
+
* Why a Centrifuge checkout cannot run right now, as opposed to a step of it
|
|
2225
|
+
* failing.
|
|
2226
|
+
*/
|
|
2227
|
+
type CentrifugeCheckoutErrorReason =
|
|
2228
|
+
/**
|
|
2229
|
+
* The offer names no vault proxy on the chain the host asked for, so there
|
|
2230
|
+
* is no spender to approve and nothing to broadcast to.
|
|
2231
|
+
*/
|
|
2232
|
+
'unsupported-chain'
|
|
2233
|
+
/**
|
|
2234
|
+
* The vault is known to be unable to take a request: halted, unlinked, or
|
|
2235
|
+
* not permissioned. Known from a status whose orderability is blocked.
|
|
2236
|
+
* Loading and failed statuses are unknown, and unknown does not block.
|
|
1830
2237
|
*
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
1833
|
-
* rather than folding into the step's `error`, because the remedy differs: a
|
|
1834
|
-
* failed refresh is fixed by refreshing again, a failed order is not.
|
|
2238
|
+
* Shown only while the user is still choosing a wallet and no request-placed
|
|
2239
|
+
* dialog is up. Past that, a pause belongs to the step it interrupts.
|
|
1835
2240
|
*/
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
2241
|
+
| 'not-orderable';
|
|
2242
|
+
declare const CentrifugeCheckoutErrorReason: {
|
|
2243
|
+
/**
|
|
2244
|
+
* Which reason, if any, replaces the whole checkout. `null` means the steps
|
|
2245
|
+
* render.
|
|
2246
|
+
*/
|
|
2247
|
+
of: ({ depositableHere, notOrderable, atEntry, }: {
|
|
2248
|
+
depositableHere: boolean;
|
|
2249
|
+
notOrderable: boolean;
|
|
2250
|
+
atEntry: boolean;
|
|
2251
|
+
}) => CentrifugeCheckoutErrorReason | null;
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* The asset panel beside the Centrifuge checkout.
|
|
2256
|
+
*
|
|
2257
|
+
* Read-only. The identity comes from the offer. The minimum waits on the
|
|
2258
|
+
* indicative quote. Yield and the fund the token tracks are `null` until
|
|
2259
|
+
* frontline publishes them, and a `null` hides its row.
|
|
2260
|
+
*/
|
|
2261
|
+
type CentrifugeSidebarUiState = {
|
|
2262
|
+
asset: CheckoutAssetUi;
|
|
2263
|
+
/** The share token's symbol, e.g. `deJTRSY`. The same one under the name. */
|
|
2264
|
+
ticker: string;
|
|
2265
|
+
/**
|
|
2266
|
+
* The fund the token tracks, e.g. `Janus Henderson Treasury Fund`.
|
|
2267
|
+
* Frontline does not publish this yet. `null` hides the row.
|
|
2268
|
+
*/
|
|
2269
|
+
underlyingFund: string | null;
|
|
2270
|
+
/**
|
|
2271
|
+
* What kind of instrument it is, in the supplier's own vocabulary, e.g.
|
|
2272
|
+
* `Tokenized Notes`. `null` hides the row.
|
|
2273
|
+
*/
|
|
2274
|
+
assetType: string | null;
|
|
2275
|
+
minimumInvestment: CentrifugeSidebarMinimumUi;
|
|
2276
|
+
/** Display name of the chain the token lives on, e.g. `Ethereum`. */
|
|
2277
|
+
networkName: string;
|
|
2278
|
+
/** Who issues the token, e.g. `Centrifuge`. `null` hides the row. */
|
|
2279
|
+
issuer: string | null;
|
|
2280
|
+
/**
|
|
2281
|
+
* Trailing yield, already formatted, e.g. `3.60%`. The caption "APY" is
|
|
2282
|
+
* the view's. Frontline does not publish this yet. `null` leaves the
|
|
2283
|
+
* corner empty.
|
|
2284
|
+
*/
|
|
2285
|
+
apy: FormattedPercentUi | null;
|
|
2286
|
+
};
|
|
2287
|
+
/**
|
|
2288
|
+
* The minimum deposit, from the indicative quote.
|
|
2289
|
+
*
|
|
2290
|
+
* Its own sum because it arrives later than the offer's identity. A vault
|
|
2291
|
+
* that sets no minimum, and a quote that failed, are both `none`: the row
|
|
2292
|
+
* is dropped rather than dashed.
|
|
2293
|
+
*/
|
|
2294
|
+
type CentrifugeSidebarMinimumUi = {
|
|
2295
|
+
type: 'loading';
|
|
2296
|
+
} | {
|
|
2297
|
+
type: 'known';
|
|
2298
|
+
amount: FormattedAmountAssetUi;
|
|
2299
|
+
} | {
|
|
2300
|
+
type: 'none';
|
|
2301
|
+
};
|
|
2302
|
+
|
|
2303
|
+
/**
|
|
2304
|
+
* Step 1 of the Centrifuge checkout: which wallet funds the deposit.
|
|
2305
|
+
*
|
|
2306
|
+
* There is no `inactive` arm. This step is the first one, so it is either being
|
|
2307
|
+
* filled in or already answered — it is never waiting on a step above it.
|
|
2308
|
+
*
|
|
2309
|
+
* Nothing is allow-listed: the user picks a wallet and confirms, and confirming
|
|
2310
|
+
* is synchronous. Hence a plain `confirmEnabled`.
|
|
2311
|
+
*/
|
|
2312
|
+
type CentrifugeWalletSelectUiState = {
|
|
2313
|
+
type: 'active';
|
|
2314
|
+
/** The user's CoinList wallets. Empty when they have none. */
|
|
2315
|
+
embeddedWallets: CheckoutEmbeddedWalletUi[];
|
|
2316
|
+
/** `null` until an external wallet is connected. The row still renders. */
|
|
2317
|
+
externalWallet: CheckoutWalletUi | null;
|
|
2318
|
+
/** Whether the connected external wallet may be disconnected here. */
|
|
2319
|
+
canDisconnect: boolean;
|
|
2320
|
+
confirmEnabled: boolean;
|
|
2321
|
+
/** Copy for a failed connect, e.g. the user rejected the wallet prompt. */
|
|
2322
|
+
error: string | null;
|
|
2323
|
+
} | {
|
|
2324
|
+
type: 'completed';
|
|
2325
|
+
wallet: CheckoutConfirmedWalletUi;
|
|
2326
|
+
};
|
|
2327
|
+
type CentrifugeWalletSelectUiEvent = {
|
|
2328
|
+
type: 'ON_SELECT_WALLET';
|
|
2329
|
+
value: CheckoutWalletTypeUi;
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Tapping the external row while nothing is connected. Split from
|
|
2333
|
+
* `ON_SELECT_WALLET` because it opens the host's wallet connector rather than
|
|
2334
|
+
* changing the selection.
|
|
2335
|
+
*/
|
|
2336
|
+
| {
|
|
2337
|
+
type: 'ON_CONNECT_WALLET';
|
|
2338
|
+
} | {
|
|
2339
|
+
type: 'ON_DISCONNECT_WALLET';
|
|
2340
|
+
} | {
|
|
2341
|
+
type: 'ON_CONFIRM_WALLET';
|
|
2342
|
+
} | {
|
|
2343
|
+
type: 'ON_EDIT_WALLET';
|
|
2344
|
+
};
|
|
2345
|
+
|
|
2346
|
+
/**
|
|
2347
|
+
* The whole Centrifuge buy checkout: three steps, the asset panel, and the
|
|
2348
|
+
* dialog that says the request was placed.
|
|
2349
|
+
*/
|
|
2350
|
+
type CentrifugeBuyCheckoutUiState = {
|
|
2351
|
+
type: 'content';
|
|
2352
|
+
wallet: CentrifugeWalletSelectUiState;
|
|
2353
|
+
amount: CentrifugeBuyAmountUiState;
|
|
2354
|
+
review: CentrifugeBuyReviewUiState;
|
|
2355
|
+
sidebar: CentrifugeSidebarUiState;
|
|
2356
|
+
orderPlaced: CentrifugeOrderPlacedUiState;
|
|
2357
|
+
} | {
|
|
2358
|
+
type: 'error';
|
|
2359
|
+
reason: CentrifugeCheckoutErrorReason;
|
|
2360
|
+
};
|
|
2361
|
+
type CentrifugeBuyCheckoutUiEvent = CentrifugeWalletSelectUiEvent | CentrifugeBuyAmountUiEvent | CentrifugeBuyReviewUiEvent | CentrifugeOrderPlacedUiEvent;
|
|
2362
|
+
/**
|
|
2363
|
+
* The dialog that closes the checkout once the request has mined.
|
|
2364
|
+
*
|
|
2365
|
+
* It reports that the request was placed. It does not report a fill.
|
|
2366
|
+
*/
|
|
2367
|
+
type CentrifugeOrderPlacedUiState = {
|
|
2368
|
+
type: 'hidden';
|
|
2369
|
+
} | {
|
|
2370
|
+
type: 'visible';
|
|
2371
|
+
outputAsset: CheckoutAssetUi;
|
|
2372
|
+
outputAmount: FormattedAmountAssetUi;
|
|
2373
|
+
totalCost: FormattedAmountAssetUi;
|
|
2374
|
+
pricePerShare: FormattedAmountAssetUi;
|
|
2375
|
+
recipientAddress: ShortenedWalletAddress;
|
|
2376
|
+
txExplorerUrl: TxExplorerUrl;
|
|
2377
|
+
};
|
|
2378
|
+
type CentrifugeOrderPlacedUiEvent = {
|
|
2379
|
+
type: 'ON_CLOSE_ORDER_PLACED';
|
|
2380
|
+
};
|
|
2381
|
+
|
|
2382
|
+
interface CentrifugeBuyCheckoutViewProps {
|
|
2383
|
+
state: CentrifugeBuyCheckoutUiState;
|
|
2384
|
+
onEvent: (event: CentrifugeBuyCheckoutUiEvent) => void;
|
|
2385
|
+
className?: string;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* The whole Centrifuge buy checkout: three step cards, the asset panel, and
|
|
2389
|
+
* the dialog that says the request was placed.
|
|
2390
|
+
*
|
|
2391
|
+
* The panel leads on a phone and moves to the right column from `md` up.
|
|
2392
|
+
*/
|
|
2393
|
+
declare function CentrifugeBuyCheckoutView({ state, onEvent, className, }: CentrifugeBuyCheckoutViewProps): ReactNode;
|
|
2394
|
+
|
|
2395
|
+
interface CentrifugeBuyOrderPlacedProps {
|
|
2396
|
+
state: CentrifugeOrderPlacedUiState;
|
|
2397
|
+
onEvent: (event: CentrifugeOrderPlacedUiEvent) => void;
|
|
2398
|
+
className?: string;
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* The dialog that closes the checkout once the request has mined.
|
|
2402
|
+
*
|
|
2403
|
+
* It says the request was placed. The fund fulfils it later.
|
|
2404
|
+
*/
|
|
2405
|
+
declare function CentrifugeBuyOrderPlaced({ state, onEvent, className, }: CentrifugeBuyOrderPlacedProps): ReactNode;
|
|
2406
|
+
|
|
2407
|
+
interface CentrifugeBuyReviewViewProps {
|
|
2408
|
+
state: CentrifugeBuyReviewUiState;
|
|
2409
|
+
onEvent: (event: CentrifugeBuyReviewUiEvent) => void;
|
|
2410
|
+
className?: string;
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Step 3 of the Centrifuge checkout. Pure: every number arrives formatted, and
|
|
2414
|
+
* whether the order can be placed is decided by `placeRequestCta`.
|
|
2415
|
+
*
|
|
2416
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
2417
|
+
* needed around it.
|
|
2418
|
+
*/
|
|
2419
|
+
declare function CentrifugeBuyReviewView(props: CentrifugeBuyReviewViewProps): ReactNode;
|
|
2420
|
+
|
|
2421
|
+
interface CentrifugeCheckoutErrorProps {
|
|
2422
|
+
reason: CentrifugeCheckoutErrorReason;
|
|
2423
|
+
className?: string;
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* What the checkout renders when there is no deposit to place, or the vault
|
|
2427
|
+
* is known to be unable to take one.
|
|
2428
|
+
*/
|
|
2429
|
+
declare function CentrifugeCheckoutError({ reason, className, }: CentrifugeCheckoutErrorProps): ReactNode;
|
|
2430
|
+
|
|
2431
|
+
interface CentrifugeSidebarViewProps {
|
|
2432
|
+
state: CentrifugeSidebarUiState;
|
|
2433
|
+
className?: string;
|
|
2434
|
+
}
|
|
2435
|
+
/**
|
|
2436
|
+
* The asset panel beside the Centrifuge checkout. Read-only.
|
|
2437
|
+
*/
|
|
2438
|
+
declare function CentrifugeSidebarView({ state, className, }: CentrifugeSidebarViewProps): ReactNode;
|
|
2439
|
+
|
|
2440
|
+
interface CentrifugeWalletSelectViewProps {
|
|
2441
|
+
state: CentrifugeWalletSelectUiState;
|
|
2442
|
+
onEvent: (event: CentrifugeWalletSelectUiEvent) => void;
|
|
2443
|
+
/**
|
|
2444
|
+
* The line under the heading. Defaults to the buy copy.
|
|
2445
|
+
*
|
|
2446
|
+
* A plain string rather than a slot: the sentence says what the wallet is for.
|
|
2447
|
+
*/
|
|
2448
|
+
description?: string;
|
|
2449
|
+
className?: string;
|
|
2450
|
+
}
|
|
2451
|
+
/**
|
|
2452
|
+
* The wallet step of a Centrifuge checkout: which wallet funds the deposit.
|
|
2453
|
+
* Pure - the wallets arrive already shaped, and every interaction leaves
|
|
2454
|
+
* through `onEvent`.
|
|
2455
|
+
*
|
|
2456
|
+
* Nothing about choosing a wallet is allow-listed: confirming is a local
|
|
2457
|
+
* decision. The sentence under the heading is the only copy that names what
|
|
2458
|
+
* the wallet is for.
|
|
2459
|
+
*
|
|
2460
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
2461
|
+
* needed around it.
|
|
2462
|
+
*/
|
|
2463
|
+
declare function CentrifugeWalletSelectView(props: CentrifugeWalletSelectViewProps): ReactNode;
|
|
2464
|
+
|
|
2465
|
+
/**
|
|
2466
|
+
* Step 2 of the Ondo checkout: how much to spend, and which asset to spend.
|
|
2467
|
+
*
|
|
2468
|
+
* Confirming this step submits an ERC-20 approval, so the CTA is a
|
|
2469
|
+
* `CheckoutCtaUi` — it reports the on-chain phase back as loading copy while
|
|
2470
|
+
* the approval is mined.
|
|
2471
|
+
*/
|
|
2472
|
+
type OndoBuyAmountUiState = {
|
|
2473
|
+
type: 'incomplete';
|
|
2474
|
+
} | {
|
|
2475
|
+
type: 'active';
|
|
2476
|
+
/**
|
|
2477
|
+
* Exactly what the user has typed, not a parsed number: the field is
|
|
2478
|
+
* mid-edit, and `'1.'` is a legal thing to be holding.
|
|
2479
|
+
*/
|
|
2480
|
+
amountInput: string;
|
|
2481
|
+
/** The wallet the funds come from, per step 1. */
|
|
2482
|
+
walletAddress: ShortenedWalletAddress;
|
|
2483
|
+
/**
|
|
2484
|
+
* Every supported input asset, in display order, whether or not the user
|
|
2485
|
+
* holds any. One entry renders as a plain card, two or more as a picker.
|
|
2486
|
+
*/
|
|
2487
|
+
inputAssets: CheckoutSelectableInputAssetUi[];
|
|
2488
|
+
confirmCta: CheckoutCtaUi;
|
|
2489
|
+
/** Validation or approval failure, e.g. `Insufficient USDC`. */
|
|
2490
|
+
error: string | null;
|
|
2491
|
+
} | {
|
|
2492
|
+
type: 'complete';
|
|
2493
|
+
inputAsset: CheckoutAssetUi;
|
|
2494
|
+
/** The confirmed amount with its symbol, e.g. `1,000.00 USDC`. */
|
|
2495
|
+
amountFormatted: FormattedAmountAssetUi;
|
|
2496
|
+
};
|
|
2497
|
+
type OndoBuyAmountUiEvent = {
|
|
2498
|
+
type: 'ON_AMOUNT_CHANGE';
|
|
2499
|
+
value: string;
|
|
2500
|
+
} | {
|
|
2501
|
+
type: 'ON_MAX_AMOUNT_CLICK';
|
|
2502
|
+
} | {
|
|
2503
|
+
type: 'ON_SELECT_PAY_WITH';
|
|
2504
|
+
value: AssetSymbol;
|
|
2505
|
+
} | {
|
|
2506
|
+
type: 'ON_CONFIRM_AMOUNT';
|
|
2507
|
+
} | {
|
|
2508
|
+
type: 'ON_EDIT_AMOUNT';
|
|
2509
|
+
};
|
|
2510
|
+
|
|
2511
|
+
interface OndoBuyAmountViewProps {
|
|
2512
|
+
state: OndoBuyAmountUiState;
|
|
2513
|
+
onEvent: (event: OndoBuyAmountUiEvent) => void;
|
|
2514
|
+
className?: string;
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Step 2 of the Ondo checkout. Pure: amounts arrive already formatted, and
|
|
2518
|
+
* every interaction leaves through `onEvent`.
|
|
2519
|
+
*
|
|
2520
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
2521
|
+
* needed around it.
|
|
2522
|
+
*/
|
|
2523
|
+
declare function OndoBuyAmountView(props: OndoBuyAmountViewProps): ReactNode;
|
|
2524
|
+
|
|
2525
|
+
/**
|
|
2526
|
+
* Step 3 of the Ondo checkout: what the order comes to, and placing it.
|
|
2527
|
+
*
|
|
2528
|
+
* `loading` is a separate arm from `active` rather than a flag inside it, so
|
|
2529
|
+
* the skeleton renders from a state that carries no order details at all —
|
|
2530
|
+
* there is nothing for the viewmodel to invent while the first quote is in
|
|
2531
|
+
* flight. Once details exist they stay on screen through every later refresh,
|
|
2532
|
+
* and it is `quote` that reports whether they can still be acted on.
|
|
2533
|
+
*/
|
|
2534
|
+
type OndoBuyReviewUiState = {
|
|
2535
|
+
type: 'incomplete';
|
|
2536
|
+
}
|
|
2537
|
+
/** The first quote is in flight; nothing to show yet. */
|
|
2538
|
+
| {
|
|
2539
|
+
type: 'loading';
|
|
2540
|
+
}
|
|
2541
|
+
/** No quote could be loaded at all. */
|
|
2542
|
+
| {
|
|
2543
|
+
type: 'error';
|
|
2544
|
+
} | {
|
|
2545
|
+
type: 'active';
|
|
2546
|
+
/** What the user is buying. */
|
|
2547
|
+
outputAsset: CheckoutAssetUi;
|
|
2548
|
+
/** The quantity, e.g. `2.639 AAPLon`. */
|
|
2549
|
+
outputAmount: FormattedAmountAssetUi;
|
|
2550
|
+
/** Where the asset lands — the wallet confirmed in step 1. */
|
|
2551
|
+
recipientAddress: ShortenedWalletAddress;
|
|
2552
|
+
/** Price of one whole token, e.g. `$378.99`. */
|
|
2553
|
+
pricePerShare: FormattedAmountAssetUi;
|
|
2554
|
+
/**
|
|
2555
|
+
* `null` while no CoinList fee is disclosed: no Ondo endpoint returns one
|
|
2556
|
+
* and none is applied to the quote (ENG-1680). The row is hidden rather
|
|
2557
|
+
* than showing a placeholder.
|
|
2558
|
+
*/
|
|
2559
|
+
coinlistFee: FormattedAmountAssetUi | null;
|
|
2560
|
+
/** What the user pays in the input asset, e.g. `1,000.00 USDC`. */
|
|
2561
|
+
total: FormattedAmountAssetUi;
|
|
2562
|
+
quote: OndoBuyQuoteStatusUi;
|
|
2563
|
+
placeOrderCta: CheckoutCtaUi;
|
|
2564
|
+
/** A failure from placing the order, distinct from a quote problem. */
|
|
2565
|
+
error: string | null;
|
|
2566
|
+
};
|
|
2567
|
+
/**
|
|
2568
|
+
* Whether the shown numbers can still be traded on.
|
|
2569
|
+
*
|
|
2570
|
+
* A quote is only good for a few seconds, so this drives the line above the CTA
|
|
2571
|
+
* and whether the CTA can be pressed at all. `refresh-failed` is its own arm
|
|
2572
|
+
* rather than folding into the step's `error`, because the remedy differs: a
|
|
2573
|
+
* failed refresh is fixed by refreshing again, a failed order is not.
|
|
2574
|
+
*/
|
|
2575
|
+
type OndoBuyQuoteStatusUi =
|
|
2576
|
+
/** Still good. `expiresInLabel` is the countdown copy, already formatted. */
|
|
2577
|
+
{
|
|
2578
|
+
type: 'valid';
|
|
2579
|
+
expiresInLabel: string;
|
|
2580
|
+
}
|
|
2581
|
+
/** A refresh is in flight; the previous numbers are still on screen. */
|
|
1843
2582
|
| {
|
|
1844
2583
|
type: 'refreshing';
|
|
1845
2584
|
}
|
|
@@ -1863,18 +2602,17 @@ type OndoBuyReviewUiEvent = {
|
|
|
1863
2602
|
};
|
|
1864
2603
|
|
|
1865
2604
|
/**
|
|
1866
|
-
* Why an Ondo checkout cannot run
|
|
2605
|
+
* Why an Ondo checkout cannot run right now, as opposed to a step of it
|
|
2606
|
+
* failing.
|
|
1867
2607
|
*
|
|
1868
|
-
*
|
|
1869
|
-
* on it for copy and because the next entry here is already foreseeable: an
|
|
1870
|
-
* offer whose asset Ondo has delisted is the same kind of "there is no flow to
|
|
1871
|
-
* render" that no step can localise.
|
|
2608
|
+
* A union rather than a bare flag because the View switches on it for copy.
|
|
1872
2609
|
*
|
|
1873
|
-
* Shared by both products because
|
|
1874
|
-
* than of a direction: buying and selling go through
|
|
1875
|
-
* chain that cannot serve one cannot serve the other
|
|
1876
|
-
*
|
|
1877
|
-
*
|
|
2610
|
+
* Shared by both products because each reason is a property of the integration
|
|
2611
|
+
* or of the market rather than of a direction: buying and selling go through
|
|
2612
|
+
* the same contract, so a chain that cannot serve one cannot serve the other,
|
|
2613
|
+
* and a closed market reads the same whichever way the trade runs. That is the
|
|
2614
|
+
* exception the provider-level `shared/` exists for, and it is narrow - the
|
|
2615
|
+
* step states stay per-product, since that is where the two genuinely diverge.
|
|
1878
2616
|
*/
|
|
1879
2617
|
type OndoCheckoutErrorReason =
|
|
1880
2618
|
/**
|
|
@@ -1885,7 +2623,38 @@ type OndoCheckoutErrorReason =
|
|
|
1885
2623
|
* offer and the chain are fixed for the lifetime of the mount. See
|
|
1886
2624
|
* `swapSpender`.
|
|
1887
2625
|
*/
|
|
1888
|
-
'unsupported-chain'
|
|
2626
|
+
'unsupported-chain'
|
|
2627
|
+
/**
|
|
2628
|
+
* Ondo is not filling orders for this asset on this side right now: the
|
|
2629
|
+
* market is closed or paused, or the asset is paused or closed for the
|
|
2630
|
+
* session. Known from the trading-status poll, never assumed from a status
|
|
2631
|
+
* that is still loading or failed to load.
|
|
2632
|
+
*
|
|
2633
|
+
* Unlike `unsupported-chain` this one clears on its own. The trading-status
|
|
2634
|
+
* poll keeps running underneath it, and the checkout comes back once the
|
|
2635
|
+
* asset is tradable again. Only shown while the user is on the step the flow
|
|
2636
|
+
* opened on: once they are past it, a pause is a step's to report, so it
|
|
2637
|
+
* cannot pull an order out from under the user mid-flow.
|
|
2638
|
+
*/
|
|
2639
|
+
| 'not-tradable';
|
|
2640
|
+
declare const OndoCheckoutErrorReason: {
|
|
2641
|
+
/**
|
|
2642
|
+
* Which reason, if any, replaces the whole checkout. `null` means the steps
|
|
2643
|
+
* render.
|
|
2644
|
+
*
|
|
2645
|
+
* `unsupported-chain` wins because it is settled at mount: no market state
|
|
2646
|
+
* can make a chain with no contract tradable. `not-tradable` needs both a
|
|
2647
|
+
* market *known* to be closed and a user still at the start of the flow,
|
|
2648
|
+
* with no order confirmation on screen. Past the first step a pause belongs
|
|
2649
|
+
* to the step it interrupts, and a just-placed order's dialog must not be
|
|
2650
|
+
* hidden by a market that closed after it filled.
|
|
2651
|
+
*/
|
|
2652
|
+
of: ({ swappableHere, notTradable, atEntry, }: {
|
|
2653
|
+
swappableHere: boolean;
|
|
2654
|
+
notTradable: boolean;
|
|
2655
|
+
atEntry: boolean;
|
|
2656
|
+
}) => OndoCheckoutErrorReason | null;
|
|
2657
|
+
};
|
|
1889
2658
|
|
|
1890
2659
|
/**
|
|
1891
2660
|
* The reference panel beside the Ondo checkout: which asset is being bought,
|
|
@@ -2030,7 +2799,11 @@ type OndoBuyCheckoutUiState = {
|
|
|
2030
2799
|
sidebar: OndoSidebarUiState;
|
|
2031
2800
|
orderConfirmed: OndoOrderConfirmedUiState;
|
|
2032
2801
|
}
|
|
2033
|
-
/**
|
|
2802
|
+
/**
|
|
2803
|
+
* There is no checkout to render. For `unsupported-chain` nothing is fetched
|
|
2804
|
+
* and no timer runs; for `not-tradable` the trading-status poll keeps
|
|
2805
|
+
* running, so the checkout comes back once the market opens.
|
|
2806
|
+
*/
|
|
2034
2807
|
| {
|
|
2035
2808
|
type: 'error';
|
|
2036
2809
|
reason: OndoCheckoutErrorReason;
|
|
@@ -2451,7 +3224,11 @@ type OndoSellCheckoutUiState = {
|
|
|
2451
3224
|
sidebar: OndoSidebarUiState;
|
|
2452
3225
|
orderConfirmed: OndoSellOrderConfirmedUiState;
|
|
2453
3226
|
}
|
|
2454
|
-
/**
|
|
3227
|
+
/**
|
|
3228
|
+
* There is no checkout to render. For `unsupported-chain` nothing is fetched
|
|
3229
|
+
* and no timer runs; for `not-tradable` the trading-status poll keeps
|
|
3230
|
+
* running, so the checkout comes back once the market opens.
|
|
3231
|
+
*/
|
|
2455
3232
|
| {
|
|
2456
3233
|
type: 'error';
|
|
2457
3234
|
reason: OndoCheckoutErrorReason;
|
|
@@ -2647,7 +3424,8 @@ interface OndoCheckoutErrorProps {
|
|
|
2647
3424
|
className?: string;
|
|
2648
3425
|
}
|
|
2649
3426
|
/**
|
|
2650
|
-
* What an Ondo checkout renders when there is no checkout to render
|
|
3427
|
+
* What an Ondo checkout renders when there is no checkout to render, or none
|
|
3428
|
+
* the user can act on right now.
|
|
2651
3429
|
*
|
|
2652
3430
|
* Shared by both products rather than duplicated in each, because the reason
|
|
2653
3431
|
* is a property of the integration and not of the direction: a chain that
|
|
@@ -2655,9 +3433,10 @@ interface OndoCheckoutErrorProps {
|
|
|
2655
3433
|
* sentence twice.
|
|
2656
3434
|
*
|
|
2657
3435
|
* No retry, deliberately. Superstate's equivalent offers one for `load-failed`,
|
|
2658
|
-
* where a re-fetch can genuinely succeed
|
|
2659
|
-
* and cannot change under a button
|
|
2660
|
-
*
|
|
3436
|
+
* where a re-fetch can genuinely succeed. Here `unsupported-chain` is settled
|
|
3437
|
+
* at mount and cannot change under a button, and `not-tradable` clears on its
|
|
3438
|
+
* own once the market opens, since the viewmodel keeps polling underneath it.
|
|
3439
|
+
* Offering a button that provably cannot help is worse than offering none.
|
|
2661
3440
|
*
|
|
2662
3441
|
* Self-scoped, like every exported component: it renders fully styled with no
|
|
2663
3442
|
* provider in the tree, and the scope is idempotent so nesting costs nothing.
|
|
@@ -3104,87 +3883,409 @@ interface SuperstateSwapCheckoutContainerProps {
|
|
|
3104
3883
|
* disconnect an external one. The SDK ships no wallet stack, so this is how
|
|
3105
3884
|
* a host plugs in Privy, AppKit, or its own.
|
|
3106
3885
|
*/
|
|
3107
|
-
wallets: CheckoutWalletSelection;
|
|
3886
|
+
wallets: CheckoutWalletSelection;
|
|
3887
|
+
/**
|
|
3888
|
+
* Default `true`. `false` turns off every request and timer, for a checkout
|
|
3889
|
+
* that is mounted but not on screen yet.
|
|
3890
|
+
*/
|
|
3891
|
+
enabled?: boolean;
|
|
3892
|
+
/** Fired once the swap has mined. The dialog shows either way. */
|
|
3893
|
+
onOrderConfirmed?: (order: SuperstateOrderPlaced) => void;
|
|
3894
|
+
className?: string;
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* The Superstate swap checkout, ready to drop in: three steps, the sale panel
|
|
3898
|
+
* beside them, and the dialog that closes the flow.
|
|
3899
|
+
*
|
|
3900
|
+
* Takes no contract address: it is looked up from `chain`, the way Ondo's is.
|
|
3901
|
+
* A partner who needs to point at a different deployment is below this rung and
|
|
3902
|
+
* calls `coinlist.superstate.execute` directly.
|
|
3903
|
+
*
|
|
3904
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
3905
|
+
* needed around it.
|
|
3906
|
+
*/
|
|
3907
|
+
declare function SuperstateSwapCheckoutContainer({ offer, chain, wallets, enabled, onOrderConfirmed, className, }: SuperstateSwapCheckoutContainerProps): ReactNode;
|
|
3908
|
+
|
|
3909
|
+
interface SuperstateSwapCheckoutViewProps {
|
|
3910
|
+
state: SuperstateSwapCheckoutUiState;
|
|
3911
|
+
onEvent: (event: SuperstateSwapCheckoutUiEvent) => void;
|
|
3912
|
+
className?: string;
|
|
3913
|
+
}
|
|
3914
|
+
/**
|
|
3915
|
+
* The whole Superstate swap checkout: the three step cards, the sale panel
|
|
3916
|
+
* beside them, and the dialog that closes the flow.
|
|
3917
|
+
*
|
|
3918
|
+
* `onEvent` is handed to each step unwrapped. A handler that accepts the wider
|
|
3919
|
+
* union is assignable where a step's narrower one is expected, so there is no
|
|
3920
|
+
* per-step lambda here and no re-dispatch on the way back up.
|
|
3921
|
+
*
|
|
3922
|
+
* The panel leads on a phone and moves to the right column from `md` up, where
|
|
3923
|
+
* it is reference material rather than the first thing to read. No page heading
|
|
3924
|
+
* and no back button — the host titles and navigates its own page.
|
|
3925
|
+
*
|
|
3926
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
3927
|
+
* needed around it. The steps scope themselves too, and the scope is
|
|
3928
|
+
* idempotent, so nesting costs nothing.
|
|
3929
|
+
*/
|
|
3930
|
+
declare function SuperstateSwapCheckoutView({ state, onEvent, className, }: SuperstateSwapCheckoutViewProps): ReactNode;
|
|
3931
|
+
|
|
3932
|
+
interface SuperstateSidebarViewProps {
|
|
3933
|
+
state: SuperstateSidebarUiState;
|
|
3934
|
+
className?: string;
|
|
3935
|
+
}
|
|
3936
|
+
/**
|
|
3937
|
+
* The panel beside the Superstate checkout: whether the sale is still running,
|
|
3938
|
+
* what is being bought, what one share costs, and the terms of the sale.
|
|
3939
|
+
*
|
|
3940
|
+
* Read-only, so it takes no `onEvent`. The sale banner sits above the card
|
|
3941
|
+
* rather than inside it — it is the first thing to read on a phone, where the
|
|
3942
|
+
* card's own contents fold away behind a disclosure.
|
|
3943
|
+
*
|
|
3944
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
3945
|
+
* needed around it.
|
|
3946
|
+
*/
|
|
3947
|
+
declare function SuperstateSidebarView({ state, className, }: SuperstateSidebarViewProps): ReactNode;
|
|
3948
|
+
|
|
3949
|
+
interface SuperstateWalletViewProps {
|
|
3950
|
+
state: SuperstateWalletUiState;
|
|
3951
|
+
onEvent: (event: SuperstateWalletUiEvent) => void;
|
|
3952
|
+
className?: string;
|
|
3953
|
+
}
|
|
3954
|
+
/**
|
|
3955
|
+
* Step 1 of the Superstate checkout. Pure: the wallets arrive already shaped,
|
|
3956
|
+
* and every interaction leaves through `onEvent`.
|
|
3957
|
+
*
|
|
3958
|
+
* Confirming allow-lists the wallet on-chain, which is why the CTA renders a
|
|
3959
|
+
* loading message rather than a spinner alone — the copy is what tells the user
|
|
3960
|
+
* their wallet is about to ask them to sign. The completed step says
|
|
3961
|
+
* `Allowlisted`, the only place the flow admits that anything happened.
|
|
3962
|
+
*
|
|
3963
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
3964
|
+
* needed around it.
|
|
3965
|
+
*/
|
|
3966
|
+
declare function SuperstateWalletView(props: SuperstateWalletViewProps): ReactNode;
|
|
3967
|
+
|
|
3968
|
+
/**
|
|
3969
|
+
* The claim card.
|
|
3970
|
+
*
|
|
3971
|
+
* `HIDDEN` renders nothing: the user is signed out, or there is nothing to
|
|
3972
|
+
* show and no wallet to connect. A host that wants an empty state can tell
|
|
3973
|
+
* both apart itself.
|
|
3974
|
+
*/
|
|
3975
|
+
type CentrifugeVaultClaimUiState = {
|
|
3976
|
+
type: 'HIDDEN';
|
|
3977
|
+
} | {
|
|
3978
|
+
type: 'LOADING';
|
|
3979
|
+
externalWallet: ClaimExternalWalletUi;
|
|
3980
|
+
} | {
|
|
3981
|
+
type: 'ERROR';
|
|
3982
|
+
externalWallet: ClaimExternalWalletUi;
|
|
3983
|
+
} | {
|
|
3984
|
+
type: 'CONTENT';
|
|
3985
|
+
rows: CentrifugeClaimRowUi[];
|
|
3986
|
+
externalWallet: ClaimExternalWalletUi;
|
|
3987
|
+
dialog: CentrifugeClaimDialogUi;
|
|
3988
|
+
};
|
|
3989
|
+
type CentrifugeVaultClaimUiEvent = {
|
|
3990
|
+
type: 'ON_CLAIM';
|
|
3991
|
+
legId: CentrifugeVaultLegId;
|
|
3992
|
+
} | {
|
|
3993
|
+
type: 'ON_RETRY_CLAIM';
|
|
3994
|
+
} | {
|
|
3995
|
+
type: 'ON_CLOSE_CLAIM_DIALOG';
|
|
3996
|
+
} | {
|
|
3997
|
+
type: 'ON_RETRY_LOAD';
|
|
3998
|
+
} | {
|
|
3999
|
+
type: 'ON_CONNECT_WALLET';
|
|
4000
|
+
} | {
|
|
4001
|
+
type: 'ON_CHANGE_WALLET';
|
|
4002
|
+
};
|
|
4003
|
+
/** Why a claimable row cannot be claimed right now. */
|
|
4004
|
+
type CentrifugeClaimBlockedReasonUi = 'vault-paused' | 'wallet-frozen';
|
|
4005
|
+
/**
|
|
4006
|
+
* What a claimable row's Claim button does. `claiming` while a claim on the
|
|
4007
|
+
* row has not settled, including one whose dialog was closed: the
|
|
4008
|
+
* transaction is still in the wallet or the mempool, and a second press
|
|
4009
|
+
* would send another.
|
|
4010
|
+
*/
|
|
4011
|
+
type CentrifugeClaimActionUi = {
|
|
4012
|
+
type: 'enabled';
|
|
4013
|
+
} | {
|
|
4014
|
+
type: 'claiming';
|
|
4015
|
+
} | {
|
|
4016
|
+
type: 'blocked';
|
|
4017
|
+
reason: CentrifugeClaimBlockedReasonUi;
|
|
4018
|
+
};
|
|
4019
|
+
/**
|
|
4020
|
+
* A row of the card. A leg yields a `pending` row while anything is queued
|
|
4021
|
+
* and a `claimable` row while anything is filled, so one wallet can show
|
|
4022
|
+
* both at once.
|
|
4023
|
+
*
|
|
4024
|
+
* The two kinds lay out differently on purpose: a pending row names the
|
|
4025
|
+
* offer and what is queued, a claimable row leads with what the user gets.
|
|
4026
|
+
*/
|
|
4027
|
+
type CentrifugeClaimRowUi = {
|
|
4028
|
+
kind: 'pending';
|
|
4029
|
+
/** Unique within the card, for React keys. */
|
|
4030
|
+
key: string;
|
|
4031
|
+
iconUrl: AssetIconUrl | null;
|
|
4032
|
+
/** The offer's name, e.g. `JTRSY deRWA`. */
|
|
4033
|
+
title: string;
|
|
4034
|
+
/** What is queued: funding for `invest`, shares for `redeem`. */
|
|
4035
|
+
amount: FormattedAmountAssetUi;
|
|
4036
|
+
wallet: string;
|
|
4037
|
+
} | {
|
|
4038
|
+
kind: 'claimable';
|
|
4039
|
+
key: string;
|
|
4040
|
+
legId: CentrifugeVaultLegId;
|
|
4041
|
+
iconUrl: AssetIconUrl | null;
|
|
4042
|
+
/**
|
|
4043
|
+
* What a claim pays out: exact shares for `invest`, an estimate of the
|
|
4044
|
+
* funding token (prefixed `~`) for `redeem`.
|
|
4045
|
+
*/
|
|
4046
|
+
amount: FormattedAmountAssetUi;
|
|
4047
|
+
wallet: string;
|
|
4048
|
+
action: CentrifugeClaimActionUi;
|
|
4049
|
+
};
|
|
4050
|
+
/** A connect or change request the host's connector is handling. */
|
|
4051
|
+
type ExternalWalletRequestUi = 'idle' | 'pending' | 'failed';
|
|
4052
|
+
/**
|
|
4053
|
+
* The card's footer. `hidden` when the host offers no connector, so there is
|
|
4054
|
+
* nothing to connect with.
|
|
4055
|
+
*/
|
|
4056
|
+
type ClaimExternalWalletUi = {
|
|
4057
|
+
type: 'hidden';
|
|
4058
|
+
} | {
|
|
4059
|
+
type: 'disconnected';
|
|
4060
|
+
request: ExternalWalletRequestUi;
|
|
4061
|
+
} | {
|
|
4062
|
+
type: 'connected';
|
|
4063
|
+
wallet: string;
|
|
4064
|
+
request: ExternalWalletRequestUi;
|
|
4065
|
+
};
|
|
4066
|
+
/** The steps a claim goes through, in order, as the dialog lists them. */
|
|
4067
|
+
type CentrifugeClaimStepUi = 'preparing' | 'awaiting-wallet' | 'confirming';
|
|
4068
|
+
/** Why a claim failed, in the flavours the dialog words differently. */
|
|
4069
|
+
type CentrifugeClaimFailureUi = 'nothing-to-claim' | 'wallet-frozen' | 'rejected' | 'insufficient-gas' | 'reverted' | 'generic';
|
|
4070
|
+
type CentrifugeClaimProgressUi = {
|
|
4071
|
+
type: 'running';
|
|
4072
|
+
step: CentrifugeClaimStepUi;
|
|
4073
|
+
} | {
|
|
4074
|
+
type: 'failed';
|
|
4075
|
+
step: CentrifugeClaimStepUi;
|
|
4076
|
+
reason: CentrifugeClaimFailureUi;
|
|
4077
|
+
/**
|
|
4078
|
+
* Whether the dialog offers "Try again". `nothing-to-claim` has already
|
|
4079
|
+
* been paid and `wallet-frozen` needs the issuer, so retrying either only
|
|
4080
|
+
* repeats the refusal.
|
|
4081
|
+
*/
|
|
4082
|
+
retryable: boolean;
|
|
4083
|
+
} | {
|
|
4084
|
+
type: 'succeeded';
|
|
4085
|
+
claimed: FormattedAmountAssetUi;
|
|
4086
|
+
explorerUrl: TxExplorerUrl;
|
|
4087
|
+
};
|
|
4088
|
+
type CentrifugeClaimDialogUi = {
|
|
4089
|
+
type: 'closed';
|
|
4090
|
+
} | {
|
|
4091
|
+
type: 'open';
|
|
4092
|
+
/** What the claim pays out, which the dialog's title names. */
|
|
4093
|
+
amount: FormattedAmountAssetUi;
|
|
4094
|
+
progress: CentrifugeClaimProgressUi;
|
|
4095
|
+
};
|
|
4096
|
+
|
|
4097
|
+
interface UseCentrifugeVaultClaimViewModelOptions {
|
|
4098
|
+
offer: CentrifugeVaultOfferDetail;
|
|
4099
|
+
wallets: WalletSelection;
|
|
4100
|
+
/** Names a wallet for display; unnamed ones show a shortened address. */
|
|
4101
|
+
walletLabel?: WalletLabelResolver;
|
|
4102
|
+
/** Fired once a claim has mined, whether or not the dialog is still open. */
|
|
4103
|
+
onClaimed?: (claim: CentrifugeVaultClaimed) => void;
|
|
4104
|
+
/** How often to re-read pending positions and vault status. */
|
|
4105
|
+
pollInterval?: Seconds;
|
|
4106
|
+
/** Default `true`. `false` turns off every request and timer. */
|
|
4107
|
+
enabled?: boolean;
|
|
4108
|
+
}
|
|
4109
|
+
interface UseCentrifugeVaultClaimViewModelResult {
|
|
4110
|
+
state: CentrifugeVaultClaimUiState;
|
|
4111
|
+
onEvent: (event: CentrifugeVaultClaimUiEvent) => void;
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* What a host hears once a claim has mined. `claimed` is what the calldata
|
|
4115
|
+
* was built to collect: shares for `invest`, the funding token for `redeem`.
|
|
4116
|
+
*/
|
|
4117
|
+
type CentrifugeVaultClaimed = {
|
|
4118
|
+
direction: CentrifugeClaimDirection;
|
|
4119
|
+
chain: EthereumChain;
|
|
4120
|
+
walletAddress: EvmWalletAddress;
|
|
4121
|
+
txHash: Hash;
|
|
4122
|
+
claimed: BlockchainAmount;
|
|
4123
|
+
};
|
|
4124
|
+
/**
|
|
4125
|
+
* The Centrifuge claim card: every wallet's pending and claimable positions on
|
|
4126
|
+
* an offer's vaults, and the claim that collects a filled one.
|
|
4127
|
+
*
|
|
4128
|
+
* The vaults come from the offer's `vaultContracts`, each chain's share and
|
|
4129
|
+
* funding token resolved through the token registry; a chain whose tokens the
|
|
4130
|
+
* registry does not list is left out and logged. Positions are read for every
|
|
4131
|
+
* wallet the host supplied, on both legs, and polled while anything is
|
|
4132
|
+
* pending. Vault status gates the Claim button, and is polled while the page
|
|
4133
|
+
* is visible.
|
|
4134
|
+
*
|
|
4135
|
+
* A claim runs in a dialog that tracks its steps. It is broadcast from the
|
|
4136
|
+
* wallet that holds the row - the proxy credits the sender - and on success
|
|
4137
|
+
* every position is read again, so the claimed amount leaves the card.
|
|
4138
|
+
*/
|
|
4139
|
+
declare function useCentrifugeVaultClaimViewModel({ offer, wallets, walletLabel, onClaimed, pollInterval, enabled, }: UseCentrifugeVaultClaimViewModelOptions): UseCentrifugeVaultClaimViewModelResult;
|
|
4140
|
+
|
|
4141
|
+
/**
|
|
4142
|
+
* Everything `ClaimContainer` needs that the offer cannot tell it, keyed by
|
|
4143
|
+
* the async offer type it belongs to.
|
|
4144
|
+
*
|
|
4145
|
+
* Keyed by {@link AsyncOfferType} with every key required, for the same reason
|
|
4146
|
+
* as `CheckoutConfig`: a host rendering `ClaimContainer` is saying it will
|
|
4147
|
+
* handle whatever async offer it is given, so a new async provider is a
|
|
4148
|
+
* compile error in every host rather than a card that silently renders
|
|
4149
|
+
* nothing. Per-integration, not per-offer: a host builds it once.
|
|
4150
|
+
*/
|
|
4151
|
+
type ClaimConfig = {
|
|
4152
|
+
[K in AsyncOfferType]: ClaimConfigByOfferType[K];
|
|
4153
|
+
};
|
|
4154
|
+
/**
|
|
4155
|
+
* What each async offer type needs, before {@link ClaimConfig} maps
|
|
4156
|
+
* `AsyncOfferType` over it. Private, so a new member of `AsyncOfferDetail`
|
|
4157
|
+
* with no entry here fails to index this type in the SDK first.
|
|
4158
|
+
*/
|
|
4159
|
+
type ClaimConfigByOfferType = {
|
|
4160
|
+
'centrifuge::vault': CentrifugeVaultClaimConfig;
|
|
4161
|
+
};
|
|
4162
|
+
/**
|
|
4163
|
+
* Centrifuge needs nothing required today: the vaults come from the offer and
|
|
4164
|
+
* the token registry. The key still has to be supplied, so that the day it
|
|
4165
|
+
* does need something the omission is a compile error.
|
|
4166
|
+
*/
|
|
4167
|
+
type CentrifugeVaultClaimConfig = {
|
|
4168
|
+
/** Fired once a claim has mined. The dialog shows either way. */
|
|
4169
|
+
onClaimed?: (claim: CentrifugeVaultClaimed) => void;
|
|
4170
|
+
};
|
|
4171
|
+
interface ClaimContainerProps {
|
|
4172
|
+
/**
|
|
4173
|
+
* The async offer whose positions to show. Its `type` decides which
|
|
4174
|
+
* provider renders. Narrow an `OfferDetail` with `AsyncOfferDetail.is`.
|
|
4175
|
+
*/
|
|
4176
|
+
offer: AsyncOfferDetail;
|
|
4177
|
+
/**
|
|
4178
|
+
* The wallets to read positions for and claim from, and the host's
|
|
4179
|
+
* external-wallet connector. Pass `externalAdapter: null` to hide the
|
|
4180
|
+
* connect affordance.
|
|
4181
|
+
*/
|
|
4182
|
+
wallets: WalletSelection;
|
|
4183
|
+
/**
|
|
4184
|
+
* Names a wallet for display, e.g. `'CoinList Wallet'` for the embedded
|
|
4185
|
+
* one. Omitted, or returning `null`, shows the shortened address.
|
|
4186
|
+
*/
|
|
4187
|
+
walletLabel?: WalletLabelResolver;
|
|
4188
|
+
/** What each async offer type needs beyond the offer itself. */
|
|
4189
|
+
config: ClaimConfig;
|
|
3108
4190
|
/**
|
|
3109
|
-
* Default `true`. `false` turns off every request and timer
|
|
3110
|
-
* that is
|
|
4191
|
+
* Default `true`. `false` turns off every request and timer in the mounted
|
|
4192
|
+
* provider, for a card that is on the tree but not on screen yet.
|
|
3111
4193
|
*/
|
|
3112
4194
|
enabled?: boolean;
|
|
3113
|
-
/** Fired once the swap has mined. The dialog shows either way. */
|
|
3114
|
-
onOrderConfirmed?: (order: SuperstateOrderPlaced) => void;
|
|
3115
4195
|
className?: string;
|
|
3116
4196
|
}
|
|
3117
4197
|
/**
|
|
3118
|
-
* The
|
|
3119
|
-
*
|
|
4198
|
+
* The plug-and-play claim card: hand it an async offer and it renders the
|
|
4199
|
+
* right provider's positions - what is pending, what is claimable - and the
|
|
4200
|
+
* claim that collects them.
|
|
3120
4201
|
*
|
|
3121
|
-
*
|
|
3122
|
-
*
|
|
3123
|
-
*
|
|
4202
|
+
* The second leg of an async trade. The user placed a request earlier, the
|
|
4203
|
+
* fund fills it on its own schedule, and they come back - days or weeks later
|
|
4204
|
+
* - to claim. So the card is its own entry on the offer page rather than a
|
|
4205
|
+
* checkout step.
|
|
3124
4206
|
*
|
|
3125
|
-
*
|
|
3126
|
-
*
|
|
4207
|
+
* Only the matching provider's container is mounted, so its viewmodel is the
|
|
4208
|
+
* only one that runs. The `switch` is exhaustive against
|
|
4209
|
+
* {@link AsyncOfferType}, and the `default` branch assigns to
|
|
4210
|
+
* `const exhaustive: never`, so a new async offer type is a compile error here
|
|
4211
|
+
* as well as in {@link ClaimConfig}.
|
|
4212
|
+
*
|
|
4213
|
+
* ```tsx
|
|
4214
|
+
* {AsyncOfferDetail.is(offer) && (
|
|
4215
|
+
* <ClaimContainer
|
|
4216
|
+
* key={offer.id}
|
|
4217
|
+
* offer={offer}
|
|
4218
|
+
* wallets={{ embedded, external, externalAdapter }}
|
|
4219
|
+
* walletLabel={(address) => (isEmbedded(address) ? 'CoinList Wallet' : null)}
|
|
4220
|
+
* config={{ 'centrifuge::vault': {} }}
|
|
4221
|
+
* />
|
|
4222
|
+
* )}
|
|
4223
|
+
* ```
|
|
3127
4224
|
*/
|
|
3128
|
-
declare function
|
|
4225
|
+
declare function ClaimContainer({ offer, wallets, walletLabel, config, enabled, className, }: ClaimContainerProps): ReactNode;
|
|
3129
4226
|
|
|
3130
|
-
interface
|
|
3131
|
-
|
|
3132
|
-
|
|
4227
|
+
interface CentrifugeVaultClaimContainerProps {
|
|
4228
|
+
/** The vault offer whose positions to show: its chains come from `vaultContracts`. */
|
|
4229
|
+
offer: CentrifugeVaultOfferDetail;
|
|
4230
|
+
/** The wallets to read positions for and claim from. */
|
|
4231
|
+
wallets: WalletSelection;
|
|
4232
|
+
/** Names a wallet for display; unnamed ones show a shortened address. */
|
|
4233
|
+
walletLabel?: WalletLabelResolver;
|
|
4234
|
+
/** Fired once a claim has mined. The dialog shows either way. */
|
|
4235
|
+
onClaimed?: (claim: CentrifugeVaultClaimed) => void;
|
|
4236
|
+
/**
|
|
4237
|
+
* Default `true`. `false` turns off every request and timer, for a card
|
|
4238
|
+
* that is mounted but not on screen yet.
|
|
4239
|
+
*/
|
|
4240
|
+
enabled?: boolean;
|
|
3133
4241
|
className?: string;
|
|
3134
4242
|
}
|
|
3135
4243
|
/**
|
|
3136
|
-
* The
|
|
3137
|
-
*
|
|
3138
|
-
*
|
|
3139
|
-
* `onEvent` is handed to each step unwrapped. A handler that accepts the wider
|
|
3140
|
-
* union is assignable where a step's narrower one is expected, so there is no
|
|
3141
|
-
* per-step lambda here and no re-dispatch on the way back up.
|
|
3142
|
-
*
|
|
3143
|
-
* The panel leads on a phone and moves to the right column from `md` up, where
|
|
3144
|
-
* it is reference material rather than the first thing to read. No page heading
|
|
3145
|
-
* and no back button — the host titles and navigates its own page.
|
|
3146
|
-
*
|
|
3147
|
-
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
3148
|
-
* needed around it. The steps scope themselves too, and the scope is
|
|
3149
|
-
* idempotent, so nesting costs nothing.
|
|
4244
|
+
* The Centrifuge claim card: every wallet's pending and claimable positions on
|
|
4245
|
+
* a vault offer, polled while anything is pending, and the claim that
|
|
4246
|
+
* collects a filled one.
|
|
3150
4247
|
*/
|
|
3151
|
-
declare function
|
|
4248
|
+
declare function CentrifugeVaultClaimContainer({ offer, wallets, walletLabel, onClaimed, enabled, className, }: CentrifugeVaultClaimContainerProps): ReactNode;
|
|
3152
4249
|
|
|
3153
|
-
interface
|
|
3154
|
-
|
|
3155
|
-
|
|
4250
|
+
interface CentrifugeVaultClaimDialogProps {
|
|
4251
|
+
dialog: CentrifugeClaimDialogUi;
|
|
4252
|
+
onRetry: () => void;
|
|
4253
|
+
onClose: () => void;
|
|
3156
4254
|
}
|
|
3157
4255
|
/**
|
|
3158
|
-
* The
|
|
3159
|
-
*
|
|
4256
|
+
* The dialog a claim runs in: its steps as they happen, the step that broke
|
|
4257
|
+
* and why, or what was claimed.
|
|
3160
4258
|
*
|
|
3161
|
-
*
|
|
3162
|
-
*
|
|
3163
|
-
|
|
4259
|
+
* Closing it mid-claim is allowed and cancels nothing: a broadcast claim
|
|
4260
|
+
* still mines, and the card refetches when it does.
|
|
4261
|
+
*/
|
|
4262
|
+
declare function CentrifugeVaultClaimDialog({ dialog, onRetry, onClose, }: CentrifugeVaultClaimDialogProps): ReactNode;
|
|
4263
|
+
|
|
4264
|
+
interface CentrifugeVaultClaimRowProps {
|
|
4265
|
+
row: CentrifugeClaimRowUi;
|
|
4266
|
+
/** Asked for when the row is claimable and its Claim button is pressed. */
|
|
4267
|
+
onClaim: () => void;
|
|
4268
|
+
}
|
|
4269
|
+
/**
|
|
4270
|
+
* One position row of the claim card.
|
|
3164
4271
|
*
|
|
3165
|
-
*
|
|
3166
|
-
*
|
|
4272
|
+
* A pending row names the offer and, on the right, what is queued and from
|
|
4273
|
+
* which wallet. A claimable row leads with what the user gets, and puts the
|
|
4274
|
+
* Claim button where the amount would be. A blocked claim keeps its row and
|
|
4275
|
+
* says why under it, so the user is not left wondering where their claim went.
|
|
3167
4276
|
*/
|
|
3168
|
-
declare function
|
|
4277
|
+
declare function CentrifugeVaultClaimRow({ row, onClaim, }: CentrifugeVaultClaimRowProps): ReactNode;
|
|
3169
4278
|
|
|
3170
|
-
interface
|
|
3171
|
-
state:
|
|
3172
|
-
onEvent: (event:
|
|
4279
|
+
interface CentrifugeVaultClaimViewProps {
|
|
4280
|
+
state: CentrifugeVaultClaimUiState;
|
|
4281
|
+
onEvent: (event: CentrifugeVaultClaimUiEvent) => void;
|
|
3173
4282
|
className?: string;
|
|
3174
4283
|
}
|
|
3175
4284
|
/**
|
|
3176
|
-
*
|
|
3177
|
-
* and
|
|
3178
|
-
*
|
|
3179
|
-
* Confirming allow-lists the wallet on-chain, which is why the CTA renders a
|
|
3180
|
-
* loading message rather than a spinner alone — the copy is what tells the user
|
|
3181
|
-
* their wallet is about to ask them to sign. The completed step says
|
|
3182
|
-
* `Allowlisted`, the only place the flow admits that anything happened.
|
|
3183
|
-
*
|
|
3184
|
-
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
3185
|
-
* needed around it.
|
|
4285
|
+
* The claim card: a wallet's pending and claimable Centrifuge positions, the
|
|
4286
|
+
* footer that connects an external wallet, and the dialog a claim runs in.
|
|
3186
4287
|
*/
|
|
3187
|
-
declare function
|
|
4288
|
+
declare function CentrifugeVaultClaimView({ state, onEvent, className, }: CentrifugeVaultClaimViewProps): ReactNode;
|
|
3188
4289
|
|
|
3189
4290
|
/**
|
|
3190
4291
|
* One image as an `<img>` renders it: a `src` for a consumer that takes a
|
|
@@ -4230,107 +5331,499 @@ type ConnectWalletFlowResult = {
|
|
|
4230
5331
|
error: ConnectWalletFlowError;
|
|
4231
5332
|
};
|
|
4232
5333
|
/**
|
|
4233
|
-
* The client surface the flow actually depends on, kept narrow on purpose.
|
|
5334
|
+
* The client surface the flow actually depends on, kept narrow on purpose.
|
|
5335
|
+
*
|
|
5336
|
+
* Named as a structural slice rather than `Pick<CoinListClient, 'wallets'>` so
|
|
5337
|
+
* this feature does not import its layer's entry point: a flow takes the
|
|
5338
|
+
* namespaces it needs, the way `@/client/core/checkout/**` flows do.
|
|
5339
|
+
*/
|
|
5340
|
+
type ConnectWalletClient = {
|
|
5341
|
+
wallets: WalletsNamespace;
|
|
5342
|
+
};
|
|
5343
|
+
type ConnectWalletFlowParams = {
|
|
5344
|
+
coinlist: ConnectWalletClient;
|
|
5345
|
+
/** Host-provided connected wallet the flow signs with. */
|
|
5346
|
+
wallet: ConnectWallet;
|
|
5347
|
+
offerId: OfferId;
|
|
5348
|
+
offerOptionId: OfferOptionId;
|
|
5349
|
+
/** Challenge framing; defaults to `'siwe'`. */
|
|
5350
|
+
challengeType?: WalletChallengeType;
|
|
5351
|
+
/** SIWE statement shown in the signing prompt. */
|
|
5352
|
+
statement?: string;
|
|
5353
|
+
/**
|
|
5354
|
+
* Polled before each irreversible step (signing, binding). Return true to
|
|
5355
|
+
* abandon a superseded attempt; the flow then resolves `{ type: 'cancelled' }`
|
|
5356
|
+
* without prompting the wallet or binding. React hooks pass a generation
|
|
5357
|
+
* check here; non-React callers can omit it.
|
|
5358
|
+
*/
|
|
5359
|
+
isCancelled?: () => boolean;
|
|
5360
|
+
/** Reports flow progress for consumers rendering loading states. */
|
|
5361
|
+
onProgress?: (phase: ConnectWalletPhase) => void;
|
|
5362
|
+
};
|
|
5363
|
+
/**
|
|
5364
|
+
* Drives the external-wallet ownership flow for one offer option:
|
|
5365
|
+
* `createWalletOwnershipChallenge` -> host `wallet.signMessage` ->
|
|
5366
|
+
* `connectExternalWallet`. Pure and signer-agnostic: signing is delegated to
|
|
5367
|
+
* the host-provided {@link ConnectWallet}, and no React is involved so non-hook
|
|
5368
|
+
* consumers can drive it directly (mirrors `authorizeWallet` in `swap-flows`).
|
|
5369
|
+
* EVM / EOA + SIWE only for now.
|
|
5370
|
+
*/
|
|
5371
|
+
declare function connectExternalWalletFlow(params: ConnectWalletFlowParams): Promise<ConnectWalletFlowResult>;
|
|
5372
|
+
|
|
5373
|
+
interface UseCoinListSignInCardViewModelOptions {
|
|
5374
|
+
/** `error` renders the sign-in failure banner. Defaults to `idle`. */
|
|
5375
|
+
status?: 'idle' | 'error';
|
|
5376
|
+
/**
|
|
5377
|
+
* Called when the user clicks the sign-in button. Defaults to
|
|
5378
|
+
* `CoinListClient#auth.startOAuth`, which redirects to the CoinList
|
|
5379
|
+
* authorization page.
|
|
5380
|
+
*/
|
|
5381
|
+
onSignIn?: () => void;
|
|
5382
|
+
/** Called when the user closes the card. When omitted, no close button is rendered. */
|
|
5383
|
+
onClose?: () => void;
|
|
5384
|
+
}
|
|
5385
|
+
interface UseCoinListSignInCardViewModelResult {
|
|
5386
|
+
state: CoinListSignInCardUiState;
|
|
5387
|
+
onEvent: (event: CoinListSignInCardUiEvent) => void;
|
|
5388
|
+
}
|
|
5389
|
+
/**
|
|
5390
|
+
* Drives {@link CoinListSignInCardView}. Starts the OAuth flow on sign-in
|
|
5391
|
+
* unless the host overrides it, and reports whether the card can be closed.
|
|
5392
|
+
*/
|
|
5393
|
+
declare function useCoinListSignInCardViewModel(options?: UseCoinListSignInCardViewModelOptions): UseCoinListSignInCardViewModelResult;
|
|
5394
|
+
|
|
5395
|
+
/**
|
|
5396
|
+
* Reasons passed to {@link UseCompleteOAuthOptions.onFailure} when the
|
|
5397
|
+
* OAuth callback cannot be completed. Includes PKCE / redirect validation
|
|
5398
|
+
* errors from {@link CoinListClient.completeOAuth} and a dedicated value when
|
|
5399
|
+
* {@link UseCompleteOAuthOptions.postOAuthComplete} fails or rejects.
|
|
5400
|
+
*/
|
|
5401
|
+
type CompleteOAuthFailureReason = OauthClientErrorReason | 'complete_request_failed';
|
|
5402
|
+
interface UseCompleteOAuthOptions {
|
|
5403
|
+
/**
|
|
5404
|
+
* Exchange the authorization code on your backend (e.g. POST to your API).
|
|
5405
|
+
* Return `true` when the session was established successfully, `false` when
|
|
5406
|
+
* the request completed but signing in failed. Rejections are treated like
|
|
5407
|
+
* `false` and reported as {@link CompleteOAuthFailureReason}
|
|
5408
|
+
* `"complete_request_failed"`.
|
|
5409
|
+
*/
|
|
5410
|
+
postOAuthComplete: (payload: {
|
|
5411
|
+
code: AuthorizationCode;
|
|
5412
|
+
codeVerifier: CodeVerifier;
|
|
5413
|
+
}) => Promise<boolean>;
|
|
5414
|
+
/**
|
|
5415
|
+
* Called when the user denied access (`error` query parameter), when
|
|
5416
|
+
* {@link CoinListClient.completeOAuth} fails PKCE/state validation, or when
|
|
5417
|
+
* {@link UseCompleteOAuthOptions.postOAuthComplete} fails.
|
|
5418
|
+
*/
|
|
5419
|
+
onFailure: (reason: CompleteOAuthFailureReason) => void | Promise<void>;
|
|
5420
|
+
/** Invoked after {@link UseCompleteOAuthOptions.postOAuthComplete} succeeds and {@link CoinListClient.init} has refreshed the client session. */
|
|
5421
|
+
onSuccess: () => void | Promise<void>;
|
|
5422
|
+
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Runs the CoinList OAuth callback once on mount: validates the redirect URL via
|
|
5425
|
+
* {@link CoinListClient.completeOAuth}, exchanges the code via {@link UseCompleteOAuthOptions.postOAuthComplete},
|
|
5426
|
+
* refreshes tokens with {@link CoinListClient.init}, then calls {@link UseCompleteOAuthOptions.onSuccess}.
|
|
5427
|
+
*
|
|
5428
|
+
* Framework-agnostic: reads `window.location` like {@link CoinListClient.completeOAuth}. Supply
|
|
5429
|
+
* {@link UseCompleteOAuthOptions.postOAuthComplete}, {@link UseCompleteOAuthOptions.onFailure},
|
|
5430
|
+
* and {@link UseCompleteOAuthOptions.onSuccess} to perform redirects or routing in your app.
|
|
5431
|
+
*
|
|
5432
|
+
* Must be used within {@link CoinListProvider}.
|
|
5433
|
+
*/
|
|
5434
|
+
declare function useCompleteOAuth(options: UseCompleteOAuthOptions): void;
|
|
5435
|
+
|
|
5436
|
+
type CentrifugeBuyAmountConfirmed = {
|
|
5437
|
+
amount: BlockchainAmount;
|
|
5438
|
+
inputAsset: StablecoinSymbol;
|
|
5439
|
+
};
|
|
5440
|
+
type CentrifugeBuyAmountStepInput = {
|
|
5441
|
+
type: 'incomplete';
|
|
5442
|
+
} | {
|
|
5443
|
+
type: 'active';
|
|
5444
|
+
wallet: EvmWallet;
|
|
5445
|
+
/**
|
|
5446
|
+
* Set when the vault is known to be unable to take a request. Unknown
|
|
5447
|
+
* and failed statuses leave this null: they do not block a deposit.
|
|
5448
|
+
*/
|
|
5449
|
+
depositBlockedMessage: string | null;
|
|
5450
|
+
/**
|
|
5451
|
+
* The offer's minimum, from the indicative quote. `null` when that
|
|
5452
|
+
* quote has not named one.
|
|
5453
|
+
*/
|
|
5454
|
+
minimumInputAmount: BlockchainAmount | null;
|
|
5455
|
+
/** True until the indicative quote has answered, so the minimum is known. */
|
|
5456
|
+
awaitingMinimum: boolean;
|
|
5457
|
+
} | {
|
|
5458
|
+
type: 'complete';
|
|
5459
|
+
wallet: EvmWallet;
|
|
5460
|
+
amount: BlockchainAmount;
|
|
5461
|
+
inputAsset: StablecoinSymbol;
|
|
5462
|
+
};
|
|
5463
|
+
interface UseCentrifugeBuyAmountViewModelOptions {
|
|
5464
|
+
stepInput: CentrifugeBuyAmountStepInput;
|
|
5465
|
+
chain: EthereumChain;
|
|
5466
|
+
enabled?: boolean;
|
|
5467
|
+
onComplete: (confirmed: CentrifugeBuyAmountConfirmed) => void;
|
|
5468
|
+
onEdit: () => void;
|
|
5469
|
+
}
|
|
5470
|
+
interface UseCentrifugeBuyAmountViewModelResult {
|
|
5471
|
+
state: CentrifugeBuyAmountUiState;
|
|
5472
|
+
onEvent: (event: CentrifugeBuyAmountUiEvent) => void;
|
|
5473
|
+
}
|
|
5474
|
+
/**
|
|
5475
|
+
* Drives step 2: how much to deposit.
|
|
5476
|
+
*
|
|
5477
|
+
* Confirming validates the amount in memory and hands it up. The estimate
|
|
5478
|
+
* for that amount is polled for the review step. Nothing here is signed.
|
|
5479
|
+
*/
|
|
5480
|
+
declare function useCentrifugeBuyAmountViewModel({ stepInput, chain, enabled, onComplete, onEdit, }: UseCentrifugeBuyAmountViewModelOptions): UseCentrifugeBuyAmountViewModelResult;
|
|
5481
|
+
type CentrifugeBuyAmountValidation = {
|
|
5482
|
+
valid: true;
|
|
5483
|
+
amount: BlockchainAmount;
|
|
5484
|
+
} | {
|
|
5485
|
+
valid: false;
|
|
5486
|
+
error: string;
|
|
5487
|
+
};
|
|
5488
|
+
declare function validateCentrifugeBuyAmount({ input, decimals, balance, symbol, minimum, locale, }: {
|
|
5489
|
+
input: string;
|
|
5490
|
+
decimals: AssetDecimals;
|
|
5491
|
+
balance: bigint | null;
|
|
5492
|
+
symbol: AssetSymbol;
|
|
5493
|
+
minimum: BlockchainAmount | null;
|
|
5494
|
+
locale: string;
|
|
5495
|
+
}): CentrifugeBuyAmountValidation;
|
|
5496
|
+
|
|
5497
|
+
/**
|
|
5498
|
+
* Why a Centrifuge read failed, in the only two flavours a UI acts on
|
|
5499
|
+
* differently.
|
|
5500
|
+
*
|
|
5501
|
+
* `not-authenticated` is split out because no retry helps until the user
|
|
5502
|
+
* signs in. Everything else collapses into `generic-error` and is offered a
|
|
5503
|
+
* retry.
|
|
5504
|
+
*/
|
|
5505
|
+
type CentrifugeLoadErrorReason = 'not-authenticated' | 'generic-error';
|
|
5506
|
+
declare function centrifugeLoadErrorReason(error: unknown): CentrifugeLoadErrorReason;
|
|
5507
|
+
|
|
5508
|
+
/**
|
|
5509
|
+
* The built deposit request a review step can place.
|
|
5510
|
+
*
|
|
5511
|
+
* `isRefreshing` rides on `CONTENT` so a rebuild never blanks the numbers on
|
|
5512
|
+
* screen. A failed rebuild keeps them and says why.
|
|
5513
|
+
*/
|
|
5514
|
+
type LoadCentrifugeBuyTransactionState = {
|
|
5515
|
+
type: 'LOADING';
|
|
5516
|
+
} | {
|
|
5517
|
+
type: 'ERROR';
|
|
5518
|
+
reason: CentrifugeLoadErrorReason;
|
|
5519
|
+
} | {
|
|
5520
|
+
type: 'CONTENT';
|
|
5521
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
5522
|
+
isRefreshing: boolean;
|
|
5523
|
+
refreshError: CentrifugeLoadErrorReason | null;
|
|
5524
|
+
};
|
|
5525
|
+
interface UseCentrifugeBuyTransactionOptions {
|
|
5526
|
+
/**
|
|
5527
|
+
* The request to build, or `null` before an amount is confirmed. A `null`
|
|
5528
|
+
* request fetches nothing.
|
|
5529
|
+
*/
|
|
5530
|
+
request: BuildCentrifugeVaultBuyParams | null;
|
|
5531
|
+
/**
|
|
5532
|
+
* A request the caller already holds, typically the one `prepareBuy`
|
|
5533
|
+
* returned. When present the hook adopts it and skips the initial build.
|
|
5534
|
+
* `refetch` still builds.
|
|
5535
|
+
*/
|
|
5536
|
+
data?: CentrifugeVaultBuyTransaction;
|
|
5537
|
+
/** When false, the hook does not build. */
|
|
5538
|
+
enabled: boolean;
|
|
5539
|
+
}
|
|
5540
|
+
interface UseCentrifugeBuyTransactionResult {
|
|
5541
|
+
state: LoadCentrifugeBuyTransactionState;
|
|
5542
|
+
/** Builds a fresh request for the same deposit. */
|
|
5543
|
+
refetch: () => void;
|
|
5544
|
+
}
|
|
5545
|
+
/**
|
|
5546
|
+
* Holds the deposit request the review step places, and rebuilds it when
|
|
5547
|
+
* asked.
|
|
5548
|
+
*
|
|
5549
|
+
* **Never polls.** A request is built once, when the user confirms an amount
|
|
5550
|
+
* or asks to refresh. The indicative quote is the thing that polls, and that
|
|
5551
|
+
* is a different hook.
|
|
5552
|
+
*/
|
|
5553
|
+
declare function useCentrifugeBuyTransaction(options: UseCentrifugeBuyTransactionOptions): UseCentrifugeBuyTransactionResult;
|
|
5554
|
+
|
|
5555
|
+
/**
|
|
5556
|
+
* The state of the indicative-quote poll.
|
|
5557
|
+
*
|
|
5558
|
+
* - `LOADING`: no quote yet (initial, or the provider is still initializing).
|
|
5559
|
+
* - `ERROR`: no quote could be fetched at all.
|
|
5560
|
+
* - `CONTENT`: a quote is in hand; `isRefreshing` says whether a newer one
|
|
5561
|
+
* is on the way.
|
|
5562
|
+
*
|
|
5563
|
+
* A poll that fails with a quote already in hand stays `CONTENT`: the last
|
|
5564
|
+
* quote is worth more to a user than a blank panel, and the next tick retries
|
|
5565
|
+
* within seconds. `ERROR` therefore means "never got one".
|
|
5566
|
+
*
|
|
5567
|
+
* There is no expiry on this quote. It is indicative, the fund prices
|
|
5568
|
+
* fulfilment later, and a countdown would imply a commitment the API does
|
|
5569
|
+
* not make. Freshness is the poll interval, not a TTL.
|
|
5570
|
+
*/
|
|
5571
|
+
type LoadCentrifugeQuoteState = {
|
|
5572
|
+
type: 'LOADING';
|
|
5573
|
+
} | {
|
|
5574
|
+
type: 'ERROR';
|
|
5575
|
+
reason: CentrifugeLoadErrorReason;
|
|
5576
|
+
} | {
|
|
5577
|
+
type: 'CONTENT';
|
|
5578
|
+
quote: CentrifugeVaultQuote;
|
|
5579
|
+
isRefreshing: boolean;
|
|
5580
|
+
};
|
|
5581
|
+
interface UseCentrifugeQuoteOptions {
|
|
5582
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
5583
|
+
symbol: AssetSymbol;
|
|
5584
|
+
chain: EthereumChain;
|
|
5585
|
+
/** The spend to price, in the funding token's base units. */
|
|
5586
|
+
amount: BlockchainAmount;
|
|
5587
|
+
/** How often to refresh. Defaults to {@link CENTRIFUGE_POLL_INTERVAL_MS}. */
|
|
5588
|
+
pollIntervalMs?: number;
|
|
5589
|
+
/**
|
|
5590
|
+
* A quote the caller already holds, typically fetched server-side, used as
|
|
5591
|
+
* the state the hook opens on so a server-rendered panel needs no loading
|
|
5592
|
+
* pass.
|
|
5593
|
+
*
|
|
5594
|
+
* It seeds the first render only: the poll still fetches immediately. A
|
|
5595
|
+
* quote is worth as much as it is fresh, and the amount being priced
|
|
5596
|
+
* changes as the flow advances, so a seed that suppressed the first read
|
|
5597
|
+
* would be offering the server's answer - or another amount's - as this
|
|
5598
|
+
* one's.
|
|
5599
|
+
*/
|
|
5600
|
+
data?: CentrifugeVaultQuote;
|
|
5601
|
+
/** When false, the hook neither fetches nor polls. */
|
|
5602
|
+
enabled: boolean;
|
|
5603
|
+
/**
|
|
5604
|
+
* Bump to fetch immediately, ahead of the poll. The review step uses this
|
|
5605
|
+
* for Try again.
|
|
5606
|
+
*/
|
|
5607
|
+
reloadKey?: number;
|
|
5608
|
+
}
|
|
5609
|
+
interface UseCentrifugeQuoteResult {
|
|
5610
|
+
state: LoadCentrifugeQuoteState;
|
|
5611
|
+
}
|
|
5612
|
+
/**
|
|
5613
|
+
* Polls Centrifuge's indicative quote for `amount` of `symbol` on `chain`.
|
|
4234
5614
|
*
|
|
4235
|
-
*
|
|
4236
|
-
*
|
|
4237
|
-
*
|
|
5615
|
+
* Free to poll: this quote spends no attestation and commits nothing, which
|
|
5616
|
+
* is why it may run while the user is still deciding. It also cannot be
|
|
5617
|
+
* executed - committing a request is `coinlist.centrifuge.buildBuyTransaction`,
|
|
5618
|
+
* which is not this hook.
|
|
5619
|
+
*
|
|
5620
|
+
* Disabled (or before the provider is ready) it neither fetches nor holds a
|
|
5621
|
+
* timer, and stays on whatever state it opened with - `LOADING`, or the
|
|
5622
|
+
* `data` seed - rather than reporting an error.
|
|
5623
|
+
*
|
|
5624
|
+
* A `data` quote opens the state instead of `LOADING` and is otherwise left
|
|
5625
|
+
* to the poll: the first tick fires as it always does, and only replaces the
|
|
5626
|
+
* seed once it has a quote of its own. Until it does the state is `CONTENT`
|
|
5627
|
+
* with `isRefreshing` set, which is what that flag is for.
|
|
4238
5628
|
*/
|
|
4239
|
-
|
|
4240
|
-
|
|
5629
|
+
declare function useCentrifugeQuote(options: UseCentrifugeQuoteOptions): UseCentrifugeQuoteResult;
|
|
5630
|
+
|
|
5631
|
+
declare const SETTLES_LATER = "Settles later, at the price the fund sets then.";
|
|
5632
|
+
type CentrifugeBuyReviewStepInput = {
|
|
5633
|
+
type: 'incomplete';
|
|
5634
|
+
} | {
|
|
5635
|
+
type: 'active';
|
|
5636
|
+
wallet: EvmWallet;
|
|
5637
|
+
amount: BlockchainAmount;
|
|
5638
|
+
inputAsset: StablecoinSymbol;
|
|
5639
|
+
/** Known vault block. Unknown status leaves this null. */
|
|
5640
|
+
depositBlockedMessage: string | null;
|
|
4241
5641
|
};
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
/** Challenge framing; defaults to `'siwe'`. */
|
|
4249
|
-
challengeType?: WalletChallengeType;
|
|
4250
|
-
/** SIWE statement shown in the signing prompt. */
|
|
4251
|
-
statement?: string;
|
|
5642
|
+
interface UseCentrifugeBuyReviewViewModelOptions {
|
|
5643
|
+
stepInput: CentrifugeBuyReviewStepInput;
|
|
5644
|
+
symbol: AssetSymbol;
|
|
5645
|
+
chain: EthereumChain;
|
|
5646
|
+
/** The offer's vault proxies. The spender the approval is written to. */
|
|
5647
|
+
vaultContracts: OfferVaultContract[];
|
|
4252
5648
|
/**
|
|
4253
|
-
*
|
|
4254
|
-
*
|
|
4255
|
-
* without prompting the wallet or binding. React hooks pass a generation
|
|
4256
|
-
* check here; non-React callers can omit it.
|
|
5649
|
+
* The checkout's quote poll. The review card reads the estimate for the
|
|
5650
|
+
* confirmed amount off it, and does not build a transaction to get one.
|
|
4257
5651
|
*/
|
|
4258
|
-
|
|
4259
|
-
/**
|
|
4260
|
-
|
|
4261
|
-
|
|
5652
|
+
quoteState: LoadCentrifugeQuoteState;
|
|
5653
|
+
/** Asks the quote poll to fetch now. Try again on a failed estimate. */
|
|
5654
|
+
onRefreshQuote: () => void;
|
|
5655
|
+
/**
|
|
5656
|
+
* The indicative price from the quote poll, or `null` when that poll has
|
|
5657
|
+
* not answered. Optional: the review card does not show it, so a caller
|
|
5658
|
+
* that is not opening the placed dialog can skip it. A skipped price is
|
|
5659
|
+
* absent on the dialog.
|
|
5660
|
+
*/
|
|
5661
|
+
indicativePrice?: DecimalString | null;
|
|
5662
|
+
/**
|
|
5663
|
+
* When false, refreshing the estimate and placing the request do nothing.
|
|
5664
|
+
* Defaults to true.
|
|
5665
|
+
*
|
|
5666
|
+
* The step being `incomplete` is not the same thing: a checkout switched
|
|
5667
|
+
* off mid-flow leaves this step `active`, with the amount still here.
|
|
5668
|
+
*/
|
|
5669
|
+
enabled?: boolean;
|
|
5670
|
+
onComplete: (order: CentrifugeOrderPlaced) => void;
|
|
5671
|
+
}
|
|
5672
|
+
interface UseCentrifugeBuyReviewViewModelResult {
|
|
5673
|
+
state: CentrifugeBuyReviewUiState;
|
|
5674
|
+
onEvent: (event: CentrifugeBuyReviewUiEvent) => void;
|
|
5675
|
+
}
|
|
4262
5676
|
/**
|
|
4263
|
-
* Drives
|
|
4264
|
-
*
|
|
4265
|
-
*
|
|
4266
|
-
* the
|
|
4267
|
-
*
|
|
4268
|
-
*
|
|
5677
|
+
* Drives step 3: the estimate, and placing the request.
|
|
5678
|
+
*
|
|
5679
|
+
* The estimate comes from the quote poll. Placing approves the vault proxy
|
|
5680
|
+
* when the allowance is short, builds the request, and broadcasts it. None of
|
|
5681
|
+
* that runs on the amount step: the quote does not expire, so a user who
|
|
5682
|
+
* edits the amount has not already signed an approval for the old one.
|
|
4269
5683
|
*/
|
|
4270
|
-
declare function
|
|
5684
|
+
declare function useCentrifugeBuyReviewViewModel({ stepInput, symbol, chain, vaultContracts, quoteState, onRefreshQuote, indicativePrice, enabled, onComplete, }: UseCentrifugeBuyReviewViewModelOptions): UseCentrifugeBuyReviewViewModelResult;
|
|
4271
5685
|
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
5686
|
+
type CentrifugeBuyStep = {
|
|
5687
|
+
type: 'wallet';
|
|
5688
|
+
} | {
|
|
5689
|
+
type: 'amount';
|
|
5690
|
+
wallet: EvmWallet;
|
|
5691
|
+
} | {
|
|
5692
|
+
type: 'review';
|
|
5693
|
+
wallet: EvmWallet;
|
|
5694
|
+
amount: BlockchainAmount;
|
|
5695
|
+
inputAsset: StablecoinSymbol;
|
|
5696
|
+
};
|
|
5697
|
+
interface UseCentrifugeBuyCheckoutViewModelOptions {
|
|
5698
|
+
offer: CentrifugeVaultOfferDetail;
|
|
5699
|
+
/** Share token symbol, e.g. `deJTRSY`. */
|
|
5700
|
+
symbol: AssetSymbol;
|
|
5701
|
+
chain: EthereumChain;
|
|
5702
|
+
wallets: CheckoutWalletSelection;
|
|
5703
|
+
enabled?: boolean;
|
|
5704
|
+
/** Fired once the request has mined. The dialog shows either way. */
|
|
5705
|
+
onOrderPlaced?: (order: CentrifugeOrderPlaced) => void;
|
|
4275
5706
|
/**
|
|
4276
|
-
*
|
|
4277
|
-
* `
|
|
4278
|
-
* authorization page.
|
|
5707
|
+
* The fund the token tracks. Frontline does not send this yet, so pass
|
|
5708
|
+
* `null` and the asset-details row stays hidden.
|
|
4279
5709
|
*/
|
|
4280
|
-
|
|
4281
|
-
/**
|
|
4282
|
-
|
|
5710
|
+
underlyingFund: string | null;
|
|
5711
|
+
/**
|
|
5712
|
+
* Trailing yield as display copy, e.g. `3.60%`. Frontline does not send
|
|
5713
|
+
* this yet, so pass `null` and the corner stays empty.
|
|
5714
|
+
*/
|
|
5715
|
+
apy: string | null;
|
|
4283
5716
|
}
|
|
4284
|
-
interface
|
|
4285
|
-
state:
|
|
4286
|
-
onEvent: (event:
|
|
5717
|
+
interface UseCentrifugeBuyCheckoutViewModelResult {
|
|
5718
|
+
state: CentrifugeBuyCheckoutUiState;
|
|
5719
|
+
onEvent: (event: CentrifugeBuyCheckoutUiEvent) => void;
|
|
4287
5720
|
}
|
|
4288
5721
|
/**
|
|
4289
|
-
* Drives
|
|
4290
|
-
*
|
|
5722
|
+
* Drives the Centrifuge buy checkout.
|
|
5723
|
+
*
|
|
5724
|
+
* The container mounts this hook only. It composes the wallet, amount,
|
|
5725
|
+
* review, and sidebar steps. The quote and status polls live here because
|
|
5726
|
+
* the panel and the review step share them. The amount step only validates.
|
|
5727
|
+
*
|
|
5728
|
+
* A vault that is known to be blocked replaces the checkout only at the
|
|
5729
|
+
* wallet step. A status that is still loading, or that failed, does not.
|
|
4291
5730
|
*/
|
|
4292
|
-
declare function
|
|
5731
|
+
declare function useCentrifugeBuyCheckoutViewModel({ offer, symbol, chain, wallets, enabled, onOrderPlaced, underlyingFund, apy, }: UseCentrifugeBuyCheckoutViewModelOptions): UseCentrifugeBuyCheckoutViewModelResult;
|
|
4293
5732
|
|
|
4294
5733
|
/**
|
|
4295
|
-
*
|
|
4296
|
-
*
|
|
4297
|
-
*
|
|
4298
|
-
*
|
|
5734
|
+
* User-facing copy for each `can_order` reason F-0 publishes.
|
|
5735
|
+
*
|
|
5736
|
+
* A record keyed by the closed set, so a new reason fails to compile here
|
|
5737
|
+
* until it has a sentence. The View (or a viewmodel mapping into one) should
|
|
5738
|
+
* render this rather than the wire token.
|
|
5739
|
+
*
|
|
5740
|
+
* Status never returns `below_minimum`; a quote can. Both call this with
|
|
5741
|
+
* whichever subset they actually hold.
|
|
4299
5742
|
*/
|
|
4300
|
-
|
|
4301
|
-
|
|
5743
|
+
declare const CENTRIFUGE_VAULT_ORDER_REASON_MESSAGES: Record<CentrifugeOrderReason, string>;
|
|
5744
|
+
declare function centrifugeVaultOrderReasonMessage(reason: CentrifugeOrderReason): string;
|
|
5745
|
+
/**
|
|
5746
|
+
* The most blocking reason in `reasons`, or `null` when the list is empty.
|
|
5747
|
+
*/
|
|
5748
|
+
declare function primaryCentrifugeVaultOrderReason<T extends CentrifugeOrderReason>(reasons: readonly T[]): T | null;
|
|
5749
|
+
/**
|
|
5750
|
+
* The sentence to show for an {@link CentrifugeOrderability}, or `null` when
|
|
5751
|
+
* the request can proceed. Accepts a quote's full reason set or a status's
|
|
5752
|
+
* narrower one.
|
|
5753
|
+
*/
|
|
5754
|
+
declare function centrifugeVaultOrderingMessage<R extends CentrifugeOrderReason>(orderability: CentrifugeOrderability<R>): string | null;
|
|
5755
|
+
|
|
5756
|
+
interface UseCentrifugeSidebarViewModelOptions {
|
|
5757
|
+
offer: CentrifugeVaultOfferDetail;
|
|
5758
|
+
symbol: AssetSymbol;
|
|
5759
|
+
chain: EthereumChain;
|
|
5760
|
+
tokenMetadata: TokenMetadata | null;
|
|
5761
|
+
quoteState: LoadCentrifugeQuoteState;
|
|
4302
5762
|
/**
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
4305
|
-
* the request completed but signing in failed. Rejections are treated like
|
|
4306
|
-
* `false` and reported as {@link CompleteOAuthFailureReason}
|
|
4307
|
-
* `"complete_request_failed"`.
|
|
5763
|
+
* The fund the token tracks. Frontline does not send this yet, so callers
|
|
5764
|
+
* pass `null` and the row stays hidden.
|
|
4308
5765
|
*/
|
|
4309
|
-
|
|
4310
|
-
code: AuthorizationCode;
|
|
4311
|
-
codeVerifier: CodeVerifier;
|
|
4312
|
-
}) => Promise<boolean>;
|
|
5766
|
+
underlyingFund: string | null;
|
|
4313
5767
|
/**
|
|
4314
|
-
*
|
|
4315
|
-
*
|
|
4316
|
-
* {@link UseCompleteOAuthOptions.postOAuthComplete} fails.
|
|
5768
|
+
* Trailing yield as display copy, e.g. `3.60%`. Frontline does not send
|
|
5769
|
+
* this yet, so callers pass `null` and the corner stays empty.
|
|
4317
5770
|
*/
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
5771
|
+
apy: string | null;
|
|
5772
|
+
}
|
|
5773
|
+
interface UseCentrifugeSidebarViewModelResult {
|
|
5774
|
+
state: CentrifugeSidebarUiState;
|
|
4321
5775
|
}
|
|
4322
5776
|
/**
|
|
4323
|
-
*
|
|
4324
|
-
* {@link CoinListClient.completeOAuth}, exchanges the code via {@link UseCompleteOAuthOptions.postOAuthComplete},
|
|
4325
|
-
* refreshes tokens with {@link CoinListClient.init}, then calls {@link UseCompleteOAuthOptions.onSuccess}.
|
|
5777
|
+
* Drives the asset panel beside the Centrifuge checkout.
|
|
4326
5778
|
*
|
|
4327
|
-
*
|
|
4328
|
-
*
|
|
4329
|
-
*
|
|
5779
|
+
* The quote poll is passed in. The checkout already runs it, sized to a fixed
|
|
5780
|
+
* amount until the user confirms one, so a second poll here would price a
|
|
5781
|
+
* different spend. Only the minimum is read off it. Yield and the underlying
|
|
5782
|
+
* fund are arguments: frontline does not publish either yet, so callers pass
|
|
5783
|
+
* `null`.
|
|
5784
|
+
*/
|
|
5785
|
+
declare function useCentrifugeSidebarViewModel({ offer, symbol, chain, tokenMetadata, quoteState, underlyingFund, apy, }: UseCentrifugeSidebarViewModelOptions): UseCentrifugeSidebarViewModelResult;
|
|
5786
|
+
|
|
5787
|
+
/**
|
|
5788
|
+
* Whether step 1 is being filled in or already answered.
|
|
4330
5789
|
*
|
|
4331
|
-
*
|
|
5790
|
+
* There is no `incomplete` arm: this is the first step, so it is never waiting
|
|
5791
|
+
* on one above it.
|
|
4332
5792
|
*/
|
|
4333
|
-
|
|
5793
|
+
type CentrifugeWalletSelectStepInput = {
|
|
5794
|
+
type: 'active';
|
|
5795
|
+
} | {
|
|
5796
|
+
type: 'completed';
|
|
5797
|
+
wallet: EvmWallet;
|
|
5798
|
+
};
|
|
5799
|
+
interface UseCentrifugeWalletSelectViewModelOptions {
|
|
5800
|
+
stepInput: CentrifugeWalletSelectStepInput;
|
|
5801
|
+
/** The host's wallets, and the lambdas that connect and disconnect one. */
|
|
5802
|
+
wallets: CheckoutWalletSelection;
|
|
5803
|
+
/** The chain the order executes on, which names the network on each row. */
|
|
5804
|
+
chain: EthereumChain;
|
|
5805
|
+
/** Called with the wallet the user settled on. */
|
|
5806
|
+
onComplete: (wallet: EvmWallet) => void;
|
|
5807
|
+
/** Called when the user reopens this step from a later one. */
|
|
5808
|
+
onEdit: () => void;
|
|
5809
|
+
}
|
|
5810
|
+
interface UseCentrifugeWalletSelectViewModelResult {
|
|
5811
|
+
state: CentrifugeWalletSelectUiState;
|
|
5812
|
+
onEvent: (event: CentrifugeWalletSelectUiEvent) => void;
|
|
5813
|
+
}
|
|
5814
|
+
/**
|
|
5815
|
+
* Drives step 1 of the Centrifuge checkout: which wallet funds the deposit.
|
|
5816
|
+
*
|
|
5817
|
+
* Nothing here touches the network. A wallet is not allow-listed, so confirming
|
|
5818
|
+
* is a local decision the viewmodel makes on its own - which is why the step's
|
|
5819
|
+
* CTA is a plain `confirmEnabled`.
|
|
5820
|
+
*
|
|
5821
|
+
* Connecting an external wallet is the host's job: `connectExternal` opens
|
|
5822
|
+
* whatever connector it ships, and the result is read from `wallets.external`
|
|
5823
|
+
* on the next render rather than from a return value, so a connector that
|
|
5824
|
+
* redirects works as well as one that opens a modal.
|
|
5825
|
+
*/
|
|
5826
|
+
declare function useCentrifugeWalletSelectViewModel({ stepInput, wallets, chain, onComplete, onEdit, }: UseCentrifugeWalletSelectViewModelOptions): UseCentrifugeWalletSelectViewModelResult;
|
|
4334
5827
|
|
|
4335
5828
|
type LoadParticipationsReason = 'not-authenticated' | 'generic-error';
|
|
4336
5829
|
type LoadParticipationsState = {
|
|
@@ -4471,11 +5964,13 @@ declare function validateAmount({ input, decimals, balance, symbol, minimumPurch
|
|
|
4471
5964
|
}): OndoBuyAmountValidation;
|
|
4472
5965
|
|
|
4473
5966
|
/**
|
|
4474
|
-
* Why an Ondo read failed, in the
|
|
5967
|
+
* Why an Ondo read failed, in the three flavours a UI acts on differently.
|
|
4475
5968
|
*
|
|
4476
5969
|
* `not-authenticated` is split out because no retry helps until the user signs
|
|
4477
|
-
* in, and because the remedy is one the UI can name.
|
|
4478
|
-
*
|
|
5970
|
+
* in, and because the remedy is one the UI can name. `not-tradable` is split
|
|
5971
|
+
* out for the same reason: the market is closed or paused, so the remedy is to
|
|
5972
|
+
* wait for it to open, and a retry before then fails the same way. Everything
|
|
5973
|
+
* else collapses into `generic-error` and is offered a retry.
|
|
4479
5974
|
*
|
|
4480
5975
|
* That is a deliberate over-offer, not a claim that every such failure is
|
|
4481
5976
|
* retryable. A `ValidationError` from the DTO boundary - an unreadable expiry,
|
|
@@ -4486,7 +5981,7 @@ declare function validateAmount({ input, decimals, balance, symbol, minimumPurch
|
|
|
4486
5981
|
* branch in every consumer to distinguish. Split it out if that stops being
|
|
4487
5982
|
* true.
|
|
4488
5983
|
*/
|
|
4489
|
-
type OndoLoadErrorReason = 'not-authenticated' | 'generic-error';
|
|
5984
|
+
type OndoLoadErrorReason = 'not-authenticated' | 'not-tradable' | 'generic-error';
|
|
4490
5985
|
declare function ondoLoadErrorReason(error: unknown): OndoLoadErrorReason;
|
|
4491
5986
|
|
|
4492
5987
|
/**
|
|
@@ -4707,7 +6202,9 @@ interface UseOndoBuyCheckoutViewModelResult {
|
|
|
4707
6202
|
* no Ondo integration contract is known before any step runs, and there is no
|
|
4708
6203
|
* region to report it in that would not first have to render something untrue:
|
|
4709
6204
|
* a wallet picker leading nowhere, a balance read for a token this flow will
|
|
4710
|
-
* never spend.
|
|
6205
|
+
* never spend. A market known to be closed while the user is still choosing a
|
|
6206
|
+
* wallet is the same kind of answer for as long as it lasts. See
|
|
6207
|
+
* {@link OndoCheckoutErrorReason}.
|
|
4711
6208
|
*
|
|
4712
6209
|
* `offer` and `chain` are read as fixed for the lifetime of the hook. The step
|
|
4713
6210
|
* machine holds a committed quote and an approval granted on one chain for one
|
|
@@ -5094,7 +6591,9 @@ interface UseOndoSellCheckoutViewModelResult {
|
|
|
5094
6591
|
* about whether there is a flow rather than about how one went. A chain with
|
|
5095
6592
|
* no Ondo integration contract is known before any step runs, and there is no
|
|
5096
6593
|
* region to report it in that would not first have to render something untrue.
|
|
5097
|
-
*
|
|
6594
|
+
* A market known to be closed while the user is still on the first step is the
|
|
6595
|
+
* same kind of answer for as long as it lasts. See
|
|
6596
|
+
* {@link OndoCheckoutErrorReason}.
|
|
5098
6597
|
*
|
|
5099
6598
|
* `offer` and `chain` are read as fixed for the lifetime of the hook, and so is
|
|
5100
6599
|
* the wallet the flow opened on. The step machine holds a committed quote and
|
|
@@ -5202,6 +6701,12 @@ type LoadOndoTradingStatusState = {
|
|
|
5202
6701
|
type: 'CONTENT';
|
|
5203
6702
|
status: OndoTradingStatus;
|
|
5204
6703
|
};
|
|
6704
|
+
/**
|
|
6705
|
+
* Whether the market is *known* to be closed for this side: the one reading of
|
|
6706
|
+
* the poll a caller may block an order on. `LOADING` and `ERROR` are unknown,
|
|
6707
|
+
* and unknown never blocks.
|
|
6708
|
+
*/
|
|
6709
|
+
declare function isNotTradable(state: LoadOndoTradingStatusState): boolean;
|
|
5205
6710
|
interface UseOndoTradingStatusOptions {
|
|
5206
6711
|
/** Ondo's API symbol, e.g. `AAPLon`. */
|
|
5207
6712
|
symbol: AssetSymbol;
|
|
@@ -5790,6 +7295,118 @@ interface UseSuperstateWalletViewModelResult {
|
|
|
5790
7295
|
*/
|
|
5791
7296
|
declare function useSuperstateWalletViewModel({ stepInput, wallets, offerId, contractAddress, chain, onComplete, onEdit, }: UseSuperstateWalletViewModelOptions): UseSuperstateWalletViewModelResult;
|
|
5792
7297
|
|
|
7298
|
+
/**
|
|
7299
|
+
* Where one claim run stands. `FAILED` keeps the phase it stopped in, so a
|
|
7300
|
+
* progress list can mark the step that broke rather than only say that
|
|
7301
|
+
* something did.
|
|
7302
|
+
*/
|
|
7303
|
+
type CentrifugeClaimState = {
|
|
7304
|
+
type: 'IDLE';
|
|
7305
|
+
} | {
|
|
7306
|
+
type: 'RUNNING';
|
|
7307
|
+
phase: CentrifugeClaimPhase;
|
|
7308
|
+
} | {
|
|
7309
|
+
type: 'FAILED';
|
|
7310
|
+
phase: CentrifugeClaimPhase;
|
|
7311
|
+
error: CentrifugeClaimError;
|
|
7312
|
+
} | {
|
|
7313
|
+
type: 'SUCCEEDED';
|
|
7314
|
+
success: Extract<CentrifugeClaimResult, {
|
|
7315
|
+
type: 'success';
|
|
7316
|
+
}>;
|
|
7317
|
+
};
|
|
7318
|
+
type CentrifugeClaimParams = Omit<ClaimCentrifugeVaultParams, 'centrifuge' | 'onProgress'>;
|
|
7319
|
+
interface UseCentrifugeClaimResult {
|
|
7320
|
+
state: CentrifugeClaimState;
|
|
7321
|
+
/**
|
|
7322
|
+
* Runs a claim and resolves with its result, whatever became of the state:
|
|
7323
|
+
* a claim abandoned with {@link reset} still mines, and the caller may want
|
|
7324
|
+
* to refetch when it does.
|
|
7325
|
+
*/
|
|
7326
|
+
claim: (params: CentrifugeClaimParams) => Promise<CentrifugeClaimResult>;
|
|
7327
|
+
/** Back to `IDLE`. A run still in flight stops updating the state. */
|
|
7328
|
+
reset: () => void;
|
|
7329
|
+
}
|
|
7330
|
+
/**
|
|
7331
|
+
* Claims a filled Centrifuge position through `coinlist.centrifuge.claim`,
|
|
7332
|
+
* tracking which phase it is in.
|
|
7333
|
+
*
|
|
7334
|
+
* Unmounting or resetting does not cancel a claim - nothing can recall a
|
|
7335
|
+
* broadcast transaction - it only stops this state following it.
|
|
7336
|
+
*/
|
|
7337
|
+
declare function useCentrifugeClaim(): UseCentrifugeClaimResult;
|
|
7338
|
+
|
|
7339
|
+
/** A vault on one chain, as the position endpoints key it. */
|
|
7340
|
+
type CentrifugePositionVault = {
|
|
7341
|
+
chain: EthereumChain;
|
|
7342
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
7343
|
+
symbol: AssetSymbol;
|
|
7344
|
+
};
|
|
7345
|
+
/**
|
|
7346
|
+
* The state of the position reads.
|
|
7347
|
+
*
|
|
7348
|
+
* `CONTENT` holds every read that has ever answered, kept through later
|
|
7349
|
+
* failures: a flaky tick must not make a claimable position vanish under the
|
|
7350
|
+
* user. A read that has never answered is absent, not zero. `ERROR` is
|
|
7351
|
+
* reserved for the case where nothing answered at all, so a screen has
|
|
7352
|
+
* nothing to show but a retry.
|
|
7353
|
+
*/
|
|
7354
|
+
type LoadCentrifugeVaultPositionsState = {
|
|
7355
|
+
type: 'LOADING';
|
|
7356
|
+
} | {
|
|
7357
|
+
type: 'ERROR';
|
|
7358
|
+
reason: CentrifugeLoadErrorReason;
|
|
7359
|
+
} | {
|
|
7360
|
+
type: 'CONTENT';
|
|
7361
|
+
legs: CentrifugeVaultLeg[];
|
|
7362
|
+
};
|
|
7363
|
+
interface UseCentrifugeVaultPositionsOptions {
|
|
7364
|
+
/** The vaults to read, one per chain the offer runs on. */
|
|
7365
|
+
vaults: CentrifugePositionVault[];
|
|
7366
|
+
/** The wallets to read them for, in display order. */
|
|
7367
|
+
walletAddresses: EvmWalletAddress[];
|
|
7368
|
+
/**
|
|
7369
|
+
* How often to re-read a position that still has something pending.
|
|
7370
|
+
* Defaults to {@link CENTRIFUGE_POLL_INTERVAL_MS}.
|
|
7371
|
+
*/
|
|
7372
|
+
pollIntervalMs?: number;
|
|
7373
|
+
/**
|
|
7374
|
+
* Reads pre-fetched on the server. When provided, the hook opens on them
|
|
7375
|
+
* and skips the first fetch; polling and {@link UseCentrifugeVaultPositionsResult.refetch}
|
|
7376
|
+
* still fetch.
|
|
7377
|
+
*/
|
|
7378
|
+
data?: CentrifugeVaultLeg[];
|
|
7379
|
+
/**
|
|
7380
|
+
* Default `true`. When `false`: no requests, no timers, and an empty
|
|
7381
|
+
* `CONTENT`.
|
|
7382
|
+
*/
|
|
7383
|
+
enabled?: boolean;
|
|
7384
|
+
}
|
|
7385
|
+
interface UseCentrifugeVaultPositionsResult {
|
|
7386
|
+
state: LoadCentrifugeVaultPositionsState;
|
|
7387
|
+
/**
|
|
7388
|
+
* Reads every position again: the retry after an `ERROR`, and what a claim
|
|
7389
|
+
* calls once it mined so the claimed amount leaves the screen.
|
|
7390
|
+
*/
|
|
7391
|
+
refetch: () => void;
|
|
7392
|
+
}
|
|
7393
|
+
/**
|
|
7394
|
+
* Reads, and keeps reading, every wallet's position on every vault, on both
|
|
7395
|
+
* sides of the trade.
|
|
7396
|
+
*
|
|
7397
|
+
* A fill lands on the fund's schedule with no signal, so polling is the only
|
|
7398
|
+
* way a pending position is seen turning claimable. Each read is fetched once
|
|
7399
|
+
* when the inputs change, when {@link UseCentrifugeVaultPositionsResult.refetch}
|
|
7400
|
+
* is called and when the page becomes visible again. Between those, only the
|
|
7401
|
+
* reads with something still pending are polled - a position with nothing
|
|
7402
|
+
* pending cannot change on its own - and only while the page is visible.
|
|
7403
|
+
*
|
|
7404
|
+
* A read that fails keeps its last answer and is logged; one that has never
|
|
7405
|
+
* answered is left out, and retried on the next full fetch rather than on
|
|
7406
|
+
* the timer.
|
|
7407
|
+
*/
|
|
7408
|
+
declare function useCentrifugeVaultPositions(options: UseCentrifugeVaultPositionsOptions): UseCentrifugeVaultPositionsResult;
|
|
7409
|
+
|
|
5793
7410
|
type LoadOfferDetailsReason = 'not-authenticated' | 'generic-error';
|
|
5794
7411
|
type LoadOfferDetailsState = {
|
|
5795
7412
|
type: 'LOADING';
|
|
@@ -6217,6 +7834,116 @@ interface UseConnectWalletModalViewModelResult {
|
|
|
6217
7834
|
*/
|
|
6218
7835
|
declare function useConnectWalletModalViewModel({ isOpen, onClose, offerId, optionId, wallet, onConnected, onRequestConnect, challengeType, statement, }: UseConnectWalletModalViewModelOptions): UseConnectWalletModalViewModelResult;
|
|
6219
7836
|
|
|
7837
|
+
/**
|
|
7838
|
+
* The state of one vault's status poll.
|
|
7839
|
+
*
|
|
7840
|
+
* Stale-preserving: a failed tick with a status in hand keeps it, so a flaky
|
|
7841
|
+
* read never reads as "vault halted". `ERROR` means the status is unknown -
|
|
7842
|
+
* which is not the same as `CONTENT` carrying a blocked orderability, and
|
|
7843
|
+
* callers must not conflate them. A vault that is *known* to be unorderable
|
|
7844
|
+
* may block a request; one that is merely unknown may not.
|
|
7845
|
+
*
|
|
7846
|
+
* `below_minimum` never appears here: it needs an amount, which this
|
|
7847
|
+
* endpoint is never given.
|
|
7848
|
+
*/
|
|
7849
|
+
type LoadCentrifugeVaultStatusState = {
|
|
7850
|
+
type: 'LOADING';
|
|
7851
|
+
} | {
|
|
7852
|
+
type: 'ERROR';
|
|
7853
|
+
reason: CentrifugeLoadErrorReason;
|
|
7854
|
+
} | {
|
|
7855
|
+
type: 'CONTENT';
|
|
7856
|
+
status: CentrifugeVaultStatus;
|
|
7857
|
+
};
|
|
7858
|
+
/** A vault as the status endpoint keys it: one share token on one chain. */
|
|
7859
|
+
type CentrifugeStatusVault = {
|
|
7860
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
7861
|
+
symbol: AssetSymbol;
|
|
7862
|
+
chain: EthereumChain;
|
|
7863
|
+
};
|
|
7864
|
+
interface UseCentrifugeVaultStatusesOptions {
|
|
7865
|
+
/** The vaults to poll, typically one per chain an offer runs on. */
|
|
7866
|
+
vaults: CentrifugeStatusVault[];
|
|
7867
|
+
/** How often to refresh. Defaults to {@link CENTRIFUGE_POLL_INTERVAL_MS}. */
|
|
7868
|
+
pollIntervalMs?: number;
|
|
7869
|
+
/**
|
|
7870
|
+
* Statuses the caller already holds, typically fetched server-side, each
|
|
7871
|
+
* opening the state of the vault it names so a server-rendered panel needs
|
|
7872
|
+
* no loading pass.
|
|
7873
|
+
*
|
|
7874
|
+
* They seed the first render only: the poll still fetches immediately. A
|
|
7875
|
+
* vault that was orderable a minute ago can be unlinked now, so a seed
|
|
7876
|
+
* that suppressed the first read would be answering "can I act right now"
|
|
7877
|
+
* with whenever the page was rendered.
|
|
7878
|
+
*/
|
|
7879
|
+
data?: CentrifugeVaultStatus[];
|
|
7880
|
+
/** When false, the hook neither fetches nor polls. */
|
|
7881
|
+
enabled: boolean;
|
|
7882
|
+
}
|
|
7883
|
+
interface UseCentrifugeVaultStatusesResult {
|
|
7884
|
+
/** One entry per vault asked for, in the order asked. */
|
|
7885
|
+
statuses: {
|
|
7886
|
+
vault: CentrifugeStatusVault;
|
|
7887
|
+
state: LoadCentrifugeVaultStatusState;
|
|
7888
|
+
}[];
|
|
7889
|
+
}
|
|
7890
|
+
/**
|
|
7891
|
+
* Polls whether each of several Centrifuge vaults can be acted on right now,
|
|
7892
|
+
* independent of any wallet or amount.
|
|
7893
|
+
*
|
|
7894
|
+
* Free to poll - it spends no attestation. Centrifuge announces none of the
|
|
7895
|
+
* changes this reports, so the poll is the only way a screen notices a vault
|
|
7896
|
+
* halting under it. Each vault is read independently on one shared timer, so
|
|
7897
|
+
* one failing chain never holds back another.
|
|
7898
|
+
*
|
|
7899
|
+
* A seeded status opens its vault's state instead of `LOADING` and is
|
|
7900
|
+
* otherwise left to the poll: the first tick fires as it always does, and
|
|
7901
|
+
* only replaces the seed once it has a status of its own.
|
|
7902
|
+
*
|
|
7903
|
+
* Disabled it neither fetches nor holds a timer, and each vault stays on
|
|
7904
|
+
* whatever state it held. That is `LOADING` and not an empty `CONTENT`
|
|
7905
|
+
* because there is no empty vault status - and an invented one would be
|
|
7906
|
+
* worse than none, since `CONTENT` here is what a caller is allowed to block
|
|
7907
|
+
* on.
|
|
7908
|
+
*/
|
|
7909
|
+
declare function useCentrifugeVaultStatuses(options: UseCentrifugeVaultStatusesOptions): UseCentrifugeVaultStatusesResult;
|
|
7910
|
+
|
|
7911
|
+
interface UseCentrifugeVaultStatusOptions {
|
|
7912
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
7913
|
+
symbol: AssetSymbol;
|
|
7914
|
+
chain: EthereumChain;
|
|
7915
|
+
/** How often to refresh. Defaults to `CENTRIFUGE_POLL_INTERVAL_MS`. */
|
|
7916
|
+
pollIntervalMs?: number;
|
|
7917
|
+
/**
|
|
7918
|
+
* A status the caller already holds, typically fetched server-side, used
|
|
7919
|
+
* as the state the hook opens on so a server-rendered panel needs no
|
|
7920
|
+
* loading pass.
|
|
7921
|
+
*
|
|
7922
|
+
* It seeds the first render only: the poll still fetches immediately. A
|
|
7923
|
+
* vault that was orderable a minute ago can be unlinked now, so a seed
|
|
7924
|
+
* that suppressed the first read would be answering "can I invest right
|
|
7925
|
+
* now" with whenever the page was rendered.
|
|
7926
|
+
*/
|
|
7927
|
+
data?: CentrifugeVaultStatus;
|
|
7928
|
+
/** When false, the hook neither fetches nor polls. */
|
|
7929
|
+
enabled: boolean;
|
|
7930
|
+
}
|
|
7931
|
+
interface UseCentrifugeVaultStatusResult {
|
|
7932
|
+
state: LoadCentrifugeVaultStatusState;
|
|
7933
|
+
}
|
|
7934
|
+
/**
|
|
7935
|
+
* Polls whether a Centrifuge vault can take a request at all right now,
|
|
7936
|
+
* independent of any amount.
|
|
7937
|
+
*
|
|
7938
|
+
* Free to poll - it spends no attestation. Centrifuge announces none of the
|
|
7939
|
+
* changes this reports, so the poll is the only way a checkout notices
|
|
7940
|
+
* mid-order.
|
|
7941
|
+
*
|
|
7942
|
+
* The one-vault case of {@link useCentrifugeVaultStatuses}, which carries the
|
|
7943
|
+
* seeding, stale-preserving and disabled semantics.
|
|
7944
|
+
*/
|
|
7945
|
+
declare function useCentrifugeVaultStatus(options: UseCentrifugeVaultStatusOptions): UseCentrifugeVaultStatusResult;
|
|
7946
|
+
|
|
6220
7947
|
interface UseErc20BalanceOptions {
|
|
6221
7948
|
/**
|
|
6222
7949
|
* The token to read, by contract address.
|
|
@@ -6587,4 +8314,15 @@ interface UseCountdownOptions {
|
|
|
6587
8314
|
*/
|
|
6588
8315
|
declare function useCountdown({ until, tickMs, enabled, }: UseCountdownOptions): number | null;
|
|
6589
8316
|
|
|
6590
|
-
export { type AuthState, type AuthorizeWalletParams, ChecklistStatus, CheckoutAssetUi, type CheckoutConfig, type CheckoutConfirmedWalletUi, CheckoutContainer, type CheckoutContainerProps, type CheckoutCtaUi, type CheckoutEmbeddedWalletUi, type CheckoutNetworkUi, type CheckoutSelectableInputAssetUi, type CheckoutStatusUi, type CheckoutWalletSelection, type CheckoutWalletTypeUi, type CheckoutWalletUi, type ClientAuthConfig, type ClientAuthNamespace, ClientAuthNamespaceImpl, type ClientAuthSession, type ClientCoinListTokenSaleNamespace, ClientCoinListTokenSaleNamespaceImpl, type ClientConfig, type ClientOndoNamespace, ClientOndoNamespaceImpl, type ClientRequirementsNamespace, ClientRequirementsNamespaceImpl, type ClientSuperstateSwapNamespace, ClientSuperstateSwapNamespaceImpl, type ClientSupportNamespace, ClientSupportNamespaceImpl, type CoinListClient, CoinListClientInitializationError, CoinListContext, CoinListContextProvider, type CoinListContextValue, CoinListProvider, type CoinListProviderProps, CoinListSignInButton, CoinListSignInCardContainer, type CoinListSignInCardContainerProps, type CoinListSignInCardUiEvent, type CoinListSignInCardUiState, CoinListSignInCardView, type CoinListSignInCardViewProps, CoinListStyleScope, type CoinListStyleScopeProps, type CoinListTokenSaleCheckoutConfig, type CompleteOAuthFailureReason, ConnectWallet, type ConnectWalletError, type ConnectWalletErrorCode, type ConnectWalletFlowError, type ConnectWalletFlowParams, type ConnectWalletFlowResult, ConnectWalletModalContainer, type ConnectWalletModalContainerProps, type ConnectWalletModalUiEvent, type ConnectWalletModalUiState, ConnectWalletModalView, type ConnectWalletModalViewProps, type ConnectWalletPhase, type ConnectWalletScreenUi, type ConnectWalletSignState, type ConnectWalletState, ConnectedWalletList, type ConnectedWalletListProps, type ConnectedWalletUi, ERC20_BALANCE_POLL_INTERVAL_MS, type Erc20AllowanceError, type Erc20AllowancePhase, type Erc20AllowanceResult, type Erc20ApprovalError, EvmWallet, type ExecuteOndoSwapParams, type ExecuteSwapParams, type ExecuteTokenSaleParams, IdentityVerificationContainer, type IdentityVerificationContainerProps, type IdentityVerificationUiEvent, type IdentityVerificationUiState, IdentityVerificationView, type IdentityVerificationViewProps, KycLevelName, type KycTokenErrorReason, type KycTokenState, type LoadOfferDetailsReason, type LoadOfferDetailsState, type LoadOffersReason, type LoadOffersState, type LoadOndoBuyTransactionState, type LoadOndoPriceState, type LoadOndoSellTransactionState, type LoadOndoTradingStatusState, type LoadOptionAddressesReason, type LoadOptionAddressesState, type LoadParticipationsReason, type LoadParticipationsState, type LoadRequirementsReason, type LoadRequirementsState, type LoadTokenMetadataState, type LoadTokenRegistryState, Logger, type LogoImageUi, OAUTH_CODE_VERIFIER_KEY, OAUTH_STATE_KEY, type OauthClientErrorReason, type OauthClientResult, OfferAssetCard, type OfferAssetCardProps, OfferAssetCardUi, OfferLogoUi, OfferSaleCard, type OfferSaleCardProps, OfferSaleCardUi, OffersAssetGrid, type OffersAssetGridProps, OffersGridContainer, type OffersGridContainerProps, type OffersGridData, type OffersGridUiEvent, type OffersGridUiState, OffersGridView, type OffersGridViewProps, type OndoBuyAmountConfirmed, type OndoBuyAmountStepInput, type OndoBuyAmountUiEvent, type OndoBuyAmountUiState, type OndoBuyAmountValidation, OndoBuyAmountView, type OndoBuyAmountViewProps, OndoBuyCheckoutContainer, type OndoBuyCheckoutContainerProps, type OndoBuyCheckoutUiEvent, type OndoBuyCheckoutUiState, OndoBuyCheckoutView, type OndoBuyCheckoutViewProps, type OndoBuyExecutionResult, OndoBuyOrderConfirmed, type OndoBuyOrderPlaced, type OndoBuyOrderTerms, type OndoBuyPreparationResult, type OndoBuyQuoteStatusUi, type OndoBuyReviewStepInput, type OndoBuyReviewUiEvent, type OndoBuyReviewUiState, OndoBuyReviewView, type OndoBuyReviewViewProps, type OndoBuyStep, type OndoCheckoutConfig, OndoCheckoutError, type OndoCheckoutErrorProps, type OndoCheckoutErrorReason, type OndoLoadErrorReason, type OndoOrderConfirmedProps, type OndoOrderConfirmedUiEvent, type OndoOrderConfirmedUiState, type OndoOrderPlaced, type OndoOrderPlacedCore, type OndoSellAmountConfirmed, type OndoSellAmountStepInput, type OndoSellAmountUiEvent, type OndoSellAmountUiState, type OndoSellAmountValidation, OndoSellAmountView, type OndoSellAmountViewProps, type OndoSellAsset, type OndoSellBalanceUi, OndoSellCheckoutContainer, type OndoSellCheckoutContainerProps, type OndoSellCheckoutUiEvent, type OndoSellCheckoutUiState, OndoSellCheckoutView, type OndoSellCheckoutViewProps, type OndoSellExecutionResult, OndoSellOrderConfirmed, type OndoSellOrderConfirmedProps, type OndoSellOrderConfirmedUiEvent, type OndoSellOrderConfirmedUiState, type OndoSellOrderPlaced, type OndoSellOrderTerms, type OndoSellOutcomeUi, type OndoSellPreparationResult, type OndoSellQuoteStatusUi, type OndoSellReviewStepInput, type OndoSellReviewUiEvent, type OndoSellReviewUiState, OndoSellReviewView, type OndoSellReviewViewProps, type OndoSellSourceWalletUi, type OndoSellStep, type OndoSidebarPriceUi, type OndoSidebarUiState, OndoSidebarView, type OndoSidebarViewProps, type OndoSwapExecutionError, type OndoSwapExecutionPhase, type OndoSwapExecutionResult, type OndoSwapPreparationError, type OndoSwapPreparationPhase, type OndoSwapPreparationResult, type OndoWalletSelectStepInput, type OndoWalletSelectUiEvent, type OndoWalletSelectUiState, OndoWalletSelectView, type OndoWalletSelectViewProps, PinoLoggerOptions, type PrepareOndoBuyParams, type PrepareOndoSellParams, type PrepareOndoSwapParamsCore, type RequiredCheckoutConfig, RequirementItem, type RequirementItemProps, RequirementItemUi, RequirementStatus, RequirementVariant, RequirementsChecklistContainer, type RequirementsChecklistContainerProps, type RequirementsChecklistItemUi, type RequirementsChecklistUiEvent, type RequirementsChecklistUiState, RequirementsChecklistView, type RequirementsChecklistViewProps, type RequirementsData, type RequirementsVerificationUi, type SignState, SlippagePicker, type SlippagePickerProps, type SubmitErc20ApprovalResult, type SuperstateAmountConfirmed, type SuperstateAmountStepInput, type SuperstateAmountUiEvent, type SuperstateAmountUiState, type SuperstateAmountValidation, SuperstateAmountView, type SuperstateAmountViewProps, type SuperstateCheckoutConfig, SuperstateOrderConfirmed, type SuperstateOrderConfirmedProps, type SuperstateOrderConfirmedUiEvent, type SuperstateOrderConfirmedUiState, type SuperstateOrderPlaced, type SuperstateReviewStepInput, type SuperstateReviewUiEvent, type SuperstateReviewUiState, SuperstateReviewView, type SuperstateReviewViewProps, type SuperstateSidebarPriceUi, type SuperstateSidebarUiState, SuperstateSidebarView, type SuperstateSidebarViewProps, type SuperstateSlippageOptionUi, type SuperstateSlippageUi, SuperstateSwapCheckoutContainer, type SuperstateSwapCheckoutContainerProps, type SuperstateSwapCheckoutRetryUiEvent, type SuperstateSwapCheckoutUiEvent, type SuperstateSwapCheckoutUiState, SuperstateSwapCheckoutView, type SuperstateSwapCheckoutViewProps, type SuperstateSwapLoadErrorReason, type SuperstateSwapStep, type SuperstateWalletStepInput, type SuperstateWalletUiEvent, type SuperstateWalletUiState, SuperstateWalletView, type SuperstateWalletViewProps, type SwapExecutionError, type SwapExecutionPhase, type SwapExecutionResult, type SwapOutputTokenState, type TaxDocumentAddressParts, type TaxDocumentFieldUi, type TaxDocumentFields, TaxDocumentModalContainer, type TaxDocumentModalContainerProps, type TaxDocumentModalUiEvent, type TaxDocumentModalUiState, TaxDocumentModalView, type TaxDocumentModalViewProps, type TaxDocumentScreenUi, type TaxDocumentState, type TokenSaleExecutionError, type TokenSaleExecutionPhase, type TokenSaleExecutionResult, USDC_ICON_URL, USDT_ICON_URL, type UseCheckoutOfferTokenMetadataOptions, type UseCheckoutOfferTokenMetadataResult, type UseCoinListResult, type UseCoinListSignInCardViewModelOptions, type UseCoinListSignInCardViewModelResult, type UseCompleteOAuthOptions, type UseConnectWalletModalViewModelOptions, type UseConnectWalletModalViewModelResult, type UseConnectWalletOptions, type UseConnectWalletResult, type UseCountdownOptions, type UseErc20BalanceOptions, type UseErc20BalanceResult, type UseErc20TokenBalancesOptions, type UseErc20TokenBalancesResult, type UseIdentityVerificationViewModelOptions, type UseIdentityVerificationViewModelResult, type UseKycTokenResult, type UseOfferDetailsOptions, type UseOfferDetailsResult, type UseOffersGridViewModelOptions, type UseOffersGridViewModelResult, type UseOffersOptions, type UseOffersResult, type UseOndoBuyAmountViewModelOptions, type UseOndoBuyAmountViewModelResult, type UseOndoBuyCheckoutViewModelOptions, type UseOndoBuyCheckoutViewModelResult, type UseOndoBuyReviewViewModelOptions, type UseOndoBuyReviewViewModelResult, type UseOndoBuyTransactionOptions, type UseOndoBuyTransactionResult, type UseOndoPriceOptions, type UseOndoPriceResult, type UseOndoSellAmountViewModelOptions, type UseOndoSellAmountViewModelResult, type UseOndoSellCheckoutViewModelOptions, type UseOndoSellCheckoutViewModelResult, type UseOndoSellReviewViewModelOptions, type UseOndoSellReviewViewModelResult, type UseOndoSellTransactionOptions, type UseOndoSellTransactionResult, type UseOndoSidebarViewModelOptions, type UseOndoSidebarViewModelResult, type UseOndoTradingStatusOptions, type UseOndoTradingStatusResult, type UseOndoWalletSelectViewModelOptions, type UseOndoWalletSelectViewModelResult, type UseOptionAddressesOptions, type UseOptionAddressesResult, type UseParticipationsOptions, type UseParticipationsResult, type UseRequirementsChecklistViewModelOptions, type UseRequirementsChecklistViewModelResult, type UseRequirementsOptions, type UseRequirementsResult, type UseSuperstateAmountViewModelOptions, type UseSuperstateAmountViewModelResult, type UseSuperstateReviewViewModelOptions, type UseSuperstateReviewViewModelResult, type UseSuperstateSidebarViewModelOptions, type UseSuperstateSidebarViewModelResult, type UseSuperstateSwapCheckoutViewModelOptions, type UseSuperstateSwapCheckoutViewModelResult, type UseSuperstateWalletViewModelOptions, type UseSuperstateWalletViewModelResult, type UseSwapOutputTokenOptions, type UseSwapOutputTokenResult, type UseSwapQuoteOptions, type UseSwapQuoteResult, type UseTaxDocumentModalViewModelOptions, type UseTaxDocumentModalViewModelResult, type UseTaxDocumentOptions, type UseTaxDocumentResult, type UseTokenMetadataOptions, type UseTokenMetadataResult, type UseTokenRegistryOptions, type UseTokenRegistryResult, VerificationOverlay, type VerificationOverlayProps, type WalletAuthorizationError, type WalletAuthorizationPhase, type WalletAuthorizationResult, WalletError, type WalletsStatus, authorizeWallet, classifyWalletError, connectExternalWalletFlow, createCoinListClient, defaultCheckoutConfig, ensureErc20Allowance, executeOndoSwap, executeSwap, executeTokenSale, formatCountdown, formatMonthYear, formatSaleCardCountdown, offerAssetIconUrl, offerIconUrl, offerTokenIdentifier, ondoLoadErrorReason, pinoClientLogger, prepareOndoBuy, prepareOndoSell, quoteIsStale, quoteOverAsks, stablecoinIconUrl, submitErc20Approval, tokenLogoSrcSet, tokenLogoUrl, tokenMetadataOf, useCheckoutOfferTokenMetadata, useCoinList, useCoinListSignInCardViewModel, useCompleteOAuth, useConnectWallet, useConnectWalletModalViewModel, useCountdown, useErc20Balance, useErc20TokenBalances, useIdentityVerificationViewModel, useKycToken, useOfferDetails, useOffers, useOffersGridViewModel, useOndoBuyAmountViewModel, useOndoBuyCheckoutViewModel, useOndoBuyReviewViewModel, useOndoBuyTransaction, useOndoPrice, useOndoSellAmountViewModel, useOndoSellCheckoutViewModel, useOndoSellReviewViewModel, useOndoSellTransaction, useOndoSidebarViewModel, useOndoTradingStatus, useOndoWalletSelectViewModel, useOptionAddresses, useParticipations, useRequirements, useRequirementsChecklistViewModel, useSuperstateAmountViewModel, useSuperstateReviewViewModel, useSuperstateSidebarViewModel, useSuperstateSwapCheckoutViewModel, useSuperstateWalletViewModel, useSwapOutputToken, useSwapQuote, useTaxDocument, useTaxDocumentModalViewModel, useTokenMetadata, useTokenRegistry, validateAmount, validateSellAmount, validateSuperstateAmount };
|
|
8317
|
+
/**
|
|
8318
|
+
* Whether the page is visible right now: `false` while the tab is in the
|
|
8319
|
+
* background or the window is minimised, per the Page Visibility API.
|
|
8320
|
+
*
|
|
8321
|
+
* For a poll that should stop costing requests nobody is looking at. Reports
|
|
8322
|
+
* `true` during a server render and hydration, so a component renders as it
|
|
8323
|
+
* would on screen and hydrates without a mismatch, then the real visibility
|
|
8324
|
+
* straight after.
|
|
8325
|
+
*/
|
|
8326
|
+
declare function usePageVisible(): boolean;
|
|
8327
|
+
|
|
8328
|
+
export { type AuthState, type AuthorizeWalletParams, type BuyCentrifugeParams, CENTRIFUGE_VAULT_ORDER_REASON_MESSAGES, type CentrifugeBuyAmountConfirmed, type CentrifugeBuyAmountStepInput, type CentrifugeBuyAmountUiEvent, type CentrifugeBuyAmountUiState, type CentrifugeBuyAmountValidation, CentrifugeBuyAmountView, type CentrifugeBuyAmountViewProps, CentrifugeBuyCheckoutContainer, type CentrifugeBuyCheckoutContainerProps, type CentrifugeBuyCheckoutUiEvent, type CentrifugeBuyCheckoutUiState, CentrifugeBuyCheckoutView, type CentrifugeBuyCheckoutViewProps, type CentrifugeBuyError, CentrifugeBuyOrderPlaced, type CentrifugeBuyOrderPlacedProps, type CentrifugeBuyPhase, type CentrifugeBuyPlacementError, type CentrifugeBuyPlacementPhase, type CentrifugeBuyPlacementResult, type CentrifugeBuyPreparationError, type CentrifugeBuyPreparationPhase, type CentrifugeBuyPreparationResult, type CentrifugeBuyResult, type CentrifugeBuyReviewStepInput, type CentrifugeBuyReviewUiEvent, type CentrifugeBuyReviewUiState, CentrifugeBuyReviewView, type CentrifugeBuyReviewViewProps, type CentrifugeBuyStep, CentrifugeCheckoutError, type CentrifugeCheckoutErrorProps, CentrifugeCheckoutErrorReason, type CentrifugeClaimActionUi, type CentrifugeClaimBlockedReasonUi, type CentrifugeClaimDialogUi, type CentrifugeClaimError, type CentrifugeClaimFailureUi, type CentrifugeClaimParams, type CentrifugeClaimPhase, type CentrifugeClaimProgressUi, type CentrifugeClaimResult, type CentrifugeClaimRowUi, type CentrifugeClaimState, type CentrifugeClaimStepUi, type CentrifugeLoadErrorReason, type CentrifugeOrderPlaced, type CentrifugeOrderPlacedUiEvent, type CentrifugeOrderPlacedUiState, type CentrifugePositionVault, type CentrifugeSidebarMinimumUi, type CentrifugeSidebarUiState, CentrifugeSidebarView, type CentrifugeSidebarViewProps, type CentrifugeStatusVault, type CentrifugeVaultCheckoutConfig, type CentrifugeVaultClaimConfig, CentrifugeVaultClaimContainer, type CentrifugeVaultClaimContainerProps, CentrifugeVaultClaimDialog, type CentrifugeVaultClaimDialogProps, CentrifugeVaultClaimRow, type CentrifugeVaultClaimRowProps, type CentrifugeVaultClaimUiEvent, type CentrifugeVaultClaimUiState, CentrifugeVaultClaimView, type CentrifugeVaultClaimViewProps, type CentrifugeVaultClaimed, type CentrifugeWalletSelectStepInput, type CentrifugeWalletSelectUiEvent, type CentrifugeWalletSelectUiState, CentrifugeWalletSelectView, type CentrifugeWalletSelectViewProps, ChecklistStatus, CheckoutAssetUi, type CheckoutConfig, type CheckoutConfirmedWalletUi, CheckoutContainer, type CheckoutContainerProps, type CheckoutCtaUi, type CheckoutEmbeddedWalletUi, type CheckoutNetworkUi, type CheckoutSelectableInputAssetUi, type CheckoutStatusUi, type CheckoutWalletSelection, type CheckoutWalletTypeUi, type CheckoutWalletUi, type ClaimCentrifugeVaultParams, type ClaimConfig, ClaimContainer, type ClaimContainerProps, type ClaimExternalWalletUi, type ClientAuthConfig, type ClientAuthNamespace, ClientAuthNamespaceImpl, type ClientAuthSession, type ClientCentrifugeNamespace, ClientCentrifugeNamespaceImpl, type ClientCoinListTokenSaleNamespace, ClientCoinListTokenSaleNamespaceImpl, type ClientConfig, type ClientOndoNamespace, ClientOndoNamespaceImpl, type ClientRequirementsNamespace, ClientRequirementsNamespaceImpl, type ClientSuperstateSwapNamespace, ClientSuperstateSwapNamespaceImpl, type ClientSupportNamespace, ClientSupportNamespaceImpl, type CoinListClient, CoinListClientInitializationError, CoinListContext, CoinListContextProvider, type CoinListContextValue, CoinListProvider, type CoinListProviderProps, CoinListSignInButton, CoinListSignInCardContainer, type CoinListSignInCardContainerProps, type CoinListSignInCardUiEvent, type CoinListSignInCardUiState, CoinListSignInCardView, type CoinListSignInCardViewProps, CoinListStyleScope, type CoinListStyleScopeProps, type CoinListTokenSaleCheckoutConfig, type CompleteOAuthFailureReason, ConnectWallet, type ConnectWalletError, type ConnectWalletErrorCode, type ConnectWalletFlowError, type ConnectWalletFlowParams, type ConnectWalletFlowResult, ConnectWalletModalContainer, type ConnectWalletModalContainerProps, type ConnectWalletModalUiEvent, type ConnectWalletModalUiState, ConnectWalletModalView, type ConnectWalletModalViewProps, type ConnectWalletPhase, type ConnectWalletScreenUi, type ConnectWalletSignState, type ConnectWalletState, ConnectedWalletList, type ConnectedWalletListProps, type ConnectedWalletUi, ERC20_BALANCE_POLL_INTERVAL_MS, type Erc20AllowanceError, type Erc20AllowancePhase, type Erc20AllowanceResult, type Erc20ApprovalError, EvmWallet, type ExecuteOndoSwapParams, type ExecuteSwapParams, type ExecuteTokenSaleParams, type ExternalWalletRequestUi, IdentityVerificationContainer, type IdentityVerificationContainerProps, type IdentityVerificationUiEvent, type IdentityVerificationUiState, IdentityVerificationView, type IdentityVerificationViewProps, KycLevelName, type KycTokenErrorReason, type KycTokenState, type LoadCentrifugeBuyTransactionState, type LoadCentrifugeQuoteState, type LoadCentrifugeVaultPositionsState, type LoadCentrifugeVaultStatusState, type LoadOfferDetailsReason, type LoadOfferDetailsState, type LoadOffersReason, type LoadOffersState, type LoadOndoBuyTransactionState, type LoadOndoPriceState, type LoadOndoSellTransactionState, type LoadOndoTradingStatusState, type LoadOptionAddressesReason, type LoadOptionAddressesState, type LoadParticipationsReason, type LoadParticipationsState, type LoadRequirementsReason, type LoadRequirementsState, type LoadTokenMetadataState, type LoadTokenRegistryState, Logger, type LogoImageUi, OAUTH_CODE_VERIFIER_KEY, OAUTH_STATE_KEY, type OauthClientErrorReason, type OauthClientResult, OfferAssetCard, type OfferAssetCardProps, OfferAssetCardUi, OfferLogoUi, OfferSaleCard, type OfferSaleCardProps, OfferSaleCardUi, OffersAssetGrid, type OffersAssetGridProps, OffersGridContainer, type OffersGridContainerProps, type OffersGridData, type OffersGridUiEvent, type OffersGridUiState, OffersGridView, type OffersGridViewProps, type OndoBuyAmountConfirmed, type OndoBuyAmountStepInput, type OndoBuyAmountUiEvent, type OndoBuyAmountUiState, type OndoBuyAmountValidation, OndoBuyAmountView, type OndoBuyAmountViewProps, OndoBuyCheckoutContainer, type OndoBuyCheckoutContainerProps, type OndoBuyCheckoutUiEvent, type OndoBuyCheckoutUiState, OndoBuyCheckoutView, type OndoBuyCheckoutViewProps, type OndoBuyExecutionResult, OndoBuyOrderConfirmed, type OndoBuyOrderPlaced, type OndoBuyOrderTerms, type OndoBuyPreparationResult, type OndoBuyQuoteStatusUi, type OndoBuyReviewStepInput, type OndoBuyReviewUiEvent, type OndoBuyReviewUiState, OndoBuyReviewView, type OndoBuyReviewViewProps, type OndoBuyStep, type OndoCheckoutConfig, OndoCheckoutError, type OndoCheckoutErrorProps, OndoCheckoutErrorReason, type OndoLoadErrorReason, type OndoOrderConfirmedProps, type OndoOrderConfirmedUiEvent, type OndoOrderConfirmedUiState, type OndoOrderPlaced, type OndoOrderPlacedCore, type OndoSellAmountConfirmed, type OndoSellAmountStepInput, type OndoSellAmountUiEvent, type OndoSellAmountUiState, type OndoSellAmountValidation, OndoSellAmountView, type OndoSellAmountViewProps, type OndoSellAsset, type OndoSellBalanceUi, OndoSellCheckoutContainer, type OndoSellCheckoutContainerProps, type OndoSellCheckoutUiEvent, type OndoSellCheckoutUiState, OndoSellCheckoutView, type OndoSellCheckoutViewProps, type OndoSellExecutionResult, OndoSellOrderConfirmed, type OndoSellOrderConfirmedProps, type OndoSellOrderConfirmedUiEvent, type OndoSellOrderConfirmedUiState, type OndoSellOrderPlaced, type OndoSellOrderTerms, type OndoSellOutcomeUi, type OndoSellPreparationResult, type OndoSellQuoteStatusUi, type OndoSellReviewStepInput, type OndoSellReviewUiEvent, type OndoSellReviewUiState, OndoSellReviewView, type OndoSellReviewViewProps, type OndoSellSourceWalletUi, type OndoSellStep, type OndoSidebarPriceUi, type OndoSidebarUiState, OndoSidebarView, type OndoSidebarViewProps, type OndoSwapExecutionError, type OndoSwapExecutionPhase, type OndoSwapExecutionResult, type OndoSwapPreparationError, type OndoSwapPreparationPhase, type OndoSwapPreparationResult, type OndoWalletSelectStepInput, type OndoWalletSelectUiEvent, type OndoWalletSelectUiState, OndoWalletSelectView, type OndoWalletSelectViewProps, PinoLoggerOptions, type PlaceCentrifugeRequestParams, type PrepareCentrifugeBuyParams, type PrepareOndoBuyParams, type PrepareOndoSellParams, type PrepareOndoSwapParamsCore, type RequiredCheckoutConfig, RequirementItem, type RequirementItemProps, RequirementItemUi, RequirementStatus, RequirementVariant, RequirementsChecklistContainer, type RequirementsChecklistContainerProps, type RequirementsChecklistItemUi, type RequirementsChecklistUiEvent, type RequirementsChecklistUiState, RequirementsChecklistView, type RequirementsChecklistViewProps, type RequirementsData, type RequirementsVerificationUi, SETTLES_LATER, type SignState, SlippagePicker, type SlippagePickerProps, type SubmitErc20ApprovalResult, type SuperstateAmountConfirmed, type SuperstateAmountStepInput, type SuperstateAmountUiEvent, type SuperstateAmountUiState, type SuperstateAmountValidation, SuperstateAmountView, type SuperstateAmountViewProps, type SuperstateCheckoutConfig, SuperstateOrderConfirmed, type SuperstateOrderConfirmedProps, type SuperstateOrderConfirmedUiEvent, type SuperstateOrderConfirmedUiState, type SuperstateOrderPlaced, type SuperstateReviewStepInput, type SuperstateReviewUiEvent, type SuperstateReviewUiState, SuperstateReviewView, type SuperstateReviewViewProps, type SuperstateSidebarPriceUi, type SuperstateSidebarUiState, SuperstateSidebarView, type SuperstateSidebarViewProps, type SuperstateSlippageOptionUi, type SuperstateSlippageUi, SuperstateSwapCheckoutContainer, type SuperstateSwapCheckoutContainerProps, type SuperstateSwapCheckoutRetryUiEvent, type SuperstateSwapCheckoutUiEvent, type SuperstateSwapCheckoutUiState, SuperstateSwapCheckoutView, type SuperstateSwapCheckoutViewProps, type SuperstateSwapLoadErrorReason, type SuperstateSwapStep, type SuperstateWalletStepInput, type SuperstateWalletUiEvent, type SuperstateWalletUiState, SuperstateWalletView, type SuperstateWalletViewProps, type SwapExecutionError, type SwapExecutionPhase, type SwapExecutionResult, type SwapOutputTokenState, type TaxDocumentAddressParts, type TaxDocumentFieldUi, type TaxDocumentFields, TaxDocumentModalContainer, type TaxDocumentModalContainerProps, type TaxDocumentModalUiEvent, type TaxDocumentModalUiState, TaxDocumentModalView, type TaxDocumentModalViewProps, type TaxDocumentScreenUi, type TaxDocumentState, type TokenSaleExecutionError, type TokenSaleExecutionPhase, type TokenSaleExecutionResult, USDC_ICON_URL, USDT_ICON_URL, type UseCentrifugeBuyAmountViewModelOptions, type UseCentrifugeBuyAmountViewModelResult, type UseCentrifugeBuyCheckoutViewModelOptions, type UseCentrifugeBuyCheckoutViewModelResult, type UseCentrifugeBuyReviewViewModelOptions, type UseCentrifugeBuyReviewViewModelResult, type UseCentrifugeBuyTransactionOptions, type UseCentrifugeBuyTransactionResult, type UseCentrifugeClaimResult, type UseCentrifugeQuoteOptions, type UseCentrifugeQuoteResult, type UseCentrifugeSidebarViewModelOptions, type UseCentrifugeSidebarViewModelResult, type UseCentrifugeVaultClaimViewModelOptions, type UseCentrifugeVaultClaimViewModelResult, type UseCentrifugeVaultPositionsOptions, type UseCentrifugeVaultPositionsResult, type UseCentrifugeVaultStatusOptions, type UseCentrifugeVaultStatusResult, type UseCentrifugeVaultStatusesOptions, type UseCentrifugeVaultStatusesResult, type UseCentrifugeWalletSelectViewModelOptions, type UseCentrifugeWalletSelectViewModelResult, type UseCheckoutOfferTokenMetadataOptions, type UseCheckoutOfferTokenMetadataResult, type UseCoinListResult, type UseCoinListSignInCardViewModelOptions, type UseCoinListSignInCardViewModelResult, type UseCompleteOAuthOptions, type UseConnectWalletModalViewModelOptions, type UseConnectWalletModalViewModelResult, type UseConnectWalletOptions, type UseConnectWalletResult, type UseCountdownOptions, type UseErc20BalanceOptions, type UseErc20BalanceResult, type UseErc20TokenBalancesOptions, type UseErc20TokenBalancesResult, type UseIdentityVerificationViewModelOptions, type UseIdentityVerificationViewModelResult, type UseKycTokenResult, type UseOfferDetailsOptions, type UseOfferDetailsResult, type UseOffersGridViewModelOptions, type UseOffersGridViewModelResult, type UseOffersOptions, type UseOffersResult, type UseOndoBuyAmountViewModelOptions, type UseOndoBuyAmountViewModelResult, type UseOndoBuyCheckoutViewModelOptions, type UseOndoBuyCheckoutViewModelResult, type UseOndoBuyReviewViewModelOptions, type UseOndoBuyReviewViewModelResult, type UseOndoBuyTransactionOptions, type UseOndoBuyTransactionResult, type UseOndoPriceOptions, type UseOndoPriceResult, type UseOndoSellAmountViewModelOptions, type UseOndoSellAmountViewModelResult, type UseOndoSellCheckoutViewModelOptions, type UseOndoSellCheckoutViewModelResult, type UseOndoSellReviewViewModelOptions, type UseOndoSellReviewViewModelResult, type UseOndoSellTransactionOptions, type UseOndoSellTransactionResult, type UseOndoSidebarViewModelOptions, type UseOndoSidebarViewModelResult, type UseOndoTradingStatusOptions, type UseOndoTradingStatusResult, type UseOndoWalletSelectViewModelOptions, type UseOndoWalletSelectViewModelResult, type UseOptionAddressesOptions, type UseOptionAddressesResult, type UseParticipationsOptions, type UseParticipationsResult, type UseRequirementsChecklistViewModelOptions, type UseRequirementsChecklistViewModelResult, type UseRequirementsOptions, type UseRequirementsResult, type UseSuperstateAmountViewModelOptions, type UseSuperstateAmountViewModelResult, type UseSuperstateReviewViewModelOptions, type UseSuperstateReviewViewModelResult, type UseSuperstateSidebarViewModelOptions, type UseSuperstateSidebarViewModelResult, type UseSuperstateSwapCheckoutViewModelOptions, type UseSuperstateSwapCheckoutViewModelResult, type UseSuperstateWalletViewModelOptions, type UseSuperstateWalletViewModelResult, type UseSwapOutputTokenOptions, type UseSwapOutputTokenResult, type UseSwapQuoteOptions, type UseSwapQuoteResult, type UseTaxDocumentModalViewModelOptions, type UseTaxDocumentModalViewModelResult, type UseTaxDocumentOptions, type UseTaxDocumentResult, type UseTokenMetadataOptions, type UseTokenMetadataResult, type UseTokenRegistryOptions, type UseTokenRegistryResult, VerificationOverlay, type VerificationOverlayProps, type WalletAuthorizationError, type WalletAuthorizationPhase, type WalletAuthorizationResult, WalletError, WalletLabelResolver, WalletSelection, type WalletsStatus, authorizeWallet, buyCentrifuge, centrifugeLoadErrorReason, centrifugeVaultOrderReasonMessage, centrifugeVaultOrderingMessage, claimCentrifugeVault, classifyWalletError, connectExternalWalletFlow, createCoinListClient, defaultCheckoutConfig, ensureErc20Allowance, executeOndoSwap, executeSwap, executeTokenSale, formatCountdown, formatMonthYear, formatSaleCardCountdown, isNotTradable, offerAssetIconUrl, offerIconUrl, offerTokenIdentifier, ondoLoadErrorReason, pinoClientLogger, placeCentrifugeRequest, prepareCentrifugeBuy, prepareOndoBuy, prepareOndoSell, primaryCentrifugeVaultOrderReason, quoteIsStale, quoteOverAsks, stablecoinIconUrl, submitErc20Approval, toInputAssetUi, tokenLogoSrcSet, tokenLogoUrl, tokenMetadataOf, useCentrifugeBuyAmountViewModel, useCentrifugeBuyCheckoutViewModel, useCentrifugeBuyReviewViewModel, useCentrifugeBuyTransaction, useCentrifugeClaim, useCentrifugeQuote, useCentrifugeSidebarViewModel, useCentrifugeVaultClaimViewModel, useCentrifugeVaultPositions, useCentrifugeVaultStatus, useCentrifugeVaultStatuses, useCentrifugeWalletSelectViewModel, useCheckoutOfferTokenMetadata, useCoinList, useCoinListSignInCardViewModel, useCompleteOAuth, useConnectWallet, useConnectWalletModalViewModel, useCountdown, useErc20Balance, useErc20TokenBalances, useIdentityVerificationViewModel, useKycToken, useOfferDetails, useOffers, useOffersGridViewModel, useOndoBuyAmountViewModel, useOndoBuyCheckoutViewModel, useOndoBuyReviewViewModel, useOndoBuyTransaction, useOndoPrice, useOndoSellAmountViewModel, useOndoSellCheckoutViewModel, useOndoSellReviewViewModel, useOndoSellTransaction, useOndoSidebarViewModel, useOndoTradingStatus, useOndoWalletSelectViewModel, useOptionAddresses, usePageVisible, useParticipations, useRequirements, useRequirementsChecklistViewModel, useSuperstateAmountViewModel, useSuperstateReviewViewModel, useSuperstateSidebarViewModel, useSuperstateSwapCheckoutViewModel, useSuperstateWalletViewModel, useSwapOutputToken, useSwapQuote, useTaxDocument, useTaxDocumentModalViewModel, useTokenMetadata, useTokenRegistry, validateAmount, validateCentrifugeBuyAmount, validateSellAmount, validateSuperstateAmount };
|