@imtbl/sdk 0.24.0-alpha.3 → 0.24.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.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.js +75 -11
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +78 -14
- package/dist/index.d.ts +23 -2
- package/dist/index.js +78 -14
- package/dist/orderbook.d.ts +18 -3
- package/dist/orderbook.js +74 -10
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout_sdk.js
CHANGED
|
@@ -16561,18 +16561,57 @@ class Seaport {
|
|
|
16561
16561
|
buildTransaction: prepareTransaction(fulfilOrderAction.transactionMethods),
|
|
16562
16562
|
purpose: TransactionPurpose.FULFILL_ORDER,
|
|
16563
16563
|
});
|
|
16564
|
-
// Expirtaion bytes in SIP7 extra data [21:29]
|
|
16565
|
-
// In hex string -> [21 * 2 + 2 (0x) : 29 * 2]
|
|
16566
|
-
// In JS slice (start, end_inclusive), (44,60)
|
|
16567
|
-
// 8 bytes uint64 epoch time in seconds
|
|
16568
|
-
const expirationHex = extraData.slice(44, 60);
|
|
16569
|
-
const expirationInSeconds = parseInt(expirationHex, 16);
|
|
16570
16564
|
return {
|
|
16571
16565
|
actions: fulfillmentActions,
|
|
16572
|
-
expiration:
|
|
16566
|
+
expiration: Seaport.getExpirationISOTimeFromExtraData(extraData),
|
|
16573
16567
|
order: mapFromOpenApiOrder(order),
|
|
16574
16568
|
};
|
|
16575
16569
|
}
|
|
16570
|
+
async fulfillBulkOrders(fulfillingOrders, account) {
|
|
16571
|
+
// TODO: this function right now does not handle errors from the seaport.js
|
|
16572
|
+
// we should figure out why orders are rejected and return a submission
|
|
16573
|
+
// transaction on best efforts basis
|
|
16574
|
+
const fulfillOrderDetails = fulfillingOrders.map((o) => {
|
|
16575
|
+
const { orderComponents, tips } = this.mapImmutableOrderToSeaportOrderComponents(o.order);
|
|
16576
|
+
return {
|
|
16577
|
+
order: {
|
|
16578
|
+
parameters: orderComponents,
|
|
16579
|
+
signature: o.order.signature,
|
|
16580
|
+
},
|
|
16581
|
+
extraData: o.extra_data,
|
|
16582
|
+
tips,
|
|
16583
|
+
};
|
|
16584
|
+
});
|
|
16585
|
+
const { actions: seaportActions } = await this.getSeaportLib().fulfillOrders({
|
|
16586
|
+
fulfillOrderDetails,
|
|
16587
|
+
accountAddress: account,
|
|
16588
|
+
});
|
|
16589
|
+
const fulfillmentActions = [];
|
|
16590
|
+
const approvalAction = seaportActions.find((action) => action.type === 'approval');
|
|
16591
|
+
if (approvalAction) {
|
|
16592
|
+
fulfillmentActions.push({
|
|
16593
|
+
type: ActionType.TRANSACTION,
|
|
16594
|
+
buildTransaction: prepareTransaction(approvalAction.transactionMethods),
|
|
16595
|
+
purpose: TransactionPurpose.APPROVAL,
|
|
16596
|
+
});
|
|
16597
|
+
}
|
|
16598
|
+
const fulfilOrderAction = seaportActions.find((action) => action.type === 'exchange');
|
|
16599
|
+
if (!fulfilOrderAction) {
|
|
16600
|
+
throw new Error('No exchange action found');
|
|
16601
|
+
}
|
|
16602
|
+
fulfillmentActions.push({
|
|
16603
|
+
type: ActionType.TRANSACTION,
|
|
16604
|
+
buildTransaction: prepareTransaction(fulfilOrderAction.transactionMethods),
|
|
16605
|
+
purpose: TransactionPurpose.FULFILL_ORDER,
|
|
16606
|
+
});
|
|
16607
|
+
return {
|
|
16608
|
+
actions: fulfillmentActions,
|
|
16609
|
+
// return the shortest expiration out of all extraData - they should be very close
|
|
16610
|
+
expiration: fulfillOrderDetails
|
|
16611
|
+
.map((d) => Seaport.getExpirationISOTimeFromExtraData(d.extraData))
|
|
16612
|
+
.reduce((p, c) => (new Date(p) < new Date(c) ? p : c)),
|
|
16613
|
+
};
|
|
16614
|
+
}
|
|
16576
16615
|
async cancelOrder(order, account) {
|
|
16577
16616
|
const { orderComponents } = this.mapImmutableOrderToSeaportOrderComponents(order);
|
|
16578
16617
|
const seaportLib = this.getSeaportLib(order);
|
|
@@ -16596,9 +16635,7 @@ class Seaport {
|
|
|
16596
16635
|
],
|
|
16597
16636
|
consideration: [
|
|
16598
16637
|
{
|
|
16599
|
-
token: considerationItem.type === 'ERC20'
|
|
16600
|
-
? considerationItem.contractAddress
|
|
16601
|
-
: undefined,
|
|
16638
|
+
token: considerationItem.type === 'ERC20' ? considerationItem.contractAddress : undefined,
|
|
16602
16639
|
amount: considerationItem.amount,
|
|
16603
16640
|
recipient: offerer,
|
|
16604
16641
|
},
|
|
@@ -16631,6 +16668,15 @@ class Seaport {
|
|
|
16631
16668
|
// }
|
|
16632
16669
|
return this.seaportLibFactory.create(seaportVersion, seaportAddress);
|
|
16633
16670
|
}
|
|
16671
|
+
static getExpirationISOTimeFromExtraData(extraData) {
|
|
16672
|
+
// Expirtaion bytes in SIP7 extra data [21:29]
|
|
16673
|
+
// In hex string -> [21 * 2 + 2 (0x) : 29 * 2]
|
|
16674
|
+
// In JS slice (start, end_inclusive), (44,60)
|
|
16675
|
+
// 8 bytes uint64 epoch time in seconds
|
|
16676
|
+
const expirationHex = extraData.slice(44, 60);
|
|
16677
|
+
const expirationInSeconds = parseInt(expirationHex, 16);
|
|
16678
|
+
return new Date(expirationInSeconds * 1000).toISOString();
|
|
16679
|
+
}
|
|
16634
16680
|
}
|
|
16635
16681
|
|
|
16636
16682
|
class ImmutableApiClient {
|
|
@@ -16934,6 +16980,24 @@ class Orderbook {
|
|
|
16934
16980
|
}
|
|
16935
16981
|
return this.seaport.fulfillOrder(orderResult, takerAddress, extraData);
|
|
16936
16982
|
}
|
|
16983
|
+
async fulfillBulkOrders(listings, takerAddress) {
|
|
16984
|
+
const fulfillmentDataRes = await this.apiClient.fulfillmentData(listings.map((listingRequest) => ({
|
|
16985
|
+
order_id: listingRequest.listingId,
|
|
16986
|
+
fees: listingRequest.takerFees.map((fee) => ({
|
|
16987
|
+
amount: fee.amount,
|
|
16988
|
+
fee_type: FeeType.TAKER_ECOSYSTEM,
|
|
16989
|
+
recipient: fee.recipient,
|
|
16990
|
+
})),
|
|
16991
|
+
})));
|
|
16992
|
+
return {
|
|
16993
|
+
...(await this.seaport.fulfillBulkOrders(fulfillmentDataRes.result.fulfillable_orders, takerAddress)),
|
|
16994
|
+
fulfillableOrders: fulfillmentDataRes.result.fulfillable_orders.map((o) => mapFromOpenApiOrder(o.order)),
|
|
16995
|
+
unfulfillableOrders: fulfillmentDataRes.result.unfulfillable_orders.map((o) => ({
|
|
16996
|
+
orderId: o.order_id,
|
|
16997
|
+
reason: o.reason,
|
|
16998
|
+
})),
|
|
16999
|
+
};
|
|
17000
|
+
}
|
|
16937
17001
|
/**
|
|
16938
17002
|
* Get an unsigned cancel order transaction. Orders can only be cancelled by
|
|
16939
17003
|
* the account that created them.
|
|
@@ -19891,7 +19955,7 @@ class APIError extends Error {
|
|
|
19891
19955
|
|
|
19892
19956
|
/* eslint-disable implicit-arrow-linebreak */
|
|
19893
19957
|
const defaultHeaders = {
|
|
19894
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.24.
|
|
19958
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.24.1-alpha.1',
|
|
19895
19959
|
};
|
|
19896
19960
|
/**
|
|
19897
19961
|
* createAPIConfiguration to create a custom Configuration
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
25
25
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.24.
|
|
28
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.24.1-alpha.1";
|
|
29
29
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30
30
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31
31
|
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.24.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.24.1-alpha.1',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|