I`ve faced issue when trying to create ton wallet according to documentation. I am always having this error: LITE_SERVER_UNKNOWN: cannot apply external message to current state : Failed to unpack account state
Here is my code
const tonwebInstance = new TonWeb(
new TonWeb.HttpProvider("https://toncenter.com/api/v2/jsonRPC", {
apiKey: process.env.API_KEY,
})
);
// Create a key pair
const keyPair = nacl.sign.keyPair();
// Extract the public key from the key pair
const publicKey = keyPair.publicKey;
const publicKeyHex = Buffer.from(publicKey).toString("hex");
// Extract the private key from the key pair
const privateKey = keyPair.secretKey;
const privateKeyHex = Buffer.from(privateKey).toString("hex");
console.log("key pair created");
// Create a wallet using the public key as Uint8Array
const wallet = tonwebInstance.wallet.create({ publicKey });
console.log("wallet created");
// Get the wallet address
const walletAddress = (await wallet.getAddress()).toString(
true,
true,
true
);
console.log("wallet address: " + walletAddress);
const seqno = await wallet.methods.seqno().call();
await wallet.deploy(privateKey).send();
From the internet i havent found any working solution, except that it is somehow depends on seqno, but i dont really now how. from debugging i can see that error appearns on send() method. What should i do?