@volr/react 0.1.8 → 0.1.10

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
@@ -2,7 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, SignerPort, ExtendedRPCClient, 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
- import { Address, Abi, PublicClient } from 'viem';
5
+ import { PublicClient } from './clients/createPublicClient.js';
6
+ import { Address, Abi } from '../abi.js';
6
7
 
7
8
  /**
8
9
  * API client with automatic token refresh
@@ -418,22 +419,56 @@ type SendBatchOverloads = {
418
419
  from?: `0x${string}`;
419
420
  }): Promise<RelayResult>;
420
421
  };
422
+ /**
423
+ * EVM chain operations interface
424
+ */
425
+ type EvmChainOperations = {
426
+ /**
427
+ * Read data from a smart contract
428
+ * @example
429
+ * ```ts
430
+ * const balance = await evm(1).readContract({
431
+ * address: tokenAddress,
432
+ * abi: erc20Abi,
433
+ * functionName: 'balanceOf',
434
+ * args: [userAddress],
435
+ * });
436
+ * ```
437
+ */
438
+ readContract: <TAbi extends readonly unknown[], TFunctionName extends string, TReturnType = Awaited<ReturnType<PublicClient['readContract']>>>(args: Parameters<PublicClient['readContract']>[0] & {
439
+ abi: TAbi;
440
+ functionName: TFunctionName;
441
+ }) => Promise<TReturnType>;
442
+ /**
443
+ * Send a single transaction
444
+ * @example
445
+ * ```ts
446
+ * const result = await evm(1).sendTransaction(
447
+ * { to: '0x...', data: '0x...', value: 0n },
448
+ * { policyId: '0x...' }
449
+ * );
450
+ * ```
451
+ */
452
+ sendTransaction: (tx: {
453
+ to: `0x${string}`;
454
+ data: `0x${string}`;
455
+ value?: bigint;
456
+ }, opts: SendTxOptions) => Promise<RelayResult>;
457
+ /**
458
+ * Send a batch of transactions
459
+ */
460
+ sendBatch: SendBatchOverloads;
461
+ };
421
462
  /**
422
463
  * useVolrWallet hook return type
423
464
  */
424
465
  type UseVolrWalletReturn = {
425
- evm: (chainId: number) => {
426
- readContract: <TAbi extends readonly unknown[], TFunctionName extends string, TReturnType = Awaited<ReturnType<PublicClient['readContract']>>>(args: Parameters<PublicClient['readContract']>[0] & {
427
- abi: TAbi;
428
- functionName: TFunctionName;
429
- }) => Promise<TReturnType>;
430
- sendTransaction: (tx: {
431
- to: `0x${string}`;
432
- data: `0x${string}`;
433
- value?: bigint;
434
- }, opts: SendTxOptions) => Promise<RelayResult>;
435
- sendBatch: SendBatchOverloads;
436
- };
466
+ /**
467
+ * Get EVM chain operations for a specific chain
468
+ * @param chainId - The chain ID to operate on
469
+ * @returns EVM chain operations interface
470
+ */
471
+ evm: (chainId: number) => EvmChainOperations;
437
472
  };
438
473
  /**
439
474
  * useVolrWallet hook - Developer-friendly facade
package/dist/index.d.ts CHANGED
@@ -2,7 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, SignerPort, ExtendedRPCClient, 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
- import { Address, Abi, PublicClient } from 'viem';
5
+ import { PublicClient } from './clients/createPublicClient.js';
6
+ import { Address, Abi } from '../abi.js';
6
7
 
7
8
  /**
8
9
  * API client with automatic token refresh
@@ -418,22 +419,56 @@ type SendBatchOverloads = {
418
419
  from?: `0x${string}`;
419
420
  }): Promise<RelayResult>;
420
421
  };
422
+ /**
423
+ * EVM chain operations interface
424
+ */
425
+ type EvmChainOperations = {
426
+ /**
427
+ * Read data from a smart contract
428
+ * @example
429
+ * ```ts
430
+ * const balance = await evm(1).readContract({
431
+ * address: tokenAddress,
432
+ * abi: erc20Abi,
433
+ * functionName: 'balanceOf',
434
+ * args: [userAddress],
435
+ * });
436
+ * ```
437
+ */
438
+ readContract: <TAbi extends readonly unknown[], TFunctionName extends string, TReturnType = Awaited<ReturnType<PublicClient['readContract']>>>(args: Parameters<PublicClient['readContract']>[0] & {
439
+ abi: TAbi;
440
+ functionName: TFunctionName;
441
+ }) => Promise<TReturnType>;
442
+ /**
443
+ * Send a single transaction
444
+ * @example
445
+ * ```ts
446
+ * const result = await evm(1).sendTransaction(
447
+ * { to: '0x...', data: '0x...', value: 0n },
448
+ * { policyId: '0x...' }
449
+ * );
450
+ * ```
451
+ */
452
+ sendTransaction: (tx: {
453
+ to: `0x${string}`;
454
+ data: `0x${string}`;
455
+ value?: bigint;
456
+ }, opts: SendTxOptions) => Promise<RelayResult>;
457
+ /**
458
+ * Send a batch of transactions
459
+ */
460
+ sendBatch: SendBatchOverloads;
461
+ };
421
462
  /**
422
463
  * useVolrWallet hook return type
423
464
  */
424
465
  type UseVolrWalletReturn = {
425
- evm: (chainId: number) => {
426
- readContract: <TAbi extends readonly unknown[], TFunctionName extends string, TReturnType = Awaited<ReturnType<PublicClient['readContract']>>>(args: Parameters<PublicClient['readContract']>[0] & {
427
- abi: TAbi;
428
- functionName: TFunctionName;
429
- }) => Promise<TReturnType>;
430
- sendTransaction: (tx: {
431
- to: `0x${string}`;
432
- data: `0x${string}`;
433
- value?: bigint;
434
- }, opts: SendTxOptions) => Promise<RelayResult>;
435
- sendBatch: SendBatchOverloads;
436
- };
466
+ /**
467
+ * Get EVM chain operations for a specific chain
468
+ * @param chainId - The chain ID to operate on
469
+ * @returns EVM chain operations interface
470
+ */
471
+ evm: (chainId: number) => EvmChainOperations;
437
472
  };
438
473
  /**
439
474
  * useVolrWallet hook - Developer-friendly facade