@imtbl/sdk 0.20.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -724,8 +724,8 @@ declare namespace Fee$1 {
724
724
  */
725
725
  enum fee_type {
726
726
  ROYALTY = "ROYALTY",
727
- MAKER_MARKETPLACE = "MAKER_MARKETPLACE",
728
- TAKER_MARKETPLACE = "TAKER_MARKETPLACE",
727
+ MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
728
+ TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
729
729
  PROTOCOL = "PROTOCOL"
730
730
  }
731
731
  }
@@ -818,7 +818,7 @@ type CreateListingRequestBody = {
818
818
  /**
819
819
  * Time after which the Order is considered expired
820
820
  */
821
- end_time: string;
821
+ end_at: string;
822
822
  protocol_data: ProtocolData;
823
823
  /**
824
824
  * A random value added to the create Order request
@@ -835,7 +835,7 @@ type CreateListingRequestBody = {
835
835
  /**
836
836
  * Time after which Order is considered active
837
837
  */
838
- start_time: string;
838
+ start_at: string;
839
839
  };
840
840
 
841
841
  type FulfillmentDataRequest = {
@@ -877,11 +877,11 @@ type Order$1 = {
877
877
  /**
878
878
  * Time the Order is created
879
879
  */
880
- create_time: string;
880
+ created_at: string;
881
881
  /**
882
882
  * Time after which the Order is considered expired
883
883
  */
884
- end_time: string;
884
+ end_at: string;
885
885
  /**
886
886
  * Global Order identifier
887
887
  */
@@ -899,12 +899,12 @@ type Order$1 = {
899
899
  /**
900
900
  * Time after which Order is considered active
901
901
  */
902
- start_time: string;
902
+ start_at: string;
903
903
  status: OrderStatus;
904
904
  /**
905
905
  * Time the Order is last updated
906
906
  */
907
- update_time: string;
907
+ updated_at: string;
908
908
  };
909
909
 
910
910
  type FulfillmentDataResult = {
@@ -1092,7 +1092,7 @@ declare class OrdersService {
1092
1092
  /**
1093
1093
  * Trade field to sort by
1094
1094
  */
1095
- sortBy?: 'created_at';
1095
+ sortBy?: 'indexed_at';
1096
1096
  /**
1097
1097
  * Ascending or descending direction for sort
1098
1098
  */
@@ -1155,8 +1155,8 @@ interface CreateListingParams {
1155
1155
  type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
1156
1156
  type ListTradesParams = Omit<Parameters<typeof OrdersService.prototype.listTrades>[0], 'chainName'>;
1157
1157
  declare enum FeeType {
1158
- MAKER_MARKETPLACE = "MAKER_MARKETPLACE",
1159
- TAKER_MARKETPLACE = "TAKER_MARKETPLACE",
1158
+ MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
1159
+ TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
1160
1160
  PROTOCOL = "PROTOCOL",
1161
1161
  ROYALTY = "ROYALTY"
1162
1162
  }
@@ -1216,16 +1216,16 @@ interface Order {
1216
1216
  id: string;
1217
1217
  name: string;
1218
1218
  };
1219
- createTime: string;
1220
- updateTime: string;
1219
+ createdAt: string;
1220
+ updatedAt: string;
1221
1221
  /**
1222
1222
  * Time after which the Order is considered active
1223
1223
  */
1224
- startTime: string;
1224
+ startAt: string;
1225
1225
  /**
1226
1226
  * Time after which the Order is expired
1227
1227
  */
1228
- endTime: string;
1228
+ endAt: string;
1229
1229
  protocolData: {
1230
1230
  orderType: 'FULL_RESTRICTED';
1231
1231
  zoneAddress: string;
package/dist/orderbook.js CHANGED
@@ -569,8 +569,8 @@ var Fee;
569
569
  (function (Fee) {
570
570
  (function (fee_type) {
571
571
  fee_type["ROYALTY"] = "ROYALTY";
572
- fee_type["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
573
- fee_type["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
572
+ fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
573
+ fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
574
574
  fee_type["PROTOCOL"] = "PROTOCOL";
575
575
  })(Fee.fee_type || (Fee.fee_type = {}));
576
576
  })(Fee || (Fee = {}));
@@ -603,8 +603,8 @@ var ProtocolData;
603
603
 
604
604
  var FeeType;
605
605
  (function (FeeType) {
606
- FeeType["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
607
- FeeType["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
606
+ FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
607
+ FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
608
608
  FeeType["PROTOCOL"] = "PROTOCOL";
609
609
  FeeType["ROYALTY"] = "ROYALTY";
610
610
  })(FeeType || (FeeType = {}));
@@ -661,8 +661,8 @@ function mapFromOpenApiOrder(order) {
661
661
  type: fee.fee_type,
662
662
  })),
663
663
  chain: order.chain,
664
- createTime: order.create_time,
665
- endTime: order.end_time,
664
+ createdAt: order.created_at,
665
+ endAt: order.end_at,
666
666
  protocolData: {
667
667
  counter: order.protocol_data.counter,
668
668
  orderType: order.protocol_data.order_type,
@@ -672,9 +672,9 @@ function mapFromOpenApiOrder(order) {
672
672
  },
673
673
  salt: order.salt,
674
674
  signature: order.signature,
675
- startTime: order.start_time,
675
+ startAt: order.start_at,
676
676
  status: order.status,
677
- updateTime: order.update_time,
677
+ updatedAt: order.updated_at,
678
678
  };
679
679
  }
680
680
  function mapFromOpenApiTrade(trade) {
@@ -877,8 +877,8 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
877
877
  };
878
878
  }),
879
879
  counter,
880
- endTime: Math.round(new Date(order.end_time).getTime() / 1000).toString(),
881
- startTime: Math.round(new Date(order.start_time).getTime() / 1000).toString(),
880
+ endTime: Math.round(new Date(order.end_at).getTime() / 1000).toString(),
881
+ startTime: Math.round(new Date(order.start_at).getTime() / 1000).toString(),
882
882
  salt: order.salt,
883
883
  offerer: order.account_address,
884
884
  zone: zoneAddress,
@@ -1106,10 +1106,10 @@ class ImmutableApiClient {
1106
1106
  ],
1107
1107
  fees: makerFees.map((x) => ({
1108
1108
  amount: x.amount,
1109
- fee_type: FeeType.MAKER_MARKETPLACE,
1109
+ fee_type: FeeType.MAKER_ECOSYSTEM,
1110
1110
  recipient: x.recipient,
1111
1111
  })),
1112
- end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
1112
+ end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
1113
1113
  protocol_data: {
1114
1114
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
1115
1115
  zone_address: orderComponents.zone,
@@ -1126,7 +1126,7 @@ class ImmutableApiClient {
1126
1126
  },
1127
1127
  ],
1128
1128
  signature: orderSignature,
1129
- start_time: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
1129
+ start_at: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
1130
1130
  },
1131
1131
  });
1132
1132
  }
@@ -1319,7 +1319,7 @@ class Orderbook {
1319
1319
  order_id: listingId,
1320
1320
  fees: takerFees.map((fee) => ({
1321
1321
  amount: fee.amount,
1322
- fee_type: FeeType.TAKER_MARKETPLACE,
1322
+ fee_type: FeeType.TAKER_ECOSYSTEM,
1323
1323
  recipient: fee.recipient,
1324
1324
  })),
1325
1325
  },
package/dist/passport.js CHANGED
@@ -178,6 +178,18 @@ const assertParamExists$1 = function (functionName, paramName, paramValue) {
178
178
  throw new RequiredError$1(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
179
179
  }
180
180
  };
181
+ /**
182
+ *
183
+ * @export
184
+ */
185
+ const setApiKeyToObject = async function (object, keyParamName, configuration) {
186
+ if (configuration && configuration.apiKey) {
187
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
188
+ ? await configuration.apiKey(keyParamName)
189
+ : await configuration.apiKey;
190
+ object[keyParamName] = localVarApiKeyValue;
191
+ }
192
+ };
181
193
  /**
182
194
  *
183
195
  * @export
@@ -668,6 +680,46 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
668
680
  options: localVarRequestOptions,
669
681
  };
670
682
  },
683
+ /**
684
+ * Refresh collection metadata
685
+ * @summary Refresh collection metadata
686
+ * @param {string} contractAddress The address contract
687
+ * @param {string} chainName The name of chain
688
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
689
+ * @param {*} [options] Override http request option.
690
+ * @throws {RequiredError}
691
+ */
692
+ refreshCollectionMetadata: async (contractAddress, chainName, refreshCollectionMetadataRequest, options = {}) => {
693
+ // verify required parameter 'contractAddress' is not null or undefined
694
+ assertParamExists$1('refreshCollectionMetadata', 'contractAddress', contractAddress);
695
+ // verify required parameter 'chainName' is not null or undefined
696
+ assertParamExists$1('refreshCollectionMetadata', 'chainName', chainName);
697
+ // verify required parameter 'refreshCollectionMetadataRequest' is not null or undefined
698
+ assertParamExists$1('refreshCollectionMetadata', 'refreshCollectionMetadataRequest', refreshCollectionMetadataRequest);
699
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata`
700
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
701
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
702
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
703
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
704
+ let baseOptions;
705
+ if (configuration) {
706
+ baseOptions = configuration.baseOptions;
707
+ }
708
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
709
+ const localVarHeaderParameter = {};
710
+ const localVarQueryParameter = {};
711
+ // authentication ImmutableApiKey required
712
+ await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
713
+ localVarHeaderParameter['Content-Type'] = 'application/json';
714
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
715
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
716
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
717
+ localVarRequestOptions.data = serializeDataIfNeeded$1(refreshCollectionMetadataRequest, localVarRequestOptions, configuration);
718
+ return {
719
+ url: toPathString$1(localVarUrlObj),
720
+ options: localVarRequestOptions,
721
+ };
722
+ },
671
723
  };
672
724
  };
673
725
  /**
@@ -716,6 +768,19 @@ const CollectionsApiFp = function (configuration) {
716
768
  const localVarAxiosArgs = await localVarAxiosParamCreator.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options);
717
769
  return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
718
770
  },
771
+ /**
772
+ * Refresh collection metadata
773
+ * @summary Refresh collection metadata
774
+ * @param {string} contractAddress The address contract
775
+ * @param {string} chainName The name of chain
776
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
777
+ * @param {*} [options] Override http request option.
778
+ * @throws {RequiredError}
779
+ */
780
+ async refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
781
+ const localVarAxiosArgs = await localVarAxiosParamCreator.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options);
782
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
783
+ },
719
784
  };
720
785
  };
721
786
  /**
@@ -758,6 +823,17 @@ class CollectionsApi extends BaseAPI$1 {
758
823
  listCollectionsByNFTOwner(requestParameters, options) {
759
824
  return CollectionsApiFp(this.configuration).listCollectionsByNFTOwner(requestParameters.accountAddress, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
760
825
  }
826
+ /**
827
+ * Refresh collection metadata
828
+ * @summary Refresh collection metadata
829
+ * @param {CollectionsApiRefreshCollectionMetadataRequest} requestParameters Request parameters.
830
+ * @param {*} [options] Override http request option.
831
+ * @throws {RequiredError}
832
+ * @memberof CollectionsApi
833
+ */
834
+ refreshCollectionMetadata(requestParameters, options) {
835
+ return CollectionsApiFp(this.configuration).refreshCollectionMetadata(requestParameters.contractAddress, requestParameters.chainName, requestParameters.refreshCollectionMetadataRequest, options).then((request) => request(this.axios, this.basePath));
836
+ }
761
837
  }
762
838
 
763
839
  /* tslint:disable */
@@ -1327,7 +1403,7 @@ const OrdersApiAxiosParamCreator = function (configuration) {
1327
1403
  * @param {string} chainName
1328
1404
  * @param {string} [accountAddress]
1329
1405
  * @param {number} [pageSize] Maximum number of trades to return per page
1330
- * @param {'created_at'} [sortBy] Trade field to sort by
1406
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1331
1407
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1332
1408
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1333
1409
  * @param {*} [options] Override http request option.
@@ -1452,7 +1528,7 @@ const OrdersApiFp = function (configuration) {
1452
1528
  * @param {string} chainName
1453
1529
  * @param {string} [accountAddress]
1454
1530
  * @param {number} [pageSize] Maximum number of trades to return per page
1455
- * @param {'created_at'} [sortBy] Trade field to sort by
1531
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1456
1532
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1457
1533
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1458
1534
  * @param {*} [options] Override http request option.
@@ -1709,7 +1785,7 @@ class MultiRollupApiClients {
1709
1785
  }
1710
1786
 
1711
1787
  // eslint-disable-next-line @typescript-eslint/naming-convention
1712
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.20.1' };
1788
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.22.0' };
1713
1789
  const createConfig = ({ basePath, headers, }) => {
1714
1790
  if (!basePath.trim()) {
1715
1791
  throw Error('basePath can not be empty');
@@ -1765,7 +1841,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
1765
1841
  chainID,
1766
1842
  coreContractAddress,
1767
1843
  registrationContractAddress,
1768
- sdkVersion: 'ts-immutable-sdk-0.20.1',
1844
+ sdkVersion: 'ts-immutable-sdk-0.22.0',
1769
1845
  });
1770
1846
  /**
1771
1847
  * Sets `sdkVersion` at the time of build
@@ -7506,6 +7582,7 @@ var ReceiveMessage;
7506
7582
  ReceiveMessage["TRANSACTION_ERROR"] = "transaction_error";
7507
7583
  ReceiveMessage["MESSAGE_CONFIRMED"] = "message_confirmed";
7508
7584
  ReceiveMessage["MESSAGE_REJECTED"] = "message_rejected";
7585
+ ReceiveMessage["LOGOUT_SUCCESS"] = "logout_success";
7509
7586
  })(ReceiveMessage || (ReceiveMessage = {}));
7510
7587
  const PASSPORT_EVENT_TYPE = 'imx_passport_confirmation';
7511
7588
 
@@ -7530,6 +7607,8 @@ const CONFIRMATION_WINDOW_TITLE = 'Confirm this transaction';
7530
7607
  const CONFIRMATION_WINDOW_HEIGHT = 380;
7531
7608
  const CONFIRMATION_WINDOW_WIDTH = 480;
7532
7609
  const CONFIRMATION_WINDOW_CLOSED_POLLING_DURATION = 1000;
7610
+ const CONFIRMATION_IFRAME_ID = 'passport-confirm';
7611
+ const CONFIRMATION_IFRAME_STYLE = 'display: none; position: absolute;width:0px;height:0px;border:0;';
7533
7612
  class ConfirmationScreen {
7534
7613
  config;
7535
7614
  confirmationWindow;
@@ -7623,6 +7702,28 @@ class ConfirmationScreen {
7623
7702
  closeWindow() {
7624
7703
  this.confirmationWindow?.close();
7625
7704
  }
7705
+ logout() {
7706
+ return new Promise((resolve, rejects) => {
7707
+ const iframe = document.createElement('iframe');
7708
+ iframe.setAttribute('id', CONFIRMATION_IFRAME_ID);
7709
+ iframe.setAttribute('src', `${this.config.passportDomain}/transaction-confirmation/logout`);
7710
+ iframe.setAttribute('style', CONFIRMATION_IFRAME_STYLE);
7711
+ const logoutHandler = ({ data, origin }) => {
7712
+ if (origin !== this.config.passportDomain
7713
+ || data.eventType !== PASSPORT_EVENT_TYPE) {
7714
+ return;
7715
+ }
7716
+ window.removeEventListener('message', logoutHandler);
7717
+ iframe.remove();
7718
+ if (data.messageType === ReceiveMessage.LOGOUT_SUCCESS) {
7719
+ resolve({ logout: true });
7720
+ }
7721
+ rejects(new Error('Unsupported logout type'));
7722
+ };
7723
+ window.addEventListener('message', logoutHandler);
7724
+ document.body.appendChild(iframe);
7725
+ });
7726
+ }
7626
7727
  showConfirmationScreen(href, messageHandler, resolve) {
7627
7728
  this.confirmationWindow.location.href = href;
7628
7729
  // https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
@@ -7968,7 +8069,11 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
7968
8069
  RelayerTransactionStatus.SUBMITTED,
7969
8070
  RelayerTransactionStatus.SUCCESSFUL,
7970
8071
  ].includes(relayerTransaction.status)) {
7971
- throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, `Transaction failed to submit with status ${relayerTransaction.status}`);
8072
+ let errorMessage = `Transaction failed to submit with status ${relayerTransaction.status}.`;
8073
+ if (relayerTransaction.statusMessage) {
8074
+ errorMessage += ` Error message: ${relayerTransaction.statusMessage}`;
8075
+ }
8076
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, errorMessage);
7972
8077
  }
7973
8078
  return relayerTransaction.hash;
7974
8079
  });
@@ -8318,6 +8423,7 @@ class Passport {
8318
8423
  }
8319
8424
  async logout() {
8320
8425
  await this.authManager.logout();
8426
+ await this.confirmationScreen.logout();
8321
8427
  // Code after this point is only executed if the logout mode is silent
8322
8428
  await this.magicAdapter.logout();
8323
8429
  this.passportEventEmitter.emit(PassportEvents.LOGGED_OUT);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.20.1",
4
+ "version": "0.22.0",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
@@ -10,8 +10,6 @@
10
10
  "@0xsequence/config": "^0.43.34",
11
11
  "@ethersproject/abi": "^5.7.0",
12
12
  "@ethersproject/abstract-signer": "^5.7.0",
13
- "@ethersproject/bignumber": "^5.7.0",
14
- "@ethersproject/contracts": "^5.7.0",
15
13
  "@ethersproject/providers": "^5.7.2",
16
14
  "@ethersproject/wallet": "^5.7.0",
17
15
  "@imtbl/core-sdk": "^2.0.2",
@@ -27,8 +25,7 @@
27
25
  "enc-utils": "^3.0.0",
28
26
  "ethers": "^5.7.2",
29
27
  "magic-sdk": "^13.3.1",
30
- "oidc-client-ts": "^2.2.1",
31
- "typechain": "^8.1.1"
28
+ "oidc-client-ts": "^2.2.1"
32
29
  },
33
30
  "devDependencies": {
34
31
  "@imtbl/blockchain-data": "0.0.0",
@@ -36,9 +33,6 @@
36
33
  "@imtbl/checkout-widgets": "0.0.0",
37
34
  "@imtbl/config": "0.0.0",
38
35
  "@imtbl/cryptofiat": "0.0.0",
39
- "@imtbl/erc20": "0.0.0",
40
- "@imtbl/erc721": "0.0.0",
41
- "@imtbl/erc721-mint-by-id": "0.0.0",
42
36
  "@imtbl/generated-clients": "0.0.0",
43
37
  "@imtbl/guardian": "0.0.0",
44
38
  "@imtbl/immutablex-client": "0.0.0",
@@ -103,18 +97,6 @@
103
97
  "./checkout_widgets": {
104
98
  "types": "./dist/checkout_widgets.d.ts",
105
99
  "import": "./dist/checkout_widgets.js"
106
- },
107
- "./erc20": {
108
- "types": "./dist/erc20.d.ts",
109
- "import": "./dist/erc20.js"
110
- },
111
- "./erc721": {
112
- "types": "./dist/erc721.d.ts",
113
- "import": "./dist/erc721.js"
114
- },
115
- "./erc721_mint_by_id": {
116
- "types": "./dist/erc721_mint_by_id.d.ts",
117
- "import": "./dist/erc721_mint_by_id.js"
118
100
  }
119
101
  },
120
102
  "files": [