| 31 | } |
| 32 | |
| 33 | CocoonWallet::CocoonWallet(td::SecureString wallet_private_key, block::StdAddress wallet_owner, td::int64 low_balance, |
| 34 | BaseRunner *runner, std::shared_ptr<RunnerConfig> runner_config) |
| 35 | : TonScWrapper(block::StdAddress{}, {}, runner, std::move(runner_config)), low_balance_(low_balance) { |
| 36 | cocoon_wallet_private_key_ = std::make_unique<td::Ed25519::PrivateKey>(std::move(wallet_private_key)); |
| 37 | auto pub = cocoon_wallet_private_key_->get_public_key().move_as_ok(); |
| 38 | auto pub_key_str = pub.as_octet_string(); |
| 39 | CHECK(pub_key_str.size() == 32); |
| 40 | cocoon_wallet_public_key_.as_slice().copy_from(pub_key_str.as_slice()); |
| 41 | cocoon_wallet_owner_address_ = wallet_owner; |
| 42 | |
| 43 | set_code(code_boc()); |
| 44 | sc_update_address(); |
| 45 | } |
| 46 | |
| 47 | td::Ref<vm::Cell> CocoonWallet::code_boc() { |
| 48 | std::string boc = td::hex_decode(code_str()).move_as_ok(); |