@imtbl/sdk 0.44.1 → 0.44.2

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.cjs CHANGED
@@ -10641,7 +10641,7 @@ class MultiRollupApiClients {
10641
10641
  }
10642
10642
 
10643
10643
  // eslint-disable-next-line @typescript-eslint/naming-convention
10644
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.1' };
10644
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.2' };
10645
10645
  const createConfig = ({ basePath, headers, }) => {
10646
10646
  if (!basePath.trim()) {
10647
10647
  throw Error('basePath can not be empty');
@@ -10713,7 +10713,7 @@ class APIError extends Error {
10713
10713
 
10714
10714
  /* eslint-disable implicit-arrow-linebreak */
10715
10715
  const defaultHeaders = {
10716
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.1',
10716
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.2',
10717
10717
  };
10718
10718
  /**
10719
10719
  * createAPIConfiguration to create a custom Configuration
@@ -11152,7 +11152,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11152
11152
  chainID,
11153
11153
  coreContractAddress,
11154
11154
  registrationContractAddress,
11155
- sdkVersion: 'ts-immutable-sdk-0.44.1',
11155
+ sdkVersion: 'ts-immutable-sdk-0.44.2',
11156
11156
  });
11157
11157
  /**
11158
11158
  * Sets `sdkVersion` at the time of build
@@ -37038,38 +37038,84 @@ class TokenBridge {
37038
37038
  * @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
37039
37039
  */
37040
37040
  async getTransactionStatus(req) {
37041
- const axelarAPIEndpoint = this.getAxelarEndpoint(req.sourceChainId);
37042
37041
  const txStatusResponse = {
37043
37042
  transactions: [],
37044
37043
  };
37045
- const abiCoder = new AbiCoder();
37046
- const statusPromises = [];
37047
- for (const transaction of req.transactions) {
37048
- statusPromises.push(queryTransactionStatus(axelarAPIEndpoint, transaction.txHash));
37044
+ const txStatusItems = await this.getAxelarStatus(req.transactions, req.sourceChainId);
37045
+ const uniqueReceivers = await this.getUniqueReceivers(txStatusItems, req.sourceChainId);
37046
+ const pendingWithdrawalPromises = [];
37047
+ for (const address of uniqueReceivers) {
37048
+ pendingWithdrawalPromises.push(this.getPendingWithdrawals({ recipient: address }));
37049
37049
  }
37050
- let statusResponses;
37050
+ let pendingWithdrawalResponses = [];
37051
37051
  try {
37052
- statusResponses = await Promise.all(statusPromises);
37052
+ pendingWithdrawalResponses = await Promise.all(pendingWithdrawalPromises);
37053
37053
  }
37054
37054
  catch (err) {
37055
- throw new BridgeError(`Failed to fetch the Axelar Status with the reason: ${err}`, BridgeErrorType.AXELAR_GAS_ESTIMATE_FAILED);
37055
+ console.log('err', err);
37056
+ throw new BridgeError(`Failed to fetch the pending withdrawals with: ${err}`, BridgeErrorType.FLOW_RATE_ERROR);
37056
37057
  }
37057
- const unpaidGasStatus = [GasPaidStatus.GAS_UNPAID, GasPaidStatus.GAS_PAID_NOT_ENOUGH_GAS];
37058
+ txStatusResponse.transactions = txStatusItems;
37059
+ // try match a completed transaction to a pending flowRate transaction
37060
+ for (const txStatusRes of txStatusResponse.transactions) {
37061
+ if (txStatusRes.status === StatusResponse.COMPLETE) {
37062
+ (() => {
37063
+ for (const pendingWithdrawals of pendingWithdrawalResponses) {
37064
+ const flowRatedTxIndex = pendingWithdrawals.pending.findIndex((el) => (el.amount.toString() === txStatusRes.amount.toString()
37065
+ && el.token === txStatusRes.token
37066
+ && el.withdrawer === txStatusRes.sender
37067
+ && el.recipient === txStatusRes.recipient));
37068
+ if (flowRatedTxIndex !== -1) {
37069
+ txStatusRes.status = StatusResponse.FLOW_RATE_CONTROLLED;
37070
+ txStatusRes.data = {
37071
+ canWithdraw: pendingWithdrawals.pending[flowRatedTxIndex].canWithdraw,
37072
+ timeoutStart: pendingWithdrawals.pending[flowRatedTxIndex].timeoutStart,
37073
+ timeoutEnd: pendingWithdrawals.pending[flowRatedTxIndex].timeoutEnd,
37074
+ };
37075
+ pendingWithdrawals.pending.splice(flowRatedTxIndex, 1);
37076
+ return;
37077
+ }
37078
+ }
37079
+ })();
37080
+ }
37081
+ }
37082
+ // Return the tx status response
37083
+ return txStatusResponse;
37084
+ }
37085
+ async getUniqueReceivers(txStatusItems, sourceChainId) {
37086
+ const uniqueReceivers = [];
37058
37087
  const isWithdraw = [
37059
37088
  ZKEVM_DEVNET_CHAIN_ID,
37060
37089
  ZKEVM_TESTNET_CHAIN_ID,
37061
37090
  ZKEVM_MAINNET_CHAIN_ID
37062
- ].includes(req.sourceChainId);
37063
- let rootBridge;
37064
- if (isWithdraw) {
37065
- rootBridge = await withBridgeError(async () => {
37066
- const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
37067
- return contract;
37068
- }, BridgeErrorType.INTERNAL_ERROR);
37091
+ ].includes(sourceChainId);
37092
+ for (let i = 0, l = txStatusItems.length; i < l; i++) {
37093
+ if (txStatusItems[i].status === StatusResponse.COMPLETE
37094
+ && isWithdraw && txStatusItems[i].recipient) {
37095
+ const receiverIndex = uniqueReceivers.findIndex((el) => el === txStatusItems[i].recipient);
37096
+ if (receiverIndex === -1) {
37097
+ uniqueReceivers.push(txStatusItems[i].recipient);
37098
+ }
37099
+ }
37100
+ } // for
37101
+ return uniqueReceivers;
37102
+ }
37103
+ async getAxelarStatus(transactions, sourceChainId) {
37104
+ const txStatusItems = [];
37105
+ const statusPromises = [];
37106
+ const axelarAPIEndpoint = this.getAxelarEndpoint(sourceChainId);
37107
+ const unpaidGasStatus = [GasPaidStatus.GAS_UNPAID, GasPaidStatus.GAS_PAID_NOT_ENOUGH_GAS];
37108
+ const abiCoder = new AbiCoder();
37109
+ for (const transaction of transactions) {
37110
+ statusPromises.push(queryTransactionStatus(axelarAPIEndpoint, transaction.txHash));
37111
+ }
37112
+ let statusResponses;
37113
+ try {
37114
+ statusResponses = await Promise.all(statusPromises);
37115
+ }
37116
+ catch (err) {
37117
+ throw new BridgeError(`Failed to fetch the Axelar Status with the reason: ${err}`, BridgeErrorType.AXELAR_GAS_ESTIMATE_FAILED);
37069
37118
  }
37070
- const flowRatePromises = [];
37071
- const flowRateLengthPromises = [];
37072
- const flowRatePromisesReceivers = [];
37073
37119
  for (let i = 0, l = statusResponses.length; i < l; i++) {
37074
37120
  let metaStatus;
37075
37121
  // consolidate axelar statuses to our own simplified metaStatus
@@ -37103,7 +37149,7 @@ class TokenBridge {
37103
37149
  }
37104
37150
  }
37105
37151
  let txItem = {
37106
- txHash: req.transactions[i].txHash,
37152
+ txHash: transactions[i].txHash,
37107
37153
  status: metaStatus,
37108
37154
  data: {
37109
37155
  gmpResponse: statusResponses[i].status,
@@ -37120,61 +37166,9 @@ class TokenBridge {
37120
37166
  amount: decodedData[4],
37121
37167
  };
37122
37168
  }
37123
- let flowRatePromiseIndex = flowRatePromisesReceivers.findIndex((el) => el === txItem.recipient);
37124
- if (metaStatus === StatusResponse.COMPLETE
37125
- && isWithdraw && txItem.recipient) {
37126
- // consolidate the calls we have to make to the flow rate by receiver
37127
- if (flowRatePromiseIndex === -1) {
37128
- flowRatePromisesReceivers.push(txItem.recipient);
37129
- flowRatePromiseIndex = flowRatePromisesReceivers.length - 1;
37130
- }
37131
- txItem.data.flowRatePromiseIndex = flowRatePromiseIndex;
37132
- }
37133
- txStatusResponse.transactions.push(txItem);
37169
+ txStatusItems.push(txItem);
37134
37170
  } // for
37135
- for (const flowRateReceiver of flowRatePromisesReceivers) {
37136
- flowRateLengthPromises.push(rootBridge.getPendingWithdrawalsLength(flowRateReceiver));
37137
- }
37138
- let flowRateLengthResponses = [];
37139
- try {
37140
- flowRateLengthResponses = await Promise.all(flowRateLengthPromises);
37141
- }
37142
- catch (err) {
37143
- throw new BridgeError(`Failed to fetch the Flow Rate pending lengths with the reason: ${err}`, BridgeErrorType.FLOW_RATE_ERROR);
37144
- }
37145
- for (let i = 0, l = flowRatePromisesReceivers.length; i < l; i++) {
37146
- const indices = [];
37147
- const indicesLength = flowRateLengthResponses[i].toNumber();
37148
- for (let j = 0; j < indicesLength; j++) {
37149
- indices.push(j);
37150
- }
37151
- flowRatePromises.push(rootBridge.getPendingWithdrawals(flowRatePromisesReceivers[i], indices));
37152
- }
37153
- let flowRateResponses = [];
37154
- if (flowRatePromises.length > 0) {
37155
- try {
37156
- flowRateResponses = await Promise.all(flowRatePromises);
37157
- }
37158
- catch (err) {
37159
- throw new BridgeError(`Failed to fetch the Flow Rate statuses with the reason: ${err}`, BridgeErrorType.FLOW_RATE_ERROR);
37160
- }
37161
- }
37162
- for (const txStatusRes of txStatusResponse.transactions) {
37163
- if (txStatusRes.data.flowRatePromiseIndex !== -1 && flowRateResponses[txStatusRes.data.flowRatePromiseIndex]) {
37164
- const flowRatedTx = flowRateResponses[txStatusRes.data.flowRatePromiseIndex].find((el) => (el.amount.toString() === txStatusRes.amount.toString()
37165
- && el.token === txStatusRes.token
37166
- && el.withdrawer === txStatusRes.sender));
37167
- if (flowRatedTx) {
37168
- txStatusRes.status = StatusResponse.FLOW_RATE_CONTROLLED;
37169
- txStatusRes.data = {
37170
- timestamp: flowRatedTx.timestamp.toString(),
37171
- };
37172
- }
37173
- }
37174
- delete txStatusRes.data.flowRatePromiseIndex;
37175
- }
37176
- // Return the tx status response
37177
- return txStatusResponse;
37171
+ return txStatusItems;
37178
37172
  }
37179
37173
  /**
37180
37174
  * Queries for the information about which tokens are flowrated and how long the delay is.
@@ -37200,6 +37194,7 @@ class TokenBridge {
37200
37194
  token = ETHEREUM_NATIVE_TOKEN_ADDRESS;
37201
37195
  }
37202
37196
  contractPromises.push(rootBridge.flowRateBuckets(token));
37197
+ contractPromises.push(rootBridge.largeTransferThresholds(token));
37203
37198
  }
37204
37199
  let contractPromisesRes;
37205
37200
  try {
@@ -37209,19 +37204,25 @@ class TokenBridge {
37209
37204
  throw new BridgeError('unable to query contract for flowrate info', BridgeErrorType.INTERNAL_ERROR);
37210
37205
  }
37211
37206
  const tokensRes = {};
37212
- // @note it's i + 2 because the first 2 promises are not token buckets
37207
+ const withdrawalQueueActivated = contractPromisesRes[0];
37208
+ const withdrawalDelay = contractPromisesRes[1].toNumber();
37209
+ // remove first 2 items from promise all response
37210
+ contractPromisesRes.splice(0, 2);
37211
+ // the remaining items should be sets of 2 per token
37213
37212
  for (let i = 0, l = req.tokens.length; i < l; i++) {
37213
+ const shifter = i * 2;
37214
37214
  tokensRes[req.tokens[i]] = {
37215
- capacity: contractPromisesRes[i + 2].capacity,
37216
- depth: contractPromisesRes[i + 2].depth,
37217
- refillTime: contractPromisesRes[i + 2].refillTime.toNumber(),
37218
- refillRate: contractPromisesRes[i + 2].refillRate,
37215
+ capacity: contractPromisesRes[shifter].capacity,
37216
+ depth: contractPromisesRes[shifter].depth,
37217
+ refillTime: contractPromisesRes[shifter].refillTime.toNumber(),
37218
+ refillRate: contractPromisesRes[shifter].refillRate,
37219
+ largeTransferThreshold: contractPromisesRes[shifter + 1],
37219
37220
  };
37220
37221
  }
37221
37222
  // Return the token mappings
37222
37223
  return {
37223
- withdrawalQueueActivated: contractPromisesRes[0],
37224
- withdrawalDelay: contractPromisesRes[1].toNumber(),
37224
+ withdrawalQueueActivated,
37225
+ withdrawalDelay,
37225
37226
  tokens: tokensRes,
37226
37227
  };
37227
37228
  }
@@ -37268,6 +37269,7 @@ class TokenBridge {
37268
37269
  canWithdraw: true,
37269
37270
  };
37270
37271
  }
37272
+ pendingWithdrawals.pending[i].recipient = req.recipient;
37271
37273
  pendingWithdrawals.pending[i].withdrawer = pending[i].withdrawer;
37272
37274
  pendingWithdrawals.pending[i].token = pending[i].token;
37273
37275
  pendingWithdrawals.pending[i].amount = pending[i].amount;
@@ -37311,6 +37313,7 @@ class TokenBridge {
37311
37313
  pendingWithdrawal: {
37312
37314
  canWithdraw: false,
37313
37315
  withdrawer: pending[0].withdrawer,
37316
+ recipient: req.recipient,
37314
37317
  token: pending[0].token,
37315
37318
  amount: pending[0].amount,
37316
37319
  timeoutStart: pending[0].timestamp.toNumber(),
@@ -37324,6 +37327,7 @@ class TokenBridge {
37324
37327
  pendingWithdrawal: {
37325
37328
  canWithdraw: true,
37326
37329
  withdrawer: pending[0].withdrawer,
37330
+ recipient: req.recipient,
37327
37331
  token: pending[0].token,
37328
37332
  amount: pending[0].amount,
37329
37333
  timeoutStart: pending[0].timestamp.toNumber(),
@@ -37349,10 +37353,38 @@ class TokenBridge {
37349
37353
  */
37350
37354
  async getTokenMapping(req) {
37351
37355
  // eslint-disable-next-line no-console
37352
- console.log('stubbed response with req', req);
37356
+ if (req.rootToken.toUpperCase() === 'NATIVE'
37357
+ || req.rootToken === this.config.bridgeContracts.rootChainWrappedETH) {
37358
+ const childBridge = await withBridgeError(async () => {
37359
+ const contract = new Contract(this.config.bridgeContracts.childERC20Bridge, CHILD_ERC20_BRIDGE, this.config.childProvider);
37360
+ return contract;
37361
+ }, BridgeErrorType.INTERNAL_ERROR);
37362
+ const childETHToken = await childBridge.childETHToken();
37363
+ return {
37364
+ rootToken: req.rootToken,
37365
+ childToken: childETHToken,
37366
+ };
37367
+ }
37368
+ const rootBridge = await withBridgeError(async () => {
37369
+ const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
37370
+ return contract;
37371
+ }, BridgeErrorType.INTERNAL_ERROR);
37372
+ const rootTokenChildAddress = await rootBridge.rootTokenToChildToken(req.rootToken);
37373
+ if (rootTokenChildAddress === AddressZero) {
37374
+ return {
37375
+ rootToken: req.rootToken,
37376
+ childToken: null,
37377
+ };
37378
+ }
37379
+ if (rootTokenChildAddress === req.rootToken) {
37380
+ return {
37381
+ rootToken: req.rootToken,
37382
+ childToken: 'NATIVE',
37383
+ };
37384
+ }
37353
37385
  return {
37354
- rootToken: '0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF',
37355
- childToken: 'NATIVE',
37386
+ rootToken: req.rootToken,
37387
+ childToken: rootTokenChildAddress,
37356
37388
  };
37357
37389
  }
37358
37390
  }
@@ -41278,12 +41310,14 @@ const validateProviderDefaults = {
41278
41310
  * @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
41279
41311
  * @property {string} FAILED - If checkout failed due to transactions not settling on chain
41280
41312
  * @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
41313
+ * @property {string} FULFILLMENTS_UNSETTLED - If checkout succeeded but the fulfillment transactions are not yet settled
41281
41314
  */
41282
41315
  var CheckoutStatus;
41283
41316
  (function (CheckoutStatus) {
41284
41317
  CheckoutStatus["SUCCESS"] = "SUCCESS";
41285
41318
  CheckoutStatus["FAILED"] = "FAILED";
41286
41319
  CheckoutStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
41320
+ CheckoutStatus["FULFILLMENTS_UNSETTLED"] = "FULFILLMENTS_UNSETTLED";
41287
41321
  })(CheckoutStatus || (CheckoutStatus = {}));
41288
41322
  /**
41289
41323
  * An enum representing the item types
@@ -41958,7 +41992,7 @@ const GAS_OVERRIDES = {
41958
41992
  maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
41959
41993
  };
41960
41994
 
41961
- const SDK_VERSION_MARKER = '0.44.1';
41995
+ const SDK_VERSION_MARKER = '0.44.2';
41962
41996
  // This SDK version is replaced by the `yarn build` command ran on the root level
41963
41997
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41964
41998
 
@@ -45019,7 +45053,9 @@ const getTransactionOrGas = (gasLimit, fulfillmentTransactions) => {
45019
45053
  },
45020
45054
  };
45021
45055
  };
45022
- const buy = async (config, provider, orders) => {
45056
+ const buy = async (config, provider, orders, overrides = {
45057
+ waitFulfillmentSettlements: true,
45058
+ }) => {
45023
45059
  if (orders.length === 0) {
45024
45060
  throw new CheckoutError('No orders were provided to the orders array. Please provide at least one order.', CheckoutErrorType.FULFILL_ORDER_LISTING_ERROR);
45025
45061
  }
@@ -45147,18 +45183,35 @@ const buy = async (config, provider, orders) => {
45147
45183
  message: err.message,
45148
45184
  });
45149
45185
  }
45150
- const fulfillmentResult = await signFulfillmentTransactions(provider, unsignedFulfillmentTransactions);
45151
- if (fulfillmentResult.type === SignTransactionStatusType.FAILED) {
45186
+ if (overrides.waitFulfillmentSettlements) {
45187
+ const fulfillmentResult = await signFulfillmentTransactions(provider, unsignedFulfillmentTransactions);
45188
+ if (fulfillmentResult.type === SignTransactionStatusType.FAILED) {
45189
+ return {
45190
+ status: CheckoutStatus.FAILED,
45191
+ transactionHash: fulfillmentResult.transactionHash,
45192
+ reason: fulfillmentResult.reason,
45193
+ smartCheckoutResult,
45194
+ };
45195
+ }
45152
45196
  return {
45153
- status: CheckoutStatus.FAILED,
45154
- transactionHash: fulfillmentResult.transactionHash,
45155
- reason: fulfillmentResult.reason,
45197
+ status: CheckoutStatus.SUCCESS,
45156
45198
  smartCheckoutResult,
45157
45199
  };
45158
45200
  }
45201
+ let transactions;
45202
+ try {
45203
+ const response = await Promise.all(unsignedFulfillmentTransactions.map((transaction) => sendTransaction(provider, transaction)));
45204
+ transactions = response.map((result) => result.transactionResponse);
45205
+ }
45206
+ catch (err) {
45207
+ throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
45208
+ message: err.message,
45209
+ });
45210
+ }
45159
45211
  return {
45160
- status: CheckoutStatus.SUCCESS,
45212
+ status: CheckoutStatus.FULFILLMENTS_UNSETTLED,
45161
45213
  smartCheckoutResult,
45214
+ transactions,
45162
45215
  };
45163
45216
  }
45164
45217
  return {
@@ -45735,7 +45788,7 @@ class Checkout {
45735
45788
  console.warn('This endpoint currently only processes the first order in the array.');
45736
45789
  }
45737
45790
  const web3Provider = await validateProvider(this.config, params.provider);
45738
- return await buy(this.config, web3Provider, params.orders);
45791
+ return await buy(this.config, web3Provider, params.orders, params.overrides);
45739
45792
  }
45740
45793
  /**
45741
45794
  * Determines the requirements for performing a sell.
package/dist/index.d.ts CHANGED
@@ -16861,6 +16861,8 @@ type orderbook_d_OrderStatusName = OrderStatusName;
16861
16861
  declare const orderbook_d_OrderStatusName: typeof OrderStatusName;
16862
16862
  type orderbook_d_Orderbook = Orderbook;
16863
16863
  declare const orderbook_d_Orderbook: typeof Orderbook;
16864
+ type orderbook_d_OrderbookModuleConfiguration = OrderbookModuleConfiguration;
16865
+ type orderbook_d_OrderbookOverrides = OrderbookOverrides;
16864
16866
  type orderbook_d_Page = Page;
16865
16867
  type orderbook_d_PrepareCancelOrdersResponse = PrepareCancelOrdersResponse;
16866
16868
  type orderbook_d_PrepareListingParams = PrepareListingParams;
@@ -16902,6 +16904,8 @@ declare namespace orderbook_d {
16902
16904
  orderbook_d_Order as Order,
16903
16905
  orderbook_d_OrderStatusName as OrderStatusName,
16904
16906
  orderbook_d_Orderbook as Orderbook,
16907
+ orderbook_d_OrderbookModuleConfiguration as OrderbookModuleConfiguration,
16908
+ orderbook_d_OrderbookOverrides as OrderbookOverrides,
16905
16909
  orderbook_d_Page as Page,
16906
16910
  orderbook_d_PrepareCancelOrdersResponse as PrepareCancelOrdersResponse,
16907
16911
  orderbook_d_PrepareListingParams as PrepareListingParams,
@@ -17062,7 +17066,7 @@ interface FeePercentage {
17062
17066
  percentageDecimal: number;
17063
17067
  }
17064
17068
 
17065
- type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds;
17069
+ type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultFulfillmentsUnsettled | BuyResultInsufficientFunds;
17066
17070
  /**
17067
17071
  * Represents the result of {@link Checkout.buy}
17068
17072
  * @property {CheckoutStatus.SUCCESS} status
@@ -17091,6 +17095,20 @@ type BuyResultFailed = {
17091
17095
  /** The sufficient result of smart checkout */
17092
17096
  smartCheckoutResult: SmartCheckoutSufficient;
17093
17097
  };
17098
+ /**
17099
+ * Represents the result of {@link Checkout.buy}
17100
+ * @property {CheckoutStatus.FULFILLMENTS_UNSETTLED} status
17101
+ * @property {SmartCheckoutSufficient} smartCheckoutResult
17102
+ * @property {SendTransactionResult[]} transactions
17103
+ */
17104
+ type BuyResultFulfillmentsUnsettled = {
17105
+ /** The status to indicate success */
17106
+ status: CheckoutStatus.FULFILLMENTS_UNSETTLED;
17107
+ /** The sufficient result of smart checkout */
17108
+ smartCheckoutResult: SmartCheckoutSufficient;
17109
+ /** Array of transaction results */
17110
+ transactions: TransactionResponse[];
17111
+ };
17094
17112
  /**
17095
17113
  * Represents the result of {@link Checkout.buy}
17096
17114
  * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status
@@ -17102,6 +17120,14 @@ type BuyResultInsufficientFunds = {
17102
17120
  /** The insufficient result of smart checkout */
17103
17121
  smartCheckoutResult: SmartCheckoutInsufficient;
17104
17122
  };
17123
+ /**
17124
+ * Represents the overrides available for {@link Checkout.buy}
17125
+ * @property {boolean} waitFulfillmentSettlements
17126
+ */
17127
+ type BuyOverrides = {
17128
+ /** If the buy should wait for the fulfillment transactions to settle */
17129
+ waitFulfillmentSettlements?: boolean;
17130
+ };
17105
17131
  type SellResult = SellResultSuccess | SellResultFailed | SellResultInsufficientFunds;
17106
17132
  /**
17107
17133
  * Represents the result of {@link Checkout.sell}
@@ -17174,11 +17200,13 @@ type CancelResultFailed = {
17174
17200
  * @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
17175
17201
  * @property {string} FAILED - If checkout failed due to transactions not settling on chain
17176
17202
  * @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
17203
+ * @property {string} FULFILLMENTS_UNSETTLED - If checkout succeeded but the fulfillment transactions are not yet settled
17177
17204
  */
17178
17205
  declare enum CheckoutStatus {
17179
17206
  SUCCESS = "SUCCESS",
17180
17207
  FAILED = "FAILED",
17181
- INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS"
17208
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
17209
+ FULFILLMENTS_UNSETTLED = "FULFILLMENTS_UNSETTLED"
17182
17210
  }
17183
17211
  /**
17184
17212
  * The type representing the order to buy
@@ -17737,11 +17765,13 @@ type AvailableRoutingOptions = {
17737
17765
  * Interface representing the parameters for {@link Checkout.buy}
17738
17766
  * @property {Web3Provider} provider - The provider to use for the buy.
17739
17767
  * @property {Array<BuyOrder>} orders - The orders to buy
17768
+ * @property {BuyOverrides} overrides - The overrides to use for the buy.
17740
17769
  * Currently only processes the first order in the array until batch processing is supported.
17741
17770
  */
17742
17771
  interface BuyParams {
17743
17772
  provider: Web3Provider;
17744
17773
  orders: Array<BuyOrder>;
17774
+ overrides?: BuyOverrides;
17745
17775
  }
17746
17776
 
17747
17777
  /**
@@ -19470,6 +19500,7 @@ type checkout_d_BridgeTransactionSent = BridgeTransactionSent;
19470
19500
  type checkout_d_BridgeWidgetConfiguration = BridgeWidgetConfiguration;
19471
19501
  type checkout_d_BridgeWidgetParams = BridgeWidgetParams;
19472
19502
  type checkout_d_BuyOrder = BuyOrder;
19503
+ type checkout_d_BuyOverrides = BuyOverrides;
19473
19504
  type checkout_d_BuyParams = BuyParams;
19474
19505
  type checkout_d_BuyResult = BuyResult;
19475
19506
  type checkout_d_BuyResultFailed = BuyResultFailed;
@@ -19679,6 +19710,7 @@ declare namespace checkout_d {
19679
19710
  checkout_d_BridgeWidgetConfiguration as BridgeWidgetConfiguration,
19680
19711
  checkout_d_BridgeWidgetParams as BridgeWidgetParams,
19681
19712
  checkout_d_BuyOrder as BuyOrder,
19713
+ checkout_d_BuyOverrides as BuyOverrides,
19682
19714
  checkout_d_BuyParams as BuyParams,
19683
19715
  checkout_d_BuyResult as BuyResult,
19684
19716
  checkout_d_BuyResultFailed as BuyResultFailed,