@imtbl/sdk 0.34.0 → 0.35.0

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.
@@ -731,17 +731,17 @@ type Fee$1 = {
731
731
  /**
732
732
  * Fee type
733
733
  */
734
- fee_type: Fee$1.fee_type;
734
+ type: Fee$1.type;
735
735
  /**
736
736
  * Wallet address of fee recipient
737
737
  */
738
- recipient: string;
738
+ recipient_address: string;
739
739
  };
740
740
  declare namespace Fee$1 {
741
741
  /**
742
742
  * Fee type
743
743
  */
744
- enum fee_type {
744
+ enum type {
745
745
  ROYALTY = "ROYALTY",
746
746
  MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
747
747
  TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
@@ -749,17 +749,36 @@ declare namespace Fee$1 {
749
749
  }
750
750
  }
751
751
 
752
+ type ERC1155Item = {
753
+ /**
754
+ * Token type user is offering, which in this case is ERC1155
755
+ */
756
+ type: 'ERC1155';
757
+ /**
758
+ * Address of ERC1155 token
759
+ */
760
+ contract_address: string;
761
+ /**
762
+ * ID of ERC1155 token
763
+ */
764
+ token_id: string;
765
+ /**
766
+ * A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
767
+ */
768
+ amount: string;
769
+ };
770
+
752
771
  type ERC20Item$1 = {
753
772
  /**
754
773
  * Token type user is offering, which in this case is ERC20
755
774
  */
756
- item_type: 'ERC20';
775
+ type: 'ERC20';
757
776
  /**
758
777
  * Address of ERC20 token
759
778
  */
760
779
  contract_address: string;
761
780
  /**
762
- * A string representing the starting price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
781
+ * A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
763
782
  */
764
783
  amount: string;
765
784
  };
@@ -768,7 +787,7 @@ type ERC721Item$1 = {
768
787
  /**
769
788
  * Token type user is offering, which in this case is ERC721
770
789
  */
771
- item_type: 'ERC721';
790
+ type: 'ERC721';
772
791
  /**
773
792
  * Address of ERC721 token
774
793
  */
@@ -783,28 +802,28 @@ type NativeItem$1 = {
783
802
  /**
784
803
  * Token type user is offering, which in this case is the native IMX token
785
804
  */
786
- item_type: 'NATIVE';
805
+ type: 'NATIVE';
787
806
  /**
788
- * A string representing the starting price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
807
+ * A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
789
808
  */
790
809
  amount: string;
791
810
  };
792
811
 
793
- type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1);
812
+ type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1 | ERC1155Item);
794
813
 
795
814
  type ProtocolData = {
796
815
  /**
797
- * The Order type
816
+ * Seaport order type
798
817
  */
799
818
  order_type: ProtocolData.order_type;
800
- /**
801
- * Immutable zone address
802
- */
803
- zone_address: string;
804
819
  /**
805
820
  * big.Int or uint256 string for order counter
806
821
  */
807
822
  counter: string;
823
+ /**
824
+ * Immutable zone address
825
+ */
826
+ zone_address: string;
808
827
  /**
809
828
  * Immutable Seaport contract address
810
829
  */
@@ -816,7 +835,7 @@ type ProtocolData = {
816
835
  };
817
836
  declare namespace ProtocolData {
818
837
  /**
819
- * The Order type
838
+ * Seaport order type
820
839
  */
821
840
  enum order_type {
822
841
  FULL_RESTRICTED = "FULL_RESTRICTED"
@@ -968,6 +987,7 @@ type Order$1 = {
968
987
  * Global Order identifier
969
988
  */
970
989
  id: string;
990
+ order_hash: string;
971
991
  protocol_data: ProtocolData;
972
992
  /**
973
993
  * A random value added to the create Order request
@@ -983,11 +1003,23 @@ type Order$1 = {
983
1003
  */
984
1004
  start_at: string;
985
1005
  status: OrderStatus;
1006
+ /**
1007
+ * Order type
1008
+ */
1009
+ type: Order$1.type;
986
1010
  /**
987
1011
  * Time the Order is last updated
988
1012
  */
989
1013
  updated_at: string;
990
1014
  };
1015
+ declare namespace Order$1 {
1016
+ /**
1017
+ * Order type
1018
+ */
1019
+ enum type {
1020
+ LISTING = "LISTING"
1021
+ }
1022
+ }
991
1023
 
992
1024
  type FulfillableOrder = {
993
1025
  extra_data: string;
@@ -1350,7 +1382,7 @@ declare enum FeeType {
1350
1382
  ROYALTY = "ROYALTY"
1351
1383
  }
1352
1384
  interface FeeValue {
1353
- recipient: string;
1385
+ recipientAddress: string;
1354
1386
  amount: string;
1355
1387
  }
1356
1388
  interface Fee extends FeeValue {
@@ -1420,6 +1452,7 @@ interface CancelOrdersOnChainResponse {
1420
1452
  }
1421
1453
  interface Order {
1422
1454
  id: string;
1455
+ type: 'LISTING';
1423
1456
  accountAddress: string;
1424
1457
  buy: (ERC20Item | NativeItem)[];
1425
1458
  sell: ERC721Item[];
@@ -1438,6 +1471,7 @@ interface Order {
1438
1471
  * Time after which the Order is expired
1439
1472
  */
1440
1473
  endAt: string;
1474
+ orderHash: string;
1441
1475
  protocolData: {
1442
1476
  orderType: 'FULL_RESTRICTED';
1443
1477
  zoneAddress: string;
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 (fee_type) {
621
- fee_type["ROYALTY"] = "ROYALTY";
622
- fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
623
- fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
624
- fee_type["PROTOCOL"] = "PROTOCOL";
625
- })(Fee.fee_type || (Fee.fee_type = {}));
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.item_type === 'ERC20') {
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.item_type === 'NATIVE') {
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.item_type === 'ERC721') {
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
- recipient: fee.recipient,
713
- type: fee.fee_type,
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.item_type === 'ERC20') {
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.item_type === 'NATIVE') {
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.item_type === 'ERC721') {
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
- recipient: fee.recipient,
767
- type: fee.fee_type,
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.item_type) {
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].item_type === 'ERC20' ? ItemType.ERC20 : ItemType.NATIVE,
914
- recipient: fee.recipient,
915
- token: order.buy[0].item_type === 'ERC20'
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
- item_type: Number(orderComponents.consideration[0].itemType)
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
- fee_type: FeeType.MAKER_ECOSYSTEM,
1222
- recipient: x.recipient,
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
- item_type: 'ERC721',
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: '0x2CFA8f64e1B49A2DF28532D1D30Cda45117cF778',
1271
- zoneContractAddress: '0x1Bb4Fb11Ba021Bd0104F0Ee8E5F5c728Bc83d7F1',
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
- fee_type: FeeType.TAKER_ECOSYSTEM,
1435
- recipient: fee.recipient,
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
- fee_type: FeeType.TAKER_ECOSYSTEM,
1458
- recipient: fee.recipient,
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.34.0' };
2194
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.35.0' };
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.34.0',
2250
+ sdkVersion: 'ts-immutable-sdk-0.35.0',
2251
2251
  });
2252
2252
  /**
2253
2253
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.34.0",
4
+ "version": "0.35.0",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",