@chipi-stack/chipi-react 13.13.0 → 14.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Chipi Pay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,43 +1,61 @@
1
- # Chipi SDK
1
+ # @chipi-stack/chipi-react
2
2
 
3
- Chipi SDK is the easiest way to integrate USDC staking and withdrawal functionality into your React/Next.js application. Add secure wallet management, token staking, and withdrawals to your application in minutes. All transactions are sponsored thanks to Avnu's paymaster.
3
+ React hooks for Chipi Pay. Provides wallet creation, transfers, SKU purchases, and session management.
4
4
 
5
- ## Prerequisites
6
-
7
- - React 18 or later
8
- - Node.js >=18.17.0 or later
9
- - A Chipi account. [Create your account for free](https://dashboard.chipipay.com)
10
-
11
- ## Installation
12
-
13
- The fastest way to get started with Chipi SDK is by following our [Quickstart Guide](https://docs.chipipay.com/gasless/quickstart).
5
+ ## Install
14
6
 
15
7
  ```bash
16
- npm install @chipi-stack/chipi-react
17
- # or
18
- yarn add @chipi-stack/chipi-react
8
+ npm install @chipi-stack/chipi-react @chipi-stack/backend @chipi-stack/types
19
9
  ```
20
10
 
21
- ## Usage
22
-
23
- For detailed information, guides, and examples visit our [documentation](https://docs.chipipay.com).
24
-
25
- ## Support
26
-
27
- You can get in touch with us in any of the following ways:
28
-
29
- - Join our [Telegram community](https://t.me/chipi_pay)
30
- - Visit our [YouTube channel](https://www.youtube.com/@chipipay) for tutorials
31
- - Email us at support@chipi.com
32
-
33
- ## Contributing
34
-
35
- We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines and code of conduct.
11
+ ## Quick Start
12
+
13
+ ```tsx
14
+ import { ChipiProvider, useChipiWallet, useTransfer } from "@chipi-stack/chipi-react";
15
+ import type { ChainToken } from "@chipi-stack/types";
16
+
17
+ function App() {
18
+ return (
19
+ <ChipiProvider config={{ apiPublicKey: "your-key" }}>
20
+ <Wallet />
21
+ </ChipiProvider>
22
+ );
23
+ }
24
+
25
+ function Wallet() {
26
+ const { wallet } = useChipiWallet({
27
+ externalUserId: "user-123",
28
+ getBearerToken: async () => "your-bearer-token",
29
+ });
30
+ const { transfer, isLoading } = useTransfer();
31
+
32
+ if (!wallet) return <p>Loading wallet...</p>;
33
+
34
+ return (
35
+ <button
36
+ onClick={() =>
37
+ transfer({
38
+ params: {
39
+ wallet,
40
+ token: "USDC" as ChainToken,
41
+ recipient: "0x...",
42
+ amount: 10,
43
+ encryptKey: "user-pin",
44
+ },
45
+ bearerToken: "your-bearer-token",
46
+ })
47
+ }
48
+ >
49
+ {isLoading ? "Sending..." : "Send 10 USDC"}
50
+ </button>
51
+ );
52
+ }
53
+ ```
36
54
 
37
- ## Security
55
+ ## Documentation
38
56
 
39
- @chipi-stack/chipi-react follows best practices for security, but 100% security cannot be assured.
57
+ Full docs at [docs.chipipay.com](https://docs.chipipay.com)
40
58
 
41
- @chipi-stack/chipi-react is provided "as is" without any warranty. Use at your own risk.
59
+ ## License
42
60
 
43
- For more information and to report security issues, please refer to our [security documentation](https://docs.chipipay.com).
61
+ MIT
package/dist/hooks.d.mts CHANGED
@@ -524,10 +524,14 @@ declare function useApprove(): {
524
524
  type TransactionListInput = {
525
525
  query: GetTransactionListQuery;
526
526
  getBearerToken?: () => Promise<string | null | undefined>;
527
- queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Transaction>, Error>, 'queryKey' | 'queryFn'>;
527
+ queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Transaction>, Error>, "queryKey" | "queryFn">;
528
+ };
529
+ type FetchTransactionListInput = {
530
+ query: GetTransactionListQuery;
531
+ getBearerToken: () => Promise<string | null | undefined>;
528
532
  };
529
533
  declare function useGetTransactionList(input?: TransactionListInput): {
530
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
534
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
531
535
  data: PaginatedResponse<Transaction>;
532
536
  error: Error;
533
537
  isError: true;
@@ -555,7 +559,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
555
559
  fetchStatus: _tanstack_react_query.FetchStatus;
556
560
  promise: Promise<PaginatedResponse<Transaction>>;
557
561
  } | {
558
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
562
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
559
563
  data: PaginatedResponse<Transaction>;
560
564
  error: null;
561
565
  isError: false;
@@ -583,7 +587,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
583
587
  fetchStatus: _tanstack_react_query.FetchStatus;
584
588
  promise: Promise<PaginatedResponse<Transaction>>;
585
589
  } | {
586
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
590
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
587
591
  data: undefined;
588
592
  error: Error;
589
593
  isError: true;
@@ -611,7 +615,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
611
615
  fetchStatus: _tanstack_react_query.FetchStatus;
612
616
  promise: Promise<PaginatedResponse<Transaction>>;
613
617
  } | {
614
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
618
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
615
619
  data: undefined;
616
620
  error: null;
617
621
  isError: false;
@@ -639,7 +643,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
639
643
  fetchStatus: _tanstack_react_query.FetchStatus;
640
644
  promise: Promise<PaginatedResponse<Transaction>>;
641
645
  } | {
642
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
646
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
643
647
  data: undefined;
644
648
  error: null;
645
649
  isError: false;
@@ -667,7 +671,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
667
671
  fetchStatus: _tanstack_react_query.FetchStatus;
668
672
  promise: Promise<PaginatedResponse<Transaction>>;
669
673
  } | {
670
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
674
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
671
675
  data: PaginatedResponse<Transaction>;
672
676
  isError: false;
673
677
  error: null;
@@ -892,7 +896,7 @@ declare function useGetSkuPurchase(input?: GetSkuPurchaseInput): {
892
896
  type SkuListInput = {
893
897
  query: GetSkuListQuery;
894
898
  getBearerToken?: () => Promise<string | null | undefined>;
895
- queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Sku>, Error>, 'queryKey' | 'queryFn'>;
899
+ queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Sku>, Error>, "queryKey" | "queryFn">;
896
900
  };
897
901
  declare function useGetSkuList(input?: SkuListInput): {
898
902
  fetchSkuList: (newInput: SkuListInput) => Promise<PaginatedResponse<Sku>>;
@@ -1275,7 +1279,7 @@ declare function useRecordSendTransaction(): {
1275
1279
  type GetTokenBalanceInput = {
1276
1280
  params?: GetTokenBalanceParams;
1277
1281
  getBearerToken?: () => Promise<string | null | undefined>;
1278
- queryOptions?: Omit<UseQueryOptions<GetTokenBalanceResponse, Error>, 'queryKey' | 'queryFn'>;
1282
+ queryOptions?: Omit<UseQueryOptions<GetTokenBalanceResponse, Error>, "queryKey" | "queryFn">;
1279
1283
  };
1280
1284
  declare function useGetTokenBalance(input?: GetTokenBalanceInput): {
1281
1285
  fetchTokenBalance: (newInput: GetTokenBalanceInput) => Promise<GetTokenBalanceResponse>;
package/dist/hooks.d.ts CHANGED
@@ -524,10 +524,14 @@ declare function useApprove(): {
524
524
  type TransactionListInput = {
525
525
  query: GetTransactionListQuery;
526
526
  getBearerToken?: () => Promise<string | null | undefined>;
527
- queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Transaction>, Error>, 'queryKey' | 'queryFn'>;
527
+ queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Transaction>, Error>, "queryKey" | "queryFn">;
528
+ };
529
+ type FetchTransactionListInput = {
530
+ query: GetTransactionListQuery;
531
+ getBearerToken: () => Promise<string | null | undefined>;
528
532
  };
529
533
  declare function useGetTransactionList(input?: TransactionListInput): {
530
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
534
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
531
535
  data: PaginatedResponse<Transaction>;
532
536
  error: Error;
533
537
  isError: true;
@@ -555,7 +559,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
555
559
  fetchStatus: _tanstack_react_query.FetchStatus;
556
560
  promise: Promise<PaginatedResponse<Transaction>>;
557
561
  } | {
558
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
562
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
559
563
  data: PaginatedResponse<Transaction>;
560
564
  error: null;
561
565
  isError: false;
@@ -583,7 +587,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
583
587
  fetchStatus: _tanstack_react_query.FetchStatus;
584
588
  promise: Promise<PaginatedResponse<Transaction>>;
585
589
  } | {
586
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
590
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
587
591
  data: undefined;
588
592
  error: Error;
589
593
  isError: true;
@@ -611,7 +615,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
611
615
  fetchStatus: _tanstack_react_query.FetchStatus;
612
616
  promise: Promise<PaginatedResponse<Transaction>>;
613
617
  } | {
614
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
618
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
615
619
  data: undefined;
616
620
  error: null;
617
621
  isError: false;
@@ -639,7 +643,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
639
643
  fetchStatus: _tanstack_react_query.FetchStatus;
640
644
  promise: Promise<PaginatedResponse<Transaction>>;
641
645
  } | {
642
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
646
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
643
647
  data: undefined;
644
648
  error: null;
645
649
  isError: false;
@@ -667,7 +671,7 @@ declare function useGetTransactionList(input?: TransactionListInput): {
667
671
  fetchStatus: _tanstack_react_query.FetchStatus;
668
672
  promise: Promise<PaginatedResponse<Transaction>>;
669
673
  } | {
670
- fetchTransactionList: (newInput: TransactionListInput) => Promise<PaginatedResponse<Transaction>>;
674
+ fetchTransactionList: (newInput: FetchTransactionListInput) => Promise<PaginatedResponse<Transaction>>;
671
675
  data: PaginatedResponse<Transaction>;
672
676
  isError: false;
673
677
  error: null;
@@ -892,7 +896,7 @@ declare function useGetSkuPurchase(input?: GetSkuPurchaseInput): {
892
896
  type SkuListInput = {
893
897
  query: GetSkuListQuery;
894
898
  getBearerToken?: () => Promise<string | null | undefined>;
895
- queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Sku>, Error>, 'queryKey' | 'queryFn'>;
899
+ queryOptions?: Omit<UseQueryOptions<PaginatedResponse<Sku>, Error>, "queryKey" | "queryFn">;
896
900
  };
897
901
  declare function useGetSkuList(input?: SkuListInput): {
898
902
  fetchSkuList: (newInput: SkuListInput) => Promise<PaginatedResponse<Sku>>;
@@ -1275,7 +1279,7 @@ declare function useRecordSendTransaction(): {
1275
1279
  type GetTokenBalanceInput = {
1276
1280
  params?: GetTokenBalanceParams;
1277
1281
  getBearerToken?: () => Promise<string | null | undefined>;
1278
- queryOptions?: Omit<UseQueryOptions<GetTokenBalanceResponse, Error>, 'queryKey' | 'queryFn'>;
1282
+ queryOptions?: Omit<UseQueryOptions<GetTokenBalanceResponse, Error>, "queryKey" | "queryFn">;
1279
1283
  };
1280
1284
  declare function useGetTokenBalance(input?: GetTokenBalanceInput): {
1281
1285
  fetchTokenBalance: (newInput: GetTokenBalanceInput) => Promise<GetTokenBalanceResponse>;