@imtbl/sdk 0.25.0 → 0.27.0

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.
@@ -11030,11 +11030,11 @@ type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds
11030
11030
  /**
11031
11031
  * Represents the result of {@link Checkout.buy}
11032
11032
  * @property {CheckoutStatus.SUCCESS} status - The status to indicate success
11033
- * @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
11033
+ * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
11034
11034
  */
11035
11035
  type BuyResultSuccess = {
11036
11036
  status: CheckoutStatus.SUCCESS;
11037
- smartCheckoutResult: SmartCheckoutSufficient[];
11037
+ smartCheckoutResult: SmartCheckoutSufficient;
11038
11038
  };
11039
11039
  /**
11040
11040
  * Represents the result of {@link Checkout.buy}
@@ -11047,49 +11047,49 @@ type BuyResultFailed = {
11047
11047
  status: CheckoutStatus.FAILED;
11048
11048
  transactionHash: string;
11049
11049
  reason: string;
11050
- smartCheckoutResult: SmartCheckoutSufficient[];
11050
+ smartCheckoutResult: SmartCheckoutSufficient;
11051
11051
  };
11052
11052
  /**
11053
11053
  * Represents the result of {@link Checkout.buy}
11054
11054
  * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status - The status to indicate insufficient funds
11055
- * @property {SmartCheckoutInsufficient[]} smartCheckoutResult - The insufficient result of smart checkout
11055
+ * @property {SmartCheckoutInsufficient} smartCheckoutResult - The insufficient result of smart checkout
11056
11056
  */
11057
11057
  type BuyResultInsufficientFunds = {
11058
11058
  status: CheckoutStatus.INSUFFICIENT_FUNDS;
11059
- smartCheckoutResult: SmartCheckoutInsufficient[];
11059
+ smartCheckoutResult: SmartCheckoutInsufficient;
11060
11060
  };
11061
11061
  type SellResult = SellResultSuccess | SellResultFailed | SellResultInsufficientFunds;
11062
11062
  /**
11063
11063
  * Represents the result of {@link Checkout.sell}
11064
11064
  * @property {CheckoutStatus.SUCCESS} status - The status to indicate success
11065
- * @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
11065
+ * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
11066
11066
  */
11067
11067
  type SellResultSuccess = {
11068
11068
  status: CheckoutStatus.SUCCESS;
11069
11069
  orderIds: string[];
11070
- smartCheckoutResult: SmartCheckoutSufficient[];
11070
+ smartCheckoutResult: SmartCheckoutSufficient;
11071
11071
  };
11072
11072
  /**
11073
11073
  * Represents the result of {@link Checkout.sell}
11074
11074
  * @property {CheckoutStatus.FAILED} status - The status to indicate failure
11075
11075
  * @property {string} transactionHash - The transaction hash of the failed transaction
11076
11076
  * @property {string} reason - The reason for the failure
11077
- * @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
11077
+ * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
11078
11078
  */
11079
11079
  type SellResultFailed = {
11080
11080
  status: CheckoutStatus.FAILED;
11081
11081
  transactionHash: string;
11082
11082
  reason: string;
11083
- smartCheckoutResult: SmartCheckoutSufficient[];
11083
+ smartCheckoutResult: SmartCheckoutSufficient;
11084
11084
  };
11085
11085
  /**
11086
11086
  * Represents the result of {@link Checkout.sell}
11087
11087
  * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status - The status to indicate insufficient funds
11088
- * @property {SmartCheckoutInsufficient[]} smartCheckoutResult - The insufficient result of smart checkout
11088
+ * @property {SmartCheckoutInsufficient} smartCheckoutResult - The insufficient result of smart checkout
11089
11089
  */
11090
11090
  type SellResultInsufficientFunds = {
11091
11091
  status: CheckoutStatus.INSUFFICIENT_FUNDS;
11092
- smartCheckoutResult: SmartCheckoutInsufficient[];
11092
+ smartCheckoutResult: SmartCheckoutInsufficient;
11093
11093
  };
11094
11094
  type CancelResult = CancelResultSuccess | CancelResultFailed;
