@imtbl/sdk 0.22.0-alpha.1 → 0.22.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.
@@ -9,7 +9,6 @@ import { keccak256 as keccak256$1 } from '@ethersproject/solidity';
9
9
  import { SwapRouter } from '@uniswap/router-sdk';
10
10
  import FormData from 'form-data';
11
11
  import { Seaport as Seaport$1 } from '@opensea/seaport-js';
12
- import { parseUnits } from 'ethers/lib/utils';
13
12
 
14
13
  var Environment$1;
15
14
  (function (Environment) {
@@ -19816,7 +19815,7 @@ class APIError extends Error {
19816
19815
 
19817
19816
  /* eslint-disable implicit-arrow-linebreak */
19818
19817
  const defaultHeaders = {
19819
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.0-alpha.1',
19818
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.1',
19820
19819
  };
19821
19820
  /**
19822
19821
  * createAPIConfiguration to create a custom Configuration
@@ -23366,7 +23365,6 @@ const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, a
23366
23365
 
23367
23366
 
23368
23367
 
23369
-
23370
23368
  const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
23371
23369
  const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
23372
23370
  const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
@@ -23378,7 +23376,7 @@ const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
23378
23376
  };
23379
23377
  const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
23380
23378
  const feeToken = orderFee.amount;
23381
- const bnFeeAmount = (parseUnits)(feeToken.token, decimals);
23379
+ const bnFeeAmount = (utils).parseUnits(feeToken.token, decimals);
23382
23380
  return bnFeeAmount;
23383
23381
  };
23384
23382
  const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
@@ -23610,7 +23608,6 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
23610
23608
 
23611
23609
 
23612
23610
 
23613
-
23614
23611
  const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
23615
23612
  type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
23616
23613
  id: id,
@@ -23618,7 +23615,7 @@ const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderA
23618
23615
  spenderAddress: spenderAddress
23619
23616
  });
23620
23617
  const $9085b221b72ac69e$export$586d02673c66d423 = (buyToken, decimals = 18)=>{
23621
- const bnAmount = (parseUnits)(buyToken.amount, decimals);
23618
+ const bnAmount = (utils).parseUnits(buyToken.amount, decimals);
23622
23619
  if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return {
23623
23620
  type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE,
23624
23621
  amount: bnAmount.toString()
@@ -23799,11 +23796,11 @@ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements)
23799
23796
  const itemRequirements = requirements.map((itemRequirementParam, index)=>{
23800
23797
  if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return {
23801
23798
  ...itemRequirementParam,
23802
- amount: (parseUnits)(itemRequirementParam.amount, 18)
23799
+ amount: (utils).parseUnits(itemRequirementParam.amount, 18)
23803
23800
  };
23804
23801
  if (itemRequirementParam.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return {
23805
23802
  ...itemRequirementParam,
23806
- amount: (parseUnits)(itemRequirementParam.amount, decimals[index])
23803
+ amount: (utils).parseUnits(itemRequirementParam.amount, decimals[index])
23807
23804
  };
23808
23805
  return itemRequirementParam;
23809
23806
  });
@@ -25580,6 +25580,31 @@ type WalletNetworkSwitchEvent = {
25580
25580
  * Represents an event that is triggered when a wallet is disconnected.
25581
25581
  */
25582
25582
  type WalletDisconnectWalletEvent = {};
25583
+ /**
25584
+ * Enum representing possible Primary Revenue Widget event types.
25585
+ */
25586
+ declare enum PrimaryRevenueEventType {
25587
+ CLOSE_WIDGET = "close-widget",
25588
+ SUCCESS = "success",
25589
+ FAILURE = "failure",
25590
+ REJECTED = "rejected"
25591
+ }
25592
+ /**
25593
+ * Represents a successful primary revenue transaction.
25594
+ * @property {string} transactionHash - The hash of the successful transaction.
25595
+ */
25596
+ type PrimaryRevenueSuccess = {
25597
+ [key: string]: string;
25598
+ };
25599
+ /**
25600
+ * Type representing a PrimaryRevenue Widget with type FAILURE.
25601
+ * @property {string} reason - The reason why the swap failed.
25602
+ * @property {number} timestamp - The timestamp of the failed swap.
25603
+ */
25604
+ type PrimaryRevenueFailed = {
25605
+ reason: string;
25606
+ timestamp: number;
25607
+ };
25583
25608
  /**
25584
25609
  * Enum representing the events emitted by the widgets.
25585
25610
  */
@@ -25588,16 +25613,17 @@ declare enum IMTBLWidgetEvents {
25588
25613
  IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
25589
25614
  IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
25590
25615
  IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
25591
- IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget"
25616
+ IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
25617
+ IMTBL_PRIMARY_REVENUE_WIDGET_EVENT = "imtbl-primary-revenue-widget"
25592
25618
  }
25593
25619
  /**
25594
25620
  * Represents an event emitted by a widget.
25595
25621
  * @template T - The type of data associated with the event.
25596
- * @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType} type - The type of the event.
25622
+ * @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType | PrimaryRevenueEventType} type - The type of the event.
25597
25623
  * @property {T} data - The data associated with the event.
25598
25624
  */
25599
25625
  type WidgetEvent<T> = {
25600
- type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType;
25626
+ type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType | PrimaryRevenueEventType;
25601
25627
  data: T;
25602
25628
  };
25603
25629
  /**
@@ -25626,6 +25652,7 @@ declare global {
25626
25652
  'imtbl-swap': ImtblSwapProps;
25627
25653
  'imtbl-bridge': ImtblBridgeProps;
25628
25654
  'imtbl-onramp': ImtblOnRampProps;
25655
+ 'imtbl-primary-revenue': ImtblPrimaryRevenueProps;
25629
25656
  }
25630
25657
  }
25631
25658
  interface ImmutableWebComponent {
@@ -25706,6 +25733,26 @@ interface ImtblOnRampProps extends React.DetailedHTMLProps<React.HTMLAttributes<
25706
25733
  amount?: string;
25707
25734
  contractAddress?: string;
25708
25735
  }
25736
+ /**
25737
+ * Interface for the properties of the primary revenue web component.
25738
+ * Extends the React.DetailedHTMLProps interface to inherit HTML attributes for an HTMLElement.
25739
+ * @interface ImtblPrimaryRevenueProps
25740
+ * @extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
25741
+ * @property {string | undefined} widgetConfig - Optional string representing the widget configuration.
25742
+ * @property {string | undefined} amount - The amount to be paid.
25743
+ * @property {string | undefined} products - A base64 encoded string of the array of items to be purchased.
25744
+ * @property {string | undefined} fromContractAddress - The contract address of the token to pay with.
25745
+ * @property {string | undefined} env - The environment to use: SANDBOX, DEV, PRODUCTION, ...
25746
+ * @property {string | undefined} environmentId - The environment id from Immutable Hub.
25747
+ */
25748
+ interface ImtblPrimaryRevenueProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
25749
+ widgetConfig?: string;
25750
+ amount: string;
25751
+ products: string;
25752
+ fromContractAddress: string;
25753
+ env: string;
25754
+ environmentId: string;
25755
+ }
25709
25756
  /**
25710
25757
  * Interface representing the props for the Bridge Widget component.
25711
25758
  * @interface BridgeReactProps
@@ -25806,4 +25853,4 @@ interface OnRampReactProps {
25806
25853
  */
25807
25854
  declare function OnRampReact(props: OnRampReactProps): JSX.Element;
25808
25855
 
25809
- export { BridgeEventType, BridgeFailed, BridgeReact, BridgeReactProps, BridgeSuccess, CheckoutWidgetTagNames, CheckoutWidgets, CheckoutWidgetsConfig, ConnectEventType, ConnectReact, ConnectReactProps, ConnectionFailed, ConnectionSuccess, IMTBLWidgetEvents, ImtblBridgeProps, ImtblConnectProps, ImtblOnRampProps, ImtblSwapProps, ImtblWalletProps, OnRampEventType, OnRampFailed, OnRampReact, OnRampReactProps, OnRampSuccess, OrchestrationEventType, 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, 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 };
@@ -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.22.0-alpha.1";
7
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.22.1";
8
8
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
9
9
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
10
10
 
@@ -69,6 +69,7 @@ var $207ed853f11d19d5$export$5a0ace85cae72d45;
69
69
  IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
70
70
  IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
71
71
  IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
72
+ IMTBLWidgetEvents["IMTBL_PRIMARY_REVENUE_WIDGET_EVENT"] = "imtbl-primary-revenue-widget";
72
73
  })($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
73
74
 
74
75
 
@@ -108,6 +109,20 @@ $parcel$export($53d219e7f6bf0cd6$exports, "SwapEventType", () => $53d219e7f6bf0c
108
109
  })($53d219e7f6bf0cd6$export$140a49745ab55563 || ($53d219e7f6bf0cd6$export$140a49745ab55563 = {}));
109
110
 
110
111
 
112
+ var $8c83f59522c4ca40$exports = {};
113
+
114
+ $parcel$export($8c83f59522c4ca40$exports, "PrimaryRevenueEventType", () => $8c83f59522c4ca40$export$b33478ffb988bd5e);
115
+ /**
116
+ * Enum representing possible Primary Revenue Widget event types.
117
+ */ var $8c83f59522c4ca40$export$b33478ffb988bd5e;
118
+ (function(PrimaryRevenueEventType) {
119
+ PrimaryRevenueEventType["CLOSE_WIDGET"] = "close-widget";
120
+ PrimaryRevenueEventType["SUCCESS"] = "success";
121
+ PrimaryRevenueEventType["FAILURE"] = "failure";
122
+ PrimaryRevenueEventType["REJECTED"] = "rejected";
123
+ })($8c83f59522c4ca40$export$b33478ffb988bd5e || ($8c83f59522c4ca40$export$b33478ffb988bd5e = {}));
124
+
125
+
111
126
  var $15cc9e120aa6f3bf$exports = {};
112
127
 
113
128
  $parcel$export($15cc9e120aa6f3bf$exports, "BridgeEventType", () => $15cc9e120aa6f3bf$export$d1bfa21f7c76447a);
@@ -362,4 +377,4 @@ function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
362
377
  });
363
378
  }
364
379
 
365
- 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, $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 };
380
+ 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 };
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
16
16
  chainID,
17
17
  coreContractAddress,
18
18
  registrationContractAddress,
19
- sdkVersion: 'ts-immutable-sdk-0.22.0-alpha.1',
19
+ sdkVersion: 'ts-immutable-sdk-0.22.1',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build