@pollar/react 0.11.4-rc.4 → 0.11.5
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 +16 -1
- package/dist/index.css +198 -32
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +122 -6
- package/dist/index.d.ts +122 -6
- package/dist/index.js +729 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +728 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner, WalletChain, KycStatus as KycStatus$1, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampQuoteRequirement, RampTxStatus, RampDepositInstructions, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
2
|
+
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, CosignState, PendingConfirmation, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner, WalletChain, CosignRequest, CosignVerification, CosignQuorumReport, CosignDevicesContent, KycStatus as KycStatus$1, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampQuoteRequirement, RampTxStatus, RampDepositInstructions, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
3
|
export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
|
|
4
4
|
import { ReactNode, CSSProperties } from 'react';
|
|
5
5
|
|
|
@@ -37,6 +37,14 @@ interface PollarContextValue {
|
|
|
37
37
|
getClient: () => PollarClient;
|
|
38
38
|
openLoginModal: () => void;
|
|
39
39
|
isAuthenticated: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the signed-in user has a wallet. False for an app that creates
|
|
42
|
+
* wallets on demand until {@link createWallet} runs, and always for one that
|
|
43
|
+
* creates none.
|
|
44
|
+
*/
|
|
45
|
+
hasWallet: boolean;
|
|
46
|
+
/** Create the signed-in user's wallet; see `PollarClient.createWallet`. */
|
|
47
|
+
createWallet: () => Promise<WalletInfo>;
|
|
40
48
|
/**
|
|
41
49
|
* `true` once the server has confirmed the session (login / refresh /
|
|
42
50
|
* `/auth/session/resume`). `false` while a cold-start session is still
|
|
@@ -48,6 +56,12 @@ interface PollarContextValue {
|
|
|
48
56
|
sessions: SessionsState;
|
|
49
57
|
/** Open the active-sessions modal. */
|
|
50
58
|
openSessionsModal: () => void;
|
|
59
|
+
/** Requests waiting for this device's vote. */
|
|
60
|
+
cosign: CosignState;
|
|
61
|
+
/** Open the approval prompt of a co-signed wallet. Opens by itself when a request arrives. */
|
|
62
|
+
openCosignModal: () => void;
|
|
63
|
+
/** Signing calls waiting for the user under `confirmation: 'prompt'`; the provider shows the first one. */
|
|
64
|
+
confirmations: PendingConfirmation[];
|
|
51
65
|
appConfig: PollarConfig;
|
|
52
66
|
styles: PollarStyles;
|
|
53
67
|
/** Remote app-config load state. 'loading' while the initial fetch is in
|
|
@@ -305,6 +319,16 @@ interface WalletButtonTemplateProps {
|
|
|
305
319
|
*/
|
|
306
320
|
notReadyReason?: string | null;
|
|
307
321
|
creatingAccount: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Signed in with no wallet yet (an app that creates wallets on demand, or
|
|
324
|
+
* none). The button then shows the account menu instead of Login, with Create
|
|
325
|
+
* wallet only when `onCreateWallet` is set. Optional, so a custom template
|
|
326
|
+
* written before this existed keeps compiling.
|
|
327
|
+
*/
|
|
328
|
+
signedIn?: boolean;
|
|
329
|
+
creatingWallet?: boolean;
|
|
330
|
+
createWalletError?: string | null;
|
|
331
|
+
onCreateWallet?: () => void;
|
|
308
332
|
onToggleOpen: () => void;
|
|
309
333
|
onCreateAccount: () => void;
|
|
310
334
|
onCopy: () => void;
|
|
@@ -319,7 +343,7 @@ interface WalletButtonTemplateProps {
|
|
|
319
343
|
onLogout: () => void;
|
|
320
344
|
onLogin: () => void;
|
|
321
345
|
}
|
|
322
|
-
declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, showCreateAccount, notReadyReason, creatingAccount, onToggleOpen, onCreateAccount, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
|
|
346
|
+
declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, showCreateAccount, notReadyReason, creatingAccount, onToggleOpen, onCreateAccount, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, signedIn, creatingWallet, createWalletError, onCreateWallet, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
|
|
323
347
|
|
|
324
348
|
/**
|
|
325
349
|
* The chain a record lives on, with the legacy shape folded in: sessions and
|
|
@@ -379,6 +403,37 @@ interface UseChainsResult {
|
|
|
379
403
|
}
|
|
380
404
|
declare function useChains(): UseChainsResult;
|
|
381
405
|
|
|
406
|
+
interface UseCosignResult {
|
|
407
|
+
/** Requests waiting for this device's vote, oldest first. */
|
|
408
|
+
pending: CosignRequest[];
|
|
409
|
+
/** The last request that reached a final state. */
|
|
410
|
+
lastResolved?: CosignRequest;
|
|
411
|
+
/** Whether the client's co-sign store has been read at least once. */
|
|
412
|
+
loaded: boolean;
|
|
413
|
+
/** Re-read the pending requests from the API. */
|
|
414
|
+
refresh: () => Promise<void>;
|
|
415
|
+
/** Verify the request against Turnkey and, when it checks out, vote yes. */
|
|
416
|
+
approve: (request: CosignRequest) => Promise<CosignRequest>;
|
|
417
|
+
/** Vote no. Final. */
|
|
418
|
+
reject: (request: CosignRequest) => Promise<CosignRequest>;
|
|
419
|
+
/** The verification a UI can show before the user decides. */
|
|
420
|
+
verify: (request: CosignRequest) => Promise<CosignVerification>;
|
|
421
|
+
/** Read the sub-organization from Turnkey with the device key and record whether it is the promised 2-of-2. */
|
|
422
|
+
inspectQuorum: () => Promise<CosignQuorumReport>;
|
|
423
|
+
/** The user's enrolled devices and the quorum state as sdk-api records it. */
|
|
424
|
+
devices: () => Promise<CosignDevicesContent>;
|
|
425
|
+
/** Revoke another enrolled device; `force` to revoke this one. */
|
|
426
|
+
revokeDevice: (deviceId: string, options?: {
|
|
427
|
+
force?: boolean;
|
|
428
|
+
}) => Promise<CosignDevicesContent>;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* The user's side of a Turnkey co-signed wallet, for an app that renders its
|
|
432
|
+
* own confirmation UI instead of the provider's modal. Subscribes to the
|
|
433
|
+
* client's co-sign store and loads the pending requests once on mount.
|
|
434
|
+
*/
|
|
435
|
+
declare function useCosign(): UseCosignResult;
|
|
436
|
+
|
|
382
437
|
interface KycModalProps {
|
|
383
438
|
corridorId?: string;
|
|
384
439
|
/** A card provider's steps, in place of a route's. */
|
|
@@ -509,6 +564,16 @@ interface SessionsModalProps {
|
|
|
509
564
|
}
|
|
510
565
|
declare function SessionsModal({ onClose }: SessionsModalProps): react_jsx_runtime.JSX.Element;
|
|
511
566
|
|
|
567
|
+
interface CosignModalProps {
|
|
568
|
+
onClose: () => void;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The approval prompt of a Turnkey co-signed wallet. Verifies each request
|
|
572
|
+
* against Turnkey before enabling Approve, so the user only ever confirms a
|
|
573
|
+
* transaction the device checked itself.
|
|
574
|
+
*/
|
|
575
|
+
declare function CosignModal({ onClose }: CosignModalProps): react_jsx_runtime.JSX.Element;
|
|
576
|
+
|
|
512
577
|
interface DistributionRulesModalProps {
|
|
513
578
|
onClose: () => void;
|
|
514
579
|
}
|
|
@@ -701,9 +766,23 @@ interface RampWidgetTemplateProps {
|
|
|
701
766
|
onboardingStatus?: 'kyc' | 'endorsement' | 'awaiting_provider' | null;
|
|
702
767
|
/** The gate has since cleared - the user needs a fresh quote to continue. */
|
|
703
768
|
kycJustApproved: boolean;
|
|
769
|
+
/** Superseded by `txHash`, which carries the settlement on any chain; read when `txHash` is absent. */
|
|
704
770
|
stellarTxHash: string | null;
|
|
705
|
-
/**
|
|
771
|
+
/** The on-chain transaction that settled the ramp, on `txChain`. */
|
|
772
|
+
txHash?: string | null;
|
|
773
|
+
/** Chain of `txHash`; Stellar when omitted. */
|
|
774
|
+
txChain?: 'STELLAR' | 'POLYGON' | 'SOLANA' | null;
|
|
775
|
+
/** Explorer URL for the transaction (chain- and network-aware); null when unknown. */
|
|
706
776
|
explorerUrl: string | null;
|
|
777
|
+
/**
|
|
778
|
+
* The user's money is in one of their wallets between two steps of the route.
|
|
779
|
+
* Optional for integrators rendering their own chrome; omitted, the state is
|
|
780
|
+
* not shown.
|
|
781
|
+
*/
|
|
782
|
+
fundsInTransit?: boolean;
|
|
783
|
+
/** A retry of the pending step is in flight. */
|
|
784
|
+
retrying?: boolean;
|
|
785
|
+
onRetryTransit?: () => void;
|
|
707
786
|
depositInstructions: RampDepositInstructions | null;
|
|
708
787
|
canComplete: boolean;
|
|
709
788
|
completing: boolean;
|
|
@@ -728,7 +807,7 @@ interface RampWidgetTemplateProps {
|
|
|
728
807
|
onRefresh: () => void;
|
|
729
808
|
onClose: () => void;
|
|
730
809
|
}
|
|
731
|
-
declare function RampWidgetTemplate({ theme, accentColor, styleOverrides, step, flowSteps, flowStepIndex, startingQuoteId, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, kycRequired, isLoading, provider, txStatus, kycUrl, tosUrl, kycBlocking, onboardingStatus, kycJustApproved, stellarTxHash, explorerUrl, depositInstructions, canComplete, completing, errorMsg, noticeMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onVerifyRoute, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onBack, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
810
|
+
declare function RampWidgetTemplate({ theme, accentColor, styleOverrides, step, flowSteps, flowStepIndex, startingQuoteId, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, kycRequired, isLoading, provider, txStatus, kycUrl, tosUrl, kycBlocking, onboardingStatus, kycJustApproved, stellarTxHash, txHash, txChain, explorerUrl, fundsInTransit, retrying, onRetryTransit, depositInstructions, canComplete, completing, errorMsg, noticeMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onVerifyRoute, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onBack, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
732
811
|
|
|
733
812
|
interface TransactionModalTemplateProps {
|
|
734
813
|
theme: string;
|
|
@@ -843,6 +922,8 @@ interface CustomTrustlineModalTemplateProps {
|
|
|
843
922
|
}) => void;
|
|
844
923
|
}
|
|
845
924
|
|
|
925
|
+
/** The memo types the backend accepts on a Stellar payment. */
|
|
926
|
+
type SendMemoType = 'text' | 'id';
|
|
846
927
|
interface SendModalTemplateProps {
|
|
847
928
|
theme: string;
|
|
848
929
|
accentColor: string;
|
|
@@ -893,6 +974,15 @@ interface SendModalTemplateProps {
|
|
|
893
974
|
onMax: () => void;
|
|
894
975
|
onPaste: () => void;
|
|
895
976
|
onDestinationChange: (value: string) => void;
|
|
977
|
+
/**
|
|
978
|
+
* Optional Stellar memo. The field renders only on Stellar and only when
|
|
979
|
+
* {@link onMemoChange} is passed, so a custom template written before it
|
|
980
|
+
* existed keeps compiling.
|
|
981
|
+
*/
|
|
982
|
+
memo?: string;
|
|
983
|
+
memoType?: SendMemoType;
|
|
984
|
+
onMemoChange?: (value: string) => void;
|
|
985
|
+
onMemoTypeChange?: (type: SendMemoType) => void;
|
|
896
986
|
onSubmit: () => void;
|
|
897
987
|
onSignAndSend: () => void;
|
|
898
988
|
onToggleXdr: () => void;
|
|
@@ -900,7 +990,7 @@ interface SendModalTemplateProps {
|
|
|
900
990
|
onRetry: () => void;
|
|
901
991
|
onDone: () => void;
|
|
902
992
|
}
|
|
903
|
-
declare function SendModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, assets, selectedAsset, selectedChain, canSendOnChain, notReadyReason, chains, onSelectChain, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onMax, onPaste, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
993
|
+
declare function SendModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, assets, selectedAsset, selectedChain, canSendOnChain, notReadyReason, chains, onSelectChain, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onMax, onPaste, onDestinationChange, memo, memoType, onMemoChange, onMemoTypeChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
904
994
|
|
|
905
995
|
interface SwapAssetOption {
|
|
906
996
|
ref: SwapQuoteParams['sellAsset'];
|
|
@@ -1001,6 +1091,32 @@ interface SessionsModalTemplateProps {
|
|
|
1001
1091
|
}
|
|
1002
1092
|
declare function SessionsModalTemplate({ theme, accentColor, styleOverrides, state, revokingFamilyId, signingOutEverywhere, revokeError, onRefresh, onRevoke, onLogoutEverywhere, onClose, }: SessionsModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
1003
1093
|
|
|
1094
|
+
interface CosignModalTemplateProps {
|
|
1095
|
+
theme: string;
|
|
1096
|
+
accentColor: string;
|
|
1097
|
+
/** Per-app modal chrome overrides (background, card + button radius). */
|
|
1098
|
+
styleOverrides?: ModalStyleOverrides;
|
|
1099
|
+
/** Requests waiting for this device's vote, oldest first. */
|
|
1100
|
+
pending: CosignRequest[];
|
|
1101
|
+
/** The request shown in detail; the first pending one when not chosen. */
|
|
1102
|
+
current: CosignRequest | null;
|
|
1103
|
+
/** Verification of `current`, or null while it runs. */
|
|
1104
|
+
verification: CosignVerification | null;
|
|
1105
|
+
busy: 'approving' | 'rejecting' | null;
|
|
1106
|
+
error: string | null;
|
|
1107
|
+
/** Approve stays off for a request whose approval just failed. */
|
|
1108
|
+
approveBlocked?: boolean;
|
|
1109
|
+
/** The last request that reached a final state, shown once the list is empty. */
|
|
1110
|
+
lastResolved?: CosignRequest;
|
|
1111
|
+
/** Explorer page of {@link lastResolved}'s transaction, when it was sent. */
|
|
1112
|
+
explorerUrl?: string | null;
|
|
1113
|
+
onSelect: (request: CosignRequest) => void;
|
|
1114
|
+
onApprove: (request: CosignRequest) => void;
|
|
1115
|
+
onReject: (request: CosignRequest) => void;
|
|
1116
|
+
onClose: () => void;
|
|
1117
|
+
}
|
|
1118
|
+
declare function CosignModalTemplate({ theme, accentColor, styleOverrides, pending, current, verification, busy, error, approveBlocked, lastResolved, explorerUrl, onSelect, onApprove, onReject, onClose, }: CosignModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
1119
|
+
|
|
1004
1120
|
interface DistributionRulesModalTemplateProps {
|
|
1005
1121
|
theme: string;
|
|
1006
1122
|
accentColor: string;
|
|
@@ -1016,4 +1132,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
1016
1132
|
}
|
|
1017
1133
|
declare function DistributionRulesModalTemplate({ theme, accentColor, styleOverrides, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
1018
1134
|
|
|
1019
|
-
export { type AuthModalProps, CardModal, ChainSelect, type ChainSelectProps, type CustomTrustlineModalTemplateProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type ModalChrome, type ModalStyleOverrides, type ModalVariant, type PollarConfig, PollarProvider, type PollarStyles, ProviderRegistrationModal, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RegistryCheckModal, RequirementFormModal, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, type UseChainsResult, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, addressForChain, browserPasskeyCeremony, browserPasskeySigner, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, usePollar, walletNotReadyReason };
|
|
1135
|
+
export { type AuthModalProps, CardModal, ChainSelect, type ChainSelectProps, CosignModal, CosignModalTemplate, type CosignModalTemplateProps, type CustomTrustlineModalTemplateProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type ModalChrome, type ModalStyleOverrides, type ModalVariant, type PollarConfig, PollarProvider, type PollarStyles, ProviderRegistrationModal, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RegistryCheckModal, RequirementFormModal, RouteDisplay, type SendMemoType, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, type UseChainsResult, type UseCosignResult, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, addressForChain, browserPasskeyCeremony, browserPasskeySigner, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner, WalletChain, KycStatus as KycStatus$1, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampQuoteRequirement, RampTxStatus, RampDepositInstructions, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
2
|
+
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, CosignState, PendingConfirmation, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, PasskeyCeremony, PasskeySigner, WalletChain, CosignRequest, CosignVerification, CosignQuorumReport, CosignDevicesContent, KycStatus as KycStatus$1, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampQuoteRequirement, RampTxStatus, RampDepositInstructions, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
3
|
export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
|
|
4
4
|
import { ReactNode, CSSProperties } from 'react';
|
|
5
5
|
|
|
@@ -37,6 +37,14 @@ interface PollarContextValue {
|
|
|
37
37
|
getClient: () => PollarClient;
|
|
38
38
|
openLoginModal: () => void;
|
|
39
39
|
isAuthenticated: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the signed-in user has a wallet. False for an app that creates
|
|
42
|
+
* wallets on demand until {@link createWallet} runs, and always for one that
|
|
43
|
+
* creates none.
|
|
44
|
+
*/
|
|
45
|
+
hasWallet: boolean;
|
|
46
|
+
/** Create the signed-in user's wallet; see `PollarClient.createWallet`. */
|
|
47
|
+
createWallet: () => Promise<WalletInfo>;
|
|
40
48
|
/**
|
|
41
49
|
* `true` once the server has confirmed the session (login / refresh /
|
|
42
50
|
* `/auth/session/resume`). `false` while a cold-start session is still
|
|
@@ -48,6 +56,12 @@ interface PollarContextValue {
|
|
|
48
56
|
sessions: SessionsState;
|
|
49
57
|
/** Open the active-sessions modal. */
|
|
50
58
|
openSessionsModal: () => void;
|
|
59
|
+
/** Requests waiting for this device's vote. */
|
|
60
|
+
cosign: CosignState;
|
|
61
|
+
/** Open the approval prompt of a co-signed wallet. Opens by itself when a request arrives. */
|
|
62
|
+
openCosignModal: () => void;
|
|
63
|
+
/** Signing calls waiting for the user under `confirmation: 'prompt'`; the provider shows the first one. */
|
|
64
|
+
confirmations: PendingConfirmation[];
|
|
51
65
|
appConfig: PollarConfig;
|
|
52
66
|
styles: PollarStyles;
|
|
53
67
|
/** Remote app-config load state. 'loading' while the initial fetch is in
|
|
@@ -305,6 +319,16 @@ interface WalletButtonTemplateProps {
|
|
|
305
319
|
*/
|
|
306
320
|
notReadyReason?: string | null;
|
|
307
321
|
creatingAccount: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Signed in with no wallet yet (an app that creates wallets on demand, or
|
|
324
|
+
* none). The button then shows the account menu instead of Login, with Create
|
|
325
|
+
* wallet only when `onCreateWallet` is set. Optional, so a custom template
|
|
326
|
+
* written before this existed keeps compiling.
|
|
327
|
+
*/
|
|
328
|
+
signedIn?: boolean;
|
|
329
|
+
creatingWallet?: boolean;
|
|
330
|
+
createWalletError?: string | null;
|
|
331
|
+
onCreateWallet?: () => void;
|
|
308
332
|
onToggleOpen: () => void;
|
|
309
333
|
onCreateAccount: () => void;
|
|
310
334
|
onCopy: () => void;
|
|
@@ -319,7 +343,7 @@ interface WalletButtonTemplateProps {
|
|
|
319
343
|
onLogout: () => void;
|
|
320
344
|
onLogin: () => void;
|
|
321
345
|
}
|
|
322
|
-
declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, showCreateAccount, notReadyReason, creatingAccount, onToggleOpen, onCreateAccount, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
|
|
346
|
+
declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, showCreateAccount, notReadyReason, creatingAccount, onToggleOpen, onCreateAccount, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, signedIn, creatingWallet, createWalletError, onCreateWallet, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
|
|
323
347
|
|
|
324
348
|
/**
|
|
325
349
|
* The chain a record lives on, with the legacy shape folded in: sessions and
|
|
@@ -379,6 +403,37 @@ interface UseChainsResult {
|
|
|
379
403
|
}
|
|
380
404
|
declare function useChains(): UseChainsResult;
|
|
381
405
|
|
|
406
|
+
interface UseCosignResult {
|
|
407
|
+
/** Requests waiting for this device's vote, oldest first. */
|
|
408
|
+
pending: CosignRequest[];
|
|
409
|
+
/** The last request that reached a final state. */
|
|
410
|
+
lastResolved?: CosignRequest;
|
|
411
|
+
/** Whether the client's co-sign store has been read at least once. */
|
|
412
|
+
loaded: boolean;
|
|
413
|
+
/** Re-read the pending requests from the API. */
|
|
414
|
+
refresh: () => Promise<void>;
|
|
415
|
+
/** Verify the request against Turnkey and, when it checks out, vote yes. */
|
|
416
|
+
approve: (request: CosignRequest) => Promise<CosignRequest>;
|
|
417
|
+
/** Vote no. Final. */
|
|
418
|
+
reject: (request: CosignRequest) => Promise<CosignRequest>;
|
|
419
|
+
/** The verification a UI can show before the user decides. */
|
|
420
|
+
verify: (request: CosignRequest) => Promise<CosignVerification>;
|
|
421
|
+
/** Read the sub-organization from Turnkey with the device key and record whether it is the promised 2-of-2. */
|
|
422
|
+
inspectQuorum: () => Promise<CosignQuorumReport>;
|
|
423
|
+
/** The user's enrolled devices and the quorum state as sdk-api records it. */
|
|
424
|
+
devices: () => Promise<CosignDevicesContent>;
|
|
425
|
+
/** Revoke another enrolled device; `force` to revoke this one. */
|
|
426
|
+
revokeDevice: (deviceId: string, options?: {
|
|
427
|
+
force?: boolean;
|
|
428
|
+
}) => Promise<CosignDevicesContent>;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* The user's side of a Turnkey co-signed wallet, for an app that renders its
|
|
432
|
+
* own confirmation UI instead of the provider's modal. Subscribes to the
|
|
433
|
+
* client's co-sign store and loads the pending requests once on mount.
|
|
434
|
+
*/
|
|
435
|
+
declare function useCosign(): UseCosignResult;
|
|
436
|
+
|
|
382
437
|
interface KycModalProps {
|
|
383
438
|
corridorId?: string;
|
|
384
439
|
/** A card provider's steps, in place of a route's. */
|
|
@@ -509,6 +564,16 @@ interface SessionsModalProps {
|
|
|
509
564
|
}
|
|
510
565
|
declare function SessionsModal({ onClose }: SessionsModalProps): react_jsx_runtime.JSX.Element;
|
|
511
566
|
|
|
567
|
+
interface CosignModalProps {
|
|
568
|
+
onClose: () => void;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The approval prompt of a Turnkey co-signed wallet. Verifies each request
|
|
572
|
+
* against Turnkey before enabling Approve, so the user only ever confirms a
|
|
573
|
+
* transaction the device checked itself.
|
|
574
|
+
*/
|
|
575
|
+
declare function CosignModal({ onClose }: CosignModalProps): react_jsx_runtime.JSX.Element;
|
|
576
|
+
|
|
512
577
|
interface DistributionRulesModalProps {
|
|
513
578
|
onClose: () => void;
|
|
514
579
|
}
|
|
@@ -701,9 +766,23 @@ interface RampWidgetTemplateProps {
|
|
|
701
766
|
onboardingStatus?: 'kyc' | 'endorsement' | 'awaiting_provider' | null;
|
|
702
767
|
/** The gate has since cleared - the user needs a fresh quote to continue. */
|
|
703
768
|
kycJustApproved: boolean;
|
|
769
|
+
/** Superseded by `txHash`, which carries the settlement on any chain; read when `txHash` is absent. */
|
|
704
770
|
stellarTxHash: string | null;
|
|
705
|
-
/**
|
|
771
|
+
/** The on-chain transaction that settled the ramp, on `txChain`. */
|
|
772
|
+
txHash?: string | null;
|
|
773
|
+
/** Chain of `txHash`; Stellar when omitted. */
|
|
774
|
+
txChain?: 'STELLAR' | 'POLYGON' | 'SOLANA' | null;
|
|
775
|
+
/** Explorer URL for the transaction (chain- and network-aware); null when unknown. */
|
|
706
776
|
explorerUrl: string | null;
|
|
777
|
+
/**
|
|
778
|
+
* The user's money is in one of their wallets between two steps of the route.
|
|
779
|
+
* Optional for integrators rendering their own chrome; omitted, the state is
|
|
780
|
+
* not shown.
|
|
781
|
+
*/
|
|
782
|
+
fundsInTransit?: boolean;
|
|
783
|
+
/** A retry of the pending step is in flight. */
|
|
784
|
+
retrying?: boolean;
|
|
785
|
+
onRetryTransit?: () => void;
|
|
707
786
|
depositInstructions: RampDepositInstructions | null;
|
|
708
787
|
canComplete: boolean;
|
|
709
788
|
completing: boolean;
|
|
@@ -728,7 +807,7 @@ interface RampWidgetTemplateProps {
|
|
|
728
807
|
onRefresh: () => void;
|
|
729
808
|
onClose: () => void;
|
|
730
809
|
}
|
|
731
|
-
declare function RampWidgetTemplate({ theme, accentColor, styleOverrides, step, flowSteps, flowStepIndex, startingQuoteId, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, kycRequired, isLoading, provider, txStatus, kycUrl, tosUrl, kycBlocking, onboardingStatus, kycJustApproved, stellarTxHash, explorerUrl, depositInstructions, canComplete, completing, errorMsg, noticeMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onVerifyRoute, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onBack, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
810
|
+
declare function RampWidgetTemplate({ theme, accentColor, styleOverrides, step, flowSteps, flowStepIndex, startingQuoteId, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, kycRequired, isLoading, provider, txStatus, kycUrl, tosUrl, kycBlocking, onboardingStatus, kycJustApproved, stellarTxHash, txHash, txChain, explorerUrl, fundsInTransit, retrying, onRetryTransit, depositInstructions, canComplete, completing, errorMsg, noticeMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onVerifyRoute, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onBack, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
732
811
|
|
|
733
812
|
interface TransactionModalTemplateProps {
|
|
734
813
|
theme: string;
|
|
@@ -843,6 +922,8 @@ interface CustomTrustlineModalTemplateProps {
|
|
|
843
922
|
}) => void;
|
|
844
923
|
}
|
|
845
924
|
|
|
925
|
+
/** The memo types the backend accepts on a Stellar payment. */
|
|
926
|
+
type SendMemoType = 'text' | 'id';
|
|
846
927
|
interface SendModalTemplateProps {
|
|
847
928
|
theme: string;
|
|
848
929
|
accentColor: string;
|
|
@@ -893,6 +974,15 @@ interface SendModalTemplateProps {
|
|
|
893
974
|
onMax: () => void;
|
|
894
975
|
onPaste: () => void;
|
|
895
976
|
onDestinationChange: (value: string) => void;
|
|
977
|
+
/**
|
|
978
|
+
* Optional Stellar memo. The field renders only on Stellar and only when
|
|
979
|
+
* {@link onMemoChange} is passed, so a custom template written before it
|
|
980
|
+
* existed keeps compiling.
|
|
981
|
+
*/
|
|
982
|
+
memo?: string;
|
|
983
|
+
memoType?: SendMemoType;
|
|
984
|
+
onMemoChange?: (value: string) => void;
|
|
985
|
+
onMemoTypeChange?: (type: SendMemoType) => void;
|
|
896
986
|
onSubmit: () => void;
|
|
897
987
|
onSignAndSend: () => void;
|
|
898
988
|
onToggleXdr: () => void;
|
|
@@ -900,7 +990,7 @@ interface SendModalTemplateProps {
|
|
|
900
990
|
onRetry: () => void;
|
|
901
991
|
onDone: () => void;
|
|
902
992
|
}
|
|
903
|
-
declare function SendModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, assets, selectedAsset, selectedChain, canSendOnChain, notReadyReason, chains, onSelectChain, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onMax, onPaste, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
993
|
+
declare function SendModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, assets, selectedAsset, selectedChain, canSendOnChain, notReadyReason, chains, onSelectChain, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onMax, onPaste, onDestinationChange, memo, memoType, onMemoChange, onMemoTypeChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
904
994
|
|
|
905
995
|
interface SwapAssetOption {
|
|
906
996
|
ref: SwapQuoteParams['sellAsset'];
|
|
@@ -1001,6 +1091,32 @@ interface SessionsModalTemplateProps {
|
|
|
1001
1091
|
}
|
|
1002
1092
|
declare function SessionsModalTemplate({ theme, accentColor, styleOverrides, state, revokingFamilyId, signingOutEverywhere, revokeError, onRefresh, onRevoke, onLogoutEverywhere, onClose, }: SessionsModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
1003
1093
|
|
|
1094
|
+
interface CosignModalTemplateProps {
|
|
1095
|
+
theme: string;
|
|
1096
|
+
accentColor: string;
|
|
1097
|
+
/** Per-app modal chrome overrides (background, card + button radius). */
|
|
1098
|
+
styleOverrides?: ModalStyleOverrides;
|
|
1099
|
+
/** Requests waiting for this device's vote, oldest first. */
|
|
1100
|
+
pending: CosignRequest[];
|
|
1101
|
+
/** The request shown in detail; the first pending one when not chosen. */
|
|
1102
|
+
current: CosignRequest | null;
|
|
1103
|
+
/** Verification of `current`, or null while it runs. */
|
|
1104
|
+
verification: CosignVerification | null;
|
|
1105
|
+
busy: 'approving' | 'rejecting' | null;
|
|
1106
|
+
error: string | null;
|
|
1107
|
+
/** Approve stays off for a request whose approval just failed. */
|
|
1108
|
+
approveBlocked?: boolean;
|
|
1109
|
+
/** The last request that reached a final state, shown once the list is empty. */
|
|
1110
|
+
lastResolved?: CosignRequest;
|
|
1111
|
+
/** Explorer page of {@link lastResolved}'s transaction, when it was sent. */
|
|
1112
|
+
explorerUrl?: string | null;
|
|
1113
|
+
onSelect: (request: CosignRequest) => void;
|
|
1114
|
+
onApprove: (request: CosignRequest) => void;
|
|
1115
|
+
onReject: (request: CosignRequest) => void;
|
|
1116
|
+
onClose: () => void;
|
|
1117
|
+
}
|
|
1118
|
+
declare function CosignModalTemplate({ theme, accentColor, styleOverrides, pending, current, verification, busy, error, approveBlocked, lastResolved, explorerUrl, onSelect, onApprove, onReject, onClose, }: CosignModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
1119
|
+
|
|
1004
1120
|
interface DistributionRulesModalTemplateProps {
|
|
1005
1121
|
theme: string;
|
|
1006
1122
|
accentColor: string;
|
|
@@ -1016,4 +1132,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
1016
1132
|
}
|
|
1017
1133
|
declare function DistributionRulesModalTemplate({ theme, accentColor, styleOverrides, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
1018
1134
|
|
|
1019
|
-
export { type AuthModalProps, CardModal, ChainSelect, type ChainSelectProps, type CustomTrustlineModalTemplateProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type ModalChrome, type ModalStyleOverrides, type ModalVariant, type PollarConfig, PollarProvider, type PollarStyles, ProviderRegistrationModal, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RegistryCheckModal, RequirementFormModal, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, type UseChainsResult, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, addressForChain, browserPasskeyCeremony, browserPasskeySigner, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, usePollar, walletNotReadyReason };
|
|
1135
|
+
export { type AuthModalProps, CardModal, ChainSelect, type ChainSelectProps, CosignModal, CosignModalTemplate, type CosignModalTemplateProps, type CustomTrustlineModalTemplateProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type ModalChrome, type ModalStyleOverrides, type ModalVariant, type PollarConfig, PollarProvider, type PollarStyles, ProviderRegistrationModal, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RegistryCheckModal, RequirementFormModal, RouteDisplay, type SendMemoType, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, type UseChainsResult, type UseCosignResult, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, addressForChain, browserPasskeyCeremony, browserPasskeySigner, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
|