@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/blockchain_data.d.ts +56 -50
- package/dist/blockchain_data.js +289 -4
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +71 -25
- package/dist/checkout_sdk.js +529 -133
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -30
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +563 -137
- package/dist/index.d.ts +149 -89
- package/dist/index.js +563 -137
- package/dist/orderbook.d.ts +15 -15
- package/dist/orderbook.js +14 -14
- package/dist/passport.js +111 -5
- package/package.json +2 -2
package/dist/checkout_sdk.js
CHANGED
|
@@ -16167,8 +16167,8 @@ var Fee;
|
|
|
16167
16167
|
(function (Fee) {
|
|
16168
16168
|
(function (fee_type) {
|
|
16169
16169
|
fee_type["ROYALTY"] = "ROYALTY";
|
|
16170
|
-
fee_type["
|
|
16171
|
-
fee_type["
|
|
16170
|
+
fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
16171
|
+
fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
16172
16172
|
fee_type["PROTOCOL"] = "PROTOCOL";
|
|
16173
16173
|
})(Fee.fee_type || (Fee.fee_type = {}));
|
|
16174
16174
|
})(Fee || (Fee = {}));
|
|
@@ -16201,8 +16201,8 @@ var ProtocolData;
|
|
|
16201
16201
|
|
|
16202
16202
|
var FeeType;
|
|
16203
16203
|
(function (FeeType) {
|
|
16204
|
-
FeeType["
|
|
16205
|
-
FeeType["
|
|
16204
|
+
FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
16205
|
+
FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
16206
16206
|
FeeType["PROTOCOL"] = "PROTOCOL";
|
|
16207
16207
|
FeeType["ROYALTY"] = "ROYALTY";
|
|
16208
16208
|
})(FeeType || (FeeType = {}));
|
|
@@ -16259,8 +16259,8 @@ function mapFromOpenApiOrder(order) {
|
|
|
16259
16259
|
type: fee.fee_type,
|
|
16260
16260
|
})),
|
|
16261
16261
|
chain: order.chain,
|
|
16262
|
-
|
|
16263
|
-
|
|
16262
|
+
createdAt: order.created_at,
|
|
16263
|
+
endAt: order.end_at,
|
|
16264
16264
|
protocolData: {
|
|
16265
16265
|
counter: order.protocol_data.counter,
|
|
16266
16266
|
orderType: order.protocol_data.order_type,
|
|
@@ -16270,9 +16270,9 @@ function mapFromOpenApiOrder(order) {
|
|
|
16270
16270
|
},
|
|
16271
16271
|
salt: order.salt,
|
|
16272
16272
|
signature: order.signature,
|
|
16273
|
-
|
|
16273
|
+
startAt: order.start_at,
|
|
16274
16274
|
status: order.status,
|
|
16275
|
-
|
|
16275
|
+
updatedAt: order.updated_at,
|
|
16276
16276
|
};
|
|
16277
16277
|
}
|
|
16278
16278
|
function mapFromOpenApiTrade(trade) {
|
|
@@ -16475,8 +16475,8 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
16475
16475
|
};
|
|
16476
16476
|
}),
|
|
16477
16477
|
counter,
|
|
16478
|
-
endTime: Math.round(new Date(order.
|
|
16479
|
-
startTime: Math.round(new Date(order.
|
|
16478
|
+
endTime: Math.round(new Date(order.end_at).getTime() / 1000).toString(),
|
|
16479
|
+
startTime: Math.round(new Date(order.start_at).getTime() / 1000).toString(),
|
|
16480
16480
|
salt: order.salt,
|
|
16481
16481
|
offerer: order.account_address,
|
|
16482
16482
|
zone: zoneAddress,
|
|
@@ -16704,10 +16704,10 @@ class ImmutableApiClient {
|
|
|
16704
16704
|
],
|
|
16705
16705
|
fees: makerFees.map((x) => ({
|
|
16706
16706
|
amount: x.amount,
|
|
16707
|
-
fee_type: FeeType.
|
|
16707
|
+
fee_type: FeeType.MAKER_ECOSYSTEM,
|
|
16708
16708
|
recipient: x.recipient,
|
|
16709
16709
|
})),
|
|
16710
|
-
|
|
16710
|
+
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
16711
16711
|
protocol_data: {
|
|
16712
16712
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
16713
16713
|
zone_address: orderComponents.zone,
|
|
@@ -16724,7 +16724,7 @@ class ImmutableApiClient {
|
|
|
16724
16724
|
},
|
|
16725
16725
|
],
|
|
16726
16726
|
signature: orderSignature,
|
|
16727
|
-
|
|
16727
|
+
start_at: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
|
|
16728
16728
|
},
|
|
16729
16729
|
});
|
|
16730
16730
|
}
|
|
@@ -16917,7 +16917,7 @@ class Orderbook {
|
|
|
16917
16917
|
order_id: listingId,
|
|
16918
16918
|
fees: takerFees.map((fee) => ({
|
|
16919
16919
|
amount: fee.amount,
|
|
16920
|
-
fee_type: FeeType.
|
|
16920
|
+
fee_type: FeeType.TAKER_ECOSYSTEM,
|
|
16921
16921
|
recipient: fee.recipient,
|
|
16922
16922
|
})),
|
|
16923
16923
|
},
|
|
@@ -17039,6 +17039,18 @@ const assertParamExists = function (functionName, paramName, paramValue) {
|
|
|
17039
17039
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
17040
17040
|
}
|
|
17041
17041
|
};
|
|
17042
|
+
/**
|
|
17043
|
+
*
|
|
17044
|
+
* @export
|
|
17045
|
+
*/
|
|
17046
|
+
const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
17047
|
+
if (configuration && configuration.apiKey) {
|
|
17048
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
17049
|
+
? await configuration.apiKey(keyParamName)
|
|
17050
|
+
: await configuration.apiKey;
|
|
17051
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
17052
|
+
}
|
|
17053
|
+
};
|
|
17042
17054
|
/**
|
|
17043
17055
|
*
|
|
17044
17056
|
* @export
|
|
@@ -17588,6 +17600,46 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
|
|
|
17588
17600
|
options: localVarRequestOptions,
|
|
17589
17601
|
};
|
|
17590
17602
|
},
|
|
17603
|
+
/**
|
|
17604
|
+
* Refresh collection metadata
|
|
17605
|
+
* @summary Refresh collection metadata
|
|
17606
|
+
* @param {string} contractAddress The address contract
|
|
17607
|
+
* @param {string} chainName The name of chain
|
|
17608
|
+
* @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
|
|
17609
|
+
* @param {*} [options] Override http request option.
|
|
17610
|
+
* @throws {RequiredError}
|
|
17611
|
+
*/
|
|
17612
|
+
refreshCollectionMetadata: async (contractAddress, chainName, refreshCollectionMetadataRequest, options = {}) => {
|
|
17613
|
+
// verify required parameter 'contractAddress' is not null or undefined
|
|
17614
|
+
assertParamExists('refreshCollectionMetadata', 'contractAddress', contractAddress);
|
|
17615
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
17616
|
+
assertParamExists('refreshCollectionMetadata', 'chainName', chainName);
|
|
17617
|
+
// verify required parameter 'refreshCollectionMetadataRequest' is not null or undefined
|
|
17618
|
+
assertParamExists('refreshCollectionMetadata', 'refreshCollectionMetadataRequest', refreshCollectionMetadataRequest);
|
|
17619
|
+
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata`
|
|
17620
|
+
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
|
|
17621
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
17622
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
17623
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
17624
|
+
let baseOptions;
|
|
17625
|
+
if (configuration) {
|
|
17626
|
+
baseOptions = configuration.baseOptions;
|
|
17627
|
+
}
|
|
17628
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
17629
|
+
const localVarHeaderParameter = {};
|
|
17630
|
+
const localVarQueryParameter = {};
|
|
17631
|
+
// authentication ImmutableApiKey required
|
|
17632
|
+
await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
|
|
17633
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
17634
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
17635
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
17636
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
17637
|
+
localVarRequestOptions.data = serializeDataIfNeeded(refreshCollectionMetadataRequest, localVarRequestOptions, configuration);
|
|
17638
|
+
return {
|
|
17639
|
+
url: toPathString(localVarUrlObj),
|
|
17640
|
+
options: localVarRequestOptions,
|
|
17641
|
+
};
|
|
17642
|
+
},
|
|
17591
17643
|
};
|
|
17592
17644
|
};
|
|
17593
17645
|
/**
|
|
@@ -17636,6 +17688,19 @@ const CollectionsApiFp = function (configuration) {
|
|
|
17636
17688
|
const localVarAxiosArgs = await localVarAxiosParamCreator.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options);
|
|
17637
17689
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
17638
17690
|
},
|
|
17691
|
+
/**
|
|
17692
|
+
* Refresh collection metadata
|
|
17693
|
+
* @summary Refresh collection metadata
|
|
17694
|
+
* @param {string} contractAddress The address contract
|
|
17695
|
+
* @param {string} chainName The name of chain
|
|
17696
|
+
* @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
|
|
17697
|
+
* @param {*} [options] Override http request option.
|
|
17698
|
+
* @throws {RequiredError}
|
|
17699
|
+
*/
|
|
17700
|
+
async refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
|
|
17701
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options);
|
|
17702
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
17703
|
+
},
|
|
17639
17704
|
};
|
|
17640
17705
|
};
|
|
17641
17706
|
/**
|
|
@@ -17681,6 +17746,18 @@ const CollectionsApiFactory = function (configuration, basePath, axios) {
|
|
|
17681
17746
|
listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options) {
|
|
17682
17747
|
return localVarFp.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options).then((request) => request(axios, basePath));
|
|
17683
17748
|
},
|
|
17749
|
+
/**
|
|
17750
|
+
* Refresh collection metadata
|
|
17751
|
+
* @summary Refresh collection metadata
|
|
17752
|
+
* @param {string} contractAddress The address contract
|
|
17753
|
+
* @param {string} chainName The name of chain
|
|
17754
|
+
* @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
|
|
17755
|
+
* @param {*} [options] Override http request option.
|
|
17756
|
+
* @throws {RequiredError}
|
|
17757
|
+
*/
|
|
17758
|
+
refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
|
|
17759
|
+
return localVarFp.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options).then((request) => request(axios, basePath));
|
|
17760
|
+
},
|
|
17684
17761
|
};
|
|
17685
17762
|
};
|
|
17686
17763
|
/**
|
|
@@ -17723,6 +17800,210 @@ class CollectionsApi extends BaseAPI {
|
|
|
17723
17800
|
listCollectionsByNFTOwner(requestParameters, options) {
|
|
17724
17801
|
return CollectionsApiFp(this.configuration).listCollectionsByNFTOwner(requestParameters.accountAddress, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
|
|
17725
17802
|
}
|
|
17803
|
+
/**
|
|
17804
|
+
* Refresh collection metadata
|
|
17805
|
+
* @summary Refresh collection metadata
|
|
17806
|
+
* @param {CollectionsApiRefreshCollectionMetadataRequest} requestParameters Request parameters.
|
|
17807
|
+
* @param {*} [options] Override http request option.
|
|
17808
|
+
* @throws {RequiredError}
|
|
17809
|
+
* @memberof CollectionsApi
|
|
17810
|
+
*/
|
|
17811
|
+
refreshCollectionMetadata(requestParameters, options) {
|
|
17812
|
+
return CollectionsApiFp(this.configuration).refreshCollectionMetadata(requestParameters.contractAddress, requestParameters.chainName, requestParameters.refreshCollectionMetadataRequest, options).then((request) => request(this.axios, this.basePath));
|
|
17813
|
+
}
|
|
17814
|
+
}
|
|
17815
|
+
|
|
17816
|
+
/* tslint:disable */
|
|
17817
|
+
/* eslint-disable */
|
|
17818
|
+
/**
|
|
17819
|
+
* Immutable zkEVM API
|
|
17820
|
+
* Immutable Multi Rollup API
|
|
17821
|
+
*
|
|
17822
|
+
* The version of the OpenAPI document: 1.0.0
|
|
17823
|
+
* Contact: support@immutable.com
|
|
17824
|
+
*
|
|
17825
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
17826
|
+
* https://openapi-generator.tech
|
|
17827
|
+
* Do not edit the class manually.
|
|
17828
|
+
*/
|
|
17829
|
+
/**
|
|
17830
|
+
* MetadataApi - axios parameter creator
|
|
17831
|
+
* @export
|
|
17832
|
+
*/
|
|
17833
|
+
const MetadataApiAxiosParamCreator = function (configuration) {
|
|
17834
|
+
return {
|
|
17835
|
+
/**
|
|
17836
|
+
* Get a single metadata by ID
|
|
17837
|
+
* @summary Get a single metadata by ID
|
|
17838
|
+
* @param {string} chainName The name of chain
|
|
17839
|
+
* @param {string} contractAddress The address of metadata contract
|
|
17840
|
+
* @param {string} metadataId The id of the metadata
|
|
17841
|
+
* @param {*} [options] Override http request option.
|
|
17842
|
+
* @throws {RequiredError}
|
|
17843
|
+
*/
|
|
17844
|
+
getMetadata: async (chainName, contractAddress, metadataId, options = {}) => {
|
|
17845
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
17846
|
+
assertParamExists('getMetadata', 'chainName', chainName);
|
|
17847
|
+
// verify required parameter 'contractAddress' is not null or undefined
|
|
17848
|
+
assertParamExists('getMetadata', 'contractAddress', contractAddress);
|
|
17849
|
+
// verify required parameter 'metadataId' is not null or undefined
|
|
17850
|
+
assertParamExists('getMetadata', 'metadataId', metadataId);
|
|
17851
|
+
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/metadata/{metadata_id}`
|
|
17852
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
|
|
17853
|
+
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
|
|
17854
|
+
.replace(`{${"metadata_id"}}`, encodeURIComponent(String(metadataId)));
|
|
17855
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
17856
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
17857
|
+
let baseOptions;
|
|
17858
|
+
if (configuration) {
|
|
17859
|
+
baseOptions = configuration.baseOptions;
|
|
17860
|
+
}
|
|
17861
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
17862
|
+
const localVarHeaderParameter = {};
|
|
17863
|
+
const localVarQueryParameter = {};
|
|
17864
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
17865
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
17866
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
17867
|
+
return {
|
|
17868
|
+
url: toPathString(localVarUrlObj),
|
|
17869
|
+
options: localVarRequestOptions,
|
|
17870
|
+
};
|
|
17871
|
+
},
|
|
17872
|
+
/**
|
|
17873
|
+
* Refresh shared metadata for a collection
|
|
17874
|
+
* @param {string} chainName The name of chain
|
|
17875
|
+
* @param {string} contractAddress Contract address
|
|
17876
|
+
* @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
|
|
17877
|
+
* @param {*} [options] Override http request option.
|
|
17878
|
+
* @throws {RequiredError}
|
|
17879
|
+
*/
|
|
17880
|
+
refreshMetadataByID: async (chainName, contractAddress, refreshMetadataByIDRequest, options = {}) => {
|
|
17881
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
17882
|
+
assertParamExists('refreshMetadataByID', 'chainName', chainName);
|
|
17883
|
+
// verify required parameter 'contractAddress' is not null or undefined
|
|
17884
|
+
assertParamExists('refreshMetadataByID', 'contractAddress', contractAddress);
|
|
17885
|
+
// verify required parameter 'refreshMetadataByIDRequest' is not null or undefined
|
|
17886
|
+
assertParamExists('refreshMetadataByID', 'refreshMetadataByIDRequest', refreshMetadataByIDRequest);
|
|
17887
|
+
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/metadata/refresh-metadata`
|
|
17888
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
|
|
17889
|
+
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)));
|
|
17890
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
17891
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
17892
|
+
let baseOptions;
|
|
17893
|
+
if (configuration) {
|
|
17894
|
+
baseOptions = configuration.baseOptions;
|
|
17895
|
+
}
|
|
17896
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
17897
|
+
const localVarHeaderParameter = {};
|
|
17898
|
+
const localVarQueryParameter = {};
|
|
17899
|
+
// authentication ImmutableApiKey required
|
|
17900
|
+
await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
|
|
17901
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
17902
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
17903
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
17904
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
17905
|
+
localVarRequestOptions.data = serializeDataIfNeeded(refreshMetadataByIDRequest, localVarRequestOptions, configuration);
|
|
17906
|
+
return {
|
|
17907
|
+
url: toPathString(localVarUrlObj),
|
|
17908
|
+
options: localVarRequestOptions,
|
|
17909
|
+
};
|
|
17910
|
+
},
|
|
17911
|
+
};
|
|
17912
|
+
};
|
|
17913
|
+
/**
|
|
17914
|
+
* MetadataApi - functional programming interface
|
|
17915
|
+
* @export
|
|
17916
|
+
*/
|
|
17917
|
+
const MetadataApiFp = function (configuration) {
|
|
17918
|
+
const localVarAxiosParamCreator = MetadataApiAxiosParamCreator(configuration);
|
|
17919
|
+
return {
|
|
17920
|
+
/**
|
|
17921
|
+
* Get a single metadata by ID
|
|
17922
|
+
* @summary Get a single metadata by ID
|
|
17923
|
+
* @param {string} chainName The name of chain
|
|
17924
|
+
* @param {string} contractAddress The address of metadata contract
|
|
17925
|
+
* @param {string} metadataId The id of the metadata
|
|
17926
|
+
* @param {*} [options] Override http request option.
|
|
17927
|
+
* @throws {RequiredError}
|
|
17928
|
+
*/
|
|
17929
|
+
async getMetadata(chainName, contractAddress, metadataId, options) {
|
|
17930
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getMetadata(chainName, contractAddress, metadataId, options);
|
|
17931
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
17932
|
+
},
|
|
17933
|
+
/**
|
|
17934
|
+
* Refresh shared metadata for a collection
|
|
17935
|
+
* @param {string} chainName The name of chain
|
|
17936
|
+
* @param {string} contractAddress Contract address
|
|
17937
|
+
* @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
|
|
17938
|
+
* @param {*} [options] Override http request option.
|
|
17939
|
+
* @throws {RequiredError}
|
|
17940
|
+
*/
|
|
17941
|
+
async refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
|
|
17942
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options);
|
|
17943
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
17944
|
+
},
|
|
17945
|
+
};
|
|
17946
|
+
};
|
|
17947
|
+
/**
|
|
17948
|
+
* MetadataApi - factory interface
|
|
17949
|
+
* @export
|
|
17950
|
+
*/
|
|
17951
|
+
const MetadataApiFactory = function (configuration, basePath, axios) {
|
|
17952
|
+
const localVarFp = MetadataApiFp(configuration);
|
|
17953
|
+
return {
|
|
17954
|
+
/**
|
|
17955
|
+
* Get a single metadata by ID
|
|
17956
|
+
* @summary Get a single metadata by ID
|
|
17957
|
+
* @param {string} chainName The name of chain
|
|
17958
|
+
* @param {string} contractAddress The address of metadata contract
|
|
17959
|
+
* @param {string} metadataId The id of the metadata
|
|
17960
|
+
* @param {*} [options] Override http request option.
|
|
17961
|
+
* @throws {RequiredError}
|
|
17962
|
+
*/
|
|
17963
|
+
getMetadata(chainName, contractAddress, metadataId, options) {
|
|
17964
|
+
return localVarFp.getMetadata(chainName, contractAddress, metadataId, options).then((request) => request(axios, basePath));
|
|
17965
|
+
},
|
|
17966
|
+
/**
|
|
17967
|
+
* Refresh shared metadata for a collection
|
|
17968
|
+
* @param {string} chainName The name of chain
|
|
17969
|
+
* @param {string} contractAddress Contract address
|
|
17970
|
+
* @param {RefreshMetadataByIDRequest} refreshMetadataByIDRequest NFT Metadata Refresh Request
|
|
17971
|
+
* @param {*} [options] Override http request option.
|
|
17972
|
+
* @throws {RequiredError}
|
|
17973
|
+
*/
|
|
17974
|
+
refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
|
|
17975
|
+
return localVarFp.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options).then((request) => request(axios, basePath));
|
|
17976
|
+
},
|
|
17977
|
+
};
|
|
17978
|
+
};
|
|
17979
|
+
/**
|
|
17980
|
+
* MetadataApi - object-oriented interface
|
|
17981
|
+
* @export
|
|
17982
|
+
* @class MetadataApi
|
|
17983
|
+
* @extends {BaseAPI}
|
|
17984
|
+
*/
|
|
17985
|
+
class MetadataApi extends BaseAPI {
|
|
17986
|
+
/**
|
|
17987
|
+
* Get a single metadata by ID
|
|
17988
|
+
* @summary Get a single metadata by ID
|
|
17989
|
+
* @param {MetadataApiGetMetadataRequest} requestParameters Request parameters.
|
|
17990
|
+
* @param {*} [options] Override http request option.
|
|
17991
|
+
* @throws {RequiredError}
|
|
17992
|
+
* @memberof MetadataApi
|
|
17993
|
+
*/
|
|
17994
|
+
getMetadata(requestParameters, options) {
|
|
17995
|
+
return MetadataApiFp(this.configuration).getMetadata(requestParameters.chainName, requestParameters.contractAddress, requestParameters.metadataId, options).then((request) => request(this.axios, this.basePath));
|
|
17996
|
+
}
|
|
17997
|
+
/**
|
|
17998
|
+
* Refresh shared metadata for a collection
|
|
17999
|
+
* @param {MetadataApiRefreshMetadataByIDRequest} requestParameters Request parameters.
|
|
18000
|
+
* @param {*} [options] Override http request option.
|
|
18001
|
+
* @throws {RequiredError}
|
|
18002
|
+
* @memberof MetadataApi
|
|
18003
|
+
*/
|
|
18004
|
+
refreshMetadataByID(requestParameters, options) {
|
|
18005
|
+
return MetadataApiFp(this.configuration).refreshMetadataByID(requestParameters.chainName, requestParameters.contractAddress, requestParameters.refreshMetadataByIDRequest, options).then((request) => request(this.axios, this.basePath));
|
|
18006
|
+
}
|
|
17726
18007
|
}
|
|
17727
18008
|
|
|
17728
18009
|
/* tslint:disable */
|
|
@@ -18363,7 +18644,7 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
18363
18644
|
* @param {string} chainName
|
|
18364
18645
|
* @param {string} [accountAddress]
|
|
18365
18646
|
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
18366
|
-
* @param {'
|
|
18647
|
+
* @param {'indexed_at'} [sortBy] Trade field to sort by
|
|
18367
18648
|
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
18368
18649
|
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
18369
18650
|
* @param {*} [options] Override http request option.
|
|
@@ -18488,7 +18769,7 @@ const OrdersApiFp = function (configuration) {
|
|
|
18488
18769
|
* @param {string} chainName
|
|
18489
18770
|
* @param {string} [accountAddress]
|
|
18490
18771
|
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
18491
|
-
* @param {'
|
|
18772
|
+
* @param {'indexed_at'} [sortBy] Trade field to sort by
|
|
18492
18773
|
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
18493
18774
|
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
18494
18775
|
* @param {*} [options] Override http request option.
|
|
@@ -18575,7 +18856,7 @@ const OrdersApiFactory = function (configuration, basePath, axios) {
|
|
|
18575
18856
|
* @param {string} chainName
|
|
18576
18857
|
* @param {string} [accountAddress]
|
|
18577
18858
|
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
18578
|
-
* @param {'
|
|
18859
|
+
* @param {'indexed_at'} [sortBy] Trade field to sort by
|
|
18579
18860
|
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
18580
18861
|
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
18581
18862
|
* @param {*} [options] Override http request option.
|
|
@@ -19481,6 +19762,10 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
19481
19762
|
ERC20ItemItemTypeEnum: ERC20ItemItemTypeEnum,
|
|
19482
19763
|
ERC721ItemItemTypeEnum: ERC721ItemItemTypeEnum,
|
|
19483
19764
|
FeeFeeTypeEnum: FeeFeeTypeEnum,
|
|
19765
|
+
MetadataApi: MetadataApi,
|
|
19766
|
+
MetadataApiAxiosParamCreator: MetadataApiAxiosParamCreator,
|
|
19767
|
+
MetadataApiFactory: MetadataApiFactory,
|
|
19768
|
+
MetadataApiFp: MetadataApiFp,
|
|
19484
19769
|
NFTContractType: NFTContractType,
|
|
19485
19770
|
NativeItemItemTypeEnum: NativeItemItemTypeEnum,
|
|
19486
19771
|
NftOwnersApi: NftOwnersApi,
|
|
@@ -19528,7 +19813,7 @@ class APIError extends Error {
|
|
|
19528
19813
|
|
|
19529
19814
|
/* eslint-disable implicit-arrow-linebreak */
|
|
19530
19815
|
const defaultHeaders = {
|
|
19531
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
19816
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.20.1-alpha.1',
|
|
19532
19817
|
};
|
|
19533
19818
|
/**
|
|
19534
19819
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -20303,14 +20588,16 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
|
20303
20588
|
CheckoutErrorType["CANCEL_ORDER_LISTING_ERROR"] = "CANCEL_ORDER_LISTING_ERROR";
|
|
20304
20589
|
CheckoutErrorType["PREPARE_ORDER_LISTING_ERROR"] = "PREPARE_ORDER_LISTING_ERROR";
|
|
20305
20590
|
CheckoutErrorType["CREATE_ORDER_LISTING_ERROR"] = "CREATE_ORDER_LISTING_ERROR";
|
|
20591
|
+
CheckoutErrorType["FULFILL_ORDER_LISTING_ERROR"] = "FULFILL_ORDER_LISTING_ERROR";
|
|
20306
20592
|
CheckoutErrorType["SWITCH_NETWORK_UNSUPPORTED"] = "SWITCH_NETWORK_UNSUPPORTED";
|
|
20307
20593
|
CheckoutErrorType["GET_ERC20_ALLOWANCE_ERROR"] = "GET_ERC20_ALLOWANCE_ERROR";
|
|
20308
20594
|
CheckoutErrorType["GET_ERC721_ALLOWANCE_ERROR"] = "GET_ERC721_ALLOWANCE_ERROR";
|
|
20309
20595
|
CheckoutErrorType["EXECUTE_APPROVAL_TRANSACTION_ERROR"] = "EXECUTE_APPROVAL_TRANSACTION_ERROR";
|
|
20310
|
-
CheckoutErrorType["
|
|
20596
|
+
CheckoutErrorType["EXECUTE_FULFILLMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR";
|
|
20311
20597
|
CheckoutErrorType["SIGN_MESSAGE_ERROR"] = "SIGN_MESSAGE_ERROR";
|
|
20312
20598
|
CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
|
|
20313
20599
|
CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
|
|
20600
|
+
CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
|
|
20314
20601
|
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
20315
20602
|
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
20316
20603
|
message;
|
|
@@ -21164,6 +21451,12 @@ function $67fc622a2b913d5f$export$436dd76f23f463ff(config) {
|
|
|
21164
21451
|
|
|
21165
21452
|
|
|
21166
21453
|
|
|
21454
|
+
function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, signerOrProvider) {
|
|
21455
|
+
return new (Contract$1)(address, contractInterface, signerOrProvider);
|
|
21456
|
+
}
|
|
21457
|
+
|
|
21458
|
+
|
|
21459
|
+
|
|
21167
21460
|
|
|
21168
21461
|
|
|
21169
21462
|
const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
|
|
@@ -21891,7 +22184,7 @@ const $7d1bfafb81e64d74$export$3a4140bd9e983e4e = async (provider, insufficientI
|
|
|
21891
22184
|
if (item.approvalTransaction === undefined) continue;
|
|
21892
22185
|
estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, item.approvalTransaction));
|
|
21893
22186
|
}
|
|
21894
|
-
// If the transaction is a
|
|
22187
|
+
// If the transaction is a fulfillment transaction get the estimate gas promise
|
|
21895
22188
|
// Otherwise use the gas amount with the limit to estimate the gas
|
|
21896
22189
|
if (transactionOrGas.type === ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION) estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, transactionOrGas.transaction));
|
|
21897
22190
|
else {
|
|
@@ -22054,10 +22347,9 @@ const $823db9fb0ca4bc15$export$1430626eec86fce9 = (chainId)=>{
|
|
|
22054
22347
|
if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET) return "imtbl-zkevm-testnet";
|
|
22055
22348
|
return "";
|
|
22056
22349
|
};
|
|
22057
|
-
const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = (chainId)=>{
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
-
return "";
|
|
22350
|
+
const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = async (chainId, config)=>{
|
|
22351
|
+
const imxMappingConfig = await config.remote.getConfig("imxAddressMapping");
|
|
22352
|
+
return imxMappingConfig[chainId] ?? "";
|
|
22061
22353
|
};
|
|
22062
22354
|
|
|
22063
22355
|
|
|
@@ -22148,7 +22440,7 @@ const $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f = (balanceRequirement)=>{
|
|
|
22148
22440
|
const $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6 = async (config, balanceRequirement)=>{
|
|
22149
22441
|
const l2address = $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f(balanceRequirement);
|
|
22150
22442
|
if (l2address === "") return "";
|
|
22151
|
-
if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
|
|
22443
|
+
if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return await ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config), config);
|
|
22152
22444
|
const chainName = ($823db9fb0ca4bc15$export$1430626eec86fce9)(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
22153
22445
|
if (chainName === "") return ""; // Chain name not a valid indexer chain name
|
|
22154
22446
|
const blockchainData = ($67fc622a2b913d5f$export$436dd76f23f463ff)(config);
|
|
@@ -22364,14 +22656,15 @@ const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, swapFees, approva
|
|
|
22364
22656
|
return true;
|
|
22365
22657
|
};
|
|
22366
22658
|
const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, dexQuoteCache, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens)=>{
|
|
22367
|
-
|
|
22368
|
-
if (
|
|
22659
|
+
const fundingSteps = [];
|
|
22660
|
+
if (!availableRoutingOptions.swap) return fundingSteps;
|
|
22661
|
+
if (swappableTokens.length === 0) return fundingSteps;
|
|
22369
22662
|
const requiredToken = $91807edfd7057288$export$85e4d8628aabb217(balanceRequirement);
|
|
22370
|
-
if (requiredToken.address === "") return
|
|
22663
|
+
if (requiredToken.address === "") return fundingSteps;
|
|
22371
22664
|
const l2TokenBalanceResult = tokenBalanceResults.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
22372
|
-
if (!l2TokenBalanceResult) return
|
|
22665
|
+
if (!l2TokenBalanceResult) return fundingSteps;
|
|
22373
22666
|
const l2Balances = l2TokenBalanceResult.balances;
|
|
22374
|
-
if (l2Balances.length === 0) return
|
|
22667
|
+
if (l2Balances.length === 0) return fundingSteps;
|
|
22375
22668
|
const quotes = await ($3ee85f12225c19f3$export$fb80fe94a81a3132)(config, dexQuoteCache, walletAddress, requiredToken, swappableTokens);
|
|
22376
22669
|
const quoteTokenAddresses = Array.from(quotes.keys());
|
|
22377
22670
|
for (const quoteTokenAddress of quoteTokenAddresses){
|
|
@@ -22395,7 +22688,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
22395
22688
|
})) continue;
|
|
22396
22689
|
// User has sufficient funds to cover any approval and swap fees so use this token for the funding route
|
|
22397
22690
|
// Currently we are not prioritising any particular token so just taking the first sufficient token
|
|
22398
|
-
|
|
22691
|
+
fundingSteps.push({
|
|
22399
22692
|
type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).SWAP,
|
|
22400
22693
|
chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
|
|
22401
22694
|
asset: {
|
|
@@ -22403,9 +22696,9 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
22403
22696
|
formattedBalance: userBalanceOfQuotedToken.formattedBalance,
|
|
22404
22697
|
token: userBalanceOfQuotedToken.token
|
|
22405
22698
|
}
|
|
22406
|
-
};
|
|
22699
|
+
});
|
|
22407
22700
|
}
|
|
22408
|
-
return
|
|
22701
|
+
return fundingSteps;
|
|
22409
22702
|
};
|
|
22410
22703
|
|
|
22411
22704
|
|
|
@@ -22440,6 +22733,7 @@ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutin
|
|
|
22440
22733
|
|
|
22441
22734
|
|
|
22442
22735
|
|
|
22736
|
+
const $c16168a9c28ae4fd$var$hasAvailableRoutingOptions = (availableRoutingOptions)=>availableRoutingOptions.bridge || availableRoutingOptions.swap || availableRoutingOptions.onRamp;
|
|
22443
22737
|
const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
22444
22738
|
let insufficientBalanceCount = 0;
|
|
22445
22739
|
let insufficientRequirement;
|
|
@@ -22450,18 +22744,18 @@ const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
|
22450
22744
|
if (insufficientBalanceCount === 1) return insufficientRequirement;
|
|
22451
22745
|
return undefined;
|
|
22452
22746
|
};
|
|
22453
|
-
const $c16168a9c28ae4fd$export$
|
|
22454
|
-
|
|
22455
|
-
if (
|
|
22456
|
-
if (
|
|
22747
|
+
const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList)=>{
|
|
22748
|
+
const fundingSteps = [];
|
|
22749
|
+
if (!availableRoutingOptions.swap) return fundingSteps;
|
|
22750
|
+
if (insufficientRequirement === undefined) return fundingSteps;
|
|
22751
|
+
if (swapTokenAllowList === undefined) return fundingSteps;
|
|
22457
22752
|
const tokenBalanceResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
22458
|
-
if (!tokenBalanceResult) return
|
|
22459
|
-
if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return
|
|
22460
|
-
if (swapTokenAllowList.length === 0) return
|
|
22753
|
+
if (!tokenBalanceResult) return fundingSteps;
|
|
22754
|
+
if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return fundingSteps;
|
|
22755
|
+
if (swapTokenAllowList.length === 0) return fundingSteps;
|
|
22461
22756
|
const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
|
|
22462
|
-
if (swappableTokens.length === 0) return
|
|
22463
|
-
|
|
22464
|
-
return swapFundingStep;
|
|
22757
|
+
if (swappableTokens.length === 0) return fundingSteps;
|
|
22758
|
+
return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
|
|
22465
22759
|
};
|
|
22466
22760
|
const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
|
|
22467
22761
|
if (!availableRoutingOptions.onRamp) return undefined;
|
|
@@ -22470,6 +22764,13 @@ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutin
|
|
|
22470
22764
|
return onRampFundingStep;
|
|
22471
22765
|
};
|
|
22472
22766
|
const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
|
|
22767
|
+
if (!$c16168a9c28ae4fd$var$hasAvailableRoutingOptions(availableRoutingOptions)) return {
|
|
22768
|
+
response: {
|
|
22769
|
+
type: ($b23305044c0e096a$export$3057de18ac0c076).NO_OPTIONS,
|
|
22770
|
+
message: "No options available"
|
|
22771
|
+
},
|
|
22772
|
+
fundingRoutes: []
|
|
22773
|
+
};
|
|
22473
22774
|
let readOnlyProviders;
|
|
22474
22775
|
try {
|
|
22475
22776
|
readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
|
|
@@ -22488,7 +22789,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22488
22789
|
const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
|
|
22489
22790
|
let bridgeFundingStep;
|
|
22490
22791
|
if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
|
|
22491
|
-
const
|
|
22792
|
+
const swapFundingSteps = await $c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
|
|
22492
22793
|
const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
|
|
22493
22794
|
// Check swap routes
|
|
22494
22795
|
// > Could bridge first
|
|
@@ -22502,7 +22803,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22502
22803
|
fundingRoutes: []
|
|
22503
22804
|
};
|
|
22504
22805
|
let priority = 0;
|
|
22505
|
-
if (bridgeFundingStep ||
|
|
22806
|
+
if (bridgeFundingStep || swapFundingSteps.length > 0 || onRampFundingStep) {
|
|
22506
22807
|
response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
|
|
22507
22808
|
response.response.message = "Routes found";
|
|
22508
22809
|
}
|
|
@@ -22515,13 +22816,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22515
22816
|
]
|
|
22516
22817
|
});
|
|
22517
22818
|
}
|
|
22518
|
-
if (
|
|
22819
|
+
if (swapFundingSteps.length > 0) {
|
|
22519
22820
|
priority++;
|
|
22520
|
-
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22821
|
+
swapFundingSteps.forEach((swapFundingStep)=>{
|
|
22822
|
+
response.fundingRoutes.push({
|
|
22823
|
+
priority: priority,
|
|
22824
|
+
steps: [
|
|
22825
|
+
swapFundingStep
|
|
22826
|
+
]
|
|
22827
|
+
});
|
|
22525
22828
|
});
|
|
22526
22829
|
}
|
|
22527
22830
|
if (onRampFundingStep) {
|
|
@@ -22606,13 +22909,13 @@ const $25ac589234c10b67$export$19693ca396db083e = async (provider, approvalTrans
|
|
|
22606
22909
|
type: ($d855a5ba32004345$export$f51b97f3aaf2d5a8).SUCCESS
|
|
22607
22910
|
};
|
|
22608
22911
|
};
|
|
22609
|
-
const $25ac589234c10b67$export$
|
|
22912
|
+
const $25ac589234c10b67$export$3f05b33bd1f29038 = async (provider, fulfillmentTransactions)=>{
|
|
22610
22913
|
let receipts = [];
|
|
22611
22914
|
try {
|
|
22612
|
-
const response = await Promise.all(
|
|
22915
|
+
const response = await Promise.all(fulfillmentTransactions.map((transaction)=>provider.getSigner().sendTransaction(transaction)));
|
|
22613
22916
|
receipts = await Promise.all(response.map((transaction)=>transaction.wait()));
|
|
22614
22917
|
} catch (err) {
|
|
22615
|
-
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while executing the
|
|
22918
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while executing the fulfillment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
|
|
22616
22919
|
message: err.message
|
|
22617
22920
|
});
|
|
22618
22921
|
}
|
|
@@ -22620,7 +22923,7 @@ const $25ac589234c10b67$export$2161274619257102 = async (provider, fulfilmentTra
|
|
|
22620
22923
|
if (receipt.status === 0) return {
|
|
22621
22924
|
type: ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED,
|
|
22622
22925
|
transactionHash: receipt.transactionHash,
|
|
22623
|
-
reason: "
|
|
22926
|
+
reason: "Fulfillment transaction failed and was reverted"
|
|
22624
22927
|
};
|
|
22625
22928
|
}
|
|
22626
22929
|
return {
|
|
@@ -22645,23 +22948,43 @@ const $25ac589234c10b67$export$1d9a7a8a40780de = async (provider, unsignedMessag
|
|
|
22645
22948
|
|
|
22646
22949
|
|
|
22647
22950
|
|
|
22648
|
-
const $a7367d01c6e76b1c$export$
|
|
22951
|
+
const $a7367d01c6e76b1c$export$c5b3365853cb6159 = async (actions)=>{
|
|
22649
22952
|
let approvalTransactions = [];
|
|
22650
|
-
let
|
|
22953
|
+
let fulfillmentTransactions = [];
|
|
22651
22954
|
const approvalPromises = [];
|
|
22652
|
-
const
|
|
22955
|
+
const fulfillmentPromises = [];
|
|
22653
22956
|
for (const action of actions){
|
|
22654
22957
|
if (action.type !== (ActionType).TRANSACTION) continue;
|
|
22655
22958
|
if (action.purpose === (TransactionPurpose).APPROVAL) approvalPromises.push(action.buildTransaction());
|
|
22656
|
-
if (action.purpose === (TransactionPurpose).FULFILL_ORDER)
|
|
22959
|
+
if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfillmentPromises.push(action.buildTransaction());
|
|
22657
22960
|
}
|
|
22658
22961
|
approvalTransactions = await Promise.all(approvalPromises);
|
|
22659
|
-
|
|
22962
|
+
fulfillmentTransactions = await Promise.all(fulfillmentPromises);
|
|
22660
22963
|
return {
|
|
22661
22964
|
approvalTransactions: approvalTransactions,
|
|
22662
|
-
|
|
22965
|
+
fulfillmentTransactions: fulfillmentTransactions
|
|
22663
22966
|
};
|
|
22664
22967
|
};
|
|
22968
|
+
const $a7367d01c6e76b1c$export$f64a20a30eb98855 = async (actions)=>{
|
|
22969
|
+
let approvalTransactions = [];
|
|
22970
|
+
const approvalPromises = [];
|
|
22971
|
+
for (const action of actions){
|
|
22972
|
+
if (action.type !== (ActionType).TRANSACTION) continue;
|
|
22973
|
+
if (action.purpose === (TransactionPurpose).APPROVAL) approvalPromises.push(action.buildTransaction());
|
|
22974
|
+
}
|
|
22975
|
+
approvalTransactions = await Promise.all(approvalPromises);
|
|
22976
|
+
return approvalTransactions;
|
|
22977
|
+
};
|
|
22978
|
+
const $a7367d01c6e76b1c$export$396bd6ce7d3ab533 = async (actions)=>{
|
|
22979
|
+
let fulfillmentTransactions = [];
|
|
22980
|
+
const fulfillmentPromises = [];
|
|
22981
|
+
for (const action of actions){
|
|
22982
|
+
if (action.type !== (ActionType).TRANSACTION) continue;
|
|
22983
|
+
if (action.purpose === (TransactionPurpose).FULFILL_ORDER) fulfillmentPromises.push(action.buildTransaction());
|
|
22984
|
+
}
|
|
22985
|
+
fulfillmentTransactions = await Promise.all(fulfillmentPromises);
|
|
22986
|
+
return fulfillmentTransactions;
|
|
22987
|
+
};
|
|
22665
22988
|
const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, actions)=>{
|
|
22666
22989
|
let unsignedMessage;
|
|
22667
22990
|
for (const action of actions){
|
|
@@ -22684,6 +23007,49 @@ const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, a
|
|
|
22684
23007
|
|
|
22685
23008
|
|
|
22686
23009
|
|
|
23010
|
+
|
|
23011
|
+
|
|
23012
|
+
|
|
23013
|
+
|
|
23014
|
+
const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
|
|
23015
|
+
const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
|
|
23016
|
+
const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
|
|
23017
|
+
const feePercentage = orderFee.amount;
|
|
23018
|
+
// note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
|
|
23019
|
+
const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
|
|
23020
|
+
const bnFeeAmount = amountBn.mul((BigNumber$1).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
|
|
23021
|
+
return bnFeeAmount;
|
|
23022
|
+
};
|
|
23023
|
+
const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
|
|
23024
|
+
const feeToken = orderFee.amount;
|
|
23025
|
+
const bnFeeAmount = (parseUnits)(feeToken.token, decimals);
|
|
23026
|
+
return bnFeeAmount;
|
|
23027
|
+
};
|
|
23028
|
+
const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
|
|
23029
|
+
let totalTokenFees = (BigNumber$1).from(0);
|
|
23030
|
+
const amountBn = (BigNumber$1).from(weiAmount);
|
|
23031
|
+
// note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
|
|
23032
|
+
const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
|
|
23033
|
+
const calculateFeesResult = [];
|
|
23034
|
+
for (const orderFee of orderFees){
|
|
23035
|
+
let currentFeeBn = (BigNumber$1).from(0);
|
|
23036
|
+
if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
|
|
23037
|
+
currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
|
|
23038
|
+
totalTokenFees = totalTokenFees.add(currentFeeBn);
|
|
23039
|
+
} else if (Object.hasOwn(orderFee.amount, "token")) {
|
|
23040
|
+
currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
|
|
23041
|
+
totalTokenFees = totalTokenFees.add(currentFeeBn);
|
|
23042
|
+
} else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
|
|
23043
|
+
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);
|
|
23044
|
+
if (currentFeeBn.gt(0)) calculateFeesResult.push({
|
|
23045
|
+
amount: currentFeeBn.toString(),
|
|
23046
|
+
recipient: orderFee.recipient
|
|
23047
|
+
});
|
|
23048
|
+
} // for
|
|
23049
|
+
return calculateFeesResult;
|
|
23050
|
+
};
|
|
23051
|
+
|
|
23052
|
+
|
|
22687
23053
|
const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
|
|
22688
23054
|
switch(type){
|
|
22689
23055
|
case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
|
|
@@ -22701,10 +23067,10 @@ const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount
|
|
|
22701
23067
|
};
|
|
22702
23068
|
}
|
|
22703
23069
|
};
|
|
22704
|
-
const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit,
|
|
22705
|
-
if (
|
|
23070
|
+
const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, fulfillmentTransactions)=>{
|
|
23071
|
+
if (fulfillmentTransactions.length > 0) return {
|
|
22706
23072
|
type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION,
|
|
22707
|
-
transaction:
|
|
23073
|
+
transaction: fulfillmentTransactions[0]
|
|
22708
23074
|
};
|
|
22709
23075
|
return {
|
|
22710
23076
|
type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
|
|
@@ -22714,34 +23080,54 @@ const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, unsignedTransaction
|
|
|
22714
23080
|
}
|
|
22715
23081
|
};
|
|
22716
23082
|
};
|
|
22717
|
-
const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider,
|
|
23083
|
+
const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, orders)=>{
|
|
22718
23084
|
let orderbook;
|
|
22719
23085
|
let order;
|
|
22720
23086
|
let spenderAddress = "";
|
|
22721
23087
|
const gasLimit = (constants).estimatedFulfillmentGasGwei;
|
|
23088
|
+
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);
|
|
23089
|
+
const { id: id, takerFees: takerFees } = orders[0];
|
|
22722
23090
|
try {
|
|
22723
23091
|
orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
22724
|
-
order = await orderbook.getListing(
|
|
23092
|
+
order = await orderbook.getListing(id);
|
|
22725
23093
|
const { seaportContractAddress: seaportContractAddress } = orderbook.config();
|
|
22726
23094
|
spenderAddress = seaportContractAddress;
|
|
22727
23095
|
} catch (err) {
|
|
22728
23096
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while getting the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ORDER_LISTING_ERROR, {
|
|
22729
|
-
orderId:
|
|
23097
|
+
orderId: id,
|
|
22730
23098
|
message: err.message
|
|
22731
23099
|
});
|
|
22732
23100
|
}
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
};
|
|
23101
|
+
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, {
|
|
23102
|
+
orderId: id,
|
|
23103
|
+
message: "No buy side tokens found on order"
|
|
23104
|
+
});
|
|
23105
|
+
const buyToken = order.result.buy[0];
|
|
23106
|
+
let decimals = 18;
|
|
23107
|
+
if (order.result.buy[0].type === "ERC20") {
|
|
23108
|
+
const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
|
|
23109
|
+
decimals = await tokenContract.decimals();
|
|
23110
|
+
}
|
|
23111
|
+
let fees = [];
|
|
23112
|
+
if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
|
|
23113
|
+
let unsignedApprovalTransactions = [];
|
|
23114
|
+
let unsignedFulfillmentTransactions = [];
|
|
23115
|
+
let orderActions = [];
|
|
22737
23116
|
try {
|
|
22738
23117
|
const fulfillerAddress = await provider.getSigner().getAddress();
|
|
22739
|
-
const { actions: actions } = await orderbook.fulfillOrder(
|
|
22740
|
-
|
|
23118
|
+
const { actions: actions } = await orderbook.fulfillOrder(id, fulfillerAddress, fees);
|
|
23119
|
+
orderActions = actions;
|
|
23120
|
+
unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
|
|
22741
23121
|
} catch {
|
|
22742
23122
|
// Silently ignore error as this is usually thrown if user does not have enough balance
|
|
22743
23123
|
// todo: if balance error - can we determine if its the balance error otherwise throw?
|
|
22744
23124
|
}
|
|
23125
|
+
try {
|
|
23126
|
+
unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
|
|
23127
|
+
} catch {
|
|
23128
|
+
// if cannot estimate gas then silently continue and use gas limit in smartCheckout
|
|
23129
|
+
// but get the fulfillment transactions after they have approved the spending
|
|
23130
|
+
}
|
|
22745
23131
|
let amount = (BigNumber$1).from("0");
|
|
22746
23132
|
let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
|
|
22747
23133
|
let contractAddress = "";
|
|
@@ -22756,7 +23142,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
22756
23142
|
break;
|
|
22757
23143
|
default:
|
|
22758
23144
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Purchasing token type is unsupported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_TOKEN_TYPE_ERROR, {
|
|
22759
|
-
orderId:
|
|
23145
|
+
orderId: id
|
|
22760
23146
|
});
|
|
22761
23147
|
}
|
|
22762
23148
|
buyArray.forEach((item)=>{
|
|
@@ -22769,31 +23155,38 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
22769
23155
|
const itemRequirements = [
|
|
22770
23156
|
$64863c39386de592$export$4249179755829904(type, contractAddress, amount, spenderAddress)
|
|
22771
23157
|
];
|
|
22772
|
-
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit,
|
|
23158
|
+
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions));
|
|
22773
23159
|
if (smartCheckoutResult.sufficient) {
|
|
22774
|
-
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider,
|
|
23160
|
+
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
|
|
22775
23161
|
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
22776
23162
|
smartCheckoutResult: smartCheckoutResult,
|
|
22777
|
-
orderId:
|
|
23163
|
+
orderId: id,
|
|
22778
23164
|
status: {
|
|
22779
23165
|
type: ($aa144554f9ef124b$export$226b052ecb8ca80).FAILED,
|
|
22780
23166
|
transactionHash: approvalResult.transactionHash,
|
|
22781
23167
|
reason: approvalResult.reason
|
|
22782
23168
|
}
|
|
22783
23169
|
};
|
|
22784
|
-
|
|
22785
|
-
|
|
23170
|
+
try {
|
|
23171
|
+
if (unsignedFulfillmentTransactions.length === 0) unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
|
|
23172
|
+
} catch (err) {
|
|
23173
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error fetching fulfillment transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR, {
|
|
23174
|
+
message: err.message
|
|
23175
|
+
});
|
|
23176
|
+
}
|
|
23177
|
+
const fulfillmentResult = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, unsignedFulfillmentTransactions);
|
|
23178
|
+
if (fulfillmentResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
22786
23179
|
smartCheckoutResult: smartCheckoutResult,
|
|
22787
|
-
orderId:
|
|
23180
|
+
orderId: id,
|
|
22788
23181
|
status: {
|
|
22789
23182
|
type: ($aa144554f9ef124b$export$226b052ecb8ca80).FAILED,
|
|
22790
|
-
transactionHash:
|
|
22791
|
-
reason:
|
|
23183
|
+
transactionHash: fulfillmentResult.transactionHash,
|
|
23184
|
+
reason: fulfillmentResult.reason
|
|
22792
23185
|
}
|
|
22793
23186
|
};
|
|
22794
23187
|
return {
|
|
22795
23188
|
smartCheckoutResult: smartCheckoutResult,
|
|
22796
|
-
orderId:
|
|
23189
|
+
orderId: id,
|
|
22797
23190
|
status: {
|
|
22798
23191
|
type: ($aa144554f9ef124b$export$226b052ecb8ca80).SUCCESS
|
|
22799
23192
|
}
|
|
@@ -22801,7 +23194,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
22801
23194
|
}
|
|
22802
23195
|
return {
|
|
22803
23196
|
smartCheckoutResult: smartCheckoutResult,
|
|
22804
|
-
orderId:
|
|
23197
|
+
orderId: id
|
|
22805
23198
|
};
|
|
22806
23199
|
};
|
|
22807
23200
|
|
|
@@ -22813,8 +23206,11 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
22813
23206
|
|
|
22814
23207
|
|
|
22815
23208
|
|
|
22816
|
-
const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider,
|
|
23209
|
+
const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
|
|
22817
23210
|
let unsignedCancelOrderTransaction;
|
|
23211
|
+
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);
|
|
23212
|
+
// Update this when bulk cancel is supproted
|
|
23213
|
+
const orderId = orderIds[0];
|
|
22818
23214
|
try {
|
|
22819
23215
|
const offererAddress = await provider.getSigner().getAddress();
|
|
22820
23216
|
const orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
@@ -22826,7 +23222,7 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
22826
23222
|
message: err.message
|
|
22827
23223
|
});
|
|
22828
23224
|
}
|
|
22829
|
-
const result = await ($25ac589234c10b67$export$
|
|
23225
|
+
const result = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, [
|
|
22830
23226
|
unsignedCancelOrderTransaction
|
|
22831
23227
|
]);
|
|
22832
23228
|
if (result.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
@@ -22859,47 +23255,6 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
22859
23255
|
|
|
22860
23256
|
|
|
22861
23257
|
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
|
|
22865
|
-
const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
|
|
22866
|
-
const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
|
|
22867
|
-
const feePercentage = orderFee.amount;
|
|
22868
|
-
// note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
|
|
22869
|
-
const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
|
|
22870
|
-
const bnFeeAmount = amountBn.mul((BigNumber$1).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
|
|
22871
|
-
return bnFeeAmount;
|
|
22872
|
-
};
|
|
22873
|
-
const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
|
|
22874
|
-
const feeToken = orderFee.amount;
|
|
22875
|
-
const bnFeeAmount = (parseUnits)(feeToken.token, decimals);
|
|
22876
|
-
return bnFeeAmount;
|
|
22877
|
-
};
|
|
22878
|
-
const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
|
|
22879
|
-
let totalTokenFees = (BigNumber$1).from(0);
|
|
22880
|
-
const amountBn = (BigNumber$1).from(weiAmount);
|
|
22881
|
-
// note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
|
|
22882
|
-
const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
|
|
22883
|
-
const calculateFeesResult = [];
|
|
22884
|
-
for (const orderFee of orderFees){
|
|
22885
|
-
let currentFeeBn = (BigNumber$1).from(0);
|
|
22886
|
-
if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
|
|
22887
|
-
currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
|
|
22888
|
-
totalTokenFees = totalTokenFees.add(currentFeeBn);
|
|
22889
|
-
} else if (Object.hasOwn(orderFee.amount, "token")) {
|
|
22890
|
-
currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
|
|
22891
|
-
totalTokenFees = totalTokenFees.add(currentFeeBn);
|
|
22892
|
-
} else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
|
|
22893
|
-
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);
|
|
22894
|
-
if (currentFeeBn.gt(0)) calculateFeesResult.push({
|
|
22895
|
-
amount: currentFeeBn.toString(),
|
|
22896
|
-
recipient: orderFee.recipient
|
|
22897
|
-
});
|
|
22898
|
-
} // for
|
|
22899
|
-
return calculateFeesResult;
|
|
22900
|
-
};
|
|
22901
|
-
|
|
22902
|
-
|
|
22903
23258
|
const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
|
|
22904
23259
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
|
|
22905
23260
|
id: id,
|
|
@@ -22928,7 +23283,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
22928
23283
|
if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
|
|
22929
23284
|
// get this from the allowed list
|
|
22930
23285
|
const buyTokenContract = new (Contract$1)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
|
|
22931
|
-
decimals = buyTokenContract.decimals();
|
|
23286
|
+
decimals = await buyTokenContract.decimals();
|
|
22932
23287
|
}
|
|
22933
23288
|
const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
|
|
22934
23289
|
try {
|
|
@@ -22971,7 +23326,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
22971
23326
|
collectionAddress: sellToken.collectionAddress
|
|
22972
23327
|
});
|
|
22973
23328
|
const signedMessage = await ($25ac589234c10b67$export$1d9a7a8a40780de)(provider, unsignedMessage);
|
|
22974
|
-
const unsignedTransactions = await ($a7367d01c6e76b1c$export$
|
|
23329
|
+
const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
|
|
22975
23330
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
|
|
22976
23331
|
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
22977
23332
|
id: sellToken.id,
|
|
@@ -23071,6 +23426,38 @@ class $a77d203f701a3b72$export$1453e9b801542ef4 {
|
|
|
23071
23426
|
|
|
23072
23427
|
|
|
23073
23428
|
|
|
23429
|
+
|
|
23430
|
+
|
|
23431
|
+
|
|
23432
|
+
async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements) {
|
|
23433
|
+
// Get all decimal values by calling contracts for each ERC20
|
|
23434
|
+
const decimalPromises = [];
|
|
23435
|
+
requirements.forEach((itemRequirementParam)=>{
|
|
23436
|
+
if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
|
|
23437
|
+
const { contractAddress: contractAddress } = itemRequirementParam;
|
|
23438
|
+
decimalPromises.push(($06a6c5c23f7f2479$export$fbbc17f6e6e58544)(contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider).decimals());
|
|
23439
|
+
}
|
|
23440
|
+
});
|
|
23441
|
+
const decimals = await Promise.all(decimalPromises);
|
|
23442
|
+
// Map ItemRequirementsParam objects to ItemRequirement by parsing amounts from formatted string to BigNumebrs
|
|
23443
|
+
const itemRequirements = requirements.map((itemRequirementParam, index)=>{
|
|
23444
|
+
if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return {
|
|
23445
|
+
...itemRequirementParam,
|
|
23446
|
+
amount: (parseUnits)(itemRequirementParam.amount, 18)
|
|
23447
|
+
};
|
|
23448
|
+
if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return {
|
|
23449
|
+
...itemRequirementParam,
|
|
23450
|
+
amount: (parseUnits)(itemRequirementParam.amount, decimals[index])
|
|
23451
|
+
};
|
|
23452
|
+
return itemRequirementParam;
|
|
23453
|
+
});
|
|
23454
|
+
return itemRequirements;
|
|
23455
|
+
}
|
|
23456
|
+
|
|
23457
|
+
|
|
23458
|
+
|
|
23459
|
+
|
|
23460
|
+
|
|
23074
23461
|
const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
23075
23462
|
baseConfig: {
|
|
23076
23463
|
environment: (Environment$1).SANDBOX
|
|
@@ -23197,8 +23584,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23197
23584
|
if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
|
|
23198
23585
|
// eslint-disable-next-line no-console
|
|
23199
23586
|
console.warn("This endpoint is currently under construction.");
|
|
23587
|
+
if (params.orders.length > 1) // eslint-disable-next-line no-console
|
|
23588
|
+
console.warn("This endpoint currently only actions the first order in the array.");
|
|
23200
23589
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
23201
|
-
await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.
|
|
23590
|
+
await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orders);
|
|
23202
23591
|
}
|
|
23203
23592
|
/**
|
|
23204
23593
|
* Determines the requirements for performing a sell.
|
|
@@ -23221,8 +23610,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23221
23610
|
if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
|
|
23222
23611
|
// eslint-disable-next-line no-console
|
|
23223
23612
|
console.warn("This endpoint is currently under construction.");
|
|
23613
|
+
// eslint-disable-next-line no-console
|
|
23614
|
+
console.warn("This endpoint currently only actions the first order in the array.");
|
|
23224
23615
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
23225
|
-
await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.
|
|
23616
|
+
await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderIds);
|
|
23226
23617
|
}
|
|
23227
23618
|
/**
|
|
23228
23619
|
* Determines the transaction requirements to complete a purchase.
|
|
@@ -23232,8 +23623,13 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23232
23623
|
// eslint-disable-next-line no-console
|
|
23233
23624
|
console.warn("This endpoint is currently under construction.");
|
|
23234
23625
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
23235
|
-
|
|
23236
|
-
|
|
23626
|
+
let itemRequirements = [];
|
|
23627
|
+
try {
|
|
23628
|
+
itemRequirements = await (0, $d35036efee31c5d1$export$dc8635800ef20f4b)(web3Provider, params.itemRequirements);
|
|
23629
|
+
} catch {
|
|
23630
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Failed to map item requirements", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ITEM_REQUIREMENTS_ERROR);
|
|
23631
|
+
}
|
|
23632
|
+
await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
|
|
23237
23633
|
}
|
|
23238
23634
|
/**
|
|
23239
23635
|
* Checks if the given object is a Web3 provider.
|