@vela-ventures/aosync-sdk-react 1.0.30 → 1.0.32

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/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import WalletClient from "@vela-ventures/ao-sync-sdk";
1
2
  import { DataItem, UserTokensResult } from "arconnect";
2
3
  import Transaction from "arweave/web/lib/transaction";
3
4
  export interface AOSyncSDKContext {
@@ -11,7 +12,10 @@ export interface AOSyncSDKContext {
11
12
  getWalletNames: () => Promise<{
12
13
  [addr: string]: string;
13
14
  }>;
15
+ getWallets: () => ReturnType<WalletClient['getWallets']>;
14
16
  userTokens: () => Promise<UserTokensResult>;
15
17
  signAOMessage: (dataItem: DataItem) => Promise<string>;
18
+ swapActiveWallet: (walletAddress: string) => Promise<string>;
19
+ getContacts: () => ReturnType<WalletClient['getContacts']>;
16
20
  sign: (transaction: Transaction) => Promise<Transaction>;
17
21
  }
@@ -36,16 +36,12 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
36
36
  };
37
37
  }, []);
38
38
  useEffect(() => {
39
- const handleStorageChange = (event) => {
40
- if (event.key === "aosync-session-active" &&
41
- event.storageArea === sessionStorage) {
42
- const newValue = event.newValue ? JSON.parse(event.newValue) : false;
43
- setIsSessionActive(newValue);
44
- }
39
+ const handleSessionChange = (event) => {
40
+ setIsSessionActive(event.detail.isActive);
45
41
  };
46
- window.addEventListener("storage", handleStorageChange);
42
+ window.addEventListener("aosync-session-change", handleSessionChange);
47
43
  return () => {
48
- window.removeEventListener("storage", handleStorageChange);
44
+ window.removeEventListener("aosync-session-change", handleSessionChange);
49
45
  };
50
46
  }, []);
51
47
  const connect = () => __awaiter(this, void 0, void 0, function* () {
@@ -155,6 +151,15 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
155
151
  throw error;
156
152
  }
157
153
  });
154
+ const getWallets = () => __awaiter(this, void 0, void 0, function* () {
155
+ try {
156
+ return yield walletRef.current.getWallets();
157
+ }
158
+ catch (error) {
159
+ console.error("Error getting wallets:", error);
160
+ throw error;
161
+ }
162
+ });
158
163
  const userTokens = () => __awaiter(this, void 0, void 0, function* () {
159
164
  try {
160
165
  return yield walletRef.current.userTokens();
@@ -164,6 +169,24 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
164
169
  throw error;
165
170
  }
166
171
  });
172
+ const swapActiveWallet = (walletAddress) => __awaiter(this, void 0, void 0, function* () {
173
+ try {
174
+ return yield walletRef.current.swapActiveWallet(walletAddress);
175
+ }
176
+ catch (error) {
177
+ console.error("Error swapping wallet:", error);
178
+ throw error;
179
+ }
180
+ });
181
+ const getContacts = () => __awaiter(this, void 0, void 0, function* () {
182
+ try {
183
+ return yield walletRef.current.getContacts();
184
+ }
185
+ catch (error) {
186
+ console.error("Error getting contacts:", error);
187
+ throw error;
188
+ }
189
+ });
167
190
  return (React.createElement(AOSyncContext.Provider, { value: {
168
191
  isConnected,
169
192
  isSessionActive,
@@ -172,9 +195,12 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
172
195
  getAddress,
173
196
  getAllAddresses,
174
197
  getWalletNames,
198
+ getWallets,
175
199
  userTokens,
176
200
  sendAR,
177
201
  signAOMessage,
202
+ swapActiveWallet,
203
+ getContacts,
178
204
  sign,
179
205
  } }, children));
180
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vela-ventures/aosync-sdk-react",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -65,6 +65,6 @@
65
65
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@vela-ventures/ao-sync-sdk": "^1.1.30"
68
+ "@vela-ventures/ao-sync-sdk": "^1.1.32"
69
69
  }
70
70
  }