js Date 传参给合约 eosio::time_point

合约

void xxx_contract::updatetime(eosio::time_point timestamp){
    require_auth( _self.value );
    system_tables system_table(_self, _self.value);
    auto itr = system_table.begin();
    if(itr == system_table.end()){
        system_table.emplace( _self, [&]( auto& s ) {
            s.id = system_table.available_primary_key();
            s.zero_time = timestamp;
        });
    }else{
        system_table.modify( itr, _self, [&]( auto& s ) {
            s.zero_time = timestamp;
        });
    }
}

Js

push action 参数为 new Date().getTime() * 1000

,

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发
区块链技术的头像-区块链开发网

昵称

取消
昵称表情代码图片