@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
package/dist/airkit.esm.js
CHANGED
|
@@ -95,7 +95,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
95
95
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
var version = "1.
|
|
98
|
+
var version = "1.5.0-beta.0";
|
|
99
99
|
var airkitPackage = {
|
|
100
100
|
version: version};
|
|
101
101
|
|
|
@@ -106,8 +106,6 @@ const AirAuthMessageTypes = {
|
|
|
106
106
|
LOGIN_REQUEST: "air_auth_login_request",
|
|
107
107
|
LOGIN_RESPONSE: "air_auth_login_response",
|
|
108
108
|
LOGIN_SERVICE_RESPONSE: "air_auth_login_service_response",
|
|
109
|
-
PASSKEY_LOGIN_REQUEST: "air_auth_passkey_login_request",
|
|
110
|
-
PASSKEY_LOGIN_RESPONSE: "air_auth_passkey_login_response",
|
|
111
109
|
USER_INFO_REQUEST: "air_auth_user_info_request",
|
|
112
110
|
USER_INFO_RESPONSE: "air_auth_user_info_response",
|
|
113
111
|
PARTNER_USER_INFO_REQUEST: "air_auth_partner_user_info_request",
|
|
@@ -128,8 +126,6 @@ const AirAuthMessageTypes = {
|
|
|
128
126
|
CROSS_PARTNER_TOKEN_RESPONSE: "air_auth_cross_partner_token_response",
|
|
129
127
|
PARTNER_ACCESS_TOKEN_REQUEST: "air_auth_partner_access_token_request",
|
|
130
128
|
PARTNER_ACCESS_TOKEN_RESPONSE: "air_auth_partner_access_token_response",
|
|
131
|
-
PRIVY_LOGIN_REQUEST: "air_auth_privy_login_request",
|
|
132
|
-
PRIVY_LOGIN_RESPONSE: "air_auth_privy_login_response",
|
|
133
129
|
CREDENTIAL_SALT_REQUEST: "air_auth_credential_salt_request",
|
|
134
130
|
CREDENTIAL_SALT_RESPONSE: "air_auth_credential_salt_response",
|
|
135
131
|
LOGOUT_REQUEST: "air_auth_logout_request",
|
|
@@ -139,8 +135,14 @@ const AirAuthMessageTypes = {
|
|
|
139
135
|
RESET_RECOVERY_COMMUNICATION: "air_auth_reset_recovery_communication",
|
|
140
136
|
START_RECOVERY_REQUEST: "air_start_recovery_request",
|
|
141
137
|
START_RECOVERY_RESPONSE: "air_start_recovery_response",
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
RECOVERY_REQUEST: "air_auth_recovery_request",
|
|
139
|
+
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
140
|
+
LINK_EOA_CREDENTIAL_REQUEST: "air_auth_link_eoa_credential_request",
|
|
141
|
+
LINK_EOA_CREDENTIAL_RESPONSE: "air_auth_link_eoa_credential_response",
|
|
142
|
+
LINKAGE_NONCE_REQUEST: "air_auth_linkage_nonce_request",
|
|
143
|
+
LINKAGE_NONCE_RESPONSE: "air_auth_linkage_nonce_response",
|
|
144
|
+
CREDENTIAL_SIGNERS_REQUEST: "air_auth_credential_signers_request",
|
|
145
|
+
CREDENTIAL_SIGNERS_RESPONSE: "air_auth_credential_signers_response"
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
const AirRecoveryMessageTypes = {
|
|
@@ -158,6 +160,8 @@ const AirWalletMessageTypes = {
|
|
|
158
160
|
SERVICE_STARTED: "air_service_started",
|
|
159
161
|
INITIALIZATION_REQUEST: "air_initialization_request",
|
|
160
162
|
INITIALIZATION_RESPONSE: "air_initialization_response",
|
|
163
|
+
CLOSE_MODAL_REQUEST: "air_close_modal_request",
|
|
164
|
+
CLOSE_MODAL_RESPONSE: "air_close_modal_response",
|
|
161
165
|
INIT_AUTH_COMMUNICATION: "air_init_auth_communication",
|
|
162
166
|
WALLET_INITIALIZED: "air_wallet_initialized",
|
|
163
167
|
WALLET_LOGIN_REQUEST: "air_wallet_login_request",
|
|
@@ -168,6 +172,8 @@ const AirWalletMessageTypes = {
|
|
|
168
172
|
CLAIM_ID_RESPONSE: "air_claim_id_response",
|
|
169
173
|
SHOW_SWAP_UI_REQUEST: "air_show_swap_ui_request",
|
|
170
174
|
SHOW_SWAP_UI_RESPONSE: "air_show_swap_ui_response",
|
|
175
|
+
SHOW_ON_RAMP_UI_REQUEST: "air_show_on_ramp_ui_request",
|
|
176
|
+
SHOW_ON_RAMP_UI_RESPONSE: "air_show_on_ramp_ui_response",
|
|
171
177
|
DEPLOY_SMART_ACCOUNT_REQUEST: "air_deploy_smart_account_request",
|
|
172
178
|
DEPLOY_SMART_ACCOUNT_RESPONSE: "air_deploy_smart_account_response",
|
|
173
179
|
WALLET_IFRAME_VISIBILITY_REQUEST: "air_wallet_iframe_visibility_request",
|
|
@@ -563,6 +569,8 @@ const configureLogLevel = (environment, enableLogging) => {
|
|
|
563
569
|
level = enableLogging ? log.levels.DEBUG : log.levels.INFO;
|
|
564
570
|
} else if (environment === "uat") {
|
|
565
571
|
level = enableLogging ? log.levels.INFO : log.levels.WARN;
|
|
572
|
+
} else if (environment === "sandbox") {
|
|
573
|
+
level = enableLogging ? log.levels.WARN : log.levels.ERROR;
|
|
566
574
|
} else if (environment === "production") {
|
|
567
575
|
// Be cautious with enabling more than WARN in prod
|
|
568
576
|
level = enableLogging ? log.levels.WARN : log.levels.ERROR;
|
|
@@ -1670,7 +1678,7 @@ class MessageServiceBase {
|
|
|
1670
1678
|
this._messages$ = this.eventSubject.pipe(map(ev => ev.data));
|
|
1671
1679
|
this._events$.subscribe(event => {
|
|
1672
1680
|
const sentOrReceived = event.origin === window.origin ? "sent" : "received";
|
|
1673
|
-
log.debug(`[${this.name}] Message ${sentOrReceived}:`, event.data);
|
|
1681
|
+
log.debug(`[${this.name}] Message ${sentOrReceived}:`, JSON.stringify(event.data, bigIntReplacer));
|
|
1674
1682
|
});
|
|
1675
1683
|
const handleMessage = async ev => {
|
|
1676
1684
|
if (this.targetOrigin && ev.origin !== this.targetOrigin || !ev.data || !(ev.data instanceof Object)) return;
|
|
@@ -1763,17 +1771,17 @@ var AirWalletProviderMessageTypes;
|
|
|
1763
1771
|
AirWalletProviderMessageTypes["EVENT"] = "JRPC_EVENT";
|
|
1764
1772
|
})(AirWalletProviderMessageTypes || (AirWalletProviderMessageTypes = {}));
|
|
1765
1773
|
|
|
1766
|
-
var _a$
|
|
1774
|
+
var _a$3, _ProviderMessageService_instance;
|
|
1767
1775
|
const ALLOWED_PROVIDER_MESSAGES = [
|
|
1768
1776
|
AirWalletProviderMessageTypes.RESPONSE,
|
|
1769
1777
|
AirWalletProviderMessageTypes.EVENT,
|
|
1770
1778
|
];
|
|
1771
1779
|
class ProviderMessageService extends MessageServiceBase {
|
|
1772
1780
|
static create() {
|
|
1773
|
-
if (__classPrivateFieldGet(this, _a$
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
return __classPrivateFieldGet(this, _a$
|
|
1781
|
+
if (!__classPrivateFieldGet(this, _a$3, "f", _ProviderMessageService_instance)) {
|
|
1782
|
+
__classPrivateFieldSet(this, _a$3, new _a$3("Embed Service: Provider Channel", ALLOWED_PROVIDER_MESSAGES), "f", _ProviderMessageService_instance);
|
|
1783
|
+
}
|
|
1784
|
+
return __classPrivateFieldGet(this, _a$3, "f", _ProviderMessageService_instance);
|
|
1777
1785
|
}
|
|
1778
1786
|
async open(walletIframe) {
|
|
1779
1787
|
const origin = new URL(walletIframe.src).origin;
|
|
@@ -1789,7 +1797,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
1789
1797
|
return response;
|
|
1790
1798
|
}
|
|
1791
1799
|
}
|
|
1792
|
-
_a$
|
|
1800
|
+
_a$3 = ProviderMessageService;
|
|
1793
1801
|
_ProviderMessageService_instance = { value: void 0 };
|
|
1794
1802
|
|
|
1795
1803
|
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_emit;
|
|
@@ -1900,7 +1908,7 @@ _AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_is
|
|
|
1900
1908
|
});
|
|
1901
1909
|
};
|
|
1902
1910
|
|
|
1903
|
-
var _a$
|
|
1911
|
+
var _a$2, _AuthMessageService_instance;
|
|
1904
1912
|
const ALLOWED_AUTH_MESSAGES = [
|
|
1905
1913
|
AirAuthMessageTypes.INITIALIZATION_RESPONSE,
|
|
1906
1914
|
AirAuthMessageTypes.LOGIN_RESPONSE,
|
|
@@ -1915,13 +1923,16 @@ const ALLOWED_AUTH_MESSAGES = [
|
|
|
1915
1923
|
AirAuthMessageTypes.IFRAME_VISIBILITY_REQUEST,
|
|
1916
1924
|
AirAuthMessageTypes.CREDENTIAL_SALT_RESPONSE,
|
|
1917
1925
|
AirAuthMessageTypes.START_RECOVERY_RESPONSE,
|
|
1926
|
+
AirAuthMessageTypes.LINK_EOA_CREDENTIAL_RESPONSE,
|
|
1927
|
+
AirAuthMessageTypes.LINKAGE_NONCE_RESPONSE,
|
|
1928
|
+
AirAuthMessageTypes.CREDENTIAL_SIGNERS_RESPONSE,
|
|
1918
1929
|
];
|
|
1919
1930
|
class AuthMessageService extends MessageServiceBase {
|
|
1920
1931
|
static create() {
|
|
1921
|
-
if (__classPrivateFieldGet(this, _a$
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
return __classPrivateFieldGet(this, _a$
|
|
1932
|
+
if (!__classPrivateFieldGet(this, _a$2, "f", _AuthMessageService_instance)) {
|
|
1933
|
+
__classPrivateFieldSet(this, _a$2, new _a$2("Embed Service: Auth Channel", ALLOWED_AUTH_MESSAGES), "f", _AuthMessageService_instance);
|
|
1934
|
+
}
|
|
1935
|
+
return __classPrivateFieldGet(this, _a$2, "f", _AuthMessageService_instance);
|
|
1925
1936
|
}
|
|
1926
1937
|
async open(authIframe) {
|
|
1927
1938
|
const origin = new URL(authIframe.src).origin;
|
|
@@ -2021,15 +2032,43 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
2021
2032
|
await this.sendMessage({ type: AirAuthMessageTypes.CREDENTIAL_SALT_REQUEST });
|
|
2022
2033
|
return response;
|
|
2023
2034
|
}
|
|
2035
|
+
async sendLinkEoaCredentialRequest(payload) {
|
|
2036
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.LINK_EOA_CREDENTIAL_RESPONSE)));
|
|
2037
|
+
await this.sendMessage({ type: AirAuthMessageTypes.LINK_EOA_CREDENTIAL_REQUEST, payload });
|
|
2038
|
+
return response;
|
|
2039
|
+
}
|
|
2040
|
+
async sendCredentialSignersRequest(payload) {
|
|
2041
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.CREDENTIAL_SIGNERS_RESPONSE)));
|
|
2042
|
+
await this.sendMessage({
|
|
2043
|
+
type: AirAuthMessageTypes.CREDENTIAL_SIGNERS_REQUEST,
|
|
2044
|
+
payload,
|
|
2045
|
+
});
|
|
2046
|
+
return response;
|
|
2047
|
+
}
|
|
2048
|
+
async sendLinkageNonceRequest(payload) {
|
|
2049
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.LINKAGE_NONCE_RESPONSE)));
|
|
2050
|
+
await this.sendMessage({ type: AirAuthMessageTypes.LINKAGE_NONCE_REQUEST, payload });
|
|
2051
|
+
return response;
|
|
2052
|
+
}
|
|
2024
2053
|
}
|
|
2025
|
-
_a$
|
|
2054
|
+
_a$2 = AuthMessageService;
|
|
2026
2055
|
_AuthMessageService_instance = { value: void 0 };
|
|
2027
2056
|
|
|
2028
2057
|
class IframeController {
|
|
2058
|
+
getZIndex() {
|
|
2059
|
+
if (this.iframeId.includes("air-auth"))
|
|
2060
|
+
return this.AUTH_IFRAME_Z_INDEX;
|
|
2061
|
+
if (this.iframeId.includes("air-wallet"))
|
|
2062
|
+
return this.WALLET_IFRAME_Z_INDEX;
|
|
2063
|
+
if (this.iframeId.includes("air-recovery"))
|
|
2064
|
+
return this.RECOVERY_IFRAME_Z_INDEX;
|
|
2065
|
+
return "9999999"; // Default z-index if not matched
|
|
2066
|
+
}
|
|
2029
2067
|
constructor(iframeUrl, iframeId, state) {
|
|
2030
2068
|
this._iframeElement = null;
|
|
2031
|
-
this.AUTH_IFRAME_Z_INDEX = "
|
|
2032
|
-
this.
|
|
2069
|
+
this.AUTH_IFRAME_Z_INDEX = "9999998";
|
|
2070
|
+
this.WALLET_IFRAME_Z_INDEX = "9999999";
|
|
2071
|
+
this.RECOVERY_IFRAME_Z_INDEX = "999999";
|
|
2033
2072
|
this.state = {
|
|
2034
2073
|
...IframeController.defaultState,
|
|
2035
2074
|
...state,
|
|
@@ -2048,7 +2087,7 @@ class IframeController {
|
|
|
2048
2087
|
iframe.allow = "publickey-credentials-get *; publickey-credentials-create *";
|
|
2049
2088
|
iframe.src = this.iframeUrl;
|
|
2050
2089
|
iframe.style.position = "fixed";
|
|
2051
|
-
iframe.style.zIndex = this.
|
|
2090
|
+
iframe.style.zIndex = this.getZIndex();
|
|
2052
2091
|
iframe.style.border = "none";
|
|
2053
2092
|
iframe.style.margin = "0";
|
|
2054
2093
|
iframe.style.padding = "0";
|
|
@@ -2091,13 +2130,14 @@ IframeController.defaultState = {
|
|
|
2091
2130
|
isVisible: false,
|
|
2092
2131
|
};
|
|
2093
2132
|
|
|
2133
|
+
var _a$1, _RecoveryMessageService_instance;
|
|
2094
2134
|
const ALLOWED_RECOVERY_MESSAGES = Object.values(AirRecoveryMessageTypes);
|
|
2095
2135
|
class RecoveryMessageService extends MessageServiceBase {
|
|
2096
2136
|
static create() {
|
|
2097
|
-
if (!
|
|
2098
|
-
|
|
2137
|
+
if (!__classPrivateFieldGet(this, _a$1, "f", _RecoveryMessageService_instance)) {
|
|
2138
|
+
__classPrivateFieldSet(this, _a$1, new _a$1("Recovery Service", ALLOWED_RECOVERY_MESSAGES), "f", _RecoveryMessageService_instance);
|
|
2099
2139
|
}
|
|
2100
|
-
return
|
|
2140
|
+
return __classPrivateFieldGet(this, _a$1, "f", _RecoveryMessageService_instance);
|
|
2101
2141
|
}
|
|
2102
2142
|
async sendInitializationRequest(payload) {
|
|
2103
2143
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.INITIALIZATION_RESPONSE)));
|
|
@@ -2127,6 +2167,8 @@ class RecoveryMessageService extends MessageServiceBase {
|
|
|
2127
2167
|
await super.close();
|
|
2128
2168
|
}
|
|
2129
2169
|
}
|
|
2170
|
+
_a$1 = RecoveryMessageService;
|
|
2171
|
+
_RecoveryMessageService_instance = { value: void 0 };
|
|
2130
2172
|
|
|
2131
2173
|
var _a, _WalletMessageService_instance;
|
|
2132
2174
|
const ALLOWED_WALLET_MESSAGES = [
|
|
@@ -2135,6 +2177,7 @@ const ALLOWED_WALLET_MESSAGES = [
|
|
|
2135
2177
|
AirWalletMessageTypes.WALLET_LOGIN_RESPONSE,
|
|
2136
2178
|
AirWalletMessageTypes.SETUP_OR_UPDATE_MFA_RESPONSE,
|
|
2137
2179
|
AirWalletMessageTypes.SHOW_SWAP_UI_RESPONSE,
|
|
2180
|
+
AirWalletMessageTypes.SHOW_ON_RAMP_UI_RESPONSE,
|
|
2138
2181
|
AirWalletMessageTypes.CLAIM_ID_RESPONSE,
|
|
2139
2182
|
AirWalletMessageTypes.IS_SMART_ACCOUNT_DEPLOYED_RESPONSE,
|
|
2140
2183
|
AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE,
|
|
@@ -2249,6 +2292,14 @@ class WalletMessageService extends MessageServiceBase {
|
|
|
2249
2292
|
});
|
|
2250
2293
|
return response;
|
|
2251
2294
|
}
|
|
2295
|
+
async sendShowOnRampUIRequest(payload) {
|
|
2296
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletMessageTypes.SHOW_ON_RAMP_UI_RESPONSE)));
|
|
2297
|
+
await this.sendMessage({
|
|
2298
|
+
type: AirWalletMessageTypes.SHOW_ON_RAMP_UI_REQUEST,
|
|
2299
|
+
payload,
|
|
2300
|
+
});
|
|
2301
|
+
return response;
|
|
2302
|
+
}
|
|
2252
2303
|
}
|
|
2253
2304
|
_a = WalletMessageService;
|
|
2254
2305
|
_WalletMessageService_instance = { value: void 0 };
|
|
@@ -2504,7 +2555,7 @@ class AirService {
|
|
|
2504
2555
|
};
|
|
2505
2556
|
}
|
|
2506
2557
|
shouldEnableAutomation() {
|
|
2507
|
-
return localStorage.getItem("automation") === "true" && __classPrivateFieldGet(this, _AirService_buildEnv, "f") !==
|
|
2558
|
+
return localStorage.getItem("automation") === "true" && __classPrivateFieldGet(this, _AirService_buildEnv, "f") !== BUILD_ENV.PRODUCTION;
|
|
2508
2559
|
}
|
|
2509
2560
|
async init({ buildEnv = BUILD_ENV.PRODUCTION, enableLogging = false, skipRehydration = false, }) {
|
|
2510
2561
|
if (!__classPrivateFieldGet(this, _AirService_partnerId, "f"))
|
|
@@ -2579,6 +2630,8 @@ class AirService {
|
|
|
2579
2630
|
});
|
|
2580
2631
|
__classPrivateFieldSet(this, _AirService_isAuthInitialized, true, "f");
|
|
2581
2632
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthInitialized).call(this, { rehydrated: result.rehydrated });
|
|
2633
|
+
if (result.preloadWallet)
|
|
2634
|
+
this.preloadWallet();
|
|
2582
2635
|
// rehydrated auth session
|
|
2583
2636
|
if (result.rehydrated) {
|
|
2584
2637
|
__classPrivateFieldSet(this, _AirService_loginResult, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_createLoginResult).call(this, result), "f");
|
|
@@ -2661,6 +2714,49 @@ class AirService {
|
|
|
2661
2714
|
credentialSalt: result.payload.credentialSalt,
|
|
2662
2715
|
};
|
|
2663
2716
|
}
|
|
2717
|
+
/**
|
|
2718
|
+
* @experimental This method is experimental and will change in the future.
|
|
2719
|
+
*/
|
|
2720
|
+
async getLinkageNonce(payload) {
|
|
2721
|
+
if (!__classPrivateFieldGet(this, _AirService_isAuthInitialized, "f"))
|
|
2722
|
+
throw new Error("Service is not initialized");
|
|
2723
|
+
if (!this.isLoggedIn)
|
|
2724
|
+
throw new Error("No active session to get nonce");
|
|
2725
|
+
const result = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendLinkageNonceRequest(payload);
|
|
2726
|
+
if (result.payload.success === false) {
|
|
2727
|
+
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
2728
|
+
}
|
|
2729
|
+
return {
|
|
2730
|
+
nonce: result.payload.nonce,
|
|
2731
|
+
};
|
|
2732
|
+
}
|
|
2733
|
+
/**
|
|
2734
|
+
* @experimental This method is experimental and will change in the future.
|
|
2735
|
+
*/
|
|
2736
|
+
async retrieveCredentialSigners(payload) {
|
|
2737
|
+
if (!__classPrivateFieldGet(this, _AirService_isAuthInitialized, "f"))
|
|
2738
|
+
throw new Error("Service is not initialized");
|
|
2739
|
+
if (!this.isLoggedIn)
|
|
2740
|
+
throw new Error("No active session to retrieve EOA credential");
|
|
2741
|
+
const result = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendCredentialSignersRequest(payload);
|
|
2742
|
+
if (result.payload.success === false) {
|
|
2743
|
+
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
2744
|
+
}
|
|
2745
|
+
return result.payload.credentials;
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* @experimental This method is experimental and will change in the future.
|
|
2749
|
+
*/
|
|
2750
|
+
async linkEoaCredential(payload) {
|
|
2751
|
+
if (!__classPrivateFieldGet(this, _AirService_isAuthInitialized, "f"))
|
|
2752
|
+
throw new Error("Service is not initialized");
|
|
2753
|
+
if (!this.isLoggedIn)
|
|
2754
|
+
throw new Error("No active session to link EOA credential");
|
|
2755
|
+
const result = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendLinkEoaCredentialRequest(payload);
|
|
2756
|
+
if (result.payload.success === false) {
|
|
2757
|
+
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2664
2760
|
getProvider() {
|
|
2665
2761
|
return this.provider;
|
|
2666
2762
|
}
|
|
@@ -2678,6 +2774,9 @@ class AirService {
|
|
|
2678
2774
|
isMFASetup: true,
|
|
2679
2775
|
}, "f");
|
|
2680
2776
|
}
|
|
2777
|
+
/**
|
|
2778
|
+
* @experimental This feature has not been officially released and might change in the future.
|
|
2779
|
+
*/
|
|
2681
2780
|
async claimAirId(options) {
|
|
2682
2781
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
2683
2782
|
const result = await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").sendClaimIdRequest(options ?? {});
|
|
@@ -2686,6 +2785,9 @@ class AirService {
|
|
|
2686
2785
|
}
|
|
2687
2786
|
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
2688
2787
|
}
|
|
2788
|
+
/**
|
|
2789
|
+
* @experimental This feature has not been officially released and might change in the future.
|
|
2790
|
+
*/
|
|
2689
2791
|
async showSwapUI() {
|
|
2690
2792
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
2691
2793
|
const result = await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").sendShowSwapUIRequest();
|
|
@@ -2694,6 +2796,16 @@ class AirService {
|
|
|
2694
2796
|
}
|
|
2695
2797
|
return { txHash: result.payload.txHash };
|
|
2696
2798
|
}
|
|
2799
|
+
/**
|
|
2800
|
+
* @experimental This feature has not been officially released and might change in the future.
|
|
2801
|
+
*/
|
|
2802
|
+
async showOnRampUI(options) {
|
|
2803
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
2804
|
+
const result = await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").sendShowOnRampUIRequest(options);
|
|
2805
|
+
if (result.payload.success === false) {
|
|
2806
|
+
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2697
2809
|
async getUserInfo() {
|
|
2698
2810
|
if (!this.isLoggedIn)
|
|
2699
2811
|
throw new Error("User not logged in");
|