@pollar/react 0.10.1-rc.1 → 0.10.1-rc.11

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/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, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, PollarAdapter, WalletId, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, RampTxStatus, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
2
+ import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, WalletId, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampCountry, 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
 
@@ -115,6 +115,33 @@ interface PollarContextValue {
115
115
  }) => Promise<SubmitOutcome>;
116
116
  /** Open the swap modal. */
117
117
  openSwapModal: () => void;
118
+ /**
119
+ * The yield providers this app exposes to end-users (empty = Earn disabled,
120
+ * hide Earn UI). Mirrors {@link PollarClient.getEarnProviders}.
121
+ */
122
+ getEarnProviders: () => Promise<EarnProviderId[]>;
123
+ /**
124
+ * The vaults (DeFindex) or pools (Blend) a provider exposes, with live APY.
125
+ * Mirrors {@link PollarClient.getEarnOpportunities}.
126
+ */
127
+ getEarnOpportunities: (provider: EarnProviderId) => Promise<EarnOpportunity[]>;
128
+ /**
129
+ * The connected wallet's position (balance + APY) in a vault/pool. Read-only.
130
+ * Mirrors {@link PollarClient.getEarnPosition}.
131
+ */
132
+ getEarnPosition: (params: EarnPositionParams) => Promise<EarnPosition>;
133
+ /**
134
+ * Deposit into a vault/pool (asset amount). Drives the transaction state
135
+ * machine. Mirrors {@link PollarClient.earnDeposit}.
136
+ */
137
+ earnDeposit: (params: EarnTxParams) => Promise<SubmitOutcome>;
138
+ /**
139
+ * Withdraw from a vault/pool (amount in the position `withdrawUnit`). Mirrors
140
+ * {@link PollarClient.earnWithdraw}.
141
+ */
142
+ earnWithdraw: (params: EarnTxParams) => Promise<SubmitOutcome>;
143
+ /** Open the Earn modal. */
144
+ openEarnModal: () => void;
118
145
  openDistributionRulesModal: () => void;
119
146
  adapters?: PollarAdapters;
120
147
  }
