@volr/react 0.1.49 → 0.1.53
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 +86 -54
- package/dist/index.cjs +28 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -57
- package/dist/index.d.ts +49 -57
- package/dist/index.js +29 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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,
|
|
3
|
+
import { KeyStorageType as KeyStorageType$1, 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
|
|
|
@@ -270,53 +270,6 @@ type VolrProviderProps = {
|
|
|
270
270
|
*/
|
|
271
271
|
declare function VolrProvider({ config, children }: VolrProviderProps): react_jsx_runtime.JSX.Element;
|
|
272
272
|
|
|
273
|
-
/**
|
|
274
|
-
* useVolr hook - Access Volr context
|
|
275
|
-
*/
|
|
276
|
-
/**
|
|
277
|
-
* Get Volr context value
|
|
278
|
-
* @throws Error if used outside VolrProvider
|
|
279
|
-
*/
|
|
280
|
-
declare function useVolr(): VolrContextValue;
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* usePrecheck hook - Precheck transaction batch
|
|
284
|
-
*/
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* usePrecheck return type
|
|
288
|
-
*/
|
|
289
|
-
type UsePrecheckReturn = {
|
|
290
|
-
precheck: (input: PrecheckInput) => Promise<PrecheckQuote>;
|
|
291
|
-
isLoading: boolean;
|
|
292
|
-
error: Error | null;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* usePrecheck hook
|
|
296
|
-
*/
|
|
297
|
-
declare function usePrecheck(): UsePrecheckReturn;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* useRelay hook - Relay transaction batch
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* useRelay return type
|
|
305
|
-
*/
|
|
306
|
-
type UseRelayReturn = {
|
|
307
|
-
relay: (input: Omit<RelayInput, "sessionSig" | "authorizationList">, opts?: {
|
|
308
|
-
signer: SignerPort;
|
|
309
|
-
rpcClient?: ExtendedRPCClient;
|
|
310
|
-
idempotencyKey?: string;
|
|
311
|
-
}) => Promise<RelayResult>;
|
|
312
|
-
isLoading: boolean;
|
|
313
|
-
error: Error | null;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* useRelay hook
|
|
317
|
-
*/
|
|
318
|
-
declare function useRelay(): UseRelayReturn;
|
|
319
|
-
|
|
320
273
|
/**
|
|
321
274
|
* Call builder utilities for better developer experience
|
|
322
275
|
*/
|
|
@@ -400,7 +353,7 @@ type SendTxOptions = {
|
|
|
400
353
|
};
|
|
401
354
|
|
|
402
355
|
/**
|
|
403
|
-
*
|
|
356
|
+
* useVolr hook - Main developer-facing hook for Volr SDK
|
|
404
357
|
*/
|
|
405
358
|
|
|
406
359
|
/**
|
|
@@ -468,8 +421,7 @@ type EvmClient = {
|
|
|
468
421
|
* @example
|
|
469
422
|
* ```ts
|
|
470
423
|
* const result = await evm(1).sendTransaction(
|
|
471
|
-
* { to: '0x...', data: '0x...'
|
|
472
|
-
* { policyId: '0x...' }
|
|
424
|
+
* { to: '0x...', data: '0x...' },
|
|
473
425
|
* );
|
|
474
426
|
* ```
|
|
475
427
|
*/
|
|
@@ -477,27 +429,67 @@ type EvmClient = {
|
|
|
477
429
|
to: `0x${string}`;
|
|
478
430
|
data: `0x${string}`;
|
|
479
431
|
value?: bigint;
|
|
480
|
-
|
|
432
|
+
gasLimit?: bigint;
|
|
433
|
+
}, opts?: SendTxOptions) => Promise<RelayResult>;
|
|
481
434
|
/**
|
|
482
435
|
* Send a batch of transactions
|
|
483
436
|
*/
|
|
484
437
|
sendBatch: SendBatchOverloads;
|
|
485
438
|
};
|
|
486
439
|
/**
|
|
487
|
-
*
|
|
440
|
+
* Volr client interface
|
|
488
441
|
*/
|
|
489
|
-
type
|
|
442
|
+
type VolrClient = {
|
|
490
443
|
/**
|
|
491
444
|
* Get EVM client for a specific chain
|
|
492
445
|
* @param chainId - The chain ID to operate on
|
|
493
446
|
* @returns EVM client interface
|
|
494
447
|
*/
|
|
495
448
|
evm: (chainId: number) => EvmClient;
|
|
449
|
+
/**
|
|
450
|
+
* User's EVM wallet address
|
|
451
|
+
*/
|
|
452
|
+
address: `0x${string}` | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* User's email (if logged in with email)
|
|
455
|
+
*/
|
|
456
|
+
email: string | undefined;
|
|
457
|
+
/**
|
|
458
|
+
* Whether user is logged in
|
|
459
|
+
*/
|
|
460
|
+
isLoggedIn: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* How the user signs transactions
|
|
463
|
+
*/
|
|
464
|
+
signerType: SignerType | undefined;
|
|
465
|
+
/**
|
|
466
|
+
* Logout the user
|
|
467
|
+
*/
|
|
468
|
+
logout: () => Promise<void>;
|
|
469
|
+
/**
|
|
470
|
+
* Whether SDK is loading
|
|
471
|
+
*/
|
|
472
|
+
isLoading: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* Error if any
|
|
475
|
+
*/
|
|
476
|
+
error: Error | null;
|
|
496
477
|
};
|
|
497
478
|
/**
|
|
498
|
-
*
|
|
479
|
+
* useVolr hook - Main developer-facing hook
|
|
480
|
+
*/
|
|
481
|
+
declare function useVolr(): VolrClient;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* useVolrContext hook - Internal access to Volr context
|
|
485
|
+
* @internal This hook is for SDK internal use only. Use useVolr instead.
|
|
486
|
+
*/
|
|
487
|
+
/**
|
|
488
|
+
* Get full Volr context value (internal use only)
|
|
489
|
+
* @throws Error if used outside VolrProvider
|
|
490
|
+
* @internal
|
|
499
491
|
*/
|
|
500
|
-
declare function
|
|
492
|
+
declare function useVolrContext(): VolrContextValue;
|
|
501
493
|
|
|
502
494
|
/**
|
|
503
495
|
* useVolrLogin hook - Login handlers for various authentication methods
|
|
@@ -832,4 +824,4 @@ declare function debugTransactionFailure(publicClient: PublicClient, failingWall
|
|
|
832
824
|
analysis: string[];
|
|
833
825
|
}>;
|
|
834
826
|
|
|
835
|
-
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 MpcConnectionStep, type NetworkDto, type NetworkInfo, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, type PrfInputDto, type SendBatchOverloads, type SendTxOptions, type SignerType, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type
|
|
827
|
+
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 MpcConnectionStep, type NetworkDto, type NetworkInfo, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, type PrfInputDto, type SendBatchOverloads, type SendTxOptions, type SignerType, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, compareERC20Balances, compareWalletStates, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getWalletState, isEIP7702Delegated, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
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,
|
|
3
|
+
import { KeyStorageType as KeyStorageType$1, 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
|
|
|
@@ -270,53 +270,6 @@ type VolrProviderProps = {
|
|
|
270
270
|
*/
|
|
271
271
|
declare function VolrProvider({ config, children }: VolrProviderProps): react_jsx_runtime.JSX.Element;
|
|
272
272
|
|
|
273
|
-
/**
|
|
274
|
-
* useVolr hook - Access Volr context
|
|
275
|
-
*/
|
|
276
|
-
/**
|
|
277
|
-
* Get Volr context value
|
|
278
|
-
* @throws Error if used outside VolrProvider
|
|
279
|
-
*/
|
|
280
|
-
declare function useVolr(): VolrContextValue;
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* usePrecheck hook - Precheck transaction batch
|
|
284
|
-
*/
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* usePrecheck return type
|
|
288
|
-
*/
|
|
289
|
-
type UsePrecheckReturn = {
|
|
290
|
-
precheck: (input: PrecheckInput) => Promise<PrecheckQuote>;
|
|
291
|
-
isLoading: boolean;
|
|
292
|
-
error: Error | null;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* usePrecheck hook
|
|
296
|
-
*/
|
|
297
|
-
declare function usePrecheck(): UsePrecheckReturn;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* useRelay hook - Relay transaction batch
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* useRelay return type
|
|
305
|
-
*/
|
|
306
|
-
type UseRelayReturn = {
|
|
307
|
-
relay: (input: Omit<RelayInput, "sessionSig" | "authorizationList">, opts?: {
|
|
308
|
-
signer: SignerPort;
|
|
309
|
-
rpcClient?: ExtendedRPCClient;
|
|
310
|
-
idempotencyKey?: string;
|
|
311
|
-
}) => Promise<RelayResult>;
|
|
312
|
-
isLoading: boolean;
|
|
313
|
-
error: Error | null;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* useRelay hook
|
|
317
|
-
*/
|
|
318
|
-
declare function useRelay(): UseRelayReturn;
|
|
319
|
-
|
|
320
273
|
/**
|
|
321
274
|
* Call builder utilities for better developer experience
|
|
322
275
|
*/
|
|
@@ -400,7 +353,7 @@ type SendTxOptions = {
|
|
|
400
353
|
};
|
|
401
354
|
|
|
402
355
|
/**
|
|
403
|
-
*
|
|
356
|
+
* useVolr hook - Main developer-facing hook for Volr SDK
|
|
404
357
|
*/
|
|
405
358
|
|
|
406
359
|
/**
|
|
@@ -468,8 +421,7 @@ type EvmClient = {
|
|
|
468
421
|
* @example
|
|
469
422
|
* ```ts
|
|
470
423
|
* const result = await evm(1).sendTransaction(
|
|
471
|
-
* { to: '0x...', data: '0x...'
|
|
472
|
-
* { policyId: '0x...' }
|
|
424
|
+
* { to: '0x...', data: '0x...' },
|
|
473
425
|
* );
|
|
474
426
|
* ```
|
|
475
427
|
*/
|
|
@@ -477,27 +429,67 @@ type EvmClient = {
|
|
|
477
429
|
to: `0x${string}`;
|
|
478
430
|
data: `0x${string}`;
|
|
479
431
|
value?: bigint;
|
|
480
|
-
|
|
432
|
+
gasLimit?: bigint;
|
|
433
|
+
}, opts?: SendTxOptions) => Promise<RelayResult>;
|
|
481
434
|
/**
|
|
482
435
|
* Send a batch of transactions
|
|
483
436
|
*/
|
|
484
437
|
sendBatch: SendBatchOverloads;
|
|
485
438
|
};
|
|
486
439
|
/**
|
|
487
|
-
*
|
|
440
|
+
* Volr client interface
|
|
488
441
|
*/
|
|
489
|
-
type
|
|
442
|
+
type VolrClient = {
|
|
490
443
|
/**
|
|
491
444
|
* Get EVM client for a specific chain
|
|
492
445
|
* @param chainId - The chain ID to operate on
|
|
493
446
|
* @returns EVM client interface
|
|
494
447
|
*/
|
|
495
448
|
evm: (chainId: number) => EvmClient;
|
|
449
|
+
/**
|
|
450
|
+
* User's EVM wallet address
|
|
451
|
+
*/
|
|
452
|
+
address: `0x${string}` | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* User's email (if logged in with email)
|
|
455
|
+
*/
|
|
456
|
+
email: string | undefined;
|
|
457
|
+
/**
|
|
458
|
+
* Whether user is logged in
|
|
459
|
+
*/
|
|
460
|
+
isLoggedIn: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* How the user signs transactions
|
|
463
|
+
*/
|
|
464
|
+
signerType: SignerType | undefined;
|
|
465
|
+
/**
|
|
466
|
+
* Logout the user
|
|
467
|
+
*/
|
|
468
|
+
logout: () => Promise<void>;
|
|
469
|
+
/**
|
|
470
|
+
* Whether SDK is loading
|
|
471
|
+
*/
|
|
472
|
+
isLoading: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* Error if any
|
|
475
|
+
*/
|
|
476
|
+
error: Error | null;
|
|
496
477
|
};
|
|
497
478
|
/**
|
|
498
|
-
*
|
|
479
|
+
* useVolr hook - Main developer-facing hook
|
|
480
|
+
*/
|
|
481
|
+
declare function useVolr(): VolrClient;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* useVolrContext hook - Internal access to Volr context
|
|
485
|
+
* @internal This hook is for SDK internal use only. Use useVolr instead.
|
|
486
|
+
*/
|
|
487
|
+
/**
|
|
488
|
+
* Get full Volr context value (internal use only)
|
|
489
|
+
* @throws Error if used outside VolrProvider
|
|
490
|
+
* @internal
|
|
499
491
|
*/
|
|
500
|
-
declare function
|
|
492
|
+
declare function useVolrContext(): VolrContextValue;
|
|
501
493
|
|
|
502
494
|
/**
|
|
503
495
|
* useVolrLogin hook - Login handlers for various authentication methods
|
|
@@ -832,4 +824,4 @@ declare function debugTransactionFailure(publicClient: PublicClient, failingWall
|
|
|
832
824
|
analysis: string[];
|
|
833
825
|
}>;
|
|
834
826
|
|
|
835
|
-
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 MpcConnectionStep, type NetworkDto, type NetworkInfo, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, type PrfInputDto, type SendBatchOverloads, type SendTxOptions, type SignerType, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type
|
|
827
|
+
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 MpcConnectionStep, type NetworkDto, type NetworkInfo, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, type PrfInputDto, type SendBatchOverloads, type SendTxOptions, type SignerType, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, compareERC20Balances, compareWalletStates, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getWalletState, isEIP7702Delegated, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as nc from 'crypto';
|
|
2
2
|
import { createContext, useRef, useEffect, useMemo, useState, useCallback, useContext } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { createPasskeyProvider, createMpcProvider, signSession, getAuthNonce, signAuthorization, deriveWrapKey, createMasterKeyProvider, sealMasterSeed, uploadBlob, deriveEvmKey, ZERO_HASH, selectSigner, VolrError } from '@volr/sdk-core';
|
|
4
4
|
export { createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -10080,10 +10080,10 @@ function VolrProvider({ config, children }) {
|
|
|
10080
10080
|
);
|
|
10081
10081
|
return /* @__PURE__ */ jsx(VolrContext.Provider, { value: publicValue, children: /* @__PURE__ */ jsx(InternalAuthContext.Provider, { value: internalValue, children }) });
|
|
10082
10082
|
}
|
|
10083
|
-
function
|
|
10083
|
+
function useVolrContext() {
|
|
10084
10084
|
const context = useContext(VolrContext);
|
|
10085
10085
|
if (!context) {
|
|
10086
|
-
throw new Error("
|
|
10086
|
+
throw new Error("useVolrContext must be used within VolrProvider");
|
|
10087
10087
|
}
|
|
10088
10088
|
return context;
|
|
10089
10089
|
}
|
|
@@ -10165,7 +10165,7 @@ function validateRelayInput(input, config = {}) {
|
|
|
10165
10165
|
|
|
10166
10166
|
// src/hooks/usePrecheck.ts
|
|
10167
10167
|
function usePrecheck() {
|
|
10168
|
-
const { precheck: precheckContext } =
|
|
10168
|
+
const { precheck: precheckContext } = useVolrContext();
|
|
10169
10169
|
const [isLoading, setIsLoading] = useState(false);
|
|
10170
10170
|
const [error, setError] = useState(null);
|
|
10171
10171
|
const precheck = useCallback(
|
|
@@ -10199,7 +10199,7 @@ function useInternalAuth() {
|
|
|
10199
10199
|
return context;
|
|
10200
10200
|
}
|
|
10201
10201
|
function useRelay() {
|
|
10202
|
-
const { relay: relayContext } =
|
|
10202
|
+
const { relay: relayContext } = useVolrContext();
|
|
10203
10203
|
const { client } = useInternalAuth();
|
|
10204
10204
|
const [isLoading, setIsLoading] = useState(false);
|
|
10205
10205
|
const [error, setError] = useState(null);
|
|
@@ -10255,7 +10255,7 @@ function useRelay() {
|
|
|
10255
10255
|
authorizationList: [authorizationTuple]
|
|
10256
10256
|
};
|
|
10257
10257
|
validateRelayInput(relayInput);
|
|
10258
|
-
return
|
|
10258
|
+
return relayContext(relayInput, {
|
|
10259
10259
|
idempotencyKey: opts.idempotencyKey
|
|
10260
10260
|
});
|
|
10261
10261
|
} catch (err) {
|
|
@@ -18359,9 +18359,9 @@ async function sendCalls(args) {
|
|
|
18359
18359
|
}
|
|
18360
18360
|
}
|
|
18361
18361
|
|
|
18362
|
-
// src/hooks/
|
|
18363
|
-
function
|
|
18364
|
-
const { user, config, provider, setProvider } =
|
|
18362
|
+
// src/hooks/useVolr.ts
|
|
18363
|
+
function useVolr() {
|
|
18364
|
+
const { user, config, provider, setProvider, logout, isLoading, error } = useVolrContext();
|
|
18365
18365
|
const { precheck } = usePrecheck();
|
|
18366
18366
|
const { relay } = useRelay();
|
|
18367
18367
|
const { client } = useInternalAuth();
|
|
@@ -18391,12 +18391,12 @@ function useVolrWallet() {
|
|
|
18391
18391
|
const { publicClient: client2 } = await ensureRpcClient();
|
|
18392
18392
|
return client2.readContract(args);
|
|
18393
18393
|
},
|
|
18394
|
-
sendTransaction: async (tx, opts) => {
|
|
18394
|
+
sendTransaction: async (tx, opts = {}) => {
|
|
18395
18395
|
const { publicClient: publicClient2, extendedRpcClient: rpcClient } = await ensureRpcClient();
|
|
18396
18396
|
const from14 = opts.from ?? user?.evmAddress;
|
|
18397
18397
|
if (!from14) {
|
|
18398
18398
|
throw new Error(
|
|
18399
|
-
"from address is required. Provide it in opts.from or
|
|
18399
|
+
"from address is required. Provide it in opts.from or ensure user is logged in."
|
|
18400
18400
|
);
|
|
18401
18401
|
}
|
|
18402
18402
|
const call2 = {
|
|
@@ -18427,7 +18427,7 @@ function useVolrWallet() {
|
|
|
18427
18427
|
const from14 = opts.from ?? user?.evmAddress;
|
|
18428
18428
|
if (!from14) {
|
|
18429
18429
|
throw new Error(
|
|
18430
|
-
"from address is required. Provide it in opts.from or
|
|
18430
|
+
"from address is required. Provide it in opts.from or ensure user is logged in."
|
|
18431
18431
|
);
|
|
18432
18432
|
}
|
|
18433
18433
|
const isCallArray = (calls2) => {
|
|
@@ -18458,12 +18458,21 @@ function useVolrWallet() {
|
|
|
18458
18458
|
})
|
|
18459
18459
|
};
|
|
18460
18460
|
},
|
|
18461
|
-
[user, config, provider, precheck, relay, getRpcUrl]
|
|
18461
|
+
[user, config, provider, precheck, relay, getRpcUrl, setProvider, client]
|
|
18462
18462
|
);
|
|
18463
|
-
return {
|
|
18463
|
+
return {
|
|
18464
|
+
evm,
|
|
18465
|
+
address: user?.evmAddress,
|
|
18466
|
+
email: user?.email,
|
|
18467
|
+
isLoggedIn: user !== null,
|
|
18468
|
+
signerType: user?.signerType,
|
|
18469
|
+
logout,
|
|
18470
|
+
isLoading,
|
|
18471
|
+
error
|
|
18472
|
+
};
|
|
18464
18473
|
}
|
|
18465
18474
|
function useVolrLogin() {
|
|
18466
|
-
const { config, setUser } =
|
|
18475
|
+
const { config, setUser } = useVolrContext();
|
|
18467
18476
|
const { setAccessToken, setRefreshToken, client } = useInternalAuth();
|
|
18468
18477
|
const toVolrUser = useCallback((u) => {
|
|
18469
18478
|
return {
|
|
@@ -18630,7 +18639,7 @@ function createAxiosInstance(baseUrl, apiKey) {
|
|
|
18630
18639
|
|
|
18631
18640
|
// src/hooks/useVolrAuthCallback.ts
|
|
18632
18641
|
function useVolrAuthCallback(options = {}) {
|
|
18633
|
-
const { config, setUser } =
|
|
18642
|
+
const { config, setUser } = useVolrContext();
|
|
18634
18643
|
const { refreshAccessToken, setAccessToken, setRefreshToken, client } = useInternalAuth();
|
|
18635
18644
|
const [isLoading, setIsLoading] = useState(true);
|
|
18636
18645
|
const [error, setError] = useState(null);
|
|
@@ -18755,7 +18764,7 @@ function balanceOfCalldata(address) {
|
|
|
18755
18764
|
return `${selector}${pad32(address).slice(2)}`;
|
|
18756
18765
|
}
|
|
18757
18766
|
function useDepositListener(input) {
|
|
18758
|
-
const { config } =
|
|
18767
|
+
const { config } = useVolrContext();
|
|
18759
18768
|
const { client } = useInternalAuth();
|
|
18760
18769
|
const [status, setStatus] = useState({ state: "idle" });
|
|
18761
18770
|
const intervalRef = useRef(null);
|
|
@@ -19009,7 +19018,7 @@ async function enrollPasskey(params) {
|
|
|
19009
19018
|
}
|
|
19010
19019
|
}
|
|
19011
19020
|
function usePasskeyEnrollment() {
|
|
19012
|
-
const { config, setProvider, setUser, user } =
|
|
19021
|
+
const { config, setProvider, setUser, user } = useVolrContext();
|
|
19013
19022
|
const { client } = useInternalAuth();
|
|
19014
19023
|
const [step, setStep] = useState("idle");
|
|
19015
19024
|
const [isEnrolling, setIsEnrolling] = useState(false);
|
|
@@ -19198,7 +19207,7 @@ async function registerWalletProvider(params) {
|
|
|
19198
19207
|
});
|
|
19199
19208
|
}
|
|
19200
19209
|
function useMpcConnection() {
|
|
19201
|
-
const { setProvider } =
|
|
19210
|
+
const { setProvider } = useVolrContext();
|
|
19202
19211
|
const { client } = useInternalAuth();
|
|
19203
19212
|
const [step, setStep] = useState("idle");
|
|
19204
19213
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
@@ -19491,6 +19500,6 @@ async function debugTransactionFailure(publicClient, failingWallet, workingWalle
|
|
|
19491
19500
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
19492
19501
|
*/
|
|
19493
19502
|
|
|
19494
|
-
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, compareERC20Balances, compareWalletStates, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getWalletState, isEIP7702Delegated, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment,
|
|
19503
|
+
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, compareERC20Balances, compareWalletStates, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getWalletState, isEIP7702Delegated, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
|
19495
19504
|
//# sourceMappingURL=index.js.map
|
|
19496
19505
|
//# sourceMappingURL=index.js.map
|