@volr/react 0.1.53 → 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 CHANGED
@@ -29,7 +29,7 @@ function App() {
29
29
  }
30
30
 
31
31
  function YourApp() {
32
- const { evm, address, isLoggedIn, logout } = useVolr();
32
+ const { evm, isLoggedIn, logout } = useVolr();
33
33
 
34
34
  if (!isLoggedIn) {
35
35
  return <div>Please login</div>;
@@ -40,7 +40,7 @@ function YourApp() {
40
40
  address: '0x...',
41
41
  abi: erc20Abi,
42
42
  functionName: 'balanceOf',
43
- args: [address],
43
+ args: [evm.address],
44
44
  });
45
45
 
46
46
  // Send transaction
@@ -69,8 +69,7 @@ Main hook for wallet operations.
69
69
 
70
70
  ```tsx
71
71
  const {
72
- evm, // (chainId: number) => EvmClient
73
- address, // `0x${string}` | undefined
72
+ evm, // EvmNamespace - chain client factory + address
74
73
  email, // string | undefined
75
74
  isLoggedIn, // boolean
76
75
  signerType, // 'passkey' | 'external_wallet' | 'mpc' | undefined
@@ -78,6 +77,12 @@ const {
78
77
  isLoading, // boolean
79
78
  error, // Error | null
80
79
  } = useVolr();
80
+
81
+ // Get EVM address
82
+ const address = evm.address;
83
+
84
+ // Get chain client
85
+ const client = evm(8453);
81
86
  ```
82
87
 
83
88
  ### EvmClient
package/dist/index.cjs CHANGED
@@ -18393,7 +18393,7 @@ function useVolr() {
18393
18393
  createGetRpcUrl({ client, rpcOverrides: config.rpcOverrides }),
18394
18394
  [client, config.rpcOverrides]
18395
18395
  );
18396
- const evm = react.useCallback(
18396
+ const evmFactory = react.useCallback(
18397
18397
  (chainId) => {
18398
18398
  if (chainId === 0) {
18399
18399
  throw new Error("chainId cannot be 0");
@@ -18484,9 +18484,11 @@ function useVolr() {
18484
18484
  },
18485
18485
  [user, config, provider, precheck, relay, getRpcUrl, setProvider, client]
18486
18486
  );
18487
+ const evm = Object.assign(evmFactory, {
18488
+ address: user?.evmAddress
18489
+ });
18487
18490
  return {
18488
18491
  evm,
18489
- address: user?.evmAddress,
18490
18492
  email: user?.email,
18491
18493
  isLoggedIn: user !== null,
18492
18494
  signerType: user?.signerType,