@mocanetwork/airkit 1.4.0 → 1.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/airkit.cjs.js +139 -27
- package/dist/airkit.esm.js +139 -27
- package/dist/airkit.umd.js +139 -27
- package/dist/types/airService.d.ts +30 -1
- package/dist/types/authMessageService.d.ts +4 -1
- package/dist/types/common/air/credentials/types.d.ts +19 -0
- package/dist/types/common/air/messaging/auth.d.ts +68 -22
- package/dist/types/common/air/messaging/const.d.ts +6 -0
- package/dist/types/common/air/messaging/messageServiceBase.d.ts +1 -1
- package/dist/types/common/air/messaging/wallet.d.ts +13 -1
- package/dist/types/common/const.d.ts +15 -15
- package/dist/types/common/realm/user/types.d.ts +1 -1
- package/dist/types/common/types.d.ts +1 -1
- package/dist/types/common/utils.d.ts +0 -8
- package/dist/types/iframeController.d.ts +3 -1
- package/dist/types/interfaces.d.ts +2 -0
- package/dist/types/recoveryMessageService.d.ts +1 -1
- package/dist/types/walletMessageService.d.ts +4 -0
- package/package.json +1 -1
- package/dist/types/common/realm/partner/config.d.ts +0 -36
- package/dist/types/common/realm/wallet/bybit/bybit.d.ts +0 -2
- package/dist/types/common/realm/wallet/coinbase/coinbase.d.ts +0 -2
- package/dist/types/common/realm/wallet/cryptoCom/cryptoCom.d.ts +0 -2
- package/dist/types/common/realm/wallet/index.d.ts +0 -25
- package/dist/types/common/realm/wallet/metamask/metamask.d.ts +0 -2
- package/dist/types/common/realm/wallet/okx/okx.d.ts +0 -2
- package/dist/types/common/realm/wallet/phantom/phantom.d.ts +0 -2
- package/dist/types/common/realm/wallet/rabby/rabby.d.ts +0 -2
- package/dist/types/common/realm/wallet/rainbow/rainbow.d.ts +0 -2
- package/dist/types/common/realm/wallet/trust/trust.d.ts +0 -2
|
@@ -4,6 +4,8 @@ export declare const AirWalletMessageTypes: {
|
|
|
4
4
|
readonly SERVICE_STARTED: "air_service_started";
|
|
5
5
|
readonly INITIALIZATION_REQUEST: "air_initialization_request";
|
|
6
6
|
readonly INITIALIZATION_RESPONSE: "air_initialization_response";
|
|
7
|
+
readonly CLOSE_MODAL_REQUEST: "air_close_modal_request";
|
|
8
|
+
readonly CLOSE_MODAL_RESPONSE: "air_close_modal_response";
|
|
7
9
|
readonly INIT_AUTH_COMMUNICATION: "air_init_auth_communication";
|
|
8
10
|
readonly WALLET_INITIALIZED: "air_wallet_initialized";
|
|
9
11
|
readonly WALLET_LOGIN_REQUEST: "air_wallet_login_request";
|
|
@@ -14,6 +16,8 @@ export declare const AirWalletMessageTypes: {
|
|
|
14
16
|
readonly CLAIM_ID_RESPONSE: "air_claim_id_response";
|
|
15
17
|
readonly SHOW_SWAP_UI_REQUEST: "air_show_swap_ui_request";
|
|
16
18
|
readonly SHOW_SWAP_UI_RESPONSE: "air_show_swap_ui_response";
|
|
19
|
+
readonly SHOW_ON_RAMP_UI_REQUEST: "air_show_on_ramp_ui_request";
|
|
20
|
+
readonly SHOW_ON_RAMP_UI_RESPONSE: "air_show_on_ramp_ui_response";
|
|
17
21
|
readonly DEPLOY_SMART_ACCOUNT_REQUEST: "air_deploy_smart_account_request";
|
|
18
22
|
readonly DEPLOY_SMART_ACCOUNT_RESPONSE: "air_deploy_smart_account_response";
|
|
19
23
|
readonly WALLET_IFRAME_VISIBILITY_REQUEST: "air_wallet_iframe_visibility_request";
|
|
@@ -56,6 +60,7 @@ export type AirSetupOrUpdateMfaResponseMessage = AirWalletMessageBase<"air_setup
|
|
|
56
60
|
export type AirClaimIdRequestMessage = AirWalletMessageBase<"air_claim_id_request", {
|
|
57
61
|
token?: string;
|
|
58
62
|
claimInBackground?: boolean;
|
|
63
|
+
offchain?: boolean;
|
|
59
64
|
}>;
|
|
60
65
|
export type AirClaimIdSuccess = AirMessageSuccessPayload & {
|
|
61
66
|
airId: AirIdDetails;
|
|
@@ -67,6 +72,11 @@ export type AirShowSwapUISuccess = AirMessageSuccessPayload & {
|
|
|
67
72
|
txHash: `0x${string}`;
|
|
68
73
|
};
|
|
69
74
|
export type AirShowSwapUIResponseMessage = AirWalletMessageBase<"air_show_swap_ui_response", AirShowSwapUISuccess | AirMessageErrorPayload>;
|
|
75
|
+
export type AirShowOnRampUIRequestMessage = AirWalletMessageBase<"air_show_on_ramp_ui_request", {
|
|
76
|
+
displayCurrencyCode: string;
|
|
77
|
+
targetCurrencyCode?: string;
|
|
78
|
+
}>;
|
|
79
|
+
export type AirShowOnRampUIResponseMessage = AirWalletMessageBase<"air_show_on_ramp_ui_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
70
80
|
export type AirInitAuthCommunicationMessage = AirWalletMessageBase<"air_init_auth_communication", {
|
|
71
81
|
skipWalletLogin: boolean;
|
|
72
82
|
}>;
|
|
@@ -83,5 +93,7 @@ export type AirWalletIframeVisibilityRequestMessage = AirWalletMessageBase<"air_
|
|
|
83
93
|
}>;
|
|
84
94
|
export type AirLogoutRequestMessage = AirWalletMessageBaseWithoutPayload<"air_logout_request">;
|
|
85
95
|
export type AirLogoutResponseMessage = AirWalletMessageBase<"air_logout_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
86
|
-
export type
|
|
96
|
+
export type AirCloseModalRequestMessage = AirWalletMessageBaseWithoutPayload<"air_close_modal_request">;
|
|
97
|
+
export type AirCloseModalResponseMessage = AirWalletMessageBase<"air_close_modal_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
98
|
+
export type AirWalletMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirWalletInitializedMessage | AirWalletLoginRequestMessage | AirWalletLoginResponseMessage | AirSetupOrUpdateMfaRequestMessage | AirSetupOrUpdateMfaResponseMessage | AirClaimIdRequestMessage | AirClaimIdResponseMessage | AirShowSwapUIRequestMessage | AirShowSwapUIResponseMessage | AirShowOnRampUIRequestMessage | AirShowOnRampUIResponseMessage | AirInitAuthCommunicationMessage | AirIsSmartAccountDeployedRequestMessage | AirIsSmartAccountDeployedResponseMessage | AirDeploySmartAccountRequestMessage | AirDeploySmartAccountResponseMessage | AirWalletIframeVisibilityRequestMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirCloseModalRequestMessage | AirCloseModalResponseMessage;
|
|
87
99
|
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export declare const mocaTestnet: {
|
|
2
|
-
id:
|
|
3
|
-
name:
|
|
4
|
-
nativeCurrency: {
|
|
5
|
-
decimals:
|
|
6
|
-
name:
|
|
7
|
-
symbol:
|
|
2
|
+
readonly id: 5151;
|
|
3
|
+
readonly name: "Moca Testnet";
|
|
4
|
+
readonly nativeCurrency: {
|
|
5
|
+
readonly decimals: 18;
|
|
6
|
+
readonly name: "Moca Network";
|
|
7
|
+
readonly symbol: "MOCA";
|
|
8
8
|
};
|
|
9
|
-
rpcUrls: {
|
|
10
|
-
default: {
|
|
11
|
-
http:
|
|
12
|
-
webSocket:
|
|
9
|
+
readonly rpcUrls: {
|
|
10
|
+
readonly default: {
|
|
11
|
+
readonly http: readonly ["https://testnet-rpc.mechain.tech"];
|
|
12
|
+
readonly webSocket: readonly ["wss://testnet-rpc.mechain.tech"];
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
blockExplorers: {
|
|
16
|
-
default: {
|
|
17
|
-
name:
|
|
18
|
-
url:
|
|
15
|
+
readonly blockExplorers: {
|
|
16
|
+
readonly default: {
|
|
17
|
+
readonly name: "Blockscout";
|
|
18
|
+
readonly url: "https://testnet-scan.mechain.tech";
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
contracts: {
|
|
21
|
+
readonly contracts: {
|
|
22
22
|
readonly multicall3: {
|
|
23
23
|
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
24
24
|
readonly blockCreated: 3837540;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Environment = "development" | "staging" | "uat" | "production";
|
|
1
|
+
export type Environment = "development" | "staging" | "uat" | "sandbox" | "production";
|
|
2
2
|
export type Hex = `0x${string}`;
|
|
3
3
|
export type Jsonable = string | number | boolean | null | undefined | readonly Jsonable[] | {
|
|
4
4
|
readonly [key: string]: Jsonable;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { AirIdDetails } from "./realm/user/types";
|
|
2
|
-
export declare const parseAirId: (airIdDetails?: Omit<AirIdDetails, "id">) => string | undefined;
|
|
3
|
-
export declare const includeId: (airIdDetails?: Omit<AirIdDetails, "id">) => AirIdDetails | undefined;
|
|
4
1
|
export type PromiseHandle<T> = {
|
|
5
2
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
6
3
|
reject: (reason?: unknown) => void;
|
|
@@ -8,11 +5,6 @@ export type PromiseHandle<T> = {
|
|
|
8
5
|
};
|
|
9
6
|
export declare function promiseCreator<T>(): PromiseHandle<T>;
|
|
10
7
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
11
|
-
export declare const isRoot: boolean;
|
|
12
|
-
export declare const getParentOrReferrerOrigin: () => string | undefined;
|
|
13
|
-
export declare const getWindowId: () => string | undefined;
|
|
14
|
-
export declare const isUnsafeOrigin: (origin: string) => boolean;
|
|
15
|
-
export declare const isParentHttps: (origin: string) => boolean;
|
|
16
8
|
export declare const formatPublicKey: (publicKey: string) => string;
|
|
17
9
|
export declare const setPartnerTheme: (theme: string, partnerId: string, configApiUrl: string) => void;
|
|
18
10
|
/**
|
|
@@ -8,7 +8,9 @@ export declare class IframeController {
|
|
|
8
8
|
private iframeUrl;
|
|
9
9
|
private iframeId;
|
|
10
10
|
private readonly AUTH_IFRAME_Z_INDEX;
|
|
11
|
-
private readonly
|
|
11
|
+
private readonly WALLET_IFRAME_Z_INDEX;
|
|
12
|
+
private readonly RECOVERY_IFRAME_Z_INDEX;
|
|
13
|
+
private getZIndex;
|
|
12
14
|
constructor(iframeUrl: string, iframeId: string, state?: Partial<IframeState>);
|
|
13
15
|
get iframeElement(): HTMLIFrameElement | null;
|
|
14
16
|
createIframe(): HTMLIFrameElement;
|
|
@@ -61,8 +61,10 @@ export type AirEventListener = (data: AirEventData) => void;
|
|
|
61
61
|
export type ClaimAirIdOptions = {
|
|
62
62
|
token?: string;
|
|
63
63
|
background?: false;
|
|
64
|
+
offchain?: boolean;
|
|
64
65
|
} | {
|
|
65
66
|
token: string;
|
|
66
67
|
background: true;
|
|
68
|
+
offchain?: boolean;
|
|
67
69
|
};
|
|
68
70
|
export type EIP1193Provider = EIP1193ProviderInterface;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MessageServiceBase } from "./common/air/messaging/messageServiceBase";
|
|
2
2
|
import { AirRecoveryMessage } from "./common/air/messaging/recovery";
|
|
3
3
|
export declare class RecoveryMessageService extends MessageServiceBase<AirRecoveryMessage> {
|
|
4
|
-
private
|
|
4
|
+
#private;
|
|
5
5
|
static create(): RecoveryMessageService;
|
|
6
6
|
sendInitializationRequest(payload: {
|
|
7
7
|
partnerId: string;
|
|
@@ -19,4 +19,8 @@ export declare class WalletMessageService extends MessageServiceBase<AirWalletMe
|
|
|
19
19
|
sendWindowClosed(windowId: string): Promise<void>;
|
|
20
20
|
sendClaimIdRequest(payload: AirClaimIdRequestMessage["payload"]): Promise<import("./common/air/messaging/wallet").AirClaimIdResponseMessage>;
|
|
21
21
|
sendShowSwapUIRequest(): Promise<import("./common/air/messaging/wallet").AirShowSwapUIResponseMessage>;
|
|
22
|
+
sendShowOnRampUIRequest(payload: {
|
|
23
|
+
displayCurrencyCode: string;
|
|
24
|
+
targetCurrencyCode?: string;
|
|
25
|
+
}): Promise<import("./common/air/messaging/wallet").AirShowOnRampUIResponseMessage>;
|
|
22
26
|
}
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ConfirmationStrategy, RealmLoginWalletId } from "../wallet";
|
|
2
|
-
export type AliasValidation = {
|
|
3
|
-
minLength: number;
|
|
4
|
-
maxLength: number;
|
|
5
|
-
};
|
|
6
|
-
export type RealmPartnerConfigStyle = {
|
|
7
|
-
passwordlessButtonVariant?: "inline" | "standalone";
|
|
8
|
-
airLogoTheme?: "default" | "reverse" | "dark_only" | "light_only";
|
|
9
|
-
transactionDetailsExpanded?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare const REALM_LOGIN_METHODS: readonly ["passwordless", "passwordlessToggle", "google", "wallet", "passkey"];
|
|
12
|
-
export type RealmLoginMethod = (typeof REALM_LOGIN_METHODS)[number];
|
|
13
|
-
export type RealmPartnerConfig = {
|
|
14
|
-
partnerId: string;
|
|
15
|
-
node: string;
|
|
16
|
-
gating: "none" | "jwt";
|
|
17
|
-
theme?: string;
|
|
18
|
-
chainId: string;
|
|
19
|
-
enabledChainIds?: string[];
|
|
20
|
-
allowedDomains?: string[];
|
|
21
|
-
publicKey?: string;
|
|
22
|
-
jwksUrl?: string;
|
|
23
|
-
aliasValidation: AliasValidation;
|
|
24
|
-
style?: RealmPartnerConfigStyle;
|
|
25
|
-
loginMethods?: RealmLoginMethod[];
|
|
26
|
-
walletLoginMethods?: RealmLoginWalletId[];
|
|
27
|
-
recommendedWallets?: RealmLoginWalletId[];
|
|
28
|
-
defaultLanguage?: string;
|
|
29
|
-
supportedLocales?: string[];
|
|
30
|
-
authLocaleUrls?: Record<string, string>;
|
|
31
|
-
walletLocaleUrls?: Record<string, string>;
|
|
32
|
-
recoveryLocaleUrls?: Record<string, string>;
|
|
33
|
-
allowUnverifiedEmails?: boolean;
|
|
34
|
-
mfaRequired?: boolean;
|
|
35
|
-
confirmationStrategy?: ConfirmationStrategy;
|
|
36
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface RealmLoginWallet {
|
|
2
|
-
id: string;
|
|
3
|
-
rdns: string;
|
|
4
|
-
name: string;
|
|
5
|
-
displayName?: string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
downloadUrls?: Record<string, string>;
|
|
8
|
-
mobile?: Record<string, string>;
|
|
9
|
-
supportRequestPermissions: boolean;
|
|
10
|
-
supportMobileWalletConnectDeeplink: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const WALLET_MAP: Record<string, RealmLoginWallet>;
|
|
13
|
-
export declare const WALLET_RDNS_MAP: Record<string, RealmLoginWallet>;
|
|
14
|
-
export type RealmLoginWalletId = keyof typeof WALLET_MAP;
|
|
15
|
-
export declare const DEFAULT_RECOMMENDED_WALLETS: Array<RealmLoginWalletId>;
|
|
16
|
-
export type WalletToken = {
|
|
17
|
-
type: "wallet" | string;
|
|
18
|
-
partnerId: string;
|
|
19
|
-
nonce: string;
|
|
20
|
-
};
|
|
21
|
-
export declare enum ConfirmationStrategy {
|
|
22
|
-
SKIP = "skip",
|
|
23
|
-
MODAL = "modal",
|
|
24
|
-
WINDOW = "window"
|
|
25
|
-
}
|