add openBoxSignature
This commit is contained in:
parent
879964800b
commit
226a268e21
@ -90,9 +90,35 @@ async function buyBoxVerifySignature(session) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openBoxSignature(session) {
|
||||||
|
const userAddress = session.request('account');
|
||||||
|
const boxId = session.request('box_token_id');
|
||||||
|
const tokenIds = [];
|
||||||
|
tokenIds.push(session.request('token_id1'));
|
||||||
|
tokenIds.push(session.request('token_id2'));
|
||||||
|
tokenIds.push(session.request('token_id3'));
|
||||||
|
|
||||||
|
let nonce = utils.getUtcTime();
|
||||||
|
let signStr = bc.web3.utils.soliditySha3(
|
||||||
|
boxId,
|
||||||
|
tokenIds[0],
|
||||||
|
tokenIds[1],
|
||||||
|
tokenIds[2],
|
||||||
|
nonce
|
||||||
|
);
|
||||||
|
let signature = await bc.web3.eth.sign(signStr, userAddress);
|
||||||
|
signature = signature.replace(/00$/, "1b").replace(/01$/, "1c");
|
||||||
|
console.log('openLuckyBox||sign: ', signature, userAddress, boxId, tokenIds, nonce);
|
||||||
|
session.rspData({
|
||||||
|
'nonce': nonce,
|
||||||
|
'signature': signature
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
app.registerHandler('BcService', 'authVerifySignature', authVerifySignature);
|
app.registerHandler('BcService', 'authVerifySignature', authVerifySignature);
|
||||||
app.registerHandler('BcService', 'buyBoxVerifySignature', buyBoxVerifySignature);
|
app.registerHandler('BcService', 'buyBoxVerifySignature', buyBoxVerifySignature);
|
||||||
|
app.registerHandler('BcService', 'openBoxSignature', openBoxSignature);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.init = init;
|
exports.init = init;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user