@volr/react 0.1.49 → 0.1.54
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 +91 -54
- package/dist/index.cjs +31 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -61
- package/dist/index.d.ts +61 -61
- package/dist/index.js +32 -21
- 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,75 @@ 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
|
+
* EVM namespace with address and chain client factory
|
|
441
|
+
*/
|
|
442
|
+
type EvmNamespace = ((chainId: number) => EvmClient) & {
|
|
443
|
+
/**
|
|
444
|
+
* User's EVM wallet address
|
|
445
|
+
*/
|
|
446
|
+
address: `0x${string}` | undefined;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Volr client interface
|
|
488
450
|
*/
|
|
489
|
-
type
|
|
451
|
+
type VolrClient = {
|
|
452
|
+
/**
|
|
453
|
+
* EVM namespace - get chain client or access address
|
|
454
|
+
* @example
|
|
455
|
+
* ```ts
|
|
456
|
+
* const address = evm.address;
|
|
457
|
+
* await evm(8453).sendBatch([...]);
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
evm: EvmNamespace;
|
|
461
|
+
/**
|
|
462
|
+
* User's email (if logged in with email)
|
|
463
|
+
*/
|
|
464
|
+
email: string | undefined;
|
|
465
|
+
/**
|
|
466
|
+
* Whether user is logged in
|
|
467
|
+
*/
|
|
468
|
+
isLoggedIn: boolean;
|
|
490
469
|
/**
|
|
491
|
-
*
|
|
492
|
-
* @param chainId - The chain ID to operate on
|
|
493
|
-
* @returns EVM client interface
|
|
470
|
+
* How the user signs transactions
|
|
494
471
|
*/
|
|
495
|
-
|
|
472
|
+
signerType: SignerType | undefined;
|
|
473
|
+
/**
|
|
474
|
+
* Logout the user
|
|
475
|
+
*/
|
|
476
|
+
logout: () => Promise<void>;
|
|
477
|
+
/**
|
|
478
|
+
* Whether SDK is loading
|
|
479
|
+
*/
|
|
480
|
+
isLoading: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Error if any
|
|
483
|
+
*/
|
|
484
|
+
error: Error | null;
|
|
496
485
|
};
|
|
497
486
|
/**
|
|
498
|
-
*
|
|
487
|
+
* useVolr hook - Main developer-facing hook
|
|
488
|
+
*/
|
|
489
|
+
declare function useVolr(): VolrClient;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* useVolrContext hook - Internal access to Volr context
|
|
493
|
+
* @internal This hook is for SDK internal use only. Use useVolr instead.
|
|
494
|
+
*/
|
|
495
|
+
/**
|
|
496
|
+
* Get full Volr context value (internal use only)
|
|
497
|
+
* @throws Error if used outside VolrProvider
|
|
498
|
+
* @internal
|
|
499
499
|
*/
|
|
500
|
-
declare function
|
|
500
|
+
declare function useVolrContext(): VolrContextValue;
|
|
501
501
|
|
|
502
502
|
/**
|
|
503
503
|
* useVolrLogin hook - Login handlers for various authentication methods
|
|
@@ -832,4 +832,4 @@ declare function debugTransactionFailure(publicClient: PublicClient, failingWall
|
|
|
832
832
|
analysis: string[];
|
|
833
833
|
}>;
|
|
834
834
|
|
|
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
|
|
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 EvmNamespace, 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,75 @@ 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
|
+
* EVM namespace with address and chain client factory
|
|
441
|
+
*/
|
|
442
|
+
type EvmNamespace = ((chainId: number) => EvmClient) & {
|
|
443
|
+
/**
|
|
444
|
+
* User's EVM wallet address
|
|
445
|
+
*/
|
|
446
|
+
address: `0x${string}` | undefined;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Volr client interface
|
|
488
450
|
*/
|
|
489
|
-
type
|
|
451
|
+
type VolrClient = {
|
|
452
|
+
/**
|
|
453
|
+
* EVM namespace - get chain client or access address
|
|
454
|
+
* @example
|
|
455
|
+
* ```ts
|
|
456
|
+
* const address = evm.address;
|
|
457
|
+
* await evm(8453).sendBatch([...]);
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
evm: EvmNamespace;
|
|
461
|
+
/**
|
|
462
|
+
* User's email (if logged in with email)
|
|
463
|
+
*/
|
|
464
|
+
email: string | undefined;
|
|
465
|
+
/**
|
|
466
|
+
* Whether user is logged in
|
|
467
|
+
*/
|
|
468
|
+
isLoggedIn: boolean;
|
|
490
469
|
/**
|
|
491
|
-
*
|
|
492
|
-
* @param chainId - The chain ID to operate on
|
|
493
|
-
* @returns EVM client interface
|
|
470
|
+
* How the user signs transactions
|
|
494
471
|
*/
|
|
495
|
-
|
|
472
|
+
signerType: SignerType | undefined;
|
|
473
|
+
/**
|
|
474
|
+
* Logout the user
|
|
475
|
+
*/
|
|
476
|
+
logout: () => Promise<void>;
|
|
477
|
+
/**
|
|
478
|
+
* Whether SDK is loading
|
|
479
|
+
*/
|
|
480
|
+
isLoading: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Error if any
|
|
483
|
+
*/
|
|
484
|
+
error: Error | null;
|
|
496
485
|
};
|
|
497
486
|
/**
|
|
498
|
-
*
|
|
487
|
+
* useVolr hook - Main developer-facing hook
|
|
488
|
+
*/
|
|
489
|
+
declare function useVolr(): VolrClient;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* useVolrContext hook - Internal access to Volr context
|
|
493
|
+
* @internal This hook is for SDK internal use only. Use useVolr instead.
|
|
494
|
+
*/
|
|
495
|
+
/**
|
|
496
|
+
* Get full Volr context value (internal use only)
|
|
497
|
+
* @throws Error if used outside VolrProvider
|
|
498
|
+
* @internal
|
|
499
499
|
*/
|
|
500
|
-
declare function
|
|
500
|
+
declare function useVolrContext(): VolrContextValue;
|
|
501
501
|
|
|
502
502
|
/**
|
|
503
503
|
* useVolrLogin hook - Login handlers for various authentication methods
|
|
@@ -832,4 +832,4 @@ declare function debugTransactionFailure(publicClient: PublicClient, failingWall
|
|
|
832
832
|
analysis: string[];
|
|
833
833
|
}>;
|
|
834
834
|
|
|
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
|
|
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 EvmNamespace, 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();
|
|
@@ -18369,7 +18369,7 @@ function useVolrWallet() {
|
|
|
18369
18369
|
createGetRpcUrl({ client, rpcOverrides: config.rpcOverrides }),
|
|
18370
18370
|
[client, config.rpcOverrides]
|
|
18371
18371
|
);
|
|
18372
|
-
const
|
|
18372
|
+
const evmFactory = useCallback(
|
|
18373
18373
|
(chainId) => {
|
|
18374
18374
|
if (chainId === 0) {
|
|
18375
18375
|
throw new Error("chainId cannot be 0");
|
|
@@ -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,23 @@ 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
|
-
|
|
18463
|
+
const evm = Object.assign(evmFactory, {
|
|
18464
|
+
address: user?.evmAddress
|
|
18465
|
+
});
|
|
18466
|
+
return {
|
|
18467
|
+
evm,
|
|
18468
|
+
email: user?.email,
|
|
18469
|
+
isLoggedIn: user !== null,
|
|
18470
|
+
signerType: user?.signerType,
|
|
18471
|
+
logout,
|
|
18472
|
+
isLoading,
|
|
18473
|
+
error
|
|
18474
|
+
};
|
|
18464
18475
|
}
|
|
18465
18476
|
function useVolrLogin() {
|
|
18466
|
-
const { config, setUser } =
|
|
18477
|
+
const { config, setUser } = useVolrContext();
|
|
18467
18478
|
const { setAccessToken, setRefreshToken, client } = useInternalAuth();
|
|
18468
18479
|
const toVolrUser = useCallback((u) => {
|
|
18469
18480
|
return {
|
|
@@ -18630,7 +18641,7 @@ function createAxiosInstance(baseUrl, apiKey) {
|
|
|
18630
18641
|
|
|
18631
18642
|
// src/hooks/useVolrAuthCallback.ts
|
|
18632
18643
|
function useVolrAuthCallback(options = {}) {
|
|
18633
|
-
const { config, setUser } =
|
|
18644
|
+
const { config, setUser } = useVolrContext();
|
|
18634
18645
|
const { refreshAccessToken, setAccessToken, setRefreshToken, client } = useInternalAuth();
|
|
18635
18646
|
const [isLoading, setIsLoading] = useState(true);
|
|
18636
18647
|
const [error, setError] = useState(null);
|
|
@@ -18755,7 +18766,7 @@ function balanceOfCalldata(address) {
|
|
|
18755
18766
|
return `${selector}${pad32(address).slice(2)}`;
|
|
18756
18767
|
}
|
|
18757
18768
|
function useDepositListener(input) {
|
|
18758
|
-
const { config } =
|
|
18769
|
+
const { config } = useVolrContext();
|
|
18759
18770
|
const { client } = useInternalAuth();
|
|
18760
18771
|
const [status, setStatus] = useState({ state: "idle" });
|
|
18761
18772
|
const intervalRef = useRef(null);
|
|
@@ -19009,7 +19020,7 @@ async function enrollPasskey(params) {
|
|
|
19009
19020
|
}
|
|
19010
19021
|
}
|
|
19011
19022
|
function usePasskeyEnrollment() {
|
|
19012
|
-
const { config, setProvider, setUser, user } =
|
|
19023
|
+
const { config, setProvider, setUser, user } = useVolrContext();
|
|
19013
19024
|
const { client } = useInternalAuth();
|
|
19014
19025
|
const [step, setStep] = useState("idle");
|
|
19015
19026
|
const [isEnrolling, setIsEnrolling] = useState(false);
|
|
@@ -19198,7 +19209,7 @@ async function registerWalletProvider(params) {
|
|
|
19198
19209
|
});
|
|
19199
19210
|
}
|
|
19200
19211
|
function useMpcConnection() {
|
|
19201
|
-
const { setProvider } =
|
|
19212
|
+
const { setProvider } = useVolrContext();
|
|
19202
19213
|
const { client } = useInternalAuth();
|
|
19203
19214
|
const [step, setStep] = useState("idle");
|
|
19204
19215
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
@@ -19491,6 +19502,6 @@ async function debugTransactionFailure(publicClient, failingWallet, workingWalle
|
|
|
19491
19502
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
19492
19503
|
*/
|
|
19493
19504
|
|
|
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,
|
|
19505
|
+
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
19506
|
//# sourceMappingURL=index.js.map
|
|
19496
19507
|
//# sourceMappingURL=index.js.map
|