toncenter/tonweb

how to get transactions in v4 wallet?

di-sukharev opened this issue · 5 comments

this is code i run:

import { withCronAuth } from "@/app/api/middlewares/withCronAuth";
import TonWeb from "tonweb";

async function getBalanceAndHistory() {
  const tonweb = new TonWeb(
    new TonWeb.HttpProvider("https://toncenter.com/api/v2/jsonRPC", {
      apiKey: process.env.MAINNET_TONCENTER_API_KEY,
    })
  );

  const Address = TonWeb.utils.Address;

  const address = new Address(process.env.MY_ADDRESS!);

  const history = await tonweb.getTransactions(address);

  // failing here

  const balance = await tonweb.getBalance(address);

  return Response.json({ success: true });
}

export const GET = withCronAuth(assignIncomingDonatesToBalances);

assignIncomingDonatesToBalances();

this is error i get: LITE_SERVER_UNKNOWN: cannot locate transaction in block with specified logical time

node v20.10.0, bun v1.0.25, both fail

it fails with the same error if i remove TonWeb.HttpProvider

guess its due to wallet v4 r2 which tonscan shows for my wallet

wallet v3 addresses work good, for example this one: EQDjVXa_oltdBP64Nc__p397xLCvGm2IcZ1ba7anSW0NAkeP

May I ask how to convert mnemonics into public and private keys?

UQD1FRXPKFNFXRgmR7JZatrDWUMHFLU7kzzRrM7AiQaYrlsD