update wallet js lib

This commit is contained in:
zhl 2023-05-12 17:35:41 +08:00
parent 5fb29b98f8
commit 9a21184d36
2 changed files with 36 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,13 +21,7 @@ function walletLogin(funId, channel) {
const wallet = !window.jc || !jc.wallet
? new jcwallet.default({ type: 0 })
: jc.wallet;
wallet.preLogin(channel)
.then((result) => {
jsb.jcCallback(funId, JSON.stringify({ errcode: 0, data: result }));
})
.catch((err) => {
jsb.jcCallback(funId, JSON.stringify({ errcode: 1, errmsg: err }));
});
promiseCb(funId, wallet.preLogin(channel));
}
/**
* init internal wallet with password
@ -64,7 +58,7 @@ function initInternalWallet(funId, chain, pass) {
function verifyPassword(funId, pass) {
try {
let result = jsb.verifyLocalPass(pass);
return JSON.stringify({ errcode: 0, data: { result } });
return JSON.stringify({ errcode: 0, data: result });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err });
}
@ -260,7 +254,7 @@ function scanQRCode(funId, title) {
promiseCb(funId, jc.wallet.nativeSvr.scanQRCode(title));
}
function exportWalletSecKey(funId) {
function exportWalletSecKey(funId, pass) {
try {
let key = jsb.walletSecKey(funId);
return JSON.stringify({ errcode: 0, data: key });
@ -493,3 +487,23 @@ function tokenHistory(funId, start, limit, address, tokenId) {
function emailInfo(funId) {
promiseCb(funId, jc.wallet.emailVerifySvr.checkEmailVerified());
}
function sendEmailCode(funId, email, type) {
promiseCb(funId, jc.wallet.emailVerifySvr.sendEmailCode(email, type));
}
function verifyEmail(funId, email, code) {
promiseCb(funId, jc.wallet.emailVerifySvr.updateEmailVerify(email, code));
}
function checkEmailExists(funId, email) {
promiseCb(funId, jc.wallet.emailVerifySvr.isEmailRegister(email));
}
function emailRegist(funId, email, password, code) {
promiseCb(funId, jc.wallet.emailVerifySvr.registByEmail(email, password, code));
}
function emailLogin(funId, email, password) {
promiseCb(funId, jc.wallet.emailLogin(email, password));
}