I'm running this code:
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";
import sotez from "sotez";
class App extends Component {
state = {
pkh: "",
mnemonic: "",
sk: ""
};
async componentDidMount() {
await this.main();
}
main = async () => {
const password = "yanterzzz";
await sotez.node
.query("/chains/main/blocks/head")
.then(response => console.log(response));
const result = await sotez.crypto.generateMnemonic();
const answer = await sotez.crypto.generateKeys(result, password);
console.log(answer.mnemonic);
this.setState({ mnemonic: answer.mnemonic });
this.setState({ sk: answer.sk });
this.setState({ pkh: answer.pkh });
};
}
and it works for a while and generates keys properly, but then eventually I'll end up running into this error:
Unhandled Rejection (TypeError): library.sodium.crypto_sign_seed_keypair is not a function
Would my issue be with React and component reloading or a problem with the libsodium library?