@volr/react 0.1.134 → 0.2.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
@@ -218,6 +218,27 @@ type SignRequest = {
218
218
  * Resolve to proceed, reject to cancel
219
219
  */
220
220
  type OnSignRequest = (request: SignRequest) => Promise<void>;
221
+ /**
222
+ * Wallet required request types for deferred wallet creation flows.
223
+ *
224
+ * Called when the SDK needs a Volr-managed wallet provider (passkey/MPC) but
225
+ * the current user does not have one available yet.
226
+ */
227
+ type WalletRequiredRequest = {
228
+ type: "transaction";
229
+ chainId: number;
230
+ } | {
231
+ type: "message";
232
+ } | {
233
+ type: "typedData";
234
+ };
235
+ /**
236
+ * Callback invoked when a wallet is required for an operation.
237
+ *
238
+ * - If you return a provider, the SDK will use it for the current operation.
239
+ * - If you return void/null, the SDK will throw WALLET_REQUIRED so the caller can retry.
240
+ */
241
+ type OnWalletRequired = (request: WalletRequiredRequest) => Promise<WalletProviderPort | void | null>;
221
242
 
222
243
  /**
223
244
  * ERC-20 token configuration
@@ -283,6 +304,12 @@ type VolrConfig = {
283
304
  * Used by @volr/react-ui to show sign confirmation modal.
284
305
  */
285
306
  onSignRequest?: OnSignRequest;
307
+ /**
308
+ * Callback invoked when a wallet provider is required (passkey/MPC not yet created).
309
+ * Used by @volr/react-ui to show "Create account in 1 second" style onboarding
310
+ * only when the user actually needs a wallet (payments/transactions/signing).
311
+ */
312
+ onWalletRequired?: OnWalletRequired;
286
313
  };
287
314
  /**
288
315
  * Public context value
@@ -585,6 +612,10 @@ type VolrClient = {
585
612
  * How the user signs transactions
586
613
  */
587
614
  signerType: SignerType | undefined;
615
+ /**
616
+ * Whether the user has created a Volr-managed wallet (passkey/MPC).
617
+ */
618
+ hasWallet: boolean;
588
619
  /**
589
620
  * Logout the user
590
621
  */
