@oasisprotocol/privana-sdk 0.4.3 → 0.5.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/{chunk-2AHJHISR.js → chunk-54FC6TO3.js} +1145 -26
- package/dist/chunk-54FC6TO3.js.map +1 -0
- package/dist/{chunk-EEAQ2NWF.cjs → chunk-ACLJPC75.cjs} +1145 -22
- package/dist/chunk-ACLJPC75.cjs.map +1 -0
- package/dist/index.cjs +2003 -312
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +137 -9
- package/dist/index.d.ts +137 -9
- package/dist/index.js +1758 -83
- package/dist/index.js.map +1 -1
- package/dist/{on-ramp-CdXqJjmm.d.cts → on-ramp-XLXsy0aI.d.cts} +15 -0
- package/dist/{on-ramp-CdXqJjmm.d.ts → on-ramp-XLXsy0aI.d.ts} +15 -0
- package/dist/on-ramp.cjs +10 -974
- package/dist/on-ramp.cjs.map +1 -1
- package/dist/on-ramp.d.cts +13 -3
- package/dist/on-ramp.d.ts +13 -3
- package/dist/on-ramp.js +1 -975
- package/dist/on-ramp.js.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-2AHJHISR.js.map +0 -1
- package/dist/chunk-EEAQ2NWF.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +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-
|
|
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-
|
|
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-XLXsy0aI.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-XLXsy0aI.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';
|
|
@@ -7,6 +7,32 @@ import { ReactNode, ComponentProps, ReactElement } 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
|
|
|
10
|
+
interface AllowanceTerm {
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
interface Allowance {
|
|
15
|
+
/**
|
|
16
|
+
* Hard cap the service is allowed to lock (`maxAmount`), in the token's base units.
|
|
17
|
+
* Signed into the deposit-lock authorization.
|
|
18
|
+
*/
|
|
19
|
+
value: string;
|
|
20
|
+
/**
|
|
21
|
+
* Minimum amount the delivered deposit must reach for the lock to be created
|
|
22
|
+
* (`minAmount`), in the token's base units. Defaults to `0` when omitted.
|
|
23
|
+
*/
|
|
24
|
+
minAmount?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Lock lifetime in seconds. The accounting module adds this to `block.timestamp`
|
|
27
|
+
* to derive the lock expiry. Defaults to the SDK default (3600) when omitted.
|
|
28
|
+
*/
|
|
29
|
+
lockDuration?: number;
|
|
30
|
+
terms?: {
|
|
31
|
+
permissions?: AllowanceTerm[];
|
|
32
|
+
restrictions?: AllowanceTerm[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
10
36
|
interface HostedAuthConfig {
|
|
11
37
|
clientId: string;
|
|
12
38
|
redirectUri: string;
|
|
@@ -41,9 +67,11 @@ interface ChainConfig {
|
|
|
41
67
|
id: number;
|
|
42
68
|
name: string;
|
|
43
69
|
explorerUrl: string;
|
|
70
|
+
explorerName: string;
|
|
44
71
|
}
|
|
45
72
|
declare const SUPPORTED_CHAINS: ChainConfig[];
|
|
46
73
|
declare function getChainById(chainId: number): ChainConfig | undefined;
|
|
74
|
+
declare function getExplorerLabel(chainId: number): string;
|
|
47
75
|
declare function getExplorerAddressUrl(chainId: number, address: string): string | undefined;
|
|
48
76
|
|
|
49
77
|
interface DepositAddressRequest {
|
|
@@ -324,6 +352,8 @@ declare function applyRefreshResponse(session: HostedAuthSession, response: JwtR
|
|
|
324
352
|
declare function isHostedAuthSessionActive(session: HostedAuthSession, now?: number, skewMs?: number): boolean;
|
|
325
353
|
declare function isHostedAuthRefreshActive(session: HostedAuthSession, now?: number, skewMs?: number): boolean;
|
|
326
354
|
|
|
355
|
+
declare function buildSiweStatement(chainId: number): string;
|
|
356
|
+
|
|
327
357
|
interface HttpClientConfig {
|
|
328
358
|
baseUrl: string;
|
|
329
359
|
timeout?: number;
|
|
@@ -624,16 +654,16 @@ interface SiweAuthContextValue {
|
|
|
624
654
|
login: () => Promise<void>;
|
|
625
655
|
logout: () => Promise<void>;
|
|
626
656
|
}
|
|
627
|
-
|
|
657
|
+
type SiweAuthConfig = boolean | {
|
|
628
658
|
autoLogin?: boolean;
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
interface SiweAuthProviderProps extends SiweAuthConfig {
|
|
659
|
+
};
|
|
660
|
+
interface SiweAuthProviderProps {
|
|
632
661
|
children: ReactNode;
|
|
633
662
|
client: PrivanaClient;
|
|
634
663
|
networkConfig: NetworkConfig;
|
|
664
|
+
autoLogin?: boolean;
|
|
635
665
|
}
|
|
636
|
-
declare function SiweAuthProvider({ children, client, networkConfig, autoLogin,
|
|
666
|
+
declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
637
667
|
declare function useSiweAuth(): SiweAuthContextValue;
|
|
638
668
|
|
|
639
669
|
type TokensStatus = 'loading' | 'ready' | 'error';
|
|
@@ -649,6 +679,8 @@ interface PrivanaContextValue {
|
|
|
649
679
|
tokensError?: Error;
|
|
650
680
|
pollingInterval: number;
|
|
651
681
|
serviceAddress?: Address;
|
|
682
|
+
serviceName?: string;
|
|
683
|
+
serviceIcon?: ReactNode;
|
|
652
684
|
hostedAuthConfig: HostedAuthConfig | null;
|
|
653
685
|
hostedAuthSession: HostedAuthSession | null;
|
|
654
686
|
setHostedAuthSession: (session: HostedAuthSession | null) => void;
|
|
@@ -680,6 +712,15 @@ interface PrivanaProviderProps {
|
|
|
680
712
|
* The service address for lock operations.
|
|
681
713
|
*/
|
|
682
714
|
serviceAddress?: Address;
|
|
715
|
+
/**
|
|
716
|
+
* Display name of the host application/service. Shown as the title in
|
|
717
|
+
* Privana modals (e.g. the deposit modal header). Defaults to "Privana".
|
|
718
|
+
*/
|
|
719
|
+
serviceName?: string;
|
|
720
|
+
/**
|
|
721
|
+
* Optional icon/logo for the host application/service.
|
|
722
|
+
*/
|
|
723
|
+
serviceIcon?: ReactNode;
|
|
683
724
|
/**
|
|
684
725
|
* Optional hosted redirect auth configuration for cross-domain browser apps.
|
|
685
726
|
*/
|
|
@@ -693,7 +734,7 @@ interface PrivanaProviderProps {
|
|
|
693
734
|
*/
|
|
694
735
|
siweAuth?: SiweAuthConfig;
|
|
695
736
|
}
|
|
696
|
-
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
737
|
+
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, serviceName, serviceIcon, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
697
738
|
declare function usePrivanaContext(): PrivanaContextValue;
|
|
698
739
|
declare function useSafePrivanaContext(): PrivanaContextValue | null;
|
|
699
740
|
|
|
@@ -787,6 +828,25 @@ interface UseDepositResult {
|
|
|
787
828
|
}
|
|
788
829
|
declare function useDeposit(options?: UseDepositOptions): UseDepositResult;
|
|
789
830
|
|
|
831
|
+
interface UseDepositAddressOptions {
|
|
832
|
+
enabled?: boolean;
|
|
833
|
+
}
|
|
834
|
+
interface UseDepositAddressResult {
|
|
835
|
+
depositAddress: string | null;
|
|
836
|
+
isReady: boolean;
|
|
837
|
+
isLoading: boolean;
|
|
838
|
+
isError: boolean;
|
|
839
|
+
error: Error | null;
|
|
840
|
+
refetch: () => void;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Fetches the user's Privana deposit address via the SIWE private-read flow
|
|
844
|
+
* (`POST /v1/accounting/deposits/address`) — the same authenticated path used
|
|
845
|
+
* by `useFiatOnRamp`. Used by the external-wallet deposit view to show a QR
|
|
846
|
+
* code / copyable address to send funds to.
|
|
847
|
+
*/
|
|
848
|
+
declare function useDepositAddress(options?: UseDepositAddressOptions): UseDepositAddressResult;
|
|
849
|
+
|
|
790
850
|
interface VerificationContext {
|
|
791
851
|
/** On-chain transfer that funded the user's Privana deposit address. */
|
|
792
852
|
hash: `0x${string}`;
|
|
@@ -1096,9 +1156,77 @@ declare function PrivanaInlineModal({ className, showLockedFunds, defaultTab, on
|
|
|
1096
1156
|
onDepositSuccess?: () => void;
|
|
1097
1157
|
}): react_jsx_runtime.JSX.Element;
|
|
1098
1158
|
|
|
1159
|
+
type DepositMethodTab = 'crypto' | 'credit-card';
|
|
1160
|
+
type DepositSource = 'connected' | 'external' | 'credit-card';
|
|
1161
|
+
interface DepositMethodHandlers {
|
|
1162
|
+
defaultTab?: DepositMethodTab;
|
|
1163
|
+
/** Allowance (shown as a "policy") the host service requests. */
|
|
1164
|
+
allowance?: Allowance;
|
|
1165
|
+
onSelectConnectedWallet?: () => void;
|
|
1166
|
+
onSelectExternalWallet?: () => void;
|
|
1167
|
+
onSelectCreditCard?: () => void;
|
|
1168
|
+
onConnectWallet?: () => void;
|
|
1169
|
+
/** Called when the user confirms the amount on the deposit view. */
|
|
1170
|
+
onDeposit?: (args: {
|
|
1171
|
+
source: DepositSource;
|
|
1172
|
+
tokenId: string;
|
|
1173
|
+
amount: string;
|
|
1174
|
+
}) => void;
|
|
1175
|
+
onDepositSuccess?: () => void;
|
|
1176
|
+
}
|
|
1177
|
+
interface DepositModalProps extends DepositMethodHandlers {
|
|
1178
|
+
open: boolean;
|
|
1179
|
+
onClose: () => void;
|
|
1180
|
+
}
|
|
1181
|
+
declare function DepositModal({ open, onClose, ...handlers }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
1182
|
+
interface DepositInlineModalProps extends DepositMethodHandlers {
|
|
1183
|
+
className?: string;
|
|
1184
|
+
}
|
|
1185
|
+
declare function DepositInlineModal({ className, ...handlers }: DepositInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
1186
|
+
|
|
1187
|
+
interface WithdrawModalProps {
|
|
1188
|
+
open: boolean;
|
|
1189
|
+
onClose: () => void;
|
|
1190
|
+
}
|
|
1191
|
+
declare function WithdrawModal({ open, onClose }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
|
1192
|
+
interface WithdrawInlineModalProps {
|
|
1193
|
+
className?: string;
|
|
1194
|
+
}
|
|
1195
|
+
declare function WithdrawInlineModal({ className }: WithdrawInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
1196
|
+
|
|
1197
|
+
interface WalletSession {
|
|
1198
|
+
/** Funds committed to the active session, in the display token's base units. */
|
|
1199
|
+
inUse: string | bigint;
|
|
1200
|
+
/** Unix timestamp (seconds) when the session lock expires; shows the countdown. */
|
|
1201
|
+
expiry?: number;
|
|
1202
|
+
}
|
|
1203
|
+
interface WalletModalHandlers extends DepositMethodHandlers {
|
|
1204
|
+
session?: WalletSession;
|
|
1205
|
+
onPlay?: (args: {
|
|
1206
|
+
tokenId: string;
|
|
1207
|
+
amount: string;
|
|
1208
|
+
}) => void;
|
|
1209
|
+
onEndSession?: () => Promise<void>;
|
|
1210
|
+
}
|
|
1211
|
+
interface WalletModalProps extends WalletModalHandlers {
|
|
1212
|
+
open: boolean;
|
|
1213
|
+
onClose: () => void;
|
|
1214
|
+
}
|
|
1215
|
+
declare function WalletModal({ open, onClose, ...handlers }: WalletModalProps): react_jsx_runtime.JSX.Element;
|
|
1216
|
+
interface WalletInlineModalProps extends WalletModalHandlers {
|
|
1217
|
+
className?: string;
|
|
1218
|
+
}
|
|
1219
|
+
declare function WalletInlineModal({ className, ...handlers }: WalletInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
1220
|
+
|
|
1099
1221
|
declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
1100
1222
|
|
|
1101
1223
|
declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
|
|
1102
1224
|
declare function getChainIcon(chainId: number, size?: number): react_jsx_runtime.JSX.Element;
|
|
1103
1225
|
|
|
1104
|
-
|
|
1226
|
+
interface PrivanaIconProps {
|
|
1227
|
+
className?: string;
|
|
1228
|
+
size?: number;
|
|
1229
|
+
}
|
|
1230
|
+
declare function PrivanaIcon({ className, size }: PrivanaIconProps): react_jsx_runtime.JSX.Element;
|
|
1231
|
+
|
|
1232
|
+
export { AccountingApiError, Address, type Allowance, type AllowanceTerm, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, Bytes32, type ChainConfig, CreateOnRampIntentRequest, CreateOnRampIntentResponse, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, 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, PrivanaIcon, 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 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 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, type WithdrawFromLockRequest, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, 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, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +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-
|
|
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-
|
|
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-XLXsy0aI.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-XLXsy0aI.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';
|
|
@@ -7,6 +7,32 @@ import { ReactNode, ComponentProps, ReactElement } 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
|
|
|
10
|
+
interface AllowanceTerm {
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
interface Allowance {
|
|
15
|
+
/**
|
|
16
|
+
* Hard cap the service is allowed to lock (`maxAmount`), in the token's base units.
|
|
17
|
+
* Signed into the deposit-lock authorization.
|
|
18
|
+
*/
|
|
19
|
+
value: string;
|
|
20
|
+
/**
|
|
21
|
+
* Minimum amount the delivered deposit must reach for the lock to be created
|
|
22
|
+
* (`minAmount`), in the token's base units. Defaults to `0` when omitted.
|
|
23
|
+
*/
|
|
24
|
+
minAmount?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Lock lifetime in seconds. The accounting module adds this to `block.timestamp`
|
|
27
|
+
* to derive the lock expiry. Defaults to the SDK default (3600) when omitted.
|
|
28
|
+
*/
|
|
29
|
+
lockDuration?: number;
|
|
30
|
+
terms?: {
|
|
31
|
+
permissions?: AllowanceTerm[];
|
|
32
|
+
restrictions?: AllowanceTerm[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
10
36
|
interface HostedAuthConfig {
|
|
11
37
|
clientId: string;
|
|
12
38
|
redirectUri: string;
|
|
@@ -41,9 +67,11 @@ interface ChainConfig {
|
|
|
41
67
|
id: number;
|
|
42
68
|
name: string;
|
|
43
69
|
explorerUrl: string;
|
|
70
|
+
explorerName: string;
|
|
44
71
|
}
|
|
45
72
|
declare const SUPPORTED_CHAINS: ChainConfig[];
|
|
46
73
|
declare function getChainById(chainId: number): ChainConfig | undefined;
|
|
74
|
+
declare function getExplorerLabel(chainId: number): string;
|
|
47
75
|
declare function getExplorerAddressUrl(chainId: number, address: string): string | undefined;
|
|
48
76
|
|
|
49
77
|
interface DepositAddressRequest {
|
|
@@ -324,6 +352,8 @@ declare function applyRefreshResponse(session: HostedAuthSession, response: JwtR
|
|
|
324
352
|
declare function isHostedAuthSessionActive(session: HostedAuthSession, now?: number, skewMs?: number): boolean;
|
|
325
353
|
declare function isHostedAuthRefreshActive(session: HostedAuthSession, now?: number, skewMs?: number): boolean;
|
|
326
354
|
|
|
355
|
+
declare function buildSiweStatement(chainId: number): string;
|
|
356
|
+
|
|
327
357
|
interface HttpClientConfig {
|
|
328
358
|
baseUrl: string;
|
|
329
359
|
timeout?: number;
|
|
@@ -624,16 +654,16 @@ interface SiweAuthContextValue {
|
|
|
624
654
|
login: () => Promise<void>;
|
|
625
655
|
logout: () => Promise<void>;
|
|
626
656
|
}
|
|
627
|
-
|
|
657
|
+
type SiweAuthConfig = boolean | {
|
|
628
658
|
autoLogin?: boolean;
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
interface SiweAuthProviderProps extends SiweAuthConfig {
|
|
659
|
+
};
|
|
660
|
+
interface SiweAuthProviderProps {
|
|
632
661
|
children: ReactNode;
|
|
633
662
|
client: PrivanaClient;
|
|
634
663
|
networkConfig: NetworkConfig;
|
|
664
|
+
autoLogin?: boolean;
|
|
635
665
|
}
|
|
636
|
-
declare function SiweAuthProvider({ children, client, networkConfig, autoLogin,
|
|
666
|
+
declare function SiweAuthProvider({ children, client, networkConfig, autoLogin, }: SiweAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
637
667
|
declare function useSiweAuth(): SiweAuthContextValue;
|
|
638
668
|
|
|
639
669
|
type TokensStatus = 'loading' | 'ready' | 'error';
|
|
@@ -649,6 +679,8 @@ interface PrivanaContextValue {
|
|
|
649
679
|
tokensError?: Error;
|
|
650
680
|
pollingInterval: number;
|
|
651
681
|
serviceAddress?: Address;
|
|
682
|
+
serviceName?: string;
|
|
683
|
+
serviceIcon?: ReactNode;
|
|
652
684
|
hostedAuthConfig: HostedAuthConfig | null;
|
|
653
685
|
hostedAuthSession: HostedAuthSession | null;
|
|
654
686
|
setHostedAuthSession: (session: HostedAuthSession | null) => void;
|
|
@@ -680,6 +712,15 @@ interface PrivanaProviderProps {
|
|
|
680
712
|
* The service address for lock operations.
|
|
681
713
|
*/
|
|
682
714
|
serviceAddress?: Address;
|
|
715
|
+
/**
|
|
716
|
+
* Display name of the host application/service. Shown as the title in
|
|
717
|
+
* Privana modals (e.g. the deposit modal header). Defaults to "Privana".
|
|
718
|
+
*/
|
|
719
|
+
serviceName?: string;
|
|
720
|
+
/**
|
|
721
|
+
* Optional icon/logo for the host application/service.
|
|
722
|
+
*/
|
|
723
|
+
serviceIcon?: ReactNode;
|
|
683
724
|
/**
|
|
684
725
|
* Optional hosted redirect auth configuration for cross-domain browser apps.
|
|
685
726
|
*/
|
|
@@ -693,7 +734,7 @@ interface PrivanaProviderProps {
|
|
|
693
734
|
*/
|
|
694
735
|
siweAuth?: SiweAuthConfig;
|
|
695
736
|
}
|
|
696
|
-
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
737
|
+
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, serviceName, serviceIcon, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
697
738
|
declare function usePrivanaContext(): PrivanaContextValue;
|
|
698
739
|
declare function useSafePrivanaContext(): PrivanaContextValue | null;
|
|
699
740
|
|
|
@@ -787,6 +828,25 @@ interface UseDepositResult {
|
|
|
787
828
|
}
|
|
788
829
|
declare function useDeposit(options?: UseDepositOptions): UseDepositResult;
|
|
789
830
|
|
|
831
|
+
interface UseDepositAddressOptions {
|
|
832
|
+
enabled?: boolean;
|
|
833
|
+
}
|
|
834
|
+
interface UseDepositAddressResult {
|
|
835
|
+
depositAddress: string | null;
|
|
836
|
+
isReady: boolean;
|
|
837
|
+
isLoading: boolean;
|
|
838
|
+
isError: boolean;
|
|
839
|
+
error: Error | null;
|
|
840
|
+
refetch: () => void;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Fetches the user's Privana deposit address via the SIWE private-read flow
|
|
844
|
+
* (`POST /v1/accounting/deposits/address`) — the same authenticated path used
|
|
845
|
+
* by `useFiatOnRamp`. Used by the external-wallet deposit view to show a QR
|
|
846
|
+
* code / copyable address to send funds to.
|
|
847
|
+
*/
|
|
848
|
+
declare function useDepositAddress(options?: UseDepositAddressOptions): UseDepositAddressResult;
|
|
849
|
+
|
|
790
850
|
interface VerificationContext {
|
|
791
851
|
/** On-chain transfer that funded the user's Privana deposit address. */
|
|
792
852
|
hash: `0x${string}`;
|
|
@@ -1096,9 +1156,77 @@ declare function PrivanaInlineModal({ className, showLockedFunds, defaultTab, on
|
|
|
1096
1156
|
onDepositSuccess?: () => void;
|
|
1097
1157
|
}): react_jsx_runtime.JSX.Element;
|
|
1098
1158
|
|
|
1159
|
+
type DepositMethodTab = 'crypto' | 'credit-card';
|
|
1160
|
+
type DepositSource = 'connected' | 'external' | 'credit-card';
|
|
1161
|
+
interface DepositMethodHandlers {
|
|
1162
|
+
defaultTab?: DepositMethodTab;
|
|
1163
|
+
/** Allowance (shown as a "policy") the host service requests. */
|
|
1164
|
+
allowance?: Allowance;
|
|
1165
|
+
onSelectConnectedWallet?: () => void;
|
|
1166
|
+
onSelectExternalWallet?: () => void;
|
|
1167
|
+
onSelectCreditCard?: () => void;
|
|
1168
|
+
onConnectWallet?: () => void;
|
|
1169
|
+
/** Called when the user confirms the amount on the deposit view. */
|
|
1170
|
+
onDeposit?: (args: {
|
|
1171
|
+
source: DepositSource;
|
|
1172
|
+
tokenId: string;
|
|
1173
|
+
amount: string;
|
|
1174
|
+
}) => void;
|
|
1175
|
+
onDepositSuccess?: () => void;
|
|
1176
|
+
}
|
|
1177
|
+
interface DepositModalProps extends DepositMethodHandlers {
|
|
1178
|
+
open: boolean;
|
|
1179
|
+
onClose: () => void;
|
|
1180
|
+
}
|
|
1181
|
+
declare function DepositModal({ open, onClose, ...handlers }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
1182
|
+
interface DepositInlineModalProps extends DepositMethodHandlers {
|
|
1183
|
+
className?: string;
|
|
1184
|
+
}
|
|
1185
|
+
declare function DepositInlineModal({ className, ...handlers }: DepositInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
1186
|
+
|
|
1187
|
+
interface WithdrawModalProps {
|
|
1188
|
+
open: boolean;
|
|
1189
|
+
onClose: () => void;
|
|
1190
|
+
}
|
|
1191
|
+
declare function WithdrawModal({ open, onClose }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
|
1192
|
+
interface WithdrawInlineModalProps {
|
|
1193
|
+
className?: string;
|
|
1194
|
+
}
|
|
1195
|
+
declare function WithdrawInlineModal({ className }: WithdrawInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
1196
|
+
|
|
1197
|
+
interface WalletSession {
|
|
1198
|
+
/** Funds committed to the active session, in the display token's base units. */
|
|
1199
|
+
inUse: string | bigint;
|
|
1200
|
+
/** Unix timestamp (seconds) when the session lock expires; shows the countdown. */
|
|
1201
|
+
expiry?: number;
|
|
1202
|
+
}
|
|
1203
|
+
interface WalletModalHandlers extends DepositMethodHandlers {
|
|
1204
|
+
session?: WalletSession;
|
|
1205
|
+
onPlay?: (args: {
|
|
1206
|
+
tokenId: string;
|
|
1207
|
+
amount: string;
|
|
1208
|
+
}) => void;
|
|
1209
|
+
onEndSession?: () => Promise<void>;
|
|
1210
|
+
}
|
|
1211
|
+
interface WalletModalProps extends WalletModalHandlers {
|
|
1212
|
+
open: boolean;
|
|
1213
|
+
onClose: () => void;
|
|
1214
|
+
}
|
|
1215
|
+
declare function WalletModal({ open, onClose, ...handlers }: WalletModalProps): react_jsx_runtime.JSX.Element;
|
|
1216
|
+
interface WalletInlineModalProps extends WalletModalHandlers {
|
|
1217
|
+
className?: string;
|
|
1218
|
+
}
|
|
1219
|
+
declare function WalletInlineModal({ className, ...handlers }: WalletInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
1220
|
+
|
|
1099
1221
|
declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
1100
1222
|
|
|
1101
1223
|
declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
|
|
1102
1224
|
declare function getChainIcon(chainId: number, size?: number): react_jsx_runtime.JSX.Element;
|
|
1103
1225
|
|
|
1104
|
-
|
|
1226
|
+
interface PrivanaIconProps {
|
|
1227
|
+
className?: string;
|
|
1228
|
+
size?: number;
|
|
1229
|
+
}
|
|
1230
|
+
declare function PrivanaIcon({ className, size }: PrivanaIconProps): react_jsx_runtime.JSX.Element;
|
|
1231
|
+
|
|
1232
|
+
export { AccountingApiError, Address, type Allowance, type AllowanceTerm, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, Bytes32, type ChainConfig, CreateOnRampIntentRequest, CreateOnRampIntentResponse, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, 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, PrivanaIcon, 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 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 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, type WithdrawFromLockRequest, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, 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, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
|