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
What is the process for obtaining the `public key` from a friendly text address on TON Web?

"What is the process for obtaining the public key from a friendly text address on TON Web?"

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

1
1
Posted one year ago
Edited one year ago
Howard Peng
10 × 1 Administrator
Votes Newest

Answers


To obtain a public key from a friendly text address using TonWeb's contract wallet module, you can use the create method to create an interface to the wallet's smart contract. You can specify the publicKey property to use a specific public key, or the address property to use a specific friendly text address.

Here's an example of creating a new interface to the wallet smart contract:

const nacl = TonWeb.utils.nacl;
const tonweb = new TonWeb();

const keyPair = nacl.sign.keyPair();
const wallet = tonweb.wallet.create({publicKey: keyPair.publicKey, wc: 0});

Once you have the wallet interface, you can use the getAddress method to obtain the friendly text address of the wallet. You can then use the get_public_key method to obtain the public key associated with the friendly text address. Here's an example:

const address = await wallet.getAddress();
const publicKey = await wallet.methods.get_public_key().call({address});

This code will obtain the friendly text address of the wallet and the associated public key. Note that the get_public_key method is specific to the wallet smart contracts published in the TON repository and may not be available for other wallet contracts.

https://github.com/toncenter/tonweb

1
1
wiki
Posted one year ago
Edited one year ago
2K Views
1 Answer
one year ago
one year ago
Tags