@imtbl/sdk 0.20.0 → 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.cjs CHANGED
@@ -233,6 +233,18 @@ const assertParamExists$1 = function (functionName, paramName, paramValue) {
233
233
  throw new RequiredError$1(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
234
234
  }
235
235
  };
236
+ /**
237
+ *
238
+ * @export
239
+ */
240
+ const setApiKeyToObject = async function (object, keyParamName, configuration) {
241
+ if (configuration && configuration.apiKey) {
242
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
243
+ ? await configuration.apiKey(keyParamName)
244
+ : await configuration.apiKey;
245
+ object[keyParamName] = localVarApiKeyValue;
246
+ }
247
+ };
236
248
  /**
237
249
  *
238
250
  * @export
@@ -782,6 +794,46 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
782
794
  options: localVarRequestOptions,
783
795
  };
784
796
  },
797
+ /**
798
+ * Refresh collection metadata
799
+ * @summary Refresh collection metadata
800
+ * @param {string} contractAddress The address contract
801
+ * @param {string} chainName The name of chain
802
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
803
+ * @param {*} [options] Override http request option.
804
+ * @throws {RequiredError}
805
+ */
806
+ refreshCollectionMetadata: async (contractAddress, chainName, refreshCollectionMetadataRequest, options = {}) => {
807
+ // verify required parameter 'contractAddress' is not null or undefined
808
+ assertParamExists$1('refreshCollectionMetadata', 'contractAddress', contractAddress);
809
+ // verify required parameter 'chainName' is not null or undefined
810
+ assertParamExists$1('refreshCollectionMetadata', 'chainName', chainName);
811
+ // verify required parameter 'refreshCollectionMetadataRequest' is not null or undefined
812
+ assertParamExists$1('refreshCollectionMetadata', 'refreshCollectionMetadataRequest', refreshCollectionMetadataRequest);
813
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata`
814
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
815
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
816
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
817
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
818
+ let baseOptions;
819
+ if (configuration) {
820
+ baseOptions = configuration.baseOptions;
821
+ }
822
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
823
+ const localVarHeaderParameter = {};
824
+ const localVarQueryParameter = {};
825
+ // authentication ImmutableApiKey required
826
+ await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
827
+ localVarHeaderParameter['Content-Type'] = 'application/json';
828
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
829
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
830
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
831
+ localVarRequestOptions.data = serializeDataIfNeeded$1(refreshCollectionMetadataRequest, localVarRequestOptions, configuration);
832
+ return {
833
+ url: toPathString$1(localVarUrlObj),
834
+ options: localVarRequestOptions,
835
+ };
836
+ },
785
837
  };
786
838
  };
787
839
  /**
@@ -830,6 +882,19 @@ const CollectionsApiFp = function (configuration) {
830
882
  const localVarAxiosArgs = await localVarAxiosParamCreator.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options);
831
883
  return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
832
884
  },
885
+ /**
886
+ * Refresh collection metadata
887
+ * @summary Refresh collection metadata
888
+ * @param {string} contractAddress The address contract
889
+ * @param {string} chainName The name of chain
890
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
891
+ * @param {*} [options] Override http request option.
892
+ * @throws {RequiredError}
893
+ */
894
+ async refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
895
+ const localVarAxiosArgs = await localVarAxiosParamCreator.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options);
896
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
897
+ },
833
898
  };
834
899
  };
835
900
  /**
@@ -875,6 +940,18 @@ const CollectionsApiFactory = function (configuration, basePath, axios) {
875
940
  listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options) {
876
941
  return localVarFp.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options).then((request) => request(axios, basePath));
877
942
  },
943
+ /**
944
+ * Refresh collection metadata
945
+ * @summary Refresh collection metadata
946
+ * @param {string} contractAddress The address contract
947
+ * @param {string} chainName The name of chain
948
+ * @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
949
+ * @param {*} [options] Override http request option.
950
+ * @throws {RequiredError}
951
+ */
952
+ refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
953
+ return localVarFp.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options).then((request) => request(axios, basePath));
954
+ },
878
955
  };
879
956
  };
880
957
  /**
@@ -917,6 +994,210 @@ class CollectionsApi extends BaseAPI$1 {
917
994
  listCollectionsByNFTOwner(requestParameters, options) {
918
995
  return CollectionsApiFp(this.configuration).listCollectionsByNFTOwner(requestParameters.accountAddress, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
919
996
  }
997
+ /**
998
+ * Refresh collection metadata
999
+ * @summary Refresh collection metadata
1000
+ * @param {CollectionsApiRefreshCollectionMetadataRequest} requestParameters Request parameters.
1001
+ * @param {*} [options] Override http request option.
1002
+ * @throws {RequiredError}
1003
+ * @memberof CollectionsApi
1004
+ */
1005
+ refreshCollectionMetadata(requestParameters, options) {
1006
+ return CollectionsApiFp(this.configuration).refreshCollectionMetadata(requestParameters.contractAddress, requestParameters.chainName, requestParameters.refreshCollectionMetadataRequest, options).then((request) => request(this.axios, this.basePath));
1007
+ }
1008
+ }
1009
+
1010
+ /* tslint:disable */
1011
+ /* eslint-disable */
1012
+ /**
1013
+ * Immutable zkEVM API
1014
+ * Immutable Multi Rollup API
1015
+ *
1016
+ * The version of the OpenAPI document: 1.0.0
1017
+ * Contact: support@immutable.com
1018
+ *
1019
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1020
+ * https://openapi-generator.tech
1021
+ * Do not edit the class manually.
1022
+ */
1023
+ /**
1024
+ * MetadataApi - axios parameter creator
1025
+ * @export
1026
+ */
1027
+ const MetadataApiAxiosParamCreator = function (configuration) {
1028
+ return {
1029
+ /**
1030
+ * Get a single metadata by ID
1031
+ * @summary Get a single metadata by ID
1032
+ * @param {string} chainName The name of chain
1033
+ * @param {string} contractAddress The address of metadata contract
1034
+ * @param {string} metadataId The id of the metadata
1035
+ * @param {*} [options] Override http request option.
1036
+ * @throws {RequiredError}
1037
+ */
1038
+ getMetadata: async (chainName, contractAddress, metadataId, options = {}) => {
1039
+ // verify required parameter 'chainName' is not null or undefined
1040
+ assertParamExists$1('getMetadata', 'chainName', chainName);
1041
+ // verify required parameter 'contractAddress' is not null or undefined
1042
+ assertParamExists$1('getMetadata', 'contractAddress', contractAddress);
1043
+ // verify required parameter 'metadataId' is not null or undefined
1044
+ assertParamExists$1('getMetadata', 'metadataId', metadataId);
1045
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/metadata/{metadata_id}`
1046
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
1047
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
1048
+ .replace(`{${"metadata_id"}}`, encodeURIComponent(String(metadataId)));
1049
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1050
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
1051
+ let baseOptions;
1052
+ if (configuration) {
1053
+ baseOptions = configuration.baseOptions;
1054
+ }
1055
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
1056
+ const localVarHeaderParameter = {};
1057
+ const localVarQueryParameter = {};
1058
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
1059
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1060
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1061
+ return {
1062
+ url: toPathString$1(localVarUrlObj),
1063
+ options: localVarRequestOptions,
1064
+ };
1065
+ },
1066
+ /**
1067
+ * Refresh shared metadata for a collection
1068
+ * @param {string} chainName The name of chain
1069
+ * @param {string} contractAddress Contract address
1070
+ * @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
1071
+ * @param {*} [options] Override http request option.
1072
+ * @throws {RequiredError}
1073
+ */
1074
+ refreshMetadataByID: async (chainName, contractAddress, refreshMetadataByIDRequest, options = {}) => {
1075
+ // verify required parameter 'chainName' is not null or undefined
1076
+ assertParamExists$1('refreshMetadataByID', 'chainName', chainName);
1077
+ // verify required parameter 'contractAddress' is not null or undefined
1078
+ assertParamExists$1('refreshMetadataByID', 'contractAddress', contractAddress);
1079
+ // verify required parameter 'refreshMetadataByIDRequest' is not null or undefined
1080
+ assertParamExists$1('refreshMetadataByID', 'refreshMetadataByIDRequest', refreshMetadataByIDRequest);
1081
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/metadata/refresh-metadata`
1082
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
1083
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)));
1084
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1085
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
1086
+ let baseOptions;
1087
+ if (configuration) {
1088
+ baseOptions = configuration.baseOptions;
1089
+ }
1090
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1091
+ const localVarHeaderParameter = {};
1092
+ const localVarQueryParameter = {};
1093
+ // authentication ImmutableApiKey required
1094
+ await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
1095
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1096
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
1097
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1098
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1099
+ localVarRequestOptions.data = serializeDataIfNeeded$1(refreshMetadataByIDRequest, localVarRequestOptions, configuration);
1100
+ return {
1101
+ url: toPathString$1(localVarUrlObj),
1102
+ options: localVarRequestOptions,
1103
+ };
1104
+ },
1105
+ };
1106
+ };
1107
+ /**
1108
+ * MetadataApi - functional programming interface
1109
+ * @export
1110
+ */
1111
+ const MetadataApiFp = function (configuration) {
1112
+ const localVarAxiosParamCreator = MetadataApiAxiosParamCreator(configuration);
1113
+ return {
1114
+ /**
1115
+ * Get a single metadata by ID
1116
+ * @summary Get a single metadata by ID
1117
+ * @param {string} chainName The name of chain
1118
+ * @param {string} contractAddress The address of metadata contract
1119
+ * @param {string} metadataId The id of the metadata
1120
+ * @param {*} [options] Override http request option.
1121
+ * @throws {RequiredError}
1122
+ */
1123
+ async getMetadata(chainName, contractAddress, metadataId, options) {
1124
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getMetadata(chainName, contractAddress, metadataId, options);
1125
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
1126
+ },
1127
+ /**
1128
+ * Refresh shared metadata for a collection
1129
+ * @param {string} chainName The name of chain
1130
+ * @param {string} contractAddress Contract address
1131
+ * @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
1132
+ * @param {*} [options] Override http request option.
1133
+ * @throws {RequiredError}
1134
+ */
1135
+ async refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
1136
+ const localVarAxiosArgs = await localVarAxiosParamCreator.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options);
1137
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
1138
+ },
1139
+ };
1140
+ };
1141
+ /**
1142
+ * MetadataApi - factory interface
1143
+ * @export
1144
+ */
1145
+ const MetadataApiFactory = function (configuration, basePath, axios) {
1146
+ const localVarFp = MetadataApiFp(configuration);
1147
+ return {
1148
+ /**
1149
+ * Get a single metadata by ID
1150
+ * @summary Get a single metadata by ID
1151
+ * @param {string} chainName The name of chain
1152
+ * @param {string} contractAddress The address of metadata contract
1153
+ * @param {string} metadataId The id of the metadata
1154
+ * @param {*} [options] Override http request option.
1155
+ * @throws {RequiredError}
1156
+ */
1157
+ getMetadata(chainName, contractAddress, metadataId, options) {
1158
+ return localVarFp.getMetadata(chainName, contractAddress, metadataId, options).then((request) => request(axios, basePath));
1159
+ },
1160
+ /**
1161
+ * Refresh shared metadata for a collection
1162
+ * @param {string} chainName The name of chain
1163
+ * @param {string} contractAddress Contract address
1164
+ * @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
1165
+ * @param {*} [options] Override http request option.
1166
+ * @throws {RequiredError}
1167
+ */
1168
+ refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
1169
+ return localVarFp.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options).then((request) => request(axios, basePath));
1170
+ },
1171
+ };
1172
+ };
1173
+ /**
1174
+ * MetadataApi - object-oriented interface
1175
+ * @export
1176
+ * @class MetadataApi
1177
+ * @extends {BaseAPI}
1178
+ */
1179
+ class MetadataApi extends BaseAPI$1 {
1180
+ /**
1181
+ * Get a single metadata by ID
1182
+ * @summary Get a single metadata by ID
1183
+ * @param {MetadataApiGetMetadataRequest} requestParameters Request parameters.
1184
+ * @param {*} [options] Override http request option.
1185
+ * @throws {RequiredError}
1186
+ * @memberof MetadataApi
1187
+ */
1188
+ getMetadata(requestParameters, options) {
1189
+ return MetadataApiFp(this.configuration).getMetadata(requestParameters.chainName, requestParameters.contractAddress, requestParameters.metadataId, options).then((request) => request(this.axios, this.basePath));
1190
+ }
1191
+ /**
1192
+ * Refresh shared metadata for a collection
1193
+ * @param {MetadataApiRefreshMetadataByIDRequest} requestParameters Request parameters.
1194
+ * @param {*} [options] Override http request option.
1195
+ * @throws {RequiredError}
1196
+ * @memberof MetadataApi
1197
+ */
1198
+ refreshMetadataByID(requestParameters, options) {
1199
+ return MetadataApiFp(this.configuration).refreshMetadataByID(requestParameters.chainName, requestParameters.contractAddress, requestParameters.refreshMetadataByIDRequest, options).then((request) => request(this.axios, this.basePath));
1200
+ }
920
1201
  }
921
1202
 
922
1203
  /* tslint:disable */
@@ -1557,7 +1838,7 @@ const OrdersApiAxiosParamCreator = function (configuration) {
1557
1838
  * @param {string} chainName
1558
1839
  * @param {string} [accountAddress]
1559
1840
  * @param {number} [pageSize] Maximum number of trades to return per page
1560
- * @param {'created_at'} [sortBy] Trade field to sort by
1841
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1561
1842
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1562
1843
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1563
1844
  * @param {*} [options] Override http request option.
@@ -1682,7 +1963,7 @@ const OrdersApiFp = function (configuration) {
1682
1963
  * @param {string} chainName
1683
1964
  * @param {string} [accountAddress]
1684
1965
  * @param {number} [pageSize] Maximum number of trades to return per page
1685
- * @param {'created_at'} [sortBy] Trade field to sort by
1966
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1686
1967
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1687
1968
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1688
1969
  * @param {*} [options] Override http request option.
@@ -1769,7 +2050,7 @@ const OrdersApiFactory = function (configuration, basePath, axios) {
1769
2050
  * @param {string} chainName
1770
2051
  * @param {string} [accountAddress]
1771
2052
  * @param {number} [pageSize] Maximum number of trades to return per page
1772
- * @param {'created_at'} [sortBy] Trade field to sort by
2053
+ * @param {'indexed_at'} [sortBy] Trade field to sort by
1773
2054
  * @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
1774
2055
  * @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
1775
2056
  * @param {*} [options] Override http request option.
@@ -2675,6 +2956,10 @@ var index = /*#__PURE__*/Object.freeze({
2675
2956
  ERC20ItemItemTypeEnum: ERC20ItemItemTypeEnum,
2676
2957
  ERC721ItemItemTypeEnum: ERC721ItemItemTypeEnum,
2677
2958
  FeeFeeTypeEnum: FeeFeeTypeEnum,
2959
+ MetadataApi: MetadataApi,
2960
+ MetadataApiAxiosParamCreator: MetadataApiAxiosParamCreator,
2961
+ MetadataApiFactory: MetadataApiFactory,
2962
+ MetadataApiFp: MetadataApiFp,
2678
2963
  NFTContractType: NFTContractType,
2679
2964
  NativeItemItemTypeEnum: NativeItemItemTypeEnum,
2680
2965
  NftOwnersApi: NftOwnersApi,
@@ -2725,7 +3010,7 @@ class MultiRollupApiClients {
2725
3010
  }
2726
3011
 
2727
3012
  // eslint-disable-next-line @typescript-eslint/naming-convention
2728
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.20.0' };
3013
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.20.1-alpha.1' };
2729
3014
  const createConfig = ({ basePath, headers, }) => {
2730
3015
  if (!basePath.trim()) {
2731
3016
  throw Error('basePath can not be empty');
@@ -2785,7 +3070,7 @@ class APIError extends Error {
2785
3070
 
2786
3071
  /* eslint-disable implicit-arrow-linebreak */
2787
3072
  const defaultHeaders = {
2788
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.20.0',
3073
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.20.1-alpha.1',
2789
3074
  };
2790
3075
  /**
2791
3076
  * createAPIConfiguration to create a custom Configuration
@@ -3071,7 +3356,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3071
3356
  chainID,
3072
3357
  coreContractAddress,
3073
3358
  registrationContractAddress,
3074
- sdkVersion: 'ts-immutable-sdk-0.20.0',
3359
+ sdkVersion: 'ts-immutable-sdk-0.20.1-alpha.1',
3075
3360
  });
3076
3361
  /**
3077
3362
  * Sets `sdkVersion` at the time of build
@@ -8829,6 +9114,7 @@ var ReceiveMessage;
8829
9114
  ReceiveMessage["TRANSACTION_ERROR"] = "transaction_error";
8830
9115
  ReceiveMessage["MESSAGE_CONFIRMED"] = "message_confirmed";
8831
9116
  ReceiveMessage["MESSAGE_REJECTED"] = "message_rejected";
9117
+ ReceiveMessage["LOGOUT_SUCCESS"] = "logout_success";
8832
9118
  })(ReceiveMessage || (ReceiveMessage = {}));
8833
9119
  const PASSPORT_EVENT_TYPE = 'imx_passport_confirmation';
8834
9120
 
@@ -8853,6 +9139,8 @@ const CONFIRMATION_WINDOW_TITLE = 'Confirm this transaction';
8853
9139
  const CONFIRMATION_WINDOW_HEIGHT = 380;
8854
9140
  const CONFIRMATION_WINDOW_WIDTH = 480;
8855
9141
  const CONFIRMATION_WINDOW_CLOSED_POLLING_DURATION = 1000;
9142
+ const CONFIRMATION_IFRAME_ID = 'passport-confirm';
9143
+ const CONFIRMATION_IFRAME_STYLE = 'display: none; position: absolute;width:0px;height:0px;border:0;';
8856
9144
  class ConfirmationScreen {
8857
9145
  config;
8858
9146
  confirmationWindow;
@@ -8946,6 +9234,28 @@ class ConfirmationScreen {
8946
9234
  closeWindow() {
8947
9235
  this.confirmationWindow?.close();
8948
9236
  }
9237
+ logout() {
9238
+ return new Promise((resolve, rejects) => {
9239
+ const iframe = document.createElement('iframe');
9240
+ iframe.setAttribute('id', CONFIRMATION_IFRAME_ID);
9241
+ iframe.setAttribute('src', `${this.config.passportDomain}/transaction-confirmation/logout`);
9242
+ iframe.setAttribute('style', CONFIRMATION_IFRAME_STYLE);
9243
+ const logoutHandler = ({ data, origin }) => {
9244
+ if (origin !== this.config.passportDomain
9245
+ || data.eventType !== PASSPORT_EVENT_TYPE) {
9246
+ return;
9247
+ }
9248
+ window.removeEventListener('message', logoutHandler);
9249
+ iframe.remove();
9250
+ if (data.messageType === ReceiveMessage.LOGOUT_SUCCESS) {
9251
+ resolve({ logout: true });
9252
+ }
9253
+ rejects(new Error('Unsupported logout type'));
9254
+ };
9255
+ window.addEventListener('message', logoutHandler);
9256
+ document.body.appendChild(iframe);
9257
+ });
9258
+ }
8949
9259
  showConfirmationScreen(href, messageHandler, resolve) {
8950
9260
  this.confirmationWindow.location.href = href;
8951
9261
  // https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
@@ -9291,7 +9601,11 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
9291
9601
  RelayerTransactionStatus.SUBMITTED,
9292
9602
  RelayerTransactionStatus.SUCCESSFUL,
9293
9603
  ].includes(relayerTransaction.status)) {
9294
- throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, `Transaction failed to submit with status ${relayerTransaction.status}`);
9604
+ let errorMessage = `Transaction failed to submit with status ${relayerTransaction.status}.`;
9605
+ if (relayerTransaction.statusMessage) {
9606
+ errorMessage += ` Error message: ${relayerTransaction.statusMessage}`;
9607
+ }
9608
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, errorMessage);
9295
9609
  }
9296
9610
  return relayerTransaction.hash;
9297
9611
  });
@@ -9641,6 +9955,7 @@ class Passport {
9641
9955
  }
9642
9956
  async logout() {
9643
9957
  await this.authManager.logout();
9958
+ await this.confirmationScreen.logout();
9644
9959
  // Code after this point is only executed if the logout mode is silent
9645
9960
  await this.magicAdapter.logout();
9646
9961
  this.passportEventEmitter.emit(PassportEvents.LOGGED_OUT);
@@ -10255,8 +10570,8 @@ var Fee;
10255
10570
  (function (Fee) {
10256
10571
  (function (fee_type) {
10257
10572
  fee_type["ROYALTY"] = "ROYALTY";
10258
- fee_type["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
10259
- fee_type["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
10573
+ fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
10574
+ fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
10260
10575
  fee_type["PROTOCOL"] = "PROTOCOL";
10261
10576
  })(Fee.fee_type || (Fee.fee_type = {}));
10262
10577
  })(Fee || (Fee = {}));
@@ -10289,8 +10604,8 @@ var ProtocolData;
10289
10604
 
10290
10605
  var FeeType;
10291
10606
  (function (FeeType) {
10292
- FeeType["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
10293
- FeeType["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
10607
+ FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
10608
+ FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
10294
10609
  FeeType["PROTOCOL"] = "PROTOCOL";
10295
10610
  FeeType["ROYALTY"] = "ROYALTY";
10296
10611
  })(FeeType || (FeeType = {}));
@@ -10347,8 +10662,8 @@ function mapFromOpenApiOrder(order) {
10347
10662
  type: fee.fee_type,
10348
10663
  })),
10349
10664
  chain: order.chain,
10350
- createTime: order.create_time,
10351
- endTime: order.end_time,
10665
+ createdAt: order.created_at,
10666
+ endAt: order.end_at,
10352
10667
  protocolData: {
10353
10668
  counter: order.protocol_data.counter,
10354
10669
  orderType: order.protocol_data.order_type,
@@ -10358,9 +10673,9 @@ function mapFromOpenApiOrder(order) {
10358
10673
  },
10359
10674
  salt: order.salt,
10360
10675
  signature: order.signature,
10361
- startTime: order.start_time,
10676
+ startAt: order.start_at,
10362
10677
  status: order.status,
10363
- updateTime: order.update_time,
10678
+ updatedAt: order.updated_at,
10364
10679
  };
10365
10680
  }
10366
10681
  function mapFromOpenApiTrade(trade) {
@@ -10563,8 +10878,8 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
10563
10878
  };
10564
10879
  }),
10565
10880
  counter,
10566
- endTime: Math.round(new Date(order.end_time).getTime() / 1000).toString(),
10567
- startTime: Math.round(new Date(order.start_time).getTime() / 1000).toString(),
10881
+ endTime: Math.round(new Date(order.end_at).getTime() / 1000).toString(),
10882
+ startTime: Math.round(new Date(order.start_at).getTime() / 1000).toString(),
10568
10883
  salt: order.salt,
10569
10884
  offerer: order.account_address,
10570
10885
  zone: zoneAddress,
@@ -10792,10 +11107,10 @@ class ImmutableApiClient {
10792
11107
  ],
10793
11108
  fees: makerFees.map((x) => ({
10794
11109
  amount: x.amount,
10795
- fee_type: FeeType.MAKER_MARKETPLACE,
11110
+ fee_type: FeeType.MAKER_ECOSYSTEM,
10796
11111
  recipient: x.recipient,
10797
11112
  })),
10798
- end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
11113
+ end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
10799
11114
  protocol_data: {
10800
11115
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
10801
11116
  zone_address: orderComponents.zone,
@@ -10812,7 +11127,7 @@ class ImmutableApiClient {
10812
11127
  },
10813
11128
  ],
10814
11129
  signature: orderSignature,
10815
- start_time: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
11130
+ start_at: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
10816
11131
  },
10817
11132
  });
10818
11133
  }
@@ -11005,7 +11320,7 @@ class Orderbook {
11005
11320
  order_id: listingId,
11006
11321
  fees: takerFees.map((fee) => ({
11007
11322
  amount: fee.amount,
11008
- fee_type: FeeType.TAKER_MARKETPLACE,
11323
+ fee_type: FeeType.TAKER_ECOSYSTEM,
11009
11324
  recipient: fee.recipient,
11010
11325
  })),
11011
11326
  },
@@ -28210,14 +28525,16 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
28210
28525
  CheckoutErrorType["CANCEL_ORDER_LISTING_ERROR"] = "CANCEL_ORDER_LISTING_ERROR";
28211
28526
  CheckoutErrorType["PREPARE_ORDER_LISTING_ERROR"] = "PREPARE_ORDER_LISTING_ERROR";
28212
28527
  CheckoutErrorType["CREATE_ORDER_LISTING_ERROR"] = "CREATE_ORDER_LISTING_ERROR";
28528
+ CheckoutErrorType["FULFILL_ORDER_LISTING_ERROR"] = "FULFILL_ORDER_LISTING_ERROR";
28213
28529
  CheckoutErrorType["SWITCH_NETWORK_UNSUPPORTED"] = "SWITCH_NETWORK_UNSUPPORTED";
28214
28530
  CheckoutErrorType["GET_ERC20_ALLOWANCE_ERROR"] = "GET_ERC20_ALLOWANCE_ERROR";
28215
28531
  CheckoutErrorType["GET_ERC721_ALLOWANCE_ERROR"] = "GET_ERC721_ALLOWANCE_ERROR";
28216
28532
  CheckoutErrorType["EXECUTE_APPROVAL_TRANSACTION_ERROR"] = "EXECUTE_APPROVAL_TRANSACTION_ERROR";
28217
- CheckoutErrorType["EXECUTE_FULFILMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILMENT_TRANSACTION_ERROR";
28533
+ CheckoutErrorType["EXECUTE_FULFILLMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR";
28218
28534
  CheckoutErrorType["SIGN_MESSAGE_ERROR"] = "SIGN_MESSAGE_ERROR";
28219
28535
  CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
28220
28536
  CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
28537
+ CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
28221
28538
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
28222
28539
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
28223
28540
  message;
@@ -29071,6 +29388,12 @@ function $67fc622a2b913d5f$export$436dd76f23f463ff(config) {
29071
29388
 
29072
29389
 
29073
29390
 
29391
+ function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, signerOrProvider) {
29392
+ return new (ethers.Contract)(address, contractInterface, signerOrProvider);
29393
+ }
29394
+
29395
+
29396
+
29074
29397
 
29075
29398
 
29076
29399
  const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
@@ -29798,7 +30121,7 @@ const $7d1bfafb81e64d74$export$3a4140bd9e983e4e = async (provider, insufficientI
29798
30121
  if (item.approvalTransaction === undefined) continue;
29799
30122
  estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, item.approvalTransaction));
29800
30123
  }
29801
- // If the transaction is a fulfilment transaction get the estimate gas promise
30124
+ // If the transaction is a fulfillment transaction get the estimate gas promise
29802
30125
  // Otherwise use the gas amount with the limit to estimate the gas
29803
30126
  if (transactionOrGas.type === ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION) estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, transactionOrGas.transaction));
29804
30127
  else {
@@ -29961,10 +30284,9 @@ const $823db9fb0ca4bc15$export$1430626eec86fce9 = (chainId)=>{
29961
30284
  if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET) return "imtbl-zkevm-testnet";
29962
30285
  return "";
29963
30286
  };
29964
- const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = (chainId)=>{
29965
- if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA) return "0x2Fa06C6672dDCc066Ab04631192738799231dE4a";
29966
- if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM) return "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF";
29967
- return "";
30287
+ const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = async (chainId, config)=>{
30288
+ const imxMappingConfig = await config.remote.getConfig("imxAddressMapping");
30289
+ return imxMappingConfig[chainId] ?? "";
29968
30290
  };
29969
30291
 
29970
30292
 
@@ -30055,7 +30377,7 @@ const $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f = (balanceRequirement)=>{
30055
30377
  const $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6 = async (config, balanceRequirement)=>{
30056
30378
  const l2address = $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f(balanceRequirement);
30057
30379
  if (l2address === "") return "";
30058
- if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
30380
+ if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return await ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config), config);
30059
30381
  const chainName = ($823db9fb0ca4bc15$export$1430626eec86fce9)(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
30060
30382
  if (chainName === "") return ""; // Chain name not a valid indexer chain name
30061
30383
  const blockchainData = ($67fc622a2b913d5f$export$436dd76f23f463ff)(config);
@@ -30271,14 +30593,15 @@ const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, swapFees, approva
30271
30593
  return true;
30272
30594
  };
30273
30595
  const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, dexQuoteCache, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens)=>{
30274
- if (!availableRoutingOptions.swap) return undefined;
30275
- if (swappableTokens.length === 0) return undefined;
30596
+ const fundingSteps = [];
30597
+ if (!availableRoutingOptions.swap) return fundingSteps;
30598
+ if (swappableTokens.length === 0) return fundingSteps;
30276
30599
  const requiredToken = $91807edfd7057288$export$85e4d8628aabb217(balanceRequirement);
30277
- if (requiredToken.address === "") return undefined;
30600
+ if (requiredToken.address === "") return fundingSteps;
30278
30601
  const l2TokenBalanceResult = tokenBalanceResults.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
30279
- if (!l2TokenBalanceResult) return undefined;
30602
+ if (!l2TokenBalanceResult) return fundingSteps;
30280
30603
  const l2Balances = l2TokenBalanceResult.balances;
30281
- if (l2Balances.length === 0) return undefined;
30604
+ if (l2Balances.length === 0) return fundingSteps;
30282
30605
  const quotes = await ($3ee85f12225c19f3$export$fb80fe94a81a3132)(config, dexQuoteCache, walletAddress, requiredToken, swappableTokens);
30283
30606
  const quoteTokenAddresses = Array.from(quotes.keys());
30284
30607
  for (const quoteTokenAddress of quoteTokenAddresses){
@@ -30302,7 +30625,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30302
30625
  })) continue;
30303
30626
  // User has sufficient funds to cover any approval and swap fees so use this token for the funding route
30304
30627
  // Currently we are not prioritising any particular token so just taking the first sufficient token
30305
- return {
30628
+ fundingSteps.push({
30306
30629
  type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).SWAP,
30307
30630
  chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
30308
30631
  asset: {
@@ -30310,9 +30633,9 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30310
30633
  formattedBalance: userBalanceOfQuotedToken.formattedBalance,
30311
30634
  token: userBalanceOfQuotedToken.token
30312
30635
  }
30313
- };
30636
+ });
30314
30637
  }
30315
- return undefined;
30638
+ return fundingSteps;
30316
30639
  };
30317
30640
 
30318
30641
 
@@ -30347,6 +30670,7 @@ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutin
30347
30670
 
30348
30671
 
30349
30672
 
30673
+ const $c16168a9c28ae4fd$var$hasAvailableRoutingOptions = (availableRoutingOptions)=>availableRoutingOptions.bridge || availableRoutingOptions.swap || availableRoutingOptions.onRamp;
30350
30674
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30351
30675
  let insufficientBalanceCount = 0;
30352
30676
  let insufficientRequirement;
@@ -30357,18 +30681,18 @@ const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30357
30681
  if (insufficientBalanceCount === 1) return insufficientRequirement;
30358
30682
  return undefined;
30359
30683
  };
30360
- const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList)=>{
30361
- if (!availableRoutingOptions.swap) return undefined;
30362
- if (insufficientRequirement === undefined) return undefined;
30363
- if (swapTokenAllowList === undefined) return undefined;
30684
+ const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList)=>{
30685
+ const fundingSteps = [];
30686
+ if (!availableRoutingOptions.swap) return fundingSteps;
30687
+ if (insufficientRequirement === undefined) return fundingSteps;
30688
+ if (swapTokenAllowList === undefined) return fundingSteps;
30364
30689
  const tokenBalanceResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
30365
- if (!tokenBalanceResult) return undefined;
30366
- if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return undefined;
30367
- if (swapTokenAllowList.length === 0) return undefined;
30690
+ if (!tokenBalanceResult) return fundingSteps;
30691
+ if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return fundingSteps;
30692
+ if (swapTokenAllowList.length === 0) return fundingSteps;
30368
30693
  const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
30369
- if (swappableTokens.length === 0) return undefined;
30370
- const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30371
- return swapFundingStep;
30694
+ if (swappableTokens.length === 0) return fundingSteps;
30695
+ return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30372
30696
  };
30373
30697
  const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
30374
30698
  if (!availableRoutingOptions.onRamp) return undefined;
@@ -30377,6 +30701,13 @@ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutin
30377
30701
  return onRampFundingStep;
30378
30702
  };
30379
30703
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
30704
+ if (!$c16168a9c28ae4fd$var$hasAvailableRoutingOptions(availableRoutingOptions)) return {
30705
+ response: {
30706
+ type: ($b23305044c0e096a$export$3057de18ac0c076).NO_OPTIONS,
30707
+ message: "No options available"
30708
+ },
30709
+ fundingRoutes: []
30710
+ };
30380
30711
  let readOnlyProviders;
30381
30712
  try {
30382
30713
  readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
@@ -30395,7 +30726,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30395
30726
  const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
30396
30727
  let bridgeFundingStep;
30397
30728
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
30398
- const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30729
+ const swapFundingSteps = await $c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30399
30730
  const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
30400
30731
  // Check swap routes
30401
30732
  // > Could bridge first
@@ -30409,7 +30740,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30409
30740
  fundingRoutes: []
30410
30741
  };
30411
30742
  let priority = 0;
30412
- if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
30743
+ if (bridgeFundingStep || swapFundingSteps.length > 0 || onRampFundingStep) {
30413
30744
  response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
30414
30745
  response.response.message = "Routes found";
30415
30746
  }
@@ -30422,13 +30753,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30422
30753
  ]
30423
30754
  });
30424
30755
  }
30425
- if (swapFundingStep) {
30756
+ if (swapFundingSteps.length > 0) {
30426
30757
  priority++;
30427
- response.fundingRoutes.push({
30428
- priority: priority,
30429
- steps: [
30430
- swapFundingStep
30431
- ]
30758
+ swapFundingSteps.forEach((swapFundingStep)=>{
30759
+ response.fundingRoutes.push({
30760
+ priority: priority,
30761
+ steps: [
30762
+ swapFundingStep
30763
+ ]
30764
+ });
30432
30765
  });
30433
30766
  }
30434
30767
  if (onRampFundingStep) {
@@ -30513,13 +30846,13 @@ const $25ac589234c10b67$export$19693ca396db083e = async (provider, approvalTrans
30513
30846
  type: ($d855a5ba32004345$export$f51b97f3aaf2d5a8).SUCCESS
30514
30847
  };
30515
30848
  };
30516
- const $25ac589234c10b67$export$2161274619257102 = async (provider, fulfilmentTransactions)=>{
30849
+ const $25ac589234c10b67$export$3f05b33bd1f29038 = async (provider, fulfillmentTransactions)=>{
30517
30850
  let receipts = [];
30518
30851
  try {
30519
- const response = await Promise.all(fulfilmentTransactions.map((transaction)=>provider.getSigner().sendTransaction(transaction)));
30852
+ const response = await Promise.all(fulfillmentTransactions.map((transaction)=>provider.getSigner().sendTransaction(transaction)));
30520
30853
  receipts = await Promise.all(response.map((transaction)=>transaction.wait()));
30521
30854
  } catch (err) {
30522
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while executing the fulfilment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).EXECUTE_FULFILMENT_TRANSACTION_ERROR, {
30855
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while executing the fulfillment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
30523
30856
  message: err.message
30524
30857
  });
30525
30858
  }
@@ -30527,7 +30860,7 @@ const $25ac589234c10b67$export$2161274619257102 = async (provider, fulfilmentTra
30527
30860
  if (receipt.status === 0) return {
30528
30861
  type: ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED,
30529
30862
  transactionHash: receipt.transactionHash,
30530
- reason: "Fulfilment transaction failed and was reverted"
30863
+ reason: "Fulfillment transaction failed and was reverted"
30531
30864
  };
30532
30865
  }
30533
30866
  return {
@@ -30552,23 +30885,43 @@ const $25ac589234c10b67$export$1d9a7a8a40780de = async (provider, unsignedMessag
30552
30885
 
30553
30886
 
30554
30887
 
30555
- const $a7367d01c6e76b1c$export$b087719c36e0f2dc = async (actions)=>{
30888
+ const $a7367d01c6e76b1c$export$c5b3365853cb6159 = async (actions)=>{
30556
30889
  let approvalTransactions = [];
30557
- let fulfilmentTransactions = [];
30890
+ let fulfillmentTransactions = [];
30558
30891
  const approvalPromises = [];
30559
- const fulfilmentPromises = [];
30892
+ const fulfillmentPromises = [];
30560
30893
  for (const action of actions){
30561
30894
  if (action.type !== (ActionType).TRANSACTION) continue;
30562
30895
  if (action.purpose === (TransactionPurpose).APPROVAL) approvalPromises.push(action.buildTransaction());
30563
- if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfilmentPromises.push(action.buildTransaction());
30896
+ if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfillmentPromises.push(action.buildTransaction());
30564
30897
  }
30565
30898
  approvalTransactions = await Promise.all(approvalPromises);
30566
- fulfilmentTransactions = await Promise.all(fulfilmentPromises);
30899
+ fulfillmentTransactions = await Promise.all(fulfillmentPromises);
30567
30900
  return {
30568
30901
  approvalTransactions: approvalTransactions,
30569
- fulfilmentTransactions: fulfilmentTransactions
30902
+ fulfillmentTransactions: fulfillmentTransactions
30570
30903
  };
30571
30904
  };
30905
+ const $a7367d01c6e76b1c$export$f64a20a30eb98855 = async (actions)=>{
30906
+ let approvalTransactions = [];
30907
+ const approvalPromises = [];
30908
+ for (const action of actions){
30909
+ if (action.type !== (ActionType).TRANSACTION) continue;
30910
+ if (action.purpose === (TransactionPurpose).APPROVAL) approvalPromises.push(action.buildTransaction());
30911
+ }
30912
+ approvalTransactions = await Promise.all(approvalPromises);
30913
+ return approvalTransactions;
30914
+ };
30915
+ const $a7367d01c6e76b1c$export$396bd6ce7d3ab533 = async (actions)=>{
30916
+ let fulfillmentTransactions = [];
30917
+ const fulfillmentPromises = [];
30918
+ for (const action of actions){
30919
+ if (action.type !== (ActionType).TRANSACTION) continue;
30920
+ if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfillmentPromises.push(action.buildTransaction());
30921
+ }
30922
+ fulfillmentTransactions = await Promise.all(fulfillmentPromises);
30923
+ return fulfillmentTransactions;
30924
+ };
30572
30925
  const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, actions)=>{
30573
30926
  let unsignedMessage;
30574
30927
  for (const action of actions){
@@ -30591,6 +30944,49 @@ const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, a
30591
30944
 
30592
30945
 
30593
30946
 
30947
+
30948
+
30949
+
30950
+
30951
+ const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
30952
+ const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
30953
+ const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
30954
+ const feePercentage = orderFee.amount;
30955
+ // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30956
+ const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
30957
+ const bnFeeAmount = amountBn.mul((ethers.BigNumber).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
30958
+ return bnFeeAmount;
30959
+ };
30960
+ const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
30961
+ const feeToken = orderFee.amount;
30962
+ const bnFeeAmount = (utils$1.parseUnits)(feeToken.token, decimals);
30963
+ return bnFeeAmount;
30964
+ };
30965
+ const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
30966
+ let totalTokenFees = (ethers.BigNumber).from(0);
30967
+ const amountBn = (ethers.BigNumber).from(weiAmount);
30968
+ // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30969
+ const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
30970
+ const calculateFeesResult = [];
30971
+ for (const orderFee of orderFees){
30972
+ let currentFeeBn = (ethers.BigNumber).from(0);
30973
+ if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
30974
+ currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
30975
+ totalTokenFees = totalTokenFees.add(currentFeeBn);
30976
+ } else if (Object.hasOwn(orderFee.amount, "token")) {
30977
+ currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
30978
+ totalTokenFees = totalTokenFees.add(currentFeeBn);
30979
+ } else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
30980
+ 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);
30981
+ if (currentFeeBn.gt(0)) calculateFeesResult.push({
30982
+ amount: currentFeeBn.toString(),
30983
+ recipient: orderFee.recipient
30984
+ });
30985
+ } // for
30986
+ return calculateFeesResult;
30987
+ };
30988
+
30989
+
30594
30990
  const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
30595
30991
  switch(type){
30596
30992
  case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
@@ -30608,10 +31004,10 @@ const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount
30608
31004
  };
30609
31005
  }
30610
31006
  };
30611
- const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, unsignedTransactions)=>{
30612
- if (unsignedTransactions.fulfilmentTransactions.length > 0) return {
31007
+ const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, fulfillmentTransactions)=>{
31008
+ if (fulfillmentTransactions.length > 0) return {
30613
31009
  type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION,
30614
- transaction: unsignedTransactions.fulfilmentTransactions[0]
31010
+ transaction: fulfillmentTransactions[0]
30615
31011
  };
30616
31012
  return {
30617
31013
  type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
@@ -30621,34 +31017,54 @@ const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, unsignedTransaction
30621
31017
  }
30622
31018
  };
30623
31019
  };
30624
- const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, orderId)=>{
31020
+ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, orders)=>{
30625
31021
  let orderbook;
30626
31022
  let order;
30627
31023
  let spenderAddress = "";
30628
31024
  const gasLimit = (constants).estimatedFulfillmentGasGwei;
31025
+ 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);
31026
+ const { id: id, takerFees: takerFees } = orders[0];
30629
31027
  try {
30630
31028
  orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
30631
- order = await orderbook.getListing(orderId);
31029
+ order = await orderbook.getListing(id);
30632
31030
  const { seaportContractAddress: seaportContractAddress } = orderbook.config();
30633
31031
  spenderAddress = seaportContractAddress;
30634
31032
  } catch (err) {
30635
31033
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while getting the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ORDER_LISTING_ERROR, {
30636
- orderId: orderId,
31034
+ orderId: id,
30637
31035
  message: err.message
30638
31036
  });
30639
31037
  }
30640
- let unsignedTransactions = {
30641
- approvalTransactions: [],
30642
- fulfilmentTransactions: []
30643
- };
31038
+ 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, {
31039
+ orderId: id,
31040
+ message: "No buy side tokens found on order"
31041
+ });
31042
+ const buyToken = order.result.buy[0];
31043
+ let decimals = 18;
31044
+ if (order.result.buy[0].type === "ERC20") {
31045
+ const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
31046
+ decimals = await tokenContract.decimals();
31047
+ }
31048
+ let fees = [];
31049
+ if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
31050
+ let unsignedApprovalTransactions = [];
31051
+ let unsignedFulfillmentTransactions = [];
31052
+ let orderActions = [];
30644
31053
  try {
30645
31054
  const fulfillerAddress = await provider.getSigner().getAddress();
30646
- const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
30647
- unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
31055
+ const { actions: actions } = await orderbook.fulfillOrder(id, fulfillerAddress, fees);
31056
+ orderActions = actions;
31057
+ unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
30648
31058
  } catch {
30649
31059
  // Silently ignore error as this is usually thrown if user does not have enough balance
30650
31060
  // todo: if balance error - can we determine if its the balance error otherwise throw?
30651
31061
  }
31062
+ try {
31063
+ unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
31064
+ } catch {
31065
+ // if cannot estimate gas then silently continue and use gas limit in smartCheckout
31066
+ // but get the fulfillment transactions after they have approved the spending
31067
+ }
30652
31068
  let amount = (ethers.BigNumber).from("0");
30653
31069
  let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
30654
31070
  let contractAddress = "";
@@ -30663,7 +31079,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30663
31079
  break;
30664
31080
  default:
30665
31081
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Purchasing token type is unsupported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_TOKEN_TYPE_ERROR, {
30666
- orderId: orderId
31082
+ orderId: id
30667
31083
  });
30668
31084
  }
30669
31085
  buyArray.forEach((item)=>{
@@ -30676,31 +31092,38 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30676
31092
  const itemRequirements = [
30677
31093
  $64863c39386de592$export$4249179755829904(type, contractAddress, amount, spenderAddress)
30678
31094
  ];
30679
- const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedTransactions));
31095
+ const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions));
30680
31096
  if (smartCheckoutResult.sufficient) {
30681
- const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
31097
+ const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
30682
31098
  if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
30683
31099
  smartCheckoutResult: smartCheckoutResult,
30684
- orderId: orderId,
31100
+ orderId: id,
30685
31101
  status: {
30686
31102
  type: ($aa144554f9ef124b$export$226b052ecb8ca80).FAILED,
30687
31103
  transactionHash: approvalResult.transactionHash,
30688
31104
  reason: approvalResult.reason
30689
31105
  }
30690
31106
  };
30691
- const fulfilmentResult = await ($25ac589234c10b67$export$2161274619257102)(provider, unsignedTransactions.fulfilmentTransactions);
30692
- if (fulfilmentResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
31107
+ try {
31108
+ if (unsignedFulfillmentTransactions.length === 0) unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
31109
+ } catch (err) {
31110
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error fetching fulfillment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR, {
31111
+ message: err.message
31112
+ });
31113
+ }
31114
+ const fulfillmentResult = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, unsignedFulfillmentTransactions);
31115
+ if (fulfillmentResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
30693
31116
  smartCheckoutResult: smartCheckoutResult,
30694
- orderId: orderId,
31117
+ orderId: id,
30695
31118
  status: {
30696
31119
  type: ($aa144554f9ef124b$export$226b052ecb8ca80).FAILED,
30697
- transactionHash: fulfilmentResult.transactionHash,
30698
- reason: fulfilmentResult.reason
31120
+ transactionHash: fulfillmentResult.transactionHash,
31121
+ reason: fulfillmentResult.reason
30699
31122
  }
30700
31123
  };
30701
31124
  return {
30702
31125
  smartCheckoutResult: smartCheckoutResult,
30703
- orderId: orderId,
31126
+ orderId: id,
30704
31127
  status: {
30705
31128
  type: ($aa144554f9ef124b$export$226b052ecb8ca80).SUCCESS
30706
31129
  }
@@ -30708,7 +31131,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30708
31131
  }
30709
31132
  return {
30710
31133
  smartCheckoutResult: smartCheckoutResult,
30711
- orderId: orderId
31134
+ orderId: id
30712
31135
  };
30713
31136
  };
30714
31137
 
@@ -30720,8 +31143,11 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30720
31143
 
30721
31144
 
30722
31145
 
30723
- const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderId)=>{
31146
+ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
30724
31147
  let unsignedCancelOrderTransaction;
31148
+ 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);
31149
+ // Update this when bulk cancel is supproted
31150
+ const orderId = orderIds[0];
30725
31151
  try {
30726
31152
  const offererAddress = await provider.getSigner().getAddress();
30727
31153
  const orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
@@ -30733,7 +31159,7 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
30733
31159
  message: err.message
30734
31160
  });
30735
31161
  }
30736
- const result = await ($25ac589234c10b67$export$2161274619257102)(provider, [
31162
+ const result = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, [
30737
31163
  unsignedCancelOrderTransaction
30738
31164
  ]);
30739
31165
  if (result.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
@@ -30766,47 +31192,6 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
30766
31192
 
30767
31193
 
30768
31194
 
30769
-
30770
-
30771
- const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
30772
- const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
30773
- const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
30774
- const feePercentage = orderFee.amount;
30775
- // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30776
- const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
30777
- const bnFeeAmount = amountBn.mul((ethers.BigNumber).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
30778
- return bnFeeAmount;
30779
- };
30780
- const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
30781
- const feeToken = orderFee.amount;
30782
- const bnFeeAmount = (utils$1.parseUnits)(feeToken.token, decimals);
30783
- return bnFeeAmount;
30784
- };
30785
- const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
30786
- let totalTokenFees = (ethers.BigNumber).from(0);
30787
- const amountBn = (ethers.BigNumber).from(weiAmount);
30788
- // note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
30789
- const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
30790
- const calculateFeesResult = [];
30791
- for (const orderFee of orderFees){
30792
- let currentFeeBn = (ethers.BigNumber).from(0);
30793
- if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
30794
- currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
30795
- totalTokenFees = totalTokenFees.add(currentFeeBn);
30796
- } else if (Object.hasOwn(orderFee.amount, "token")) {
30797
- currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
30798
- totalTokenFees = totalTokenFees.add(currentFeeBn);
30799
- } else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
30800
- 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);
30801
- if (currentFeeBn.gt(0)) calculateFeesResult.push({
30802
- amount: currentFeeBn.toString(),
30803
- recipient: orderFee.recipient
30804
- });
30805
- } // for
30806
- return calculateFeesResult;
30807
- };
30808
-
30809
-
30810
31195
  const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
30811
31196
  type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
30812
31197
  id: id,
@@ -30835,7 +31220,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30835
31220
  if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
30836
31221
  // get this from the allowed list
30837
31222
  const buyTokenContract = new (ethers.Contract)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
30838
- decimals = buyTokenContract.decimals();
31223
+ decimals = await buyTokenContract.decimals();
30839
31224
  }
30840
31225
  const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
30841
31226
  try {
@@ -30878,7 +31263,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30878
31263
  collectionAddress: sellToken.collectionAddress
30879
31264
  });
30880
31265
  const signedMessage = await ($25ac589234c10b67$export$1d9a7a8a40780de)(provider, unsignedMessage);
30881
- const unsignedTransactions = await ($a7367d01c6e76b1c$export$b087719c36e0f2dc)(listing.actions);
31266
+ const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
30882
31267
  const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
30883
31268
  if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
30884
31269
  id: sellToken.id,
@@ -30978,6 +31363,38 @@ class $a77d203f701a3b72$export$1453e9b801542ef4 {
30978
31363
 
30979
31364
 
30980
31365
 
31366
+
31367
+
31368
+
31369
+ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements) {
31370
+ // Get all decimal values by calling contracts for each ERC20
31371
+ const decimalPromises = [];
31372
+ requirements.forEach((itemRequirementParam)=>{
31373
+ if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
31374
+ const { contractAddress: contractAddress } = itemRequirementParam;
31375
+ decimalPromises.push(($06a6c5c23f7f2479$export$fbbc17f6e6e58544)(contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider).decimals());
31376
+ }
31377
+ });
31378
+ const decimals = await Promise.all(decimalPromises);
31379
+ // Map ItemRequirementsParam objects to ItemRequirement by parsing amounts from formatted string to BigNumebrs
31380
+ const itemRequirements = requirements.map((itemRequirementParam, index)=>{
31381
+ if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return {
31382
+ ...itemRequirementParam,
31383
+ amount: (utils$1.parseUnits)(itemRequirementParam.amount, 18)
31384
+ };
31385
+ if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return {
31386
+ ...itemRequirementParam,
31387
+ amount: (utils$1.parseUnits)(itemRequirementParam.amount, decimals[index])
31388
+ };
31389
+ return itemRequirementParam;
31390
+ });
31391
+ return itemRequirements;
31392
+ }
31393
+
31394
+
31395
+
31396
+
31397
+
30981
31398
  const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
30982
31399
  baseConfig: {
30983
31400
  environment: (Environment$1).SANDBOX
@@ -31104,8 +31521,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
31104
31521
  if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
31105
31522
  // eslint-disable-next-line no-console
31106
31523
  console.warn("This endpoint is currently under construction.");
31524
+ if (params.orders.length > 1) // eslint-disable-next-line no-console
31525
+ console.warn("This endpoint currently only actions the first order in the array.");
31107
31526
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
31108
- await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orderId);
31527
+ await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orders);
31109
31528
  }
31110
31529
  /**
31111
31530
  * Determines the requirements for performing a sell.
@@ -31128,8 +31547,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
31128
31547
  if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
31129
31548
  // eslint-disable-next-line no-console
31130
31549
  console.warn("This endpoint is currently under construction.");
31550
+ // eslint-disable-next-line no-console
31551
+ console.warn("This endpoint currently only actions the first order in the array.");
31131
31552
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
31132
- await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderId);
31553
+ await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderIds);
31133
31554
  }
31134
31555
  /**
31135
31556
  * Determines the transaction requirements to complete a purchase.
@@ -31139,8 +31560,13 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
31139
31560
  // eslint-disable-next-line no-console
31140
31561
  console.warn("This endpoint is currently under construction.");
31141
31562
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
31142
- // console.log('Smart Checkout Params ::', params);
31143
- await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, params.itemRequirements, params.transactionOrGasAmount);
31563
+ let itemRequirements = [];
31564
+ try {
31565
+ itemRequirements = await (0, $d35036efee31c5d1$export$dc8635800ef20f4b)(web3Provider, params.itemRequirements);
31566
+ } catch {
31567
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Failed to map item requirements", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ITEM_REQUIREMENTS_ERROR);
31568
+ }
31569
+ await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
31144
31570
  }
31145
31571
  /**
31146
31572
  * Checks if the given object is a Web3 provider.
@@ -31217,7 +31643,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31217
31643
  function $parcel$export(e, n, v, s) {
31218
31644
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31219
31645
  }
31220
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.20.0";
31646
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.20.1-alpha.1";
31221
31647
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31222
31648
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31223
31649