@imtbl/sdk 0.34.1-alpha → 0.35.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/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +56 -56
- package/dist/checkout.js +95 -98
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +97 -100
- package/dist/index.d.ts +50 -16
- package/dist/index.js +97 -100
- package/dist/orderbook.d.ts +50 -16
- package/dist/orderbook.js +44 -32
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/orderbook.js
CHANGED
|
@@ -617,14 +617,24 @@ var FailedOrderCancellation;
|
|
|
617
617
|
/* eslint-disable */
|
|
618
618
|
var Fee;
|
|
619
619
|
(function (Fee) {
|
|
620
|
-
(function (
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
})(Fee.
|
|
620
|
+
(function (type) {
|
|
621
|
+
type["ROYALTY"] = "ROYALTY";
|
|
622
|
+
type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
623
|
+
type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
624
|
+
type["PROTOCOL"] = "PROTOCOL";
|
|
625
|
+
})(Fee.type || (Fee.type = {}));
|
|
626
626
|
})(Fee || (Fee = {}));
|
|
627
627
|
|
|
628
|
+
/* istanbul ignore file */
|
|
629
|
+
/* tslint:disable */
|
|
630
|
+
/* eslint-disable */
|
|
631
|
+
var Order;
|
|
632
|
+
(function (Order) {
|
|
633
|
+
(function (type) {
|
|
634
|
+
type["LISTING"] = "LISTING";
|
|
635
|
+
})(Order.type || (Order.type = {}));
|
|
636
|
+
})(Order || (Order = {}));
|
|
637
|
+
|
|
628
638
|
/* istanbul ignore file */
|
|
629
639
|
/* tslint:disable */
|
|
630
640
|
/* eslint-disable */
|
|
@@ -677,14 +687,14 @@ var ActionType;
|
|
|
677
687
|
|
|
678
688
|
function mapFromOpenApiOrder(order) {
|
|
679
689
|
const buyItems = order.buy.map((item) => {
|
|
680
|
-
if (item.
|
|
690
|
+
if (item.type === 'ERC20') {
|
|
681
691
|
return {
|
|
682
692
|
type: 'ERC20',
|
|
683
693
|
contractAddress: item.contract_address,
|
|
684
694
|
amount: item.amount,
|
|
685
695
|
};
|
|
686
696
|
}
|
|
687
|
-
if (item.
|
|
697
|
+
if (item.type === 'NATIVE') {
|
|
688
698
|
return {
|
|
689
699
|
type: 'NATIVE',
|
|
690
700
|
amount: item.amount,
|
|
@@ -693,7 +703,7 @@ function mapFromOpenApiOrder(order) {
|
|
|
693
703
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
694
704
|
});
|
|
695
705
|
const sellItems = order.sell.map((item) => {
|
|
696
|
-
if (item.
|
|
706
|
+
if (item.type === 'ERC721') {
|
|
697
707
|
return {
|
|
698
708
|
type: 'ERC721',
|
|
699
709
|
contractAddress: item.contract_address,
|
|
@@ -704,20 +714,22 @@ function mapFromOpenApiOrder(order) {
|
|
|
704
714
|
});
|
|
705
715
|
return {
|
|
706
716
|
id: order.id,
|
|
717
|
+
type: order.type,
|
|
707
718
|
accountAddress: order.account_address,
|
|
708
719
|
buy: buyItems,
|
|
709
720
|
sell: sellItems,
|
|
710
721
|
fees: order.fees.map((fee) => ({
|
|
711
722
|
amount: fee.amount,
|
|
712
|
-
|
|
713
|
-
type: fee.
|
|
723
|
+
recipientAddress: fee.recipient_address,
|
|
724
|
+
type: fee.type,
|
|
714
725
|
})),
|
|
715
726
|
chain: order.chain,
|
|
716
727
|
createdAt: order.created_at,
|
|
717
728
|
endAt: order.end_at,
|
|
729
|
+
orderHash: order.order_hash,
|
|
718
730
|
protocolData: {
|
|
719
|
-
counter: order.protocol_data.counter,
|
|
720
731
|
orderType: order.protocol_data.order_type,
|
|
732
|
+
counter: order.protocol_data.counter,
|
|
721
733
|
seaportAddress: order.protocol_data.seaport_address,
|
|
722
734
|
seaportVersion: order.protocol_data.seaport_version,
|
|
723
735
|
zoneAddress: order.protocol_data.zone_address,
|
|
@@ -731,14 +743,14 @@ function mapFromOpenApiOrder(order) {
|
|
|
731
743
|
}
|
|
732
744
|
function mapFromOpenApiTrade(trade) {
|
|
733
745
|
const buyItems = trade.buy.map((item) => {
|
|
734
|
-
if (item.
|
|
746
|
+
if (item.type === 'ERC20') {
|
|
735
747
|
return {
|
|
736
748
|
type: 'ERC20',
|
|
737
749
|
contractAddress: item.contract_address,
|
|
738
750
|
amount: item.amount,
|
|
739
751
|
};
|
|
740
752
|
}
|
|
741
|
-
if (item.
|
|
753
|
+
if (item.type === 'NATIVE') {
|
|
742
754
|
return {
|
|
743
755
|
type: 'NATIVE',
|
|
744
756
|
amount: item.amount,
|
|
@@ -747,7 +759,7 @@ function mapFromOpenApiTrade(trade) {
|
|
|
747
759
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
748
760
|
});
|
|
749
761
|
const sellItems = trade.sell.map((item) => {
|
|
750
|
-
if (item.
|
|
762
|
+
if (item.type === 'ERC721') {
|
|
751
763
|
return {
|
|
752
764
|
type: 'ERC721',
|
|
753
765
|
contractAddress: item.contract_address,
|
|
@@ -763,8 +775,8 @@ function mapFromOpenApiTrade(trade) {
|
|
|
763
775
|
sell: sellItems,
|
|
764
776
|
buyerFees: trade.buyer_fees.map((fee) => ({
|
|
765
777
|
amount: fee.amount,
|
|
766
|
-
|
|
767
|
-
type: fee.
|
|
778
|
+
recipientAddress: fee.recipient_address,
|
|
779
|
+
type: fee.type,
|
|
768
780
|
})),
|
|
769
781
|
chain: trade.chain,
|
|
770
782
|
indexedAt: trade.indexed_at,
|
|
@@ -878,7 +890,7 @@ chainId) {
|
|
|
878
890
|
|
|
879
891
|
function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
|
|
880
892
|
const considerationItems = order.buy.map((buyItem) => {
|
|
881
|
-
switch (buyItem.
|
|
893
|
+
switch (buyItem.type) {
|
|
882
894
|
case 'NATIVE':
|
|
883
895
|
return {
|
|
884
896
|
startAmount: buyItem.amount,
|
|
@@ -910,9 +922,9 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
910
922
|
});
|
|
911
923
|
const fees = order.fees.map((fee) => ({
|
|
912
924
|
amount: fee.amount,
|
|
913
|
-
itemType: order.buy[0].
|
|
914
|
-
recipient: fee.
|
|
915
|
-
token: order.buy[0].
|
|
925
|
+
itemType: order.buy[0].type === 'ERC20' ? ItemType.ERC20 : ItemType.NATIVE,
|
|
926
|
+
recipient: fee.recipient_address,
|
|
927
|
+
token: order.buy[0].type === 'ERC20'
|
|
916
928
|
? order.buy[0].contract_address
|
|
917
929
|
: constants$1.AddressZero,
|
|
918
930
|
identifierOrCriteria: '0',
|
|
@@ -1204,11 +1216,10 @@ class ImmutableApiClient {
|
|
|
1204
1216
|
return this.orderbookService.createListing({
|
|
1205
1217
|
chainName: this.chainName,
|
|
1206
1218
|
requestBody: {
|
|
1207
|
-
order_hash: orderHash,
|
|
1208
1219
|
account_address: orderComponents.offerer,
|
|
1209
1220
|
buy: [
|
|
1210
1221
|
{
|
|
1211
|
-
|
|
1222
|
+
type: Number(orderComponents.consideration[0].itemType)
|
|
1212
1223
|
=== ItemType.NATIVE
|
|
1213
1224
|
? 'NATIVE'
|
|
1214
1225
|
: 'ERC20',
|
|
@@ -1218,10 +1229,11 @@ class ImmutableApiClient {
|
|
|
1218
1229
|
],
|
|
1219
1230
|
fees: makerFees.map((x) => ({
|
|
1220
1231
|
amount: x.amount,
|
|
1221
|
-
|
|
1222
|
-
|
|
1232
|
+
type: FeeType.MAKER_ECOSYSTEM,
|
|
1233
|
+
recipient_address: x.recipientAddress,
|
|
1223
1234
|
})),
|
|
1224
1235
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
1236
|
+
order_hash: orderHash,
|
|
1225
1237
|
protocol_data: {
|
|
1226
1238
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
1227
1239
|
zone_address: orderComponents.zone,
|
|
@@ -1234,7 +1246,7 @@ class ImmutableApiClient {
|
|
|
1234
1246
|
{
|
|
1235
1247
|
contract_address: orderComponents.offer[0].token,
|
|
1236
1248
|
token_id: orderComponents.offer[0].identifierOrCriteria,
|
|
1237
|
-
|
|
1249
|
+
type: 'ERC721',
|
|
1238
1250
|
},
|
|
1239
1251
|
],
|
|
1240
1252
|
signature: orderSignature,
|
|
@@ -1267,8 +1279,8 @@ function getOrderbookConfig(environment) {
|
|
|
1267
1279
|
switch (environment) {
|
|
1268
1280
|
case Environment.SANDBOX:
|
|
1269
1281
|
return {
|
|
1270
|
-
seaportContractAddress: '
|
|
1271
|
-
zoneContractAddress: '
|
|
1282
|
+
seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
|
|
1283
|
+
zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
|
|
1272
1284
|
apiEndpoint: 'https://api.sandbox.immutable.com',
|
|
1273
1285
|
chainName: TESTNET_CHAIN_NAME,
|
|
1274
1286
|
provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
|
|
@@ -1431,8 +1443,8 @@ class Orderbook {
|
|
|
1431
1443
|
order_id: listingId,
|
|
1432
1444
|
fees: takerFees.map((fee) => ({
|
|
1433
1445
|
amount: fee.amount,
|
|
1434
|
-
|
|
1435
|
-
|
|
1446
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
1447
|
+
recipient_address: fee.recipientAddress,
|
|
1436
1448
|
})),
|
|
1437
1449
|
},
|
|
1438
1450
|
]);
|
|
@@ -1454,8 +1466,8 @@ class Orderbook {
|
|
|
1454
1466
|
order_id: listingRequest.listingId,
|
|
1455
1467
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
1456
1468
|
amount: fee.amount,
|
|
1457
|
-
|
|
1458
|
-
|
|
1469
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
1470
|
+
recipient_address: fee.recipientAddress,
|
|
1459
1471
|
})),
|
|
1460
1472
|
})));
|
|
1461
1473
|
try {
|
package/dist/passport.js
CHANGED
|
@@ -2191,7 +2191,7 @@ class MultiRollupApiClients {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
2193
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2194
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
2194
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.35.1' };
|
|
2195
2195
|
const createConfig = ({ basePath, headers, }) => {
|
|
2196
2196
|
if (!basePath.trim()) {
|
|
2197
2197
|
throw Error('basePath can not be empty');
|
|
@@ -2247,7 +2247,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2247
2247
|
chainID,
|
|
2248
2248
|
coreContractAddress,
|
|
2249
2249
|
registrationContractAddress,
|
|
2250
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
2250
|
+
sdkVersion: 'ts-immutable-sdk-0.35.1',
|
|
2251
2251
|
});
|
|
2252
2252
|
/**
|
|
2253
2253
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED