@oasisprotocol/privana-sdk 0.2.1 → 0.4.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/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import { A as Address, B as Bytes32, H as HexString, I as IntegerLike, a as HostedAuthResponseMode, S as SignOnRampUrlRequest, b as SignOnRampUrlResponse, C as CreateOnRampIntentRequest, c as CreateOnRampIntentResponse, U as UpdateOnRampRequest, d as UpdateOnRampResponse, P as PendingOnRampsResponse, N as NetworkConfig, T as TokenConfig } from './on-ramp-DIAOtdeU.cjs';
2
+ export { e as NETWORK_CONFIG, f as Network, O as OnRampRecord, g as OnRampStatus, h as getAccountingContract, i as getApiUrl, j as getChainId, n as normalizeAddress, k as normalizeHex } from './on-ramp-DIAOtdeU.cjs';
1
3
  import { WalletClient, Address as Address$1 } from 'viem';
2
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
5
  import * as React$1 from 'react';
@@ -5,56 +7,6 @@ import { ReactNode, ComponentProps, ReactElement } from 'react';
5
7
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
8
  import { VariantProps } from 'class-variance-authority';
7
9
 
8
- var networks = {
9
- testnet: {
10
- chainId: 23295,
11
- name: "Sapphire Testnet",
12
- accountingContract: "0xaF8e5de153A584528B57DD4B9B0195956BBDF571",
13
- apiUrl: "https://testnet.privana.finance"
14
- },
15
- mainnet: {
16
- chainId: 23294,
17
- name: "Sapphire Mainnet",
18
- accountingContract: "0x0000000000000000000000000000000000000000",
19
- apiUrl: ""
20
- }
21
- };
22
- var config = {
23
- networks: networks
24
- };
25
-
26
- type Address = `0x${string}`;
27
- type Bytes32 = `0x${string}`;
28
- type HexString = `0x${string}`;
29
- type IntegerLike = string | number;
30
- type HostedAuthResponseMode = 'web_message' | 'redirect';
31
- type Network = keyof typeof config.networks;
32
- interface NetworkConfig {
33
- chainId: number;
34
- name: string;
35
- accountingContract: Address;
36
- apiUrl: string;
37
- }
38
- declare const NETWORK_CONFIG: {
39
- readonly testnet: {
40
- readonly accountingContract: Address;
41
- readonly chainId: number;
42
- readonly name: string;
43
- readonly apiUrl: string;
44
- };
45
- readonly mainnet: {
46
- readonly accountingContract: Address;
47
- readonly chainId: number;
48
- readonly name: string;
49
- readonly apiUrl: string;
50
- };
51
- };
52
- declare function getChainId(network: Network): number;
53
- declare function getAccountingContract(network: Network): Address;
54
- declare function getApiUrl(network: Network): string;
55
- declare function normalizeHex(value: string): HexString;
56
- declare function normalizeAddress(value: string): Address;
57
-
58
10
  interface HostedAuthConfig {
59
11
  clientId: string;
60
12
  redirectUri: string;
@@ -85,15 +37,6 @@ interface HostedAuthCallbackError {
85
37
  }
86
38
  type HostedAuthCallback = HostedAuthCallbackSuccess | HostedAuthCallbackError;
87
39
 
88
- interface TokenConfig {
89
- id: Bytes32;
90
- symbol: string;
91
- decimals: number;
92
- contract: Address;
93
- name: string;
94
- chainId: number;
95
- }
96
-
97
40
  interface ChainConfig {
98
41
  id: number;
99
42
  name: string;
@@ -438,6 +381,10 @@ declare class PrivanaClient {
438
381
  exchangeHostedAuthCode(request: HostedAuthTokenExchangeRequest): Promise<HostedAuthTokenExchangeResponse>;
439
382
  refreshJwtSession(request: JwtRefreshRequest): Promise<JwtRefreshResponse>;
440
383
  logoutJwtSession(request?: JwtLogoutRequest): Promise<JwtLogoutResponse>;
384
+ signOnRampUrl(request: SignOnRampUrlRequest): Promise<SignOnRampUrlResponse>;
385
+ createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
386
+ updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
387
+ getPendingOnRamps(): Promise<PendingOnRampsResponse>;
441
388
  setPrivateReadToken(token: string): void;
442
389
  getPrivateReadToken(): string | undefined;
443
390
  clearPrivateReadToken(): void;
@@ -663,6 +610,32 @@ interface SignWithdrawFromLockParams {
663
610
  }
664
611
  declare function signWithdrawFromLockMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawFromLockParams): Promise<`0x${string}`>;
665
612
 
613
+ type SiweAuthSession = {
614
+ address: Address;
615
+ };
616
+ type SiweAuthTokens = Pick<SiweLoginResponse, 'siwe_token' | 'jwt_access_token' | 'jwt_refresh_token' | 'address'>;
617
+ interface SiweAuthContextValue {
618
+ isAuthenticated: boolean;
619
+ isLoading: boolean;
620
+ error: Error | null;
621
+ session: SiweAuthSession | null;
622
+ accessToken: string | undefined;
623
+ tokens: SiweAuthTokens | null;
624
+ login: () => Promise<void>;
625
+ logout: () => Promise<void>;
626
+ }
627
+ interface SiweAuthConfig {
628
+ autoLogin?: boolean;
629
+ statement?: string;
630
+ }
631
+ interface SiweAuthProviderProps extends SiweAuthConfig {
632
+ children: ReactNode;
633
+ client: PrivanaClient;
634
+ networkConfig: NetworkConfig;
635
+ }
636
+ declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, statement, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
637
+ declare function useSiweAuth(): SiweAuthContextValue;
638
+
666
639
  type TokensStatus = 'loading' | 'ready' | 'error';
667
640
  interface PrivanaContextValue {
668
641
  client: PrivanaClient;
@@ -711,8 +684,16 @@ interface PrivanaProviderProps {
711
684
  * Optional hosted redirect auth configuration for cross-domain browser apps.
712
685
  */
713
686
  hostedAuth?: HostedAuthConfig;
687
+ /**
688
+ * Optional direct (in-app) SIWE auth. When provided, the connected wallet
689
+ * signs an EIP-4361 message in-app and `useSiweAuth()` becomes available.
690
+ * Mutually exclusive with `hostedAuth`: providing both throws, because
691
+ * `usePrivateReadRequest()` prefers `hostedAuthConfig` and would otherwise
692
+ * ignore the SIWE login.
693
+ */
694
+ siweAuth?: SiweAuthConfig;
714
695
  }
715
- declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
696
+ declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
716
697
  declare function usePrivanaContext(): PrivanaContextValue;
717
698
  declare function useSafePrivanaContext(): PrivanaContextValue | null;
718
699
 
@@ -806,6 +787,60 @@ interface UseDepositResult {
806
787
  }
807
788
  declare function useDeposit(options?: UseDepositOptions): UseDepositResult;
808
789
 
790
+ interface VerificationContext {
791
+ /** On-chain transfer that funded the user's Privana deposit address. */
792
+ hash: `0x${string}`;
793
+ /** Chain the transfer was mined on. */
794
+ chainId: number;
795
+ /** Transferred amount in base units (matches the deposit's token decimals). */
796
+ amount: bigint;
797
+ }
798
+ interface UseDepositVerificationOptions {
799
+ /** Fired when the deposit is credited inside the Privana accounting module. */
800
+ onCredited?: (txHash: string, response: DepositCheckResponse) => void;
801
+ /** Fired when polling exceeds `pollTimeout` (the deposit may still be processing). */
802
+ onCheckTimeout?: (txHash: string) => void;
803
+ onError?: (error: Error) => void;
804
+ /** Polling interval in ms (default: 5000). */
805
+ pollInterval?: number;
806
+ /** Retry interval in ms while the source-chain tx is waiting finality (default: pollInterval). */
807
+ finalityRetryInterval?: number;
808
+ /** Max time to wait for credit confirmation in ms (default: 180000). */
809
+ pollTimeout?: number;
810
+ }
811
+ interface UseDepositVerificationResult {
812
+ /** True while phase 1 (checkDeposit) or phase 2 (status polling) is in flight. */
813
+ isVerifying: boolean;
814
+ /** True if polling timed out before a terminal status. */
815
+ didTimeout: boolean;
816
+ /**
817
+ * True when the on-chain transfer exists but the API verification step failed.
818
+ * Funds are still at the deposit address; call `retryVerification()` to re-run
819
+ * without re-sending the transfer.
820
+ */
821
+ verificationFailed: boolean;
822
+ error: Error | null;
823
+ /** Current transfer hash being verified, if any. */
824
+ txHash: `0x${string}` | undefined;
825
+ /** Kick off Phase 1 (checkDeposit) + Phase 2 (poll getDepositStatus) for the given context. */
826
+ verify: (ctx: VerificationContext) => Promise<void>;
827
+ /** Re-run verification against the existing context (after a transient API failure). */
828
+ retryVerification: () => Promise<void>;
829
+ /** Discard local tracking (the deposit may still be credited in the background). */
830
+ reset: () => void;
831
+ }
832
+ /**
833
+ * Phase 1 (POST /deposits/check) + Phase 2 (poll /deposits/status) of the
834
+ * Privana deposit flow, decoupled from the wallet-signing half. Use this
835
+ * directly when the on-chain transfer to the deposit address came from
836
+ * somewhere other than the connected wallet — e.g. a fiat on-ramp that
837
+ * delivers straight to the deposit address.
838
+ *
839
+ * For the full deposit flow (get address → wallet transfer → verify) use
840
+ * `useDeposit`, which composes this hook internally.
841
+ */
842
+ declare function useDepositVerification(options?: UseDepositVerificationOptions): UseDepositVerificationResult;
843
+
809
844
  interface UseWithdrawOptions {
810
845
  onSuccess?: (response: TransactionSubmissionResponse) => void;
811
846
  /** Called when withdrawal is submitted to the backend */
@@ -963,9 +998,11 @@ interface UseHistoryResult {
963
998
  }
964
999
  declare function useHistory(options?: UseHistoryOptions): UseHistoryResult;
965
1000
 
1001
+ type AccountStatus = 'connecting' | 'reconnecting' | 'connected' | 'disconnected';
966
1002
  interface SafeAccountResult {
967
1003
  address: Address$1 | undefined;
968
1004
  isConnected: boolean;
1005
+ status: AccountStatus;
969
1006
  }
970
1007
  declare function useSafeAccount(): SafeAccountResult;
971
1008
 
@@ -1057,4 +1094,4 @@ declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>):
1057
1094
  declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
1058
1095
  declare function getChainIcon(chainId: number, size?: number): react_jsx_runtime.JSX.Element;
1059
1096
 
1060
- export { AccountingApiError, type Address, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, type Bytes32, type ChainConfig, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, type DepositParams, type EIP712Domain, type ExpiredLocksResponse, HOSTED_AUTH_CLOCK_SKEW_MS, type HexString, type HistoryEntry, type HistoryKind, type HistoryRequest, type HistoryResponse, type HostedAuthAuthorizeUrlRequest, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthResponseMode, type HostedAuthSession, HostedAuthStateMismatchError, type HostedAuthTokenExchangeRequest, type HostedAuthTokenExchangeResponse, HttpClient, type HttpClientConfig, type IntegerLike, type JwtLogoutRequest, type JwtLogoutResponse, type JwtRefreshRequest, type JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, type LockFundsRequest, type LockInfo, type LockMessage, type LockNonceResponse, type LockedFundsResponse, MODIFY_LOCK_TYPES, type MinDepositAmounts, type ModifyLockMessage, type ModifyLockNonceResponse, type ModifyLockParams, type ModifyLockRequest, NETWORK_CONFIG, type Network, type NetworkConfig, NetworkError, type PendingWithdrawalsResponse, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaClientConfig, type PrivanaContextValue, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweDomainResponse, type SiweLoginRequest, type SiweLoginResponse, type SiweNonceResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, type TokenBalance, type TokenConfig, type TokenInfoResponse, type TokenListResponse, type TokensStatus, type TotalLockedBalanceResponse, type TransactionSubmissionResponse, type TransferFundsRequest, type TransferLockedFundsRequest, type TransferLockedMessage, type TransferLockedNonceResponse, type TransferLockedParams, type TransferMessage, type TransferNonceResponse, type TransferParams, type UnlockAllExpiredRequest, type UnlockFundsParams, type UnlockFundsRequest, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositOptions, type UseDepositResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, 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, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, type WithdrawFromLockMessage, type WithdrawFromLockRequest, type WithdrawMessage, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, applyRefreshResponse, buildHostedAuthSession, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getAccountingContract, getApiUrl, getChainById, getChainIcon, getChainId, getExplorerAddressUrl, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, normalizeAddress, normalizeHex, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
1097
+ export { AccountingApiError, Address, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, Bytes32, type ChainConfig, CreateOnRampIntentRequest, CreateOnRampIntentResponse, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, type DepositParams, type EIP712Domain, type ExpiredLocksResponse, HOSTED_AUTH_CLOCK_SKEW_MS, HexString, type HistoryEntry, type HistoryKind, type HistoryRequest, type HistoryResponse, type HostedAuthAuthorizeUrlRequest, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, HostedAuthResponseMode, type HostedAuthSession, HostedAuthStateMismatchError, type HostedAuthTokenExchangeRequest, type HostedAuthTokenExchangeResponse, HttpClient, type HttpClientConfig, IntegerLike, type JwtLogoutRequest, type JwtLogoutResponse, type JwtRefreshRequest, type JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, type LockFundsRequest, type LockInfo, type LockMessage, type LockNonceResponse, type LockedFundsResponse, MODIFY_LOCK_TYPES, type MinDepositAmounts, type ModifyLockMessage, type ModifyLockNonceResponse, type ModifyLockParams, type ModifyLockRequest, NetworkConfig, NetworkError, PendingOnRampsResponse, type PendingWithdrawalsResponse, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaClientConfig, type PrivanaContextValue, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, SignOnRampUrlRequest, SignOnRampUrlResponse, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, type SiweDomainResponse, type SiweLoginRequest, type SiweLoginResponse, type SiweNonceResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, type TokenBalance, TokenConfig, type TokenInfoResponse, type TokenListResponse, type TokensStatus, type TotalLockedBalanceResponse, type TransactionSubmissionResponse, type TransferFundsRequest, type TransferLockedFundsRequest, type TransferLockedMessage, type TransferLockedNonceResponse, type TransferLockedParams, type TransferMessage, type TransferNonceResponse, type TransferParams, type UnlockAllExpiredRequest, type UnlockFundsParams, type UnlockFundsRequest, UpdateOnRampRequest, UpdateOnRampResponse, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, 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 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, type WithdrawFromLockMessage, type WithdrawFromLockRequest, type WithdrawMessage, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, applyRefreshResponse, buildHostedAuthSession, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { A as Address, B as Bytes32, H as HexString, I as IntegerLike, a as HostedAuthResponseMode, S as SignOnRampUrlRequest, b as SignOnRampUrlResponse, C as CreateOnRampIntentRequest, c as CreateOnRampIntentResponse, U as UpdateOnRampRequest, d as UpdateOnRampResponse, P as PendingOnRampsResponse, N as NetworkConfig, T as TokenConfig } from './on-ramp-DIAOtdeU.js';
2
+ export { e as NETWORK_CONFIG, f as Network, O as OnRampRecord, g as OnRampStatus, h as getAccountingContract, i as getApiUrl, j as getChainId, n as normalizeAddress, k as normalizeHex } from './on-ramp-DIAOtdeU.js';
1
3
  import { WalletClient, Address as Address$1 } from 'viem';
2
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
5
  import * as React$1 from 'react';
@@ -5,56 +7,6 @@ import { ReactNode, ComponentProps, ReactElement } from 'react';
5
7
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
8
  import { VariantProps } from 'class-variance-authority';
7
9
 
8
- var networks = {
9
- testnet: {
10
- chainId: 23295,
11
- name: "Sapphire Testnet",
12
- accountingContract: "0xaF8e5de153A584528B57DD4B9B0195956BBDF571",
13
- apiUrl: "https://testnet.privana.finance"
14
- },
15
- mainnet: {
16
- chainId: 23294,
17
- name: "Sapphire Mainnet",
18
- accountingContract: "0x0000000000000000000000000000000000000000",
19
- apiUrl: ""
20
- }
21
- };
22
- var config = {
23
- networks: networks
24
- };
25
-
26
- type Address = `0x${string}`;
27
- type Bytes32 = `0x${string}`;
28
- type HexString = `0x${string}`;
29
- type IntegerLike = string | number;
30
- type HostedAuthResponseMode = 'web_message' | 'redirect';
31
- type Network = keyof typeof config.networks;
32
- interface NetworkConfig {
33
- chainId: number;
34
- name: string;
35
- accountingContract: Address;
36
- apiUrl: string;
37
- }
38
- declare const NETWORK_CONFIG: {
39
- readonly testnet: {
40
- readonly accountingContract: Address;
41
- readonly chainId: number;
42
- readonly name: string;
43
- readonly apiUrl: string;
44
- };
45
- readonly mainnet: {
46
- readonly accountingContract: Address;
47
- readonly chainId: number;
48
- readonly name: string;
49
- readonly apiUrl: string;
50
- };
51
- };
52
- declare function getChainId(network: Network): number;
53
- declare function getAccountingContract(network: Network): Address;
54
- declare function getApiUrl(network: Network): string;
55
- declare function normalizeHex(value: string): HexString;
56
- declare function normalizeAddress(value: string): Address;
57
-
58
10
  interface HostedAuthConfig {
59
11
  clientId: string;
60
12
  redirectUri: string;
@@ -85,15 +37,6 @@ interface HostedAuthCallbackError {
85
37
  }
86
38
  type HostedAuthCallback = HostedAuthCallbackSuccess | HostedAuthCallbackError;
87
39
 
88
- interface TokenConfig {
89
- id: Bytes32;
90
- symbol: string;
91
- decimals: number;
92
- contract: Address;
93
- name: string;
94
- chainId: number;
95
- }
96
-
97
40
  interface ChainConfig {
98
41
  id: number;
99
42
  name: string;
@@ -438,6 +381,10 @@ declare class PrivanaClient {
438
381
  exchangeHostedAuthCode(request: HostedAuthTokenExchangeRequest): Promise<HostedAuthTokenExchangeResponse>;
439
382
  refreshJwtSession(request: JwtRefreshRequest): Promise<JwtRefreshResponse>;
440
383
  logoutJwtSession(request?: JwtLogoutRequest): Promise<JwtLogoutResponse>;
384
+ signOnRampUrl(request: SignOnRampUrlRequest): Promise<SignOnRampUrlResponse>;
385
+ createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
386
+ updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
387
+ getPendingOnRamps(): Promise<PendingOnRampsResponse>;
441
388
  setPrivateReadToken(token: string): void;
442
389
  getPrivateReadToken(): string | undefined;
443
390
  clearPrivateReadToken(): void;
@@ -663,6 +610,32 @@ interface SignWithdrawFromLockParams {
663
610
  }
664
611
  declare function signWithdrawFromLockMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawFromLockParams): Promise<`0x${string}`>;
665
612
 
613
+ type SiweAuthSession = {
614
+ address: Address;
615
+ };
616
+ type SiweAuthTokens = Pick<SiweLoginResponse, 'siwe_token' | 'jwt_access_token' | 'jwt_refresh_token' | 'address'>;
617
+ interface SiweAuthContextValue {
618
+ isAuthenticated: boolean;
619
+ isLoading: boolean;
620
+ error: Error | null;
621
+ session: SiweAuthSession | null;
622
+ accessToken: string | undefined;
623
+ tokens: SiweAuthTokens | null;
624
+ login: () => Promise<void>;
625
+ logout: () => Promise<void>;
626
+ }
627
+ interface SiweAuthConfig {
628
+ autoLogin?: boolean;
629
+ statement?: string;
630
+ }
631
+ interface SiweAuthProviderProps extends SiweAuthConfig {
632
+ children: ReactNode;
633
+ client: PrivanaClient;
634
+ networkConfig: NetworkConfig;
635
+ }
636
+ declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, statement, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
637
+ declare function useSiweAuth(): SiweAuthContextValue;
638
+
666
639
  type TokensStatus = 'loading' | 'ready' | 'error';
667
640
  interface PrivanaContextValue {
668
641
  client: PrivanaClient;
@@ -711,8 +684,16 @@ interface PrivanaProviderProps {
711
684
  * Optional hosted redirect auth configuration for cross-domain browser apps.
712
685
  */
713
686
  hostedAuth?: HostedAuthConfig;
687
+ /**
688
+ * Optional direct (in-app) SIWE auth. When provided, the connected wallet
689
+ * signs an EIP-4361 message in-app and `useSiweAuth()` becomes available.
690
+ * Mutually exclusive with `hostedAuth`: providing both throws, because
691
+ * `usePrivateReadRequest()` prefers `hostedAuthConfig` and would otherwise
692
+ * ignore the SIWE login.
693
+ */
694
+ siweAuth?: SiweAuthConfig;
714
695
  }
715
- declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
696
+ declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
716
697
  declare function usePrivanaContext(): PrivanaContextValue;
717
698
  declare function useSafePrivanaContext(): PrivanaContextValue | null;
718
699
 
@@ -806,6 +787,60 @@ interface UseDepositResult {
806
787
  }
807
788
  declare function useDeposit(options?: UseDepositOptions): UseDepositResult;
808
789
 
790
+ interface VerificationContext {
791
+ /** On-chain transfer that funded the user's Privana deposit address. */
792
+ hash: `0x${string}`;
793
+ /** Chain the transfer was mined on. */
794
+ chainId: number;
795
+ /** Transferred amount in base units (matches the deposit's token decimals). */
796
+ amount: bigint;
797
+ }
798
+ interface UseDepositVerificationOptions {
799
+ /** Fired when the deposit is credited inside the Privana accounting module. */
800
+ onCredited?: (txHash: string, response: DepositCheckResponse) => void;
801
+ /** Fired when polling exceeds `pollTimeout` (the deposit may still be processing). */
802
+ onCheckTimeout?: (txHash: string) => void;
803
+ onError?: (error: Error) => void;
804
+ /** Polling interval in ms (default: 5000). */
805
+ pollInterval?: number;
806
+ /** Retry interval in ms while the source-chain tx is waiting finality (default: pollInterval). */
807
+ finalityRetryInterval?: number;
808
+ /** Max time to wait for credit confirmation in ms (default: 180000). */
809
+ pollTimeout?: number;
810
+ }
811
+ interface UseDepositVerificationResult {
812
+ /** True while phase 1 (checkDeposit) or phase 2 (status polling) is in flight. */
813
+ isVerifying: boolean;
814
+ /** True if polling timed out before a terminal status. */
815
+ didTimeout: boolean;
816
+ /**
817
+ * True when the on-chain transfer exists but the API verification step failed.
818
+ * Funds are still at the deposit address; call `retryVerification()` to re-run
819
+ * without re-sending the transfer.
820
+ */
821
+ verificationFailed: boolean;
822
+ error: Error | null;
823
+ /** Current transfer hash being verified, if any. */
824
+ txHash: `0x${string}` | undefined;
825
+ /** Kick off Phase 1 (checkDeposit) + Phase 2 (poll getDepositStatus) for the given context. */
826
+ verify: (ctx: VerificationContext) => Promise<void>;
827
+ /** Re-run verification against the existing context (after a transient API failure). */
828
+ retryVerification: () => Promise<void>;
829
+ /** Discard local tracking (the deposit may still be credited in the background). */
830
+ reset: () => void;
831
+ }
832
+ /**
833
+ * Phase 1 (POST /deposits/check) + Phase 2 (poll /deposits/status) of the
834
+ * Privana deposit flow, decoupled from the wallet-signing half. Use this
835
+ * directly when the on-chain transfer to the deposit address came from
836
+ * somewhere other than the connected wallet — e.g. a fiat on-ramp that
837
+ * delivers straight to the deposit address.
838
+ *
839
+ * For the full deposit flow (get address → wallet transfer → verify) use
840
+ * `useDeposit`, which composes this hook internally.
841
+ */
842
+ declare function useDepositVerification(options?: UseDepositVerificationOptions): UseDepositVerificationResult;
843
+
809
844
  interface UseWithdrawOptions {
810
845
  onSuccess?: (response: TransactionSubmissionResponse) => void;
811
846
  /** Called when withdrawal is submitted to the backend */
@@ -963,9 +998,11 @@ interface UseHistoryResult {
963
998
  }
964
999
  declare function useHistory(options?: UseHistoryOptions): UseHistoryResult;
965
1000
 
1001
+ type AccountStatus = 'connecting' | 'reconnecting' | 'connected' | 'disconnected';
966
1002
  interface SafeAccountResult {
967
1003
  address: Address$1 | undefined;
968
1004
  isConnected: boolean;
1005
+ status: AccountStatus;
969
1006
  }
970
1007
  declare function useSafeAccount(): SafeAccountResult;
971
1008
 
@@ -1057,4 +1094,4 @@ declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>):
1057
1094
  declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
1058
1095
  declare function getChainIcon(chainId: number, size?: number): react_jsx_runtime.JSX.Element;
1059
1096
 
1060
- export { AccountingApiError, type Address, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, type Bytes32, type ChainConfig, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, type DepositParams, type EIP712Domain, type ExpiredLocksResponse, HOSTED_AUTH_CLOCK_SKEW_MS, type HexString, type HistoryEntry, type HistoryKind, type HistoryRequest, type HistoryResponse, type HostedAuthAuthorizeUrlRequest, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthResponseMode, type HostedAuthSession, HostedAuthStateMismatchError, type HostedAuthTokenExchangeRequest, type HostedAuthTokenExchangeResponse, HttpClient, type HttpClientConfig, type IntegerLike, type JwtLogoutRequest, type JwtLogoutResponse, type JwtRefreshRequest, type JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, type LockFundsRequest, type LockInfo, type LockMessage, type LockNonceResponse, type LockedFundsResponse, MODIFY_LOCK_TYPES, type MinDepositAmounts, type ModifyLockMessage, type ModifyLockNonceResponse, type ModifyLockParams, type ModifyLockRequest, NETWORK_CONFIG, type Network, type NetworkConfig, NetworkError, type PendingWithdrawalsResponse, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaClientConfig, type PrivanaContextValue, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweDomainResponse, type SiweLoginRequest, type SiweLoginResponse, type SiweNonceResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, type TokenBalance, type TokenConfig, type TokenInfoResponse, type TokenListResponse, type TokensStatus, type TotalLockedBalanceResponse, type TransactionSubmissionResponse, type TransferFundsRequest, type TransferLockedFundsRequest, type TransferLockedMessage, type TransferLockedNonceResponse, type TransferLockedParams, type TransferMessage, type TransferNonceResponse, type TransferParams, type UnlockAllExpiredRequest, type UnlockFundsParams, type UnlockFundsRequest, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositOptions, type UseDepositResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, 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, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, type WithdrawFromLockMessage, type WithdrawFromLockRequest, type WithdrawMessage, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, applyRefreshResponse, buildHostedAuthSession, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getAccountingContract, getApiUrl, getChainById, getChainIcon, getChainId, getExplorerAddressUrl, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, normalizeAddress, normalizeHex, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
1097
+ export { AccountingApiError, Address, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, Bytes32, type ChainConfig, CreateOnRampIntentRequest, CreateOnRampIntentResponse, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, type DepositParams, type EIP712Domain, type ExpiredLocksResponse, HOSTED_AUTH_CLOCK_SKEW_MS, HexString, type HistoryEntry, type HistoryKind, type HistoryRequest, type HistoryResponse, type HostedAuthAuthorizeUrlRequest, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, HostedAuthResponseMode, type HostedAuthSession, HostedAuthStateMismatchError, type HostedAuthTokenExchangeRequest, type HostedAuthTokenExchangeResponse, HttpClient, type HttpClientConfig, IntegerLike, type JwtLogoutRequest, type JwtLogoutResponse, type JwtRefreshRequest, type JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, type LockFundsRequest, type LockInfo, type LockMessage, type LockNonceResponse, type LockedFundsResponse, MODIFY_LOCK_TYPES, type MinDepositAmounts, type ModifyLockMessage, type ModifyLockNonceResponse, type ModifyLockParams, type ModifyLockRequest, NetworkConfig, NetworkError, PendingOnRampsResponse, type PendingWithdrawalsResponse, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaClientConfig, type PrivanaContextValue, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, SignOnRampUrlRequest, SignOnRampUrlResponse, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, type SiweDomainResponse, type SiweLoginRequest, type SiweLoginResponse, type SiweNonceResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, type TokenBalance, TokenConfig, type TokenInfoResponse, type TokenListResponse, type TokensStatus, type TotalLockedBalanceResponse, type TransactionSubmissionResponse, type TransferFundsRequest, type TransferLockedFundsRequest, type TransferLockedMessage, type TransferLockedNonceResponse, type TransferLockedParams, type TransferMessage, type TransferNonceResponse, type TransferParams, type UnlockAllExpiredRequest, type UnlockFundsParams, type UnlockFundsRequest, UpdateOnRampRequest, UpdateOnRampResponse, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, 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 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, type WithdrawFromLockMessage, type WithdrawFromLockRequest, type WithdrawMessage, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, applyRefreshResponse, buildHostedAuthSession, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };