@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 +21 -0
- package/README.md +51 -33
- package/dist/hooks.d.mts +13 -9
- package/dist/hooks.d.ts +13 -9
- package/dist/hooks.js +120 -115
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +120 -115
- 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 +121 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
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
|
-
#
|
|
1
|
+
# @chipi-stack/chipi-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React hooks for Chipi Pay. Provides wallet creation, transfers, SKU purchases, and session management.
|
|
4
4
|
|
|
5
|
-
##
|
|
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
|
-
##
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
##
|
|
55
|
+
## Documentation
|
|
38
56
|
|
|
39
|
-
|
|
57
|
+
Full docs at [docs.chipipay.com](https://docs.chipipay.com)
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
## License
|
|
42
60
|
|
|
43
|
-
|
|
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>,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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>,
|
|
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>,
|
|
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>,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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>,
|
|
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>,
|
|
1282
|
+
queryOptions?: Omit<UseQueryOptions<GetTokenBalanceResponse, Error>, "queryKey" | "queryFn">;
|
|
1279
1283
|
};
|
|
1280
1284
|
declare function useGetTokenBalance(input?: GetTokenBalanceInput): {
|
|
1281
1285
|
fetchTokenBalance: (newInput: GetTokenBalanceInput) => Promise<GetTokenBalanceResponse>;
|