@chipi-stack/chipi-react 12.8.0 → 13.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/dist/hooks.d.mts +33 -33
- package/dist/hooks.d.ts +33 -33
- package/dist/hooks.js +22 -19
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +21 -18
- 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 +22 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/hooks.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, ChainToken, GetTokenBalanceResponse, WalletType, WalletData, SessionKeyData, SessionDataResponse, CreateSessionKeyParams, SessionConfig, Call, MigrateWalletToPasskeyParams, TransferHookInput, ApproveHookInput, GetTransactionListQuery, PaginatedResponse, Transaction,
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, ChainToken, GetTokenBalanceResponse, WalletType, WalletData, SessionKeyData, SessionDataResponse, CreateSessionKeyParams, SessionConfig, Call, MigrateWalletToPasskeyParams, TransferHookInput, ApproveHookInput, GetTransactionListQuery, PaginatedResponse, Transaction, CreateSkuPurchaseParams, GetSkuListQuery, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, GetTokenBalanceParams, GetUserParams, User, CreateUserParams, AddSessionKeyParams, RevokeSessionKeyParams, GetSessionDataParams, ExecuteWithSessionParams } from '@chipi-stack/types';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -677,17 +677,17 @@ declare function useGetTransactionList(input?: TransactionListInput): {
|
|
|
677
677
|
promise: Promise<PaginatedResponse<Transaction>>;
|
|
678
678
|
};
|
|
679
679
|
|
|
680
|
-
type
|
|
681
|
-
params:
|
|
680
|
+
type PurchaseSkuInput = {
|
|
681
|
+
params: CreateSkuPurchaseParams;
|
|
682
682
|
bearerToken: string;
|
|
683
683
|
};
|
|
684
684
|
/**
|
|
685
|
-
* Hook for
|
|
685
|
+
* Hook for purchasing SKUs
|
|
686
686
|
*/
|
|
687
|
-
declare function
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
data:
|
|
687
|
+
declare function usePurchaseSku(): {
|
|
688
|
+
purchaseSku: (input: PurchaseSkuInput) => void;
|
|
689
|
+
purchaseSkuAsync: (input: PurchaseSkuInput) => Promise<Transaction>;
|
|
690
|
+
data: Transaction | undefined;
|
|
691
691
|
isLoading: boolean;
|
|
692
692
|
isError: boolean;
|
|
693
693
|
error: Error | null;
|
|
@@ -695,14 +695,14 @@ declare function useCreateSkuTransaction(): {
|
|
|
695
695
|
reset: () => void;
|
|
696
696
|
};
|
|
697
697
|
|
|
698
|
-
type
|
|
698
|
+
type GetSkuPurchaseInput = {
|
|
699
699
|
id: string;
|
|
700
700
|
getBearerToken?: () => Promise<string | null | undefined>;
|
|
701
|
-
queryOptions?: Omit<UseQueryOptions<
|
|
701
|
+
queryOptions?: Omit<UseQueryOptions<Transaction, Error>, "queryKey" | "queryFn">;
|
|
702
702
|
};
|
|
703
|
-
declare function
|
|
704
|
-
|
|
705
|
-
data:
|
|
703
|
+
declare function useGetSkuPurchase(input?: GetSkuPurchaseInput): {
|
|
704
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
705
|
+
data: Transaction;
|
|
706
706
|
error: Error;
|
|
707
707
|
isError: true;
|
|
708
708
|
isPending: false;
|
|
@@ -725,12 +725,12 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
725
725
|
isRefetching: boolean;
|
|
726
726
|
isStale: boolean;
|
|
727
727
|
isEnabled: boolean;
|
|
728
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
728
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
729
729
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
730
|
-
promise: Promise<
|
|
730
|
+
promise: Promise<Transaction>;
|
|
731
731
|
} | {
|
|
732
|
-
|
|
733
|
-
data:
|
|
732
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
733
|
+
data: Transaction;
|
|
734
734
|
error: null;
|
|
735
735
|
isError: false;
|
|
736
736
|
isPending: false;
|
|
@@ -753,11 +753,11 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
753
753
|
isRefetching: boolean;
|
|
754
754
|
isStale: boolean;
|
|
755
755
|
isEnabled: boolean;
|
|
756
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
756
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
757
757
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
758
|
-
promise: Promise<
|
|
758
|
+
promise: Promise<Transaction>;
|
|
759
759
|
} | {
|
|
760
|
-
|
|
760
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
761
761
|
data: undefined;
|
|
762
762
|
error: Error;
|
|
763
763
|
isError: true;
|
|
@@ -781,11 +781,11 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
781
781
|
isRefetching: boolean;
|
|
782
782
|
isStale: boolean;
|
|
783
783
|
isEnabled: boolean;
|
|
784
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
784
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
785
785
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
786
|
-
promise: Promise<
|
|
786
|
+
promise: Promise<Transaction>;
|
|
787
787
|
} | {
|
|
788
|
-
|
|
788
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
789
789
|
data: undefined;
|
|
790
790
|
error: null;
|
|
791
791
|
isError: false;
|
|
@@ -809,11 +809,11 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
809
809
|
isRefetching: boolean;
|
|
810
810
|
isStale: boolean;
|
|
811
811
|
isEnabled: boolean;
|
|
812
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
812
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
813
813
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
814
|
-
promise: Promise<
|
|
814
|
+
promise: Promise<Transaction>;
|
|
815
815
|
} | {
|
|
816
|
-
|
|
816
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
817
817
|
data: undefined;
|
|
818
818
|
error: null;
|
|
819
819
|
isError: false;
|
|
@@ -837,12 +837,12 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
837
837
|
isRefetching: boolean;
|
|
838
838
|
isStale: boolean;
|
|
839
839
|
isEnabled: boolean;
|
|
840
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
840
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
841
841
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
842
|
-
promise: Promise<
|
|
842
|
+
promise: Promise<Transaction>;
|
|
843
843
|
} | {
|
|
844
|
-
|
|
845
|
-
data:
|
|
844
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
845
|
+
data: Transaction;
|
|
846
846
|
isError: false;
|
|
847
847
|
error: null;
|
|
848
848
|
isPending: false;
|
|
@@ -865,9 +865,9 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
865
865
|
isRefetching: boolean;
|
|
866
866
|
isStale: boolean;
|
|
867
867
|
isEnabled: boolean;
|
|
868
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
868
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
869
869
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
870
|
-
promise: Promise<
|
|
870
|
+
promise: Promise<Transaction>;
|
|
871
871
|
};
|
|
872
872
|
|
|
873
873
|
type SkuListInput = {
|
|
@@ -1896,4 +1896,4 @@ declare function useExecuteWithSession(): {
|
|
|
1896
1896
|
reset: () => void;
|
|
1897
1897
|
};
|
|
1898
1898
|
|
|
1899
|
-
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey,
|
|
1899
|
+
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateUser, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransactionList, useGetUser, useGetWallet, useMigrateWalletToPasskey, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc };
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, ChainToken, GetTokenBalanceResponse, WalletType, WalletData, SessionKeyData, SessionDataResponse, CreateSessionKeyParams, SessionConfig, Call, MigrateWalletToPasskeyParams, TransferHookInput, ApproveHookInput, GetTransactionListQuery, PaginatedResponse, Transaction,
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, ChainToken, GetTokenBalanceResponse, WalletType, WalletData, SessionKeyData, SessionDataResponse, CreateSessionKeyParams, SessionConfig, Call, MigrateWalletToPasskeyParams, TransferHookInput, ApproveHookInput, GetTransactionListQuery, PaginatedResponse, Transaction, CreateSkuPurchaseParams, GetSkuListQuery, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, GetTokenBalanceParams, GetUserParams, User, CreateUserParams, AddSessionKeyParams, RevokeSessionKeyParams, GetSessionDataParams, ExecuteWithSessionParams } from '@chipi-stack/types';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -677,17 +677,17 @@ declare function useGetTransactionList(input?: TransactionListInput): {
|
|
|
677
677
|
promise: Promise<PaginatedResponse<Transaction>>;
|
|
678
678
|
};
|
|
679
679
|
|
|
680
|
-
type
|
|
681
|
-
params:
|
|
680
|
+
type PurchaseSkuInput = {
|
|
681
|
+
params: CreateSkuPurchaseParams;
|
|
682
682
|
bearerToken: string;
|
|
683
683
|
};
|
|
684
684
|
/**
|
|
685
|
-
* Hook for
|
|
685
|
+
* Hook for purchasing SKUs
|
|
686
686
|
*/
|
|
687
|
-
declare function
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
data:
|
|
687
|
+
declare function usePurchaseSku(): {
|
|
688
|
+
purchaseSku: (input: PurchaseSkuInput) => void;
|
|
689
|
+
purchaseSkuAsync: (input: PurchaseSkuInput) => Promise<Transaction>;
|
|
690
|
+
data: Transaction | undefined;
|
|
691
691
|
isLoading: boolean;
|
|
692
692
|
isError: boolean;
|
|
693
693
|
error: Error | null;
|
|
@@ -695,14 +695,14 @@ declare function useCreateSkuTransaction(): {
|
|
|
695
695
|
reset: () => void;
|
|
696
696
|
};
|
|
697
697
|
|
|
698
|
-
type
|
|
698
|
+
type GetSkuPurchaseInput = {
|
|
699
699
|
id: string;
|
|
700
700
|
getBearerToken?: () => Promise<string | null | undefined>;
|
|
701
|
-
queryOptions?: Omit<UseQueryOptions<
|
|
701
|
+
queryOptions?: Omit<UseQueryOptions<Transaction, Error>, "queryKey" | "queryFn">;
|
|
702
702
|
};
|
|
703
|
-
declare function
|
|
704
|
-
|
|
705
|
-
data:
|
|
703
|
+
declare function useGetSkuPurchase(input?: GetSkuPurchaseInput): {
|
|
704
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
705
|
+
data: Transaction;
|
|
706
706
|
error: Error;
|
|
707
707
|
isError: true;
|
|
708
708
|
isPending: false;
|
|
@@ -725,12 +725,12 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
725
725
|
isRefetching: boolean;
|
|
726
726
|
isStale: boolean;
|
|
727
727
|
isEnabled: boolean;
|
|
728
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
728
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
729
729
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
730
|
-
promise: Promise<
|
|
730
|
+
promise: Promise<Transaction>;
|
|
731
731
|
} | {
|
|
732
|
-
|
|
733
|
-
data:
|
|
732
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
733
|
+
data: Transaction;
|
|
734
734
|
error: null;
|
|
735
735
|
isError: false;
|
|
736
736
|
isPending: false;
|
|
@@ -753,11 +753,11 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
753
753
|
isRefetching: boolean;
|
|
754
754
|
isStale: boolean;
|
|
755
755
|
isEnabled: boolean;
|
|
756
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
756
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
757
757
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
758
|
-
promise: Promise<
|
|
758
|
+
promise: Promise<Transaction>;
|
|
759
759
|
} | {
|
|
760
|
-
|
|
760
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
761
761
|
data: undefined;
|
|
762
762
|
error: Error;
|
|
763
763
|
isError: true;
|
|
@@ -781,11 +781,11 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
781
781
|
isRefetching: boolean;
|
|
782
782
|
isStale: boolean;
|
|
783
783
|
isEnabled: boolean;
|
|
784
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
784
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
785
785
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
786
|
-
promise: Promise<
|
|
786
|
+
promise: Promise<Transaction>;
|
|
787
787
|
} | {
|
|
788
|
-
|
|
788
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
789
789
|
data: undefined;
|
|
790
790
|
error: null;
|
|
791
791
|
isError: false;
|
|
@@ -809,11 +809,11 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
809
809
|
isRefetching: boolean;
|
|
810
810
|
isStale: boolean;
|
|
811
811
|
isEnabled: boolean;
|
|
812
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
812
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
813
813
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
814
|
-
promise: Promise<
|
|
814
|
+
promise: Promise<Transaction>;
|
|
815
815
|
} | {
|
|
816
|
-
|
|
816
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
817
817
|
data: undefined;
|
|
818
818
|
error: null;
|
|
819
819
|
isError: false;
|
|
@@ -837,12 +837,12 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
837
837
|
isRefetching: boolean;
|
|
838
838
|
isStale: boolean;
|
|
839
839
|
isEnabled: boolean;
|
|
840
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
840
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
841
841
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
842
|
-
promise: Promise<
|
|
842
|
+
promise: Promise<Transaction>;
|
|
843
843
|
} | {
|
|
844
|
-
|
|
845
|
-
data:
|
|
844
|
+
fetchSkuPurchase: (newInput: GetSkuPurchaseInput) => Promise<Transaction>;
|
|
845
|
+
data: Transaction;
|
|
846
846
|
isError: false;
|
|
847
847
|
error: null;
|
|
848
848
|
isPending: false;
|
|
@@ -865,9 +865,9 @@ declare function useGetSkuTransaction(input?: GetSkuTransactionInput): {
|
|
|
865
865
|
isRefetching: boolean;
|
|
866
866
|
isStale: boolean;
|
|
867
867
|
isEnabled: boolean;
|
|
868
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
868
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Transaction, Error>>;
|
|
869
869
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
870
|
-
promise: Promise<
|
|
870
|
+
promise: Promise<Transaction>;
|
|
871
871
|
};
|
|
872
872
|
|
|
873
873
|
type SkuListInput = {
|
|
@@ -1896,4 +1896,4 @@ declare function useExecuteWithSession(): {
|
|
|
1896
1896
|
reset: () => void;
|
|
1897
1897
|
};
|
|
1898
1898
|
|
|
1899
|
-
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey,
|
|
1899
|
+
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateUser, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransactionList, useGetUser, useGetWallet, useMigrateWalletToPasskey, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc };
|
package/dist/hooks.js
CHANGED
|
@@ -6,6 +6,7 @@ var backend = require('@chipi-stack/backend');
|
|
|
6
6
|
require('react/jsx-runtime');
|
|
7
7
|
var chipiPasskey = require('@chipi-stack/chipi-passkey');
|
|
8
8
|
var shared = require('@chipi-stack/shared');
|
|
9
|
+
var types = require('@chipi-stack/types');
|
|
9
10
|
|
|
10
11
|
// src/hooks/useCreateWallet.ts
|
|
11
12
|
var ChipiContext = react.createContext(null);
|
|
@@ -133,7 +134,7 @@ function useChipiWallet(config) {
|
|
|
133
134
|
return failureCount < 3;
|
|
134
135
|
}
|
|
135
136
|
});
|
|
136
|
-
const walletPublicKey = walletQuery.data?.publicKey;
|
|
137
|
+
const walletPublicKey = walletQuery.data?.wallet.publicKey;
|
|
137
138
|
const balanceQuery = reactQuery.useQuery({
|
|
138
139
|
queryKey: ["chipi-wallet-balance", walletPublicKey, defaultToken],
|
|
139
140
|
queryFn: async () => {
|
|
@@ -142,7 +143,7 @@ function useChipiWallet(config) {
|
|
|
142
143
|
if (!bearerToken) throw new Error("Bearer token is required");
|
|
143
144
|
return chipiSDK.getTokenBalance(
|
|
144
145
|
{
|
|
145
|
-
chain:
|
|
146
|
+
chain: types.Chain.STARKNET,
|
|
146
147
|
chainToken: defaultToken,
|
|
147
148
|
walletPublicKey
|
|
148
149
|
},
|
|
@@ -164,6 +165,7 @@ function useChipiWallet(config) {
|
|
|
164
165
|
if (!bearerToken) throw new Error("Bearer token is required");
|
|
165
166
|
return chipiSDK.createWallet({
|
|
166
167
|
params: {
|
|
168
|
+
chain: types.Chain.STARKNET,
|
|
167
169
|
encryptKey,
|
|
168
170
|
externalUserId,
|
|
169
171
|
walletType
|
|
@@ -183,8 +185,8 @@ function useChipiWallet(config) {
|
|
|
183
185
|
const data = walletQuery.data;
|
|
184
186
|
return {
|
|
185
187
|
...data,
|
|
186
|
-
supportsSessionKeys: data.walletType === "CHIPI",
|
|
187
|
-
shortAddress: formatAddress(data.publicKey)
|
|
188
|
+
supportsSessionKeys: data.wallet.walletType === "CHIPI",
|
|
189
|
+
shortAddress: formatAddress(data.wallet.publicKey)
|
|
188
190
|
};
|
|
189
191
|
}, [walletQuery.data, walletQuery.isLoading]);
|
|
190
192
|
const formattedBalance = react.useMemo(() => {
|
|
@@ -192,7 +194,7 @@ function useChipiWallet(config) {
|
|
|
192
194
|
const num = Number(balanceQuery.data.balance);
|
|
193
195
|
return num.toLocaleString(void 0, {
|
|
194
196
|
minimumFractionDigits: 2,
|
|
195
|
-
maximumFractionDigits: defaultToken ===
|
|
197
|
+
maximumFractionDigits: defaultToken === types.ChainToken.ETH || defaultToken === types.ChainToken.STRK ? 6 : 2
|
|
196
198
|
});
|
|
197
199
|
}, [balanceQuery.data, defaultToken]);
|
|
198
200
|
const refetchWallet = react.useCallback(async () => {
|
|
@@ -656,17 +658,17 @@ function useGetTransactionList(input) {
|
|
|
656
658
|
fetchTransactionList
|
|
657
659
|
};
|
|
658
660
|
}
|
|
659
|
-
function
|
|
661
|
+
function usePurchaseSku() {
|
|
660
662
|
const { chipiSDK } = useChipiContext();
|
|
661
663
|
const mutation = reactQuery.useMutation({
|
|
662
|
-
mutationFn: (input) => chipiSDK.
|
|
664
|
+
mutationFn: (input) => chipiSDK.purchaseSku({
|
|
663
665
|
params: input.params,
|
|
664
666
|
bearerToken: input.bearerToken
|
|
665
667
|
})
|
|
666
668
|
});
|
|
667
669
|
return {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
+
purchaseSku: mutation.mutate,
|
|
671
|
+
purchaseSkuAsync: mutation.mutateAsync,
|
|
670
672
|
data: mutation.data,
|
|
671
673
|
isLoading: mutation.isPending,
|
|
672
674
|
isError: mutation.isError,
|
|
@@ -675,36 +677,37 @@ function useCreateSkuTransaction() {
|
|
|
675
677
|
reset: mutation.reset
|
|
676
678
|
};
|
|
677
679
|
}
|
|
678
|
-
function
|
|
680
|
+
function useGetSkuPurchase(input) {
|
|
679
681
|
const { chipiSDK } = useChipiContext();
|
|
680
682
|
const queryClient = reactQuery.useQueryClient();
|
|
681
683
|
const query = reactQuery.useQuery({
|
|
682
|
-
queryKey: ["sku-
|
|
684
|
+
queryKey: ["sku-purchase", input?.id],
|
|
683
685
|
queryFn: async () => {
|
|
684
686
|
if (!input?.id) throw new Error("id is required");
|
|
685
687
|
if (!input?.getBearerToken) throw new Error("getBearerToken is required");
|
|
686
688
|
const bearerToken = await input.getBearerToken();
|
|
687
689
|
if (!bearerToken) throw new Error("Bearer token is required");
|
|
688
|
-
return chipiSDK.
|
|
690
|
+
return chipiSDK.getSkuPurchase(input.id, bearerToken);
|
|
689
691
|
},
|
|
690
692
|
enabled: Boolean(input?.id && input?.getBearerToken),
|
|
691
693
|
...input?.queryOptions
|
|
692
694
|
});
|
|
693
|
-
const
|
|
695
|
+
const fetchSkuPurchase = async (newInput) => {
|
|
694
696
|
return queryClient.fetchQuery({
|
|
695
|
-
queryKey: ["sku-
|
|
697
|
+
queryKey: ["sku-purchase", newInput?.id],
|
|
696
698
|
queryFn: async () => {
|
|
697
699
|
if (!newInput?.id) throw new Error("id is required");
|
|
698
|
-
if (!newInput?.getBearerToken)
|
|
700
|
+
if (!newInput?.getBearerToken)
|
|
701
|
+
throw new Error("getBearerToken is required");
|
|
699
702
|
const bearerToken = await newInput.getBearerToken();
|
|
700
703
|
if (!bearerToken) throw new Error("Bearer token is required");
|
|
701
|
-
return chipiSDK.
|
|
704
|
+
return chipiSDK.getSkuPurchase(newInput.id, bearerToken);
|
|
702
705
|
}
|
|
703
706
|
});
|
|
704
707
|
};
|
|
705
708
|
return {
|
|
706
709
|
...query,
|
|
707
|
-
|
|
710
|
+
fetchSkuPurchase
|
|
708
711
|
};
|
|
709
712
|
}
|
|
710
713
|
function useGetSkuList(input) {
|
|
@@ -1182,19 +1185,19 @@ exports.useCallAnyContract = useCallAnyContract;
|
|
|
1182
1185
|
exports.useChipiSession = useChipiSession;
|
|
1183
1186
|
exports.useChipiWallet = useChipiWallet;
|
|
1184
1187
|
exports.useCreateSessionKey = useCreateSessionKey;
|
|
1185
|
-
exports.useCreateSkuTransaction = useCreateSkuTransaction;
|
|
1186
1188
|
exports.useCreateUser = useCreateUser;
|
|
1187
1189
|
exports.useCreateWallet = useCreateWallet;
|
|
1188
1190
|
exports.useExecuteWithSession = useExecuteWithSession;
|
|
1189
1191
|
exports.useGetSessionData = useGetSessionData;
|
|
1190
1192
|
exports.useGetSku = useGetSku;
|
|
1191
1193
|
exports.useGetSkuList = useGetSkuList;
|
|
1192
|
-
exports.
|
|
1194
|
+
exports.useGetSkuPurchase = useGetSkuPurchase;
|
|
1193
1195
|
exports.useGetTokenBalance = useGetTokenBalance;
|
|
1194
1196
|
exports.useGetTransactionList = useGetTransactionList;
|
|
1195
1197
|
exports.useGetUser = useGetUser;
|
|
1196
1198
|
exports.useGetWallet = useGetWallet;
|
|
1197
1199
|
exports.useMigrateWalletToPasskey = useMigrateWalletToPasskey;
|
|
1200
|
+
exports.usePurchaseSku = usePurchaseSku;
|
|
1198
1201
|
exports.useRecordSendTransaction = useRecordSendTransaction;
|
|
1199
1202
|
exports.useRevokeSessionKey = useRevokeSessionKey;
|
|
1200
1203
|
exports.useStakeVesuUsdc = useStakeVesuUsdc;
|