@abstraxn/signer-react 3.3.2 → 3.3.3

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.3.3] - 2026-07-09
9
+
10
+ ### Changed
11
+ - Bumped `@abstraxn/signer-core` to `2.1.3` for automatic secure-enclave policy
12
+ stamp/confirm on publish, unpublish, update, and delete (enforced policies).
13
+
8
14
  ## [3.3.0] - 2026-04-28
9
15
 
10
16
  ### Added
package/README.md CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -2406,6 +2406,54 @@ export function AbstraxnProviderInner({ config, children, base, wagmi, solana, }
2406
2406
  }
2407
2407
  await walletRef.current.linkEmail(otpId, otpCode);
2408
2408
  }, []);
2409
+ const createPolicy = useCallback(async (input) => {
2410
+ if (!walletRef.current?.isConnected) {
2411
+ throw new Error("Wallet not connected");
2412
+ }
2413
+ return await walletRef.current.createPolicy(input);
2414
+ }, []);
2415
+ const listPolicies = useCallback(async (filters) => {
2416
+ if (!walletRef.current?.isConnected) {
2417
+ throw new Error("Wallet not connected");
2418
+ }
2419
+ return await walletRef.current.listPolicies(filters);
2420
+ }, []);
2421
+ const getPolicy = useCallback(async (policyId) => {
2422
+ if (!walletRef.current?.isConnected) {
2423
+ throw new Error("Wallet not connected");
2424
+ }
2425
+ return await walletRef.current.getPolicy(policyId);
2426
+ }, []);
2427
+ const updatePolicy = useCallback(async (policyId, input) => {
2428
+ if (!walletRef.current?.isConnected) {
2429
+ throw new Error("Wallet not connected");
2430
+ }
2431
+ return await walletRef.current.updatePolicy(policyId, input);
2432
+ }, []);
2433
+ const deletePolicy = useCallback(async (policyId) => {
2434
+ if (!walletRef.current?.isConnected) {
2435
+ throw new Error("Wallet not connected");
2436
+ }
2437
+ await walletRef.current.deletePolicy(policyId);
2438
+ }, []);
2439
+ const publishPolicy = useCallback(async (policyId) => {
2440
+ if (!walletRef.current?.isConnected) {
2441
+ throw new Error("Wallet not connected");
2442
+ }
2443
+ return await walletRef.current.publishPolicy(policyId);
2444
+ }, []);
2445
+ const unpublishPolicy = useCallback(async (policyId) => {
2446
+ if (!walletRef.current?.isConnected) {
2447
+ throw new Error("Wallet not connected");
2448
+ }
2449
+ return await walletRef.current.unpublishPolicy(policyId);
2450
+ }, []);
2451
+ const getPolicyTemplates = useCallback(async () => {
2452
+ if (!walletRef.current?.isConnected) {
2453
+ throw new Error("Wallet not connected");
2454
+ }
2455
+ return await walletRef.current.getPolicyTemplates();
2456
+ }, []);
2409
2457
  // MFA helpers (delegating to core wallet/AuthManager)
