@imtbl/sdk 0.39.5 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/checkout.js CHANGED
@@ -19737,6 +19737,9 @@ class Fees {
19737
19737
  const IMMUTABLE_TESTNET_RPC_URL = 'https://rpc.testnet.immutable.com';
19738
19738
  const IMMUTABLE_TESTNET_CHAIN_ID = 13473;
19739
19739
 
19740
+ const IMMUTABLE_MAINNET_RPC_URL = 'https://rpc.immutable.com';
19741
+ const IMMUTABLE_MAINNET_CHAIN_ID = 13371;
19742
+
19740
19743
  const NATIVE_IMX_IMMUTABLE_TESTNET = {
19741
19744
  chainId: IMMUTABLE_TESTNET_CHAIN_ID,
19742
19745
  decimals: 18,
@@ -19756,6 +19759,34 @@ const IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS = [
19756
19759
  WIMX_IMMUTABLE_TESTNET,
19757
19760
  ];
19758
19761
 
19762
+ const NATIVE_IMX_IMMUTABLE_MAINNET = {
19763
+ chainId: IMMUTABLE_MAINNET_CHAIN_ID,
19764
+ decimals: 18,
19765
+ symbol: 'IMX',
19766
+ name: 'Immutable Token',
19767
+ type: 'native',
19768
+ };
19769
+ const WIMX_IMMUTABLE_MAINNET = {
19770
+ chainId: IMMUTABLE_MAINNET_CHAIN_ID,
19771
+ address: '0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d',
19772
+ decimals: 18,
19773
+ symbol: 'WIMX',
19774
+ name: 'Wrapped Immutable Token',
19775
+ type: 'erc20',
19776
+ };
19777
+ const ETH_IMMUTABLE_MAINNET = {
19778
+ chainId: IMMUTABLE_MAINNET_CHAIN_ID,
19779
+ address: '0x52a6c53869ce09a731cd772f245b97a4401d3348',
19780
+ decimals: 18,
19781
+ symbol: 'ETH',
19782
+ name: 'Ethereum',
19783
+ type: 'erc20',
19784
+ };
19785
+ const IMMUTABLE_MAINNET_COMMON_ROUTING_TOKENS = [
19786
+ WIMX_IMMUTABLE_MAINNET,
19787
+ ETH_IMMUTABLE_MAINNET,
19788
+ ];
19789
+
19759
19790
  const zeroNativeCurrencyValue = '0x00';
19760
19791
  const multicallWithDeadlineFunctionSignature = 'multicall(uint256,bytes[])';
19761
19792
  function buildSinglePoolSwap(tokenIn, tokenOut, recipient, trade, route, amountIn, amountOut, routerContract, paymentsContract) {
@@ -20049,6 +20080,13 @@ const CONTRACTS_FOR_CHAIN_ID = {
20049
20080
  swapRouter: '0x0b012055F770AE7BB7a8303968A7Fb6088A2296e',
20050
20081
  immutableSwapProxy: '0xDdBDa144cEbe1cCd68E746CDff8a6e4Be51A9e98',
20051
20082
  },
20083
+ [IMMUTABLE_MAINNET_CHAIN_ID]: {
20084
+ multicall: '0xc7efb32470dEE601959B15f1f923e017C6A918cA',
20085
+ coreFactory: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
20086
+ quoter: '0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd',
20087
+ swapRouter: '0xE5a02c2Be08406c3fB36F9Aa29bF7C7A09CAe50B',
20088
+ immutableSwapProxy: '0xD67cc11151dBccCC424A16F8963ece3D0539BD61',
20089
+ },
20052
20090
  };
20053
20091
  const SUPPORTED_SANDBOX_CHAINS = {
20054
20092
  [IMMUTABLE_TESTNET_CHAIN_ID]: {
@@ -20060,7 +20098,16 @@ const SUPPORTED_SANDBOX_CHAINS = {
20060
20098
  wrappedNativeToken: WIMX_IMMUTABLE_TESTNET,
20061
20099
  },
20062
20100
  };
20063
- const SUPPORTED_PRODUCTION_CHAINS = {};
20101
+ const SUPPORTED_PRODUCTION_CHAINS = {
20102
+ [IMMUTABLE_MAINNET_CHAIN_ID]: {
20103
+ chainId: IMMUTABLE_MAINNET_CHAIN_ID,
20104
+ rpcUrl: IMMUTABLE_MAINNET_RPC_URL,
20105
+ contracts: CONTRACTS_FOR_CHAIN_ID[IMMUTABLE_MAINNET_CHAIN_ID],
20106
+ commonRoutingTokens: IMMUTABLE_MAINNET_COMMON_ROUTING_TOKENS,
20107
+ nativeToken: NATIVE_IMX_IMMUTABLE_MAINNET,
20108
+ wrappedNativeToken: WIMX_IMMUTABLE_MAINNET,
20109
+ },
20110
+ };
20064
20111
  const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
20065
20112
  [Environment$1.SANDBOX]: SUPPORTED_SANDBOX_CHAINS,
20066
20113
  [Environment$1.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
@@ -21537,8 +21584,8 @@ function getOrderbookConfig(environment) {
21537
21584
  switch (environment) {
21538
21585
  case Environment$1.SANDBOX:
21539
21586
  return {
21540
- seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
21541
- zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
21587
+ seaportContractAddress: '0x7d117aA8BD6D31c4fa91722f246388f38ab1942c',
21588
+ zoneContractAddress: '0x8831867E347AB87FA30199C5B695F0A31604Bb52',
21542
21589
  apiEndpoint: 'https://api.sandbox.immutable.com',
21543
21590
  chainName: TESTNET_CHAIN_NAME,
21544
21591
  provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
@@ -21546,8 +21593,8 @@ function getOrderbookConfig(environment) {
21546
21593
  // not yet deployed
21547
21594
  case Environment$1.PRODUCTION:
21548
21595
  return {
21549
- seaportContractAddress: '',
21550
- zoneContractAddress: '',
21596
+ seaportContractAddress: '0x6c12aD6F0bD274191075Eb2E78D7dA5ba6453424',
21597
+ zoneContractAddress: '0x00338b92Bec262078B3e49BF12bbEA058916BF91',
21551
21598
  apiEndpoint: 'https://api.immutable.com',
21552
21599
  chainName: MAINNET_CHAIN_NAME,
21553
21600
  provider: new providers.JsonRpcProvider('https://rpc.immutable.com'),
@@ -21692,13 +21739,15 @@ class Orderbook {
21692
21739
  * transaction exists it must be signed and submitted to the chain before the fulfilment
21693
21740
  * transaction can be submitted or it will be reverted.
21694
21741
  * @param {string} listingId - The listingId to fulfil.
21695
- * @param {string} fulfillerAddress - The address of the account fulfilling the order.
21742
+ * @param {string} takerAddress - The address of the account fulfilling the order.
21743
+ * @param {FeeValue[]} takerFees - Taker ecosystem fees to be paid.
21696
21744
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
21697
21745
  */
21698
21746
  async fulfillOrder(listingId, takerAddress, takerFees) {
21699
21747
  const fulfillmentDataRes = await this.apiClient.fulfillmentData([
21700
21748
  {
21701
21749
  order_id: listingId,
21750
+ taker_address: takerAddress,
21702
21751
  fees: takerFees.map((fee) => ({
21703
21752
  amount: fee.amount,
21704
21753
  type: FeeType$1.TAKER_ECOSYSTEM,
@@ -21722,6 +21771,7 @@ class Orderbook {
21722
21771
  async fulfillBulkOrders(listings, takerAddress) {
21723
21772
  const fulfillmentDataRes = await this.apiClient.fulfillmentData(listings.map((listingRequest) => ({
21724
21773
  order_id: listingRequest.listingId,
21774
+ taker_address: takerAddress,
21725
21775
  fees: listingRequest.takerFees.map((fee) => ({
21726
21776
  amount: fee.amount,
21727
21777
  type: FeeType$1.TAKER_ECOSYSTEM,
@@ -25801,7 +25851,7 @@ class APIError extends Error {
25801
25851
 
25802
25852
  /* eslint-disable implicit-arrow-linebreak */
25803
25853
  const defaultHeaders = {
25804
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.5',
25854
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.40.0',
25805
25855
  };
25806
25856
  /**
25807
25857
  * createAPIConfiguration to create a custom Configuration
@@ -26813,6 +26863,7 @@ const ZKEVM_NATIVE_TOKEN = {
26813
26863
  name: 'IMX',
26814
26864
  symbol: 'IMX',
26815
26865
  decimals: DEFAULT_TOKEN_DECIMALS$1,
26866
+ address: NATIVE,
26816
26867
  };
26817
26868
  /**
26818
26869
  * Base URL for the Immutable API based on the environment.
@@ -27150,7 +27201,7 @@ const GAS_OVERRIDES = {
27150
27201
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
27151
27202
  };
27152
27203
 
27153
- const SDK_VERSION_MARKER = '0.39.5';
27204
+ const SDK_VERSION_MARKER = '0.40.0';
27154
27205
  // This SDK version is replaced by the `yarn build` command ran on the root level
27155
27206
  const globalPackageVersion = () => SDK_VERSION_MARKER;
27156
27207
 
@@ -28467,11 +28518,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
28467
28518
  type: ItemType.NATIVE,
28468
28519
  balance: BigNumber$1.from(0),
28469
28520
  formattedBalance: '0',
28470
- token: {
28471
- name,
28472
- symbol,
28473
- decimals: DEFAULT_TOKEN_DECIMALS$1,
28474
- },
28521
+ token: ZKEVM_NATIVE_TOKEN,
28475
28522
  };
28476
28523
  }
28477
28524
  return {
@@ -29740,13 +29787,19 @@ const bridgeAndSwapRoute = async (config, readOnlyProviders, availableRoutingOpt
29740
29787
  };
29741
29788
 
29742
29789
  const onRampRoute = async (config, availableRoutingOptions, balanceRequirement) => {
29743
- if (balanceRequirement.type !== ItemType.ERC20 && balanceRequirement.type !== ItemType.NATIVE)
29790
+ // Only check for ERC20 and NATIVE
29791
+ if (![ItemType.ERC20, ItemType.NATIVE].includes(balanceRequirement.type))
29744
29792
  return undefined;
29745
29793
  const { required, current, delta } = balanceRequirement;
29746
29794
  let hasAllowList = false;
29747
29795
  const onRampAllowList = await allowListCheckForOnRamp(config, availableRoutingOptions);
29748
29796
  onRampAllowList.forEach((token) => {
29749
- if (token.address === required.token?.address) {
29797
+ if (!token.address)
29798
+ return;
29799
+ if (!required.token)
29800
+ return;
29801
+ if (isNativeToken(required.token.address)
29802
+ || token.address.toLowerCase() === required.token.address?.toLowerCase()) {
29750
29803
  hasAllowList = true;
29751
29804
  }
29752
29805
  });
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
17
17
  chainID,
18
18
  coreContractAddress,
19
19
  registrationContractAddress,
20
- sdkVersion: 'ts-immutable-sdk-0.39.5',
20
+ sdkVersion: 'ts-immutable-sdk-0.40.0',
21
21
  });
22
22
  /**
23
23
  * Sets `sdkVersion` at the time of build