@imtbl/sdk 0.18.2 → 0.19.0-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 +61 -28
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +7 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +64 -31
- package/dist/index.d.ts +7 -4
- package/dist/index.js +64 -31
- package/dist/orderbook.d.ts +7 -4
- package/dist/orderbook.js +11 -20
- package/dist/passport.js +2 -2
- package/package.json +2 -1
package/dist/checkout_sdk.js
CHANGED
|
@@ -16673,7 +16673,7 @@ class ImmutableApiClient {
|
|
|
16673
16673
|
...listTradesParams,
|
|
16674
16674
|
});
|
|
16675
16675
|
}
|
|
16676
|
-
async createListing({ orderHash, orderComponents, orderSignature,
|
|
16676
|
+
async createListing({ orderHash, orderComponents, orderSignature, makerFees, }) {
|
|
16677
16677
|
if (orderComponents.offer.length !== 1) {
|
|
16678
16678
|
throw new Error('Only one item can be listed at a time');
|
|
16679
16679
|
}
|
|
@@ -16702,11 +16702,11 @@ class ImmutableApiClient {
|
|
|
16702
16702
|
contract_address: orderComponents.consideration[0].token,
|
|
16703
16703
|
},
|
|
16704
16704
|
],
|
|
16705
|
-
|
|
16706
|
-
amount:
|
|
16705
|
+
fees: makerFees.map((x) => ({
|
|
16706
|
+
amount: x.amount,
|
|
16707
16707
|
fee_type: FeeType.MAKER_MARKETPLACE,
|
|
16708
|
-
recipient:
|
|
16709
|
-
}
|
|
16708
|
+
recipient: x.recipient,
|
|
16709
|
+
})),
|
|
16710
16710
|
end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
16711
16711
|
protocol_data: {
|
|
16712
16712
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
@@ -16896,15 +16896,8 @@ class Orderbook {
|
|
|
16896
16896
|
* @return {ListingResult} The result of the order created in the Immutable services.
|
|
16897
16897
|
*/
|
|
16898
16898
|
async createListing(createListingParams) {
|
|
16899
|
-
const makerFee = createListingParams.makerFee
|
|
16900
|
-
? {
|
|
16901
|
-
...createListingParams.makerFee,
|
|
16902
|
-
type: FeeType.MAKER_MARKETPLACE,
|
|
16903
|
-
}
|
|
16904
|
-
: undefined;
|
|
16905
16899
|
const apiListingResponse = await this.apiClient.createListing({
|
|
16906
16900
|
...createListingParams,
|
|
16907
|
-
makerFee,
|
|
16908
16901
|
});
|
|
16909
16902
|
return {
|
|
16910
16903
|
result: mapFromOpenApiOrder(apiListingResponse.result),
|
|
@@ -16918,17 +16911,15 @@ class Orderbook {
|
|
|
16918
16911
|
* @param {string} fulfillerAddress - The address of the account fulfilling the order.
|
|
16919
16912
|
* @return {FulfillOrderResponse} Approval and fulfilment transactions.
|
|
16920
16913
|
*/
|
|
16921
|
-
async fulfillOrder(listingId, takerAddress,
|
|
16914
|
+
async fulfillOrder(listingId, takerAddress, takerFees) {
|
|
16922
16915
|
const fulfillmentDataRes = await this.apiClient.fulfillmentData([
|
|
16923
16916
|
{
|
|
16924
16917
|
order_id: listingId,
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
}
|
|
16931
|
-
: undefined,
|
|
16918
|
+
fees: takerFees.map((fee) => ({
|
|
16919
|
+
amount: fee.amount,
|
|
16920
|
+
fee_type: FeeType.TAKER_MARKETPLACE,
|
|
16921
|
+
recipient: fee.recipient,
|
|
16922
|
+
})),
|
|
16932
16923
|
},
|
|
16933
16924
|
]);
|
|
16934
16925
|
if (fulfillmentDataRes.result.length !== 1) {
|
|
@@ -19537,7 +19528,7 @@ class APIError extends Error {
|
|
|
19537
19528
|
|
|
19538
19529
|
/* eslint-disable implicit-arrow-linebreak */
|
|
19539
19530
|
const defaultHeaders = {
|
|
19540
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
19531
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.19.0-alpha',
|
|
19541
19532
|
};
|
|
19542
19533
|
/**
|
|
19543
19534
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -22421,6 +22412,34 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
22421
22412
|
|
|
22422
22413
|
|
|
22423
22414
|
|
|
22415
|
+
|
|
22416
|
+
|
|
22417
|
+
|
|
22418
|
+
const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutingOptions, balanceRequirement)=>{
|
|
22419
|
+
if (balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return undefined;
|
|
22420
|
+
const requiredBalance = balanceRequirement.required;
|
|
22421
|
+
let hasAllowList = false;
|
|
22422
|
+
const onRampProvidersAllowList = await ($5a5ccedc98d53d25$export$9ec9fc71f3ce62c4)(config, availableRoutingOptions);
|
|
22423
|
+
Object.values(onRampProvidersAllowList).forEach((onRampAllowList)=>{
|
|
22424
|
+
if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address === requiredBalance.token?.address);
|
|
22425
|
+
});
|
|
22426
|
+
if (!hasAllowList) return undefined;
|
|
22427
|
+
return {
|
|
22428
|
+
type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).ONRAMP,
|
|
22429
|
+
chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
|
|
22430
|
+
asset: {
|
|
22431
|
+
balance: requiredBalance.balance,
|
|
22432
|
+
formattedBalance: requiredBalance.formattedBalance,
|
|
22433
|
+
token: {
|
|
22434
|
+
...requiredBalance.token
|
|
22435
|
+
}
|
|
22436
|
+
}
|
|
22437
|
+
};
|
|
22438
|
+
};
|
|
22439
|
+
|
|
22440
|
+
|
|
22441
|
+
|
|
22442
|
+
|
|
22424
22443
|
const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
22425
22444
|
let insufficientBalanceCount = 0;
|
|
22426
22445
|
let insufficientRequirement;
|
|
@@ -22444,6 +22463,12 @@ const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutin
|
|
|
22444
22463
|
const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
|
|
22445
22464
|
return swapFundingStep;
|
|
22446
22465
|
};
|
|
22466
|
+
const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
|
|
22467
|
+
if (!availableRoutingOptions.onRamp) return undefined;
|
|
22468
|
+
if (insufficientRequirement === undefined) return undefined;
|
|
22469
|
+
const onRampFundingStep = await ($5649bc8af91da370$export$1fb2bd867f4a9be3)(config, availableRoutingOptions, insufficientRequirement);
|
|
22470
|
+
return onRampFundingStep;
|
|
22471
|
+
};
|
|
22447
22472
|
const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
|
|
22448
22473
|
let readOnlyProviders;
|
|
22449
22474
|
try {
|
|
@@ -22464,7 +22489,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22464
22489
|
let bridgeFundingStep;
|
|
22465
22490
|
if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
|
|
22466
22491
|
const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
|
|
22467
|
-
|
|
22492
|
+
const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
|
|
22468
22493
|
// Check swap routes
|
|
22469
22494
|
// > Could bridge first
|
|
22470
22495
|
// > Could on-ramp first
|
|
@@ -22477,7 +22502,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22477
22502
|
fundingRoutes: []
|
|
22478
22503
|
};
|
|
22479
22504
|
let priority = 0;
|
|
22480
|
-
if (bridgeFundingStep || swapFundingStep) {
|
|
22505
|
+
if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
|
|
22481
22506
|
response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
|
|
22482
22507
|
response.response.message = "Routes found";
|
|
22483
22508
|
}
|
|
@@ -22499,6 +22524,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22499
22524
|
]
|
|
22500
22525
|
});
|
|
22501
22526
|
}
|
|
22527
|
+
if (onRampFundingStep) {
|
|
22528
|
+
priority++;
|
|
22529
|
+
response.fundingRoutes.push({
|
|
22530
|
+
priority: priority,
|
|
22531
|
+
steps: [
|
|
22532
|
+
onRampFundingStep
|
|
22533
|
+
]
|
|
22534
|
+
});
|
|
22535
|
+
}
|
|
22502
22536
|
return response;
|
|
22503
22537
|
};
|
|
22504
22538
|
|
|
@@ -22702,7 +22736,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
22702
22736
|
};
|
|
22703
22737
|
try {
|
|
22704
22738
|
const fulfillerAddress = await provider.getSigner().getAddress();
|
|
22705
|
-
const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress);
|
|
22739
|
+
const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
|
|
22706
22740
|
unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
|
|
22707
22741
|
} catch {
|
|
22708
22742
|
// Silently ignore error as this is usually thrown if user does not have enough balance
|
|
@@ -22953,14 +22987,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
22953
22987
|
const createListingParams = {
|
|
22954
22988
|
orderComponents: signedMessage.orderComponents,
|
|
22955
22989
|
orderHash: signedMessage.orderHash,
|
|
22956
|
-
orderSignature: signedMessage.signedMessage
|
|
22990
|
+
orderSignature: signedMessage.signedMessage,
|
|
22991
|
+
makerFees: []
|
|
22957
22992
|
};
|
|
22958
22993
|
if (makerFees !== undefined) {
|
|
22959
22994
|
const orderBookFees = ($9051cee080948594$export$1e69c9cfc42e28d8)(makerFees, buyTokenOrNative.amount, decimals);
|
|
22960
|
-
// @TODO add support for an array of fees when the orderbook enables it
|
|
22961
22995
|
if (orderBookFees.length !== makerFees.length) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("One of the fees is too small, must be greater than 0.000001", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CREATE_ORDER_LISTING_ERROR);
|
|
22962
|
-
|
|
22963
|
-
createListingParams.makerFee = makerFee;
|
|
22996
|
+
createListingParams.makerFees = orderBookFees;
|
|
22964
22997
|
}
|
|
22965
22998
|
try {
|
|
22966
22999
|
const order = await orderbook.createListing(createListingParams);
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.
|
|
7
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.19.0-alpha";
|
|
8
8
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
9
9
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.19.0-alpha',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|