не может конвертировать eosio :: name в uint64_t

Я работаю с умным контрактом, используя eos.cdt v1.3.2. Я уже пытался как можно реорганизовать рефакторинг, чтобы не отставать от изменений, внесенных в eos.cdt. Вот контракт:

#include <eosiolib/eosio.hpp>
#include <eosiolib/name.hpp>

using namespace eosio;
using namespace std;
class addressbook: contract {
struct address {
uint64_t account_name;
string first_name;
string last_name;
string street;
string city;
string state;
auto primary_key() const { return account_name; }
EOSLIB_SERIALIZE( address, (account_name)(first_name)(last_name)(street)(city)(state) )
};
public:
using contract::contract;

addressbook(name receiver, name code, datastream<const char*> ds):contract(receiver, code, ds) {}

typedef eosio::multi_index< "address"_n, address > address_index;
void myaction() {
address_index addresses(_code, _code.value); // code, scope
// add to table, first argument is account to bill for storage
addresses.emplace(_self, [&](auto& address) {
address.account_name = name("foo");
address.first_name = "Daniel";
address.last_name = "Larimer";
address.street = "1 EOS Way";
address.city = "Blacksburg";
address.state = "VA";
});
auto user = addresses.get(name("foo"));
eosio_assert(user.first_name == "Daniel", "Couldn't get him.");
}
}
EOSIO_ABI( addressbook, (myaction) )

Когда я пытаюсь скомпилировать из командной строки, я получаю следующие сообщения об ошибках:

get.cpp:34:33: error: no viable conversion from 'eosio::name' to 'uint64_t' (aka
'unsigned long long')
auto user = addresses.get(name("foo"));
^~~~~~~~~~~
/usr/local/eosio.cdt/bin/../include/eosiolib/name.hpp:131:17: note: candidate
function
constexpr operator raw()const { return raw(value); }
^
/usr/local/eosio.cdt/bin/../include/eosiolib/multi_index.hpp:1963:30: note:
passing argument to parameter 'primary' here
const T& get( uint64_t primary, const char* error_msg = "unable t...
^
get.cpp:38:26: error: C++ requires a type specifier for all declarations
EOSIO_ABI( addressbook, (myaction) )
^
get.cpp:38:37: error: expected function body after function declarator
EOSIO_ABI( addressbook, (myaction) )
^
get.cpp:27:32: error: assigning to 'uint64_t' (aka 'unsigned long long') from
incompatible type 'eosio::name'
address.account_name = name("foo");
^~~~~~~~~~~
/usr/local/eosio.cdt/bin/../include/eosiolib/multi_index.hpp:1691:13: note: in
instantiation of function template specialization
'addressbook::myaction()::(anonymous
class)::operator()<addressbook::address>' requested here
constructor( obj );
^
get.cpp:26:17: note: in instantiation of function template specialization
'eosio::multi_index<3626371193025593344,
addressbook::address>::emplace<(lambda at get.cpp:26:32)>' requested here
addresses.emplace(_self, [&](auto& address) {
^
4 errors generated.

Меня больше всего беспокоит сообщение об ошибке, которое гласит: get.cpp: 34: 33: ошибка: нет жизнеспособного преобразования из ‘eosio :: name’ в ‘uint64_t’ (иначе
«unsigned long long»), поскольку это сообщение появилось из-за изменений в eos.cbt. Тем не менее, кажется, нет решения о том, как это исправить. Кто-нибудь смог решить эту проблему?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector