@imtbl/sdk 0.11.0-alpha → 0.12.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/orderbook.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import FormData from 'form-data';
3
- import { providers, BigNumber, constants as constants$1, utils, Contract } from 'ethers';
3
+ import { providers, BigNumber, constants as constants$1 } from 'ethers';
4
4
  import { Seaport as Seaport$1 } from '@opensea/seaport-js';
5
5
 
6
6
  var Environment;
@@ -531,6 +531,9 @@ var Fee;
531
531
  (function (Fee) {
532
532
  (function (fee_type) {
533
533
  fee_type["ROYALTY"] = "ROYALTY";
534
+ fee_type["MAKER_MARKETPLACE"] = "MAKER_MARKETPLACE";
535
+ fee_type["TAKER_MARKETPLACE"] = "TAKER_MARKETPLACE";
536
+ fee_type["PROTOCOL"] = "PROTOCOL";
534
537
  })(Fee.fee_type || (Fee.fee_type = {}));
535
538
  })(Fee || (Fee = {}));
536
539
 
@@ -684,8 +687,7 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
684
687
  }
685
688
  });
686
689
  const fees = order.fees.map((fee) => ({
687
- startAmount: fee.amount,
688
- endAmount: fee.amount,
690
+ amount: fee.amount,
689
691
  itemType: order.buy[0].item_type === 'ERC20' ? ItemType.ERC20 : ItemType.NATIVE,
690
692
  recipient: fee.recipient,
691
693
  token: order.buy[0].item_type === 'ERC20'
@@ -694,27 +696,31 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
694
696
  identifierOrCriteria: '0',
695
697
  }));
696
698
  return {
697
- conduitKey: constants$1.HashZero,
698
- consideration: [...considerationItems, ...fees],
699
- offer: order.sell.map((sellItem) => {
700
- const erc721Item = sellItem;
701
- return {
702
- startAmount: '1',
703
- endAmount: '1',
704
- itemType: ItemType.ERC721,
705
- token: erc721Item.contract_address,
706
- identifierOrCriteria: erc721Item.token_id,
707
- };
708
- }),
709
- counter,
710
- endTime: Math.round(new Date(order.end_time).getTime() / 1000).toString(),
711
- startTime: Math.round(new Date(order.start_time).getTime() / 1000).toString(),
712
- salt: order.salt,
713
- offerer: order.account_address,
714
- zone: zoneAddress,
715
- totalOriginalConsiderationItems: 2,
716
- orderType: OrderType.FULL_RESTRICTED,
717
- zoneHash: constants$1.HashZero,
699
+ orderComponents: {
700
+ conduitKey: constants$1.HashZero,
701
+ consideration: [...considerationItems],
702
+ offer: order.sell.map((sellItem) => {
703
+ const erc721Item = sellItem;
704
+ return {
705
+ startAmount: '1',
706
+ endAmount: '1',
707
+ itemType: ItemType.ERC721,
708
+ token: erc721Item.contract_address,
709
+ identifierOrCriteria: erc721Item.token_id,
710
+ };
711
+ }),
712
+ counter,
713
+ endTime: Math.round(new Date(order.end_time).getTime() / 1000).toString(),
714
+ startTime: Math.round(new Date(order.start_time).getTime() / 1000).toString(),
715
+ salt: order.salt,
716
+ offerer: order.account_address,
717
+ zone: zoneAddress,
718
+ // this should be the fee exclusive number of items the user signed for
719
+ totalOriginalConsiderationItems: considerationItems.length,
720
+ orderType: OrderType.FULL_RESTRICTED,
721
+ zoneHash: constants$1.HashZero,
722
+ },
723
+ tips: fees,
718
724
  };
719
725
  }
720
726
 
@@ -729,11 +735,10 @@ class Seaport {
729
735
  this.seaportContractAddress = seaportContractAddress;
730
736
  this.zoneContractAddress = zoneContractAddress;
731
737
  }
