@chipi-stack/chipi-react 14.16.0 → 14.17.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 +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +19 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +19 -2
- package/dist/hooks.mjs.map +1 -1
- package/dist/{index-Dbqp9oNS.d.mts → index-CUfzUBgv.d.mts} +34 -4
- package/dist/{index-Dbqp9oNS.d.ts → index-CUfzUBgv.d.ts} +34 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletRes
|
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
4
4
|
import { SyntheticEvent } from 'react';
|
|
5
|
-
import { MigrateChipiWalletToShhhParams, MigrationOutcome, Eip191Pubkey, WebAuthnPubkey, JwtAppleSubPubkey, NewOwnerInput, buildProposeAddOwnerCall, TIMELOCK_SECONDS, DEFAULT_OP_EXPIRY_SECONDS, ROLE_OWNER, ROLE_GUARDIAN, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, ShhhSignerKind, MIN_THRESHOLD_OWNERS } from '@chipi-stack/backend';
|
|
5
|
+
import { MigrateChipiWalletToShhhParams, MigrationOutcome, ChipiSDK, Eip191Pubkey, WebAuthnPubkey, JwtAppleSubPubkey, NewOwnerInput, buildProposeAddOwnerCall, TIMELOCK_SECONDS, DEFAULT_OP_EXPIRY_SECONDS, ROLE_OWNER, ROLE_GUARDIAN, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, ShhhSignerKind, MIN_THRESHOLD_OWNERS } from '@chipi-stack/backend';
|
|
6
6
|
import { Call as Call$2 } from 'starknet';
|
|
7
7
|
import { TypedData, AccountDeploymentData } from '@starknet-io/types-js';
|
|
8
8
|
import { ShieldResult } from '@chipi-stack/core';
|
|
@@ -1872,6 +1872,24 @@ declare function useSignTypedData(): {
|
|
|
1872
1872
|
reset: () => void;
|
|
1873
1873
|
};
|
|
1874
1874
|
|
|
1875
|
+
type ExternalSignerExecuteInput = Parameters<ChipiSDK["executeWithExternalSigner"]>[0];
|
|
1876
|
+
/**
|
|
1877
|
+
* Run calls on a SHHH wallet signed by an external Starknet wallet that is one
|
|
1878
|
+
* of its `STARK_SNIP12` owners: Bramble, Braavos, Ready/Argent or another
|
|
1879
|
+
* Chipi wallet. Pass the wallet's `wallet_signTypedData` as `signTypedData`;
|
|
1880
|
+
* the key never leaves that wallet. Returns the tx hash (wait for it).
|
|
1881
|
+
*/
|
|
1882
|
+
declare function useExternalSignerExecute(): {
|
|
1883
|
+
execute: (input: ExternalSignerExecuteInput) => void;
|
|
1884
|
+
executeAsync: (input: ExternalSignerExecuteInput) => Promise<string>;
|
|
1885
|
+
data: string | undefined;
|
|
1886
|
+
isLoading: boolean;
|
|
1887
|
+
isError: boolean;
|
|
1888
|
+
error: Error | null;
|
|
1889
|
+
isSuccess: boolean;
|
|
1890
|
+
reset: () => void;
|
|
1891
|
+
};
|
|
1892
|
+
|
|
1875
1893
|
/**
|
|
1876
1894
|
* An approval the host (walletv2, the hosted web-wallet, or a harness) must
|
|
1877
1895
|
* resolve before the SWO performs a sensitive action. Returning `false`
|
|
@@ -1968,7 +1986,12 @@ interface ChipiWindowObjectDeps {
|
|
|
1968
1986
|
executeCalls: (calls: Call$2[]) => Promise<string>;
|
|
1969
1987
|
/** Sign SNIP-12 typed data → signature felts (envelope-aware for SHHH). */
|
|
1970
1988
|
signTypedData: (typedData: TypedData) => Promise<string[]>;
|
|
1971
|
-
/**
|
|
1989
|
+
/**
|
|
1990
|
+
* Counterfactual deployment data for an undeployed account. Throw
|
|
1991
|
+
* `Error("account_already_deployed")` for a deployed account (the dApp gets
|
|
1992
|
+
* 115) or `Error("account_deployment_data_unavailable")` when the data can't
|
|
1993
|
+
* be derived (116). Any other error reaches the dApp as 163.
|
|
1994
|
+
*/
|
|
1972
1995
|
getDeploymentData: () => Promise<AccountDeploymentData>;
|
|
1973
1996
|
/** Optional: establish a session from a dApp-proposed policy (approve once). */
|
|
1974
1997
|
createSession?: (policy: ChipiSessionPolicy) => Promise<void>;
|
|
@@ -1995,6 +2018,13 @@ interface UseChipiWalletObjectConfig {
|
|
|
1995
2018
|
sessionPolicy?: ChipiSessionPolicy | null;
|
|
1996
2019
|
/** Chain id felt; defaults to SN_MAIN. */
|
|
1997
2020
|
chainId?: string;
|
|
2021
|
+
/**
|
|
2022
|
+
* Whether the account is deployed on-chain (e.g. `isDeployed` from the
|
|
2023
|
+
* wallet row). Only `true` makes `wallet_deploymentData` answer 115
|
|
2024
|
+
* ("already deployed"); otherwise it answers 116 ("deployment data is not
|
|
2025
|
+
* available"), since this hook can't derive a Chipi account's deployment data.
|
|
2026
|
+
*/
|
|
2027
|
+
isDeployed?: boolean;
|
|
1998
2028
|
/**
|
|
1999
2029
|
* Host approval gate (connect / execute / signTypedData / session). When
|
|
2000
2030
|
* omitted, every approval is denied and a single `console.warn` explains
|
|
@@ -2592,7 +2622,7 @@ type Call = ReturnType<typeof buildProposeAddOwnerCall>;
|
|
|
2592
2622
|
* 1. ADD DEVICE (user has wallet access, wants a second owner)
|
|
2593
2623
|
* a. `proposeAddOwner` (owner-signed OE)
|
|
2594
2624
|
* b. wait 48h timelock
|
|
2595
|
-
* c. `executeAddOwner` (
|
|
2625
|
+
* c. `executeAddOwner` (permissionless after the timelock: any account, or an owner OE; opId from 1a)
|
|
2596
2626
|
*
|
|
2597
2627
|
* 2. RECOVER VIA GUARDIAN (user lost key)
|
|
2598
2628
|
* a. `initiateRecovery` (guardian-signed OE)
|
|
@@ -2966,4 +2996,4 @@ declare function usePrivateBalance(input: PrivateBalanceInput): {
|
|
|
2966
2996
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, bigint>, Error>>;
|
|
2967
2997
|
};
|
|
2968
2998
|
|
|
2969
|
-
export { type
|
|
2999
|
+
export { type UseThresholdSignReturn as $, useGetSkuPurchase as A, useGetSkuList as B, type ChipiWindowObjectDeps as C, useGetSku as D, useCallAnyContract as E, useSignTypedData as F, useExternalSignerExecute as G, type ExternalSignerExecuteInput as H, useChipiWalletObject as I, useRecordSendTransaction as J, useGetTokenBalance as K, useCreateSessionKey as L, useAddSessionKeyToContract as M, useRevokeSessionKey as N, useGetSessionData as O, useExecuteWithSession as P, useX402Payment as Q, type RegisterSessionConfig as R, type SessionState as S, type UseX402PaymentConfig as T, type UseChipiWalletObjectConfig as U, type UseX402PaymentReturn as V, useShhhSigner as W, type UseShhhSignerReturn as X, useGuardianRecovery as Y, type UseGuardianRecoveryReturn as Z, useThresholdSign as _, type ChipiApprovalRequest as a, type UseThresholdSignOptions as a0, type ThresholdSignState as a1, useShield as a2, useUnshield as a3, usePrivateBalance as a4, derivePrivacyAccount as a5, netPrivateBalance as a6, type PrivacyConfig as a7, type PrivacyKeys as a8, type PrivacyStep as a9, type ShieldHookInput as aa, type PrivacyLedgerEvent as ab, type PrivateBalanceInput as ac, type ChipiSessionPolicy as b, type ChipiSessionSpendCap as c, type ChipiSessionSpendCapAmount as d, type ChipiSessionSpendCapPolicy as e, useGetWallet as f, useChipiWallet as g, type UseChipiWalletConfig as h, type UseChipiWalletReturn as i, type ChipiWalletData as j, useChipiSession as k, type UseChipiSessionConfig as l, type UseChipiSessionReturn as m, type SessionWallet as n, useMigrateWalletToPasskey as o, useUpdateWalletEncryption as p, useMigrateWalletToShhh as q, useTransfer as r, type UseTransferConfig as s, useApprove as t, useCreateWallet as u, useGetTransactionList as v, useGetTransaction as w, useGetTransactionStatus as x, useSyncOnChainTransfers as y, usePurchaseSku as z };
|
|
@@ -2,7 +2,7 @@ import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletRes
|
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
4
4
|
import { SyntheticEvent } from 'react';
|
|
5
|
-
import { MigrateChipiWalletToShhhParams, MigrationOutcome, Eip191Pubkey, WebAuthnPubkey, JwtAppleSubPubkey, NewOwnerInput, buildProposeAddOwnerCall, TIMELOCK_SECONDS, DEFAULT_OP_EXPIRY_SECONDS, ROLE_OWNER, ROLE_GUARDIAN, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, ShhhSignerKind, MIN_THRESHOLD_OWNERS } from '@chipi-stack/backend';
|
|
5
|
+
import { MigrateChipiWalletToShhhParams, MigrationOutcome, ChipiSDK, Eip191Pubkey, WebAuthnPubkey, JwtAppleSubPubkey, NewOwnerInput, buildProposeAddOwnerCall, TIMELOCK_SECONDS, DEFAULT_OP_EXPIRY_SECONDS, ROLE_OWNER, ROLE_GUARDIAN, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, ShhhSignerKind, MIN_THRESHOLD_OWNERS } from '@chipi-stack/backend';
|
|
6
6
|
import { Call as Call$2 } from 'starknet';
|
|
7
7
|
import { TypedData, AccountDeploymentData } from '@starknet-io/types-js';
|
|
8
8
|
import { ShieldResult } from '@chipi-stack/core';
|
|
@@ -1872,6 +1872,24 @@ declare function useSignTypedData(): {
|
|
|
1872
1872
|
reset: () => void;
|
|
1873
1873
|
};
|
|
1874
1874
|
|
|
1875
|
+
type ExternalSignerExecuteInput = Parameters<ChipiSDK["executeWithExternalSigner"]>[0];
|
|
1876
|
+
/**
|
|
1877
|
+
* Run calls on a SHHH wallet signed by an external Starknet wallet that is one
|
|
1878
|
+
* of its `STARK_SNIP12` owners: Bramble, Braavos, Ready/Argent or another
|
|
1879
|
+
* Chipi wallet. Pass the wallet's `wallet_signTypedData` as `signTypedData`;
|
|
1880
|
+
* the key never leaves that wallet. Returns the tx hash (wait for it).
|
|
1881
|
+
*/
|
|
1882
|
+
declare function useExternalSignerExecute(): {
|
|
1883
|
+
execute: (input: ExternalSignerExecuteInput) => void;
|
|
1884
|
+
executeAsync: (input: ExternalSignerExecuteInput) => Promise<string>;
|
|
1885
|
+
data: string | undefined;
|
|
1886
|
+
isLoading: boolean;
|
|
1887
|
+
isError: boolean;
|
|
1888
|
+
error: Error | null;
|
|
1889
|
+
isSuccess: boolean;
|
|
1890
|
+
reset: () => void;
|
|
1891
|
+
};
|
|
1892
|
+
|
|
1875
1893
|
/**
|
|
1876
1894
|
* An approval the host (walletv2, the hosted web-wallet, or a harness) must
|
|
1877
1895
|
* resolve before the SWO performs a sensitive action. Returning `false`
|
|
@@ -1968,7 +1986,12 @@ interface ChipiWindowObjectDeps {
|
|
|
1968
1986
|
executeCalls: (calls: Call$2[]) => Promise<string>;
|
|
1969
1987
|
/** Sign SNIP-12 typed data → signature felts (envelope-aware for SHHH). */
|
|
1970
1988
|
signTypedData: (typedData: TypedData) => Promise<string[]>;
|
|
1971
|
-
/**
|
|
1989
|
+
/**
|
|
1990
|
+
* Counterfactual deployment data for an undeployed account. Throw
|
|
1991
|
+
* `Error("account_already_deployed")` for a deployed account (the dApp gets
|
|
1992
|
+
* 115) or `Error("account_deployment_data_unavailable")` when the data can't
|
|
1993
|
+
* be derived (116). Any other error reaches the dApp as 163.
|
|
1994
|
+
*/
|
|
1972
1995
|
getDeploymentData: () => Promise<AccountDeploymentData>;
|
|
1973
1996
|
/** Optional: establish a session from a dApp-proposed policy (approve once). */
|
|
1974
1997
|
createSession?: (policy: ChipiSessionPolicy) => Promise<void>;
|
|
@@ -1995,6 +2018,13 @@ interface UseChipiWalletObjectConfig {
|
|
|
1995
2018
|
sessionPolicy?: ChipiSessionPolicy | null;
|
|
1996
2019
|
/** Chain id felt; defaults to SN_MAIN. */
|
|
1997
2020
|
chainId?: string;
|
|
2021
|
+
/**
|
|
2022
|
+
* Whether the account is deployed on-chain (e.g. `isDeployed` from the
|
|
2023
|
+
* wallet row). Only `true` makes `wallet_deploymentData` answer 115
|
|
2024
|
+
* ("already deployed"); otherwise it answers 116 ("deployment data is not
|
|
2025
|
+
* available"), since this hook can't derive a Chipi account's deployment data.
|
|
2026
|
+
*/
|
|
2027
|
+
isDeployed?: boolean;
|
|
1998
2028
|
/**
|
|
1999
2029
|
* Host approval gate (connect / execute / signTypedData / session). When
|
|
2000
2030
|
* omitted, every approval is denied and a single `console.warn` explains
|
|
@@ -2592,7 +2622,7 @@ type Call = ReturnType<typeof buildProposeAddOwnerCall>;
|
|
|
2592
2622
|
* 1. ADD DEVICE (user has wallet access, wants a second owner)
|
|
2593
2623
|
* a. `proposeAddOwner` (owner-signed OE)
|
|
2594
2624
|
* b. wait 48h timelock
|
|
2595
|
-
* c. `executeAddOwner` (
|
|
2625
|
+
* c. `executeAddOwner` (permissionless after the timelock: any account, or an owner OE; opId from 1a)
|
|
2596
2626
|
*
|
|
2597
2627
|
* 2. RECOVER VIA GUARDIAN (user lost key)
|
|
2598
2628
|
* a. `initiateRecovery` (guardian-signed OE)
|
|
@@ -2966,4 +2996,4 @@ declare function usePrivateBalance(input: PrivateBalanceInput): {
|
|
|
2966
2996
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, bigint>, Error>>;
|
|
2967
2997
|
};
|
|
2968
2998
|
|
|
2969
|
-
export { type
|
|
2999
|
+
export { type UseThresholdSignReturn as $, useGetSkuPurchase as A, useGetSkuList as B, type ChipiWindowObjectDeps as C, useGetSku as D, useCallAnyContract as E, useSignTypedData as F, useExternalSignerExecute as G, type ExternalSignerExecuteInput as H, useChipiWalletObject as I, useRecordSendTransaction as J, useGetTokenBalance as K, useCreateSessionKey as L, useAddSessionKeyToContract as M, useRevokeSessionKey as N, useGetSessionData as O, useExecuteWithSession as P, useX402Payment as Q, type RegisterSessionConfig as R, type SessionState as S, type UseX402PaymentConfig as T, type UseChipiWalletObjectConfig as U, type UseX402PaymentReturn as V, useShhhSigner as W, type UseShhhSignerReturn as X, useGuardianRecovery as Y, type UseGuardianRecoveryReturn as Z, useThresholdSign as _, type ChipiApprovalRequest as a, type UseThresholdSignOptions as a0, type ThresholdSignState as a1, useShield as a2, useUnshield as a3, usePrivateBalance as a4, derivePrivacyAccount as a5, netPrivateBalance as a6, type PrivacyConfig as a7, type PrivacyKeys as a8, type PrivacyStep as a9, type ShieldHookInput as aa, type PrivacyLedgerEvent as ab, type PrivateBalanceInput as ac, type ChipiSessionPolicy as b, type ChipiSessionSpendCap as c, type ChipiSessionSpendCapAmount as d, type ChipiSessionSpendCapPolicy as e, useGetWallet as f, useChipiWallet as g, type UseChipiWalletConfig as h, type UseChipiWalletReturn as i, type ChipiWalletData as j, useChipiSession as k, type UseChipiSessionConfig as l, type UseChipiSessionReturn as m, type SessionWallet as n, useMigrateWalletToPasskey as o, useUpdateWalletEncryption as p, useMigrateWalletToShhh as q, useTransfer as r, type UseTransferConfig as s, useApprove as t, useCreateWallet as u, useGetTransactionList as v, useGetTransaction as w, useGetTransactionStatus as x, useSyncOnChainTransfers as y, usePurchaseSku as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,8 +4,8 @@ import { ChipiSDK, NewOwnerInput } from '@chipi-stack/backend';
|
|
|
4
4
|
import { ChipiSDKConfig, WalletType } from '@chipi-stack/types';
|
|
5
5
|
export * from '@chipi-stack/types';
|
|
6
6
|
export { Chain, ChainToken } from '@chipi-stack/types';
|
|
7
|
-
import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-
|
|
8
|
-
export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, c as ChipiSessionSpendCap, d as ChipiSessionSpendCapAmount, e as ChipiSessionSpendCapPolicy, j as ChipiWalletData,
|
|
7
|
+
import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-CUfzUBgv.mjs';
|
|
8
|
+
export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, c as ChipiSessionSpendCap, d as ChipiSessionSpendCapAmount, e as ChipiSessionSpendCapPolicy, j as ChipiWalletData, H as ExternalSignerExecuteInput, a7 as PrivacyConfig, a8 as PrivacyKeys, ab as PrivacyLedgerEvent, a9 as PrivacyStep, ac as PrivateBalanceInput, R as RegisterSessionConfig, S as SessionState, n as SessionWallet, aa as ShieldHookInput, a1 as ThresholdSignState, l as UseChipiSessionConfig, m as UseChipiSessionReturn, h as UseChipiWalletConfig, i as UseChipiWalletReturn, Z as UseGuardianRecoveryReturn, X as UseShhhSignerReturn, a0 as UseThresholdSignOptions, $ as UseThresholdSignReturn, s as UseTransferConfig, T as UseX402PaymentConfig, V as UseX402PaymentReturn, a5 as derivePrivacyAccount, a6 as netPrivateBalance, M as useAddSessionKeyToContract, t as useApprove, E as useCallAnyContract, k as useChipiSession, g as useChipiWallet, I as useChipiWalletObject, L as useCreateSessionKey, u as useCreateWallet, P as useExecuteWithSession, G as useExternalSignerExecute, O as useGetSessionData, D as useGetSku, B as useGetSkuList, A as useGetSkuPurchase, K as useGetTokenBalance, w as useGetTransaction, v as useGetTransactionList, x as useGetTransactionStatus, f as useGetWallet, Y as useGuardianRecovery, o as useMigrateWalletToPasskey, q as useMigrateWalletToShhh, a4 as usePrivateBalance, z as usePurchaseSku, J as useRecordSendTransaction, N as useRevokeSessionKey, W as useShhhSigner, a2 as useShield, F as useSignTypedData, y as useSyncOnChainTransfers, _ as useThresholdSign, r as useTransfer, a3 as useUnshield, p as useUpdateWalletEncryption, Q as useX402Payment } from './index-CUfzUBgv.mjs';
|
|
9
9
|
import { StarknetWindowObject } from '@starknet-io/types-js';
|
|
10
10
|
import '@tanstack/react-query';
|
|
11
11
|
import 'starknet';
|
|
@@ -212,7 +212,7 @@ interface RecoverProps {
|
|
|
212
212
|
/**
|
|
213
213
|
* Optional cancel handler. When omitted the cancel button is hidden.
|
|
214
214
|
* Add-device uses `cancel_pending_op` (any owner); guardian-recovery
|
|
215
|
-
* uses `cancel_recovery` (
|
|
215
|
+
* uses `cancel_recovery` (any non-revoked owner, signing with its own owner id).
|
|
216
216
|
*/
|
|
217
217
|
onCancel?: (opId: bigint | string) => Promise<void>;
|
|
218
218
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { ChipiSDK, NewOwnerInput } from '@chipi-stack/backend';
|
|
|
4
4
|
import { ChipiSDKConfig, WalletType } from '@chipi-stack/types';
|
|
5
5
|
export * from '@chipi-stack/types';
|
|
6
6
|
export { Chain, ChainToken } from '@chipi-stack/types';
|
|
7
|
-
import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-
|
|
8
|
-
export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, c as ChipiSessionSpendCap, d as ChipiSessionSpendCapAmount, e as ChipiSessionSpendCapPolicy, j as ChipiWalletData,
|
|
7
|
+
import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-CUfzUBgv.js';
|
|
8
|
+
export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, c as ChipiSessionSpendCap, d as ChipiSessionSpendCapAmount, e as ChipiSessionSpendCapPolicy, j as ChipiWalletData, H as ExternalSignerExecuteInput, a7 as PrivacyConfig, a8 as PrivacyKeys, ab as PrivacyLedgerEvent, a9 as PrivacyStep, ac as PrivateBalanceInput, R as RegisterSessionConfig, S as SessionState, n as SessionWallet, aa as ShieldHookInput, a1 as ThresholdSignState, l as UseChipiSessionConfig, m as UseChipiSessionReturn, h as UseChipiWalletConfig, i as UseChipiWalletReturn, Z as UseGuardianRecoveryReturn, X as UseShhhSignerReturn, a0 as UseThresholdSignOptions, $ as UseThresholdSignReturn, s as UseTransferConfig, T as UseX402PaymentConfig, V as UseX402PaymentReturn, a5 as derivePrivacyAccount, a6 as netPrivateBalance, M as useAddSessionKeyToContract, t as useApprove, E as useCallAnyContract, k as useChipiSession, g as useChipiWallet, I as useChipiWalletObject, L as useCreateSessionKey, u as useCreateWallet, P as useExecuteWithSession, G as useExternalSignerExecute, O as useGetSessionData, D as useGetSku, B as useGetSkuList, A as useGetSkuPurchase, K as useGetTokenBalance, w as useGetTransaction, v as useGetTransactionList, x as useGetTransactionStatus, f as useGetWallet, Y as useGuardianRecovery, o as useMigrateWalletToPasskey, q as useMigrateWalletToShhh, a4 as usePrivateBalance, z as usePurchaseSku, J as useRecordSendTransaction, N as useRevokeSessionKey, W as useShhhSigner, a2 as useShield, F as useSignTypedData, y as useSyncOnChainTransfers, _ as useThresholdSign, r as useTransfer, a3 as useUnshield, p as useUpdateWalletEncryption, Q as useX402Payment } from './index-CUfzUBgv.js';
|
|
9
9
|
import { StarknetWindowObject } from '@starknet-io/types-js';
|
|
10
10
|
import '@tanstack/react-query';
|
|
11
11
|
import 'starknet';
|
|
@@ -212,7 +212,7 @@ interface RecoverProps {
|
|
|
212
212
|
/**
|
|
213
213
|
* Optional cancel handler. When omitted the cancel button is hidden.
|
|
214
214
|
* Add-device uses `cancel_pending_op` (any owner); guardian-recovery
|
|
215
|
-
* uses `cancel_recovery` (
|
|
215
|
+
* uses `cancel_recovery` (any non-revoked owner, signing with its own owner id).
|
|
216
216
|
*/
|
|
217
217
|
onCancel?: (opId: bigint | string) => Promise<void>;
|
|
218
218
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1340,6 +1340,22 @@ function useSignTypedData() {
|
|
|
1340
1340
|
reset: mutation.reset
|
|
1341
1341
|
};
|
|
1342
1342
|
}
|
|
1343
|
+
function useExternalSignerExecute() {
|
|
1344
|
+
const { chipiSDK } = useChipiContext();
|
|
1345
|
+
const mutation = reactQuery.useMutation({
|
|
1346
|
+
mutationFn: async (input) => chipiSDK.executeWithExternalSigner(input)
|
|
1347
|
+
});
|
|
1348
|
+
return {
|
|
1349
|
+
execute: mutation.mutate,
|
|
1350
|
+
executeAsync: mutation.mutateAsync,
|
|
1351
|
+
data: mutation.data,
|
|
1352
|
+
isLoading: mutation.isPending,
|
|
1353
|
+
isError: mutation.isError,
|
|
1354
|
+
error: mutation.error,
|
|
1355
|
+
isSuccess: mutation.isSuccess,
|
|
1356
|
+
reset: mutation.reset
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1343
1359
|
|
|
1344
1360
|
// ../node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/index.js
|
|
1345
1361
|
var esm_exports = {};
|
|
@@ -20549,7 +20565,8 @@ function useChipiWalletObject(config3) {
|
|
|
20549
20565
|
return signTypedDataAsync({ encryptKey, wallet, typedData });
|
|
20550
20566
|
},
|
|
20551
20567
|
getDeploymentData: async () => {
|
|
20552
|
-
throw new Error("account_already_deployed");
|
|
20568
|
+
if (cfg.current.isDeployed === true) throw new Error("account_already_deployed");
|
|
20569
|
+
throw new Error("account_deployment_data_unavailable");
|
|
20553
20570
|
},
|
|
20554
20571
|
createSession: async (policy) => {
|
|
20555
20572
|
await createSession(policy);
|
|
@@ -21243,6 +21260,7 @@ var RpcError2 = class extends Error {
|
|
|
21243
21260
|
var USER_REFUSED_OP = 113;
|
|
21244
21261
|
var INVALID_REQUEST_PAYLOAD = 114;
|
|
21245
21262
|
var ACCOUNT_ALREADY_DEPLOYED = 115;
|
|
21263
|
+
var NO_DEPLOYMENT_DATA = 116;
|
|
21246
21264
|
var UNKNOWN_ERROR = 163;
|
|
21247
21265
|
var MISSING_APPROVAL_WARNING = "[ChipiSDK:Connect] No `requestApproval` was provided, so every approval (connect, execute, signTypedData, session) is denied. Pass `requestApproval` to show the user an approval UI and resolve true/false.";
|
|
21248
21266
|
function normalizeChainId(value) {
|
|
@@ -21312,15 +21330,19 @@ function createChipiWindowObject(deps) {
|
|
|
21312
21330
|
case "wallet_signTypedData": {
|
|
21313
21331
|
const typedData = call.params;
|
|
21314
21332
|
const domainChainId = typedData?.domain?.chainId;
|
|
21315
|
-
if (domainChainId
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
-
|
|
21323
|
-
|
|
21333
|
+
if (domainChainId === void 0 || domainChainId === null) {
|
|
21334
|
+
throw new RpcError2(
|
|
21335
|
+
INVALID_REQUEST_PAYLOAD,
|
|
21336
|
+
`wallet_signTypedData: domain.chainId is required (the wallet chain is ${deps.chainId})`
|
|
21337
|
+
);
|
|
21338
|
+
}
|
|
21339
|
+
const expected = normalizeChainId(deps.chainId);
|
|
21340
|
+
const actual = normalizeChainId(domainChainId);
|
|
21341
|
+
if (actual === null || expected === null || actual !== expected) {
|
|
21342
|
+
throw new RpcError2(
|
|
21343
|
+
INVALID_REQUEST_PAYLOAD,
|
|
21344
|
+
`wallet_signTypedData: domain.chainId ${String(domainChainId)} does not match the wallet chain ${deps.chainId}`
|
|
21345
|
+
);
|
|
21324
21346
|
}
|
|
21325
21347
|
await requireApproval({ type: "signTypedData", typedData });
|
|
21326
21348
|
return deps.signTypedData(typedData);
|
|
@@ -21332,6 +21354,9 @@ function createChipiWindowObject(deps) {
|
|
|
21332
21354
|
if (err2 instanceof Error && err2.message === "account_already_deployed") {
|
|
21333
21355
|
throw new RpcError2(ACCOUNT_ALREADY_DEPLOYED, "Account already deployed");
|
|
21334
21356
|
}
|
|
21357
|
+
if (err2 instanceof Error && err2.message === "account_deployment_data_unavailable") {
|
|
21358
|
+
throw new RpcError2(NO_DEPLOYMENT_DATA, "Account deployment data is not available");
|
|
21359
|
+
}
|
|
21335
21360
|
throw new RpcError2(
|
|
21336
21361
|
UNKNOWN_ERROR,
|
|
21337
21362
|
err2 instanceof Error ? err2.message : "Could not read deployment data"
|
|
@@ -21652,6 +21677,7 @@ exports.useChipiWalletObject = useChipiWalletObject;
|
|
|
21652
21677
|
exports.useCreateSessionKey = useCreateSessionKey;
|
|
21653
21678
|
exports.useCreateWallet = useCreateWallet;
|
|
21654
21679
|
exports.useExecuteWithSession = useExecuteWithSession;
|
|
21680
|
+
exports.useExternalSignerExecute = useExternalSignerExecute;
|
|
21655
21681
|
exports.useGetSessionData = useGetSessionData;
|
|
21656
21682
|
exports.useGetSku = useGetSku;
|
|
21657
21683
|
exports.useGetSkuList = useGetSkuList;
|