@imtbl/sdk 0.27.15-alpha.6 → 0.28.0-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/sdk.js +35 -0
- package/dist/browser/checkout/widgets.js +890 -0
- package/dist/checkout_sdk.d.ts +8497 -7946
- package/dist/checkout_sdk.js +2961 -2695
- package/dist/immutablex_client.js +4 -4
- package/dist/index.browser.js +9 -18
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +3013 -3226
- package/dist/index.d.ts +1036 -15490
- package/dist/index.js +3015 -3227
- package/dist/orderbook.d.ts +65 -109
- package/dist/orderbook.js +20 -101
- package/dist/passport.js +17 -39
- package/package.json +17 -6
- package/dist/browser/checkout.js +0 -2
- package/dist/checkout_widgets.d.ts +0 -25860
- package/dist/checkout_widgets.js +0 -449
package/dist/orderbook.d.ts
CHANGED
|
@@ -595,6 +595,53 @@ interface OrderbookModuleConfiguration {
|
|
|
595
595
|
provider: JsonRpcProvider | Web3Provider;
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
+
declare enum OrderType {
|
|
599
|
+
FULL_OPEN = 0,
|
|
600
|
+
PARTIAL_OPEN = 1,
|
|
601
|
+
FULL_RESTRICTED = 2,
|
|
602
|
+
PARTIAL_RESTRICTED = 3
|
|
603
|
+
}
|
|
604
|
+
declare enum ItemType {
|
|
605
|
+
NATIVE = 0,
|
|
606
|
+
ERC20 = 1,
|
|
607
|
+
ERC721 = 2,
|
|
608
|
+
ERC1155 = 3,
|
|
609
|
+
ERC721_WITH_CRITERIA = 4,
|
|
610
|
+
ERC1155_WITH_CRITERIA = 5
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
type OfferItem = {
|
|
614
|
+
itemType: ItemType;
|
|
615
|
+
token: string;
|
|
616
|
+
identifierOrCriteria: string;
|
|
617
|
+
startAmount: string;
|
|
618
|
+
endAmount: string;
|
|
619
|
+
};
|
|
620
|
+
type ConsiderationItem = {
|
|
621
|
+
itemType: ItemType;
|
|
622
|
+
token: string;
|
|
623
|
+
identifierOrCriteria: string;
|
|
624
|
+
startAmount: string;
|
|
625
|
+
endAmount: string;
|
|
626
|
+
recipient: string;
|
|
627
|
+
};
|
|
628
|
+
type OrderParameters = {
|
|
629
|
+
offerer: string;
|
|
630
|
+
zone: string;
|
|
631
|
+
orderType: OrderType;
|
|
632
|
+
startTime: BigNumberish;
|
|
633
|
+
endTime: BigNumberish;
|
|
634
|
+
zoneHash: string;
|
|
635
|
+
salt: string;
|
|
636
|
+
offer: OfferItem[];
|
|
637
|
+
consideration: ConsiderationItem[];
|
|
638
|
+
totalOriginalConsiderationItems: BigNumberish;
|
|
639
|
+
conduitKey: string;
|
|
640
|
+
};
|
|
641
|
+
type OrderComponents = OrderParameters & {
|
|
642
|
+
counter: BigNumberish;
|
|
643
|
+
};
|
|
644
|
+
|
|
598
645
|
type ApiRequestOptions = {
|
|
599
646
|
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
600
647
|
readonly url: string;
|
|
@@ -682,7 +729,7 @@ declare namespace FailedOrderCancellation {
|
|
|
682
729
|
* Reason code indicating why the order failed to be cancelled
|
|
683
730
|
*/
|
|
684
731
|
enum reason_code {
|
|
685
|
-
|
|
732
|
+
ALREADY_FILLED = "ALREADY_FILLED"
|
|
686
733
|
}
|
|
687
734
|
}
|
|
688
735
|
|
|
@@ -860,20 +907,20 @@ type Chain = {
|
|
|
860
907
|
|
|
861
908
|
type ActiveOrderStatus = {
|
|
862
909
|
/**
|
|
863
|
-
* The order status
|
|
910
|
+
* The order status
|
|
864
911
|
*/
|
|
865
912
|
name: 'ACTIVE';
|
|
866
913
|
};
|
|
867
914
|
|
|
868
915
|
type CancelledOrderStatus = {
|
|
869
916
|
/**
|
|
870
|
-
* The order status
|
|
917
|
+
* The order status
|
|
871
918
|
*/
|
|
872
919
|
name: 'CANCELLED';
|
|
873
920
|
/**
|
|
874
921
|
* Whether the cancellation of the order is pending
|
|
875
922
|
*/
|
|
876
|
-
|
|
923
|
+
is_pending: boolean;
|
|
877
924
|
/**
|
|
878
925
|
* Whether the cancellation was done on-chain or off-chain
|
|
879
926
|
*/
|
|
@@ -891,46 +938,30 @@ declare namespace CancelledOrderStatus {
|
|
|
891
938
|
|
|
892
939
|
type ExpiredOrderStatus = {
|
|
893
940
|
/**
|
|
894
|
-
*
|
|
941
|
+
* The order status
|
|
895
942
|
*/
|
|
896
943
|
name: 'EXPIRED';
|
|
897
944
|
};
|
|
898
945
|
|
|
899
946
|
type FilledOrderStatus = {
|
|
900
947
|
/**
|
|
901
|
-
*
|
|
948
|
+
* The order status
|
|
902
949
|
*/
|
|
903
950
|
name: 'FILLED';
|
|
904
951
|
};
|
|
905
952
|
|
|
906
953
|
type InactiveOrderStatus = {
|
|
907
954
|
/**
|
|
908
|
-
* The order status
|
|
955
|
+
* The order status
|
|
909
956
|
*/
|
|
910
957
|
name: 'INACTIVE';
|
|
911
|
-
/**
|
|
912
|
-
* Whether the order offerer has sufficient approvals
|
|
913
|
-
*/
|
|
914
|
-
sufficient_approvals: boolean;
|
|
915
|
-
/**
|
|
916
|
-
* Whether the order offerer still has sufficient balance to complete the order
|
|
917
|
-
*/
|
|
918
|
-
sufficient_balances: boolean;
|
|
919
958
|
};
|
|
920
959
|
|
|
921
960
|
type PendingOrderStatus = {
|
|
922
961
|
/**
|
|
923
|
-
* The order status
|
|
962
|
+
* The order status
|
|
924
963
|
*/
|
|
925
964
|
name: 'PENDING';
|
|
926
|
-
/**
|
|
927
|
-
* Whether the order has been evaluated after its creation
|
|
928
|
-
*/
|
|
929
|
-
evaluated: boolean;
|
|
930
|
-
/**
|
|
931
|
-
* Whether the order has reached its specified start time
|
|
932
|
-
*/
|
|
933
|
-
started: boolean;
|
|
934
965
|
};
|
|
935
966
|
|
|
936
967
|
/**
|
|
@@ -1235,53 +1266,6 @@ declare class OrdersService {
|
|
|
1235
1266
|
}): CancelablePromise<TradeResult$1>;
|
|
1236
1267
|
}
|
|
1237
1268
|
|
|
1238
|
-
declare enum OrderType {
|
|
1239
|
-
FULL_OPEN = 0,
|
|
1240
|
-
PARTIAL_OPEN = 1,
|
|
1241
|
-
FULL_RESTRICTED = 2,
|
|
1242
|
-
PARTIAL_RESTRICTED = 3
|
|
1243
|
-
}
|
|
1244
|
-
declare enum ItemType {
|
|
1245
|
-
NATIVE = 0,
|
|
1246
|
-
ERC20 = 1,
|
|
1247
|
-
ERC721 = 2,
|
|
1248
|
-
ERC1155 = 3,
|
|
1249
|
-
ERC721_WITH_CRITERIA = 4,
|
|
1250
|
-
ERC1155_WITH_CRITERIA = 5
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
type OfferItem = {
|
|
1254
|
-
itemType: ItemType;
|
|
1255
|
-
token: string;
|
|
1256
|
-
identifierOrCriteria: string;
|
|
1257
|
-
startAmount: string;
|
|
1258
|
-
endAmount: string;
|
|
1259
|
-
};
|
|
1260
|
-
type ConsiderationItem = {
|
|
1261
|
-
itemType: ItemType;
|
|
1262
|
-
token: string;
|
|
1263
|
-
identifierOrCriteria: string;
|
|
1264
|
-
startAmount: string;
|
|
1265
|
-
endAmount: string;
|
|
1266
|
-
recipient: string;
|
|
1267
|
-
};
|
|
1268
|
-
type OrderParameters = {
|
|
1269
|
-
offerer: string;
|
|
1270
|
-
zone: string;
|
|
1271
|
-
orderType: OrderType;
|
|
1272
|
-
startTime: BigNumberish;
|
|
1273
|
-
endTime: BigNumberish;
|
|
1274
|
-
zoneHash: string;
|
|
1275
|
-
salt: string;
|
|
1276
|
-
offer: OfferItem[];
|
|
1277
|
-
consideration: ConsiderationItem[];
|
|
1278
|
-
totalOriginalConsiderationItems: BigNumberish;
|
|
1279
|
-
conduitKey: string;
|
|
1280
|
-
};
|
|
1281
|
-
type OrderComponents = OrderParameters & {
|
|
1282
|
-
counter: BigNumberish;
|
|
1283
|
-
};
|
|
1284
|
-
|
|
1285
1269
|
interface ERC721Item {
|
|
1286
1270
|
type: 'ERC721';
|
|
1287
1271
|
contractAddress: string;
|
|
@@ -1311,9 +1295,6 @@ interface PrepareListingResponse {
|
|
|
1311
1295
|
orderComponents: OrderComponents;
|
|
1312
1296
|
orderHash: string;
|
|
1313
1297
|
}
|
|
1314
|
-
interface PrepareCancelOrdersResponse {
|
|
1315
|
-
signableAction: SignableAction;
|
|
1316
|
-
}
|
|
1317
1298
|
interface CreateListingParams {
|
|
1318
1299
|
orderComponents: OrderComponents;
|
|
1319
1300
|
orderHash: string;
|
|
@@ -1337,12 +1318,10 @@ interface Fee extends FeeValue {
|
|
|
1337
1318
|
}
|
|
1338
1319
|
declare enum TransactionPurpose {
|
|
1339
1320
|
APPROVAL = "APPROVAL",
|
|
1340
|
-
FULFILL_ORDER = "FULFILL_ORDER"
|
|
1341
|
-
CANCEL = "CANCEL"
|
|
1321
|
+
FULFILL_ORDER = "FULFILL_ORDER"
|
|
1342
1322
|
}
|
|
1343
1323
|
declare enum SignablePurpose {
|
|
1344
|
-
CREATE_LISTING = "CREATE_LISTING"
|
|
1345
|
-
OFF_CHAIN_CANCELLATION = "OFF_CHAIN_CANCELLATION"
|
|
1324
|
+
CREATE_LISTING = "CREATE_LISTING"
|
|
1346
1325
|
}
|
|
1347
1326
|
declare enum ActionType {
|
|
1348
1327
|
TRANSACTION = "TRANSACTION",
|
|
@@ -1394,8 +1373,8 @@ interface FulfillOrderResponse {
|
|
|
1394
1373
|
expiration: string;
|
|
1395
1374
|
order: Order;
|
|
1396
1375
|
}
|
|
1397
|
-
interface
|
|
1398
|
-
|
|
1376
|
+
interface CancelOrderResponse {
|
|
1377
|
+
unsignedCancelOrderTransaction: PopulatedTransaction;
|
|
1399
1378
|
}
|
|
1400
1379
|
interface Order {
|
|
1401
1380
|
id: string;
|
|
@@ -1557,40 +1536,17 @@ declare class Orderbook {
|
|
|
1557
1536
|
fulfillOrder(listingId: string, takerAddress: string, takerFees: FeeValue[]): Promise<FulfillOrderResponse>;
|
|
1558
1537
|
fulfillBulkOrders(listings: Array<FulfillmentListing>, takerAddress: string): Promise<FulfillBulkOrdersResponse>;
|
|
1559
1538
|
/**
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
* @param {string} orderIds - The orderIds to attempt to cancel.
|
|
1564
|
-
* @return {PrepareCancelOrdersResponse} The signable action to cancel the orders.
|
|
1565
|
-
*/
|
|
1566
|
-
prepareOrderCancellations(orderIds: string[]): Promise<PrepareCancelOrdersResponse>;
|
|
1567
|
-
/**
|
|
1568
|
-
* Cancelling orders is a gasless alternative to on-chain cancellation exposed with
|
|
1569
|
-
* `cancelOrdersOnChain`. Orders cancelled this way cannot be fulfilled and will be removed
|
|
1570
|
-
* from the orderbook. If there is pending fulfillment data outstanding for the order, its
|
|
1571
|
-
* cancellation will be pending until the fulfillment window has passed.
|
|
1572
|
-
* `prepareOffchainOrderCancellations` can be used to get the signable action that is signed
|
|
1573
|
-
* to get the signature required for this call.
|
|
1574
|
-
* @param {string[]} orderIds - The orderIds to attempt to cancel.
|
|
1575
|
-
* @param {string} accountAddress - The address of the account cancelling the orders.
|
|
1576
|
-
* @param {string} accountAddress - The address of the account cancelling the orders.
|
|
1577
|
-
* @return {CancelOrdersResult} The result of the off-chain cancellation request
|
|
1578
|
-
*/
|
|
1579
|
-
cancelOrders(orderIds: string[], accountAddress: string, signature: string): Promise<CancelOrdersResult>;
|
|
1580
|
-
/**
|
|
1581
|
-
* Get an unsigned order cancellation transaction. Orders can only be cancelled by
|
|
1582
|
-
* the account that created them. All of the orders must be from the same seaport contract.
|
|
1583
|
-
* If trying to cancel orders from multiple seaport contracts, group the orderIds by seaport
|
|
1584
|
-
* contract and call this method for each group.
|
|
1585
|
-
* @param {string[]} orderIds - The orderIds to cancel.
|
|
1539
|
+
* Get an unsigned cancel order transaction. Orders can only be cancelled by
|
|
1540
|
+
* the account that created them.
|
|
1541
|
+
* @param {string} listingId - The listingId to cancel.
|
|
1586
1542
|
* @param {string} accountAddress - The address of the account cancelling the order.
|
|
1587
|
-
* @return {
|
|
1543
|
+
* @return {CancelOrderResponse} The unsigned cancel order transaction
|
|
1588
1544
|
*/
|
|
1589
|
-
|
|
1545
|
+
cancelOrder(listingId: string, accountAddress: string): Promise<CancelOrderResponse>;
|
|
1590
1546
|
}
|
|
1591
1547
|
|
|
1592
1548
|
declare const constants: {
|
|
1593
1549
|
estimatedFulfillmentGasGwei: number;
|
|
1594
1550
|
};
|
|
1595
1551
|
|
|
1596
|
-
export { Action, ActionType,
|
|
1552
|
+
export { Action, ActionType, CancelOrderResponse, CreateListingParams, ERC20Item, ERC721Item, Fee, FeeType, FeeValue, FulfillBulkOrdersInsufficientBalanceResponse, FulfillBulkOrdersResponse, FulfillBulkOrdersSufficientBalanceResponse, FulfillOrderResponse, FulfillmentListing, ListListingsParams, ListListingsResult, ListTradesParams, ListTradesResult, ListingResult, NativeItem, Order, OrderStatusName, Orderbook, Page, PrepareListingParams, PrepareListingResponse, RoyaltyInfo, SignableAction, SignablePurpose, Trade, TradeResult, TransactionAction, TransactionBuilder, TransactionPurpose, UnfulfillableOrder, constants };
|
package/dist/orderbook.js
CHANGED
|
@@ -606,7 +606,7 @@ var CancelledOrderStatus;
|
|
|
606
606
|
var FailedOrderCancellation;
|
|
607
607
|
(function (FailedOrderCancellation) {
|
|
608
608
|
(function (reason_code) {
|
|
609
|
-
reason_code["
|
|
609
|
+
reason_code["ALREADY_FILLED"] = "ALREADY_FILLED";
|
|
610
610
|
})(FailedOrderCancellation.reason_code || (FailedOrderCancellation.reason_code = {}));
|
|
611
611
|
})(FailedOrderCancellation || (FailedOrderCancellation = {}));
|
|
612
612
|
|
|
@@ -660,12 +660,10 @@ var TransactionPurpose;
|
|
|
660
660
|
(function (TransactionPurpose) {
|
|
661
661
|
TransactionPurpose["APPROVAL"] = "APPROVAL";
|
|
662
662
|
TransactionPurpose["FULFILL_ORDER"] = "FULFILL_ORDER";
|
|
663
|
-
TransactionPurpose["CANCEL"] = "CANCEL";
|
|
664
663
|
})(TransactionPurpose || (TransactionPurpose = {}));
|
|
665
664
|
var SignablePurpose;
|
|
666
665
|
(function (SignablePurpose) {
|
|
667
666
|
SignablePurpose["CREATE_LISTING"] = "CREATE_LISTING";
|
|
668
|
-
SignablePurpose["OFF_CHAIN_CANCELLATION"] = "OFF_CHAIN_CANCELLATION";
|
|
669
667
|
})(SignablePurpose || (SignablePurpose = {}));
|
|
670
668
|
var ActionType;
|
|
671
669
|
(function (ActionType) {
|
|
@@ -1062,15 +1060,11 @@ class Seaport {
|
|
|
1062
1060
|
.reduce((p, c) => (new Date(p) < new Date(c) ? p : c)),
|
|
1063
1061
|
};
|
|
1064
1062
|
}
|
|
1065
|
-
async
|
|
1066
|
-
const orderComponents =
|
|
1067
|
-
const seaportLib = this.getSeaportLib(
|
|
1068
|
-
const cancellationTransaction = await seaportLib.cancelOrders(orderComponents, account);
|
|
1069
|
-
return
|
|
1070
|
-
type: ActionType.TRANSACTION,
|
|
1071
|
-
buildTransaction: prepareTransaction(cancellationTransaction),
|
|
1072
|
-
purpose: TransactionPurpose.CANCEL,
|
|
1073
|
-
};
|
|
1063
|
+
async cancelOrder(order, account) {
|
|
1064
|
+
const { orderComponents } = this.mapImmutableOrderToSeaportOrderComponents(order);
|
|
1065
|
+
const seaportLib = this.getSeaportLib(order);
|
|
1066
|
+
const cancellationTransaction = await seaportLib.cancelOrders([orderComponents], account);
|
|
1067
|
+
return prepareTransaction(cancellationTransaction)();
|
|
1074
1068
|
}
|
|
1075
1069
|
mapImmutableOrderToSeaportOrderComponents(order) {
|
|
1076
1070
|
const orderCounter = order.protocol_data.counter;
|
|
@@ -1172,16 +1166,6 @@ class ImmutableApiClient {
|
|
|
1172
1166
|
...listTradesParams,
|
|
1173
1167
|
});
|
|
1174
1168
|
}
|
|
1175
|
-
async cancelOrders(orderIds, accountAddress, signature) {
|
|
1176
|
-
return this.orderbookService.cancelOrders({
|
|
1177
|
-
chainName: this.chainName,
|
|
1178
|
-
requestBody: {
|
|
1179
|
-
account_address: accountAddress,
|
|
1180
|
-
orders: orderIds,
|
|
1181
|
-
signature,
|
|
1182
|
-
},
|
|
1183
|
-
});
|
|
1184
|
-
}
|
|
1185
1169
|
async createListing({ orderHash, orderComponents, orderSignature, makerFees, }) {
|
|
1186
1170
|
if (orderComponents.offer.length !== 1) {
|
|
1187
1171
|
throw new Error('Only one item can be listed at a time');
|
|
@@ -1483,89 +1467,24 @@ class Orderbook {
|
|
|
1483
1467
|
}
|
|
1484
1468
|
}
|
|
1485
1469
|
/**
|
|
1486
|
-
*
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1489
|
-
* @param {string} orderIds - The orderIds to attempt to cancel.
|
|
1490
|
-
* @return {PrepareCancelOrdersResponse} The signable action to cancel the orders.
|
|
1491
|
-
*/
|
|
1492
|
-
async prepareOrderCancellations(orderIds) {
|
|
1493
|
-
const network = await this.orderbookConfig.provider.getNetwork();
|
|
1494
|
-
const domain = {
|
|
1495
|
-
name: 'imtbl-order-book',
|
|
1496
|
-
chainId: network.chainId,
|
|
1497
|
-
verifyingContract: this.orderbookConfig.seaportContractAddress,
|
|
1498
|
-
};
|
|
1499
|
-
const types = {
|
|
1500
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1501
|
-
CancelPayload: [
|
|
1502
|
-
{ name: 'orders', type: 'Order[]' },
|
|
1503
|
-
],
|
|
1504
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1505
|
-
Order: [
|
|
1506
|
-
{ name: 'id', type: 'string' },
|
|
1507
|
-
],
|
|
1508
|
-
};
|
|
1509
|
-
const cancelMessage = {
|
|
1510
|
-
orders: orderIds.map((id) => ({ id })),
|
|
1511
|
-
};
|
|
1512
|
-
return {
|
|
1513
|
-
signableAction: {
|
|
1514
|
-
purpose: SignablePurpose.OFF_CHAIN_CANCELLATION,
|
|
1515
|
-
type: ActionType.SIGNABLE,
|
|
1516
|
-
message: {
|
|
1517
|
-
domain,
|
|
1518
|
-
types,
|
|
1519
|
-
value: cancelMessage,
|
|
1520
|
-
},
|
|
1521
|
-
},
|
|
1522
|
-
};
|
|
1523
|
-
}
|
|
1524
|
-
/**
|
|
1525
|
-
* Cancelling orders is a gasless alternative to on-chain cancellation exposed with
|
|
1526
|
-
* `cancelOrdersOnChain`. Orders cancelled this way cannot be fulfilled and will be removed
|
|
1527
|
-
* from the orderbook. If there is pending fulfillment data outstanding for the order, its
|
|
1528
|
-
* cancellation will be pending until the fulfillment window has passed.
|
|
1529
|
-
* `prepareOffchainOrderCancellations` can be used to get the signable action that is signed
|
|
1530
|
-
* to get the signature required for this call.
|
|
1531
|
-
* @param {string[]} orderIds - The orderIds to attempt to cancel.
|
|
1532
|
-
* @param {string} accountAddress - The address of the account cancelling the orders.
|
|
1533
|
-
* @param {string} accountAddress - The address of the account cancelling the orders.
|
|
1534
|
-
* @return {CancelOrdersResult} The result of the off-chain cancellation request
|
|
1535
|
-
*/
|
|
1536
|
-
async cancelOrders(orderIds, accountAddress, signature) {
|
|
1537
|
-
return this.apiClient.cancelOrders(orderIds, accountAddress, signature);
|
|
1538
|
-
}
|
|
1539
|
-
/**
|
|
1540
|
-
* Get an unsigned order cancellation transaction. Orders can only be cancelled by
|
|
1541
|
-
* the account that created them. All of the orders must be from the same seaport contract.
|
|
1542
|
-
* If trying to cancel orders from multiple seaport contracts, group the orderIds by seaport
|
|
1543
|
-
* contract and call this method for each group.
|
|
1544
|
-
* @param {string[]} orderIds - The orderIds to cancel.
|
|
1470
|
+
* Get an unsigned cancel order transaction. Orders can only be cancelled by
|
|
1471
|
+
* the account that created them.
|
|
1472
|
+
* @param {string} listingId - The listingId to cancel.
|
|
1545
1473
|
* @param {string} accountAddress - The address of the account cancelling the order.
|
|
1546
|
-
* @return {
|
|
1474
|
+
* @return {CancelOrderResponse} The unsigned cancel order transaction
|
|
1547
1475
|
*/
|
|
1548
|
-
async
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
&& orderResult.result.status.name !== OrderStatusName.PENDING) {
|
|
1555
|
-
throw new Error(`Cannot cancel order with status ${orderResult.result.status}`);
|
|
1556
|
-
}
|
|
1557
|
-
if (orderResult.result.account_address !== accountAddress.toLowerCase()) {
|
|
1558
|
-
throw new Error(`Only account ${orderResult.result.account_address} can cancel order ${orderResult.result.id}`);
|
|
1559
|
-
}
|
|
1476
|
+
async cancelOrder(listingId, accountAddress) {
|
|
1477
|
+
const orderResult = await this.apiClient.getListing(listingId);
|
|
1478
|
+
if (orderResult.result.status.name !== OrderStatusName.ACTIVE
|
|
1479
|
+
&& orderResult.result.status.name !== OrderStatusName.INACTIVE
|
|
1480
|
+
&& orderResult.result.status.name !== OrderStatusName.PENDING) {
|
|
1481
|
+
throw new Error(`Cannot cancel order with status ${orderResult.result.status}`);
|
|
1560
1482
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
const distinctSeaportAddresses = new Set(...[seaportAddresses]);
|
|
1564
|
-
if (distinctSeaportAddresses.size !== 1) {
|
|
1565
|
-
throw new Error('Cannot cancel multiple orders from different seaport contracts. Please group your orderIds accordingly');
|
|
1483
|
+
if (orderResult.result.account_address !== accountAddress.toLowerCase()) {
|
|
1484
|
+
throw new Error(`Only account ${orderResult.result.account_address} can cancel order ${listingId}`);
|
|
1566
1485
|
}
|
|
1567
|
-
const
|
|
1568
|
-
return {
|
|
1486
|
+
const cancelOrderTransaction = await this.seaport.cancelOrder(orderResult.result, accountAddress);
|
|
1487
|
+
return { unsignedCancelOrderTransaction: cancelOrderTransaction };
|
|
1569
1488
|
}
|
|
1570
1489
|
}
|
|
1571
1490
|
|
package/dist/passport.js
CHANGED
|
@@ -2072,7 +2072,7 @@ class MultiRollupApiClients {
|
|
|
2072
2072
|
}
|
|
2073
2073
|
|
|
2074
2074
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2075
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
2075
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.28.0-alpha.1' };
|
|
2076
2076
|
const createConfig = ({ basePath, headers, }) => {
|
|
2077
2077
|
if (!basePath.trim()) {
|
|
2078
2078
|
throw Error('basePath can not be empty');
|
|
@@ -2128,7 +2128,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2128
2128
|
chainID,
|
|
2129
2129
|
coreContractAddress,
|
|
2130
2130
|
registrationContractAddress,
|
|
2131
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
2131
|
+
sdkVersion: 'ts-immutable-sdk-0.28.0-alpha.1',
|
|
2132
2132
|
});
|
|
2133
2133
|
/**
|
|
2134
2134
|
* Sets `sdkVersion` at the time of build
|
|
@@ -2144,9 +2144,9 @@ const production = () => createImmutableXConfiguration({
|
|
|
2144
2144
|
*/
|
|
2145
2145
|
const sandbox = () => createImmutableXConfiguration({
|
|
2146
2146
|
basePath: 'https://api.sandbox.x.immutable.com',
|
|
2147
|
-
chainID:
|
|
2148
|
-
coreContractAddress: '
|
|
2149
|
-
registrationContractAddress: '
|
|
2147
|
+
chainID: 5,
|
|
2148
|
+
coreContractAddress: '0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623',
|
|
2149
|
+
registrationContractAddress: '0x1C97Ada273C9A52253f463042f29117090Cd7D83',
|
|
2150
2150
|
});
|
|
2151
2151
|
class ImxConfiguration {
|
|
2152
2152
|
immutableXConfig;
|
|
@@ -7061,7 +7061,7 @@ class MagicAdapter {
|
|
|
7061
7061
|
magicClient;
|
|
7062
7062
|
constructor(config) {
|
|
7063
7063
|
this.config = config;
|
|
7064
|
-
if (
|
|
7064
|
+
if (window) {
|
|
7065
7065
|
this.magicClient = this.initMagicClient();
|
|
7066
7066
|
this.magicClient.preload();
|
|
7067
7067
|
}
|
|
@@ -7297,7 +7297,7 @@ class GuardianClient {
|
|
|
7297
7297
|
throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, transactionRejectedCrossSdkBridgeError);
|
|
7298
7298
|
}
|
|
7299
7299
|
if (confirmationRequired && !!messageId) {
|
|
7300
|
-
const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId
|
|
7300
|
+
const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId);
|
|
7301
7301
|
if (!confirmationResult.confirmed) {
|
|
7302
7302
|
throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, 'Signature rejected by user');
|
|
7303
7303
|
}
|
|
@@ -7972,19 +7972,7 @@ class ConfirmationScreen {
|
|
|
7972
7972
|
constructor(config) {
|
|
7973
7973
|
this.config = config;
|
|
7974
7974
|
}
|
|
7975
|
-
|
|
7976
|
-
let href = `${this.config.passportDomain}/transaction-confirmation/${relativePath}`;
|
|
7977
|
-
if (queryStringParams) {
|
|
7978
|
-
const queryString = queryStringParams
|
|
7979
|
-
? Object.keys(queryStringParams)
|
|
7980
|
-
.map((key) => `${key}=${queryStringParams[key]}`)
|
|
7981
|
-
.join('&')
|
|
7982
|
-
: '';
|
|
7983
|
-
href = `${href}?${queryString}`;
|
|
7984
|
-
}
|
|
7985
|
-
return href;
|
|
7986
|
-
}
|
|
7987
|
-
requestConfirmation(transactionId, etherAddress, chainType, chainId) {
|
|
7975
|
+
requestConfirmation(transactionId, imxEtherAddress, chainType, chainId) {
|
|
7988
7976
|
return new Promise((resolve, reject) => {
|
|
7989
7977
|
const messageHandler = ({ data, origin }) => {
|
|
7990
7978
|
if (origin !== this.config.passportDomain
|
|
@@ -8014,17 +8002,17 @@ class ConfirmationScreen {
|
|
|
8014
8002
|
window.addEventListener('message', messageHandler);
|
|
8015
8003
|
let href = '';
|
|
8016
8004
|
if (chainType === TransactionApprovalRequestChainTypeEnum.Starkex) {
|
|
8017
|
-
|
|
8005
|
+
// eslint-disable-next-line max-len
|
|
8006
|
+
href = `${this.config.passportDomain}/transaction-confirmation/transaction?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
|
|
8018
8007
|
}
|
|
8019
8008
|
else {
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
});
|
|
8009
|
+
// eslint-disable-next-line max-len
|
|
8010
|
+
href = `${this.config.passportDomain}/transaction-confirmation/zkevm?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=evm&chainId=${chainId}`;
|
|
8023
8011
|
}
|
|
8024
8012
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
8025
8013
|
});
|
|
8026
8014
|
}
|
|
8027
|
-
requestMessageConfirmation(
|
|
8015
|
+
requestMessageConfirmation(messageId) {
|
|
8028
8016
|
return new Promise((resolve, reject) => {
|
|
8029
8017
|
const messageHandler = ({ data, origin }) => {
|
|
8030
8018
|
if (origin !== this.config.passportDomain
|
|
@@ -8052,7 +8040,7 @@ class ConfirmationScreen {
|
|
|
8052
8040
|
return;
|
|
8053
8041
|
}
|
|
8054
8042
|
window.addEventListener('message', messageHandler);
|
|
8055
|
-
const href = this.
|
|
8043
|
+
const href = `${this.config.passportDomain}/transaction-confirmation/zkevm/message?messageID=${messageId}`;
|
|
8056
8044
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
8057
8045
|
});
|
|
8058
8046
|
}
|
|
@@ -8062,7 +8050,7 @@ class ConfirmationScreen {
|
|
|
8062
8050
|
return;
|
|
8063
8051
|
}
|
|
8064
8052
|
this.confirmationWindow = openPopupCenter({
|
|
8065
|
-
url: this.
|
|
8053
|
+
url: `${this.config.passportDomain}/transaction-confirmation/loading`,
|
|
8066
8054
|
title: CONFIRMATION_WINDOW_TITLE,
|
|
8067
8055
|
width: popupOptions?.width || CONFIRMATION_WINDOW_WIDTH,
|
|
8068
8056
|
height: popupOptions?.height || CONFIRMATION_WINDOW_HEIGHT,
|
|
@@ -8075,7 +8063,7 @@ class ConfirmationScreen {
|
|
|
8075
8063
|
return new Promise((resolve, rejects) => {
|
|
8076
8064
|
const iframe = document.createElement('iframe');
|
|
8077
8065
|
iframe.setAttribute('id', CONFIRMATION_IFRAME_ID);
|
|
8078
|
-
iframe.setAttribute('src', this.
|
|
8066
|
+
iframe.setAttribute('src', `${this.config.passportDomain}/transaction-confirmation/logout`);
|
|
8079
8067
|
iframe.setAttribute('style', CONFIRMATION_IFRAME_STYLE);
|
|
8080
8068
|
const logoutHandler = ({ data, origin }) => {
|
|
8081
8069
|
if (origin !== this.config.passportDomain
|
|
@@ -8519,17 +8507,7 @@ class ZkEvmProvider {
|
|
|
8519
8507
|
this.magicAdapter = magicAdapter;
|
|
8520
8508
|
this.config = config;
|
|
8521
8509
|
this.confirmationScreen = confirmationScreen;
|
|
8522
|
-
|
|
8523
|
-
// JsonRpcProvider by default sets the referrer as "client".
|
|
8524
|
-
// On Unreal 4 this errors as the browser used is expecting a valid URL.
|
|
8525
|
-
this.jsonRpcProvider = new JsonRpcProvider({
|
|
8526
|
-
url: this.config.zkEvmRpcUrl,
|
|
8527
|
-
fetchOptions: { referrer: 'http://imtblgamesdk.local' },
|
|
8528
|
-
});
|
|
8529
|
-
}
|
|
8530
|
-
else {
|
|
8531
|
-
this.jsonRpcProvider = new JsonRpcProvider(this.config.zkEvmRpcUrl);
|
|
8532
|
-
}
|
|
8510
|
+
this.jsonRpcProvider = new JsonRpcProvider(this.config.zkEvmRpcUrl);
|
|
8533
8511
|
this.multiRollupApiClients = multiRollupApiClients;
|
|
8534
8512
|
this.eventEmitter = new TypedEventEmitter();
|
|
8535
8513
|
passportEventEmitter.on(PassportEvents.LOGGED_OUT, this.handleLogout);
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.28.0-alpha.1",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"browser": "./dist/index.browser.js",
|
|
7
7
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@0xsequence/abi": "^0.43.34",
|
|
10
10
|
"@0xsequence/config": "^0.43.34",
|
|
11
|
+
"@biom3/design-tokens": "0.2.4-beta",
|
|
12
|
+
"@biom3/react": "^0.10.12",
|
|
11
13
|
"@ethersproject/abi": "^5.7.0",
|
|
12
14
|
"@ethersproject/abstract-signer": "^5.7.0",
|
|
13
15
|
"@ethersproject/providers": "^5.7.2",
|
|
14
16
|
"@ethersproject/wallet": "^5.7.0",
|
|
15
17
|
"@imtbl/core-sdk": "^2.0.2",
|
|
18
|
+
"@imtbl/react-analytics": "0.0.5-alpha",
|
|
16
19
|
"@jest/globals": "^29.5.0",
|
|
17
20
|
"@magic-ext/oidc": "^1.0.1",
|
|
18
21
|
"@metamask/detect-provider": "^2.0.0",
|
|
@@ -20,13 +23,25 @@
|
|
|
20
23
|
"@uniswap/router-sdk": "^1.4.0",
|
|
21
24
|
"@uniswap/sdk-core": "^3.0.1",
|
|
22
25
|
"@uniswap/v3-sdk": "^3.9.0",
|
|
26
|
+
"assert": "^2.0.0",
|
|
23
27
|
"axios": "^1.3.5",
|
|
24
28
|
"bn.js": "^5.2.1",
|
|
29
|
+
"buffer": "^6.0.3",
|
|
30
|
+
"crypto-browserify": "^3.12.0",
|
|
25
31
|
"enc-utils": "^3.0.0",
|
|
26
32
|
"ethers": "^5.7.2",
|
|
33
|
+
"https-browserify": "^1.0.0",
|
|
27
34
|
"jwt-decode": "^3.1.2",
|
|
28
35
|
"magic-sdk": "^13.3.1",
|
|
29
|
-
"oidc-client-ts": "^2.2.1"
|
|
36
|
+
"oidc-client-ts": "^2.2.1",
|
|
37
|
+
"os-browserify": "^0.3.0",
|
|
38
|
+
"pako": "^2.1.0",
|
|
39
|
+
"react": "^18.2.0",
|
|
40
|
+
"react-dom": "^18.2.0",
|
|
41
|
+
"react-router-dom": "^6.11.0",
|
|
42
|
+
"stream-browserify": "^3.0.0",
|
|
43
|
+
"stream-http": "^3.2.0",
|
|
44
|
+
"url": "^0.11.0"
|
|
30
45
|
},
|
|
31
46
|
"devDependencies": {
|
|
32
47
|
"@imtbl/blockchain-data": "0.0.0",
|
|
@@ -94,10 +109,6 @@
|
|
|
94
109
|
"./checkout_sdk": {
|
|
95
110
|
"types": "./dist/checkout_sdk.d.ts",
|
|
96
111
|
"import": "./dist/checkout_sdk.js"
|
|
97
|
-
},
|
|
98
|
-
"./checkout_widgets": {
|
|
99
|
-
"types": "./dist/checkout_widgets.d.ts",
|
|
100
|
-
"import": "./dist/checkout_widgets.js"
|
|
101
112
|
}
|
|
102
113
|
},
|
|
103
114
|
"files": [
|