@volr/react 0.1.99 → 0.1.101

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,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, TypedDataInput, PasskeyProviderPort } from '@volr/sdk-core';
3
+ import { KeyStorageType as KeyStorageType$1, TypedDataInput, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort } from '@volr/sdk-core';
4
4
  export { AuthorizationTuple, Call, MpcTransport, PrecheckInput, PrecheckQuote, PrfInput, RelayInput, RelayMode, RelayResult, SessionAuth, UploadBlobOptions, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
5
5
  import { Address, Abi, PublicClient } from 'viem';
6
6
 
@@ -114,9 +114,8 @@ interface UserDto {
114
114
  projectId: string;
115
115
  projectName: string;
116
116
  email: string;
117
- accountId?: string;
117
+ authWallet?: string;
118
118
  evmAddress?: `0x${string}`;
119
- authWalletAddress?: string;
120
119
  keyStorageType?: KeyStorageType$1;
121
120
  signerType?: 'passkey' | 'external_wallet' | 'mpc';
122
121
  walletConnector?: string;
@@ -175,6 +174,22 @@ interface ApiResponse<T> {
175
174
 
176
175
  type KeyStorageType = "passkey" | "mpc";
177
176
  type SignerType = "passkey" | "external_wallet" | "mpc";
177
+ /**
178
+ * Sign request types for confirmation modal
179
+ */
180
+ type SignRequest = {
181
+ type: "message";
182
+ message: string | Uint8Array;
183
+ } | {
184
+ type: "typedData";
185
+ typedData: TypedDataInput;
186
+ };
187
+ /**
188
+ * Callback for sign request confirmation
189
+ * Called before signing to allow UI to show confirmation modal
190
+ * Resolve to proceed, reject to cancel
191
+ */
192
+ type OnSignRequest = (request: SignRequest) => Promise<void>;
178
193
 
179
194
  /**
180
195
  * ERC-20 token configuration
@@ -206,9 +221,8 @@ interface VolrUser {
206
221
  projectId?: string;
207
222
  projectName?: string;
208
223
  email?: string;
209
- accountId?: string;
224
+ authWallet?: string;
210
225
  evmAddress?: `0x${string}`;
211
- authWalletAddress?: string;
212
226
  keyStorageType?: KeyStorageType;
213
227
  signerType?: SignerType;
214
228
  walletConnector?: string;
@@ -232,6 +246,13 @@ type VolrConfig = {
232
246
  * Deposit/Topup configuration for multi-chain, multi-token support
233
247
  */
234
248
  deposit?: DepositConfig;
249
+ /**
250
+ * Callback for sign request confirmation.
251
+ * If provided, this callback is called before signing to allow UI to show confirmation modal.
252
+ * The callback should resolve to proceed with signing, or reject to cancel.
253
+ * Used by @volr/react-ui to show sign confirmation modal.
254
+ */
255
+ onSignRequest?: OnSignRequest;
235
256
  };
236
257
  /**
237
258
  * Public context value
@@ -376,7 +397,7 @@ type SendBatchOverloads = {
376
397
  * const calls: Call[] = [
377
398
  * { target: '0x...', data: '0x...', value: 0n, gasLimit: 100000n }
378
399
  * ];
379
- * await evm(chainId).sendBatch(calls);
400
+ * await evm.client(chainId).sendBatch(calls);
380
401
  * ```
381
402
  */
382
403
  (calls: Call[], opts?: SendTxOptions & {
@@ -388,7 +409,7 @@ type SendBatchOverloads = {
388
409
  * @param opts - Optional transaction options including expiresInSec, from
389
410
  * @example
390
411
  * ```ts
391
- * await evm(chainId).sendBatch([
412
+ * await evm.client(chainId).sendBatch([
392
413
  * {
393
414
  * target: tokenAddress,
394
415
  * abi: erc20Abi,
@@ -404,14 +425,14 @@ type SendBatchOverloads = {
404
425
  }): Promise<RelayResult>;
405
426
  };
406
427
  /**
407
- * EVM client interface
428
+ * EVM chain client interface (chain-specific operations)
408
429
  */
409
- type EvmClient = {
430
+ type EvmChainClient = {
410
431
  /**
411
432
  * Get native token balance for an address
412
433
  * @example
413
434
  * ```ts
414
- * const balance = await evm(1).getBalance('0x...');
435
+ * const balance = await evm.client(1).getBalance('0x...');
415
436
  * // Returns bigint (in wei)
416
437
  * ```
417
438
  */
@@ -420,7 +441,7 @@ type EvmClient = {
420
441
  * Read data from a smart contract
421
442
  * @example
422
443
  * ```ts
423
- * const balance = await evm(1).readContract({
444
+ * const balance = await evm.client(1).readContract({
424
445
  * address: tokenAddress,
425
446
  * abi: erc20Abi,
426
447
  * functionName: 'balanceOf',
@@ -436,7 +457,7 @@ type EvmClient = {
436
457
  * Send a single transaction
437
458
  * @example
438
459
  * ```ts
439
- * const result = await evm(1).sendTransaction(
460
+ * const result = await evm.client(1).sendTransaction(
440
461
  * { to: '0x...', data: '0x...' },
441
462
  * );
442
463
  * ```
@@ -451,25 +472,37 @@ type EvmClient = {
451
472
  * Send a batch of transactions
452
473
  */
453
474
  sendBatch: SendBatchOverloads;
475
+ };
476
+ /**
477
+ * EVM namespace interface (chain-agnostic operations)
478
+ */
479
+ type EvmNamespace = {
480
+ /**
481
+ * User's EVM wallet address
482
+ * undefined if not logged in
483
+ */
484
+ address: `0x${string}` | undefined;
454
485
  /**
455
486
  * Sign a message (EIP-191 personal_sign)
487
+ * This is chain-agnostic - uses the same private key regardless of chain
456
488
  * @param message - String or bytes to sign
457
489
  * @returns Signature hex string
458
490
  * @example
459
491
  * ```ts
460
- * const signature = await evm(1).signMessage('Hello, World!');
492
+ * const signature = await evm.signMessage('Hello, World!');
461
493
  * // or with raw bytes
462
- * const signature = await evm(1).signMessage(new Uint8Array([1, 2, 3]));
494
+ * const signature = await evm.signMessage(new Uint8Array([1, 2, 3]));
463
495
  * ```
464
496
  */
465
497
  signMessage: (message: string | Uint8Array) => Promise<`0x${string}`>;
466
498
  /**
467
499
  * Sign EIP-712 typed data
500
+ * This is chain-agnostic - uses the same private key regardless of chain
468
501
  * @param typedData - Typed data with domain, types, and message
469
502
  * @returns Signature hex string
470
503
  * @example
471
504
  * ```ts
472
- * const signature = await evm(1).signTypedData({
505
+ * const signature = await evm.signTypedData({
473
506
  * domain: {
474
507
  * name: 'MyApp',
475
508
  * version: '1',
@@ -484,19 +517,30 @@ type EvmClient = {
484
517
  * ```
485
518
  */
486
519
  signTypedData: (typedData: TypedDataInput) => Promise<`0x${string}`>;
520
+ /**
521
+ * Get chain-specific client for operations that require a chain
522
+ * @param chainId - The chain ID to operate on
523
+ * @returns EVM chain client with readContract, sendTransaction, sendBatch
524
+ * @example
525
+ * ```ts
526
+ * const client = evm.client(1); // Ethereum mainnet
527
+ * const balance = await client.getBalance('0x...');
528
+ * ```
529
+ */
530
+ client: (chainId: number) => EvmChainClient;
487
531
  };
532
+ type EvmClient = EvmChainClient;
488
533
  /**
489
534
  * Volr client interface
490
535
  */
491
536
  type VolrClient = {
492
537
  /**
493
- * Get EVM client for a specific chain
494
- * @param chainId - The chain ID to operate on
495
- * @returns EVM client with readContract, sendTransaction, sendBatch
538
+ * EVM namespace with address, signing methods, and chain client
496
539
  */
497
- evm: (chainId: number) => EvmClient;
540
+ evm: EvmNamespace;
498
541
  /**
499
542
  * User's EVM wallet address
543
+ * @deprecated Use evm.address instead
500
544
  */
501
545
  evmAddress: `0x${string}` | undefined;
502
546
  /**
@@ -1305,4 +1349,4 @@ declare function getUserCredentials(client: APIClient): Promise<Array<{
1305
1349
  createdAt: string;
1306
1350
  }>>;
1307
1351
 
1308
- export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmClient, 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 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 PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi };
1352
+ export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, 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 PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, TypedDataInput, PasskeyProviderPort } from '@volr/sdk-core';
3
+ import { KeyStorageType as KeyStorageType$1, TypedDataInput, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort } from '@volr/sdk-core';
4
4
  export { AuthorizationTuple, Call, MpcTransport, PrecheckInput, PrecheckQuote, PrfInput, RelayInput, RelayMode, RelayResult, SessionAuth, UploadBlobOptions, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
5
5
  import { Address, Abi, PublicClient } from 'viem';
6
6
 
@@ -114,9 +114,8 @@ interface UserDto {
114
114
  projectId: string;
115
115
  projectName: string;
116
116
  email: string;
117
- accountId?: string;
117
+ authWallet?: string;
118
118
  evmAddress?: `0x${string}`;
119
- authWalletAddress?: string;
120
119
  keyStorageType?: KeyStorageType$1;
121
120
  signerType?: 'passkey' | 'external_wallet' | 'mpc';
122
121
  walletConnector?: string;
@@ -175,6 +174,22 @@ interface ApiResponse<T> {
175
174
 
176
175
  type KeyStorageType = "passkey" | "mpc";
177
176
  type SignerType = "passkey" | "external_wallet" | "mpc";
177
+ /**
178
+ * Sign request types for confirmation modal
179
+ */
180
+ type SignRequest = {
181
+ type: "message";
182
+ message: string | Uint8Array;
183
+ } | {
184
+ type: "typedData";
185
+ typedData: TypedDataInput;
186
+ };
187
+ /**
188
+ * Callback for sign request confirmation
189
+ * Called before signing to allow UI to show confirmation modal
190
+ * Resolve to proceed, reject to cancel
191
+ */
192
+ type OnSignRequest = (request: SignRequest) => Promise<void>;
178
193
 
179
194
  /**
180
195
  * ERC-20 token configuration
@@ -206,9 +221,8 @@ interface VolrUser {
206
221
  projectId?: string;
207
222
  projectName?: string;
208
223
  email?: string;
209
- accountId?: string;
224
+ authWallet?: string;
210
225
  evmAddress?: `0x${string}`;
211
- authWalletAddress?: string;
212
226
  keyStorageType?: KeyStorageType;
213
227
  signerType?: SignerType;
214
228
  walletConnector?: string;
@@ -232,6 +246,13 @@ type VolrConfig = {
232
246
  * Deposit/Topup configuration for multi-chain, multi-token support
233
247
  */
234
248
  deposit?: DepositConfig;
249
+ /**
250
+ * Callback for sign request confirmation.
251
+ * If provided, this callback is called before signing to allow UI to show confirmation modal.
252
+ * The callback should resolve to proceed with signing, or reject to cancel.
253
+ * Used by @volr/react-ui to show sign confirmation modal.
254
+ */
255
+ onSignRequest?: OnSignRequest;
235
256
  };
236
257
  /**
237
258
  * Public context value
@@ -376,7 +397,7 @@ type SendBatchOverloads = {
376
397
  * const calls: Call[] = [
377
398
  * { target: '0x...', data: '0x...', value: 0n, gasLimit: 100000n }
378
399
  * ];
379
- * await evm(chainId).sendBatch(calls);
400
+ * await evm.client(chainId).sendBatch(calls);
380
401
  * ```
381
402
  */
382
403
  (calls: Call[], opts?: SendTxOptions & {
@@ -388,7 +409,7 @@ type SendBatchOverloads = {
388
409
  * @param opts - Optional transaction options including expiresInSec, from
389
410
  * @example
390
411
  * ```ts
391
- * await evm(chainId).sendBatch([
412
+ * await evm.client(chainId).sendBatch([
392
413
  * {
393
414
  * target: tokenAddress,
394
415
  * abi: erc20Abi,
@@ -404,14 +425,14 @@ type SendBatchOverloads = {
404
425
  }): Promise<RelayResult>;
405
426
  };
406
427
  /**
407
- * EVM client interface
428
+ * EVM chain client interface (chain-specific operations)
408
429
  */
409
- type EvmClient = {
430
+ type EvmChainClient = {
410
431
  /**
411
432
  * Get native token balance for an address
412
433
  * @example
413
434
  * ```ts
414
- * const balance = await evm(1).getBalance('0x...');
435
+ * const balance = await evm.client(1).getBalance('0x...');
415
436
  * // Returns bigint (in wei)
416
437
  * ```
417
438
  */
@@ -420,7 +441,7 @@ type EvmClient = {
420
441
  * Read data from a smart contract
421
442
  * @example
422
443
  * ```ts
423
- * const balance = await evm(1).readContract({
444
+ * const balance = await evm.client(1).readContract({
424
445
  * address: tokenAddress,
425
446
  * abi: erc20Abi,
426
447
  * functionName: 'balanceOf',
@@ -436,7 +457,7 @@ type EvmClient = {
436
457
  * Send a single transaction
437
458
  * @example
438
459
  * ```ts
439
- * const result = await evm(1).sendTransaction(
460
+ * const result = await evm.client(1).sendTransaction(
440
461
  * { to: '0x...', data: '0x...' },
441
462
  * );
442
463
  * ```
@@ -451,25 +472,37 @@ type EvmClient = {
451
472
  * Send a batch of transactions
452
473
  */
453
474
  sendBatch: SendBatchOverloads;
475
+ };
476
+ /**
477
+ * EVM namespace interface (chain-agnostic operations)
478
+ */
479
+ type EvmNamespace = {
480
+ /**
481
+ * User's EVM wallet address
482
+ * undefined if not logged in
483
+ */
484
+ address: `0x${string}` | undefined;
454
485
  /**
455
486
  * Sign a message (EIP-191 personal_sign)
487
+ * This is chain-agnostic - uses the same private key regardless of chain
456
488
  * @param message - String or bytes to sign
457
489
  * @returns Signature hex string
458
490
  * @example
459
491
  * ```ts
460
- * const signature = await evm(1).signMessage('Hello, World!');
492
+ * const signature = await evm.signMessage('Hello, World!');
461
493
  * // or with raw bytes
462
- * const signature = await evm(1).signMessage(new Uint8Array([1, 2, 3]));
494
+ * const signature = await evm.signMessage(new Uint8Array([1, 2, 3]));
463
495
  * ```
464
496
  */
465
497
  signMessage: (message: string | Uint8Array) => Promise<`0x${string}`>;
466
498
  /**
467
499
  * Sign EIP-712 typed data
500
+ * This is chain-agnostic - uses the same private key regardless of chain
468
501
  * @param typedData - Typed data with domain, types, and message
469
502
  * @returns Signature hex string
470
503
  * @example
471
504
  * ```ts
472
- * const signature = await evm(1).signTypedData({
505
+ * const signature = await evm.signTypedData({
473
506
  * domain: {
474
507
  * name: 'MyApp',
475
508
  * version: '1',
@@ -484,19 +517,30 @@ type EvmClient = {
484
517
  * ```
485
518
  */
486
519
  signTypedData: (typedData: TypedDataInput) => Promise<`0x${string}`>;
520
+ /**
521
+ * Get chain-specific client for operations that require a chain
522
+ * @param chainId - The chain ID to operate on
523
+ * @returns EVM chain client with readContract, sendTransaction, sendBatch
524
+ * @example
525
+ * ```ts
526
+ * const client = evm.client(1); // Ethereum mainnet
527
+ * const balance = await client.getBalance('0x...');
528
+ * ```
529
+ */
530
+ client: (chainId: number) => EvmChainClient;
487
531
  };
532
+ type EvmClient = EvmChainClient;
488
533
  /**
489
534
  * Volr client interface
490
535
  */
491
536
  type VolrClient = {
492
537
  /**
493
- * Get EVM client for a specific chain
494
- * @param chainId - The chain ID to operate on
495
- * @returns EVM client with readContract, sendTransaction, sendBatch
538
+ * EVM namespace with address, signing methods, and chain client
496
539
  */
497
- evm: (chainId: number) => EvmClient;
540
+ evm: EvmNamespace;
498
541
  /**
499
542
  * User's EVM wallet address
543
+ * @deprecated Use evm.address instead
500
544
  */
501
545
  evmAddress: `0x${string}` | undefined;
502
546
  /**
@@ -1305,4 +1349,4 @@ declare function getUserCredentials(client: APIClient): Promise<Array<{
1305
1349
  createdAt: string;
1306
1350
  }>>;
1307
1351
 
1308
- export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmClient, 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 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 PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi };
1352
+ export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, 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 PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi };
package/dist/index.js CHANGED
@@ -18508,12 +18508,54 @@ function useVolr() {
18508
18508
  const { user, config, provider, setProvider, logout, isLoading, error } = useVolrContext();
18509
18509
  const { precheck } = usePrecheck();
18510
18510
  const { relay } = useRelay();
18511
- const { client } = useInternalAuth();
18511
+ const { client: apiClient } = useInternalAuth();
18512
18512
  const getRpcUrl = useCallback(
18513
- createGetRpcUrl({ client, rpcOverrides: config.rpcOverrides }),
18514
- [client, config.rpcOverrides]
18513
+ createGetRpcUrl({ client: apiClient, rpcOverrides: config.rpcOverrides }),
18514
+ [apiClient, config.rpcOverrides]
18515
+ );
18516
+ const signMessage = useCallback(
18517
+ async (message) => {
18518
+ if (!provider) {
18519
+ throw new Error(
18520
+ "No wallet provider available. Please log in with a Passkey or MPC wallet to sign messages."
18521
+ );
18522
+ }
18523
+ if (config.onSignRequest) {
18524
+ await config.onSignRequest({ type: "message", message });
18525
+ }
18526
+ await provider.ensureSession({ interactive: true });
18527
+ const messageHash = hashMessage(
18528
+ typeof message === "string" ? message : { raw: message }
18529
+ );
18530
+ const hashBytes = new Uint8Array(32);
18531
+ const hex = messageHash.slice(2);
18532
+ for (let i = 0; i < 32; i++) {
18533
+ hashBytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
18534
+ }
18535
+ const sig = await provider.signMessage(hashBytes);
18536
+ const v = sig.yParity + 27;
18537
+ const rHex = Array.from(sig.r).map((b) => b.toString(16).padStart(2, "0")).join("");
18538
+ const sHex = Array.from(sig.s).map((b) => b.toString(16).padStart(2, "0")).join("");
18539
+ const vHex = v.toString(16).padStart(2, "0");
18540
+ return `0x${rHex}${sHex}${vHex}`;
18541
+ },
18542
+ [provider, config.onSignRequest]
18543
+ );
18544
+ const signTypedData = useCallback(
18545
+ async (typedData) => {
18546
+ if (!provider) {
18547
+ throw new Error(
18548
+ "No wallet provider available. Please log in with a Passkey or MPC wallet to sign typed data."
18549
+ );
18550
+ }
18551
+ if (config.onSignRequest) {
18552
+ await config.onSignRequest({ type: "typedData", typedData });
18553
+ }
18554
+ return provider.signTypedData(typedData);
18555
+ },
18556
+ [provider, config.onSignRequest]
18515
18557
  );
18516
- const evm = useCallback(
18558
+ const createChainClient = useCallback(
18517
18559
  (chainId) => {
18518
18560
  if (chainId === 0) {
18519
18561
  throw new Error("chainId cannot be 0");
@@ -18532,12 +18574,12 @@ function useVolr() {
18532
18574
  };
18533
18575
  return {
18534
18576
  getBalance: async (address) => {
18535
- const { publicClient: client2 } = await ensureRpcClient();
18536
- return client2.getBalance({ address });
18577
+ const { publicClient: client } = await ensureRpcClient();
18578
+ return client.getBalance({ address });
18537
18579
  },
18538
18580
  readContract: async (args) => {
18539
- const { publicClient: client2 } = await ensureRpcClient();
18540
- return client2.readContract(args);
18581
+ const { publicClient: client } = await ensureRpcClient();
18582
+ return client.readContract(args);
18541
18583
  },
18542
18584
  sendTransaction: async (tx, opts = {}) => {
18543
18585
  const { publicClient: publicClient2, extendedRpcClient: rpcClient } = await ensureRpcClient();
@@ -18563,7 +18605,7 @@ function useVolr() {
18563
18605
  rpcClient,
18564
18606
  precheck,
18565
18607
  relay,
18566
- client,
18608
+ client: apiClient,
18567
18609
  user: user ?? null,
18568
18610
  provider: provider ?? null,
18569
18611
  setProvider
@@ -18597,50 +18639,30 @@ function useVolr() {
18597
18639
  rpcClient,
18598
18640
  precheck,
18599
18641
  relay,
18600
- client,
18642
+ client: apiClient,
18601
18643
  user: user ?? null,
18602
18644
  provider: provider ?? null,
18603
18645
  setProvider
18604
18646
  }
18605
18647
  });
18606
- }),
18607
- signMessage: async (message) => {
18608
- if (!provider) {
18609
- throw new Error(
18610
- "No wallet provider available. Please log in with a Passkey or MPC wallet to sign messages."
18611
- );
18612
- }
18613
- await provider.ensureSession({ interactive: true });
18614
- const messageHash = hashMessage(
18615
- typeof message === "string" ? message : { raw: message }
18616
- );
18617
- const hashBytes = new Uint8Array(32);
18618
- const hex = messageHash.slice(2);
18619
- for (let i = 0; i < 32; i++) {
18620
- hashBytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
18621
- }
18622
- const sig = await provider.signMessage(hashBytes);
18623
- const v = sig.yParity + 27;
18624
- const rHex = Array.from(sig.r).map((b) => b.toString(16).padStart(2, "0")).join("");
18625
- const sHex = Array.from(sig.s).map((b) => b.toString(16).padStart(2, "0")).join("");
18626
- const vHex = v.toString(16).padStart(2, "0");
18627
- return `0x${rHex}${sHex}${vHex}`;
18628
- },
18629
- signTypedData: async (typedData) => {
18630
- if (!provider) {
18631
- throw new Error(
18632
- "No wallet provider available. Please log in with a Passkey or MPC wallet to sign typed data."
18633
- );
18634
- }
18635
- return provider.signTypedData(typedData);
18636
- }
18648
+ })
18637
18649
  };
18638
18650
  },
18639
- [user, config, provider, precheck, relay, getRpcUrl, setProvider, client]
18651
+ [user, provider, precheck, relay, getRpcUrl, setProvider, apiClient]
18652
+ );
18653
+ const evm = useMemo(
18654
+ () => ({
18655
+ address: user?.evmAddress,
18656
+ signMessage,
18657
+ signTypedData,
18658
+ client: createChainClient
18659
+ }),
18660
+ [user?.evmAddress, signMessage, signTypedData, createChainClient]
18640
18661
  );
18641
18662
  return {
18642
18663
  evm,
18643
18664
  evmAddress: user?.evmAddress,
18665
+ // deprecated, kept for backward compatibility
18644
18666
  email: user?.email,
18645
18667
  isLoggedIn: user !== null,
18646
18668
  signerType: user?.signerType,
@@ -18664,19 +18686,6 @@ function toChecksumAddress(address) {
18664
18686
  }
18665
18687
  return checksummed;
18666
18688
  }
18667
- function detectWalletConnector() {
18668
- if (typeof window === "undefined" || !window.ethereum) {
18669
- return void 0;
18670
- }
18671
- const provider = window.ethereum;
18672
- if (provider.info?.rdns) return provider.info.rdns;
18673
- if (provider.isMetaMask) return "io.metamask";
18674
- if (provider.isCoinbaseWallet) return "com.coinbase.wallet";
18675
- if (provider.isRabby) return "io.rabby";
18676
- if (provider.isZerion) return "io.zerion";
18677
- if (provider.isBraveWallet) return "com.brave.wallet";
18678
- return "unknown";
18679
- }
18680
18689
  function useVolrLogin() {
18681
18690
  const { config, setUser } = useVolrContext();
18682
18691
  const { setAccessToken, setRefreshToken, client } = useInternalAuth();
@@ -18686,9 +18695,8 @@ function useVolrLogin() {
18686
18695
  projectId: u.projectId,
18687
18696
  projectName: u.projectName,
18688
18697
  email: u.email,
18689
- accountId: u.accountId ?? void 0,
18698
+ authWallet: u.authWallet ?? void 0,
18690
18699
  evmAddress: u.evmAddress,
18691
- authWalletAddress: u.authWalletAddress ?? void 0,
18692
18700
  keyStorageType: u.keyStorageType ?? void 0,
18693
18701
  signerType: u.signerType ?? void 0,
18694
18702
  walletConnector: u.walletConnector ?? void 0,
@@ -18810,11 +18818,11 @@ function useVolrLogin() {
18810
18818
  [client, setAccessToken, setRefreshToken, setUser, toVolrUser]
18811
18819
  );
18812
18820
  const signWithWallet = useCallback(
18813
- async (walletAddress) => {
18814
- if (typeof window === "undefined" || !window.ethereum) {
18821
+ async (walletAddress, options) => {
18822
+ const ethereum = options?.provider ?? (typeof window !== "undefined" ? window.ethereum : null);
18823
+ if (!ethereum) {
18815
18824
  throw new Error("No Ethereum wallet found. Please install MetaMask or another wallet.");
18816
18825
  }
18817
- const ethereum = window.ethereum;
18818
18826
  const chainIdHex = await ethereum.request({ method: "eth_chainId" });
18819
18827
  const chainId = parseInt(chainIdHex, 16);
18820
18828
  const nonce = await requestSiweNonce();
@@ -18837,7 +18845,7 @@ Issued At: ${issuedAt}`;
18837
18845
  method: "personal_sign",
18838
18846
  params: [message, walletAddress]
18839
18847
  });
18840
- const walletConnector = detectWalletConnector();
18848
+ const walletConnector = options?.walletConnector ?? ethereum.info?.rdns ?? "unknown";
18841
18849
  return verifySiweSignature(message, signature, { walletConnector, chainId });
18842
18850
  },
18843
18851
  [requestSiweNonce, verifySiweSignature]
@@ -18904,7 +18912,7 @@ function useVolrAuthCallback(options = {}) {
18904
18912
  projectId: u.projectId,
18905
18913
  projectName: u.projectName,
18906
18914
  email: u.email,
18907
- accountId: u.accountId ?? void 0,
18915
+ authWallet: u.authWallet ?? void 0,
18908
18916
  evmAddress: u.evmAddress,
18909
18917
  keyStorageType: u.keyStorageType ?? void 0,
18910
18918
  signerType: u.signerType ?? void 0,