@volr/react 0.1.20 → 0.1.22
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.cjs +567 -320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -6
- package/dist/index.d.ts +132 -6
- package/dist/index.js +560 -321
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -397,11 +397,6 @@ type SendTxOptions = {
|
|
|
397
397
|
* Sender address override. If not provided, uses user.evmAddress.
|
|
398
398
|
*/
|
|
399
399
|
from?: `0x${string}`;
|
|
400
|
-
/**
|
|
401
|
-
* Run best-effort RPC preflight (eth_estimateGas) before prompting passkey.
|
|
402
|
-
* Defaults to true.
|
|
403
|
-
*/
|
|
404
|
-
preflight?: boolean;
|
|
405
400
|
};
|
|
406
401
|
|
|
407
402
|
/**
|
|
@@ -709,4 +704,135 @@ declare function normalizeHex(value: `0x${string}` | string): `0x${string}`;
|
|
|
709
704
|
*/
|
|
710
705
|
declare function normalizeHexArray(values: (`0x${string}` | string)[]): `0x${string}`[];
|
|
711
706
|
|
|
712
|
-
|
|
707
|
+
/**
|
|
708
|
+
* Contract analysis utilities for debugging transaction failures
|
|
709
|
+
*
|
|
710
|
+
* These utilities help diagnose why a transaction might fail when executed
|
|
711
|
+
* through the Volr SDK with EIP-7702, but succeed with a regular wallet.
|
|
712
|
+
*/
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Check if an address has EIP-7702 delegation code
|
|
716
|
+
*/
|
|
717
|
+
declare function isEIP7702Delegated(publicClient: PublicClient, address: Address): Promise<boolean>;
|
|
718
|
+
/**
|
|
719
|
+
* Known patterns that may cause issues with EIP-7702
|
|
720
|
+
*/
|
|
721
|
+
interface ContractAnalysisResult {
|
|
722
|
+
/** Target contract address */
|
|
723
|
+
target: Address;
|
|
724
|
+
/** Whether the target has code (is a contract) */
|
|
725
|
+
isContract: boolean;
|
|
726
|
+
/** Code size in bytes */
|
|
727
|
+
codeSize: number;
|
|
728
|
+
/** Whether the contract might check msg.sender.code.length */
|
|
729
|
+
mayCheckSenderCode: boolean;
|
|
730
|
+
/** Whether the contract might use DelegationGuard pattern */
|
|
731
|
+
mayUseDelegationGuard: boolean;
|
|
732
|
+
/** Detected function selector */
|
|
733
|
+
functionSelector: string;
|
|
734
|
+
/** Analysis notes */
|
|
735
|
+
notes: string[];
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Analyze a target contract for potential EIP-7702 compatibility issues
|
|
739
|
+
*
|
|
740
|
+
* This is a heuristic analysis and may not catch all cases.
|
|
741
|
+
* For definitive analysis, review the contract source code.
|
|
742
|
+
*/
|
|
743
|
+
declare function analyzeContractForEIP7702(publicClient: PublicClient, target: Address, calldata?: `0x${string}`): Promise<ContractAnalysisResult>;
|
|
744
|
+
/**
|
|
745
|
+
* Diagnose potential issues with a transaction that fails
|
|
746
|
+
*
|
|
747
|
+
* @param publicClient - Viem public client
|
|
748
|
+
* @param from - Sender address (user EOA)
|
|
749
|
+
* @param target - Target contract address
|
|
750
|
+
* @param calldata - Transaction calldata
|
|
751
|
+
* @returns Diagnostic information
|
|
752
|
+
*/
|
|
753
|
+
declare function diagnoseTransactionFailure(publicClient: PublicClient, from: Address, target: Address, calldata: `0x${string}`): Promise<{
|
|
754
|
+
fromAnalysis: {
|
|
755
|
+
isDelegated: boolean;
|
|
756
|
+
hasCode: boolean;
|
|
757
|
+
};
|
|
758
|
+
targetAnalysis: ContractAnalysisResult;
|
|
759
|
+
recommendations: string[];
|
|
760
|
+
}>;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Wallet debugging utilities for comparing on-chain state
|
|
764
|
+
* between different wallet addresses
|
|
765
|
+
*/
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Wallet state comparison result
|
|
769
|
+
*/
|
|
770
|
+
interface WalletStateComparison {
|
|
771
|
+
address: Address;
|
|
772
|
+
ethBalance: string;
|
|
773
|
+
ethBalanceWei: bigint;
|
|
774
|
+
hasCode: boolean;
|
|
775
|
+
codeLength: number;
|
|
776
|
+
nonce: number;
|
|
777
|
+
isEIP7702Delegated: boolean;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* ERC20 balance comparison result
|
|
781
|
+
*/
|
|
782
|
+
interface ERC20BalanceComparison {
|
|
783
|
+
address: Address;
|
|
784
|
+
tokenAddress: Address;
|
|
785
|
+
balance: string;
|
|
786
|
+
balanceRaw: bigint;
|
|
787
|
+
decimals: number;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Get wallet state for comparison
|
|
791
|
+
*/
|
|
792
|
+
declare function getWalletState(publicClient: PublicClient, address: Address): Promise<WalletStateComparison>;
|
|
793
|
+
/**
|
|
794
|
+
* Get ERC20 balance for a wallet
|
|
795
|
+
*/
|
|
796
|
+
declare function getERC20Balance(publicClient: PublicClient, walletAddress: Address, tokenAddress: Address, decimals?: number): Promise<ERC20BalanceComparison>;
|
|
797
|
+
/**
|
|
798
|
+
* Compare two wallets' states
|
|
799
|
+
*/
|
|
800
|
+
declare function compareWalletStates(publicClient: PublicClient, address1: Address, address2: Address): Promise<{
|
|
801
|
+
wallet1: WalletStateComparison;
|
|
802
|
+
wallet2: WalletStateComparison;
|
|
803
|
+
differences: string[];
|
|
804
|
+
}>;
|
|
805
|
+
/**
|
|
806
|
+
* Compare ERC20 balances between two wallets
|
|
807
|
+
*/
|
|
808
|
+
declare function compareERC20Balances(publicClient: PublicClient, address1: Address, address2: Address, tokenAddress: Address, decimals?: number): Promise<{
|
|
809
|
+
wallet1: ERC20BalanceComparison;
|
|
810
|
+
wallet2: ERC20BalanceComparison;
|
|
811
|
+
difference: string;
|
|
812
|
+
differenceRaw: bigint;
|
|
813
|
+
}>;
|
|
814
|
+
/**
|
|
815
|
+
* Debug a transaction failure by comparing wallet states
|
|
816
|
+
*
|
|
817
|
+
* @param publicClient - Viem public client
|
|
818
|
+
* @param failingWallet - The wallet that fails through Volr
|
|
819
|
+
* @param workingWallet - A wallet that succeeds with the same transaction
|
|
820
|
+
* @param tokenAddress - Optional ERC20 token address to compare balances
|
|
821
|
+
* @param tokenDecimals - Token decimals (default 18)
|
|
822
|
+
*/
|
|
823
|
+
declare function debugTransactionFailure(publicClient: PublicClient, failingWallet: Address, workingWallet: Address, tokenAddress?: Address, tokenDecimals?: number): Promise<{
|
|
824
|
+
stateComparison: {
|
|
825
|
+
wallet1: WalletStateComparison;
|
|
826
|
+
wallet2: WalletStateComparison;
|
|
827
|
+
differences: string[];
|
|
828
|
+
};
|
|
829
|
+
tokenComparison?: {
|
|
830
|
+
wallet1: ERC20BalanceComparison;
|
|
831
|
+
wallet2: ERC20BalanceComparison;
|
|
832
|
+
difference: string;
|
|
833
|
+
differenceRaw: bigint;
|
|
834
|
+
};
|
|
835
|
+
analysis: string[];
|
|
836
|
+
}>;
|
|
837
|
+
|
|
838
|
+
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 EvmChainOperations, 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 UsePrecheckReturn, type UseRelayReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrWalletReturn, type UserDto, 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, usePrecheck, useRelay, useVolr, useVolrAuthCallback, useVolrLogin, useVolrWallet };
|
package/dist/index.d.ts
CHANGED
|
@@ -397,11 +397,6 @@ type SendTxOptions = {
|
|
|
397
397
|
* Sender address override. If not provided, uses user.evmAddress.
|
|
398
398
|
*/
|
|
399
399
|
from?: `0x${string}`;
|
|
400
|
-
/**
|
|
401
|
-
* Run best-effort RPC preflight (eth_estimateGas) before prompting passkey.
|
|
402
|
-
* Defaults to true.
|
|
403
|
-
*/
|
|
404
|
-
preflight?: boolean;
|
|
405
400
|
};
|
|
406
401
|
|
|
407
402
|
/**
|
|
@@ -709,4 +704,135 @@ declare function normalizeHex(value: `0x${string}` | string): `0x${string}`;
|
|
|
709
704
|
*/
|
|
710
705
|
declare function normalizeHexArray(values: (`0x${string}` | string)[]): `0x${string}`[];
|
|
711
706
|
|
|
712
|
-
|
|
707
|
+
/**
|
|
708
|
+
* Contract analysis utilities for debugging transaction failures
|
|
709
|
+
*
|
|
710
|
+
* These utilities help diagnose why a transaction might fail when executed
|
|
711
|
+
* through the Volr SDK with EIP-7702, but succeed with a regular wallet.
|
|
712
|
+
*/
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Check if an address has EIP-7702 delegation code
|
|
716
|
+
*/
|
|
717
|
+
declare function isEIP7702Delegated(publicClient: PublicClient, address: Address): Promise<boolean>;
|
|
718
|
+
/**
|
|
719
|
+
* Known patterns that may cause issues with EIP-7702
|
|
720
|
+
*/
|
|
721
|
+
interface ContractAnalysisResult {
|
|
722
|
+
/** Target contract address */
|
|
723
|
+
target: Address;
|
|
724
|
+
/** Whether the target has code (is a contract) */
|
|
725
|
+
isContract: boolean;
|
|
726
|
+
/** Code size in bytes */
|
|
727
|
+
codeSize: number;
|
|
728
|
+
/** Whether the contract might check msg.sender.code.length */
|
|
729
|
+
mayCheckSenderCode: boolean;
|
|
730
|
+
/** Whether the contract might use DelegationGuard pattern */
|
|
731
|
+
mayUseDelegationGuard: boolean;
|
|
732
|
+
/** Detected function selector */
|
|
733
|
+
functionSelector: string;
|
|
734
|
+
/** Analysis notes */
|
|
735
|
+
notes: string[];
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Analyze a target contract for potential EIP-7702 compatibility issues
|
|
739
|
+
*
|
|
740
|
+
* This is a heuristic analysis and may not catch all cases.
|
|
741
|
+
* For definitive analysis, review the contract source code.
|
|
742
|
+
*/
|
|
743
|
+
declare function analyzeContractForEIP7702(publicClient: PublicClient, target: Address, calldata?: `0x${string}`): Promise<ContractAnalysisResult>;
|
|
744
|
+
/**
|
|
745
|
+
* Diagnose potential issues with a transaction that fails
|
|
746
|
+
*
|
|
747
|
+
* @param publicClient - Viem public client
|
|
748
|
+
* @param from - Sender address (user EOA)
|
|
749
|
+
* @param target - Target contract address
|
|
750
|
+
* @param calldata - Transaction calldata
|
|
751
|
+
* @returns Diagnostic information
|
|
752
|
+
*/
|
|
753
|
+
declare function diagnoseTransactionFailure(publicClient: PublicClient, from: Address, target: Address, calldata: `0x${string}`): Promise<{
|
|
754
|
+
fromAnalysis: {
|
|
755
|
+
isDelegated: boolean;
|
|
756
|
+
hasCode: boolean;
|
|
757
|
+
};
|
|
758
|
+
targetAnalysis: ContractAnalysisResult;
|
|
759
|
+
recommendations: string[];
|
|
760
|
+
}>;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Wallet debugging utilities for comparing on-chain state
|
|
764
|
+
* between different wallet addresses
|
|
765
|
+
*/
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Wallet state comparison result
|
|
769
|
+
*/
|
|
770
|
+
interface WalletStateComparison {
|
|
771
|
+
address: Address;
|
|
772
|
+
ethBalance: string;
|
|
773
|
+
ethBalanceWei: bigint;
|
|
774
|
+
hasCode: boolean;
|
|
775
|
+
codeLength: number;
|
|
776
|
+
nonce: number;
|
|
777
|
+
isEIP7702Delegated: boolean;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* ERC20 balance comparison result
|
|
781
|
+
*/
|
|
782
|
+
interface ERC20BalanceComparison {
|
|
783
|
+
address: Address;
|
|
784
|
+
tokenAddress: Address;
|
|
785
|
+
balance: string;
|
|
786
|
+
balanceRaw: bigint;
|
|
787
|
+
decimals: number;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Get wallet state for comparison
|
|
791
|
+
*/
|
|
792
|
+
declare function getWalletState(publicClient: PublicClient, address: Address): Promise<WalletStateComparison>;
|
|
793
|
+
/**
|
|
794
|
+
* Get ERC20 balance for a wallet
|
|
795
|
+
*/
|
|
796
|
+
declare function getERC20Balance(publicClient: PublicClient, walletAddress: Address, tokenAddress: Address, decimals?: number): Promise<ERC20BalanceComparison>;
|
|
797
|
+
/**
|
|
798
|
+
* Compare two wallets' states
|
|
799
|
+
*/
|
|
800
|
+
declare function compareWalletStates(publicClient: PublicClient, address1: Address, address2: Address): Promise<{
|
|
801
|
+
wallet1: WalletStateComparison;
|
|
802
|
+
wallet2: WalletStateComparison;
|
|
803
|
+
differences: string[];
|
|
804
|
+
}>;
|
|
805
|
+
/**
|
|
806
|
+
* Compare ERC20 balances between two wallets
|
|
807
|
+
*/
|
|
808
|
+
declare function compareERC20Balances(publicClient: PublicClient, address1: Address, address2: Address, tokenAddress: Address, decimals?: number): Promise<{
|
|
809
|
+
wallet1: ERC20BalanceComparison;
|
|
810
|
+
wallet2: ERC20BalanceComparison;
|
|
811
|
+
difference: string;
|
|
812
|
+
differenceRaw: bigint;
|
|
813
|
+
}>;
|
|
814
|
+
/**
|
|
815
|
+
* Debug a transaction failure by comparing wallet states
|
|
816
|
+
*
|
|
817
|
+
* @param publicClient - Viem public client
|
|
818
|
+
* @param failingWallet - The wallet that fails through Volr
|
|
819
|
+
* @param workingWallet - A wallet that succeeds with the same transaction
|
|
820
|
+
* @param tokenAddress - Optional ERC20 token address to compare balances
|
|
821
|
+
* @param tokenDecimals - Token decimals (default 18)
|
|
822
|
+
*/
|
|
823
|
+
declare function debugTransactionFailure(publicClient: PublicClient, failingWallet: Address, workingWallet: Address, tokenAddress?: Address, tokenDecimals?: number): Promise<{
|
|
824
|
+
stateComparison: {
|
|
825
|
+
wallet1: WalletStateComparison;
|
|
826
|
+
wallet2: WalletStateComparison;
|
|
827
|
+
differences: string[];
|
|
828
|
+
};
|
|
829
|
+
tokenComparison?: {
|
|
830
|
+
wallet1: ERC20BalanceComparison;
|
|
831
|
+
wallet2: ERC20BalanceComparison;
|
|
832
|
+
difference: string;
|
|
833
|
+
differenceRaw: bigint;
|
|
834
|
+
};
|
|
835
|
+
analysis: string[];
|
|
836
|
+
}>;
|
|
837
|
+
|
|
838
|
+
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 EvmChainOperations, 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 UsePrecheckReturn, type UseRelayReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrWalletReturn, type UserDto, 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, usePrecheck, useRelay, useVolr, useVolrAuthCallback, useVolrLogin, useVolrWallet };
|