@@ -169,7 +196,11 @@ interface WalletButtonTemplateProps {
169
196
  wrapperRef: React.RefObject<HTMLDivElement>;
170
197
  isInProgress: boolean;
171
198
  walletType: WalletId | null;
199
+ /** Show the "Create account" action (external wallet not yet on-chain, IMMEDIATE funding). */
200
+ showCreateAccount: boolean;
201
+ creatingAccount: boolean;
172
202
  onToggleOpen: () => void;
203
+ onCreateAccount: () => void;
173
204
  onCopy: () => void;
174
205
  onWalletBalance: () => void;
175
206
  onTxHistory: () => void;
@@ -182,7 +213,7 @@ interface WalletButtonTemplateProps {
182
213
  onLogout: () => void;
183
214
  onLogin: () => void;
184
215
  }
185
- declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, onToggleOpen, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
216
+ declare function WalletButtonTemplate({ walletAddress, accentColor, open, copied, dropdownBg, dropdownBorder, itemColor, wrapperRef, isInProgress, showCreateAccount, creatingAccount, onToggleOpen, onCreateAccount, onCopy, onWalletBalance, onTxHistory, onSend, onReceive, onSessions, onKyc, onRamp, onDistributionRules, onLogout, onLogin, }: WalletButtonTemplateProps): react_jsx_runtime.JSX.Element;
186
217
 
187
218
  interface KycModalProps {
188
219
  onClose: () => void;
@@ -232,6 +263,11 @@ interface SwapModalProps {
232
263
  }
233
264
  declare function SwapModal({ onClose }: SwapModalProps): react_jsx_runtime.JSX.Element;
234
265
 
266
+ interface EarnModalProps {
267
+ onClose: () => void;
268
+ }
269
+ declare function EarnModal({ onClose }: EarnModalProps): react_jsx_runtime.JSX.Element;
270
+
235
271
  interface ReceiveModalProps {
236
272
  onClose: () => void;
237
273
  }
@@ -304,11 +340,24 @@ interface KycModalTemplateProps {
304
340
  isLoading: boolean;
305
341
  onSelectProvider: (provider: KycProvider) => void;
306
342
  onDoneVerifying: () => void;
343
+ onRefresh: () => void;
307
344
  onClose: () => void;
308
345
  }
309
- declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
346
+ declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onRefresh, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
310
347
 
311
- type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
348
+ type RampStep = 'input' | 'loading_quote' | 'select_route' | 'contact' | 'status' | 'error';
349
+ /** A field a provider declares (via the quote) that the client must collect. */
350
+ interface RampFieldSpec {
351
+ key: string;
352
+ label: string;
353
+ type: 'text' | 'email' | 'tel' | 'select';
354
+ bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH' | 'BREB';
355
+ /** For `type: 'select'` — dropdown choices (e.g. Stereum's Bolivian banks). */
356
+ options?: {
357
+ value: string;
358
+ label: string;
359
+ }[];
360
+ }
312
361
  interface RampWidgetTemplateProps {
313
362
  theme: string;
314
363
  accentColor: string;
@@ -317,6 +366,8 @@ interface RampWidgetTemplateProps {
317
366
  amount: string;
318
367
  currency: string;
319
368
  country: string;
369
+ requiredFields: RampFieldSpec[];
370
+ fieldValues: Record<string, string>;
320
371
  countries: RampCountry[];
321
372
  countriesLoading: boolean;
322
373
  refreshing: boolean;
@@ -325,23 +376,29 @@ interface RampWidgetTemplateProps {
325
376
  provider: string;
326
377
  txStatus: RampTxStatus | null;
327
378
  kycUrl: string | null;
379
+ tosUrl: string | null;
328
380
  stellarTxHash: string | null;
381
+ /** Stellar Expert URL for `stellarTxHash` (network-aware); null when unknown. */
382
+ explorerUrl: string | null;
383
+ depositInstructions: Record<string, unknown> | null;
329
384
  canComplete: boolean;
330
385
  completing: boolean;
331
386
  errorMsg: string | null;
332
387
  onDirectionChange: (d: RampDirection) => void;
333
388
  onAmountChange: (v: string) => void;
334
- onCurrencyChange: (v: string) => void;
389
+ onFieldChange: (key: string, value: string) => void;
335
390
  onCountryChange: (v: string) => void;
336
391
  onFindRoute: () => void;
337
392
  onSelectQuote: (q: RampQuote) => void;
393
+ onContactContinue: () => void;
338
394
  onOpenKyc: () => void;
395
+ onOpenTos: () => void;
339
396
  onCompleteWithdraw: () => void;
340
397
  onRetry: () => void;
341
398
  onRefresh: () => void;
342
399
  onClose: () => void;
343
400
  }
344
- declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onOpenKyc, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
401
+ declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, tosUrl, stellarTxHash, explorerUrl, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
345
402
 
346
403
  interface TransactionModalTemplateProps {
347
404
  theme: string;
@@ -430,6 +487,7 @@ interface SendModalTemplateProps {
430
487
  isInProgress: boolean;
431
488
  onClose: () => void;
432
489
  onBack: () => void;
490
+ onRefresh: () => void;
433
491
  onSelectAsset: (asset: WalletBalanceRecord) => void;
434
492
  onAmountChange: (value: string) => void;
435
493
  onDestinationChange: (value: string) => void;
@@ -440,7 +498,7 @@ interface SendModalTemplateProps {
440
498
  onRetry: () => void;
441
499
  onDone: () => void;
442
500
  }
443
- 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;
501
+ declare function SendModalTemplate({ theme, accentColor, step, txTitle, assets, selectedAsset, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
444
502
 
445
503
  /** A selectable asset in the sell/buy pickers, normalized across balance/enabled records. */
446
504
  interface SwapAssetOption {
@@ -534,4 +592,4 @@ interface DistributionRulesModalTemplateProps {
534
592
  }
535
593
  declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
536
594
 
537
- 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 };
595
+ export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, 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 };