2410
2458
  const getMfaStatus = useCallback(async () => {
2411
2459
  if (!walletRef.current?.isConnected) {
@@ -3639,6 +3687,14 @@ export function AbstraxnProviderInner({ config, children, base, wagmi, solana, }
3639
3687
  requestOtpForEmailLink,
3640
3688
  linkEmail,
3641
3689
  unlinkAuthMethod,
3690
+ createPolicy,
3691
+ listPolicies,
3692
+ getPolicy,
3693
+ updatePolicy,
3694
+ deletePolicy,
3695
+ publishPolicy,
3696
+ unpublishPolicy,
3697
+ getPolicyTemplates,
3642
3698
  uiConfig: enrichedUiConfig,
3643
3699
  // External wallet methods
3644
3700
  connectExternalWallet: externalWalletsEnabled
File without changes
@@ -13495,3 +13495,57 @@ export declare function useSolanaExternalWallet(): {
13495
13495
  signAllTransactions: (transactions: SolanaTransaction[]) => Promise<SolanaTransaction[]>;
13496
13496
  sendTransaction: (transaction: SolanaTransaction, options?: SendOptions) => Promise<string>;
13497
13497
  };
13498
+ /**
13499
+ * List wallet policies for the connected org. Optionally filter by walletId/status/blockchain.
13500
+ */
13501
+ export declare function usePolicies(filters?: import("@abstraxn/signer-core").PolicyListFilters): {
13502
+ policies: import("@abstraxn/signer-core").WalletPolicy[];
13503
+ total: number;
13504
+ loading: boolean;
13505
+ error: Error | null;
13506
+ refresh: () => Promise<import("@abstraxn/signer-core").WalletPolicyListResponse | null>;
13507
+ isConnected: boolean;
13508
+ };
13509
+ /**
13510
+ * Fetch a single policy by id.
13511
+ */
13512
+ export declare function usePolicy(policyId: string | null | undefined): {
13513
+ policy: import("@abstraxn/signer-core").WalletPolicy | null;
13514
+ loading: boolean;
13515
+ error: Error | null;
13516
+ refresh: () => Promise<import("@abstraxn/signer-core").WalletPolicy | null>;
13517
+ isConnected: boolean;
13518
+ };
13519
+ export declare function useCreatePolicy(): {
13520
+ createPolicy: (input: import("@abstraxn/signer-core").CreatePolicyInput) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
13521
+ isLoading: boolean;
13522
+ error: string | null;
13523
+ };
13524
+ export declare function useUpdatePolicy(): {
13525
+ updatePolicy: (policyId: string, input: import("@abstraxn/signer-core").UpdatePolicyInput) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
13526
+ isLoading: boolean;
13527
+ error: string | null;
13528
+ };
13529
+ export declare function useDeletePolicy(): {
13530
+ deletePolicy: (policyId: string) => Promise<void>;
13531
+ isLoading: boolean;
13532
+ error: string | null;
13533
+ };
13534
+ export declare function usePublishPolicy(): {
13535
+ publishPolicy: (policyId: string) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
13536
+ isLoading: boolean;
13537
+ error: string | null;
13538
+ };
13539
+ export declare function useUnpublishPolicy(): {
13540
+ unpublishPolicy: (policyId: string) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
13541
+ isLoading: boolean;
13542
+ error: string | null;
13543
+ };
13544
+ export declare function usePolicyTemplates(): {
13545
+ templates: import("@abstraxn/signer-core").PolicyTemplateInfo[];
13546
+ loading: boolean;
13547
+ error: Error | null;
13548
+ refresh: () => Promise<{
13549
+ templates: import("@abstraxn/signer-core").PolicyTemplateInfo[];
13550
+ } | null>;
13551
+ };
package/dist/src/hooks.js CHANGED
@@ -2712,4 +2712,227 @@ export function useSolanaExternalWallet() {
2712
2712
  sendTransaction,
2713
2713
  };
2714
2714
  }
2715
+ // ─── Wallet Policies ─────────────────────────────────────────────────────────
2716
+ /**
2717
+ * List wallet policies for the connected org. Optionally filter by walletId/status/blockchain.
2718
+ */
2719
+ export function usePolicies(filters) {
2720
+ const { isConnected, listPolicies } = useAbstraxnWallet();
2721
+ const [policies, setPolicies] = useState([]);
2722
+ const [total, setTotal] = useState(0);
2723
+ const [loading, setLoading] = useState(false);
2724
+ const [error, setError] = useState(null);
2725
+ const refresh = useCallback(async () => {
2726
+ if (!isConnected || !listPolicies) {
2727
+ setError(new Error("Wallet is not connected"));
2728
+ return null;
2729
+ }
2730
+ setLoading(true);
2731
+ setError(null);
2732
+ try {
2733
+ const result = await listPolicies(filters);
2734
+ setPolicies(result.policies);
2735
+ setTotal(result.total);
2736
+ return result;
2737
+ }
2738
+ catch (err) {
2739
+ const e = err instanceof Error ? err : new Error("Failed to list policies");
2740
+ setError(e);
2741
+ return null;
2742
+ }
2743
+ finally {
2744
+ setLoading(false);
2745
+ }
2746
+ }, [isConnected, listPolicies, filters?.walletId, filters?.status, filters?.blockchain, filters?.enabled]);
2747
+ useEffect(() => {
2748
+ if (isConnected && listPolicies) {
2749
+ void refresh();
2750
+ }
2751
+ }, [isConnected]); // eslint-disable-line react-hooks/exhaustive-deps
2752
+ return { policies, total, loading, error, refresh, isConnected };
2753
+ }
2754
+ /**
2755
+ * Fetch a single policy by id.
2756
+ */
2757
+ export function usePolicy(policyId) {
2758
+ const { isConnected, getPolicy } = useAbstraxnWallet();
2759
+ const [policy, setPolicy] = useState(null);
2760
+ const [loading, setLoading] = useState(false);
2761
+ const [error, setError] = useState(null);
2762
+ const refresh = useCallback(async () => {
2763
+ if (!policyId)
2764
+ return null;
2765
+ if (!isConnected || !getPolicy) {
2766
+ setError(new Error("Wallet is not connected"));
2767
+ return null;
2768
+ }
2769
+ setLoading(true);
2770
+ setError(null);
2771
+ try {
2772
+ const result = await getPolicy(policyId);
2773
+ setPolicy(result);
2774
+ return result;
2775
+ }
2776
+ catch (err) {
2777
+ const e = err instanceof Error ? err : new Error("Failed to get policy");
2778
+ setError(e);
2779
+ return null;
2780
+ }
2781
+ finally {
2782
+ setLoading(false);
2783
+ }
2784
+ }, [isConnected, getPolicy, policyId]);
2785
+ useEffect(() => {
2786
+ if (isConnected && policyId && getPolicy) {
2787
+ void refresh();
2788
+ }
2789
+ }, [isConnected, policyId]); // eslint-disable-line react-hooks/exhaustive-deps
2790
+ return { policy, loading, error, refresh, isConnected };
2791
+ }
2792
+ export function useCreatePolicy() {
2793
+ const { createPolicy: createPolicyFn } = useAbstraxnWallet();
2794
+ const [isLoading, setIsLoading] = useState(false);
2795
+ const [error, setError] = useState(null);
2796
+ const createPolicy = useCallback(async (input) => {
2797
+ if (!createPolicyFn)
2798
+ throw new Error("createPolicy is not available");
2799
+ setIsLoading(true);
2800
+ setError(null);
2801
+ try {
2802
+ return await createPolicyFn(input);
2803
+ }
2804
+ catch (err) {
2805
+ const msg = err instanceof Error ? err.message : "Failed to create policy";
2806
+ setError(msg);
2807
+ throw err;
2808
+ }
2809
+ finally {
2810
+ setIsLoading(false);
2811
+ }
2812
+ }, [createPolicyFn]);
2813
+ return { createPolicy, isLoading, error };
2814
+ }
2815
+ export function useUpdatePolicy() {
2816
+ const { updatePolicy: updatePolicyFn } = useAbstraxnWallet();
2817
+ const [isLoading, setIsLoading] = useState(false);
2818
+ const [error, setError] = useState(null);
2819
+ const updatePolicy = useCallback(async (policyId, input) => {
2820
+ if (!updatePolicyFn)
2821
+ throw new Error("updatePolicy is not available");
2822
+ setIsLoading(true);
2823
+ setError(null);
2824
+ try {
2825
+ return await updatePolicyFn(policyId, input);
2826
+ }
2827
+ catch (err) {
2828
+ const msg = err instanceof Error ? err.message : "Failed to update policy";
2829
+ setError(msg);
2830
+ throw err;
2831
+ }
2832
+ finally {
2833
+ setIsLoading(false);
2834
+ }
2835
+ }, [updatePolicyFn]);
2836
+ return { updatePolicy, isLoading, error };
2837
+ }
2838
+ export function useDeletePolicy() {
2839
+ const { deletePolicy: deletePolicyFn } = useAbstraxnWallet();
2840
+ const [isLoading, setIsLoading] = useState(false);
2841
+ const [error, setError] = useState(null);
2842
+ const deletePolicy = useCallback(async (policyId) => {
2843
+ if (!deletePolicyFn)
2844
+ throw new Error("deletePolicy is not available");
2845
+ setIsLoading(true);
2846
+ setError(null);
2847
+ try {
2848
+ await deletePolicyFn(policyId);
2849
+ }
2850
+ catch (err) {
2851
+ const msg = err instanceof Error ? err.message : "Failed to delete policy";
2852
+ setError(msg);
2853
+ throw err;
2854
+ }
2855
+ finally {
2856
+ setIsLoading(false);
2857
+ }
2858
+ }, [deletePolicyFn]);
2859
+ return { deletePolicy, isLoading, error };
2860
+ }
2861
+ export function usePublishPolicy() {
2862
+ const { publishPolicy: publishPolicyFn } = useAbstraxnWallet();
2863
+ const [isLoading, setIsLoading] = useState(false);
2864
+ const [error, setError] = useState(null);
2865
+ const publishPolicy = useCallback(async (policyId) => {
2866
+ if (!publishPolicyFn)
2867
+ throw new Error("publishPolicy is not available");
2868
+ setIsLoading(true);
2869
+ setError(null);
2870
+ try {
2871
+ return await publishPolicyFn(policyId);
2872
+ }
2873
+ catch (err) {
2874
+ const msg = err instanceof Error ? err.message : "Failed to publish policy";
2875
+ setError(msg);
2876
+ throw err;
2877
+ }
2878
+ finally {
2879
+ setIsLoading(false);
2880
+ }
2881
+ }, [publishPolicyFn]);
2882
+ return { publishPolicy, isLoading, error };
2883
+ }
2884
+ export function useUnpublishPolicy() {
2885
+ const { unpublishPolicy: unpublishPolicyFn } = useAbstraxnWallet();
2886
+ const [isLoading, setIsLoading] = useState(false);
2887
+ const [error, setError] = useState(null);
2888
+ const unpublishPolicy = useCallback(async (policyId) => {
2889
+ if (!unpublishPolicyFn)
2890
+ throw new Error("unpublishPolicy is not available");
2891
+ setIsLoading(true);
2892
+ setError(null);
2893
+ try {
2894
+ return await unpublishPolicyFn(policyId);
2895
+ }
2896
+ catch (err) {
2897
+ const msg = err instanceof Error ? err.message : "Failed to unpublish policy";
2898
+ setError(msg);
2899
+ throw err;
2900
+ }
2901
+ finally {
2902
+ setIsLoading(false);
2903
+ }
2904
+ }, [unpublishPolicyFn]);
2905
+ return { unpublishPolicy, isLoading, error };
2906
+ }
2907
+ export function usePolicyTemplates() {
2908
+ const { isConnected, getPolicyTemplates } = useAbstraxnWallet();
2909
+ const [templates, setTemplates] = useState([]);
2910
+ const [loading, setLoading] = useState(false);
2911
+ const [error, setError] = useState(null);
2912
+ const refresh = useCallback(async () => {
2913
+ if (!isConnected || !getPolicyTemplates)
2914
+ return null;
2915
+ setLoading(true);
2916
+ setError(null);
2917
+ try {
2918
+ const result = await getPolicyTemplates();
2919
+ setTemplates(result.templates);
2920
+ return result;
2921
+ }
2922
+ catch (err) {
2923
+ const e = err instanceof Error ? err : new Error("Failed to load templates");
2924
+ setError(e);
2925
+ return null;
2926
+ }
2927
+ finally {
2928
+ setLoading(false);
2929
+ }
2930
+ }, [isConnected, getPolicyTemplates]);
2931
+ useEffect(() => {
2932
+ if (isConnected && getPolicyTemplates) {
2933
+ void refresh();
2934
+ }
2935
+ }, [isConnected]); // eslint-disable-line react-hooks/exhaustive-deps
2936
+ return { templates, loading, error, refresh };
2937
+ }
2715
2938
  //# sourceMappingURL=hooks.js.map
@@ -4,7 +4,7 @@
4
4
  * when used in a React project
5
5
  */
6
6
  export { AbstraxnProvider, useAbstraxnWallet } from './AbstraxnProvider';
7
- export { useIsConnected, useAddress, useAuthContext, useChainId, useError, useEnableMfa, useDisableMfa, useAuthMethodLinking, useEmailForOtp, useWallet, useSmartAccountOwner, useExportWallet, useWhoami, useExternalWallet, useExternalWalletBalance, useExternalWalletChain, useExternalWalletInfo, usePublicClient, useWalletClient, useContract, usePrepareRawTxn, useSignTxn, useSignTypedTx, useSignAndSendTxn, useWaitForTxnReceipt, useReadContract, useExternalWalletClient, useWriteContract, useConnectionType, useSwitchChain, useSignMessage, useEstimateGas, useGetGasPrice, useSolanaConnection, useSolanaPublicKey, useSolanaBalance, usePrepareSolanaTxn, useSolanaExternalWallet, usePrepareSolanaProgramTxn, useSolanaProgramTransaction, useSignSolanaTxn, useSignAndSendSolanaTxn, useSolanaGasless, useSignAndSendSolanaGaslessTxn, useWaitForSolanaConfirmation, } from './hooks';
7
+ export { useIsConnected, useAddress, useAuthContext, useChainId, useError, useEnableMfa, useDisableMfa, useAuthMethodLinking, useEmailForOtp, useWallet, useSmartAccountOwner, useExportWallet, useWhoami, useExternalWallet, useExternalWalletBalance, useExternalWalletChain, useExternalWalletInfo, usePublicClient, useWalletClient, useContract, usePrepareRawTxn, useSignTxn, useSignTypedTx, useSignAndSendTxn, useWaitForTxnReceipt, useReadContract, useExternalWalletClient, useWriteContract, useConnectionType, useSwitchChain, useSignMessage, useEstimateGas, useGetGasPrice, useSolanaConnection, useSolanaPublicKey, useSolanaBalance, usePrepareSolanaTxn, useSolanaExternalWallet, usePrepareSolanaProgramTxn, useSolanaProgramTransaction, useSignSolanaTxn, useSignAndSendSolanaTxn, useSolanaGasless, useSignAndSendSolanaGaslessTxn, useWaitForSolanaConfirmation, usePolicies, usePolicy, useCreatePolicy, useUpdatePolicy, useDeletePolicy, usePublishPolicy, useUnpublishPolicy, usePolicyTemplates, } from './hooks';
8
8
  export { ConnectButton } from './ConnectButton';
9
9
  export type { ConnectButtonProps, ConnectButtonVariant, ConnectButtonSize } from './ConnectButton';
10
10
  export { WalletModal } from './WalletModal';
package/dist/src/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * when used in a React project
5
5
  */
6
6
  export { AbstraxnProvider, useAbstraxnWallet } from './AbstraxnProvider';
7
- export { useIsConnected, useAddress, useAuthContext, useChainId, useError, useEnableMfa, useDisableMfa, useAuthMethodLinking, useEmailForOtp, useWallet, useSmartAccountOwner, useExportWallet, useWhoami, useExternalWallet, useExternalWalletBalance, useExternalWalletChain, useExternalWalletInfo, usePublicClient, useWalletClient, useContract, usePrepareRawTxn, useSignTxn, useSignTypedTx, useSignAndSendTxn, useWaitForTxnReceipt, useReadContract, useExternalWalletClient, useWriteContract, useConnectionType, useSwitchChain, useSignMessage, useEstimateGas, useGetGasPrice, useSolanaConnection, useSolanaPublicKey, useSolanaBalance, usePrepareSolanaTxn, useSolanaExternalWallet, usePrepareSolanaProgramTxn, useSolanaProgramTransaction, useSignSolanaTxn, useSignAndSendSolanaTxn, useSolanaGasless, useSignAndSendSolanaGaslessTxn, useWaitForSolanaConfirmation, } from './hooks';
7
+ export { useIsConnected, useAddress, useAuthContext, useChainId, useError, useEnableMfa, useDisableMfa, useAuthMethodLinking, useEmailForOtp, useWallet, useSmartAccountOwner, useExportWallet, useWhoami, useExternalWallet, useExternalWalletBalance, useExternalWalletChain, useExternalWalletInfo, usePublicClient, useWalletClient, useContract, usePrepareRawTxn, useSignTxn, useSignTypedTx, useSignAndSendTxn, useWaitForTxnReceipt, useReadContract, useExternalWalletClient, useWriteContract, useConnectionType, useSwitchChain, useSignMessage, useEstimateGas, useGetGasPrice, useSolanaConnection, useSolanaPublicKey, useSolanaBalance, usePrepareSolanaTxn, useSolanaExternalWallet, usePrepareSolanaProgramTxn, useSolanaProgramTransaction, useSignSolanaTxn, useSignAndSendSolanaTxn, useSolanaGasless, useSignAndSendSolanaGaslessTxn, useWaitForSolanaConfirmation, usePolicies, usePolicy, useCreatePolicy, useUpdatePolicy, useDeletePolicy, usePublishPolicy, useUnpublishPolicy, usePolicyTemplates, } from './hooks';
8
8
  export { ConnectButton } from './ConnectButton';
9
9
  export { WalletModal } from './WalletModal';
10
10
  export { OnboardingUIComponent as OnboardingUI } from './OnboardingUI';
@@ -281,6 +281,16 @@ export interface AbstraxnContextValue {
281
281
  }>;
282
282
  linkEmail?: (otpId: string, otpCode: string) => Promise<void>;
283
283
  unlinkAuthMethod?: (provider: string) => Promise<void>;
284
+ createPolicy?: (input: import("@abstraxn/signer-core").CreatePolicyInput) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
285
+ listPolicies?: (filters?: import("@abstraxn/signer-core").PolicyListFilters) => Promise<import("@abstraxn/signer-core").WalletPolicyListResponse>;
286
+ getPolicy?: (policyId: string) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
287
+ updatePolicy?: (policyId: string, input: import("@abstraxn/signer-core").UpdatePolicyInput) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
288
+ deletePolicy?: (policyId: string) => Promise<void>;
289
+ publishPolicy?: (policyId: string) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
290
+ unpublishPolicy?: (policyId: string) => Promise<import("@abstraxn/signer-core").WalletPolicy>;
291
+ getPolicyTemplates?: () => Promise<{
292
+ templates: import("@abstraxn/signer-core").PolicyTemplateInfo[];
293
+ }>;
284
294
  connectExternalWallet?: (connectorId: string) => Promise<void>;
285
295
  disconnectExternalWallet?: () => Promise<void>;
286
296
  isExternalWalletConnected?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abstraxn/signer-react",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
4
4
  "description": "React SDK for Abstraxn Wallet - React components, hooks, and providers for seamless Web3 wallet integration",
5
5
  "main": "./dist/src/index.js",
6
6
  "module": "./dist/src/index.js",
@@ -40,7 +40,7 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@abstraxn/signer-core": "2.1.2",
43
+ "@abstraxn/signer-core": "2.1.3",
44
44
  "@abstraxn/solana-relayer": "^1.1.0",
45
45
  "@solana/wallet-adapter-base": "^0.9.27",
46
46
  "@solana/wallet-adapter-react": "^0.15.39",