@volr/react 0.1.109 → 0.1.111
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 +550 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +163 -1
- package/dist/index.d.ts +163 -1
- package/dist/index.js +547 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -956,6 +956,107 @@ interface UseVolrPaymentApiReturn {
|
|
|
956
956
|
}
|
|
957
957
|
declare function useVolrPaymentApi(): UseVolrPaymentApiReturn;
|
|
958
958
|
|
|
959
|
+
/**
|
|
960
|
+
* useUserBalances hook - Fetch user's token balances for project deposit assets
|
|
961
|
+
*/
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Token balance with metadata
|
|
965
|
+
*/
|
|
966
|
+
interface TokenBalance {
|
|
967
|
+
/** Unique identifier: chainId_address or chainId_native */
|
|
968
|
+
id: string;
|
|
969
|
+
/** Chain ID */
|
|
970
|
+
chainId: number;
|
|
971
|
+
/** Token symbol */
|
|
972
|
+
symbol: string;
|
|
973
|
+
/** Token decimals */
|
|
974
|
+
decimals: number;
|
|
975
|
+
/** Token address (0x0 for native) */
|
|
976
|
+
address: string;
|
|
977
|
+
/** Token icon URL */
|
|
978
|
+
iconUrl?: string;
|
|
979
|
+
/** Whether this is native token */
|
|
980
|
+
isNative: boolean;
|
|
981
|
+
/** Raw balance in smallest unit */
|
|
982
|
+
balanceRaw: bigint;
|
|
983
|
+
/** Formatted balance string */
|
|
984
|
+
balance: string;
|
|
985
|
+
/** Token price in USD (from backend) */
|
|
986
|
+
priceUsd?: number;
|
|
987
|
+
/** USD value (balance * price) */
|
|
988
|
+
balanceUsd?: number;
|
|
989
|
+
/** Whether balance is loading */
|
|
990
|
+
isLoading: boolean;
|
|
991
|
+
/** Error if balance fetch failed */
|
|
992
|
+
error?: string;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Extended deposit asset with price info from API
|
|
996
|
+
*/
|
|
997
|
+
interface DepositAssetWithPrice extends DepositAsset$1 {
|
|
998
|
+
priceUsd?: number;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Branding data with payment enabled flag
|
|
1002
|
+
*/
|
|
1003
|
+
interface BrandingData {
|
|
1004
|
+
depositAssets: DepositAssetWithPrice[];
|
|
1005
|
+
paymentEnabled: boolean;
|
|
1006
|
+
}
|
|
1007
|
+
interface UseUserBalancesReturn {
|
|
1008
|
+
/** Array of token balances */
|
|
1009
|
+
balances: TokenBalance[];
|
|
1010
|
+
/** Total USD value of all balances */
|
|
1011
|
+
totalUsd: number;
|
|
1012
|
+
/** Whether any balance is loading */
|
|
1013
|
+
isLoading: boolean;
|
|
1014
|
+
/** Whether payment feature is enabled for this project */
|
|
1015
|
+
paymentEnabled: boolean;
|
|
1016
|
+
/** Refresh all balances */
|
|
1017
|
+
refresh: () => Promise<void>;
|
|
1018
|
+
/** Error if branding fetch failed */
|
|
1019
|
+
error: Error | null;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Hook to fetch user's token balances for project deposit assets
|
|
1023
|
+
*/
|
|
1024
|
+
declare function useUserBalances(): UseUserBalancesReturn;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* useWithdraw hook - Withdraw tokens to external address
|
|
1028
|
+
*/
|
|
1029
|
+
|
|
1030
|
+
interface WithdrawParams {
|
|
1031
|
+
/** Chain ID to withdraw from */
|
|
1032
|
+
chainId: number;
|
|
1033
|
+
/** Token address (use 'native' for native token) */
|
|
1034
|
+
tokenAddress: string;
|
|
1035
|
+
/** Token decimals */
|
|
1036
|
+
decimals: number;
|
|
1037
|
+
/** Amount to withdraw (human readable, e.g., "1.5") */
|
|
1038
|
+
amount: string;
|
|
1039
|
+
/** Destination address */
|
|
1040
|
+
to: `0x${string}`;
|
|
1041
|
+
}
|
|
1042
|
+
interface UseWithdrawReturn {
|
|
1043
|
+
/** Execute withdrawal */
|
|
1044
|
+
withdraw: (params: WithdrawParams) => Promise<RelayResult>;
|
|
1045
|
+
/** Whether withdrawal is in progress */
|
|
1046
|
+
isWithdrawing: boolean;
|
|
1047
|
+
/** Last withdrawal result */
|
|
1048
|
+
result: RelayResult | null;
|
|
1049
|
+
/** Error if withdrawal failed */
|
|
1050
|
+
error: Error | null;
|
|
1051
|
+
/** Reset state */
|
|
1052
|
+
reset: () => void;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Hook to withdraw tokens to external address
|
|
1056
|
+
* Uses existing relay infrastructure for gas sponsorship
|
|
1057
|
+
*/
|
|
1058
|
+
declare function useWithdraw(): UseWithdrawReturn;
|
|
1059
|
+
|
|
959
1060
|
/**
|
|
960
1061
|
* Passkey adapter for WebAuthn
|
|
961
1062
|
* Implements PasskeyProviderPort interface
|
|
@@ -1367,4 +1468,65 @@ declare function getUserCredentials(client: APIClient): Promise<Array<{
|
|
|
1367
1468
|
createdAt: string;
|
|
1368
1469
|
}>>;
|
|
1369
1470
|
|
|
1370
|
-
|
|
1471
|
+
/**
|
|
1472
|
+
* EIP-6963: Multi Injected Provider Discovery
|
|
1473
|
+
* https://eips.ethereum.org/EIPS/eip-6963
|
|
1474
|
+
*/
|
|
1475
|
+
interface EIP6963ProviderInfo {
|
|
1476
|
+
uuid: string;
|
|
1477
|
+
name: string;
|
|
1478
|
+
icon: string;
|
|
1479
|
+
rdns: string;
|
|
1480
|
+
}
|
|
1481
|
+
interface EIP6963ProviderDetail {
|
|
1482
|
+
info: EIP6963ProviderInfo;
|
|
1483
|
+
provider: any;
|
|
1484
|
+
}
|
|
1485
|
+
interface EIP6963AnnounceProviderEvent extends Event {
|
|
1486
|
+
detail: EIP6963ProviderDetail;
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Wallet display info for UI rendering
|
|
1490
|
+
*/
|
|
1491
|
+
interface WalletDisplayInfo {
|
|
1492
|
+
id: string;
|
|
1493
|
+
name: string;
|
|
1494
|
+
icon?: string;
|
|
1495
|
+
rdns?: string;
|
|
1496
|
+
provider: any;
|
|
1497
|
+
isLegacy?: boolean;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* EIP-6963 Multi Injected Provider Discovery Hook
|
|
1502
|
+
*
|
|
1503
|
+
* Detects wallet providers in the browser using EIP-6963 standard
|
|
1504
|
+
* with fallback to legacy window.ethereum.
|
|
1505
|
+
*/
|
|
1506
|
+
|
|
1507
|
+
interface UseEIP6963Return {
|
|
1508
|
+
/** Best available provider (EIP-6963 first, then window.ethereum) */
|
|
1509
|
+
provider: any | null;
|
|
1510
|
+
/** Provider info if from EIP-6963 */
|
|
1511
|
+
providerInfo: EIP6963ProviderInfo | null;
|
|
1512
|
+
/** Whether any wallet is available */
|
|
1513
|
+
hasWallet: boolean;
|
|
1514
|
+
/** Whether detection is still in progress */
|
|
1515
|
+
isDetecting: boolean;
|
|
1516
|
+
/** All detected EIP-6963 providers */
|
|
1517
|
+
allProviders: EIP6963ProviderDetail[];
|
|
1518
|
+
/** Has legacy window.ethereum provider */
|
|
1519
|
+
hasLegacyProvider: boolean;
|
|
1520
|
+
/** Get all wallets for UI display (EIP-6963 + legacy fallback) */
|
|
1521
|
+
getWalletsForDisplay: () => WalletDisplayInfo[];
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Detects wallet providers using EIP-6963 with window.ethereum fallback
|
|
1525
|
+
*/
|
|
1526
|
+
declare function useEIP6963(): UseEIP6963Return;
|
|
1527
|
+
/**
|
|
1528
|
+
* Detect wallet connector identifier from provider
|
|
1529
|
+
*/
|
|
1530
|
+
declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
|
|
1531
|
+
|
|
1532
|
+
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, 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 TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
package/dist/index.d.ts
CHANGED
|
@@ -956,6 +956,107 @@ interface UseVolrPaymentApiReturn {
|
|
|
956
956
|
}
|
|
957
957
|
declare function useVolrPaymentApi(): UseVolrPaymentApiReturn;
|
|
958
958
|
|
|
959
|
+
/**
|
|
960
|
+
* useUserBalances hook - Fetch user's token balances for project deposit assets
|
|
961
|
+
*/
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Token balance with metadata
|
|
965
|
+
*/
|
|
966
|
+
interface TokenBalance {
|
|
967
|
+
/** Unique identifier: chainId_address or chainId_native */
|
|
968
|
+
id: string;
|
|
969
|
+
/** Chain ID */
|
|
970
|
+
chainId: number;
|
|
971
|
+
/** Token symbol */
|
|
972
|
+
symbol: string;
|
|
973
|
+
/** Token decimals */
|
|
974
|
+
decimals: number;
|
|
975
|
+
/** Token address (0x0 for native) */
|
|
976
|
+
address: string;
|
|
977
|
+
/** Token icon URL */
|
|
978
|
+
iconUrl?: string;
|
|
979
|
+
/** Whether this is native token */
|
|
980
|
+
isNative: boolean;
|
|
981
|
+
/** Raw balance in smallest unit */
|
|
982
|
+
balanceRaw: bigint;
|
|
983
|
+
/** Formatted balance string */
|
|
984
|
+
balance: string;
|
|
985
|
+
/** Token price in USD (from backend) */
|
|
986
|
+
priceUsd?: number;
|
|
987
|
+
/** USD value (balance * price) */
|
|
988
|
+
balanceUsd?: number;
|
|
989
|
+
/** Whether balance is loading */
|
|
990
|
+
isLoading: boolean;
|
|
991
|
+
/** Error if balance fetch failed */
|
|
992
|
+
error?: string;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Extended deposit asset with price info from API
|
|
996
|
+
*/
|
|
997
|
+
interface DepositAssetWithPrice extends DepositAsset$1 {
|
|
998
|
+
priceUsd?: number;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Branding data with payment enabled flag
|
|
1002
|
+
*/
|
|
1003
|
+
interface BrandingData {
|
|
1004
|
+
depositAssets: DepositAssetWithPrice[];
|
|
1005
|
+
paymentEnabled: boolean;
|
|
1006
|
+
}
|
|
1007
|
+
interface UseUserBalancesReturn {
|
|
1008
|
+
/** Array of token balances */
|
|
1009
|
+
balances: TokenBalance[];
|
|
1010
|
+
/** Total USD value of all balances */
|
|
1011
|
+
totalUsd: number;
|
|
1012
|
+
/** Whether any balance is loading */
|
|
1013
|
+
isLoading: boolean;
|
|
1014
|
+
/** Whether payment feature is enabled for this project */
|
|
1015
|
+
paymentEnabled: boolean;
|
|
1016
|
+
/** Refresh all balances */
|
|
1017
|
+
refresh: () => Promise<void>;
|
|
1018
|
+
/** Error if branding fetch failed */
|
|
1019
|
+
error: Error | null;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Hook to fetch user's token balances for project deposit assets
|
|
1023
|
+
*/
|
|
1024
|
+
declare function useUserBalances(): UseUserBalancesReturn;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* useWithdraw hook - Withdraw tokens to external address
|
|
1028
|
+
*/
|
|
1029
|
+
|
|
1030
|
+
interface WithdrawParams {
|
|
1031
|
+
/** Chain ID to withdraw from */
|
|
1032
|
+
chainId: number;
|
|
1033
|
+
/** Token address (use 'native' for native token) */
|
|
1034
|
+
tokenAddress: string;
|
|
1035
|
+
/** Token decimals */
|
|
1036
|
+
decimals: number;
|
|
1037
|
+
/** Amount to withdraw (human readable, e.g., "1.5") */
|
|
1038
|
+
amount: string;
|
|
1039
|
+
/** Destination address */
|
|
1040
|
+
to: `0x${string}`;
|
|
1041
|
+
}
|
|
1042
|
+
interface UseWithdrawReturn {
|
|
1043
|
+
/** Execute withdrawal */
|
|
1044
|
+
withdraw: (params: WithdrawParams) => Promise<RelayResult>;
|
|
1045
|
+
/** Whether withdrawal is in progress */
|
|
1046
|
+
isWithdrawing: boolean;
|
|
1047
|
+
/** Last withdrawal result */
|
|
1048
|
+
result: RelayResult | null;
|
|
1049
|
+
/** Error if withdrawal failed */
|
|
1050
|
+
error: Error | null;
|
|
1051
|
+
/** Reset state */
|
|
1052
|
+
reset: () => void;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Hook to withdraw tokens to external address
|
|
1056
|
+
* Uses existing relay infrastructure for gas sponsorship
|
|
1057
|
+
*/
|
|
1058
|
+
declare function useWithdraw(): UseWithdrawReturn;
|
|
1059
|
+
|
|
959
1060
|
/**
|
|
960
1061
|
* Passkey adapter for WebAuthn
|
|
961
1062
|
* Implements PasskeyProviderPort interface
|
|
@@ -1367,4 +1468,65 @@ declare function getUserCredentials(client: APIClient): Promise<Array<{
|
|
|
1367
1468
|
createdAt: string;
|
|
1368
1469
|
}>>;
|
|
1369
1470
|
|
|
1370
|
-
|
|
1471
|
+
/**
|
|
1472
|
+
* EIP-6963: Multi Injected Provider Discovery
|
|
1473
|
+
* https://eips.ethereum.org/EIPS/eip-6963
|
|
1474
|
+
*/
|
|
1475
|
+
interface EIP6963ProviderInfo {
|
|
1476
|
+
uuid: string;
|
|
1477
|
+
name: string;
|
|
1478
|
+
icon: string;
|
|
1479
|
+
rdns: string;
|
|
1480
|
+
}
|
|
1481
|
+
interface EIP6963ProviderDetail {
|
|
1482
|
+
info: EIP6963ProviderInfo;
|
|
1483
|
+
provider: any;
|
|
1484
|
+
}
|
|
1485
|
+
interface EIP6963AnnounceProviderEvent extends Event {
|
|
1486
|
+
detail: EIP6963ProviderDetail;
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Wallet display info for UI rendering
|
|
1490
|
+
*/
|
|
1491
|
+
interface WalletDisplayInfo {
|
|
1492
|
+
id: string;
|
|
1493
|
+
name: string;
|
|
1494
|
+
icon?: string;
|
|
1495
|
+
rdns?: string;
|
|
1496
|
+
provider: any;
|
|
1497
|
+
isLegacy?: boolean;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* EIP-6963 Multi Injected Provider Discovery Hook
|
|
1502
|
+
*
|
|
1503
|
+
* Detects wallet providers in the browser using EIP-6963 standard
|
|
1504
|
+
* with fallback to legacy window.ethereum.
|
|
1505
|
+
*/
|
|
1506
|
+
|
|
1507
|
+
interface UseEIP6963Return {
|
|
1508
|
+
/** Best available provider (EIP-6963 first, then window.ethereum) */
|
|
1509
|
+
provider: any | null;
|
|
1510
|
+
/** Provider info if from EIP-6963 */
|
|
1511
|
+
providerInfo: EIP6963ProviderInfo | null;
|
|
1512
|
+
/** Whether any wallet is available */
|
|
1513
|
+
hasWallet: boolean;
|
|
1514
|
+
/** Whether detection is still in progress */
|
|
1515
|
+
isDetecting: boolean;
|
|
1516
|
+
/** All detected EIP-6963 providers */
|
|
1517
|
+
allProviders: EIP6963ProviderDetail[];
|
|
1518
|
+
/** Has legacy window.ethereum provider */
|
|
1519
|
+
hasLegacyProvider: boolean;
|
|
1520
|
+
/** Get all wallets for UI display (EIP-6963 + legacy fallback) */
|
|
1521
|
+
getWalletsForDisplay: () => WalletDisplayInfo[];
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Detects wallet providers using EIP-6963 with window.ethereum fallback
|
|
1525
|
+
*/
|
|
1526
|
+
declare function useEIP6963(): UseEIP6963Return;
|
|
1527
|
+
/**
|
|
1528
|
+
* Detect wallet connector identifier from provider
|
|
1529
|
+
*/
|
|
1530
|
+
declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
|
|
1531
|
+
|
|
1532
|
+
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, 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 TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|