@imtbl/sdk 0.13.1-alpha → 0.13.2-alpha
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.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.js +119 -6
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +8 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +125 -10
- package/dist/index.d.ts +509 -91
- package/dist/index.js +125 -10
- package/dist/orderbook.d.ts +963 -71
- package/dist/orderbook.js +20 -3
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2420,7 +2420,7 @@ class MultiRollupApiClients {
|
|
|
2420
2420
|
}
|
|
2421
2421
|
|
|
2422
2422
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2423
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.13.
|
|
2423
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.13.2-alpha' };
|
|
2424
2424
|
const createConfig = ({ basePath, headers, }) => {
|
|
2425
2425
|
if (!basePath.trim()) {
|
|
2426
2426
|
throw Error('basePath can not be empty');
|
|
@@ -2480,7 +2480,7 @@ class APIError extends Error {
|
|
|
2480
2480
|
|
|
2481
2481
|
/* eslint-disable implicit-arrow-linebreak */
|
|
2482
2482
|
const defaultHeaders = {
|
|
2483
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.13.
|
|
2483
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.13.2-alpha',
|
|
2484
2484
|
};
|
|
2485
2485
|
/**
|
|
2486
2486
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -2752,7 +2752,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2752
2752
|
chainID,
|
|
2753
2753
|
coreContractAddress,
|
|
2754
2754
|
registrationContractAddress,
|
|
2755
|
-
sdkVersion: 'ts-immutable-sdk-0.13.
|
|
2755
|
+
sdkVersion: 'ts-immutable-sdk-0.13.2-alpha',
|
|
2756
2756
|
});
|
|
2757
2757
|
/**
|
|
2758
2758
|
* Sets `sdkVersion` at the time of build
|
|
@@ -9506,6 +9506,13 @@ var ProtocolData;
|
|
|
9506
9506
|
})(ProtocolData.order_type || (ProtocolData.order_type = {}));
|
|
9507
9507
|
})(ProtocolData || (ProtocolData = {}));
|
|
9508
9508
|
|
|
9509
|
+
var FeeType;
|
|
9510
|
+
(function (FeeType) {
|
|
9511
|
+
FeeType["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
|
|
9512
|
+
FeeType["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
|
|
9513
|
+
FeeType["PROTOCOL"] = "PROTOCOL";
|
|
9514
|
+
FeeType["ROYALTY"] = "ROYALTY";
|
|
9515
|
+
})(FeeType || (FeeType = {}));
|
|
9509
9516
|
var TransactionPurpose;
|
|
9510
9517
|
(function (TransactionPurpose) {
|
|
9511
9518
|
TransactionPurpose["APPROVAL"] = "APPROVAL";
|
|
@@ -9868,7 +9875,11 @@ class ImmutableApiClient {
|
|
|
9868
9875
|
contract_address: orderComponents.consideration[0].token,
|
|
9869
9876
|
},
|
|
9870
9877
|
],
|
|
9871
|
-
fees: makerFee ? [
|
|
9878
|
+
fees: makerFee ? [{
|
|
9879
|
+
amount: makerFee.amount,
|
|
9880
|
+
fee_type: makerFee.type,
|
|
9881
|
+
recipient: makerFee.recipient,
|
|
9882
|
+
}] : [],
|
|
9872
9883
|
end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
9873
9884
|
protocol_data: {
|
|
9874
9885
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
@@ -10041,7 +10052,13 @@ class Orderbook {
|
|
|
10041
10052
|
const fulfillmentDataRes = await this.apiClient.fulfillmentData([
|
|
10042
10053
|
{
|
|
10043
10054
|
order_id: listingId,
|
|
10044
|
-
fee: takerFee
|
|
10055
|
+
fee: takerFee
|
|
10056
|
+
? {
|
|
10057
|
+
amount: takerFee.amount,
|
|
10058
|
+
fee_type: takerFee.type,
|
|
10059
|
+
recipient: takerFee.recipient,
|
|
10060
|
+
}
|
|
10061
|
+
: undefined,
|
|
10045
10062
|
},
|
|
10046
10063
|
]);
|
|
10047
10064
|
if (fulfillmentDataRes.result.length !== 1) {
|
|
@@ -10087,6 +10104,8 @@ const constants = {
|
|
|
10087
10104
|
var orderbook = /*#__PURE__*/Object.freeze({
|
|
10088
10105
|
__proto__: null,
|
|
10089
10106
|
get ActionType () { return ActionType; },
|
|
10107
|
+
get FeeType () { return FeeType; },
|
|
10108
|
+
get OrderStatus () { return OrderStatus; },
|
|
10090
10109
|
Orderbook: Orderbook,
|
|
10091
10110
|
get SignablePurpose () { return SignablePurpose; },
|
|
10092
10111
|
get TransactionPurpose () { return TransactionPurpose; },
|
|
@@ -27908,9 +27927,39 @@ async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProvide
|
|
|
27908
27927
|
|
|
27909
27928
|
|
|
27910
27929
|
|
|
27930
|
+
const $ddc6bcd0896481e5$export$2fbfa41a4de56a89 = (erc20allowances, erc721allowances)=>{
|
|
27931
|
+
const aggregatedAllowances = [];
|
|
27932
|
+
if (!erc20allowances.sufficient) {
|
|
27933
|
+
for (const allowance of erc20allowances.allowances)if (!allowance.sufficient) aggregatedAllowances.push(allowance);
|
|
27934
|
+
}
|
|
27935
|
+
if (!erc721allowances.sufficient) {
|
|
27936
|
+
for (const allowance of erc721allowances.allowances)if (!allowance.sufficient) aggregatedAllowances.push(allowance);
|
|
27937
|
+
}
|
|
27938
|
+
return aggregatedAllowances;
|
|
27939
|
+
};
|
|
27940
|
+
|
|
27941
|
+
|
|
27911
27942
|
|
|
27912
27943
|
|
|
27913
|
-
const $
|
|
27944
|
+
const $074f75878f618031$export$84f303391caa056f = (itemRequirements)=>{
|
|
27945
|
+
const aggregatedMap = new Map();
|
|
27946
|
+
const aggregatedItemRequirements = [];
|
|
27947
|
+
itemRequirements.forEach((itemRequirement)=>{
|
|
27948
|
+
const { type: type } = itemRequirement;
|
|
27949
|
+
if (type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) {
|
|
27950
|
+
aggregatedItemRequirements.push(itemRequirement);
|
|
27951
|
+
return;
|
|
27952
|
+
}
|
|
27953
|
+
const { amount: amount } = itemRequirement;
|
|
27954
|
+
const aggregateItem = aggregatedMap.get(type);
|
|
27955
|
+
if (aggregateItem && aggregateItem.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) aggregateItem.amount = (ethers.BigNumber).from(aggregateItem.amount).add(amount);
|
|
27956
|
+
else aggregatedMap.set(type, {
|
|
27957
|
+
...itemRequirement
|
|
27958
|
+
});
|
|
27959
|
+
});
|
|
27960
|
+
return aggregatedItemRequirements.concat(Array.from(aggregatedMap.values()));
|
|
27961
|
+
};
|
|
27962
|
+
const $074f75878f618031$export$1ede6278abcdf1cb = (itemRequirements)=>{
|
|
27914
27963
|
const aggregatedMap = new Map();
|
|
27915
27964
|
const aggregatedItemRequirements = [];
|
|
27916
27965
|
itemRequirements.forEach((itemRequirement)=>{
|
|
@@ -27929,7 +27978,7 @@ const $2499eab4caa6dc71$export$1ede6278abcdf1cb = (itemRequirements)=>{
|
|
|
27929
27978
|
});
|
|
27930
27979
|
return aggregatedItemRequirements.concat(Array.from(aggregatedMap.values()));
|
|
27931
27980
|
};
|
|
27932
|
-
const $
|
|
27981
|
+
const $074f75878f618031$export$fa1f577106a81103 = (itemRequirements)=>{
|
|
27933
27982
|
const aggregatedMap = new Map();
|
|
27934
27983
|
const aggregatedItemRequirements = [];
|
|
27935
27984
|
itemRequirements.forEach((itemRequirement)=>{
|
|
@@ -27947,7 +27996,9 @@ const $2499eab4caa6dc71$export$fa1f577106a81103 = (itemRequirements)=>{
|
|
|
27947
27996
|
});
|
|
27948
27997
|
return aggregatedItemRequirements.concat(Array.from(aggregatedMap.values()));
|
|
27949
27998
|
};
|
|
27950
|
-
const $
|
|
27999
|
+
const $074f75878f618031$export$c804c9ade5c28607 = (itemRequirements)=>$074f75878f618031$export$fa1f577106a81103($074f75878f618031$export$1ede6278abcdf1cb($074f75878f618031$export$84f303391caa056f(itemRequirements)));
|
|
28000
|
+
|
|
28001
|
+
|
|
27951
28002
|
|
|
27952
28003
|
|
|
27953
28004
|
|
|
@@ -28176,17 +28227,81 @@ const $35c3fc7013888ba5$export$be546c525d418988 = async (provider, ownerAddress,
|
|
|
28176
28227
|
|
|
28177
28228
|
|
|
28178
28229
|
|
|
28230
|
+
|
|
28231
|
+
|
|
28232
|
+
|
|
28233
|
+
|
|
28234
|
+
const $7d1bfafb81e64d74$var$doesChainSupportEIP1559 = (feeData)=>!!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
|
|
28235
|
+
const $7d1bfafb81e64d74$var$getGasPriceInWei = (feeData)=>{
|
|
28236
|
+
if ($7d1bfafb81e64d74$var$doesChainSupportEIP1559(feeData)) return (ethers.BigNumber).from(feeData.maxFeePerGas).add((ethers.BigNumber).from(feeData.maxPriorityFeePerGas));
|
|
28237
|
+
if (feeData.gasPrice) return (ethers.BigNumber).from(feeData.gasPrice);
|
|
28238
|
+
return undefined;
|
|
28239
|
+
};
|
|
28240
|
+
const $7d1bfafb81e64d74$export$e0580ae1f48db848 = async (provider, transaction)=>{
|
|
28241
|
+
try {
|
|
28242
|
+
return await provider.estimateGas(transaction);
|
|
28243
|
+
} catch (err) {
|
|
28244
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Failed to estimate gas for transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNPREDICTABLE_GAS_LIMIT);
|
|
28245
|
+
}
|
|
28246
|
+
};
|
|
28247
|
+
const $7d1bfafb81e64d74$export$c5e1b13f11e2e27f = (gas, transactionOrGas)=>{
|
|
28248
|
+
if (transactionOrGas.type === ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION || transactionOrGas.gasToken.type === ($4b58188d47aafe8d$export$537fa3efd10ed435).NATIVE) return {
|
|
28249
|
+
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE,
|
|
28250
|
+
amount: gas
|
|
28251
|
+
};
|
|
28252
|
+
return {
|
|
28253
|
+
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20,
|
|
28254
|
+
amount: gas,
|
|
28255
|
+
contractAddress: transactionOrGas.gasToken.contractAddress,
|
|
28256
|
+
spenderAddress: ""
|
|
28257
|
+
};
|
|
28258
|
+
};
|
|
28259
|
+
const $7d1bfafb81e64d74$export$3a4140bd9e983e4e = async (provider, insufficientItems, transactionOrGas)=>{
|
|
28260
|
+
const estimateGasPromises = [];
|
|
28261
|
+
let totalGas = (ethers.BigNumber).from(0);
|
|
28262
|
+
// Get all the gas estimate promises for the approval transactions
|
|
28263
|
+
for (const item of insufficientItems){
|
|
28264
|
+
if (item.approvalTransaction === undefined) continue;
|
|
28265
|
+
estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, item.approvalTransaction));
|
|
28266
|
+
}
|
|
28267
|
+
// If the transaction is a fulfilment transaction get the estimate gas promise
|
|
28268
|
+
// Otherwise use the gas amount with the limit to estimate the gas
|
|
28269
|
+
if (transactionOrGas.type === ($4b58188d47aafe8d$export$65c64e46348ee3c1).TRANSACTION) estimateGasPromises.push($7d1bfafb81e64d74$export$e0580ae1f48db848(provider, transactionOrGas.transaction));
|
|
28270
|
+
else {
|
|
28271
|
+
const feeData = await provider.getFeeData();
|
|
28272
|
+
const gasPrice = $7d1bfafb81e64d74$var$getGasPriceInWei(feeData);
|
|
28273
|
+
const gas = gasPrice?.mul(transactionOrGas.gasToken.limit);
|
|
28274
|
+
if (gas) totalGas = totalGas.add(gas);
|
|
28275
|
+
}
|
|
28276
|
+
// Get the gas estimates for all the transactions and calculate the total gas
|
|
28277
|
+
const gasEstimatePromises = await Promise.all(estimateGasPromises);
|
|
28278
|
+
gasEstimatePromises.forEach((gasEstimate)=>{
|
|
28279
|
+
totalGas = totalGas.add(gasEstimate);
|
|
28280
|
+
});
|
|
28281
|
+
if (totalGas.eq(0)) return null;
|
|
28282
|
+
return $7d1bfafb81e64d74$export$c5e1b13f11e2e27f(totalGas, transactionOrGas);
|
|
28283
|
+
};
|
|
28284
|
+
|
|
28285
|
+
|
|
28179
28286
|
const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (provider, itemRequirements, transactionOrGasAmount)=>{
|
|
28180
28287
|
// eslint-disable-next-line no-console
|
|
28181
28288
|
console.log(provider, itemRequirements, transactionOrGasAmount);
|
|
28182
28289
|
const ownerAddress = await provider.getSigner().getAddress();
|
|
28183
|
-
|
|
28290
|
+
let aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(itemRequirements);
|
|
28184
28291
|
const erc20Allowances = await ($fc8b338399d890f3$export$d93c00812189e36)(provider, ownerAddress, aggregatedItems);
|
|
28185
28292
|
const erc721Allowances = await ($35c3fc7013888ba5$export$be546c525d418988)(provider, ownerAddress, aggregatedItems);
|
|
28186
28293
|
// eslint-disable-next-line no-console
|
|
28187
28294
|
console.log("ERC20 Allowances", erc20Allowances);
|
|
28188
28295
|
// eslint-disable-next-line no-console
|
|
28189
28296
|
console.log("ERC721 Allowances", erc721Allowances);
|
|
28297
|
+
const aggregatedAllowances = ($ddc6bcd0896481e5$export$2fbfa41a4de56a89)(erc20Allowances, erc721Allowances);
|
|
28298
|
+
const gasItem = await ($7d1bfafb81e64d74$export$3a4140bd9e983e4e)(provider, aggregatedAllowances, transactionOrGasAmount);
|
|
28299
|
+
if (gasItem !== null) {
|
|
28300
|
+
aggregatedItems.push(gasItem);
|
|
28301
|
+
aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(aggregatedItems);
|
|
28302
|
+
}
|
|
28303
|
+
// eslint-disable-next-line no-console
|
|
28304
|
+
console.log("Aggregated Items", aggregatedItems);
|
|
28190
28305
|
return {
|
|
28191
28306
|
sufficient: true,
|
|
28192
28307
|
transactionRequirements: [
|
|
@@ -28515,7 +28630,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
28515
28630
|
function $parcel$export(e, n, v, s) {
|
|
28516
28631
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
28517
28632
|
}
|
|
28518
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.13.
|
|
28633
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.13.2-alpha";
|
|
28519
28634
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
28520
28635
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
28521
28636
|
|