@mocanetwork/airkit-connector 1.8.1-beta.0 → 1.9.0-beta.2

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.
@@ -94,7 +94,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
94
94
  var e = new Error(message);
95
95
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
96
96
  };
97
- var version$2 = "1.8.1-beta.0";
97
+ var version$2 = "1.9.0-beta.2";
98
98
  var airkitPackage = {
99
99
  version: version$2
100
100
  };
@@ -122,6 +122,8 @@ const AirAuthMessageTypes = {
122
122
  SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response",
123
123
  SETUP_RECOVERY_REQUEST: "air_auth_setup_recovery_request",
124
124
  SETUP_RECOVERY_RESPONSE: "air_auth_setup_recovery_response",
125
+ SETUP_CREDENTIAL_REQUEST: "air_auth_setup_credential_request",
126
+ SETUP_CREDENTIAL_RESPONSE: "air_auth_setup_credential_response",
125
127
  SIGN_SIWE_MESSAGE_REQUEST: "air_auth_sign_siwe_message_request",
126
128
  SIGN_SIWE_MESSAGE_RESPONSE: "air_auth_sign_siwe_message_response",
127
129
  CROSS_PARTNER_TOKEN_REQUEST: "air_auth_cross_partner_token_request",
@@ -134,6 +136,12 @@ const AirAuthMessageTypes = {
134
136
  START_RECOVERY_RESPONSE: "air_start_recovery_response",
135
137
  RECOVERY_REQUEST: "air_auth_recovery_request",
136
138
  RECOVERY_RESPONSE: "air_auth_recovery_response",
139
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request",
140
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response",
141
+ REMOVE_SIGNER_SIGNATURE_REQUEST: "air_auth_remove_signer_signature_request",
142
+ REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_auth_remove_signer_signature_response",
143
+ RESET_WALLET_REQUEST: "air_auth_reset_wallet_request",
144
+ RESET_WALLET_RESPONSE: "air_auth_reset_wallet_response",
137
145
  EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
138
146
  };
139
147
  const AirCredentialMessageTypes = {
@@ -145,12 +153,16 @@ const AirCredentialMessageTypes = {
145
153
  UPDATE_SESSION_CONFIG_RESPONSE: "air_credential_update_session_config_response",
146
154
  LOGOUT_REQUEST: "air_credential_logout_request",
147
155
  LOGOUT_RESPONSE: "air_credential_logout_response",
156
+ CLOSE_MODAL_REQUEST: "air_credential_close_modal_request",
157
+ CLOSE_MODAL_RESPONSE: "air_credential_close_modal_response",
148
158
  // New credential operation message types
149
159
  ISSUE_CREDENTIAL_REQUEST: "air_credential_issue_request",
150
160
  VERIFY_CREDENTIAL_REQUEST: "air_credential_verify_request",
151
161
  // Event messages for communication with parent
152
162
  ISSUE_CREDENTIAL_RESPONSE: "air_credential_issue_response",
153
- VERIFY_CREDENTIAL_RESPONSE: "air_credential_verify_response"
163
+ VERIFY_CREDENTIAL_RESPONSE: "air_credential_verify_response",
164
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_credential_issue_on_behalf_new_user_confirmation_request",
165
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_credential_issue_on_behalf_new_user_confirmation_response"
154
166
  };
155
167
  const AirRecoveryMessageTypes = {
156
168
  SERVICE_STARTED: "air_recovery_service_started",
@@ -167,8 +179,8 @@ const AirWalletMessageTypes = {
167
179
  SERVICE_STARTED: "air_service_started",
168
180
  INITIALIZATION_REQUEST: "air_initialization_request",
169
181
  INITIALIZATION_RESPONSE: "air_initialization_response",
170
- CLOSE_MODAL_REQUEST: "air_close_modal_request",
171
- CLOSE_MODAL_RESPONSE: "air_close_modal_response",
182
+ CLOSE_MODAL_REQUEST: "air_wallet_close_modal_request",
183
+ CLOSE_MODAL_RESPONSE: "air_wallet_close_modal_response",
172
184
  WALLET_INITIALIZED: "air_wallet_initialized",
173
185
  UPDATE_SESSION_CONFIG_REQUEST: "air_wallet_update_session_config_request",
174
186
  UPDATE_SESSION_CONFIG_RESPONSE: "air_wallet_update_session_config_response",
@@ -182,6 +194,10 @@ const AirWalletMessageTypes = {
182
194
  SHOW_SWAP_UI_RESPONSE: "air_show_swap_ui_response",
183
195
  SHOW_ON_RAMP_UI_REQUEST: "air_show_on_ramp_ui_request",
184
196
  SHOW_ON_RAMP_UI_RESPONSE: "air_show_on_ramp_ui_response",
197
+ SHOW_TRANSFER_UI_REQUEST: "air_show_transfer_ui_request",
198
+ SHOW_TRANSFER_UI_RESPONSE: "air_show_transfer_ui_response",
199
+ SHOW_RECEIVE_UI_REQUEST: "air_show_receive_ui_request",
200
+ SHOW_RECEIVE_UI_RESPONSE: "air_show_receive_ui_response",
185
201
  DEPLOY_SMART_ACCOUNT_REQUEST: "air_deploy_smart_account_request",
186
202
  DEPLOY_SMART_ACCOUNT_RESPONSE: "air_deploy_smart_account_response",
187
203
  WALLET_IFRAME_VISIBILITY_REQUEST: "air_wallet_iframe_visibility_request",
@@ -190,7 +206,11 @@ const AirWalletMessageTypes = {
190
206
  LOGOUT_REQUEST: "air_logout_request",
191
207
  LOGOUT_RESPONSE: "air_logout_response",
192
208
  INTERNAL_PROVIDER_REQUEST: "air_internal_provider_request",
193
- INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response"
209
+ INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response",
210
+ ADDITIONAL_SIGNER_SIGNATURE_REQUEST: "air_additional_signer_signature_request",
211
+ ADDITIONAL_SIGNER_SIGNATURE_RESPONSE: "air_additional_signer_signature_response",
212
+ REMOVE_SIGNER_SIGNATURE_REQUEST: "air_remove_signer_signature_request",
213
+ REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_remove_signer_signature_response"
194
214
  };
195
215
  const AirWindowMessageTypes = {
196
216
  OPEN_WINDOW_REQUEST: "air_open_window_request",
@@ -1695,7 +1715,7 @@ const Codes = {
1695
1715
  ...AirIDErrorName,
1696
1716
  ...WindowErrorName
1697
1717
  };
1698
- const AirClientUserErrors = ["USER_CANCELLED", "CONFIG_ERROR", "CLIENT_ERROR", "UNKNOWN_ERROR", "PERMISSION_NOT_ENABLED", "SMART_ACCOUNT_NOT_DEPLOYED", "ACCOUNT_DELETION_PENDING"];
1718
+ const AirClientUserErrors = ["USER_CANCELLED", "CONFIG_ERROR", "CLIENT_ERROR", "UNKNOWN_ERROR", "PERMISSION_NOT_ENABLED", "SMART_ACCOUNT_NOT_DEPLOYED", "ACCOUNT_DELETION_PENDING", "SWAP_TO_ONRAMP", "USER_REJECTED"];
1699
1719
  class AirError extends BaseError$2 {}
1700
1720
  new Set(AirClientUserErrors);
1701
1721
  new Set(Object.values(Codes));
@@ -1834,7 +1854,7 @@ class ProviderMessageService extends MessageServiceBase {
1834
1854
  });
1835
1855
  }
1836
1856
  async sendWalletProviderRequest(payload) {
1837
- const response = firstValueFrom(this.messages$.pipe(filter(msg => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter(msg => msg.payload.method === payload.method)));
1857
+ const response = firstValueFrom(this.messages$.pipe(filter(msg => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter(msg => msg.payload.method === payload.method && msg.payload.requestId === payload.requestId)));
1838
1858
  await this.sendMessage({
1839
1859
  type: AirWalletProviderMessageTypes.REQUEST,
1840
1860
  payload
@@ -1954,7 +1974,7 @@ _AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_is
1954
1974
  });
1955
1975
  };
1956
1976
  var _a$3, _AuthMessageService_instance;
1957
- const ALLOWED_AUTH_MESSAGES = [AirAuthMessageTypes.INITIALIZATION_RESPONSE, AirAuthMessageTypes.LOGIN_RESPONSE, AirAuthMessageTypes.SETUP_WALLET_REQUEST, AirAuthMessageTypes.SETUP_RECOVERY_REQUEST, AirAuthMessageTypes.LOGOUT_RESPONSE, AirAuthMessageTypes.UPDATE_SESSION_CONFIG_RESPONSE, AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE, AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE, AirAuthMessageTypes.PARTNER_ACCESS_TOKEN_RESPONSE, AirAuthMessageTypes.IFRAME_VISIBILITY_REQUEST, AirAuthMessageTypes.START_RECOVERY_RESPONSE, AirAuthMessageTypes.EXPIRED_LOGOUT_REQUEST];
1977
+ const ALLOWED_AUTH_MESSAGES = [AirAuthMessageTypes.INITIALIZATION_RESPONSE, AirAuthMessageTypes.LOGIN_RESPONSE, AirAuthMessageTypes.SETUP_WALLET_REQUEST, AirAuthMessageTypes.SETUP_RECOVERY_REQUEST, AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST, AirAuthMessageTypes.LOGOUT_RESPONSE, AirAuthMessageTypes.UPDATE_SESSION_CONFIG_RESPONSE, AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE, AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE, AirAuthMessageTypes.PARTNER_ACCESS_TOKEN_RESPONSE, AirAuthMessageTypes.IFRAME_VISIBILITY_REQUEST, AirAuthMessageTypes.START_RECOVERY_RESPONSE, AirAuthMessageTypes.EXPIRED_LOGOUT_REQUEST];
1958
1978
  class AuthMessageService extends MessageServiceBase {
1959
1979
  static create() {
1960
1980
  if (!__classPrivateFieldGet$1(this, _a$3, "f", _AuthMessageService_instance)) {
@@ -2043,6 +2063,17 @@ class AuthMessageService extends MessageServiceBase {
2043
2063
  }
2044
2064
  });
2045
2065
  }
2066
+ async sendSetupCredentialSuccessResponse() {
2067
+ await this.sendMessage({
2068
+ type: AirAuthMessageTypes.SETUP_CREDENTIAL_RESPONSE,
2069
+ payload: {
2070
+ success: true
2071
+ }
2072
+ });
2073
+ }
2074
+ async sendSetupCredentialErrorResponse(error) {
2075
+ await this.sendMessage(this.createErrorResponseMessage(AirAuthMessageTypes.SETUP_CREDENTIAL_RESPONSE, error));
2076
+ }
2046
2077
  async sendCrossPartnerTokenRequest(targetPartnerUrl) {
2047
2078
  const response = firstValueFrom(this.messages$.pipe(filter(msg => msg.type === AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE)));
2048
2079
  await this.sendMessage({
@@ -2160,7 +2191,7 @@ class IframeController {
2160
2191
  if (this._iframeElement) return this._iframeElement;
2161
2192
  const iframe = document.createElement("iframe");
2162
2193
  iframe.id = this.iframeId;
2163
- iframe.allow = ["publickey-credentials-get *", "publickey-credentials-create *", "ch-ua-model", "ch-ua-platform-version"].join("; ");
2194
+ iframe.allow = ["publickey-credentials-get *", "publickey-credentials-create *", "ch-ua-model", "ch-ua-platform-version", "clipboard-write", "web-share"].join("; ");
2164
2195
  iframe.src = this.iframeUrl;
2165
2196
  iframe.style.position = "fixed";
2166
2197
  iframe.style.zIndex = `${this.getZIndex()}`;
@@ -2263,7 +2294,7 @@ _RecoveryMessageService_instance = {
2263
2294
  value: void 0
2264
2295
  };
2265
2296
  var _a, _WalletMessageService_instance;
2266
- const ALLOWED_WALLET_MESSAGES = [AirWalletMessageTypes.INITIALIZATION_RESPONSE, AirWalletMessageTypes.WALLET_INITIALIZED, AirWalletMessageTypes.UPDATE_SESSION_CONFIG_RESPONSE, AirWalletMessageTypes.WALLET_LOGIN_RESPONSE, AirWalletMessageTypes.SETUP_OR_UPDATE_MFA_RESPONSE, AirWalletMessageTypes.SHOW_SWAP_UI_RESPONSE, AirWalletMessageTypes.SHOW_ON_RAMP_UI_RESPONSE, AirWalletMessageTypes.CLAIM_ID_RESPONSE, AirWalletMessageTypes.IS_SMART_ACCOUNT_DEPLOYED_RESPONSE, AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE, AirWalletMessageTypes.WALLET_IFRAME_VISIBILITY_REQUEST, AirWalletMessageTypes.LOGOUT_RESPONSE, AirWindowMessageTypes.OPEN_WINDOW_REQUEST, AirWindowMessageTypes.OPEN_WINDOW_RETRY_RESPONSE];
2297
+ const ALLOWED_WALLET_MESSAGES = [AirWalletMessageTypes.INITIALIZATION_RESPONSE, AirWalletMessageTypes.WALLET_INITIALIZED, AirWalletMessageTypes.UPDATE_SESSION_CONFIG_RESPONSE, AirWalletMessageTypes.WALLET_LOGIN_RESPONSE, AirWalletMessageTypes.SETUP_OR_UPDATE_MFA_RESPONSE, AirWalletMessageTypes.SHOW_SWAP_UI_RESPONSE, AirWalletMessageTypes.SHOW_ON_RAMP_UI_RESPONSE, AirWalletMessageTypes.SHOW_TRANSFER_UI_RESPONSE, AirWalletMessageTypes.SHOW_RECEIVE_UI_RESPONSE, AirWalletMessageTypes.CLAIM_ID_RESPONSE, AirWalletMessageTypes.IS_SMART_ACCOUNT_DEPLOYED_RESPONSE, AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE, AirWalletMessageTypes.WALLET_IFRAME_VISIBILITY_REQUEST, AirWalletMessageTypes.LOGOUT_RESPONSE, AirWindowMessageTypes.OPEN_WINDOW_REQUEST, AirWindowMessageTypes.OPEN_WINDOW_RETRY_RESPONSE];
2267
2298
  class WalletMessageService extends MessageServiceBase {
2268
2299
  static create() {
2269
2300
  if (!__classPrivateFieldGet$1(this, _a, "f", _WalletMessageService_instance)) {
@@ -2399,6 +2430,26 @@ class WalletMessageService extends MessageServiceBase {
2399
2430
  });
2400
2431
  return response;
2401
2432
  }
2433
+ async sendShowTransferUIRequest(payload) {
2434
+ const response = firstValueFrom(this.messages$.pipe(filter(msg => msg.type === AirWalletMessageTypes.SHOW_TRANSFER_UI_RESPONSE)));
2435
+ await this.sendMessage({
2436
+ type: AirWalletMessageTypes.SHOW_TRANSFER_UI_REQUEST,
2437
+ payload: {
2438
+ tokenSymbol: payload?.tokenSymbol,
2439
+ chainId: payload?.chainId,
2440
+ recipientAddress: payload?.recipientAddress,
2441
+ amount: payload?.amount
2442
+ }
2443
+ });
2444
+ return response;
2445
+ }
2446
+ async sendShowReceiveUIRequest() {
2447
+ const response = firstValueFrom(this.messages$.pipe(filter(msg => msg.type === AirWalletMessageTypes.SHOW_RECEIVE_UI_RESPONSE)));
2448
+ await this.sendMessage({
2449
+ type: AirWalletMessageTypes.SHOW_RECEIVE_UI_REQUEST
2450
+ });
2451
+ return response;
2452
+ }
2402
2453
  }
2403
2454
  _a = WalletMessageService;
2404
2455
  _WalletMessageService_instance = {
@@ -2749,6 +2800,17 @@ class AirService {
2749
2800
  }
2750
2801
  break;
2751
2802
  }
2803
+ case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST:
2804
+ {
2805
+ try {
2806
+ await __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
2807
+ await __classPrivateFieldGet$1(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
2808
+ } catch (err) {
2809
+ const error = ensureError(err);
2810
+ await __classPrivateFieldGet$1(this, _AirService_authMessagingService, "f").sendSetupCredentialErrorResponse(error);
2811
+ }
2812
+ break;
2813
+ }
2752
2814
  case AirAuthMessageTypes.EXPIRED_LOGOUT_REQUEST:
2753
2815
  {
2754
2816
  await this.logout();
@@ -2900,6 +2962,36 @@ class AirService {
2900
2962
  throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
2901
2963
  }
2902
2964
  }
2965
+ /**
2966
+ * @experimental This feature has not been officially released and might change in the future.
2967
+ */
2968
+ async showTransferUI(options) {
2969
+ await __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
2970
+ const result = await __classPrivateFieldGet$1(this, _AirService_walletMessagingService, "f").sendShowTransferUIRequest(options);
2971
+ if (result.payload.success === false) {
2972
+ throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
2973
+ }
2974
+ return {
2975
+ txHash: result.payload.txHash,
2976
+ symbol: result.payload.symbol,
2977
+ chainId: result.payload.chainId,
2978
+ decimals: result.payload.decimals,
2979
+ address: result.payload.address,
2980
+ recipientAddress: result.payload.recipientAddress,
2981
+ amount: result.payload.amount
2982
+ };
2983
+ }
2984
+ /**
2985
+ * @experimental This feature has not been officially released and might change in the future.
2986
+ */
2987
+ async showReceiveUI() {
2988
+ await __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
2989
+ const result = await __classPrivateFieldGet$1(this, _AirService_walletMessagingService, "f").sendShowReceiveUIRequest();
2990
+ if (result.payload.success === false) {
2991
+ if (result.payload.errorName === "USER_CANCELLED") return;
2992
+ throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
2993
+ }
2994
+ }
2903
2995
  async getUserInfo() {
2904
2996
  __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_assertLoggedIn).call(this);
2905
2997
  const info = await __classPrivateFieldGet$1(this, _AirService_authMessagingService, "f").sendPartnerUserInfoRequest();
@@ -2914,7 +3006,7 @@ class AirService {
2914
3006
  id: info.payload.user.id,
2915
3007
  abstractAccountAddress: info.payload.user.abstractAccountAddress,
2916
3008
  email: info.payload.user.email,
2917
- isMFASetup: info.payload.user.isMFASetup
3009
+ isMFASetup: info.payload.user.activeMfaMethods.length > 0
2918
3010
  }
2919
3011
  };
2920
3012
  }
@@ -3004,7 +3096,8 @@ class AirService {
3004
3096
  issuerDid,
3005
3097
  credentialId,
3006
3098
  credentialSubject,
3007
- curve
3099
+ curve,
3100
+ offchain
3008
3101
  }) {
3009
3102
  await __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
3010
3103
  const response = await __classPrivateFieldGet$1(this, _AirService_credentialMessagingService, "f").sendIssueCredentialRequest({
@@ -3012,7 +3105,8 @@ class AirService {
3012
3105
  issuerDid,
3013
3106
  credentialId,
3014
3107
  credentialSubject,
3015
- curve
3108
+ curve,
3109
+ offchain
3016
3110
  });
3017
3111
  const {
3018
3112
  payload
@@ -3030,15 +3124,22 @@ class AirService {
3030
3124
  async verifyCredential({
3031
3125
  authToken,
3032
3126
  programId,
3033
- redirectUrl
3127
+ redirectUrl,
3128
+ fieldsToDisclose,
3129
+ offchain
3034
3130
  }) {
3131
+ if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
3132
+ throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
3133
+ }
3035
3134
  await __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
3036
3135
  const {
3037
3136
  payload
3038
3137
  } = await __classPrivateFieldGet$1(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
3039
3138
  partnerToken: authToken,
3040
3139
  programId,
3041
- redirectUrl
3140
+ redirectUrl,
3141
+ fieldsToDisclose,
3142
+ offchain
3042
3143
  });
3043
3144
  if (payload.success === false) {
3044
3145
  throw new AirServiceError(payload.errorName, payload.errorMessage);
@@ -3053,7 +3154,9 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
3053
3154
  if (!this.isLoggedIn) throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
3054
3155
  }, _AirService_ensureCredential = async function _AirService_ensureCredential() {
3055
3156
  __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
3056
- void __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
3157
+ void __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, {
3158
+ skipWalletLogin: true
3159
+ });
3057
3160
  try {
3058
3161
  if (!__classPrivateFieldGet$1(this, _AirService_credentialsInitialization, "f")) __classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet$1(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
3059
3162
  await __classPrivateFieldGet$1(this, _AirService_credentialsInitialization, "f");
@@ -3178,6 +3281,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
3178
3281
  } = await __classPrivateFieldGet$1(this, _AirService_walletMessagingService, "f").sendInitializationRequest({
3179
3282
  sessionId: __classPrivateFieldGet$1(this, _AirService_sessionId, "f"),
3180
3283
  partnerId: __classPrivateFieldGet$1(this, _AirService_partnerId, "f"),
3284
+ partnerDAppUrl: window.location.href,
3181
3285
  enableLogging: __classPrivateFieldGet$1(this, _AirService_enableLogging, "f"),
3182
3286
  sdkVersion: airKitVersion,
3183
3287
  enableAutomation: this.shouldEnableAutomation(),
@@ -3298,7 +3402,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
3298
3402
  id: payload.id,
3299
3403
  abstractAccountAddress: payload.abstractAccountAddress,
3300
3404
  token: payload.partnerAccessToken,
3301
- isMFASetup: payload.isMFASetup
3405
+ isMFASetup: payload.activeMfaMethods.length > 0
3302
3406
  };
3303
3407
  }, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
3304
3408
  if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
@@ -3309,7 +3413,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
3309
3413
  }
3310
3414
  return {
3311
3415
  abstractAccountAddress: payload.addresses.aa,
3312
- isMFASetup: payload.isMFASetup
3416
+ isMFASetup: payload.activeMfaMethods.length > 0
3313
3417
  };
3314
3418
  }, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
3315
3419
  // Logout auth session
@@ -3365,6 +3469,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
3365
3469
  } = await __classPrivateFieldGet$1(this, _AirService_recoveryMessagingService, "f").sendInitializationRequest({
3366
3470
  sessionId: __classPrivateFieldGet$1(this, _AirService_sessionId, "f"),
3367
3471
  partnerId: __classPrivateFieldGet$1(this, _AirService_partnerId, "f"),
3472
+ partnerDAppUrl: window.location.href,
3368
3473
  enableLogging: __classPrivateFieldGet$1(this, _AirService_enableLogging, "f"),
3369
3474
  sdkVersion: airKitVersion,
3370
3475
  enableAutomation: this.shouldEnableAutomation(),
@@ -3418,7 +3523,28 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
3418
3523
  __classPrivateFieldSet(this, _AirService_recoveryInitialization, undefined);
3419
3524
  };
3420
3525
 
3421
- const version$1 = '2.34.0';
3526
+ function isHex(value, {
3527
+ strict = true
3528
+ } = {}) {
3529
+ if (!value) return false;
3530
+ if (typeof value !== 'string') return false;
3531
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');
3532
+ }
3533
+
3534
+ /**
3535
+ * @description Retrieves the size of the value (in bytes).
3536
+ *
3537
+ * @param value The value (hex or byte array) to retrieve the size of.
3538
+ * @returns The size of the value (in bytes).
3539
+ */
3540
+ function size(value) {
3541
+ if (isHex(value, {
3542
+ strict: false
3543
+ })) return Math.ceil((value.length - 2) / 2);
3544
+ return value.length;
3545
+ }
3546
+
3547
+ const version$1 = '2.46.3';
3422
3548
 
3423
3549
  let errorConfig = {
3424
3550
  getDocsUrl: ({
@@ -3500,26 +3626,13 @@ function walk(err, fn) {
3500
3626
  return fn ? null : err;
3501
3627
  }
3502
3628
 
3503
- class IntegerOutOfRangeError extends BaseError$1 {
3504
- constructor({
3505
- max,
3506
- min,
3507
- signed,
3508
- size,
3509
- value
3510
- }) {
3511
- super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, {
3512
- name: 'IntegerOutOfRangeError'
3513
- });
3514
- }
3515
- }
3516
- class SizeOverflowError extends BaseError$1 {
3629
+ class InvalidAddressError extends BaseError$1 {
3517
3630
  constructor({
3518
- givenSize,
3519
- maxSize
3631
+ address
3520
3632
  }) {
3521
- super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, {
3522
- name: 'SizeOverflowError'
3633
+ super(`Address "${address}" is invalid.`, {
3634
+ metaMessages: ['- Address must be a hex value of 20 bytes (40 hex characters).', '- Address must match its checksum counterpart.'],
3635
+ name: 'InvalidAddressError'
3523
3636
  });
3524
3637
  }
3525
3638
  }
@@ -3580,25 +3693,86 @@ function padBytes(bytes, {
3580
3693
  return paddedBytes;
3581
3694
  }
3582
3695
 
3583
- function isHex(value, {
3584
- strict = true
3585
- } = {}) {
3586
- if (!value) return false;
3587
- if (typeof value !== 'string') return false;
3588
- return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');
3696
+ class IntegerOutOfRangeError extends BaseError$1 {
3697
+ constructor({
3698
+ max,
3699
+ min,
3700
+ signed,
3701
+ size,
3702
+ value
3703
+ }) {
3704
+ super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, {
3705
+ name: 'IntegerOutOfRangeError'
3706
+ });
3707
+ }
3708
+ }
3709
+ class SizeOverflowError extends BaseError$1 {
3710
+ constructor({
3711
+ givenSize,
3712
+ maxSize
3713
+ }) {
3714
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, {
3715
+ name: 'SizeOverflowError'
3716
+ });
3717
+ }
3718
+ }
3719
+
3720
+ function assertSize(hexOrBytes, {
3721
+ size: size$1
3722
+ }) {
3723
+ if (size(hexOrBytes) > size$1) throw new SizeOverflowError({
3724
+ givenSize: size(hexOrBytes),
3725
+ maxSize: size$1
3726
+ });
3589
3727
  }
3590
3728
 
3591
3729
  /**
3592
- * @description Retrieves the size of the value (in bytes).
3730
+ * Encodes a number or bigint into a hex string
3593
3731
  *
3594
- * @param value The value (hex or byte array) to retrieve the size of.
3595
- * @returns The size of the value (in bytes).
3732
+ * - Docs: https://viem.sh/docs/utilities/toHex#numbertohex
3733
+ *
3734
+ * @param value Value to encode.
3735
+ * @param opts Options.
3736
+ * @returns Hex value.
3737
+ *
3738
+ * @example
3739
+ * import { numberToHex } from 'viem'
3740
+ * const data = numberToHex(420)
3741
+ * // '0x1a4'
3742
+ *
3743
+ * @example
3744
+ * import { numberToHex } from 'viem'
3745
+ * const data = numberToHex(420, { size: 32 })
3746
+ * // '0x00000000000000000000000000000000000000000000000000000000000001a4'
3596
3747
  */
3597
- function size(value) {
3598
- if (isHex(value, {
3599
- strict: false
3600
- })) return Math.ceil((value.length - 2) / 2);
3601
- return value.length;
3748
+ function numberToHex(value_, opts = {}) {
3749
+ const {
3750
+ signed,
3751
+ size
3752
+ } = opts;
3753
+ const value = BigInt(value_);
3754
+ let maxValue;
3755
+ if (size) {
3756
+ if (signed) maxValue = (1n << BigInt(size) * 8n - 1n) - 1n;else maxValue = 2n ** (BigInt(size) * 8n) - 1n;
3757
+ } else if (typeof value_ === 'number') {
3758
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
3759
+ }
3760
+ const minValue = typeof maxValue === 'bigint' && signed ? -maxValue - 1n : 0;
3761
+ if (maxValue && value > maxValue || value < minValue) {
3762
+ const suffix = typeof value_ === 'bigint' ? 'n' : '';
3763
+ throw new IntegerOutOfRangeError({
3764
+ max: maxValue ? `${maxValue}${suffix}` : undefined,
3765
+ min: `${minValue}${suffix}`,
3766
+ signed,
3767
+ size,
3768
+ value: `${value_}${suffix}`
3769
+ });
3770
+ }
3771
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;
3772
+ if (size) return pad(hex, {
3773
+ size
3774
+ });
3775
+ return hex;
3602
3776
  }
3603
3777
 
3604
3778
  const encoder = /*#__PURE__*/new TextEncoder();
@@ -3780,109 +3954,6 @@ function stringToBytes(value, opts = {}) {
3780
3954
  return bytes;
3781
3955
  }
3782
3956
 
3783
- function assertSize(hexOrBytes, {
3784
- size: size$1
3785
- }) {
3786
- if (size(hexOrBytes) > size$1) throw new SizeOverflowError({
3787
- givenSize: size(hexOrBytes),
3788
- maxSize: size$1
3789
- });
3790
- }
3791
-
3792
- /**
3793
- * Encodes a number or bigint into a hex string
3794
- *
3795
- * - Docs: https://viem.sh/docs/utilities/toHex#numbertohex
3796
- *
3797
- * @param value Value to encode.
3798
- * @param opts Options.
3799
- * @returns Hex value.
3800
- *
3801
- * @example
3802
- * import { numberToHex } from 'viem'
3803
- * const data = numberToHex(420)
3804
- * // '0x1a4'
3805
- *
3806
- * @example
3807
- * import { numberToHex } from 'viem'
3808
- * const data = numberToHex(420, { size: 32 })
3809
- * // '0x00000000000000000000000000000000000000000000000000000000000001a4'
3810
- */
3811
- function numberToHex(value_, opts = {}) {
3812
- const {
3813
- signed,
3814
- size
3815
- } = opts;
3816
- const value = BigInt(value_);
3817
- let maxValue;
3818
- if (size) {
3819
- if (signed) maxValue = (1n << BigInt(size) * 8n - 1n) - 1n;else maxValue = 2n ** (BigInt(size) * 8n) - 1n;
3820
- } else if (typeof value_ === 'number') {
3821
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
3822
- }
3823
- const minValue = typeof maxValue === 'bigint' && signed ? -maxValue - 1n : 0;
3824
- if (maxValue && value > maxValue || value < minValue) {
3825
- const suffix = typeof value_ === 'bigint' ? 'n' : '';
3826
- throw new IntegerOutOfRangeError({
3827
- max: maxValue ? `${maxValue}${suffix}` : undefined,
3828
- min: `${minValue}${suffix}`,
3829
- signed,
3830
- size,
3831
- value: `${value_}${suffix}`
3832
- });
3833
- }
3834
- const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;
3835
- if (size) return pad(hex, {
3836
- size
3837
- });
3838
- return hex;
3839
- }
3840
-
3841
- class InvalidAddressError extends BaseError$1 {
3842
- constructor({
3843
- address
3844
- }) {
3845
- super(`Address "${address}" is invalid.`, {
3846
- metaMessages: ['- Address must be a hex value of 20 bytes (40 hex characters).', '- Address must match its checksum counterpart.'],
3847
- name: 'InvalidAddressError'
3848
- });
3849
- }
3850
- }
3851
-
3852
- /**
3853
- * Map with a LRU (Least recently used) policy.
3854
- *
3855
- * @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
3856
- */
3857
- class LruMap extends Map {
3858
- constructor(size) {
3859
- super();
3860
- Object.defineProperty(this, "maxSize", {
3861
- enumerable: true,
3862
- configurable: true,
3863
- writable: true,
3864
- value: void 0
3865
- });
3866
- this.maxSize = size;
3867
- }
3868
- get(key) {
3869
- const value = super.get(key);
3870
- if (super.has(key) && value !== undefined) {
3871
- this.delete(key);
3872
- super.set(key, value);
3873
- }
3874
- return value;
3875
- }
3876
- set(key, value) {
3877
- super.set(key, value);
3878
- if (this.maxSize && this.size > this.maxSize) {
3879
- const firstKey = this.keys().next().value;
3880
- if (firstKey) this.delete(firstKey);
3881
- }
3882
- return this;
3883
- }
3884
- }
3885
-
3886
3957
  /**
3887
3958
  * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
3888
3959
  * @todo re-check https://issues.chromium.org/issues/42212588
@@ -4234,6 +4305,59 @@ function keccak256(value, to_) {
4234
4305
  return bytes;
4235
4306
  }
4236
4307
 
4308
+ /**
4309
+ * Map with a LRU (Least recently used) policy.
4310
+ *
4311
+ * @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
4312
+ */
4313
+ class LruMap extends Map {
4314
+ constructor(size) {
4315
+ super();
4316
+ Object.defineProperty(this, "maxSize", {
4317
+ enumerable: true,
4318
+ configurable: true,
4319
+ writable: true,
4320
+ value: void 0
4321
+ });
4322
+ this.maxSize = size;
4323
+ }
4324
+ get(key) {
4325
+ const value = super.get(key);
4326
+ if (super.has(key) && value !== undefined) {
4327
+ this.delete(key);
4328
+ super.set(key, value);
4329
+ }
4330
+ return value;
4331
+ }
4332
+ set(key, value) {
4333
+ super.set(key, value);
4334
+ if (this.maxSize && this.size > this.maxSize) {
4335
+ const firstKey = this.keys().next().value;
4336
+ if (firstKey) this.delete(firstKey);
4337
+ }
4338
+ return this;
4339
+ }
4340
+ }
4341
+
4342
+ const addressRegex = /^0x[a-fA-F0-9]{40}$/;
4343
+ /** @internal */
4344
+ const isAddressCache = /*#__PURE__*/new LruMap(8192);
4345
+ function isAddress(address, options) {
4346
+ const {
4347
+ strict = true
4348
+ } = options ?? {};
4349
+ const cacheKey = `${address}.${strict}`;
4350
+ if (isAddressCache.has(cacheKey)) return isAddressCache.get(cacheKey);
4351
+ const result = (() => {
4352
+ if (!addressRegex.test(address)) return false;
4353
+ if (address.toLowerCase() === address) return true;
4354
+ if (strict) return checksumAddress(address) === address;
4355
+ return true;
4356
+ })();
4357
+ isAddressCache.set(cacheKey, result);
4358
+ return result;
4359
+ }
4360
+
4237
4361
  const checksumAddressCache = /*#__PURE__*/new LruMap(8192);
4238
4362
  function checksumAddress(address_,
4239
4363
  /**
@@ -4283,25 +4407,6 @@ chainId) {
4283
4407
  return checksumAddress(address, chainId);
4284
4408
  }
4285
4409
 
4286
- const addressRegex = /^0x[a-fA-F0-9]{40}$/;
4287
- /** @internal */
4288
- const isAddressCache = /*#__PURE__*/new LruMap(8192);
4289
- function isAddress(address, options) {
4290
- const {
4291
- strict = true
4292
- } = options ?? {};
4293
- const cacheKey = `${address}.${strict}`;
4294
- if (isAddressCache.has(cacheKey)) return isAddressCache.get(cacheKey);
4295
- const result = (() => {
4296
- if (!addressRegex.test(address)) return false;
4297
- if (address.toLowerCase() === address) return true;
4298
- if (strict) return checksumAddress(address) === address;
4299
- return true;
4300
- })();
4301
- isAddressCache.set(cacheKey, result);
4302
- return result;
4303
- }
4304
-
4305
4410
  const stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
4306
4411
  const value = typeof value_ === 'bigint' ? value_.toString() : value_;
4307
4412
  return value;
@@ -4333,8 +4438,15 @@ class RpcRequestError extends BaseError$1 {
4333
4438
  writable: true,
4334
4439
  value: void 0
4335
4440
  });
4441
+ Object.defineProperty(this, "url", {
4442
+ enumerable: true,
4443
+ configurable: true,
4444
+ writable: true,
4445
+ value: void 0
4446
+ });
4336
4447
  this.code = error.code;
4337
4448
  this.data = error.data;
4449
+ this.url = url;
4338
4450
  }
4339
4451
  }
4340
4452
 
@@ -4406,7 +4518,7 @@ Object.defineProperty(SwitchChainError, "code", {
4406
4518
  value: 4902
4407
4519
  });
4408
4520
 
4409
- const version = '2.19.0';
4521
+ const version = '2.21.2';
4410
4522
 
4411
4523
  const getVersion = () => `@wagmi/core@${version}`;
4412
4524
 
@@ -4840,10 +4952,11 @@ function airConnector(parameters) {
4840
4952
  isRainbowKitConnector: true,
4841
4953
  airService: service,
4842
4954
  getLoginResult: () => loginResult,
4843
- async connect({ chainId, authToken } = {}) {
4955
+ async connect(connectParams) {
4956
+ const { chainId, authToken } = connectParams ?? {};
4844
4957
  try {
4845
4958
  config.emitter.emit("message", { type: "connecting" });
4846
- const provider = await this.getProvider();
4959
+ const provider = (await this.getProvider());
4847
4960
  provider.on("accountsChanged", (payload) => this.onAccountsChanged(payload));
4848
4961
  provider.on("chainChanged", this.onChainChanged);
4849
4962
  provider.on("disconnect", this.onDisconnect.bind(this));
@@ -4869,14 +4982,14 @@ function airConnector(parameters) {
4869
4982
  }
4870
4983
  },
4871
4984
  async getAccounts() {
4872
- const provider = await this.getProvider();
4985
+ const provider = (await this.getProvider());
4873
4986
  return (await provider.request({
4874
4987
  method: "eth_accounts",
4875
4988
  params: [],
4876
4989
  })).map((x) => getAddress(x));
4877
4990
  },
4878
4991
  async getChainId() {
4879
- const provider = await this.getProvider();
4992
+ const provider = (await this.getProvider());
4880
4993
  const chainId = await provider.request({
4881
4994
  method: "eth_chainId",
4882
4995
  params: [],
@@ -4907,7 +5020,7 @@ function airConnector(parameters) {
4907
5020
  const chain = config.chains.find((x) => x.id === chainId);
4908
5021
  if (!chain)
4909
5022
  throw new SwitchChainError(new ChainNotConfiguredError());
4910
- const provider = await this.getProvider();
5023
+ const provider = (await this.getProvider());
4911
5024
  const hexChainId = numberToHex(chain.id);
4912
5025
  try {
4913
5026
  await provider.request({
@@ -4963,7 +5076,7 @@ function airConnector(parameters) {
4963
5076
  await service.logout();
4964
5077
  return;
4965
5078
  }
4966
- const provider = await this.getProvider();
5079
+ const provider = (await this.getProvider());
4967
5080
  if (provider) {
4968
5081
  provider.removeListener("accountsChanged", (payload) => this.onAccountsChanged(payload));
4969
5082
  provider.removeListener("chainChanged", this.onChainChanged);