@imtbl/sdk 0.6.0-alpha → 0.7.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/index.js CHANGED
@@ -2398,7 +2398,7 @@ class MultiRollupApiClients {
2398
2398
  }
2399
2399
 
2400
2400
  // eslint-disable-next-line @typescript-eslint/naming-convention
2401
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.6.0-alpha' };
2401
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.7.0-alpha.1' };
2402
2402
  const createConfig = ({ basePath, headers, }) => {
2403
2403
  if (!basePath.trim()) {
2404
2404
  throw Error('basePath can not be empty');
@@ -2458,7 +2458,7 @@ class APIError extends Error {
2458
2458
 
2459
2459
  /* eslint-disable implicit-arrow-linebreak */
2460
2460
  const defaultHeaders = {
2461
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.6.0-alpha',
2461
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.7.0-alpha.1',
2462
2462
  };
2463
2463
  /**
2464
2464
  * createAPIConfiguration to create a custom Configuration
@@ -2730,7 +2730,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2730
2730
  chainID,
2731
2731
  coreContractAddress,
2732
2732
  registrationContractAddress,
2733
- sdkVersion: 'ts-immutable-sdk-0.6.0-alpha',
2733
+ sdkVersion: 'ts-immutable-sdk-0.7.0-alpha.1',
2734
2734
  });
2735
2735
  /**
2736
2736
  * Sets `sdkVersion` at the time of build
@@ -9469,6 +9469,21 @@ var OrderStatus;
9469
9469
  OrderStatus["EXPIRED"] = "EXPIRED";
9470
9470
  })(OrderStatus || (OrderStatus = {}));
9471
9471
 
9472
+ var TransactionPurpose;
9473
+ (function (TransactionPurpose) {
9474
+ TransactionPurpose["APPROVAL"] = "APPROVAL";
9475
+ TransactionPurpose["FULFILL_ORDER"] = "FULFILL_ORDER";
9476
+ })(TransactionPurpose || (TransactionPurpose = {}));
9477
+ var SignablePurpose;
9478
+ (function (SignablePurpose) {
9479
+ SignablePurpose["CREATE_LISTING"] = "CREATE_LISTING";
9480
+ })(SignablePurpose || (SignablePurpose = {}));
9481
+ var ActionType;
9482
+ (function (ActionType) {
9483
+ ActionType["TRANSACTION"] = "TRANSACTION";
9484
+ ActionType["SIGNABLE"] = "SIGNABLE";
9485
+ })(ActionType || (ActionType = {}));
9486
+
9472
9487
  /* eslint-disable */
9473
9488
  // TODO: Resolve these from seaport-js.
9474
9489
  // There is some bundling issue that is preventing this from working
@@ -9545,12 +9560,14 @@ function getOrderComponentsFromMessage(orderMessage) {
9545
9560
 
9546
9561
  // Add 20% more gas than estimate to prevent out of gas errors
9547
9562
  // This can always be overwritten by the user signing the transaction
9548
- async function prepareTransaction(transactionMethods) {
9549
- const transaction = await transactionMethods.buildTransaction();
9550
- transaction.gasLimit = await transactionMethods.estimateGas();
9551
- transaction.gasLimit = transaction.gasLimit
9552
- .add(transaction.gasLimit.div(5));
9553
- return transaction;
9563
+ function prepareTransaction(transactionMethods) {
9564
+ return async () => {
9565
+ const transaction = await transactionMethods.buildTransaction();
9566
+ transaction.gasLimit = await transactionMethods.estimateGas();
9567
+ transaction.gasLimit = transaction.gasLimit
9568
+ .add(transaction.gasLimit.div(5));
9569
+ return transaction;
9570
+ };
9554
9571
  }
9555
9572
 
9556
9573
  function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
@@ -9632,31 +9649,39 @@ class Seaport {
9632
9649
  this.zoneContractAddress = zoneContractAddress;
9633
9650
  }
9634
9651
  async prepareSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry) {
9635
- const { actions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry);
9636
- let approvalTransaction;
9637
- const approvalAction = actions
9652
+ const { actions: seaportActions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry);
9653
+ const listingActions = [];
9654
+ const approvalAction = seaportActions
9638
9655
  .find((action) => action.type === 'approval');
9639
9656
  if (approvalAction) {
9640
- approvalTransaction = await prepareTransaction(approvalAction.transactionMethods);
9657
+ listingActions.push({
9658
+ type: ActionType.TRANSACTION,
9659
+ purpose: TransactionPurpose.APPROVAL,
9660
+ buildTransaction: prepareTransaction(approvalAction.transactionMethods),
9661
+ });
9641
9662
  }
9642
- const createAction = actions
9663
+ const createAction = seaportActions
9643
9664
  .find((action) => action.type === 'create');
9644
9665
  if (!createAction) {
9645
9666
  throw new Error('No create order action found');
9646
9667
  }
9647
9668
  const orderMessageToSign = await createAction.getMessageToSign();
9648
9669
  const orderComponents = getOrderComponentsFromMessage(orderMessageToSign);
9670
+ listingActions.push({
9671
+ type: ActionType.SIGNABLE,
9672
+ purpose: SignablePurpose.CREATE_LISTING,
9673
+ message: await this.getTypedDataFromOrderComponents(orderComponents),
9674
+ });
9649
9675
  return {
9650
- unsignedApprovalTransaction: approvalTransaction,
9651
- typedOrderMessageForSigning: await this.getTypedDataFromOrderComponents(orderComponents),
9676
+ actions: listingActions,
9652
9677
  orderComponents,
9653
9678
  orderHash: this.getSeaportLib().getOrderHash(orderComponents),
9654
9679
  };
9655
9680
  }
9656
- async fulfilOrder(order, account) {
9681
+ async fulfillOrder(order, account) {
9657
9682
  const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
9658
9683
  const seaportLib = this.getSeaportLib(order);
9659
- const { actions } = await seaportLib.fulfillOrders({
9684
+ const { actions: seaportActions } = await seaportLib.fulfillOrders({
9660
9685
  accountAddress: account,
9661
9686
  fulfillOrderDetails: [{
9662
9687
  order: {
@@ -9666,28 +9691,33 @@ class Seaport {
9666
9691
  extraData: order.protocol_data.operator_signature,
9667
9692
  }],
9668
9693
  });
9669
- let approvalTransaction;
9670
- const approvalAction = actions
9694
+ const fulfillmentActions = [];
9695
+ const approvalAction = seaportActions
9671
9696
  .find((action) => action.type === 'approval');
9672
9697
  if (approvalAction) {
9673
- approvalTransaction = await prepareTransaction(approvalAction.transactionMethods);
9698
+ fulfillmentActions.push({
9699
+ type: ActionType.TRANSACTION,
9700
+ buildTransaction: prepareTransaction(approvalAction.transactionMethods),
9701
+ purpose: TransactionPurpose.APPROVAL,
9702
+ });
9674
9703
  }
9675
- const fulfillmentAction = actions
9704
+ const fulfilOrderAction = seaportActions
9676
9705
  .find((action) => action.type === 'exchange');
9677
- if (!fulfillmentAction) {
9706
+ if (!fulfilOrderAction) {
9678
9707
  throw new Error('No exchange action found');
9679
9708
  }
9680
- const fulfillmentTransaction = await prepareTransaction(fulfillmentAction.transactionMethods);
9681
- return {
9682
- unsignedApprovalTransaction: approvalTransaction,
9683
- unsignedFulfillmentTransaction: fulfillmentTransaction,
9684
- };
9709
+ fulfillmentActions.push({
9710
+ type: ActionType.TRANSACTION,
9711
+ buildTransaction: prepareTransaction(fulfilOrderAction.transactionMethods),
9712
+ purpose: TransactionPurpose.FULFILL_ORDER,
9713
+ });
9714
+ return { actions: fulfillmentActions };
9685
9715
  }
9686
9716
  async cancelOrder(order, account) {
9687
9717
  const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
9688
9718
  const seaportLib = this.getSeaportLib(order);
9689
9719
  const cancellationTransaction = await seaportLib.cancelOrders([orderComponents], account);
9690
- return prepareTransaction(cancellationTransaction);
9720
+ return prepareTransaction(cancellationTransaction)();
9691
9721
  }
9692
9722
  mapImmutableOrderToSeaportOrderComponents(order) {
9693
9723
  const orderCounter = order.protocol_data.counter;
@@ -9851,9 +9881,9 @@ function getOrderbookConfig(environment) {
9851
9881
  switch (environment) {
9852
9882
  case Environment$1.SANDBOX:
9853
9883
  return {
9854
- seaportContractAddress: '0x474989C4D25DD41B0B9b1ECb4643B9Fe25f83B19',
9855
- zoneContractAddress: '0x6FeDb4949E5b452700A8a8956999a7E05B6770F3',
9856
- apiEndpoint: 'https://api.sandbox.immutable.com',
9884
+ seaportContractAddress: '0x410000346E270aDbC89b2b688177d3AE76348dE9',
9885
+ zoneContractAddress: '0x979C2aCA989A56554Eb63E01e576E3179Cdad5A0',
9886
+ apiEndpoint: 'https://order-book-mr.sandbox.imtbl.com',
9857
9887
  chainName: TESTNET_CHAIN_NAME,
9858
9888
  provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
9859
9889
  };
@@ -10895,7 +10925,7 @@ class Orderbook {
10895
10925
  if (orderResult.result.status !== OrderStatus.ACTIVE) {
10896
10926
  throw new Error(`Cannot fulfil order that is not active. Current status: ${orderResult.result.status}`);
10897
10927
  }
10898
- return this.seaport.fulfilOrder(orderResult.result, takerAddress);
10928
+ return this.seaport.fulfillOrder(orderResult.result, takerAddress);
10899
10929
  }
10900
10930
  /**
10901
10931
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
@@ -10919,12 +10949,12 @@ class Orderbook {
10919
10949
  }
10920
10950
  }
10921
10951
 
10922
- const module = 'orderbook';
10923
-
10924
10952
  var orderbook = /*#__PURE__*/Object.freeze({
10925
10953
  __proto__: null,
10954
+ get ActionType () { return ActionType; },
10926
10955
  Orderbook: Orderbook,
10927
- module: module
10956
+ get SignablePurpose () { return SignablePurpose; },
10957
+ get TransactionPurpose () { return TransactionPurpose; }
10928
10958
  });
10929
10959
 
10930
10960
  function isChainValid(chainID, config) {
@@ -27442,6 +27472,19 @@ const $762782b6c862d954$export$db5daa1b5156ccfe = [
27442
27472
  ];
27443
27473
 
27444
27474
 
27475
+ var $aa144554f9ef124b$export$1fc8f52ad1810e52;
27476
+ (function(ItemType) {
27477
+ ItemType["NATIVE"] = "NATIVE";
27478
+ ItemType["ERC20"] = "ERC20";
27479
+ ItemType["ERC721"] = "ERC721";
27480
+ })($aa144554f9ef124b$export$1fc8f52ad1810e52 || ($aa144554f9ef124b$export$1fc8f52ad1810e52 = {}));
27481
+ var $aa144554f9ef124b$export$537fa3efd10ed435;
27482
+ (function(GasTokenType) {
27483
+ GasTokenType["NATIVE"] = "NATIVE";
27484
+ GasTokenType["ERC20"] = "ERC20";
27485
+ })($aa144554f9ef124b$export$537fa3efd10ed435 || ($aa144554f9ef124b$export$537fa3efd10ed435 = {}));
27486
+
27487
+
27445
27488
  /**
27446
27489
  * Enum representing different chain IDs.
27447
27490
  * @enum {number}
@@ -27524,6 +27567,7 @@ var $4f91c5f280efe242$export$a75605c67ea83a5a;
27524
27567
  var $e768639828688ca3$export$2d7a51a18d87e21d;
27525
27568
  (function(WalletProviderName) {
27526
27569
  WalletProviderName["METAMASK"] = "metamask";
27570
+ WalletProviderName["PASSPORT"] = "passport";
27527
27571
  })($e768639828688ca3$export$2d7a51a18d87e21d || ($e768639828688ca3$export$2d7a51a18d87e21d = {}));
27528
27572
  const $e768639828688ca3$export$44dde05038008549 = {
27529
27573
  allowMistmatchedChainId: false,
@@ -27539,10 +27583,6 @@ const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
27539
27583
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
27540
27584
  [(Environment$1).PRODUCTION]: "https://checkout-api.immutable.com"
27541
27585
  };
27542
- const $d85ad1457a3f1a83$export$7b057be2a3f512cc = {
27543
- [(Environment$1).SANDBOX]: "https://zkevm-rpc.sandbox.imtbl.com",
27544
- [(Environment$1).PRODUCTION]: "https://zkevm-rpc.imtbl.com"
27545
- };
27546
27586
  const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
27547
27587
  [
27548
27588
  ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM,
@@ -27672,6 +27712,8 @@ const $d85ad1457a3f1a83$export$3a9ebede6a150274 = new Map([
27672
27712
  CheckoutErrorType["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
27673
27713
  CheckoutErrorType["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
27674
27714
  CheckoutErrorType["INVALID_GAS_ESTIMATE_TYPE"] = "INVALID_GAS_ESTIMATE_TYPE";
27715
+ CheckoutErrorType["UNSUPPORTED_TOKEN_TYPE_ERROR"] = "UNSUPPORTED_TOKEN_TYPE_ERROR";
27716
+ CheckoutErrorType["GET_ORDER_LISTING_ERROR"] = "GET_ORDER_LISTING_ERROR";
27675
27717
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
27676
27718
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
27677
27719
  message;
@@ -28118,6 +28160,7 @@ async function $570856c68db0bd36$export$9e73e22953cebcfc(tokenBridge, tokenAddre
28118
28160
 
28119
28161
 
28120
28162
 
28163
+
28121
28164
  async function $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config) {
28122
28165
  const rootChainProvider = readOnlyProviders.get(fromChainId);
28123
28166
  const childChainProvider = readOnlyProviders.get(toChainId);
@@ -28146,6 +28189,13 @@ async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
28146
28189
  overrides: dexConfig?.overrides
28147
28190
  });
28148
28191
  }
28192
+ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
28193
+ return new (Orderbook)({
28194
+ baseConfig: {
28195
+ environment: config.environment
28196
+ }
28197
+ });
28198
+ }
28149
28199
 
28150
28200
 
28151
28201
 
@@ -28212,23 +28262,10 @@ class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
28212
28262
  this.message = message;
28213
28263
  }
28214
28264
  }
28215
- const $4013c5c91bb535f6$var$networkMap = (prod, dev, local)=>{
28216
- let networks;
28217
- if (dev) networks = ($d85ad1457a3f1a83$export$3a9ebede6a150274);
28218
- else if (prod) {
28219
- networks = ($d85ad1457a3f1a83$export$6f24f3cef7d501c4);
28220
- if (local) {
28221
- const rpcUrls = networks.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET)?.rpcUrls;
28222
- rpcUrls?.splice(0, 1, ($d85ad1457a3f1a83$export$7b057be2a3f512cc)[(Environment$1).PRODUCTION]);
28223
- }
28224
- } else {
28225
- networks = ($d85ad1457a3f1a83$export$3e81fc0987227f10);
28226
- if (local) {
28227
- const rpcUrls = networks.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET)?.rpcUrls;
28228
- rpcUrls?.splice(0, 1, ($d85ad1457a3f1a83$export$7b057be2a3f512cc)[(Environment$1).SANDBOX]);
28229
- }
28230
- }
28231
- return networks;
28265
+ const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
28266
+ if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
28267
+ if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
28268
+ return $d85ad1457a3f1a83$export$3e81fc0987227f10;
28232
28269
  };
28233
28270
  const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
28234
28271
  // DevMode and Sandbox will both use Sepolia.
@@ -28246,11 +28283,6 @@ class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
28246
28283
  // This will be used to get around the lack of
28247
28284
  // Environment.DEVELOPMENT
28248
28285
  isDevelopment = false;
28249
- // This is a hidden feature that is only available
28250
- // when building the project from source code.
28251
- // This will be used to get around the lack of
28252
- // Environment.LOCAL_DEVELOPMENT
28253
- isLocal = false;
28254
28286
  isProduction;
28255
28287
  remote;
28256
28288
  environment;
@@ -28260,7 +28292,7 @@ class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
28260
28292
  this.environment = config.baseConfig.environment;
28261
28293
  // Developer mode will super set any environment configuration
28262
28294
  this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
28263
- this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment, this.isLocal);
28295
+ this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
28264
28296
  this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
28265
28297
  isDevelopment: this.isDevelopment,
28266
28298
  isProduction: this.isProduction
@@ -28370,6 +28402,84 @@ async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProvide
28370
28402
 
28371
28403
 
28372
28404
 
28405
+ const $c147333b1f360629$export$92589613aaa38e1f = 300000;
28406
+ const $c147333b1f360629$export$dea9ce0e9bb2441c = "0x474989C4D25DD41B0B9b1ECb4643B9Fe25f83B19";
28407
+ const $c147333b1f360629$export$5baee63457fa7911 = (type, amount, contractAddress)=>{
28408
+ switch(type){
28409
+ case ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC20:
28410
+ case ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC721:
28411
+ return {
28412
+ type: type,
28413
+ amount: amount,
28414
+ contractAddress: contractAddress,
28415
+ approvalContractAddress: $c147333b1f360629$export$dea9ce0e9bb2441c
28416
+ };
28417
+ case ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE:
28418
+ default:
28419
+ return {
28420
+ type: ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE,
28421
+ amount: amount
28422
+ };
28423
+ }
28424
+ };
28425
+ const $c147333b1f360629$export$7f8e2b98eca5a7f0 = async (config, provider, orderId)=>{
28426
+ let order;
28427
+ try {
28428
+ const orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
28429
+ order = await orderbook.getListing(orderId);
28430
+ } catch (err) {
28431
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while getting the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ORDER_LISTING_ERROR, {
28432
+ orderId: orderId,
28433
+ message: err.message
28434
+ });
28435
+ }
28436
+ let amount = (BigNumber$1).from("0");
28437
+ let type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE;
28438
+ let contractAddress = "";
28439
+ const buyArray = order.result.buy;
28440
+ if (buyArray.length > 0) switch(buyArray[0].item_type){
28441
+ case "NATIVE":
28442
+ type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE;
28443
+ break;
28444
+ case "ERC20":
28445
+ type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC20;
28446
+ contractAddress = buyArray[0].contract_address;
28447
+ break;
28448
+ case "ERC721":
28449
+ type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC721;
28450
+ contractAddress = buyArray[0].contract_address;
28451
+ break;
28452
+ default:
28453
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Purchasing token type is unsupported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_TOKEN_TYPE_ERROR, {
28454
+ orderId: orderId
28455
+ });
28456
+ }
28457
+ buyArray.forEach((item)=>{
28458
+ amount = amount.add((BigNumber$1).from(item.start_amount));
28459
+ });
28460
+ const feeArray = order.result.fees;
28461
+ feeArray.forEach((item)=>{
28462
+ amount = amount.add((BigNumber$1).from(item.amount));
28463
+ });
28464
+ const requirements = [
28465
+ $c147333b1f360629$export$5baee63457fa7911(type, amount, contractAddress)
28466
+ ];
28467
+ return {
28468
+ requirements: requirements,
28469
+ gas: {
28470
+ type: ($aa144554f9ef124b$export$537fa3efd10ed435).NATIVE,
28471
+ limit: (BigNumber$1).from($c147333b1f360629$export$92589613aaa38e1f)
28472
+ }
28473
+ };
28474
+ };
28475
+
28476
+
28477
+
28478
+
28479
+
28480
+
28481
+
28482
+
28373
28483
  async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
28374
28484
  if (config.isProduction && existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM)) return existingReadOnlyProviders;
28375
28485
  if (existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
@@ -28504,6 +28614,15 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
28504
28614
  return await $de192de6ef100f9f$export$79f13b4cfaaf0d09(this.config, web3Provider);
28505
28615
  }
28506
28616
  /**
28617
+ * Determines the requirements for performing a buy.
28618
+ * @param {BuyParams} params - The parameters for the buy.
28619
+ */ async buy(params) {
28620
+ // eslint-disable-next-line no-console
28621
+ console.warn("This endpoint is currently under construction.");
28622
+ const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
28623
+ await $c147333b1f360629$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orderId);
28624
+ }
28625
+ /**
28507
28626
  * Checks if the given object is a Web3 provider.
28508
28627
  * @param {Web3Provider} web3Provider - The object to check.
28509
28628
  * @returns {boolean} - True if the object is a Web3 provider, false otherwise.
@@ -28537,7 +28656,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
28537
28656
  function $parcel$export(e, n, v, s) {
28538
28657
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
28539
28658
  }
28540
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.6.0-alpha";
28659
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.7.0-alpha.1";
28541
28660
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
28542
28661
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
28543
28662
 
@@ -28730,12 +28849,48 @@ function $77ec335383336bdd$export$931068bc678f0d73(tagName, provider) {
28730
28849
 
28731
28850
 
28732
28851
 
28852
+ function $b222a8f062090058$export$fae4199086a966a3(tagName, passport) {
28853
+ if (!passport) {
28854
+ // eslint-disable-next-line no-console
28855
+ console.error("no passport provided");
28856
+ return;
28857
+ }
28858
+ if (window === undefined) {
28859
+ // eslint-disable-next-line no-console
28860
+ console.error("missing window object: please run Checkout client side");
28861
+ return;
28862
+ }
28863
+ let attempts = 0;
28864
+ const maxAttempts = 10;
28865
+ let timer;
28866
+ const attemptToAddPassport = ()=>{
28867
+ try {
28868
+ const elements = document.getElementsByTagName(tagName);
28869
+ const widget = elements[0];
28870
+ widget.addPassportOption(passport);
28871
+ window.clearInterval(timer);
28872
+ } catch (err) {
28873
+ attempts++;
28874
+ if (attempts >= maxAttempts) {
28875
+ window.clearInterval(timer);
28876
+ // eslint-disable-next-line no-console
28877
+ console.error("failed to set the provider");
28878
+ }
28879
+ }
28880
+ };
28881
+ timer = window.setInterval(attemptToAddPassport, 10);
28882
+ attemptToAddPassport();
28883
+ }
28884
+
28885
+
28733
28886
  function $1f969328e5988c99$export$30f61ebf204c69f6(props) {
28734
- const { walletProvider: walletProvider, fromContractAddress: fromContractAddress, amount: amount, provider: provider } = props;
28887
+ const { walletProvider: walletProvider, fromContractAddress: fromContractAddress, amount: amount, provider: provider, passport: passport } = props;
28735
28888
  (useEffect)(()=>{
28736
28889
  if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).BRIDGE, provider);
28890
+ if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).BRIDGE, passport);
28737
28891
  }, [
28738
- provider
28892
+ provider,
28893
+ passport
28739
28894
  ]);
28740
28895
  const config = window.ImtblCheckoutWidgetConfig;
28741
28896
  return /*#__PURE__*/ (jsx)("imtbl-bridge", {
@@ -28752,8 +28907,15 @@ var $f2083cd30e2f5c56$exports = {};
28752
28907
  $parcel$export($f2083cd30e2f5c56$exports, "ConnectReact", () => $f2083cd30e2f5c56$export$49d62957f420a1e2);
28753
28908
 
28754
28909
 
28755
- function $f2083cd30e2f5c56$export$49d62957f420a1e2() {
28910
+
28911
+
28912
+ function $f2083cd30e2f5c56$export$49d62957f420a1e2({ passport: passport }) {
28756
28913
  const config = window.ImtblCheckoutWidgetConfig;
28914
+ (useEffect)(()=>{
28915
+ if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).CONNECT, passport);
28916
+ }, [
28917
+ passport
28918
+ ]);
28757
28919
  return /*#__PURE__*/ (jsx)("imtbl-connect", {
28758
28920
  widgetConfig: config
28759
28921
  });
@@ -28767,12 +28929,15 @@ $parcel$export($a4fbb8e3a6aeff58$exports, "SwapReact", () => $a4fbb8e3a6aeff58$e
28767
28929
 
28768
28930
 
28769
28931
 
28932
+
28770
28933
  function $a4fbb8e3a6aeff58$export$971e031379577f4(props) {
28771
- const { walletProvider: walletProvider, fromContractAddress: fromContractAddress, amount: amount, toContractAddress: toContractAddress, provider: provider } = props;
28934
+ const { walletProvider: walletProvider, fromContractAddress: fromContractAddress, amount: amount, toContractAddress: toContractAddress, provider: provider, passport: passport } = props;
28772
28935
  (useEffect)(()=>{
28773
28936
  if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).SWAP, provider);
28937
+ if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).SWAP, passport);
28774
28938
  }, [
28775
- provider
28939
+ provider,
28940
+ passport
28776
28941
  ]);
28777
28942
  const config = window.ImtblCheckoutWidgetConfig;
28778
28943
  return /*#__PURE__*/ (jsx)("imtbl-swap", {
@@ -28792,12 +28957,15 @@ $parcel$export($89d55ace0f8f1c07$exports, "WalletReact", () => $89d55ace0f8f1c07
28792
28957
 
28793
28958
 
28794
28959
 
28960
+
28795
28961
  function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
28796
- const { walletProvider: walletProvider, provider: provider } = props;
28962
+ const { walletProvider: walletProvider, provider: provider, passport: passport } = props;
28797
28963
  (useEffect)(()=>{
28798
28964
  if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).WALLET, provider);
28965
+ if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).WALLET, passport);
28799
28966
  }, [
28800
- provider
28967
+ provider,
28968
+ passport
28801
28969
  ]);
28802
28970
  const config = window.ImtblCheckoutWidgetConfig;
28803
28971
  return /*#__PURE__*/ (jsx)("imtbl-wallet", {
@@ -224,12 +224,7 @@ interface PrepareListingParams {
224
224
  orderExpiry?: Date;
225
225
  }
226
226
  interface PrepareListingResponse {
227
- unsignedApprovalTransaction?: PopulatedTransaction;
228
- typedOrderMessageForSigning: {
229
- domain: TypedDataDomain;
230
- types: Record<string, TypedDataField[]>;
231
- value: Record<string, any>;
232
- };
227
+ actions: Action[];
233
228
  orderComponents: OrderComponents;
234
229
  orderHash: string;
235
230
  }
@@ -239,14 +234,38 @@ interface CreateListingParams {
239
234
  orderSignature: string;
240
235
  }
241
236
  type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
237
+ declare enum TransactionPurpose {
238
+ APPROVAL = "APPROVAL",
239
+ FULFILL_ORDER = "FULFILL_ORDER"
240
+ }
241
+ declare enum SignablePurpose {
242
+ CREATE_LISTING = "CREATE_LISTING"
243
+ }
244
+ declare enum ActionType {
245
+ TRANSACTION = "TRANSACTION",
246
+ SIGNABLE = "SIGNABLE"
247
+ }
248
+ type TransactionBuilder = () => Promise<PopulatedTransaction>;
249
+ interface TransactionAction {
250
+ type: ActionType.TRANSACTION;
251
+ purpose: TransactionPurpose;
252
+ buildTransaction: TransactionBuilder;
253
+ }
254
+ interface SignableAction {
255
+ type: ActionType.SIGNABLE;
256
+ purpose: SignablePurpose;
257
+ message: {
258
+ domain: TypedDataDomain;
259
+ types: Record<string, TypedDataField[]>;
260
+ value: Record<string, any>;
261
+ };
262
+ }
263
+ type Action = TransactionAction | SignableAction;
242
264
  interface FulfillOrderResponse {
243
- unsignedApprovalTransaction?: PopulatedTransaction;
244
- unsignedFulfillmentTransaction: PopulatedTransaction;
265
+ actions: Action[];
245
266
  }
246
267
  interface CancelOrderResponse {
247
268
  unsignedCancelOrderTransaction: PopulatedTransaction;
248
269
  }
249
270
 
250
- declare const module = "orderbook";
251
-
252
- export { CancelOrderResponse, CreateListingParams, ERC20Item, ERC721Item, FulfillOrderResponse, ListListingsParams, NativeItem, Orderbook, PrepareListingParams, PrepareListingResponse, RoyaltyInfo, module };
271
+ export { Action, ActionType, CancelOrderResponse, CreateListingParams, ERC20Item, ERC721Item, FulfillOrderResponse, ListListingsParams, NativeItem, Orderbook, PrepareListingParams, PrepareListingResponse, RoyaltyInfo, SignableAction, SignablePurpose, TransactionAction, TransactionBuilder, TransactionPurpose };