11095
11095
  /**
@@ -11324,13 +11324,11 @@ type SmartCheckoutInsufficient = {
11324
11324
  };
11325
11325
  /**
11326
11326
  * Represents the routing outcome for a transaction.
11327
- * @property {boolean} isPassport - Indicates if the provider used was a passport provider.
11328
11327
  * @property {AvailableRoutingOptions} availableRoutingOptions - The routing options available to the user
11329
11328
  * @property {RoutingOutcome} routingOutcome - The routing outcome for the transaction which
11330
11329
  * includes the funding routes if routes were found
11331
11330
  */
11332
11331
  type SmartCheckoutRouter = {
11333
- isPassport: boolean;
11334
11332
  availableRoutingOptions: AvailableRoutingOptions;
11335
11333
  routingOutcome: RoutingOutcome;
11336
11334
  };
@@ -11559,24 +11557,6 @@ type AvailableRoutingOptions = {
11559
11557
  swap?: boolean;
11560
11558
  bridge?: boolean;
11561
11559
  };
11562
- type FundingRouteFeeEstimate = SwapRouteFeeEstimate | BridgeRouteFeeEstimate;
11563
- type SwapRouteFeeEstimate = {
11564
- type: FundingStepType.SWAP;
11565
- estimatedAmount: BigNumber;
11566
- token: TokenInfo;
11567
- };
11568
- type BridgeRouteFeeEstimate = {
11569
- type: FundingStepType.BRIDGE;
11570
- gasFee: {
11571
- estimatedAmount: BigNumber;
11572
- token?: TokenInfo;
11573
- };
11574
- bridgeFee: {
11575
- estimatedAmount: BigNumber;
11576
- token?: TokenInfo;
11577
- };
11578
- totalFees: BigNumber;
11579
- };
11580
11560
  /**
11581
11561
  * Interface representing the parameters for {@link Checkout.buy}
11582
11562
  * @property {Web3Provider} provider - The provider to use for the buy.
@@ -12092,7 +12072,8 @@ declare enum CheckoutErrorType {
12092
12072
  SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
12093
12073
  BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
12094
12074
  ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
12095
- ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR"
12075
+ ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
12076
+ API_ERROR = "API_ERROR"
12096
12077
  }
12097
12078
  /**
12098
12079
  * Represents an error object with a specific type, optional message, and optional data.
@@ -12267,4 +12248,4 @@ declare class Checkout {
12267
12248
  getExchangeFeeEstimate(): Promise<OnRampProviderFees>;
12268
12249
  }
12269
12250
 
12270
- export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BuyOrder, BuyParams, BuyResult, BuyToken, CHECKOUT_API_BASE_URL, CancelParams, CancelResult, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutStatus, ConnectParams, ConnectResult, DexConfig, ERC20ItemRequirement, ERC721ItemRequirement, ErrorType, ExchangeType, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingRouteFeeEstimate, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, OrderFee, RemoteConfiguration, RoutingOutcome, RoutingOutcomeType, SellOrder, SellParams, SellResult, SellToken, SendTransactionParams, SendTransactionResult, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
12251
+ export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeFundingStep, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CHECKOUT_API_BASE_URL, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutStatus, ConnectParams, ConnectResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampFundingStep, OrderFee, RemoteConfiguration, RoutesFound, RoutingOutcome, RoutingOutcomeType, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapFundingStep, SwitchNetworkParams, SwitchNetworkResult, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
@@ -20461,7 +20461,7 @@ class APIError extends Error {
20461
20461
 
20462
20462
  /* eslint-disable implicit-arrow-linebreak */
20463
20463
  const defaultHeaders = {
20464
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.25.0',
20464
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.0',
20465
20465
  };
