@imtbl/sdk 1.47.6 → 1.47.7

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.
Files changed (31) hide show
  1. package/dist/{blockchain_data-CiZHsf9c.js → blockchain_data-BxNIoP5D.js} +2 -2
  2. package/dist/blockchain_data.js +3 -3
  3. package/dist/browser/checkout/sdk.js +4 -4
  4. package/dist/{checkout-BBvLRxMi.js → checkout-hyV1W7o_.js} +5 -5
  5. package/dist/checkout.js +5 -5
  6. package/dist/{config-DrLnrVGK.js → config-BDnSNrUg.js} +1 -1
  7. package/dist/config.js +1 -1
  8. package/dist/{index-CigMtyzV.js → index-BEmbEQo3.js} +1 -1
  9. package/dist/{index-Cjv4ZmMK.js → index-BpHMHRxz.js} +3 -3
  10. package/dist/{index-D2J4NDeb.js → index-CADkJAYZ.js} +1 -1
  11. package/dist/{index-CR3MX8lP.js → index-CRPsZi2t.js} +1 -1
  12. package/dist/{index-DXOmpxiv.js → index-CgFCYrSh.js} +84 -10
  13. package/dist/{index-Bzh249QJ.js → index-D2UN9L1O.js} +4 -4
  14. package/dist/index.browser.js +6 -6
  15. package/dist/index.browser.js.map +1 -1
  16. package/dist/index.cjs +90 -16
  17. package/dist/index.d.ts +13 -2
  18. package/dist/index.js +14 -14
  19. package/dist/{minting_backend-Bl2cT8ma.js → minting_backend-BE0r4303.js} +3 -3
  20. package/dist/minting_backend.js +5 -5
  21. package/dist/{orderbook-Ye9irRWy.js → orderbook-DV8uREzr.js} +1 -1
  22. package/dist/orderbook.d.ts +13 -2
  23. package/dist/orderbook.js +4 -4
  24. package/dist/{passport-C_rwhkBZ.js → passport-CcbgiSNV.js} +3 -3
  25. package/dist/passport.js +4 -4
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/{webhook-BmR-m7dM.js → webhook-D7vbg188.js} +1 -1
  28. package/dist/webhook.js +2 -2
  29. package/dist/{x-DWBBH_Mv.js → x-BJQwIc3_.js} +3 -3
  30. package/dist/x.js +4 -4
  31. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { E as Environment$1, t as track, I as ImmutableConfiguration } from './index-CigMtyzV.js';
1
+ import { E as Environment$1, t as track, I as ImmutableConfiguration } from './index-BEmbEQo3.js';
2
2
  import { ethers, BigNumber as BigNumber$1, ContractFactory, utils as utils$2, Contract as Contract$1 } from 'ethers';
3
3
  import globalAxios, { HttpStatusCode as HttpStatusCode$1 } from 'axios';
4
4
  import { Web3Provider, JsonRpcProvider } from '@ethersproject/providers';
@@ -9,8 +9,8 @@ import assert from 'assert';
9
9
  import { FeeAmount, Route, SwapQuoter, Pool, Trade, toHex as toHex$1, encodeRouteToPath } from '@uniswap/v3-sdk';
10
10
  import { keccak256 as keccak256$1 } from '@ethersproject/solidity';
11
11
  import { SwapRouter, PaymentsExtended } from '@uniswap/router-sdk';
12
- import { c as constants, O as OrderStatusName, a as Orderbook, A as ActionType, T as TransactionPurpose, S as SignablePurpose } from './index-DXOmpxiv.js';
13
- import { B as BlockchainData } from './index-Cjv4ZmMK.js';
12
+ import { c as constants, O as OrderStatusName, a as Orderbook, A as ActionType, T as TransactionPurpose, S as SignablePurpose } from './index-CgFCYrSh.js';
13
+ import { B as BlockchainData } from './index-BpHMHRxz.js';
14
14
 
