@imtbl/sdk 0.28.4-alpha.2 → 0.28.5

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/index.cjs CHANGED
@@ -3651,7 +3651,7 @@ class MultiRollupApiClients {
3651
3651
  }
3652
3652
 
3653
3653
  // eslint-disable-next-line @typescript-eslint/naming-convention
3654
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.4-alpha.2' };
3654
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.5' };
3655
3655
  const createConfig = ({ basePath, headers, }) => {
3656
3656
  if (!basePath.trim()) {
3657
3657
  throw Error('basePath can not be empty');
@@ -3711,7 +3711,7 @@ class APIError extends Error {
3711
3711
 
3712
3712
  /* eslint-disable implicit-arrow-linebreak */
3713
3713
  const defaultHeaders = {
3714
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.4-alpha.2',
3714
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.5',
3715
3715
  };
3716
3716
  /**
3717
3717
  * createAPIConfiguration to create a custom Configuration
@@ -4122,7 +4122,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4122
4122
  chainID,
4123
4123
  coreContractAddress,
4124
4124
  registrationContractAddress,
4125
- sdkVersion: 'ts-immutable-sdk-0.28.4-alpha.2',
4125
+ sdkVersion: 'ts-immutable-sdk-0.28.5',
4126
4126
  });
4127
4127
  /**
4128
4128
  * Sets `sdkVersion` at the time of build
@@ -9067,39 +9067,63 @@ class AuthManager {
9067
9067
  }
9068
9068
  }
9069
9069
 
9070
+ const lazyLoad = (promiseToAwait, initialiseFunction) => (promiseToAwait().then(initialiseFunction));
9071
+ const lazyDocumentReady = (initialiseFunction) => {
9072
+ const documentReadyPromise = () => new Promise((resolve) => {
9073
+ if (window.document.readyState === 'complete') {
9074
+ resolve();
9075
+ }
9076
+ else {
9077
+ const onReadyStateChange = () => {
9078
+ if (window.document.readyState === 'complete') {
9079
+ resolve();
9080
+ window.document.removeEventListener('readystatechange', onReadyStateChange);
9081
+ }
9082
+ };
9083
+ window.document.addEventListener('readystatechange', onReadyStateChange);
9084
+ }
9085
+ });
9086
+ return lazyLoad(documentReadyPromise, initialiseFunction);
9087
+ };
9088
+
9070
9089
  class MagicAdapter {
9071
9090
  config;
9072
- magicClient;
9091
+ lazyMagicClient;
9073
9092
  constructor(config) {
9074
9093
  this.config = config;
9075
9094
  if (typeof window !== 'undefined') {
9076
- this.magicClient = this.initMagicClient();
9077
- this.magicClient.preload();
9095
+ this.lazyMagicClient = lazyDocumentReady(() => {
9096
+ const client = new magicSdk.Magic(this.config.magicPublishableApiKey, {
9097
+ extensions: [new oidc.OpenIdExtension()],
9098
+ network: this.config.network,
9099
+ });
9100
+ client.preload();
9101
+ return client;
9102
+ });
9078
9103
  }
9079
9104
  }
9105
+ get magicClient() {
9106
+ if (!this.lazyMagicClient) {
9107
+ throw new Error('Cannot perform this action outside of the browser');
9108
+ }
9109
+ return this.lazyMagicClient;
9110
+ }
9080
9111
  async login(idToken) {
9081
9112
  return withPassportError(async () => {
9082
- if (!this.magicClient) {
9083
- this.magicClient = this.initMagicClient();
9084
- }
9085
- await this.magicClient.openid.loginWithOIDC({
9113
+ const magicClient = await this.magicClient;
9114
+ await magicClient.openid.loginWithOIDC({
9086
9115
  jwt: idToken,
9087
9116
  providerId: this.config.magicProviderId,
9088
9117
  });
9089
- return this.magicClient.rpcProvider;
9118
+ return magicClient.rpcProvider;
9090
9119
  }, PassportErrorType.WALLET_CONNECTION_ERROR);
9091
9120
  }
9092
9121
  async logout() {
9093
- if (this.magicClient?.user) {
9094
- await this.magicClient.user.logout();
9122
+ const magicClient = await this.magicClient;
9123
+ if (magicClient.user) {
9124
+ await magicClient.user.logout();
9095
9125
  }
9096
9126
  }
9097
- initMagicClient() {
9098
- return new magicSdk.Magic(this.config.magicPublishableApiKey, {
9099
- extensions: [new oidc.OpenIdExtension()],
9100
- network: this.config.network,
9101
- });
9102
- }
9103
9127
  }
9104
9128
 
9105
9129
  const getStarkSigner = async (signer) => withPassportError(async () => {
@@ -9326,7 +9350,7 @@ var PassportEvents;
9326
9350
  var Networks;
9327
9351
  (function (Networks) {
9328
9352
  Networks["PRODUCTION"] = "mainnet";
9329
- Networks["SANDBOX"] = "goerli";
9353
+ Networks["SANDBOX"] = "sepolia";
9330
9354
  })(Networks || (Networks = {}));
9331
9355
 
9332
9356
  async function exchangeTransfer$1({ user, starkSigner, request, exchangesApi, }) {
@@ -9675,6 +9699,11 @@ class PassportImxProvider {
9675
9699
  }
9676
9700
  // TODO: Remove once implemented
9677
9701
  // eslint-disable-next-line class-methods-use-this
9702
+ isRegisteredOffchain() {
9703
+ throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
9704
+ }
9705
+ // TODO: Remove once implemented
9706
+ // eslint-disable-next-line class-methods-use-this
9678
9707
  isRegisteredOnchain() {
9679
9708
  throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
9680
9709
  }
@@ -12671,6 +12700,22 @@ async function registerOffchain(signers, config) {
12671
12700
  });
12672
12701
  return registeredUser.data;
12673
12702
  }
12703
+ async function isRegisteredOffchain(ethAddress, config) {
12704
+ try {
12705
+ const usersApi = new coreSdk.UsersApi(config.immutableXConfig.apiConfiguration);
12706
+ const getUsersResult = await usersApi.getUsers({
12707
+ user: ethAddress,
12708
+ });
12709
+ const { accounts } = getUsersResult.data;
12710
+ return accounts?.length > 0;
12711
+ }
12712
+ catch (ex) {
12713
+ if (ex instanceof globalAxios$1.AxiosError && ex.response?.status === 404) {
12714
+ return false;
12715
+ }
12716
+ throw ex;
12717
+ }
12718
+ }
12674
12719
  async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
12675
12720
  await validateChain(ethSigner, config.immutableXConfig);
12676
12721
  const registrationContract = coreSdk.Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
@@ -13206,7 +13251,11 @@ class GenericIMXProvider {
13206
13251
  this.signers = { ethSigner, starkSigner };
13207
13252
  }
13208
13253
  async getAddress() {
13209
- return await this.signers.ethSigner.getAddress();
13254
+ return this.signers.ethSigner.getAddress();
13255
+ }
13256
+ async isRegisteredOffchain() {
13257
+ const ethAddress = await this.getAddress();
13258
+ return isRegisteredOffchain(ethAddress, this.config);
13210
13259
  }
13211
13260
  registerOffchain() {
13212
13261
  return registerOffchain(this.signers, this.config);
@@ -30797,39 +30846,39 @@ function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, s
30797
30846
 
30798
30847
  const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
30799
30848
  const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
30800
- async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired) {
30849
+ async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
30850
+ if (tokenAddress === "NATIVE") return config.networkMap.get(chainId)?.nativeCurrency;
30851
+ const contract = new (ethers.Contract)(tokenAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
30852
+ const name = await contract.name();
30853
+ const symbol = await contract.symbol();
30854
+ const decimals = await contract.decimals();
30855
+ return {
30856
+ name: name,
30857
+ symbol: symbol,
30858
+ decimals: decimals,
30859
+ address: tokenAddress
30860
+ };
30861
+ }
30862
+ async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
30801
30863
  const fromChainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
30802
30864
  const toChainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
30803
30865
  const gasEstimateTokensConfig = await config.remote.getConfig("gasEstimateTokens");
30804
- const { fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
30866
+ const { gasTokenAddress: gasTokenAddress, fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
30805
30867
  const provider = readOnlyProviders.get(fromChainId);
30806
30868
  if (!provider) throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
30807
30869
  try {
30808
- let gasFees = {};
30809
- const getGasFees = async ()=>{
30810
- gasFees = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
30811
- gasFees.token = config.networkMap.get(fromChainId)?.nativeCurrency;
30812
- };
30813
- let bridgeFees = {
30814
- bridgeFee: {},
30815
- bridgeable: false
30816
- };
30817
- const getBridgeFees = async ()=>{
30818
- const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
30819
- bridgeFees = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
30820
- };
30821
- await Promise.all([
30822
- getGasFees(),
30823
- getBridgeFees()
30824
- ]);
30870
+ const gasFee = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
30871
+ gasFee.token = await $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress ?? (gasTokenAddress || "NATIVE"), fromChainId, provider);
30872
+ const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
30873
+ const { bridgeFee: bridgeFee, bridgeable: bridgeable } = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
30825
30874
  return {
30826
30875
  gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
30827
- gasFee: gasFees,
30876
+ gasFee: gasFee,
30828
30877
  bridgeFee: {
30829
- estimatedAmount: bridgeFees.bridgeFee?.estimatedAmount,
30830
- token: bridgeFees.bridgeFee?.token
30878
+ estimatedAmount: bridgeFee?.estimatedAmount,
30879
+ token: bridgeFee?.token
30831
30880
  },
30832
- bridgeable: bridgeFees.bridgeable
30881
+ bridgeable: bridgeable
30833
30882
  };
30834
30883
  } catch {
30835
30884
  // In the case of an error, just return an empty gas & bridge fee estimate
@@ -30878,7 +30927,7 @@ async function $2e7bf45a7c9a9570$var$swapGasEstimator(config) {
30878
30927
  async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProviders, config) {
30879
30928
  switch(params.gasEstimateType){
30880
30929
  case ($de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2:
30881
- return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
30930
+ return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired, params.tokenAddress);
30882
30931
  case ($de275b98d2b651c3$export$788b1fd17f3dad84).SWAP:
30883
30932
  return await $2e7bf45a7c9a9570$var$swapGasEstimator(config);
30884
30933
  default:
@@ -33601,7 +33650,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
33601
33650
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
33602
33651
 
33603
33652
 
33604
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.4-alpha.2";
33653
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.5";
33605
33654
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
33606
33655
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
33607
33656
 
package/dist/index.d.ts CHANGED
@@ -14422,6 +14422,12 @@ interface IMXProvider {
14422
14422
  * @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
14423
14423
  */
14424
14424
  registerOffchain(): Promise<RegisterUserResponse>;
14425
+ /**
14426
+ * Checks if a User is registered off-chain
14427
+ *
14428
+ * @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
14429
+ */
14430
+ isRegisteredOffchain(): Promise<boolean>;
14425
14431
  /**
14426
14432
  * Checks if a User is registered on-chain
14427
14433
  *
@@ -14499,6 +14505,7 @@ declare class GenericIMXProvider implements IMXProvider {
14499
14505
  private readonly signers;
14500
14506
  constructor(config: ProviderConfiguration$1, ethSigner: Signer, starkSigner: StarkSigner);
14501
14507
  getAddress(): Promise<string>;
14508
+ isRegisteredOffchain(): Promise<boolean>;
14502
14509
  registerOffchain(): Promise<RegisterUserResponse>;
14503
14510
  batchNftTransfer(request: Array<NftTransferDetails>): Promise<CreateTransferResponse>;
14504
14511
  cancelOrder(request: GetSignableCancelOrderRequest): Promise<CancelOrderResponse>;
@@ -14537,7 +14544,7 @@ type UserProfile = {
14537
14544
  };
14538
14545
  declare enum Networks {
14539
14546
  PRODUCTION = "mainnet",
14540
- SANDBOX = "goerli"
14547
+ SANDBOX = "sepolia"
14541
14548
  }
14542
14549
  interface OidcConfiguration {
14543
14550
  clientId: string;
@@ -15926,6 +15933,15 @@ type ExchangeOverrides = {
15926
15933
  wrappedNativeToken: ERC20;
15927
15934
  };
15928
15935
 
15936
+ /**
15937
+ * @typedef {string} Address - Represents an Ethereum address.
15938
+ */
15939
+ type Address = string;
15940
+ /**
15941
+ * @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
15942
+ */
15943
+ type FungibleToken = Address | 'NATIVE';
15944
+
15929
15945
  /**
15930
15946
  * Enum representing different chain IDs.
15931
15947
  * @enum {number}
@@ -16754,10 +16770,12 @@ type GasEstimateParams = GasEstimateBridgeToL2Params | GasEstimateSwapParams;
16754
16770
  * An interface representing the parameters for estimating gas for a bridge to L2 transaction {@link Checkout.gasEstimate}.
16755
16771
  * @param {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
16756
16772
  * @param {boolean} isSpendingCapApprovalRequired - Whether or not spending cap approval is required.
16773
+ * @param {FungibleToken | undefined} tokenAddress - The address of the fungible token to use in the transaction.
16757
16774
  */
16758
16775
  interface GasEstimateBridgeToL2Params {
16759
16776
  gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
16760
16777
  isSpendingCapApprovalRequired: boolean;
16778
+ tokenAddress?: FungibleToken;
16761
16779
  }
16762
16780
  /**
16763
16781
  * An interface representing the parameters for a gas estimate swap {@link Checkout.gasEstimate}.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import globalAxios$1, { isAxiosError as isAxiosError$1, HttpStatusCode as HttpStatusCode$2 } from 'axios';
1
+ import globalAxios$1, { isAxiosError as isAxiosError$1, AxiosError as AxiosError$1, HttpStatusCode as HttpStatusCode$2 } from 'axios';
2
2
  import { ImmutableX, Config, IMXError, createStarkSigner, generateLegacyStarkPrivateKey, TransfersApi, OrdersApi as OrdersApi$1, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi as TokensApi$1 } from '@imtbl/core-sdk';
3
3
  import { UserManager, InMemoryWebStorage, WebStorageStateStore } from 'oidc-client-ts';
4
4
  import jwt_decode from 'jwt-decode';
@@ -3629,7 +3629,7 @@ class MultiRollupApiClients {
3629
3629
  }
3630
3630
 
3631
3631
  // eslint-disable-next-line @typescript-eslint/naming-convention
3632
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.4-alpha.2' };
3632
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.5' };
3633
3633
  const createConfig = ({ basePath, headers, }) => {
3634
3634
  if (!basePath.trim()) {
3635
3635
  throw Error('basePath can not be empty');
@@ -3689,7 +3689,7 @@ class APIError extends Error {
3689
3689
 
3690
3690
  /* eslint-disable implicit-arrow-linebreak */
3691
3691
  const defaultHeaders = {
3692
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.4-alpha.2',
3692
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.5',
3693
3693
  };
3694
3694
  /**
3695
3695
  * createAPIConfiguration to create a custom Configuration
@@ -4100,7 +4100,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4100
4100
  chainID,
4101
4101
  coreContractAddress,
4102
4102
  registrationContractAddress,
4103
- sdkVersion: 'ts-immutable-sdk-0.28.4-alpha.2',
4103
+ sdkVersion: 'ts-immutable-sdk-0.28.5',
4104
4104
  });
4105
4105
  /**
4106
4106
  * Sets `sdkVersion` at the time of build
@@ -9045,39 +9045,63 @@ class AuthManager {
9045
9045
  }
9046
9046
  }
9047
9047
 
9048
+ const lazyLoad = (promiseToAwait, initialiseFunction) => (promiseToAwait().then(initialiseFunction));
9049
+ const lazyDocumentReady = (initialiseFunction) => {
9050
+ const documentReadyPromise = () => new Promise((resolve) => {
9051
+ if (window.document.readyState === 'complete') {
9052
+ resolve();
9053
+ }
9054
+ else {
9055
+ const onReadyStateChange = () => {
9056
+ if (window.document.readyState === 'complete') {
9057
+ resolve();
9058
+ window.document.removeEventListener('readystatechange', onReadyStateChange);
9059
+ }
9060
+ };
9061
+ window.document.addEventListener('readystatechange', onReadyStateChange);
9062
+ }
9063
+ });
9064
+ return lazyLoad(documentReadyPromise, initialiseFunction);
9065
+ };
9066
+
9048
9067
  class MagicAdapter {
9049
9068
  config;
9050
- magicClient;
9069
+ lazyMagicClient;
9051
9070
  constructor(config) {
9052
9071
  this.config = config;
9053
9072
  if (typeof window !== 'undefined') {
9054
- this.magicClient = this.initMagicClient();
9055
- this.magicClient.preload();
9073
+ this.lazyMagicClient = lazyDocumentReady(() => {
9074
+ const client = new Magic(this.config.magicPublishableApiKey, {
9075
+ extensions: [new OpenIdExtension()],
9076
+ network: this.config.network,
9077
+ });
9078
+ client.preload();
9079
+ return client;
9080
+ });
9056
9081
  }
9057
9082
  }
9083
+ get magicClient() {
9084
+ if (!this.lazyMagicClient) {
9085
+ throw new Error('Cannot perform this action outside of the browser');
9086
+ }
9087
+ return this.lazyMagicClient;
9088
+ }
9058
9089
  async login(idToken) {
9059
9090
  return withPassportError(async () => {
9060
- if (!this.magicClient) {
9061
- this.magicClient = this.initMagicClient();
9062
- }
9063
- await this.magicClient.openid.loginWithOIDC({
9091
+ const magicClient = await this.magicClient;
9092
+ await magicClient.openid.loginWithOIDC({
9064
9093
  jwt: idToken,
9065
9094
  providerId: this.config.magicProviderId,
9066
9095
  });
9067
- return this.magicClient.rpcProvider;
9096
+ return magicClient.rpcProvider;
9068
9097
  }, PassportErrorType.WALLET_CONNECTION_ERROR);
9069
9098
  }
9070
9099
  async logout() {
9071
- if (this.magicClient?.user) {
9072
- await this.magicClient.user.logout();
9100
+ const magicClient = await this.magicClient;
9101
+ if (magicClient.user) {
9102
+ await magicClient.user.logout();
9073
9103
  }
9074
9104
  }
9075
- initMagicClient() {
9076
- return new Magic(this.config.magicPublishableApiKey, {
9077
- extensions: [new OpenIdExtension()],
9078
- network: this.config.network,
9079
- });
9080
- }
9081
9105
  }
9082
9106
 
9083
9107
  const getStarkSigner = async (signer) => withPassportError(async () => {
@@ -9304,7 +9328,7 @@ var PassportEvents;
9304
9328
  var Networks;
9305
9329
  (function (Networks) {
9306
9330
  Networks["PRODUCTION"] = "mainnet";
9307
- Networks["SANDBOX"] = "goerli";
9331
+ Networks["SANDBOX"] = "sepolia";
9308
9332
  })(Networks || (Networks = {}));
9309
9333
 
9310
9334
  async function exchangeTransfer$1({ user, starkSigner, request, exchangesApi, }) {
@@ -9653,6 +9677,11 @@ class PassportImxProvider {
9653
9677
  }
9654
9678
  // TODO: Remove once implemented
9655
9679
  // eslint-disable-next-line class-methods-use-this
9680
+ isRegisteredOffchain() {
9681
+ throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
9682
+ }
9683
+ // TODO: Remove once implemented
9684
+ // eslint-disable-next-line class-methods-use-this
9656
9685
  isRegisteredOnchain() {
9657
9686
  throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
9658
9687
  }
@@ -12649,6 +12678,22 @@ async function registerOffchain(signers, config) {
12649
12678
  });
12650
12679
  return registeredUser.data;
12651
12680
  }
12681
+ async function isRegisteredOffchain(ethAddress, config) {
12682
+ try {
12683
+ const usersApi = new UsersApi(config.immutableXConfig.apiConfiguration);
12684
+ const getUsersResult = await usersApi.getUsers({
12685
+ user: ethAddress,
12686
+ });
12687
+ const { accounts } = getUsersResult.data;
12688
+ return accounts?.length > 0;
12689
+ }
12690
+ catch (ex) {
12691
+ if (ex instanceof AxiosError$1 && ex.response?.status === 404) {
12692
+ return false;
12693
+ }
12694
+ throw ex;
12695
+ }
12696
+ }
12652
12697
  async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
12653
12698
  await validateChain(ethSigner, config.immutableXConfig);
12654
12699
  const registrationContract = Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
@@ -13184,7 +13229,11 @@ class GenericIMXProvider {
13184
13229
  this.signers = { ethSigner, starkSigner };
13185
13230
  }
13186
13231
  async getAddress() {
13187
- return await this.signers.ethSigner.getAddress();
13232
+ return this.signers.ethSigner.getAddress();
13233
+ }
13234
+ async isRegisteredOffchain() {
13235
+ const ethAddress = await this.getAddress();
13236
+ return isRegisteredOffchain(ethAddress, this.config);
13188
13237
  }
13189
13238
  registerOffchain() {
13190
13239
  return registerOffchain(this.signers, this.config);
@@ -30775,39 +30824,39 @@ function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, s
30775
30824
 
30776
30825
  const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
30777
30826
  const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
30778
- async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired) {
30827
+ async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
30828
+ if (tokenAddress === "NATIVE") return config.networkMap.get(chainId)?.nativeCurrency;
30829
+ const contract = new (Contract$1)(tokenAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
30830
+ const name = await contract.name();
30831
+ const symbol = await contract.symbol();
30832
+ const decimals = await contract.decimals();
30833
+ return {
30834
+ name: name,
30835
+ symbol: symbol,
30836
+ decimals: decimals,
30837
+ address: tokenAddress
30838
+ };
30839
+ }
30840
+ async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
30779
30841
  const fromChainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
30780
30842
  const toChainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
30781
30843
  const gasEstimateTokensConfig = await config.remote.getConfig("gasEstimateTokens");
30782
- const { fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
30844
+ const { gasTokenAddress: gasTokenAddress, fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
30783
30845
  const provider = readOnlyProviders.get(fromChainId);
30784
30846
  if (!provider) throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
30785
30847
  try {
30786
- let gasFees = {};
30787
- const getGasFees = async ()=>{
30788
- gasFees = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
30789
- gasFees.token = config.networkMap.get(fromChainId)?.nativeCurrency;
30790
- };
30791
- let bridgeFees = {
30792
- bridgeFee: {},
30793
- bridgeable: false
30794
- };
30795
- const getBridgeFees = async ()=>{
30796
- const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
30797
- bridgeFees = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
30798
- };
30799
- await Promise.all([
30800
- getGasFees(),
30801
- getBridgeFees()
30802
- ]);
30848
+ const gasFee = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
30849
+ gasFee.token = await $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress ?? (gasTokenAddress || "NATIVE"), fromChainId, provider);
30850
+ const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
30851
+ const { bridgeFee: bridgeFee, bridgeable: bridgeable } = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
30803
30852
  return {
30804
30853
  gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
30805
- gasFee: gasFees,
30854
+ gasFee: gasFee,
30806
30855
  bridgeFee: {
30807
- estimatedAmount: bridgeFees.bridgeFee?.estimatedAmount,
30808
- token: bridgeFees.bridgeFee?.token
30856
+ estimatedAmount: bridgeFee?.estimatedAmount,
30857
+ token: bridgeFee?.token
30809
30858
  },
30810
- bridgeable: bridgeFees.bridgeable
30859
+ bridgeable: bridgeable
30811
30860
  };
30812
30861
  } catch {
30813
30862
  // In the case of an error, just return an empty gas & bridge fee estimate
@@ -30856,7 +30905,7 @@ async function $2e7bf45a7c9a9570$var$swapGasEstimator(config) {
30856
30905
  async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProviders, config) {
30857
30906
  switch(params.gasEstimateType){
30858
30907
  case ($de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2:
30859
- return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
30908
+ return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired, params.tokenAddress);
30860
30909
  case ($de275b98d2b651c3$export$788b1fd17f3dad84).SWAP:
30861
30910
  return await $2e7bf45a7c9a9570$var$swapGasEstimator(config);
30862
30911
  default:
@@ -33579,7 +33628,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
33579
33628
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
33580
33629
 
33581
33630
 
33582
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.4-alpha.2";
33631
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.5";
33583
33632
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
33584
33633
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
33585
33634
 
@@ -9732,6 +9732,12 @@ interface IMXProvider {
9732
9732
  * @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
9733
9733
  */
9734
9734
  registerOffchain(): Promise<RegisterUserResponse>;
9735
+ /**
9736
+ * Checks if a User is registered off-chain
9737
+ *
9738
+ * @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
9739
+ */
9740
+ isRegisteredOffchain(): Promise<boolean>;
9735
9741
  /**
9736
9742
  * Checks if a User is registered on-chain
9737
9743
  *
@@ -10184,7 +10190,7 @@ type UserProfile = {
10184
10190
  };
10185
10191
  declare enum Networks {
10186
10192
  PRODUCTION = "mainnet",
10187
- SANDBOX = "goerli"
10193
+ SANDBOX = "sepolia"
10188
10194
  }
10189
10195
  interface OidcConfiguration {
10190
10196
  clientId: string;