完善tiktok登陆

This commit is contained in:
cebgcontract 2022-12-15 12:05:57 +08:00
parent 8cfc528f08
commit 06a91b3e36
3 changed files with 15 additions and 15 deletions

View File

@ -13,7 +13,7 @@ export function appleAuth(idToken: string) {
export function tikTokAuth(idToken: string) {
const url = `${WALLET_API_HOST}/wallet/login/tiktok`;
return POST_JSON(url, { token: idToken });
return POST_JSON(url, { code: idToken });
}
export function getWalletInfo() {

View File

@ -210,7 +210,7 @@ export default class JCWallet {
this.createAccount();
}
public restoreFromMnemonic(mnemonic: string, password: string) {
private restoreFromMnemonic(mnemonic: string, password: string) {
this.password = password;
this.wallet.clear();
restoreWalletByMnemonic(mnemonic, this.password);
@ -231,7 +231,7 @@ export default class JCWallet {
this.updateListType("tokens");
resolve && resolve(this.currentChain);
} else {
console.log("third parth wallet change chain: " + chainId);
console.log("third party wallet change chain: " + chainId);
const chainData = this.chainMap.get(chainId);
this.wConnect
.addOrChangeChain(chainData)
@ -281,7 +281,7 @@ export default class JCWallet {
}
get currentAccountData() {
let address = this.currentAccount().address;
let address = this.currentAccAddr;
const chain = this.currentChain.id;
let data = this.data.find((o) => o.address === address);
if (!data) {
@ -394,7 +394,7 @@ export default class JCWallet {
}
public async sendEth(to: string, amount: number | string) {
let from = this.currentAccount().address;
let from = this.currentAccAddr;
const amountToSend = this.web3.utils.toWei(amount + "", "ether");
let gas = await this.web3.eth.estimateGas({
from,
@ -404,9 +404,9 @@ export default class JCWallet {
this.web3.eth.sendTransaction({ from, to, gas, value: amountToSend });
}
public async getBalance(address?: string) {
console.log("get balance with address: ", address);
let balance = await this.chainCommon.getBalance(address);
public async getBalance(account?: string) {
console.log("get balance with address: ", account);
let balance = await this.chainCommon.getBalance(account);
return balance;
}
@ -464,14 +464,14 @@ export default class JCWallet {
public async erc20Balance(address: string, account?: string) {
if (!account) {
account = this.currentAccount().address;
account = this.currentAccAddr;
}
let result = await this.erc20Standard.getBalanceOf(address, account);
return result;
}
public async sendErc20(address: string, to: string, amount: string) {
let from = this.currentAccount().address;
let from = this.currentAccAddr;
let result = await this.erc20Standard.transfer({
address,
from,
@ -506,7 +506,7 @@ export default class JCWallet {
account: string,
refresh: boolean
) {
account = account || this.currentAccount().address;
account = account || this.currentAccAddr;
const chain = this.wallet.currentChain.id;
const { categor, type } = getTypeByAddress(chain, address);
let nfts = [];
@ -522,7 +522,7 @@ export default class JCWallet {
}
public async nftList(address: string, account?: string) {
account = account || this.currentAccount().address;
account = account || this.currentAccAddr;
const chain = this.wallet.currentChain.id;
const amount = await this.erc721Standard.getBalance(address, account);
const { categor, type } = getTypeByAddress(chain, address);
@ -545,7 +545,7 @@ export default class JCWallet {
}
public async sendNFT(address: string, to: string, tokenId: string) {
let from = this.currentAccount().address;
let from = this.currentAccAddr;
let result = await this.erc721Standard.transfer({
address,
from,
@ -559,7 +559,7 @@ export default class JCWallet {
public async erc1155List(address: string, account?: string) {
if (!account) {
account = this.currentAccount().address;
account = this.currentAccAddr;
}
}
//TODO::

View File

@ -14,7 +14,7 @@ export class NativeSvr {
return new Promise((resolve, reject) => {
this._subscribeToResponse(id, (result) => {
if (result.errcode) {
reject(result.errcode);
reject(result.errmessage || result.errcode);
return;
}
resolve(result.data);