Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getmethods.get_wallet_data #285

Open
khalilmosavi opened this issue Oct 18, 2024 · 0 comments
Open

Getmethods.get_wallet_data #285

khalilmosavi opened this issue Oct 18, 2024 · 0 comments

Comments

@khalilmosavi
Copy link

async createWallet() {
const keyPair = TonWeb.utils.nacl.sign.keyPair()

const tonweb = new TonWeb(
  new TonWeb.HttpProvider("https://testnet.toncenter.com/api/v2/jsonRPC", {
    apiKey: process.env.TON_APIK,
  }),
)
const publicKey = keyPair.publicKey
const privateKey = keyPair.secretKey

const WalletClass = TonWeb.Wallets.all.v3R2
const wallet = new WalletClass(tonweb.provider, {
  publicKey: publicKey,
})

const walletAddress = await wallet.getAddress()

const address = walletAddress.toString(true, true, true, true)
return { address, publicKey, privateKey }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant