@chipi-stack/chipi-react 13.12.0 → 13.13.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 +21 -2
- package/dist/hooks.d.ts +21 -2
- package/dist/hooks.js +26 -0
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +26 -1
- 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 +26 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -1
- 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, CreateSkuPurchaseParams, GetSkuListQuery, Sku, CallAnyContractParams, RecordSendTransactionParams, GetTokenBalanceParams, AddSessionKeyParams, RevokeSessionKeyParams, GetSessionDataParams, ExecuteWithSessionParams } from '@chipi-stack/types';
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, ChainToken, GetTokenBalanceResponse, WalletType, WalletData, SessionKeyData, SessionDataResponse, CreateSessionKeyParams, SessionConfig, Call, MigrateWalletToPasskeyParams, UpdateWalletEncryptionParams, UpdateWalletEncryptionResponse, TransferHookInput, ApproveHookInput, GetTransactionListQuery, PaginatedResponse, Transaction, CreateSkuPurchaseParams, GetSkuListQuery, Sku, CallAnyContractParams, RecordSendTransactionParams, GetTokenBalanceParams, 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
|
|
|
@@ -466,6 +466,25 @@ declare function useMigrateWalletToPasskey(): {
|
|
|
466
466
|
reset: () => void;
|
|
467
467
|
};
|
|
468
468
|
|
|
469
|
+
type UpdateWalletEncryptionInput = UpdateWalletEncryptionParams & {
|
|
470
|
+
bearerToken: string;
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* Hook for updating a wallet's encrypted private key.
|
|
474
|
+
* Use when the user changes their passkey or PIN; the client re-encrypts the private key
|
|
475
|
+
* and sends the new ciphertext here.
|
|
476
|
+
*/
|
|
477
|
+
declare function useUpdateWalletEncryption(): {
|
|
478
|
+
updateWalletEncryption: (input: UpdateWalletEncryptionInput) => void;
|
|
479
|
+
updateWalletEncryptionAsync: (input: UpdateWalletEncryptionInput) => Promise<UpdateWalletEncryptionResponse>;
|
|
480
|
+
data: UpdateWalletEncryptionResponse | undefined;
|
|
481
|
+
isLoading: boolean;
|
|
482
|
+
isError: boolean;
|
|
483
|
+
error: Error | null;
|
|
484
|
+
isSuccess: boolean;
|
|
485
|
+
reset: () => void;
|
|
486
|
+
};
|
|
487
|
+
|
|
469
488
|
type TransferInput = {
|
|
470
489
|
params: TransferHookInput;
|
|
471
490
|
bearerToken: string;
|
|
@@ -1625,4 +1644,4 @@ declare function useExecuteWithSession(): {
|
|
|
1625
1644
|
reset: () => void;
|
|
1626
1645
|
};
|
|
1627
1646
|
|
|
1628
|
-
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransactionList, useGetWallet, useMigrateWalletToPasskey, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useTransfer };
|
|
1647
|
+
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransactionList, useGetWallet, useMigrateWalletToPasskey, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useTransfer, useUpdateWalletEncryption };
|
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, CreateSkuPurchaseParams, GetSkuListQuery, Sku, CallAnyContractParams, RecordSendTransactionParams, GetTokenBalanceParams, AddSessionKeyParams, RevokeSessionKeyParams, GetSessionDataParams, ExecuteWithSessionParams } from '@chipi-stack/types';
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, ChainToken, GetTokenBalanceResponse, WalletType, WalletData, SessionKeyData, SessionDataResponse, CreateSessionKeyParams, SessionConfig, Call, MigrateWalletToPasskeyParams, UpdateWalletEncryptionParams, UpdateWalletEncryptionResponse, TransferHookInput, ApproveHookInput, GetTransactionListQuery, PaginatedResponse, Transaction, CreateSkuPurchaseParams, GetSkuListQuery, Sku, CallAnyContractParams, RecordSendTransactionParams, GetTokenBalanceParams, 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
|
|
|
@@ -466,6 +466,25 @@ declare function useMigrateWalletToPasskey(): {
|
|
|
466
466
|
reset: () => void;
|
|
467
467
|
};
|
|
468
468
|
|
|
469
|
+
type UpdateWalletEncryptionInput = UpdateWalletEncryptionParams & {
|
|
470
|
+
bearerToken: string;
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* Hook for updating a wallet's encrypted private key.
|
|
474
|
+
* Use when the user changes their passkey or PIN; the client re-encrypts the private key
|
|
475
|
+
* and sends the new ciphertext here.
|
|
476
|
+
*/
|
|
477
|
+
declare function useUpdateWalletEncryption(): {
|
|
478
|
+
updateWalletEncryption: (input: UpdateWalletEncryptionInput) => void;
|
|
479
|
+
updateWalletEncryptionAsync: (input: UpdateWalletEncryptionInput) => Promise<UpdateWalletEncryptionResponse>;
|
|
480
|
+
data: UpdateWalletEncryptionResponse | undefined;
|
|
481
|
+
isLoading: boolean;
|
|
482
|
+
isError: boolean;
|
|
483
|
+
error: Error | null;
|
|
484
|
+
isSuccess: boolean;
|
|
485
|
+
reset: () => void;
|
|
486
|
+
};
|
|
487
|
+
|
|
469
488
|
type TransferInput = {
|
|
470
489
|
params: TransferHookInput;
|
|
471
490
|
bearerToken: string;
|
|
@@ -1625,4 +1644,4 @@ declare function useExecuteWithSession(): {
|
|
|
1625
1644
|
reset: () => void;
|
|
1626
1645
|
};
|
|
1627
1646
|
|
|
1628
|
-
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransactionList, useGetWallet, useMigrateWalletToPasskey, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useTransfer };
|
|
1647
|
+
export { type ChipiWalletData, type SessionState, type SessionWallet, type UseChipiSessionConfig, type UseChipiSessionReturn, type UseChipiWalletConfig, type UseChipiWalletReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransactionList, useGetWallet, useMigrateWalletToPasskey, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useTransfer, useUpdateWalletEncryption };
|
package/dist/hooks.js
CHANGED
|
@@ -522,6 +522,31 @@ function useMigrateWalletToPasskey() {
|
|
|
522
522
|
reset: mutation.reset
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
+
function useUpdateWalletEncryption() {
|
|
526
|
+
const { chipiSDK } = useChipiContext();
|
|
527
|
+
const queryClient = reactQuery.useQueryClient();
|
|
528
|
+
const mutation = reactQuery.useMutation({
|
|
529
|
+
mutationFn: async (input) => {
|
|
530
|
+
const { bearerToken, ...params } = input;
|
|
531
|
+
return chipiSDK.wallets.updateWalletEncryption(params, bearerToken);
|
|
532
|
+
},
|
|
533
|
+
onSuccess: (_, variables) => {
|
|
534
|
+
queryClient.invalidateQueries({
|
|
535
|
+
queryKey: ["chipi-wallet", variables.externalUserId]
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
return {
|
|
540
|
+
updateWalletEncryption: mutation.mutate,
|
|
541
|
+
updateWalletEncryptionAsync: mutation.mutateAsync,
|
|
542
|
+
data: mutation.data,
|
|
543
|
+
isLoading: mutation.isPending,
|
|
544
|
+
isError: mutation.isError,
|
|
545
|
+
error: mutation.error,
|
|
546
|
+
isSuccess: mutation.isSuccess,
|
|
547
|
+
reset: mutation.reset
|
|
548
|
+
};
|
|
549
|
+
}
|
|
525
550
|
function useTransfer() {
|
|
526
551
|
const { chipiSDK, passkeyAdapter } = useChipiContext();
|
|
527
552
|
const mutation = reactQuery.useMutation(
|
|
@@ -1050,5 +1075,6 @@ exports.usePurchaseSku = usePurchaseSku;
|
|
|
1050
1075
|
exports.useRecordSendTransaction = useRecordSendTransaction;
|
|
1051
1076
|
exports.useRevokeSessionKey = useRevokeSessionKey;
|
|
1052
1077
|
exports.useTransfer = useTransfer;
|
|
1078
|
+
exports.useUpdateWalletEncryption = useUpdateWalletEncryption;
|
|
1053
1079
|
//# sourceMappingURL=hooks.js.map
|
|
1054
1080
|
//# sourceMappingURL=hooks.js.map
|