增加账号email认证相关接口,增加开始购买的接口
This commit is contained in:
parent
1824e4230e
commit
1a1ca431e3
@ -28,7 +28,9 @@ import {
|
||||
loadInternalWallet,
|
||||
restoreWalletByMnemonic,
|
||||
} from "./manage/WalletManage";
|
||||
import { EmailVerifySvr } from "./services/EmailVerifySvr";
|
||||
import { NativeSvr } from "./services/NativeSvr";
|
||||
import { PaySvr } from "./services/PaySvr";
|
||||
import { TranHistorySvr } from "./services/TranHistorySvr";
|
||||
import { ChainCommon } from "./standards/ChainCommon";
|
||||
import { ERC1155Standard } from "./standards/ERC1155Standard";
|
||||
@ -70,6 +72,8 @@ export default class JCWallet {
|
||||
public jcStandard: JCStandard;
|
||||
public nativeSvr: NativeSvr;
|
||||
public historySvr: TranHistorySvr;
|
||||
public emailVerifySvr: EmailVerifySvr;
|
||||
public paySvr: PaySvr;
|
||||
public wConnect: ZWalletConnect;
|
||||
public mainHandlers = createWalletEvents();
|
||||
public data: IAccount[] = [];
|
||||
@ -84,6 +88,8 @@ export default class JCWallet {
|
||||
constructor({ type, chain }: { type: number; chain: number }) {
|
||||
this.nativeSvr = new NativeSvr();
|
||||
this.historySvr = new TranHistorySvr();
|
||||
this.emailVerifySvr = new EmailVerifySvr();
|
||||
this.paySvr = new PaySvr();
|
||||
this.walletType = type;
|
||||
chain = chain || 80001;
|
||||
let data = AllChains.find((o) => o.id === chain);
|
||||
|
30
src/services/EmailVerifySvr.ts
Normal file
30
src/services/EmailVerifySvr.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { updateEmailVerify } from "../api/PayApi";
|
||||
import { isEmailVerified } from "../api/WalletApi";
|
||||
import { singleton } from "../decorator/singleton.decorator";
|
||||
|
||||
@singleton
|
||||
export class EmailVerifySvr {
|
||||
/**
|
||||
* Checks if the user's email is verified
|
||||
* @returns an object containing the verification status and the user's email
|
||||
*/
|
||||
public async checkEmailVerified() {
|
||||
let res = await isEmailVerified();
|
||||
let verified = 0;
|
||||
let email = "";
|
||||
if (!res.errcode) {
|
||||
verified = res.data.verified;
|
||||
email = res.data?.email;
|
||||
}
|
||||
return { verified, email };
|
||||
}
|
||||
/**
|
||||
* Begins the process of verifying the user's email
|
||||
* @param email - the email to be verified
|
||||
* @returns a Promise that resolves to the result of the updateEmailVerify API call
|
||||
*/
|
||||
|
||||
public async beginVerifyEmail(email: string) {
|
||||
return updateEmailVerify({ email });
|
||||
}
|
||||
}
|
15
src/services/PaySvr.ts
Normal file
15
src/services/PaySvr.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { alchemyPrePay } from "../api/PayApi";
|
||||
import { singleton } from "../decorator/singleton.decorator";
|
||||
import { IPayData } from "../types/data.types";
|
||||
|
||||
@singleton
|
||||
export class PaySvr {
|
||||
/**
|
||||
* Calls the alchemyPrePay function with the given data.
|
||||
* @param data - The data to be passed to the alchemyPrePay function.
|
||||
* @returns The result of the alchemyPrePay function.
|
||||
*/
|
||||
public async alchemyPrePay(data: IPayData) {
|
||||
return alchemyPrePay(data);
|
||||
}
|
||||
}
|
@ -7,3 +7,9 @@ export interface IChainData {
|
||||
explorerurl: string;
|
||||
decimals?: number;
|
||||
}
|
||||
|
||||
export interface IPayData {
|
||||
address: string;
|
||||
chain: string;
|
||||
currency: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user