add connect third wallet

This commit is contained in:
CounterFire2023 2023-12-13 15:30:47 +08:00
parent 9daf77c83a
commit c81e5d0071
4 changed files with 48 additions and 31 deletions

File diff suppressed because one or more lines are too long

View File

@ -36,6 +36,11 @@ function walletLogin(funId, channel, env, account) {
promiseCb(funId, jc.wallet.preLogin(channel, env, account));
}
function logout(funId, channel) {
channel = parseInt(channel || '0');
promiseCb(funId, jc.wallet.logout(channel));
}
function updateGameInfo(funId, info) {
jsb.updateGameInfo(funId, info);
promiseCb(funId, Promise.resolve(1));
@ -69,11 +74,10 @@ function verifyPassword(funId, pass) {
* init third party wallet
* @param {number | string} chain chain id
*/
function initThirdPartyWallet(funId, chain, env) {
function initThirdPartyWallet(funId, chain, env, wallettype, provider) {
chain = parseInt(chain);
promiseCb(funId, jc.wallet.initThirdPartyWallet(chain, env), () => {
return jc.wallet.currentAccount();
});
wallettype = parseInt(wallettype || '1');
promiseCb(funId, jc.wallet.initThirdPartyWallet(chain, env, wallettype, provider));
}

View File

@ -17,6 +17,15 @@ if (jc.wallet.platform !== 'web') {
args.unshift('initInternalWallet');
callProxyMethod.apply(this, args);
}
/**
* connect thirdparty wallet
* @param {number | string} chain chain id
* @param {string} pass
*/
function initThirdPartyWallet(...args) {
args.unshift('initThirdPartyWallet');
callProxyMethod.apply(this, args);
}
/**
* verify if password is correct
* compare with local password hash

View File

@ -11,6 +11,10 @@ const pages = {
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);