@imtbl/sdk 0.17.2 → 0.17.3

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.d.ts CHANGED
@@ -14513,14 +14513,45 @@ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverri
14513
14513
  * A type representing various remotely defined configurations which are
14514
14514
  * accessible via the Checkout config and configured based on the Environment.
14515
14515
  * @property {DexConfig} dex - The config used for the DEX.
14516
+ * @property {OnRampConfig} onramp - The config used for the OnRamp
14516
14517
  * @property {AllowedNetworkConfig[]} allowedNetworks - An array representing the allowed networks.
14517
14518
  * @property {GasEstimateTokenConfig | undefined} gasEstimateTokens - The config for the tokens used to estimate gas.
14518
14519
  */
14519
14520
  type RemoteConfiguration = {
14520
14521
  dex: DexConfig;
14522
+ onramp: OnRampConfig;
14521
14523
  allowedNetworks: AllowedNetworkConfig[];
14522
14524
  gasEstimateTokens?: GasEstimateTokenConfig;
14523
14525
  };
14526
+ /**
14527
+ * A type representing the fee structure for an OnRamp provider
14528
+ * @property {string | undefined} minPercentage - minimum percentage fee shown if a fee range is provided
14529
+ * @property {string | undefined} maxPercentage - maximum percentage fee shown if a fee range is provided
14530
+ * @property {string | undefined} feePercentage - specific fee percentage shown if there is no range provided
14531
+ */
14532
+ type OnRampProviderFees = {
14533
+ minPercentage?: string;
14534
+ maxPercentage?: string;
14535
+ feePercentage?: string;
14536
+ };
14537
+ /**
14538
+ * A type representing the configuration for the OnRamp for a specific provider.
14539
+ * @property {string} publishableApiKey - on ramp provider publishable api-key
14540
+ * @property {TokenInfo[]} tokens - allowed tokens for the OnRamp provider
14541
+ * @property {OnRampProviderFees} fees - on ramp provider transaction fees
14542
+ */
14543
+ type OnRampProviderConfig = {
14544
+ publishableApiKey: string;
14545
+ tokens: TokenInfo[];
14546
+ fees: OnRampProviderFees;
14547
+ };
14548
+ /**
14549
+ * A type representing the configuration for the OnRamp.
14550
+ * @property {OnRampProviderConfig} transak - OnRamp config for Transak provider
14551
+ */
14552
+ type OnRampConfig = {
14553
+ [key: string]: OnRampProviderConfig;
14554
+ };
14524
14555
  /**
14525
14556
  * A type representing the configuration for the DEX.
14526
14557
  * @property {ExchangeOverrides | undefined} overrides - The DEX overrides.
@@ -14851,7 +14882,8 @@ interface GetTokenAllowListResult {
14851
14882
  declare enum TokenFilterTypes {
14852
14883
  ALL = "all",
14853
14884
  SWAP = "swap",
14854
- BRIDGE = "bridge"
14885
+ BRIDGE = "bridge",
14886
+ ONRAMP = "onramp"
14855
14887
  }
14856
14888
  /**
14857
14889
  * Interface representing a token filter that can be used to exclude certain tokens.
@@ -14964,6 +14996,29 @@ type NetworkDetails = {
14964
14996
  blockExplorerUrls?: string[];
14965
14997
  };
14966
14998
  type NetworkMap = Map<ChainId, NetworkDetails>;
14999
+ /**
15000
+ * An enum representing the type of exchange.
15001
+ * @enum {string}
15002
+ * @property {string} ONRAMP - The exchange type for transacting.
15003
+ */
15004
+ declare enum ExchangeType {
15005
+ ONRAMP = "onramp"
15006
+ }
15007
+ /**
15008
+ * Interface representing the result of {@link Checkout.createFiatRampUrl}.
15009
+ * @property {ExchangeType} exchangeType - The ExchangeType specified.
15010
+ * @property {Web3Provider} web3Provider - The Web3Provider used to exchange.
15011
+ * @property {string | undefined} tokenAmount - The token amount specified as input.
15012
+ * @property {string | undefined} tokenAddress - The token address specified as input.
15013
+ * @property {Passport | undefined} passport - The Passport instance specified as input.
15014
+ */
15015
+ interface FiatRampParams {
15016
+ exchangeType: ExchangeType;
15017
+ web3Provider: Web3Provider;
15018
+ tokenAmount?: string;
15019
+ tokenAddress?: string;
15020
+ passport?: Passport;
15021
+ }
14967
15022
  /**
14968
15023
  * Enum representing different types of errors that can occur during the checkout process.
14969
15024
  */
