从未使用过 c++ 并遇到问题。我意识到我无法记录整个对象owner
并查看其结构。在代码片段中,您可以看到 db 插入适用于硬编码字符串old_account_name
。这个字符串只是一个硬编码的EOS
公钥。我知道对象中应该有一个带有公钥的数组,owner
但由于类型转换,我无法靠近他。请告诉我解决此问题并获取公钥字符串的正确方法。
else if (action.name == N(newaccount)) {
auto new_account_name = abi_data["newact"].as<chain::name>().to_string();
auto creator = abi_data["creator"].as<chain::name>().to_string();
//hardcoded works std::string old_account_name = "EOS7ea3Dj15nUkKz3diU7BmE5FV5aNKsBKL6TEST";
auto owner = abi_data["owner"].as<chain::authority>();
// doesn't work std::string public_k1 = owner.keys[0].key.as<chain::authority>();
// doesn't work std::string public_k2 = owner.keys[0].key.as<chain::public_key_type>();
ilog("new_account_name: " + new_account_name + " ,creator: " + creator);
*m_session << "UPDATE user_address SET address = :nan WHERE crypto_currency_asset_id = :ai AND address = :oan",
soci::use(new_account_name, "nan"),
soci::use(old_account_name, "oan"),
soci::use(asset_id, "ai");
}
错误:no viable conversion from 'eosio::chain::public_key_type' (aka 'fc::crypto::public_key') to 'std::string'