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)); 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) { function updateGameInfo(funId, info) {
jsb.updateGameInfo(funId, info); jsb.updateGameInfo(funId, info);
promiseCb(funId, Promise.resolve(1)); promiseCb(funId, Promise.resolve(1));
@ -69,11 +74,10 @@ function verifyPassword(funId, pass) {
* init third party wallet * init third party wallet
* @param {number | string} chain chain id * @param {number | string} chain chain id
*/ */
function initThirdPartyWallet(funId, chain, env) { function initThirdPartyWallet(funId, chain, env, wallettype, provider) {
chain = parseInt(chain); chain = parseInt(chain);
promiseCb(funId, jc.wallet.initThirdPartyWallet(chain, env), () => { wallettype = parseInt(wallettype || '1');
return jc.wallet.currentAccount(); promiseCb(funId, jc.wallet.initThirdPartyWallet(chain, env, wallettype, provider));
});
} }

View File

@ -17,6 +17,15 @@ if (jc.wallet.platform !== 'web') {
args.unshift('initInternalWallet'); args.unshift('initInternalWallet');
callProxyMethod.apply(this, args); 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 * verify if password is correct
* compare with local password hash * compare with local password hash

View File

@ -11,6 +11,10 @@ const pages = {
let res = await callMethod('walletLogin', '0', 'dev'); let res = await callMethod('walletLogin', '0', 'dev');
console.log(res); console.log(res);
}, },
okx: async function() {
let res = await callMethod('initThirdPartyWallet', '421613', 'dev', '2', window.okxwallet);
console.log(res);
},
// loginWithTiktok: async function() { // loginWithTiktok: async function() {
// let res = await callMethod('walletLogin', '2', 'dev'); // let res = await callMethod('walletLogin', '2', 'dev');
// console.log(res); // console.log(res);