diff --git a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate index e98ed19..4edb0c0 100644 Binary files a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate and b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 1c2db93..f5cd38e 100644 --- a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -68,5 +68,37 @@ landmarkType = "9"> + + + + + + + + diff --git a/js/main.js b/js/main.js index f1605f1..1a66f49 100644 --- a/js/main.js +++ b/js/main.js @@ -6,10 +6,10 @@ console.log(">>begin load wallet main file"); */ function initWallet(funId, type, chain, channel) { - // chain = chain || 80001 - channel = channel || 1 - type = 0 - chain = 80001 + type = parseInt(type) + chain = parseInt(chain) + channel = channel || 0; + channel = parseInt(channel); try { var wallet; if (!window.jc || !jc.wallet) { @@ -126,7 +126,6 @@ function changeChain(funId, chainId) { * @param {string} tips: tips message when sign */ function loginSign(funId, nonce, tips) { - console.log('login sign: ' + funId) jc.wallet .loginSign(nonce, tips) .then((result) => { @@ -165,33 +164,18 @@ function createAccount(funId) { * @return {string} account actived */ function importAccount(funId, privateKey) { - console.log('importAccount: ' + funId); - jsb.signWithApple(funId); -// jsb.restoreKey(funId, '1111'); -// jsb.scanQRCode(funId, '111'); -// jsb.showQRCode('00123', '0x12312312313123123123', 'CEBG RECOVERY KEY', '0x1231231231321231'); -// try { -// let address = jc.wallet.importAccount(privateKey); -// return JSON.stringify({ -// errcode: 0, -// data: address, -// }); -// } catch (err) { -// return JSON.stringify({ -// errcode: 1, -// errmsg: err, -// }); -// } - // jc.wallet.erc20Standard.transfer({ - // address: '0xC76c692450d6221A8B1E035CB8bdB639bC60658D', - // from: '0x50A8e60041A206AcaA5F844a1104896224be6F39', - // to: '0x746338765a8FbDD1c5aB61bfb92CD6D960C3C662', - // amount: 101 - // }).then((res) => { - // console.log(JSON.stringify(res)) - // }).catch(err => { - // console.log(JSON.stringify(err)) - // }) + try { + let address = jc.wallet.importAccount(privateKey); + return JSON.stringify({ + errcode: 0, + data: address, + }); + } catch (err) { + return JSON.stringify({ + errcode: 1, + errmsg: err, + }); + } } /** * active one account @@ -350,6 +334,7 @@ function restoreFromMnemonic(funId, mnemonic, password) { function scanQRCode(funId, title) { try { + console.log('scanQRCode: ' + title) jsb.scanQRCode(funId, title); } catch (err) { return JSON.stringify({ @@ -395,6 +380,8 @@ function signOutGoogle(funId) { //} function buyNft721(funId, addresses, values, signature) { + addresses = JSON.parse(addresses) + values = JSON.parse(values) jc.wallet.jcStandard .buyNft721({ addresses, @@ -406,7 +393,7 @@ function buyNft721(funId, addresses, values, signature) { funId, JSON.stringify({ errcode: 0, - data: result, + data: JSON.stringify(result), }) ); }) @@ -416,6 +403,11 @@ function buyNft721(funId, addresses, values, signature) { } function buyNft1155(funId, addresses, values, ids, amounts, signature) { + addresses = JSON.parse(addresses) + values = JSON.parse(values) + ids = JSON.parse(ids) + amounts = JSON.parse(amounts) + jc.wallet.jcStandard .buyNft1155({ addresses, @@ -429,7 +421,7 @@ function buyNft1155(funId, addresses, values, ids, amounts, signature) { funId, JSON.stringify({ errcode: 0, - data: result, + data: JSON.stringify(result), }) ); }) @@ -446,7 +438,7 @@ function evolveNft721( nonce, signature ) { - { + tokenIds = JSON.parse(tokenIds) jc.wallet.jcStandard .evolve721NFT({ nftAddress, @@ -460,17 +452,17 @@ function evolveNft721( funId, JSON.stringify({ errcode: 0, - data: result, + data: JSON.stringify(result), }) ); }) .catch((err) => { jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err})); }); - } } function evolveChip(funId, tokenIds, startTime, nonce, signature) { + tokenIds = JSON.parse(tokenIds) jc.wallet.jcStandard .evolveChip({ tokenIds, @@ -483,7 +475,7 @@ function evolveChip(funId, tokenIds, startTime, nonce, signature) { funId, JSON.stringify({ errcode: 0, - data: result, + data: JSON.stringify(result), }) ); }) @@ -500,6 +492,9 @@ function mintShardBatchUser( nonce, signature ) { + tokenIds = JSON.parse(tokenIds) + amounts = JSON.parse(amounts) + jc.wallet.jcStandard .mintShardBatchUser({ tokenIds, @@ -513,7 +508,7 @@ function mintShardBatchUser( funId, JSON.stringify({ errcode: 0, - data: result, + data: JSON.stringify(result), }) ); }) @@ -534,6 +529,9 @@ function shardMixByUser( nonce, signature ) { + ids = JSON.parse(ids) + amounts = JSON.parse(amounts) + jc.wallet.jcStandard .shardMixByUser({ tokenId, @@ -551,14 +549,15 @@ function shardMixByUser( funId, JSON.stringify({ errcode: 0, - data: result, + data: JSON.stringify(result), }) ); }) .catch((err) => { jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err})); }); -} + } + // addresses: [nftId, chip, sign_address] // values: [token_id,salt_nonce,startTime]