添加开箱子签名

This commit is contained in:
aozhiwei 2022-04-20 22:15:07 +08:00
parent 226a268e21
commit 8d1fa5618a
4 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,5 @@
{
"user_address": "0xAd2DeA1977055Db01C66e6E53309C4604AB869b8",
"private_key": "9178a1469fc7121aafe1e5dd485f8fa21627daa4656647abddacfcc1e0dbc90e",
"_user_address": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
"_private_key": "d9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60",
"user_address": "0x50A8e60041A206AcaA5F844a1104896224be6F39",
"private_key": "d9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60",
"block_server": "https://rpc-testnet.kcc.network"
}

View File

@ -25,6 +25,7 @@ class BlockChain {
async init() {
this.web3 = new Web3(metaFactory.getWeb3Conf()['block_server']);
this.web3.eth.handleRevert = true;
this.web3.eth.accounts.wallet.add(metamgr.getPrivateKey());
for (const data of metaFactory.getContracts()) {
this[`${data.name}Instance`] = await this.initInstance
(metaFactory.getUserAddress(), data.address, data.json);

View File

@ -2,6 +2,7 @@ const ethUtil = require('ethereumjs-util');
const sigUtil = require('@metamask/eth-sig-util');
const app = require('j7/app');
const utils = require('j7/utils');
const bc = require('../blockchain');
const metaFactory = require('../metadata/factory');
@ -90,8 +91,8 @@ async function buyBoxVerifySignature(session) {
}
}
function openBoxSignature(session) {
const userAddress = session.request('account');
async function openBoxSignature(session) {
const userAddress = metaFactory.getUserAddress();
const boxId = session.request('box_token_id');
const tokenIds = [];
tokenIds.push(session.request('token_id1'));

View File

@ -209,10 +209,10 @@ async function getPastEvents(session, params) {
eventName,
{
fromBlock: Number(fromBlock),
toBlock: toBlock,
// toBlock: toBlock,
},
);
console.log(events.length, events);
console.log(events.length, events, eventName);
session.rspData({
'count': events.length
});
@ -238,7 +238,7 @@ async function execCmd(session) {
}
async function openLuckyBox(session, params) {
const userAddress = params[0];
const userAddress = metaFactory.getUserAddress();
const boxId = params[1];
const tokenIds = [];
tokenIds.push(params[2]);