2023-12-13 19:30:46 +08:00

216 lines
6.8 KiB
JavaScript

var address = '0x1c2d7640d9510569ef2687b7729be8e1583c2781';
const pages = {
closePage: async function () {
callNative({ action: 'closepage' });
},
loginWithApple: async function () {
let res = await callMethod('walletLogin', '1', 'dev');
console.log(res);
},
loginWithGoogle: async function () {
let res = await callMethod('walletLogin', '0', 'dev');
console.log(res);
},
okx: async function() {
let res = await callMethod('initThirdPartyWallet', '421613', 'dev', '2', window.okxwallet);
console.log(res);
},
// loginWithTiktok: async function() {
// let res = await callMethod('walletLogin', '2', 'dev');
// console.log(res);
// },
// loginWithFacebook: async function() {
// let res = await callMethod('walletLogin', '3', 'dev');
// console.log(res);
// },
// loginWithTwitter: async function() {
// let res = await callMethod('walletLogin', '4', 'dev');
// console.log(res);
// },
initInternalWallet: async function () {
let res = await callMethod('initInternalWallet', '421613', '111111', 'dev');
console.log(res);
},
loginSign: async function () {
let res = await callMethod('loginSign', '421613', 'sign for login');
console.log(res);
},
exportWalletSecKey: async function () {
let res = await callMethod('exportWalletSecKey', '111111');
console.log(res);
},
currentChain: async function () {
let res = await callMethod('currentChain');
console.log(res);
},
tokenList: async function () {
let res = await callMethod('tokenList');
console.log(res);
},
scanQRCode: async function () {
let res = await callMethod('scanQRCode', 'scan');
console.log(res);
},
showQRCode: async function () {
let res = await callMethod('showQRCode', address);
console.log(res);
},
verifyPassword: async function () {
let res = await callMethod('verifyPassword', '111111');
console.log(res);
},
getEthBalance: async function () {
let res = await callMethod('getEthBalance', address);
console.log(res);
},
erc20Balance: async function () {
let res = await callMethod('erc20Balance', '0xaa34B79A0Ab433eaC900fB3CB9f191F5Cd27501D', address);
console.log(res);
},
erc721Balance: async function () {
let res = await callMethod(
'erc721Balance',
'0x3F13F83E6363D97d0353cAAfACA08B05D9BF3637',
'0xb217e9529bf2208e76d9016b7411f335e30f0ad5',
'42161'
);
console.log(res);
},
sendEth: async function () {
let res = await callMethod('sendEth', address, '0.01', '0');
console.log(res);
},
marketSellNFT: async function () {
let res = await callMethod(
'marketSellNFT',
'0xE6A69474E04B93De50dd07F239d62879dB9bF716',
'0x8dd1439E0C3254b4543d6D68b3C0C891E5Bd2eCE',
'1043423364010011',
'5000000000000000000',
'1',
'0'
);
console.log(res);
},
marketCancelOrder: async function () {
let res = await callMethod('marketCancelOrder', '2');
console.log(res);
},
marketUpdatePrice: async function () {
let res = await callMethod('marketUpdatePrice', '2', '5100000000000000000');
console.log(res);
},
marketBuy: async function () {
let res = await callMethod('marketBuy', '2');
console.log(res);
},
gameMallBuy: async function () {
let res = await callMethod(
'gameMallBuy',
'50436890550010088000000000000000000000000000000000000000000000000000000000000',
'0x2C7221588D4FBac2585D71618CD540e74c7413B8',
'1000000000000000000',
'1687163482',
'50436890550010088000000000000000000000000000000000000000000000000000000000000',
'0xb660bbc0131663be938c839ac9c8bfba4800cadde7c5c75ef14cea38d65ee46742c2893c42270d354beef5bf8482e2650553c10f5d00da0d30bdf4727e6e31111b'
);
console.log(res);
},
gameMarketBuy: async function () {
let res = await callMethod(
'gameMarketBuy',
'50436890550040088000000000000000000000000000000000000000000000000000000000000',
'0x50A8e60041A206AcaA5F844a1104896224be6F39',
'0x2C7221588D4FBac2585D71618CD540e74c7413B8',
'1000000000000000000',
'1687166158',
'50436890550040088000000000000000000000000000000000000000000000000000000000000',
'0x7be41f445add96f30df8877f340a5b1e6ac51a665d4e98542d012ac4cc1315d56fda2d65b1b92bd3bcf174e608a1066ff24cc7afbd712ab40ab78bbfa91d0f081b'
);
console.log(res);
},
nftMallBuy: async function () {
let res = await callMethod(
'nftMallBuy',
'0x2C7221588D4FBac2585D71618CD540e74c7413B8',
'["0xae37bb7BcA26Bab9a11D8BaE8fdB97f63b82c189"], ["10"], ["1"], ["50436890550040088000000000000000000000000000000000000000000000000000000000000","1000000000000000000","1687259171","50436890550040088000000000000000000000000000000000000000000000000000000000000"]',
'0xee9d497dac1ec563800a112424fb8f423610ff3996877049493e273fe9ec5e9610c441eeb19de4eaf190f2ac084da250eac3ea2b29ca1c397c2c3cfd246bfd5d1c'
);
console.log(res);
},
stakeNfts: async function () {
let res = await callMethod(
'stakeNfts',
'["0xEbC170185ad614C05Af38C820020b70E458717F5","0xEbC170185ad614C05Af38C820020b70E458717F5"]',
'["2","3"]',
'["2592000","2592000"]'
);
console.log(res);
},
redeemNfts: async function () {
let res = await callMethod(
'redeemNfts',
'["0xEbC170185ad614C05Af38C820020b70E458717F5","0xEbC170185ad614C05Af38C820020b70E458717F5"]',
'["2","3"]'
);
console.log(res);
},
queryGoogleProducts: async function () {
let res = await callMethod('queryGoogleProducts', '["2999"]');
console.log(res);
},
queryGooglePurchases: async function () {
let res = await callMethod('queryGooglePurchases', '');
console.log(res);
},
beginGoogleBuy: async function () {
let res = await callMethod('beginGoogleBuy', '2999', '3F13F83E6363D97d0353cAAfACA08B05D9BF3637');
console.log(res);
},
tokenPrice: async function () {
let res = await callMethod('tokenPrice', 'USDT', '1');
console.log(res);
},
emailInfo: async function () {
let res = await callMethod('emailInfo');
console.log(res);
},
getPass: async function() {
let res = await callMethod('restorePassLocal', '0x1c2d7640d9510569ef2687b7729be8e1583c2781');
console.log(res);
},
savePassCloud: async function() {
let res = await callMethod('storePassLocal', '0x1c2d7640d9510569ef2687b7729be8e1583c2781', '111111');
console.log(res);
}
};
// 根据上面的事件列表, 在页面上显示按钮
let app = document.getElementById('app');
for (let key in pages) {
let button = document.createElement('button');
button.innerText = key;
button.addEventListener('click', pages[key]);
app.appendChild(button);
}
window.addEventListener('envready', (e) => {
console.log('接受到环境初始化事件, 可以显示登录按钮了');
});