@chipi-stack/chipi-react 0.1.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.
package/dist/index.mjs ADDED
@@ -0,0 +1,601 @@
1
+ import React, { createContext, useContext, useState } from 'react';
2
+ import { ChipiSDK } from '@chipi-stack/backend';
3
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
+ import { useMutation, useQuery } from '@tanstack/react-query';
5
+ import { formatAddress, formatCurrency } from '@chipi-stack/shared';
6
+
7
+ // src/context/ChipiProvider.tsx
8
+ var ChipiContext = createContext(null);
9
+ function ChipiProvider({ children, config }) {
10
+ const chipiSDK = React.useMemo(() => new ChipiSDK(config), [config]);
11
+ const value = React.useMemo(
12
+ () => ({
13
+ chipiSDK,
14
+ config
15
+ }),
16
+ [chipiSDK, config]
17
+ );
18
+ return /* @__PURE__ */ jsx(ChipiContext.Provider, { value, children });
19
+ }
20
+ function useChipiContext() {
21
+ const context = useContext(ChipiContext);
22
+ if (!context) {
23
+ throw new Error("useChipiContext must be used within a ChipiProvider");
24
+ }
25
+ return context;
26
+ }
27
+ function useCreateWallet() {
28
+ const { chipiSDK } = useChipiContext();
29
+ const mutation = useMutation({
30
+ mutationFn: (params) => chipiSDK.createWallet(params)
31
+ });
32
+ return {
33
+ createWallet: mutation.mutate,
34
+ createWalletAsync: mutation.mutateAsync,
35
+ data: mutation.data,
36
+ isLoading: mutation.isPending,
37
+ isError: mutation.isError,
38
+ error: mutation.error,
39
+ isSuccess: mutation.isSuccess,
40
+ reset: mutation.reset
41
+ };
42
+ }
43
+ function useWallets(params) {
44
+ const { chipiSDK } = useChipiContext();
45
+ const { enabled = true, ...queryParams } = params;
46
+ return useQuery({
47
+ queryKey: ["wallets", queryParams],
48
+ queryFn: () => chipiSDK.wallets.getWallets(queryParams),
49
+ enabled: enabled && !!queryParams.apiKeyId && !!queryParams.orgId
50
+ });
51
+ }
52
+ function useTransfer() {
53
+ const { chipiSDK } = useChipiContext();
54
+ const mutation = useMutation({
55
+ mutationFn: (params) => chipiSDK.transfer(params)
56
+ });
57
+ return {
58
+ transfer: mutation.mutate,
59
+ transferAsync: mutation.mutateAsync,
60
+ data: mutation.data,
61
+ isLoading: mutation.isPending,
62
+ isError: mutation.isError,
63
+ error: mutation.error,
64
+ isSuccess: mutation.isSuccess,
65
+ reset: mutation.reset
66
+ };
67
+ }
68
+ function useApprove() {
69
+ const { chipiSDK } = useChipiContext();
70
+ const mutation = useMutation({
71
+ mutationFn: (params) => chipiSDK.approve(params)
72
+ });
73
+ return {
74
+ approve: mutation.mutate,
75
+ approveAsync: mutation.mutateAsync,
76
+ data: mutation.data,
77
+ isLoading: mutation.isPending,
78
+ isError: mutation.isError,
79
+ error: mutation.error,
80
+ isSuccess: mutation.isSuccess,
81
+ reset: mutation.reset
82
+ };
83
+ }
84
+ function useExecuteTransaction() {
85
+ const { chipiSDK } = useChipiContext();
86
+ const mutation = useMutation({
87
+ mutationFn: (params) => chipiSDK.executeTransaction(params)
88
+ });
89
+ return {
90
+ executeTransaction: mutation.mutate,
91
+ executeTransactionAsync: mutation.mutateAsync,
92
+ data: mutation.data,
93
+ isLoading: mutation.isPending,
94
+ isError: mutation.isError,
95
+ error: mutation.error,
96
+ isSuccess: mutation.isSuccess,
97
+ reset: mutation.reset
98
+ };
99
+ }
100
+ function useSkus(params = {}) {
101
+ const { chipiSDK } = useChipiContext();
102
+ const { enabled = true, ...queryParams } = params;
103
+ return useQuery({
104
+ queryKey: ["skus", queryParams],
105
+ queryFn: () => chipiSDK.skus.findSkus(queryParams),
106
+ enabled
107
+ });
108
+ }
109
+ function useSkuTransactions(params) {
110
+ const { chipiSDK } = useChipiContext();
111
+ const { enabled = true, walletAddress, ...queryParams } = params;
112
+ return useQuery({
113
+ queryKey: ["sku-transactions", { walletAddress, ...queryParams }],
114
+ queryFn: () => chipiSDK.skus.getSkuTransactionsByWallet(walletAddress, queryParams),
115
+ enabled: enabled && !!walletAddress
116
+ });
117
+ }
118
+ function usePurchaseSku() {
119
+ const { chipiSDK } = useChipiContext();
120
+ const mutation = useMutation({
121
+ mutationFn: (params) => chipiSDK.skus.purchaseSku(params)
122
+ });
123
+ return {
124
+ purchaseSku: mutation.mutate,
125
+ purchaseSkuAsync: mutation.mutateAsync,
126
+ data: mutation.data,
127
+ isLoading: mutation.isPending,
128
+ isError: mutation.isError,
129
+ error: mutation.error,
130
+ isSuccess: mutation.isSuccess,
131
+ reset: mutation.reset
132
+ };
133
+ }
134
+ function useStakeVesuUsdc() {
135
+ const { chipiSDK } = useChipiContext();
136
+ const mutation = useMutation({
137
+ mutationFn: (params) => chipiSDK.stakeVesuUsdc(params)
138
+ });
139
+ return {
140
+ stakeVesuUsdc: mutation.mutate,
141
+ stakeVesuUsdcAsync: mutation.mutateAsync,
142
+ data: mutation.data,
143
+ isLoading: mutation.isPending,
144
+ isError: mutation.isError,
145
+ error: mutation.error,
146
+ isSuccess: mutation.isSuccess,
147
+ reset: mutation.reset
148
+ };
149
+ }
150
+ function useWithdrawVesuUsdc() {
151
+ const { chipiSDK } = useChipiContext();
152
+ const mutation = useMutation({
153
+ mutationFn: (params) => chipiSDK.withdrawVesuUsdc(params)
154
+ });
155
+ return {
156
+ withdrawVesuUsdc: mutation.mutate,
157
+ withdrawVesuUsdcAsync: mutation.mutateAsync,
158
+ data: mutation.data,
159
+ isLoading: mutation.isPending,
160
+ isError: mutation.isError,
161
+ error: mutation.error,
162
+ isSuccess: mutation.isSuccess,
163
+ reset: mutation.reset
164
+ };
165
+ }
166
+ function useCallAnyContract() {
167
+ const { chipiSDK } = useChipiContext();
168
+ const mutation = useMutation({
169
+ mutationFn: (params) => chipiSDK.callAnyContract(params)
170
+ });
171
+ return {
172
+ callAnyContract: mutation.mutate,
173
+ callAnyContractAsync: mutation.mutateAsync,
174
+ data: mutation.data,
175
+ isLoading: mutation.isPending,
176
+ isError: mutation.isError,
177
+ error: mutation.error,
178
+ isSuccess: mutation.isSuccess,
179
+ reset: mutation.reset
180
+ };
181
+ }
182
+ function WalletCreator({ onWalletCreated, className, children }) {
183
+ const [encryptKey, setEncryptKey] = useState("");
184
+ const [bearerToken, setBearerToken] = useState("");
185
+ const { createWallet, isLoading, isError, error, data, isSuccess } = useCreateWallet();
186
+ const handleSubmit = (e) => {
187
+ e.preventDefault();
188
+ if (!encryptKey || !bearerToken) return;
189
+ createWallet({
190
+ encryptKey,
191
+ bearerToken
192
+ });
193
+ };
194
+ React.useEffect(() => {
195
+ if (isSuccess && data && onWalletCreated) {
196
+ onWalletCreated(data);
197
+ }
198
+ }, [isSuccess, data, onWalletCreated]);
199
+ if (children) {
200
+ return /* @__PURE__ */ jsx(Fragment, { children });
201
+ }
202
+ return /* @__PURE__ */ jsxs("div", { className, children: [
203
+ /* @__PURE__ */ jsx("h2", { children: "Create Wallet" }),
204
+ isError && error && /* @__PURE__ */ jsxs("div", { style: { color: "red", marginBottom: "1rem" }, children: [
205
+ "Error: ",
206
+ error.message
207
+ ] }),
208
+ isSuccess && data && /* @__PURE__ */ jsxs("div", { style: { color: "green", marginBottom: "1rem" }, children: [
209
+ "Wallet created successfully! Address: ",
210
+ data.walletPublicKey
211
+ ] }),
212
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
213
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
214
+ /* @__PURE__ */ jsx("label", { htmlFor: "encryptKey", children: "Encrypt Key:" }),
215
+ /* @__PURE__ */ jsx(
216
+ "input",
217
+ {
218
+ id: "encryptKey",
219
+ type: "password",
220
+ value: encryptKey,
221
+ onChange: (e) => setEncryptKey(e.target.value),
222
+ required: true,
223
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
224
+ }
225
+ )
226
+ ] }),
227
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
228
+ /* @__PURE__ */ jsx("label", { htmlFor: "bearerToken", children: "Bearer Token:" }),
229
+ /* @__PURE__ */ jsx(
230
+ "input",
231
+ {
232
+ id: "bearerToken",
233
+ type: "text",
234
+ value: bearerToken,
235
+ onChange: (e) => setBearerToken(e.target.value),
236
+ required: true,
237
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
238
+ }
239
+ )
240
+ ] }),
241
+ /* @__PURE__ */ jsx(
242
+ "button",
243
+ {
244
+ type: "submit",
245
+ disabled: isLoading || !encryptKey || !bearerToken,
246
+ style: {
247
+ padding: "0.75rem 1.5rem",
248
+ backgroundColor: isLoading ? "#ccc" : "#007bff",
249
+ color: "white",
250
+ border: "none",
251
+ borderRadius: "0.25rem",
252
+ cursor: isLoading ? "not-allowed" : "pointer"
253
+ },
254
+ children: isLoading ? "Creating..." : "Create Wallet"
255
+ }
256
+ )
257
+ ] })
258
+ ] });
259
+ }
260
+ function WalletBalance({
261
+ address,
262
+ balance,
263
+ currency = "USD",
264
+ isLoading = false,
265
+ className
266
+ }) {
267
+ return /* @__PURE__ */ jsxs("div", { className, children: [
268
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.5rem" }, children: [
269
+ /* @__PURE__ */ jsx("strong", { children: "Wallet:" }),
270
+ " ",
271
+ formatAddress(address)
272
+ ] }),
273
+ /* @__PURE__ */ jsxs("div", { children: [
274
+ /* @__PURE__ */ jsx("strong", { children: "Balance:" }),
275
+ " ",
276
+ isLoading ? /* @__PURE__ */ jsx("span", { children: "Loading..." }) : balance !== void 0 ? formatCurrency(balance, currency) : /* @__PURE__ */ jsx("span", { children: "--" })
277
+ ] })
278
+ ] });
279
+ }
280
+ function TransactionForm({
281
+ wallet,
282
+ encryptKey,
283
+ bearerToken,
284
+ onTransactionComplete,
285
+ className
286
+ }) {
287
+ const [contractAddress, setContractAddress] = useState("");
288
+ const [recipient, setRecipient] = useState("");
289
+ const [amount, setAmount] = useState("");
290
+ const [decimals, setDecimals] = useState(18);
291
+ const { transfer, isLoading, isError, error, data, isSuccess } = useTransfer();
292
+ const handleSubmit = (e) => {
293
+ e.preventDefault();
294
+ if (!contractAddress || !recipient || !amount) return;
295
+ transfer({
296
+ encryptKey,
297
+ wallet,
298
+ contractAddress,
299
+ recipient,
300
+ amount: parseFloat(amount),
301
+ decimals,
302
+ bearerToken
303
+ });
304
+ };
305
+ React.useEffect(() => {
306
+ if (isSuccess && data && onTransactionComplete) {
307
+ onTransactionComplete(data);
308
+ }
309
+ }, [isSuccess, data, onTransactionComplete]);
310
+ return /* @__PURE__ */ jsxs("div", { className, children: [
311
+ /* @__PURE__ */ jsx("h3", { children: "Transfer Tokens" }),
312
+ isError && error && /* @__PURE__ */ jsxs("div", { style: { color: "red", marginBottom: "1rem" }, children: [
313
+ "Error: ",
314
+ error.message
315
+ ] }),
316
+ isSuccess && data && /* @__PURE__ */ jsxs("div", { style: { color: "green", marginBottom: "1rem" }, children: [
317
+ "Transaction successful! Hash: ",
318
+ data
319
+ ] }),
320
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
321
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
322
+ /* @__PURE__ */ jsx("label", { htmlFor: "contractAddress", children: "Token Contract:" }),
323
+ /* @__PURE__ */ jsx(
324
+ "input",
325
+ {
326
+ id: "contractAddress",
327
+ type: "text",
328
+ value: contractAddress,
329
+ onChange: (e) => setContractAddress(e.target.value),
330
+ placeholder: "0x...",
331
+ required: true,
332
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
333
+ }
334
+ )
335
+ ] }),
336
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
337
+ /* @__PURE__ */ jsx("label", { htmlFor: "recipient", children: "Recipient:" }),
338
+ /* @__PURE__ */ jsx(
339
+ "input",
340
+ {
341
+ id: "recipient",
342
+ type: "text",
343
+ value: recipient,
344
+ onChange: (e) => setRecipient(e.target.value),
345
+ placeholder: "0x...",
346
+ required: true,
347
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
348
+ }
349
+ )
350
+ ] }),
351
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
352
+ /* @__PURE__ */ jsx("label", { htmlFor: "amount", children: "Amount:" }),
353
+ /* @__PURE__ */ jsx(
354
+ "input",
355
+ {
356
+ id: "amount",
357
+ type: "number",
358
+ step: "any",
359
+ value: amount,
360
+ onChange: (e) => setAmount(e.target.value),
361
+ required: true,
362
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
363
+ }
364
+ )
365
+ ] }),
366
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
367
+ /* @__PURE__ */ jsx("label", { htmlFor: "decimals", children: "Decimals:" }),
368
+ /* @__PURE__ */ jsx(
369
+ "input",
370
+ {
371
+ id: "decimals",
372
+ type: "number",
373
+ value: decimals,
374
+ onChange: (e) => setDecimals(parseInt(e.target.value)),
375
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
376
+ }
377
+ )
378
+ ] }),
379
+ /* @__PURE__ */ jsx(
380
+ "button",
381
+ {
382
+ type: "submit",
383
+ disabled: isLoading || !contractAddress || !recipient || !amount,
384
+ style: {
385
+ padding: "0.75rem 1.5rem",
386
+ backgroundColor: isLoading ? "#ccc" : "#007bff",
387
+ color: "white",
388
+ border: "none",
389
+ borderRadius: "0.25rem",
390
+ cursor: isLoading ? "not-allowed" : "pointer"
391
+ },
392
+ children: isLoading ? "Sending..." : "Send Transaction"
393
+ }
394
+ )
395
+ ] })
396
+ ] });
397
+ }
398
+ function SkuList({ categories, onSkuSelect, className }) {
399
+ const { data: skus, isLoading, isError, error } = useSkus({ categories });
400
+ if (isLoading) {
401
+ return /* @__PURE__ */ jsx("div", { className, children: "Loading SKUs..." });
402
+ }
403
+ if (isError) {
404
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsxs("div", { style: { color: "red" }, children: [
405
+ "Error loading SKUs: ",
406
+ error?.message
407
+ ] }) });
408
+ }
409
+ if (!skus || skus.length === 0) {
410
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("div", { children: "No SKUs available." }) });
411
+ }
412
+ return /* @__PURE__ */ jsxs("div", { className, children: [
413
+ /* @__PURE__ */ jsx("h3", { children: "Available SKUs" }),
414
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: "1rem", gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))" }, children: skus.map((sku) => /* @__PURE__ */ jsxs(
415
+ "div",
416
+ {
417
+ style: {
418
+ border: "1px solid #ddd",
419
+ borderRadius: "0.5rem",
420
+ padding: "1rem",
421
+ backgroundColor: "white",
422
+ cursor: onSkuSelect ? "pointer" : "default"
423
+ },
424
+ onClick: () => onSkuSelect?.(sku),
425
+ children: [
426
+ /* @__PURE__ */ jsx("div", { style: { marginBottom: "0.5rem" }, children: /* @__PURE__ */ jsx("h4", { style: { margin: 0, fontSize: "1.1rem" }, children: sku.name }) }),
427
+ sku.description && /* @__PURE__ */ jsx("div", { style: { marginBottom: "0.5rem", color: "#666", fontSize: "0.9rem" }, children: sku.description }),
428
+ /* @__PURE__ */ jsx("div", { style: { marginBottom: "0.5rem" }, children: /* @__PURE__ */ jsx(
429
+ "span",
430
+ {
431
+ style: {
432
+ backgroundColor: "#f0f0f0",
433
+ padding: "0.25rem 0.5rem",
434
+ borderRadius: "0.25rem",
435
+ fontSize: "0.8rem",
436
+ color: "#666"
437
+ },
438
+ children: sku.category
439
+ }
440
+ ) }),
441
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
442
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "1.2rem", fontWeight: "bold" }, children: formatCurrency(sku.price, sku.currency) }),
443
+ /* @__PURE__ */ jsx(
444
+ "div",
445
+ {
446
+ style: {
447
+ color: sku.isActive ? "green" : "red",
448
+ fontSize: "0.9rem",
449
+ fontWeight: "bold"
450
+ },
451
+ children: sku.isActive ? "Available" : "Unavailable"
452
+ }
453
+ )
454
+ ] })
455
+ ]
456
+ },
457
+ sku.id
458
+ )) })
459
+ ] });
460
+ }
461
+ function SkuPurchaseForm({
462
+ sku,
463
+ walletAddress,
464
+ onPurchaseComplete,
465
+ className
466
+ }) {
467
+ const [chain, setChain] = useState("STARKNET_MAINNET");
468
+ const [chainToken, setChainToken] = useState("USDC");
469
+ const [reference, setReference] = useState("");
470
+ const [transactionHash, setTransactionHash] = useState("");
471
+ const { purchaseSku, isLoading, isError, error, data, isSuccess } = usePurchaseSku();
472
+ const handleSubmit = (e) => {
473
+ e.preventDefault();
474
+ if (!reference || !transactionHash) return;
475
+ purchaseSku({
476
+ skuId: sku.id,
477
+ walletAddress,
478
+ chain,
479
+ chainToken,
480
+ mxnAmount: sku.price,
481
+ reference,
482
+ transactionHash
483
+ });
484
+ };
485
+ React.useEffect(() => {
486
+ if (isSuccess && data && onPurchaseComplete) {
487
+ onPurchaseComplete(data.transaction.transactionHash);
488
+ }
489
+ }, [isSuccess, data, onPurchaseComplete]);
490
+ if (!sku.isActive) {
491
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("div", { style: { color: "red", textAlign: "center", padding: "2rem" }, children: "This SKU is currently unavailable for purchase." }) });
492
+ }
493
+ return /* @__PURE__ */ jsxs("div", { className, children: [
494
+ /* @__PURE__ */ jsx("h3", { children: "Purchase SKU" }),
495
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1.5rem", padding: "1rem", backgroundColor: "#f9f9f9", borderRadius: "0.5rem" }, children: [
496
+ /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 0.5rem 0" }, children: sku.name }),
497
+ sku.description && /* @__PURE__ */ jsx("p", { style: { margin: "0 0 0.5rem 0", color: "#666" }, children: sku.description }),
498
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "1.2rem", fontWeight: "bold" }, children: [
499
+ "Price: ",
500
+ formatCurrency(sku.price, sku.currency)
501
+ ] })
502
+ ] }),
503
+ isError && error && /* @__PURE__ */ jsxs("div", { style: { color: "red", marginBottom: "1rem" }, children: [
504
+ "Error: ",
505
+ error.message
506
+ ] }),
507
+ isSuccess && data && /* @__PURE__ */ jsxs("div", { style: { color: "green", marginBottom: "1rem" }, children: [
508
+ "Purchase successful! Transaction: ",
509
+ data.transaction.transactionHash
510
+ ] }),
511
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
512
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
513
+ /* @__PURE__ */ jsx("label", { htmlFor: "chain", children: "Chain:" }),
514
+ /* @__PURE__ */ jsxs(
515
+ "select",
516
+ {
517
+ id: "chain",
518
+ value: chain,
519
+ onChange: (e) => setChain(e.target.value),
520
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" },
521
+ children: [
522
+ /* @__PURE__ */ jsx("option", { value: "STARKNET_MAINNET", children: "Starknet Mainnet" }),
523
+ /* @__PURE__ */ jsx("option", { value: "STARKNET_SEPOLIA", children: "Starknet Sepolia" })
524
+ ]
525
+ }
526
+ )
527
+ ] }),
528
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
529
+ /* @__PURE__ */ jsx("label", { htmlFor: "chainToken", children: "Token:" }),
530
+ /* @__PURE__ */ jsxs(
531
+ "select",
532
+ {
533
+ id: "chainToken",
534
+ value: chainToken,
535
+ onChange: (e) => setChainToken(e.target.value),
536
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" },
537
+ children: [
538
+ /* @__PURE__ */ jsx("option", { value: "USDC", children: "USDC" }),
539
+ /* @__PURE__ */ jsx("option", { value: "USDT", children: "USDT" }),
540
+ /* @__PURE__ */ jsx("option", { value: "ETH", children: "ETH" }),
541
+ /* @__PURE__ */ jsx("option", { value: "STRK", children: "STRK" }),
542
+ /* @__PURE__ */ jsx("option", { value: "DAI", children: "DAI" })
543
+ ]
544
+ }
545
+ )
546
+ ] }),
547
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
548
+ /* @__PURE__ */ jsx("label", { htmlFor: "reference", children: "Reference:" }),
549
+ /* @__PURE__ */ jsx(
550
+ "input",
551
+ {
552
+ id: "reference",
553
+ type: "text",
554
+ value: reference,
555
+ onChange: (e) => setReference(e.target.value),
556
+ placeholder: "Transaction reference",
557
+ required: true,
558
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
559
+ }
560
+ )
561
+ ] }),
562
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
563
+ /* @__PURE__ */ jsx("label", { htmlFor: "transactionHash", children: "Transaction Hash:" }),
564
+ /* @__PURE__ */ jsx(
565
+ "input",
566
+ {
567
+ id: "transactionHash",
568
+ type: "text",
569
+ value: transactionHash,
570
+ onChange: (e) => setTransactionHash(e.target.value),
571
+ placeholder: "0x...",
572
+ required: true,
573
+ style: { width: "100%", padding: "0.5rem", marginTop: "0.25rem" }
574
+ }
575
+ )
576
+ ] }),
577
+ /* @__PURE__ */ jsx(
578
+ "button",
579
+ {
580
+ type: "submit",
581
+ disabled: isLoading || !reference || !transactionHash,
582
+ style: {
583
+ width: "100%",
584
+ padding: "0.75rem",
585
+ backgroundColor: isLoading ? "#ccc" : "#28a745",
586
+ color: "white",
587
+ border: "none",
588
+ borderRadius: "0.25rem",
589
+ fontSize: "1rem",
590
+ cursor: isLoading ? "not-allowed" : "pointer"
591
+ },
592
+ children: isLoading ? "Processing..." : `Purchase for ${formatCurrency(sku.price, sku.currency)}`
593
+ }
594
+ )
595
+ ] })
596
+ ] });
597
+ }
598
+
599
+ export { ChipiProvider, SkuList, SkuPurchaseForm, TransactionForm, WalletBalance, WalletCreator, useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, usePurchaseSku, useSkuTransactions, useSkus, useStakeVesuUsdc, useTransfer, useWallets, useWithdrawVesuUsdc };
600
+ //# sourceMappingURL=index.mjs.map
601
+ //# sourceMappingURL=index.mjs.map