mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
emergency update
This commit is contained in:
parent
5d846e0aaf
commit
9f351fc29f
87 changed files with 2486 additions and 655 deletions
|
@ -55,6 +55,8 @@
|
|||
#include "td/utils/port/path.h"
|
||||
#include "td/utils/port/signals.h"
|
||||
|
||||
#include "tonlib/keys/Mnemonic.h"
|
||||
|
||||
#include "block.h"
|
||||
#include "block-parse.h"
|
||||
#include "block-auto.h"
|
||||
|
@ -634,7 +636,25 @@ void interpret_sub_extra_currencies(vm::Stack& stack) {
|
|||
stack.push_bool(ok);
|
||||
}
|
||||
|
||||
void interpret_mnemonic_to_privkey(vm::Stack& stack, int mode) {
|
||||
td::SecureString str{td::Slice{stack.pop_string()}};
|
||||
auto res = tonlib::Mnemonic::create(std::move(str), td::SecureString());
|
||||
if (res.is_error()) {
|
||||
throw fift::IntError{res.move_as_error().to_string()};
|
||||
}
|
||||
auto privkey = res.move_as_ok().to_private_key();
|
||||
td::SecureString key;
|
||||
if (mode & 1) {
|
||||
auto pub = privkey.get_public_key();
|
||||
key = pub.move_as_ok().as_octet_string();
|
||||
} else {
|
||||
key = privkey.as_octet_string();
|
||||
}
|
||||
stack.push_bytes(key.as_slice());
|
||||
}
|
||||
|
||||
void init_words_custom(fift::Dictionary& d) {
|
||||
using namespace std::placeholders;
|
||||
d.def_stack_word("verb@ ", interpret_get_verbosity);
|
||||
d.def_stack_word("verb! ", interpret_set_verbosity);
|
||||
d.def_stack_word("wcid@ ", interpret_get_workchain);
|
||||
|
@ -651,6 +671,8 @@ void init_words_custom(fift::Dictionary& d) {
|
|||
d.def_stack_word("isWorkchainDescr? ", interpret_is_workchain_descr);
|
||||
d.def_stack_word("CC+? ", interpret_add_extra_currencies);
|
||||
d.def_stack_word("CC-? ", interpret_sub_extra_currencies);
|
||||
d.def_stack_word("mnemo>priv ", std::bind(interpret_mnemonic_to_privkey, _1, 0));
|
||||
d.def_stack_word("mnemo>pub ", std::bind(interpret_mnemonic_to_privkey, _1, 1));
|
||||
}
|
||||
|
||||
tlb::TypenameLookup tlb_dict;
|
||||
|
@ -738,7 +760,8 @@ void init_words_tlb(fift::Dictionary& d) {
|
|||
d.def_stack_word("(tlb-dump-str?) ", interpret_tlb_dump_to_str);
|
||||
d.def_stack_word("tlb-skip ", interpret_tlb_skip);
|
||||
d.def_stack_word("tlb-validate-skip ", interpret_tlb_validate_skip);
|
||||
d.def_stack_word("ExtraCurrencyCollection", std::bind(interpret_tlb_type_const, _1, &block::tlb::t_ExtraCurrencyCollection));
|
||||
d.def_stack_word("ExtraCurrencyCollection",
|
||||
std::bind(interpret_tlb_type_const, _1, &block::tlb::t_ExtraCurrencyCollection));
|
||||
}
|
||||
|
||||
void usage(const char* progname) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue