@oasisprotocol/privana-sdk 0.5.2 → 0.5.4

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.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { A as Address, J as JwtRefreshResponse, H as HostedAuthTokenExchangeResponse, B as Bytes32, S as SiweLoginResponse, P as PrivanaClient, N as NetworkConfig, T as TokenConfig, a as TokenBalance, b as PostDepositLockConfig, D as DepositAddressResponse, c as DepositCheckResponse, d as TransactionSubmissionResponse, e as PostDepositLockError, L as LockInfo, f as PendingDeposit, g as PendingDepositsResponse, W as WithdrawalInfo, h as HistoryEntry, i as TokenInfoResponse } from './pending-lock-BdkuMjmY.cjs';
2
- export { j as BalanceResponse, k as BatchBalancesRequest, l as BatchBalancesResponse, C as CreateOnRampIntentRequest, m as CreateOnRampIntentResponse, n as CreateSignedLockRequestParams, o as DEFAULT_LOCK_DURATION_SECONDS, p as DEFAULT_ONRAMP_LOCK_BUFFER, q as DepositAddressRequest, r as DepositCheckRequest, E as ExpiredLocksResponse, s as HexString, t as HistoryKind, u as HistoryRequest, v as HistoryResponse, w as HostedAuthAuthorizeUrlRequest, x as HostedAuthResponseMode, y as HostedAuthTokenExchangeRequest, z as HttpClient, F as HttpClientConfig, I as IntegerLike, G as JwtLogoutRequest, K as JwtLogoutResponse, M as JwtRefreshRequest, O as LockFundsRequest, Q as LockNonceResponse, R as LockedFundsResponse, U as MinDepositAmounts, V as ModifyLockNonceResponse, X as ModifyLockRequest, Y as NETWORK_CONFIG, Z as Network, _ as OnRampPostDepositLockConfig, $ as OnRampRecord, a0 as OnRampStatus, a1 as PendingDepositStatus, a2 as PendingDepositsRequest, a3 as PendingOnRampsResponse, a4 as PendingWithdrawalsResponse, a5 as PostDepositLockFailureReason, a6 as PrivanaClientConfig, a7 as SignOnRampUrlRequest, a8 as SignOnRampUrlResponse, a9 as SiweDomainResponse, aa as SiweLoginRequest, ab as SiweNonceResponse, ac as SubmitPendingLockParams, ad as TokenListResponse, ae as TotalLockedBalanceResponse, af as TransferFundsRequest, ag as TransferLockedFundsRequest, ah as TransferLockedNonceResponse, ai as TransferNonceResponse, aj as UnlockAllExpiredRequest, ak as UnlockFundsRequest, al as UpdateOnRampRequest, am as UpdateOnRampResponse, an as WithdrawFromLockRequest, ao as WithdrawalInfoResponse, ap as WithdrawalNonceResponse, aq as WithdrawalRequest, ar as applyLockBuffer, as as clampLockAmount, at as clearPendingLock, au as createSignedLockRequest, av as getAccountingContract, aw as getApiUrl, ax as getChainId, ay as isSignedLockUsable, az as loadPendingLock, aA as normalizeAddress, aB as normalizeHex, aC as savePendingLock, aD as submitPendingLock } from './pending-lock-BdkuMjmY.cjs';
1
+ import { A as Address, J as JwtRefreshResponse, H as HostedAuthTokenExchangeResponse, B as Bytes32, a as HexString, P as PrivanaClient, N as NetworkConfig, T as TokenConfig, b as TokenBalance, c as PostDepositLockConfig, D as DepositAddressResponse, d as DepositCheckResponse, e as TransactionSubmissionResponse, f as PostDepositLockError, L as LockInfo, g as PendingDeposit, h as PendingDepositsResponse, W as WithdrawalInfo, i as HistoryEntry, j as TokenInfoResponse } from './pending-lock-DSEqUHOw.cjs';
2
+ export { k as BalanceResponse, l as BatchBalancesRequest, m as BatchBalancesResponse, C as CreateOnRampIntentRequest, n as CreateOnRampIntentResponse, o as CreateSignedLockRequestParams, p as DEFAULT_LOCK_DURATION_SECONDS, q as DEFAULT_ONRAMP_LOCK_BUFFER, r as DepositAddressRequest, s as DepositCheckRequest, E as ExpiredLocksResponse, t as HistoryKind, u as HistoryRequest, v as HistoryResponse, w as HostedAuthAuthorizeUrlRequest, x as HostedAuthResponseMode, y as HostedAuthTokenExchangeRequest, z as HttpClient, F as HttpClientConfig, I as IntegerLike, G as JwtLogoutRequest, K as JwtLogoutResponse, M as JwtRefreshRequest, O as LockFundsRequest, Q as LockNonceResponse, R as LockedFundsResponse, S as MinDepositAmounts, U as ModifyLockNonceResponse, V as ModifyLockRequest, X as NETWORK_CONFIG, Y as Network, Z as OnRampPostDepositLockConfig, _ as OnRampRecord, $ as OnRampStatus, a0 as PendingDepositStatus, a1 as PendingDepositsRequest, a2 as PendingOnRampsResponse, a3 as PendingWithdrawalsResponse, a4 as PostDepositLockFailureReason, a5 as PrivanaClientConfig, a6 as SignOnRampUrlRequest, a7 as SignOnRampUrlResponse, a8 as SiweDomainResponse, a9 as SiweLoginRequest, aa as SiweLoginResponse, ab as SiweNonceResponse, ac as SubmitPendingLockParams, ad as TokenListResponse, ae as TotalLockedBalanceResponse, af as TransferFundsRequest, ag as TransferLockedFundsRequest, ah as TransferLockedNonceResponse, ai as TransferNonceResponse, aj as UnlockAllExpiredRequest, ak as UnlockFundsRequest, al as UpdateOnRampRequest, am as UpdateOnRampResponse, an as WithdrawFromLockRequest, ao as WithdrawalInfoResponse, ap as WithdrawalNonceResponse, aq as WithdrawalRequest, ar as applyLockBuffer, as as clampLockAmount, at as clearPendingLock, au as createSignedLockRequest, av as getAccountingContract, aw as getApiUrl, ax as getChainId, ay as isSignedLockUsable, az as loadPendingLock, aA as normalizeAddress, aB as normalizeHex, aC as requireDepositLockOwner, aD as requireServiceAddress, aE as savePendingLock, aF as submitPendingLock } from './pending-lock-DSEqUHOw.cjs';
3
3
  import { WalletClient, Address as Address$1 } from 'viem';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as React$1 from 'react';
