@coinlist-co/react 0.12.2-rc.e1f6c82 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -43
- package/dist/{chunk-GIE4UWB3.js → chunk-2FZAXGVH.js} +384 -618
- package/dist/chunk-2FZAXGVH.js.map +1 -0
- package/dist/{chunk-PIOQA6HW.js → chunk-EAPBF7T2.js} +88 -109
- package/dist/chunk-EAPBF7T2.js.map +1 -0
- package/dist/{chunk-MJ6YXZWH.js → chunk-IWQ6A52U.js} +4 -2
- package/dist/chunk-IWQ6A52U.js.map +1 -0
- package/dist/{chunk-EKLUJZ7T.js → chunk-OQ2ANYUF.js} +328 -21
- package/dist/chunk-OQ2ANYUF.js.map +1 -0
- package/dist/client/index.d.ts +1634 -1268
- package/dist/client/index.js +10261 -10050
- package/dist/client/index.js.map +1 -1
- package/dist/client-credentials-BwcmPcn-.d.ts +13 -0
- package/dist/server/index.d.ts +58 -106
- package/dist/server/index.js +208 -170
- package/dist/server/index.js.map +1 -1
- package/dist/{time-Bbqlt2x7.d.ts → time-ChSGmKZe.d.ts} +114 -66
- package/dist/{token-registry-snapshot-DttZXGvY.d.ts → token-registry-snapshot-DMubXr2c.d.ts} +19 -21
- package/dist/universal/index.d.ts +86 -73
- package/dist/universal/index.js +12 -8
- package/package.json +1 -1
- package/dist/chunk-EKLUJZ7T.js.map +0 -1
- package/dist/chunk-GIE4UWB3.js.map +0 -1
- package/dist/chunk-MJ6YXZWH.js.map +0 -1
- package/dist/chunk-PIOQA6HW.js.map +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, MouseEventHandler } from 'react';
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as AuthorizationGrant, W as WalletError, E as EthereumChain, a as AssetSymbol, O as OfferVaultContract, b as EvmContractAddress, B as BlockchainAmount, C as CentrifugeVaultBuyTransaction, c as CentrifugeClaimDirection, d as CentrifugeNamespace, e as CoinListTokenSaleOfferDetail, f as OfferOptionId, S as StablecoinSymbol, P as Participation, g as CoinListTokenSaleNamespace, h as OfferSwapContract, i as OndoBuyTransaction, j as OndoSellTransaction, k as OndoNamespace, l as OndoSwapTransactionCore, m as OrderBookSide, n as OfferId, o as SwapQuote, p as Bps, q as EvmWalletAddress, r as SuperstateSwapNamespace, R as RequirementsNamespace, s as Requirement, t as WalletChallengeType, u as OfferOptionAddress, v as WalletsNamespace, w as Config, x as OAuthAccessToken, y as OffersNamespace, z as Erc20Namespace, T as TokensNamespace, D as Offer, F as TokenMetadata, G as OfferDetail, H as Erc20Asset, I as CentrifugeVaultLegId, J as CentrifugeVaultOfferDetail, K as Seconds, L as AsyncOfferDetail, M as RequirementStatusInfo, N as KycLevelName, Q as RequirementType, U as RequirementStatusValue, V as RequirementId, X as PinoLoggerOptions, Y as Logger, Z as AuthorizationCode, _ as CodeVerifier, $ as CentrifugeVaultStatus, a0 as CentrifugeVaultRef, a1 as BuildOndoBuyParams, a2 as OndoSwapOfferDetail, a3 as BuildOndoSellParams, a4 as OndoQuote, a5 as OndoQuoteSize, a6 as OndoTradingStatus, a7 as AssetDecimals, a8 as SuperstateSwapOfferDetail, a9 as CentrifugeVaultLeg, aa as CentrifugeVault, ab as ParticipationId, ac as ParticipationStatus, ad as EpochMillis, ae as OfferOptionAddressId, af as DocumentSubmission, ag as TokenIdentifier } from '../time-ChSGmKZe.js';
|
|
4
4
|
import { Hash } from 'viem';
|
|
5
|
-
import { E as EvmWallet, C as ConnectWallet, F as FormattedAmountAssetUi, T as TxExplorerUrl, A as AssetIconUrl,
|
|
5
|
+
import { E as EvmWallet, C as ConnectWallet, W as WalletSelection, F as FormattedAmountAssetUi, T as TxExplorerUrl, A as AssetIconUrl, a as WalletLabelResolver, S as ShortenedWalletAddress, b as FormattedPercentUi, N as NonEmptyArray, c as TokenRegistrySnapshot } from '../token-registry-snapshot-DMubXr2c.js';
|
|
6
6
|
|
|
7
7
|
type AuthState = 'unknown' | 'logged-in' | 'logged-out';
|
|
8
8
|
/** Discriminated error reasons from {@link CoinListClient.completeOAuth}. */
|
|
9
9
|
type OAuthClientErrorReason = 'user_canceled' | 'missing_state' | 'invalid_state' | 'missing_code' | 'missing_code_verifier';
|
|
10
|
-
type OAuthClientResult = {
|
|
10
|
+
type OAuthClientResult = ({
|
|
11
11
|
type: 'ok';
|
|
12
|
-
|
|
13
|
-
codeVerifier: CodeVerifier;
|
|
14
|
-
} | {
|
|
12
|
+
} & AuthorizationGrant) | {
|
|
15
13
|
type: 'error';
|
|
16
14
|
reason: OAuthClientErrorReason;
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* Everything the browser half of the SDK knows about the current user's
|
|
21
|
-
* session, and the OAuth 2.0 + PKCE flow that establishes one.
|
|
19
|
+
* session, and the OAuth 2.0 + PKCE flow that establishes one - e.g.
|
|
20
|
+
* `coinlist.auth.getState()` or `coinlist.auth.startOAuth()`.
|
|
22
21
|
*
|
|
23
22
|
* The SDK never holds a client secret in the browser: {@link startOAuth}
|
|
24
23
|
* redirects the user to CoinList, and {@link completeOAuth} only parses and
|
|
@@ -73,7 +72,7 @@ interface ClientAuthNamespace {
|
|
|
73
72
|
logout(): void;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
type Erc20AllowancePhase = 'checking-allowance' |
|
|
75
|
+
type Erc20AllowancePhase = 'checking-allowance' | ResetThenApprovePhase;
|
|
77
76
|
type Erc20AllowanceError = {
|
|
78
77
|
step: 'allowance-check';
|
|
79
78
|
} | Erc20ApprovalError;
|
|
@@ -84,24 +83,32 @@ type Erc20ApprovalError = {
|
|
|
84
83
|
} | {
|
|
85
84
|
step: 'approval-reverted';
|
|
86
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* The phases {@link resetThenApprove} reports, in order. The two reset phases
|
|
88
|
+
* occur only when there is a non-zero allowance to reset.
|
|
89
|
+
*/
|
|
90
|
+
type ResetThenApprovePhase = 'resetting-allowance' | 'confirming-allowance-reset' | 'approving' | 'confirming-approval';
|
|
87
91
|
|
|
88
92
|
/**
|
|
89
|
-
* Progress phases emitted while a
|
|
90
|
-
* allowance that already covers the
|
|
91
|
-
*
|
|
92
|
-
* @alpha
|
|
93
|
+
* Progress phases emitted while a backend-built order is being prepared, in
|
|
94
|
+
* the order they occur. An allowance that already covers the order skips the
|
|
95
|
+
* approval phases.
|
|
93
96
|
*/
|
|
94
|
-
type
|
|
97
|
+
type ApproveThenBuildPhase = Erc20AllowancePhase | 'building-transaction';
|
|
95
98
|
/**
|
|
96
99
|
* A step-tagged reason a preparation failed.
|
|
97
100
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
+
* Every arm names a *remedy* rather than a provider or a trade: an unsupported
|
|
102
|
+
* chain, a refused approval and a build that would not complete are fixed the
|
|
103
|
+
* same way whichever token was being approved, and whoever built it.
|
|
101
104
|
*
|
|
102
|
-
*
|
|
105
|
+
* `insufficient-allowance` is separated from the generic build failure because
|
|
106
|
+
* it is the one with a remedy: the backend reads the allowance itself before
|
|
107
|
+
* building, so reaching it means the approval this flow just mined is not the
|
|
108
|
+
* one the backend sees. That is usually its RPC node lagging a block behind,
|
|
109
|
+
* which retrying fixes - so it is a retry, not a re-approval.
|
|
103
110
|
*/
|
|
104
|
-
type
|
|
111
|
+
type ApproveThenBuildError = {
|
|
105
112
|
step: 'unsupported-chain';
|
|
106
113
|
chain: EthereumChain;
|
|
107
114
|
} | Erc20AllowanceError | {
|
|
@@ -109,14 +116,34 @@ type CentrifugeBuyPreparationError = {
|
|
|
109
116
|
} | {
|
|
110
117
|
step: 'build-transaction';
|
|
111
118
|
};
|
|
112
|
-
/**
|
|
113
|
-
|
|
119
|
+
/**
|
|
120
|
+
* A prepared order of whichever kind was asked for, or the step that stopped
|
|
121
|
+
* it. Generic in the transaction, so a caller gets back the type its `build`
|
|
122
|
+
* returned.
|
|
123
|
+
*/
|
|
124
|
+
type ApproveThenBuildResult<T> = {
|
|
114
125
|
type: 'success';
|
|
115
|
-
transaction:
|
|
126
|
+
transaction: T;
|
|
116
127
|
} | {
|
|
117
128
|
type: 'error';
|
|
118
|
-
error:
|
|
129
|
+
error: ApproveThenBuildError;
|
|
119
130
|
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Progress phases emitted while a request is being prepared, in order. An
|
|
134
|
+
* allowance that already covers the deposit skips the approval phases.
|
|
135
|
+
*
|
|
136
|
+
* @alpha
|
|
137
|
+
*/
|
|
138
|
+
type CentrifugeBuyPreparationPhase = ApproveThenBuildPhase;
|
|
139
|
+
/**
|
|
140
|
+
* A step-tagged reason a preparation failed - see {@link ApproveThenBuildError}.
|
|
141
|
+
*
|
|
142
|
+
* @alpha
|
|
143
|
+
*/
|
|
144
|
+
type CentrifugeBuyPreparationError = ApproveThenBuildError;
|
|
145
|
+
/** @alpha */
|
|
146
|
+
type CentrifugeBuyPreparationResult = ApproveThenBuildResult<CentrifugeVaultBuyTransaction>;
|
|
120
147
|
/** @alpha */
|
|
121
148
|
type PrepareCentrifugeBuyParams = {
|
|
122
149
|
wallet: EvmWallet;
|
|
@@ -283,8 +310,8 @@ type ClaimCentrifugeVaultParams = {
|
|
|
283
310
|
* broadcast. The two halves stay beside it. The checkout runs them itself so
|
|
284
311
|
* it can drop a build that finishes after the user has left, and a host that
|
|
285
312
|
* wants to show the calldata before broadcasting can do the same. The amount
|
|
286
|
-
* step calls neither
|
|
287
|
-
* buy shares.
|
|
313
|
+
* step calls neither, and like the builders they wrap they are not free to
|
|
314
|
+
* poll. The request settles later. Broadcasting it does not buy shares.
|
|
288
315
|
*
|
|
289
316
|
* @alpha
|
|
290
317
|
*/
|
|
@@ -326,6 +353,10 @@ type TokenSaleExecutionPhase = 'checking-allowance' | 'resetting-allowance' | 'c
|
|
|
326
353
|
/**
|
|
327
354
|
* A step-tagged reason `ClientCoinListTokenSaleNamespace.execute` failed.
|
|
328
355
|
*
|
|
356
|
+
* The first three are refusals before anything is signed: the offer names no
|
|
357
|
+
* funding contract on the chain, does not accept the coin there, or has no
|
|
358
|
+
* option with that id.
|
|
359
|
+
*
|
|
329
360
|
* The reset-to-zero step (`allowance-reset` / `allowance-reset-reverted`) is
|
|
330
361
|
* reported distinctly from the main approval (`approval` /
|
|
331
362
|
* `approval-reverted`, reused from {@link Erc20ApprovalError}) so consumers can
|
|
@@ -333,6 +364,12 @@ type TokenSaleExecutionPhase = 'checking-allowance' | 'resetting-allowance' | 'c
|
|
|
333
364
|
* reverted on-chain.
|
|
334
365
|
*/
|
|
335
366
|
type TokenSaleExecutionError = {
|
|
367
|
+
step: 'unsupported-chain';
|
|
368
|
+
} | {
|
|
369
|
+
step: 'unsupported-asset';
|
|
370
|
+
} | {
|
|
371
|
+
step: 'unknown-option';
|
|
372
|
+
} | {
|
|
336
373
|
step: 'allowance-check';
|
|
337
374
|
} | {
|
|
338
375
|
step: 'allowance-reset';
|
|
@@ -351,25 +388,44 @@ type TokenSaleExecutionResult = {
|
|
|
351
388
|
type: 'error';
|
|
352
389
|
error: TokenSaleExecutionError;
|
|
353
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* Which approval a participation is recorded against.
|
|
393
|
+
*
|
|
394
|
+
* `fresh` sends a new one, which is what every first attempt does. `mined`
|
|
395
|
+
* reuses one that already mined for this amount - the `approvalTxHash` of a
|
|
396
|
+
* `participation` failure - so retrying the write asks the wallet for nothing.
|
|
397
|
+
*/
|
|
398
|
+
type TokenSaleApproval = {
|
|
399
|
+
type: 'fresh';
|
|
400
|
+
} | {
|
|
401
|
+
type: 'mined';
|
|
402
|
+
txHash: Hash;
|
|
403
|
+
};
|
|
354
404
|
type ExecuteTokenSaleParams = {
|
|
355
405
|
wallet: EvmWallet;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
|
|
406
|
+
/**
|
|
407
|
+
* The sale being bought into. The funding contract, the coin's address and
|
|
408
|
+
* its asset id are all read off it, so the caller never supplies one.
|
|
409
|
+
*/
|
|
410
|
+
offer: CoinListTokenSaleOfferDetail;
|
|
411
|
+
/** The option being bought, which sets the price. */
|
|
412
|
+
optionId: OfferOptionId;
|
|
363
413
|
chain: EthereumChain;
|
|
414
|
+
/** The coin the user pays in. It must be one of the offer's funding assets. */
|
|
415
|
+
inputAsset: StablecoinSymbol;
|
|
416
|
+
/** How much of `inputAsset` to commit, in its base units. */
|
|
364
417
|
amount: BlockchainAmount;
|
|
418
|
+
/** Defaults to `{ type: 'fresh' }`. */
|
|
419
|
+
approval?: TokenSaleApproval;
|
|
365
420
|
onProgress?: (phase: TokenSaleExecutionPhase) => void;
|
|
366
421
|
};
|
|
367
422
|
|
|
368
423
|
/**
|
|
369
424
|
* The client-side token-sale namespace: everything the shared
|
|
370
425
|
* {@link CoinListTokenSaleNamespace} reads/writes over the API, plus the
|
|
371
|
-
* on-chain flow that drives a
|
|
372
|
-
*
|
|
426
|
+
* on-chain flow that drives a caller-supplied `EvmWallet` (`execute`) -
|
|
427
|
+
* e.g. `coinlist.tokenSale.execute({ ... })`. The flow takes the wallet and
|
|
428
|
+
* addresses per call; the namespace supplies the participation writes and
|
|
373
429
|
* (via the ERC-20 namespace) the allowance read it depends on.
|
|
374
430
|
*/
|
|
375
431
|
interface ClientCoinListTokenSaleNamespace extends CoinListTokenSaleNamespace {
|
|
@@ -388,28 +444,13 @@ interface ClientCoinListTokenSaleNamespace extends CoinListTokenSaleNamespace {
|
|
|
388
444
|
* Progress phases emitted while an order is being prepared, in the order they
|
|
389
445
|
* occur. An allowance that already covers the order skips the approval phases.
|
|
390
446
|
*/
|
|
391
|
-
type OndoSwapPreparationPhase =
|
|
447
|
+
type OndoSwapPreparationPhase = ApproveThenBuildPhase;
|
|
392
448
|
/**
|
|
393
|
-
* A step-tagged reason a preparation failed.
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* trade: an unsupported chain, a refused approval and a build that would not
|
|
397
|
-
* complete are fixed the same way whichever token was being approved.
|
|
398
|
-
*
|
|
399
|
-
* `insufficient-allowance` is separated from the generic build failure because
|
|
400
|
-
* it is the one with a remedy: frontline reads the allowance before asking
|
|
401
|
-
* Ninshubur for anything, so reaching it means the approval this flow just
|
|
402
|
-
* mined is not the one frontline sees. That is usually its RPC node lagging a
|
|
403
|
-
* block behind, which retrying fixes - so it is a retry, not a re-approval.
|
|
449
|
+
* A step-tagged reason a preparation failed. Shared by both directions, and
|
|
450
|
+
* with every other backend-built checkout, because every arm names a remedy
|
|
451
|
+
* rather than a trade - see {@link ApproveThenBuildError}.
|
|
404
452
|
*/
|
|
405
|
-
type OndoSwapPreparationError =
|
|
406
|
-
step: 'unsupported-chain';
|
|
407
|
-
chain: EthereumChain;
|
|
408
|
-
} | Erc20AllowanceError | {
|
|
409
|
-
step: 'insufficient-allowance';
|
|
410
|
-
} | {
|
|
411
|
-
step: 'build-transaction';
|
|
412
|
-
};
|
|
453
|
+
type OndoSwapPreparationError = ApproveThenBuildError;
|
|
413
454
|
/**
|
|
414
455
|
* A prepared order of whichever kind was asked for, or the step that stopped
|
|
415
456
|
* it.
|
|
@@ -417,13 +458,7 @@ type OndoSwapPreparationError = {
|
|
|
417
458
|
* Generic in the transaction rather than a union over the two, so a caller
|
|
418
459
|
* that asked for a sale cannot be handed a purchase to narrow.
|
|
419
460
|
*/
|
|
420
|
-
type OndoSwapPreparationResult<T> =
|
|
421
|
-
type: 'success';
|
|
422
|
-
transaction: T;
|
|
423
|
-
} | {
|
|
424
|
-
type: 'error';
|
|
425
|
-
error: OndoSwapPreparationError;
|
|
426
|
-
};
|
|
461
|
+
type OndoSwapPreparationResult<T> = ApproveThenBuildResult<T>;
|
|
427
462
|
type OndoBuyPreparationResult = OndoSwapPreparationResult<OndoBuyTransaction>;
|
|
428
463
|
type OndoSellPreparationResult = OndoSwapPreparationResult<OndoSellTransaction>;
|
|
429
464
|
/** What both preparations take, before the two fields whose meaning forks. */
|
|
@@ -477,12 +512,21 @@ type OndoSwapExecutionPhase = 'broadcasting-swap' | 'confirming-swap';
|
|
|
477
512
|
* `quote-expired` is a refusal to broadcast rather than a failure of a
|
|
478
513
|
* broadcast: it would revert on chain and cost the user gas, and it is fixed
|
|
479
514
|
* by building a fresh transaction.
|
|
515
|
+
*
|
|
516
|
+
* `swap` means the wallet never sent it, so placing again is safe.
|
|
517
|
+
* `swap-unconfirmed` means it was sent and the receipt wait failed: the swap
|
|
518
|
+
* may still mine, and placing again can fill the order twice. `txHash` is
|
|
519
|
+
* the transaction to look up before doing anything else.
|
|
480
520
|
*/
|
|
481
521
|
type OndoSwapExecutionError = {
|
|
482
522
|
step: 'quote-expired';
|
|
483
523
|
} | {
|
|
484
524
|
step: 'swap';
|
|
485
525
|
cause: WalletError;
|
|
526
|
+
} | {
|
|
527
|
+
step: 'swap-unconfirmed';
|
|
528
|
+
txHash: Hash;
|
|
529
|
+
cause: WalletError;
|
|
486
530
|
} | {
|
|
487
531
|
step: 'swap-reverted';
|
|
488
532
|
};
|
|
@@ -520,7 +564,12 @@ type ExecuteOndoSwapParams<T> = {
|
|
|
520
564
|
|
|
521
565
|
/**
|
|
522
566
|
* The Ondo namespace plus the halves of placing an order that need a wallet,
|
|
523
|
-
* and so cannot live on the shared namespace
|
|
567
|
+
* and so cannot live on the shared namespace: `prepareBuy` / `prepareSell`
|
|
568
|
+
* (approve, then commit a firm quote) and `executeSwap` (broadcast it).
|
|
569
|
+
*
|
|
570
|
+
* Like the builders they wrap, the prepare methods spend an attestation, so
|
|
571
|
+
* unlike the reads they are not free to poll: call one when the user commits
|
|
572
|
+
* to an amount, never on a timer.
|
|
524
573
|
*
|
|
525
574
|
* Preparing and executing are two calls rather than one because the flow is
|
|
526
575
|
* two user decisions: the trader commits to an amount (approving the spend),
|
|
@@ -585,9 +634,21 @@ type SwapExecutionError = {
|
|
|
585
634
|
step: 'swap-paused';
|
|
586
635
|
} | {
|
|
587
636
|
step: 'swap-stopped';
|
|
588
|
-
} | Erc20AllowanceError
|
|
637
|
+
} | Erc20AllowanceError
|
|
638
|
+
/** The wallet never sent the swap, so swapping again is safe. */
|
|
639
|
+
| {
|
|
589
640
|
step: 'swap';
|
|
590
641
|
cause: WalletError;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* The swap was sent and the receipt wait failed. It may still mine, so
|
|
645
|
+
* swapping again can fill the order twice: `txHash` is the transaction to
|
|
646
|
+
* look up before doing anything else.
|
|
647
|
+
*/
|
|
648
|
+
| {
|
|
649
|
+
step: 'swap-unconfirmed';
|
|
650
|
+
txHash: Hash;
|
|
651
|
+
cause: WalletError;
|
|
591
652
|
} | {
|
|
592
653
|
step: 'swap-reverted';
|
|
593
654
|
};
|
|
@@ -642,9 +703,21 @@ type WalletAuthorizationError = {
|
|
|
642
703
|
cause: WalletError;
|
|
643
704
|
} | {
|
|
644
705
|
step: 'allow-wallet';
|
|
645
|
-
}
|
|
706
|
+
}
|
|
707
|
+
/** The wallet never sent the allow-list transaction. */
|
|
708
|
+
| {
|
|
646
709
|
step: 'broadcast';
|
|
647
710
|
cause: WalletError;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* The allow-list transaction was sent and the receipt wait failed. It may
|
|
714
|
+
* still mine, so authorizing again would send a second one: `txHash` is the
|
|
715
|
+
* transaction to look up first.
|
|
716
|
+
*/
|
|
717
|
+
| {
|
|
718
|
+
step: 'broadcast-unconfirmed';
|
|
719
|
+
txHash: Hash;
|
|
720
|
+
cause: WalletError;
|
|
648
721
|
} | {
|
|
649
722
|
step: 'not-authorized';
|
|
650
723
|
};
|
|
@@ -665,7 +738,8 @@ type AuthorizeWalletParams = {
|
|
|
665
738
|
/**
|
|
666
739
|
* The client-side swap namespace: everything the shared
|
|
667
740
|
* {@link SuperstateSwapNamespace} reads/writes over the API, plus the on-chain flows
|
|
668
|
-
* that drive a wallet (`execute`, `authorizeWallet`)
|
|
741
|
+
* that drive a caller-supplied wallet (`execute`, `authorizeWallet`) and
|
|
742
|
+
* return a step-tagged result rather than throwing. The flows take the
|
|
669
743
|
* wallet and addresses per call; the namespace itself supplies the API reads
|
|
670
744
|
* they depend on.
|
|
671
745
|
*/
|
|
@@ -706,7 +780,7 @@ interface ClientRequirementsNamespace extends RequirementsNamespace {
|
|
|
706
780
|
}
|
|
707
781
|
|
|
708
782
|
/**
|
|
709
|
-
* Getting the user to a human at CoinList.
|
|
783
|
+
* Getting the user to a human at CoinList - `coinlist.support.contact()`.
|
|
710
784
|
*
|
|
711
785
|
* This namespace is client-only: it opens a browser tab and has no
|
|
712
786
|
* `CoinListServer` counterpart. No method here requires authentication.
|
|
@@ -767,7 +841,8 @@ type ConnectWalletParams = {
|
|
|
767
841
|
|
|
768
842
|
/**
|
|
769
843
|
* The wallets namespace plus the one operation that needs the host's wallet:
|
|
770
|
-
* proving ownership of it and binding it to an offer option, in one call
|
|
844
|
+
* proving ownership of it and binding it to an offer option, in one call -
|
|
845
|
+
* `coinlist.wallets.connect({ wallet, offerId, offerOptionId })`.
|
|
771
846
|
*
|
|
772
847
|
* The shared {@link WalletsNamespace} already has both halves -
|
|
773
848
|
* `createOwnershipChallenge` and `connectExternal` - but a signature has to
|
|
@@ -826,96 +901,27 @@ interface ClientConfig extends Config {
|
|
|
826
901
|
* when the user is not authenticated.
|
|
827
902
|
*/
|
|
828
903
|
interface CoinListClient {
|
|
829
|
-
/**
|
|
830
|
-
* Authentication: the current {@link AuthState}, and the browser half of the
|
|
831
|
-
* OAuth 2.0 + PKCE flow — e.g. `coinlist.auth.startOAuth()`.
|
|
832
|
-
*/
|
|
904
|
+
/** Auth state and the browser half of OAuth - see {@link ClientAuthNamespace}. */
|
|
833
905
|
readonly auth: ClientAuthNamespace;
|
|
834
|
-
/**
|
|
835
|
-
* The offer catalogue: listing offers and reading one in full — e.g.
|
|
836
|
-
* `coinlist.offers.get(offerId)`.
|
|
837
|
-
*/
|
|
906
|
+
/** The offer catalogue, e.g. `coinlist.offers.get(offerId)` - see {@link OffersNamespace}. */
|
|
838
907
|
readonly offers: OffersNamespace;
|
|
839
|
-
/**
|
|
840
|
-
* What the user must satisfy before participating in an offer: the
|
|
841
|
-
* checklist and its statuses, identity verification (KYC), and tax-document
|
|
842
|
-
* signing — e.g. `coinlist.requirements.statuses(offerId)`.
|
|
843
|
-
*
|
|
844
|
-
* Also exposes `handle(requirement)`, which sends the user to the CoinList
|
|
845
|
-
* page that satisfies a requirement.
|
|
846
|
-
*/
|
|
908
|
+
/** What a user must satisfy to participate - see {@link ClientRequirementsNamespace}. */
|
|
847
909
|
readonly requirements: ClientRequirementsNamespace;
|
|
848
|
-
/**
|
|
849
|
-
* The user's external wallets: proving ownership, binding a wallet to an
|
|
850
|
-
* offer option, and managing those bindings — e.g.
|
|
851
|
-
* `coinlist.wallets.connect({ wallet, offerId, offerOptionId })`.
|
|
852
|
-
*/
|
|
910
|
+
/** Wallet ownership proofs and offer-option bindings - see {@link ClientWalletsNamespace}. */
|
|
853
911
|
readonly wallets: ClientWalletsNamespace;
|
|
854
|
-
/**
|
|
855
|
-
* Generic ERC-20 reads (token allowance and balance) shared across the
|
|
856
|
-
* on-chain flows — e.g. `coinlist.erc20.getBalance({ ... })`.
|
|
857
|
-
*/
|
|
912
|
+
/** Generic ERC-20 allowance and balance reads - see {@link Erc20Namespace}. */
|
|
858
913
|
readonly erc20: Erc20Namespace;
|
|
859
|
-
/**
|
|
860
|
-
* Token-sale operations: listing/reading/recording participations, plus the
|
|
861
|
-
* on-chain `execute` flow that submits the ERC-20 approval and records the
|
|
862
|
-
* participation over a caller-supplied {@link EvmWallet} — e.g.
|
|
863
|
-
* `coinlist.tokenSale.execute({ ... })`.
|
|
864
|
-
*
|
|
865
|
-
* `execute` drives a caller-supplied wallet and returns a step-tagged result
|
|
866
|
-
* rather than throwing.
|
|
867
|
-
*/
|
|
914
|
+
/** Token-sale participations and the on-chain purchase - see {@link ClientCoinListTokenSaleNamespace}. */
|
|
868
915
|
readonly tokenSale: ClientCoinListTokenSaleNamespace;
|
|
869
|
-
/**
|
|
870
|
-
* On-chain swap operations: quoting a swap, reading swap-contract state, and
|
|
871
|
-
* allow-listing a proven wallet — e.g.
|
|
872
|
-
* `coinlist.superstate.getOutputToken({ contractAddress, chain })`.
|
|
873
|
-
*
|
|
874
|
-
* The on-chain flows (`execute`, `authorizeWallet`) additionally drive a
|
|
875
|
-
* caller-supplied wallet.
|
|
876
|
-
*/
|
|
916
|
+
/** Superstate swaps - see {@link ClientSuperstateSwapNamespace}. */
|
|
877
917
|
readonly superstate: ClientSuperstateSwapNamespace;
|
|
878
|
-
/**
|
|
879
|
-
* Ondo swaps: whether an asset is tradable right now and what it costs - e.g.
|
|
880
|
-
* `coinlist.ondo.getQuote({ ... })` - plus placing an order, in the two
|
|
881
|
-
* halves the flow actually has: `prepareBuy` / `prepareSell` (approve, then
|
|
882
|
-
* commit a firm quote) and `executeSwap` (broadcast it).
|
|
883
|
-
*
|
|
884
|
-
* Preparing is two methods because the directions approve different tokens -
|
|
885
|
-
* the funding coin on a purchase, the asset on a sale - and commit to
|
|
886
|
-
* different terms; broadcasting is one, because it reads calldata and a
|
|
887
|
-
* deadline and knows about neither.
|
|
888
|
-
*
|
|
889
|
-
* The reads are free to poll while the user edits an order. Preparing is
|
|
890
|
-
* not: committing a quote spends an attestation.
|
|
891
|
-
*
|
|
892
|
-
* No CoinList fee is applied to a read quote; see
|
|
893
|
-
* {@link ClientOndoNamespace}.
|
|
894
|
-
*/
|
|
918
|
+
/** Ondo swap quotes and orders - see {@link ClientOndoNamespace}. */
|
|
895
919
|
readonly ondo: ClientOndoNamespace;
|
|
896
|
-
/**
|
|
897
|
-
* Centrifuge vault deposits and claims: the vault-wide ordering gate, each
|
|
898
|
-
* wallet's position, the two halves of placing a request, and the claim
|
|
899
|
-
* that settles a filled one.
|
|
900
|
-
*
|
|
901
|
-
* The reads are free to poll. `prepareBuy` and `placeRequest` are not.
|
|
902
|
-
* Broadcasting places a request. It does not buy shares.
|
|
903
|
-
*/
|
|
920
|
+
/** Centrifuge vault requests and claims - see {@link ClientCentrifugeNamespace}. */
|
|
904
921
|
readonly centrifuge: ClientCentrifugeNamespace;
|
|
905
|
-
/**
|
|
906
|
-
* Token display metadata (name, symbol, decimals, logos) from CoinList's
|
|
907
|
-
* public token registry, keyed by chain + contract address — e.g.
|
|
908
|
-
* `coinlist.tokens.get({ chain, address })` for an entry of
|
|
909
|
-
* `Offer.tokens`, or `coinlist.tokens.list()` for the whole
|
|
910
|
-
* catalogue in one request.
|
|
911
|
-
*
|
|
912
|
-
* Public and unauthenticated: unlike the other namespaces, its methods never
|
|
913
|
-
* require a logged-in user.
|
|
914
|
-
*/
|
|
922
|
+
/** Public token display metadata - see {@link TokensNamespace}. */
|
|
915
923
|
readonly tokens: TokensNamespace;
|
|
916
|
-
/**
|
|
917
|
-
* Contacting CoinList support — `coinlist.support.contact()`.
|
|
918
|
-
*/
|
|
924
|
+
/** Contacting CoinList support - see {@link ClientSupportNamespace}. */
|
|
919
925
|
readonly support: ClientSupportNamespace;
|
|
920
926
|
/**
|
|
921
927
|
* Calls the provided {@link ClientConfig.getAccessToken} lambda to determine
|
|
@@ -1025,140 +1031,349 @@ interface CoinListSignInCardContainerProps {
|
|
|
1025
1031
|
declare function CoinListSignInCardContainer({ state, onSignIn, onClose, className, }?: CoinListSignInCardContainerProps): ReactNode;
|
|
1026
1032
|
|
|
1027
1033
|
/**
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
* Success means the request was placed. The fund fulfils it later, at a price
|
|
1034
|
-
* set then.
|
|
1035
|
-
*
|
|
1036
|
-
* @alpha
|
|
1034
|
+
* What the grid fetches, pre-fetched on the server instead. Each half is
|
|
1035
|
+
* independent: seed `offers` (via `CoinListServer#offers.list()`) and the
|
|
1036
|
+
* client still fetches the registry, seed `tokens` (via
|
|
1037
|
+
* `CoinListServer#tokens.list()`) and it still fetches the offers, seed both
|
|
1038
|
+
* and the grid makes no request of its own.
|
|
1037
1039
|
*/
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
transaction: CentrifugeVaultBuyTransaction;
|
|
1043
|
-
txHash: Hash;
|
|
1044
|
-
};
|
|
1040
|
+
interface OffersGridData {
|
|
1041
|
+
offers?: Offer[];
|
|
1042
|
+
tokens?: TokenMetadata[];
|
|
1043
|
+
}
|
|
1045
1044
|
|
|
1045
|
+
interface OffersGridContainerProps {
|
|
1046
|
+
/** Maximum number of columns to render when horizontal space allows. */
|
|
1047
|
+
maxColumns?: number;
|
|
1048
|
+
/** Optional className applied to the grid element. */
|
|
1049
|
+
className?: string;
|
|
1050
|
+
/** Optional className applied to the outer wrapper element. */
|
|
1051
|
+
containerClassName?: string;
|
|
1052
|
+
/** Optional loading slot shown while offers are being fetched. */
|
|
1053
|
+
loading?: ReactNode;
|
|
1054
|
+
/** Optional error slot shown when loading offers fails. */
|
|
1055
|
+
error?: ReactNode;
|
|
1056
|
+
/** Optional empty state slot shown when there are no available offers. */
|
|
1057
|
+
emptyState?: ReactNode;
|
|
1058
|
+
/** Optional per-offer click handler; when omitted, cards are not clickable. */
|
|
1059
|
+
onOfferClick?: (offer: Offer) => void;
|
|
1060
|
+
/**
|
|
1061
|
+
* What the grid would otherwise fetch, pre-fetched on the server: `offers`
|
|
1062
|
+
* via `CoinListServer#offers.list()`, `tokens` via
|
|
1063
|
+
* `CoinListServer#tokens.list()`. Each half skips its own client-side
|
|
1064
|
+
* fetch; pass both for a grid that makes no request of its own.
|
|
1065
|
+
*/
|
|
1066
|
+
data?: OffersGridData;
|
|
1067
|
+
/**
|
|
1068
|
+
* Default `true`. When `false` nothing is fetched, so the container can be
|
|
1069
|
+
* mounted while the grid is not needed yet.
|
|
1070
|
+
*/
|
|
1071
|
+
enabled?: boolean;
|
|
1072
|
+
}
|
|
1046
1073
|
/**
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
* forbids for the reason it always does: two products that reach sideways can
|
|
1054
|
-
* no longer be moved or deleted on their own.
|
|
1074
|
+
* Displays a responsive live-sale grid of {@link OfferSaleCard}, backed by
|
|
1075
|
+
* {@link useOffersGridViewModel}. Each card is named and illustrated by the
|
|
1076
|
+
* public token registry where it lists the offer's token, and by the offer's
|
|
1077
|
+
* own fields otherwise - list offers carry no display name, so an unlisted
|
|
1078
|
+
* one shows logo + tagline until the host maps from detail. For equities /
|
|
1079
|
+
* past-sales browse rows, compose {@link OffersAssetGrid} instead.
|
|
1055
1080
|
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
|
|
1062
|
-
type OndoOrderPlaced = OndoBuyOrderPlaced | OndoSellOrderPlaced;
|
|
1063
|
-
/**
|
|
1064
|
-
* The common half of an {@link OndoOrderPlaced}, before its side's terms.
|
|
1081
|
+
* Pass `data` (offers and tokens pre-fetched server-side) to use them as-is
|
|
1082
|
+
* and skip the client-side fetches. Pass `enabled={false}` to skip the fetches
|
|
1083
|
+
* when the container is mounted but the grid is not needed yet. Uses the
|
|
1084
|
+
* `loading` / `error` / `emptyState` slots when provided; otherwise renders
|
|
1085
|
+
* the standard fallbacks. Cards are interactive only when `onOfferClick` is
|
|
1086
|
+
* provided.
|
|
1065
1087
|
*
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
* sell order holding a buy transaction constructible and its
|
|
1069
|
-
* `minimumReceiveOutputAmount` unreachable behind a narrowed `side`. Each arm
|
|
1070
|
-
* names its own instead.
|
|
1071
|
-
*/
|
|
1072
|
-
type OndoOrderPlacedCore = {
|
|
1073
|
-
txHash: Hash;
|
|
1074
|
-
/** What the trader spent, in the input asset's base units. */
|
|
1075
|
-
amount: BlockchainAmount;
|
|
1076
|
-
wallet: EvmWallet;
|
|
1077
|
-
};
|
|
1078
|
-
/** A filled purchase: a stablecoin spent, the asset received. */
|
|
1079
|
-
type OndoBuyOrderPlaced = OndoOrderPlacedCore & OndoBuyOrderTerms;
|
|
1080
|
-
/** A filled sale: the asset spent, the settlement coin received. */
|
|
1081
|
-
type OndoSellOrderPlaced = OndoOrderPlacedCore & OndoSellOrderTerms;
|
|
1082
|
-
/**
|
|
1083
|
-
* A buy spends a stablecoin the SDK ships a registry entry for, so its input
|
|
1084
|
-
* asset is narrowed to one - which is what keeps `TOKEN_REGISTRY.erc20` total
|
|
1085
|
-
* at the call sites that name it.
|
|
1088
|
+
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
1089
|
+
* needed.
|
|
1086
1090
|
*/
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
inputAsset: StablecoinSymbol;
|
|
1090
|
-
/** The purchase that was broadcast, and the deposit it was struck against. */
|
|
1091
|
-
transaction: OndoBuyTransaction;
|
|
1092
|
-
};
|
|
1091
|
+
declare function OffersGridContainer({ data, onOfferClick, enabled, ...viewProps }?: OffersGridContainerProps): ReactNode;
|
|
1092
|
+
|
|
1093
1093
|
/**
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1094
|
+
* One image as an `<img>` renders it: a `src` for a consumer that takes a
|
|
1095
|
+
* single URL, and the `srcSet` candidates for one that also knows the size
|
|
1096
|
+
* it renders at. `srcSet` is absent for a vector logo and for the offer's own
|
|
1097
|
+
* artwork, neither of which offers the browser a choice.
|
|
1098
1098
|
*/
|
|
1099
|
-
type
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
/** The sale that was broadcast, and the floor under the proceeds it names. */
|
|
1103
|
-
transaction: OndoSellTransaction;
|
|
1099
|
+
type LogoImageUi = {
|
|
1100
|
+
src: string;
|
|
1101
|
+
srcSet?: string;
|
|
1104
1102
|
};
|
|
1105
|
-
|
|
1106
1103
|
/**
|
|
1107
|
-
* The
|
|
1108
|
-
*
|
|
1109
|
-
* The SDK ships no wallet stack and is not coupled to Privy, AppKit or
|
|
1110
|
-
* anything else - a partner may be a wallet provider themselves - so wallet
|
|
1111
|
-
* discovery and connection are inverted onto the host. It hands over ready
|
|
1112
|
-
* {@link EvmWallet}s and two lambdas; the SDK decides nothing about how they
|
|
1113
|
-
* came to exist.
|
|
1114
|
-
*
|
|
1115
|
-
* There is no separate wallet model here on purpose: `EvmWallet` already
|
|
1116
|
-
* carries the `address`, so a `{ address, signer }` pair would be a second
|
|
1117
|
-
* wallet type to keep in sync with the first.
|
|
1104
|
+
* The logo a catalogue card renders for an offer, with the registry's
|
|
1105
|
+
* dark-theme counterpart when it configures one.
|
|
1118
1106
|
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
* that is the chain the transaction goes to whatever the wallet is currently
|
|
1122
|
-
* pointed at.
|
|
1107
|
+
* `dark` is `null` rather than absent so a renderer has to decide what to do
|
|
1108
|
+
* without one: fall back to `light`, which is the registry's own rule.
|
|
1123
1109
|
*/
|
|
1124
|
-
type
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
embedded: EvmWallet[];
|
|
1130
|
-
/** The connected external wallet, or `null` while none is connected. */
|
|
1131
|
-
external: EvmWallet | null;
|
|
1110
|
+
type OfferLogoUi = {
|
|
1111
|
+
light: LogoImageUi;
|
|
1112
|
+
dark: LogoImageUi | null;
|
|
1113
|
+
};
|
|
1114
|
+
declare const OfferLogoUi: {
|
|
1132
1115
|
/**
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
* When set, a checkout that supports it skips its wallet step entirely and
|
|
1136
|
-
* opens on the amount, renumbering the steps that remain. That is for the
|
|
1137
|
-
* host that already knows the answer - a sell page reached from a position
|
|
1138
|
-
* knows which wallet holds it, and asking again would be a question with one
|
|
1139
|
-
* possible answer.
|
|
1140
|
-
*
|
|
1141
|
-
* It does not have to appear in `embedded` or `external`. The host supplies a
|
|
1142
|
-
* ready {@link EvmWallet} either way, and the SDK never resolves this back to
|
|
1143
|
-
* a row.
|
|
1116
|
+
* The registry's logo for the token an offer is about, or the offer's own
|
|
1117
|
+
* artwork otherwise, or `null` when neither exists.
|
|
1144
1118
|
*
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1149
|
-
* assume a skip from the field being set.
|
|
1119
|
+
* The registry wins when both exist because it is the token's real artwork
|
|
1120
|
+
* where `Offer.logoUrl` is catalogue artwork, and because a swap publishes
|
|
1121
|
+
* without artwork more often than not - which is why `logoUrl` is `null`
|
|
1122
|
+
* on the swap variants.
|
|
1150
1123
|
*/
|
|
1151
|
-
|
|
1124
|
+
fromOffer: (offer: {
|
|
1125
|
+
logoUrl: string | null;
|
|
1126
|
+
}, tokenMetadata: TokenMetadata | null) => OfferLogoUi | null;
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* An offer as {@link OfferAssetCard} renders it. Browse chrome: circular
|
|
1131
|
+
* `logo`, `name`, and asset `symbol`. No wordmark.
|
|
1132
|
+
*
|
|
1133
|
+
* All three come from the public token registry when the caller hands over
|
|
1134
|
+
* the metadata of the token the offer is about. Without it, `fromOffer`
|
|
1135
|
+
* omits `name` and `symbol` - the list payload has neither - so a list-mapped
|
|
1136
|
+
* card is honest about being logo-only, and `fromDetail` reads them from the
|
|
1137
|
+
* detail payload (`name`, `asset.code`).
|
|
1138
|
+
*/
|
|
1139
|
+
type OfferAssetCardUi = {
|
|
1140
|
+
id: OfferId;
|
|
1141
|
+
/** Absent when neither the registry nor a detail payload names the offer. */
|
|
1142
|
+
name?: string;
|
|
1143
|
+
/** Absent when neither the registry nor a detail payload carries a ticker. */
|
|
1144
|
+
symbol?: string;
|
|
1145
|
+
/** `null` when neither the registry nor the offer carries artwork. */
|
|
1146
|
+
logo: OfferLogoUi | null;
|
|
1147
|
+
};
|
|
1148
|
+
declare const OfferAssetCardUi: {
|
|
1149
|
+
/**
|
|
1150
|
+
* `tokenMetadata` is the registry's entry for the token the offer is about
|
|
1151
|
+
* (`TokenRegistrySnapshot.forOffer`), or `null` when it lists none. The
|
|
1152
|
+
* registry names win over the offer's own where both exist: they are the
|
|
1153
|
+
* token's canonical name, ticker and artwork, where the offer's are
|
|
1154
|
+
* catalogue copy.
|
|
1155
|
+
*/
|
|
1156
|
+
fromOffer: (offer: Offer, tokenMetadata?: TokenMetadata | null) => OfferAssetCardUi;
|
|
1157
|
+
fromDetail: (detail: OfferDetail, tokenMetadata?: TokenMetadata | null) => OfferAssetCardUi;
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
interface OfferAssetCardProps {
|
|
1161
|
+
offer: OfferAssetCardUi;
|
|
1162
|
+
/** When set, the whole card is the hit target. */
|
|
1163
|
+
onClick?: () => void;
|
|
1164
|
+
/** Optional className applied to the card root element. */
|
|
1165
|
+
className?: string;
|
|
1166
|
+
/** Optional className applied to an outer wrapper element. */
|
|
1167
|
+
containerClassName?: string;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Light browse-row catalogue card. Self-scoped. Header is the offer's `logo`
|
|
1171
|
+
* (the token registry's where it lists the token, with its dark-theme
|
|
1172
|
+
* variant, the catalogue's otherwise) beside `name` (h2) and asset `symbol`
|
|
1173
|
+
* under it — not a wordmark.
|
|
1174
|
+
* Responsive hug: tighter pad / logo / type below `md`, desktop keeps the
|
|
1175
|
+
* H4 + 48px logo row. Hosts compose this beside {@link OfferSaleCard}; the
|
|
1176
|
+
* card does not pick a variant itself.
|
|
1177
|
+
*/
|
|
1178
|
+
declare function OfferAssetCard({ offer, onClick, className, containerClassName, }: OfferAssetCardProps): ReactNode;
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* An offer as {@link OfferSaleCard} renders it. Countdown copy is derived in
|
|
1182
|
+
* the leaf from `startsAt` / `endsAt` so it can tick; the mapper does not
|
|
1183
|
+
* invent a price, FDV, unlock schedule, banner overlay, or wordmark.
|
|
1184
|
+
*
|
|
1185
|
+
* `name` and `logo` come from the public token registry when the caller
|
|
1186
|
+
* hands over the metadata of the token the offer is about, and from the
|
|
1187
|
+
* offer otherwise. The list payload carries no name, so `fromOffer` leaves
|
|
1188
|
+
* `name` absent without registry metadata - do not derive one from `slug`.
|
|
1189
|
+
* The card pairs `logo` with `name` as an h2 and renders each only when
|
|
1190
|
+
* present. Prefer {@link OfferSaleCardUi.fromDetail} when the host has a
|
|
1191
|
+
* name and no registry answer.
|
|
1192
|
+
*
|
|
1193
|
+
* `tagline` and `startsAt` are null for an offer that runs no sale window, an
|
|
1194
|
+
* Ondo swap: the card then omits the tagline and, with nothing to count down
|
|
1195
|
+
* to, reads as live.
|
|
1196
|
+
*/
|
|
1197
|
+
type OfferSaleCardUi = {
|
|
1198
|
+
id: OfferId;
|
|
1199
|
+
/** Absent when neither the registry nor a detail payload names the offer. */
|
|
1200
|
+
name?: string;
|
|
1201
|
+
tagline: string | null;
|
|
1202
|
+
/** `null` when neither the registry nor the offer carries artwork. */
|
|
1203
|
+
logo: OfferLogoUi | null;
|
|
1204
|
+
startsAt: Date | null;
|
|
1205
|
+
endsAt: Date | null;
|
|
1206
|
+
};
|
|
1207
|
+
declare const OfferSaleCardUi: {
|
|
1208
|
+
/**
|
|
1209
|
+
* `tokenMetadata` is the registry's entry for the token the offer is about
|
|
1210
|
+
* (`TokenRegistrySnapshot.forOffer`), or `null` when it lists none. The
|
|
1211
|
+
* registry names win over the offer's own where both exist: they are the
|
|
1212
|
+
* token's canonical name and artwork, where the offer's are catalogue copy.
|
|
1213
|
+
*/
|
|
1214
|
+
fromOffer: (offer: Offer, tokenMetadata?: TokenMetadata | null) => OfferSaleCardUi;
|
|
1215
|
+
fromDetail: (detail: OfferDetail, tokenMetadata?: TokenMetadata | null) => OfferSaleCardUi;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
interface OfferSaleCardProps {
|
|
1219
|
+
offer: OfferSaleCardUi;
|
|
1220
|
+
/** Host click handler. View offer always renders; this wires the hit target. */
|
|
1221
|
+
onClick?: () => void;
|
|
1222
|
+
/** Optional className applied to the card root element. */
|
|
1223
|
+
className?: string;
|
|
1224
|
+
/** Optional className applied to an outer wrapper element. */
|
|
1225
|
+
containerClassName?: string;
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Dark live-sale catalogue card. Self-scoped. Header is the offer's `logo`
|
|
1229
|
+
* (the token registry's where it lists the token, the catalogue's otherwise)
|
|
1230
|
+
* beside the `name` as an h2, then the tagline — not a wordmark. The same
|
|
1231
|
+
* logo is painted as a faint right-shifted watermark over the gradient.
|
|
1232
|
+
* Responsive hug layout; View offer always renders. No token price, FDV or unlock.
|
|
1233
|
+
*/
|
|
1234
|
+
declare function OfferSaleCard({ offer, onClick, className, containerClassName, }: OfferSaleCardProps): ReactNode;
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* A deposit request that has been broadcast and mined.
|
|
1238
|
+
*
|
|
1239
|
+
* Named without `Buy` so it does not collide with the dialog component when
|
|
1240
|
+
* both are re-exported from the client barrel.
|
|
1241
|
+
*
|
|
1242
|
+
* Success means the request was placed. The fund fulfils it later, at a price
|
|
1243
|
+
* set then.
|
|
1244
|
+
*
|
|
1245
|
+
* @alpha
|
|
1246
|
+
*/
|
|
1247
|
+
type CentrifugeOrderPlaced = {
|
|
1248
|
+
wallet: EvmWallet;
|
|
1249
|
+
/** What the request deposits, in the funding token's base units. */
|
|
1250
|
+
amount: BlockchainAmount;
|
|
1251
|
+
transaction: CentrifugeVaultBuyTransaction;
|
|
1252
|
+
txHash: Hash;
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* A token-sale order the checkout placed: the approval mined and the
|
|
1257
|
+
* participation is recorded.
|
|
1258
|
+
*
|
|
1259
|
+
* It is a commitment, not a purchase. The sale pulls the payment through the
|
|
1260
|
+
* approval shortly after and holds it, and allocates tokens - refunding what
|
|
1261
|
+
* they do not use - when it settles. So `participation.status` starts out
|
|
1262
|
+
* pending; `ClaimContainer` follows it from there.
|
|
1263
|
+
*
|
|
1264
|
+
* @alpha
|
|
1265
|
+
*/
|
|
1266
|
+
type TokenSaleOrderPlaced = {
|
|
1267
|
+
/** The wallet that approved the payment, and that receives the tokens. */
|
|
1268
|
+
wallet: EvmWallet;
|
|
1269
|
+
/** What was committed, in `inputAsset`'s base units. */
|
|
1270
|
+
amount: BlockchainAmount;
|
|
1271
|
+
inputAsset: StablecoinSymbol;
|
|
1272
|
+
participation: Participation;
|
|
1273
|
+
/** The approval the participation was recorded against. */
|
|
1274
|
+
approvalTxHash: Hash;
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* A filled Ondo order, as the confirmation dialog and the host's
|
|
1279
|
+
* `onOrderConfirmed` callback need it.
|
|
1280
|
+
*
|
|
1281
|
+
* It lives here rather than beside either review viewmodel because both
|
|
1282
|
+
* products produce one. Declaring it in `ondo/buy/` would make the sell
|
|
1283
|
+
* viewmodel import a sibling product's module - which the `shared/` ladder
|
|
1284
|
+
* forbids for the reason it always does: two products that reach sideways can
|
|
1285
|
+
* no longer be moved or deleted on their own.
|
|
1286
|
+
*
|
|
1287
|
+
* It names no asset beyond the one that was spent. The transaction does not
|
|
1288
|
+
* carry one, and rebuilding an `Erc20Asset` here would mean inventing a
|
|
1289
|
+
* `decimals` - the quote's answers for a different quantity, and the
|
|
1290
|
+
* transaction's is a scale rather than a property of the token. A host that
|
|
1291
|
+
* wants to know what was traded has the `offer` it passed in.
|
|
1292
|
+
*/
|
|
1293
|
+
type OndoOrderPlaced = OndoBuyOrderPlaced | OndoSellOrderPlaced;
|
|
1294
|
+
/**
|
|
1295
|
+
* The common half of an {@link OndoOrderPlaced}, before its side's terms.
|
|
1296
|
+
*
|
|
1297
|
+
* The transaction that was broadcast is not here, because it is not common:
|
|
1298
|
+
* it carries the same `side` this order does, and saying so in prose left a
|
|
1299
|
+
* sell order holding a buy transaction constructible and its
|
|
1300
|
+
* `minimumReceiveOutputAmount` unreachable behind a narrowed `side`. Each arm
|
|
1301
|
+
* names its own instead.
|
|
1302
|
+
*/
|
|
1303
|
+
type OndoOrderPlacedCore = {
|
|
1304
|
+
txHash: Hash;
|
|
1305
|
+
/** What the trader spent, in the input asset's base units. */
|
|
1306
|
+
amount: BlockchainAmount;
|
|
1307
|
+
wallet: EvmWallet;
|
|
1308
|
+
};
|
|
1309
|
+
/** A filled purchase: a stablecoin spent, the asset received. */
|
|
1310
|
+
type OndoBuyOrderPlaced = OndoOrderPlacedCore & OndoBuyOrderTerms;
|
|
1311
|
+
/** A filled sale: the asset spent, the settlement coin received. */
|
|
1312
|
+
type OndoSellOrderPlaced = OndoOrderPlacedCore & OndoSellOrderTerms;
|
|
1313
|
+
/**
|
|
1314
|
+
* A buy spends a stablecoin the SDK ships a registry entry for, so its input
|
|
1315
|
+
* asset is narrowed to one - which is what keeps `TOKEN_REGISTRY.erc20` total
|
|
1316
|
+
* at the call sites that name it.
|
|
1317
|
+
*/
|
|
1318
|
+
type OndoBuyOrderTerms = {
|
|
1319
|
+
side: 'buy';
|
|
1320
|
+
inputAsset: StablecoinSymbol;
|
|
1321
|
+
/** The purchase that was broadcast, and the deposit it was struck against. */
|
|
1322
|
+
transaction: OndoBuyTransaction;
|
|
1323
|
+
};
|
|
1324
|
+
/**
|
|
1325
|
+
* A sell spends the Ondo asset, which is in no registry: its address and
|
|
1326
|
+
* decimals come off the quote, and only its symbol is carried here. Hence the
|
|
1327
|
+
* wider `AssetSymbol`, and hence a SUM rather than one widened field - a buy
|
|
1328
|
+
* that lost its stablecoin guarantee would be the cost of sharing one.
|
|
1329
|
+
*/
|
|
1330
|
+
type OndoSellOrderTerms = {
|
|
1331
|
+
side: 'sell';
|
|
1332
|
+
inputAsset: AssetSymbol;
|
|
1333
|
+
/** The sale that was broadcast, and the floor under the proceeds it names. */
|
|
1334
|
+
transaction: OndoSellTransaction;
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* The wallets a checkout can spend from, supplied by the host: the shared
|
|
1339
|
+
* {@link WalletSelection} every screen reads its wallets from, plus the one
|
|
1340
|
+
* thing only a checkout asks for.
|
|
1341
|
+
*
|
|
1342
|
+
* A `null` `externalAdapter` hides the external-wallet row entirely, for a
|
|
1343
|
+
* host that only offers embedded wallets.
|
|
1344
|
+
*
|
|
1345
|
+
* Everything a wallet row displays beyond the address - the network name -
|
|
1346
|
+
* comes from the checkout's execution chain rather than from the wallet,
|
|
1347
|
+
* because that is the chain the transaction goes to whatever the wallet is
|
|
1348
|
+
* currently pointed at.
|
|
1349
|
+
*/
|
|
1350
|
+
type CheckoutWalletSelection = WalletSelection & {
|
|
1152
1351
|
/**
|
|
1153
|
-
*
|
|
1154
|
-
* SDK reads the outcome from `external` on the next render rather than from
|
|
1155
|
-
* a return value, so a host that connects through a redirect still works.
|
|
1352
|
+
* A wallet the host has already settled on, or `null` to let the user pick.
|
|
1156
1353
|
*
|
|
1157
|
-
*
|
|
1354
|
+
* That is for the host that already knows the answer - a sell page reached
|
|
1355
|
+
* from a position knows which wallet holds it, and a host with a single
|
|
1356
|
+
* embedded wallet has only one answer on a buy too - so asking again would
|
|
1357
|
+
* be a question with one possible answer. Every checkout honours it, in one
|
|
1358
|
+
* of two ways:
|
|
1359
|
+
*
|
|
1360
|
+
* - **Ondo buy, Ondo sell and Centrifuge buy skip their wallet step** and
|
|
1361
|
+
* open on the amount, renumbering the steps that remain. The wallet does
|
|
1362
|
+
* not have to appear in `embedded` or `external`: the host supplies a
|
|
1363
|
+
* ready {@link EvmWallet}, and these flows never resolve it back to a row.
|
|
1364
|
+
* - **Superstate never skips its wallet step**, because that step
|
|
1365
|
+
* allow-lists the wallet on-chain and no preselection can stand in for it.
|
|
1366
|
+
* The step opens with the preselected wallet's row already selected, so
|
|
1367
|
+
* the user confirms it rather than finding it. That needs a row: a wallet
|
|
1368
|
+
* matching neither an `embedded` one nor the connected `external` one by
|
|
1369
|
+
* address selects nothing, and the user picks as if none was preselected.
|
|
1370
|
+
*
|
|
1371
|
+
* Read **once**, when the checkout mounts. The approval a checkout asks for
|
|
1372
|
+
* is granted by one specific wallet, so a change mid-flow is ignored; remount
|
|
1373
|
+
* the checkout (a `key`) to apply a new one. After an order the flow resets
|
|
1374
|
+
* to the step it opened on, so a skipped wallet step stays skipped.
|
|
1158
1375
|
*/
|
|
1159
|
-
|
|
1160
|
-
/** Disconnects the external wallet. Resolves when it is gone. */
|
|
1161
|
-
disconnectExternal: () => Promise<void>;
|
|
1376
|
+
preselected: EvmWallet | null;
|
|
1162
1377
|
};
|
|
1163
1378
|
|
|
1164
1379
|
/** What the swap actually filled at, once it has mined. */
|
|
@@ -1196,10 +1411,8 @@ type SuperstateOrderPlaced = {
|
|
|
1196
1411
|
*
|
|
1197
1412
|
* Keyed by `OfferType` rather than by provider name. Every entry is optional,
|
|
1198
1413
|
* and so is the whole object: a host that says nothing about a provider gets
|
|
1199
|
-
* its defaults
|
|
1200
|
-
*
|
|
1201
|
-
* wired up without a key here, since its branch in {@link CheckoutContainer}
|
|
1202
|
-
* has to index one.
|
|
1414
|
+
* its defaults. A new provider that needs config cannot be wired up without a
|
|
1415
|
+
* key here, since its branch in {@link CheckoutContainer} has to index one.
|
|
1203
1416
|
*
|
|
1204
1417
|
* Everything here is per-*integration*: a host builds it once and passes the
|
|
1205
1418
|
* same object for every offer it renders. Which way the order runs is
|
|
@@ -1225,19 +1438,20 @@ type SuperstateCheckoutConfig = {
|
|
|
1225
1438
|
onOrderConfirmed?: (order: SuperstateOrderPlaced) => void;
|
|
1226
1439
|
};
|
|
1227
1440
|
/**
|
|
1228
|
-
*
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1232
|
-
* of its own needs that offer to render it. Without this entry a token-sale
|
|
1233
|
-
* offer renders nothing.
|
|
1234
|
-
*
|
|
1235
|
-
* Alpha: may change once the SDK ships its own token-sale checkout.
|
|
1441
|
+
* What a CoinList token-sale checkout can be configured with. Nothing is
|
|
1442
|
+
* required: the funding contract, the coins and the price are all read off
|
|
1443
|
+
* the offer. Which option is bought is per-render, so it is a prop - see
|
|
1444
|
+
* {@link CheckoutContainerProps.optionId}.
|
|
1236
1445
|
*
|
|
1237
1446
|
* @alpha
|
|
1238
1447
|
*/
|
|
1239
1448
|
type CoinListTokenSaleCheckoutConfig = {
|
|
1240
|
-
|
|
1449
|
+
/**
|
|
1450
|
+
* Fired once the participation is recorded. The dialog shows either way.
|
|
1451
|
+
* The order is a commitment: the sale collects the payment and allocates
|
|
1452
|
+
* the tokens when it settles.
|
|
1453
|
+
*/
|
|
1454
|
+
onOrderPlaced?: (order: TokenSaleOrderPlaced) => void;
|
|
1241
1455
|
};
|
|
1242
1456
|
/**
|
|
1243
1457
|
* What a Centrifuge vault checkout can be configured with.
|
|
@@ -1285,14 +1499,46 @@ interface CheckoutContainerProps {
|
|
|
1285
1499
|
*/
|
|
1286
1500
|
side?: OrderBookSide;
|
|
1287
1501
|
/**
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1502
|
+
* Which of a token sale's options is bought - each sets its own price,
|
|
1503
|
+
* minimum and sale agreement. Default: the offer's first option. Every
|
|
1504
|
+
* other provider buys its offer's only option and ignores it.
|
|
1505
|
+
*
|
|
1506
|
+
* A prop rather than a config entry for the same reason as `side`: it is
|
|
1507
|
+
* per-render, chosen on the host's offer page.
|
|
1508
|
+
*
|
|
1509
|
+
* **Read once, at mount**, as `side` is. To switch options, remount with a
|
|
1510
|
+
* `key` covering it.
|
|
1511
|
+
*/
|
|
1512
|
+
optionId?: OfferOptionId;
|
|
1513
|
+
/**
|
|
1514
|
+
* The wallets the buyer can spend from, and the host's connector for an
|
|
1515
|
+
* external one. The SDK ships no wallet stack, so this is how a host plugs
|
|
1516
|
+
* in Privy, AppKit, or its own.
|
|
1517
|
+
*
|
|
1518
|
+
* ```tsx
|
|
1519
|
+
* const wallets: CheckoutWalletSelection = {
|
|
1520
|
+
* embedded: myEmbeddedWallets,
|
|
1521
|
+
* external: myConnectedWallet, // or null
|
|
1522
|
+
* // `null` hides the external-wallet row, for a host with embedded
|
|
1523
|
+
* // wallets only.
|
|
1524
|
+
* externalAdapter: {
|
|
1525
|
+
* connect: () => myConnector.open(),
|
|
1526
|
+
* disconnect: () => myConnector.disconnect(),
|
|
1527
|
+
* },
|
|
1528
|
+
* preselected: null, // or the wallet the host already settled on
|
|
1529
|
+
* };
|
|
1530
|
+
* ```
|
|
1531
|
+
*
|
|
1532
|
+
* Every provider honours `wallets.preselected`. Ondo (buy and sell),
|
|
1533
|
+
* Centrifuge and the token sale skip their wallet step and open on the amount, renumbering the
|
|
1534
|
+
* cards that remain. Superstate never skips it, because that step
|
|
1535
|
+
* allow-lists the wallet on-chain: it opens the step with the preselected
|
|
1536
|
+
* wallet's row already selected instead. Read once, at mount - see below.
|
|
1291
1537
|
*/
|
|
1292
1538
|
wallets: CheckoutWalletSelection;
|
|
1293
1539
|
/**
|
|
1294
1540
|
* What each offer type needs beyond the offer itself. Default `{}`: every
|
|
1295
|
-
* provider runs on its defaults
|
|
1541
|
+
* provider runs on its defaults.
|
|
1296
1542
|
*/
|
|
1297
1543
|
config?: CheckoutConfig;
|
|
1298
1544
|
/**
|
|
@@ -1315,22 +1561,29 @@ interface CheckoutContainerProps {
|
|
|
1315
1561
|
* assigns to `const exhaustive: never`, so a new offer type is a compile error
|
|
1316
1562
|
* here as well as in {@link CheckoutConfig}.
|
|
1317
1563
|
*
|
|
1318
|
-
* ## One mount, one offer, one chain, one side
|
|
1319
|
-
*
|
|
1320
|
-
* `offer`, `chain
|
|
1321
|
-
* the mount. Each provider's viewmodel owns a step machine
|
|
1322
|
-
* authorized, how much is being spent
|
|
1323
|
-
* it was made against: a Superstate wallet authorization
|
|
1324
|
-
* offer, and an ERC-20 approval is granted per chain, for
|
|
1325
|
-
* Changing any of
|
|
1326
|
-
* it was never made for
|
|
1327
|
-
* approval covers the coin the *old* direction spent. So the
|
|
1328
|
-
* try to: `side` is read once into state and later values
|
|
1329
|
-
* swap could also land mid-execution, between an approval and the broadcast it
|
|
1564
|
+
* ## One mount, one offer, one chain, one side, one preselected wallet
|
|
1565
|
+
*
|
|
1566
|
+
* `offer`, `chain`, the `side`, the `optionId` and `wallets.preselected` are read as fixed for
|
|
1567
|
+
* the lifetime of the mount. Each provider's viewmodel owns a step machine -
|
|
1568
|
+
* which wallet was authorized, how much is being spent - and that progress is
|
|
1569
|
+
* bound to the order it was made against: a Superstate wallet authorization
|
|
1570
|
+
* is allow-listed per offer, and an ERC-20 approval is granted per chain, for
|
|
1571
|
+
* one specific token. Changing any of them in place would carry a completed
|
|
1572
|
+
* step onto an order it was never made for - a flipped side most sharply of
|
|
1573
|
+
* all, since the approval covers the coin the *old* direction spent. So the
|
|
1574
|
+
* container does not try to: `side` is read once into state and later values
|
|
1575
|
+
* are ignored. A swap could also land mid-execution, between an approval and the broadcast it
|
|
1330
1576
|
* was granted for, which is worse than not switching at all.
|
|
1331
1577
|
*
|
|
1332
|
-
*
|
|
1333
|
-
*
|
|
1578
|
+
* The preselected wallet is the same kind of progress: whether the flow has a
|
|
1579
|
+
* wallet step at all is decided from it at mount, and the approval that
|
|
1580
|
+
* follows is granted by that wallet. The rest of `wallets` stays live - a
|
|
1581
|
+
* newly connected external wallet appears as a row without a remount.
|
|
1582
|
+
*
|
|
1583
|
+
* **To render a different offer, chain, side, option or preselected wallet, remount
|
|
1584
|
+
* rather than reassign** - give the container a `key` that changes with them
|
|
1585
|
+
* (add `wallets.preselected?.address` to it if the host's preselection can
|
|
1586
|
+
* change on one page):
|
|
1334
1587
|
*
|
|
1335
1588
|
* ```tsx
|
|
1336
1589
|
* <CheckoutContainer
|
|
@@ -1355,7 +1608,7 @@ interface CheckoutContainerProps {
|
|
|
1355
1608
|
*
|
|
1356
1609
|
* ```tsx
|
|
1357
1610
|
* const config: CheckoutConfig = {
|
|
1358
|
-
* '
|
|
1611
|
+
* 'ondo::swap': { onOrderConfirmed: (order) => track(order) },
|
|
1359
1612
|
* };
|
|
1360
1613
|
*
|
|
1361
1614
|
* // The sell page. The buy page leaves `side` out.
|
|
@@ -1364,7 +1617,8 @@ interface CheckoutContainerProps {
|
|
|
1364
1617
|
*
|
|
1365
1618
|
* A sell page reached from a position also knows which wallet holds it, so it
|
|
1366
1619
|
* usually sets {@link CheckoutWalletSelection.preselected} and opens on the
|
|
1367
|
-
* amount.
|
|
1620
|
+
* amount. A buy page can do the same whenever the host has one answer - a
|
|
1621
|
+
* single embedded wallet, say.
|
|
1368
1622
|
*
|
|
1369
1623
|
* ### A buy/sell toggle on one page
|
|
1370
1624
|
*
|
|
@@ -1398,7 +1652,7 @@ interface CheckoutContainerProps {
|
|
|
1398
1652
|
* toggle where it can reach an executing flow — disable the tabs once the
|
|
1399
1653
|
* user is past the amount step, or confirm before switching.
|
|
1400
1654
|
*/
|
|
1401
|
-
declare function CheckoutContainer({ offer, chain, side, wallets, config, enabled, className, }: CheckoutContainerProps): ReactNode;
|
|
1655
|
+
declare function CheckoutContainer({ offer, chain, side, optionId, wallets, config, enabled, className, }: CheckoutContainerProps): ReactNode;
|
|
1402
1656
|
|
|
1403
1657
|
/**
|
|
1404
1658
|
* The claim card.
|
|
@@ -1616,6 +1870,9 @@ declare function useCentrifugeVaultClaimViewModel({ offer, wallets, walletLabel,
|
|
|
1616
1870
|
* `CheckoutConfig`: a provider with nothing the host must decide asks for
|
|
1617
1871
|
* nothing. Per-integration, not per-offer: a host builds it once.
|
|
1618
1872
|
*
|
|
1873
|
+
* `coinlist::token_sale` has no entry: its card only follows participations,
|
|
1874
|
+
* so there is nothing for a host to decide or to hear about.
|
|
1875
|
+
*
|
|
1619
1876
|
* @alpha
|
|
1620
1877
|
*/
|
|
1621
1878
|
type ClaimConfig = {
|
|
@@ -1634,14 +1891,15 @@ type CentrifugeVaultClaimConfig = {
|
|
|
1634
1891
|
/** @alpha */
|
|
1635
1892
|
interface ClaimContainerProps {
|
|
1636
1893
|
/**
|
|
1637
|
-
* The async offer whose
|
|
1894
|
+
* The async offer whose second leg to show. Its `type` decides which
|
|
1638
1895
|
* provider renders. Narrow an `OfferDetail` with `AsyncOfferDetail.is`.
|
|
1639
1896
|
*/
|
|
1640
1897
|
offer: AsyncOfferDetail;
|
|
1641
1898
|
/**
|
|
1642
1899
|
* The wallets to read positions for and claim from, and the host's
|
|
1643
1900
|
* external-wallet connector. Pass `externalAdapter: null` to hide the
|
|
1644
|
-
* connect affordance.
|
|
1901
|
+
* connect affordance. A token sale's participations are listed for the
|
|
1902
|
+
* whole account, whichever wallet paid, so it reads none of these.
|
|
1645
1903
|
*/
|
|
1646
1904
|
wallets: WalletSelection;
|
|
1647
1905
|
/**
|
|
@@ -1663,13 +1921,20 @@ interface ClaimContainerProps {
|
|
|
1663
1921
|
}
|
|
1664
1922
|
/**
|
|
1665
1923
|
* The plug-and-play claim card: hand it an async offer and it renders the
|
|
1666
|
-
* right provider's
|
|
1667
|
-
* claim that collects them.
|
|
1924
|
+
* right provider's second leg.
|
|
1668
1925
|
*
|
|
1669
1926
|
* The second leg of an async trade. The user placed a request earlier, the
|
|
1670
|
-
*
|
|
1671
|
-
* - to
|
|
1672
|
-
* checkout step.
|
|
1927
|
+
* other side fills it on its own schedule, and they come back - days or
|
|
1928
|
+
* weeks later - to see how it went. So the card is its own entry on the offer
|
|
1929
|
+
* page rather than a checkout step. What it shows is the provider's:
|
|
1930
|
+
*
|
|
1931
|
+
* - `centrifuge::vault`: each wallet's pending and claimable positions, and
|
|
1932
|
+
* the claim that collects a filled one.
|
|
1933
|
+
* - `coinlist::token_sale`: the user's participations and where each one
|
|
1934
|
+
* stands. Nothing is claimed - the sale pushes the tokens it allocates
|
|
1935
|
+
* once it settles, and refunds what it does not use - and the list is
|
|
1936
|
+
* polled, so an order placed in `CheckoutContainer` on the same page shows
|
|
1937
|
+
* up on its own.
|
|
1673
1938
|
*
|
|
1674
1939
|
* Only the matching provider's container is mounted, so its viewmodel is the
|
|
1675
1940
|
* only one that runs. The `switch` is exhaustive against
|
|
@@ -1692,209 +1957,6 @@ interface ClaimContainerProps {
|
|
|
1692
1957
|
*/
|
|
1693
1958
|
declare function ClaimContainer({ offer, wallets, walletLabel, config, enabled, className, }: ClaimContainerProps): ReactNode;
|
|
1694
1959
|
|
|
1695
|
-
/**
|
|
1696
|
-
* What the grid fetches, pre-fetched on the server instead. Each half is
|
|
1697
|
-
* independent: seed `offers` (via `CoinListServer#offers.list()`) and the
|
|
1698
|
-
* client still fetches the registry, seed `tokens` (via
|
|
1699
|
-
* `CoinListServer#tokens.list()`) and it still fetches the offers, seed both
|
|
1700
|
-
* and the grid makes no request of its own.
|
|
1701
|
-
*/
|
|
1702
|
-
interface OffersGridData {
|
|
1703
|
-
offers?: Offer[];
|
|
1704
|
-
tokens?: TokenMetadata[];
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
interface OffersGridContainerProps {
|
|
1708
|
-
/** Maximum number of columns to render when horizontal space allows. */
|
|
1709
|
-
maxColumns?: number;
|
|
1710
|
-
/** Optional className applied to the grid element. */
|
|
1711
|
-
className?: string;
|
|
1712
|
-
/** Optional className applied to the outer wrapper element. */
|
|
1713
|
-
containerClassName?: string;
|
|
1714
|
-
/** Optional loading slot shown while offers are being fetched. */
|
|
1715
|
-
loading?: ReactNode;
|
|
1716
|
-
/** Optional error slot shown when loading offers fails. */
|
|
1717
|
-
error?: ReactNode;
|
|
1718
|
-
/** Optional empty state slot shown when there are no available offers. */
|
|
1719
|
-
emptyState?: ReactNode;
|
|
1720
|
-
/** Optional per-offer click handler; when omitted, cards are not clickable. */
|
|
1721
|
-
onOfferClick?: (offer: Offer) => void;
|
|
1722
|
-
/**
|
|
1723
|
-
* What the grid would otherwise fetch, pre-fetched on the server: `offers`
|
|
1724
|
-
* via `CoinListServer#offers.list()`, `tokens` via
|
|
1725
|
-
* `CoinListServer#tokens.list()`. Each half skips its own client-side
|
|
1726
|
-
* fetch; pass both for a grid that makes no request of its own.
|
|
1727
|
-
*/
|
|
1728
|
-
data?: OffersGridData;
|
|
1729
|
-
/**
|
|
1730
|
-
* Default `true`. When `false` nothing is fetched, so the container can be
|
|
1731
|
-
* mounted while the grid is not needed yet.
|
|
1732
|
-
*/
|
|
1733
|
-
enabled?: boolean;
|
|
1734
|
-
}
|
|
1735
|
-
/**
|
|
1736
|
-
* Displays a responsive live-sale grid of {@link OfferSaleCard}, backed by
|
|
1737
|
-
* {@link useOffersGridViewModel}. Each card is named and illustrated by the
|
|
1738
|
-
* public token registry where it lists the offer's token, and by the offer's
|
|
1739
|
-
* own fields otherwise - list offers carry no display name, so an unlisted
|
|
1740
|
-
* one shows logo + tagline until the host maps from detail. For equities /
|
|
1741
|
-
* past-sales browse rows, compose {@link OffersAssetGrid} instead.
|
|
1742
|
-
*
|
|
1743
|
-
* Pass `data` (offers and tokens pre-fetched server-side) to use them as-is
|
|
1744
|
-
* and skip the client-side fetches. Pass `enabled={false}` to skip the fetches
|
|
1745
|
-
* when the container is mounted but the grid is not needed yet. Uses the
|
|
1746
|
-
* `loading` / `error` / `emptyState` slots when provided; otherwise renders
|
|
1747
|
-
* the standard fallbacks. Cards are interactive only when `onOfferClick` is
|
|
1748
|
-
* provided.
|
|
1749
|
-
*
|
|
1750
|
-
* Self-scoped: renders fully styled on its own, with no `CoinListStyleScope`
|
|
1751
|
-
* needed.
|
|
1752
|
-
*/
|
|
1753
|
-
declare function OffersGridContainer({ data, onOfferClick, enabled, ...viewProps }?: OffersGridContainerProps): ReactNode;
|
|
1754
|
-
|
|
1755
|
-
/**
|
|
1756
|
-
* One image as an `<img>` renders it: a `src` for a consumer that takes a
|
|
1757
|
-
* single URL, and the `srcSet` candidates for one that also knows the size
|
|
1758
|
-
* it renders at. `srcSet` is absent for a vector logo and for the offer's own
|
|
1759
|
-
* artwork, neither of which offers the browser a choice.
|
|
1760
|
-
*/
|
|
1761
|
-
type LogoImageUi = {
|
|
1762
|
-
src: string;
|
|
1763
|
-
srcSet?: string;
|
|
1764
|
-
};
|
|
1765
|
-
/**
|
|
1766
|
-
* The logo a catalogue card renders for an offer, with the registry's
|
|
1767
|
-
* dark-theme counterpart when it configures one.
|
|
1768
|
-
*
|
|
1769
|
-
* `dark` is `null` rather than absent so a renderer has to decide what to do
|
|
1770
|
-
* without one: fall back to `light`, which is the registry's own rule.
|
|
1771
|
-
*/
|
|
1772
|
-
type OfferLogoUi = {
|
|
1773
|
-
light: LogoImageUi;
|
|
1774
|
-
dark: LogoImageUi | null;
|
|
1775
|
-
};
|
|
1776
|
-
declare const OfferLogoUi: {
|
|
1777
|
-
/**
|
|
1778
|
-
* The registry's logo for the token an offer is about, or the offer's own
|
|
1779
|
-
* artwork otherwise, or `null` when neither exists.
|
|
1780
|
-
*
|
|
1781
|
-
* The registry wins when both exist because it is the token's real artwork
|
|
1782
|
-
* where `Offer.logoUrl` is catalogue artwork, and because a swap publishes
|
|
1783
|
-
* without artwork more often than not - which is why `logoUrl` is `null`
|
|
1784
|
-
* on the swap variants.
|
|
1785
|
-
*/
|
|
1786
|
-
fromOffer: (offer: {
|
|
1787
|
-
logoUrl: string | null;
|
|
1788
|
-
}, tokenMetadata: TokenMetadata | null) => OfferLogoUi | null;
|
|
1789
|
-
};
|
|
1790
|
-
|
|
1791
|
-
/**
|
|
1792
|
-
* An offer as {@link OfferAssetCard} renders it. Browse chrome: circular
|
|
1793
|
-
* `logo`, `name`, and asset `symbol`. No wordmark.
|
|
1794
|
-
*
|
|
1795
|
-
* All three come from the public token registry when the caller hands over
|
|
1796
|
-
* the metadata of the token the offer is about. Without it, `fromOffer`
|
|
1797
|
-
* omits `name` and `symbol` - the list payload has neither - so a list-mapped
|
|
1798
|
-
* card is honest about being logo-only, and `fromDetail` reads them from the
|
|
1799
|
-
* detail payload (`name`, `asset.code`).
|
|
1800
|
-
*/
|
|
1801
|
-
type OfferAssetCardUi = {
|
|
1802
|
-
id: OfferId;
|
|
1803
|
-
/** Absent when neither the registry nor a detail payload names the offer. */
|
|
1804
|
-
name?: string;
|
|
1805
|
-
/** Absent when neither the registry nor a detail payload carries a ticker. */
|
|
1806
|
-
symbol?: string;
|
|
1807
|
-
/** `null` when neither the registry nor the offer carries artwork. */
|
|
1808
|
-
logo: OfferLogoUi | null;
|
|
1809
|
-
};
|
|
1810
|
-
declare const OfferAssetCardUi: {
|
|
1811
|
-
/**
|
|
1812
|
-
* `tokenMetadata` is the registry's entry for the token the offer is about
|
|
1813
|
-
* (`TokenRegistrySnapshot.forOffer`), or `null` when it lists none. The
|
|
1814
|
-
* registry names win over the offer's own where both exist: they are the
|
|
1815
|
-
* token's canonical name, ticker and artwork, where the offer's are
|
|
1816
|
-
* catalogue copy.
|
|
1817
|
-
*/
|
|
1818
|
-
fromOffer: (offer: Offer, tokenMetadata?: TokenMetadata | null) => OfferAssetCardUi;
|
|
1819
|
-
fromDetail: (detail: OfferDetail, tokenMetadata?: TokenMetadata | null) => OfferAssetCardUi;
|
|
1820
|
-
};
|
|
1821
|
-
|
|
1822
|
-
interface OfferAssetCardProps {
|
|
1823
|
-
offer: OfferAssetCardUi;
|
|
1824
|
-
/** When set, the whole card is the hit target. */
|
|
1825
|
-
onClick?: () => void;
|
|
1826
|
-
/** Optional className applied to the card root element. */
|
|
1827
|
-
className?: string;
|
|
1828
|
-
/** Optional className applied to an outer wrapper element. */
|
|
1829
|
-
containerClassName?: string;
|
|
1830
|
-
}
|
|
1831
|
-
/**
|
|
1832
|
-
* Light browse-row catalogue card. Self-scoped. Header is the offer's `logo`
|
|
1833
|
-
* (the token registry's where it lists the token, with its dark-theme
|
|
1834
|
-
* variant, the catalogue's otherwise) beside `name` (h2) and asset `symbol`
|
|
1835
|
-
* under it — not a wordmark.
|
|
1836
|
-
* Responsive hug: tighter pad / logo / type below `md`, desktop keeps the
|
|
1837
|
-
* H4 + 48px logo row. Hosts compose this beside {@link OfferSaleCard}; the
|
|
1838
|
-
* card does not pick a variant itself.
|
|
1839
|
-
*/
|
|
1840
|
-
declare function OfferAssetCard({ offer, onClick, className, containerClassName, }: OfferAssetCardProps): ReactNode;
|
|
1841
|
-
|
|
1842
|
-
/**
|
|
1843
|
-
* An offer as {@link OfferSaleCard} renders it. Countdown copy is derived in
|
|
1844
|
-
* the leaf from `startsAt` / `endsAt` so it can tick; the mapper does not
|
|
1845
|
-
* invent a price, FDV, unlock schedule, banner overlay, or wordmark.
|
|
1846
|
-
*
|
|
1847
|
-
* `name` and `logo` come from the public token registry when the caller
|
|
1848
|
-
* hands over the metadata of the token the offer is about, and from the
|
|
1849
|
-
* offer otherwise. The list payload carries no name, so `fromOffer` leaves
|
|
1850
|
-
* `name` absent without registry metadata - do not derive one from `slug`.
|
|
1851
|
-
* The card pairs `logo` with `name` as an h2 and renders each only when
|
|
1852
|
-
* present. Prefer {@link OfferSaleCardUi.fromDetail} when the host has a
|
|
1853
|
-
* name and no registry answer.
|
|
1854
|
-
*
|
|
1855
|
-
* `tagline` and `startsAt` are null for an offer that runs no sale window, an
|
|
1856
|
-
* Ondo swap: the card then omits the tagline and, with nothing to count down
|
|
1857
|
-
* to, reads as live.
|
|
1858
|
-
*/
|
|
1859
|
-
type OfferSaleCardUi = {
|
|
1860
|
-
id: OfferId;
|
|
1861
|
-
/** Absent when neither the registry nor a detail payload names the offer. */
|
|
1862
|
-
name?: string;
|
|
1863
|
-
tagline: string | null;
|
|
1864
|
-
/** `null` when neither the registry nor the offer carries artwork. */
|
|
1865
|
-
logo: OfferLogoUi | null;
|
|
1866
|
-
startsAt: Date | null;
|
|
1867
|
-
endsAt: Date | null;
|
|
1868
|
-
};
|
|
1869
|
-
declare const OfferSaleCardUi: {
|
|
1870
|
-
/**
|
|
1871
|
-
* `tokenMetadata` is the registry's entry for the token the offer is about
|
|
1872
|
-
* (`TokenRegistrySnapshot.forOffer`), or `null` when it lists none. The
|
|
1873
|
-
* registry names win over the offer's own where both exist: they are the
|
|
1874
|
-
* token's canonical name and artwork, where the offer's are catalogue copy.
|
|
1875
|
-
*/
|
|
1876
|
-
fromOffer: (offer: Offer, tokenMetadata?: TokenMetadata | null) => OfferSaleCardUi;
|
|
1877
|
-
fromDetail: (detail: OfferDetail, tokenMetadata?: TokenMetadata | null) => OfferSaleCardUi;
|
|
1878
|
-
};
|
|
1879
|
-
|
|
1880
|
-
interface OfferSaleCardProps {
|
|
1881
|
-
offer: OfferSaleCardUi;
|
|
1882
|
-
/** Host click handler. View offer always renders; this wires the hit target. */
|
|
1883
|
-
onClick?: () => void;
|
|
1884
|
-
/** Optional className applied to the card root element. */
|
|
1885
|
-
className?: string;
|
|
1886
|
-
/** Optional className applied to an outer wrapper element. */
|
|
1887
|
-
containerClassName?: string;
|
|
1888
|
-
}
|
|
1889
|
-
/**
|
|
1890
|
-
* Dark live-sale catalogue card. Self-scoped. Header is the offer's `logo`
|
|
1891
|
-
* (the token registry's where it lists the token, the catalogue's otherwise)
|
|
1892
|
-
* beside the `name` as an h2, then the tagline — not a wordmark. The same
|
|
1893
|
-
* logo is painted as a faint right-shifted watermark over the gradient.
|
|
1894
|
-
* Responsive hug layout; View offer always renders. No token price, FDV or unlock.
|
|
1895
|
-
*/
|
|
1896
|
-
declare function OfferSaleCard({ offer, onClick, className, containerClassName, }: OfferSaleCardProps): ReactNode;
|
|
1897
|
-
|
|
1898
1960
|
type LoadRequirementsReason = 'not-authenticated' | 'generic-error';
|
|
1899
1961
|
type LoadRequirementsState = {
|
|
1900
1962
|
type: 'LOADING';
|
|
@@ -2325,39 +2387,334 @@ interface UseCompleteOAuthOptions {
|
|
|
2325
2387
|
*/
|
|
2326
2388
|
declare function useCompleteOAuth(options: UseCompleteOAuthOptions): void;
|
|
2327
2389
|
|
|
2390
|
+
type LoadOfferDetailsReason = 'not-authenticated' | 'generic-error';
|
|
2391
|
+
type LoadOfferDetailsState = {
|
|
2392
|
+
type: 'LOADING';
|
|
2393
|
+
} | {
|
|
2394
|
+
type: 'ERROR';
|
|
2395
|
+
reason: LoadOfferDetailsReason;
|
|
2396
|
+
} | {
|
|
2397
|
+
type: 'CONTENT';
|
|
2398
|
+
offerDetail: OfferDetail;
|
|
2399
|
+
};
|
|
2400
|
+
interface UseOfferDetailsOptions {
|
|
2401
|
+
/**
|
|
2402
|
+
* Offer detail pre-fetched on the server (e.g. via `CoinListServer#offers.get()`).
|
|
2403
|
+
* When provided, the hook uses this data as-is and skips the client-side fetch entirely.
|
|
2404
|
+
*/
|
|
2405
|
+
data?: OfferDetail;
|
|
2406
|
+
/**
|
|
2407
|
+
* When `false`, the hook sends no request. A seeded or already-fetched
|
|
2408
|
+
* `CONTENT` survives; otherwise the hook stays `LOADING`. Defaults to `true`.
|
|
2409
|
+
*/
|
|
2410
|
+
enabled?: boolean;
|
|
2411
|
+
}
|
|
2412
|
+
interface UseOfferDetailsResult {
|
|
2413
|
+
offerDetailsState: LoadOfferDetailsState;
|
|
2414
|
+
}
|
|
2328
2415
|
/**
|
|
2329
|
-
*
|
|
2330
|
-
* that provider's `use{X}ViewModel.types`; these live here because Ondo and
|
|
2331
|
-
* Superstate both render them.
|
|
2332
|
-
*
|
|
2333
|
-
* Models only. A screen's `{X}UiState` and `{X}UiEvent` stay in that screen's
|
|
2334
|
-
* `use{X}ViewModel.types` even when two providers' happen to agree today: a
|
|
2335
|
-
* state machine is where providers diverge, and sharing one would make the
|
|
2336
|
-
* divergence a breaking change rather than a local edit. Ondo's wallet step
|
|
2337
|
-
* confirms synchronously and Superstate's allow-lists on-chain, from the same
|
|
2338
|
-
* rows and the same models.
|
|
2416
|
+
* Loads CoinList offer details for a given offer id and exposes a UI-friendly state.
|
|
2339
2417
|
*
|
|
2340
|
-
*
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
* The state of a step's call-to-action.
|
|
2418
|
+
* Pass `data` (pre-fetched server-side) to use that data as-is and skip
|
|
2419
|
+
* the client-side fetch entirely. Pass `enabled: false` to skip the fetch
|
|
2420
|
+
* when the hook must be called but the data is not needed yet.
|
|
2344
2421
|
*
|
|
2345
|
-
*
|
|
2346
|
-
*
|
|
2347
|
-
*
|
|
2348
|
-
*
|
|
2422
|
+
* Returns `LOADING` while CoinList is initializing or while details are being fetched.
|
|
2423
|
+
* Returns `CONTENT` with the offer when `offers.get()` succeeds.
|
|
2424
|
+
* Returns `ERROR` with:
|
|
2425
|
+
* - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
|
|
2426
|
+
* - `generic-error` for any other failure
|
|
2349
2427
|
*/
|
|
2350
|
-
|
|
2351
|
-
|
|
2428
|
+
declare function useOfferDetails(offerId: OfferId, options?: UseOfferDetailsOptions): UseOfferDetailsResult;
|
|
2429
|
+
|
|
2430
|
+
type LoadOffersReason = 'not-authenticated' | 'generic-error';
|
|
2431
|
+
type LoadOffersState = {
|
|
2432
|
+
type: 'LOADING';
|
|
2352
2433
|
} | {
|
|
2353
|
-
type: '
|
|
2434
|
+
type: 'ERROR';
|
|
2435
|
+
reason: LoadOffersReason;
|
|
2354
2436
|
} | {
|
|
2355
|
-
type: '
|
|
2356
|
-
|
|
2437
|
+
type: 'CONTENT';
|
|
2438
|
+
offers: Offer[];
|
|
2357
2439
|
};
|
|
2440
|
+
interface UseOffersOptions {
|
|
2441
|
+
/**
|
|
2442
|
+
* Offers pre-fetched on the server (e.g. via `CoinListServer#offers.list()`).
|
|
2443
|
+
* When provided, the hook uses this data as-is and skips the client-side fetch entirely.
|
|
2444
|
+
*/
|
|
2445
|
+
data?: Offer[];
|
|
2446
|
+
/**
|
|
2447
|
+
* When `false`, the hook sends no request. A seeded or already-fetched
|
|
2448
|
+
* `CONTENT` survives; otherwise the hook stays `LOADING`. Defaults to `true`.
|
|
2449
|
+
*/
|
|
2450
|
+
enabled?: boolean;
|
|
2451
|
+
}
|
|
2452
|
+
interface UseOffersResult {
|
|
2453
|
+
offersState: LoadOffersState;
|
|
2454
|
+
}
|
|
2358
2455
|
/**
|
|
2359
|
-
*
|
|
2360
|
-
*
|
|
2456
|
+
* Loads all CoinList offers for the current user and exposes a UI-friendly state.
|
|
2457
|
+
*
|
|
2458
|
+
* Pass `data` (pre-fetched server-side) to use that data as-is and skip
|
|
2459
|
+
* the client-side fetch entirely. Pass `enabled: false` to skip the fetch
|
|
2460
|
+
* when the hook must be called but the data is not needed yet.
|
|
2461
|
+
*
|
|
2462
|
+
* Returns `LOADING` while CoinList is initializing or while offers are being fetched.
|
|
2463
|
+
* Returns `CONTENT` with all offers when `fetchOffers()` succeeds.
|
|
2464
|
+
* Returns `ERROR` with:
|
|
2465
|
+
* - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
|
|
2466
|
+
* - `generic-error` for any other failure
|
|
2467
|
+
*/
|
|
2468
|
+
declare function useOffers(options?: UseOffersOptions): UseOffersResult;
|
|
2469
|
+
|
|
2470
|
+
/**
|
|
2471
|
+
* Why a read failed, in the only two flavours every UI acts on differently.
|
|
2472
|
+
*
|
|
2473
|
+
* `not-authenticated` is split out because no retry helps until the user
|
|
2474
|
+
* signs in, and because the remedy is one the UI can name. Everything else
|
|
2475
|
+
* collapses into `generic-error` and is offered a retry. A provider that has a
|
|
2476
|
+
* third remedy of its own - Ondo's closed market - widens this union rather
|
|
2477
|
+
* than restating it.
|
|
2478
|
+
*/
|
|
2479
|
+
type LoadErrorReason = 'not-authenticated' | 'generic-error';
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* Why a Centrifuge read failed. Centrifuge has no remedy of its own to add,
|
|
2483
|
+
* so this is {@link LoadErrorReason} under the name its states already
|
|
2484
|
+
* publish, classified by `loadErrorReason`.
|
|
2485
|
+
*
|
|
2486
|
+
* @alpha
|
|
2487
|
+
*/
|
|
2488
|
+
type CentrifugeLoadErrorReason = LoadErrorReason;
|
|
2489
|
+
|
|
2490
|
+
/**
|
|
2491
|
+
* The state of one vault's status poll.
|
|
2492
|
+
*
|
|
2493
|
+
* Stale-preserving: a failed tick with a status in hand keeps it, so a flaky
|
|
2494
|
+
* read never reads as "vault halted". `ERROR` means the status is unknown -
|
|
2495
|
+
* which is not the same as `CONTENT` carrying a blocked orderability, and
|
|
2496
|
+
* callers must not conflate them. A vault that is *known* to be unorderable
|
|
2497
|
+
* may block a request; one that is merely unknown may not.
|
|
2498
|
+
*
|
|
2499
|
+
* `below_minimum` never appears here: it needs an amount, which this
|
|
2500
|
+
* endpoint is never given.
|
|
2501
|
+
*
|
|
2502
|
+
* @alpha
|
|
2503
|
+
*/
|
|
2504
|
+
type LoadCentrifugeVaultStatusState = {
|
|
2505
|
+
type: 'DISABLED';
|
|
2506
|
+
} | {
|
|
2507
|
+
type: 'LOADING';
|
|
2508
|
+
} | {
|
|
2509
|
+
type: 'ERROR';
|
|
2510
|
+
reason: CentrifugeLoadErrorReason;
|
|
2511
|
+
} | {
|
|
2512
|
+
type: 'CONTENT';
|
|
2513
|
+
status: CentrifugeVaultStatus;
|
|
2514
|
+
};
|
|
2515
|
+
/** @alpha */
|
|
2516
|
+
interface UseCentrifugeVaultStatusesOptions {
|
|
2517
|
+
/** The vaults to poll, typically one per chain an offer runs on. */
|
|
2518
|
+
vaults: CentrifugeVaultRef[];
|
|
2519
|
+
/** How often to refresh. Defaults to {@link CENTRIFUGE_POLL_INTERVAL_MS}. */
|
|
2520
|
+
pollIntervalMs?: number;
|
|
2521
|
+
/**
|
|
2522
|
+
* Statuses the caller already holds, typically fetched server-side, each
|
|
2523
|
+
* opening the state of the vault it names so a server-rendered panel needs
|
|
2524
|
+
* no loading pass.
|
|
2525
|
+
*
|
|
2526
|
+
* They seed the first render only: the poll still fetches immediately. A
|
|
2527
|
+
* vault that was orderable a minute ago can be unlinked now, so a seed
|
|
2528
|
+
* that suppressed the first read would be answering "can I act right now"
|
|
2529
|
+
* with whenever the page was rendered.
|
|
2530
|
+
*/
|
|
2531
|
+
data?: CentrifugeVaultStatus[];
|
|
2532
|
+
/** When false, the hook neither fetches nor polls. */
|
|
2533
|
+
enabled: boolean;
|
|
2534
|
+
}
|
|
2535
|
+
/** @alpha */
|
|
2536
|
+
interface UseCentrifugeVaultStatusesResult {
|
|
2537
|
+
/** One entry per vault asked for, in the order asked. */
|
|
2538
|
+
statuses: {
|
|
2539
|
+
vault: CentrifugeVaultRef;
|
|
2540
|
+
state: LoadCentrifugeVaultStatusState;
|
|
2541
|
+
}[];
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Polls whether each of several Centrifuge vaults can be acted on right now,
|
|
2545
|
+
* independent of any wallet or amount.
|
|
2546
|
+
*
|
|
2547
|
+
* Free to poll - it spends no attestation. Centrifuge announces none of the
|
|
2548
|
+
* changes this reports, so the poll is the only way a screen notices a vault
|
|
2549
|
+
* halting under it. Each vault is read independently on one shared timer, so
|
|
2550
|
+
* one failing chain never holds back another.
|
|
2551
|
+
*
|
|
2552
|
+
* A seeded status opens its vault's state instead of `LOADING` and is
|
|
2553
|
+
* otherwise left to the poll: the first tick fires as it always does, and
|
|
2554
|
+
* only replaces the seed once it has a status of its own.
|
|
2555
|
+
*
|
|
2556
|
+
* Disabled it neither fetches nor holds a timer. A vault with no status in
|
|
2557
|
+
* hand reports `DISABLED`, not an empty `CONTENT`: there is no empty vault
|
|
2558
|
+
* status, and an invented one would be worse than none, since `CONTENT` here
|
|
2559
|
+
* is what a caller is allowed to block on. A status already in hand survives
|
|
2560
|
+
* being switched off.
|
|
2561
|
+
*
|
|
2562
|
+
* @alpha
|
|
2563
|
+
*/
|
|
2564
|
+
declare function useCentrifugeVaultStatuses(options: UseCentrifugeVaultStatusesOptions): UseCentrifugeVaultStatusesResult;
|
|
2565
|
+
|
|
2566
|
+
/** @alpha */
|
|
2567
|
+
interface UseCentrifugeVaultStatusOptions {
|
|
2568
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
2569
|
+
symbol: AssetSymbol;
|
|
2570
|
+
chain: EthereumChain;
|
|
2571
|
+
/** How often to refresh. Defaults to `CENTRIFUGE_POLL_INTERVAL_MS`. */
|
|
2572
|
+
pollIntervalMs?: number;
|
|
2573
|
+
/**
|
|
2574
|
+
* A status the caller already holds, typically fetched server-side, used
|
|
2575
|
+
* as the state the hook opens on so a server-rendered panel needs no
|
|
2576
|
+
* loading pass.
|
|
2577
|
+
*
|
|
2578
|
+
* It seeds the first render only: the poll still fetches immediately. A
|
|
2579
|
+
* vault that was orderable a minute ago can be unlinked now, so a seed
|
|
2580
|
+
* that suppressed the first read would be answering "can I invest right
|
|
2581
|
+
* now" with whenever the page was rendered.
|
|
2582
|
+
*/
|
|
2583
|
+
data?: CentrifugeVaultStatus;
|
|
2584
|
+
/** When false, the hook neither fetches nor polls. */
|
|
2585
|
+
enabled: boolean;
|
|
2586
|
+
}
|
|
2587
|
+
/** @alpha */
|
|
2588
|
+
interface UseCentrifugeVaultStatusResult {
|
|
2589
|
+
state: LoadCentrifugeVaultStatusState;
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Polls whether a Centrifuge vault can take a request at all right now,
|
|
2593
|
+
* independent of any amount.
|
|
2594
|
+
*
|
|
2595
|
+
* Free to poll - it spends no attestation. Centrifuge announces none of the
|
|
2596
|
+
* changes this reports, so the poll is the only way a checkout notices
|
|
2597
|
+
* mid-order.
|
|
2598
|
+
*
|
|
2599
|
+
* The one-vault case of {@link useCentrifugeVaultStatuses}, which carries the
|
|
2600
|
+
* seeding, stale-preserving and disabled semantics.
|
|
2601
|
+
*
|
|
2602
|
+
* @alpha
|
|
2603
|
+
*/
|
|
2604
|
+
declare function useCentrifugeVaultStatus(options: UseCentrifugeVaultStatusOptions): UseCentrifugeVaultStatusResult;
|
|
2605
|
+
|
|
2606
|
+
/**
|
|
2607
|
+
* The state of the participations read.
|
|
2608
|
+
*
|
|
2609
|
+
* Stale-preserving: a failed poll with a list in hand keeps it, so a flaky
|
|
2610
|
+
* tick never empties the user's orders. `ERROR` therefore means nothing has
|
|
2611
|
+
* answered yet - or the session ended, which drops the list rather than
|
|
2612
|
+
* leaving a signed-out user looking at it. `DISABLED` means the hook was
|
|
2613
|
+
* switched off before an answer arrived, so nothing is in flight.
|
|
2614
|
+
*/
|
|
2615
|
+
type LoadCoinListTokenSaleParticipationsState = {
|
|
2616
|
+
type: 'DISABLED';
|
|
2617
|
+
} | {
|
|
2618
|
+
type: 'LOADING';
|
|
2619
|
+
} | {
|
|
2620
|
+
type: 'ERROR';
|
|
2621
|
+
reason: LoadErrorReason;
|
|
2622
|
+
} | {
|
|
2623
|
+
type: 'CONTENT';
|
|
2624
|
+
participations: Participation[];
|
|
2625
|
+
};
|
|
2626
|
+
interface UseCoinListTokenSaleParticipationsOptions {
|
|
2627
|
+
/**
|
|
2628
|
+
* Participations pre-fetched on the server (e.g. via
|
|
2629
|
+
* `CoinListServer#tokenSale.list()`). When provided, the hook opens on them
|
|
2630
|
+
* and skips the first client-side read; the poll and
|
|
2631
|
+
* {@link UseCoinListTokenSaleParticipationsResult.refetch} still read.
|
|
2632
|
+
*/
|
|
2633
|
+
data?: Participation[];
|
|
2634
|
+
/**
|
|
2635
|
+
* When `false`, the hook sends no request and holds no timer. A seeded or
|
|
2636
|
+
* already-fetched `CONTENT` survives; otherwise the hook reports
|
|
2637
|
+
* `DISABLED`. Defaults to `true`.
|
|
2638
|
+
*/
|
|
2639
|
+
enabled?: boolean;
|
|
2640
|
+
/** How often to read again while the page is visible. Defaults to 15s. */
|
|
2641
|
+
pollInterval?: Seconds;
|
|
2642
|
+
}
|
|
2643
|
+
interface UseCoinListTokenSaleParticipationsResult {
|
|
2644
|
+
participationsState: LoadCoinListTokenSaleParticipationsState;
|
|
2645
|
+
/**
|
|
2646
|
+
* Reads again now: the recovery path after an `ERROR`, and the way past a
|
|
2647
|
+
* server seed. No-op while disabled.
|
|
2648
|
+
*/
|
|
2649
|
+
refetch: () => void;
|
|
2650
|
+
}
|
|
2651
|
+
/**
|
|
2652
|
+
* Loads, and keeps reading, the current user's CoinList token-sale
|
|
2653
|
+
* participations, optionally for one offer.
|
|
2654
|
+
*
|
|
2655
|
+
* A participation moves on the backend's clock - its approval is verified,
|
|
2656
|
+
* its payment committed in a batch, any excess refunded after the sale
|
|
2657
|
+
* settles - and none of it is announced, so the list is polled while the page
|
|
2658
|
+
* is visible and read once more when it becomes visible again. The poll is
|
|
2659
|
+
* also how an order placed through `CheckoutContainer` on the same page shows
|
|
2660
|
+
* up here, with nothing for the host to wire.
|
|
2661
|
+
*
|
|
2662
|
+
* Returns `LOADING` while CoinList is initializing or the first read is in
|
|
2663
|
+
* flight, and `CONTENT` once a read has answered - an empty list included.
|
|
2664
|
+
* Returns `ERROR` with:
|
|
2665
|
+
* - `not-authenticated` when the user has to sign in first
|
|
2666
|
+
* - `generic-error` for any other failure before a list was in hand
|
|
2667
|
+
*/
|
|
2668
|
+
declare function useCoinListTokenSaleParticipations(offerId?: OfferId, options?: UseCoinListTokenSaleParticipationsOptions): UseCoinListTokenSaleParticipationsResult;
|
|
2669
|
+
|
|
2670
|
+
/**
|
|
2671
|
+
* UI models every checkout provider needs. Provider-specific models stay in
|
|
2672
|
+
* that provider's `use{X}ViewModel.types`; these live here because Ondo and
|
|
2673
|
+
* Superstate both render them.
|
|
2674
|
+
*
|
|
2675
|
+
* Models only. A provider screen's `{X}UiState` and `{X}UiEvent` stay in that
|
|
2676
|
+
* screen's `use{X}ViewModel.types` even when two providers' happen to agree
|
|
2677
|
+
* today: a state machine is where providers diverge, and sharing one would
|
|
2678
|
+
* make the divergence a breaking change rather than a local edit. A step with
|
|
2679
|
+
* zero provider input is the exception and is shared whole, in its own
|
|
2680
|
+
* `shared/` screen directory - the wallet step Ondo and Centrifuge render as
|
|
2681
|
+
* it stands, while Superstate's allow-lists on-chain from the same rows and
|
|
2682
|
+
* the same models; and the validate-only amount step Centrifuge and
|
|
2683
|
+
* Superstate render as it stands, while Ondo's approves on confirm and builds
|
|
2684
|
+
* its own from the same rules and leaves.
|
|
2685
|
+
*
|
|
2686
|
+
* No React and no hooks: this is the module Views and leaf components import.
|
|
2687
|
+
*/
|
|
2688
|
+
/**
|
|
2689
|
+
* The state of a step's call-to-action.
|
|
2690
|
+
*
|
|
2691
|
+
* A SUM type rather than `disabled`/`isLoading` booleans, so "disabled while
|
|
2692
|
+
* loading" and "loading without a message" are both unrepresentable. The
|
|
2693
|
+
* message is what the user reads while an on-chain step runs (e.g. "Approving
|
|
2694
|
+
* USDC…"), so it belongs to the loading arm alone.
|
|
2695
|
+
*/
|
|
2696
|
+
type CheckoutCtaUi = {
|
|
2697
|
+
type: 'enabled';
|
|
2698
|
+
} | {
|
|
2699
|
+
type: 'disabled';
|
|
2700
|
+
} | {
|
|
2701
|
+
type: 'loading';
|
|
2702
|
+
message: string;
|
|
2703
|
+
};
|
|
2704
|
+
/**
|
|
2705
|
+
* What an amount field's number is denominated in, drawn beside it.
|
|
2706
|
+
*
|
|
2707
|
+
* A token symbol follows the number as its unit (`1,000 USDC`); a currency
|
|
2708
|
+
* sign leads it (`$1,000`). One closed variant rather than a `prefix` and a
|
|
2709
|
+
* `suffix` that could both be set, because a figure has one unit.
|
|
2710
|
+
*/
|
|
2711
|
+
type CheckoutAmountAdornmentUi = {
|
|
2712
|
+
type: 'prefix' | 'suffix';
|
|
2713
|
+
text: string;
|
|
2714
|
+
};
|
|
2715
|
+
/**
|
|
2716
|
+
* A status and the copy that names it: an Ondo market that is open, a sale
|
|
2717
|
+
* still running, a window that has closed.
|
|
2361
2718
|
*
|
|
2362
2719
|
* A SUM type rather than a `label` plus an `isActive` flag, so the label always
|
|
2363
2720
|
* arrives with the state it describes. The label is already formatted — a
|
|
@@ -2461,6 +2818,42 @@ type CheckoutWalletUi = {
|
|
|
2461
2818
|
type CheckoutEmbeddedWalletUi = CheckoutWalletUi & {
|
|
2462
2819
|
walletAddress: EvmWalletAddress;
|
|
2463
2820
|
};
|
|
2821
|
+
/**
|
|
2822
|
+
* The external-wallet row of a checkout's wallet step.
|
|
2823
|
+
*
|
|
2824
|
+
* - `hidden`: the host offers no connector and none is connected, so there is
|
|
2825
|
+
* no row at all - a host that only supports embedded wallets.
|
|
2826
|
+
* - `disconnected`: the host offers a connector and nothing is connected yet.
|
|
2827
|
+
* The row is the invitation to connect one.
|
|
2828
|
+
* - `connected`: a wallet like any other. `canDisconnect` is `false` when the
|
|
2829
|
+
* host offers no connector (it handed over a wallet the user cannot change
|
|
2830
|
+
* from here) or while the step is using that wallet.
|
|
2831
|
+
*
|
|
2832
|
+
* A SUM rather than a nullable wallet beside a flag, so a View cannot offer to
|
|
2833
|
+
* connect a wallet the host has no way of connecting.
|
|
2834
|
+
*/
|
|
2835
|
+
type CheckoutExternalWalletUi = {
|
|
2836
|
+
type: 'hidden';
|
|
2837
|
+
} | {
|
|
2838
|
+
type: 'disconnected';
|
|
2839
|
+
} | {
|
|
2840
|
+
type: 'connected';
|
|
2841
|
+
wallet: CheckoutWalletUi;
|
|
2842
|
+
canDisconnect: boolean;
|
|
2843
|
+
};
|
|
2844
|
+
declare const CheckoutExternalWalletUi: {
|
|
2845
|
+
/**
|
|
2846
|
+
* The external-wallet row for the host's wallets.
|
|
2847
|
+
*
|
|
2848
|
+
* `locked` is for a step that is using the external wallet right now - mid
|
|
2849
|
+
* signature, say - and must not let it be disconnected underneath itself.
|
|
2850
|
+
*/
|
|
2851
|
+
fromDomain: (wallets: WalletSelection, { network, selected, locked, }: {
|
|
2852
|
+
network: string;
|
|
2853
|
+
selected: boolean;
|
|
2854
|
+
locked: boolean;
|
|
2855
|
+
}) => CheckoutExternalWalletUi;
|
|
2856
|
+
};
|
|
2464
2857
|
/**
|
|
2465
2858
|
* The wallet the user settled on.
|
|
2466
2859
|
*
|
|
@@ -2513,107 +2906,23 @@ type CheckoutSelectableInputAssetUi = {
|
|
|
2513
2906
|
rawBalance: bigint;
|
|
2514
2907
|
selected: boolean;
|
|
2515
2908
|
};
|
|
2516
|
-
|
|
2517
|
-
/**
|
|
2518
|
-
* Step 2 of the Centrifuge checkout: how much of the funding token to deposit.
|
|
2519
|
-
*
|
|
2520
|
-
* Nothing here touches the chain. Confirming checks the amount in memory and
|
|
2521
|
-
* hands it up. The review step approves and places the request together.
|
|
2522
|
-
*
|
|
2523
|
-
* @alpha
|
|
2524
|
-
*/
|
|
2525
|
-
type CentrifugeBuyAmountUiState = {
|
|
2526
|
-
type: 'incomplete';
|
|
2527
|
-
} | {
|
|
2528
|
-
type: 'active';
|
|
2529
|
-
/** Exactly what the user has typed. `'1.'` is a legal thing to hold. */
|
|
2530
|
-
amountInput: string;
|
|
2531
|
-
walletAddress: ShortenedWalletAddress;
|
|
2532
|
-
inputAssets: CheckoutSelectableInputAssetUi[];
|
|
2533
|
-
confirmCta: CheckoutCtaUi;
|
|
2534
|
-
error: string | null;
|
|
2535
|
-
} | {
|
|
2536
|
-
type: 'complete';
|
|
2537
|
-
inputAsset: CheckoutAssetUi;
|
|
2538
|
-
amountFormatted: FormattedAmountAssetUi;
|
|
2539
|
-
};
|
|
2540
|
-
/** @alpha */
|
|
2541
|
-
type CentrifugeBuyAmountUiEvent = {
|
|
2542
|
-
type: 'ON_AMOUNT_CHANGE';
|
|
2543
|
-
value: string;
|
|
2544
|
-
} | {
|
|
2545
|
-
type: 'ON_MAX_AMOUNT_CLICK';
|
|
2546
|
-
} | {
|
|
2547
|
-
type: 'ON_SELECT_PAY_WITH';
|
|
2548
|
-
value: AssetSymbol;
|
|
2549
|
-
} | {
|
|
2550
|
-
type: 'ON_CONFIRM_AMOUNT';
|
|
2551
|
-
} | {
|
|
2552
|
-
type: 'ON_EDIT_AMOUNT';
|
|
2553
|
-
};
|
|
2554
|
-
|
|
2555
|
-
/**
|
|
2556
|
-
* Why a Centrifuge read failed, in the only two flavours a UI acts on
|
|
2557
|
-
* differently.
|
|
2558
|
-
*
|
|
2559
|
-
* `not-authenticated` is split out because no retry helps until the user
|
|
2560
|
-
* signs in. Everything else collapses into `generic-error` and is offered a
|
|
2561
|
-
* retry.
|
|
2562
|
-
*
|
|
2563
|
-
* @alpha
|
|
2564
|
-
*/
|
|
2565
|
-
type CentrifugeLoadErrorReason = 'not-authenticated' | 'generic-error';
|
|
2566
|
-
|
|
2567
2909
|
/**
|
|
2568
|
-
*
|
|
2910
|
+
* Where a placed order can be checked: the wallet it settles to, and the
|
|
2911
|
+
* transaction on a block explorer.
|
|
2569
2912
|
*
|
|
2570
|
-
*
|
|
2571
|
-
*
|
|
2572
|
-
*
|
|
2573
|
-
* @alpha
|
|
2913
|
+
* Every provider's order dialog carries the pair, and builds it the same way
|
|
2914
|
+
* from the same three facts, so it is one model rather than two fields each
|
|
2915
|
+
* dialog re-derives.
|
|
2574
2916
|
*/
|
|
2575
|
-
type
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
type: 'ERROR';
|
|
2579
|
-
reason: CentrifugeLoadErrorReason;
|
|
2580
|
-
} | {
|
|
2581
|
-
type: 'CONTENT';
|
|
2582
|
-
transaction: CentrifugeVaultBuyTransaction;
|
|
2583
|
-
isRefreshing: boolean;
|
|
2584
|
-
refreshError: CentrifugeLoadErrorReason | null;
|
|
2585
|
-
};
|
|
2586
|
-
/** @alpha */
|
|
2587
|
-
interface UseCentrifugeBuyTransactionOptions {
|
|
2588
|
-
/**
|
|
2589
|
-
* The request to build, or `null` before an amount is confirmed. A `null`
|
|
2590
|
-
* request fetches nothing.
|
|
2591
|
-
*/
|
|
2592
|
-
request: BuildCentrifugeVaultBuyParams | null;
|
|
2917
|
+
type CheckoutReceiptUi = {
|
|
2918
|
+
/** The wallet the order settles to. */
|
|
2919
|
+
recipientAddress: ShortenedWalletAddress;
|
|
2593
2920
|
/**
|
|
2594
|
-
*
|
|
2595
|
-
*
|
|
2596
|
-
* `refetch` still builds.
|
|
2921
|
+
* The order's transaction on a block explorer. Always present: a dialog
|
|
2922
|
+
* only exists once there is a transaction to point at.
|
|
2597
2923
|
*/
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
enabled: boolean;
|
|
2601
|
-
}
|
|
2602
|
-
/** @alpha */
|
|
2603
|
-
interface UseCentrifugeBuyTransactionResult {
|
|
2604
|
-
state: LoadCentrifugeBuyTransactionState;
|
|
2605
|
-
/** Builds a fresh request for the same deposit. */
|
|
2606
|
-
refetch: () => void;
|
|
2607
|
-
}
|
|
2608
|
-
/**
|
|
2609
|
-
* Holds the deposit request the review step places, and rebuilds it when
|
|
2610
|
-
* asked.
|
|
2611
|
-
*
|
|
2612
|
-
* **Never polls.** A request is built once, when the user confirms an amount.
|
|
2613
|
-
*
|
|
2614
|
-
* @alpha
|
|
2615
|
-
*/
|
|
2616
|
-
declare function useCentrifugeBuyTransaction(options: UseCentrifugeBuyTransactionOptions): UseCentrifugeBuyTransactionResult;
|
|
2924
|
+
txExplorerUrl: TxExplorerUrl;
|
|
2925
|
+
};
|
|
2617
2926
|
|
|
2618
2927
|
/**
|
|
2619
2928
|
* Step 3 of the Centrifuge checkout: confirming the deposit and placing it.
|
|
@@ -2648,38 +2957,37 @@ type CentrifugeBuyReviewUiEvent = {
|
|
|
2648
2957
|
};
|
|
2649
2958
|
|
|
2650
2959
|
/**
|
|
2651
|
-
* Why a
|
|
2652
|
-
* failing.
|
|
2960
|
+
* Why a checkout cannot run right now, as opposed to a step of it failing.
|
|
2653
2961
|
*
|
|
2654
|
-
*
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
*
|
|
2659
|
-
*
|
|
2962
|
+
* Every provider has the same two kinds of answer, and only the second is
|
|
2963
|
+
* named per provider:
|
|
2964
|
+
*
|
|
2965
|
+
* - `unsupported-chain`: the offer names no contract on the chain the host
|
|
2966
|
+
* asked for, so there is no spender to approve and nothing to broadcast to.
|
|
2967
|
+
* Settled at mount, since the offer and the chain are both fixed for its
|
|
2968
|
+
* lifetime, so nothing can clear it.
|
|
2969
|
+
* - `TBlocked`: the provider is known not to take an order right now - a
|
|
2970
|
+
* closed market, a paused vault. Known from a poll, never assumed from one
|
|
2971
|
+
* that is still loading or failed, and it clears on its own once the poll
|
|
2972
|
+
* says so.
|
|
2973
|
+
*
|
|
2974
|
+
* A union rather than a bare flag because the View switches on it for copy.
|
|
2660
2975
|
*/
|
|
2661
|
-
'unsupported-chain'
|
|
2976
|
+
type CheckoutBlockedReason<TBlocked extends string> = 'unsupported-chain' | TBlocked;
|
|
2977
|
+
|
|
2662
2978
|
/**
|
|
2663
|
-
*
|
|
2664
|
-
*
|
|
2665
|
-
*
|
|
2979
|
+
* Why a Centrifuge checkout cannot run right now, as opposed to a step of it
|
|
2980
|
+
* failing. See {@link CheckoutBlockedReason} for `unsupported-chain`, which
|
|
2981
|
+
* here means the offer names no vault proxy on the chain.
|
|
2982
|
+
*
|
|
2983
|
+
* `not-orderable` is Centrifuge's block: the vault is known to be unable to
|
|
2984
|
+
* take a request - halted, unlinked, or not permissioned. Known from a status
|
|
2985
|
+
* whose orderability is blocked; loading and failed statuses are unknown, and
|
|
2986
|
+
* unknown does not block.
|
|
2666
2987
|
*
|
|
2667
|
-
*
|
|
2668
|
-
* dialog is up. Past that, a pause belongs to the step it interrupts.
|
|
2988
|
+
* @alpha
|
|
2669
2989
|
*/
|
|
2670
|
-
|
|
2671
|
-
/** @alpha */
|
|
2672
|
-
declare const CentrifugeCheckoutErrorReason: {
|
|
2673
|
-
/**
|
|
2674
|
-
* Which reason, if any, replaces the whole checkout. `null` means the steps
|
|
2675
|
-
* render.
|
|
2676
|
-
*/
|
|
2677
|
-
of: ({ depositableHere, notOrderable, atEntry, }: {
|
|
2678
|
-
depositableHere: boolean;
|
|
2679
|
-
notOrderable: boolean;
|
|
2680
|
-
atEntry: boolean;
|
|
2681
|
-
}) => CentrifugeCheckoutErrorReason | null;
|
|
2682
|
-
};
|
|
2990
|
+
type CentrifugeCheckoutErrorReason = CheckoutBlockedReason<'not-orderable'>;
|
|
2683
2991
|
|
|
2684
2992
|
/**
|
|
2685
2993
|
* The asset panel beside the Centrifuge checkout.
|
|
@@ -2734,24 +3042,113 @@ type CentrifugeSidebarMinimumUi = {
|
|
|
2734
3042
|
};
|
|
2735
3043
|
|
|
2736
3044
|
/**
|
|
2737
|
-
*
|
|
3045
|
+
* The amount step of a checkout whose amount step takes no provider input:
|
|
3046
|
+
* how much to spend, and which stablecoin to spend it in. Centrifuge and
|
|
3047
|
+
* Superstate render it as it stands.
|
|
3048
|
+
*
|
|
3049
|
+
* Shared whole, state machine included, because it is not a provider state
|
|
3050
|
+
* machine: nothing here touches the chain, so confirming checks the amount in
|
|
3051
|
+
* memory and hands it up, and there is nothing for a provider to diverge on.
|
|
3052
|
+
* It forks the moment one provider needs different behaviour - Ondo's already
|
|
3053
|
+
* has, since its confirm approves and builds an order, so it keeps its own
|
|
3054
|
+
* state over the same rules and leaves.
|
|
3055
|
+
*
|
|
3056
|
+
* The CTA is a `CheckoutCtaUi` all the same, rather than a `confirmEnabled`
|
|
3057
|
+
* flag, so the View renders it through the one CTA every amount step uses. It
|
|
3058
|
+
* is never `loading` here.
|
|
3059
|
+
*/
|
|
3060
|
+
type CheckoutAmountUiState = {
|
|
3061
|
+
type: 'incomplete';
|
|
3062
|
+
} | {
|
|
3063
|
+
type: 'active';
|
|
3064
|
+
/**
|
|
3065
|
+
* Exactly what the user has typed, not a parsed number: the field is
|
|
3066
|
+
* mid-edit, and `'1.'` is a legal thing to be holding.
|
|
3067
|
+
*/
|
|
3068
|
+
amountInput: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* What the field is denominated in: the selected coin's symbol after the
|
|
3071
|
+
* number, or a `$` before it for a dollar-denominated field.
|
|
3072
|
+
*/
|
|
3073
|
+
adornment: CheckoutAmountAdornmentUi;
|
|
3074
|
+
/** The wallet the funds come from, per the wallet step. */
|
|
3075
|
+
walletAddress: ShortenedWalletAddress;
|
|
3076
|
+
/**
|
|
3077
|
+
* Every fundable asset, in display order, whether or not the user holds
|
|
3078
|
+
* any. One entry renders as a plain card, two or more as a picker.
|
|
3079
|
+
*/
|
|
3080
|
+
inputAssets: CheckoutSelectableInputAssetUi[];
|
|
3081
|
+
confirmCta: CheckoutCtaUi;
|
|
3082
|
+
/**
|
|
3083
|
+
* Validation copy, e.g. `Insufficient USDC.`, or why no amount can be
|
|
3084
|
+
* confirmed right now, which takes its place.
|
|
3085
|
+
*/
|
|
3086
|
+
error: string | null;
|
|
3087
|
+
} | {
|
|
3088
|
+
type: 'complete';
|
|
3089
|
+
inputAsset: CheckoutAssetUi;
|
|
3090
|
+
/**
|
|
3091
|
+
* The confirmed amount as the field asked for it: `1,000.00 USDC`, or
|
|
3092
|
+
* `$1,000.00` for a dollar-denominated field.
|
|
3093
|
+
*/
|
|
3094
|
+
amountFormatted: FormattedAmountAssetUi;
|
|
3095
|
+
/**
|
|
3096
|
+
* The same figure in the asset actually being paid, e.g. `1,000.00
|
|
3097
|
+
* USDC`, when the headline names dollars rather than the asset. `null`
|
|
3098
|
+
* when the headline already is in the asset.
|
|
3099
|
+
*
|
|
3100
|
+
* Both are shown for a dollar field because the two are only equal while
|
|
3101
|
+
* the funding asset is a dollar stablecoin - the day a non-dollar one is
|
|
3102
|
+
* fundable, the summary would otherwise silently claim it was.
|
|
3103
|
+
*/
|
|
3104
|
+
inputAmountFormatted: FormattedAmountAssetUi | null;
|
|
3105
|
+
};
|
|
3106
|
+
/**
|
|
3107
|
+
* Everything the amount step raises. `ON_CONFIRM_AMOUNT` only moves the flow
|
|
3108
|
+
* to the review step: nothing is placed or paid for here.
|
|
3109
|
+
*/
|
|
3110
|
+
type CheckoutAmountUiEvent = {
|
|
3111
|
+
type: 'ON_AMOUNT_CHANGE';
|
|
3112
|
+
value: string;
|
|
3113
|
+
} | {
|
|
3114
|
+
type: 'ON_MAX_AMOUNT_CLICK';
|
|
3115
|
+
} | {
|
|
3116
|
+
type: 'ON_SELECT_PAY_WITH';
|
|
3117
|
+
value: AssetSymbol;
|
|
3118
|
+
} | {
|
|
3119
|
+
type: 'ON_CONFIRM_AMOUNT';
|
|
3120
|
+
} | {
|
|
3121
|
+
type: 'ON_EDIT_AMOUNT';
|
|
3122
|
+
};
|
|
3123
|
+
|
|
3124
|
+
/**
|
|
3125
|
+
* Step 1 of a checkout whose wallet step takes no provider input: which wallet
|
|
3126
|
+
* funds the order and receives the asset. Ondo (buy and sell) and Centrifuge
|
|
3127
|
+
* render it as it stands.
|
|
2738
3128
|
*
|
|
2739
|
-
*
|
|
2740
|
-
*
|
|
3129
|
+
* Shared whole, state machine included, because it is not a provider state
|
|
3130
|
+
* machine: no provider answers anything here, so there is nothing for one to
|
|
3131
|
+
* diverge on. It forks the moment one provider needs different behaviour -
|
|
3132
|
+
* Superstate already has, since its confirm allow-lists the wallet on-chain,
|
|
3133
|
+
* so it keeps its own state over the same rows.
|
|
2741
3134
|
*
|
|
2742
|
-
*
|
|
2743
|
-
* is
|
|
3135
|
+
* There is no `inactive` arm. This step is the first one, so it is either
|
|
3136
|
+
* being filled in or already answered - it is never waiting on a step above
|
|
3137
|
+
* it.
|
|
2744
3138
|
*
|
|
2745
|
-
*
|
|
3139
|
+
* Nothing is allow-listed: the user picks a wallet and confirms, and
|
|
3140
|
+
* confirming is synchronous. Hence a plain `confirmEnabled` rather than a
|
|
3141
|
+
* `CheckoutCtaUi` with loading copy.
|
|
2746
3142
|
*/
|
|
2747
|
-
type
|
|
3143
|
+
type CheckoutWalletSelectUiState = {
|
|
2748
3144
|
type: 'active';
|
|
2749
3145
|
/** The user's CoinList wallets. Empty when they have none. */
|
|
2750
3146
|
embeddedWallets: CheckoutEmbeddedWalletUi[];
|
|
2751
|
-
/**
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
3147
|
+
/**
|
|
3148
|
+
* The external-wallet row: absent when the host offers no connector,
|
|
3149
|
+
* an invitation to connect one, or the connected wallet.
|
|
3150
|
+
*/
|
|
3151
|
+
externalWallet: CheckoutExternalWalletUi;
|
|
2755
3152
|
confirmEnabled: boolean;
|
|
2756
3153
|
/** Copy for a failed connect, e.g. the user rejected the wallet prompt. */
|
|
2757
3154
|
error: string | null;
|
|
@@ -2759,8 +3156,7 @@ type CentrifugeWalletSelectUiState = {
|
|
|
2759
3156
|
type: 'completed';
|
|
2760
3157
|
wallet: CheckoutConfirmedWalletUi;
|
|
2761
3158
|
};
|
|
2762
|
-
|
|
2763
|
-
type CentrifugeWalletSelectUiEvent = {
|
|
3159
|
+
type CheckoutWalletSelectUiEvent = {
|
|
2764
3160
|
type: 'ON_SELECT_WALLET';
|
|
2765
3161
|
value: CheckoutWalletTypeUi;
|
|
2766
3162
|
}
|
|
@@ -2787,8 +3183,13 @@ type CentrifugeWalletSelectUiEvent = {
|
|
|
2787
3183
|
*/
|
|
2788
3184
|
type CentrifugeBuyCheckoutUiState = {
|
|
2789
3185
|
type: 'content';
|
|
2790
|
-
|
|
2791
|
-
|
|
3186
|
+
/**
|
|
3187
|
+
* The wallet step, or `null` when the host preselected a wallet and the
|
|
3188
|
+
* flow skipped it. The later steps are numbered from it. Never `null`
|
|
3189
|
+
* today: this flow does not honour a preselection yet.
|
|
3190
|
+
*/
|
|
3191
|
+
wallet: CheckoutWalletSelectUiState | null;
|
|
3192
|
+
amount: CheckoutAmountUiState;
|
|
2792
3193
|
review: CentrifugeBuyReviewUiState;
|
|
2793
3194
|
sidebar: CentrifugeSidebarUiState;
|
|
2794
3195
|
orderPlaced: CentrifugeOrderPlacedUiState;
|
|
@@ -2797,7 +3198,7 @@ type CentrifugeBuyCheckoutUiState = {
|
|
|
2797
3198
|
reason: CentrifugeCheckoutErrorReason;
|
|
2798
3199
|
};
|
|
2799
3200
|
/** @alpha */
|
|
2800
|
-
type CentrifugeBuyCheckoutUiEvent =
|
|
3201
|
+
type CentrifugeBuyCheckoutUiEvent = CheckoutWalletSelectUiEvent | CheckoutAmountUiEvent | CentrifugeBuyReviewUiEvent | CentrifugeOrderPlacedUiEvent;
|
|
2801
3202
|
/**
|
|
2802
3203
|
* The dialog that closes the checkout once the request has mined.
|
|
2803
3204
|
*
|
|
@@ -2807,13 +3208,11 @@ type CentrifugeBuyCheckoutUiEvent = CentrifugeWalletSelectUiEvent | CentrifugeBu
|
|
|
2807
3208
|
*/
|
|
2808
3209
|
type CentrifugeOrderPlacedUiState = {
|
|
2809
3210
|
type: 'hidden';
|
|
2810
|
-
} | {
|
|
3211
|
+
} | ({
|
|
2811
3212
|
type: 'visible';
|
|
2812
3213
|
outputAsset: CheckoutAssetUi;
|
|
2813
3214
|
totalCost: FormattedAmountAssetUi;
|
|
2814
|
-
|
|
2815
|
-
txExplorerUrl: TxExplorerUrl;
|
|
2816
|
-
};
|
|
3215
|
+
} & CheckoutReceiptUi);
|
|
2817
3216
|
/** @alpha */
|
|
2818
3217
|
type CentrifugeOrderPlacedUiEvent = {
|
|
2819
3218
|
type: 'ON_CLOSE_ORDER_PLACED';
|
|
@@ -2823,6 +3222,15 @@ type CentrifugeOrderPlacedUiEvent = {
|
|
|
2823
3222
|
interface UseCentrifugeBuyCheckoutViewModelOptions {
|
|
2824
3223
|
offer: CentrifugeVaultOfferDetail;
|
|
2825
3224
|
chain: EthereumChain;
|
|
3225
|
+
/**
|
|
3226
|
+
* The host's wallets, its connector for an external one if any, and
|
|
3227
|
+
* optionally the wallet it has already settled on.
|
|
3228
|
+
*
|
|
3229
|
+
* `wallets.preselected` is read **once**, to seed the step machine: set, the
|
|
3230
|
+
* flow has no wallet step and opens on the amount. A host that changes it
|
|
3231
|
+
* mid-flow is ignored, because the approval the review grants is granted by
|
|
3232
|
+
* one specific wallet.
|
|
3233
|
+
*/
|
|
2826
3234
|
wallets: CheckoutWalletSelection;
|
|
2827
3235
|
enabled?: boolean;
|
|
2828
3236
|
/** Fired once the request has mined. The dialog shows either way. */
|
|
@@ -2840,53 +3248,191 @@ interface UseCentrifugeBuyCheckoutViewModelResult {
|
|
|
2840
3248
|
* review, and sidebar steps. The status poll lives here. The amount step
|
|
2841
3249
|
* only validates.
|
|
2842
3250
|
*
|
|
2843
|
-
* A vault that is known to be blocked replaces the checkout only at the
|
|
2844
|
-
*
|
|
3251
|
+
* A vault that is known to be blocked replaces the checkout only at the step
|
|
3252
|
+
* the flow opened on: the wallet step, or the amount for a wallet the host
|
|
3253
|
+
* preselected. A status that is still loading, or that failed, does not.
|
|
2845
3254
|
*
|
|
2846
3255
|
* @alpha
|
|
2847
3256
|
*/
|
|
2848
3257
|
declare function useCentrifugeBuyCheckoutViewModel({ offer, chain, wallets, enabled, onOrderPlaced, }: UseCentrifugeBuyCheckoutViewModelOptions): UseCentrifugeBuyCheckoutViewModelResult;
|
|
2849
3258
|
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
3259
|
+
/**
|
|
3260
|
+
* The last step of the token-sale checkout: confirming the commitment and
|
|
3261
|
+
* placing it.
|
|
3262
|
+
*
|
|
3263
|
+
* Placing approves the payment to the sale's funding contract and records the
|
|
3264
|
+
* participation. The sale pulls the payment shortly after and holds it, and
|
|
3265
|
+
* allocates the tokens only when it settles, so the quantity shown is an
|
|
3266
|
+
* estimate.
|
|
3267
|
+
*
|
|
3268
|
+
* @alpha
|
|
3269
|
+
*/
|
|
3270
|
+
type TokenSaleReviewUiState = {
|
|
3271
|
+
type: 'incomplete';
|
|
2853
3272
|
} | {
|
|
2854
|
-
type: '
|
|
2855
|
-
|
|
3273
|
+
type: 'active';
|
|
3274
|
+
/** The token being bought. */
|
|
3275
|
+
outputAsset: CheckoutAssetUi;
|
|
3276
|
+
/** How many tokens the payment buys at the option's price, e.g. `200.00 TKN`. */
|
|
3277
|
+
estimatedTokens: FormattedAmountAssetUi;
|
|
3278
|
+
/** The option's price for one whole token, e.g. `$0.50`. */
|
|
3279
|
+
pricePerToken: FormattedAmountAssetUi;
|
|
3280
|
+
/** What the user commits, e.g. `100.00 USDC`. No fee comes off it. */
|
|
3281
|
+
payAmount: FormattedAmountAssetUi;
|
|
3282
|
+
/** Where the tokens land - the wallet that approves the payment. */
|
|
3283
|
+
recipientAddress: ShortenedWalletAddress;
|
|
3284
|
+
/** The option's sale agreement, which the order is placed under. */
|
|
3285
|
+
saleAgreementUrl: string | null;
|
|
3286
|
+
placeOrderCta: CheckoutCtaUi;
|
|
3287
|
+
error: string | null;
|
|
3288
|
+
};
|
|
3289
|
+
/** @alpha */
|
|
3290
|
+
type TokenSaleReviewUiEvent = {
|
|
3291
|
+
type: 'ON_PLACE_ORDER';
|
|
3292
|
+
};
|
|
3293
|
+
|
|
3294
|
+
/**
|
|
3295
|
+
* Why a token-sale checkout cannot run at all, as opposed to a step of it
|
|
3296
|
+
* failing. Every one of them is a fact about the offer and the host's props,
|
|
3297
|
+
* so none clears on its own:
|
|
3298
|
+
*
|
|
3299
|
+
* - `unsupported-chain`: the sale names no funding contract on the chain.
|
|
3300
|
+
* - `unknown-option`: the host's `optionId` is not one of the offer's options.
|
|
3301
|
+
* - `no-price`: the option has no fixed price - an auction, which the SDK
|
|
3302
|
+
* does not run.
|
|
3303
|
+
* - `no-payable-asset`: the sale accepts no coin the SDK can pay with on the
|
|
3304
|
+
* chain.
|
|
3305
|
+
*
|
|
3306
|
+
* @alpha
|
|
3307
|
+
*/
|
|
3308
|
+
type TokenSaleCheckoutErrorReason = CheckoutBlockedReason<'unknown-option' | 'no-price' | 'no-payable-asset'>;
|
|
3309
|
+
|
|
3310
|
+
/**
|
|
3311
|
+
* The reference panel beside the token-sale checkout: which token is being
|
|
3312
|
+
* bought, what one costs, whether the sale is running, and the terms that do
|
|
3313
|
+
* not move while the order is filled in.
|
|
3314
|
+
*
|
|
3315
|
+
* Read-only, so there is no `UiEvent`. Everything is known from the offer the
|
|
3316
|
+
* moment the checkout renders, so the state is a product rather than a union.
|
|
3317
|
+
*
|
|
3318
|
+
* @alpha
|
|
3319
|
+
*/
|
|
3320
|
+
type TokenSaleSidebarUiState = {
|
|
3321
|
+
asset: CheckoutAssetUi;
|
|
3322
|
+
/** Whether the sale is running: a live countdown, or why it is not. */
|
|
3323
|
+
sale: CheckoutStatusUi;
|
|
3324
|
+
/** The option's price for one whole token, e.g. `$0.50`. */
|
|
3325
|
+
pricePerToken: FormattedAmountAssetUi;
|
|
3326
|
+
/**
|
|
3327
|
+
* The price times the option's total token supply, e.g. `$500,000,000.00`.
|
|
3328
|
+
* `-` when the option publishes no supply.
|
|
3329
|
+
*/
|
|
3330
|
+
fullyDilutedValuation: FormattedAmountAssetUi;
|
|
3331
|
+
/** Display name of the chain the sale is paid on, e.g. `Ethereum`. */
|
|
3332
|
+
networkName: string;
|
|
3333
|
+
/** What the sale can be paid in, e.g. `USDC, USDT`. */
|
|
3334
|
+
purchaseOptionsLabel: string;
|
|
3335
|
+
/** The option's minimum, e.g. `$100.00`. `-` when it publishes none. */
|
|
3336
|
+
minPurchase: FormattedAmountAssetUi;
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3339
|
+
/**
|
|
3340
|
+
* The whole CoinList token-sale checkout: three steps, the sale panel, and the
|
|
3341
|
+
* dialog that says the order was placed.
|
|
3342
|
+
*
|
|
3343
|
+
* @alpha
|
|
3344
|
+
*/
|
|
3345
|
+
type CoinListTokenSaleCheckoutUiState = {
|
|
3346
|
+
type: 'content';
|
|
3347
|
+
/**
|
|
3348
|
+
* The wallet step, or `null` when the host preselected a wallet and the
|
|
3349
|
+
* flow skipped it. The later steps are numbered from it.
|
|
3350
|
+
*/
|
|
3351
|
+
wallet: CheckoutWalletSelectUiState | null;
|
|
3352
|
+
amount: CheckoutAmountUiState;
|
|
3353
|
+
review: TokenSaleReviewUiState;
|
|
3354
|
+
sidebar: TokenSaleSidebarUiState;
|
|
3355
|
+
orderPlaced: TokenSaleOrderPlacedUiState;
|
|
2856
3356
|
} | {
|
|
2857
|
-
type: '
|
|
2858
|
-
|
|
3357
|
+
type: 'error';
|
|
3358
|
+
reason: TokenSaleCheckoutErrorReason;
|
|
3359
|
+
};
|
|
3360
|
+
/** @alpha */
|
|
3361
|
+
type CoinListTokenSaleCheckoutUiEvent = CheckoutWalletSelectUiEvent | CheckoutAmountUiEvent | TokenSaleReviewUiEvent | TokenSaleOrderPlacedUiEvent;
|
|
3362
|
+
/**
|
|
3363
|
+
* The dialog that closes the checkout once the order is recorded.
|
|
3364
|
+
*
|
|
3365
|
+
* It reports a commitment, not a purchase: the sale takes and holds the
|
|
3366
|
+
* payment, and allocates the tokens only when it settles. The explorer link is the approval's,
|
|
3367
|
+
* the one transaction the order sent.
|
|
3368
|
+
*
|
|
3369
|
+
* @alpha
|
|
3370
|
+
*/
|
|
3371
|
+
type TokenSaleOrderPlacedUiState = {
|
|
3372
|
+
type: 'hidden';
|
|
3373
|
+
} | ({
|
|
3374
|
+
type: 'visible';
|
|
3375
|
+
outputAsset: CheckoutAssetUi;
|
|
3376
|
+
/** What was committed, e.g. `100.00 USDC`. */
|
|
3377
|
+
payAmount: FormattedAmountAssetUi;
|
|
3378
|
+
/** How many tokens it buys at the option's price, e.g. `200.00 TKN`. */
|
|
3379
|
+
estimatedTokens: FormattedAmountAssetUi;
|
|
3380
|
+
} & CheckoutReceiptUi);
|
|
3381
|
+
/** @alpha */
|
|
3382
|
+
type TokenSaleOrderPlacedUiEvent = {
|
|
3383
|
+
type: 'ON_CLOSE_ORDER_PLACED';
|
|
2859
3384
|
};
|
|
2860
|
-
|
|
3385
|
+
|
|
3386
|
+
/** @alpha */
|
|
3387
|
+
interface UseCoinListTokenSaleCheckoutViewModelOptions {
|
|
3388
|
+
offer: CoinListTokenSaleOfferDetail;
|
|
3389
|
+
/** The chain the order is paid on. The sale must name a funding contract there. */
|
|
3390
|
+
chain: EthereumChain;
|
|
2861
3391
|
/**
|
|
2862
|
-
*
|
|
2863
|
-
*
|
|
3392
|
+
* The option being bought, which sets the price, the minimum and the sale
|
|
3393
|
+
* agreement. Defaults to the offer's first option.
|
|
3394
|
+
*
|
|
3395
|
+
* **Read once, at mount**: the price, minimum and agreement the steps were
|
|
3396
|
+
* filled in against are this option's. A host whose selection can change
|
|
3397
|
+
* remounts with a `key` covering it.
|
|
2864
3398
|
*/
|
|
2865
|
-
|
|
3399
|
+
optionId?: OfferOptionId;
|
|
2866
3400
|
/**
|
|
2867
|
-
*
|
|
2868
|
-
*
|
|
3401
|
+
* The host's wallets, its connector for an external one if any, and
|
|
3402
|
+
* optionally the wallet it has already settled on.
|
|
3403
|
+
*
|
|
3404
|
+
* `wallets.preselected` is read **once**, to seed the step machine: set, the
|
|
3405
|
+
* flow has no wallet step and opens on the amount. A host that changes it
|
|
3406
|
+
* mid-flow is ignored, because the approval the review grants is granted by
|
|
3407
|
+
* one specific wallet.
|
|
2869
3408
|
*/
|
|
3409
|
+
wallets: CheckoutWalletSelection;
|
|
2870
3410
|
enabled?: boolean;
|
|
3411
|
+
/** Fired once the participation is recorded. The dialog shows either way. */
|
|
3412
|
+
onOrderPlaced?: (order: TokenSaleOrderPlaced) => void;
|
|
2871
3413
|
}
|
|
2872
|
-
|
|
2873
|
-
|
|
3414
|
+
/** @alpha */
|
|
3415
|
+
interface UseCoinListTokenSaleCheckoutViewModelResult {
|
|
3416
|
+
state: CoinListTokenSaleCheckoutUiState;
|
|
3417
|
+
onEvent: (event: CoinListTokenSaleCheckoutUiEvent) => void;
|
|
2874
3418
|
}
|
|
2875
3419
|
/**
|
|
2876
|
-
*
|
|
2877
|
-
* Optionally filters by offer when `offerId` is provided.
|
|
3420
|
+
* Drives the CoinList token-sale checkout.
|
|
2878
3421
|
*
|
|
2879
|
-
*
|
|
2880
|
-
*
|
|
2881
|
-
*
|
|
3422
|
+
* The container mounts this hook only. It composes the shared wallet and
|
|
3423
|
+
* amount steps, the review that places the order, and the sale panel. The
|
|
3424
|
+
* amount step only validates; the review approves the payment to the sale's
|
|
3425
|
+
* funding contract and records the participation.
|
|
2882
3426
|
*
|
|
2883
|
-
*
|
|
2884
|
-
*
|
|
2885
|
-
*
|
|
2886
|
-
*
|
|
2887
|
-
*
|
|
3427
|
+
* A sale that cannot take an order on this chain at all - no funding
|
|
3428
|
+
* contract, no such option, no fixed price, no coin the SDK can pay with -
|
|
3429
|
+
* replaces the whole checkout. A sale outside its window blocks the amount
|
|
3430
|
+
* and review steps instead, and the panel says when it opens or that it
|
|
3431
|
+
* ended.
|
|
3432
|
+
*
|
|
3433
|
+
* @alpha
|
|
2888
3434
|
*/
|
|
2889
|
-
declare function
|
|
3435
|
+
declare function useCoinListTokenSaleCheckoutViewModel({ offer, chain, optionId: initialOptionId, wallets, enabled, onOrderPlaced, }: UseCoinListTokenSaleCheckoutViewModelOptions): UseCoinListTokenSaleCheckoutViewModelResult;
|
|
2890
3436
|
|
|
2891
3437
|
/**
|
|
2892
3438
|
* Step 2 of the Ondo checkout: how much to spend, and which asset to spend.
|
|
@@ -2952,28 +3498,43 @@ type OndoBuyAmountUiEvent = {
|
|
|
2952
3498
|
* branch in every consumer to distinguish. Split it out if that stops being
|
|
2953
3499
|
* true.
|
|
2954
3500
|
*/
|
|
2955
|
-
type OndoLoadErrorReason =
|
|
3501
|
+
type OndoLoadErrorReason = LoadErrorReason | 'not-tradable';
|
|
2956
3502
|
|
|
2957
3503
|
/**
|
|
2958
|
-
* The state of
|
|
3504
|
+
* The state of a firm, expiring transaction a review step acts on.
|
|
2959
3505
|
*
|
|
2960
|
-
* `
|
|
2961
|
-
*
|
|
2962
|
-
*
|
|
2963
|
-
*
|
|
3506
|
+
* `DISABLED` means the caller switched the hook off before a transaction was
|
|
3507
|
+
* in hand, so nothing is being built. A transaction already in hand - a seed,
|
|
3508
|
+
* or an earlier build - survives being switched off.
|
|
3509
|
+
*
|
|
3510
|
+
* `isRefreshing` rides on `CONTENT` rather than replacing it, so a rebuild in
|
|
3511
|
+
* flight never blanks the numbers the user is reading. A rebuild that fails
|
|
3512
|
+
* keeps them too, and reports why alongside - the previous transaction may
|
|
3513
|
+
* still be good, and a failed rebuild is fixed by rebuilding again.
|
|
2964
3514
|
*/
|
|
2965
|
-
type
|
|
3515
|
+
type LoadFirmTransactionState<T, R> = {
|
|
3516
|
+
type: 'DISABLED';
|
|
3517
|
+
} | {
|
|
2966
3518
|
type: 'LOADING';
|
|
2967
3519
|
} | {
|
|
2968
3520
|
type: 'ERROR';
|
|
2969
|
-
reason:
|
|
3521
|
+
reason: R;
|
|
2970
3522
|
} | {
|
|
2971
3523
|
type: 'CONTENT';
|
|
2972
|
-
transaction:
|
|
3524
|
+
transaction: T;
|
|
2973
3525
|
isRefreshing: boolean;
|
|
2974
|
-
/** Why the last
|
|
2975
|
-
refreshError:
|
|
3526
|
+
/** Why the last rebuild failed; `null` when the transaction is fresh. */
|
|
3527
|
+
refreshError: R | null;
|
|
2976
3528
|
};
|
|
3529
|
+
|
|
3530
|
+
/**
|
|
3531
|
+
* The state of the built purchase a review step acts on.
|
|
3532
|
+
*
|
|
3533
|
+
* `DISABLED` while switched off with no purchase in hand. `isRefreshing` rides
|
|
3534
|
+
* on `CONTENT`, so a refresh in flight never blanks the numbers the user is
|
|
3535
|
+
* reading, and a refresh that fails keeps them and says why.
|
|
3536
|
+
*/
|
|
3537
|
+
type LoadOndoBuyTransactionState = LoadFirmTransactionState<OndoBuyTransaction, OndoLoadErrorReason>;
|
|
2977
3538
|
interface UseOndoBuyTransactionOptions {
|
|
2978
3539
|
/**
|
|
2979
3540
|
* The order to build, or `null` while there is not one yet - before the
|
|
@@ -2997,29 +3558,50 @@ interface UseOndoBuyTransactionResult {
|
|
|
2997
3558
|
}
|
|
2998
3559
|
/**
|
|
2999
3560
|
* Holds the firm, expiring purchase the buy review step places an order
|
|
3000
|
-
* against, and rebuilds it on demand.
|
|
3001
|
-
*
|
|
3002
|
-
* **Never polls.** Building spends an attestation, so a new one is only ever
|
|
3003
|
-
* obtained when the caller asks - on `refetch`, or on the first render if no
|
|
3004
|
-
* `data` was supplied. That is also why an expired purchase is left expired
|
|
3005
|
-
* here: whether to replace it is the user's call, not a timer's.
|
|
3006
|
-
*
|
|
3007
|
-
* Disabled it fetches nothing and stays on whatever state it opened with. That
|
|
3008
|
-
* is `LOADING` and not an empty `CONTENT` because there is no empty
|
|
3009
|
-
* purchase: firm calldata for an order that does not exist is not
|
|
3010
|
-
* representable. A caller that switches this hook off should switch its own
|
|
3011
|
-
* rendering off with it - which is what the review step does, since a step
|
|
3012
|
-
* that is not active is `incomplete` and never reads this state at all.
|
|
3561
|
+
* against, and rebuilds it on demand. **Never polls**: each build spends an
|
|
3562
|
+
* attestation.
|
|
3013
3563
|
*
|
|
3014
3564
|
* One of a pair with `useOndoSellTransaction`, and deliberately not one hook
|
|
3015
|
-
* over both. The two endpoints answer different shapes - a purchase
|
|
3016
|
-
* an exact quantity, a sale to a range - so a shared hook
|
|
3017
|
-
* review step a union to narrow after its own directory had
|
|
3018
|
-
* which trade it was. The machinery
|
|
3019
|
-
*
|
|
3565
|
+
* over both (ADR-10). The two endpoints answer different shapes - a purchase
|
|
3566
|
+
* commits to an exact quantity, a sale to a range - so a shared public hook
|
|
3567
|
+
* would hand every review step a union to narrow after its own directory had
|
|
3568
|
+
* already settled which trade it was. The machinery is shared instead, in
|
|
3569
|
+
* `useFirmTransaction`.
|
|
3020
3570
|
*/
|
|
3021
3571
|
declare function useOndoBuyTransaction(options: UseOndoBuyTransactionOptions): UseOndoBuyTransactionResult;
|
|
3022
3572
|
|
|
3573
|
+
/**
|
|
3574
|
+
* Whether the numbers on an Ondo review step can still be traded on.
|
|
3575
|
+
*
|
|
3576
|
+
* A quote is only good for a few seconds, so this drives the line above the CTA
|
|
3577
|
+
* and whether the CTA can be pressed at all. `refresh-failed` is its own arm
|
|
3578
|
+
* rather than folding into the step's `error`, because the remedy differs: a
|
|
3579
|
+
* failed refresh is fixed by refreshing again, a failed order is not.
|
|
3580
|
+
*
|
|
3581
|
+
* One type for both products, because a buy and a sell quote expire, refresh
|
|
3582
|
+
* and fail to refresh in exactly the same way: `useOndoReviewExecution` derives
|
|
3583
|
+
* it for both from the same firm transaction state.
|
|
3584
|
+
*/
|
|
3585
|
+
type OndoQuoteStatusUi =
|
|
3586
|
+
/** Still good. `expiresInLabel` is the countdown copy, already formatted. */
|
|
3587
|
+
{
|
|
3588
|
+
type: 'valid';
|
|
3589
|
+
expiresInLabel: string;
|
|
3590
|
+
}
|
|
3591
|
+
/** A refresh is in flight; the previous numbers are still on screen. */
|
|
3592
|
+
| {
|
|
3593
|
+
type: 'refreshing';
|
|
3594
|
+
}
|
|
3595
|
+
/** Too old to trade on. The user must refresh before placing the order. */
|
|
3596
|
+
| {
|
|
3597
|
+
type: 'expired';
|
|
3598
|
+
}
|
|
3599
|
+
/** The refresh failed. `message` says why. */
|
|
3600
|
+
| {
|
|
3601
|
+
type: 'refresh-failed';
|
|
3602
|
+
message: string;
|
|
3603
|
+
};
|
|
3604
|
+
|
|
3023
3605
|
/**
|
|
3024
3606
|
* Step 3 of the Ondo checkout: what the order comes to, and placing it.
|
|
3025
3607
|
*
|
|
@@ -3057,38 +3639,11 @@ type OndoBuyReviewUiState = {
|
|
|
3057
3639
|
coinlistFee: FormattedAmountAssetUi | null;
|
|
3058
3640
|
/** What the user pays in the input asset, e.g. `1,000.00 USDC`. */
|
|
3059
3641
|
total: FormattedAmountAssetUi;
|
|
3060
|
-
quote:
|
|
3642
|
+
quote: OndoQuoteStatusUi;
|
|
3061
3643
|
placeOrderCta: CheckoutCtaUi;
|
|
3062
3644
|
/** A failure from placing the order, distinct from a quote problem. */
|
|
3063
3645
|
error: string | null;
|
|
3064
3646
|
};
|
|
3065
|
-
/**
|
|
3066
|
-
* Whether the shown numbers can still be traded on.
|
|
3067
|
-
*
|
|
3068
|
-
* A quote is only good for a few seconds, so this drives the line above the CTA
|
|
3069
|
-
* and whether the CTA can be pressed at all. `refresh-failed` is its own arm
|
|
3070
|
-
* rather than folding into the step's `error`, because the remedy differs: a
|
|
3071
|
-
* failed refresh is fixed by refreshing again, a failed order is not.
|
|
3072
|
-
*/
|
|
3073
|
-
type OndoBuyQuoteStatusUi =
|
|
3074
|
-
/** Still good. `expiresInLabel` is the countdown copy, already formatted. */
|
|
3075
|
-
{
|
|
3076
|
-
type: 'valid';
|
|
3077
|
-
expiresInLabel: string;
|
|
3078
|
-
}
|
|
3079
|
-
/** A refresh is in flight; the previous numbers are still on screen. */
|
|
3080
|
-
| {
|
|
3081
|
-
type: 'refreshing';
|
|
3082
|
-
}
|
|
3083
|
-
/** Too old to trade on. The user must refresh before placing the order. */
|
|
3084
|
-
| {
|
|
3085
|
-
type: 'expired';
|
|
3086
|
-
}
|
|
3087
|
-
/** The refresh failed. `message` says why. */
|
|
3088
|
-
| {
|
|
3089
|
-
type: 'refresh-failed';
|
|
3090
|
-
message: string;
|
|
3091
|
-
};
|
|
3092
3647
|
type OndoBuyReviewUiEvent = {
|
|
3093
3648
|
type: 'ON_REFRESH_QUOTE';
|
|
3094
3649
|
}
|
|
@@ -3101,9 +3656,14 @@ type OndoBuyReviewUiEvent = {
|
|
|
3101
3656
|
|
|
3102
3657
|
/**
|
|
3103
3658
|
* Why an Ondo checkout cannot run right now, as opposed to a step of it
|
|
3104
|
-
* failing.
|
|
3659
|
+
* failing. See {@link CheckoutBlockedReason} for `unsupported-chain`, which
|
|
3660
|
+
* here means the offer names no CoinList swap contract on the chain (see
|
|
3661
|
+
* `swapSpender`).
|
|
3105
3662
|
*
|
|
3106
|
-
*
|
|
3663
|
+
* `not-tradable` is Ondo's block: it is not filling orders for this asset on
|
|
3664
|
+
* this side right now, because the market is closed or paused, or the asset is
|
|
3665
|
+
* paused or closed for the session. The trading-status poll keeps running
|
|
3666
|
+
* underneath it, and the checkout comes back once the asset is tradable again.
|
|
3107
3667
|
*
|
|
3108
3668
|
* Shared by both products because each reason is a property of the integration
|
|
3109
3669
|
* or of the market rather than of a direction: buying and selling go through
|
|
@@ -3112,47 +3672,7 @@ type OndoBuyReviewUiEvent = {
|
|
|
3112
3672
|
* exception the provider-level `shared/` exists for, and it is narrow - the
|
|
3113
3673
|
* step states stay per-product, since that is where the two genuinely diverge.
|
|
3114
3674
|
*/
|
|
3115
|
-
type OndoCheckoutErrorReason =
|
|
3116
|
-
/**
|
|
3117
|
-
* The offer names no CoinList swap contract on the chain the host asked for,
|
|
3118
|
-
* so there is no spender to approve and nothing to broadcast to.
|
|
3119
|
-
*
|
|
3120
|
-
* Not retryable, and not the host's mistake to correct at runtime: both the
|
|
3121
|
-
* offer and the chain are fixed for the lifetime of the mount. See
|
|
3122
|
-
* `swapSpender`.
|
|
3123
|
-
*/
|
|
3124
|
-
'unsupported-chain'
|
|
3125
|
-
/**
|
|
3126
|
-
* Ondo is not filling orders for this asset on this side right now: the
|
|
3127
|
-
* market is closed or paused, or the asset is paused or closed for the
|
|
3128
|
-
* session. Known from the trading-status poll, never assumed from a status
|
|
3129
|
-
* that is still loading or failed to load.
|
|
3130
|
-
*
|
|
3131
|
-
* Unlike `unsupported-chain` this one clears on its own. The trading-status
|
|
3132
|
-
* poll keeps running underneath it, and the checkout comes back once the
|
|
3133
|
-
* asset is tradable again. Only shown while the user is on the step the flow
|
|
3134
|
-
* opened on: once they are past it, a pause is a step's to report, so it
|
|
3135
|
-
* cannot pull an order out from under the user mid-flow.
|
|
3136
|
-
*/
|
|
3137
|
-
| 'not-tradable';
|
|
3138
|
-
declare const OndoCheckoutErrorReason: {
|
|
3139
|
-
/**
|
|
3140
|
-
* Which reason, if any, replaces the whole checkout. `null` means the steps
|
|
3141
|
-
* render.
|
|
3142
|
-
*
|
|
3143
|
-
* `unsupported-chain` wins because it is settled at mount: no market state
|
|
3144
|
-
* can make a chain with no contract tradable. `not-tradable` needs both a
|
|
3145
|
-
* market *known* to be closed and a user still at the start of the flow,
|
|
3146
|
-
* with no order confirmation on screen. Past the first step a pause belongs
|
|
3147
|
-
* to the step it interrupts, and a just-placed order's dialog must not be
|
|
3148
|
-
* hidden by a market that closed after it filled.
|
|
3149
|
-
*/
|
|
3150
|
-
of: ({ swappableHere, notTradable, atEntry, }: {
|
|
3151
|
-
swappableHere: boolean;
|
|
3152
|
-
notTradable: boolean;
|
|
3153
|
-
atEntry: boolean;
|
|
3154
|
-
}) => OndoCheckoutErrorReason | null;
|
|
3155
|
-
};
|
|
3675
|
+
type OndoCheckoutErrorReason = CheckoutBlockedReason<'not-tradable'>;
|
|
3156
3676
|
|
|
3157
3677
|
/**
|
|
3158
3678
|
* The reference panel beside the Ondo checkout: which asset is being bought,
|
|
@@ -3223,54 +3743,6 @@ type OndoSidebarPriceUi =
|
|
|
3223
3743
|
type: 'unavailable';
|
|
3224
3744
|
};
|
|
3225
3745
|
|
|
3226
|
-
/**
|
|
3227
|
-
* Step 1 of the Ondo checkout: which wallet funds the purchase and receives the
|
|
3228
|
-
* asset.
|
|
3229
|
-
*
|
|
3230
|
-
* There is no `inactive` arm. This step is the first one, so it is either being
|
|
3231
|
-
* filled in or already answered — it is never waiting on a step above it.
|
|
3232
|
-
*
|
|
3233
|
-
* Unlike Superstate's equivalent, nothing is allow-listed here: the user picks
|
|
3234
|
-
* a wallet and confirms, and confirming is synchronous. Hence a plain
|
|
3235
|
-
* `confirmEnabled` rather than the `CheckoutCtaUi` Superstate's step carries.
|
|
3236
|
-
* The rows themselves are the shared `Checkout*WalletUi` models — the two
|
|
3237
|
-
* providers render the same wallets and disagree only about what confirming
|
|
3238
|
-
* does.
|
|
3239
|
-
*/
|
|
3240
|
-
type OndoWalletSelectUiState = {
|
|
3241
|
-
type: 'active';
|
|
3242
|
-
/** The user's CoinList wallets. Empty when they have none. */
|
|
3243
|
-
embeddedWallets: CheckoutEmbeddedWalletUi[];
|
|
3244
|
-
/** `null` until an external wallet is connected. The row still renders. */
|
|
3245
|
-
externalWallet: CheckoutWalletUi | null;
|
|
3246
|
-
/** Whether the connected external wallet may be disconnected here. */
|
|
3247
|
-
canDisconnect: boolean;
|
|
3248
|
-
confirmEnabled: boolean;
|
|
3249
|
-
/** Copy for a failed connect, e.g. the user rejected the wallet prompt. */
|
|
3250
|
-
error: string | null;
|
|
3251
|
-
} | {
|
|
3252
|
-
type: 'completed';
|
|
3253
|
-
wallet: CheckoutConfirmedWalletUi;
|
|
3254
|
-
};
|
|
3255
|
-
type OndoWalletSelectUiEvent = {
|
|
3256
|
-
type: 'ON_SELECT_WALLET';
|
|
3257
|
-
value: CheckoutWalletTypeUi;
|
|
3258
|
-
}
|
|
3259
|
-
/**
|
|
3260
|
-
* Tapping the external row while nothing is connected. Split from
|
|
3261
|
-
* `ON_SELECT_WALLET` because it opens the host's wallet connector rather than
|
|
3262
|
-
* changing the selection.
|
|
3263
|
-
*/
|
|
3264
|
-
| {
|
|
3265
|
-
type: 'ON_CONNECT_WALLET';
|
|
3266
|
-
} | {
|
|
3267
|
-
type: 'ON_DISCONNECT_WALLET';
|
|
3268
|
-
} | {
|
|
3269
|
-
type: 'ON_CONFIRM_WALLET';
|
|
3270
|
-
} | {
|
|
3271
|
-
type: 'ON_EDIT_WALLET';
|
|
3272
|
-
};
|
|
3273
|
-
|
|
3274
3746
|
/**
|
|
3275
3747
|
* The whole Ondo buy checkout: three step cards, the reference panel beside
|
|
3276
3748
|
* them, and the dialog that closes the flow.
|
|
@@ -3290,7 +3762,12 @@ type OndoWalletSelectUiEvent = {
|
|
|
3290
3762
|
*/
|
|
3291
3763
|
type OndoBuyCheckoutUiState = {
|
|
3292
3764
|
type: 'content';
|
|
3293
|
-
|
|
3765
|
+
/**
|
|
3766
|
+
* The wallet step, or `null` when the host preselected a wallet and the
|
|
3767
|
+
* flow skipped it. The later steps are numbered from it. Never `null`
|
|
3768
|
+
* today: the buy flow does not honour a preselection yet.
|
|
3769
|
+
*/
|
|
3770
|
+
wallet: CheckoutWalletSelectUiState | null;
|
|
3294
3771
|
amount: OndoBuyAmountUiState;
|
|
3295
3772
|
review: OndoBuyReviewUiState;
|
|
3296
3773
|
/** The asset panel. Read-only, so it raises no events. */
|
|
@@ -3316,7 +3793,7 @@ type OndoBuyCheckoutUiState = {
|
|
|
3316
3793
|
* tags must stay globally unique, which is why the edit events are
|
|
3317
3794
|
* `ON_EDIT_WALLET` and `ON_EDIT_AMOUNT` rather than a shared `ON_EDIT`.
|
|
3318
3795
|
*/
|
|
3319
|
-
type OndoBuyCheckoutUiEvent =
|
|
3796
|
+
type OndoBuyCheckoutUiEvent = CheckoutWalletSelectUiEvent | OndoBuyAmountUiEvent | OndoBuyReviewUiEvent | OndoOrderConfirmedUiEvent;
|
|
3320
3797
|
/**
|
|
3321
3798
|
* The dialog that closes the Ondo checkout, once the swap is mined.
|
|
3322
3799
|
*
|
|
@@ -3326,7 +3803,7 @@ type OndoBuyCheckoutUiEvent = OndoWalletSelectUiEvent | OndoBuyAmountUiEvent | O
|
|
|
3326
3803
|
*/
|
|
3327
3804
|
type OndoOrderConfirmedUiState = {
|
|
3328
3805
|
type: 'hidden';
|
|
3329
|
-
} | {
|
|
3806
|
+
} | ({
|
|
3330
3807
|
type: 'visible';
|
|
3331
3808
|
/**
|
|
3332
3809
|
* What was bought.
|
|
@@ -3342,14 +3819,7 @@ type OndoOrderConfirmedUiState = {
|
|
|
3342
3819
|
totalCost: FormattedAmountAssetUi;
|
|
3343
3820
|
/** Price of one whole token at the time of the fill, e.g. `$378.99`. */
|
|
3344
3821
|
pricePerShare: FormattedAmountAssetUi;
|
|
3345
|
-
|
|
3346
|
-
recipientAddress: ShortenedWalletAddress;
|
|
3347
|
-
/**
|
|
3348
|
-
* The settled swap on a block explorer. Always present: the dialog only
|
|
3349
|
-
* exists once there is a mined transaction to point at.
|
|
3350
|
-
*/
|
|
3351
|
-
txExplorerUrl: TxExplorerUrl;
|
|
3352
|
-
};
|
|
3822
|
+
} & CheckoutReceiptUi);
|
|
3353
3823
|
/**
|
|
3354
3824
|
* Closing is the only thing the dialog raises.
|
|
3355
3825
|
*
|
|
@@ -3378,7 +3848,17 @@ interface UseOndoBuyCheckoutViewModelOptions {
|
|
|
3378
3848
|
* Fixed for the lifetime of the hook, as `offer` is.
|
|
3379
3849
|
*/
|
|
3380
3850
|
chain: EthereumChain;
|
|
3381
|
-
/**
|
|
3851
|
+
/**
|
|
3852
|
+
* The host's wallets, its connector for an external one if any, and
|
|
3853
|
+
* optionally the wallet it has already settled on.
|
|
3854
|
+
*
|
|
3855
|
+
* `wallets.preselected` is read **once**, to seed the step machine: set, the
|
|
3856
|
+
* flow has no wallet step and opens on the amount. A host that changes it
|
|
3857
|
+
* mid-flow is ignored, because the approval that follows the amount step is
|
|
3858
|
+
* granted by one specific wallet, and moving the flow onto another one under
|
|
3859
|
+
* it would strand that approval and build calldata the new wallet cannot
|
|
3860
|
+
* broadcast.
|
|
3861
|
+
*/
|
|
3382
3862
|
wallets: CheckoutWalletSelection;
|
|
3383
3863
|
/**
|
|
3384
3864
|
* Default `true`. When `false` nothing is fetched and no timer runs, for a
|
|
@@ -3417,12 +3897,12 @@ interface UseOndoBuyCheckoutViewModelResult {
|
|
|
3417
3897
|
* wallet is the same kind of answer for as long as it lasts. See
|
|
3418
3898
|
* {@link OndoCheckoutErrorReason}.
|
|
3419
3899
|
*
|
|
3420
|
-
* `offer` and `chain` are read as fixed for the lifetime of the hook
|
|
3421
|
-
*
|
|
3422
|
-
*
|
|
3423
|
-
*
|
|
3424
|
-
*
|
|
3425
|
-
* documents. That discards the flow with its component instance, which is the
|
|
3900
|
+
* `offer` and `chain` are read as fixed for the lifetime of the hook, and so is
|
|
3901
|
+
* the wallet the flow opened on. The step machine holds a committed quote and
|
|
3902
|
+
* an approval granted on one chain by one wallet for one order, so changing any
|
|
3903
|
+
* of them in place would carry them onto an order they were never priced for.
|
|
3904
|
+
* Remount instead: give the component holding this hook a `key` that changes
|
|
3905
|
+
* with the offer and the chain, as {@link CheckoutContainer} documents. That discards the flow with its component instance, which is the
|
|
3426
3906
|
* only reset that cannot land between an approval and the broadcast it was
|
|
3427
3907
|
* granted for.
|
|
3428
3908
|
*/
|
|
@@ -3506,23 +3986,11 @@ type OndoSellAmountUiEvent = {
|
|
|
3506
3986
|
/**
|
|
3507
3987
|
* The state of the built sale a review step acts on.
|
|
3508
3988
|
*
|
|
3509
|
-
* `
|
|
3510
|
-
* flight never blanks the numbers the user is
|
|
3511
|
-
*
|
|
3512
|
-
* be good, and a failed refresh is fixed by refreshing again.
|
|
3989
|
+
* `DISABLED` while switched off with no sale in hand. `isRefreshing` rides on
|
|
3990
|
+
* `CONTENT`, so a refresh in flight never blanks the numbers the user is
|
|
3991
|
+
* reading, and a refresh that fails keeps them and says why.
|
|
3513
3992
|
*/
|
|
3514
|
-
type LoadOndoSellTransactionState =
|
|
3515
|
-
type: 'LOADING';
|
|
3516
|
-
} | {
|
|
3517
|
-
type: 'ERROR';
|
|
3518
|
-
reason: OndoLoadErrorReason;
|
|
3519
|
-
} | {
|
|
3520
|
-
type: 'CONTENT';
|
|
3521
|
-
transaction: OndoSellTransaction;
|
|
3522
|
-
isRefreshing: boolean;
|
|
3523
|
-
/** Why the last refresh failed; `null` when the sale is fresh. */
|
|
3524
|
-
refreshError: OndoLoadErrorReason | null;
|
|
3525
|
-
};
|
|
3993
|
+
type LoadOndoSellTransactionState = LoadFirmTransactionState<OndoSellTransaction, OndoLoadErrorReason>;
|
|
3526
3994
|
interface UseOndoSellTransactionOptions {
|
|
3527
3995
|
/**
|
|
3528
3996
|
* The order to build, or `null` while there is not one yet - before the
|
|
@@ -3545,26 +4013,15 @@ interface UseOndoSellTransactionResult {
|
|
|
3545
4013
|
refetch: () => void;
|
|
3546
4014
|
}
|
|
3547
4015
|
/**
|
|
3548
|
-
* Holds the firm, expiring sale the sell review step places an order
|
|
3549
|
-
*
|
|
3550
|
-
*
|
|
3551
|
-
* **Never polls.** Building spends an attestation, so a new one is only ever
|
|
3552
|
-
* obtained when the caller asks - on `refetch`, or on the first render if no
|
|
3553
|
-
* `data` was supplied. That is also why an expired sale is left expired
|
|
3554
|
-
* here: whether to replace it is the user's call, not a timer's.
|
|
3555
|
-
*
|
|
3556
|
-
* Disabled it fetches nothing and stays on whatever state it opened with. That
|
|
3557
|
-
* is `LOADING` and not an empty `CONTENT` because there is no empty
|
|
3558
|
-
* sale: firm calldata for an order that does not exist is not
|
|
3559
|
-
* representable. A caller that switches this hook off should switch its own
|
|
3560
|
-
* rendering off with it - which is what the review step does, since a step
|
|
3561
|
-
* that is not active is `incomplete` and never reads this state at all.
|
|
4016
|
+
* Holds the firm, expiring sale the sell review step places an order against,
|
|
4017
|
+
* and rebuilds it on demand. **Never polls**: each build spends an
|
|
4018
|
+
* attestation.
|
|
3562
4019
|
*
|
|
3563
4020
|
* The sell half of the pair `useOndoBuyTransaction` opens - see there for why
|
|
3564
|
-
* the two are not one hook. What differs is entirely in what `CONTENT`
|
|
3565
|
-
* an {@link OndoSellTransaction} publishes an expected outcome and a
|
|
3566
|
-
* beneath it rather than one attested quantity, and the review step
|
|
3567
|
-
* both.
|
|
4021
|
+
* the two are not one hook. What differs is entirely in what `CONTENT`
|
|
4022
|
+
* carries: an {@link OndoSellTransaction} publishes an expected outcome and a
|
|
4023
|
+
* floor beneath it rather than one attested quantity, and the review step
|
|
4024
|
+
* renders both.
|
|
3568
4025
|
*/
|
|
3569
4026
|
declare function useOndoSellTransaction(options: UseOndoSellTransactionOptions): UseOndoSellTransactionResult;
|
|
3570
4027
|
|
|
@@ -3624,7 +4081,7 @@ type OndoSellReviewUiState = {
|
|
|
3624
4081
|
* is what the order is expected to fill at.
|
|
3625
4082
|
*/
|
|
3626
4083
|
pricePerShare: FormattedAmountAssetUi;
|
|
3627
|
-
quote:
|
|
4084
|
+
quote: OndoQuoteStatusUi;
|
|
3628
4085
|
placeOrderCta: CheckoutCtaUi;
|
|
3629
4086
|
/** A failure from placing the order, distinct from a quote problem. */
|
|
3630
4087
|
error: string | null;
|
|
@@ -3657,33 +4114,6 @@ type OndoSellOutcomeUi = {
|
|
|
3657
4114
|
*/
|
|
3658
4115
|
fee: FormattedAmountAssetUi | null;
|
|
3659
4116
|
};
|
|
3660
|
-
/**
|
|
3661
|
-
* Whether the shown numbers can still be traded on.
|
|
3662
|
-
*
|
|
3663
|
-
* A quote is only good for a few seconds, so this drives the line above the CTA
|
|
3664
|
-
* and whether the CTA can be pressed at all. `refresh-failed` is its own arm
|
|
3665
|
-
* rather than folding into the step's `error`, because the remedy differs: a
|
|
3666
|
-
* failed refresh is fixed by refreshing again, a failed order is not.
|
|
3667
|
-
*/
|
|
3668
|
-
type OndoSellQuoteStatusUi =
|
|
3669
|
-
/** Still good. `expiresInLabel` is the countdown copy, already formatted. */
|
|
3670
|
-
{
|
|
3671
|
-
type: 'valid';
|
|
3672
|
-
expiresInLabel: string;
|
|
3673
|
-
}
|
|
3674
|
-
/** A refresh is in flight; the previous numbers are still on screen. */
|
|
3675
|
-
| {
|
|
3676
|
-
type: 'refreshing';
|
|
3677
|
-
}
|
|
3678
|
-
/** Too old to trade on. The user must refresh before placing the order. */
|
|
3679
|
-
| {
|
|
3680
|
-
type: 'expired';
|
|
3681
|
-
}
|
|
3682
|
-
/** The refresh failed. `message` says why. */
|
|
3683
|
-
| {
|
|
3684
|
-
type: 'refresh-failed';
|
|
3685
|
-
message: string;
|
|
3686
|
-
};
|
|
3687
4117
|
type OndoSellReviewUiEvent = {
|
|
3688
4118
|
type: 'ON_REFRESH_SELL_QUOTE';
|
|
3689
4119
|
}
|
|
@@ -3719,7 +4149,7 @@ type OndoSellCheckoutUiState = {
|
|
|
3719
4149
|
* two-step flow numbered `1, 2` and a three-step flow numbered `1, 2, 3`
|
|
3720
4150
|
* cannot disagree. A boolean beside a non-null state would have let them.
|
|
3721
4151
|
*/
|
|
3722
|
-
wallet:
|
|
4152
|
+
wallet: CheckoutWalletSelectUiState | null;
|
|
3723
4153
|
amount: OndoSellAmountUiState;
|
|
3724
4154
|
review: OndoSellReviewUiState;
|
|
3725
4155
|
/** The asset panel. Read-only, so it raises no events. */
|
|
@@ -3747,7 +4177,7 @@ type OndoSellCheckoutUiState = {
|
|
|
3747
4177
|
* separate, and a shared tag would make one product's event dispatch into the
|
|
3748
4178
|
* other's handler in any host that composed both.
|
|
3749
4179
|
*/
|
|
3750
|
-
type OndoSellCheckoutUiEvent =
|
|
4180
|
+
type OndoSellCheckoutUiEvent = CheckoutWalletSelectUiEvent | OndoSellAmountUiEvent | OndoSellReviewUiEvent | OndoSellOrderConfirmedUiEvent;
|
|
3751
4181
|
/**
|
|
3752
4182
|
* The dialog that closes the Ondo sell checkout, once the swap is mined.
|
|
3753
4183
|
*
|
|
@@ -3757,7 +4187,7 @@ type OndoSellCheckoutUiEvent = OndoWalletSelectUiEvent | OndoSellAmountUiEvent |
|
|
|
3757
4187
|
*/
|
|
3758
4188
|
type OndoSellOrderConfirmedUiState = {
|
|
3759
4189
|
type: 'hidden';
|
|
3760
|
-
} | {
|
|
4190
|
+
} | ({
|
|
3761
4191
|
type: 'visible';
|
|
3762
4192
|
/**
|
|
3763
4193
|
* What was sold.
|
|
@@ -3782,14 +4212,7 @@ type OndoSellOrderConfirmedUiState = {
|
|
|
3782
4212
|
proceedsSymbol: AssetSymbol;
|
|
3783
4213
|
/** Price of one whole token at the time of the fill, e.g. `$378.99`. */
|
|
3784
4214
|
pricePerShare: FormattedAmountAssetUi;
|
|
3785
|
-
|
|
3786
|
-
recipientAddress: ShortenedWalletAddress;
|
|
3787
|
-
/**
|
|
3788
|
-
* The settled swap on a block explorer. Always present: the dialog only
|
|
3789
|
-
* exists once there is a mined transaction to point at.
|
|
3790
|
-
*/
|
|
3791
|
-
txExplorerUrl: TxExplorerUrl;
|
|
3792
|
-
};
|
|
4215
|
+
} & CheckoutReceiptUi);
|
|
3793
4216
|
/**
|
|
3794
4217
|
* Closing is the only thing the dialog raises.
|
|
3795
4218
|
*
|
|
@@ -3819,7 +4242,7 @@ interface UseOndoSellCheckoutViewModelOptions {
|
|
|
3819
4242
|
*/
|
|
3820
4243
|
chain: EthereumChain;
|
|
3821
4244
|
/**
|
|
3822
|
-
* The host's wallets,
|
|
4245
|
+
* The host's wallets, its connector for an external one if any, and
|
|
3823
4246
|
* optionally the wallet it has already settled on.
|
|
3824
4247
|
*
|
|
3825
4248
|
* `wallets.preselected` is read **once**, to seed the step machine. A host
|
|
@@ -3884,6 +4307,7 @@ declare function useOndoSellCheckoutViewModel({ offer, chain, wallets, enabled,
|
|
|
3884
4307
|
/**
|
|
3885
4308
|
* The state of the indicative-price poll.
|
|
3886
4309
|
*
|
|
4310
|
+
* - `DISABLED`: switched off with no price in hand, so none is coming.
|
|
3887
4311
|
* - `LOADING`: no price yet (initial, or the provider is still initializing).
|
|
3888
4312
|
* - `ERROR`: no price could be fetched at all.
|
|
3889
4313
|
* - `CONTENT`: a price is in hand; `isRefreshing` says whether a newer one is
|
|
@@ -3895,6 +4319,8 @@ declare function useOndoSellCheckoutViewModel({ offer, chain, wallets, enabled,
|
|
|
3895
4319
|
* when the UI has nothing to show.
|
|
3896
4320
|
*/
|
|
3897
4321
|
type LoadOndoPriceState = {
|
|
4322
|
+
type: 'DISABLED';
|
|
4323
|
+
} | {
|
|
3898
4324
|
type: 'LOADING';
|
|
3899
4325
|
} | {
|
|
3900
4326
|
type: 'ERROR';
|
|
@@ -3941,15 +4367,12 @@ interface UseOndoPriceResult {
|
|
|
3941
4367
|
* - committing a fillable quote is `coinlist.ondo.prepareBuy` or
|
|
3942
4368
|
* `coinlist.ondo.prepareSell`, whichever way the trade runs.
|
|
3943
4369
|
*
|
|
3944
|
-
* Disabled
|
|
3945
|
-
*
|
|
3946
|
-
*
|
|
3947
|
-
*
|
|
3948
|
-
*
|
|
3949
|
-
*
|
|
3950
|
-
* `useOptionAddresses` does, and one whose content is a number cannot. A caller
|
|
3951
|
-
* that switches this hook off should switch its own rendering off with it,
|
|
3952
|
-
* rather than read `LOADING` as "a price is coming".
|
|
4370
|
+
* Disabled it neither fetches nor holds a timer. With no price in hand it
|
|
4371
|
+
* reports `DISABLED` - not `LOADING`, since nothing is coming, and not an
|
|
4372
|
+
* empty `CONTENT`, since there is no empty price. A price already in hand (the
|
|
4373
|
+
* `data` seed, or an earlier tick) survives being switched off. Before the
|
|
4374
|
+
* provider is ready it is `LOADING`: the read is coming, it just cannot leave
|
|
4375
|
+
* yet.
|
|
3953
4376
|
*
|
|
3954
4377
|
* A `data` price opens the state instead of `LOADING` and is otherwise left to
|
|
3955
4378
|
* the poll: the first tick fires as it always does, and only replaces the seed
|
|
@@ -3969,6 +4392,8 @@ declare function useOndoPrice(options: UseOndoPriceOptions): UseOndoPriceResult;
|
|
|
3969
4392
|
* unknown may not.
|
|
3970
4393
|
*/
|
|
3971
4394
|
type LoadOndoTradingStatusState = {
|
|
4395
|
+
type: 'DISABLED';
|
|
4396
|
+
} | {
|
|
3972
4397
|
type: 'LOADING';
|
|
3973
4398
|
} | {
|
|
3974
4399
|
type: 'ERROR';
|
|
@@ -3979,8 +4404,8 @@ type LoadOndoTradingStatusState = {
|
|
|
3979
4404
|
};
|
|
3980
4405
|
/**
|
|
3981
4406
|
* Whether the market is *known* to be closed for this side: the one reading of
|
|
3982
|
-
* the poll a caller may block an order on. `LOADING` and `ERROR`
|
|
3983
|
-
* and unknown never blocks.
|
|
4407
|
+
* the poll a caller may block an order on. `DISABLED`, `LOADING` and `ERROR`
|
|
4408
|
+
* are unknown, and unknown never blocks.
|
|
3984
4409
|
*/
|
|
3985
4410
|
declare function isNotTradable(state: LoadOndoTradingStatusState): boolean;
|
|
3986
4411
|
interface UseOndoTradingStatusOptions {
|
|
@@ -4023,94 +4448,30 @@ interface UseOndoTradingStatusResult {
|
|
|
4023
4448
|
* the poll: the first tick fires as it always does, and only replaces the seed
|
|
4024
4449
|
* once it has a status of its own.
|
|
4025
4450
|
*
|
|
4026
|
-
* Disabled it neither fetches nor holds a timer
|
|
4027
|
-
*
|
|
4028
|
-
*
|
|
4029
|
-
*
|
|
4030
|
-
*
|
|
4451
|
+
* Disabled it neither fetches nor holds a timer. With no status in hand it
|
|
4452
|
+
* reports `DISABLED`, not an empty `CONTENT`: there is no empty market status,
|
|
4453
|
+
* and an invented one would be worse than none, since `CONTENT` here is what a
|
|
4454
|
+
* caller is allowed to block an order on. A status already in hand survives
|
|
4455
|
+
* being switched off.
|
|
4031
4456
|
*/
|
|
4032
4457
|
declare function useOndoTradingStatus(options: UseOndoTradingStatusOptions): UseOndoTradingStatusResult;
|
|
4033
4458
|
|
|
4034
4459
|
/**
|
|
4035
|
-
*
|
|
4036
|
-
* spend.
|
|
4460
|
+
* The state of the swap's output-token read.
|
|
4037
4461
|
*
|
|
4038
|
-
*
|
|
4039
|
-
*
|
|
4040
|
-
*
|
|
4041
|
-
*
|
|
4042
|
-
*
|
|
4043
|
-
*/
|
|
4044
|
-
type SuperstateAmountUiState = {
|
|
4045
|
-
type: 'incomplete';
|
|
4046
|
-
} | {
|
|
4047
|
-
type: 'active';
|
|
4048
|
-
/**
|
|
4049
|
-
* Exactly what the user has typed, not a parsed number: the field is
|
|
4050
|
-
* mid-edit, and `'1.'` is a legal thing to be holding.
|
|
4051
|
-
*/
|
|
4052
|
-
amountInput: string;
|
|
4053
|
-
/** The wallet the funds come from, per step 1. */
|
|
4054
|
-
walletAddress: ShortenedWalletAddress;
|
|
4055
|
-
/**
|
|
4056
|
-
* Every supported input asset, in display order, whether or not the user
|
|
4057
|
-
* holds any. One entry renders as a plain card, two or more as a picker.
|
|
4058
|
-
*/
|
|
4059
|
-
inputAssets: CheckoutSelectableInputAssetUi[];
|
|
4060
|
-
confirmEnabled: boolean;
|
|
4061
|
-
/** Validation copy, e.g. `Amount must be greater than 0.` */
|
|
4062
|
-
error: string | null;
|
|
4063
|
-
} | {
|
|
4064
|
-
type: 'complete';
|
|
4065
|
-
inputAsset: CheckoutAssetUi;
|
|
4066
|
-
/**
|
|
4067
|
-
* What the user is spending, as the field asked for it: dollars, e.g.
|
|
4068
|
-
* `$1,000.00`. The Superstate field is dollar-denominated, which is why
|
|
4069
|
-
* this is prefixed rather than suffixed with a symbol.
|
|
4070
|
-
*/
|
|
4071
|
-
amountFormatted: FormattedAmountAssetUi;
|
|
4072
|
-
/**
|
|
4073
|
-
* The same figure in the asset actually being paid, e.g. `1,000.00 USDC`.
|
|
4074
|
-
*
|
|
4075
|
-
* Both are shown because the two are only equal while the funding asset
|
|
4076
|
-
* is a dollar stablecoin — the day a non-dollar one is fundable, the
|
|
4077
|
-
* summary would otherwise silently claim it was.
|
|
4078
|
-
*/
|
|
4079
|
-
inputAmountFormatted: FormattedAmountAssetUi;
|
|
4080
|
-
};
|
|
4081
|
-
type SuperstateAmountUiEvent = {
|
|
4082
|
-
type: 'ON_AMOUNT_CHANGE';
|
|
4083
|
-
value: string;
|
|
4084
|
-
} | {
|
|
4085
|
-
type: 'ON_MAX_AMOUNT_CLICK';
|
|
4086
|
-
} | {
|
|
4087
|
-
type: 'ON_SELECT_PAY_WITH';
|
|
4088
|
-
value: AssetSymbol;
|
|
4089
|
-
}
|
|
4090
|
-
/**
|
|
4091
|
-
* Named for what it does rather than for the step: confirming here previews
|
|
4092
|
-
* the order on step 3, it does not place or pay for anything.
|
|
4462
|
+
* - `DISABLED`: switched off before an answer arrived.
|
|
4463
|
+
* - `LOADING`: no answer yet (initial, a re-read after the contract or chain
|
|
4464
|
+
* changed, or the provider still initializing).
|
|
4465
|
+
* - `ERROR`: the read failed.
|
|
4466
|
+
* - `CONTENT`: the output token was read.
|
|
4093
4467
|
*/
|
|
4094
|
-
|
|
4095
|
-
type: '
|
|
4468
|
+
type LoadSwapOutputTokenState = {
|
|
4469
|
+
type: 'DISABLED';
|
|
4096
4470
|
} | {
|
|
4097
|
-
type: 'ON_EDIT_AMOUNT';
|
|
4098
|
-
};
|
|
4099
|
-
|
|
4100
|
-
/**
|
|
4101
|
-
* The state of the swap's output-token fetch.
|
|
4102
|
-
*
|
|
4103
|
-
* - `LOADING`: no result yet (initial, or provider still initializing).
|
|
4104
|
-
* - `ERROR`: the fetch failed.
|
|
4105
|
-
* - `CONTENT`: the output token was fetched successfully.
|
|
4106
|
-
*
|
|
4107
|
-
* A stale `CONTENT`/`ERROR` is preserved while a re-fetch (e.g. after a chain
|
|
4108
|
-
* change) is in flight, rather than flipping back to `LOADING`.
|
|
4109
|
-
*/
|
|
4110
|
-
type SwapOutputTokenState = {
|
|
4111
4471
|
type: 'LOADING';
|
|
4112
4472
|
} | {
|
|
4113
4473
|
type: 'ERROR';
|
|
4474
|
+
reason: LoadErrorReason;
|
|
4114
4475
|
} | {
|
|
4115
4476
|
type: 'CONTENT';
|
|
4116
4477
|
outputToken: Erc20Asset;
|
|
@@ -4123,12 +4484,12 @@ interface UseSwapOutputTokenOptions {
|
|
|
4123
4484
|
enabled: boolean;
|
|
4124
4485
|
}
|
|
4125
4486
|
interface UseSwapOutputTokenResult {
|
|
4126
|
-
|
|
4487
|
+
state: LoadSwapOutputTokenState;
|
|
4127
4488
|
/**
|
|
4128
|
-
* Runs the
|
|
4489
|
+
* Runs the read again after a failure.
|
|
4129
4490
|
*
|
|
4130
4491
|
* The output token is read once and never polled, so `ERROR` is otherwise
|
|
4131
|
-
* terminal until a dependency changes
|
|
4492
|
+
* terminal until a dependency changes - and without it there is no quote,
|
|
4132
4493
|
* no price and no minimum received, which is why the Superstate checkout
|
|
4133
4494
|
* surfaces it as a whole-flow failure with a retry rather than as one
|
|
4134
4495
|
* unavailable corner.
|
|
@@ -4136,11 +4497,11 @@ interface UseSwapOutputTokenResult {
|
|
|
4136
4497
|
refetch: () => void;
|
|
4137
4498
|
}
|
|
4138
4499
|
/**
|
|
4139
|
-
*
|
|
4500
|
+
* Reads the ERC-20 output token a swap contract pays out. Reads again when the
|
|
4140
4501
|
* contract or chain changes, and once when `enabled` flips to true.
|
|
4141
4502
|
*
|
|
4142
|
-
* The
|
|
4143
|
-
* retried until a dependency changes.
|
|
4503
|
+
* The read runs once (no polling); a failure resolves to `ERROR` and is not
|
|
4504
|
+
* retried until a dependency changes or `refetch` is called.
|
|
4144
4505
|
*/
|
|
4145
4506
|
declare function useSwapOutputToken(options: UseSwapOutputTokenOptions): UseSwapOutputTokenResult;
|
|
4146
4507
|
|
|
@@ -4161,21 +4522,45 @@ interface UseSwapQuoteOptions {
|
|
|
4161
4522
|
/** When false, the hook neither fetches nor polls. */
|
|
4162
4523
|
enabled: boolean;
|
|
4163
4524
|
}
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4525
|
+
/**
|
|
4526
|
+
* The state of the quote poll.
|
|
4527
|
+
*
|
|
4528
|
+
* - `DISABLED`: switched off with no quote in hand, so none is coming.
|
|
4529
|
+
* - `LOADING`: no quote yet - the first read is in flight, the provider is
|
|
4530
|
+
* still initializing, or the output token's decimals are not known yet.
|
|
4531
|
+
* - `ERROR`: no quote could be read at all.
|
|
4532
|
+
* - `CONTENT`: a quote is in hand; `isRefreshing` says whether a newer one is
|
|
4533
|
+
* on the way.
|
|
4534
|
+
*
|
|
4535
|
+
* A tick that fails with a quote already in hand stays `CONTENT`, so `ERROR`
|
|
4536
|
+
* means "never got one". A quote also survives a change of amount until the
|
|
4537
|
+
* new one lands, with `isRefreshing` set: the review step compares the quote
|
|
4538
|
+
* against the amount, and that flag is what tells it the mismatch is a reprice
|
|
4539
|
+
* in flight rather than a quote for the wrong order.
|
|
4540
|
+
*/
|
|
4541
|
+
type LoadSwapQuoteState = {
|
|
4542
|
+
type: 'DISABLED';
|
|
4543
|
+
} | {
|
|
4544
|
+
type: 'LOADING';
|
|
4545
|
+
} | {
|
|
4546
|
+
type: 'ERROR';
|
|
4547
|
+
reason: LoadErrorReason;
|
|
4548
|
+
} | {
|
|
4549
|
+
type: 'CONTENT';
|
|
4550
|
+
quote: SwapQuote;
|
|
4170
4551
|
isRefreshing: boolean;
|
|
4552
|
+
};
|
|
4553
|
+
interface UseSwapQuoteResult {
|
|
4554
|
+
state: LoadSwapQuoteState;
|
|
4171
4555
|
}
|
|
4172
4556
|
/**
|
|
4173
4557
|
* Polls a read-only swap quote for `inputAmount` of `inputTokenAddress` against
|
|
4174
4558
|
* the given swap contract, refreshing every `pollIntervalMs`.
|
|
4175
4559
|
*
|
|
4176
|
-
* A failed
|
|
4177
|
-
*
|
|
4178
|
-
*
|
|
4560
|
+
* A failed tick with a quote in hand keeps it and the next tick retries.
|
|
4561
|
+
* Quoting waits while `outputTokenDecimals` is `null` and until the CoinList
|
|
4562
|
+
* provider finishes initializing. Disabled it neither fetches nor holds a
|
|
4563
|
+
* timer; a quote already in hand survives being switched off.
|
|
4179
4564
|
*/
|
|
4180
4565
|
declare function useSwapQuote(options: UseSwapQuoteOptions): UseSwapQuoteResult;
|
|
4181
4566
|
|
|
@@ -4338,10 +4723,11 @@ type SuperstateWalletUiState = {
|
|
|
4338
4723
|
type: 'active';
|
|
4339
4724
|
/** The user's CoinList wallets. Empty when they have none. */
|
|
4340
4725
|
embeddedWallets: CheckoutEmbeddedWalletUi[];
|
|
4341
|
-
/**
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4726
|
+
/**
|
|
4727
|
+
* The external-wallet row: absent when the host offers no connector,
|
|
4728
|
+
* an invitation to connect one, or the connected wallet.
|
|
4729
|
+
*/
|
|
4730
|
+
externalWallet: CheckoutExternalWalletUi;
|
|
4345
4731
|
/**
|
|
4346
4732
|
* Confirming runs the authorization, so this reports its phase as
|
|
4347
4733
|
* loading copy — `Sign the message in your wallet…` and the rest.
|
|
@@ -4385,7 +4771,7 @@ type SuperstateWalletUiEvent = {
|
|
|
4385
4771
|
type SuperstateSwapCheckoutUiState = {
|
|
4386
4772
|
type: 'content';
|
|
4387
4773
|
wallet: SuperstateWalletUiState;
|
|
4388
|
-
amount:
|
|
4774
|
+
amount: CheckoutAmountUiState;
|
|
4389
4775
|
review: SuperstateReviewUiState;
|
|
4390
4776
|
/** The sale panel. Read-only, so it raises no events. */
|
|
4391
4777
|
sidebar: SuperstateSidebarUiState;
|
|
@@ -4420,7 +4806,7 @@ type SuperstateSwapLoadErrorReason =
|
|
|
4420
4806
|
* edit events are `ON_EDIT_WALLET` and `ON_EDIT_AMOUNT` rather than a shared
|
|
4421
4807
|
* `ON_EDIT`.
|
|
4422
4808
|
*/
|
|
4423
|
-
type SuperstateSwapCheckoutUiEvent = SuperstateWalletUiEvent |
|
|
4809
|
+
type SuperstateSwapCheckoutUiEvent = SuperstateWalletUiEvent | CheckoutAmountUiEvent | SuperstateReviewUiEvent | SuperstateOrderConfirmedUiEvent | SuperstateSwapCheckoutRetryUiEvent;
|
|
4424
4810
|
/**
|
|
4425
4811
|
* Retrying the load behind the flow-level `error` arm.
|
|
4426
4812
|
*
|
|
@@ -4440,7 +4826,7 @@ type SuperstateSwapCheckoutRetryUiEvent = {
|
|
|
4440
4826
|
*/
|
|
4441
4827
|
type SuperstateOrderConfirmedUiState = {
|
|
4442
4828
|
type: 'hidden';
|
|
4443
|
-
} | {
|
|
4829
|
+
} | ({
|
|
4444
4830
|
type: 'visible';
|
|
4445
4831
|
/** What was bought. */
|
|
4446
4832
|
asset: CheckoutAssetUi;
|
|
@@ -4464,14 +4850,7 @@ type SuperstateOrderConfirmedUiState = {
|
|
|
4464
4850
|
* `outputAmount`, so `outputAmountConfirmed` covers it too.
|
|
4465
4851
|
*/
|
|
4466
4852
|
pricePerShare: FormattedAmountAssetUi;
|
|
4467
|
-
|
|
4468
|
-
recipientAddress: ShortenedWalletAddress;
|
|
4469
|
-
/**
|
|
4470
|
-
* The settled swap on a block explorer. Always present: the dialog only
|
|
4471
|
-
* exists once there is a mined transaction to point at.
|
|
4472
|
-
*/
|
|
4473
|
-
txExplorerUrl: TxExplorerUrl;
|
|
4474
|
-
};
|
|
4853
|
+
} & CheckoutReceiptUi);
|
|
4475
4854
|
/**
|
|
4476
4855
|
* Closing is the only thing the dialog raises.
|
|
4477
4856
|
*
|
|
@@ -4499,7 +4878,17 @@ interface UseSuperstateSwapCheckoutViewModelOptions {
|
|
|
4499
4878
|
* Fixed for the lifetime of the hook, as `offer` is.
|
|
4500
4879
|
*/
|
|
4501
4880
|
chain: EthereumChain;
|
|
4502
|
-
/**
|
|
4881
|
+
/**
|
|
4882
|
+
* The host's wallets, its connector for an external one if any, and
|
|
4883
|
+
* optionally the wallet it has already settled on.
|
|
4884
|
+
*
|
|
4885
|
+
* `wallets.preselected` never skips the wallet step here: that step
|
|
4886
|
+
* allow-lists the wallet on-chain, which no preselection can stand in for.
|
|
4887
|
+
* It pre-selects the wallet's row instead, so the user confirms and
|
|
4888
|
+
* allow-lists it rather than picking it again. A preselected wallet that
|
|
4889
|
+
* is neither one of `embedded` nor the connected `external` has no row to
|
|
4890
|
+
* select, and the step opens with nothing picked.
|
|
4891
|
+
*/
|
|
4503
4892
|
wallets: CheckoutWalletSelection;
|
|
4504
4893
|
/**
|
|
4505
4894
|
* Default `true`. When `false` nothing is fetched and no timer runs, for a
|
|
@@ -4598,11 +4987,14 @@ declare function useCentrifugeClaim(): UseCentrifugeClaimResult;
|
|
|
4598
4987
|
* failures: a flaky tick must not make a claimable position vanish under the
|
|
4599
4988
|
* user. A read that has never answered is absent, not zero. `ERROR` is
|
|
4600
4989
|
* reserved for the case where nothing answered at all, so a screen has
|
|
4601
|
-
* nothing to show but a retry.
|
|
4990
|
+
* nothing to show but a retry. `DISABLED` means the hook is switched off and
|
|
4991
|
+
* holds nothing.
|
|
4602
4992
|
*
|
|
4603
4993
|
* @alpha
|
|
4604
4994
|
*/
|
|
4605
4995
|
type LoadCentrifugeClaimPositionsState = {
|
|
4996
|
+
type: 'DISABLED';
|
|
4997
|
+
} | {
|
|
4606
4998
|
type: 'LOADING';
|
|
4607
4999
|
} | {
|
|
4608
5000
|
type: 'ERROR';
|
|
@@ -4629,8 +5021,7 @@ interface UseCentrifugeClaimPositionsOptions {
|
|
|
4629
5021
|
*/
|
|
4630
5022
|
data?: CentrifugeVaultLeg[];
|
|
4631
5023
|
/**
|
|
4632
|
-
* Default `true`. When `false`: no requests, no timers, and
|
|
4633
|
-
* `CONTENT`.
|
|
5024
|
+
* Default `true`. When `false`: no requests, no timers, and `DISABLED`.
|
|
4634
5025
|
*/
|
|
4635
5026
|
enabled?: boolean;
|
|
4636
5027
|
}
|
|
@@ -4663,85 +5054,132 @@ interface UseCentrifugeClaimPositionsResult {
|
|
|
4663
5054
|
*/
|
|
4664
5055
|
declare function useCentrifugeClaimPositions(options: UseCentrifugeClaimPositionsOptions): UseCentrifugeClaimPositionsResult;
|
|
4665
5056
|
|
|
4666
|
-
|
|
4667
|
-
|
|
5057
|
+
/**
|
|
5058
|
+
* The token-sale claim card.
|
|
5059
|
+
*
|
|
5060
|
+
* `HIDDEN` renders nothing: the card is switched off, or the user is signed
|
|
5061
|
+
* out and the host decides whether to ask them in. `CONTENT` with no rows is
|
|
5062
|
+
* a real answer - nothing placed yet - and renders as such.
|
|
5063
|
+
*
|
|
5064
|
+
* @alpha
|
|
5065
|
+
*/
|
|
5066
|
+
type CoinListTokenSaleClaimUiState = {
|
|
5067
|
+
type: 'HIDDEN';
|
|
5068
|
+
} | {
|
|
4668
5069
|
type: 'LOADING';
|
|
4669
5070
|
} | {
|
|
4670
5071
|
type: 'ERROR';
|
|
4671
|
-
reason: LoadOfferDetailsReason;
|
|
4672
5072
|
} | {
|
|
4673
5073
|
type: 'CONTENT';
|
|
4674
|
-
|
|
5074
|
+
rows: ParticipationRowUi[];
|
|
4675
5075
|
};
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
5076
|
+
/** @alpha */
|
|
5077
|
+
type CoinListTokenSaleClaimUiEvent = {
|
|
5078
|
+
type: 'ON_RETRY_LOAD';
|
|
5079
|
+
};
|
|
5080
|
+
/**
|
|
5081
|
+
* Where a participation stands, in the steps a user can tell apart.
|
|
5082
|
+
*
|
|
5083
|
+
* - `processing`: the approval is being verified, or the payment is being
|
|
5084
|
+
* committed to the sale's contract.
|
|
5085
|
+
* - `committed`: the payment is held by the sale until it settles.
|
|
5086
|
+
* - `failed`: the approval or the commit failed, so nothing was taken.
|
|
5087
|
+
* - `refunding`: a refund is on its way back to the wallet that paid.
|
|
5088
|
+
* - `refunded`: the refund arrived. It may be the whole payment or only what
|
|
5089
|
+
* the allocation did not use; the API does not say which.
|
|
5090
|
+
* - `refund-failed`: the refund transaction failed, and support has to step
|
|
5091
|
+
* in.
|
|
5092
|
+
*
|
|
5093
|
+
* @alpha
|
|
5094
|
+
*/
|
|
5095
|
+
type ParticipationStatusUi = 'processing' | 'committed' | 'failed' | 'refunding' | 'refunded' | 'refund-failed';
|
|
5096
|
+
/** @alpha */
|
|
5097
|
+
declare const ParticipationStatusUi: {
|
|
4682
5098
|
/**
|
|
4683
|
-
*
|
|
4684
|
-
*
|
|
5099
|
+
* Folds the backend's eight steps into the six a user can act on. The
|
|
5100
|
+
* three before the payment is held - approval unverified, queued for a
|
|
5101
|
+
* commit batch, commit broadcast - are one wait to the user.
|
|
4685
5102
|
*/
|
|
4686
|
-
|
|
4687
|
-
}
|
|
4688
|
-
interface UseOfferDetailsResult {
|
|
4689
|
-
offerDetailsState: LoadOfferDetailsState;
|
|
4690
|
-
}
|
|
5103
|
+
fromDomain: (status: ParticipationStatus) => ParticipationStatusUi;
|
|
5104
|
+
};
|
|
4691
5105
|
/**
|
|
4692
|
-
*
|
|
5106
|
+
* How a row reads its dates: the current instant, and the wall clock to read
|
|
5107
|
+
* them on (`undefined` for the runtime's own).
|
|
4693
5108
|
*
|
|
4694
|
-
*
|
|
4695
|
-
* the client-side fetch entirely. Pass `enabled: false` to skip the fetch
|
|
4696
|
-
* when the hook must be called but the data is not needed yet.
|
|
4697
|
-
*
|
|
4698
|
-
* Returns `LOADING` while CoinList is initializing or while details are being fetched.
|
|
4699
|
-
* Returns `CONTENT` with the offer when `offers.get()` succeeds.
|
|
4700
|
-
* Returns `ERROR` with:
|
|
4701
|
-
* - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
|
|
4702
|
-
* - `generic-error` for any other failure
|
|
5109
|
+
* @alpha
|
|
4703
5110
|
*/
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
type LoadOffersState = {
|
|
4708
|
-
type: 'LOADING';
|
|
4709
|
-
} | {
|
|
4710
|
-
type: 'ERROR';
|
|
4711
|
-
reason: LoadOffersReason;
|
|
4712
|
-
} | {
|
|
4713
|
-
type: 'CONTENT';
|
|
4714
|
-
offers: Offer[];
|
|
5111
|
+
type ParticipationClockUi = {
|
|
5112
|
+
now: EpochMillis;
|
|
5113
|
+
timeZone: string | undefined;
|
|
4715
5114
|
};
|
|
4716
|
-
|
|
5115
|
+
/**
|
|
5116
|
+
* One participation as a row of the card.
|
|
5117
|
+
*
|
|
5118
|
+
* @alpha
|
|
5119
|
+
*/
|
|
5120
|
+
type ParticipationRowUi = {
|
|
5121
|
+
key: ParticipationId;
|
|
5122
|
+
/** The coin it was paid in: its name for the icon's alt text, and its icon. */
|
|
5123
|
+
asset: {
|
|
5124
|
+
name: string;
|
|
5125
|
+
iconUrl: AssetIconUrl | null;
|
|
5126
|
+
};
|
|
5127
|
+
/** What was paid, e.g. `1,000.00 USDC`. */
|
|
5128
|
+
amount: FormattedAmountAssetUi;
|
|
5129
|
+
status: ParticipationStatusUi;
|
|
5130
|
+
/** The wallet that paid, by label or shortened address; `null` if unknown. */
|
|
5131
|
+
wallet: string | null;
|
|
4717
5132
|
/**
|
|
4718
|
-
*
|
|
4719
|
-
*
|
|
5133
|
+
* When it was placed, on the user's clock and without the year when it is
|
|
5134
|
+
* this one - `Oct 15, 10:14 AM`; `null` if the API did not say.
|
|
4720
5135
|
*/
|
|
4721
|
-
|
|
5136
|
+
placedAt: string | null;
|
|
5137
|
+
};
|
|
5138
|
+
/** @alpha */
|
|
5139
|
+
declare const ParticipationRowUi: {
|
|
5140
|
+
fromDomain: (participation: Participation, { walletLabel, locale, clock, }: {
|
|
5141
|
+
walletLabel: WalletLabelResolver | undefined;
|
|
5142
|
+
locale: string;
|
|
5143
|
+
clock: ParticipationClockUi;
|
|
5144
|
+
}) => ParticipationRowUi;
|
|
5145
|
+
};
|
|
5146
|
+
|
|
5147
|
+
/** @alpha */
|
|
5148
|
+
interface UseCoinListTokenSaleClaimViewModelOptions {
|
|
5149
|
+
offer: CoinListTokenSaleOfferDetail;
|
|
5150
|
+
/** Names the wallet that paid; unnamed ones show a shortened address. */
|
|
5151
|
+
walletLabel?: WalletLabelResolver;
|
|
4722
5152
|
/**
|
|
4723
|
-
*
|
|
4724
|
-
*
|
|
5153
|
+
* The offer's participations pre-fetched on the server, so the card opens
|
|
5154
|
+
* on them. The poll still reads. Dates render in UTC on the server and
|
|
5155
|
+
* through hydration, so the markup matches on any clock, then on the
|
|
5156
|
+
* user's own clock from the render straight after.
|
|
4725
5157
|
*/
|
|
5158
|
+
data?: Participation[];
|
|
5159
|
+
/** How often to read the participations again while the page is visible. */
|
|
5160
|
+
pollInterval?: Seconds;
|
|
5161
|
+
/** Default `true`. `false` turns off every request and timer. */
|
|
4726
5162
|
enabled?: boolean;
|
|
4727
5163
|
}
|
|
4728
|
-
|
|
4729
|
-
|
|
5164
|
+
/** @alpha */
|
|
5165
|
+
interface UseCoinListTokenSaleClaimViewModelResult {
|
|
5166
|
+
state: CoinListTokenSaleClaimUiState;
|
|
5167
|
+
onEvent: (event: CoinListTokenSaleClaimUiEvent) => void;
|
|
4730
5168
|
}
|
|
4731
5169
|
/**
|
|
4732
|
-
*
|
|
5170
|
+
* The token-sale claim card: every participation the user has placed in an
|
|
5171
|
+
* offer, across its options and whichever wallet paid, and where each one
|
|
5172
|
+
* stands.
|
|
4733
5173
|
*
|
|
4734
|
-
*
|
|
4735
|
-
*
|
|
4736
|
-
*
|
|
5174
|
+
* Nothing here is claimed. A token sale pushes the tokens it allocates once
|
|
5175
|
+
* it settles and refunds what it does not use, so the card follows each
|
|
5176
|
+
* participation through those steps and the user has nothing to press but a
|
|
5177
|
+
* retry. The list is account-wide rather than read per wallet, so it needs
|
|
5178
|
+
* none of the host's wallets.
|
|
4737
5179
|
*
|
|
4738
|
-
*
|
|
4739
|
-
* Returns `CONTENT` with all offers when `fetchOffers()` succeeds.
|
|
4740
|
-
* Returns `ERROR` with:
|
|
4741
|
-
* - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
|
|
4742
|
-
* - `generic-error` for any other failure
|
|
5180
|
+
* @alpha
|
|
4743
5181
|
*/
|
|
4744
|
-
declare function
|
|
5182
|
+
declare function useCoinListTokenSaleClaimViewModel({ offer, walletLabel, data, pollInterval, enabled, }: UseCoinListTokenSaleClaimViewModelOptions): UseCoinListTokenSaleClaimViewModelResult;
|
|
4745
5183
|
|
|
4746
5184
|
/**
|
|
4747
5185
|
* A display-ready connect-wallet error: the core flow's machine-readable code
|
|
@@ -5032,120 +5470,6 @@ interface UseRequirementsChecklistViewModelResult {
|
|
|
5032
5470
|
*/
|
|
5033
5471
|
declare function useRequirementsChecklistViewModel(options: UseRequirementsChecklistViewModelOptions): UseRequirementsChecklistViewModelResult;
|
|
5034
5472
|
|
|
5035
|
-
/**
|
|
5036
|
-
* The state of one vault's status poll.
|
|
5037
|
-
*
|
|
5038
|
-
* Stale-preserving: a failed tick with a status in hand keeps it, so a flaky
|
|
5039
|
-
* read never reads as "vault halted". `ERROR` means the status is unknown -
|
|
5040
|
-
* which is not the same as `CONTENT` carrying a blocked orderability, and
|
|
5041
|
-
* callers must not conflate them. A vault that is *known* to be unorderable
|
|
5042
|
-
* may block a request; one that is merely unknown may not.
|
|
5043
|
-
*
|
|
5044
|
-
* `below_minimum` never appears here: it needs an amount, which this
|
|
5045
|
-
* endpoint is never given.
|
|
5046
|
-
*
|
|
5047
|
-
* @alpha
|
|
5048
|
-
*/
|
|
5049
|
-
type LoadCentrifugeVaultStatusState = {
|
|
5050
|
-
type: 'LOADING';
|
|
5051
|
-
} | {
|
|
5052
|
-
type: 'ERROR';
|
|
5053
|
-
reason: CentrifugeLoadErrorReason;
|
|
5054
|
-
} | {
|
|
5055
|
-
type: 'CONTENT';
|
|
5056
|
-
status: CentrifugeVaultStatus;
|
|
5057
|
-
};
|
|
5058
|
-
/** @alpha */
|
|
5059
|
-
interface UseCentrifugeVaultStatusesOptions {
|
|
5060
|
-
/** The vaults to poll, typically one per chain an offer runs on. */
|
|
5061
|
-
vaults: CentrifugeVaultRef[];
|
|
5062
|
-
/** How often to refresh. Defaults to {@link CENTRIFUGE_POLL_INTERVAL_MS}. */
|
|
5063
|
-
pollIntervalMs?: number;
|
|
5064
|
-
/**
|
|
5065
|
-
* Statuses the caller already holds, typically fetched server-side, each
|
|
5066
|
-
* opening the state of the vault it names so a server-rendered panel needs
|
|
5067
|
-
* no loading pass.
|
|
5068
|
-
*
|
|
5069
|
-
* They seed the first render only: the poll still fetches immediately. A
|
|
5070
|
-
* vault that was orderable a minute ago can be unlinked now, so a seed
|
|
5071
|
-
* that suppressed the first read would be answering "can I act right now"
|
|
5072
|
-
* with whenever the page was rendered.
|
|
5073
|
-
*/
|
|
5074
|
-
data?: CentrifugeVaultStatus[];
|
|
5075
|
-
/** When false, the hook neither fetches nor polls. */
|
|
5076
|
-
enabled: boolean;
|
|
5077
|
-
}
|
|
5078
|
-
/** @alpha */
|
|
5079
|
-
interface UseCentrifugeVaultStatusesResult {
|
|
5080
|
-
/** One entry per vault asked for, in the order asked. */
|
|
5081
|
-
statuses: {
|
|
5082
|
-
vault: CentrifugeVaultRef;
|
|
5083
|
-
state: LoadCentrifugeVaultStatusState;
|
|
5084
|
-
}[];
|
|
5085
|
-
}
|
|
5086
|
-
/**
|
|
5087
|
-
* Polls whether each of several Centrifuge vaults can be acted on right now,
|
|
5088
|
-
* independent of any wallet or amount.
|
|
5089
|
-
*
|
|
5090
|
-
* Free to poll - it spends no attestation. Centrifuge announces none of the
|
|
5091
|
-
* changes this reports, so the poll is the only way a screen notices a vault
|
|
5092
|
-
* halting under it. Each vault is read independently on one shared timer, so
|
|
5093
|
-
* one failing chain never holds back another.
|
|
5094
|
-
*
|
|
5095
|
-
* A seeded status opens its vault's state instead of `LOADING` and is
|
|
5096
|
-
* otherwise left to the poll: the first tick fires as it always does, and
|
|
5097
|
-
* only replaces the seed once it has a status of its own.
|
|
5098
|
-
*
|
|
5099
|
-
* Disabled it neither fetches nor holds a timer, and each vault stays on
|
|
5100
|
-
* whatever state it held. That is `LOADING` and not an empty `CONTENT`
|
|
5101
|
-
* because there is no empty vault status - and an invented one would be
|
|
5102
|
-
* worse than none, since `CONTENT` here is what a caller is allowed to block
|
|
5103
|
-
* on.
|
|
5104
|
-
*
|
|
5105
|
-
* @alpha
|
|
5106
|
-
*/
|
|
5107
|
-
declare function useCentrifugeVaultStatuses(options: UseCentrifugeVaultStatusesOptions): UseCentrifugeVaultStatusesResult;
|
|
5108
|
-
|
|
5109
|
-
/** @alpha */
|
|
5110
|
-
interface UseCentrifugeVaultStatusOptions {
|
|
5111
|
-
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
5112
|
-
symbol: AssetSymbol;
|
|
5113
|
-
chain: EthereumChain;
|
|
5114
|
-
/** How often to refresh. Defaults to `CENTRIFUGE_POLL_INTERVAL_MS`. */
|
|
5115
|
-
pollIntervalMs?: number;
|
|
5116
|
-
/**
|
|
5117
|
-
* A status the caller already holds, typically fetched server-side, used
|
|
5118
|
-
* as the state the hook opens on so a server-rendered panel needs no
|
|
5119
|
-
* loading pass.
|
|
5120
|
-
*
|
|
5121
|
-
* It seeds the first render only: the poll still fetches immediately. A
|
|
5122
|
-
* vault that was orderable a minute ago can be unlinked now, so a seed
|
|
5123
|
-
* that suppressed the first read would be answering "can I invest right
|
|
5124
|
-
* now" with whenever the page was rendered.
|
|
5125
|
-
*/
|
|
5126
|
-
data?: CentrifugeVaultStatus;
|
|
5127
|
-
/** When false, the hook neither fetches nor polls. */
|
|
5128
|
-
enabled: boolean;
|
|
5129
|
-
}
|
|
5130
|
-
/** @alpha */
|
|
5131
|
-
interface UseCentrifugeVaultStatusResult {
|
|
5132
|
-
state: LoadCentrifugeVaultStatusState;
|
|
5133
|
-
}
|
|
5134
|
-
/**
|
|
5135
|
-
* Polls whether a Centrifuge vault can take a request at all right now,
|
|
5136
|
-
* independent of any amount.
|
|
5137
|
-
*
|
|
5138
|
-
* Free to poll - it spends no attestation. Centrifuge announces none of the
|
|
5139
|
-
* changes this reports, so the poll is the only way a checkout notices
|
|
5140
|
-
* mid-order.
|
|
5141
|
-
*
|
|
5142
|
-
* The one-vault case of {@link useCentrifugeVaultStatuses}, which carries the
|
|
5143
|
-
* seeding, stale-preserving and disabled semantics.
|
|
5144
|
-
*
|
|
5145
|
-
* @alpha
|
|
5146
|
-
*/
|
|
5147
|
-
declare function useCentrifugeVaultStatus(options: UseCentrifugeVaultStatusOptions): UseCentrifugeVaultStatusResult;
|
|
5148
|
-
|
|
5149
5473
|
interface UseErc20BalanceOptions {
|
|
5150
5474
|
/**
|
|
5151
5475
|
* The token to read, by contract address.
|
|
@@ -5156,26 +5480,47 @@ interface UseErc20BalanceOptions {
|
|
|
5156
5480
|
* has one.
|
|
5157
5481
|
*/
|
|
5158
5482
|
tokenAddress: EvmContractAddress | null;
|
|
5159
|
-
|
|
5483
|
+
/**
|
|
5484
|
+
* The wallet whose balance is read. `null` when there is no wallet yet,
|
|
5485
|
+
* which reads nothing and holds `DISABLED`, exactly as `enabled: false`
|
|
5486
|
+
* does: there is no holding to wait for.
|
|
5487
|
+
*/
|
|
5488
|
+
owner: EvmWalletAddress | null;
|
|
5160
5489
|
chain: EthereumChain;
|
|
5161
5490
|
/** How often to refresh. Defaults to {@link ERC20_BALANCE_POLL_INTERVAL_MS}. */
|
|
5162
5491
|
pollIntervalMs?: number;
|
|
5163
5492
|
/** When false, the hook neither fetches nor polls. */
|
|
5164
5493
|
enabled: boolean;
|
|
5165
5494
|
}
|
|
5495
|
+
/**
|
|
5496
|
+
* The state of one balance read.
|
|
5497
|
+
*
|
|
5498
|
+
* Every arm answers for the token, owner and chain currently named by the
|
|
5499
|
+
* options, and nothing else: from the moment any of them changes the state is
|
|
5500
|
+
* `LOADING` until the read for the new one lands. A balance carried across
|
|
5501
|
+
* that change would be a number read for something else, indistinguishable
|
|
5502
|
+
* from a fresh one.
|
|
5503
|
+
*
|
|
5504
|
+
* - `DISABLED`: switched off. No balance is held, for the same reason.
|
|
5505
|
+
* - `LOADING`: no read has settled for this request yet, or `tokenAddress` is
|
|
5506
|
+
* not known yet.
|
|
5507
|
+
* - `ERROR`: the last read failed. A failed read is not a zero balance, and an
|
|
5508
|
+
* order must not be sized against the one before it, so it is dropped.
|
|
5509
|
+
* - `CONTENT`: raw base units of the token.
|
|
5510
|
+
*/
|
|
5511
|
+
type LoadErc20BalanceState = {
|
|
5512
|
+
type: 'DISABLED';
|
|
5513
|
+
} | {
|
|
5514
|
+
type: 'LOADING';
|
|
5515
|
+
} | {
|
|
5516
|
+
type: 'ERROR';
|
|
5517
|
+
reason: LoadErrorReason;
|
|
5518
|
+
} | {
|
|
5519
|
+
type: 'CONTENT';
|
|
5520
|
+
balance: bigint;
|
|
5521
|
+
};
|
|
5166
5522
|
interface UseErc20BalanceResult {
|
|
5167
|
-
|
|
5168
|
-
* Raw base units of the token currently named by the options, or `null`.
|
|
5169
|
-
*
|
|
5170
|
-
* `null` covers every state that is not a settled read of *this* request:
|
|
5171
|
-
* before the first one settles, after one fails, while disabled, and from
|
|
5172
|
-
* the moment the token, owner or chain changes until the read for the new
|
|
5173
|
-
* one lands. A caller cannot tell those apart on purpose - none of them is a
|
|
5174
|
-
* number to size an order against - and `isLoading` is what says whether to
|
|
5175
|
-
* wait.
|
|
5176
|
-
*/
|
|
5177
|
-
balance: bigint | null;
|
|
5178
|
-
isLoading: boolean;
|
|
5523
|
+
state: LoadErc20BalanceState;
|
|
5179
5524
|
}
|
|
5180
5525
|
/**
|
|
5181
5526
|
* Polls one wallet's balance of one ERC-20, named by contract address.
|
|
@@ -5189,15 +5534,18 @@ interface UseErc20BalanceResult {
|
|
|
5189
5534
|
* each independently, which is a different job from following a single token
|
|
5190
5535
|
* whose address may not be known yet.
|
|
5191
5536
|
*
|
|
5192
|
-
*
|
|
5193
|
-
*
|
|
5194
|
-
* until the first read settles; background polls do not toggle it. Disabled, or
|
|
5195
|
-
* with no `tokenAddress`, it neither fetches nor holds a timer.
|
|
5537
|
+
* Disabled, with no `owner`, or with no `tokenAddress`, it neither fetches
|
|
5538
|
+
* nor holds a timer.
|
|
5196
5539
|
*/
|
|
5197
5540
|
declare function useErc20Balance(options: UseErc20BalanceOptions): UseErc20BalanceResult;
|
|
5198
5541
|
|
|
5199
5542
|
interface UseErc20TokenBalancesOptions {
|
|
5200
|
-
|
|
5543
|
+
/**
|
|
5544
|
+
* The wallet whose balances are read. `null` when there is no wallet yet -
|
|
5545
|
+
* a checkout step waiting on the wallet step - which reads nothing and holds
|
|
5546
|
+
* `DISABLED`, exactly as `enabled: false` does.
|
|
5547
|
+
*/
|
|
5548
|
+
address: EvmWalletAddress | null;
|
|
5201
5549
|
chain: EthereumChain;
|
|
5202
5550
|
/** The assets to read balances for. */
|
|
5203
5551
|
assets: NonEmptyArray<StablecoinSymbol>;
|
|
@@ -5209,29 +5557,47 @@ interface UseErc20TokenBalancesOptions {
|
|
|
5209
5557
|
/** When false, the hook neither fetches nor polls. */
|
|
5210
5558
|
enabled: boolean;
|
|
5211
5559
|
}
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5560
|
+
/**
|
|
5561
|
+
* The state of the balance reads.
|
|
5562
|
+
*
|
|
5563
|
+
* Every arm answers for the address, chain and assets currently named by the
|
|
5564
|
+
* options: from the moment any of them changes the state is `LOADING` until
|
|
5565
|
+
* the reads for the new ones land, so one wallet's balances never stand in
|
|
5566
|
+
* for another's.
|
|
5567
|
+
*
|
|
5568
|
+
* - `DISABLED`: switched off. No balances are held.
|
|
5569
|
+
* - `LOADING`: no poll has settled for this request yet.
|
|
5570
|
+
* - `ERROR`: every read the last poll made failed, so there is no balance at
|
|
5571
|
+
* all to show.
|
|
5572
|
+
* - `CONTENT`: raw on-chain balances keyed by the requested assets. Each
|
|
5573
|
+
* requested asset with a deployment on the chain has an entry (`bigint` on
|
|
5574
|
+
* success, `null` on a failed read). Assets the chain has no deployment for
|
|
5575
|
+
* (e.g. USDT on Base Sepolia) are omitted entirely, so absence and failure
|
|
5576
|
+
* stay tellable apart.
|
|
5577
|
+
*/
|
|
5578
|
+
type LoadErc20TokenBalancesState = {
|
|
5579
|
+
type: 'DISABLED';
|
|
5580
|
+
} | {
|
|
5581
|
+
type: 'LOADING';
|
|
5582
|
+
} | {
|
|
5583
|
+
type: 'ERROR';
|
|
5584
|
+
reason: LoadErrorReason;
|
|
5585
|
+
} | {
|
|
5586
|
+
type: 'CONTENT';
|
|
5220
5587
|
balances: Map<StablecoinSymbol, bigint | null>;
|
|
5221
|
-
|
|
5588
|
+
};
|
|
5589
|
+
interface UseErc20TokenBalancesResult {
|
|
5590
|
+
state: LoadErc20TokenBalancesState;
|
|
5222
5591
|
}
|
|
5223
5592
|
/**
|
|
5224
5593
|
* Polls the raw ERC-20 balances of `assets` for `address`, refreshing every
|
|
5225
5594
|
* `pollIntervalMs`. Each asset settles independently: a failed read maps to
|
|
5226
5595
|
* `null` while the others still resolve, and an asset the chain has no
|
|
5227
5596
|
* deployment for is omitted from the result rather than read at a fake
|
|
5228
|
-
* address.
|
|
5229
|
-
* flight. `assets` is compared by contents, so passing an inline array does
|
|
5597
|
+
* address. `assets` is compared by contents, so passing an inline array does
|
|
5230
5598
|
* not restart the poll.
|
|
5231
5599
|
*
|
|
5232
|
-
*
|
|
5233
|
-
* not toggle it. Disabled (or before the provider is ready) the hook does not
|
|
5234
|
-
* fetch.
|
|
5600
|
+
* Disabled, or with no `address`, it neither fetches nor holds a timer.
|
|
5235
5601
|
*/
|
|
5236
5602
|
declare function useErc20TokenBalances(options: UseErc20TokenBalancesOptions): UseErc20TokenBalancesResult;
|
|
5237
5603
|
|
|
@@ -5367,4 +5733,4 @@ declare class CoinListClientInitializationError extends Error {
|
|
|
5367
5733
|
constructor(message?: string);
|
|
5368
5734
|
}
|
|
5369
5735
|
|
|
5370
|
-
export { type AuthState, type AuthorizeWalletParams, type BuyCentrifugeParams, type CentrifugeBuyAmountUiEvent, type CentrifugeBuyAmountUiState, type CentrifugeBuyCheckoutUiEvent, type CentrifugeBuyCheckoutUiState, type CentrifugeBuyError, type CentrifugeBuyPhase, type CentrifugeBuyPlacementError, type CentrifugeBuyPlacementPhase, type CentrifugeBuyPlacementResult, type CentrifugeBuyPreparationError, type CentrifugeBuyPreparationPhase, type CentrifugeBuyPreparationResult, type CentrifugeBuyResult, type CentrifugeBuyReviewUiEvent, type CentrifugeBuyReviewUiState, 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 CentrifugeSidebarMinimumUi, type CentrifugeSidebarUiState, type CentrifugeVaultCheckoutConfig, type CentrifugeVaultClaimConfig, type CentrifugeVaultClaimUiEvent, type CentrifugeVaultClaimUiState, type CentrifugeVaultClaimed, type CentrifugeWalletSelectUiEvent, type CentrifugeWalletSelectUiState, 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 ClientAuthNamespace, type ClientCentrifugeNamespace, type ClientCoinListTokenSaleNamespace, type ClientConfig, type ClientOndoNamespace, type ClientRequirementsNamespace, type ClientSuperstateSwapNamespace, type ClientSupportNamespace, type ClientWalletsNamespace, type CoinListClient, CoinListClientInitializationError, CoinListProvider, type CoinListProviderProps, CoinListSignInButton, type CoinListSignInButtonProps, CoinListSignInCardContainer, type CoinListSignInCardContainerProps, type CoinListSignInCardUiEvent, type CoinListSignInCardUiState, CoinListStyleScope, type CoinListStyleScopeProps, type CoinListTokenSaleCheckoutConfig, type CompleteOAuthFailureReason, type ConnectWalletError, type ConnectWalletErrorCode, type ConnectWalletFlowError, type ConnectWalletFlowResult, type ConnectWalletParams, type ConnectWalletPhase, type ConnectWalletSignState, type ConnectWalletState, type ConnectedWalletUi, type Erc20AllowanceError, type Erc20AllowancePhase, type Erc20ApprovalError, type ExecuteOndoSwapParams, type ExecuteSwapParams, type ExecuteTokenSaleParams, type ExternalWalletRequestUi, type KycTokenErrorReason, type KycTokenState, type LoadCentrifugeBuyTransactionState, type LoadCentrifugeClaimPositionsState, 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, type LogoImageUi, type OAuthClientErrorReason, type OAuthClientResult, OfferAssetCard, type OfferAssetCardProps, OfferAssetCardUi, OfferLogoUi, OfferSaleCard, type OfferSaleCardProps, OfferSaleCardUi, OffersGridContainer, type OffersGridContainerProps, type OffersGridData, type OndoBuyAmountUiEvent, type OndoBuyAmountUiState, type OndoBuyCheckoutUiEvent, type OndoBuyCheckoutUiState, type OndoBuyOrderPlaced, type OndoBuyOrderTerms, type OndoBuyPreparationResult, type OndoBuyQuoteStatusUi, type OndoBuyReviewUiEvent, type OndoBuyReviewUiState, type OndoCheckoutConfig, OndoCheckoutErrorReason, type OndoLoadErrorReason, type OndoOrderConfirmedUiEvent, type OndoOrderConfirmedUiState, type OndoOrderPlaced, type OndoOrderPlacedCore, type OndoSellAmountUiEvent, type OndoSellAmountUiState, type OndoSellBalanceUi, type OndoSellCheckoutUiEvent, type OndoSellCheckoutUiState, type OndoSellOrderConfirmedUiEvent, type OndoSellOrderConfirmedUiState, type OndoSellOrderPlaced, type OndoSellOrderTerms, type OndoSellOutcomeUi, type OndoSellPreparationResult, type OndoSellQuoteStatusUi, type OndoSellReviewUiEvent, type OndoSellReviewUiState, type OndoSellSourceWalletUi, type OndoSidebarPriceUi, type OndoSidebarUiState, type OndoSwapExecutionError, type OndoSwapExecutionPhase, type OndoSwapExecutionResult, type OndoSwapPreparationError, type OndoSwapPreparationPhase, type OndoSwapPreparationResult, type OndoWalletSelectUiEvent, type OndoWalletSelectUiState, type PlaceCentrifugeRequestParams, type PrepareCentrifugeBuyParams, type PrepareOndoBuyParams, type PrepareOndoSellParams, type PrepareOndoSwapParamsCore, RequirementItemUi, RequirementStatus, RequirementVariant, RequirementsChecklistContainer, type RequirementsChecklistContainerProps, type RequirementsChecklistItemUi, type RequirementsChecklistUiEvent, type RequirementsChecklistUiState, RequirementsChecklistView, type RequirementsChecklistViewProps, type RequirementsData, type RequirementsVerificationUi, type SignState, type SuperstateAmountUiEvent, type SuperstateAmountUiState, type SuperstateCheckoutConfig, type SuperstateOrderConfirmedUiEvent, type SuperstateOrderConfirmedUiState, type SuperstateOrderPlaced, type SuperstateReviewUiEvent, type SuperstateReviewUiState, type SuperstateSidebarPriceUi, type SuperstateSidebarUiState, type SuperstateSlippageOptionUi, type SuperstateSlippageUi, type SuperstateSwapCheckoutRetryUiEvent, type SuperstateSwapCheckoutUiEvent, type SuperstateSwapCheckoutUiState, type SuperstateSwapLoadErrorReason, type SuperstateWalletUiEvent, type SuperstateWalletUiState, type SwapExecutionError, type SwapExecutionPhase, type SwapExecutionResult, type SwapOutputTokenState, type TaxDocumentAddressParts, type TaxDocumentFields, type TaxDocumentState, type TokenSaleExecutionError, type TokenSaleExecutionPhase, type TokenSaleExecutionResult, type UseCentrifugeBuyCheckoutViewModelOptions, type UseCentrifugeBuyCheckoutViewModelResult, type UseCentrifugeBuyTransactionOptions, type UseCentrifugeBuyTransactionResult, type UseCentrifugeClaimPositionsOptions, type UseCentrifugeClaimPositionsResult, type UseCentrifugeClaimResult, type UseCentrifugeVaultClaimViewModelOptions, type UseCentrifugeVaultClaimViewModelResult, type UseCentrifugeVaultStatusOptions, type UseCentrifugeVaultStatusResult, type UseCentrifugeVaultStatusesOptions, type UseCentrifugeVaultStatusesResult, type UseCoinListResult, type UseCoinListSignInCardViewModelOptions, type UseCoinListSignInCardViewModelResult, type UseCompleteOAuthOptions, type UseConnectWalletOptions, type UseConnectWalletResult, type UseErc20BalanceOptions, type UseErc20BalanceResult, type UseErc20TokenBalancesOptions, type UseErc20TokenBalancesResult, type UseKycTokenResult, type UseOfferDetailsOptions, type UseOfferDetailsResult, type UseOffersOptions, type UseOffersResult, type UseOndoBuyCheckoutViewModelOptions, type UseOndoBuyCheckoutViewModelResult, type UseOndoBuyTransactionOptions, type UseOndoBuyTransactionResult, type UseOndoPriceOptions, type UseOndoPriceResult, type UseOndoSellCheckoutViewModelOptions, type UseOndoSellCheckoutViewModelResult, type UseOndoSellTransactionOptions, type UseOndoSellTransactionResult, type UseOndoTradingStatusOptions, type UseOndoTradingStatusResult, type UseOptionAddressesOptions, type UseOptionAddressesResult, type UseParticipationsOptions, type UseParticipationsResult, type UseRequirementsChecklistViewModelOptions, type UseRequirementsChecklistViewModelResult, type UseRequirementsOptions, type UseRequirementsResult, type UseSuperstateSwapCheckoutViewModelOptions, type UseSuperstateSwapCheckoutViewModelResult, type UseSwapOutputTokenOptions, type UseSwapOutputTokenResult, type UseSwapQuoteOptions, type UseSwapQuoteResult, type UseTaxDocumentOptions, type UseTaxDocumentResult, type UseTokenMetadataOptions, type UseTokenMetadataResult, type UseTokenRegistryOptions, type UseTokenRegistryResult, type WalletAuthorizationError, type WalletAuthorizationPhase, type WalletAuthorizationResult, type WalletsStatus, createCoinListClient, isNotTradable, pinoClientLogger, useCentrifugeBuyCheckoutViewModel, useCentrifugeBuyTransaction, useCentrifugeClaim, useCentrifugeClaimPositions, useCentrifugeVaultClaimViewModel, useCentrifugeVaultStatus, useCentrifugeVaultStatuses, useCoinList, useCoinListSignInCardViewModel, useCompleteOAuth, useConnectWallet, useErc20Balance, useErc20TokenBalances, useKycToken, useOfferDetails, useOffers, useOndoBuyCheckoutViewModel, useOndoBuyTransaction, useOndoPrice, useOndoSellCheckoutViewModel, useOndoSellTransaction, useOndoTradingStatus, useOptionAddresses, useParticipations, useRequirements, useRequirementsChecklistViewModel, useSuperstateSwapCheckoutViewModel, useSwapOutputToken, useSwapQuote, useTaxDocument, useTokenMetadata, useTokenRegistry };
|
|
5736
|
+
export { type ApproveThenBuildError, type ApproveThenBuildPhase, type ApproveThenBuildResult, type AuthState, type AuthorizeWalletParams, type BuyCentrifugeParams, type CentrifugeBuyCheckoutUiEvent, type CentrifugeBuyCheckoutUiState, type CentrifugeBuyError, type CentrifugeBuyPhase, type CentrifugeBuyPlacementError, type CentrifugeBuyPlacementPhase, type CentrifugeBuyPlacementResult, type CentrifugeBuyPreparationError, type CentrifugeBuyPreparationPhase, type CentrifugeBuyPreparationResult, type CentrifugeBuyResult, type CentrifugeBuyReviewUiEvent, type CentrifugeBuyReviewUiState, type 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 CentrifugeSidebarMinimumUi, type CentrifugeSidebarUiState, type CentrifugeVaultCheckoutConfig, type CentrifugeVaultClaimConfig, type CentrifugeVaultClaimUiEvent, type CentrifugeVaultClaimUiState, type CentrifugeVaultClaimed, ChecklistStatus, type CheckoutAmountAdornmentUi, type CheckoutAmountUiEvent, type CheckoutAmountUiState, CheckoutAssetUi, type CheckoutBlockedReason, type CheckoutConfig, type CheckoutConfirmedWalletUi, CheckoutContainer, type CheckoutContainerProps, type CheckoutCtaUi, type CheckoutEmbeddedWalletUi, CheckoutExternalWalletUi, type CheckoutNetworkUi, type CheckoutReceiptUi, type CheckoutSelectableInputAssetUi, type CheckoutStatusUi, type CheckoutWalletSelectUiEvent, type CheckoutWalletSelectUiState, type CheckoutWalletSelection, type CheckoutWalletTypeUi, type CheckoutWalletUi, type ClaimCentrifugeVaultParams, type ClaimConfig, ClaimContainer, type ClaimContainerProps, type ClaimExternalWalletUi, type ClientAuthNamespace, type ClientCentrifugeNamespace, type ClientCoinListTokenSaleNamespace, type ClientConfig, type ClientOndoNamespace, type ClientRequirementsNamespace, type ClientSuperstateSwapNamespace, type ClientSupportNamespace, type ClientWalletsNamespace, type CoinListClient, CoinListClientInitializationError, CoinListProvider, type CoinListProviderProps, CoinListSignInButton, type CoinListSignInButtonProps, CoinListSignInCardContainer, type CoinListSignInCardContainerProps, type CoinListSignInCardUiEvent, type CoinListSignInCardUiState, CoinListStyleScope, type CoinListStyleScopeProps, type CoinListTokenSaleCheckoutConfig, type CoinListTokenSaleCheckoutUiEvent, type CoinListTokenSaleCheckoutUiState, type CoinListTokenSaleClaimUiEvent, type CoinListTokenSaleClaimUiState, type CompleteOAuthFailureReason, type ConnectWalletError, type ConnectWalletErrorCode, type ConnectWalletFlowError, type ConnectWalletFlowResult, type ConnectWalletParams, type ConnectWalletPhase, type ConnectWalletSignState, type ConnectWalletState, type ConnectedWalletUi, type Erc20AllowanceError, type Erc20AllowancePhase, type Erc20ApprovalError, type ExecuteOndoSwapParams, type ExecuteSwapParams, type ExecuteTokenSaleParams, type ExternalWalletRequestUi, type KycTokenErrorReason, type KycTokenState, type LoadCentrifugeClaimPositionsState, type LoadCentrifugeVaultStatusState, type LoadCoinListTokenSaleParticipationsState, type LoadErc20BalanceState, type LoadErc20TokenBalancesState, type LoadErrorReason, type LoadFirmTransactionState, type LoadOfferDetailsReason, type LoadOfferDetailsState, type LoadOffersReason, type LoadOffersState, type LoadOndoBuyTransactionState, type LoadOndoPriceState, type LoadOndoSellTransactionState, type LoadOndoTradingStatusState, type LoadOptionAddressesReason, type LoadOptionAddressesState, type LoadRequirementsReason, type LoadRequirementsState, type LoadSwapOutputTokenState, type LoadSwapQuoteState, type LoadTokenMetadataState, type LoadTokenRegistryState, type LogoImageUi, type OAuthClientErrorReason, type OAuthClientResult, OfferAssetCard, type OfferAssetCardProps, OfferAssetCardUi, OfferLogoUi, OfferSaleCard, type OfferSaleCardProps, OfferSaleCardUi, OffersGridContainer, type OffersGridContainerProps, type OffersGridData, type OndoBuyAmountUiEvent, type OndoBuyAmountUiState, type OndoBuyCheckoutUiEvent, type OndoBuyCheckoutUiState, type OndoBuyOrderPlaced, type OndoBuyOrderTerms, type OndoBuyPreparationResult, type OndoBuyReviewUiEvent, type OndoBuyReviewUiState, type OndoCheckoutConfig, type OndoCheckoutErrorReason, type OndoLoadErrorReason, type OndoOrderConfirmedUiEvent, type OndoOrderConfirmedUiState, type OndoOrderPlaced, type OndoOrderPlacedCore, type OndoQuoteStatusUi, type OndoSellAmountUiEvent, type OndoSellAmountUiState, type OndoSellBalanceUi, type OndoSellCheckoutUiEvent, type OndoSellCheckoutUiState, type OndoSellOrderConfirmedUiEvent, type OndoSellOrderConfirmedUiState, type OndoSellOrderPlaced, type OndoSellOrderTerms, type OndoSellOutcomeUi, type OndoSellPreparationResult, type OndoSellReviewUiEvent, type OndoSellReviewUiState, type OndoSellSourceWalletUi, type OndoSidebarPriceUi, type OndoSidebarUiState, type OndoSwapExecutionError, type OndoSwapExecutionPhase, type OndoSwapExecutionResult, type OndoSwapPreparationError, type OndoSwapPreparationPhase, type OndoSwapPreparationResult, type ParticipationClockUi, ParticipationRowUi, ParticipationStatusUi, type PlaceCentrifugeRequestParams, type PrepareCentrifugeBuyParams, type PrepareOndoBuyParams, type PrepareOndoSellParams, type PrepareOndoSwapParamsCore, RequirementItemUi, RequirementStatus, RequirementVariant, RequirementsChecklistContainer, type RequirementsChecklistContainerProps, type RequirementsChecklistItemUi, type RequirementsChecklistUiEvent, type RequirementsChecklistUiState, RequirementsChecklistView, type RequirementsChecklistViewProps, type RequirementsData, type RequirementsVerificationUi, type ResetThenApprovePhase, type SignState, type SuperstateCheckoutConfig, type SuperstateOrderConfirmedUiEvent, type SuperstateOrderConfirmedUiState, type SuperstateOrderPlaced, type SuperstateReviewUiEvent, type SuperstateReviewUiState, type SuperstateSidebarPriceUi, type SuperstateSidebarUiState, type SuperstateSlippageOptionUi, type SuperstateSlippageUi, type SuperstateSwapCheckoutRetryUiEvent, type SuperstateSwapCheckoutUiEvent, type SuperstateSwapCheckoutUiState, type SuperstateSwapLoadErrorReason, type SuperstateWalletUiEvent, type SuperstateWalletUiState, type SwapExecutionError, type SwapExecutionPhase, type SwapExecutionResult, type TaxDocumentAddressParts, type TaxDocumentFields, type TaxDocumentState, type TokenSaleApproval, type TokenSaleCheckoutErrorReason, type TokenSaleExecutionError, type TokenSaleExecutionPhase, type TokenSaleExecutionResult, type TokenSaleOrderPlaced, type TokenSaleOrderPlacedUiEvent, type TokenSaleOrderPlacedUiState, type TokenSaleReviewUiEvent, type TokenSaleReviewUiState, type TokenSaleSidebarUiState, type UseCentrifugeBuyCheckoutViewModelOptions, type UseCentrifugeBuyCheckoutViewModelResult, type UseCentrifugeClaimPositionsOptions, type UseCentrifugeClaimPositionsResult, type UseCentrifugeClaimResult, type UseCentrifugeVaultClaimViewModelOptions, type UseCentrifugeVaultClaimViewModelResult, type UseCentrifugeVaultStatusOptions, type UseCentrifugeVaultStatusResult, type UseCentrifugeVaultStatusesOptions, type UseCentrifugeVaultStatusesResult, type UseCoinListResult, type UseCoinListSignInCardViewModelOptions, type UseCoinListSignInCardViewModelResult, type UseCoinListTokenSaleCheckoutViewModelOptions, type UseCoinListTokenSaleCheckoutViewModelResult, type UseCoinListTokenSaleClaimViewModelOptions, type UseCoinListTokenSaleClaimViewModelResult, type UseCoinListTokenSaleParticipationsOptions, type UseCoinListTokenSaleParticipationsResult, type UseCompleteOAuthOptions, type UseConnectWalletOptions, type UseConnectWalletResult, type UseErc20BalanceOptions, type UseErc20BalanceResult, type UseErc20TokenBalancesOptions, type UseErc20TokenBalancesResult, type UseKycTokenResult, type UseOfferDetailsOptions, type UseOfferDetailsResult, type UseOffersOptions, type UseOffersResult, type UseOndoBuyCheckoutViewModelOptions, type UseOndoBuyCheckoutViewModelResult, type UseOndoBuyTransactionOptions, type UseOndoBuyTransactionResult, type UseOndoPriceOptions, type UseOndoPriceResult, type UseOndoSellCheckoutViewModelOptions, type UseOndoSellCheckoutViewModelResult, type UseOndoSellTransactionOptions, type UseOndoSellTransactionResult, type UseOndoTradingStatusOptions, type UseOndoTradingStatusResult, type UseOptionAddressesOptions, type UseOptionAddressesResult, type UseRequirementsChecklistViewModelOptions, type UseRequirementsChecklistViewModelResult, type UseRequirementsOptions, type UseRequirementsResult, type UseSuperstateSwapCheckoutViewModelOptions, type UseSuperstateSwapCheckoutViewModelResult, type UseSwapOutputTokenOptions, type UseSwapOutputTokenResult, type UseSwapQuoteOptions, type UseSwapQuoteResult, type UseTaxDocumentOptions, type UseTaxDocumentResult, type UseTokenMetadataOptions, type UseTokenMetadataResult, type UseTokenRegistryOptions, type UseTokenRegistryResult, type WalletAuthorizationError, type WalletAuthorizationPhase, type WalletAuthorizationResult, type WalletsStatus, createCoinListClient, isNotTradable, pinoClientLogger, useCentrifugeBuyCheckoutViewModel, useCentrifugeClaim, useCentrifugeClaimPositions, useCentrifugeVaultClaimViewModel, useCentrifugeVaultStatus, useCentrifugeVaultStatuses, useCoinList, useCoinListSignInCardViewModel, useCoinListTokenSaleCheckoutViewModel, useCoinListTokenSaleClaimViewModel, useCoinListTokenSaleParticipations, useCompleteOAuth, useConnectWallet, useErc20Balance, useErc20TokenBalances, useKycToken, useOfferDetails, useOffers, useOndoBuyCheckoutViewModel, useOndoBuyTransaction, useOndoPrice, useOndoSellCheckoutViewModel, useOndoSellTransaction, useOndoTradingStatus, useOptionAddresses, useRequirements, useRequirementsChecklistViewModel, useSuperstateSwapCheckoutViewModel, useSwapOutputToken, useSwapQuote, useTaxDocument, useTokenMetadata, useTokenRegistry };
|