732
- async prepareSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry) {
733
- const { actions: seaportActions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry);
738
+ async prepareSeaportOrder(offerer, listingItem, considerationItem, orderStart, orderExpiry) {
739
+ const { actions: seaportActions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, orderStart, orderExpiry);
734
740
  const listingActions = [];
735
- const approvalAction = seaportActions
736
- .find((action) => action.type === 'approval');
741
+ const approvalAction = seaportActions.find((action) => action.type === 'approval');
737
742
  if (approvalAction) {
738
743
  listingActions.push({
739
744
  type: ActionType.TRANSACTION,
@@ -741,8 +746,7 @@ class Seaport {
741
746
  buildTransaction: prepareTransaction(approvalAction.transactionMethods),
742
747
  });
743
748
  }
744
- const createAction = seaportActions
745
- .find((action) => action.type === 'create');
749
+ const createAction = seaportActions.find((action) => action.type === 'create');
746
750
  if (!createAction) {
747
751
  throw new Error('No create order action found');
748
752
  }
@@ -760,21 +764,23 @@ class Seaport {
760
764
  };
761
765
  }
762
766
  async fulfillOrder(order, account, extraData) {
763
- const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
767
+ const { orderComponents, tips } = this.mapImmutableOrderToSeaportOrderComponents(order);
764
768
  const seaportLib = this.getSeaportLib(order);
765
769
  const { actions: seaportActions } = await seaportLib.fulfillOrders({
766
770
  accountAddress: account,
767
- fulfillOrderDetails: [{
771
+ fulfillOrderDetails: [
772
+ {
768
773
  order: {
769
774
  parameters: orderComponents,
770
775
  signature: order.signature,
771
776
  },
772
777
  extraData,
773
- }],
778
+ tips,
779
+ },
780
+ ],
774
781
  });
775
782
  const fulfillmentActions = [];
776
- const approvalAction = seaportActions
777
- .find((action) => action.type === 'approval');
783
+ const approvalAction = seaportActions.find((action) => action.type === 'approval');
778
784
  if (approvalAction) {
779
785
  fulfillmentActions.push({
780
786
  type: ActionType.TRANSACTION,
@@ -782,8 +788,7 @@ class Seaport {
782
788
  purpose: TransactionPurpose.APPROVAL,
783
789
  });
784
790
  }
785
- const fulfilOrderAction = seaportActions
786
- .find((action) => action.type === 'exchange');
791
+ const fulfilOrderAction = seaportActions.find((action) => action.type === 'exchange');
787
792
  if (!fulfilOrderAction) {
788
793
  throw new Error('No exchange action found');
789
794
  }
@@ -795,7 +800,7 @@ class Seaport {
795
800
  return { actions: fulfillmentActions };
796
801
  }
797
802
  async cancelOrder(order, account) {
798
- const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
803
+ const { orderComponents } = this.mapImmutableOrderToSeaportOrderComponents(order);
799
804
  const seaportLib = this.getSeaportLib(order);
800
805
  const cancellationTransaction = await seaportLib.cancelOrders([orderComponents], account);
801
806
  return prepareTransaction(cancellationTransaction)();
@@ -804,7 +809,7 @@ class Seaport {
804
809
  const orderCounter = order.protocol_data.counter;
805
810
  return mapImmutableOrderToSeaportOrderComponents(order, orderCounter, this.zoneContractAddress);
806
811
  }
807
- createSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry) {
812
+ createSeaportOrder(offerer, listingItem, considerationItem, orderStart, orderExpiry) {
808
813
  const seaportLib = this.getSeaportLib();
809
814
  return seaportLib.createOrder({
810
815
  allowPartialFills: false,
@@ -817,15 +822,12 @@ class Seaport {
817
822
  ],
818
823
  consideration: [
819
824
  {
820
- token: considerationItem.type === 'ERC20' ? considerationItem.contractAddress : undefined,
825
+ token: considerationItem.type === 'ERC20'
826
+ ? considerationItem.contractAddress
827
+ : undefined,
821
828
  amount: considerationItem.amount,
822
829
  recipient: offerer,
823
830
  },
824
- {
825
- token: considerationItem.type === 'ERC20' ? considerationItem.contractAddress : undefined,
826
- amount: royaltyInfo.amountRequired,
827
- recipient: royaltyInfo.recipient,
828
- },
829
831
  ],
830
832
  startTime: (orderStart.getTime() / 1000).toFixed(0),
831
833
  endTime: (orderExpiry.getTime() / 1000).toFixed(0),
@@ -884,7 +886,7 @@ class ImmutableApiClient {
884
886
  ...listOrderParams,
885
887
  });
886
888
  }
887
- async createListing({ orderHash, orderComponents, orderSignature, }) {
889
+ async createListing({ orderHash, orderComponents, orderSignature, makerFee, }) {
888
890
  if (orderComponents.offer.length !== 1) {
889
891
  throw new Error('Only one item can be listed at a time');
890
892
  }
@@ -913,15 +915,7 @@ class ImmutableApiClient {
913
915
  contract_address: orderComponents.consideration[0].token,
914
916
  },
915
917
  ],
916
- fees: orderComponents.consideration.length > 1
917
- ? [
918
- {
919
- amount: orderComponents.consideration[1].startAmount,
920
- recipient: orderComponents.consideration[1].recipient,
921
- fee_type: Fee.fee_type.ROYALTY,
922
- },
923
- ]
924
- : [],
918
+ fees: makerFee ? [makerFee] : [],
925
919
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
926
920
  protocol_data: {
927
921
  order_type: CreateOrderProtocolData.order_type.FULL_RESTRICTED,
@@ -988,928 +982,6 @@ function getOrderbookConfig(environment) {
988
982
  }
989
983
  }
990
984
 
991
- class ERC721 {
992
- erc721;
993
- constructor(erc721) {
994
- this.erc721 = erc721;
995
- }
996
- async royaltyInfo(tokenId, salePrice) {
997
- const [recipient, royaltyRequired] = await this.erc721.royaltyInfo(tokenId, salePrice);
998
- return { recipient, amountRequired: royaltyRequired.toString() };
999
- }
1000
- }
1001
-
1002
- /* Autogenerated file. Do not edit manually. */
1003
- /* tslint:disable */
1004
- /* eslint-disable */
1005
- const _abi = [
1006
- {
1007
- inputs: [
1008
- {
1009
- internalType: "address",
1010
- name: "owner_",
1011
- type: "address",
1012
- },
1013
- {
1014
- internalType: "string",
1015
- name: "name_",
1016
- type: "string",
1017
- },
1018
- {
1019
- internalType: "string",
1020
- name: "symbol_",
1021
- type: "string",
1022
- },
1023
- {
1024
- internalType: "string",
1025
- name: "baseURI_",
1026
- type: "string",
1027
- },
1028
- {
1029
- internalType: "string",
1030
- name: "contractURI_",
1031
- type: "string",
1032
- },
1033
- {
1034
- internalType: "address",
1035
- name: "_receiver",
1036
- type: "address",
1037
- },
1038
- {
1039
- internalType: "uint96",
1040
- name: "_feeNumerator",
1041
- type: "uint96",
1042
- },
1043
- ],
1044
- stateMutability: "nonpayable",
1045
- type: "constructor",
1046
- },
1047
- {
1048
- inputs: [
1049
- {
1050
- internalType: "address",
1051
- name: "target",
1052
- type: "address",
1053
- },
1054
- ],
1055
- name: "ApproveTargetNotInAllowlist",
1056
- type: "error",
1057
- },
1058
- {
1059
- inputs: [
1060
- {
1061
- internalType: "address",
1062
- name: "caller",
1063
- type: "address",
1064
- },
1065
- ],
1066
- name: "CallerNotInAllowlist",
1067
- type: "error",
1068
- },
1069
- {
1070
- anonymous: false,
1071
- inputs: [
1072
- {
1073
- indexed: true,
1074
- internalType: "address",
1075
- name: "owner",
1076
- type: "address",
1077
- },
1078
- {
1079
- indexed: true,
1080
- internalType: "address",
1081
- name: "approved",
1082
- type: "address",
1083
- },
1084
- {
1085
- indexed: true,
1086
- internalType: "uint256",
1087
- name: "tokenId",
1088
- type: "uint256",
1089
- },
1090
- ],
1091
- name: "Approval",
1092
- type: "event",
1093
- },
1094
- {
1095
- anonymous: false,
1096
- inputs: [
1097
- {
1098
- indexed: true,
1099
- internalType: "address",
1100
- name: "owner",
1101
- type: "address",
1102
- },
1103
- {
1104
- indexed: true,
1105
- internalType: "address",
1106
- name: "operator",
1107
- type: "address",
1108
- },
1109
- {
1110
- indexed: false,
1111
- internalType: "bool",
1112
- name: "approved",
1113
- type: "bool",
1114
- },
1115
- ],
1116
- name: "ApprovalForAll",
1117
- type: "event",
1118
- },
1119
- {
1120
- anonymous: false,
1121
- inputs: [
1122
- {
1123
- indexed: true,
1124
- internalType: "bytes32",
1125
- name: "role",
1126
- type: "bytes32",
1127
- },
1128
- {
1129
- indexed: true,
1130
- internalType: "bytes32",
1131
- name: "previousAdminRole",
1132
- type: "bytes32",
1133
- },
1134
- {
1135
- indexed: true,
1136
- internalType: "bytes32",
1137
- name: "newAdminRole",
1138
- type: "bytes32",
1139
- },
1140
- ],
1141
- name: "RoleAdminChanged",
1142
- type: "event",
1143
- },
1144
- {
1145
- anonymous: false,
1146
- inputs: [
1147
- {
1148
- indexed: true,
1149
- internalType: "bytes32",
1150
- name: "role",
1151
- type: "bytes32",
1152
- },
1153
- {
1154
- indexed: true,
1155
- internalType: "address",
1156
- name: "account",
1157
- type: "address",
1158
- },
1159
- {
1160
- indexed: true,
1161
- internalType: "address",
1162
- name: "sender",
1163
- type: "address",
1164
- },
1165
- ],
1166
- name: "RoleGranted",
1167
- type: "event",
1168
- },
1169
- {
1170
- anonymous: false,
1171
- inputs: [
1172
- {
1173
- indexed: true,
1174
- internalType: "bytes32",
1175
- name: "role",
1176
- type: "bytes32",
1177
- },
1178
- {
1179
- indexed: true,
1180
- internalType: "address",
1181
- name: "account",
1182
- type: "address",
1183
- },
1184
- {
1185
- indexed: true,
1186
- internalType: "address",
1187
- name: "sender",
1188
- type: "address",
1189
- },
1190
- ],
1191
- name: "RoleRevoked",
1192
- type: "event",
1193
- },
1194
- {
1195
- anonymous: false,
1196
- inputs: [
1197
- {
1198
- indexed: false,
1199
- internalType: "address",
1200
- name: "oldRegistry",
1201
- type: "address",
1202
- },
1203
- {
1204
- indexed: false,
1205
- internalType: "address",
1206
- name: "newRegistry",
1207
- type: "address",
1208
- },
1209
- ],
1210
- name: "RoyaltytAllowlistRegistryUpdated",
1211
- type: "event",
1212
- },
1213
- {
1214
- anonymous: false,
1215
- inputs: [
1216
- {
1217
- indexed: true,
1218
- internalType: "address",
1219
- name: "from",
1220
- type: "address",
1221
- },
1222
- {
1223
- indexed: true,
1224
- internalType: "address",
1225
- name: "to",
1226
- type: "address",
1227
- },
1228
- {
1229
- indexed: true,
1230
- internalType: "uint256",
1231
- name: "tokenId",
1232
- type: "uint256",
1233
- },
1234
- ],
1235
- name: "Transfer",
1236
- type: "event",
1237
- },
1238
- {
1239
- inputs: [],
1240
- name: "DEFAULT_ADMIN_ROLE",
1241
- outputs: [
1242
- {
1243
- internalType: "bytes32",
1244
- name: "",
1245
- type: "bytes32",
1246
- },
1247
- ],
1248
- stateMutability: "view",
1249
- type: "function",
1250
- },
1251
- {
1252
- inputs: [],
1253
- name: "MINTER_ROLE",
1254
- outputs: [
1255
- {
1256
- internalType: "bytes32",
1257
- name: "",
1258
- type: "bytes32",
1259
- },
1260
- ],
1261
- stateMutability: "view",
1262
- type: "function",
1263
- },
1264
- {
1265
- inputs: [
1266
- {
1267
- internalType: "address",
1268
- name: "to",
1269
- type: "address",
1270
- },
1271
- {
1272
- internalType: "uint256",
1273
- name: "tokenId",
1274
- type: "uint256",
1275
- },
1276
- ],
1277
- name: "approve",
1278
- outputs: [],
1279
- stateMutability: "nonpayable",
1280
- type: "function",
1281
- },
1282
- {
1283
- inputs: [
1284
- {
1285
- internalType: "address",
1286
- name: "owner",
1287
- type: "address",
1288
- },
1289
- ],
1290
- name: "balanceOf",
1291
- outputs: [
1292
- {
1293
- internalType: "uint256",
1294
- name: "",
1295
- type: "uint256",
1296
- },
1297
- ],
1298
- stateMutability: "view",
1299
- type: "function",
1300
- },
1301
- {
1302
- inputs: [],
1303
- name: "baseURI",
1304
- outputs: [
1305
- {
1306
- internalType: "string",
1307
- name: "",
1308
- type: "string",
1309
- },
1310
- ],
1311
- stateMutability: "view",
1312
- type: "function",
1313
- },
1314
- {
1315
- inputs: [
1316
- {
1317
- internalType: "uint256",
1318
- name: "tokenId",
1319
- type: "uint256",
1320
- },
1321
- ],
1322
- name: "burn",
1323
- outputs: [],
1324
- stateMutability: "nonpayable",
1325
- type: "function",
1326
- },
1327
- {
1328
- inputs: [],
1329
- name: "contractURI",
1330
- outputs: [
1331
- {
1332
- internalType: "string",
1333
- name: "",
1334
- type: "string",
1335
- },
1336
- ],
1337
- stateMutability: "view",
1338
- type: "function",
1339
- },
1340
- {
1341
- inputs: [],
1342
- name: "getAdmins",
1343
- outputs: [
1344
- {
1345
- internalType: "address[]",
1346
- name: "",
1347
- type: "address[]",
1348
- },
1349
- ],
1350
- stateMutability: "view",
1351
- type: "function",
1352
- },
1353
- {
1354
- inputs: [
1355
- {
1356
- internalType: "uint256",
1357
- name: "tokenId",
1358
- type: "uint256",
1359
- },
1360
- ],
1361
- name: "getApproved",
1362
- outputs: [
1363
- {
1364
- internalType: "address",
1365
- name: "",
1366
- type: "address",
1367
- },
1368
- ],
1369
- stateMutability: "view",
1370
- type: "function",
1371
- },
1372
- {
1373
- inputs: [
1374
- {
1375
- internalType: "bytes32",
1376
- name: "role",
1377
- type: "bytes32",
1378
- },
1379
- ],
1380
- name: "getRoleAdmin",
1381
- outputs: [
1382
- {
1383
- internalType: "bytes32",
1384
- name: "",
1385
- type: "bytes32",
1386
- },
1387
- ],
1388
- stateMutability: "view",
1389
- type: "function",
1390
- },
1391
- {
1392
- inputs: [
1393
- {
1394
- internalType: "bytes32",
1395
- name: "role",
1396
- type: "bytes32",
1397
- },
1398
- {
1399
- internalType: "uint256",
1400
- name: "index",
1401
- type: "uint256",
1402
- },
1403
- ],
1404
- name: "getRoleMember",
1405
- outputs: [
1406
- {
1407
- internalType: "address",
1408
- name: "",
1409
- type: "address",
1410
- },
1411
- ],
1412
- stateMutability: "view",
1413
- type: "function",
1414
- },
1415
- {
1416
- inputs: [
1417
- {
1418
- internalType: "bytes32",
1419
- name: "role",
1420
- type: "bytes32",
1421
- },
1422
- ],
1423
- name: "getRoleMemberCount",
1424
- outputs: [
1425
- {
1426
- internalType: "uint256",
1427
- name: "",
1428
- type: "uint256",
1429
- },
1430
- ],
1431
- stateMutability: "view",
1432
- type: "function",
1433
- },
1434
- {
1435
- inputs: [
1436
- {
1437
- internalType: "address",
1438
- name: "user",
1439
- type: "address",
1440
- },
1441
- ],
1442
- name: "grantMinterRole",
1443
- outputs: [],
1444
- stateMutability: "nonpayable",
1445
- type: "function",
1446
- },
1447
- {
1448
- inputs: [
1449
- {
1450
- internalType: "bytes32",
1451
- name: "role",
1452
- type: "bytes32",
1453
- },
1454
- {
1455
- internalType: "address",
1456
- name: "account",
1457
- type: "address",
1458
- },
1459
- ],
1460
- name: "grantRole",
1461
- outputs: [],
1462
- stateMutability: "nonpayable",
1463
- type: "function",
1464
- },
1465
- {
1466
- inputs: [
1467
- {
1468
- internalType: "bytes32",
1469
- name: "role",
1470
- type: "bytes32",
1471
- },
1472
- {
1473
- internalType: "address",
1474
- name: "account",
1475
- type: "address",
1476
- },
1477
- ],
1478
- name: "hasRole",
1479
- outputs: [
1480
- {
1481
- internalType: "bool",
1482
- name: "",
1483
- type: "bool",
1484
- },
1485
- ],
1486
- stateMutability: "view",
1487
- type: "function",
1488
- },
1489
- {
1490
- inputs: [
1491
- {
1492
- internalType: "address",
1493
- name: "owner",
1494
- type: "address",
1495
- },
1496
- {
1497
- internalType: "address",
1498
- name: "operator",
1499
- type: "address",
1500
- },
1501
- ],
1502
- name: "isApprovedForAll",
1503
- outputs: [
1504
- {
1505
- internalType: "bool",
1506
- name: "",
1507
- type: "bool",
1508
- },
1509
- ],
1510
- stateMutability: "view",
1511
- type: "function",
1512
- },
1513
- {
1514
- inputs: [
1515
- {
1516
- internalType: "address",
1517
- name: "to",
1518
- type: "address",
1519
- },
1520
- {
1521
- internalType: "uint256",
1522
- name: "amount",
1523
- type: "uint256",
1524
- },
1525
- ],
1526
- name: "mint",
1527
- outputs: [],
1528
- stateMutability: "nonpayable",
1529
- type: "function",
1530
- },
1531
- {
1532
- inputs: [],
1533
- name: "name",
1534
- outputs: [
1535
- {
1536
- internalType: "string",
1537
- name: "",
1538
- type: "string",
1539
- },
1540
- ],
1541
- stateMutability: "view",
1542
- type: "function",
1543
- },
1544
- {
1545
- inputs: [
1546
- {
1547
- internalType: "uint256",
1548
- name: "tokenId",
1549
- type: "uint256",
1550
- },
1551
- ],
1552
- name: "ownerOf",
1553
- outputs: [
1554
- {
1555
- internalType: "address",
1556
- name: "",
1557
- type: "address",
1558
- },
1559
- ],
1560
- stateMutability: "view",
1561
- type: "function",
1562
- },
1563
- {
1564
- inputs: [
1565
- {
1566
- internalType: "bytes32",
1567
- name: "role",
1568
- type: "bytes32",
1569
- },
1570
- {
1571
- internalType: "address",
1572
- name: "account",
1573
- type: "address",
1574
- },
1575
- ],
1576
- name: "renounceRole",
1577
- outputs: [],
1578
- stateMutability: "nonpayable",
1579
- type: "function",
1580
- },
1581
- {
1582
- inputs: [
1583
- {
1584
- internalType: "address",
1585
- name: "user",
1586
- type: "address",
1587
- },
1588
- ],
1589
- name: "revokeMinterRole",
1590
- outputs: [],
1591
- stateMutability: "nonpayable",
1592
- type: "function",
1593
- },
1594
- {
1595
- inputs: [
1596
- {
1597
- internalType: "bytes32",
1598
- name: "role",
1599
- type: "bytes32",
1600
- },
1601
- {
1602
- internalType: "address",
1603
- name: "account",
1604
- type: "address",
1605
- },
1606
- ],
1607
- name: "revokeRole",
1608
- outputs: [],
1609
- stateMutability: "nonpayable",
1610
- type: "function",
1611
- },
1612
- {
1613
- inputs: [],
1614
- name: "royaltyAllowlist",
1615
- outputs: [
1616
- {
1617
- internalType: "contract IRoyaltyAllowlist",
1618
- name: "",
1619
- type: "address",
1620
- },
1621
- ],
1622
- stateMutability: "view",
1623
- type: "function",
1624
- },
1625
- {
1626
- inputs: [
1627
- {
1628
- internalType: "uint256",
1629
- name: "_tokenId",
1630
- type: "uint256",
1631
- },
1632
- {
1633
- internalType: "uint256",
1634
- name: "_salePrice",
1635
- type: "uint256",
1636
- },
1637
- ],
1638
- name: "royaltyInfo",
1639
- outputs: [
1640
- {
1641
- internalType: "address",
1642
- name: "",
1643
- type: "address",
1644
- },
1645
- {
1646
- internalType: "uint256",
1647
- name: "",
1648
- type: "uint256",
1649
- },
1650
- ],
1651
- stateMutability: "view",
1652
- type: "function",
1653
- },
1654
- {
1655
- inputs: [
1656
- {
1657
- internalType: "address",
1658
- name: "from",
1659
- type: "address",
1660
- },
1661
- {
1662
- internalType: "address",
1663
- name: "to",
1664
- type: "address",
1665
- },
1666
- {
1667
- internalType: "uint256",
1668
- name: "tokenId",
1669
- type: "uint256",
1670
- },
1671
- ],
1672
- name: "safeTransferFrom",
1673
- outputs: [],
1674
- stateMutability: "nonpayable",
1675
- type: "function",
1676
- },
1677
- {
1678
- inputs: [
1679
- {
1680
- internalType: "address",
1681
- name: "from",
1682
- type: "address",
1683
- },
1684
- {
1685
- internalType: "address",
1686
- name: "to",
1687
- type: "address",
1688
- },
1689
- {
1690
- internalType: "uint256",
1691
- name: "tokenId",
1692
- type: "uint256",
1693
- },
1694
- {
1695
- internalType: "bytes",
1696
- name: "data",
1697
- type: "bytes",
1698
- },
1699
- ],
1700
- name: "safeTransferFrom",
1701
- outputs: [],
1702
- stateMutability: "nonpayable",
1703
- type: "function",
1704
- },
1705
- {
1706
- inputs: [
1707
- {
1708
- internalType: "address",
1709
- name: "operator",
1710
- type: "address",
1711
- },
1712
- {
1713
- internalType: "bool",
1714
- name: "approved",
1715
- type: "bool",
1716
- },
1717
- ],
1718
- name: "setApprovalForAll",
1719
- outputs: [],
1720
- stateMutability: "nonpayable",
1721
- type: "function",
1722
- },
1723
- {
1724
- inputs: [
1725
- {
1726
- internalType: "string",
1727
- name: "baseURI_",
1728
- type: "string",
1729
- },
1730
- ],
1731
- name: "setBaseURI",
1732
- outputs: [],
1733
- stateMutability: "nonpayable",
1734
- type: "function",
1735
- },
1736
- {
1737
- inputs: [
1738
- {
1739
- internalType: "string",
1740
- name: "_contractURI",
1741
- type: "string",
1742
- },
1743
- ],
1744
- name: "setContractURI",
1745
- outputs: [],
1746
- stateMutability: "nonpayable",
1747
- type: "function",
1748
- },
1749
- {
1750
- inputs: [
1751
- {
1752
- internalType: "address",
1753
- name: "_royaltyAllowlist",
1754
- type: "address",
1755
- },
1756
- ],
1757
- name: "setRoyaltyAllowlistRegistry",
1758
- outputs: [],
1759
- stateMutability: "nonpayable",
1760
- type: "function",
1761
- },
1762
- {
1763
- inputs: [
1764
- {
1765
- internalType: "bytes4",
1766
- name: "interfaceId",
1767
- type: "bytes4",
1768
- },
1769
- ],
1770
- name: "supportsInterface",
1771
- outputs: [
1772
- {
1773
- internalType: "bool",
1774
- name: "",
1775
- type: "bool",
1776
- },
1777
- ],
1778
- stateMutability: "view",
1779
- type: "function",
1780
- },
1781
- {
1782
- inputs: [],
1783
- name: "symbol",
1784
- outputs: [
1785
- {
1786
- internalType: "string",
1787
- name: "",
1788
- type: "string",
1789
- },
1790
- ],
1791
- stateMutability: "view",
1792
- type: "function",
1793
- },
1794
- {
1795
- inputs: [
1796
- {
1797
- internalType: "uint256",
1798
- name: "index",
1799
- type: "uint256",
1800
- },
1801
- ],
1802
- name: "tokenByIndex",
1803
- outputs: [
1804
- {
1805
- internalType: "uint256",
1806
- name: "",
1807
- type: "uint256",
1808
- },
1809
- ],
1810
- stateMutability: "view",
1811
- type: "function",
1812
- },
1813
- {
1814
- inputs: [
1815
- {
1816
- internalType: "address",
1817
- name: "owner",
1818
- type: "address",
1819
- },
1820
- {
1821
- internalType: "uint256",
1822
- name: "index",
1823
- type: "uint256",
1824
- },
1825
- ],
1826
- name: "tokenOfOwnerByIndex",
1827
- outputs: [
1828
- {
1829
- internalType: "uint256",
1830
- name: "",
1831
- type: "uint256",
1832
- },
1833
- ],
1834
- stateMutability: "view",
1835
- type: "function",
1836
- },
1837
- {
1838
- inputs: [
1839
- {
1840
- internalType: "uint256",
1841
- name: "tokenId",
1842
- type: "uint256",
1843
- },
1844
- ],
1845
- name: "tokenURI",
1846
- outputs: [
1847
- {
1848
- internalType: "string",
1849
- name: "",
1850
- type: "string",
1851
- },
1852
- ],
1853
- stateMutability: "view",
1854
- type: "function",
1855
- },
1856
- {
1857
- inputs: [],
1858
- name: "totalSupply",
1859
- outputs: [
1860
- {
1861
- internalType: "uint256",
1862
- name: "",
1863
- type: "uint256",
1864
- },
1865
- ],
1866
- stateMutability: "view",
1867
- type: "function",
1868
- },
1869
- {
1870
- inputs: [
1871
- {
1872
- internalType: "address",
1873
- name: "from",
1874
- type: "address",
1875
- },
1876
- {
1877
- internalType: "address",
1878
- name: "to",
1879
- type: "address",
1880
- },
1881
- {
1882
- internalType: "uint256",
1883
- name: "tokenId",
1884
- type: "uint256",
1885
- },
1886
- ],
1887
- name: "transferFrom",
1888
- outputs: [],
1889
- stateMutability: "nonpayable",
1890
- type: "function",
1891
- },
1892
- ];
1893
- class ImmutableERC721Base__factory {
1894
- static abi = _abi;
1895
- static createInterface() {
1896
- return new utils.Interface(_abi);
1897
- }
1898
- static connect(address, signerOrProvider) {
1899
- return new Contract(address, _abi, signerOrProvider);
1900
- }
1901
- }
1902
-
1903
- class ERC721Factory {
1904
- erc721;
1905
- constructor(contractAddress, provider) {
1906
- this.erc721 = ImmutableERC721Base__factory.connect(contractAddress, provider);
1907
- }
1908
- create() {
1909
- return new ERC721(this.erc721);
1910
- }
1911
- }
1912
-
1913
985
  class SeaportLibFactory {
1914
986
  defaultSeaportContractAddress;
1915
987
  provider;
@@ -1975,8 +1047,8 @@ class Orderbook {
1975
1047
  /**
1976
1048
  * List orders. This method is used to get a list of orders filtered by conditions specified
1977
1049
  * in the params object.
1978
- * @param {ListOrderParams} listOrderParams - Filtering, ordering and page parameters.
1979
- * @return {Orders} The paged orders.
1050
+ * @param {ListListingsParams} listOrderParams - Filtering, ordering and page parameters.
1051
+ * @return {ListListingsResult} The paged orders.
1980
1052
  */
1981
1053
  listListings(listOrderParams) {
1982
1054
  return this.apiClient.listListings(listOrderParams);
@@ -1990,9 +1062,7 @@ class Orderbook {
1990
1062
  * the order components that can be submitted to `createListing` with a signature.
1991
1063
  */
1992
1064
  async prepareListing({ makerAddress, sell, buy, orderExpiry, }) {
1993
- const erc721 = new ERC721Factory(sell.contractAddress, this.orderbookConfig.provider).create();
1994
- const royaltyInfo = await erc721.royaltyInfo(sell.tokenId, buy.amount);
1995
- return this.seaport.prepareSeaportOrder(makerAddress, sell, buy, royaltyInfo,
1065
+ return this.seaport.prepareSeaportOrder(makerAddress, sell, buy,
1996
1066
  // Default order start to now
1997
1067
  new Date(),
1998
1068
  // Default order expiry to 2 years from now
@@ -2014,12 +1084,13 @@ class Orderbook {
2014
1084
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
2015
1085
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
2016
1086
  */
2017
- async fulfillOrder(listingId, takerAddress) {
2018
- const fulfillmentDataRes = await this.apiClient.fulfillmentData([{
1087
+ async fulfillOrder(listingId, takerAddress, takerFee) {
1088
+ const fulfillmentDataRes = await this.apiClient.fulfillmentData([
1089
+ {
2019
1090
  order_id: listingId,
2020
- // fee: takerFee,
2021
- fee: undefined,
2022
- }]);
1091
+ fee: takerFee,
1092
+ },
1093
+ ]);
2023
1094
  if (fulfillmentDataRes.result.length !== 1) {
2024
1095
  throw new Error('unexpected fulfillment data result length');
2025
1096
  }