20466
20466
  /**
20467
20467
  * createAPIConfiguration to create a custom Configuration
@@ -20778,6 +20778,20 @@ class BlockchainData {
20778
20778
  throw formatError(err);
20779
20779
  });
20780
20780
  }
20781
+ /**
20782
+ * Get metadata by ID
20783
+ * @param request - the request object containing the parameters to be provided in the API request
20784
+ * @returns a promise that resolves with a single Metadata
20785
+ * @throws {@link index.APIError}
20786
+ */
20787
+ async getMetadata(request) {
20788
+ return await this.metadata
20789
+ .getMetadata(request)
20790
+ .then((res) => res.data)
20791
+ .catch((err) => {
20792
+ throw formatError(err);
20793
+ });
20794
+ }
20781
20795
  /**
20782
20796
  * List NFT Metadata by contract address
20783
20797
  * @param request - the request object containing the parameters to be provided in the API request
@@ -20955,6 +20969,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
20955
20969
  decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
20956
20970
  address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
20957
20971
  };
20972
+ ({
20973
+ [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
20974
+ [(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
20975
+ [(Environment$1).PRODUCTION]: "https://api.immutable.com"
20976
+ });
20958
20977
  const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
20959
20978
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
20960
20979
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
@@ -21347,6 +21366,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
21347
21366
  CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
21348
21367
  CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
21349
21368
  CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
21369
+ CheckoutErrorType["API_ERROR"] = "API_ERROR";
21350
21370
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
21351
21371
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
21352
21372
  message;
@@ -21527,6 +21547,7 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
21527
21547
 
21528
21548
 
21529
21549
 
21550
+
21530
21551
  class $a492ee374ae7b613$export$d902b56530cd5f87 {
21531
21552
  isDevelopment;
21532
21553
  isProduction;
@@ -21541,9 +21562,9 @@ class $a492ee374ae7b613$export$d902b56530cd5f87 {
21541
21562
  try {
21542
21563
  response = await (0, globalAxios).get(url);
21543
21564
  } catch (error) {
21544
- throw new Error(`Error fetching from api: ${error.message}`);
21565
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
21545
21566
  }
21546
- if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
21567
+ if (response.status !== 200) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
21547
21568
  return response;
21548
21569
  }
21549
21570
  getEndpoint = ()=>{
@@ -23079,17 +23100,23 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
23079
23100
  try {
23080
23101
  const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
23081
23102
  const dexTransactionResponsePromises = [];
23103
+ const fromToken = [];
23082
23104
  // Create a quote for each swappable token
23083
- for (const swappableToken of swappableTokens)dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
23105
+ for (const swappableToken of swappableTokens){
23106
+ if (swappableToken === requiredToken.address) continue;
23107
+ dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
23108
+ fromToken.push(swappableToken);
23109
+ }
23084
23110
  // Resolve all the quotes and link them back to the swappable token
23085
23111
  // The swappable token array is in the same position in the array as the quote in the promise array
23086
- const dexTransactionResponse = await Promise.all(dexTransactionResponsePromises);
23112
+ const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
23087
23113
  dexTransactionResponse.forEach((response, index)=>{
23088
- const swappableToken = swappableTokens[index];
23114
+ if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
23115
+ const swappableToken = fromToken[index];
23089
23116
  dexQuotes.set(swappableToken, {
23090
- quote: response.quote,
23091
- approval: response.approval?.gasFeeEstimate,
23092
- swap: response.swap.gasFeeEstimate
23117
+ quote: response.value.quote,
23118
+ approval: response.value.approval?.gasFeeEstimate,
23119
+ swap: response.value.swap.gasFeeEstimate
23093
23120
  });
23094
23121
  });
23095
23122
  return dexQuotes;
@@ -24042,15 +24069,6 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
24042
24069
  fundingRoutes: []
24043
24070
  };
24044
24071
  let priority = 0;
24045
- if (bridgeFundingStep) {
24046
- priority++;
24047
- response.fundingRoutes.push({
24048
- priority: priority,
24049
- steps: [
24050
- bridgeFundingStep
24051
- ]
24052
- });
24053
- }
24054
24072
  if (swapFundingSteps.length > 0) {
24055
24073
  priority++;
24056
24074
  swapFundingSteps.forEach((swapFundingStep)=>{
@@ -24062,6 +24080,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
24062
24080
  });
24063
24081
  });
24064
24082
  }
24083
+ if (bridgeFundingStep) {
24084
+ priority++;
24085
+ response.fundingRoutes.push({
24086
+ priority: priority,
24087
+ steps: [
24088
+ bridgeFundingStep
24089
+ ]
24090
+ });
24091
+ }
24065
24092
  if (onRampFundingStep) {
24066
24093
  priority++;
24067
24094
  response.fundingRoutes.push({
@@ -24109,12 +24136,10 @@ const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (config, provider, itemR
24109
24136
  };
24110
24137
  const availableRoutingOptions = await ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider);
24111
24138
  const routingOutcome = await ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions);
24112
- const isPassport = provider.provider?.isPassport || false;
24113
24139
  return {
24114
24140
  sufficient: sufficient,
24115
24141
  transactionRequirements: transactionRequirements,
24116
24142
  router: {
24117
- isPassport: isPassport,
24118
24143
  availableRoutingOptions: availableRoutingOptions,
24119
24144
  routingOutcome: routingOutcome
24120
24145
  }
@@ -24328,7 +24353,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24328
24353
  let order;
24329
24354
  let spenderAddress = "";
24330
24355
  const gasLimit = (constants).estimatedFulfillmentGasGwei;
24331
- if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were passed in, must pass at least one order", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
24356
+ if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were provided to the orders array. Please provide at least one order.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
24332
24357
  const { id: id, takerFees: takerFees } = orders[0];
24333
24358
  try {
24334
24359
  orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
@@ -24404,9 +24429,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24404
24429
  status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
24405
24430
  transactionHash: approvalResult.transactionHash,
24406
24431
  reason: approvalResult.reason,
24407
- smartCheckoutResult: [
24408
- smartCheckoutResult
24409
- ]
24432
+ smartCheckoutResult: smartCheckoutResult
24410
24433
  };
24411
24434
  try {
24412
24435
  if (unsignedFulfillmentTransactions.length === 0) unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
@@ -24420,22 +24443,16 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24420
24443
  status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
24421
24444
  transactionHash: fulfillmentResult.transactionHash,
24422
24445
  reason: fulfillmentResult.reason,
24423
- smartCheckoutResult: [
24424
- smartCheckoutResult
24425
- ]
24446
+ smartCheckoutResult: smartCheckoutResult
24426
24447
  };
24427
24448
  return {
24428
24449
  status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).SUCCESS,
24429
- smartCheckoutResult: [
24430
- smartCheckoutResult
24431
- ]
24450
+ smartCheckoutResult: smartCheckoutResult
24432
24451
  };
24433
24452
  }
24434
24453
  return {
24435
24454
  status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).INSUFFICIENT_FUNDS,
24436
- smartCheckoutResult: [
24437
- smartCheckoutResult
24438
- ]
24455
+ smartCheckoutResult: smartCheckoutResult
24439
24456
  };
24440
24457
  };
24441
24458
 
@@ -24449,7 +24466,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24449
24466
 
24450
24467
  const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
24451
24468
  let unsignedCancelOrderTransaction;
24452
- if (orderIds.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orderIds were passed in, must pass at least one orderId to cancel", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR);
24469
+ if (orderIds.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orderIds were provided to the orderIds array. Please provide at least one orderId.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR);
24453
24470
  // Update this when bulk cancel is supported
24454
24471
  const orderId = orderIds[0];
24455
24472
  try {
@@ -24510,7 +24527,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
24510
24527
  let orderbook;
24511
24528
  let listing;
24512
24529
  let spenderAddress = "";
24513
- if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were parsed, must parse at least one order", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR);
24530
+ if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were provided to the orders array. Please provide at least one order.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR);
24514
24531
  const { buyToken: buyToken, sellToken: sellToken, makerFees: makerFees } = orders[0];
24515
24532
  let decimals = 18;
24516
24533
  if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
@@ -24557,9 +24574,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
24557
24574
  status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
24558
24575
  transactionHash: approvalResult.transactionHash,
24559
24576
  reason: approvalResult.reason,
24560
- smartCheckoutResult: [
24561
- smartCheckoutResult
24562
- ]
24577
+ smartCheckoutResult: smartCheckoutResult
24563
24578
  };
24564
24579
  const unsignedMessage = ($a7367d01c6e76b1c$export$d62081fac18000c2)(listing.orderHash, listing.orderComponents, listing.actions);
24565
24580
  if (!unsignedMessage) // For sell it is expected the orderbook will always return an unsigned message
@@ -24596,16 +24611,12 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
24596
24611
  orderIds: [
24597
24612
  orderId
24598
24613
  ],
24599
- smartCheckoutResult: [
24600
- smartCheckoutResult
24601
- ]
24614
+ smartCheckoutResult: smartCheckoutResult
24602
24615
  };
24603
24616
  }
24604
24617
  return {
24605
24618
  status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).INSUFFICIENT_FUNDS,
24606
- smartCheckoutResult: [
24607
- smartCheckoutResult
24608
- ]
24619
+ smartCheckoutResult: smartCheckoutResult
24609
24620
  };
24610
24621
  };
24611
24622
 
@@ -25581,27 +25581,27 @@ type WalletNetworkSwitchEvent = {
25581
25581
  */
