@imtbl/sdk 0.1.7-alpha.1 → 0.1.7

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.
@@ -1,284 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import 'react';
3
-
4
- var Environment;
5
- (function (Environment) {
6
- Environment["PRODUCTION"] = "production";
7
- Environment["SANDBOX"] = "sandbox";
8
- })(Environment || (Environment = {}));
9
-
10
- function $parcel$export(e, n, v, s) {
11
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
- }
13
- // Definitions | Events
14
- var $207ed853f11d19d5$exports = {};
15
-
16
- $parcel$export($207ed853f11d19d5$exports, "IMTBLWidgetEvents", () => $207ed853f11d19d5$export$5a0ace85cae72d45);
17
- /**
18
- * Enum representing the events emitted by the widgets.
19
- */ let $207ed853f11d19d5$export$5a0ace85cae72d45;
20
- (function(IMTBLWidgetEvents) {
21
- IMTBLWidgetEvents["IMTBL_CONNECT_WIDGET_EVENT"] = "imtbl-connect-widget";
22
- IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
23
- IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
24
- IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
25
- IMTBLWidgetEvents["IMTBL_BUY_WIDGET_EVENT"] = "imtbl-buy-widget";
26
- IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
27
- })($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
28
-
29
-
30
- var $a85ecdbd885c58ad$exports = {};
31
-
32
- $parcel$export($a85ecdbd885c58ad$exports, "ConnectEventType", () => $a85ecdbd885c58ad$export$e72e7f9969a47dd3);
33
- let $a85ecdbd885c58ad$export$e72e7f9969a47dd3;
34
- (function(ConnectEventType) {
35
- ConnectEventType["SUCCESS"] = "success";
36
- ConnectEventType["FAILURE"] = "failure";
37
- ConnectEventType["CLOSE_WIDGET"] = "close-widget";
38
- })($a85ecdbd885c58ad$export$e72e7f9969a47dd3 || ($a85ecdbd885c58ad$export$e72e7f9969a47dd3 = {}));
39
-
40
-
41
- var $77b6aac5c353d4a9$exports = {};
42
-
43
- $parcel$export($77b6aac5c353d4a9$exports, "WalletEventType", () => $77b6aac5c353d4a9$export$d9be06b70b28c742);
44
- let $77b6aac5c353d4a9$export$d9be06b70b28c742;
45
- (function(WalletEventType) {
46
- WalletEventType["CLOSE_WIDGET"] = "close-widget";
47
- WalletEventType["NETWORK_SWITCH"] = "network-switch";
48
- WalletEventType["ADD_COINS"] = "add-coins";
49
- WalletEventType["REQUEST_SWAP"] = "request-swap";
50
- WalletEventType["REQUEST_BRIDGE"] = "request-bridge";
51
- WalletEventType["REQUEST_ONRAMP"] = "request-onramp";
52
- WalletEventType["DISCONNECT_WALLET"] = "disconnect-wallet";
53
- })($77b6aac5c353d4a9$export$d9be06b70b28c742 || ($77b6aac5c353d4a9$export$d9be06b70b28c742 = {}));
54
-
55
-
56
- var $53d219e7f6bf0cd6$exports = {};
57
-
58
- $parcel$export($53d219e7f6bf0cd6$exports, "SwapEventType", () => $53d219e7f6bf0cd6$export$140a49745ab55563);
59
- /**
60
- * Represents an event object emitted by the Swap Widget.
61
- * @property {SwapEventType} type - The type of the event.
62
- * @property {T} data - The data contained in the event.
63
- */ let $53d219e7f6bf0cd6$export$140a49745ab55563;
64
- (function(SwapEventType) {
65
- SwapEventType["SUCCESS"] = "success";
66
- SwapEventType["FAILURE"] = "failure";
67
- SwapEventType["CLOSE_WIDGET"] = "close-widget";
68
- })($53d219e7f6bf0cd6$export$140a49745ab55563 || ($53d219e7f6bf0cd6$export$140a49745ab55563 = {}));
69
-
70
-
71
- var $15cc9e120aa6f3bf$exports = {};
72
-
73
- $parcel$export($15cc9e120aa6f3bf$exports, "BridgeEventType", () => $15cc9e120aa6f3bf$export$d1bfa21f7c76447a);
74
- /**
75
- * Represents an event object emitted by the Bridge Widget.
76
- * @property {BridgeEventType} type - The type of the event.
77
- * @property {T} data - The data associated with the event.
78
- */ let $15cc9e120aa6f3bf$export$d1bfa21f7c76447a;
79
- (function(BridgeEventType) {
80
- BridgeEventType["CLOSE_WIDGET"] = "close-widget";
81
- BridgeEventType["SUCCESS"] = "success";
82
- BridgeEventType["FAILURE"] = "failure";
83
- })($15cc9e120aa6f3bf$export$d1bfa21f7c76447a || ($15cc9e120aa6f3bf$export$d1bfa21f7c76447a = {}));
84
-
85
-
86
- var $98cbcca465beec95$exports = {};
87
-
88
- $parcel$export($98cbcca465beec95$exports, "BuyEventType", () => $98cbcca465beec95$export$90db5fe1be5993c1);
89
- /**
90
- * Represents an event object emitted by the Buy Widget.
91
- * @property {BuyEventType} type - The type of the event.
92
- * @property {T} data - The data contained in the event.
93
- */ let $98cbcca465beec95$export$90db5fe1be5993c1;
94
- (function(BuyEventType) {
95
- BuyEventType["SUCCESS"] = "success";
96
- BuyEventType["FAILURE"] = "failure";
97
- BuyEventType["NOT_CONNECTED"] = "not_connected";
98
- BuyEventType["CLOSE"] = "close";
99
- })($98cbcca465beec95$export$90db5fe1be5993c1 || ($98cbcca465beec95$export$90db5fe1be5993c1 = {}));
100
-
101
-
102
- var $66ceef112c0ee49e$exports = {};
103
-
104
- $parcel$export($66ceef112c0ee49e$exports, "OnRampEventType", () => $66ceef112c0ee49e$export$66ec39c0924078d8);
105
- let $66ceef112c0ee49e$export$66ec39c0924078d8;
106
- $66ceef112c0ee49e$export$66ec39c0924078d8 || ($66ceef112c0ee49e$export$66ec39c0924078d8 = {});
107
- /* eslint-disable @typescript-eslint/naming-convention */
108
-
109
- var $14d7a2bbb79e0dae$exports = {};
110
-
111
- $parcel$export($14d7a2bbb79e0dae$exports, "Network", () => $14d7a2bbb79e0dae$export$95be4ae94445245a);
112
- $parcel$export($14d7a2bbb79e0dae$exports, "WidgetTheme", () => $14d7a2bbb79e0dae$export$c88931fdc51854eb);
113
- $parcel$export($14d7a2bbb79e0dae$exports, "CheckoutWidgetTagNames", () => $14d7a2bbb79e0dae$export$75be0f6af9650f2c);
114
- /**
115
- * Enum representing the networks supported by Checkout.
116
- */ let $14d7a2bbb79e0dae$export$95be4ae94445245a;
117
- (function(Network) {
118
- Network["ETHEREUM"] = "Ethereum";
119
- Network["SEPOLIA"] = "Sepolia";
120
- Network["IMTBL_ZKEVM_TESTNET"] = "Immutable zkEVM Testnet";
121
- Network["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Devnet";
122
- Network["POLYGON_ZKEVM_TESTNET"] = "Polygon zkEVM Testnet";
123
- Network["POLYGON_ZKEVM"] = "Polygon zkEVM";
124
- })($14d7a2bbb79e0dae$export$95be4ae94445245a || ($14d7a2bbb79e0dae$export$95be4ae94445245a = {}));
125
- let $14d7a2bbb79e0dae$export$c88931fdc51854eb;
126
- (function(WidgetTheme) {
127
- WidgetTheme["LIGHT"] = "light";
128
- WidgetTheme["DARK"] = "dark";
129
- WidgetTheme["CUSTOM"] = "custom";
130
- })($14d7a2bbb79e0dae$export$c88931fdc51854eb || ($14d7a2bbb79e0dae$export$c88931fdc51854eb = {}));
131
- let $14d7a2bbb79e0dae$export$75be0f6af9650f2c;
132
- (function(CheckoutWidgetTagNames) {
133
- CheckoutWidgetTagNames["CONNECT"] = "imtbl-connect";
134
- CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
135
- CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
136
- CheckoutWidgetTagNames["BUY"] = "imtbl-buy";
137
- CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
138
- CheckoutWidgetTagNames["EXAMPLE"] = "imtbl-example";
139
- })($14d7a2bbb79e0dae$export$75be0f6af9650f2c || ($14d7a2bbb79e0dae$export$75be0f6af9650f2c = {}));
140
-
141
-
142
- var $1f969328e5988c99$exports = {};
143
-
144
- $parcel$export($1f969328e5988c99$exports, "BridgeReact", () => $1f969328e5988c99$export$30f61ebf204c69f6);
145
-
146
-
147
- function $1f969328e5988c99$export$30f61ebf204c69f6(props) {
148
- const { providerPreference: providerPreference , fromContractAddress: fromContractAddress , amount: amount , fromNetwork: fromNetwork } = props;
149
- const config = window.ImtblCheckoutWidgetConfig;
150
- return /*#__PURE__*/ (jsx)("imtbl-bridge", {
151
- widgetConfig: config,
152
- providerPreference: providerPreference,
153
- fromContractAddress: fromContractAddress ?? "",
154
- fromNetwork: fromNetwork ?? "",
155
- amount: amount ?? ""
156
- });
157
- }
158
-
159
-
160
- var $f22931ca9e2f35b6$exports = {};
161
-
162
- $parcel$export($f22931ca9e2f35b6$exports, "BuyReact", () => $f22931ca9e2f35b6$export$d13582032b79b401);
163
-
164
-
165
- function $f22931ca9e2f35b6$export$d13582032b79b401(props) {
166
- const { providerPreference: providerPreference , orderId: orderId } = props;
167
- const config = window.ImtblCheckoutWidgetConfig;
168
- return /*#__PURE__*/ (jsx)("imtbl-buy", {
169
- widgetConfig: config,
170
- providerPreference: providerPreference,
171
- orderId: orderId
172
- });
173
- }
174
-
175
-
176
- var $f2083cd30e2f5c56$exports = {};
177
-
178
- $parcel$export($f2083cd30e2f5c56$exports, "ConnectReact", () => $f2083cd30e2f5c56$export$49d62957f420a1e2);
179
-
180
-
181
- function $f2083cd30e2f5c56$export$49d62957f420a1e2(props) {
182
- const { providerPreference: providerPreference } = props;
183
- const config = window.ImtblCheckoutWidgetConfig;
184
- return /*#__PURE__*/ (jsx)("imtbl-connect", {
185
- widgetConfig: config,
186
- providerPreference: providerPreference ?? "metamask"
187
- });
188
- }
189
-
190
-
191
- var $a4fbb8e3a6aeff58$exports = {};
192
-
193
- $parcel$export($a4fbb8e3a6aeff58$exports, "SwapReact", () => $a4fbb8e3a6aeff58$export$971e031379577f4);
194
- /* eslint-disable max-len */
195
-
196
- function $a4fbb8e3a6aeff58$export$971e031379577f4(props) {
197
- const { providerPreference: providerPreference , fromContractAddress: fromContractAddress , amount: amount , toContractAddress: toContractAddress } = props;
198
- const config = window.ImtblCheckoutWidgetConfig;
199
- return /*#__PURE__*/ (jsx)("imtbl-swap", {
200
- widgetConfig: config,
201
- providerPreference: providerPreference,
202
- fromContractAddress: fromContractAddress ?? "",
203
- toContractAddress: toContractAddress ?? "",
204
- amount: amount ?? ""
205
- });
206
- }
207
-
208
-
209
- var $89d55ace0f8f1c07$exports = {};
210
-
211
- $parcel$export($89d55ace0f8f1c07$exports, "WalletReact", () => $89d55ace0f8f1c07$export$ceaac94f34dba154);
212
-
213
-
214
- function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
215
- const { providerPreference: providerPreference , useConnectWidget: useConnectWidget } = props;
216
- const config = window.ImtblCheckoutWidgetConfig;
217
- return /*#__PURE__*/ (jsx)("imtbl-wallet", {
218
- widgetConfig: config,
219
- useConnectWidget: useConnectWidget?.toString(),
220
- providerPreference: providerPreference ?? "metamask"
221
- });
222
- }
223
-
224
-
225
- var $d087956fd1002f80$exports = {};
226
-
227
- $parcel$export($d087956fd1002f80$exports, "ExampleReact", () => $d087956fd1002f80$export$fa517eee6594d26c);
228
-
229
-
230
-
231
- function $d087956fd1002f80$export$fa517eee6594d26c(props) {
232
- const { providerPreference: // eslint-disable-next-line @typescript-eslint/no-unused-vars
233
- providerPreference , environment: environment , theme: theme } = props;
234
- return /*#__PURE__*/ (jsx)("imtbl-example", {
235
- environment: environment ?? (Environment).SANDBOX,
236
- theme: theme ?? "dark",
237
- providerPreference: providerPreference
238
- });
239
- }
240
-
241
-
242
- var $430e3eda76fa4d5f$exports = {};
243
-
244
- $parcel$export($430e3eda76fa4d5f$exports, "CheckoutWidgets", () => $430e3eda76fa4d5f$export$af210a0808087845);
245
- $parcel$export($430e3eda76fa4d5f$exports, "UpdateConfig", () => $430e3eda76fa4d5f$export$bf1548ba7e61c17f);
246
- $parcel$export($430e3eda76fa4d5f$exports, "SetProvider", () => $430e3eda76fa4d5f$export$931068bc678f0d73);
247
- function $430e3eda76fa4d5f$export$af210a0808087845(config) {
248
- const checkoutWidgetJS = document.createElement("script");
249
- checkoutWidgetJS.setAttribute("src", "http://localhost:3000/lib/js/imtbl-checkout.js");
250
- document.head.appendChild(checkoutWidgetJS);
251
- window.ImtblCheckoutWidgetConfig = JSON.stringify(config);
252
- }
253
- function $430e3eda76fa4d5f$export$bf1548ba7e61c17f(config) {
254
- window.ImtblCheckoutWidgetConfig = JSON.stringify(config);
255
- }
256
- function $430e3eda76fa4d5f$export$931068bc678f0d73(tagName, provider) {
257
- if (!provider) {
258
- // eslint-disable-next-line no-console
259
- console.error("no provider parsed");
260
- return;
261
- }
262
- const elements = document.getElementsByTagName(tagName);
263
- const widget = elements[0];
264
- let attempts = 0;
265
- const maxAttempts = 10;
266
- let timer;
267
- const attemptToSetProvider = ()=>{
268
- try {
269
- widget.setProvider(provider);
270
- window.clearInterval(timer);
271
- } catch (err) {
272
- attempts++;
273
- if (attempts >= maxAttempts) {
274
- window.clearInterval(timer);
275
- // eslint-disable-next-line no-console
276
- console.error("failed to set the provider");
277
- }
278
- }
279
- };
280
- timer = window.setInterval(attemptToSetProvider, 10);
281
- attemptToSetProvider();
282
- }
283
-
284
- export { $15cc9e120aa6f3bf$export$d1bfa21f7c76447a as BridgeEventType, $1f969328e5988c99$export$30f61ebf204c69f6 as BridgeReact, $98cbcca465beec95$export$90db5fe1be5993c1 as BuyEventType, $f22931ca9e2f35b6$export$d13582032b79b401 as BuyReact, $14d7a2bbb79e0dae$export$75be0f6af9650f2c as CheckoutWidgetTagNames, $430e3eda76fa4d5f$export$af210a0808087845 as CheckoutWidgets, $a85ecdbd885c58ad$export$e72e7f9969a47dd3 as ConnectEventType, $f2083cd30e2f5c56$export$49d62957f420a1e2 as ConnectReact, $d087956fd1002f80$export$fa517eee6594d26c as ExampleReact, $207ed853f11d19d5$export$5a0ace85cae72d45 as IMTBLWidgetEvents, $14d7a2bbb79e0dae$export$95be4ae94445245a as Network, $66ceef112c0ee49e$export$66ec39c0924078d8 as OnRampEventType, $430e3eda76fa4d5f$export$931068bc678f0d73 as SetProvider, $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, $14d7a2bbb79e0dae$export$c88931fdc51854eb as WidgetTheme };
@@ -1,57 +0,0 @@
1
- import { OrderbookModuleConfiguration } from 'config/config';
2
- import { Order } from 'openapi/sdk';
3
- import { PrepareListingParams, PrepareListingResponse, CreateOrderParams, FulfilOrderResponse, CancelOrderResponse } from 'types';
4
-
5
- /**
6
- * zkEVM orderbook SDK
7
- * @constructor
8
- * @param {OrderbookModuleConfiguration} config - Configuration for Immutable services.
9
- */
10
- declare class Orderbook {
11
- private config;
12
- private apiClient;
13
- private seaport;
14
- constructor(config: OrderbookModuleConfiguration);
15
- /**
16
- * Get an order by ID
17
- * @param {string} orderId - The orderId to find.
18
- * @return {Order} The returned order.
19
- */
20
- getOrder(orderId: string): Promise<Order>;
21
- /**
22
- * Get required transactions and messages for signing prior to creating a listing
23
- * through the createOrder method
24
- * @param {PrepareListingParams} prepareListingParams - Details about the listing to be created.
25
- * @return {PrepareListingResponse} PrepareListingResponse includes
26
- * the unsigned approval transaction, the typed order message for signing and
27
- * the order components that can be submitted to `createOrder` with a signature.
28
- */
29
- prepareListing({ offerer, listingItem, considerationItem, orderExpiry, }: PrepareListingParams): Promise<PrepareListingResponse>;
30
- /**
31
- * Create an order
32
- * @param {CreateOrderParams} createOrderParams - create an order with the given params.
33
- * @return {Order} The order created in the Immutable services.
34
- */
35
- createOrder(createOrderParams: CreateOrderParams): Promise<Order>;
36
- /**
37
- * Get unsigned transactions that can be submitted to fulfil an open order. If the approval
38
- * transaction exists it must be signed and submitted to the chain before the fulfilment
39
- * transaction can be submitted or it will be reverted.
40
- * @param {string} orderId - The orderId to fulfil.
41
- * @param {string} fulfillerAddress - The address of the account fulfilling the order.
42
- * @return {FulfilOrderResponse} Approval and fulfilment transactions.
43
- */
44
- fulfillOrder(orderId: string, fulfillerAddress: string): Promise<FulfilOrderResponse>;
45
- /**
46
- * Get an unsigned cancel order transaction. Orders can only be cancelled by
47
- * the account that created them.
48
- * @param {string} orderId - The orderId to cancel.
49
- * @param {string} accountAddress - The address of the account cancelling the order.
50
- * @return {CancelOrderResponse} The unsigned cancel order transaction
51
- */
52
- cancelOrder(orderId: string, accountAddress: string): Promise<CancelOrderResponse>;
53
- }
54
-
55
- declare const module = "orderbook";
56
-
57
- export { Orderbook, module };