@coinlist-co/react 0.12.2-rc.7b430dd → 0.12.2-rc.9fb6364

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/{chunk-MOE5S6CE.js → chunk-BNMF2HMW.js} +114 -4
  2. package/dist/chunk-BNMF2HMW.js.map +1 -0
  3. package/dist/{chunk-VH34YC3Q.js → chunk-KRA6EM2L.js} +2 -2
  4. package/dist/{chunk-DCW7NQXH.js → chunk-STAHYDLY.js} +52 -19
  5. package/dist/chunk-STAHYDLY.js.map +1 -0
  6. package/dist/client/index.cjs +322 -96
  7. package/dist/client/index.cjs.map +1 -1
  8. package/dist/client/index.d.cts +26 -10
  9. package/dist/client/index.d.ts +26 -10
  10. package/dist/client/index.js +225 -102
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/server/index.cjs +437 -76
  13. package/dist/server/index.cjs.map +1 -1
  14. package/dist/server/index.d.cts +47 -38
  15. package/dist/server/index.d.ts +47 -38
  16. package/dist/server/index.js +316 -61
  17. package/dist/server/index.js.map +1 -1
  18. package/dist/time-B5YOQxuh.d.ts +50 -0
  19. package/dist/time-BY3apBpc.d.cts +50 -0
  20. package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-C1NxdBmF.d.ts} +1 -1
  21. package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-DyjrA32p.d.cts} +1 -1
  22. package/dist/{tokens-namespace-CIWBtgt2.d.cts → tokens-namespace-BJfFeowE.d.cts} +53 -1
  23. package/dist/{tokens-namespace-CIWBtgt2.d.ts → tokens-namespace-BJfFeowE.d.ts} +53 -1
  24. package/dist/universal/index.cjs +100 -3
  25. package/dist/universal/index.cjs.map +1 -1
  26. package/dist/universal/index.d.cts +23 -5
  27. package/dist/universal/index.d.ts +23 -5
  28. package/dist/universal/index.js +12 -2
  29. package/package.json +1 -1
  30. package/dist/chunk-DCW7NQXH.js.map +0 -1
  31. package/dist/chunk-MOE5S6CE.js.map +0 -1
  32. /package/dist/{chunk-VH34YC3Q.js.map → chunk-KRA6EM2L.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ButtonHTMLAttributes } from 'react';