15
15
  function bind(fn, thisArg) {
16
16
  return function wrap() {
@@ -19154,7 +19154,7 @@ const flattenProperties = (properties) => {
19154
19154
  };
19155
19155
 
19156
19156
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
19157
- const SDK_VERSION = '1.47.6';
19157
+ const SDK_VERSION = '1.47.7';
19158
19158
  const getFrameParentDomain = () => {
19159
19159
  if (isNode()) {
19160
19160
  return '';
@@ -24518,7 +24518,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
24518
24518
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
24519
24519
  };
24520
24520
 
24521
- const SDK_VERSION_MARKER = '1.47.6';
24521
+ const SDK_VERSION_MARKER = '1.47.7';
24522
24522
  // This SDK version is replaced by the `yarn build` command ran on the root level
24523
24523
  const globalPackageVersion = () => SDK_VERSION_MARKER;
24524
24524
 
package/dist/checkout.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BlockExplorerService, a as BridgeEventType, C as ChainId, b as ChainName, d as ChainSlug, e as Checkout, f as CheckoutConfiguration, g as CheckoutErrorType, h as CheckoutEventType, i as CheckoutFailureEventType, j as CheckoutFlowType, k as CheckoutStatus, l as CheckoutSuccessEventType, m as CheckoutUserActionEventType, n as ConnectEventType, o as ConnectTargetLayer, E as ExchangeType, F as FeeType, p as FundingStepType, G as GasEstimateType, q as GasTokenType, I as IMMUTABLE_API_BASE_URL, r as IMTBLWidgetEvents, s as ItemType, N as NetworkFilterTypes, O as OnRampEventType, t as OrchestrationEventType, P as PostMessageHandler, u as PostMessageHandlerEventType, v as ProviderEventType, R as RoutingOutcomeType, S as SaleEventType, w as SalePaymentTypes, x as SwapEventType, T as TokenFilterTypes, y as TransactionOrGasType, W as WalletEventType, z as WalletFilterTypes, A as WalletProviderName, D as WalletProviderRdns, H as WidgetTheme, J as WidgetType, K as getMetaMaskProviderDetail, L as getPassportProviderDetail, M as isAddressSanctioned, Q as validateProvider } from './checkout-BBvLRxMi.js';
2
- import './index-CigMtyzV.js';
1
+ export { B as BlockExplorerService, a as BridgeEventType, C as ChainId, b as ChainName, d as ChainSlug, e as Checkout, f as CheckoutConfiguration, g as CheckoutErrorType, h as CheckoutEventType, i as CheckoutFailureEventType, j as CheckoutFlowType, k as CheckoutStatus, l as CheckoutSuccessEventType, m as CheckoutUserActionEventType, n as ConnectEventType, o as ConnectTargetLayer, E as ExchangeType, F as FeeType, p as FundingStepType, G as GasEstimateType, q as GasTokenType, I as IMMUTABLE_API_BASE_URL, r as IMTBLWidgetEvents, s as ItemType, N as NetworkFilterTypes, O as OnRampEventType, t as OrchestrationEventType, P as PostMessageHandler, u as PostMessageHandlerEventType, v as ProviderEventType, R as RoutingOutcomeType, S as SaleEventType, w as SalePaymentTypes, x as SwapEventType, T as TokenFilterTypes, y as TransactionOrGasType, W as WalletEventType, z as WalletFilterTypes, A as WalletProviderName, D as WalletProviderRdns, H as WidgetTheme, J as WidgetType, K as getMetaMaskProviderDetail, L as getPassportProviderDetail, M as isAddressSanctioned, Q as validateProvider } from './checkout-hyV1W7o_.js';
2
+ import './index-BEmbEQo3.js';
3
3
  import 'axios';
4
4
  import 'lru-memorise';
5
5
  import 'global-const';
@@ -11,10 +11,10 @@ import 'assert';
11
11
  import '@uniswap/v3-sdk';
12
12
  import '@ethersproject/solidity';
13
13
  import '@uniswap/router-sdk';
14
- import './index-DXOmpxiv.js';
14
+ import './index-CgFCYrSh.js';
15
15
  import 'form-data';
16
16
  import 'ethers-v6';
17
17
  import 'merkletreejs';
18
18
  import '@opensea/seaport-js';
19
- import './index-Cjv4ZmMK.js';
20
- import './index-D2J4NDeb.js';
19
+ import './index-BpHMHRxz.js';
20
+ import './index-CADkJAYZ.js';
@@ -1,4 +1,4 @@
1
- import { E as Environment, I as ImmutableConfiguration, K as KeyHeaders, a as addKeysToHeadersOverride } from './index-CigMtyzV.js';
1
+ import { E as Environment, I as ImmutableConfiguration, K as KeyHeaders, a as addKeysToHeadersOverride } from './index-BEmbEQo3.js';
2
2
 
3
3
  var config = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- export { E as Environment, I as ImmutableConfiguration, K as KeyHeaders, a as addKeysToHeadersOverride } from './index-CigMtyzV.js';
1
+ export { E as Environment, I as ImmutableConfiguration, K as KeyHeaders, a as addKeysToHeadersOverride } from './index-BEmbEQo3.js';
2
2
  import 'axios';
3
3
  import 'lru-memorise';
4
4
  import 'global-const';
@@ -158,7 +158,7 @@ const flattenProperties = (properties) => {
158
158
  };
159
159
 
160
160
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
161
- const SDK_VERSION = '1.47.6';
161
+ const SDK_VERSION = '1.47.7';
162
162
  const getFrameParentDomain = () => {
163
163
  if (isNode()) {
164
164
  return '';
@@ -1,5 +1,5 @@
1
- import { a as index$1 } from './index-D2J4NDeb.js';
2
- import { E as Environment, a as addKeysToHeadersOverride } from './index-CigMtyzV.js';
1
+ import { a as index$1 } from './index-CADkJAYZ.js';
2
+ import { E as Environment, a as addKeysToHeadersOverride } from './index-BEmbEQo3.js';
3
3
  import globalAxios from 'axios';
4
4
 
5
5
  /**
@@ -21,7 +21,7 @@ class APIError extends Error {
21
21
 
22
22
  /* eslint-disable implicit-arrow-linebreak */
23
23
  const defaultHeaders = {
24
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.47.6',
24
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.47.7',
25
25
  };
26
26
  /**
27
27
  * createAPIConfiguration to create a custom Configuration
@@ -13838,7 +13838,7 @@ class MultiRollupApiClients {
13838
13838
  }
13839
13839
 
13840
13840
  // eslint-disable-next-line @typescript-eslint/naming-convention
13841
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.47.6' };
13841
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.47.7' };
13842
13842
  const createConfig = ({ basePath, headers, }) => {
13843
13843
  if (!basePath.trim()) {
13844
13844
  throw Error('basePath can not be empty');
@@ -1,5 +1,5 @@
1
1
  import MessageValidator from 'sns-validator';
2
- import { E as Environment } from './index-CigMtyzV.js';
2
+ import { E as Environment } from './index-BEmbEQo3.js';
3
3
 
4
4
  const validator = new MessageValidator();
5
5
  const allowedTopicArnPrefix = {
@@ -1,9 +1,9 @@
1
+ import { t as track, E as Environment } from './index-BEmbEQo3.js';
1
2
  import globalAxios from 'axios';
2
3
  import FormData from 'form-data';
3
4
  import { providers, BigNumber, constants as constants$1 } from 'ethers';
4
5
  import { ethers, FetchRequest, JsonRpcProvider, JsonRpcSigner, keccak256, toUtf8Bytes, concat, TypedDataEncoder, zeroPadValue, toBeHex, AbiCoder } from 'ethers-v6';
5
6
  import { MerkleTree } from 'merkletreejs';
6
- import { E as Environment } from './index-CigMtyzV.js';
7
7
  import { Seaport as Seaport$1 } from '@opensea/seaport-js';
8
8
 
9
9
  class BaseHttpRequest {
@@ -1769,6 +1769,10 @@ class Orderbook {
1769
1769
  const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
1770
1770
  this.seaport = new Seaport(seaportLibFactory, this.orderbookConfig.provider, this.orderbookConfig.seaportContractAddress, this.orderbookConfig.zoneContractAddress, config.baseConfig.rateLimitingKey);
1771
1771
  }
1772
+ // Default order expiry to 2 years from now
1773
+ static defaultOrderExpiry() {
1774
+ return new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 2);
1775
+ }
1772
1776
  /**
1773
1777
  * Return the configuration for the orderbook module.
1774
1778
  * @return {OrderbookModuleConfiguration} The configuration for the orderbook module.
@@ -1829,29 +1833,36 @@ class Orderbook {
1829
1833
  * Once the transactions are submitted and the message signed, call the completeListings method
1830
1834
  * provided in the return type with the signature. This method supports up to 20 listing creations
1831
1835
  * at a time. It can also be used for individual listings to simplify integration code paths.
1836
+ *
1837
+ * Bulk listings created using an EOA (Metamask) will require a single listing confirmation
1838
+ * signature.
1839
+ * Bulk listings creating using a smart contract wallet will require multiple listing confirmation
1840
+ * signatures(as many as the number of orders).
1832
1841
  * @param {PrepareBulkListingsParams} prepareBulkListingsParams - Details about the listings
1833
1842
  * to be created.
1834
1843
  * @return {PrepareBulkListingsResponse} PrepareListingResponse includes
1835
1844
  * any unsigned approval transactions, the typed bulk order message for signing and
1836
- * the createListings method that can be called with the signature to create the listings.
1845
+ * the createListings method that can be called with the signature(s) to create the listings.
1837
1846
  */
1838
1847
  async prepareBulkListings({ makerAddress, listingParams, }) {
1839
1848
  // Limit bulk listing creation to 20 orders to prevent API and order evaluation spam
1840
1849
  if (listingParams.length > 20) {
1841
1850
  throw new Error('Bulk listing creation is limited to 20 orders');
1842
1851
  }
1852
+ // Bulk listings (with single listing) code path common for both Smart contract
1853
+ // wallets and EOAs.
1843
1854
  // In the event of a single order, delegate to prepareListing as the signature is more
1844
1855
  // gas efficient
1845
1856
  if (listingParams.length === 1) {
1846
- const prepareListingResponse = await this.seaport.prepareSeaportOrder(makerAddress, listingParams[0].sell, listingParams[0].buy, new Date(), listingParams[0].orderExpiry || new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 2));
1857
+ const prepareListingResponse = await this.seaport.prepareSeaportOrder(makerAddress, listingParams[0].sell, listingParams[0].buy, new Date(), listingParams[0].orderExpiry || Orderbook.defaultOrderExpiry());
1847
1858
  return {
1848
1859
  actions: prepareListingResponse.actions,
1849
- completeListings: async (signature) => {
1860
+ completeListings: async (signatures) => {
1850
1861
  const createListingResult = await this.createListing({
1851
1862
  makerFees: listingParams[0].makerFees,
1852
1863
  orderComponents: prepareListingResponse.orderComponents,
1853
1864
  orderHash: prepareListingResponse.orderHash,
1854
- orderSignature: signature,
1865
+ orderSignature: typeof signatures === 'string' ? signatures : signatures[0],
1855
1866
  });
1856
1867
  return {
1857
1868
  result: [{
@@ -1863,19 +1874,82 @@ class Orderbook {
1863
1874
  },
1864
1875
  };
1865
1876
  }
1877
+ // Bulk listings (with multiple listings) code path for Smart contract wallets.
1878
+ // Code check to determine wallet type is not fool-proof but scenarios where smart
1879
+ // contract wallet is not deployed will be an edge case
1880
+ const isSmartContractWallet = await this.orderbookConfig.provider.getCode(makerAddress) !== '0x';
1881
+ if (isSmartContractWallet) {
1882
+ track('orderbookmr', 'bulkListings', { walletType: 'Passport', makerAddress, listingsCount: listingParams.length });
1883
+ // eslint-disable-next-line max-len
1884
+ const prepareListingResponses = await Promise.all(listingParams.map((listing) => this.seaport.prepareSeaportOrder(makerAddress, listing.sell, listing.buy, new Date(), listing.orderExpiry || Orderbook.defaultOrderExpiry())));
1885
+ const pendingApproval = [];
1886
+ const actions = prepareListingResponses.flatMap((response) => {
1887
+ // de-dupe approval transactions to ensure every contract has
1888
+ // a maximum of 1 approval transaction
1889
+ const dedupedActions = [];
1890
+ response.actions.forEach((action) => {
1891
+ if (action.type === ActionType.TRANSACTION) {
1892
+ // Assuming only a single item is on offer per listing
1893
+ const contractAddress = response.orderComponents.offer[0].token;
1894
+ if (!pendingApproval.includes(contractAddress)) {
1895
+ pendingApproval.push(contractAddress);
1896
+ dedupedActions.push(action);
1897
+ }
1898
+ }
1899
+ else {
1900
+ dedupedActions.push(action);
1901
+ }
1902
+ });
1903
+ return dedupedActions;
1904
+ });
1905
+ return {
1906
+ actions,
1907
+ completeListings: async (signatures) => {
1908
+ const signatureIsString = typeof signatures === 'string';
1909
+ if (signatureIsString) {
1910
+ throw new Error('A signature per listing must be provided for smart contract wallets');
1911
+ }
1912
+ const createListingsApiResponses = await Promise.all(prepareListingResponses.map((prepareListingResponse, i) => {
1913
+ const signature = signatures[i];
1914
+ return this.apiClient.createListing({
1915
+ makerFees: listingParams[i].makerFees,
1916
+ orderComponents: prepareListingResponse.orderComponents,
1917
+ orderHash: prepareListingResponse.orderHash,
1918
+ orderSignature: signature,
1919
+ // Swallow failed creations,this gets mapped in the response to the caller as failed
1920
+ }).catch(() => undefined);
1921
+ }));
1922
+ return {
1923
+ result: createListingsApiResponses.map((apiListingResponse, i) => ({
1924
+ success: !!apiListingResponse,
1925
+ orderHash: prepareListingResponses[i].orderHash,
1926
+ // eslint-disable-next-line max-len
1927
+ order: apiListingResponse ? mapFromOpenApiOrder(apiListingResponse.result) : undefined,
1928
+ })),
1929
+ };
1930
+ },
1931
+ };
1932
+ }
1933
+ // Bulk listings (with multiple listings) code path for EOA wallets.
1934
+ track('orderbookmr', 'bulkListings', { walletType: 'EOA', makerAddress, listingsCount: listingParams.length });
1866
1935
  const { actions, preparedListings } = await this.seaport.prepareBulkSeaportOrders(makerAddress, listingParams.map((orderParam) => ({
1867
1936
  listingItem: orderParam.sell,
1868
1937
  considerationItem: orderParam.buy,
1869
1938
  orderStart: new Date(),
1870
- orderExpiry: orderParam.orderExpiry || new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 2),
1939
+ orderExpiry: orderParam.orderExpiry || Orderbook.defaultOrderExpiry(),
1871
1940
  })));
1872
1941
  return {
1873
1942
  actions,
1874
- completeListings: async (bulkOrderSignature) => {
1943
+ completeListings: async (signatures) => {
1944
+ const signatureIsArray = typeof signatures === 'object';
1945
+ if (signatureIsArray && signatures.length !== 1) {
1946
+ throw new Error('Only a single signature is expected for bulk listing creation');
1947
+ }
1875
1948
  const orderComponents = preparedListings.map((orderParam) => orderParam.orderComponents);
1876
- const signatures = getBulkSeaportOrderSignatures(bulkOrderSignature, orderComponents);
1949
+ const signature = signatureIsArray ? signatures[0] : signatures;
1950
+ const bulkOrderSignatures = getBulkSeaportOrderSignatures(signature, orderComponents);
1877
1951
  const createOrdersApiListingResponse = await Promise.all(orderComponents.map((orderComponent, i) => {
1878
- const sig = signatures[i];
1952
+ const sig = bulkOrderSignatures[i];
1879
1953
  const listing = preparedListings[i];
1880
1954
  const listingParam = listingParams[i];
1881
1955
  return this.apiClient.createListing({
@@ -1909,7 +1983,7 @@ class Orderbook {
1909
1983
  // Default order start to now
1910
1984
  new Date(),
1911
1985
  // Default order expiry to 2 years from now
1912
- orderExpiry || new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 2));
1986
+ orderExpiry || Orderbook.defaultOrderExpiry());
1913
1987
  }
1914
1988
  /**
1915
1989
  * Create an order
@@ -1,5 +1,5 @@
1
- import { b as index$2, I as ImxApiClients } from './index-D2J4NDeb.js';
2
- import { a as addKeysToHeadersOverride, E as Environment, I as ImmutableConfiguration } from './index-CigMtyzV.js';
1
+ import { b as index$2, I as ImxApiClients } from './index-CADkJAYZ.js';
2
+ import { a as addKeysToHeadersOverride, E as Environment, I as ImmutableConfiguration } from './index-BEmbEQo3.js';
3
3
  import globalAxios from 'axios';
4
4
  import { keccak256 } from '@ethersproject/keccak256';
5
5
  import { toUtf8Bytes } from '@ethersproject/strings';
@@ -16,7 +16,7 @@ import '@ethersproject/abstract-signer';
16
16
  /* eslint-disable @typescript-eslint/naming-convention */
17
17
  class ApiConfiguration extends index$2.Configuration {
18
18
  }
19
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.47.6' };
19
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.47.7' };
20
20
  /**
21
21
  * @dev use createImmutableXConfiguration instead
22
22
  */
@@ -57,7 +57,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
57
57
  coreContractAddress,
58
58
  registrationContractAddress,
59
59
  registrationV4ContractAddress,
60
- sdkVersion: 'ts-immutable-sdk-1.47.6',
60
+ sdkVersion: 'ts-immutable-sdk-1.47.7',
61
61
  baseConfig,
62
62
  });
63
63
  const production = ({ baseConfig }) => createImmutableXConfiguration({