1
This commit is contained in:
parent
675b520d66
commit
aa9013ab55
@ -4,13 +4,13 @@ const sigUtil = require('@metamask/eth-sig-util');
|
||||
const app = require('j7/app');
|
||||
const utils = require('j7/utils');
|
||||
const bcutils = require('j7/bcutils');
|
||||
const bc = require('../blockchain');
|
||||
const metaFactory = require('../metadata/factory');
|
||||
|
||||
async function claim(session) {
|
||||
try {
|
||||
const account = session.request('account');
|
||||
const netId = session.request('net_id');
|
||||
const bc = null;
|
||||
|
||||
const nftAddress = bc.getNftAddress(bcutils.CLAIM_BOX_TYPE);
|
||||
|
||||
@ -37,22 +37,15 @@ async function claim(session) {
|
||||
['trans_id', transId]
|
||||
]);
|
||||
const nonce = transId;
|
||||
const tokenIds = [tokenId];
|
||||
utils.arrayToStrings(tokenIds);
|
||||
let signStr = await bc.web3.utils.soliditySha3
|
||||
(
|
||||
const signature = await bc.soliditySha3Sign(
|
||||
account,
|
||||
nftAddress,
|
||||
nowTime,
|
||||
nonce,
|
||||
...tokenIds
|
||||
nonce
|
||||
);
|
||||
let signature = await bc.web3.eth.sign(signStr, userAddress);
|
||||
signature = signature.replace(/00$/, "1b").replace(/01$/, "1c");
|
||||
|
||||
const rspParams = [
|
||||
nftAddress,
|
||||
utils.jsonEncode(tokenIds),
|
||||
nowTime,
|
||||
nonce,
|
||||
signature
|
||||
|
@ -34,7 +34,7 @@ class BlockChain extends BaseService {
|
||||
}
|
||||
|
||||
async soliditySha3Sign(...args) {
|
||||
let signStr = await this.#bc.web3.utils.soliditySha3(...args);
|
||||
const signStr = await this.#bc.web3.utils.soliditySha3(...args);
|
||||
let signature = await this.#bc.web3.eth.sign(signStr, this.getUserAddress());
|
||||
signature = signature.replace(/00$/, "1b").replace(/01$/, "1c");
|
||||
return signature;
|
||||
|
Loading…
x
Reference in New Issue
Block a user