@echoxyz/sonar-react 0.4.0 → 0.4.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @echoxyz/sonar-react
2
2
 
3
+ ## 0.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1102d83: Ensure that entity is refetched whenever the wallet address changes
8
+
9
+ ## 0.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [c032c29]
14
+ - @echoxyz/sonar-core@0.3.0
15
+
3
16
  ## 0.4.0
4
17
 
5
18
  ### Minor Changes
package/README.md CHANGED
@@ -124,7 +124,6 @@ const ExampleEntityPanel = () => {
124
124
  import { useEffect } from "react";
125
125
  import { useSonarEntity } from "./hooks/useSonarEntity";
126
126
  import { useAccount } from "wagmi";
127
- import { EntityType } from "@echoxyz/sonar-core";
128
127
 
129
128
  export function Example() {
130
129
  const { address, isConnected } = useAccount();
@@ -144,7 +143,6 @@ export function Example() {
144
143
  const pre = await client.prePurchaseCheck({
145
144
  saleUUID: "<your-sale-uuid>",
146
145
  entityUUID: entity.EntityUUID,
147
- entityType: EntityType.USER,
148
146
  walletAddress: "0x1234...abcd" as `0x${string}`,
149
147
  });
150
148
 
@@ -152,7 +150,6 @@ export function Example() {
152
150
  const permit = await client.generatePurchasePermit({
153
151
  saleUUID: "<your-sale-uuid>",
154
152
  entityUUID: entity.EntityUUID,
155
- entityType: EntityType.USER,
156
153
  walletAddress: "0x1234...abcd" as `0x${string}`,
157
154
  });
158
155
  console.log(permit.Signature, permit.Permit);
package/dist/index.cjs CHANGED
@@ -147,6 +147,7 @@ function useSonarEntity(args) {
147
147
  setState({
148
148
  loading: false,
149
149
  entity: resp.Entity,
150
+ walletAddress,
150
151
  error: void 0,
151
152
  hasFetched: true
152
153
  });
@@ -155,13 +156,14 @@ function useSonarEntity(args) {
155
156
  setState({
156
157
  loading: false,
157
158
  entity: void 0,
159
+ walletAddress: void 0,
158
160
  error: void 0,
159
161
  hasFetched: true
160
162
  });
161
163
  return;
162
164
  }
163
165
  const error = err instanceof Error ? err : new Error(String(err));
164
- setState({ loading: false, entity: void 0, error, hasFetched: true });
166
+ setState({ loading: false, entity: void 0, walletAddress: void 0, error, hasFetched: true });
165
167
  }
166
168
  }, [client, saleUUID, walletAddress, fullyConnected]);
167
169
  const reset = (0, import_react2.useCallback)(() => {
@@ -169,16 +171,15 @@ function useSonarEntity(args) {
169
171
  loading: false,
170
172
  hasFetched: false,
171
173
  entity: void 0,
174
+ walletAddress: void 0,
172
175
  error: void 0
173
176
  });
174
177
  }, []);
175
178
  (0, import_react2.useEffect)(() => {
176
- if (fullyConnected) {
177
- if (!state.hasFetched && !state.loading) {
178
- refetch();
179
- }
179
+ if (fullyConnected && state.walletAddress !== walletAddress) {
180
+ refetch();
180
181
  }
181
- }, [fullyConnected, state.hasFetched, state.loading, refetch]);
182
+ }, [fullyConnected, state.walletAddress, walletAddress, refetch]);
182
183
  (0, import_react2.useEffect)(() => {
183
184
  if (ready && (!authenticated || !walletAddress)) {
184
185
  reset();
package/dist/index.js CHANGED
@@ -118,6 +118,7 @@ function useSonarEntity(args) {
118
118
  setState({
119
119
  loading: false,
120
120
  entity: resp.Entity,
121
+ walletAddress,
121
122
  error: void 0,
122
123
  hasFetched: true
123
124
  });
@@ -126,13 +127,14 @@ function useSonarEntity(args) {
126
127
  setState({
127
128
  loading: false,
128
129
  entity: void 0,
130
+ walletAddress: void 0,
129
131
  error: void 0,
130
132
  hasFetched: true
131
133
  });
132
134
  return;
133
135
  }
134
136
  const error = err instanceof Error ? err : new Error(String(err));
135
- setState({ loading: false, entity: void 0, error, hasFetched: true });
137
+ setState({ loading: false, entity: void 0, walletAddress: void 0, error, hasFetched: true });
136
138
  }
137
139
  }, [client, saleUUID, walletAddress, fullyConnected]);
138
140
  const reset = useCallback2(() => {
@@ -140,16 +142,15 @@ function useSonarEntity(args) {
140
142
  loading: false,
141
143
  hasFetched: false,
142
144
  entity: void 0,
145
+ walletAddress: void 0,
143
146
  error: void 0
144
147
  });
145
148
  }, []);
146
149
  useEffect2(() => {
147
- if (fullyConnected) {
148
- if (!state.hasFetched && !state.loading) {
149
- refetch();
150
- }
150
+ if (fullyConnected && state.walletAddress !== walletAddress) {
151
+ refetch();
151
152
  }
152
- }, [fullyConnected, state.hasFetched, state.loading, refetch]);
153
+ }, [fullyConnected, state.walletAddress, walletAddress, refetch]);
153
154
  useEffect2(() => {
154
155
  if (ready && (!authenticated || !walletAddress)) {
155
156
  reset();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@echoxyz/sonar-react",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "react": ">=18"
17
17
  },
18
18
  "dependencies": {
19
- "@echoxyz/sonar-core": "0.2.1"
19
+ "@echoxyz/sonar-core": "0.3.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@testing-library/react": "^16.0.0",