@imtbl/sdk 0.34.1-alpha → 0.35.1

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.js CHANGED
@@ -3769,7 +3769,7 @@ class MultiRollupApiClients {
3769
3769
  }
3770
3770
 
3771
3771
  // eslint-disable-next-line @typescript-eslint/naming-convention
3772
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.34.1-alpha' };
3772
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.1' };
3773
3773
  const createConfig = ({ basePath, headers, }) => {
3774
3774
  if (!basePath.trim()) {
3775
3775
  throw Error('basePath can not be empty');
@@ -3829,7 +3829,7 @@ class APIError extends Error {
3829
3829
 
3830
3830
  /* eslint-disable implicit-arrow-linebreak */
3831
3831
  const defaultHeaders = {
3832
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.34.1-alpha',
3832
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.1',
3833
3833
  };
3834
3834
  /**
3835
3835
  * createAPIConfiguration to create a custom Configuration
@@ -4240,7 +4240,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4240
4240
  chainID,
4241
4241
  coreContractAddress,
4242
4242
  registrationContractAddress,
4243
- sdkVersion: 'ts-immutable-sdk-0.34.1-alpha',
4243
+ sdkVersion: 'ts-immutable-sdk-0.35.1',
4244
4244
  });
4245
4245
  /**
4246
4246
  * Sets `sdkVersion` at the time of build
@@ -11698,14 +11698,24 @@ var FailedOrderCancellation;
11698
11698
  /* eslint-disable */
11699
11699
  var Fee;
11700
11700
  (function (Fee) {
11701
- (function (fee_type) {
11702
- fee_type["ROYALTY"] = "ROYALTY";
11703
- fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
11704
- fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
11705
- fee_type["PROTOCOL"] = "PROTOCOL";
11706
- })(Fee.fee_type || (Fee.fee_type = {}));
11701
+ (function (type) {
11702
+ type["ROYALTY"] = "ROYALTY";
11703
+ type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
11704
+ type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
11705
+ type["PROTOCOL"] = "PROTOCOL";
11706
+ })(Fee.type || (Fee.type = {}));
11707
11707
  })(Fee || (Fee = {}));
11708
11708
 
11709
+ /* istanbul ignore file */
11710
+ /* tslint:disable */
11711
+ /* eslint-disable */
11712
+ var Order;
11713
+ (function (Order) {
11714
+ (function (type) {
11715
+ type["LISTING"] = "LISTING";
11716
+ })(Order.type || (Order.type = {}));
11717
+ })(Order || (Order = {}));
11718
+
11709
11719
  /* istanbul ignore file */
11710
11720
  /* tslint:disable */
11711
11721
  /* eslint-disable */
@@ -11758,14 +11768,14 @@ var ActionType;
11758
11768
 
11759
11769
  function mapFromOpenApiOrder(order) {
11760
11770
  const buyItems = order.buy.map((item) => {
11761
- if (item.item_type === 'ERC20') {
11771
+ if (item.type === 'ERC20') {
11762
11772
  return {
11763
11773
  type: 'ERC20',
11764
11774
  contractAddress: item.contract_address,
11765
11775
  amount: item.amount,
11766
11776
  };
11767
11777
  }
11768
- if (item.item_type === 'NATIVE') {
11778
+ if (item.type === 'NATIVE') {
11769
11779
  return {
11770
11780
  type: 'NATIVE',
11771
11781
  amount: item.amount,
@@ -11774,7 +11784,7 @@ function mapFromOpenApiOrder(order) {
11774
11784
  throw new Error('Buy items must be either ERC20 or NATIVE');
11775
11785
  });
11776
11786
  const sellItems = order.sell.map((item) => {
11777
- if (item.item_type === 'ERC721') {
11787
+ if (item.type === 'ERC721') {
11778
11788
  return {
11779
11789
  type: 'ERC721',
11780
11790
  contractAddress: item.contract_address,
@@ -11785,20 +11795,22 @@ function mapFromOpenApiOrder(order) {
11785
11795
  });
11786
11796
  return {
11787
11797
  id: order.id,
11798
+ type: order.type,
11788
11799
  accountAddress: order.account_address,
11789
11800
  buy: buyItems,
11790
11801
  sell: sellItems,
11791
11802
  fees: order.fees.map((fee) => ({
11792
11803
  amount: fee.amount,
11793
- recipient: fee.recipient,
11794
- type: fee.fee_type,
11804
+ recipientAddress: fee.recipient_address,
11805
+ type: fee.type,
11795
11806
  })),
11796
11807
  chain: order.chain,
11797
11808
  createdAt: order.created_at,
11798
11809
  endAt: order.end_at,
11810
+ orderHash: order.order_hash,
11799
11811
  protocolData: {
11800
- counter: order.protocol_data.counter,
11801
11812
  orderType: order.protocol_data.order_type,
11813
+ counter: order.protocol_data.counter,
11802
11814
  seaportAddress: order.protocol_data.seaport_address,
11803
11815
  seaportVersion: order.protocol_data.seaport_version,
11804
11816
  zoneAddress: order.protocol_data.zone_address,
@@ -11812,14 +11824,14 @@ function mapFromOpenApiOrder(order) {
11812
11824
  }
11813
11825
  function mapFromOpenApiTrade(trade) {
11814
11826
  const buyItems = trade.buy.map((item) => {
11815
- if (item.item_type === 'ERC20') {
11827
+ if (item.type === 'ERC20') {
11816
11828
  return {
11817
11829
  type: 'ERC20',
11818
11830
  contractAddress: item.contract_address,
11819
11831
  amount: item.amount,
11820
11832
  };
11821
11833
  }
11822
- if (item.item_type === 'NATIVE') {
11834
+ if (item.type === 'NATIVE') {
11823
11835
  return {
11824
11836
  type: 'NATIVE',
11825
11837
  amount: item.amount,
@@ -11828,7 +11840,7 @@ function mapFromOpenApiTrade(trade) {
11828
11840
  throw new Error('Buy items must be either ERC20 or NATIVE');
11829
11841
  });
11830
11842
  const sellItems = trade.sell.map((item) => {
11831
- if (item.item_type === 'ERC721') {
11843
+ if (item.type === 'ERC721') {
11832
11844
  return {
11833
11845
  type: 'ERC721',
11834
11846
  contractAddress: item.contract_address,
@@ -11844,8 +11856,8 @@ function mapFromOpenApiTrade(trade) {
11844
11856
  sell: sellItems,
11845
11857
  buyerFees: trade.buyer_fees.map((fee) => ({
11846
11858
  amount: fee.amount,
11847
- recipient: fee.recipient,
11848
- type: fee.fee_type,
11859
+ recipientAddress: fee.recipient_address,
11860
+ type: fee.type,
11849
11861
  })),
11850
11862
  chain: trade.chain,
11851
11863
  indexedAt: trade.indexed_at,
@@ -11959,7 +11971,7 @@ chainId) {
11959
11971
 
11960
11972
  function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
11961
11973
  const considerationItems = order.buy.map((buyItem) => {
11962
- switch (buyItem.item_type) {
11974
+ switch (buyItem.type) {
11963
11975
  case 'NATIVE':
11964
11976
  return {
11965
11977
  startAmount: buyItem.amount,
@@ -11991,9 +12003,9 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
11991
12003
  });
11992
12004
  const fees = order.fees.map((fee) => ({
11993
12005
  amount: fee.amount,
11994
- itemType: order.buy[0].item_type === 'ERC20' ? ItemType$1.ERC20 : ItemType$1.NATIVE,
11995
- recipient: fee.recipient,
11996
- token: order.buy[0].item_type === 'ERC20'
12006
+ itemType: order.buy[0].type === 'ERC20' ? ItemType$1.ERC20 : ItemType$1.NATIVE,
12007
+ recipient: fee.recipient_address,
12008
+ token: order.buy[0].type === 'ERC20'
11997
12009
  ? order.buy[0].contract_address
11998
12010
  : constants$1.AddressZero,
11999
12011
  identifierOrCriteria: '0',
@@ -12285,11 +12297,10 @@ class ImmutableApiClient {
12285
12297
  return this.orderbookService.createListing({
12286
12298
  chainName: this.chainName,
12287
12299
  requestBody: {
12288
- order_hash: orderHash,
12289
12300
  account_address: orderComponents.offerer,
12290
12301
  buy: [
12291
12302
  {
12292
- item_type: Number(orderComponents.consideration[0].itemType)
12303
+ type: Number(orderComponents.consideration[0].itemType)
12293
12304
  === ItemType$1.NATIVE
12294
12305
  ? 'NATIVE'
12295
12306
  : 'ERC20',
@@ -12299,10 +12310,11 @@ class ImmutableApiClient {
12299
12310
  ],
12300
12311
  fees: makerFees.map((x) => ({
12301
12312
  amount: x.amount,
12302
- fee_type: FeeType.MAKER_ECOSYSTEM,
12303
- recipient: x.recipient,
12313
+ type: FeeType.MAKER_ECOSYSTEM,
12314
+ recipient_address: x.recipientAddress,
12304
12315
  })),
12305
12316
  end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
12317
+ order_hash: orderHash,
12306
12318
  protocol_data: {
12307
12319
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
12308
12320
  zone_address: orderComponents.zone,
@@ -12315,7 +12327,7 @@ class ImmutableApiClient {
12315
12327
  {
12316
12328
  contract_address: orderComponents.offer[0].token,
12317
12329
  token_id: orderComponents.offer[0].identifierOrCriteria,
12318
- item_type: 'ERC721',
12330
+ type: 'ERC721',
12319
12331
  },
12320
12332
  ],
12321
12333
  signature: orderSignature,
@@ -12348,8 +12360,8 @@ function getOrderbookConfig(environment) {
12348
12360
  switch (environment) {
12349
12361
  case Environment$1.SANDBOX:
12350
12362
  return {
12351
- seaportContractAddress: '0x2CFA8f64e1B49A2DF28532D1D30Cda45117cF778',
12352
- zoneContractAddress: '0x1Bb4Fb11Ba021Bd0104F0Ee8E5F5c728Bc83d7F1',
12363
+ seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
12364
+ zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
12353
12365
  apiEndpoint: 'https://api.sandbox.immutable.com',
12354
12366
  chainName: TESTNET_CHAIN_NAME,
12355
12367
  provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
@@ -12512,8 +12524,8 @@ class Orderbook {
12512
12524
  order_id: listingId,
12513
12525
  fees: takerFees.map((fee) => ({
12514
12526
  amount: fee.amount,
12515
- fee_type: FeeType.TAKER_ECOSYSTEM,
12516
- recipient: fee.recipient,
12527
+ type: FeeType.TAKER_ECOSYSTEM,
12528
+ recipient_address: fee.recipientAddress,
12517
12529
  })),
12518
12530
  },
12519
12531
  ]);
@@ -12535,8 +12547,8 @@ class Orderbook {
12535
12547
  order_id: listingRequest.listingId,
12536
12548
  fees: listingRequest.takerFees.map((fee) => ({
12537
12549
  amount: fee.amount,
12538
- fee_type: FeeType.TAKER_ECOSYSTEM,
12539
- recipient: fee.recipient,
12550
+ type: FeeType.TAKER_ECOSYSTEM,
12551
+ recipient_address: fee.recipientAddress,
12540
12552
  })),
12541
12553
  })));
12542
12554
  try {
@@ -28405,7 +28417,6 @@ class UniswapV3Pool__factory extends ContractFactory {
28405
28417
  }
28406
28418
  }
28407
28419
 
28408
- const DEFAULT_GAS_QUOTE = 2000000;
28409
28420
  // TODO: Better description of function and args
28410
28421
  async function multicallSingleCallDataMultipleContracts(multicallContract, functionName, addresses) {
28411
28422
  // Encode args - generate calldata for contract
@@ -28427,22 +28438,6 @@ async function multicallSingleCallDataMultipleContracts(multicallContract, funct
28427
28438
  }
28428
28439
  return multicallContract.callStatic.multicall(calls);
28429
28440
  }
28430
- // TODO: Better description of function and args
28431
- async function multicallMultipleCallDataSingContract(multicallContract, calldata, address, options) {
28432
- // Create call objects
28433
- const calls = new Array(calldata.length);
28434
- // TODO: use object.keys of something similar to avoid iterating over
28435
- // entire object prototype
28436
- // eslint-disable-next-line no-restricted-syntax, guard-for-in
28437
- for (const i in calldata) {
28438
- calls[i] = {
28439
- target: address,
28440
- callData: calldata[i],
28441
- gasLimit: options?.gasRequired ?? DEFAULT_GAS_QUOTE,
28442
- };
28443
- }
28444
- return multicallContract.callStatic.multicall(calls);
28445
- }
28446
28441
  const getCallData = (methodName, contractInterface) => {
28447
28442
  // Create ethers function fragment
28448
28443
  const fragment = contractInterface?.getFunction(methodName);
@@ -28602,35 +28597,27 @@ const getDefaultDeadlineSeconds = () => Math.floor(Date.now() / 1000) + DEFAULT_
28602
28597
 
28603
28598
  const amountIndex = 0;
28604
28599
  const gasEstimateIndex = 3;
28605
- async function getQuotesForRoutes(multicallContract, quoterContractAddress, routes, amountSpecified, tradeType) {
28606
- const callData = routes.map((route) => SwapQuoter.quoteCallParameters(route, toCurrencyAmount(amountSpecified), tradeType, {
28600
+ async function getQuotesForRoutes(provider, quoterContractAddress, routes, amountSpecified, tradeType) {
28601
+ const callDatas = routes.map((route) => SwapQuoter.quoteCallParameters(route, toCurrencyAmount(amountSpecified), tradeType, {
28607
28602
  useQuoterV2: true,
28608
28603
  }).calldata);
28609
- let quoteResults;
28610
- try {
28611
- quoteResults = await multicallMultipleCallDataSingContract(multicallContract, callData, quoterContractAddress);
28612
- }
28613
- catch (e) {
28614
- const message = e instanceof Error ? e.message : 'Unknown Error';
28615
- throw new ProviderCallError(`failed multicall: ${message}`);
28616
- }
28617
- const decodedQuoteResults = [];
28618
- // TODO: for..in loops iterate over the entire prototype chain,
28619
- // Use Object.{keys,values,entries}, and iterate over the resulting array.
28620
- // eslint-disable-next-line no-restricted-syntax, guard-for-in
28621
- for (const i in quoteResults.returnData) {
28622
- const functionSig = callData[i].substring(0, 10);
28604
+ const promises = await Promise.allSettled(callDatas.map((data) => provider.send('eth_call', [
28605
+ { to: quoterContractAddress, data }, 'latest',
28606
+ ])));
28607
+ const decodedQuoteResults = promises.reduce((quoteResults, promiseResult, i) => {
28608
+ if (promiseResult.status === 'rejected')
28609
+ return quoteResults;
28610
+ const functionSig = callDatas[i].substring(0, 10);
28623
28611
  const returnTypes = quoteReturnMapping[functionSig];
28624
28612
  if (!returnTypes) {
28625
28613
  throw new Error('No quoting function signature found');
28626
28614
  }
28627
- if (quoteResults.returnData[i].returnData === '0x') {
28615
+ if (promiseResult.value === '0x') {
28628
28616
  // There is no quote result for the swap using this route, so don't include it in results
28629
- // eslint-disable-next-line no-continue
28630
- continue;
28617
+ return quoteResults;
28631
28618
  }
28632
28619
  try {
28633
- const decodedQuoteResult = ethers.utils.defaultAbiCoder.decode(returnTypes, quoteResults.returnData[i].returnData);
28620
+ const decodedQuoteResult = utils$1.defaultAbiCoder.decode(returnTypes, promiseResult.value);
28634
28621
  if (decodedQuoteResult) {
28635
28622
  // The 0th element in each decoded data is going to be the amountOut or amountIn.
28636
28623
  const quoteAmount = decodedQuoteResult[amountIndex];
@@ -28638,11 +28625,11 @@ async function getQuotesForRoutes(multicallContract, quoterContractAddress, rout
28638
28625
  throw new Error('Expected BigNumber');
28639
28626
  const input = uniswapTokenToERC20(routes[i].input);
28640
28627
  const output = uniswapTokenToERC20(routes[i].output);
28641
- decodedQuoteResults.push({
28628
+ quoteResults.push({
28642
28629
  route: routes[i],
28643
28630
  amountIn: tradeType === TradeType.EXACT_INPUT ? amountSpecified : newAmount(quoteAmount, input),
28644
28631
  amountOut: tradeType === TradeType.EXACT_INPUT ? newAmount(quoteAmount, output) : amountSpecified,
28645
- gasEstimate: ethers.BigNumber.from(decodedQuoteResult[gasEstimateIndex]),
28632
+ gasEstimate: BigNumber$1.from(decodedQuoteResult[gasEstimateIndex]),
28646
28633
  tradeType,
28647
28634
  });
28648
28635
  }
@@ -28652,7 +28639,8 @@ async function getQuotesForRoutes(multicallContract, quoterContractAddress, rout
28652
28639
  // Other quotes for routes may still succeed, so do nothing
28653
28640
  // and continue processing
28654
28641
  }
28655
- }
28642
+ return quoteResults;
28643
+ }, new Array());
28656
28644
  return decodedQuoteResults;
28657
28645
  }
28658
28646
 
@@ -28780,19 +28768,24 @@ const fetchValidPools = async (multicallContract, erc20Pair, commonRoutingERC20s
28780
28768
 
28781
28769
  class Router {
28782
28770
  provider;
28771
+ multicallContract;
28783
28772
  routingTokens;
28784
28773
  routingContracts;
28785
- constructor(provider, routingTokens, routingContracts) {
28774
+ constructor(provider, multicallContract, routingTokens, routingContracts) {
28786
28775
  this.provider = provider;
28776
+ this.multicallContract = multicallContract;
28777
+ this.routingTokens = routingTokens;
28778
+ this.routingContracts = routingContracts;
28779
+ this.provider = provider;
28780
+ this.multicallContract = multicallContract;
28787
28781
  this.routingTokens = routingTokens;
28788
28782
  this.routingContracts = routingContracts;
28789
28783
  }
28790
28784
  async findOptimalRoute(amountSpecified, otherToken, tradeType, maxHops = 2) {
28791
28785
  const [tokenIn, tokenOut] = this.determineERC20InAndERC20Out(tradeType, amountSpecified, otherToken);
28792
- const multicallContract = Multicall__factory.connect(this.routingContracts.multicallAddress, this.provider);
28793
28786
  const erc20Pair = [tokenIn, tokenOut];
28794
28787
  // Get all pools and use these to get all possible routes.
28795
- const pools = await fetchValidPools(multicallContract, erc20Pair, this.routingTokens, this.routingContracts.factoryAddress);
28788
+ const pools = await fetchValidPools(this.multicallContract, erc20Pair, this.routingTokens, this.routingContracts.coreFactory);
28796
28789
  const noValidPools = pools.length === 0;
28797
28790
  if (noValidPools) {
28798
28791
  throw new NoRoutesAvailableError();
@@ -28806,10 +28799,10 @@ class Router {
28806
28799
  throw new NoRoutesAvailableError();
28807
28800
  }
28808
28801
  // Get the best quote from all of the given routes
28809
- return await this.getBestQuoteFromRoutes(multicallContract, routes, amountSpecified, tradeType);
28802
+ return await this.getBestQuoteFromRoutes(routes, amountSpecified, tradeType);
28810
28803
  }
28811
- async getBestQuoteFromRoutes(multicallContract, routes, amountSpecified, tradeType) {
28812
- const quotes = await getQuotesForRoutes(multicallContract, this.routingContracts.quoterAddress, routes, amountSpecified, tradeType);
28804
+ async getBestQuoteFromRoutes(routes, amountSpecified, tradeType) {
28805
+ const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoterV2, routes, amountSpecified, tradeType);
28813
28806
  if (quotes.length === 0) {
28814
28807
  throw new NoRoutesAvailableError();
28815
28808
  }
@@ -29538,6 +29531,7 @@ const toPublicQuote = (amount, amountWithMaxSlippage, slippage, fees) => ({
29538
29531
  });
29539
29532
  class Exchange {
29540
29533
  provider;
29534
+ batchProvider;
29541
29535
  router;
29542
29536
  chainId;
29543
29537
  nativeToken;
@@ -29555,12 +29549,16 @@ class Exchange {
29555
29549
  this.secondaryFees = config.secondaryFees;
29556
29550
  this.routerContractAddress = config.chain.contracts.peripheryRouter;
29557
29551
  this.secondaryFeeContractAddress = config.chain.contracts.secondaryFee;
29558
- this.provider = new ethers.providers.JsonRpcProvider(config.chain.rpcUrl);
29559
- this.router = new Router(this.provider, config.chain.commonRoutingTokens, {
29560
- multicallAddress: config.chain.contracts.multicall,
29561
- factoryAddress: config.chain.contracts.coreFactory,
29562
- quoterAddress: config.chain.contracts.quoterV2,
29563
- });
29552
+ this.provider = new ethers.providers.StaticJsonRpcProvider({
29553
+ url: config.chain.rpcUrl,
29554
+ skipFetchSetup: true,
29555
+ }, config.chain.chainId);
29556
+ this.batchProvider = new ethers.providers.JsonRpcBatchProvider({
29557
+ url: config.chain.rpcUrl,
29558
+ skipFetchSetup: true,
29559
+ }, config.chain.chainId);
29560
+ const multicallContract = Multicall__factory.connect(config.chain.contracts.multicall, this.provider);
29561
+ this.router = new Router(this.batchProvider, multicallContract, config.chain.commonRoutingTokens, config.chain.contracts);
29564
29562
  }
29565
29563
  static validate(tokenInAddress, tokenOutAddress, maxHops, slippagePercent, fromAddress) {
29566
29564
  assert(isValidNonZeroAddress(fromAddress), new InvalidAddressError('invalid from address'));
@@ -29572,11 +29570,11 @@ class Exchange {
29572
29570
  assert(slippagePercent <= 50, new InvalidSlippageError('slippage percent must be less than or equal to 50'));
29573
29571
  assert(slippagePercent >= 0, new InvalidSlippageError('slippage percent must be greater than or equal to 0'));
29574
29572
  }
29575
- async getSecondaryFees() {
29573
+ async getSecondaryFees(provider) {
29576
29574
  if (this.secondaryFees.length === 0) {
29577
29575
  return [];
29578
29576
  }
29579
- const secondaryFeeContract = SecondaryFee__factory.connect(this.secondaryFeeContractAddress, this.provider);
29577
+ const secondaryFeeContract = SecondaryFee__factory.connect(this.secondaryFeeContractAddress, provider);
29580
29578
  if (await secondaryFeeContract.paused()) {
29581
29579
  // Do not use secondary fees if the contract is paused
29582
29580
  return [];
@@ -29597,11 +29595,13 @@ class Exchange {
29597
29595
  async getUnsignedSwapTx(fromAddress, tokenInLiteral, tokenOutLiteral, amount, slippagePercent, maxHops, deadline, tradeType) {
29598
29596
  Exchange.validate(tokenInLiteral, tokenOutLiteral, maxHops, slippagePercent, fromAddress);
29599
29597
  // get the decimals of the tokens that will be swapped
29600
- const [tokenInDecimals, tokenOutDecimals, secondaryFees] = await Promise.all([
29601
- getTokenDecimals(tokenInLiteral, this.provider, this.nativeToken),
29602
- getTokenDecimals(tokenOutLiteral, this.provider, this.nativeToken),
29603
- this.getSecondaryFees(),
29604
- ]);
29598
+ const promises = [
29599
+ getTokenDecimals(tokenInLiteral, this.batchProvider, this.nativeToken),
29600
+ getTokenDecimals(tokenOutLiteral, this.batchProvider, this.nativeToken),
29601
+ this.getSecondaryFees(this.batchProvider),
29602
+ fetchGasPrice(this.batchProvider, this.nativeToken),
29603
+ ];
29604
+ const [tokenInDecimals, tokenOutDecimals, secondaryFees, gasPrice] = await Promise.all(promises);
29605
29605
  const tokenIn = this.parseTokenLiteral(tokenInLiteral, tokenInDecimals);
29606
29606
  const tokenOut = this.parseTokenLiteral(tokenOutLiteral, tokenOutDecimals);
29607
29607
  // determine which amount was specified for the swap from the TradeType
@@ -29610,10 +29610,7 @@ class Exchange {
29610
29610
  const fees = new Fees(secondaryFees, tokenIn);
29611
29611
  const ourQuoteReqAmount = getOurQuoteReqAmount(amountSpecified, fees, tradeType, this.nativeTokenService);
29612
29612
  // Quotes will always use ERC20s. If the user-specified token is Native, we use the Wrapped Native Token pool
29613
- const [ourQuote, gasPrice] = await Promise.all([
29614
- this.router.findOptimalRoute(ourQuoteReqAmount, this.nativeTokenService.maybeWrapToken(otherToken), tradeType, maxHops),
29615
- fetchGasPrice(this.provider, this.nativeToken),
29616
- ]);
29613
+ const ourQuote = await this.router.findOptimalRoute(ourQuoteReqAmount, this.nativeTokenService.maybeWrapToken(otherToken), tradeType, maxHops);
29617
29614
  const adjustedQuote = adjustQuoteWithFees(ourQuote, amountSpecified, fees, this.nativeTokenService);
29618
29615
  const swap = getSwap(tokenIn, tokenOut, adjustedQuote, fromAddress, slippagePercent, deadline, this.routerContractAddress, this.secondaryFeeContractAddress, gasPrice, secondaryFees);
29619
29616
  const { quotedAmount, quotedAmountWithMaxSlippage } = prepareUserQuote(this.nativeTokenService, adjustedQuote, slippagePercent, otherToken);
@@ -30550,7 +30547,7 @@ const GAS_OVERRIDES = {
30550
30547
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
30551
30548
  };
30552
30549
 
30553
- const SDK_VERSION_MARKER = '0.34.1-alpha';
30550
+ const SDK_VERSION_MARKER = '0.35.1';
30554
30551
  // This SDK version is replaced by the `yarn build` command ran on the root level
30555
30552
  const globalPackageVersion = () => SDK_VERSION_MARKER;
30556
30553
 
@@ -33581,7 +33578,7 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
33581
33578
  if (currentFeeBn.gt(0)) {
33582
33579
  calculateFeesResult.push({
33583
33580
  amount: currentFeeBn.toString(),
33584
- recipient: orderFee.recipient,
33581
+ recipientAddress: orderFee.recipient,
33585
33582
  });
33586
33583
  }
33587
33584
  } // for
@@ -731,17 +731,17 @@ type Fee$1 = {
731
731
  /**
732
732
  * Fee type
733
733
  */
734
- fee_type: Fee$1.fee_type;
734
+ type: Fee$1.type;
735
735
  /**
736
736
  * Wallet address of fee recipient
737
737
  */
738
- recipient: string;
738
+ recipient_address: string;
739
739
  };
740
740
  declare namespace Fee$1 {
741
741
  /**
742
742
  * Fee type
743
743
  */
744
- enum fee_type {
744
+ enum type {
745
745
  ROYALTY = "ROYALTY",
746
746
  MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
747
747
  TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
@@ -749,17 +749,36 @@ declare namespace Fee$1 {
749
749
  }
750
750
  }
751
751
 
752
+ type ERC1155Item = {
753
+ /**
754
+ * Token type user is offering, which in this case is ERC1155
755
+ */
756
+ type: 'ERC1155';
757
+ /**
758
+ * Address of ERC1155 token
759
+ */
760
+ contract_address: string;
761
+ /**
762
+ * ID of ERC1155 token
763
+ */
764
+ token_id: string;
765
+ /**
766
+ * A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
767
+ */
768
+ amount: string;
769
+ };
770
+
752
771
  type ERC20Item$1 = {
753
772
  /**
754
773
  * Token type user is offering, which in this case is ERC20
755
774
  */
756
- item_type: 'ERC20';
775
+ type: 'ERC20';
757
776
  /**
758
777
  * Address of ERC20 token
759
778
  */
760
779
  contract_address: string;
761
780
  /**
762
- * A string representing the starting price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
781
+ * A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
763
782
  */
764
783
  amount: string;
765
784
  };
@@ -768,7 +787,7 @@ type ERC721Item$1 = {
768
787
  /**
769
788
  * Token type user is offering, which in this case is ERC721
770
789
  */
771
- item_type: 'ERC721';
790
+ type: 'ERC721';
772
791
  /**
773
792
  * Address of ERC721 token
774
793
  */
@@ -783,28 +802,28 @@ type NativeItem$1 = {
783
802
  /**
784
803
  * Token type user is offering, which in this case is the native IMX token
785
804
  */
786
- item_type: 'NATIVE';
805
+ type: 'NATIVE';
787
806
  /**
788
- * A string representing the starting price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
807
+ * A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
789
808
  */
790
809
  amount: string;
791
810
  };
792
811
 
793
- type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1);
812
+ type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1 | ERC1155Item);
794
813
 
795
814
  type ProtocolData = {
796
815
  /**
797
- * The Order type
816
+ * Seaport order type
798
817
  */
799
818
  order_type: ProtocolData.order_type;
800
- /**
801
- * Immutable zone address
802
- */
803
- zone_address: string;
804
819
  /**
805
820
  * big.Int or uint256 string for order counter
806
821
  */
807
822
  counter: string;
823
+ /**
824
+ * Immutable zone address
825
+ */
826
+ zone_address: string;
808
827
  /**
809
828
  * Immutable Seaport contract address
810
829
  */
@@ -816,7 +835,7 @@ type ProtocolData = {
816
835
  };
817
836
  declare namespace ProtocolData {
818
837
  /**
819
- * The Order type
838
+ * Seaport order type
820
839
  */
821
840
  enum order_type {
822
841
  FULL_RESTRICTED = "FULL_RESTRICTED"
@@ -968,6 +987,7 @@ type Order$1 = {
968
987
  * Global Order identifier
969
988
  */
970
989
  id: string;
990
+ order_hash: string;
971
991
  protocol_data: ProtocolData;
972
992
  /**
973
993
  * A random value added to the create Order request
@@ -983,11 +1003,23 @@ type Order$1 = {
983
1003
  */
984
1004
  start_at: string;
985
1005
  status: OrderStatus;
1006
+ /**
1007
+ * Order type
1008
+ */
1009
+ type: Order$1.type;
986
1010
  /**
987
1011
  * Time the Order is last updated
988
1012
  */
989
1013
  updated_at: string;
990
1014
  };
1015
+ declare namespace Order$1 {
1016
+ /**
1017
+ * Order type
1018
+ */
1019
+ enum type {
1020
+ LISTING = "LISTING"
1021
+ }
1022
+ }
991
1023
 
992
1024
  type FulfillableOrder = {
993
1025
  extra_data: string;
@@ -1350,7 +1382,7 @@ declare enum FeeType {
1350
1382
  ROYALTY = "ROYALTY"
1351
1383
  }
1352
1384
  interface FeeValue {
1353
- recipient: string;
1385
+ recipientAddress: string;
1354
1386
  amount: string;
1355
1387
  }
1356
1388
  interface Fee extends FeeValue {
@@ -1420,6 +1452,7 @@ interface CancelOrdersOnChainResponse {
1420
1452
  }
1421
1453
  interface Order {
1422
1454
  id: string;
1455
+ type: 'LISTING';
1423
1456
  accountAddress: string;
1424
1457
  buy: (ERC20Item | NativeItem)[];
1425
1458
  sell: ERC721Item[];
@@ -1438,6 +1471,7 @@ interface Order {
1438
1471
  * Time after which the Order is expired
1439
1472
  */
1440
1473
  endAt: string;
1474
+ orderHash: string;
1441
1475
  protocolData: {
1442
1476
  orderType: 'FULL_RESTRICTED';
1443
1477
  zoneAddress: string;