增加一些文档

This commit is contained in:
zhl 2023-05-12 17:50:37 +08:00
parent 72e8e91151
commit 60d1e913c5

View File

@ -11,9 +11,8 @@ function promiseCb(funId, promiseFun, dataParser) {
}); });
} }
/** /**
* oauth login for before init internal wallet * oauth login before init internal wallet
* @param {*} funId * @param {*} channel 0: google, 1: apple, 2: tiktok, 3: facebook, 4: twitter 5: tg
* @param {*} channel 0: google, 1: apple, 2: tiktok, 3: facebook, 4: twitter 5: tg, 6: email
*/ */
function walletLogin(funId, channel) { function walletLogin(funId, channel) {
channel = parseInt(channel); channel = parseInt(channel);
@ -24,9 +23,8 @@ function walletLogin(funId, channel) {
} }
/** /**
* init internal wallet with password * init internal wallet with password
* @param {*} funId * @param {number | string} chain chain id
* @param {*} chain * @param {string} pass
* @param {*} pass
*/ */
function initInternalWallet(funId, chain, pass) { function initInternalWallet(funId, chain, pass) {
chain = parseInt(chain); chain = parseInt(chain);
@ -48,7 +46,8 @@ function initInternalWallet(funId, chain, pass) {
} }
/** /**
* verify if password is correct * verify if password is correct
* @param {*} pass * compare with local password hash
* @param {string} pass password for wallet
*/ */
function verifyPassword(funId, pass) { function verifyPassword(funId, pass) {
try { try {
@ -60,8 +59,7 @@ function verifyPassword(funId, pass) {
} }
/** /**
* init third party wallet * init third party wallet
* @param {*} funId * @param {number | string} chain chain id
* @param {*} chain
*/ */
function initThirdPartyWallet(funId, chain) { function initThirdPartyWallet(funId, chain) {
chain = parseInt(chain); chain = parseInt(chain);
@ -477,29 +475,54 @@ function tokenHistory(funId, start, limit, address, tokenId) {
} }
// ======= end of transaction history ======= // ======= end of transaction history =======
/**
* get email info of current user
*/
function emailInfo(funId) { function emailInfo(funId) {
promiseCb(funId, jc.wallet.emailVerifySvr.checkEmailVerified()); promiseCb(funId, jc.wallet.emailVerifySvr.checkEmailVerified());
} }
/**
* send code with email
* @param {*} email
* @param {*} type
*/
function sendEmailCode(funId, email, type) { function sendEmailCode(funId, email, type) {
promiseCb(funId, jc.wallet.emailVerifySvr.sendEmailCode(email, type)); const wallet =
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailVerifySvr.sendEmailCode(email, type));
} }
/**
* verify email with code, and update email
* @param {*} email
* @param {*} code
*/
function verifyEmail(funId, email, code) { function verifyEmail(funId, email, code) {
promiseCb(funId, jc.wallet.emailVerifySvr.updateEmailVerify(email, code)); promiseCb(funId, jc.wallet.emailVerifySvr.updateEmailVerify(email, code));
} }
/**
* check if email had already been registed
* @param {*} email
*/
function checkEmailExists(funId, email) { function checkEmailExists(funId, email) {
promiseCb(funId, jc.wallet.emailVerifySvr.isEmailRegister(email)); const wallet =
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailVerifySvr.isEmailRegister(email));
} }
/**
* regist with email
* @param {*} email
* @param {*} password
* @param {*} code
*/
function emailRegist(funId, email, password, code) { function emailRegist(funId, email, password, code) {
promiseCb( const wallet =
funId, !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
jc.wallet.emailVerifySvr.registByEmail(email, password, code) promiseCb(funId, wallet.emailVerifySvr.registByEmail(email, password, code));
);
} }
function emailLogin(funId, email, password) { function emailLogin(funId, email, password) {
promiseCb(funId, jc.wallet.emailLogin(email, password)); const wallet =
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailLogin(email, password));
} }