@chipi-stack/chipi-react 11.6.0 → 11.8.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/hooks.d.mts +374 -6
- package/dist/hooks.d.ts +374 -6
- package/dist/hooks.js +117 -4
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +115 -5
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +117 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +115 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -6
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse,
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, TransferHookInput, ApproveHookInput, CreateSkuTransactionParams, SkuTransaction, GetSkusQuery, PaginatedResponse, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, Transaction, GetTokenBalanceParams, GetTokenBalanceResponse } from '@chipi-stack/types';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -240,7 +240,7 @@ declare function useGetWallet(input?: GetWalletInput): {
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
type TransferInput = {
|
|
243
|
-
params:
|
|
243
|
+
params: TransferHookInput;
|
|
244
244
|
bearerToken: string;
|
|
245
245
|
};
|
|
246
246
|
/**
|
|
@@ -258,7 +258,7 @@ declare function useTransfer(): {
|
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
type ApproveInput = {
|
|
261
|
-
params:
|
|
261
|
+
params: ApproveHookInput;
|
|
262
262
|
bearerToken: string;
|
|
263
263
|
};
|
|
264
264
|
/**
|
|
@@ -275,8 +275,376 @@ declare function useApprove(): {
|
|
|
275
275
|
reset: () => void;
|
|
276
276
|
};
|
|
277
277
|
|
|
278
|
+
type CreateSkuTransactionInput = {
|
|
279
|
+
params: CreateSkuTransactionParams;
|
|
280
|
+
bearerToken: string;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Hook for creating SKU transactions
|
|
284
|
+
*/
|
|
285
|
+
declare function useCreateSkuTransaction(): {
|
|
286
|
+
createSkuTransaction: (input: CreateSkuTransactionInput) => void;
|
|
287
|
+
createSkuTransactionAsync: (input: CreateSkuTransactionInput) => Promise<SkuTransaction>;
|
|
288
|
+
data: SkuTransaction | undefined;
|
|
289
|
+
isLoading: boolean;
|
|
290
|
+
isError: boolean;
|
|
291
|
+
error: Error | null;
|
|
292
|
+
isSuccess: boolean;
|
|
293
|
+
reset: () => void;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
type GetSkuTransactionByIdInput = {
|
|
297
|
+
id: string;
|
|
298
|
+
getBearerToken?: () => Promise<string | null | undefined>;
|
|
299
|
+
queryOptions?: Omit<UseQueryOptions<SkuTransaction, Error>, 'queryKey' | 'queryFn'>;
|
|
300
|
+
};
|
|
301
|
+
declare function useGetSkuTransactionById(input?: GetSkuTransactionByIdInput): {
|
|
302
|
+
fetchSkuTransactionById: (newInput: GetSkuTransactionByIdInput) => Promise<SkuTransaction>;
|
|
303
|
+
data: SkuTransaction;
|
|
304
|
+
error: Error;
|
|
305
|
+
isError: true;
|
|
306
|
+
isPending: false;
|
|
307
|
+
isLoading: false;
|
|
308
|
+
isLoadingError: false;
|
|
309
|
+
isRefetchError: true;
|
|
310
|
+
isSuccess: false;
|
|
311
|
+
isPlaceholderData: false;
|
|
312
|
+
status: "error";
|
|
313
|
+
dataUpdatedAt: number;
|
|
314
|
+
errorUpdatedAt: number;
|
|
315
|
+
failureCount: number;
|
|
316
|
+
failureReason: Error | null;
|
|
317
|
+
errorUpdateCount: number;
|
|
318
|
+
isFetched: boolean;
|
|
319
|
+
isFetchedAfterMount: boolean;
|
|
320
|
+
isFetching: boolean;
|
|
321
|
+
isInitialLoading: boolean;
|
|
322
|
+
isPaused: boolean;
|
|
323
|
+
isRefetching: boolean;
|
|
324
|
+
isStale: boolean;
|
|
325
|
+
isEnabled: boolean;
|
|
326
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SkuTransaction, Error>>;
|
|
327
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
328
|
+
promise: Promise<SkuTransaction>;
|
|
329
|
+
} | {
|
|
330
|
+
fetchSkuTransactionById: (newInput: GetSkuTransactionByIdInput) => Promise<SkuTransaction>;
|
|
331
|
+
data: SkuTransaction;
|
|
332
|
+
error: null;
|
|
333
|
+
isError: false;
|
|
334
|
+
isPending: false;
|
|
335
|
+
isLoading: false;
|
|
336
|
+
isLoadingError: false;
|
|
337
|
+
isRefetchError: false;
|
|
338
|
+
isSuccess: true;
|
|
339
|
+
isPlaceholderData: false;
|
|
340
|
+
status: "success";
|
|
341
|
+
dataUpdatedAt: number;
|
|
342
|
+
errorUpdatedAt: number;
|
|
343
|
+
failureCount: number;
|
|
344
|
+
failureReason: Error | null;
|
|
345
|
+
errorUpdateCount: number;
|
|
346
|
+
isFetched: boolean;
|
|
347
|
+
isFetchedAfterMount: boolean;
|
|
348
|
+
isFetching: boolean;
|
|
349
|
+
isInitialLoading: boolean;
|
|
350
|
+
isPaused: boolean;
|
|
351
|
+
isRefetching: boolean;
|
|
352
|
+
isStale: boolean;
|
|
353
|
+
isEnabled: boolean;
|
|
354
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SkuTransaction, Error>>;
|
|
355
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
356
|
+
promise: Promise<SkuTransaction>;
|
|
357
|
+
} | {
|
|
358
|
+
fetchSkuTransactionById: (newInput: GetSkuTransactionByIdInput) => Promise<SkuTransaction>;
|
|
359
|
+
data: undefined;
|
|
360
|
+
error: Error;
|
|
361
|
+
isError: true;
|
|
362
|
+
isPending: false;
|
|
363
|
+
isLoading: false;
|
|
364
|
+
isLoadingError: true;
|
|
365
|
+
isRefetchError: false;
|
|
366
|
+
isSuccess: false;
|
|
367
|
+
isPlaceholderData: false;
|
|
368
|
+
status: "error";
|
|
369
|
+
dataUpdatedAt: number;
|
|
370
|
+
errorUpdatedAt: number;
|
|
371
|
+
failureCount: number;
|
|
372
|
+
failureReason: Error | null;
|
|
373
|
+
errorUpdateCount: number;
|
|
374
|
+
isFetched: boolean;
|
|
375
|
+
isFetchedAfterMount: boolean;
|
|
376
|
+
isFetching: boolean;
|
|
377
|
+
isInitialLoading: boolean;
|
|
378
|
+
isPaused: boolean;
|
|
379
|
+
isRefetching: boolean;
|
|
380
|
+
isStale: boolean;
|
|
381
|
+
isEnabled: boolean;
|
|
382
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SkuTransaction, Error>>;
|
|
383
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
384
|
+
promise: Promise<SkuTransaction>;
|
|
385
|
+
} | {
|
|
386
|
+
fetchSkuTransactionById: (newInput: GetSkuTransactionByIdInput) => Promise<SkuTransaction>;
|
|
387
|
+
data: undefined;
|
|
388
|
+
error: null;
|
|
389
|
+
isError: false;
|
|
390
|
+
isPending: true;
|
|
391
|
+
isLoading: true;
|
|
392
|
+
isLoadingError: false;
|
|
393
|
+
isRefetchError: false;
|
|
394
|
+
isSuccess: false;
|
|
395
|
+
isPlaceholderData: false;
|
|
396
|
+
status: "pending";
|
|
397
|
+
dataUpdatedAt: number;
|
|
398
|
+
errorUpdatedAt: number;
|
|
399
|
+
failureCount: number;
|
|
400
|
+
failureReason: Error | null;
|
|
401
|
+
errorUpdateCount: number;
|
|
402
|
+
isFetched: boolean;
|
|
403
|
+
isFetchedAfterMount: boolean;
|
|
404
|
+
isFetching: boolean;
|
|
405
|
+
isInitialLoading: boolean;
|
|
406
|
+
isPaused: boolean;
|
|
407
|
+
isRefetching: boolean;
|
|
408
|
+
isStale: boolean;
|
|
409
|
+
isEnabled: boolean;
|
|
410
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SkuTransaction, Error>>;
|
|
411
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
412
|
+
promise: Promise<SkuTransaction>;
|
|
413
|
+
} | {
|
|
414
|
+
fetchSkuTransactionById: (newInput: GetSkuTransactionByIdInput) => Promise<SkuTransaction>;
|
|
415
|
+
data: undefined;
|
|
416
|
+
error: null;
|
|
417
|
+
isError: false;
|
|
418
|
+
isPending: true;
|
|
419
|
+
isLoadingError: false;
|
|
420
|
+
isRefetchError: false;
|
|
421
|
+
isSuccess: false;
|
|
422
|
+
isPlaceholderData: false;
|
|
423
|
+
status: "pending";
|
|
424
|
+
dataUpdatedAt: number;
|
|
425
|
+
errorUpdatedAt: number;
|
|
426
|
+
failureCount: number;
|
|
427
|
+
failureReason: Error | null;
|
|
428
|
+
errorUpdateCount: number;
|
|
429
|
+
isFetched: boolean;
|
|
430
|
+
isFetchedAfterMount: boolean;
|
|
431
|
+
isFetching: boolean;
|
|
432
|
+
isLoading: boolean;
|
|
433
|
+
isInitialLoading: boolean;
|
|
434
|
+
isPaused: boolean;
|
|
435
|
+
isRefetching: boolean;
|
|
436
|
+
isStale: boolean;
|
|
437
|
+
isEnabled: boolean;
|
|
438
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SkuTransaction, Error>>;
|
|
439
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
440
|
+
promise: Promise<SkuTransaction>;
|
|
441
|
+
} | {
|
|
442
|
+
fetchSkuTransactionById: (newInput: GetSkuTransactionByIdInput) => Promise<SkuTransaction>;
|
|
443
|
+
data: SkuTransaction;
|
|
444
|
+
isError: false;
|
|
445
|
+
error: null;
|
|
446
|
+
isPending: false;
|
|
447
|
+
isLoading: false;
|
|
448
|
+
isLoadingError: false;
|
|
449
|
+
isRefetchError: false;
|
|
450
|
+
isSuccess: true;
|
|
451
|
+
isPlaceholderData: true;
|
|
452
|
+
status: "success";
|
|
453
|
+
dataUpdatedAt: number;
|
|
454
|
+
errorUpdatedAt: number;
|
|
455
|
+
failureCount: number;
|
|
456
|
+
failureReason: Error | null;
|
|
457
|
+
errorUpdateCount: number;
|
|
458
|
+
isFetched: boolean;
|
|
459
|
+
isFetchedAfterMount: boolean;
|
|
460
|
+
isFetching: boolean;
|
|
461
|
+
isInitialLoading: boolean;
|
|
462
|
+
isPaused: boolean;
|
|
463
|
+
isRefetching: boolean;
|
|
464
|
+
isStale: boolean;
|
|
465
|
+
isEnabled: boolean;
|
|
466
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SkuTransaction, Error>>;
|
|
467
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
468
|
+
promise: Promise<SkuTransaction>;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
type GetSkusInput = {
|
|
472
|
+
query?: GetSkusQuery;
|
|
473
|
+
getBearerToken?: () => Promise<string | null | undefined>;
|
|
474
|
+
queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Sku>, Error>, 'queryKey' | 'queryFn'>;
|
|
475
|
+
};
|
|
476
|
+
declare function useGetSkus(input?: GetSkusInput): {
|
|
477
|
+
fetchAvailableSkus: (newInput: GetSkusInput) => Promise<PaginatedResponse<Sku>>;
|
|
478
|
+
data: PaginatedResponse<Sku>;
|
|
479
|
+
error: Error;
|
|
480
|
+
isError: true;
|
|
481
|
+
isPending: false;
|
|
482
|
+
isLoading: false;
|
|
483
|
+
isLoadingError: false;
|
|
484
|
+
isRefetchError: true;
|
|
485
|
+
isSuccess: false;
|
|
486
|
+
isPlaceholderData: false;
|
|
487
|
+
status: "error";
|
|
488
|
+
dataUpdatedAt: number;
|
|
489
|
+
errorUpdatedAt: number;
|
|
490
|
+
failureCount: number;
|
|
491
|
+
failureReason: Error | null;
|
|
492
|
+
errorUpdateCount: number;
|
|
493
|
+
isFetched: boolean;
|
|
494
|
+
isFetchedAfterMount: boolean;
|
|
495
|
+
isFetching: boolean;
|
|
496
|
+
isInitialLoading: boolean;
|
|
497
|
+
isPaused: boolean;
|
|
498
|
+
isRefetching: boolean;
|
|
499
|
+
isStale: boolean;
|
|
500
|
+
isEnabled: boolean;
|
|
501
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PaginatedResponse<Sku>, Error>>;
|
|
502
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
503
|
+
promise: Promise<PaginatedResponse<Sku>>;
|
|
504
|
+
} | {
|
|
505
|
+
fetchAvailableSkus: (newInput: GetSkusInput) => Promise<PaginatedResponse<Sku>>;
|
|
506
|
+
data: PaginatedResponse<Sku>;
|
|
507
|
+
error: null;
|
|
508
|
+
isError: false;
|
|
509
|
+
isPending: false;
|
|
510
|
+
isLoading: false;
|
|
511
|
+
isLoadingError: false;
|
|
512
|
+
isRefetchError: false;
|
|
513
|
+
isSuccess: true;
|
|
514
|
+
isPlaceholderData: false;
|
|
515
|
+
status: "success";
|
|
516
|
+
dataUpdatedAt: number;
|
|
517
|
+
errorUpdatedAt: number;
|
|
518
|
+
failureCount: number;
|
|
519
|
+
failureReason: Error | null;
|
|
520
|
+
errorUpdateCount: number;
|
|
521
|
+
isFetched: boolean;
|
|
522
|
+
isFetchedAfterMount: boolean;
|
|
523
|
+
isFetching: boolean;
|
|
524
|
+
isInitialLoading: boolean;
|
|
525
|
+
isPaused: boolean;
|
|
526
|
+
isRefetching: boolean;
|
|
527
|
+
isStale: boolean;
|
|
528
|
+
isEnabled: boolean;
|
|
529
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PaginatedResponse<Sku>, Error>>;
|
|
530
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
531
|
+
promise: Promise<PaginatedResponse<Sku>>;
|
|
532
|
+
} | {
|
|
533
|
+
fetchAvailableSkus: (newInput: GetSkusInput) => Promise<PaginatedResponse<Sku>>;
|
|
534
|
+
data: undefined;
|
|
535
|
+
error: Error;
|
|
536
|
+
isError: true;
|
|
537
|
+
isPending: false;
|
|
538
|
+
isLoading: false;
|
|
539
|
+
isLoadingError: true;
|
|
540
|
+
isRefetchError: false;
|
|
541
|
+
isSuccess: false;
|
|
542
|
+
isPlaceholderData: false;
|
|
543
|
+
status: "error";
|
|
544
|
+
dataUpdatedAt: number;
|
|
545
|
+
errorUpdatedAt: number;
|
|
546
|
+
failureCount: number;
|
|
547
|
+
failureReason: Error | null;
|
|
548
|
+
errorUpdateCount: number;
|
|
549
|
+
isFetched: boolean;
|
|
550
|
+
isFetchedAfterMount: boolean;
|
|
551
|
+
isFetching: boolean;
|
|
552
|
+
isInitialLoading: boolean;
|
|
553
|
+
isPaused: boolean;
|
|
554
|
+
isRefetching: boolean;
|
|
555
|
+
isStale: boolean;
|
|
556
|
+
isEnabled: boolean;
|
|
557
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PaginatedResponse<Sku>, Error>>;
|
|
558
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
559
|
+
promise: Promise<PaginatedResponse<Sku>>;
|
|
560
|
+
} | {
|
|
561
|
+
fetchAvailableSkus: (newInput: GetSkusInput) => Promise<PaginatedResponse<Sku>>;
|
|
562
|
+
data: undefined;
|
|
563
|
+
error: null;
|
|
564
|
+
isError: false;
|
|
565
|
+
isPending: true;
|
|
566
|
+
isLoading: true;
|
|
567
|
+
isLoadingError: false;
|
|
568
|
+
isRefetchError: false;
|
|
569
|
+
isSuccess: false;
|
|
570
|
+
isPlaceholderData: false;
|
|
571
|
+
status: "pending";
|
|
572
|
+
dataUpdatedAt: number;
|
|
573
|
+
errorUpdatedAt: number;
|
|
574
|
+
failureCount: number;
|
|
575
|
+
failureReason: Error | null;
|
|
576
|
+
errorUpdateCount: number;
|
|
577
|
+
isFetched: boolean;
|
|
578
|
+
isFetchedAfterMount: boolean;
|
|
579
|
+
isFetching: boolean;
|
|
580
|
+
isInitialLoading: boolean;
|
|
581
|
+
isPaused: boolean;
|
|
582
|
+
isRefetching: boolean;
|
|
583
|
+
isStale: boolean;
|
|
584
|
+
isEnabled: boolean;
|
|
585
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PaginatedResponse<Sku>, Error>>;
|
|
586
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
587
|
+
promise: Promise<PaginatedResponse<Sku>>;
|
|
588
|
+
} | {
|
|
589
|
+
fetchAvailableSkus: (newInput: GetSkusInput) => Promise<PaginatedResponse<Sku>>;
|
|
590
|
+
data: undefined;
|
|
591
|
+
error: null;
|
|
592
|
+
isError: false;
|
|
593
|
+
isPending: true;
|
|
594
|
+
isLoadingError: false;
|
|
595
|
+
isRefetchError: false;
|
|
596
|
+
isSuccess: false;
|
|
597
|
+
isPlaceholderData: false;
|
|
598
|
+
status: "pending";
|
|
599
|
+
dataUpdatedAt: number;
|
|
600
|
+
errorUpdatedAt: number;
|
|
601
|
+
failureCount: number;
|
|
602
|
+
failureReason: Error | null;
|
|
603
|
+
errorUpdateCount: number;
|
|
604
|
+
isFetched: boolean;
|
|
605
|
+
isFetchedAfterMount: boolean;
|
|
606
|
+
isFetching: boolean;
|
|
607
|
+
isLoading: boolean;
|
|
608
|
+
isInitialLoading: boolean;
|
|
609
|
+
isPaused: boolean;
|
|
610
|
+
isRefetching: boolean;
|
|
611
|
+
isStale: boolean;
|
|
612
|
+
isEnabled: boolean;
|
|
613
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PaginatedResponse<Sku>, Error>>;
|
|
614
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
615
|
+
promise: Promise<PaginatedResponse<Sku>>;
|
|
616
|
+
} | {
|
|
617
|
+
fetchAvailableSkus: (newInput: GetSkusInput) => Promise<PaginatedResponse<Sku>>;
|
|
618
|
+
data: PaginatedResponse<Sku>;
|
|
619
|
+
isError: false;
|
|
620
|
+
error: null;
|
|
621
|
+
isPending: false;
|
|
622
|
+
isLoading: false;
|
|
623
|
+
isLoadingError: false;
|
|
624
|
+
isRefetchError: false;
|
|
625
|
+
isSuccess: true;
|
|
626
|
+
isPlaceholderData: true;
|
|
627
|
+
status: "success";
|
|
628
|
+
dataUpdatedAt: number;
|
|
629
|
+
errorUpdatedAt: number;
|
|
630
|
+
failureCount: number;
|
|
631
|
+
failureReason: Error | null;
|
|
632
|
+
errorUpdateCount: number;
|
|
633
|
+
isFetched: boolean;
|
|
634
|
+
isFetchedAfterMount: boolean;
|
|
635
|
+
isFetching: boolean;
|
|
636
|
+
isInitialLoading: boolean;
|
|
637
|
+
isPaused: boolean;
|
|
638
|
+
isRefetching: boolean;
|
|
639
|
+
isStale: boolean;
|
|
640
|
+
isEnabled: boolean;
|
|
641
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<PaginatedResponse<Sku>, Error>>;
|
|
642
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
643
|
+
promise: Promise<PaginatedResponse<Sku>>;
|
|
644
|
+
};
|
|
645
|
+
|
|
278
646
|
type StakeVesuUsdcInput = {
|
|
279
|
-
params:
|
|
647
|
+
params: StakeVesuUsdcHookInputParams;
|
|
280
648
|
bearerToken: string;
|
|
281
649
|
};
|
|
282
650
|
/**
|
|
@@ -294,7 +662,7 @@ declare function useStakeVesuUsdc(): {
|
|
|
294
662
|
};
|
|
295
663
|
|
|
296
664
|
type WithdrawVesuUsdcInput = {
|
|
297
|
-
params:
|
|
665
|
+
params: WithdrawVesuUsdcHookInputParams;
|
|
298
666
|
bearerToken: string;
|
|
299
667
|
};
|
|
300
668
|
/**
|
|
@@ -519,4 +887,4 @@ declare function useGetTokenBalance(input?: GetTokenBalanceInput): {
|
|
|
519
887
|
promise: Promise<GetTokenBalanceResponse>;
|
|
520
888
|
};
|
|
521
889
|
|
|
522
|
-
export { useApprove, useCallAnyContract, useCreateWallet, useGetTokenBalance, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc };
|
|
890
|
+
export { useApprove, useCallAnyContract, useCreateSkuTransaction, useCreateWallet, useGetSkuTransactionById, useGetSkus, useGetTokenBalance, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc };
|
package/dist/hooks.js
CHANGED
|
@@ -74,7 +74,10 @@ function useTransfer() {
|
|
|
74
74
|
const mutation = reactQuery.useMutation(
|
|
75
75
|
{
|
|
76
76
|
mutationFn: (input) => chipiSDK.transfer({
|
|
77
|
-
params:
|
|
77
|
+
params: {
|
|
78
|
+
...input.params,
|
|
79
|
+
amount: String(input.params.amount)
|
|
80
|
+
},
|
|
78
81
|
bearerToken: input.bearerToken
|
|
79
82
|
})
|
|
80
83
|
}
|
|
@@ -93,7 +96,13 @@ function useTransfer() {
|
|
|
93
96
|
function useApprove() {
|
|
94
97
|
const { chipiSDK } = useChipiContext();
|
|
95
98
|
const mutation = reactQuery.useMutation({
|
|
96
|
-
mutationFn: (params) => chipiSDK.approve(
|
|
99
|
+
mutationFn: (params) => chipiSDK.approve({
|
|
100
|
+
params: {
|
|
101
|
+
...params.params,
|
|
102
|
+
amount: String(params.params.amount)
|
|
103
|
+
},
|
|
104
|
+
bearerToken: params.bearerToken
|
|
105
|
+
})
|
|
97
106
|
});
|
|
98
107
|
return {
|
|
99
108
|
approve: mutation.mutate,
|
|
@@ -106,10 +115,105 @@ function useApprove() {
|
|
|
106
115
|
reset: mutation.reset
|
|
107
116
|
};
|
|
108
117
|
}
|
|
118
|
+
function useCreateSkuTransaction() {
|
|
119
|
+
const { chipiSDK } = useChipiContext();
|
|
120
|
+
const mutation = reactQuery.useMutation({
|
|
121
|
+
mutationFn: (input) => chipiSDK.createSkuTransaction({
|
|
122
|
+
params: input.params,
|
|
123
|
+
bearerToken: input.bearerToken
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
createSkuTransaction: mutation.mutate,
|
|
128
|
+
createSkuTransactionAsync: mutation.mutateAsync,
|
|
129
|
+
data: mutation.data,
|
|
130
|
+
isLoading: mutation.isPending,
|
|
131
|
+
isError: mutation.isError,
|
|
132
|
+
error: mutation.error,
|
|
133
|
+
isSuccess: mutation.isSuccess,
|
|
134
|
+
reset: mutation.reset
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function useGetSkuTransactionById(input) {
|
|
138
|
+
const { chipiSDK } = useChipiContext();
|
|
139
|
+
const queryClient = reactQuery.useQueryClient();
|
|
140
|
+
const query = reactQuery.useQuery({
|
|
141
|
+
queryKey: ["sku-transaction", input?.id],
|
|
142
|
+
queryFn: async () => {
|
|
143
|
+
if (!input?.id) throw new Error("id is required");
|
|
144
|
+
if (!input?.getBearerToken) throw new Error("getBearerToken is required");
|
|
145
|
+
const bearerToken = await input.getBearerToken();
|
|
146
|
+
if (!bearerToken) throw new Error("Bearer token is required");
|
|
147
|
+
return chipiSDK.skuTransactions.getSkuTransactionById(input.id, bearerToken);
|
|
148
|
+
},
|
|
149
|
+
enabled: Boolean(input?.id && input?.getBearerToken),
|
|
150
|
+
...input?.queryOptions
|
|
151
|
+
});
|
|
152
|
+
const fetchSkuTransactionById = async (newInput) => {
|
|
153
|
+
return queryClient.fetchQuery({
|
|
154
|
+
queryKey: ["sku-transaction", newInput?.id],
|
|
155
|
+
queryFn: async () => {
|
|
156
|
+
if (!newInput?.id) throw new Error("id is required");
|
|
157
|
+
if (!newInput?.getBearerToken) throw new Error("getBearerToken is required");
|
|
158
|
+
const bearerToken = await newInput.getBearerToken();
|
|
159
|
+
if (!bearerToken) throw new Error("Bearer token is required");
|
|
160
|
+
return chipiSDK.skuTransactions.getSkuTransactionById(newInput.id, bearerToken);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
...query,
|
|
166
|
+
fetchSkuTransactionById
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function useGetSkus(input) {
|
|
170
|
+
const { chipiSDK } = useChipiContext();
|
|
171
|
+
const queryClient = reactQuery.useQueryClient();
|
|
172
|
+
const buildQueryKey = (q) => [
|
|
173
|
+
"available-skus",
|
|
174
|
+
q?.page ?? 1,
|
|
175
|
+
q?.limit ?? 10,
|
|
176
|
+
q?.offset ?? 0,
|
|
177
|
+
q?.provider ?? null,
|
|
178
|
+
q?.category ?? null
|
|
179
|
+
];
|
|
180
|
+
const query = reactQuery.useQuery({
|
|
181
|
+
queryKey: buildQueryKey(input?.query),
|
|
182
|
+
queryFn: async () => {
|
|
183
|
+
if (!input?.getBearerToken) throw new Error("getBearerToken is required");
|
|
184
|
+
const bearerToken = await input.getBearerToken();
|
|
185
|
+
if (!bearerToken) throw new Error("Bearer token is required");
|
|
186
|
+
return chipiSDK.skus.getSkus(bearerToken, input.query);
|
|
187
|
+
},
|
|
188
|
+
enabled: Boolean(input?.getBearerToken),
|
|
189
|
+
...input?.queryOptions
|
|
190
|
+
});
|
|
191
|
+
const fetchAvailableSkus = async (newInput) => {
|
|
192
|
+
return queryClient.fetchQuery({
|
|
193
|
+
queryKey: buildQueryKey(newInput?.query),
|
|
194
|
+
queryFn: async () => {
|
|
195
|
+
if (!newInput?.getBearerToken) throw new Error("getBearerToken is required");
|
|
196
|
+
const bearerToken = await newInput.getBearerToken();
|
|
197
|
+
if (!bearerToken) throw new Error("Bearer token is required");
|
|
198
|
+
return chipiSDK.skus.getSkus(bearerToken, newInput.query);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
...query,
|
|
204
|
+
fetchAvailableSkus
|
|
205
|
+
};
|
|
206
|
+
}
|
|
109
207
|
function useStakeVesuUsdc() {
|
|
110
208
|
const { chipiSDK } = useChipiContext();
|
|
111
209
|
const mutation = reactQuery.useMutation({
|
|
112
|
-
mutationFn: (params) => chipiSDK.stakeVesuUsdc(
|
|
210
|
+
mutationFn: (params) => chipiSDK.stakeVesuUsdc({
|
|
211
|
+
params: {
|
|
212
|
+
...params.params,
|
|
213
|
+
amount: String(params.params.amount)
|
|
214
|
+
},
|
|
215
|
+
bearerToken: params.bearerToken
|
|
216
|
+
})
|
|
113
217
|
});
|
|
114
218
|
return {
|
|
115
219
|
stakeVesuUsdc: mutation.mutate,
|
|
@@ -125,7 +229,13 @@ function useStakeVesuUsdc() {
|
|
|
125
229
|
function useWithdrawVesuUsdc() {
|
|
126
230
|
const { chipiSDK } = useChipiContext();
|
|
127
231
|
const mutation = reactQuery.useMutation({
|
|
128
|
-
mutationFn: (params) => chipiSDK.withdrawVesuUsdc(
|
|
232
|
+
mutationFn: (params) => chipiSDK.withdrawVesuUsdc({
|
|
233
|
+
params: {
|
|
234
|
+
...params.params,
|
|
235
|
+
amount: String(params.params.amount)
|
|
236
|
+
},
|
|
237
|
+
bearerToken: params.bearerToken
|
|
238
|
+
})
|
|
129
239
|
});
|
|
130
240
|
return {
|
|
131
241
|
withdrawVesuUsdc: mutation.mutate,
|
|
@@ -206,7 +316,10 @@ function useGetTokenBalance(input) {
|
|
|
206
316
|
|
|
207
317
|
exports.useApprove = useApprove;
|
|
208
318
|
exports.useCallAnyContract = useCallAnyContract;
|
|
319
|
+
exports.useCreateSkuTransaction = useCreateSkuTransaction;
|
|
209
320
|
exports.useCreateWallet = useCreateWallet;
|
|
321
|
+
exports.useGetSkuTransactionById = useGetSkuTransactionById;
|
|
322
|
+
exports.useGetSkus = useGetSkus;
|
|
210
323
|
exports.useGetTokenBalance = useGetTokenBalance;
|
|
211
324
|
exports.useGetWallet = useGetWallet;
|
|
212
325
|
exports.useRecordSendTransaction = useRecordSendTransaction;
|