25582
25582
  type WalletDisconnectWalletEvent = {};
25583
25583
  /**
25584
- * Enum representing possible Primary Revenue Widget event types.
25584
+ * Enum representing possible Sale Widget event types.
25585
25585
  */
25586
- declare enum PrimaryRevenueEventType {
25586
+ declare enum SaleEventType {
25587
25587
  CLOSE_WIDGET = "close-widget",
25588
25588
  SUCCESS = "success",
25589
25589
  FAILURE = "failure",
25590
25590
  REJECTED = "rejected"
25591
25591
  }
25592
25592
  /**
25593
- * Represents a successful primary revenue transaction.
25593
+ * Represents a successful Sale transaction.
25594
25594
  * @property {string} transactionHash - The hash of the successful transaction.
25595
25595
  */
25596
- type PrimaryRevenueSuccess = {
25596
+ type SaleSuccess = {
25597
25597
  [key: string]: string;
25598
25598
  };
25599
25599
  /**
25600
- * Type representing a PrimaryRevenue Widget with type FAILURE.
25600
+ * Type representing a Sale Widget with type FAILURE.
25601
25601
  * @property {string} reason - The reason why the swap failed.
25602
25602
  * @property {number} timestamp - The timestamp of the failed swap.
25603
25603
  */
25604
- type PrimaryRevenueFailed = {
25604
+ type SaleFailed = {
25605
25605
  reason: string;
25606
25606
  timestamp: number;
25607
25607
  };
@@ -25614,16 +25614,16 @@ declare enum IMTBLWidgetEvents {
25614
25614
  IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
25615
25615
  IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
25616
25616
  IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
25617
- IMTBL_PRIMARY_REVENUE_WIDGET_EVENT = "imtbl-primary-revenue-widget"
25617
+ IMTBL_PRIMARY_REVENUE_WIDGET_EVENT = "imtbl-sale-widget"
25618
25618
  }
25619
25619
  /**
25620
25620
  * Represents an event emitted by a widget.
25621
25621
  * @template T - The type of data associated with the event.
25622
- * @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType | PrimaryRevenueEventType} type - The type of the event.
25622
+ * @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType | SaleEventType} type - The type of the event.
25623
25623
  * @property {T} data - The data associated with the event.
25624
25624
  */
25625
25625
  type WidgetEvent<T> = {
25626
- type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType | PrimaryRevenueEventType;
25626
+ type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType | SaleEventType;
25627
25627
  data: T;
25628
25628
  };
25629
25629
  /**
@@ -25652,7 +25652,7 @@ declare global {
25652
25652
  'imtbl-swap': ImtblSwapProps;
25653
25653
  'imtbl-bridge': ImtblBridgeProps;
25654
25654
  'imtbl-onramp': ImtblOnRampProps;
25655
- 'imtbl-primary-revenue': ImtblPrimaryRevenueProps;
25655
+ 'imtbl-sale': ImtblSaleProps;
25656
25656
  }
25657
25657
  }
25658
25658
  interface ImmutableWebComponent {
@@ -25734,9 +25734,9 @@ interface ImtblOnRampProps extends React.DetailedHTMLProps<React.HTMLAttributes<
25734
25734
  contractAddress?: string;
25735
25735
  }
25736
25736
  /**
25737
- * Interface for the properties of the primary revenue web component.
25737
+ * Interface for the properties of the Sale web component.
25738
25738
  * Extends the React.DetailedHTMLProps interface to inherit HTML attributes for an HTMLElement.
25739
- * @interface ImtblPrimaryRevenueProps
25739
+ * @interface ImtblSaleProps
25740
25740
  * @extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
25741
25741
  * @property {string | undefined} widgetConfig - Optional string representing the widget configuration.
25742
25742
  * @property {string | undefined} amount - The amount to be paid.
@@ -25745,7 +25745,7 @@ interface ImtblOnRampProps extends React.DetailedHTMLProps<React.HTMLAttributes<
25745
25745
  * @property {string | undefined} env - The environment to use: SANDBOX, DEV, PRODUCTION, ...
25746
25746
  * @property {string | undefined} environmentId - The environment id from Immutable Hub.
25747
25747
  */
25748
- interface ImtblPrimaryRevenueProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
25748
+ interface ImtblSaleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
25749
25749
  widgetConfig?: string;
25750
25750
  amount: string;
25751
25751
  products: string;
@@ -25853,4 +25853,4 @@ interface OnRampReactProps {
25853
25853
  */
25854
25854
  declare function OnRampReact(props: OnRampReactProps): JSX.Element;
25855
25855
 
25856
- export { BridgeEventType, BridgeFailed, BridgeReact, BridgeReactProps, BridgeSuccess, CheckoutWidgetTagNames, CheckoutWidgets, CheckoutWidgetsConfig, ConnectEventType, ConnectReact, ConnectReactProps, ConnectionFailed, ConnectionSuccess, IMTBLWidgetEvents, ImtblBridgeProps, ImtblConnectProps, ImtblOnRampProps, ImtblPrimaryRevenueProps, ImtblSwapProps, ImtblWalletProps, OnRampEventType, OnRampFailed, OnRampReact, OnRampReactProps, OnRampSuccess, OrchestrationEventType, PrimaryRevenueEventType, PrimaryRevenueFailed, PrimaryRevenueSuccess, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, SemanticVersion, SwapEventType, SwapFailed, SwapReact, SwapReactProps, SwapRejected, SwapSuccess, UpdateConfig, WalletDisconnectWalletEvent, WalletEventType, WalletNetworkSwitchEvent, WalletReact, WalletReactProps, WidgetEvent, WidgetTheme };
25856
+ export { BridgeEventType, BridgeFailed, BridgeReact, BridgeReactProps, BridgeSuccess, CheckoutWidgetTagNames, CheckoutWidgets, CheckoutWidgetsConfig, ConnectEventType, ConnectReact, ConnectReactProps, ConnectionFailed, ConnectionSuccess, IMTBLWidgetEvents, ImtblBridgeProps, ImtblConnectProps, ImtblOnRampProps, ImtblSaleProps, ImtblSwapProps, ImtblWalletProps, OnRampEventType, OnRampFailed, OnRampReact, OnRampReactProps, OnRampSuccess, OrchestrationEventType, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, SaleEventType, SaleFailed, SaleSuccess, SemanticVersion, SwapEventType, SwapFailed, SwapReact, SwapReactProps, SwapRejected, SwapSuccess, UpdateConfig, WalletDisconnectWalletEvent, WalletEventType, WalletNetworkSwitchEvent, WalletReact, WalletReactProps, WidgetEvent, WidgetTheme };
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
25
25
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
26
26
 
27
27
 
28
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.25.0";
28
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.0";
29
29
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
30
30
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31
31
 
@@ -159,7 +159,7 @@ var $207ed853f11d19d5$export$5a0ace85cae72d45;
159
159
  IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
160
160
  IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
161
161
  IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
162
- IMTBLWidgetEvents["IMTBL_PRIMARY_REVENUE_WIDGET_EVENT"] = "imtbl-primary-revenue-widget";
162
+ IMTBLWidgetEvents["IMTBL_PRIMARY_REVENUE_WIDGET_EVENT"] = "imtbl-sale-widget";
163
163
  })($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
164
164
 
165
165
 
@@ -199,18 +199,18 @@ $parcel$export($53d219e7f6bf0cd6$exports, "SwapEventType", () => $53d219e7f6bf0c
199
199
  })($53d219e7f6bf0cd6$export$140a49745ab55563 || ($53d219e7f6bf0cd6$export$140a49745ab55563 = {}));
200
200
 
201
201
 
202
- var $8c83f59522c4ca40$exports = {};
202
+ var $9b3189b6b155842e$exports = {};
203
203
 
204
- $parcel$export($8c83f59522c4ca40$exports, "PrimaryRevenueEventType", () => $8c83f59522c4ca40$export$b33478ffb988bd5e);
204
+ $parcel$export($9b3189b6b155842e$exports, "SaleEventType", () => $9b3189b6b155842e$export$881881ffb3bd733e);
205
205
  /**
206
- * Enum representing possible Primary Revenue Widget event types.
207
- */ var $8c83f59522c4ca40$export$b33478ffb988bd5e;
208
- (function(PrimaryRevenueEventType) {
209
- PrimaryRevenueEventType["CLOSE_WIDGET"] = "close-widget";
210
- PrimaryRevenueEventType["SUCCESS"] = "success";
211
- PrimaryRevenueEventType["FAILURE"] = "failure";
212
- PrimaryRevenueEventType["REJECTED"] = "rejected";
213
- })($8c83f59522c4ca40$export$b33478ffb988bd5e || ($8c83f59522c4ca40$export$b33478ffb988bd5e = {}));
206
+ * Enum representing possible Sale Widget event types.
207
+ */ var $9b3189b6b155842e$export$881881ffb3bd733e;
208
+ (function(SaleEventType) {
209
+ SaleEventType["CLOSE_WIDGET"] = "close-widget";
210
+ SaleEventType["SUCCESS"] = "success";
211
+ SaleEventType["FAILURE"] = "failure";
212
+ SaleEventType["REJECTED"] = "rejected";
213
+ })($9b3189b6b155842e$export$881881ffb3bd733e || ($9b3189b6b155842e$export$881881ffb3bd733e = {}));
214
214
 
215
215
 
216
216
  var $15cc9e120aa6f3bf$exports = {};
@@ -446,4 +446,4 @@ function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
446
446
  });
