@pollar/react 0.10.0-rc.8 → 0.10.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -103
- package/dist/index.css +50 -11
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +100 -34
- package/dist/index.d.ts +100 -34
- package/dist/index.js +959 -199
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +959 -201
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, PollarAdapter, WalletId, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampTxStatus, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
3
|
export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
|
|
7
7
|
type PollarConfig = ConfigResponse['content'];
|
|
8
8
|
type PollarStyles = PollarConfig['styles'];
|
|
9
|
-
/**
|
|
10
|
-
* Props passed by `@pollar/react` to a `renderWallets` slot. External wallet
|
|
11
|
-
* picker components receive these and call `onConnect(id)` when the user picks
|
|
12
|
-
* a wallet; `@pollar/react` wraps that into `client.login({ provider: id })`.
|
|
13
|
-
*/
|
|
14
|
-
interface RenderWalletsProps {
|
|
15
|
-
/** Wrapper around `client.login({ provider: id })`. */
|
|
16
|
-
onConnect: (id: WalletId) => void;
|
|
17
|
-
/** Current auth state — picker can disable buttons / surface loading. */
|
|
18
|
-
authState: AuthState;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Signature for the `ui.renderWallets` slot on `<PollarProvider>`. When
|
|
22
|
-
* provided, replaces the default Freighter/Albedo buttons in the LoginModal
|
|
23
|
-
* with whatever the slot returns (typically a kit-powered wallet grid).
|
|
24
|
-
*/
|
|
25
|
-
type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
|
|
26
9
|
interface LoginButtonProps {
|
|
27
10
|
onSuccess?: () => void;
|
|
28
11
|
onError?: (error: Error) => void;
|
|
@@ -60,8 +43,6 @@ interface PollarContextValue {
|
|
|
60
43
|
openSessionsModal: () => void;
|
|
61
44
|
appConfig: PollarConfig;
|
|
62
45
|
styles: PollarStyles;
|
|
63
|
-
/** UI slot overriding the per-adapter wallet button list (forwarded from provider props). */
|
|
64
|
-
renderWallets?: RenderWalletsSlot;
|
|
65
46
|
openTxModal: () => void;
|
|
66
47
|
tx: TransactionState;
|
|
67
48
|
buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
|
|
@@ -110,6 +91,30 @@ interface PollarContextValue {
|
|
|
110
91
|
openWalletBalanceModal: () => void;
|
|
111
92
|
openSendModal: () => void;
|
|
112
93
|
openReceiveModal: () => void;
|
|
94
|
+
/**
|
|
95
|
+
* The swap venues this app exposes to end-users (empty = swap disabled, hide
|
|
96
|
+
* swap UI). Mirrors {@link PollarClient.getSwapConfig}.
|
|
97
|
+
*/
|
|
98
|
+
getSwapConfig: () => Promise<SwapVenue[]>;
|
|
99
|
+
/**
|
|
100
|
+
* The curated "buy" tokens this app opted into (admin catalog). Mirrors
|
|
101
|
+
* {@link PollarClient.getSwapTokens}.
|
|
102
|
+
*/
|
|
103
|
+
getSwapTokens: () => Promise<SwapToken[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Quote an asset-to-asset swap across the requested venue(s). Read-only;
|
|
106
|
+
* returns quotes ranked best-first. Mirrors {@link PollarClient.getSwapQuote}.
|
|
107
|
+
*/
|
|
108
|
+
getSwapQuote: (params: SwapQuoteParams) => Promise<SwapQuote[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Execute a swap from a quote (establishes the buy-asset trustline first when
|
|
111
|
+
* needed). Drives the transaction state machine. Mirrors {@link PollarClient.swap}.
|
|
112
|
+
*/
|
|
113
|
+
swap: (quote: SwapQuote, opts?: {
|
|
114
|
+
autoTrustline?: boolean;
|
|
115
|
+
}) => Promise<SubmitOutcome>;
|
|
116
|
+
/** Open the swap modal. */
|
|
117
|
+
openSwapModal: () => void;
|
|
113
118
|
openDistributionRulesModal: () => void;
|
|
114
119
|
adapters?: PollarAdapters;
|
|
115
120
|
}
|
|
@@ -130,11 +135,6 @@ interface PollarProviderProps {
|
|
|
130
135
|
* `/applications/config` on mount.
|
|
131
136
|
*/
|
|
132
137
|
appConfig?: PollarConfig;
|
|
133
|
-
/** UI customization slots. */
|
|
134
|
-
ui?: {
|
|
135
|
-
/** Replaces the default per-adapter wallet button list with a custom picker. */
|
|
136
|
-
renderWallets?: RenderWalletsSlot;
|
|
137
|
-
};
|
|
138
138
|
adapters?: PollarAdapters;
|
|
139
139
|
/**
|
|
140
140
|
* Notified when persistent storage silently degrades to in-memory mode
|
|
@@ -148,7 +148,7 @@ interface PollarProviderProps {
|
|
|
148
148
|
onStorageDegrade?: OnStorageDegrade;
|
|
149
149
|
children: ReactNode;
|
|
150
150
|
}
|
|
151
|
-
declare function PollarProvider({ client, appConfig: appConfigProp,
|
|
151
|
+
declare function PollarProvider({ client, appConfig: appConfigProp, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
|
|
152
152
|
declare function usePollar(): PollarContextValue;
|
|
153
153
|
|
|
154
154
|
type WrappedAdapter<T extends PollarAdapter> = {
|
|
@@ -227,6 +227,11 @@ interface SendModalProps {
|
|
|
227
227
|
}
|
|
228
228
|
declare function SendModal({ onClose }: SendModalProps): react_jsx_runtime.JSX.Element;
|
|
229
229
|
|
|
230
|
+
interface SwapModalProps {
|
|
231
|
+
onClose: () => void;
|
|
232
|
+
}
|
|
233
|
+
declare function SwapModal({ onClose }: SwapModalProps): react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
230
235
|
interface ReceiveModalProps {
|
|
231
236
|
onClose: () => void;
|
|
232
237
|
}
|
|
@@ -247,6 +252,7 @@ type WalletAdapterEntry = {
|
|
|
247
252
|
meta: {
|
|
248
253
|
label: string;
|
|
249
254
|
iconUrl?: string;
|
|
255
|
+
group?: string;
|
|
250
256
|
};
|
|
251
257
|
};
|
|
252
258
|
interface LoginModalTemplateProps {
|
|
@@ -277,8 +283,6 @@ interface LoginModalTemplateProps {
|
|
|
277
283
|
onLoginSmartWallet?: () => void;
|
|
278
284
|
/** Create a new passkey + smart wallet (new user). */
|
|
279
285
|
onCreateSmartWallet?: () => void;
|
|
280
|
-
/** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
|
|
281
|
-
renderWallets?: RenderWalletsSlot;
|
|
282
286
|
authState: AuthState;
|
|
283
287
|
codeInputKey?: number;
|
|
284
288
|
onCodeSubmit?: (code: string) => void;
|
|
@@ -286,7 +290,7 @@ interface LoginModalTemplateProps {
|
|
|
286
290
|
onCancel: () => void;
|
|
287
291
|
onRetry: () => void;
|
|
288
292
|
}
|
|
289
|
-
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet,
|
|
293
|
+
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
290
294
|
|
|
291
295
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
292
296
|
interface KycModalTemplateProps {
|
|
@@ -304,7 +308,7 @@ interface KycModalTemplateProps {
|
|
|
304
308
|
}
|
|
305
309
|
declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
306
310
|
|
|
307
|
-
type RampStep = 'input' | 'loading_quote' | 'select_route' | '
|
|
311
|
+
type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
|
|
308
312
|
interface RampWidgetTemplateProps {
|
|
309
313
|
theme: string;
|
|
310
314
|
accentColor: string;
|
|
@@ -314,18 +318,26 @@ interface RampWidgetTemplateProps {
|
|
|
314
318
|
currency: string;
|
|
315
319
|
country: string;
|
|
316
320
|
quotes: RampQuote[];
|
|
317
|
-
paymentInstructions: PaymentInstructions | null;
|
|
318
321
|
isLoading: boolean;
|
|
322
|
+
provider: string;
|
|
323
|
+
txStatus: RampTxStatus | null;
|
|
324
|
+
kycUrl: string | null;
|
|
325
|
+
stellarTxHash: string | null;
|
|
326
|
+
canComplete: boolean;
|
|
327
|
+
completing: boolean;
|
|
328
|
+
errorMsg: string | null;
|
|
319
329
|
onDirectionChange: (d: RampDirection) => void;
|
|
320
330
|
onAmountChange: (v: string) => void;
|
|
321
331
|
onCurrencyChange: (v: string) => void;
|
|
322
332
|
onCountryChange: (v: string) => void;
|
|
323
333
|
onFindRoute: () => void;
|
|
324
334
|
onSelectQuote: (q: RampQuote) => void;
|
|
325
|
-
|
|
335
|
+
onOpenKyc: () => void;
|
|
336
|
+
onCompleteWithdraw: () => void;
|
|
337
|
+
onRetry: () => void;
|
|
326
338
|
onClose: () => void;
|
|
327
339
|
}
|
|
328
|
-
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes,
|
|
340
|
+
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onOpenKyc, onCompleteWithdraw, onRetry, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
329
341
|
|
|
330
342
|
interface TransactionModalTemplateProps {
|
|
331
343
|
theme: string;
|
|
@@ -426,6 +438,60 @@ interface SendModalTemplateProps {
|
|
|
426
438
|
}
|
|
427
439
|
declare function SendModalTemplate({ theme, accentColor, step, txTitle, assets, selectedAsset, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onSelectAsset, onAmountChange, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
428
440
|
|
|
441
|
+
/** A selectable asset in the sell/buy pickers, normalized across balance/enabled records. */
|
|
442
|
+
interface SwapAssetOption {
|
|
443
|
+
ref: SwapQuoteParams['sellAsset'];
|
|
444
|
+
code: string;
|
|
445
|
+
issuer?: string | undefined;
|
|
446
|
+
available?: string | undefined;
|
|
447
|
+
enabledInApp?: boolean | undefined;
|
|
448
|
+
}
|
|
449
|
+
interface SwapModalTemplateProps {
|
|
450
|
+
theme: string;
|
|
451
|
+
accentColor: string;
|
|
452
|
+
step: 'form' | 'tx';
|
|
453
|
+
txTitle: string;
|
|
454
|
+
sellOptions: SwapAssetOption[];
|
|
455
|
+
buyOptions: SwapAssetOption[];
|
|
456
|
+
selectedSell: SwapAssetOption | null;
|
|
457
|
+
selectedBuy: SwapAssetOption | null;
|
|
458
|
+
amount: string;
|
|
459
|
+
provider: SwapProvider;
|
|
460
|
+
providers: SwapProvider[];
|
|
461
|
+
quote: SwapQuote | null;
|
|
462
|
+
quoteLoading: boolean;
|
|
463
|
+
quoteError: string;
|
|
464
|
+
formError: string;
|
|
465
|
+
isLoadingData: boolean;
|
|
466
|
+
smartUnsupported: boolean;
|
|
467
|
+
/** Swap config is still loading. */
|
|
468
|
+
configLoading: boolean;
|
|
469
|
+
/** Config loaded and this app exposes no swap venues — swap is disabled. */
|
|
470
|
+
swapUnavailable: boolean;
|
|
471
|
+
/** Buying the selected asset will create a trustline first (~0.5 XLM reserve). */
|
|
472
|
+
buyNeedsTrustline: boolean;
|
|
473
|
+
transaction: TransactionState;
|
|
474
|
+
showXdr: boolean;
|
|
475
|
+
copied: boolean;
|
|
476
|
+
explorerUrl: string | null;
|
|
477
|
+
walletType?: WalletId | null | undefined;
|
|
478
|
+
showBack: boolean;
|
|
479
|
+
isInProgress: boolean;
|
|
480
|
+
onClose: () => void;
|
|
481
|
+
onBack: () => void;
|
|
482
|
+
onRefresh: () => void;
|
|
483
|
+
onSelectSell: (o: SwapAssetOption) => void;
|
|
484
|
+
onSelectBuy: (o: SwapAssetOption) => void;
|
|
485
|
+
onAmountChange: (value: string) => void;
|
|
486
|
+
onProviderChange: (p: SwapProvider) => void;
|
|
487
|
+
onSwap: () => void;
|
|
488
|
+
onToggleXdr: () => void;
|
|
489
|
+
onCopyHash: () => void;
|
|
490
|
+
onRetry: () => void;
|
|
491
|
+
onDone: () => void;
|
|
492
|
+
}
|
|
493
|
+
declare function SwapModalTemplate({ theme, accentColor, step, txTitle, sellOptions, buyOptions, selectedSell, selectedBuy, amount, provider, providers, quote, quoteLoading, quoteError, formError, isLoadingData, smartUnsupported, configLoading, swapUnavailable, buyNeedsTrustline, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectSell, onSelectBuy, onAmountChange, onProviderChange, onSwap, onToggleXdr, onCopyHash, onRetry, onDone, }: SwapModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
494
|
+
|
|
429
495
|
interface ReceiveModalTemplateProps {
|
|
430
496
|
theme: string;
|
|
431
497
|
accentColor: string;
|
|
@@ -462,4 +528,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
462
528
|
}
|
|
463
529
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
464
530
|
|
|
465
|
-
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps,
|
|
531
|
+
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, PollarAdapter, WalletId, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampTxStatus, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
|
|
3
3
|
export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
|
|
7
7
|
type PollarConfig = ConfigResponse['content'];
|
|
8
8
|
type PollarStyles = PollarConfig['styles'];
|
|
9
|
-
/**
|
|
10
|
-
* Props passed by `@pollar/react` to a `renderWallets` slot. External wallet
|
|
11
|
-
* picker components receive these and call `onConnect(id)` when the user picks
|
|
12
|
-
* a wallet; `@pollar/react` wraps that into `client.login({ provider: id })`.
|
|
13
|
-
*/
|
|
14
|
-
interface RenderWalletsProps {
|
|
15
|
-
/** Wrapper around `client.login({ provider: id })`. */
|
|
16
|
-
onConnect: (id: WalletId) => void;
|
|
17
|
-
/** Current auth state — picker can disable buttons / surface loading. */
|
|
18
|
-
authState: AuthState;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Signature for the `ui.renderWallets` slot on `<PollarProvider>`. When
|
|
22
|
-
* provided, replaces the default Freighter/Albedo buttons in the LoginModal
|
|
23
|
-
* with whatever the slot returns (typically a kit-powered wallet grid).
|
|
24
|
-
*/
|
|
25
|
-
type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
|
|
26
9
|
interface LoginButtonProps {
|
|
27
10
|
onSuccess?: () => void;
|
|
28
11
|
onError?: (error: Error) => void;
|
|
@@ -60,8 +43,6 @@ interface PollarContextValue {
|
|
|
60
43
|
openSessionsModal: () => void;
|
|
61
44
|
appConfig: PollarConfig;
|
|
62
45
|
styles: PollarStyles;
|
|
63
|
-
/** UI slot overriding the per-adapter wallet button list (forwarded from provider props). */
|
|
64
|
-
renderWallets?: RenderWalletsSlot;
|
|
65
46
|
openTxModal: () => void;
|
|
66
47
|
tx: TransactionState;
|
|
67
48
|
buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
|
|
@@ -110,6 +91,30 @@ interface PollarContextValue {
|
|
|
110
91
|
openWalletBalanceModal: () => void;
|
|
111
92
|
openSendModal: () => void;
|
|
112
93
|
openReceiveModal: () => void;
|
|
94
|
+
/**
|
|
95
|
+
* The swap venues this app exposes to end-users (empty = swap disabled, hide
|
|
96
|
+
* swap UI). Mirrors {@link PollarClient.getSwapConfig}.
|
|
97
|
+
*/
|
|
98
|
+
getSwapConfig: () => Promise<SwapVenue[]>;
|
|
99
|
+
/**
|
|
100
|
+
* The curated "buy" tokens this app opted into (admin catalog). Mirrors
|
|
101
|
+
* {@link PollarClient.getSwapTokens}.
|
|
102
|
+
*/
|
|
103
|
+
getSwapTokens: () => Promise<SwapToken[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Quote an asset-to-asset swap across the requested venue(s). Read-only;
|
|
106
|
+
* returns quotes ranked best-first. Mirrors {@link PollarClient.getSwapQuote}.
|
|
107
|
+
*/
|
|
108
|
+
getSwapQuote: (params: SwapQuoteParams) => Promise<SwapQuote[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Execute a swap from a quote (establishes the buy-asset trustline first when
|
|
111
|
+
* needed). Drives the transaction state machine. Mirrors {@link PollarClient.swap}.
|
|
112
|
+
*/
|
|
113
|
+
swap: (quote: SwapQuote, opts?: {
|
|
114
|
+
autoTrustline?: boolean;
|
|
115
|
+
}) => Promise<SubmitOutcome>;
|
|
116
|
+
/** Open the swap modal. */
|
|
117
|
+
openSwapModal: () => void;
|
|
113
118
|
openDistributionRulesModal: () => void;
|
|
114
119
|
adapters?: PollarAdapters;
|
|
115
120
|
}
|
|
@@ -130,11 +135,6 @@ interface PollarProviderProps {
|
|
|
130
135
|
* `/applications/config` on mount.
|
|
131
136
|
*/
|
|
132
137
|
appConfig?: PollarConfig;
|
|
133
|
-
/** UI customization slots. */
|
|
134
|
-
ui?: {
|
|
135
|
-
/** Replaces the default per-adapter wallet button list with a custom picker. */
|
|
136
|
-
renderWallets?: RenderWalletsSlot;
|
|
137
|
-
};
|
|
138
138
|
adapters?: PollarAdapters;
|
|
139
139
|
/**
|
|
140
140
|
* Notified when persistent storage silently degrades to in-memory mode
|
|
@@ -148,7 +148,7 @@ interface PollarProviderProps {
|
|
|
148
148
|
onStorageDegrade?: OnStorageDegrade;
|
|
149
149
|
children: ReactNode;
|
|
150
150
|
}
|
|
151
|
-
declare function PollarProvider({ client, appConfig: appConfigProp,
|
|
151
|
+
declare function PollarProvider({ client, appConfig: appConfigProp, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
|
|
152
152
|
declare function usePollar(): PollarContextValue;
|
|
153
153
|
|
|
154
154
|
type WrappedAdapter<T extends PollarAdapter> = {
|
|
@@ -227,6 +227,11 @@ interface SendModalProps {
|
|
|
227
227
|
}
|
|
228
228
|
declare function SendModal({ onClose }: SendModalProps): react_jsx_runtime.JSX.Element;
|
|
229
229
|
|
|
230
|
+
interface SwapModalProps {
|
|
231
|
+
onClose: () => void;
|
|
232
|
+
}
|
|
233
|
+
declare function SwapModal({ onClose }: SwapModalProps): react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
230
235
|
interface ReceiveModalProps {
|
|
231
236
|
onClose: () => void;
|
|
232
237
|
}
|
|
@@ -247,6 +252,7 @@ type WalletAdapterEntry = {
|
|
|
247
252
|
meta: {
|
|
248
253
|
label: string;
|
|
249
254
|
iconUrl?: string;
|
|
255
|
+
group?: string;
|
|
250
256
|
};
|
|
251
257
|
};
|
|
252
258
|
interface LoginModalTemplateProps {
|
|
@@ -277,8 +283,6 @@ interface LoginModalTemplateProps {
|
|
|
277
283
|
onLoginSmartWallet?: () => void;
|
|
278
284
|
/** Create a new passkey + smart wallet (new user). */
|
|
279
285
|
onCreateSmartWallet?: () => void;
|
|
280
|
-
/** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
|
|
281
|
-
renderWallets?: RenderWalletsSlot;
|
|
282
286
|
authState: AuthState;
|
|
283
287
|
codeInputKey?: number;
|
|
284
288
|
onCodeSubmit?: (code: string) => void;
|
|
@@ -286,7 +290,7 @@ interface LoginModalTemplateProps {
|
|
|
286
290
|
onCancel: () => void;
|
|
287
291
|
onRetry: () => void;
|
|
288
292
|
}
|
|
289
|
-
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet,
|
|
293
|
+
declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
290
294
|
|
|
291
295
|
type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
|
|
292
296
|
interface KycModalTemplateProps {
|
|
@@ -304,7 +308,7 @@ interface KycModalTemplateProps {
|
|
|
304
308
|
}
|
|
305
309
|
declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
306
310
|
|
|
307
|
-
type RampStep = 'input' | 'loading_quote' | 'select_route' | '
|
|
311
|
+
type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
|
|
308
312
|
interface RampWidgetTemplateProps {
|
|
309
313
|
theme: string;
|
|
310
314
|
accentColor: string;
|
|
@@ -314,18 +318,26 @@ interface RampWidgetTemplateProps {
|
|
|
314
318
|
currency: string;
|
|
315
319
|
country: string;
|
|
316
320
|
quotes: RampQuote[];
|
|
317
|
-
paymentInstructions: PaymentInstructions | null;
|
|
318
321
|
isLoading: boolean;
|
|
322
|
+
provider: string;
|
|
323
|
+
txStatus: RampTxStatus | null;
|
|
324
|
+
kycUrl: string | null;
|
|
325
|
+
stellarTxHash: string | null;
|
|
326
|
+
canComplete: boolean;
|
|
327
|
+
completing: boolean;
|
|
328
|
+
errorMsg: string | null;
|
|
319
329
|
onDirectionChange: (d: RampDirection) => void;
|
|
320
330
|
onAmountChange: (v: string) => void;
|
|
321
331
|
onCurrencyChange: (v: string) => void;
|
|
322
332
|
onCountryChange: (v: string) => void;
|
|
323
333
|
onFindRoute: () => void;
|
|
324
334
|
onSelectQuote: (q: RampQuote) => void;
|
|
325
|
-
|
|
335
|
+
onOpenKyc: () => void;
|
|
336
|
+
onCompleteWithdraw: () => void;
|
|
337
|
+
onRetry: () => void;
|
|
326
338
|
onClose: () => void;
|
|
327
339
|
}
|
|
328
|
-
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes,
|
|
340
|
+
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onOpenKyc, onCompleteWithdraw, onRetry, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
329
341
|
|
|
330
342
|
interface TransactionModalTemplateProps {
|
|
331
343
|
theme: string;
|
|
@@ -426,6 +438,60 @@ interface SendModalTemplateProps {
|
|
|
426
438
|
}
|
|
427
439
|
declare function SendModalTemplate({ theme, accentColor, step, txTitle, assets, selectedAsset, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onSelectAsset, onAmountChange, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
428
440
|
|
|
441
|
+
/** A selectable asset in the sell/buy pickers, normalized across balance/enabled records. */
|
|
442
|
+
interface SwapAssetOption {
|
|
443
|
+
ref: SwapQuoteParams['sellAsset'];
|
|
444
|
+
code: string;
|
|
445
|
+
issuer?: string | undefined;
|
|
446
|
+
available?: string | undefined;
|
|
447
|
+
enabledInApp?: boolean | undefined;
|
|
448
|
+
}
|
|
449
|
+
interface SwapModalTemplateProps {
|
|
450
|
+
theme: string;
|
|
451
|
+
accentColor: string;
|
|
452
|
+
step: 'form' | 'tx';
|
|
453
|
+
txTitle: string;
|
|
454
|
+
sellOptions: SwapAssetOption[];
|
|
455
|
+
buyOptions: SwapAssetOption[];
|
|
456
|
+
selectedSell: SwapAssetOption | null;
|
|
457
|
+
selectedBuy: SwapAssetOption | null;
|
|
458
|
+
amount: string;
|
|
459
|
+
provider: SwapProvider;
|
|
460
|
+
providers: SwapProvider[];
|
|
461
|
+
quote: SwapQuote | null;
|
|
462
|
+
quoteLoading: boolean;
|
|
463
|
+
quoteError: string;
|
|
464
|
+
formError: string;
|
|
465
|
+
isLoadingData: boolean;
|
|
466
|
+
smartUnsupported: boolean;
|
|
467
|
+
/** Swap config is still loading. */
|
|
468
|
+
configLoading: boolean;
|
|
469
|
+
/** Config loaded and this app exposes no swap venues — swap is disabled. */
|
|
470
|
+
swapUnavailable: boolean;
|
|
471
|
+
/** Buying the selected asset will create a trustline first (~0.5 XLM reserve). */
|
|
472
|
+
buyNeedsTrustline: boolean;
|
|
473
|
+
transaction: TransactionState;
|
|
474
|
+
showXdr: boolean;
|
|
475
|
+
copied: boolean;
|
|
476
|
+
explorerUrl: string | null;
|
|
477
|
+
walletType?: WalletId | null | undefined;
|
|
478
|
+
showBack: boolean;
|
|
479
|
+
isInProgress: boolean;
|
|
480
|
+
onClose: () => void;
|
|
481
|
+
onBack: () => void;
|
|
482
|
+
onRefresh: () => void;
|
|
483
|
+
onSelectSell: (o: SwapAssetOption) => void;
|
|
484
|
+
onSelectBuy: (o: SwapAssetOption) => void;
|
|
485
|
+
onAmountChange: (value: string) => void;
|
|
486
|
+
onProviderChange: (p: SwapProvider) => void;
|
|
487
|
+
onSwap: () => void;
|
|
488
|
+
onToggleXdr: () => void;
|
|
489
|
+
onCopyHash: () => void;
|
|
490
|
+
onRetry: () => void;
|
|
491
|
+
onDone: () => void;
|
|
492
|
+
}
|
|
493
|
+
declare function SwapModalTemplate({ theme, accentColor, step, txTitle, sellOptions, buyOptions, selectedSell, selectedBuy, amount, provider, providers, quote, quoteLoading, quoteError, formError, isLoadingData, smartUnsupported, configLoading, swapUnavailable, buyNeedsTrustline, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectSell, onSelectBuy, onAmountChange, onProviderChange, onSwap, onToggleXdr, onCopyHash, onRetry, onDone, }: SwapModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
494
|
+
|
|
429
495
|
interface ReceiveModalTemplateProps {
|
|
430
496
|
theme: string;
|
|
431
497
|
accentColor: string;
|
|
@@ -462,4 +528,4 @@ interface DistributionRulesModalTemplateProps {
|
|
|
462
528
|
}
|
|
463
529
|
declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
464
530
|
|
|
465
|
-
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps,
|
|
531
|
+
export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };
|