@imtbl/sdk 0.1.10-alpha.4 → 0.2.0-alpha

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.
@@ -10387,9 +10387,8 @@ class ExchangeError extends Error {
10387
10387
  }
10388
10388
  }
10389
10389
  class InvalidConfigurationError extends ExchangeError {
10390
- constructor() {
10391
- const message = 'Invalid configuration';
10392
- super(message, ExchangeErrorCode.INVALID_CONFIGURATION);
10390
+ constructor(message) {
10391
+ super(message || 'Invalid configuration', ExchangeErrorCode.INVALID_CONFIGURATION);
10393
10392
  }
10394
10393
  }
10395
10394
  class ChainNotSupportedError extends ExchangeError {
@@ -12490,20 +12489,84 @@ function getSwap(nativeToken, routeAndQuote, fromAddress, slippage, deadline, pe
12490
12489
  };
12491
12490
  }
12492
12491
 
12492
+ const CONTRACTS_FOR_CHAIN_ID = {
12493
+ [IMMUTABLE_TESTNET_CHAIN_ID]: {
12494
+ multicall: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
12495
+ coreFactory: '0x12739A8f1A8035F439092D016DAE19A2874F30d2',
12496
+ quoterV2: '0xF674847fBcca5C80315e3AE37043Dce99F6CC529',
12497
+ peripheryRouter: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
12498
+ },
12499
+ };
12500
+ const SUPPORTED_SANDBOX_CHAINS = {
12501
+ [IMMUTABLE_TESTNET_CHAIN_ID]: {
12502
+ chainId: IMMUTABLE_TESTNET_CHAIN_ID,
12503
+ rpcUrl: IMMUTABLE_TESTNET_RPC_URL,
12504
+ contracts: CONTRACTS_FOR_CHAIN_ID[IMMUTABLE_TESTNET_CHAIN_ID],
12505
+ commonRoutingTokens: IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS,
12506
+ nativeToken: TIMX_IMMUTABLE_TESTNET,
12507
+ },
12508
+ };
12509
+ const SUPPORTED_PRODUCTION_CHAINS = {};
12510
+ const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
12511
+ [Environment$1.SANDBOX]: SUPPORTED_SANDBOX_CHAINS,
12512
+ [Environment$1.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
12513
+ };
12514
+ function validateOverrides(overrides) {
12515
+ Object.entries(overrides).forEach(([key, value]) => {
12516
+ if (!value) {
12517
+ throw new InvalidConfigurationError(`Missing override: ${key}`);
12518
+ }
12519
+ });
12520
+ Object.entries(overrides.exchangeContracts).forEach(([key, contract]) => {
12521
+ if (!isValidNonZeroAddress(contract)) {
12522
+ throw new InvalidConfigurationError(`Invalid exchange contract address for ${key}`);
12523
+ }
12524
+ });
12525
+ }
12526
+ /**
12527
+ * {@link ExchangeConfiguration} is used to configure the {@link Exchange} class.
12528
+ * @param chainId the ID of the chain to configure. {@link SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT} contains the supported chains for each environment.
12529
+ * @param baseConfig the base {@link ImmutableConfiguration} for the {@link Exchange} class
12530
+ */
12531
+ class ExchangeConfiguration {
12532
+ baseConfig;
12533
+ chain;
12534
+ constructor({ chainId, baseConfig, overrides }) {
12535
+ this.baseConfig = baseConfig;
12536
+ if (overrides) {
12537
+ validateOverrides(overrides);
12538
+ this.chain = {
12539
+ chainId,
12540
+ rpcUrl: overrides.rpcURL,
12541
+ contracts: overrides.exchangeContracts,
12542
+ commonRoutingTokens: overrides.commonRoutingTokens,
12543
+ nativeToken: overrides.nativeToken,
12544
+ };
12545
+ return;
12546
+ }
12547
+ const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId];
12548
+ if (!chain) {
12549
+ throw new ChainNotSupportedError(chainId, baseConfig.environment);
12550
+ }
12551
+ this.chain = chain;
12552
+ }
12553
+ }
12554
+
12493
12555
  class Exchange {
12494
12556
  provider;
12495
12557
  router;
12496
12558
  chainId;
12497
12559
  nativeToken;
12498
12560
  constructor(configuration) {
12499
- this.chainId = configuration.chain.chainId;
12500
- this.nativeToken = configuration.chain.nativeToken;
12501
- this.provider = new ethers.providers.JsonRpcProvider(configuration.chain.rpcUrl);
12502
- this.router = new Router(this.provider, configuration.chain.commonRoutingTokens, {
12503
- multicallAddress: configuration.chain.contracts.multicall,
12504
- factoryAddress: configuration.chain.contracts.coreFactory,
12505
- quoterAddress: configuration.chain.contracts.quoterV2,
12506
- peripheryRouterAddress: configuration.chain.contracts.peripheryRouter,
12561
+ const config = new ExchangeConfiguration(configuration);
12562
+ this.chainId = config.chain.chainId;
12563
+ this.nativeToken = config.chain.nativeToken;
12564
+ this.provider = new ethers.providers.JsonRpcProvider(config.chain.rpcUrl);
12565
+ this.router = new Router(this.provider, config.chain.commonRoutingTokens, {
12566
+ multicallAddress: config.chain.contracts.multicall,
12567
+ factoryAddress: config.chain.contracts.coreFactory,
12568
+ quoterAddress: config.chain.contracts.quoterV2,
12569
+ peripheryRouterAddress: config.chain.contracts.peripheryRouter,
12507
12570
  });
12508
12571
  }
12509
12572
  static validate(tokenInAddress, tokenOutAddress, maxHops, slippagePercent, fromAddress) {
@@ -12583,67 +12646,6 @@ class Exchange {
12583
12646
  }
12584
12647
  }
12585
12648
 
12586
- const CONTRACTS_FOR_CHAIN_ID = {
12587
- [IMMUTABLE_TESTNET_CHAIN_ID]: {
12588
- multicall: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
12589
- coreFactory: '0x12739A8f1A8035F439092D016DAE19A2874F30d2',
12590
- quoterV2: '0xF674847fBcca5C80315e3AE37043Dce99F6CC529',
12591
- peripheryRouter: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
12592
- },
12593
- };
12594
- const SUPPORTED_SANDBOX_CHAINS = {
12595
- [IMMUTABLE_TESTNET_CHAIN_ID]: {
12596
- chainId: IMMUTABLE_TESTNET_CHAIN_ID,
12597
- rpcUrl: IMMUTABLE_TESTNET_RPC_URL,
12598
- contracts: CONTRACTS_FOR_CHAIN_ID[IMMUTABLE_TESTNET_CHAIN_ID],
12599
- commonRoutingTokens: IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS,
12600
- nativeToken: TIMX_IMMUTABLE_TESTNET,
12601
- },
12602
- };
12603
- const SUPPORTED_PRODUCTION_CHAINS = {};
12604
- const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
12605
- [Environment$1.SANDBOX]: SUPPORTED_SANDBOX_CHAINS,
12606
- [Environment$1.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
12607
- };
12608
- function validateOverrides(overrides) {
12609
- if (!overrides.rpcURL || !overrides.exchangeContracts || !overrides.commonRoutingTokens || !overrides.nativeToken) {
12610
- throw new InvalidConfigurationError();
12611
- }
12612
- Object.values(overrides.exchangeContracts).forEach((contract) => {
12613
- if (!isValidNonZeroAddress(contract)) {
12614
- throw new InvalidConfigurationError();
12615
- }
12616
- });
12617
- }
12618
- /**
12619
- * {@link ExchangeConfiguration} is used to configure the {@link Exchange} class.
12620
- * @param chainId the ID of the chain to configure. {@link SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT} contains the supported chains for each environment.
12621
- * @param baseConfig the base {@link ImmutableConfiguration} for the {@link Exchange} class
12622
- */
12623
- class ExchangeConfiguration {
12624
- baseConfig;
12625
- chain;
12626
- constructor({ chainId, baseConfig, overrides }) {
12627
- this.baseConfig = baseConfig;
12628
- if (overrides) {
12629
- validateOverrides(overrides);
12630
- this.chain = {
12631
- chainId,
12632
- rpcUrl: overrides.rpcURL,
12633
- contracts: overrides.exchangeContracts,
12634
- commonRoutingTokens: overrides.commonRoutingTokens,
12635
- nativeToken: overrides.nativeToken,
12636
- };
12637
- return;
12638
- }
12639
- const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId];
12640
- if (!chain) {
12641
- throw new ChainNotSupportedError(chainId, baseConfig.environment);
12642
- }
12643
- this.chain = chain;
12644
- }
12645
- }
12646
-
12647
12649
  /* eslint-disable class-methods-use-this */
12648
12650
 
12649
12651
  const $762782b6c862d954$export$db5daa1b5156ccfe = [
@@ -13396,13 +13398,13 @@ async function $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId,
13396
13398
  }
13397
13399
  async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
13398
13400
  const dexConfig = await config.remote.getConfig("dex");
13399
- return new (Exchange)(new (ExchangeConfiguration)({
13401
+ return new (Exchange)({
13400
13402
  chainId: chainId,
13401
13403
  baseConfig: new (ImmutableConfiguration)({
13402
13404
  environment: config.environment
13403
13405
  }),
13404
13406
  overrides: dexConfig?.overrides
13405
- }));
13407
+ });
13406
13408
  }
13407
13409
 
13408
13410
 
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
4
4
  function $parcel$export(e, n, v, s) {
5
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
6
  }
7
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.1.10-alpha.4";
7
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.0-alpha";
8
8
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
9
9
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
10
10
 
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
16
16
  chainID,
17
17
  coreContractAddress,
18
18
  registrationContractAddress,
19
- sdkVersion: 'ts-immutable-sdk-0.1.10-alpha.4',
19
+ sdkVersion: 'ts-immutable-sdk-0.2.0-alpha',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build
package/dist/index.cjs CHANGED
@@ -10,7 +10,6 @@ var encUtils = require('enc-utils');
10
10
  var providers = require('@ethersproject/providers');
11
11
  var FormData$2 = require('form-data');
12
12
  var ethers = require('ethers');
13
- var dotenv = require('dotenv');
14
13
  var seaportJs = require('@opensea/seaport-js');
15
14
  var units = require('@ethersproject/units');
16
15
  var bignumber = require('@ethersproject/bignumber');
@@ -5457,7 +5456,7 @@ class APIError extends Error {
5457
5456
 
5458
5457
  /* eslint-disable implicit-arrow-linebreak */
5459
5458
  const defaultHeaders = {
5460
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.1.10-alpha.4',
5459
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.0-alpha',
5461
5460
  };
5462
5461
  /**
5463
5462
  * createAPIConfiguration to create a custom Configuration
@@ -5723,7 +5722,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
5723
5722
  chainID,
5724
5723
  coreContractAddress,
5725
5724
  registrationContractAddress,
5726
- sdkVersion: 'ts-immutable-sdk-0.1.10-alpha.4',
5725
+ sdkVersion: 'ts-immutable-sdk-0.2.0-alpha',
5727
5726
  });
5728
5727
  /**
5729
5728
  * Sets `sdkVersion` at the time of build
@@ -11846,49 +11845,11 @@ class ImmutableApiClientFactory {
11846
11845
  }
11847
11846
  }
11848
11847
 
11849
- // eslint-disable-next-line
11850
- dotenv.config();
11851
- function getConfigFromEnv() {
11852
- if (!process.env.ORDERBOOK_MR_API_URL
11853
- || !process.env.SEAPORT_CONTRACT_ADDRESS
11854
- || !process.env.ZONE_CONTRACT_ADDRESS) {
11855
- throw new Error('missing config');
11856
- }
11857
- return {
11858
- apiUrl: process.env.ORDERBOOK_MR_API_URL,
11859
- seaportContractAddress: process.env.SEAPORT_CONTRACT_ADDRESS,
11860
- zoneContractAddress: process.env.ZONE_CONTRACT_ADDRESS,
11861
- };
11862
- }
11863
-
11864
- dotenv.config();
11865
- function getLocalhostProvider() {
11866
- const endpoint = process.env.LOCAL_RPC_ENDPOINT;
11867
- if (!endpoint) {
11868
- throw new Error('LOCAL_RPC_ENDPOINT not set');
11869
- }
11870
- return new ethers.providers.JsonRpcProvider(endpoint);
11871
- }
11872
-
11873
- dotenv.config();
11874
-
11875
- const LOCAL_CHAIN_NAME = 'imtbl-zkevm-local';
11876
11848
  const DEVNET_CHAIN_NAME = 'imtbl-zkevm-devnet';
11877
11849
  const TESTNET_CHAIN_NAME = 'imtbl-zkevm-testnet';
11878
11850
  const MAINNET_CHAIN_NAME = 'imtbl-zkevm-mainnet';
11879
- function localChainConfig() {
11880
- const localConfig = getConfigFromEnv();
11881
- return {
11882
- seaportContractAddress: localConfig.seaportContractAddress,
11883
- zoneContractAddress: localConfig.zoneContractAddress,
11884
- apiEndpoint: localConfig.apiUrl,
11885
- provider: getLocalhostProvider(),
11886
- };
11887
- }
11888
11851
  function getOrderbookConfig(chainName) {
11889
11852
  switch (chainName) {
11890
- case LOCAL_CHAIN_NAME:
11891
- return localChainConfig();
11892
11853
  case DEVNET_CHAIN_NAME:
11893
11854
  return {
11894
11855
  seaportContractAddress: '0x41388404Efb7a68Fd31d75CEf71dF91e2BDBa2fb',
@@ -12864,13 +12825,17 @@ class SeaportLibFactory {
12864
12825
  * @param {OrderbookModuleConfiguration} config - Configuration for Immutable services.
12865
12826
  */
12866
12827
  class Orderbook {
12867
- config;
12868
12828
  apiClient;
12869
12829
  seaport;
12870
- constructor(config) {
12871
- this.config = config;
12872
- const orderbookConfig = getOrderbookConfig(config.overrides?.chainName);
12873
- const apiEndpoint = orderbookConfig?.apiEndpoint;
12830
+ orderbookConfig;
12831
+ constructor(config, localConfig) {
12832
+ // either use preconfigured config or local config passed in
12833
+ const maybeConfig = getOrderbookConfig(config.overrides?.chainName) || localConfig;
12834
+ if (!maybeConfig) {
12835
+ throw new Error('Orderbook configuration not passed, either select one of the preseet chainNames or pass in localConfig');
12836
+ }
12837
+ this.orderbookConfig = maybeConfig;
12838
+ const { apiEndpoint } = this.orderbookConfig;
12874
12839
  if (!apiEndpoint) {
12875
12840
  throw new Error('API endpoint must be provided as an override');
12876
12841
  }
@@ -12879,9 +12844,9 @@ class Orderbook {
12879
12844
  if (!chainName) {
12880
12845
  throw new Error('chainName must be provided as an override');
12881
12846
  }
12882
- this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, orderbookConfig.seaportContractAddress).create();
12883
- const seaportLibFactory = new SeaportLibFactory(orderbookConfig.seaportContractAddress, orderbookConfig.provider);
12884
- this.seaport = new Seaport(seaportLibFactory, orderbookConfig.provider, orderbookConfig.seaportContractAddress, orderbookConfig.zoneContractAddress);
12847
+ this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, this.orderbookConfig.seaportContractAddress).create();
12848
+ const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
12849
+ this.seaport = new Seaport(seaportLibFactory, this.orderbookConfig.provider, this.orderbookConfig.seaportContractAddress, this.orderbookConfig.zoneContractAddress);
12885
12850
  }
12886
12851
  /**
12887
12852
  * Get an order by ID
@@ -12909,8 +12874,7 @@ class Orderbook {
12909
12874
  * the order components that can be submitted to `createListing` with a signature.
12910
12875
  */
12911
12876
  async prepareListing({ makerAddress, sell, buy, orderExpiry, }) {
12912
- const orderbookConfig = getOrderbookConfig(this.config.overrides?.chainName);
12913
- const erc721 = new ERC721Factory(sell.contractAddress, orderbookConfig.provider).create();
12877
+ const erc721 = new ERC721Factory(sell.contractAddress, this.orderbookConfig.provider).create();
12914
12878
  const royaltyInfo = await erc721.royaltyInfo(sell.tokenId, buy.amount);
12915
12879
  return this.seaport.prepareSeaportOrder(makerAddress, sell, buy, royaltyInfo,
12916
12880
  // Default order start to now
@@ -24384,9 +24348,8 @@ class ExchangeError extends Error {
24384
24348
  }
24385
24349
  }
24386
24350
  class InvalidConfigurationError extends ExchangeError {
24387
- constructor() {
24388
- const message = 'Invalid configuration';
24389
- super(message, ExchangeErrorCode.INVALID_CONFIGURATION);
24351
+ constructor(message) {
24352
+ super(message || 'Invalid configuration', ExchangeErrorCode.INVALID_CONFIGURATION);
24390
24353
  }
24391
24354
  }
24392
24355
  class ChainNotSupportedError extends ExchangeError {
@@ -26487,20 +26450,84 @@ function getSwap(nativeToken, routeAndQuote, fromAddress, slippage, deadline, pe
26487
26450
  };
26488
26451
  }
26489
26452
 
26453
+ const CONTRACTS_FOR_CHAIN_ID = {
26454
+ [IMMUTABLE_TESTNET_CHAIN_ID]: {
26455
+ multicall: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
26456
+ coreFactory: '0x12739A8f1A8035F439092D016DAE19A2874F30d2',
26457
+ quoterV2: '0xF674847fBcca5C80315e3AE37043Dce99F6CC529',
26458
+ peripheryRouter: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
26459
+ },
26460
+ };
26461
+ const SUPPORTED_SANDBOX_CHAINS = {
26462
+ [IMMUTABLE_TESTNET_CHAIN_ID]: {
26463
+ chainId: IMMUTABLE_TESTNET_CHAIN_ID,
26464
+ rpcUrl: IMMUTABLE_TESTNET_RPC_URL,
26465
+ contracts: CONTRACTS_FOR_CHAIN_ID[IMMUTABLE_TESTNET_CHAIN_ID],
26466
+ commonRoutingTokens: IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS,
26467
+ nativeToken: TIMX_IMMUTABLE_TESTNET,
26468
+ },
26469
+ };
26470
+ const SUPPORTED_PRODUCTION_CHAINS = {};
26471
+ const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
26472
+ [exports.Environment.SANDBOX]: SUPPORTED_SANDBOX_CHAINS,
26473
+ [exports.Environment.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
26474
+ };
26475
+ function validateOverrides(overrides) {
26476
+ Object.entries(overrides).forEach(([key, value]) => {
26477
+ if (!value) {
26478
+ throw new InvalidConfigurationError(`Missing override: ${key}`);
26479
+ }
26480
+ });
26481
+ Object.entries(overrides.exchangeContracts).forEach(([key, contract]) => {
26482
+ if (!isValidNonZeroAddress(contract)) {
26483
+ throw new InvalidConfigurationError(`Invalid exchange contract address for ${key}`);
26484
+ }
26485
+ });
26486
+ }
26487
+ /**
26488
+ * {@link ExchangeConfiguration} is used to configure the {@link Exchange} class.
26489
+ * @param chainId the ID of the chain to configure. {@link SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT} contains the supported chains for each environment.
26490
+ * @param baseConfig the base {@link ImmutableConfiguration} for the {@link Exchange} class
26491
+ */
26492
+ class ExchangeConfiguration {
26493
+ baseConfig;
26494
+ chain;
26495
+ constructor({ chainId, baseConfig, overrides }) {
26496
+ this.baseConfig = baseConfig;
26497
+ if (overrides) {
26498
+ validateOverrides(overrides);
26499
+ this.chain = {
26500
+ chainId,
26501
+ rpcUrl: overrides.rpcURL,
26502
+ contracts: overrides.exchangeContracts,
26503
+ commonRoutingTokens: overrides.commonRoutingTokens,
26504
+ nativeToken: overrides.nativeToken,
26505
+ };
26506
+ return;
26507
+ }
26508
+ const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId];
26509
+ if (!chain) {
26510
+ throw new ChainNotSupportedError(chainId, baseConfig.environment);
26511
+ }
26512
+ this.chain = chain;
26513
+ }
26514
+ }
26515
+
26490
26516
  class Exchange {
26491
26517
  provider;
26492
26518
  router;
26493
26519
  chainId;
26494
26520
  nativeToken;
26495
26521
  constructor(configuration) {
26496
- this.chainId = configuration.chain.chainId;
26497
- this.nativeToken = configuration.chain.nativeToken;
26498
- this.provider = new ethers.ethers.providers.JsonRpcProvider(configuration.chain.rpcUrl);
26499
- this.router = new Router(this.provider, configuration.chain.commonRoutingTokens, {
26500
- multicallAddress: configuration.chain.contracts.multicall,
26501
- factoryAddress: configuration.chain.contracts.coreFactory,
26502
- quoterAddress: configuration.chain.contracts.quoterV2,
26503
- peripheryRouterAddress: configuration.chain.contracts.peripheryRouter,
26522
+ const config = new ExchangeConfiguration(configuration);
26523
+ this.chainId = config.chain.chainId;
26524
+ this.nativeToken = config.chain.nativeToken;
26525
+ this.provider = new ethers.ethers.providers.JsonRpcProvider(config.chain.rpcUrl);
26526
+ this.router = new Router(this.provider, config.chain.commonRoutingTokens, {
26527
+ multicallAddress: config.chain.contracts.multicall,
26528
+ factoryAddress: config.chain.contracts.coreFactory,
26529
+ quoterAddress: config.chain.contracts.quoterV2,
26530
+ peripheryRouterAddress: config.chain.contracts.peripheryRouter,
26504
26531
  });
26505
26532
  }
26506
26533
  static validate(tokenInAddress, tokenOutAddress, maxHops, slippagePercent, fromAddress) {
@@ -26580,67 +26607,6 @@ class Exchange {
26580
26607
  }
26581
26608
  }
26582
26609
 
26583
- const CONTRACTS_FOR_CHAIN_ID = {
26584
- [IMMUTABLE_TESTNET_CHAIN_ID]: {
26585
- multicall: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
26586
- coreFactory: '0x12739A8f1A8035F439092D016DAE19A2874F30d2',
26587
- quoterV2: '0xF674847fBcca5C80315e3AE37043Dce99F6CC529',
26588
- peripheryRouter: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
26589
- },
26590
- };
26591
- const SUPPORTED_SANDBOX_CHAINS = {
26592
- [IMMUTABLE_TESTNET_CHAIN_ID]: {
26593
- chainId: IMMUTABLE_TESTNET_CHAIN_ID,
26594
- rpcUrl: IMMUTABLE_TESTNET_RPC_URL,
26595
- contracts: CONTRACTS_FOR_CHAIN_ID[IMMUTABLE_TESTNET_CHAIN_ID],
26596
- commonRoutingTokens: IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS,
26597
- nativeToken: TIMX_IMMUTABLE_TESTNET,
26598
- },
26599
- };
26600
- const SUPPORTED_PRODUCTION_CHAINS = {};
26601
- const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
26602
- [exports.Environment.SANDBOX]: SUPPORTED_SANDBOX_CHAINS,
26603
- [exports.Environment.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
26604
- };
26605
- function validateOverrides(overrides) {
26606
- if (!overrides.rpcURL || !overrides.exchangeContracts || !overrides.commonRoutingTokens || !overrides.nativeToken) {
26607
- throw new InvalidConfigurationError();
26608
- }
26609
- Object.values(overrides.exchangeContracts).forEach((contract) => {
26610
- if (!isValidNonZeroAddress(contract)) {
26611
- throw new InvalidConfigurationError();
26612
- }
26613
- });
26614
- }
26615
- /**
26616
- * {@link ExchangeConfiguration} is used to configure the {@link Exchange} class.
26617
- * @param chainId the ID of the chain to configure. {@link SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT} contains the supported chains for each environment.
26618
- * @param baseConfig the base {@link ImmutableConfiguration} for the {@link Exchange} class
26619
- */
26620
- class ExchangeConfiguration {
26621
- baseConfig;
26622
- chain;
26623
- constructor({ chainId, baseConfig, overrides }) {
26624
- this.baseConfig = baseConfig;
26625
- if (overrides) {
26626
- validateOverrides(overrides);
26627
- this.chain = {
26628
- chainId,
26629
- rpcUrl: overrides.rpcURL,
26630
- contracts: overrides.exchangeContracts,
26631
- commonRoutingTokens: overrides.commonRoutingTokens,
26632
- nativeToken: overrides.nativeToken,
26633
- };
26634
- return;
26635
- }
26636
- const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId];
26637
- if (!chain) {
26638
- throw new ChainNotSupportedError(chainId, baseConfig.environment);
26639
- }
26640
- this.chain = chain;
26641
- }
26642
- }
26643
-
26644
26610
  /* eslint-disable class-methods-use-this */
26645
26611
 
26646
26612
  const $762782b6c862d954$export$db5daa1b5156ccfe = [
@@ -27393,13 +27359,13 @@ async function $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId,
27393
27359
  }
27394
27360
  async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
27395
27361
  const dexConfig = await config.remote.getConfig("dex");
27396
- return new (Exchange)(new (ExchangeConfiguration)({
27362
+ return new (Exchange)({
27397
27363
  chainId: chainId,
27398
27364
  baseConfig: new (ImmutableConfiguration)({
27399
27365
  environment: config.environment
27400
27366
  }),
27401
27367
  overrides: dexConfig?.overrides
27402
- }));
27368
+ });
27403
27369
  }
27404
27370
 
27405
27371
 
@@ -27763,7 +27729,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
27763
27729
  function $parcel$export(e, n, v, s) {
27764
27730
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27765
27731
  }
27766
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.1.10-alpha.4";
27732
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.0-alpha";
27767
27733
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
27768
27734
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
27769
27735
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference path="global.d.ts" />
2
2
  /// <reference types="node" />
3
3
  import { BlockchainDataConfiguration, BlockchainDataModuleConfiguration as BlockchainDataModuleConfiguration$1, ProviderConfiguration as ProviderConfiguration$1, ExchangeContracts } from 'config';
4
- import { OrderbookOverrides } from 'config/config';
4
+ import { OrderbookOverrides, OrderbookModuleConfiguration } from 'config/config';
5
5
  import { ListingResult, ListListingsResult } from 'openapi/sdk';
6
6
  import { ListListingsParams, PrepareListingParams, PrepareListingResponse, CreateListingParams, FulfillOrderResponse, CancelOrderResponse as CancelOrderResponse$1 } from 'types';
7
7
 
@@ -12782,10 +12782,10 @@ declare class Passport {
12782
12782
  * @param {OrderbookModuleConfiguration} config - Configuration for Immutable services.
12783
12783
  */
12784
12784
  declare class Orderbook {
12785
- private config;
12786
12785
  private apiClient;
12787
12786
  private seaport;
12788
- constructor(config: ModuleConfiguration<OrderbookOverrides>);
12787
+ private orderbookConfig;
12788
+ constructor(config: ModuleConfiguration<OrderbookOverrides>, localConfig?: OrderbookModuleConfiguration);
12789
12789
  /**
12790
12790
  * Get an order by ID
12791
12791
  * @param {string} listingId - The listingId to find.