@vela-ventures/aosync-sdk-react 1.0.18 → 1.0.19
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/walletContext.js +5 -5
- package/package.json +2 -2
package/dist/walletContext.js
CHANGED
|
@@ -13,8 +13,8 @@ import Arweave from "arweave";
|
|
|
13
13
|
import WalletClient from "@vela-ventures/ao-sync-sdk";
|
|
14
14
|
export const AOSyncContext = createContext(undefined);
|
|
15
15
|
export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 443, protocol: "https" }, muUrl = "https://mu.ao-testnet.xyz", children, appInfo, }) {
|
|
16
|
-
const [isConnected, setIsConnected] = useState(false);
|
|
17
16
|
const walletRef = useRef(new WalletClient());
|
|
17
|
+
const [isConnected, setIsConnected] = useState(!!sessionStorage.getItem("aosync-topic-id"));
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
const wallet = walletRef.current;
|
|
20
20
|
wallet.reconnect();
|
|
@@ -107,12 +107,12 @@ export function AOSyncProvider({ gatewayConfig = { host: "arweave.net", port: 44
|
|
|
107
107
|
function extractAndHashId(byteArray) {
|
|
108
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
109
|
const idBytes = byteArray.slice(2, 2 + 512);
|
|
110
|
-
const hashBuffer = yield crypto.subtle.digest(
|
|
110
|
+
const hashBuffer = yield crypto.subtle.digest("SHA-256", idBytes);
|
|
111
111
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
112
112
|
const hashBase64 = btoa(String.fromCharCode.apply(null, hashArray))
|
|
113
|
-
.replace(/\+/g,
|
|
114
|
-
.replace(/\//g,
|
|
115
|
-
.replace(/=+$/,
|
|
113
|
+
.replace(/\+/g, "-")
|
|
114
|
+
.replace(/\//g, "_")
|
|
115
|
+
.replace(/=+$/, "");
|
|
116
116
|
return hashBase64;
|
|
117
117
|
});
|
|
118
118
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vela-ventures/aosync-sdk-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
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.
|
|
68
|
+
"@vela-ventures/ao-sync-sdk": "^1.1.19"
|
|
69
69
|
}
|
|
70
70
|
}
|