@imtbl/sdk 0.23.0-alpha → 0.23.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.
package/dist/index.cjs CHANGED
@@ -3009,7 +3009,7 @@ class MultiRollupApiClients {
3009
3009
  }
3010
3010
 
3011
3011
  // eslint-disable-next-line @typescript-eslint/naming-convention
3012
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.0-alpha' };
3012
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.2' };
3013
3013
  const createConfig = ({ basePath, headers, }) => {
3014
3014
  if (!basePath.trim()) {
3015
3015
  throw Error('basePath can not be empty');
@@ -3069,7 +3069,7 @@ class APIError extends Error {
3069
3069
 
3070
3070
  /* eslint-disable implicit-arrow-linebreak */
3071
3071
  const defaultHeaders = {
3072
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.0-alpha',
3072
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.2',
3073
3073
  };
3074
3074
  /**
3075
3075
  * createAPIConfiguration to create a custom Configuration
@@ -3355,7 +3355,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3355
3355
  chainID,
3356
3356
  coreContractAddress,
3357
3357
  registrationContractAddress,
3358
- sdkVersion: 'ts-immutable-sdk-0.23.0-alpha',
3358
+ sdkVersion: 'ts-immutable-sdk-0.23.2',
3359
3359
  });
3360
3360
  /**
3361
3361
  * Sets `sdkVersion` at the time of build
@@ -8217,14 +8217,25 @@ class AuthManager {
8217
8217
  this.deviceCredentialsManager.clearCredentials();
8218
8218
  }, PassportErrorType.LOGOUT_ERROR);
8219
8219
  }
8220
- async loginSilent() {
8221
- return withPassportError(async () => this.getUser(), PassportErrorType.SILENT_LOGIN_ERROR);
8220
+ async loginSilent({ forceRefresh } = { forceRefresh: false }) {
8221
+ // eslint-disable-next-line arrow-body-style
8222
+ return withPassportError(async () => {
8223
+ return this.getUser({ forceRefresh });
8224
+ }, PassportErrorType.SILENT_LOGIN_ERROR);
8222
8225
  }
8223
- async getWebUser() {
8226
+ /**
8227
+ * Get the user from the cache or refresh the token if it's expired.
8228
+ * @param forceRefresh If set to true, force an HTTP call to the OIDC server's authorization endpoint. This call will
8229
+ * throw an error if there's no refresh token.
8230
+ */
8231
+ async getWebUser({ forceRefresh = false }) {
8232
+ if (forceRefresh) {
8233
+ const newOidcUser = await this.userManager.signinSilent();
8234
+ return newOidcUser ? AuthManager.mapOidcUserToDomainModel(newOidcUser) : null;
8235
+ }
8224
8236
  const oidcUser = await this.userManager.getUser();
8225
- if (!oidcUser) {
8237
+ if (!oidcUser)
8226
8238
  return null;
8227
- }
8228
8239
  const tokenExpired = isTokenExpired(oidcUser);
8229
8240
  if (!tokenExpired) {
8230
8241
  return AuthManager.mapOidcUserToDomainModel(oidcUser);
@@ -8237,9 +8248,9 @@ class AuthManager {
8237
8248
  }
8238
8249
  return null;
8239
8250
  }
8240
- async getUser() {
8251
+ async getUser({ forceRefresh } = { forceRefresh: false }) {
8241
8252
  return withPassportError(async () => {
8242
- const user = await this.getWebUser();
8253
+ const user = await this.getWebUser({ forceRefresh });
8243
8254
  if (user) {
8244
8255
  return user;
8245
8256
  }
@@ -9017,7 +9028,7 @@ class PassportImxProviderFactory {
9017
9028
  }, jwt);
9018
9029
  // User metadata is updated asynchronously. Poll userinfo endpoint until it is updated.
9019
9030
  const updatedUser = await retryWithDelay(async () => {
9020
- const user = await this.authManager.loginSilent();
9031
+ const user = await this.authManager.loginSilent({ forceRefresh: true }); // force refresh to get updated user info
9021
9032
  const metadataExists = !!user?.imx;
9022
9033
  if (metadataExists) {
9023
9034
  return user;
@@ -9517,7 +9528,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
9517
9528
  user = await authManager.refreshToken(credentials.refresh_token);
9518
9529
  }
9519
9530
  else {
9520
- user = await authManager.loginSilent();
9531
+ user = await authManager.loginSilent({ forceRefresh: true });
9521
9532
  }
9522
9533
  if (!user?.zkEvm) {
9523
9534
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
@@ -32095,10 +32106,12 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
32095
32106
  get CheckoutErrorType () { return $a8bc256d81a5e2c1$export$e3dc0620abde7f5a; },
32096
32107
  get CheckoutStatus () { return $4b58188d47aafe8d$export$de7bcda3c490bf18; },
32097
32108
  get ExchangeType () { return $e055e79256bbc1dd$export$80f4da0d409a629d; },
32109
+ get FundingStepType () { return $4b58188d47aafe8d$export$6fbaa98ee06d03e8; },
32098
32110
  get GasEstimateType () { return $de275b98d2b651c3$export$788b1fd17f3dad84; },
32099
32111
  get GasTokenType () { return $4b58188d47aafe8d$export$537fa3efd10ed435; },
32100
32112
  get ItemType () { return $4b58188d47aafe8d$export$1fc8f52ad1810e52; },
32101
32113
  get NetworkFilterTypes () { return $a47e48dd2c04791b$export$1f05a55fe0680cc7; },
32114
+ get RoutingOutcomeType () { return $4b58188d47aafe8d$export$d0616bd3e995b8be; },
32102
32115
  get TokenFilterTypes () { return $08d5ddc39acd6833$export$fd9b17d87f4121d2; },
32103
32116
  get TransactionOrGasType () { return $4b58188d47aafe8d$export$65c64e46348ee3c1; },
32104
32117
  get WalletFilterTypes () { return $4f91c5f280efe242$export$a75605c67ea83a5a; },
@@ -32129,7 +32142,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
32129
32142
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
32130
32143
 
32131
32144
 
32132
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.0-alpha";
32145
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.2";
32133
32146
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
32134
32147
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
32135
32148
 
package/dist/index.d.ts CHANGED
@@ -13414,7 +13414,7 @@ declare namespace Fee$2 {
13414
13414
  }
13415
13415
  }
13416
13416
 
13417
- type ERC20Item$2 = {
13417
+ type ERC20Item$1 = {
13418
13418
  /**
13419
13419
  * Token type user is offering, which in this case is ERC20
13420
13420
  */
@@ -13429,7 +13429,7 @@ type ERC20Item$2 = {
13429
13429
  start_amount: string;
13430
13430
  };
13431
13431
 
13432
- type ERC721Item$2 = {
13432
+ type ERC721Item$1 = {
13433
13433
  /**
13434
13434
  * Token type user is offering, which in this case is ERC721
13435
13435
  */
@@ -13444,7 +13444,7 @@ type ERC721Item$2 = {
13444
13444
  token_id: string;
13445
13445
  };
13446
13446
 
13447
- type NativeItem$2 = {
13447
+ type NativeItem$1 = {
13448
13448
  /**
13449
13449
  * Token type user is offering, which in this case is the native IMX token
13450
13450
  */
@@ -13455,7 +13455,7 @@ type NativeItem$2 = {
13455
13455
  start_amount: string;
13456
13456
  };
13457
13457
 
13458
- type Item = (NativeItem$2 | ERC20Item$2 | ERC721Item$2);
13458
+ type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1);
13459
13459
 
13460
13460
  type ProtocolData = {
13461
13461
  /**
@@ -13815,17 +13815,17 @@ declare class OrdersService {
13815
13815
  }): CancelablePromise<TradeResult$1>;
13816
13816
  }
13817
13817
 
13818
- interface ERC721Item$1 {
13818
+ interface ERC721Item {
13819
13819
  type: 'ERC721';
13820
13820
  contractAddress: string;
13821
13821
  tokenId: string;
13822
13822
  }
13823
- interface ERC20Item$1 {
13823
+ interface ERC20Item {
13824
13824
  type: 'ERC20';
13825
13825
  contractAddress: string;
13826
13826
  amount: string;
13827
13827
  }
13828
- interface NativeItem$1 {
13828
+ interface NativeItem {
13829
13829
  type: 'NATIVE';
13830
13830
  amount: string;
13831
13831
  }
@@ -13835,8 +13835,8 @@ interface RoyaltyInfo {
13835
13835
  }
13836
13836
  interface PrepareListingParams {
13837
13837
  makerAddress: string;
13838
- sell: ERC721Item$1;
13839
- buy: ERC20Item$1 | NativeItem$1;
13838
+ sell: ERC721Item;
13839
+ buy: ERC20Item | NativeItem;
13840
13840
  orderExpiry?: Date;
13841
13841
  }
13842
13842
  interface PrepareListingResponse {
@@ -13907,8 +13907,8 @@ interface CancelOrderResponse {
13907
13907
  interface Order {
13908
13908
  id: string;
13909
13909
  accountAddress: string;
13910
- buy: (ERC20Item$1 | NativeItem$1)[];
13911
- sell: ERC721Item$1[];
13910
+ buy: (ERC20Item | NativeItem)[];
13911
+ sell: ERC721Item[];
13912
13912
  fees: Fee$1[];
13913
13913
  chain: {
13914
13914
  id: string;
@@ -13959,8 +13959,8 @@ interface Trade {
13959
13959
  id: string;
13960
13960
  name: string;
13961
13961
  };
13962
- buy: (ERC20Item$1 | NativeItem$1)[];
13963
- sell: ERC721Item$1[];
13962
+ buy: (ERC20Item | NativeItem)[];
13963
+ sell: ERC721Item[];
13964
13964
  buyerFees: Fee$1[];
13965
13965
  sellerAddress: string;
13966
13966
  buyerAddress: string;
@@ -14081,6 +14081,8 @@ type orderbook_d_ActionType = ActionType;
14081
14081
  declare const orderbook_d_ActionType: typeof ActionType;
14082
14082
  type orderbook_d_CancelOrderResponse = CancelOrderResponse;
14083
14083
  type orderbook_d_CreateListingParams = CreateListingParams;
14084
+ type orderbook_d_ERC20Item = ERC20Item;
14085
+ type orderbook_d_ERC721Item = ERC721Item;
14084
14086
  type orderbook_d_FeeType = FeeType;
14085
14087
  declare const orderbook_d_FeeType: typeof FeeType;
14086
14088
  type orderbook_d_FeeValue = FeeValue;
@@ -14090,6 +14092,7 @@ type orderbook_d_ListListingsResult = ListListingsResult;
14090
14092
  type orderbook_d_ListTradesParams = ListTradesParams;
14091
14093
  type orderbook_d_ListTradesResult = ListTradesResult;
14092
14094
  type orderbook_d_ListingResult = ListingResult;
14095
+ type orderbook_d_NativeItem = NativeItem;
14093
14096
  type orderbook_d_Order = Order;
14094
14097
  type orderbook_d_OrderStatus = OrderStatus;
14095
14098
  declare const orderbook_d_OrderStatus: typeof OrderStatus;
@@ -14115,8 +14118,8 @@ declare namespace orderbook_d {
14115
14118
  orderbook_d_ActionType as ActionType,
14116
14119
  orderbook_d_CancelOrderResponse as CancelOrderResponse,
14117
14120
  orderbook_d_CreateListingParams as CreateListingParams,
14118
- ERC20Item$1 as ERC20Item,
14119
- ERC721Item$1 as ERC721Item,
14121
+ orderbook_d_ERC20Item as ERC20Item,
14122
+ orderbook_d_ERC721Item as ERC721Item,
14120
14123
  Fee$1 as Fee,
14121
14124
  orderbook_d_FeeType as FeeType,
14122
14125
  orderbook_d_FeeValue as FeeValue,
@@ -14126,7 +14129,7 @@ declare namespace orderbook_d {
14126
14129
  orderbook_d_ListTradesParams as ListTradesParams,
14127
14130
  orderbook_d_ListTradesResult as ListTradesResult,
14128
14131
  orderbook_d_ListingResult as ListingResult,
14129
- NativeItem$1 as NativeItem,
14132
+ orderbook_d_NativeItem as NativeItem,
14130
14133
  orderbook_d_Order as Order,
14131
14134
  orderbook_d_OrderStatus as OrderStatus,
14132
14135
  orderbook_d_Orderbook as Orderbook,
@@ -14486,11 +14489,6 @@ type ERC721ItemRequirement = {
14486
14489
  id: string;
14487
14490
  spenderAddress: string;
14488
14491
  };
14489
- /**
14490
- * Represents the item requirements for a transaction.
14491
- * NativeItem, ERC20Item or ERC721Item {@link Checkout.smartCheckout}.
14492
- */
14493
- type ItemRequirement = NativeItem | ERC20Item | ERC721Item;
14494
14492
  /**
14495
14493
  * An enum representing the item types
14496
14494
  * @enum {string}
@@ -14503,41 +14501,6 @@ declare enum ItemType {
14503
14501
  ERC20 = "ERC20",
14504
14502
  ERC721 = "ERC721"
14505
14503
  }
14506
- /**
14507
- * Represents a native item.
14508
- * @property {ItemType} type - The type indicate this is a native item.
14509
- * @property {BigNumber} amount - The amount of the item.
14510
- */
14511
- type NativeItem = {
14512
- type: ItemType.NATIVE;
14513
- amount: BigNumber;
14514
- };
14515
- /**
14516
- * Represents an ERC20 item.
14517
- * @property {ItemType} type - The type to indicate this is an ERC20 item.
14518
- * @property {string} contractAddress - The contract address of the ERC20.
14519
- * @property {BigNumber} amount - The amount of the item.
14520
- * @property {string} spenderAddress - The contract address of the approver.
14521
- */
14522
- type ERC20Item = {
14523
- type: ItemType.ERC20;
14524
- contractAddress: string;
14525
- amount: BigNumber;
14526
- spenderAddress: string;
14527
- };
14528
- /**
14529
- * Represents an ERC721 item.
14530
- * @property {ItemType} type - The type to indicate this is an ERC721 item.
14531
- * @property {string} contractAddress - The contract address of the ERC721 collection.
14532
- * @property {string} id - The ID of this ERC721 in the collection.
14533
- * @property {string} spenderAddress - The contract address of the approver.
14534
- */
14535
- type ERC721Item = {
14536
- type: ItemType.ERC721;
14537
- contractAddress: string;
14538
- id: string;
14539
- spenderAddress: string;
14540
- };
14541
14504
  /**
14542
14505
  * An enum representing transaction or gas types
14543
14506
  * @enum {string}
@@ -14874,6 +14837,24 @@ type AvailableRoutingOptions = {
14874
14837
  swap?: boolean;
14875
14838
  bridge?: boolean;
14876
14839
  };
14840
+ type FundingRouteFeeEstimate = SwapRouteFeeEstimate | BridgeRouteFeeEstimate;
14841
+ type SwapRouteFeeEstimate = {
14842
+ type: FundingStepType.SWAP;
14843
+ estimatedAmount: BigNumber;
14844
+ token: TokenInfo;
14845
+ };
14846
+ type BridgeRouteFeeEstimate = {
14847
+ type: FundingStepType.BRIDGE;
14848
+ gasFee: {
14849
+ estimatedAmount: BigNumber;
14850
+ token?: TokenInfo;
14851
+ };
14852
+ bridgeFee: {
14853
+ estimatedAmount: BigNumber;
14854
+ token?: TokenInfo;
14855
+ };
14856
+ totalFees: BigNumber;
14857
+ };
14877
14858
  /**
14878
14859
  * Interface representing the parameters for {@link Checkout.buy}
14879
14860
  * @property {Web3Provider} provider - The provider to use for the buy.
@@ -15565,6 +15546,8 @@ declare class Checkout {
15565
15546
  }
15566
15547
 
15567
15548
  type checkout_sdk_d_AllowedNetworkConfig = AllowedNetworkConfig;
15549
+ type checkout_sdk_d_AvailableRoutingOptions = AvailableRoutingOptions;
15550
+ type checkout_sdk_d_BalanceDelta = BalanceDelta;
15568
15551
  type checkout_sdk_d_BuyOrder = BuyOrder;
15569
15552
  type checkout_sdk_d_BuyParams = BuyParams;
15570
15553
  type checkout_sdk_d_BuyResult = BuyResult;
@@ -15597,6 +15580,12 @@ type checkout_sdk_d_FeePercentage = FeePercentage;
15597
15580
  type checkout_sdk_d_FeeToken = FeeToken;
15598
15581
  type checkout_sdk_d_FiatRampParams = FiatRampParams;
15599
15582
  type checkout_sdk_d_FulfillmentTransaction = FulfillmentTransaction;
15583
+ type checkout_sdk_d_FundingItem = FundingItem;
15584
+ type checkout_sdk_d_FundingRoute = FundingRoute;
15585
+ type checkout_sdk_d_FundingRouteFeeEstimate = FundingRouteFeeEstimate;
15586
+ type checkout_sdk_d_FundingStep = FundingStep;
15587
+ type checkout_sdk_d_FundingStepType = FundingStepType;
15588
+ declare const checkout_sdk_d_FundingStepType: typeof FundingStepType;
15600
15589
  type checkout_sdk_d_GasAmount = GasAmount;
15601
15590
  type checkout_sdk_d_GasEstimateBridgeToL2Result = GasEstimateBridgeToL2Result;
15602
15591
  type checkout_sdk_d_GasEstimateParams = GasEstimateParams;
@@ -15618,7 +15607,7 @@ type checkout_sdk_d_GetTokenAllowListParams = GetTokenAllowListParams;
15618
15607
  type checkout_sdk_d_GetTokenAllowListResult = GetTokenAllowListResult;
15619
15608
  type checkout_sdk_d_GetWalletAllowListParams = GetWalletAllowListParams;
15620
15609
  type checkout_sdk_d_GetWalletAllowListResult = GetWalletAllowListResult;
15621
- type checkout_sdk_d_ItemRequirement = ItemRequirement;
15610
+ type checkout_sdk_d_ItemBalance = ItemBalance;
15622
15611
  type checkout_sdk_d_ItemType = ItemType;
15623
15612
  declare const checkout_sdk_d_ItemType: typeof ItemType;
15624
15613
  type checkout_sdk_d_NativeItemRequirement = NativeItemRequirement;
@@ -15628,6 +15617,9 @@ declare const checkout_sdk_d_NetworkFilterTypes: typeof NetworkFilterTypes;
15628
15617
  type checkout_sdk_d_NetworkInfo = NetworkInfo;
15629
15618
  type checkout_sdk_d_OrderFee = OrderFee;
15630
15619
  type checkout_sdk_d_RemoteConfiguration = RemoteConfiguration;
15620
+ type checkout_sdk_d_RoutingOutcome = RoutingOutcome;
15621
+ type checkout_sdk_d_RoutingOutcomeType = RoutingOutcomeType;
15622
+ declare const checkout_sdk_d_RoutingOutcomeType: typeof RoutingOutcomeType;
15631
15623
  type checkout_sdk_d_SellOrder = SellOrder;
15632
15624
  type checkout_sdk_d_SellParams = SellParams;
15633
15625
  type checkout_sdk_d_SellResult = SellResult;
@@ -15635,6 +15627,8 @@ type checkout_sdk_d_SellToken = SellToken;
15635
15627
  type checkout_sdk_d_SendTransactionParams = SendTransactionParams;
15636
15628
  type checkout_sdk_d_SendTransactionResult = SendTransactionResult;
15637
15629
  type checkout_sdk_d_SmartCheckoutParams = SmartCheckoutParams;
15630
+ type checkout_sdk_d_SmartCheckoutResult = SmartCheckoutResult;
15631
+ type checkout_sdk_d_SmartCheckoutRouter = SmartCheckoutRouter;
15638
15632
  type checkout_sdk_d_SwitchNetworkParams = SwitchNetworkParams;
15639
15633
  type checkout_sdk_d_SwitchNetworkResult = SwitchNetworkResult;
15640
15634
  type checkout_sdk_d_TokenFilter = TokenFilter;
@@ -15643,6 +15637,7 @@ declare const checkout_sdk_d_TokenFilterTypes: typeof TokenFilterTypes;
15643
15637
  type checkout_sdk_d_TokenInfo = TokenInfo;
15644
15638
  type checkout_sdk_d_TransactionOrGasType = TransactionOrGasType;
15645
15639
  declare const checkout_sdk_d_TransactionOrGasType: typeof TransactionOrGasType;
15640
+ type checkout_sdk_d_TransactionRequirement = TransactionRequirement;
15646
15641
  type checkout_sdk_d_WalletFilter = WalletFilter;
15647
15642
  type checkout_sdk_d_WalletFilterTypes = WalletFilterTypes;
15648
15643
  declare const checkout_sdk_d_WalletFilterTypes: typeof WalletFilterTypes;
@@ -15652,6 +15647,8 @@ declare const checkout_sdk_d_WalletProviderName: typeof WalletProviderName;
15652
15647
  declare namespace checkout_sdk_d {
15653
15648
  export {
15654
15649
  checkout_sdk_d_AllowedNetworkConfig as AllowedNetworkConfig,
15650
+ checkout_sdk_d_AvailableRoutingOptions as AvailableRoutingOptions,
15651
+ checkout_sdk_d_BalanceDelta as BalanceDelta,
15655
15652
  checkout_sdk_d_BuyOrder as BuyOrder,
15656
15653
  checkout_sdk_d_BuyParams as BuyParams,
15657
15654
  checkout_sdk_d_BuyResult as BuyResult,
@@ -15678,6 +15675,11 @@ declare namespace checkout_sdk_d {
15678
15675
  checkout_sdk_d_FeeToken as FeeToken,
15679
15676
  checkout_sdk_d_FiatRampParams as FiatRampParams,
15680
15677
  checkout_sdk_d_FulfillmentTransaction as FulfillmentTransaction,
15678
+ checkout_sdk_d_FundingItem as FundingItem,
15679
+ checkout_sdk_d_FundingRoute as FundingRoute,
15680
+ checkout_sdk_d_FundingRouteFeeEstimate as FundingRouteFeeEstimate,
15681
+ checkout_sdk_d_FundingStep as FundingStep,
15682
+ checkout_sdk_d_FundingStepType as FundingStepType,
15681
15683
  checkout_sdk_d_GasAmount as GasAmount,
15682
15684
  checkout_sdk_d_GasEstimateBridgeToL2Result as GasEstimateBridgeToL2Result,
15683
15685
  checkout_sdk_d_GasEstimateParams as GasEstimateParams,
@@ -15697,7 +15699,7 @@ declare namespace checkout_sdk_d {
15697
15699
  checkout_sdk_d_GetTokenAllowListResult as GetTokenAllowListResult,
15698
15700
  checkout_sdk_d_GetWalletAllowListParams as GetWalletAllowListParams,
15699
15701
  checkout_sdk_d_GetWalletAllowListResult as GetWalletAllowListResult,
15700
- checkout_sdk_d_ItemRequirement as ItemRequirement,
15702
+ checkout_sdk_d_ItemBalance as ItemBalance,
15701
15703
  checkout_sdk_d_ItemType as ItemType,
15702
15704
  checkout_sdk_d_NativeItemRequirement as NativeItemRequirement,
15703
15705
  checkout_sdk_d_NetworkFilter as NetworkFilter,
@@ -15705,6 +15707,8 @@ declare namespace checkout_sdk_d {
15705
15707
  checkout_sdk_d_NetworkInfo as NetworkInfo,
15706
15708
  checkout_sdk_d_OrderFee as OrderFee,
15707
15709
  checkout_sdk_d_RemoteConfiguration as RemoteConfiguration,
15710
+ checkout_sdk_d_RoutingOutcome as RoutingOutcome,
15711
+ checkout_sdk_d_RoutingOutcomeType as RoutingOutcomeType,
15708
15712
  checkout_sdk_d_SellOrder as SellOrder,
15709
15713
  checkout_sdk_d_SellParams as SellParams,
15710
15714
  checkout_sdk_d_SellResult as SellResult,
@@ -15712,12 +15716,15 @@ declare namespace checkout_sdk_d {
15712
15716
  checkout_sdk_d_SendTransactionParams as SendTransactionParams,
15713
15717
  checkout_sdk_d_SendTransactionResult as SendTransactionResult,
15714
15718
  checkout_sdk_d_SmartCheckoutParams as SmartCheckoutParams,
15719
+ checkout_sdk_d_SmartCheckoutResult as SmartCheckoutResult,
15720
+ checkout_sdk_d_SmartCheckoutRouter as SmartCheckoutRouter,
15715
15721
  checkout_sdk_d_SwitchNetworkParams as SwitchNetworkParams,
15716
15722
  checkout_sdk_d_SwitchNetworkResult as SwitchNetworkResult,
15717
15723
  checkout_sdk_d_TokenFilter as TokenFilter,
15718
15724
  checkout_sdk_d_TokenFilterTypes as TokenFilterTypes,
15719
15725
  checkout_sdk_d_TokenInfo as TokenInfo,
15720
15726
  checkout_sdk_d_TransactionOrGasType as TransactionOrGasType,
15727
+ checkout_sdk_d_TransactionRequirement as TransactionRequirement,
15721
15728
  checkout_sdk_d_WalletFilter as WalletFilter,
15722
15729
  checkout_sdk_d_WalletFilterTypes as WalletFilterTypes,
15723
15730
  checkout_sdk_d_WalletInfo as WalletInfo,
package/dist/index.js CHANGED
@@ -2987,7 +2987,7 @@ class MultiRollupApiClients {
2987
2987
  }
2988
2988
 
2989
2989
  // eslint-disable-next-line @typescript-eslint/naming-convention
2990
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.0-alpha' };
2990
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.2' };
2991
2991
  const createConfig = ({ basePath, headers, }) => {
2992
2992
  if (!basePath.trim()) {
2993
2993
  throw Error('basePath can not be empty');
@@ -3047,7 +3047,7 @@ class APIError extends Error {
3047
3047
 
3048
3048
  /* eslint-disable implicit-arrow-linebreak */
3049
3049
  const defaultHeaders = {
3050
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.0-alpha',
3050
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.2',
3051
3051
  };
3052
3052
  /**
3053
3053
  * createAPIConfiguration to create a custom Configuration
@@ -3333,7 +3333,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3333
3333
  chainID,
3334
3334
  coreContractAddress,
3335
3335
  registrationContractAddress,
3336
- sdkVersion: 'ts-immutable-sdk-0.23.0-alpha',
3336
+ sdkVersion: 'ts-immutable-sdk-0.23.2',
3337
3337
  });
3338
3338
  /**
3339
3339
  * Sets `sdkVersion` at the time of build
@@ -8195,14 +8195,25 @@ class AuthManager {
8195
8195
  this.deviceCredentialsManager.clearCredentials();
8196
8196
  }, PassportErrorType.LOGOUT_ERROR);
8197
8197
  }
8198
- async loginSilent() {
8199
- return withPassportError(async () => this.getUser(), PassportErrorType.SILENT_LOGIN_ERROR);
8198
+ async loginSilent({ forceRefresh } = { forceRefresh: false }) {
8199
+ // eslint-disable-next-line arrow-body-style
8200
+ return withPassportError(async () => {
8201
+ return this.getUser({ forceRefresh });
8202
+ }, PassportErrorType.SILENT_LOGIN_ERROR);
8200
8203
  }
8201
- async getWebUser() {
8204
+ /**
8205
+ * Get the user from the cache or refresh the token if it's expired.
8206
+ * @param forceRefresh If set to true, force an HTTP call to the OIDC server's authorization endpoint. This call will
8207
+ * throw an error if there's no refresh token.
8208
+ */
8209
+ async getWebUser({ forceRefresh = false }) {
8210
+ if (forceRefresh) {
8211
+ const newOidcUser = await this.userManager.signinSilent();
8212
+ return newOidcUser ? AuthManager.mapOidcUserToDomainModel(newOidcUser) : null;
8213
+ }
8202
8214
  const oidcUser = await this.userManager.getUser();
8203
- if (!oidcUser) {
8215
+ if (!oidcUser)
8204
8216
  return null;
8205
- }
8206
8217
  const tokenExpired = isTokenExpired(oidcUser);
8207
8218
  if (!tokenExpired) {
8208
8219
  return AuthManager.mapOidcUserToDomainModel(oidcUser);
@@ -8215,9 +8226,9 @@ class AuthManager {
8215
8226
  }
8216
8227
  return null;
8217
8228
  }
8218
- async getUser() {
8229
+ async getUser({ forceRefresh } = { forceRefresh: false }) {
8219
8230
  return withPassportError(async () => {
8220
- const user = await this.getWebUser();
8231
+ const user = await this.getWebUser({ forceRefresh });
8221
8232
  if (user) {
8222
8233
  return user;
8223
8234
  }
@@ -8995,7 +9006,7 @@ class PassportImxProviderFactory {
8995
9006
  }, jwt);
8996
9007
  // User metadata is updated asynchronously. Poll userinfo endpoint until it is updated.
8997
9008
  const updatedUser = await retryWithDelay(async () => {
8998
- const user = await this.authManager.loginSilent();
9009
+ const user = await this.authManager.loginSilent({ forceRefresh: true }); // force refresh to get updated user info
8999
9010
  const metadataExists = !!user?.imx;
9000
9011
  if (metadataExists) {
9001
9012
  return user;
@@ -9495,7 +9506,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
9495
9506
  user = await authManager.refreshToken(credentials.refresh_token);
9496
9507
  }
9497
9508
  else {
9498
- user = await authManager.loginSilent();
9509
+ user = await authManager.loginSilent({ forceRefresh: true });
9499
9510
  }
9500
9511
  if (!user?.zkEvm) {
9501
9512
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
@@ -32073,10 +32084,12 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
32073
32084
  get CheckoutErrorType () { return $a8bc256d81a5e2c1$export$e3dc0620abde7f5a; },
32074
32085
  get CheckoutStatus () { return $4b58188d47aafe8d$export$de7bcda3c490bf18; },
32075
32086
  get ExchangeType () { return $e055e79256bbc1dd$export$80f4da0d409a629d; },
32087
+ get FundingStepType () { return $4b58188d47aafe8d$export$6fbaa98ee06d03e8; },
32076
32088
  get GasEstimateType () { return $de275b98d2b651c3$export$788b1fd17f3dad84; },
32077
32089
  get GasTokenType () { return $4b58188d47aafe8d$export$537fa3efd10ed435; },
32078
32090
  get ItemType () { return $4b58188d47aafe8d$export$1fc8f52ad1810e52; },
32079
32091
  get NetworkFilterTypes () { return $a47e48dd2c04791b$export$1f05a55fe0680cc7; },
32092
+ get RoutingOutcomeType () { return $4b58188d47aafe8d$export$d0616bd3e995b8be; },
32080
32093
  get TokenFilterTypes () { return $08d5ddc39acd6833$export$fd9b17d87f4121d2; },
32081
32094
  get TransactionOrGasType () { return $4b58188d47aafe8d$export$65c64e46348ee3c1; },
32082
32095
  get WalletFilterTypes () { return $4f91c5f280efe242$export$a75605c67ea83a5a; },
@@ -32107,7 +32120,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
32107
32120
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
32108
32121
 
32109
32122
 
32110
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.0-alpha";
32123
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.2";
32111
32124
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
32112
32125
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
32113
32126
 
package/dist/passport.js CHANGED
@@ -1785,7 +1785,7 @@ class MultiRollupApiClients {
1785
1785
  }
1786
1786
 
1787
1787
  // eslint-disable-next-line @typescript-eslint/naming-convention
1788
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.23.0-alpha' };
1788
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.23.2' };
1789
1789
  const createConfig = ({ basePath, headers, }) => {
1790
1790
  if (!basePath.trim()) {
1791
1791
  throw Error('basePath can not be empty');
@@ -1841,7 +1841,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
1841
1841
  chainID,
1842
1842
  coreContractAddress,
1843
1843
  registrationContractAddress,
1844
- sdkVersion: 'ts-immutable-sdk-0.23.0-alpha',
1844
+ sdkVersion: 'ts-immutable-sdk-0.23.2',
1845
1845
  });
1846
1846
  /**
1847
1847
  * Sets `sdkVersion` at the time of build
@@ -6686,14 +6686,25 @@ class AuthManager {
6686
6686
  this.deviceCredentialsManager.clearCredentials();
6687
6687
  }, PassportErrorType.LOGOUT_ERROR);
6688
6688
  }
6689
- async loginSilent() {
6690
- return withPassportError(async () => this.getUser(), PassportErrorType.SILENT_LOGIN_ERROR);
6689
+ async loginSilent({ forceRefresh } = { forceRefresh: false }) {
6690
+ // eslint-disable-next-line arrow-body-style
6691
+ return withPassportError(async () => {
6692
+ return this.getUser({ forceRefresh });
6693
+ }, PassportErrorType.SILENT_LOGIN_ERROR);
6691
6694
  }
6692
- async getWebUser() {
6695
+ /**
6696
+ * Get the user from the cache or refresh the token if it's expired.
6697
+ * @param forceRefresh If set to true, force an HTTP call to the OIDC server's authorization endpoint. This call will
6698
+ * throw an error if there's no refresh token.
6699
+ */
6700
+ async getWebUser({ forceRefresh = false }) {
6701
+ if (forceRefresh) {
6702
+ const newOidcUser = await this.userManager.signinSilent();
6703
+ return newOidcUser ? AuthManager.mapOidcUserToDomainModel(newOidcUser) : null;
6704
+ }
6693
6705
  const oidcUser = await this.userManager.getUser();
6694
- if (!oidcUser) {
6706
+ if (!oidcUser)
6695
6707
  return null;
6696
- }
6697
6708
  const tokenExpired = isTokenExpired(oidcUser);
6698
6709
  if (!tokenExpired) {
6699
6710
  return AuthManager.mapOidcUserToDomainModel(oidcUser);
@@ -6706,9 +6717,9 @@ class AuthManager {
6706
6717
  }
6707
6718
  return null;
6708
6719
  }
6709
- async getUser() {
6720
+ async getUser({ forceRefresh } = { forceRefresh: false }) {
6710
6721
  return withPassportError(async () => {
6711
- const user = await this.getWebUser();
6722
+ const user = await this.getWebUser({ forceRefresh });
6712
6723
  if (user) {
6713
6724
  return user;
6714
6725
  }
@@ -7486,7 +7497,7 @@ class PassportImxProviderFactory {
7486
7497
  }, jwt);
7487
7498
  // User metadata is updated asynchronously. Poll userinfo endpoint until it is updated.
7488
7499
  const updatedUser = await retryWithDelay(async () => {
7489
- const user = await this.authManager.loginSilent();
7500
+ const user = await this.authManager.loginSilent({ forceRefresh: true }); // force refresh to get updated user info
7490
7501
  const metadataExists = !!user?.imx;
7491
7502
  if (metadataExists) {
7492
7503
  return user;
@@ -7986,7 +7997,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
7986
7997
  user = await authManager.refreshToken(credentials.refresh_token);
7987
7998
  }
7988
7999
  else {
7989
- user = await authManager.loginSilent();
8000
+ user = await authManager.loginSilent({ forceRefresh: true });
7990
8001
  }
7991
8002
  if (!user?.zkEvm) {
7992
8003
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.23.0-alpha",
4
+ "version": "0.23.2",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",