@@ -15032,8 +15087,27 @@ declare class CheckoutConfiguration {
15032
15087
  readonly networkMap: NetworkMap;
15033
15088
  constructor(config: CheckoutModuleConfiguration);
15034
15089
  }
15090
+ interface FiatRampWidgetParams {
15091
+ exchangeType: ExchangeType;
15092
+ isPassport: boolean;
15093
+ walletAddress?: string;
15094
+ tokenAmount?: string;
15095
+ tokenSymbol?: string;
15096
+ email?: string;
15097
+ }
15098
+ declare class FiatRampService {
15099
+ readonly config: CheckoutConfiguration;
15100
+ /**
15101
+ * Constructs a new instance of the FiatRampService class.
15102
+ * @param {CheckoutConfiguration} config - The config required for the FiatRampService.
15103
+ */
15104
+ constructor(config: CheckoutConfiguration);
15105
+ feeEstimate(): Promise<OnRampProviderFees>;
15106
+ createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
15107
+ }
15035
15108
  declare class Checkout {
15036
15109
  readonly config: CheckoutConfiguration;
15110
+ readonly fiatRampService: FiatRampService;
15037
15111
  /**
15038
15112
  * Constructs a new instance of the CheckoutModule class.
15039
15113
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
@@ -15138,6 +15212,17 @@ declare class Checkout {
15138
15212
  * @returns {Promise<GasEstimateSwapResult | GasEstimateBridgeToL2Result>} - A promise that resolves to the gas estimation result.
15139
15213
  */
15140
15214
  gasEstimate(params: GasEstimateParams): Promise<GasEstimateSwapResult | GasEstimateBridgeToL2Result>;
15215
+ /**
15216
+ * Creates and returns a URL for the fiat ramp widget.
15217
+ * @param {FiatRampParams} params - The parameters for creating the url.
15218
+ * @returns {Promise<string>} - A promise that resolves to a string url.
15219
+ */
15220
+ createFiatRampUrl(params: FiatRampParams): Promise<string>;
15221
+ /**
15222
+ * Fetches fiat ramp fee estimations.
15223
+ * @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
15224
+ */
15225
+ getExchangeFeeEstimate(): Promise<OnRampProviderFees>;
15141
15226
  }
15142
15227
 
15143
15228
  type checkout_sdk_d_AllowedNetworkConfig = AllowedNetworkConfig;
@@ -15160,6 +15245,9 @@ type checkout_sdk_d_ConnectParams = ConnectParams;
15160
15245
  type checkout_sdk_d_ConnectResult = ConnectResult;
15161
15246
  type checkout_sdk_d_DexConfig = DexConfig;
15162
15247
  type checkout_sdk_d_ErrorType = ErrorType;
15248
+ type checkout_sdk_d_ExchangeType = ExchangeType;
15249
+ declare const checkout_sdk_d_ExchangeType: typeof ExchangeType;
15250
+ type checkout_sdk_d_FiatRampParams = FiatRampParams;
15163
15251
  type checkout_sdk_d_GasEstimateBridgeToL2Result = GasEstimateBridgeToL2Result;
15164
15252
  type checkout_sdk_d_GasEstimateParams = GasEstimateParams;
15165
15253
  type checkout_sdk_d_GasEstimateSwapResult = GasEstimateSwapResult;
@@ -15223,6 +15311,8 @@ declare namespace checkout_sdk_d {
15223
15311
  checkout_sdk_d_ConnectResult as ConnectResult,
15224
15312
  checkout_sdk_d_DexConfig as DexConfig,
15225
15313
  checkout_sdk_d_ErrorType as ErrorType,
15314
+ checkout_sdk_d_ExchangeType as ExchangeType,
15315
+ checkout_sdk_d_FiatRampParams as FiatRampParams,
15226
15316
  checkout_sdk_d_GasEstimateBridgeToL2Result as GasEstimateBridgeToL2Result,
15227
15317
  checkout_sdk_d_GasEstimateParams as GasEstimateParams,
15228
15318
  checkout_sdk_d_GasEstimateSwapResult as GasEstimateSwapResult,
@@ -29703,7 +29793,8 @@ declare enum CheckoutWidgetTagNames {
29703
29793
  CONNECT = "imtbl-connect",
29704
29794
  WALLET = "imtbl-wallet",
29705
29795
  SWAP = "imtbl-swap",
29706
- BRIDGE = "imtbl-bridge"
29796
+ BRIDGE = "imtbl-bridge",
29797
+ ONRAMP = "imtbl-onramp"
29707
29798
  }
29708
29799
  /**
29709
29800
  * Represents the version of the Checkout Widgets to use defaults to (0.1.9-alpha)
@@ -29731,6 +29822,7 @@ type SemanticVersion = {
29731
29822
  * @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
29732
29823
  * @property {Environment | undefined} environment - The environment configuration (default: "SANDBOX")
29733
29824
  * @property {SemanticVersion | undefined} version - The version of the checkout widgets js file to use (default: "0.1.0")
29825
+ * @property {boolean | undefined} isOnRampEnabled - Enable on-ramp top-up method (default: "true")
29734
29826
  * @property {boolean | undefined} isSwapEnabled - Enable swap top-up method (default: "true")
29735
29827
  * @property {boolean | undefined} isBridgeEnabled - Enable bridge top-up method (default: "true")
29736
29828
  */
@@ -29738,6 +29830,7 @@ type CheckoutWidgetsConfig = {
29738
29830
  theme?: WidgetTheme;
29739
29831
  environment?: Environment;
29740
29832
  version?: SemanticVersion;
29833
+ isOnRampEnabled?: boolean;
29741
29834
  isSwapEnabled?: boolean;
29742
29835
  isBridgeEnabled?: boolean;
29743
29836
  };
@@ -29803,6 +29896,30 @@ type ConnectionSuccess = {
29803
29896
  type ConnectionFailed = {
29804
29897
  reason: string;
29805
29898
  };
29899
+ /**
29900
+ * Enum of possible OnRamp Widget event types.
29901
+ */
29902
+ declare enum OnRampEventType {
29903
+ CLOSE_WIDGET = "close-widget",
29904
+ SUCCESS = "success",
29905
+ FAILURE = "failure"
29906
+ }
29907
+ /**
29908
+ * Represents a successful on-ramp transaction.
29909
+ * @property {string} transactionHash - The transaction hash of the successful transaction.
29910
+ */
29911
+ type OnRampSuccess = {
29912
+ transactionHash: string;
29913
+ };
29914
+ /**
29915
+ * Type representing a On-ramp Widget with type FAILURE.
29916
+ * @property {string} reason - The reason why the on-ramp failed.
29917
+ * @property {number} timestamp - The timestamp of the failed transaction.
29918
+ */
29919
+ type OnRampFailed = {
29920
+ reason: string;
29921
+ timestamp: number;
29922
+ };
29806
29923
  /**
29807
29924
  * Enum representing different types of orchestration events.
29808
29925
  */
@@ -29920,16 +30037,17 @@ declare enum IMTBLWidgetEvents {
29920
30037
  IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
29921
30038
  IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
29922
30039
  IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
29923
- IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget"
30040
+ IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
30041
+ IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget"
29924
30042
  }
29925
30043
  /**
29926
30044
  * Represents an event emitted by a widget.
29927
30045
  * @template T - The type of data associated with the event.
29928
- * @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType} type - The type of the event.
30046
+ * @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType} type - The type of the event.
29929
30047
  * @property {T} data - The data associated with the event.
29930
30048
  */
29931
30049
  type WidgetEvent<T> = {
29932
- type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType;
30050
+ type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType;
29933
30051
  data: T;
29934
30052
  };
29935
30053
  /**
@@ -29945,7 +30063,8 @@ type WidgetEvent<T> = {
29945
30063
  * @property {ImtblWalletProps} 'imtbl-wallet' - Props for the 'imtbl-wallet' component.
29946
30064
  * @property {ImtblSwapProps} 'imtbl-swap' - Props for the 'imtbl-swap' component.
29947
30065
  * @property {ImtblBridgeProps} 'imtbl-bridge' - Props for the 'imtbl-bridge' component.
29948
- */
30066
+ * @property {ImtblOnRampProps} 'imtbl-onramp' - Props for the 'imtbl-onramp' component.
30067
+ * */
29949
30068
  declare global {
29950
30069
  interface Window {
29951
30070
  ImtblCheckoutWidgetConfig: any;
@@ -29956,6 +30075,7 @@ declare global {
29956
30075
  'imtbl-wallet': ImtblWalletProps;
29957
30076
  'imtbl-swap': ImtblSwapProps;
29958
30077
  'imtbl-bridge': ImtblBridgeProps;
30078
+ 'imtbl-onramp': ImtblOnRampProps;
29959
30079
  }
29960
30080
  }
29961
30081
  interface ImmutableWebComponent {
@@ -30020,6 +30140,22 @@ interface ImtblBridgeProps extends React.DetailedHTMLProps<React.HTMLAttributes<
30020
30140
  fromContractAddress?: string;
30021
30141
  amount?: string;
30022
30142
  }
30143
+ /**
30144
+ * Interface for the properties of a bridge web component.
30145
+ * Extends the React.DetailedHTMLProps interface to inherit HTML attributes for the component's root element.
30146
+ * @interface ImtblOnRampProps
30147
+ * @extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
30148
+ * @property {string | undefined} walletProvider - The preferred wallet provider to connect to.
30149
+ * @property {string | undefined} widgetConfig - The configuration for the bridge widget.
30150
+ * @property {string | undefined} amount - The amount to onramp.
30151
+ * @property {string | undefined} contractAddress - The contract address of the token to on ramp.
30152
+ */
30153
+ interface ImtblOnRampProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
30154
+ walletProvider?: string;
30155
+ widgetConfig?: string;
30156
+ amount?: string;
30157
+ contractAddress?: string;
30158
+ }
30023
30159
  /**
30024
30160
  * Interface representing the props for the Bridge Widget component.
30025
30161
  * @interface BridgeReactProps
@@ -30097,6 +30233,28 @@ interface WalletReactProps {
30097
30233
  * @returns {JSX.Element} - The rendered Wallet Widget component.
30098
30234
  */
30099
30235
  declare function WalletReact(props: WalletReactProps): JSX.Element;
30236
+ /**
30237
+ * Interface representing the props for the on-ramp Widget component.
30238
+ * @interface OnRampReactProps
30239
+ * @property {WalletProviderName | undefined} walletProvider - The name of the wallet provider.
30240
+ * @property {Web3Provider | undefined} provider - The Web3 provider.
30241
+ * @property {Passport | undefined} passport - The Passport instance to create a Web3Provider.
30242
+ * @property {string | undefined} amount - The amount.
30243
+ * @property {string | undefined} contractAddress - The contract address of the token to on ramp
30244
+ */
30245
+ interface OnRampReactProps {
30246
+ walletProvider?: WalletProviderName;
30247
+ provider?: Web3Provider;
30248
+ passport?: Passport;
30249
+ amount?: string;
30250
+ contractAddress?: string;
30251
+ }
30252
+ /**
30253
+ * A React functional component that renders the Checkout on-ramp Widget.
30254
+ * @param {OnRampReactProps} props - The props for the On-ramp Widget component.
30255
+ * @returns {JSX.Element} - The rendered Bridge Widget component.
30256
+ */
30257
+ declare function OnRampReact(props: OnRampReactProps): JSX.Element;
30100
30258
 
30101
30259
  type checkout_widgets_d_BridgeEventType = BridgeEventType;
30102
30260
  declare const checkout_widgets_d_BridgeEventType: typeof BridgeEventType;
@@ -30118,8 +30276,15 @@ type checkout_widgets_d_IMTBLWidgetEvents = IMTBLWidgetEvents;
30118
30276
  declare const checkout_widgets_d_IMTBLWidgetEvents: typeof IMTBLWidgetEvents;
30119
30277
  type checkout_widgets_d_ImtblBridgeProps = ImtblBridgeProps;
30120
30278
  type checkout_widgets_d_ImtblConnectProps = ImtblConnectProps;
30279
+ type checkout_widgets_d_ImtblOnRampProps = ImtblOnRampProps;
30121
30280
  type checkout_widgets_d_ImtblSwapProps = ImtblSwapProps;
30122
30281
  type checkout_widgets_d_ImtblWalletProps = ImtblWalletProps;
30282
+ type checkout_widgets_d_OnRampEventType = OnRampEventType;
30283
+ declare const checkout_widgets_d_OnRampEventType: typeof OnRampEventType;
30284
+ type checkout_widgets_d_OnRampFailed = OnRampFailed;
30285
+ declare const checkout_widgets_d_OnRampReact: typeof OnRampReact;
30286
+ type checkout_widgets_d_OnRampReactProps = OnRampReactProps;
30287
+ type checkout_widgets_d_OnRampSuccess = OnRampSuccess;
30123
30288
  type checkout_widgets_d_OrchestrationEventType = OrchestrationEventType;
30124
30289
  declare const checkout_widgets_d_OrchestrationEventType: typeof OrchestrationEventType;
30125
30290
  type checkout_widgets_d_RequestBridgeEvent = RequestBridgeEvent;
@@ -30163,8 +30328,14 @@ declare namespace checkout_widgets_d {
30163
30328
  checkout_widgets_d_IMTBLWidgetEvents as IMTBLWidgetEvents,
30164
30329
  checkout_widgets_d_ImtblBridgeProps as ImtblBridgeProps,
30165
30330
  checkout_widgets_d_ImtblConnectProps as ImtblConnectProps,
30331
+ checkout_widgets_d_ImtblOnRampProps as ImtblOnRampProps,
30166
30332
  checkout_widgets_d_ImtblSwapProps as ImtblSwapProps,
30167
30333
  checkout_widgets_d_ImtblWalletProps as ImtblWalletProps,
30334
+ checkout_widgets_d_OnRampEventType as OnRampEventType,
30335
+ checkout_widgets_d_OnRampFailed as OnRampFailed,
30336
+ checkout_widgets_d_OnRampReact as OnRampReact,
30337
+ checkout_widgets_d_OnRampReactProps as OnRampReactProps,
30338
+ checkout_widgets_d_OnRampSuccess as OnRampSuccess,
30168
30339
  checkout_widgets_d_OrchestrationEventType as OrchestrationEventType,
30169
30340
  checkout_widgets_d_RequestBridgeEvent as RequestBridgeEvent,
30170
30341
  checkout_widgets_d_RequestConnectEvent as RequestConnectEvent,