update js lib
This commit is contained in:
parent
8c6aa18bce
commit
6a6b3acc8e
File diff suppressed because one or more lines are too long
@ -32,11 +32,11 @@ function walletLogin(funId, channel) {
|
|||||||
* @param {number | string} chain chain id
|
* @param {number | string} chain chain id
|
||||||
* @param {string} pass
|
* @param {string} pass
|
||||||
*/
|
*/
|
||||||
function initInternalWallet(funId, chain, pass) {
|
function initInternalWallet(funId, chain, pass, env) {
|
||||||
chain = parseInt(chain);
|
chain = parseInt(chain);
|
||||||
const wallet =
|
const wallet =
|
||||||
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
|
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
|
||||||
promiseCb(funId, wallet.initInternalWallet(chain, pass), () => {
|
promiseCb(funId, wallet.initInternalWallet(chain, pass, env), () => {
|
||||||
return jc.wallet.nativeAccount;
|
return jc.wallet.nativeAccount;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -52,11 +52,11 @@ 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) {
|
function initThirdPartyWallet(funId, chain, env) {
|
||||||
chain = parseInt(chain);
|
chain = parseInt(chain);
|
||||||
const wallet =
|
const wallet =
|
||||||
!window.jc || !jc.wallet ? new jcwallet.default({ type: 1 }) : jc.wallet;
|
!window.jc || !jc.wallet ? new jcwallet.default({ type: 1 }) : jc.wallet;
|
||||||
promiseCb(funId, wallet.initThirdPartyWallet(chain), () => {
|
promiseCb(funId, wallet.initThirdPartyWallet(chain, env), () => {
|
||||||
return jc.wallet.currentAccount();
|
return jc.wallet.currentAccount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -488,6 +488,11 @@ function emailRegist(funId, email, password, code) {
|
|||||||
promiseCb(funId, wallet.emailVerifySvr.registByEmail(email, password, code));
|
promiseCb(funId, wallet.emailVerifySvr.registByEmail(email, password, code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* login with email
|
||||||
|
* @param {*} email
|
||||||
|
* @param {*} password
|
||||||
|
*/
|
||||||
function emailLogin(funId, email, password) {
|
function emailLogin(funId, email, password) {
|
||||||
const wallet =
|
const wallet =
|
||||||
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
|
!window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
|
||||||
@ -505,3 +510,12 @@ function tokenList(funId) {
|
|||||||
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
|
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* calc token price of USD
|
||||||
|
* token must already be in DEX
|
||||||
|
* @param {*} tokenName
|
||||||
|
* @param {*} amount
|
||||||
|
*/
|
||||||
|
function tokenPrice(funId, tokenName, amount) {
|
||||||
|
promiseCb(funId, jc.wallet.calcTokenPrice(tokenName, amount));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user