@imtbl/sdk 0.19.0-alpha → 0.20.1-alpha.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
@@ -211,6 +211,18 @@ const assertParamExists$1 = function (functionName, paramName, paramValue) {
211
211
  throw new RequiredError$1(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
212
212
  }
213
213
  };
214
+ /**
215
+ *
216
+ * @export
217
+ */
218
+ const setApiKeyToObject = async function (object, keyParamName, configuration) {
219
+ if (configuration && configuration.apiKey) {
220
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
221
+ ? await configuration.apiKey(keyParamName)
222
+ : await configuration.apiKey;
223
+ object[keyParamName] = localVarApiKeyValue;
224
+ }
225
+ };
214
226
  /**
215
227
  *
216
228
  * @export
@@ -760,6 +772,46 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
760
772
  options: localVarRequestOptions,
761
773
  };
762
774
  },
775
+ /**
776
+ * Refresh collection metadata
777
+ * @summary Refresh collection metadata
778
+ * @param {string} contractAddress The address contract
779
+ * @param {string} chainName The name of chain
780
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
781
+ * @param {*} [options] Override http request option.
782
+ * @throws {RequiredError}
783
+ */
784
+ refreshCollectionMetadata: async (contractAddress, chainName, refreshCollectionMetadataRequest, options = {}) => {
785
+ // verify required parameter 'contractAddress' is not null or undefined
786
+ assertParamExists$1('refreshCollectionMetadata', 'contractAddress', contractAddress);
787
+ // verify required parameter 'chainName' is not null or undefined
788
+ assertParamExists$1('refreshCollectionMetadata', 'chainName', chainName);
789
+ // verify required parameter 'refreshCollectionMetadataRequest' is not null or undefined
790
+ assertParamExists$1('refreshCollectionMetadata', 'refreshCollectionMetadataRequest', refreshCollectionMetadataRequest);
791
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata`
792
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
793
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
794
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
795
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
796
+ let baseOptions;
797
+ if (configuration) {
798
+ baseOptions = configuration.baseOptions;
799
+ }
800
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
801
+ const localVarHeaderParameter = {};
802
+ const localVarQueryParameter = {};
803
+ // authentication ImmutableApiKey required
804
+ await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
805
+ localVarHeaderParameter['Content-Type'] = 'application/json';
806
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
807
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
808
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
809
+ localVarRequestOptions.data = serializeDataIfNeeded$1(refreshCollectionMetadataRequest, localVarRequestOptions, configuration);
810
+ return {
811
+ url: toPathString$1(localVarUrlObj),
812
+ options: localVarRequestOptions,
813
+ };
814
+ },
763
815
  };
764
816
  };
765
817
  /**
@@ -808,6 +860,19 @@ const CollectionsApiFp = function (configuration) {
808
860
  const localVarAxiosArgs = await localVarAxiosParamCreator.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options);
809
861
  return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
810
862
  },
863
+ /**
864
+ * Refresh collection metadata
865
+ * @summary Refresh collection metadata
866
+ * @param {string} contractAddress The address contract
867
+ * @param {string} chainName The name of chain
868
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
869
+ * @param {*} [options] Override http request option.
870
+ * @throws {RequiredError}
871
+ */
872
+ async refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
873
+ const localVarAxiosArgs = await localVarAxiosParamCreator.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options);
874
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
875
+ },
811
876
  };
812
877
  };
813
878
  /**
@@ -853,6 +918,18 @@ const CollectionsApiFactory = function (configuration, basePath, axios) {
853
918
  listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options) {
854
919
  return localVarFp.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options).then((request) => request(axios, basePath));
855
920
  },
921
+ /**
922
+ * Refresh collection metadata
923
+ * @summary Refresh collection metadata
924
+ * @param {string} contractAddress The address contract
925
+ * @param {string} chainName The name of chain
926
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
927
+ * @param {*} [options] Override http request option.
928
+ * @throws {RequiredError}
929
+ */
930
+ refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
931
+ return localVarFp.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options).then((request) => request(axios, basePath));
932
+ },
856
933
  };
857
934
  };
858
935
  /**
@@ -895,6 +972,210 @@ class CollectionsApi extends BaseAPI$1 {
895
972
  listCollectionsByNFTOwner(requestParameters, options) {
896
973
  return CollectionsApiFp(this.configuration).listCollectionsByNFTOwner(requestParameters.accountAddress, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
897
974
  }
975
+ /**
976
+ * Refresh collection metadata
977
+ * @summary Refresh collection metadata
978
+ * @param {CollectionsApiRefreshCollectionMetadataRequest} requestParameters Request parameters.
979
+ * @param {*} [options] Override http request option.
980
+ * @throws {RequiredError}
981
+ * @memberof CollectionsApi
982
+ */
983
+ refreshCollectionMetadata(requestParameters, options) {
984
+ return CollectionsApiFp(this.configuration).refreshCollectionMetadata(requestParameters.contractAddress, requestParameters.chainName, requestParameters.refreshCollectionMetadataRequest, options).then((request) => request(this.axios, this.basePath));
985
+ }
986
+ }
987
+
988
+ /* tslint:disable */
989
+ /* eslint-disable */
990
+ /**
991
+ * Immutable zkEVM API
992
+ * Immutable Multi Rollup API
993
+ *
994
+ * The version of the OpenAPI document: 1.0.0
995
+ * Contact: support@immutable.com
996
+ *
997
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
998
+ * https://openapi-generator.tech
999
+ * Do not edit the class manually.
1000
+ */
1001
+ /**
1002
+ * MetadataApi - axios parameter creator
1003
+ * @export
1004
+ */
1005
+ const MetadataApiAxiosParamCreator = function (configuration) {
1006
+ return {
1007
+ /**
1008
+ * Get a single metadata by ID
1009
+ * @summary Get a single metadata by ID
1010
+ * @param {string} chainName The name of chain
1011
+ * @param {string} contractAddress The address of metadata contract
1012
+ * @param {string} metadataId The id of the metadata
1013
+ * @param {*} [options] Override http request option.
1014
+ * @throws {RequiredError}
1015
+ */
1016
+ getMetadata: async (chainName, contractAddress, metadataId, options = {}) => {
1017
+ // verify required parameter 'chainName' is not null or undefined
1018
+ assertParamExists$1('getMetadata', 'chainName', chainName);
1019
+ // verify required parameter 'contractAddress' is not null or undefined
1020
+ assertParamExists$1('getMetadata', 'contractAddress', contractAddress);
1021
+ // verify required parameter 'metadataId' is not null or undefined
1022
+ assertParamExists$1('getMetadata', 'metadataId', metadataId);
1023
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/metadata/{metadata_id}`
1024
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
1025
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
1026
+ .replace(`{${"metadata_id"}}`, encodeURIComponent(String(metadataId)));
1027
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1028
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
1029
+ let baseOptions;
1030
+ if (configuration) {
1031
+ baseOptions = configuration.baseOptions;
1032
+ }
1033
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
1034
+ const localVarHeaderParameter = {};
1035
+ const localVarQueryParameter = {};
1036
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
1037
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1038
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1039
+ return {
1040
+ url: toPathString$1(localVarUrlObj),
1041
+ options: localVarRequestOptions,
1042
+ };
1043
+ },
1044
+ /**
1045
+ * Refresh shared metadata for a collection
1046
+ * @param {string} chainName The name of chain
1047
+ * @param {string} contractAddress Contract address
1048
+ * @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
1049
+ * @param {*} [options] Override http request option.
1050
+ * @throws {RequiredError}
1051
+ */
1052
+ refreshMetadataByID: async (chainName, contractAddress, refreshMetadataByIDRequest, options = {}) => {
1053
+ // verify required parameter 'chainName' is not null or undefined
1054
+ assertParamExists$1('refreshMetadataByID', 'chainName', chainName);
1055
+ // verify required parameter 'contractAddress' is not null or undefined
1056
+ assertParamExists$1('refreshMetadataByID', 'contractAddress', contractAddress);
1057
+ // verify required parameter 'refreshMetadataByIDRequest' is not null or undefined
1058
+ assertParamExists$1('refreshMetadataByID', 'refreshMetadataByIDRequest', refreshMetadataByIDRequest);
1059
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/metadata/refresh-metadata`
1060
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
1061
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)));
1062
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1063
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
1064
+ let baseOptions;
1065
+ if (configuration) {
1066
+ baseOptions = configuration.baseOptions;
1067
+ }
1068
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1069
+ const localVarHeaderParameter = {};
1070
+ const localVarQueryParameter = {};
1071
+ // authentication ImmutableApiKey required
1072
+ await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
1073
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1074
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
1075
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1076
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1077
+ localVarRequestOptions.data = serializeDataIfNeeded$1(refreshMetadataByIDRequest, localVarRequestOptions, configuration);
1078
+ return {
1079
+ url: toPathString$1(localVarUrlObj),
1080
+ options: localVarRequestOptions,
1081
+ };
1082
+ },
1083
+ };
1084
+ };
1085
+ /**
1086
+ * MetadataApi - functional programming interface
1087
+ * @export
1088
+ */
1089
+ const MetadataApiFp = function (configuration) {
1090
+ const localVarAxiosParamCreator = MetadataApiAxiosParamCreator(configuration);
1091
+ return {
1092
+ /**
1093
+ * Get a single metadata by ID
1094
+ * @summary Get a single metadata by ID
1095
+ * @param {string} chainName The name of chain
1096
+ * @param {string} contractAddress The address of metadata contract
1097
+ * @param {string} metadataId The id of the metadata
1098
+ * @param {*} [options] Override http request option.
1099
+ * @throws {RequiredError}
1100
+ */
1101
+ async getMetadata(chainName, contractAddress, metadataId, options) {
1102
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getMetadata(chainName, contractAddress, metadataId, options);
1103
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
1104
+ },
1105
+ /**
1106
+ * Refresh shared metadata for a collection
1107
+ * @param {string} chainName The name of chain
1108
+ * @param {string} contractAddress Contract address
1109
+ * @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
1110
+ * @param {*} [options] Override http request option.
1111
+ * @throws {RequiredError}
1112
+ */
1113
+ async refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
1114
+ const localVarAxiosArgs = await localVarAxiosParamCreator.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options);
1115
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
1116
+ },
1117
+ };
1118
+ };
1119
+ /**
1120
+ * MetadataApi - factory interface
1121
+ * @export
1122
+ */
1123
+ const MetadataApiFactory = function (configuration, basePath, axios) {
1124
+ const localVarFp = MetadataApiFp(configuration);
1125
+ return {
1126
+ /**
1127
+ * Get a single metadata by ID
1128
+ * @summary Get a single metadata by ID
1129
+ * @param {string} chainName The name of chain
1130
+ * @param {string} contractAddress The address of metadata contract
1131
+ * @param {string} metadataId The id of the metadata
1132
+ * @param {*} [options] Override http request option.
1133
+ * @throws {RequiredError}
1134
+ */
1135
+ getMetadata(chainName, contractAddress, metadataId, options) {
1136
+ return localVarFp.getMetadata(chainName, contractAddress, metadataId, options).then((request) => request(axios, basePath));
1137
+ },
1138
+ /**
1139
+ * Refresh shared metadata for a collection
1140
+ * @param {string} chainName The name of chain
1141
+ * @param {string} contractAddress Contract address
1142
+ * @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
1143
+ * @param {*} [options] Override http request option.
1144
+ * @throws {RequiredError}
1145
+ */
1146
+ refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
1147
+ return localVarFp.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options).then((request) => request(axios, basePath));
1148
+ },
1149
+ };
1150
+ };
1151
+ /**
1152
+ * MetadataApi - object-oriented interface
1153
+ * @export
1154
+ * @class MetadataApi
1155
+ * @extends {BaseAPI}
1156
+ */
1157
+ class MetadataApi extends BaseAPI$1 {
1158
+ /**
1159
+ * Get a single metadata by ID
1160
+ * @summary Get a single metadata by ID
1161
+ * @param {MetadataApiGetMetadataRequest} requestParameters Request parameters.
1162
+ * @param {*} [options] Override http request option.
1163
+ * @throws {RequiredError}
1164
+ * @memberof MetadataApi
1165
+ */
1166
+ getMetadata(requestParameters, options) {
1167
+ return MetadataApiFp(this.configuration).getMetadata(requestParameters.chainName, requestParameters.contractAddress, requestParameters.metadataId, options).then((request) => request(this.axios, this.basePath));
1168
+ }
1169
+ /**
1170
+ * Refresh shared metadata for a collection
1171
+ * @param {MetadataApiRefreshMetadataByIDRequest} requestParameters Request parameters.
1172
+ * @param {*} [options] Override http request option.
1173
+ * @throws {RequiredError}
1174
+ * @memberof MetadataApi
1175
+ */
1176
+ refreshMetadataByID(requestParameters, options) {
1177
+ return MetadataApiFp(this.configuration).refreshMetadataByID(requestParameters.chainName, requestParameters.contractAddress, requestParameters.refreshMetadataByIDRequest, options).then((request) => request(this.axios, this.basePath));
1178
+ }
898
1179
  }
899
1180
 
900
1181
  /* tslint:disable */
@@ -1535,7 +1816,7 @@ const OrdersApiAxiosParamCreator = function (configuration) {
1535
1816
  * @param {string} chainName
1536
1817
  * @param {string} [accountAddress]
1537
1818
  * @param {number} [pageSize] Maximum number of trades to return per page
1538
- * @param {'created_at'} [sortBy] Trade field to sort by
1819
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1539
1820
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1540
1821
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1541
1822
  * @param {*} [options] Override http request option.
@@ -1660,7 +1941,7 @@ const OrdersApiFp = function (configuration) {
1660
1941
  * @param {string} chainName
1661
1942
  * @param {string} [accountAddress]
1662
1943
  * @param {number} [pageSize] Maximum number of trades to return per page
1663
- * @param {'created_at'} [sortBy] Trade field to sort by
1944
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1664
1945
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1665
1946
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1666
1947
  * @param {*} [options] Override http request option.
@@ -1747,7 +2028,7 @@ const OrdersApiFactory = function (configuration, basePath, axios) {
1747
2028
  * @param {string} chainName
1748
2029
  * @param {string} [accountAddress]
1749
2030
  * @param {number} [pageSize] Maximum number of trades to return per page
1750
- * @param {'created_at'} [sortBy] Trade field to sort by
2031
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1751
2032
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1752
2033
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1753
2034
  * @param {*} [options] Override http request option.
@@ -2653,6 +2934,10 @@ var index = /*#__PURE__*/Object.freeze({
2653
2934
  ERC20ItemItemTypeEnum: ERC20ItemItemTypeEnum,
2654
2935
  ERC721ItemItemTypeEnum: ERC721ItemItemTypeEnum,
2655
2936
  FeeFeeTypeEnum: FeeFeeTypeEnum,
2937
+ MetadataApi: MetadataApi,
2938
+ MetadataApiAxiosParamCreator: MetadataApiAxiosParamCreator,
2939
+ MetadataApiFactory: MetadataApiFactory,
2940
+ MetadataApiFp: MetadataApiFp,
2656
2941
  NFTContractType: NFTContractType,
2657
2942
  NativeItemItemTypeEnum: NativeItemItemTypeEnum,
2658
2943
  NftOwnersApi: NftOwnersApi,
@@ -2703,7 +2988,7 @@ class MultiRollupApiClients {
2703
2988
  }
2704
2989
 
2705
2990
  // eslint-disable-next-line @typescript-eslint/naming-convention
2706
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.19.0-alpha' };
2991
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.20.1-alpha.1' };
2707
2992
  const createConfig = ({ basePath, headers, }) => {
2708
2993
  if (!basePath.trim()) {
2709
2994
  throw Error('basePath can not be empty');
@@ -2763,7 +3048,7 @@ class APIError extends Error {
2763
3048
 
2764
3049
  /* eslint-disable implicit-arrow-linebreak */
2765
3050
  const defaultHeaders = {
2766
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.19.0-alpha',
3051
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.20.1-alpha.1',
2767
3052
  };
2768
3053
  /**
2769
3054
  * createAPIConfiguration to create a custom Configuration
@@ -3049,7 +3334,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3049
3334
  chainID,
3050
3335
  coreContractAddress,
3051
3336
  registrationContractAddress,
3052
- sdkVersion: 'ts-immutable-sdk-0.19.0-alpha',
3337
+ sdkVersion: 'ts-immutable-sdk-0.20.1-alpha.1',
3053
3338
  });
3054
3339
  /**
3055
3340
  * Sets `sdkVersion` at the time of build
@@ -8807,6 +9092,7 @@ var ReceiveMessage;
8807
9092
  ReceiveMessage["TRANSACTION_ERROR"] = "transaction_error";
8808
9093
  ReceiveMessage["MESSAGE_CONFIRMED"] = "message_confirmed";
8809
9094
  ReceiveMessage["MESSAGE_REJECTED"] = "message_rejected";
9095
+ ReceiveMessage["LOGOUT_SUCCESS"] = "logout_success";
8810
9096
  })(ReceiveMessage || (ReceiveMessage = {}));
8811
9097
  const PASSPORT_EVENT_TYPE = 'imx_passport_confirmation';
8812
9098
 
@@ -8831,6 +9117,8 @@ const CONFIRMATION_WINDOW_TITLE = 'Confirm this transaction';
8831
9117
  const CONFIRMATION_WINDOW_HEIGHT = 380;
8832
9118
  const CONFIRMATION_WINDOW_WIDTH = 480;
8833
9119
  const CONFIRMATION_WINDOW_CLOSED_POLLING_DURATION = 1000;
9120
+ const CONFIRMATION_IFRAME_ID = 'passport-confirm';
9121
+ const CONFIRMATION_IFRAME_STYLE = 'display: none; position: absolute;width:0px;height:0px;border:0;';
8834
9122
  class ConfirmationScreen {
8835
9123
  config;
8836
9124
  confirmationWindow;
@@ -8924,6 +9212,28 @@ class ConfirmationScreen {
8924
9212
  closeWindow() {
8925
9213
  this.confirmationWindow?.close();
8926
9214
  }
9215
+ logout() {
9216
+ return new Promise((resolve, rejects) => {
9217
+ const iframe = document.createElement('iframe');
9218
+ iframe.setAttribute('id', CONFIRMATION_IFRAME_ID);
9219
+ iframe.setAttribute('src', `${this.config.passportDomain}/transaction-confirmation/logout`);
9220
+ iframe.setAttribute('style', CONFIRMATION_IFRAME_STYLE);
9221
+ const logoutHandler = ({ data, origin }) => {
9222
+ if (origin !== this.config.passportDomain
9223
+ || data.eventType !== PASSPORT_EVENT_TYPE) {
9224
+ return;
9225
+ }
9226
+ window.removeEventListener('message', logoutHandler);
9227
+ iframe.remove();
9228
+ if (data.messageType === ReceiveMessage.LOGOUT_SUCCESS) {
9229
+ resolve({ logout: true });
9230
+ }
9231
+ rejects(new Error('Unsupported logout type'));
9232
+ };
9233
+ window.addEventListener('message', logoutHandler);
9234
+ document.body.appendChild(iframe);
9235
+ });
9236
+ }
8927
9237
  showConfirmationScreen(href, messageHandler, resolve) {
8928
9238
  this.confirmationWindow.location.href = href;
8929
9239
  // https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
@@ -9269,7 +9579,11 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
9269
9579
  RelayerTransactionStatus.SUBMITTED,
9270
9580
  RelayerTransactionStatus.SUCCESSFUL,
9271
9581
  ].includes(relayerTransaction.status)) {
9272
- throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, `Transaction failed to submit with status ${relayerTransaction.status}`);
9582
+ let errorMessage = `Transaction failed to submit with status ${relayerTransaction.status}.`;
9583
+ if (relayerTransaction.statusMessage) {
9584
+ errorMessage += ` Error message: ${relayerTransaction.statusMessage}`;
9585
+ }
9586
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, errorMessage);
9273
9587
  }
9274
9588
  return relayerTransaction.hash;
9275
9589
  });
@@ -9619,6 +9933,7 @@ class Passport {
9619
9933
  }
9620
9934
  async logout() {
9621
9935
  await this.authManager.logout();
9936
+ await this.confirmationScreen.logout();
9622
9937
  // Code after this point is only executed if the logout mode is silent
9623
9938
  await this.magicAdapter.logout();
9624
9939
  this.passportEventEmitter.emit(PassportEvents.LOGGED_OUT);
@@ -10233,8 +10548,8 @@ var Fee;
10233
10548
  (function (Fee) {
10234
10549
  (function (fee_type) {
10235
10550
  fee_type["ROYALTY"] = "ROYALTY";
10236
- fee_type["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
10237
- fee_type["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
10551
+ fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
10552
+ fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
10238
10553
  fee_type["PROTOCOL"] = "PROTOCOL";
10239
10554
  })(Fee.fee_type || (Fee.fee_type = {}));
10240
10555
  })(Fee || (Fee = {}));
@@ -10267,8 +10582,8 @@ var ProtocolData;
10267
10582
 
10268
10583
  var FeeType;
10269
10584
  (function (FeeType) {
10270
- FeeType["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
10271
- FeeType["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
10585
+ FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
10586
+ FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
10272
10587
  FeeType["PROTOCOL"] = "PROTOCOL";
10273
10588
  FeeType["ROYALTY"] = "ROYALTY";
10274
10589
  })(FeeType || (FeeType = {}));
@@ -10325,8 +10640,8 @@ function mapFromOpenApiOrder(order) {
10325
10640
  type: fee.fee_type,
10326
10641
  })),
10327
10642
  chain: order.chain,
10328
- createTime: order.create_time,
10329
- endTime: order.end_time,
10643
+ createdAt: order.created_at,
10644
+ endAt: order.end_at,
10330
10645
  protocolData: {
10331
10646
  counter: order.protocol_data.counter,
10332
10647
  orderType: order.protocol_data.order_type,
@@ -10336,9 +10651,9 @@ function mapFromOpenApiOrder(order) {
10336
10651
  },
10337
10652
  salt: order.salt,
10338
10653
  signature: order.signature,
10339
- startTime: order.start_time,
10654
+ startAt: order.start_at,
10340
10655
  status: order.status,
10341
- updateTime: order.update_time,
10656
+ updatedAt: order.updated_at,
10342
10657
  };
10343
10658
  }
10344
10659
  function mapFromOpenApiTrade(trade) {
@@ -10541,8 +10856,8 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
10541
10856
  };
10542
10857
  }),
10543
10858
  counter,
10544
- endTime: Math.round(new Date(order.end_time).getTime() / 1000).toString(),
10545
- startTime: Math.round(new Date(order.start_time).getTime() / 1000).toString(),
10859
+ endTime: Math.round(new Date(order.end_at).getTime() / 1000).toString(),
10860
+ startTime: Math.round(new Date(order.start_at).getTime() / 1000).toString(),
10546
10861
  salt: order.salt,
10547
10862
  offerer: order.account_address,
10548
10863
  zone: zoneAddress,
@@ -10770,10 +11085,10 @@ class ImmutableApiClient {
10770
11085
  ],
10771
11086
  fees: makerFees.map((x) => ({
10772
11087
  amount: x.amount,
10773
- fee_type: FeeType.MAKER_MARKETPLACE,
11088
+ fee_type: FeeType.MAKER_ECOSYSTEM,
10774
11089
  recipient: x.recipient,
10775
11090
  })),
10776
- end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
11091
+ end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
10777
11092
  protocol_data: {
10778
11093
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
10779
11094
  zone_address: orderComponents.zone,
@@ -10790,7 +11105,7 @@ class ImmutableApiClient {
10790
11105
  },
10791
11106
  ],
10792
11107
  signature: orderSignature,
10793
- start_time: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
11108
+ start_at: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
10794
11109
  },
10795
11110
  });
10796
11111
  }
@@ -10983,7 +11298,7 @@ class Orderbook {
10983
11298
  order_id: listingId,
10984
11299
  fees: takerFees.map((fee) => ({
10985
11300
  amount: fee.amount,
10986
- fee_type: FeeType.TAKER_MARKETPLACE,
11301
+ fee_type: FeeType.TAKER_ECOSYSTEM,
10987
11302
  recipient: fee.recipient,
10988
11303
  })),
10989
11304
  },
@@ -28188,14 +28503,16 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
28188
28503
  CheckoutErrorType["CANCEL_ORDER_LISTING_ERROR"] = "CANCEL_ORDER_LISTING_ERROR";
28189
28504
  CheckoutErrorType["PREPARE_ORDER_LISTING_ERROR"] = "PREPARE_ORDER_LISTING_ERROR";
28190
28505
  CheckoutErrorType["CREATE_ORDER_LISTING_ERROR"] = "CREATE_ORDER_LISTING_ERROR";
28506
+ CheckoutErrorType["FULFILL_ORDER_LISTING_ERROR"] = "FULFILL_ORDER_LISTING_ERROR";
28191
28507
  CheckoutErrorType["SWITCH_NETWORK_UNSUPPORTED"] = "SWITCH_NETWORK_UNSUPPORTED";
28192
28508
  CheckoutErrorType["GET_ERC20_ALLOWANCE_ERROR"] = "GET_ERC20_ALLOWANCE_ERROR";
28193
28509
  CheckoutErrorType["GET_ERC721_ALLOWANCE_ERROR"] = "GET_ERC721_ALLOWANCE_ERROR";
28194
28510
  CheckoutErrorType["EXECUTE_APPROVAL_TRANSACTION_ERROR"] = "EXECUTE_APPROVAL_TRANSACTION_ERROR";
28195
- CheckoutErrorType["EXECUTE_FULFILMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILMENT_TRANSACTION_ERROR";
28511
+ CheckoutErrorType["EXECUTE_FULFILLMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR";
28196
28512
  CheckoutErrorType["SIGN_MESSAGE_ERROR"] = "SIGN_MESSAGE_ERROR";
28197
28513
  CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
28198
28514
  CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
28515
+ CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
28199
28516
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
28200
28517
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
28201
28518
  message;
@@ -29049,6 +29366,12 @@ function $67fc622a2b913d5f$export$436dd76f23f463ff(config) {
29049
29366
 
29050
29367
 
29051
29368
 
29369
+ function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, signerOrProvider) {
29370
+ return new (Contract$1)(address, contractInterface, signerOrProvider);
29371
+ }
29372
+
29373
+
29374
+
29052
29375
 
29053
29376
 
29054
29377
  const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
@@ -29776,7 +30099,7 @@ const $7d1bfafb81e64d74$export$3a4140bd9e983e4e = async (provider, insufficientI
29776
30099
  if (item.approvalTransaction === undefined) continue;
29777
30100
  estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, item.approvalTransaction));
29778
30101
  }
29779
- // If the transaction is a fulfilment transaction get the estimate gas promise
30102
+ // If the transaction is a fulfillment transaction get the estimate gas promise
29780
30103
  // Otherwise use the gas amount with the limit to estimate the gas
29781
30104
  if (transactionOrGas.type === ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION) estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, transactionOrGas.transaction));
29782
30105
  else {
@@ -29939,10 +30262,9 @@ const $823db9fb0ca4bc15$export$1430626eec86fce9 = (chainId)=>{
29939
30262
  if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET) return "imtbl-zkevm-testnet";
29940
30263
  return "";
29941
30264
  };
29942
- const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = (chainId)=>{
29943
- if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA) return "0x2Fa06C6672dDCc066Ab04631192738799231dE4a";
29944
- if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM) return "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF";
29945
- return "";
30265
+ const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = async (chainId, config)=>{
30266
+ const imxMappingConfig = await config.remote.getConfig("imxAddressMapping");
30267
+ return imxMappingConfig[chainId] ?? "";
29946
30268
  };
29947
30269
 
29948
30270
 
@@ -30033,7 +30355,7 @@ const $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f = (balanceRequirement)=>{
30033
30355
  const $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6 = async (config, balanceRequirement)=>{
30034
30356
  const l2address = $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f(balanceRequirement);
30035
30357
  if (l2address === "") return "";
30036
- if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
30358
+ if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return await ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config), config);
30037
30359
  const chainName = ($823db9fb0ca4bc15$export$1430626eec86fce9)(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
30038
30360
  if (chainName === "") return ""; // Chain name not a valid indexer chain name
30039
30361
  const blockchainData = ($67fc622a2b913d5f$export$436dd76f23f463ff)(config);
@@ -30249,14 +30571,15 @@ const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, swapFees, approva
30249
30571
  return true;
30250
30572
  };
30251
30573
  const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, dexQuoteCache, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens)=>{
30252
- if (!availableRoutingOptions.swap) return undefined;
30253
- if (swappableTokens.length === 0) return undefined;
30574
+ const fundingSteps = [];
30575
+ if (!availableRoutingOptions.swap) return fundingSteps;
30576
+ if (swappableTokens.length === 0) return fundingSteps;
30254
30577
  const requiredToken = $91807edfd7057288$export$85e4d8628aabb217(balanceRequirement);
30255
- if (requiredToken.address === "") return undefined;
30578
+ if (requiredToken.address === "") return fundingSteps;
30256
30579
  const l2TokenBalanceResult = tokenBalanceResults.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
30257
- if (!l2TokenBalanceResult) return undefined;
30580
+ if (!l2TokenBalanceResult) return fundingSteps;
30258
30581
  const l2Balances = l2TokenBalanceResult.balances;
30259
- if (l2Balances.length === 0) return undefined;
30582
+ if (l2Balances.length === 0) return fundingSteps;
30260
30583
  const quotes = await ($3ee85f12225c19f3$export$fb80fe94a81a3132)(config, dexQuoteCache, walletAddress, requiredToken, swappableTokens);
30261
30584
  const quoteTokenAddresses = Array.from(quotes.keys());
30262
30585
  for (const quoteTokenAddress of quoteTokenAddresses){
@@ -30280,7 +30603,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30280
30603
  })) continue;
30281
30604
  // User has sufficient funds to cover any approval and swap fees so use this token for the funding route
30282
30605
  // Currently we are not prioritising any particular token so just taking the first sufficient token
30283
- return {
30606
+ fundingSteps.push({
30284
30607
  type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).SWAP,
30285
30608
  chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
30286
30609
  asset: {
@@ -30288,9 +30611,9 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30288
30611
  formattedBalance: userBalanceOfQuotedToken.formattedBalance,
30289
30612
  token: userBalanceOfQuotedToken.token
30290
30613
  }
30291
- };
30614
+ });
30292
30615
  }
30293
- return undefined;
30616
+ return fundingSteps;
30294
30617
  };
30295
30618
 
30296
30619
 
@@ -30325,6 +30648,7 @@ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutin
30325
30648
 
30326
30649
 
30327
30650
 
30651
+ const $c16168a9c28ae4fd$var$hasAvailableRoutingOptions = (availableRoutingOptions)=>availableRoutingOptions.bridge || availableRoutingOptions.swap || availableRoutingOptions.onRamp;
30328
30652
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30329
30653
  let insufficientBalanceCount = 0;
30330
30654
  let insufficientRequirement;
@@ -30335,18 +30659,18 @@ const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30335
30659
  if (insufficientBalanceCount === 1) return insufficientRequirement;
30336
30660
  return undefined;
30337
30661
  };
30338
- const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList)=>{
30339
- if (!availableRoutingOptions.swap) return undefined;
30340
- if (insufficientRequirement === undefined) return undefined;
30341
- if (swapTokenAllowList === undefined) return undefined;
30662
+ const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList)=>{
30663
+ const fundingSteps = [];
30664
+ if (!availableRoutingOptions.swap) return fundingSteps;
30665
+ if (insufficientRequirement === undefined) return fundingSteps;
30666
+ if (swapTokenAllowList === undefined) return fundingSteps;
30342
30667
  const tokenBalanceResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
30343
- if (!tokenBalanceResult) return undefined;
30344
- if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return undefined;
30345
- if (swapTokenAllowList.length === 0) return undefined;
30668
+ if (!tokenBalanceResult) return fundingSteps;
30669
+ if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return fundingSteps;
30670
+ if (swapTokenAllowList.length === 0) return fundingSteps;
30346
30671
  const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
30347
- if (swappableTokens.length === 0) return undefined;
30348
- const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30349
- return swapFundingStep;
30672
+ if (swappableTokens.length === 0) return fundingSteps;
30673
+ return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30350
30674
  };
30351
30675
  const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
30352
30676
  if (!availableRoutingOptions.onRamp) return undefined;
@@ -30355,6 +30679,13 @@ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutin
30355
30679
  return onRampFundingStep;
30356
30680
  };
30357
30681
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
30682
+ if (!$c16168a9c28ae4fd$var$hasAvailableRoutingOptions(availableRoutingOptions)) return {
30683
+ response: {
30684
+ type: ($b23305044c0e096a$export$3057de18ac0c076).NO_OPTIONS,
30685
+ message: "No options available"
30686
+ },
30687
+ fundingRoutes: []
30688
+ };
30358
30689
  let readOnlyProviders;
30359
30690
  try {
30360
30691
  readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
@@ -30373,7 +30704,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30373
30704
  const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
30374
30705
  let bridgeFundingStep;
30375
30706
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
30376
- const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30707
+ const swapFundingSteps = await $c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30377
30708
  const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
30378
30709
  // Check swap routes
30379
30710
  // > Could bridge first
@@ -30387,7 +30718,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30387
30718
  fundingRoutes: []
30388
30719
  };
30389
30720
  let priority = 0;
30390
- if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
30721
+ if (bridgeFundingStep || swapFundingSteps.length > 0 || onRampFundingStep) {
30391
30722
  response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
30392
30723
  response.response.message = "Routes found";
30393
30724
  }
@@ -30400,13 +30731,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30400
30731
  ]
30401
30732
  });
30402
30733
  }
30403
- if (swapFundingStep) {
30734
+ if (swapFundingSteps.length > 0) {
30404
30735
  priority++;
30405
- response.fundingRoutes.push({
30406
- priority: priority,
30407
- steps: [
30408
- swapFundingStep
30409
- ]
30736
+ swapFundingSteps.forEach((swapFundingStep)=>{
30737
+ response.fundingRoutes.push({
30738
+ priority: priority,
30739
+ steps: [
30740
+ swapFundingStep
30741
+ ]
30742
+ });
30410
30743
  });
30411
30744
  }
30412
30745
  if (onRampFundingStep) {
@@ -30491,13 +30824,13 @@ const $25ac589234c10b67$export$19693ca396db083e = async (provider, approvalTrans
30491
30824
  type: ($d855a5ba32004345$export$f51b97f3aaf2d5a8).SUCCESS
30492
30825
  };
30493
30826
  };
30494
- const $25ac589234c10b67$export$2161274619257102 = async (provider, fulfilmentTransactions)=>{
30827
+ const $25ac589234c10b67$export$3f05b33bd1f29038 = async (provider, fulfillmentTransactions)=>{
30495
30828
  let receipts = [];
30496
30829
  try {
30497
- const response = await Promise.all(fulfilmentTransactions.map((transaction)=>provider.getSigner().sendTransaction(transaction)));
30830
+ const response = await Promise.all(fulfillmentTransactions.map((transaction)=>provider.getSigner().sendTransaction(transaction)));
30498
30831
  receipts = await Promise.all(response.map((transaction)=>transaction.wait()));
30499
30832
  } catch (err) {
30500
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while executing the fulfilment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).EXECUTE_FULFILMENT_TRANSACTION_ERROR, {
30833
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while executing the fulfillment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
30501
30834
  message: err.message
30502
30835
  });
30503
30836
  }
@@ -30505,7 +30838,7 @@ const $25ac589234c10b67$export$2161274619257102 = async (provider, fulfilmentTra
30505
30838
  if (receipt.status === 0) return {
30506
30839
  type: ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED,
30507
30840
  transactionHash: receipt.transactionHash,
30508
- reason: "Fulfilment transaction failed and was reverted"
30841
+ reason: "Fulfillment transaction failed and was reverted"
30509
30842
  };
30510
30843
  }
30511
30844
  return {
@@ -30530,23 +30863,43 @@ const $25ac589234c10b67$export$1d9a7a8a40780de = async (provider, unsignedMessag
30530
30863
 
30531
30864
 
30532
30865
 
30533
- const $a7367d01c6e76b1c$export$b087719c36e0f2dc = async (actions)=>{
30866
+ const $a7367d01c6e76b1c$export$c5b3365853cb6159 = async (actions)=>{
30534
30867
  let approvalTransactions = [];
30535
- let fulfilmentTransactions = [];
30868
+ let fulfillmentTransactions = [];
30536
30869
  const approvalPromises = [];
30537
- const fulfilmentPromises = [];
30870
+ const fulfillmentPromises = [];
30538
30871
  for (const action of actions){
30539
30872
  if (action.type !== (ActionType).TRANSACTION) continue;
30540
30873
  if (action.purpose === (TransactionPurpose).APPROVAL) approvalPromises.push(action.buildTransaction());
30541
- if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfilmentPromises.push(action.buildTransaction());
30874
+ if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfillmentPromises.push(action.buildTransaction());
30542
30875
  }
30543
30876
  approvalTransactions = await Promise.all(approvalPromises);
30544
- fulfilmentTransactions = await Promise.all(fulfilmentPromises);
30877
+ fulfillmentTransactions = await Promise.all(fulfillmentPromises);
30545
30878
  return {
30546
30879
  approvalTransactions: approvalTransactions,
30547
- fulfilmentTransactions: fulfilmentTransactions
30880
+ fulfillmentTransactions: fulfillmentTransactions
30548
30881
  };
30549
30882
  };
30883
+ const $a7367d01c6e76b1c$export$f64a20a30eb98855 = async (actions)=>{
30884
+ let approvalTransactions = [];
30885
+ const approvalPromises = [];
30886
+ for (const action of actions){
30887
+ if (action.type !== (ActionType).TRANSACTION) continue;
30888
+ if (action.purpose === (TransactionPurpose).APPROVAL) approvalPromises.push(action.buildTransaction());
30889
+ }
30890
+ approvalTransactions = await Promise.all(approvalPromises);
30891
+ return approvalTransactions;
30892
+ };
30893
+ const $a7367d01c6e76b1c$export$396bd6ce7d3ab533 = async (actions)=>{
30894
+ let fulfillmentTransactions = [];
30895
+ const fulfillmentPromises = [];
30896
+ for (const action of actions){
30897
+ if (action.type !== (ActionType).TRANSACTION) continue;
30898
+ if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfillmentPromises.push(action.buildTransaction());
30899
+ }
30900
+ fulfillmentTransactions = await Promise.all(fulfillmentPromises);
30901
+ return fulfillmentTransactions;
30902
+ };
30550
30903
  const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, actions)=>{
30551
30904
  let unsignedMessage;
30552
30905
  for (const action of actions){
@@ -30569,6 +30922,49 @@ const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, a
30569
30922
 
30570
30923
 
30571
30924
 
30925
+
30926
+
30927
+
30928
+
30929
+ const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
30930
+ const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
30931
+ const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
30932
+ const feePercentage = orderFee.amount;
30933
+ // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30934
+ const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
30935
+ const bnFeeAmount = amountBn.mul((BigNumber$1).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
30936
+ return bnFeeAmount;
30937
+ };
30938
+ const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
30939
+ const feeToken = orderFee.amount;
30940
+ const bnFeeAmount = (parseUnits$1)(feeToken.token, decimals);
30941
+ return bnFeeAmount;
30942
+ };
30943
+ const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
30944
+ let totalTokenFees = (BigNumber$1).from(0);
30945
+ const amountBn = (BigNumber$1).from(weiAmount);
30946
+ // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30947
+ const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
30948
+ const calculateFeesResult = [];
30949
+ for (const orderFee of orderFees){
30950
+ let currentFeeBn = (BigNumber$1).from(0);
30951
+ if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
30952
+ currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
30953
+ totalTokenFees = totalTokenFees.add(currentFeeBn);
30954
+ } else if (Object.hasOwn(orderFee.amount, "token")) {
30955
+ currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
30956
+ totalTokenFees = totalTokenFees.add(currentFeeBn);
30957
+ } else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
30958
+ if (totalTokenFees.gt(totalAllowableFees)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`The combined fees are above the allowed maximum of ${$9051cee080948594$export$9ac1563efd38130 * 100}%`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
30959
+ if (currentFeeBn.gt(0)) calculateFeesResult.push({
30960
+ amount: currentFeeBn.toString(),
30961
+ recipient: orderFee.recipient
30962
+ });
30963
+ } // for
30964
+ return calculateFeesResult;
30965
+ };
30966
+
30967
+
30572
30968
  const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
30573
30969
  switch(type){
30574
30970
  case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
@@ -30586,10 +30982,10 @@ const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount
30586
30982
  };
30587
30983
  }
30588
30984
  };
30589
- const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, unsignedTransactions)=>{
30590
- if (unsignedTransactions.fulfilmentTransactions.length > 0) return {
30985
+ const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, fulfillmentTransactions)=>{
30986
+ if (fulfillmentTransactions.length > 0) return {
30591
30987
  type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION,
30592
- transaction: unsignedTransactions.fulfilmentTransactions[0]
30988
+ transaction: fulfillmentTransactions[0]
30593
30989
  };
30594
30990
  return {
30595
30991
  type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
@@ -30599,34 +30995,54 @@ const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, unsignedTransaction
30599
30995
  }
30600
30996
  };
30601
30997
  };
30602
- const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, orderId)=>{
30998
+ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, orders)=>{
30603
30999
  let orderbook;
30604
31000
  let order;
30605
31001
  let spenderAddress = "";
30606
31002
  const gasLimit = (constants).estimatedFulfillmentGasGwei;
31003
+ if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were passed in, must pass at least one order", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
31004
+ const { id: id, takerFees: takerFees } = orders[0];
30607
31005
  try {
30608
31006
  orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
30609
- order = await orderbook.getListing(orderId);
31007
+ order = await orderbook.getListing(id);
30610
31008
  const { seaportContractAddress: seaportContractAddress } = orderbook.config();
30611
31009
  spenderAddress = seaportContractAddress;
30612
31010
  } catch (err) {
30613
31011
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while getting the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ORDER_LISTING_ERROR, {
30614
- orderId: orderId,
31012
+ orderId: id,
30615
31013
  message: err.message
30616
31014
  });
30617
31015
  }
30618
- let unsignedTransactions = {
30619
- approvalTransactions: [],
30620
- fulfilmentTransactions: []
30621
- };
31016
+ if (order.result.buy.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred with the get order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ORDER_LISTING_ERROR, {
31017
+ orderId: id,
31018
+ message: "No buy side tokens found on order"
31019
+ });
31020
+ const buyToken = order.result.buy[0];
31021
+ let decimals = 18;
31022
+ if (order.result.buy[0].type === "ERC20") {
31023
+ const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
31024
+ decimals = await tokenContract.decimals();
31025
+ }
31026
+ let fees = [];
31027
+ if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
31028
+ let unsignedApprovalTransactions = [];
31029
+ let unsignedFulfillmentTransactions = [];
31030
+ let orderActions = [];
30622
31031
  try {
30623
31032
  const fulfillerAddress = await provider.getSigner().getAddress();
30624
- const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
30625
- unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
31033
+ const { actions: actions } = await orderbook.fulfillOrder(id, fulfillerAddress, fees);
31034
+ orderActions = actions;
31035
+ unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
30626
31036
  } catch {
30627
31037
  // Silently ignore error as this is usually thrown if user does not have enough balance
30628
31038
  // todo: if balance error - can we determine if its the balance error otherwise throw?
30629
31039
  }
31040
+ try {
31041
+ unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
31042
+ } catch {
31043
+ // if cannot estimate gas then silently continue and use gas limit in smartCheckout
31044
+ // but get the fulfillment transactions after they have approved the spending
31045
+ }
30630
31046
  let amount = (BigNumber$1).from("0");
30631
31047
  let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
30632
31048
  let contractAddress = "";
@@ -30641,7 +31057,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30641
31057
  break;
30642
31058
  default:
30643
31059
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Purchasing token type is unsupported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_TOKEN_TYPE_ERROR, {
30644
- orderId: orderId
31060
+ orderId: id
30645
31061
  });
30646
31062
  }
30647
31063
  buyArray.forEach((item)=>{
@@ -30654,31 +31070,38 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30654
31070
  const itemRequirements = [
30655
31071
  $64863c39386de592$export$4249179755829904(type, contractAddress, amount, spenderAddress)
30656
31072
  ];
30657
- const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedTransactions));
31073
+ const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions));
30658
31074
  if (smartCheckoutResult.sufficient) {
30659
- const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
31075
+ const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
30660
31076
  if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
30661
31077
  smartCheckoutResult: smartCheckoutResult,
30662
- orderId: orderId,
31078
+ orderId: id,
30663
31079
  status: {
30664
31080
  type: ($aa144554f9ef124b$export$226b052ecb8ca80).FAILED,
30665
31081
  transactionHash: approvalResult.transactionHash,
30666
31082
  reason: approvalResult.reason
30667
31083
  }
30668
31084
  };
30669
- const fulfilmentResult = await ($25ac589234c10b67$export$2161274619257102)(provider, unsignedTransactions.fulfilmentTransactions);
30670
- if (fulfilmentResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
31085
+ try {
31086
+ if (unsignedFulfillmentTransactions.length === 0) unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
31087
+ } catch (err) {
31088
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error fetching fulfillment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR, {
31089
+ message: err.message
31090
+ });
31091
+ }
31092
+ const fulfillmentResult = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, unsignedFulfillmentTransactions);
31093
+ if (fulfillmentResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
30671
31094
  smartCheckoutResult: smartCheckoutResult,
30672
- orderId: orderId,
31095
+ orderId: id,
30673
31096
  status: {
30674
31097
  type: ($aa144554f9ef124b$export$226b052ecb8ca80).FAILED,
30675
- transactionHash: fulfilmentResult.transactionHash,
30676
- reason: fulfilmentResult.reason
31098
+ transactionHash: fulfillmentResult.transactionHash,
31099
+ reason: fulfillmentResult.reason
30677
31100
  }
30678
31101
  };
30679
31102
  return {
30680
31103
  smartCheckoutResult: smartCheckoutResult,
30681
- orderId: orderId,
31104
+ orderId: id,
30682
31105
  status: {
30683
31106
  type: ($aa144554f9ef124b$export$226b052ecb8ca80).SUCCESS
30684
31107
  }
@@ -30686,7 +31109,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30686
31109
  }
30687
31110
  return {
30688
31111
  smartCheckoutResult: smartCheckoutResult,
30689
- orderId: orderId
31112
+ orderId: id
30690
31113
  };
30691
31114
  };
30692
31115
 
@@ -30698,8 +31121,11 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30698
31121
 
30699
31122
 
30700
31123
 
30701
- const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderId)=>{
31124
+ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
30702
31125
  let unsignedCancelOrderTransaction;
31126
+ if (orderIds.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orderIds were passed in, must pass at least one orderId to cancel", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR);
31127
+ // Update this when bulk cancel is supproted
31128
+ const orderId = orderIds[0];
30703
31129
  try {
30704
31130
  const offererAddress = await provider.getSigner().getAddress();
30705
31131
  const orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
@@ -30711,7 +31137,7 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
30711
31137
  message: err.message
30712
31138
  });
30713
31139
  }
30714
- const result = await ($25ac589234c10b67$export$2161274619257102)(provider, [
31140
+ const result = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, [
30715
31141
  unsignedCancelOrderTransaction
30716
31142
  ]);
30717
31143
  if (result.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
@@ -30744,47 +31170,6 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
30744
31170
 
30745
31171
 
30746
31172
 
30747
-
30748
-
30749
- const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
30750
- const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
30751
- const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
30752
- const feePercentage = orderFee.amount;
30753
- // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30754
- const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
30755
- const bnFeeAmount = amountBn.mul((BigNumber$1).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
30756
- return bnFeeAmount;
30757
- };
30758
- const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
30759
- const feeToken = orderFee.amount;
30760
- const bnFeeAmount = (parseUnits$1)(feeToken.token, decimals);
30761
- return bnFeeAmount;
30762
- };
30763
- const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
30764
- let totalTokenFees = (BigNumber$1).from(0);
30765
- const amountBn = (BigNumber$1).from(weiAmount);
30766
- // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30767
- const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
30768
- const calculateFeesResult = [];
30769
- for (const orderFee of orderFees){
30770
- let currentFeeBn = (BigNumber$1).from(0);
30771
- if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
30772
- currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
30773
- totalTokenFees = totalTokenFees.add(currentFeeBn);
30774
- } else if (Object.hasOwn(orderFee.amount, "token")) {
30775
- currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
30776
- totalTokenFees = totalTokenFees.add(currentFeeBn);
30777
- } else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
30778
- if (totalTokenFees.gt(totalAllowableFees)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`The combined fees are above the allowed maximum of ${$9051cee080948594$export$9ac1563efd38130 * 100}%`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
30779
- if (currentFeeBn.gt(0)) calculateFeesResult.push({
30780
- amount: currentFeeBn.toString(),
30781
- recipient: orderFee.recipient
30782
- });
30783
- } // for
30784
- return calculateFeesResult;
30785
- };
30786
-
30787
-
30788
31173
  const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
30789
31174
  type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
30790
31175
  id: id,
@@ -30813,7 +31198,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30813
31198
  if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
30814
31199
  // get this from the allowed list
30815
31200
  const buyTokenContract = new (Contract$1)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
30816
- decimals = buyTokenContract.decimals();
31201
+ decimals = await buyTokenContract.decimals();
30817
31202
  }
30818
31203
  const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
30819
31204
  try {
@@ -30856,7 +31241,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30856
31241
  collectionAddress: sellToken.collectionAddress
30857
31242
  });
30858
31243
  const signedMessage = await ($25ac589234c10b67$export$1d9a7a8a40780de)(provider, unsignedMessage);
30859
- const unsignedTransactions = await ($a7367d01c6e76b1c$export$b087719c36e0f2dc)(listing.actions);
31244
+ const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
30860
31245
  const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
30861
31246
  if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
30862
31247
  id: sellToken.id,
@@ -30956,6 +31341,38 @@ class $a77d203f701a3b72$export$1453e9b801542ef4 {
30956
31341
 
30957
31342
 
30958
31343
 
31344
+
31345
+
31346
+
31347
+ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements) {
31348
+ // Get all decimal values by calling contracts for each ERC20
31349
+ const decimalPromises = [];
31350
+ requirements.forEach((itemRequirementParam)=>{
31351
+ if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
31352
+ const { contractAddress: contractAddress } = itemRequirementParam;
31353
+ decimalPromises.push(($06a6c5c23f7f2479$export$fbbc17f6e6e58544)(contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider).decimals());
31354
+ }
31355
+ });
31356
+ const decimals = await Promise.all(decimalPromises);
31357
+ // Map ItemRequirementsParam objects to ItemRequirement by parsing amounts from formatted string to BigNumebrs
31358
+ const itemRequirements = requirements.map((itemRequirementParam, index)=>{
31359
+ if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return {
31360
+ ...itemRequirementParam,
31361
+ amount: (parseUnits$1)(itemRequirementParam.amount, 18)
31362
+ };
31363
+ if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return {
31364
+ ...itemRequirementParam,
31365
+ amount: (parseUnits$1)(itemRequirementParam.amount, decimals[index])
31366
+ };
31367
+ return itemRequirementParam;
31368
+ });
31369
+ return itemRequirements;
31370
+ }
31371
+
31372
+
31373
+
31374
+
31375
+
30959
31376
  const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
30960
31377
  baseConfig: {
30961
31378
  environment: (Environment$1).SANDBOX
@@ -31082,8 +31499,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
31082
31499
  if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
31083
31500
  // eslint-disable-next-line no-console
31084
31501
  console.warn("This endpoint is currently under construction.");
31502
+ if (params.orders.length > 1) // eslint-disable-next-line no-console
31503
+ console.warn("This endpoint currently only actions the first order in the array.");
31085
31504
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
31086
- await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orderId);
31505
+ await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orders);
31087
31506
  }
31088
31507
  /**
31089
31508
  * Determines the requirements for performing a sell.
@@ -31106,8 +31525,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
31106
31525
  if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
31107
31526
  // eslint-disable-next-line no-console
31108
31527
  console.warn("This endpoint is currently under construction.");
31528
+ // eslint-disable-next-line no-console
31529
+ console.warn("This endpoint currently only actions the first order in the array.");
31109
31530
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
31110
- await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderId);
31531
+ await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderIds);
31111
31532
  }
31112
31533
  /**
31113
31534
  * Determines the transaction requirements to complete a purchase.
@@ -31117,8 +31538,13 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
31117
31538
  // eslint-disable-next-line no-console
31118
31539
  console.warn("This endpoint is currently under construction.");
31119
31540
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
31120
- // console.log('Smart Checkout Params ::', params);
31121
- await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, params.itemRequirements, params.transactionOrGasAmount);
31541
+ let itemRequirements = [];
31542
+ try {
31543
+ itemRequirements = await (0, $d35036efee31c5d1$export$dc8635800ef20f4b)(web3Provider, params.itemRequirements);
31544
+ } catch {
31545
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Failed to map item requirements", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ITEM_REQUIREMENTS_ERROR);
31546
+ }
31547
+ await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
31122
31548
  }
31123
31549
  /**
31124
31550
  * Checks if the given object is a Web3 provider.
@@ -31195,7 +31621,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31195
31621
  function $parcel$export(e, n, v, s) {
31196
31622
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31197
31623
  }
31198
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.19.0-alpha";
31624
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.20.1-alpha.1";
31199
31625
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31200
31626
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31201
31627