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