@imtbl/sdk 0.6.1-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.
@@ -974,7 +974,8 @@ interface SendTransactionResult {
974
974
  * Enum representing the names of different wallet providers.
975
975
  */
976
976
  declare enum WalletProviderName {
977
- METAMASK = "metamask"
977
+ METAMASK = "metamask",
978
+ PASSPORT = "passport"
978
979
  }
979
980
  /**
980
981
  * Interface for the parameters required to create a wallet provider {@link Checkout.createProvider}.
@@ -15933,6 +15933,21 @@ var OrderStatus;
15933
15933
  OrderStatus["EXPIRED"] = "EXPIRED";
15934
15934
  })(OrderStatus || (OrderStatus = {}));
15935
15935
 
15936
+ var TransactionPurpose;
15937
+ (function (TransactionPurpose) {
15938
+ TransactionPurpose["APPROVAL"] = "APPROVAL";
15939
+ TransactionPurpose["FULFILL_ORDER"] = "FULFILL_ORDER";
15940
+ })(TransactionPurpose || (TransactionPurpose = {}));
15941
+ var SignablePurpose;
15942
+ (function (SignablePurpose) {
15943
+ SignablePurpose["CREATE_LISTING"] = "CREATE_LISTING";
15944
+ })(SignablePurpose || (SignablePurpose = {}));
15945
+ var ActionType;
15946
+ (function (ActionType) {
15947
+ ActionType["TRANSACTION"] = "TRANSACTION";
15948
+ ActionType["SIGNABLE"] = "SIGNABLE";
15949
+ })(ActionType || (ActionType = {}));
15950
+
15936
15951
  /* eslint-disable */
15937
15952
  // TODO: Resolve these from seaport-js.
15938
15953
  // There is some bundling issue that is preventing this from working
@@ -16009,12 +16024,14 @@ function getOrderComponentsFromMessage(orderMessage) {
16009
16024
 
16010
16025
  // Add 20% more gas than estimate to prevent out of gas errors
16011
16026
  // This can always be overwritten by the user signing the transaction
16012
- async function prepareTransaction(transactionMethods) {
16013
- const transaction = await transactionMethods.buildTransaction();
16014
- transaction.gasLimit = await transactionMethods.estimateGas();
16015
- transaction.gasLimit = transaction.gasLimit
16016
- .add(transaction.gasLimit.div(5));
16017
- return transaction;
16027
+ function prepareTransaction(transactionMethods) {
16028
+ return async () => {
16029
+ const transaction = await transactionMethods.buildTransaction();
16030
+ transaction.gasLimit = await transactionMethods.estimateGas();
16031
+ transaction.gasLimit = transaction.gasLimit
16032
+ .add(transaction.gasLimit.div(5));
16033
+ return transaction;
16034
+ };
16018
16035
  }
16019
16036
 
16020
16037
  function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
@@ -16096,31 +16113,39 @@ class Seaport {
16096
16113
  this.zoneContractAddress = zoneContractAddress;
16097
16114
  }
16098
16115
  async prepareSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry) {
16099
- const { actions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry);
16100
- let approvalTransaction;
16101
- const approvalAction = actions
16116
+ const { actions: seaportActions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, royaltyInfo, orderStart, orderExpiry);
16117
+ const listingActions = [];
16118
+ const approvalAction = seaportActions
16102
16119
  .find((action) => action.type === 'approval');
16103
16120
  if (approvalAction) {
16104
- approvalTransaction = await prepareTransaction(approvalAction.transactionMethods);
16121
+ listingActions.push({
16122
+ type: ActionType.TRANSACTION,
16123
+ purpose: TransactionPurpose.APPROVAL,
16124
+ buildTransaction: prepareTransaction(approvalAction.transactionMethods),
16125
+ });
16105
16126
  }
16106
- const createAction = actions
16127
+ const createAction = seaportActions
16107
16128
  .find((action) => action.type === 'create');
16108
16129
  if (!createAction) {
16109
16130
  throw new Error('No create order action found');
16110
16131
  }
16111
16132
  const orderMessageToSign = await createAction.getMessageToSign();
16112
16133
  const orderComponents = getOrderComponentsFromMessage(orderMessageToSign);
16134
+ listingActions.push({
16135
+ type: ActionType.SIGNABLE,
16136
+ purpose: SignablePurpose.CREATE_LISTING,
16137
+ message: await this.getTypedDataFromOrderComponents(orderComponents),
16138
+ });
16113
16139
  return {
16114
- unsignedApprovalTransaction: approvalTransaction,
16115
- typedOrderMessageForSigning: await this.getTypedDataFromOrderComponents(orderComponents),
16140
+ actions: listingActions,
16116
16141
  orderComponents,
16117
16142
  orderHash: this.getSeaportLib().getOrderHash(orderComponents),
16118
16143
  };
16119
16144
  }
16120
- async fulfilOrder(order, account) {
16145
+ async fulfillOrder(order, account) {
16121
16146
  const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
16122
16147
  const seaportLib = this.getSeaportLib(order);
16123
- const { actions } = await seaportLib.fulfillOrders({
16148
+ const { actions: seaportActions } = await seaportLib.fulfillOrders({
16124
16149
  accountAddress: account,
16125
16150
  fulfillOrderDetails: [{
16126
16151
  order: {
@@ -16130,28 +16155,33 @@ class Seaport {
16130
16155
  extraData: order.protocol_data.operator_signature,
16131
16156
  }],
16132
16157
  });
16133
- let approvalTransaction;
16134
- const approvalAction = actions
16158
+ const fulfillmentActions = [];
16159
+ const approvalAction = seaportActions
16135
16160
  .find((action) => action.type === 'approval');
16136
16161
  if (approvalAction) {
16137
- approvalTransaction = await prepareTransaction(approvalAction.transactionMethods);
16162
+ fulfillmentActions.push({
16163
+ type: ActionType.TRANSACTION,
16164
+ buildTransaction: prepareTransaction(approvalAction.transactionMethods),
16165
+ purpose: TransactionPurpose.APPROVAL,
16166
+ });
16138
16167
  }
16139
- const fulfillmentAction = actions
16168
+ const fulfilOrderAction = seaportActions
16140
16169
  .find((action) => action.type === 'exchange');
16141
- if (!fulfillmentAction) {
16170
+ if (!fulfilOrderAction) {
16142
16171
  throw new Error('No exchange action found');
16143
16172
  }
16144
- const fulfillmentTransaction = await prepareTransaction(fulfillmentAction.transactionMethods);
16145
- return {
16146
- unsignedApprovalTransaction: approvalTransaction,
16147
- unsignedFulfillmentTransaction: fulfillmentTransaction,
16148
- };
16173
+ fulfillmentActions.push({
16174
+ type: ActionType.TRANSACTION,
16175
+ buildTransaction: prepareTransaction(fulfilOrderAction.transactionMethods),
16176
+ purpose: TransactionPurpose.FULFILL_ORDER,
16177
+ });
16178
+ return { actions: fulfillmentActions };
16149
16179
  }
16150
16180
  async cancelOrder(order, account) {
16151
16181
  const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
16152
16182
  const seaportLib = this.getSeaportLib(order);
16153
16183
  const cancellationTransaction = await seaportLib.cancelOrders([orderComponents], account);
16154
- return prepareTransaction(cancellationTransaction);
16184
+ return prepareTransaction(cancellationTransaction)();
16155
16185
  }
16156
16186
  mapImmutableOrderToSeaportOrderComponents(order) {
16157
16187
  const orderCounter = order.protocol_data.counter;
@@ -16315,9 +16345,9 @@ function getOrderbookConfig(environment) {
16315
16345
  switch (environment) {
16316
16346
  case Environment$1.SANDBOX:
16317
16347
  return {
16318
- seaportContractAddress: '0x474989C4D25DD41B0B9b1ECb4643B9Fe25f83B19',
16319
- zoneContractAddress: '0x6FeDb4949E5b452700A8a8956999a7E05B6770F3',
16320
- apiEndpoint: 'https://api.sandbox.immutable.com',
16348
+ seaportContractAddress: '0x410000346E270aDbC89b2b688177d3AE76348dE9',
16349
+ zoneContractAddress: '0x979C2aCA989A56554Eb63E01e576E3179Cdad5A0',
16350
+ apiEndpoint: 'https://order-book-mr.sandbox.imtbl.com',
16321
16351
  chainName: TESTNET_CHAIN_NAME,
16322
16352
  provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
16323
16353
  };
@@ -17359,7 +17389,7 @@ class Orderbook {
17359
17389
  if (orderResult.result.status !== OrderStatus.ACTIVE) {
17360
17390
  throw new Error(`Cannot fulfil order that is not active. Current status: ${orderResult.result.status}`);
17361
17391
  }
17362
- return this.seaport.fulfilOrder(orderResult.result, takerAddress);
17392
+ return this.seaport.fulfillOrder(orderResult.result, takerAddress);
17363
17393
  }
17364
17394
  /**
17365
17395
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
@@ -17541,6 +17571,7 @@ var $4f91c5f280efe242$export$a75605c67ea83a5a;
17541
17571
  var $e768639828688ca3$export$2d7a51a18d87e21d;
17542
17572
  (function(WalletProviderName) {
17543
17573
  WalletProviderName["METAMASK"] = "metamask";
17574
+ WalletProviderName["PASSPORT"] = "passport";
17544
17575
  })($e768639828688ca3$export$2d7a51a18d87e21d || ($e768639828688ca3$export$2d7a51a18d87e21d = {}));
17545
17576
  const $e768639828688ca3$export$44dde05038008549 = {
17546
17577
  allowMistmatchedChainId: false,
@@ -568,7 +568,8 @@ declare class Web3Provider extends JsonRpcProvider {
568
568
  * Enum representing the names of different wallet providers.
569
569
  */
570
570
  declare enum WalletProviderName {
571
- METAMASK = "metamask"
571
+ METAMASK = "metamask",
572
+ PASSPORT = "passport"
572
573
  }
573
574
 
574
575
  interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
4
4
  function $parcel$export(e, n, v, s) {
5
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
6
  }
7
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.6.1-alpha";
7
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.7.0-alpha.1";
8
8
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
9
9
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
10
10
 
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
16
16
  chainID,
17
17
  coreContractAddress,
18
18
  registrationContractAddress,
19
- sdkVersion: 'ts-immutable-sdk-0.6.1-alpha',
19
+ sdkVersion: 'ts-immutable-sdk-0.7.0-alpha.1',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build