@imtbl/sdk 0.2.1-alpha → 0.2.3-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.
@@ -5406,7 +5406,7 @@ class APIError extends Error {
5406
5406
 
5407
5407
  /* eslint-disable implicit-arrow-linebreak */
5408
5408
  const defaultHeaders = {
5409
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.1-alpha',
5409
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.3-alpha',
5410
5410
  };
5411
5411
  /**
5412
5412
  * createAPIConfiguration to create a custom Configuration
@@ -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.2.1-alpha";
7
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.3-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.2.1-alpha',
19
+ sdkVersion: 'ts-immutable-sdk-0.2.3-alpha',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build
package/dist/index.cjs CHANGED
@@ -5457,7 +5457,7 @@ class APIError extends Error {
5457
5457
 
5458
5458
  /* eslint-disable implicit-arrow-linebreak */
5459
5459
  const defaultHeaders = {
5460
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.1-alpha',
5460
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.3-alpha',
5461
5461
  };
5462
5462
  /**
5463
5463
  * createAPIConfiguration to create a custom Configuration
@@ -5723,7 +5723,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
5723
5723
  chainID,
5724
5724
  coreContractAddress,
5725
5725
  registrationContractAddress,
5726
- sdkVersion: 'ts-immutable-sdk-0.2.1-alpha',
5726
+ sdkVersion: 'ts-immutable-sdk-0.2.3-alpha',
5727
5727
  });
5728
5728
  /**
5729
5729
  * Sets `sdkVersion` at the time of build
@@ -12055,31 +12055,25 @@ class ImmutableApiClientFactory {
12055
12055
  }
12056
12056
  }
12057
12057
 
12058
- const DEVNET_CHAIN_NAME = 'imtbl-zkevm-devnet';
12059
12058
  const TESTNET_CHAIN_NAME = 'imtbl-zkevm-testnet';
12060
12059
  const MAINNET_CHAIN_NAME = 'imtbl-zkevm-mainnet';
12061
- function getOrderbookConfig(chainName) {
12062
- switch (chainName) {
12063
- case DEVNET_CHAIN_NAME:
12064
- return {
12065
- seaportContractAddress: '0x41388404Efb7a68Fd31d75CEf71dF91e2BDBa2fb',
12066
- zoneContractAddress: '0xCb5063b0c1dcF4f7fed8E7eaa79faf9859792767',
12067
- apiEndpoint: 'https://order-book-mr.dev.imtbl.com',
12068
- provider: new ethers.providers.JsonRpcProvider('https://zkevm-rpc.dev.x.immutable.com'),
12069
- };
12070
- case TESTNET_CHAIN_NAME:
12060
+ function getOrderbookConfig(environment) {
12061
+ switch (environment) {
12062
+ case exports.Environment.SANDBOX:
12071
12063
  return {
12072
12064
  seaportContractAddress: '0x45E23dA18804F99Cf67408AeBE85F67c958381Ff',
12073
12065
  zoneContractAddress: '0x25b00b7eb97eab6194798E9B8eF63Aa526D5bd7E',
12074
12066
  apiEndpoint: 'https://order-book-mr.sandbox.imtbl.com',
12067
+ chainName: TESTNET_CHAIN_NAME,
12075
12068
  provider: new ethers.providers.JsonRpcProvider('https://zkevm-rpc.sandbox.x.immutable.com'),
12076
12069
  };
12077
- case MAINNET_CHAIN_NAME:
12078
- // not yet deployed
12070
+ // not yet deployed
12071
+ case exports.Environment.PRODUCTION:
12079
12072
  return {
12080
12073
  seaportContractAddress: '',
12081
12074
  zoneContractAddress: '',
12082
12075
  apiEndpoint: 'https://order-book-mr.imtbl.com',
12076
+ chainName: MAINNET_CHAIN_NAME,
12083
12077
  provider: new ethers.providers.JsonRpcProvider('https://zkevm-rpc.x.immutable.com'),
12084
12078
  };
12085
12079
  default:
@@ -13038,19 +13032,19 @@ class Orderbook {
13038
13032
  apiClient;
13039
13033
  seaport;
13040
13034
  orderbookConfig;
13041
- constructor(config, localConfig) {
13042
- // either use preconfigured config or local config passed in
13043
- const maybeConfig = getOrderbookConfig(config.overrides?.chainName) || localConfig;
13044
- if (!maybeConfig) {
13045
- throw new Error('Orderbook configuration not passed, either select one of the preseet chainNames or pass in localConfig');
13046
- }
13047
- const { chainName, provider } = config.overrides;
13048
- maybeConfig.provider = provider
13049
- || maybeConfig.provider;
13050
- this.orderbookConfig = maybeConfig;
13051
- const { apiEndpoint } = this.orderbookConfig;
13035
+ constructor(config) {
13036
+ const obConfig = getOrderbookConfig(config.baseConfig.environment);
13037
+ const finalConfig = {
13038
+ ...obConfig,
13039
+ ...config.overrides,
13040
+ };
13041
+ if (!finalConfig) {
13042
+ throw new Error('Orderbook configuration not passed, please specify the environment under config.baseConfig.environment');
13043
+ }
13044
+ this.orderbookConfig = finalConfig;
13045
+ const { apiEndpoint, chainName } = this.orderbookConfig;
13052
13046
  if (!apiEndpoint) {
13053
- throw new Error('API endpoint must be provided as an override');
13047
+ throw new Error('API endpoint must be provided');
13054
13048
  }
13055
13049
  this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, this.orderbookConfig.seaportContractAddress).create();
13056
13050
  const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
@@ -27937,7 +27931,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
27937
27931
  function $parcel$export(e, n, v, s) {
27938
27932
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27939
27933
  }
27940
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.1-alpha";
27934
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.3-alpha";
27941
27935
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
27942
27936
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
27943
27937
 
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, OrderbookModuleConfiguration } from 'config/config';
4
+ import { OrderbookOverrides } 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
 
@@ -12807,7 +12807,7 @@ declare class Orderbook {
12807
12807
  private apiClient;
12808
12808
  private seaport;
12809
12809
  private orderbookConfig;
12810
- constructor(config: ModuleConfiguration<OrderbookOverrides>, localConfig?: OrderbookModuleConfiguration);
12810
+ constructor(config: ModuleConfiguration<OrderbookOverrides>);
12811
12811
  /**
12812
12812
  * Get an order by ID
12813
12813
  * @param {string} listingId - The listingId to find.
package/dist/index.js CHANGED
@@ -5437,7 +5437,7 @@ class APIError extends Error {
5437
5437
 
5438
5438
  /* eslint-disable implicit-arrow-linebreak */
5439
5439
  const defaultHeaders = {
5440
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.1-alpha',
5440
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.2.3-alpha',
5441
5441
  };
5442
5442
  /**
5443
5443
  * createAPIConfiguration to create a custom Configuration
@@ -5703,7 +5703,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
5703
5703
  chainID,
5704
5704
  coreContractAddress,
5705
5705
  registrationContractAddress,
5706
- sdkVersion: 'ts-immutable-sdk-0.2.1-alpha',
5706
+ sdkVersion: 'ts-immutable-sdk-0.2.3-alpha',
5707
5707
  });
5708
5708
  /**
5709
5709
  * Sets `sdkVersion` at the time of build
@@ -12035,31 +12035,25 @@ class ImmutableApiClientFactory {
12035
12035
  }
12036
12036
  }
12037
12037
 
12038
- const DEVNET_CHAIN_NAME = 'imtbl-zkevm-devnet';
12039
12038
  const TESTNET_CHAIN_NAME = 'imtbl-zkevm-testnet';
12040
12039
  const MAINNET_CHAIN_NAME = 'imtbl-zkevm-mainnet';
12041
- function getOrderbookConfig(chainName) {
12042
- switch (chainName) {
12043
- case DEVNET_CHAIN_NAME:
12044
- return {
12045
- seaportContractAddress: '0x41388404Efb7a68Fd31d75CEf71dF91e2BDBa2fb',
12046
- zoneContractAddress: '0xCb5063b0c1dcF4f7fed8E7eaa79faf9859792767',
12047
- apiEndpoint: 'https://order-book-mr.dev.imtbl.com',
12048
- provider: new providers.JsonRpcProvider('https://zkevm-rpc.dev.x.immutable.com'),
12049
- };
12050
- case TESTNET_CHAIN_NAME:
12040
+ function getOrderbookConfig(environment) {
12041
+ switch (environment) {
12042
+ case Environment$1.SANDBOX:
12051
12043
  return {
12052
12044
  seaportContractAddress: '0x45E23dA18804F99Cf67408AeBE85F67c958381Ff',
12053
12045
  zoneContractAddress: '0x25b00b7eb97eab6194798E9B8eF63Aa526D5bd7E',
12054
12046
  apiEndpoint: 'https://order-book-mr.sandbox.imtbl.com',
12047
+ chainName: TESTNET_CHAIN_NAME,
12055
12048
  provider: new providers.JsonRpcProvider('https://zkevm-rpc.sandbox.x.immutable.com'),
12056
12049
  };
12057
- case MAINNET_CHAIN_NAME:
12058
- // not yet deployed
12050
+ // not yet deployed
12051
+ case Environment$1.PRODUCTION:
12059
12052
  return {
12060
12053
  seaportContractAddress: '',
12061
12054
  zoneContractAddress: '',
12062
12055
  apiEndpoint: 'https://order-book-mr.imtbl.com',
12056
+ chainName: MAINNET_CHAIN_NAME,
12063
12057
  provider: new providers.JsonRpcProvider('https://zkevm-rpc.x.immutable.com'),
12064
12058
  };
12065
12059
  default:
@@ -13018,19 +13012,19 @@ class Orderbook {
13018
13012
  apiClient;
13019
13013
  seaport;
13020
13014
  orderbookConfig;
13021
- constructor(config, localConfig) {
13022
- // either use preconfigured config or local config passed in
13023
- const maybeConfig = getOrderbookConfig(config.overrides?.chainName) || localConfig;
13024
- if (!maybeConfig) {
13025
- throw new Error('Orderbook configuration not passed, either select one of the preseet chainNames or pass in localConfig');
13026
- }
13027
- const { chainName, provider } = config.overrides;
13028
- maybeConfig.provider = provider
13029
- || maybeConfig.provider;
13030
- this.orderbookConfig = maybeConfig;
13031
- const { apiEndpoint } = this.orderbookConfig;
13015
+ constructor(config) {
13016
+ const obConfig = getOrderbookConfig(config.baseConfig.environment);
13017
+ const finalConfig = {
13018
+ ...obConfig,
13019
+ ...config.overrides,
13020
+ };
13021
+ if (!finalConfig) {
13022
+ throw new Error('Orderbook configuration not passed, please specify the environment under config.baseConfig.environment');
13023
+ }
13024
+ this.orderbookConfig = finalConfig;
13025
+ const { apiEndpoint, chainName } = this.orderbookConfig;
13032
13026
  if (!apiEndpoint) {
13033
- throw new Error('API endpoint must be provided as an override');
13027
+ throw new Error('API endpoint must be provided');
13034
13028
  }
13035
13029
  this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, this.orderbookConfig.seaportContractAddress).create();
13036
13030
  const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
@@ -27917,7 +27911,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
27917
27911
  function $parcel$export(e, n, v, s) {
27918
27912
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27919
27913
  }
27920
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.1-alpha";
27914
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.2.3-alpha";
27921
27915
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
27922
27916
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
27923
27917
 
@@ -1,4 +1,4 @@
1
- import { OrderbookOverrides, OrderbookModuleConfiguration } from 'config/config';
1
+ import { OrderbookOverrides } from 'config/config';
2
2
  import { ListingResult, ListListingsResult } from 'openapi/sdk';
3
3
  import { ListListingsParams, PrepareListingParams, PrepareListingResponse, CreateListingParams, FulfillOrderResponse, CancelOrderResponse } from 'types';
4
4
 
@@ -28,7 +28,7 @@ declare class Orderbook {
28
28
  private apiClient;
29
29
  private seaport;
30
30
  private orderbookConfig;
31
- constructor(config: ModuleConfiguration<OrderbookOverrides>, localConfig?: OrderbookModuleConfiguration);
31
+ constructor(config: ModuleConfiguration<OrderbookOverrides>);
32
32
  /**
33
33
  * Get an order by ID
34
34
  * @param {string} listingId - The listingId to find.
package/dist/orderbook.js CHANGED
@@ -3,6 +3,12 @@ import FormData from 'form-data';
3
3
  import { providers, BigNumber, constants, utils, Contract } from 'ethers';
4
4
  import { Seaport as Seaport$1 } from '@opensea/seaport-js';
5
5
 
6
+ var Environment;
7
+ (function (Environment) {
8
+ Environment["PRODUCTION"] = "production";
9
+ Environment["SANDBOX"] = "sandbox";
10
+ })(Environment || (Environment = {}));
11
+
6
12
  class BaseHttpRequest {
7
13
  config;
8
14
  constructor(config) {
@@ -898,31 +904,25 @@ class ImmutableApiClientFactory {
898
904
  }
899
905
  }
900
906
 
901
- const DEVNET_CHAIN_NAME = 'imtbl-zkevm-devnet';
902
907
  const TESTNET_CHAIN_NAME = 'imtbl-zkevm-testnet';
903
908
  const MAINNET_CHAIN_NAME = 'imtbl-zkevm-mainnet';
904
- function getOrderbookConfig(chainName) {
905
- switch (chainName) {
906
- case DEVNET_CHAIN_NAME:
907
- return {
908
- seaportContractAddress: '0x41388404Efb7a68Fd31d75CEf71dF91e2BDBa2fb',
909
- zoneContractAddress: '0xCb5063b0c1dcF4f7fed8E7eaa79faf9859792767',
910
- apiEndpoint: 'https://order-book-mr.dev.imtbl.com',
911
- provider: new providers.JsonRpcProvider('https://zkevm-rpc.dev.x.immutable.com'),
912
- };
913
- case TESTNET_CHAIN_NAME:
909
+ function getOrderbookConfig(environment) {
910
+ switch (environment) {
911
+ case Environment.SANDBOX:
914
912
  return {
915
913
  seaportContractAddress: '0x45E23dA18804F99Cf67408AeBE85F67c958381Ff',
916
914
  zoneContractAddress: '0x25b00b7eb97eab6194798E9B8eF63Aa526D5bd7E',
917
915
  apiEndpoint: 'https://order-book-mr.sandbox.imtbl.com',
916
+ chainName: TESTNET_CHAIN_NAME,
918
917
  provider: new providers.JsonRpcProvider('https://zkevm-rpc.sandbox.x.immutable.com'),
919
918
  };
920
- case MAINNET_CHAIN_NAME:
921
- // not yet deployed
919
+ // not yet deployed
920
+ case Environment.PRODUCTION:
922
921
  return {
923
922
  seaportContractAddress: '',
924
923
  zoneContractAddress: '',
925
924
  apiEndpoint: 'https://order-book-mr.imtbl.com',
925
+ chainName: MAINNET_CHAIN_NAME,
926
926
  provider: new providers.JsonRpcProvider('https://zkevm-rpc.x.immutable.com'),
927
927
  };
928
928
  default:
@@ -1881,19 +1881,19 @@ class Orderbook {
1881
1881
  apiClient;
1882
1882
  seaport;
1883
1883
  orderbookConfig;
1884
- constructor(config, localConfig) {
1885
- // either use preconfigured config or local config passed in
1886
- const maybeConfig = getOrderbookConfig(config.overrides?.chainName) || localConfig;
1887
- if (!maybeConfig) {
1888
- throw new Error('Orderbook configuration not passed, either select one of the preseet chainNames or pass in localConfig');
1884
+ constructor(config) {
1885
+ const obConfig = getOrderbookConfig(config.baseConfig.environment);
1886
+ const finalConfig = {
1887
+ ...obConfig,
1888
+ ...config.overrides,
1889
+ };
1890
+ if (!finalConfig) {
1891
+ throw new Error('Orderbook configuration not passed, please specify the environment under config.baseConfig.environment');
1889
1892
  }
1890
- const { chainName, provider } = config.overrides;
1891
- maybeConfig.provider = provider
1892
- || maybeConfig.provider;
1893
- this.orderbookConfig = maybeConfig;
1894
- const { apiEndpoint } = this.orderbookConfig;
1893
+ this.orderbookConfig = finalConfig;
1894
+ const { apiEndpoint, chainName } = this.orderbookConfig;
1895
1895
  if (!apiEndpoint) {
1896
- throw new Error('API endpoint must be provided as an override');
1896
+ throw new Error('API endpoint must be provided');
1897
1897
  }
1898
1898
  this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, this.orderbookConfig.seaportContractAddress).create();
1899
1899
  const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
package/dist/passport.js CHANGED
@@ -23,7 +23,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
23
23
  chainID,
24
24
  coreContractAddress,
25
25
  registrationContractAddress,
26
- sdkVersion: 'ts-immutable-sdk-0.2.1-alpha',
26
+ sdkVersion: 'ts-immutable-sdk-0.2.3-alpha',
27
27
  });
28
28
  /**
29
29
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.2.1-alpha",
4
+ "version": "0.2.3-alpha",
5
5
  "author": "Immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
7
  "dependencies": {