447
447
  }
448
448
 
449
- export { $15cc9e120aa6f3bf$export$d1bfa21f7c76447a as BridgeEventType, $1f969328e5988c99$export$30f61ebf204c69f6 as BridgeReact, $045213b18e9f1f94$export$75be0f6af9650f2c as CheckoutWidgetTagNames, $430e3eda76fa4d5f$export$af210a0808087845 as CheckoutWidgets, $a85ecdbd885c58ad$export$e72e7f9969a47dd3 as ConnectEventType, $f2083cd30e2f5c56$export$49d62957f420a1e2 as ConnectReact, $207ed853f11d19d5$export$5a0ace85cae72d45 as IMTBLWidgetEvents, $d882ddc5600b1284$export$66ec39c0924078d8 as OnRampEventType, $f94f63f2c041a04c$export$9e363c61ea99bbb4 as OnRampReact, $ad06b030b1a3ba34$export$b80d2daf830437b9 as OrchestrationEventType, $8c83f59522c4ca40$export$b33478ffb988bd5e as PrimaryRevenueEventType, $53d219e7f6bf0cd6$export$140a49745ab55563 as SwapEventType, $a4fbb8e3a6aeff58$export$971e031379577f4 as SwapReact, $430e3eda76fa4d5f$export$bf1548ba7e61c17f as UpdateConfig, $77b6aac5c353d4a9$export$d9be06b70b28c742 as WalletEventType, $89d55ace0f8f1c07$export$ceaac94f34dba154 as WalletReact, $045213b18e9f1f94$export$c88931fdc51854eb as WidgetTheme };
449
+ export { $15cc9e120aa6f3bf$export$d1bfa21f7c76447a as BridgeEventType, $1f969328e5988c99$export$30f61ebf204c69f6 as BridgeReact, $045213b18e9f1f94$export$75be0f6af9650f2c as CheckoutWidgetTagNames, $430e3eda76fa4d5f$export$af210a0808087845 as CheckoutWidgets, $a85ecdbd885c58ad$export$e72e7f9969a47dd3 as ConnectEventType, $f2083cd30e2f5c56$export$49d62957f420a1e2 as ConnectReact, $207ed853f11d19d5$export$5a0ace85cae72d45 as IMTBLWidgetEvents, $d882ddc5600b1284$export$66ec39c0924078d8 as OnRampEventType, $f94f63f2c041a04c$export$9e363c61ea99bbb4 as OnRampReact, $ad06b030b1a3ba34$export$b80d2daf830437b9 as OrchestrationEventType, $9b3189b6b155842e$export$881881ffb3bd733e as SaleEventType, $53d219e7f6bf0cd6$export$140a49745ab55563 as SwapEventType, $a4fbb8e3a6aeff58$export$971e031379577f4 as SwapReact, $430e3eda76fa4d5f$export$bf1548ba7e61c17f as UpdateConfig, $77b6aac5c353d4a9$export$d9be06b70b28c742 as WalletEventType, $89d55ace0f8f1c07$export$ceaac94f34dba154 as WalletReact, $045213b18e9f1f94$export$c88931fdc51854eb as WidgetTheme };
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
16
16
  chainID,
17
17
  coreContractAddress,
18
18
  registrationContractAddress,
19
- sdkVersion: 'ts-immutable-sdk-0.25.0',
19
+ sdkVersion: 'ts-immutable-sdk-0.27.0',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build