@pollar/react 0.5.3 → 0.7.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 +202 -20
- package/dist/index.css +242 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +110 -11
- package/dist/index.d.ts +110 -11
- package/dist/index.js +2122 -365
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2117 -367
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { PollarApplicationConfigContent, PollarLoginOptions, PollarClientConfig, pollarPaths, PollarAdapters, PollarClient, TransactionState, TxBuildBody,
|
|
2
|
+
import { PollarApplicationConfigContent, PollarLoginOptions, PollarClientConfig, pollarPaths, PollarAdapters, PollarClient, TransactionState, TxBuildBody, WalletId, StellarNetwork, WalletBalanceState, TxHistoryState, PollarAdapter, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, PaymentInstructions, WalletBalanceRecord, SessionInfo } from '@pollar/core';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
|
|
@@ -35,26 +35,30 @@ interface PollarContextValue {
|
|
|
35
35
|
isAuthenticated: boolean;
|
|
36
36
|
login: (options: PollarLoginOptions) => void;
|
|
37
37
|
logout: () => void;
|
|
38
|
-
|
|
38
|
+
/** Open the active-sessions modal. */
|
|
39
|
+
openSessionsModal: () => void;
|
|
40
|
+
appConfig: PollarConfig;
|
|
39
41
|
styles: PollarStyles;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
openTxModal: () => void;
|
|
43
|
+
tx: TransactionState;
|
|
42
44
|
buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<void>;
|
|
43
45
|
signAndSubmitTx: (unsignedXdr: string) => Promise<void>;
|
|
44
|
-
walletType:
|
|
46
|
+
walletType: WalletId | null;
|
|
45
47
|
network: StellarNetwork;
|
|
46
48
|
setNetwork: (network: StellarNetwork) => void;
|
|
47
49
|
walletBalance: WalletBalanceState;
|
|
48
|
-
|
|
50
|
+
refreshWalletBalance: () => Promise<void>;
|
|
49
51
|
openKycModal: (options?: {
|
|
50
52
|
country?: string;
|
|
51
53
|
level?: 'basic' | 'intermediate' | 'enhanced';
|
|
52
54
|
onApproved?: () => void;
|
|
53
55
|
}) => void;
|
|
54
|
-
|
|
56
|
+
openRampModal: () => void;
|
|
55
57
|
txHistory: TxHistoryState;
|
|
56
58
|
openTxHistoryModal: () => void;
|
|
57
59
|
openWalletBalanceModal: () => void;
|
|
60
|
+
openSendModal: () => void;
|
|
61
|
+
openReceiveModal: () => void;
|
|
58
62
|
adapters?: PollarAdapters;
|
|
59
63
|
}
|
|
60
64
|
interface PollarProviderProps {
|
|
@@ -66,10 +70,10 @@ interface PollarProviderProps {
|
|
|
66
70
|
declare function PollarProvider({ config, styles: propStyles, adapters, children }: PollarProviderProps): react_jsx_runtime.JSX.Element;
|
|
67
71
|
declare function usePollar(): PollarContextValue;
|
|
68
72
|
|
|
69
|
-
type WrappedAdapter<T extends
|
|
73
|
+
type WrappedAdapter<T extends PollarAdapter> = {
|
|
70
74
|
[K in keyof T]: (params: Parameters<T[K]>[0]) => Promise<void>;
|
|
71
75
|
};
|
|
72
|
-
declare function createPollarAdapterHook<T extends
|
|
76
|
+
declare function createPollarAdapterHook<T extends PollarAdapter>(key: string): () => WrappedAdapter<T>;
|
|
73
77
|
|
|
74
78
|
declare function WalletButton(): react_jsx_runtime.JSX.Element;
|
|
75
79
|
|
|
@@ -106,6 +110,21 @@ interface WalletBalanceModalProps {
|
|
|
106
110
|
}
|
|
107
111
|
declare function WalletBalanceModal({ onClose }: WalletBalanceModalProps): react_jsx_runtime.JSX.Element;
|
|
108
112
|
|
|
113
|
+
interface SendModalProps {
|
|
114
|
+
onClose: () => void;
|
|
115
|
+
}
|
|
116
|
+
declare function SendModal({ onClose }: SendModalProps): react_jsx_runtime.JSX.Element;
|
|
117
|
+
|
|
118
|
+
interface ReceiveModalProps {
|
|
119
|
+
onClose: () => void;
|
|
120
|
+
}
|
|
121
|
+
declare function ReceiveModal({ onClose }: ReceiveModalProps): react_jsx_runtime.JSX.Element;
|
|
122
|
+
|
|
123
|
+
interface SessionsModalProps {
|
|
124
|
+
onClose: () => void;
|
|
125
|
+
}
|
|
126
|
+
declare function SessionsModal({ onClose }: SessionsModalProps): react_jsx_runtime.JSX.Element;
|
|
127
|
+
|
|
109
128
|
interface LoginModalTemplateProps {
|
|
110
129
|
theme: string;
|
|
111
130
|
accentColor: string;
|
|
@@ -181,7 +200,7 @@ interface TransactionModalTemplateProps {
|
|
|
181
200
|
showXdr: boolean;
|
|
182
201
|
copied: boolean;
|
|
183
202
|
explorerUrl: string | null;
|
|
184
|
-
walletType?:
|
|
203
|
+
walletType?: WalletId | null;
|
|
185
204
|
onClose: () => void;
|
|
186
205
|
onSignAndSend: () => void;
|
|
187
206
|
onToggleXdr: () => void;
|
|
@@ -190,6 +209,20 @@ interface TransactionModalTemplateProps {
|
|
|
190
209
|
}
|
|
191
210
|
declare function TransactionModalTemplate({ theme, accentColor, transaction, showXdr, copied, explorerUrl, walletType, onClose, onSignAndSend, onToggleXdr, onCopyHash, onRetry, }: TransactionModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
192
211
|
|
|
212
|
+
interface TxStatusViewProps {
|
|
213
|
+
transaction: TransactionState;
|
|
214
|
+
showXdr: boolean;
|
|
215
|
+
copied: boolean;
|
|
216
|
+
explorerUrl: string | null;
|
|
217
|
+
walletType?: WalletId | null | undefined;
|
|
218
|
+
onSignAndSend: () => void;
|
|
219
|
+
onToggleXdr: () => void;
|
|
220
|
+
onCopyHash: () => void;
|
|
221
|
+
onRetry?: (() => void) | undefined;
|
|
222
|
+
onDone: () => void;
|
|
223
|
+
}
|
|
224
|
+
declare function TxStatusView({ transaction, showXdr, copied, explorerUrl, walletType, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: TxStatusViewProps): react_jsx_runtime.JSX.Element;
|
|
225
|
+
|
|
193
226
|
interface TxHistoryModalTemplateProps {
|
|
194
227
|
theme: string;
|
|
195
228
|
accentColor: string;
|
|
@@ -212,4 +245,70 @@ interface WalletBalanceModalTemplateProps {
|
|
|
212
245
|
}
|
|
213
246
|
declare function WalletBalanceModalTemplate({ theme, accentColor, walletBalance, walletAddress, onRefresh, onClose, }: WalletBalanceModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
214
247
|
|
|
215
|
-
|
|
248
|
+
interface SendModalTemplateProps {
|
|
249
|
+
theme: string;
|
|
250
|
+
accentColor: string;
|
|
251
|
+
step: 'form' | 'tx';
|
|
252
|
+
txTitle: string;
|
|
253
|
+
assets: WalletBalanceRecord[];
|
|
254
|
+
selectedAsset: WalletBalanceRecord | null;
|
|
255
|
+
amount: string;
|
|
256
|
+
destination: string;
|
|
257
|
+
formError: string;
|
|
258
|
+
isLoadingBalance: boolean;
|
|
259
|
+
transaction: TransactionState;
|
|
260
|
+
showXdr: boolean;
|
|
261
|
+
copied: boolean;
|
|
262
|
+
explorerUrl: string | null;
|
|
263
|
+
walletType?: WalletId | null | undefined;
|
|
264
|
+
showBack: boolean;
|
|
265
|
+
isInProgress: boolean;
|
|
266
|
+
onClose: () => void;
|
|
267
|
+
onBack: () => void;
|
|
268
|
+
onSelectAsset: (asset: WalletBalanceRecord) => void;
|
|
269
|
+
onAmountChange: (value: string) => void;
|
|
270
|
+
onDestinationChange: (value: string) => void;
|
|
271
|
+
onSubmit: () => void;
|
|
272
|
+
onSignAndSend: () => void;
|
|
273
|
+
onToggleXdr: () => void;
|
|
274
|
+
onCopyHash: () => void;
|
|
275
|
+
onRetry: () => void;
|
|
276
|
+
onDone: () => void;
|
|
277
|
+
}
|
|
278
|
+
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;
|
|
279
|
+
|
|
280
|
+
interface ReceiveModalTemplateProps {
|
|
281
|
+
theme: string;
|
|
282
|
+
accentColor: string;
|
|
283
|
+
walletAddress: string;
|
|
284
|
+
copied: boolean;
|
|
285
|
+
onCopy: () => void;
|
|
286
|
+
onClose: () => void;
|
|
287
|
+
}
|
|
288
|
+
declare function ReceiveModalTemplate({ theme, accentColor, walletAddress, copied, onCopy, onClose, }: ReceiveModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
289
|
+
|
|
290
|
+
type SessionsState = {
|
|
291
|
+
step: 'idle';
|
|
292
|
+
} | {
|
|
293
|
+
step: 'loading';
|
|
294
|
+
} | {
|
|
295
|
+
step: 'loaded';
|
|
296
|
+
sessions: SessionInfo[];
|
|
297
|
+
} | {
|
|
298
|
+
step: 'error';
|
|
299
|
+
message: string;
|
|
300
|
+
};
|
|
301
|
+
interface SessionsModalTemplateProps {
|
|
302
|
+
theme: string;
|
|
303
|
+
accentColor: string;
|
|
304
|
+
state: SessionsState;
|
|
305
|
+
revokingFamilyId: string | null;
|
|
306
|
+
signingOutEverywhere: boolean;
|
|
307
|
+
onRefresh: () => void;
|
|
308
|
+
onRevoke: (familyId: string) => void;
|
|
309
|
+
onLogoutEverywhere: () => void;
|
|
310
|
+
onClose: () => void;
|
|
311
|
+
}
|
|
312
|
+
declare function SessionsModalTemplate({ theme, accentColor, state, revokingFamilyId, signingOutEverywhere, onRefresh, onRevoke, onLogoutEverywhere, onClose, }: SessionsModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
313
|
+
|
|
314
|
+
export { type AuthContextValue, type AuthModalProps, type AuthProviderProps, 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 SessionsState, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, createPollarAdapterHook, usePollar };
|