@@ -603,6 +634,28 @@ type VolrClient = {
603
634
  */
604
635
  declare function useVolr(): VolrClient;
605
636
 
637
+ type SetSessionParams = {
638
+ accessToken: string;
639
+ refreshToken: string;
640
+ };
641
+ type OidcExchangeResult = {
642
+ userId: string;
643
+ isNewUser: boolean;
644
+ keyStorageType: KeyStorageType | null;
645
+ signerType?: SignerType | null;
646
+ accessToken: string;
647
+ };
648
+ /**
649
+ * BYO Auth helpers:
650
+ * - A) setSession: inject server-minted Volr tokens and refresh user profile.
651
+ * - B) exchangeOidc: exchange an OIDC idToken (JWT) for Volr tokens.
652
+ */
653
+ declare function useVolrSession(): {
654
+ setSession: (session: SetSessionParams) => Promise<VolrUser>;
655
+ clearSession: () => Promise<void>;
656
+ exchangeOidc: (idToken: string) => Promise<OidcExchangeResult>;
657
+ };
658
+
606
659
  /**
607
660
  * usePrecheck hook - Precheck transaction batch
608
661
  */
@@ -1378,6 +1431,22 @@ declare function isWebAuthnBusyError(error: unknown): boolean;
1378
1431
  */
1379
1432
  declare function isInAppBrowserNotSupportedError(error: unknown): boolean;
1380
1433
 
1434
+ /**
1435
+ * Wallet-related error classes
1436
+ */
1437
+ type WalletRequiredAction = "send_transaction" | "sign_message" | "sign_typed_data";
1438
+ /**
1439
+ * Error thrown when a Volr-managed wallet provider is required but not available.
1440
+ *
1441
+ * This is expected in the deferred-wallet flow (BYO Auth + optional wallet creation).
1442
+ */
1443
+ declare class WalletRequiredError extends Error {
1444
+ readonly code = "WALLET_REQUIRED";
1445
+ readonly action: WalletRequiredAction;
1446
+ constructor(action: WalletRequiredAction, message?: string);
1447
+ }
1448
+ declare function isWalletRequiredError(error: unknown): error is WalletRequiredError;
1449
+
1381
1450
  /**
1382
1451
  * Platform compatibility check utilities
1383
1452
  * Detects PRF extension support and provides guidance for cross-device authentication
@@ -1702,4 +1771,4 @@ declare function useEIP6963(): UseEIP6963Return;
1702
1771
  */
1703
1772
  declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
1704
1773
 
1705
- export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OnSignRequest, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
1774
+ export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OidcExchangeResult, type OnSignRequest, type OnWalletRequired, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SetSessionParams, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletRequiredAction, WalletRequiredError, type WalletRequiredRequest, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
package/dist/index.d.ts CHANGED
@@ -218,6 +218,27 @@ type SignRequest = {
218
218
  * Resolve to proceed, reject to cancel
219
219
  */
220
220
  type OnSignRequest = (request: SignRequest) => Promise<void>;
221
+ /**
222
+ * Wallet required request types for deferred wallet creation flows.
223
+ *
224
+ * Called when the SDK needs a Volr-managed wallet provider (passkey/MPC) but
225
+ * the current user does not have one available yet.
226
+ */
227
+ type WalletRequiredRequest = {
228
+ type: "transaction";
229
+ chainId: number;
230
+ } | {
231
+ type: "message";
232
+ } | {
233
+ type: "typedData";
234
+ };
235
+ /**
236
+ * Callback invoked when a wallet is required for an operation.
237
+ *
238
+ * - If you return a provider, the SDK will use it for the current operation.
239
+ * - If you return void/null, the SDK will throw WALLET_REQUIRED so the caller can retry.
240
+ */
241
+ type OnWalletRequired = (request: WalletRequiredRequest) => Promise<WalletProviderPort | void | null>;
221
242
 
222
243
  /**
223
244
  * ERC-20 token configuration
@@ -283,6 +304,12 @@ type VolrConfig = {
283
304
  * Used by @volr/react-ui to show sign confirmation modal.
284
305
  */
285
306
  onSignRequest?: OnSignRequest;
307
+ /**
308
+ * Callback invoked when a wallet provider is required (passkey/MPC not yet created).
309
+ * Used by @volr/react-ui to show "Create account in 1 second" style onboarding
310
+ * only when the user actually needs a wallet (payments/transactions/signing).
311
+ */
312
+ onWalletRequired?: OnWalletRequired;
286
313
  };
287
314
  /**
288
315
  * Public context value
@@ -585,6 +612,10 @@ type VolrClient = {
585
612
  * How the user signs transactions
586
613
  */
587
614
  signerType: SignerType | undefined;
615
+ /**
616
+ * Whether the user has created a Volr-managed wallet (passkey/MPC).
617
+ */
618
+ hasWallet: boolean;
588
619
  /**
589
620
  * Logout the user
590
621
  */
@@ -603,6 +634,28 @@ type VolrClient = {
603
634
  */
604
635
  declare function useVolr(): VolrClient;
605
636
 
637
+ type SetSessionParams = {
638
+ accessToken: string;
639
+ refreshToken: string;
640
+ };
641
+ type OidcExchangeResult = {
642
+ userId: string;
643
+ isNewUser: boolean;
644
+ keyStorageType: KeyStorageType | null;
645
+ signerType?: SignerType | null;
646
+ accessToken: string;
647
+ };
648
+ /**
649
+ * BYO Auth helpers:
650
+ * - A) setSession: inject server-minted Volr tokens and refresh user profile.
651
+ * - B) exchangeOidc: exchange an OIDC idToken (JWT) for Volr tokens.
652
+ */
653
+ declare function useVolrSession(): {
654
+ setSession: (session: SetSessionParams) => Promise<VolrUser>;
655
+ clearSession: () => Promise<void>;
656
+ exchangeOidc: (idToken: string) => Promise<OidcExchangeResult>;
657
+ };
658
+
606
659
  /**
607
660
  * usePrecheck hook - Precheck transaction batch
608
661
  */
@@ -1378,6 +1431,22 @@ declare function isWebAuthnBusyError(error: unknown): boolean;
1378
1431
  */
1379
1432
  declare function isInAppBrowserNotSupportedError(error: unknown): boolean;
1380
1433
 
1434
+ /**
1435
+ * Wallet-related error classes
1436
+ */
1437
+ type WalletRequiredAction = "send_transaction" | "sign_message" | "sign_typed_data";
1438
+ /**
1439
+ * Error thrown when a Volr-managed wallet provider is required but not available.
1440
+ *
1441
+ * This is expected in the deferred-wallet flow (BYO Auth + optional wallet creation).
1442
+ */
1443
+ declare class WalletRequiredError extends Error {
1444
+ readonly code = "WALLET_REQUIRED";
1445
+ readonly action: WalletRequiredAction;
1446
+ constructor(action: WalletRequiredAction, message?: string);
1447
+ }
1448
+ declare function isWalletRequiredError(error: unknown): error is WalletRequiredError;
1449
+
1381
1450
  /**
1382
1451
  * Platform compatibility check utilities
1383
1452
  * Detects PRF extension support and provides guidance for cross-device authentication
@@ -1702,4 +1771,4 @@ declare function useEIP6963(): UseEIP6963Return;
1702
1771
  */
1703
1772
  declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
1704
1773
 
1705
- export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OnSignRequest, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
1774
+ export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OidcExchangeResult, type OnSignRequest, type OnWalletRequired, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SetSessionParams, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletRequiredAction, WalletRequiredError, type WalletRequiredRequest, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };