Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
How do you generate the public address of a TON wallet from its mnemonic?

How do you generate the public address of TON wallet from the seed phrase?


This question was imported from Telegram Chat: https://t.me/tondev_eng/9723

  
  
Posted 6 months ago
Votes Newest

Answers


This post has JS code that does it as well as explanations how it all works: https://ton-community.github.io/tutorials/01-wallet/

You should be able to get the wallet address like so:

import { mnemonicToWalletKey } from "ton-crypto";
import { WalletContractV4 } from "ton";

async function main() {
  // open wallet v4 (notice the correct wallet version here)
  const mnemonic = "unfold sugar water ..."; // your 24 secret words (replace ... with the rest of the words)
  const key = await mnemonicToWalletKey(mnemonic.split(" "));
  const wallet = WalletContractV4.create({ publicKey: key.publicKey, workchain: 0 });

  // print wallet address
  console.log(wallet.address.toString({ testOnly: true }));
}

main();
1
1
Posted 6 months ago
Jeremy
384 × 5 Administrator
7K Views
1 Answer
6 months ago
6 months ago
Tags