3
- import { A as AuthorizationCode, C as CodeVerifier, L as Logger, W as WalletError, E as Erc20Namespace, a as EthereumChain, b as EvmContractAddress, B as BlockchainAmount, c as CoinListTokenSaleNamespace, O as OfferId, d as OfferOptionId, e as AssetId, P as Participation, f as CoinListTokenSaleNamespaceImpl, U as UniversalNamespaceContext, g as OndoNamespace, h as AssetSymbol, i as OfferSwapContract, j as OndoBuyTransaction, k as OndoSellTransaction, l as OndoSwapTransactionCore, m as OrderBookSide, n as OndoNamespaceImpl, S as SuperstateSwapNamespace, o as WalletsNamespace, p as Bps, q as EvmWalletAddress, r as SuperstateSwapNamespaceImpl, R as RequirementsNamespace, s as Requirement, t as RequirementsNamespaceImpl, u as Config, v as OAuthAccessToken, w as OffersNamespace, T as TokensNamespace, x as StablecoinSymbol, y as Erc20Asset, z as OfferDetail, D as TokenMetadata, F as OfferType, G as OndoSwapOfferDetail, H as CoinListTokenSaleOfferDetail, I as SuperstateSwapOfferDetail, J as Offer, K as RequirementStatusInfo, M as RequirementType, N as RequirementStatusValue, Q as OfferOptionAddress, V as RequirementId, X as KycLevelName, Y as DocumentSubmission, Z as WalletChallengeType, _ as PinoLoggerOptions, $ as OndoTradingStatus, a0 as AssetDecimals, a1 as BuildOndoBuyParams, a2 as BuildOndoSellParams, a3 as OndoQuote, a4 as OndoQuoteSize, a5 as TokenIdentifier, a6 as OfferOptionAddressId, a7 as TokenLogo } from '../tokens-namespace-CIWBtgt2.cjs';
4
- export { a8 as DebugEvent, a9 as FrontlineEventId, aa as HttpError, ab as HttpResponse, ac as KycToken, ad as LogBinding, ae as LogBindings, af as LogCause, ag as LogLevel, ah as LogScope, ai as LogValue, aj as ProductionLogLevel, ak as RedactedWalletError, al as RequestId, am as RpcFailureReason, an as SafeEvent, ao as SafeFields, ap as UnredactedFields } from '../tokens-namespace-CIWBtgt2.cjs';
5
- import { P as PKCEConfig, E as EvmWallet, S as SwapQuote, A as AssetIconUrl, a as ShortenedWalletAddress, F as FormattedAmountAssetUi, b as FormattedPercentUi, T as TxExplorerUrl, C as ConnectWallet, N as NonEmptyArray, c as TokenRegistrySnapshot } from '../token-registry-snapshot-CqI6dXM_.cjs';
6
- export { B as BroadcastTxParams, d as EvmSigner, W as WriteContractParams } from '../token-registry-snapshot-CqI6dXM_.cjs';
3
+ import { A as AuthorizationCode, C as CodeVerifier, L as Logger, W as WalletError, E as Erc20Namespace, a as EthereumChain, b as EvmContractAddress, B as BlockchainAmount, c as CoinListTokenSaleNamespace, O as OfferId, d as OfferOptionId, e as AssetId, P as Participation, f as CoinListTokenSaleNamespaceImpl, U as UniversalNamespaceContext, g as OndoNamespace, h as AssetSymbol, i as OfferSwapContract, j as OndoBuyTransaction, k as OndoSellTransaction, l as OndoSwapTransactionCore, m as OrderBookSide, n as OndoNamespaceImpl, S as SuperstateSwapNamespace, o as WalletsNamespace, p as Bps, q as EvmWalletAddress, r as SuperstateSwapNamespaceImpl, R as RequirementsNamespace, s as Requirement, t as RequirementsNamespaceImpl, u as Config, v as OAuthAccessToken, w as OffersNamespace, T as TokensNamespace, x as StablecoinSymbol, y as Erc20Asset, z as OfferDetail, D as TokenMetadata, F as OfferType, G as OndoSwapOfferDetail, H as CoinListTokenSaleOfferDetail, I as SuperstateSwapOfferDetail, J as Offer, K as RequirementStatusInfo, M as RequirementType, N as RequirementStatusValue, Q as OfferOptionAddress, V as RequirementId, X as KycLevelName, Y as DocumentSubmission, Z as WalletChallengeType, _ as PinoLoggerOptions, $ as OndoTradingStatus, a0 as AssetDecimals, a1 as BuildOndoBuyParams, a2 as BuildOndoSellParams, a3 as OndoQuote, a4 as OndoQuoteSize, a5 as TokenIdentifier, a6 as OfferOptionAddressId, a7 as TokenLogo } from '../tokens-namespace-BJfFeowE.cjs';
4
+ export { a8 as DebugEvent, a9 as FrontlineEventId, aa as HttpError, ab as HttpResponse, ac as KycToken, ad as LogBinding, ae as LogBindings, af as LogCause, ag as LogLevel, ah as LogScope, ai as LogValue, aj as ProductionLogLevel, ak as RedactedWalletError, al as RequestId, am as RpcFailureReason, an as SafeEvent, ao as SafeFields, ap as UnredactedFields } from '../tokens-namespace-BJfFeowE.cjs';
5
+ import { P as PKCEConfig, E as EvmWallet, S as SwapQuote, A as AssetIconUrl, a as ShortenedWalletAddress, F as FormattedAmountAssetUi, b as FormattedPercentUi, T as TxExplorerUrl, C as ConnectWallet, N as NonEmptyArray, c as TokenRegistrySnapshot } from '../token-registry-snapshot-DyjrA32p.cjs';
6
+ export { B as BroadcastTxParams, d as EvmSigner, W as WriteContractParams } from '../token-registry-snapshot-DyjrA32p.cjs';
7
7
  import { Hash } from 'viem';
8
8
  import * as class_variance_authority_types from 'class-variance-authority/types';
9
9
  import { VariantProps } from 'class-variance-authority';
@@ -698,10 +698,24 @@ declare class ClientSupportNamespaceImpl implements ClientSupportNamespace {
698
698
 
699
699
  interface ClientConfig extends Config {
700
700
  /**
701
- * The SDK user must provide this function. It is responsible for fetching a
702
- * valid {@link OAuthAccessToken}, or **null** for logged-out users. If your
703
- * backend is in TypeScript, it is recommended to use
704
- * `CoinListServer#auth.getAccessToken` from `@/server/core/coinlist-server`.
701
+ * The SDK user must provide this function. It fetches a valid
702
+ * {@link OAuthAccessToken} from your backend. If your backend is in
703
+ * TypeScript, serve `CoinListServer#auth.getAccessToken` from it.
704
+ *
705
+ * Two answers, and they must not be confused:
706
+ *
707
+ * - **Resolve `null`** when there is no session - e.g. your endpoint
708
+ * answered 204. After a 401 the SDK asks once more a second later before
709
+ * it believes it, then signs the user out and calls
710
+ * {@link Config.onSessionExpired}.
711
+ * - **Throw** when you could not find out - a 5xx, a network failure. The
712
+ * SDK keeps its current auth state and fails only the request in hand.
713
+ *
714
+ * So a backend that answers "no session" for its own failures turns every
715
+ * outage into a logout. Map those to an error status and throw on it.
716
+ *
717
+ * The SDK calls this at most once at a time: concurrent requests that all
718
+ * need a new token share one call.
705
719
  */
706
720
  getAccessToken: () => Promise<OAuthAccessToken | null>;
707
721
  /**
@@ -810,6 +824,10 @@ interface CoinListClient {
810
824
  * the user's {@link AuthState}. This is called automatically by
811
825
  * {@link CoinListProvider}; you typically do not need to call it yourself
812
826
  * unless you are using the client outside of the provider.
827
+ *
828
+ * @throws whatever {@link ClientConfig.getAccessToken} throws. The auth
829
+ * state is then left as it was (`'unknown'` on a first call), since a
830
+ * failure to find out is not a logout.
813
831
  */
814
832
  init(): Promise<AuthState>;
815
833
  }
@@ -2977,8 +2995,6 @@ type SuperstateOrderConfirmedUiState = {
2977
2995
  type: 'visible';
2978
2996
  /** What was bought. */
2979
2997
  asset: CheckoutAssetUi;
2980
- /** Who issues it, e.g. `Superstate`. */
2981
- issuer: string;
2982
2998
  /** How much of it arrived, e.g. `981.2431 USTB`. */
2983
2999
  outputAmount: FormattedAmountAssetUi;
2984
3000
  /**
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ButtonHTMLAttributes } from 'react';
3
- import { A as AuthorizationCode, C as CodeVerifier, L as Logger, W as WalletError, E as Erc20Namespace, a as EthereumChain, b as EvmContractAddress, B as BlockchainAmount, c as CoinListTokenSaleNamespace, O as OfferId, d as OfferOptionId, e as AssetId, P as Participation, f as CoinListTokenSaleNamespaceImpl, U as UniversalNamespaceContext, g as OndoNamespace, h as AssetSymbol, i as OfferSwapContract, j as OndoBuyTransaction, k as OndoSellTransaction, l as OndoSwapTransactionCore, m as OrderBookSide, n as OndoNamespaceImpl, S as SuperstateSwapNamespace, o as WalletsNamespace, p as Bps, q as EvmWalletAddress, r as SuperstateSwapNamespaceImpl, R as RequirementsNamespace, s as Requirement, t as RequirementsNamespaceImpl, u as Config, v as OAuthAccessToken, w as OffersNamespace, T as TokensNamespace, x as StablecoinSymbol, y as Erc20Asset, z as OfferDetail, D as TokenMetadata, F as OfferType, G as OndoSwapOfferDetail, H as CoinListTokenSaleOfferDetail, I as SuperstateSwapOfferDetail, J as Offer, K as RequirementStatusInfo, M as RequirementType, N as RequirementStatusValue, Q as OfferOptionAddress, V as RequirementId, X as KycLevelName, Y as DocumentSubmission, Z as WalletChallengeType, _ as PinoLoggerOptions, $ as OndoTradingStatus, a0 as AssetDecimals, a1 as BuildOndoBuyParams, a2 as BuildOndoSellParams, a3 as OndoQuote, a4 as OndoQuoteSize, a5 as TokenIdentifier, a6 as OfferOptionAddressId, a7 as TokenLogo } from '../tokens-namespace-CIWBtgt2.js';
4
- export { a8 as DebugEvent, a9 as FrontlineEventId, aa as HttpError, ab as HttpResponse, ac as KycToken, ad as LogBinding, ae as LogBindings, af as LogCause, ag as LogLevel, ah as LogScope, ai as LogValue, aj as ProductionLogLevel, ak as RedactedWalletError, al as RequestId, am as RpcFailureReason, an as SafeEvent, ao as SafeFields, ap as UnredactedFields } from '../tokens-namespace-CIWBtgt2.js';
5
- import { P as PKCEConfig, E as EvmWallet, S as SwapQuote, A as AssetIconUrl, a as ShortenedWalletAddress, F as FormattedAmountAssetUi, b as FormattedPercentUi, T as TxExplorerUrl, C as ConnectWallet, N as NonEmptyArray, c as TokenRegistrySnapshot } from '../token-registry-snapshot-BNBNuDu1.js';
6
- export { B as BroadcastTxParams, d as EvmSigner, W as WriteContractParams } from '../token-registry-snapshot-BNBNuDu1.js';
3
+ import { A as AuthorizationCode, C as CodeVerifier, L as Logger, W as WalletError, E as Erc20Namespace, a as EthereumChain, b as EvmContractAddress, B as BlockchainAmount, c as CoinListTokenSaleNamespace, O as OfferId, d as OfferOptionId, e as AssetId, P as Participation, f as CoinListTokenSaleNamespaceImpl, U as UniversalNamespaceContext, g as OndoNamespace, h as AssetSymbol, i as OfferSwapContract, j as OndoBuyTransaction, k as OndoSellTransaction, l as OndoSwapTransactionCore, m as OrderBookSide, n as OndoNamespaceImpl, S as SuperstateSwapNamespace, o as WalletsNamespace, p as Bps, q as EvmWalletAddress, r as SuperstateSwapNamespaceImpl, R as RequirementsNamespace, s as Requirement, t as RequirementsNamespaceImpl, u as Config, v as OAuthAccessToken, w as OffersNamespace, T as TokensNamespace, x as StablecoinSymbol, y as Erc20Asset, z as OfferDetail, D as TokenMetadata, F as OfferType, G as OndoSwapOfferDetail, H as CoinListTokenSaleOfferDetail, I as SuperstateSwapOfferDetail, J as Offer, K as RequirementStatusInfo, M as RequirementType, N as RequirementStatusValue, Q as OfferOptionAddress, V as RequirementId, X as KycLevelName, Y as DocumentSubmission, Z as WalletChallengeType, _ as PinoLoggerOptions, $ as OndoTradingStatus, a0 as AssetDecimals, a1 as BuildOndoBuyParams, a2 as BuildOndoSellParams, a3 as OndoQuote, a4 as OndoQuoteSize, a5 as TokenIdentifier, a6 as OfferOptionAddressId, a7 as TokenLogo } from '../tokens-namespace-BJfFeowE.js';
4
+ export { a8 as DebugEvent, a9 as FrontlineEventId, aa as HttpError, ab as HttpResponse, ac as KycToken, ad as LogBinding, ae as LogBindings, af as LogCause, ag as LogLevel, ah as LogScope, ai as LogValue, aj as ProductionLogLevel, ak as RedactedWalletError, al as RequestId, am as RpcFailureReason, an as SafeEvent, ao as SafeFields, ap as UnredactedFields } from '../tokens-namespace-BJfFeowE.js';
5
+ import { P as PKCEConfig, E as EvmWallet, S as SwapQuote, A as AssetIconUrl, a as ShortenedWalletAddress, F as FormattedAmountAssetUi, b as FormattedPercentUi, T as TxExplorerUrl, C as ConnectWallet, N as NonEmptyArray, c as TokenRegistrySnapshot } from '../token-registry-snapshot-C1NxdBmF.js';
6
+ export { B as BroadcastTxParams, d as EvmSigner, W as WriteContractParams } from '../token-registry-snapshot-C1NxdBmF.js';
7
7
  import { Hash } from 'viem';
8
8
  import * as class_variance_authority_types from 'class-variance-authority/types';
9
9
  import { VariantProps } from 'class-variance-authority';
@@ -698,10 +698,24 @@ declare class ClientSupportNamespaceImpl implements ClientSupportNamespace {
698
698
 
699
699
  interface ClientConfig extends Config {
700
700
  /**
701
- * The SDK user must provide this function. It is responsible for fetching a
702
- * valid {@link OAuthAccessToken}, or **null** for logged-out users. If your
703
- * backend is in TypeScript, it is recommended to use
704
- * `CoinListServer#auth.getAccessToken` from `@/server/core/coinlist-server`.
701
+ * The SDK user must provide this function. It fetches a valid
702
+ * {@link OAuthAccessToken} from your backend. If your backend is in
703
+ * TypeScript, serve `CoinListServer#auth.getAccessToken` from it.
704
+ *
705
+ * Two answers, and they must not be confused:
706
+ *
707
+ * - **Resolve `null`** when there is no session - e.g. your endpoint
708
+ * answered 204. After a 401 the SDK asks once more a second later before
709
+ * it believes it, then signs the user out and calls
710
+ * {@link Config.onSessionExpired}.
711
+ * - **Throw** when you could not find out - a 5xx, a network failure. The
712
+ * SDK keeps its current auth state and fails only the request in hand.
713
+ *
714
+ * So a backend that answers "no session" for its own failures turns every
715
+ * outage into a logout. Map those to an error status and throw on it.
716
+ *
717
+ * The SDK calls this at most once at a time: concurrent requests that all
718
+ * need a new token share one call.
705
719
  */
706
720
  getAccessToken: () => Promise<OAuthAccessToken | null>;
707
721
  /**
@@ -810,6 +824,10 @@ interface CoinListClient {
810
824
  * the user's {@link AuthState}. This is called automatically by
811
825
  * {@link CoinListProvider}; you typically do not need to call it yourself
812
826
  * unless you are using the client outside of the provider.
827
+ *
828
+ * @throws whatever {@link ClientConfig.getAccessToken} throws. The auth
829
+ * state is then left as it was (`'unknown'` on a first call), since a
830
+ * failure to find out is not a logout.
813
831
  */
814
832
  init(): Promise<AuthState>;
815
833
  }
@@ -2977,8 +2995,6 @@ type SuperstateOrderConfirmedUiState = {
2977
2995
  type: 'visible';
2978
2996
  /** What was bought. */
2979
2997
  asset: CheckoutAssetUi;
2980
- /** Who issues it, e.g. `Superstate`. */
2981
- issuer: string;
2982
2998
  /** How much of it arrived, e.g. `981.2431 USTB`. */
2983
2999
  outputAmount: FormattedAmountAssetUi;
2984
3000
  /**