@oasisprotocol/privana-sdk 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/{chunk-UHXVYWTF.cjs → chunk-7KEQHWZB.cjs} +902 -240
- package/dist/chunk-7KEQHWZB.cjs.map +1 -0
- package/dist/{chunk-ZVUMV4NR.js → chunk-DZURIIRE.js} +898 -242
- package/dist/chunk-DZURIIRE.js.map +1 -0
- package/dist/index.cjs +1356 -336
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +24 -11
- package/dist/index.d.ts +24 -11
- package/dist/index.js +1116 -104
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +3 -3
- package/dist/on-ramp.d.cts +5 -4
- package/dist/on-ramp.d.ts +5 -4
- package/dist/on-ramp.js +1 -1
- package/dist/{pending-lock-BdkuMjmY.d.cts → pending-lock-f4bWWTyN.d.cts} +41 -7
- package/dist/{pending-lock-BdkuMjmY.d.ts → pending-lock-f4bWWTyN.d.ts} +41 -7
- package/package.json +1 -1
- package/dist/chunk-UHXVYWTF.cjs.map +0 -1
- package/dist/chunk-ZVUMV4NR.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Address, J as JwtRefreshResponse, H as HostedAuthTokenExchangeResponse, B as Bytes32,
|
|
2
|
-
export {
|
|
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-f4bWWTyN.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-f4bWWTyN.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';
|
|
@@ -312,10 +312,18 @@ interface SignWithdrawFromLockParams {
|
|
|
312
312
|
}
|
|
313
313
|
declare function signWithdrawFromLockMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawFromLockParams): Promise<`0x${string}`>;
|
|
314
314
|
|
|
315
|
-
|
|
315
|
+
/** Session published to consumers. */
|
|
316
|
+
interface SiweAuthSession {
|
|
316
317
|
address: Address;
|
|
317
|
-
}
|
|
318
|
-
|
|
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
|
|
468
|
-
*
|
|
469
|
-
*
|
|
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;
|
|
@@ -946,4 +959,4 @@ interface PrivanaIconProps {
|
|
|
946
959
|
}
|
|
947
960
|
declare function PrivanaIcon({ className, size }: PrivanaIconProps): react_jsx_runtime.JSX.Element;
|
|
948
961
|
|
|
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,
|
|
962
|
+
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, 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, 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 };
|