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 we validate given address is valid TON address or not?

How do we validate given address is valid TON address or not?


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

  
  
Posted one year ago
Votes Newest

Answers


Generally speaking, you can use https://testnet.toncenter.com/api/v2/#/accounts/get_address_information_getAddressInformation_get to acquire all formats of a single address.

However, in practice, you can also utilize libraries to generate these. Below are a few snippets of code:

import { mnemonicToPrivateKey } from "ton-crypto";

let mnemonics = "YOUR_MNEMONICS";
let keyPair = await mnemonicToPrivateKey([mnemonics]);

// ✨ 🟡 Test-net:
const client = new TonClient4({
    endpoint: "https://sandbox-v4.tonhubapi.com",
});

// Create wallet contract
let workchain = 0; // Usually you need a workchain 0
let wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey });
let wallet_address = client.open(wallet);
let address = wallet_address.address;

Please replace "YOUR_MNEMONICS" with your actual mnemonics.

1
1
Posted one year ago
16K Views
1 Answer
one year ago
one year ago
Tags