This commit is contained in:
aozhiwei 2024-06-17 17:22:51 +08:00
parent 15637fced9
commit b2eca732fe

View File

@ -14,6 +14,7 @@ async function activate721Nft(session) {
const itemUniId = session.request('item_uniid'); const itemUniId = session.request('item_uniid');
const itemId = session.request('item_id'); const itemId = session.request('item_id');
const bc = serviceFactory.create('BlockChain'); const bc = serviceFactory.create('BlockChain');
const isMint = session.request('is_mint') == '1' ? true : false;
{ {
const ret = await bc.init(netId); const ret = await bc.init(netId);
if (!ret) { if (!ret) {
@ -51,6 +52,10 @@ async function activate721Nft(session) {
session.rspErr(101, 'token_type param error'); session.rspErr(101, 'token_type param error');
return; return;
} }
if (itemMeta.getNftType() == bcconst.BC_NFT_GOLD_BULLION && !isMint) {
session.rspErr(101, 'gold bullion only mint');
return;
}
} }
{ {
if (!nftAddress) { if (!nftAddress) {
@ -86,13 +91,17 @@ async function activate721Nft(session) {
const nftList = [ const nftList = [
[ [
tokenId, tokenId,
true isMint
] ]
]; ];
const nftListArr = []; const nftListArr = [];
nftList.forEach((item) => { nftList.forEach((item) => {
nftListArr.push(item[0].toString()); nftListArr.push(item[0].toString());
nftListArr.push('0x01'); if (isMint) {
nftListArr.push('0x01');
} else {
nftListArr.push('0x00');
}
}); });
const signature = await bc.soliditySha3Sign( const signature = await bc.soliditySha3Sign(
account, account,