6
- import { ReactNode, ComponentProps, ReactElement } from 'react';
6
+ import { ReactNode } from 'react';
7
7
  import * as class_variance_authority_types from 'class-variance-authority/types';
8
8
  import { VariantProps } from 'class-variance-authority';
9
9
 
@@ -312,10 +312,18 @@ interface SignWithdrawFromLockParams {
312
312
  }
313
313
  declare function signWithdrawFromLockMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawFromLockParams): Promise<`0x${string}`>;
314
314
 
315
- type SiweAuthSession = {
315
+ /** Session published to consumers. */
316
+ interface SiweAuthSession {
316
317
  address: Address;
317
- };
318
- type SiweAuthTokens = Pick<SiweLoginResponse, 'siwe_token' | 'jwt_access_token' | 'jwt_refresh_token' | 'address'>;
318
+ }
319
+ /** Raw tokens exposed so apps with own backend can forward them. */
320
+ interface SiweAuthTokens {
321
+ siwe_token: HexString;
322
+ jwt_access_token: string;
323
+ jwt_refresh_token: string;
324
+ address: Address;
325
+ }
326
+
319
327
  interface SiweAuthContextValue {
320
328
  isAuthenticated: boolean;
321
329
  isLoading: boolean;
@@ -328,14 +336,16 @@ interface SiweAuthContextValue {
328
336
  }
329
337
  type SiweAuthConfig = boolean | {
330
338
  autoLogin?: boolean;
339
+ persistJwt?: boolean;
331
340
  };
332
341
  interface SiweAuthProviderProps {
333
342
  children: ReactNode;
334
343
  client: PrivanaClient;
335
344
  networkConfig: NetworkConfig;
336
345
  autoLogin?: boolean;
346
+ persistJwt?: boolean;
337
347
  }
338
- declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
348
+ declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, persistJwt, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
339
349
  declare function useSiweAuth(): SiweAuthContextValue;
340
350
 
341
351
  type TokensStatus = 'loading' | 'ready' | 'error';
@@ -464,9 +474,9 @@ interface UseDepositOptions {
464
474
  onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
465
475
  /**
466
476
  * Fired when the deposit credited but the pre-signed lock could not be
467
- * submitted (expired, short credit, stale nonce). The funds sit in the
468
- * user's available balance re-prompt a fresh lock signature at the
469
- * credited amount. Falls back to `onError` when not provided.
477
+ * submitted. The funds sit in the user's available balance. Fresh signing
478
+ * is safe only for failures known to precede any API attempt; otherwise
479
+ * retry or reconcile the same signature. Falls back to `onError`.
470
480
  */
471
481
  onLockFailed?: (error: PostDepositLockError) => void;
472
482
  /** Called when deposit check polling times out - deposit may still be processing */
@@ -520,6 +530,7 @@ interface UseDepositAddressOptions {
520
530
  enabled?: boolean;
521
531
  }
522
532
  interface UseDepositAddressResult {
533
+ response?: DepositAddressResponse;
523
534
  depositAddress: string | null;
524
535
  isReady: boolean;
525
536
  isLoading: boolean;
@@ -547,7 +558,7 @@ interface VerificationContext {
547
558
  }
548
559
  interface UseDepositVerificationOptions {
549
560
  /** Fired when the deposit is credited inside the Privana accounting module. */
550
- onCredited?: (txHash: string, response: DepositCheckResponse) => void;
561
+ onCredited?: (txHash: string, response: DepositCheckResponse, creditedAmount: bigint) => void;
551
562
  /** Fired when polling exceeds `pollTimeout` (the deposit may still be processing). */
552
563
  onCheckTimeout?: (txHash: string) => void;
553
564
  onError?: (error: Error) => void;
@@ -576,6 +587,8 @@ interface UseDepositVerificationResult {
576
587
  * without re-sending the transfer.
577
588
  */
578
589
  verificationFailed: boolean;
590
+ /** True only when this transfer was definitively rejected and another candidate is safe to try. */
591
+ canCheckAnotherTransfer: boolean;
579
592
  error: Error | null;
580
593
  /** Current transfer hash being verified, if any. */
581
594
  txHash: `0x${string}` | undefined;
@@ -830,46 +843,6 @@ interface UseModifyLockResult {
830
843
  }
831
844
  declare function useModifyLock(options?: UseModifyLockOptions): UseModifyLockResult;
832
845
 
833
- declare const buttonVariants: (props?: ({
834
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
835
- size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
836
- } & class_variance_authority_types.ClassProp) | undefined) => string;
837
- declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
838
- asChild?: boolean;
839
- }): react_jsx_runtime.JSX.Element;
840
-
841
- type ButtonVariantProps = VariantProps<typeof buttonVariants>;
842
- interface PrivanaButtonProps extends Omit<ComponentProps<'button'>, 'children'> {
843
- children?: ReactNode;
844
- variant?: ButtonVariantProps['variant'];
845
- size?: ButtonVariantProps['size'];
846
- asChild?: boolean;
847
- renderButton?: (props: {
848
- onClick: () => void;
849
- isOpen: boolean;
850
- }) => ReactElement;
851
- hideWhenDisconnected?: boolean;
852
- showLockedFunds?: boolean;
853
- defaultTab?: 'deposit' | 'withdraw';
854
- onDepositSuccess?: () => void;
855
- }
856
- declare function PrivanaButton({ children, className, variant, size, asChild, renderButton, hideWhenDisconnected, showLockedFunds, defaultTab, onDepositSuccess, ...buttonProps }: PrivanaButtonProps): react_jsx_runtime.JSX.Element | null;
857
-
858
- interface PrivanaModalProps {
859
- open: boolean;
860
- onClose: () => void;
861
- showLockedFunds?: boolean;
862
- defaultTab?: 'deposit' | 'withdraw';
863
- onDepositSuccess?: () => void;
864
- }
865
- declare function PrivanaModal({ open, onClose, showLockedFunds, defaultTab, onDepositSuccess, }: PrivanaModalProps): react_jsx_runtime.JSX.Element;
866
- declare function PrivanaInlineModal({ className, showLockedFunds, defaultTab, onDepositSuccess, }: {
867
- className?: string;
868
- showLockedFunds?: boolean;
869
- defaultTab?: 'deposit' | 'withdraw';
870
- onDepositSuccess?: () => void;
871
- }): react_jsx_runtime.JSX.Element;
872
-
873
846
  type DepositMethodTab = 'crypto' | 'credit-card';
874
847
  type DepositSource = 'connected' | 'external' | 'credit-card';
875
848
  interface DepositMethodHandlers {
@@ -935,6 +908,14 @@ interface WalletInlineModalProps extends WalletModalHandlers {
935
908
  }
936
909
  declare function WalletInlineModal({ className, ...handlers }: WalletInlineModalProps): react_jsx_runtime.JSX.Element;
937
910
 
911
+ declare const buttonVariants: (props?: ({
912
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
913
+ size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
914
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
915
+ declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
916
+ asChild?: boolean;
917
+ }): react_jsx_runtime.JSX.Element;
918
+
938
919
  declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
939
920
 
940
921
  declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
@@ -946,4 +927,4 @@ interface PrivanaIconProps {
946
927
  }
947
928
  declare function PrivanaIcon({ className, size }: PrivanaIconProps): react_jsx_runtime.JSX.Element;
948
929
 
949
- export { AccountingApiError, Address, type Allowance, type AllowanceTerm, Button, Bytes32, type ChainConfig, DepositAddressResponse, DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, type EIP712Domain, HOSTED_AUTH_CLOCK_SKEW_MS, HistoryEntry, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthSession, HostedAuthStateMismatchError, HostedAuthTokenExchangeResponse, JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, LockInfo, type LockMessage, MODIFY_LOCK_TYPES, type ModifyLockMessage, type ModifyLockParams, NetworkConfig, NetworkError, PendingDeposit, PendingDepositsResponse, PostDepositLockConfig, PostDepositLockError, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaContextValue, PrivanaIcon, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, SiweLoginResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, TokenBalance, TokenConfig, TokenInfoResponse, type TokensStatus, TransactionSubmissionResponse, type TransferLockedMessage, type TransferLockedParams, type TransferMessage, type TransferParams, type UnlockFundsParams, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositAddressOptions, type UseDepositAddressResult, type UseDepositOptions, type UseDepositResult, type UseDepositVerificationOptions, type UseDepositVerificationResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, type UsePendingDepositsOptions, type UsePendingDepositsResult, type UsePendingWithdrawalsOptions, type UsePendingWithdrawalsResult, type UseTokenInfoOptions, type UseTokenInfoResult, type UseTokenListOptions, type UseTokenListResult, type UseTotalLockedBalanceOptions, type UseTotalLockedBalanceResult, type UseTransferOptions, type UseTransferResult, type UseUnlockFundsOptions, type UseUnlockFundsResult, type UseWithdrawOptions, type UseWithdrawResult, ValidationError, type VerificationContext, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, WalletInlineModal, type WalletInlineModalProps, WalletModal, type WalletModalHandlers, type WalletModalProps, type WalletSession, type WithdrawFromLockMessage, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, WithdrawalInfo, applyRefreshResponse, buildHostedAuthSession, buildSiweStatement, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getExplorerLabel, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositAddress, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingDeposits, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
930
+ export { AccountingApiError, Address, type Allowance, type AllowanceTerm, Button, Bytes32, type ChainConfig, DepositAddressResponse, DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, type EIP712Domain, HOSTED_AUTH_CLOCK_SKEW_MS, HexString, HistoryEntry, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthSession, HostedAuthStateMismatchError, HostedAuthTokenExchangeResponse, JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, LockInfo, type LockMessage, MODIFY_LOCK_TYPES, type ModifyLockMessage, type ModifyLockParams, NetworkConfig, NetworkError, PendingDeposit, PendingDepositsResponse, PostDepositLockConfig, PostDepositLockError, PrivanaClient, type PrivanaContextValue, PrivanaIcon, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, TokenBalance, TokenConfig, TokenInfoResponse, type TokensStatus, TransactionSubmissionResponse, type TransferLockedMessage, type TransferLockedParams, type TransferMessage, type TransferParams, type UnlockFundsParams, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositAddressOptions, type UseDepositAddressResult, type UseDepositOptions, type UseDepositResult, type UseDepositVerificationOptions, type UseDepositVerificationResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, type UsePendingDepositsOptions, type UsePendingDepositsResult, type UsePendingWithdrawalsOptions, type UsePendingWithdrawalsResult, type UseTokenInfoOptions, type UseTokenInfoResult, type UseTokenListOptions, type UseTokenListResult, type UseTotalLockedBalanceOptions, type UseTotalLockedBalanceResult, type UseTransferOptions, type UseTransferResult, type UseUnlockFundsOptions, type UseUnlockFundsResult, type UseWithdrawOptions, type UseWithdrawResult, ValidationError, type VerificationContext, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, WalletInlineModal, type WalletInlineModalProps, WalletModal, type WalletModalHandlers, type WalletModalProps, type WalletSession, type WithdrawFromLockMessage, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, WithdrawalInfo, applyRefreshResponse, buildHostedAuthSession, buildSiweStatement, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getExplorerLabel, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositAddress, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingDeposits, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { A as Address, J as JwtRefreshResponse, H as HostedAuthTokenExchangeResponse, B as Bytes32, S as SiweLoginResponse, P as PrivanaClient, N as NetworkConfig, T as TokenConfig, a as TokenBalance, b as PostDepositLockConfig, D as DepositAddressResponse, c as DepositCheckResponse, d as TransactionSubmissionResponse, e as PostDepositLockError, L as LockInfo, f as PendingDeposit, g as PendingDepositsResponse, W as WithdrawalInfo, h as HistoryEntry, i as TokenInfoResponse } from './pending-lock-BdkuMjmY.js';
2
- export { j as BalanceResponse, k as BatchBalancesRequest, l as BatchBalancesResponse, C as CreateOnRampIntentRequest, m as CreateOnRampIntentResponse, n as CreateSignedLockRequestParams, o as DEFAULT_LOCK_DURATION_SECONDS, p as DEFAULT_ONRAMP_LOCK_BUFFER, q as DepositAddressRequest, r as DepositCheckRequest, E as ExpiredLocksResponse, s as HexString, t as HistoryKind, u as HistoryRequest, v as HistoryResponse, w as HostedAuthAuthorizeUrlRequest, x as HostedAuthResponseMode, y as HostedAuthTokenExchangeRequest, z as HttpClient, F as HttpClientConfig, I as IntegerLike, G as JwtLogoutRequest, K as JwtLogoutResponse, M as JwtRefreshRequest, O as LockFundsRequest, Q as LockNonceResponse, R as LockedFundsResponse, U as MinDepositAmounts, V as ModifyLockNonceResponse, X as ModifyLockRequest, Y as NETWORK_CONFIG, Z as Network, _ as OnRampPostDepositLockConfig, $ as OnRampRecord, a0 as OnRampStatus, a1 as PendingDepositStatus, a2 as PendingDepositsRequest, a3 as PendingOnRampsResponse, a4 as PendingWithdrawalsResponse, a5 as PostDepositLockFailureReason, a6 as PrivanaClientConfig, a7 as SignOnRampUrlRequest, a8 as SignOnRampUrlResponse, a9 as SiweDomainResponse, aa as SiweLoginRequest, ab as SiweNonceResponse, ac as SubmitPendingLockParams, ad as TokenListResponse, ae as TotalLockedBalanceResponse, af as TransferFundsRequest, ag as TransferLockedFundsRequest, ah as TransferLockedNonceResponse, ai as TransferNonceResponse, aj as UnlockAllExpiredRequest, ak as UnlockFundsRequest, al as UpdateOnRampRequest, am as UpdateOnRampResponse, an as WithdrawFromLockRequest, ao as WithdrawalInfoResponse, ap as WithdrawalNonceResponse, aq as WithdrawalRequest, ar as applyLockBuffer, as as clampLockAmount, at as clearPendingLock, au as createSignedLockRequest, av as getAccountingContract, aw as getApiUrl, ax as getChainId, ay as isSignedLockUsable, az as loadPendingLock, aA as normalizeAddress, aB as normalizeHex, aC as savePendingLock, aD as submitPendingLock } from './pending-lock-BdkuMjmY.js';
1
+ import { A as Address, J as JwtRefreshResponse, H as HostedAuthTokenExchangeResponse, B as Bytes32, a as HexString, P as PrivanaClient, N as NetworkConfig, T as TokenConfig, b as TokenBalance, c as PostDepositLockConfig, D as DepositAddressResponse, d as DepositCheckResponse, e as TransactionSubmissionResponse, f as PostDepositLockError, L as LockInfo, g as PendingDeposit, h as PendingDepositsResponse, W as WithdrawalInfo, i as HistoryEntry, j as TokenInfoResponse } from './pending-lock-DSEqUHOw.js';
2
+ export { k as BalanceResponse, l as BatchBalancesRequest, m as BatchBalancesResponse, C as CreateOnRampIntentRequest, n as CreateOnRampIntentResponse, o as CreateSignedLockRequestParams, p as DEFAULT_LOCK_DURATION_SECONDS, q as DEFAULT_ONRAMP_LOCK_BUFFER, r as DepositAddressRequest, s as DepositCheckRequest, E as ExpiredLocksResponse, t as HistoryKind, u as HistoryRequest, v as HistoryResponse, w as HostedAuthAuthorizeUrlRequest, x as HostedAuthResponseMode, y as HostedAuthTokenExchangeRequest, z as HttpClient, F as HttpClientConfig, I as IntegerLike, G as JwtLogoutRequest, K as JwtLogoutResponse, M as JwtRefreshRequest, O as LockFundsRequest, Q as LockNonceResponse, R as LockedFundsResponse, S as MinDepositAmounts, U as ModifyLockNonceResponse, V as ModifyLockRequest, X as NETWORK_CONFIG, Y as Network, Z as OnRampPostDepositLockConfig, _ as OnRampRecord, $ as OnRampStatus, a0 as PendingDepositStatus, a1 as PendingDepositsRequest, a2 as PendingOnRampsResponse, a3 as PendingWithdrawalsResponse, a4 as PostDepositLockFailureReason, a5 as PrivanaClientConfig, a6 as SignOnRampUrlRequest, a7 as SignOnRampUrlResponse, a8 as SiweDomainResponse, a9 as SiweLoginRequest, aa as SiweLoginResponse, ab as SiweNonceResponse, ac as SubmitPendingLockParams, ad as TokenListResponse, ae as TotalLockedBalanceResponse, af as TransferFundsRequest, ag as TransferLockedFundsRequest, ah as TransferLockedNonceResponse, ai as TransferNonceResponse, aj as UnlockAllExpiredRequest, ak as UnlockFundsRequest, al as UpdateOnRampRequest, am as UpdateOnRampResponse, an as WithdrawFromLockRequest, ao as WithdrawalInfoResponse, ap as WithdrawalNonceResponse, aq as WithdrawalRequest, ar as applyLockBuffer, as as clampLockAmount, at as clearPendingLock, au as createSignedLockRequest, av as getAccountingContract, aw as getApiUrl, ax as getChainId, ay as isSignedLockUsable, az as loadPendingLock, aA as normalizeAddress, aB as normalizeHex, aC as requireDepositLockOwner, aD as requireServiceAddress, aE as savePendingLock, aF as submitPendingLock } from './pending-lock-DSEqUHOw.js';
3
3
  import { WalletClient, Address as Address$1 } from 'viem';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as React$1 from 'react';
6
- import { ReactNode, ComponentProps, ReactElement } from 'react';
6
+ import { ReactNode } from 'react';
7
7
  import * as class_variance_authority_types from 'class-variance-authority/types';
8
8
  import { VariantProps } from 'class-variance-authority';
9
9
 
@@ -312,10 +312,18 @@ interface SignWithdrawFromLockParams {
312
312
  }
313
313
  declare function signWithdrawFromLockMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawFromLockParams): Promise<`0x${string}`>;
314
314
 
315
- type SiweAuthSession = {
315
+ /** Session published to consumers. */
316
+ interface SiweAuthSession {
316
317
  address: Address;
317
- };
318
- type SiweAuthTokens = Pick<SiweLoginResponse, 'siwe_token' | 'jwt_access_token' | 'jwt_refresh_token' | 'address'>;
318
+ }
319
+ /** Raw tokens exposed so apps with own backend can forward them. */
320
+ interface SiweAuthTokens {
321
+ siwe_token: HexString;
322
+ jwt_access_token: string;
323
+ jwt_refresh_token: string;
324
+ address: Address;
325
+ }
326
+
319
327
  interface SiweAuthContextValue {
320
328
  isAuthenticated: boolean;
321
329
  isLoading: boolean;
@@ -328,14 +336,16 @@ interface SiweAuthContextValue {
328
336
  }
329
337
  type SiweAuthConfig = boolean | {
330
338
  autoLogin?: boolean;
339
+ persistJwt?: boolean;
331
340
  };
332
341
  interface SiweAuthProviderProps {
333
342
  children: ReactNode;
334
343
  client: PrivanaClient;
335
344
  networkConfig: NetworkConfig;
336
345
  autoLogin?: boolean;
346
+ persistJwt?: boolean;
337
347
  }
338
- declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
348
+ declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, persistJwt, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
339
349
  declare function useSiweAuth(): SiweAuthContextValue;
340
350
 
341
351
  type TokensStatus = 'loading' | 'ready' | 'error';
@@ -464,9 +474,9 @@ interface UseDepositOptions {
464
474
  onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
465
475
  /**
466
476
  * Fired when the deposit credited but the pre-signed lock could not be
467
- * submitted (expired, short credit, stale nonce). The funds sit in the
468
- * user's available balance re-prompt a fresh lock signature at the
469
- * credited amount. Falls back to `onError` when not provided.
477
+ * submitted. The funds sit in the user's available balance. Fresh signing
478
+ * is safe only for failures known to precede any API attempt; otherwise
479
+ * retry or reconcile the same signature. Falls back to `onError`.
470
480
  */
471
481
  onLockFailed?: (error: PostDepositLockError) => void;
472
482
  /** Called when deposit check polling times out - deposit may still be processing */
@@ -520,6 +530,7 @@ interface UseDepositAddressOptions {
520
530
  enabled?: boolean;
521
531
  }
522
532
  interface UseDepositAddressResult {
533
+ response?: DepositAddressResponse;
523
534
  depositAddress: string | null;
524
535
  isReady: boolean;
525
536
  isLoading: boolean;
@@ -547,7 +558,7 @@ interface VerificationContext {
547
558
  }
548
559
  interface UseDepositVerificationOptions {
549
560
  /** Fired when the deposit is credited inside the Privana accounting module. */
550
- onCredited?: (txHash: string, response: DepositCheckResponse) => void;
561
+ onCredited?: (txHash: string, response: DepositCheckResponse, creditedAmount: bigint) => void;
551
562
  /** Fired when polling exceeds `pollTimeout` (the deposit may still be processing). */
552
563
  onCheckTimeout?: (txHash: string) => void;
553
564
  onError?: (error: Error) => void;
@@ -576,6 +587,8 @@ interface UseDepositVerificationResult {
576
587
  * without re-sending the transfer.
577
588
  */
578
589
  verificationFailed: boolean;
590
+ /** True only when this transfer was definitively rejected and another candidate is safe to try. */
591
+ canCheckAnotherTransfer: boolean;
579
592
  error: Error | null;
580
593
  /** Current transfer hash being verified, if any. */
581
594
  txHash: `0x${string}` | undefined;
@@ -830,46 +843,6 @@ interface UseModifyLockResult {
830
843
  }
831
844
  declare function useModifyLock(options?: UseModifyLockOptions): UseModifyLockResult;
832
845
 
833
- declare const buttonVariants: (props?: ({
834
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
835
- size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
836
- } & class_variance_authority_types.ClassProp) | undefined) => string;
837
- declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
838
- asChild?: boolean;
839
- }): react_jsx_runtime.JSX.Element;
840
-
841
- type ButtonVariantProps = VariantProps<typeof buttonVariants>;
842
- interface PrivanaButtonProps extends Omit<ComponentProps<'button'>, 'children'> {
843
- children?: ReactNode;
844
- variant?: ButtonVariantProps['variant'];
845
- size?: ButtonVariantProps['size'];
846
- asChild?: boolean;
847
- renderButton?: (props: {
848
- onClick: () => void;
849
- isOpen: boolean;
850
- }) => ReactElement;
851
- hideWhenDisconnected?: boolean;
852
- showLockedFunds?: boolean;
853
- defaultTab?: 'deposit' | 'withdraw';
854
- onDepositSuccess?: () => void;
855
- }
856
- declare function PrivanaButton({ children, className, variant, size, asChild, renderButton, hideWhenDisconnected, showLockedFunds, defaultTab, onDepositSuccess, ...buttonProps }: PrivanaButtonProps): react_jsx_runtime.JSX.Element | null;
857
-
858
- interface PrivanaModalProps {
859
- open: boolean;
860
- onClose: () => void;
861
- showLockedFunds?: boolean;
862
- defaultTab?: 'deposit' | 'withdraw';
863
- onDepositSuccess?: () => void;
864
- }
865
- declare function PrivanaModal({ open, onClose, showLockedFunds, defaultTab, onDepositSuccess, }: PrivanaModalProps): react_jsx_runtime.JSX.Element;
866
- declare function PrivanaInlineModal({ className, showLockedFunds, defaultTab, onDepositSuccess, }: {
867
- className?: string;
868
- showLockedFunds?: boolean;
869
- defaultTab?: 'deposit' | 'withdraw';
870
- onDepositSuccess?: () => void;
871
- }): react_jsx_runtime.JSX.Element;
872
-
873
846
  type DepositMethodTab = 'crypto' | 'credit-card';
874
847
  type DepositSource = 'connected' | 'external' | 'credit-card';
875
848
  interface DepositMethodHandlers {
@@ -935,6 +908,14 @@ interface WalletInlineModalProps extends WalletModalHandlers {
935
908
  }
936
909
  declare function WalletInlineModal({ className, ...handlers }: WalletInlineModalProps): react_jsx_runtime.JSX.Element;
937
910
 
911
+ declare const buttonVariants: (props?: ({
912
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
913
+ size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
914
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
915
+ declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
916
+ asChild?: boolean;
917
+ }): react_jsx_runtime.JSX.Element;
918
+
938
919
  declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
939
920
 
940
921
  declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
@@ -946,4 +927,4 @@ interface PrivanaIconProps {
946
927
  }
947
928
  declare function PrivanaIcon({ className, size }: PrivanaIconProps): react_jsx_runtime.JSX.Element;
948
929
 
949
- export { AccountingApiError, Address, type Allowance, type AllowanceTerm, Button, Bytes32, type ChainConfig, DepositAddressResponse, DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, type EIP712Domain, HOSTED_AUTH_CLOCK_SKEW_MS, HistoryEntry, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthSession, HostedAuthStateMismatchError, HostedAuthTokenExchangeResponse, JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, LockInfo, type LockMessage, MODIFY_LOCK_TYPES, type ModifyLockMessage, type ModifyLockParams, NetworkConfig, NetworkError, PendingDeposit, PendingDepositsResponse, PostDepositLockConfig, PostDepositLockError, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaContextValue, PrivanaIcon, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, SiweLoginResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, TokenBalance, TokenConfig, TokenInfoResponse, type TokensStatus, TransactionSubmissionResponse, type TransferLockedMessage, type TransferLockedParams, type TransferMessage, type TransferParams, type UnlockFundsParams, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositAddressOptions, type UseDepositAddressResult, type UseDepositOptions, type UseDepositResult, type UseDepositVerificationOptions, type UseDepositVerificationResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, type UsePendingDepositsOptions, type UsePendingDepositsResult, type UsePendingWithdrawalsOptions, type UsePendingWithdrawalsResult, type UseTokenInfoOptions, type UseTokenInfoResult, type UseTokenListOptions, type UseTokenListResult, type UseTotalLockedBalanceOptions, type UseTotalLockedBalanceResult, type UseTransferOptions, type UseTransferResult, type UseUnlockFundsOptions, type UseUnlockFundsResult, type UseWithdrawOptions, type UseWithdrawResult, ValidationError, type VerificationContext, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, WalletInlineModal, type WalletInlineModalProps, WalletModal, type WalletModalHandlers, type WalletModalProps, type WalletSession, type WithdrawFromLockMessage, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, WithdrawalInfo, applyRefreshResponse, buildHostedAuthSession, buildSiweStatement, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getExplorerLabel, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositAddress, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingDeposits, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
930
+ export { AccountingApiError, Address, type Allowance, type AllowanceTerm, Button, Bytes32, type ChainConfig, DepositAddressResponse, DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, type EIP712Domain, HOSTED_AUTH_CLOCK_SKEW_MS, HexString, HistoryEntry, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthSession, HostedAuthStateMismatchError, HostedAuthTokenExchangeResponse, JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, LockInfo, type LockMessage, MODIFY_LOCK_TYPES, type ModifyLockMessage, type ModifyLockParams, NetworkConfig, NetworkError, PendingDeposit, PendingDepositsResponse, PostDepositLockConfig, PostDepositLockError, PrivanaClient, type PrivanaContextValue, PrivanaIcon, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, TokenBalance, TokenConfig, TokenInfoResponse, type TokensStatus, TransactionSubmissionResponse, type TransferLockedMessage, type TransferLockedParams, type TransferMessage, type TransferParams, type UnlockFundsParams, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositAddressOptions, type UseDepositAddressResult, type UseDepositOptions, type UseDepositResult, type UseDepositVerificationOptions, type UseDepositVerificationResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, type UsePendingDepositsOptions, type UsePendingDepositsResult, type UsePendingWithdrawalsOptions, type UsePendingWithdrawalsResult, type UseTokenInfoOptions, type UseTokenInfoResult, type UseTokenListOptions, type UseTokenListResult, type UseTotalLockedBalanceOptions, type UseTotalLockedBalanceResult, type UseTransferOptions, type UseTransferResult, type UseUnlockFundsOptions, type UseUnlockFundsResult, type UseWithdrawOptions, type UseWithdrawResult, ValidationError, type VerificationContext, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, WalletInlineModal, type WalletInlineModalProps, WalletModal, type WalletModalHandlers, type WalletModalProps, type WalletSession, type WithdrawFromLockMessage, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, WithdrawalInfo, applyRefreshResponse, buildHostedAuthSession, buildSiweStatement, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getExplorerLabel, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositAddress, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingDeposits, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };