@imtbl/sdk 0.17.2 → 0.17.4
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/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +87 -2
- package/dist/checkout_sdk.js +242 -118
- package/dist/checkout_widgets.d.ts +74 -6
- package/dist/checkout_widgets.js +44 -2
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +289 -120
- package/dist/index.d.ts +177 -6
- package/dist/index.js +289 -120
- package/dist/passport.js +2 -2
- package/package.json +1 -1
|
@@ -25344,7 +25344,8 @@ declare enum CheckoutWidgetTagNames {
|
|
|
25344
25344
|
CONNECT = "imtbl-connect",
|
|
25345
25345
|
WALLET = "imtbl-wallet",
|
|
25346
25346
|
SWAP = "imtbl-swap",
|
|
25347
|
-
BRIDGE = "imtbl-bridge"
|
|
25347
|
+
BRIDGE = "imtbl-bridge",
|
|
25348
|
+
ONRAMP = "imtbl-onramp"
|
|
25348
25349
|
}
|
|
25349
25350
|
/**
|
|
25350
25351
|
* Represents the version of the Checkout Widgets to use defaults to (0.1.9-alpha)
|
|
@@ -25372,6 +25373,7 @@ type SemanticVersion = {
|
|
|
25372
25373
|
* @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
|
|
25373
25374
|
* @property {Environment | undefined} environment - The environment configuration (default: "SANDBOX")
|
|
25374
25375
|
* @property {SemanticVersion | undefined} version - The version of the checkout widgets js file to use (default: "0.1.0")
|
|
25376
|
+
* @property {boolean | undefined} isOnRampEnabled - Enable on-ramp top-up method (default: "true")
|
|
25375
25377
|
* @property {boolean | undefined} isSwapEnabled - Enable swap top-up method (default: "true")
|
|
25376
25378
|
* @property {boolean | undefined} isBridgeEnabled - Enable bridge top-up method (default: "true")
|
|
25377
25379
|
*/
|
|
@@ -25379,6 +25381,7 @@ type CheckoutWidgetsConfig = {
|
|
|
25379
25381
|
theme?: WidgetTheme;
|
|
25380
25382
|
environment?: Environment;
|
|
25381
25383
|
version?: SemanticVersion;
|
|
25384
|
+
isOnRampEnabled?: boolean;
|
|
25382
25385
|
isSwapEnabled?: boolean;
|
|
25383
25386
|
isBridgeEnabled?: boolean;
|
|
25384
25387
|
};
|
|
@@ -25444,6 +25447,30 @@ type ConnectionSuccess = {
|
|
|
25444
25447
|
type ConnectionFailed = {
|
|
25445
25448
|
reason: string;
|
|
25446
25449
|
};
|
|
25450
|
+
/**
|
|
25451
|
+
* Enum of possible OnRamp Widget event types.
|
|
25452
|
+
*/
|
|
25453
|
+
declare enum OnRampEventType {
|
|
25454
|
+
CLOSE_WIDGET = "close-widget",
|
|
25455
|
+
SUCCESS = "success",
|
|
25456
|
+
FAILURE = "failure"
|
|
25457
|
+
}
|
|
25458
|
+
/**
|
|
25459
|
+
* Represents a successful on-ramp transaction.
|
|
25460
|
+
* @property {string} transactionHash - The transaction hash of the successful transaction.
|
|
25461
|
+
*/
|
|
25462
|
+
type OnRampSuccess = {
|
|
25463
|
+
transactionHash: string;
|
|
25464
|
+
};
|
|
25465
|
+
/**
|
|
25466
|
+
* Type representing a On-ramp Widget with type FAILURE.
|
|
25467
|
+
* @property {string} reason - The reason why the on-ramp failed.
|
|
25468
|
+
* @property {number} timestamp - The timestamp of the failed transaction.
|
|
25469
|
+
*/
|
|
25470
|
+
type OnRampFailed = {
|
|
25471
|
+
reason: string;
|
|
25472
|
+
timestamp: number;
|
|
25473
|
+
};
|
|
25447
25474
|
/**
|
|
25448
25475
|
* Enum representing different types of orchestration events.
|
|
25449
25476
|
*/
|
|
@@ -25561,16 +25588,17 @@ declare enum IMTBLWidgetEvents {
|
|
|
25561
25588
|
IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
|
|
25562
25589
|
IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
|
|
25563
25590
|
IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
|
|
25564
|
-
IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget"
|
|
25591
|
+
IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
|
|
25592
|
+
IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget"
|
|
25565
25593
|
}
|
|
25566
25594
|
/**
|
|
25567
25595
|
* Represents an event emitted by a widget.
|
|
25568
25596
|
* @template T - The type of data associated with the event.
|
|
25569
|
-
* @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType} type - The type of the event.
|
|
25597
|
+
* @property {OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType} type - The type of the event.
|
|
25570
25598
|
* @property {T} data - The data associated with the event.
|
|
25571
25599
|
*/
|
|
25572
25600
|
type WidgetEvent<T> = {
|
|
25573
|
-
type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType;
|
|
25601
|
+
type: OrchestrationEventType | ConnectEventType | WalletEventType | SwapEventType | BridgeEventType | OnRampEventType;
|
|
25574
25602
|
data: T;
|
|
25575
25603
|
};
|
|
25576
25604
|
/**
|
|
@@ -25586,7 +25614,8 @@ type WidgetEvent<T> = {
|
|
|
25586
25614
|
* @property {ImtblWalletProps} 'imtbl-wallet' - Props for the 'imtbl-wallet' component.
|
|
25587
25615
|
* @property {ImtblSwapProps} 'imtbl-swap' - Props for the 'imtbl-swap' component.
|
|
25588
25616
|
* @property {ImtblBridgeProps} 'imtbl-bridge' - Props for the 'imtbl-bridge' component.
|
|
25589
|
-
|
|
25617
|
+
* @property {ImtblOnRampProps} 'imtbl-onramp' - Props for the 'imtbl-onramp' component.
|
|
25618
|
+
* */
|
|
25590
25619
|
declare global {
|
|
25591
25620
|
interface Window {
|
|
25592
25621
|
ImtblCheckoutWidgetConfig: any;
|
|
@@ -25597,6 +25626,7 @@ declare global {
|
|
|
25597
25626
|
'imtbl-wallet': ImtblWalletProps;
|
|
25598
25627
|
'imtbl-swap': ImtblSwapProps;
|
|
25599
25628
|
'imtbl-bridge': ImtblBridgeProps;
|
|
25629
|
+
'imtbl-onramp': ImtblOnRampProps;
|
|
25600
25630
|
}
|
|
25601
25631
|
}
|
|
25602
25632
|
interface ImmutableWebComponent {
|
|
@@ -25661,6 +25691,22 @@ interface ImtblBridgeProps extends React.DetailedHTMLProps<React.HTMLAttributes<
|
|
|
25661
25691
|
fromContractAddress?: string;
|
|
25662
25692
|
amount?: string;
|
|
25663
25693
|
}
|
|
25694
|
+
/**
|
|
25695
|
+
* Interface for the properties of a bridge web component.
|
|
25696
|
+
* Extends the React.DetailedHTMLProps interface to inherit HTML attributes for the component's root element.
|
|
25697
|
+
* @interface ImtblOnRampProps
|
|
25698
|
+
* @extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
|
|
25699
|
+
* @property {string | undefined} walletProvider - The preferred wallet provider to connect to.
|
|
25700
|
+
* @property {string | undefined} widgetConfig - The configuration for the bridge widget.
|
|
25701
|
+
* @property {string | undefined} amount - The amount to onramp.
|
|
25702
|
+
* @property {string | undefined} contractAddress - The contract address of the token to on ramp.
|
|
25703
|
+
*/
|
|
25704
|
+
interface ImtblOnRampProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
25705
|
+
walletProvider?: string;
|
|
25706
|
+
widgetConfig?: string;
|
|
25707
|
+
amount?: string;
|
|
25708
|
+
contractAddress?: string;
|
|
25709
|
+
}
|
|
25664
25710
|
/**
|
|
25665
25711
|
* Interface representing the props for the Bridge Widget component.
|
|
25666
25712
|
* @interface BridgeReactProps
|
|
@@ -25738,5 +25784,27 @@ interface WalletReactProps {
|
|
|
25738
25784
|
* @returns {JSX.Element} - The rendered Wallet Widget component.
|
|
25739
25785
|
*/
|
|
25740
25786
|
declare function WalletReact(props: WalletReactProps): JSX.Element;
|
|
25787
|
+
/**
|
|
25788
|
+
* Interface representing the props for the on-ramp Widget component.
|
|
25789
|
+
* @interface OnRampReactProps
|
|
25790
|
+
* @property {WalletProviderName | undefined} walletProvider - The name of the wallet provider.
|
|
25791
|
+
* @property {Web3Provider | undefined} provider - The Web3 provider.
|
|
25792
|
+
* @property {Passport | undefined} passport - The Passport instance to create a Web3Provider.
|
|
25793
|
+
* @property {string | undefined} amount - The amount.
|
|
25794
|
+
* @property {string | undefined} contractAddress - The contract address of the token to on ramp
|
|
25795
|
+
*/
|
|
25796
|
+
interface OnRampReactProps {
|
|
25797
|
+
walletProvider?: WalletProviderName;
|
|
25798
|
+
provider?: Web3Provider;
|
|
25799
|
+
passport?: Passport;
|
|
25800
|
+
amount?: string;
|
|
25801
|
+
contractAddress?: string;
|
|
25802
|
+
}
|
|
25803
|
+
/**
|
|
25804
|
+
* A React functional component that renders the Checkout on-ramp Widget.
|
|
25805
|
+
* @param {OnRampReactProps} props - The props for the On-ramp Widget component.
|
|
25806
|
+
* @returns {JSX.Element} - The rendered Bridge Widget component.
|
|
25807
|
+
*/
|
|
25808
|
+
declare function OnRampReact(props: OnRampReactProps): JSX.Element;
|
|
25741
25809
|
|
|
25742
|
-
export { BridgeEventType, BridgeFailed, BridgeReact, BridgeReactProps, BridgeSuccess, CheckoutWidgetTagNames, CheckoutWidgets, CheckoutWidgetsConfig, ConnectEventType, ConnectReact, ConnectReactProps, ConnectionFailed, ConnectionSuccess, IMTBLWidgetEvents, ImtblBridgeProps, ImtblConnectProps, ImtblSwapProps, ImtblWalletProps, OrchestrationEventType, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, SemanticVersion, SwapEventType, SwapFailed, SwapReact, SwapReactProps, SwapRejected, SwapSuccess, UpdateConfig, WalletDisconnectWalletEvent, WalletEventType, WalletNetworkSwitchEvent, WalletReact, WalletReactProps, WidgetEvent, WidgetTheme };
|
|
25810
|
+
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 };
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -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.17.
|
|
7
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.4";
|
|
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_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
|
|
70
70
|
IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
|
|
71
71
|
IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
|
|
72
|
+
IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
|
|
72
73
|
})($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
|
|
73
74
|
|
|
74
75
|
|
|
@@ -134,6 +135,19 @@ $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b
|
|
|
134
135
|
OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
|
|
135
136
|
OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
|
|
136
137
|
})($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
var $d882ddc5600b1284$exports = {};
|
|
141
|
+
|
|
142
|
+
$parcel$export($d882ddc5600b1284$exports, "OnRampEventType", () => $d882ddc5600b1284$export$66ec39c0924078d8);
|
|
143
|
+
/**
|
|
144
|
+
* Enum of possible OnRamp Widget event types.
|
|
145
|
+
*/ var $d882ddc5600b1284$export$66ec39c0924078d8;
|
|
146
|
+
(function(OnRampEventType) {
|
|
147
|
+
OnRampEventType["CLOSE_WIDGET"] = "close-widget";
|
|
148
|
+
OnRampEventType["SUCCESS"] = "success";
|
|
149
|
+
OnRampEventType["FAILURE"] = "failure";
|
|
150
|
+
})($d882ddc5600b1284$export$66ec39c0924078d8 || ($d882ddc5600b1284$export$66ec39c0924078d8 = {}));
|
|
137
151
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
138
152
|
|
|
139
153
|
var $045213b18e9f1f94$exports = {};
|
|
@@ -154,6 +168,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
154
168
|
CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
|
|
155
169
|
CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
|
|
156
170
|
CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
|
|
171
|
+
CheckoutWidgetTagNames["ONRAMP"] = "imtbl-onramp";
|
|
157
172
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
158
173
|
|
|
159
174
|
|
|
@@ -322,4 +337,31 @@ function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
|
|
|
322
337
|
});
|
|
323
338
|
}
|
|
324
339
|
|
|
325
|
-
|
|
340
|
+
|
|
341
|
+
var $f94f63f2c041a04c$exports = {};
|
|
342
|
+
|
|
343
|
+
$parcel$export($f94f63f2c041a04c$exports, "OnRampReact", () => $f94f63f2c041a04c$export$9e363c61ea99bbb4);
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
|
|
350
|
+
const { walletProvider: walletProvider, amount: amount, provider: provider, passport: passport, contractAddress: contractAddress } = props;
|
|
351
|
+
(useEffect)(()=>{
|
|
352
|
+
if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, provider);
|
|
353
|
+
if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, passport);
|
|
354
|
+
}, [
|
|
355
|
+
provider,
|
|
356
|
+
passport
|
|
357
|
+
]);
|
|
358
|
+
const config = window.ImtblCheckoutWidgetConfig;
|
|
359
|
+
return /*#__PURE__*/ (jsx)("imtbl-onramp", {
|
|
360
|
+
widgetConfig: config,
|
|
361
|
+
walletProvider: walletProvider,
|
|
362
|
+
amount: amount ?? "",
|
|
363
|
+
contractAddress: contractAddress ?? ""
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
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 };
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.17.4',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|