Reference
AirService
ts
class AirService {
constructor({ partnerId: string; });
get buildEnv(): BUILD_ENV_TYPE; // available env: SANDBOX
get isInitialized(): boolean;
get isLoggedIn(): boolean;
get isWalletInitialized(): boolean;
get provider(): EIP1193Provider;
init({
buildEnv: BUILD_ENV_TYPE;
enableLogging: boolean;
skipRehydration: boolean;
preloadWallet: boolean;
preloadCredential: boolean;
}): Promise<AirLoginResult | null>;
login(options?: { authToken?: string }): Promise<AirLoginResult>;
isSmartAccountDeployed(): Promise<boolean>;
deploySmartAccount(): Promise<{ txHash: string }>;
getProvider(): EIP1193Provider;
preloadWallet(): Promise<void>;
preloadCredential(): Promise<void>;
setupOrUpdateMfa(): Promise<void>;
getUserInfo(): Promise<AirUserDetails>;
goToPartner(partnerUrl: string): Promise<{ urlWithToken: string }>;
getAccessToken(): Promise<{ token: string }>;
showSwapUI(options?: {
initialFromToken?: string;
fallbackFromToken?: string;
initialToToken?: string;
}): Promise<{ txHash: `0x${string}` }>;
showOnRampUI(options: {
displayCurrencyCode: string;
targetCurrencyCode?: string;
}): Promise<void>;
issueCredential({
authToken: string;
issuerDid: string;
credentialId: string;
credentialSubject: Record<string, unknown>;
}): Promise<void>;
verifyCredential({
authToken: string;
programId: string;
redirectUrl?: string;
}): Promise<CredentialVerificationResult>;
logout(): Promise<void>;
cleanUp(): Promise<void>;
on(listener: AirEventListener): void;
off(listener: AirEventListener): void;
clearEventListeners(): void;
}Types
ts
export type AirIdDetails = {
id: string;
name?: string;
node: string;
status: "minting" | "minted";
chainId: number;
imageUrl?: string;
};
export type AirUserDetails = {
partnerId?: string;
partnerUserId?: string;
airId?: AirIdDetails;
user: {
id: string;
abstractAccountAddress?: string;
email?: string;
isMFASetup: boolean;
};
};
export type AirInitializationResult = {
rehydrated: boolean;
};
export type AirLoginResult = {
isLoggedIn: boolean;
id: string;
abstractAccountAddress?: string;
token: string;
isMFASetup: boolean;
};
export type AirWalletInitializedResult = {
abstractAccountAddress: string | null;
isMFASetup: boolean;
};
export type CredentialVerificationResult =
| {
status:
| "Non-Compliant"
| "Pending"
| "Revoking"
| "Revoked"
| "Expired"
| "NotFound";
}
| {
status: "Compliant";
zkProofs: Record<string, string>;
transactionHash: string;
};
export type ClaimAirIdResult = {
airId: AirIdDetails;
};
export type AirEventOnInitialized = {
event: "initialized";
result: AirInitializationResult;
};
export type AirEventOnLoggedIn = {
event: "logged_in";
result: AirLoginResult;
};
export type AirEventOnAirIdMintingStarted = {
event: "air_id_minting_started";
};
export type AirEventOnAirIdMintingFailed = {
event: "air_id_minting_failed";
errorMessage?: string;
};
export type AirEventOnLoggedOut = {
event: "logged_out";
};
export type AirEventOnWalletInitialized = {
event: "wallet_initialized";
result: AirWalletInitializedResult;
};
export type AirEventData =
| AirEventOnInitialized
| AirEventOnLoggedIn
| AirEventOnWalletInitialized
| AirEventOnAirIdMintingStarted
| AirEventOnAirIdMintingFailed
| AirEventOnLoggedOut;
export type AirEventListener = (data: AirEventData) => void;
export type ClaimAirIdOptions =
| {
token?: string;
background?: false;
}
| {
token: string;
background: true;
};