@chipi-stack/chipi-react 14.15.1 → 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 +91 -19
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +91 -20
- package/dist/hooks.mjs.map +1 -1
- package/dist/{index-gNLTF6ix.d.mts → index-CUfzUBgv.d.mts} +92 -12
- package/dist/{index-gNLTF6ix.d.ts → index-CUfzUBgv.d.ts} +92 -12
- package/dist/index.d.mts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +159 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +159 -32
- 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`
|
|
@@ -1897,19 +1915,52 @@ type ChipiApprovalRequest = {
|
|
|
1897
1915
|
* `[session_pubkey, r, s, valid_until]`.
|
|
1898
1916
|
*/
|
|
1899
1917
|
interface ChipiSessionPolicy {
|
|
1900
|
-
/**
|
|
1918
|
+
/**
|
|
1919
|
+
* Allowed (contractAddress, entrypoint) pairs the session may call.
|
|
1920
|
+
*
|
|
1921
|
+
* Client side, `useChipiWalletObject` only routes a call through the session
|
|
1922
|
+
* when its exact (contract, entrypoint) pair is listed. On-chain, though, the
|
|
1923
|
+
* session whitelist is per entrypoint selector only: allowing `transfer` lets
|
|
1924
|
+
* the session call `transfer` on ANY contract. Use `spendCaps` to bound what
|
|
1925
|
+
* the session can move per token.
|
|
1926
|
+
*/
|
|
1901
1927
|
allowedCalls: Array<{
|
|
1902
1928
|
contractAddress: string;
|
|
1903
1929
|
entrypoint: string;
|
|
1904
1930
|
}>;
|
|
1905
1931
|
/** Unix seconds after which the session is invalid. */
|
|
1906
1932
|
validUntil: number;
|
|
1907
|
-
/**
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1933
|
+
/**
|
|
1934
|
+
* Optional per-token spend caps, registered on-chain as spending policies in
|
|
1935
|
+
* the same transaction as the session. A cap must never resolve to a window
|
|
1936
|
+
* limit of 0 (on-chain, 0 means unlimited); that is rejected.
|
|
1937
|
+
*/
|
|
1938
|
+
spendCaps?: ChipiSessionSpendCap[];
|
|
1912
1939
|
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Simple per-token cap: `amount` (base units, decimal or hex string) is used as
|
|
1942
|
+
* both the per-call and the per-window limit, with a window equal to the
|
|
1943
|
+
* session lifetime.
|
|
1944
|
+
*/
|
|
1945
|
+
interface ChipiSessionSpendCapAmount {
|
|
1946
|
+
/** ERC-20 token contract address. */
|
|
1947
|
+
token: string;
|
|
1948
|
+
/** Cap in token base units (e.g. "5000000" = 5 USDC). Must be > 0. */
|
|
1949
|
+
amount: string;
|
|
1950
|
+
}
|
|
1951
|
+
/** Full per-token spending policy (mirrors `SpendingPolicyConfig`). */
|
|
1952
|
+
interface ChipiSessionSpendCapPolicy {
|
|
1953
|
+
/** ERC-20 token contract address. */
|
|
1954
|
+
token: string;
|
|
1955
|
+
/** Max amount per single call, in token base units. */
|
|
1956
|
+
maxPerCall: string | bigint;
|
|
1957
|
+
/** Max cumulative amount within the rolling window, in base units. Must be > 0. */
|
|
1958
|
+
maxPerWindow: string | bigint;
|
|
1959
|
+
/** Rolling window duration in seconds (positive integer). */
|
|
1960
|
+
windowSeconds: number;
|
|
1961
|
+
}
|
|
1962
|
+
/** A per-token spend cap: the simple `{ token, amount }` form or a full policy. */
|
|
1963
|
+
type ChipiSessionSpendCap = ChipiSessionSpendCapAmount | ChipiSessionSpendCapPolicy;
|
|
1913
1964
|
/**
|
|
1914
1965
|
* Everything the framework-agnostic SWO needs, supplied by the host layer
|
|
1915
1966
|
* (`@chipi-stack/react`'s `useChipiWalletObject`, the hosted web-wallet, etc.).
|
|
@@ -1935,11 +1986,20 @@ interface ChipiWindowObjectDeps {
|
|
|
1935
1986
|
executeCalls: (calls: Call$2[]) => Promise<string>;
|
|
1936
1987
|
/** Sign SNIP-12 typed data → signature felts (envelope-aware for SHHH). */
|
|
1937
1988
|
signTypedData: (typedData: TypedData) => Promise<string[]>;
|
|
1938
|
-
/**
|
|
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
|
+
*/
|
|
1939
1995
|
getDeploymentData: () => Promise<AccountDeploymentData>;
|
|
1940
1996
|
/** Optional: establish a session from a dApp-proposed policy (approve once). */
|
|
1941
1997
|
createSession?: (policy: ChipiSessionPolicy) => Promise<void>;
|
|
1942
|
-
/**
|
|
1998
|
+
/**
|
|
1999
|
+
* Host approval gate: render the prompt and resolve `true` to approve.
|
|
2000
|
+
* When omitted, every approval is denied (deny by default) and a single
|
|
2001
|
+
* `console.warn` explains that `requestApproval` must be provided.
|
|
2002
|
+
*/
|
|
1943
2003
|
requestApproval?: (req: ChipiApprovalRequest) => Promise<boolean>;
|
|
1944
2004
|
}
|
|
1945
2005
|
|
|
@@ -1958,7 +2018,18 @@ interface UseChipiWalletObjectConfig {
|
|
|
1958
2018
|
sessionPolicy?: ChipiSessionPolicy | null;
|
|
1959
2019
|
/** Chain id felt; defaults to SN_MAIN. */
|
|
1960
2020
|
chainId?: string;
|
|
1961
|
-
/**
|
|
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;
|
|
2028
|
+
/**
|
|
2029
|
+
* Host approval gate (connect / execute / signTypedData / session). When
|
|
2030
|
+
* omitted, every approval is denied and a single `console.warn` explains
|
|
2031
|
+
* that `requestApproval` must be provided.
|
|
2032
|
+
*/
|
|
1962
2033
|
requestApproval?: (req: ChipiApprovalRequest) => Promise<boolean>;
|
|
1963
2034
|
}
|
|
1964
2035
|
/**
|
|
@@ -1971,6 +2042,15 @@ interface UseChipiWalletObjectConfig {
|
|
|
1971
2042
|
* `injectChipiWallet`. `createSession(policy)` establishes a session on-chain
|
|
1972
2043
|
* from a dApp-proposed policy (the "approve once" flow); the host stores the
|
|
1973
2044
|
* returned SessionKeyData and feeds it back via `config.session`.
|
|
2045
|
+
*
|
|
2046
|
+
* Note: `allowedCalls` is matched per (contract, entrypoint) only client-side,
|
|
2047
|
+
* for routing. On-chain the session whitelist is per entrypoint selector, not
|
|
2048
|
+
* per contract, so pass `spendCaps` to bound token spend; with caps, the
|
|
2049
|
+
* session and its spending policies are registered in one owner-signed
|
|
2050
|
+
* transaction (`sdk.sessions.setupSession`).
|
|
2051
|
+
*
|
|
2052
|
+
* Approvals are deny-by-default: without `config.requestApproval`, every
|
|
2053
|
+
* approval is denied and a single `console.warn` says so.
|
|
1974
2054
|
*/
|
|
1975
2055
|
declare function useChipiWalletObject(config: UseChipiWalletObjectConfig): {
|
|
1976
2056
|
deps: ChipiWindowObjectDeps;
|
|
@@ -2542,7 +2622,7 @@ type Call = ReturnType<typeof buildProposeAddOwnerCall>;
|
|
|
2542
2622
|
* 1. ADD DEVICE (user has wallet access, wants a second owner)
|
|
2543
2623
|
* a. `proposeAddOwner` (owner-signed OE)
|
|
2544
2624
|
* b. wait 48h timelock
|
|
2545
|
-
* c. `executeAddOwner` (
|
|
2625
|
+
* c. `executeAddOwner` (permissionless after the timelock: any account, or an owner OE; opId from 1a)
|
|
2546
2626
|
*
|
|
2547
2627
|
* 2. RECOVER VIA GUARDIAN (user lost key)
|
|
2548
2628
|
* a. `initiateRecovery` (guardian-signed OE)
|
|
@@ -2916,4 +2996,4 @@ declare function usePrivateBalance(input: PrivateBalanceInput): {
|
|
|
2916
2996
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, bigint>, Error>>;
|
|
2917
2997
|
};
|
|
2918
2998
|
|
|
2919
|
-
export {
|
|
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`
|
|
@@ -1897,19 +1915,52 @@ type ChipiApprovalRequest = {
|
|
|
1897
1915
|
* `[session_pubkey, r, s, valid_until]`.
|
|
1898
1916
|
*/
|
|
1899
1917
|
interface ChipiSessionPolicy {
|
|
1900
|
-
/**
|
|
1918
|
+
/**
|
|
1919
|
+
* Allowed (contractAddress, entrypoint) pairs the session may call.
|
|
1920
|
+
*
|
|
1921
|
+
* Client side, `useChipiWalletObject` only routes a call through the session
|
|
1922
|
+
* when its exact (contract, entrypoint) pair is listed. On-chain, though, the
|
|
1923
|
+
* session whitelist is per entrypoint selector only: allowing `transfer` lets
|
|
1924
|
+
* the session call `transfer` on ANY contract. Use `spendCaps` to bound what
|
|
1925
|
+
* the session can move per token.
|
|
1926
|
+
*/
|
|
1901
1927
|
allowedCalls: Array<{
|
|
1902
1928
|
contractAddress: string;
|
|
1903
1929
|
entrypoint: string;
|
|
1904
1930
|
}>;
|
|
1905
1931
|
/** Unix seconds after which the session is invalid. */
|
|
1906
1932
|
validUntil: number;
|
|
1907
|
-
/**
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1933
|
+
/**
|
|
1934
|
+
* Optional per-token spend caps, registered on-chain as spending policies in
|
|
1935
|
+
* the same transaction as the session. A cap must never resolve to a window
|
|
1936
|
+
* limit of 0 (on-chain, 0 means unlimited); that is rejected.
|
|
1937
|
+
*/
|
|
1938
|
+
spendCaps?: ChipiSessionSpendCap[];
|
|
1912
1939
|
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Simple per-token cap: `amount` (base units, decimal or hex string) is used as
|
|
1942
|
+
* both the per-call and the per-window limit, with a window equal to the
|
|
1943
|
+
* session lifetime.
|
|
1944
|
+
*/
|
|
1945
|
+
interface ChipiSessionSpendCapAmount {
|
|
1946
|
+
/** ERC-20 token contract address. */
|
|
1947
|
+
token: string;
|
|
1948
|
+
/** Cap in token base units (e.g. "5000000" = 5 USDC). Must be > 0. */
|
|
1949
|
+
amount: string;
|
|
1950
|
+
}
|
|
1951
|
+
/** Full per-token spending policy (mirrors `SpendingPolicyConfig`). */
|
|
1952
|
+
interface ChipiSessionSpendCapPolicy {
|
|
1953
|
+
/** ERC-20 token contract address. */
|
|
1954
|
+
token: string;
|
|
1955
|
+
/** Max amount per single call, in token base units. */
|
|
1956
|
+
maxPerCall: string | bigint;
|
|
1957
|
+
/** Max cumulative amount within the rolling window, in base units. Must be > 0. */
|
|
1958
|
+
maxPerWindow: string | bigint;
|
|
1959
|
+
/** Rolling window duration in seconds (positive integer). */
|
|
1960
|
+
windowSeconds: number;
|
|
1961
|
+
}
|
|
1962
|
+
/** A per-token spend cap: the simple `{ token, amount }` form or a full policy. */
|
|
1963
|
+
type ChipiSessionSpendCap = ChipiSessionSpendCapAmount | ChipiSessionSpendCapPolicy;
|
|
1913
1964
|
/**
|
|
1914
1965
|
* Everything the framework-agnostic SWO needs, supplied by the host layer
|
|
1915
1966
|
* (`@chipi-stack/react`'s `useChipiWalletObject`, the hosted web-wallet, etc.).
|
|
@@ -1935,11 +1986,20 @@ interface ChipiWindowObjectDeps {
|
|
|
1935
1986
|
executeCalls: (calls: Call$2[]) => Promise<string>;
|
|
1936
1987
|
/** Sign SNIP-12 typed data → signature felts (envelope-aware for SHHH). */
|
|
1937
1988
|
signTypedData: (typedData: TypedData) => Promise<string[]>;
|
|
1938
|
-
/**
|
|
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
|
+
*/
|
|
1939
1995
|
getDeploymentData: () => Promise<AccountDeploymentData>;
|
|
1940
1996
|
/** Optional: establish a session from a dApp-proposed policy (approve once). */
|
|
1941
1997
|
createSession?: (policy: ChipiSessionPolicy) => Promise<void>;
|
|
1942
|
-
/**
|
|
1998
|
+
/**
|
|
1999
|
+
* Host approval gate: render the prompt and resolve `true` to approve.
|
|
2000
|
+
* When omitted, every approval is denied (deny by default) and a single
|
|
2001
|
+
* `console.warn` explains that `requestApproval` must be provided.
|
|
2002
|
+
*/
|
|
1943
2003
|
requestApproval?: (req: ChipiApprovalRequest) => Promise<boolean>;
|
|
1944
2004
|
}
|
|
1945
2005
|
|
|
@@ -1958,7 +2018,18 @@ interface UseChipiWalletObjectConfig {
|
|
|
1958
2018
|
sessionPolicy?: ChipiSessionPolicy | null;
|
|
1959
2019
|
/** Chain id felt; defaults to SN_MAIN. */
|
|
1960
2020
|
chainId?: string;
|
|
1961
|
-
/**
|
|
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;
|
|
2028
|
+
/**
|
|
2029
|
+
* Host approval gate (connect / execute / signTypedData / session). When
|
|
2030
|
+
* omitted, every approval is denied and a single `console.warn` explains
|
|
2031
|
+
* that `requestApproval` must be provided.
|
|
2032
|
+
*/
|
|
1962
2033
|
requestApproval?: (req: ChipiApprovalRequest) => Promise<boolean>;
|
|
1963
2034
|
}
|
|
1964
2035
|
/**
|
|
@@ -1971,6 +2042,15 @@ interface UseChipiWalletObjectConfig {
|
|
|
1971
2042
|
* `injectChipiWallet`. `createSession(policy)` establishes a session on-chain
|
|
1972
2043
|
* from a dApp-proposed policy (the "approve once" flow); the host stores the
|
|
1973
2044
|
* returned SessionKeyData and feeds it back via `config.session`.
|
|
2045
|
+
*
|
|
2046
|
+
* Note: `allowedCalls` is matched per (contract, entrypoint) only client-side,
|
|
2047
|
+
* for routing. On-chain the session whitelist is per entrypoint selector, not
|
|
2048
|
+
* per contract, so pass `spendCaps` to bound token spend; with caps, the
|
|
2049
|
+
* session and its spending policies are registered in one owner-signed
|
|
2050
|
+
* transaction (`sdk.sessions.setupSession`).
|
|
2051
|
+
*
|
|
2052
|
+
* Approvals are deny-by-default: without `config.requestApproval`, every
|
|
2053
|
+
* approval is denied and a single `console.warn` says so.
|
|
1974
2054
|
*/
|
|
1975
2055
|
declare function useChipiWalletObject(config: UseChipiWalletObjectConfig): {
|
|
1976
2056
|
deps: ChipiWindowObjectDeps;
|
|
@@ -2542,7 +2622,7 @@ type Call = ReturnType<typeof buildProposeAddOwnerCall>;
|
|
|
2542
2622
|
* 1. ADD DEVICE (user has wallet access, wants a second owner)
|
|
2543
2623
|
* a. `proposeAddOwner` (owner-signed OE)
|
|
2544
2624
|
* b. wait 48h timelock
|
|
2545
|
-
* c. `executeAddOwner` (
|
|
2625
|
+
* c. `executeAddOwner` (permissionless after the timelock: any account, or an owner OE; opId from 1a)
|
|
2546
2626
|
*
|
|
2547
2627
|
* 2. RECOVER VIA GUARDIAN (user lost key)
|
|
2548
2628
|
* a. `initiateRecovery` (guardian-signed OE)
|
|
@@ -2916,4 +2996,4 @@ declare function usePrivateBalance(input: PrivateBalanceInput): {
|
|
|
2916
2996
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, bigint>, Error>>;
|
|
2917
2997
|
};
|
|
2918
2998
|
|
|
2919
|
-
export {
|
|
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,
|
|
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';
|
|
@@ -61,6 +61,19 @@ declare function walletSupportsSessions(wallet: {
|
|
|
61
61
|
* `deps`, so the same object powers walletv2's in-app browser, the hosted
|
|
62
62
|
* web-wallet connector, and WalletConnect transport identically.
|
|
63
63
|
*
|
|
64
|
+
* Approvals are deny-by-default: every sensitive action goes through
|
|
65
|
+
* `deps.requestApproval`. When it is omitted, every approval is denied (and a
|
|
66
|
+
* single `console.warn` says so) instead of being auto-approved.
|
|
67
|
+
*
|
|
68
|
+
* Connection model (per window object, i.e. per injected dApp page):
|
|
69
|
+
* - `wallet_requestAccounts` asks for a `connect` approval once, even when the
|
|
70
|
+
* wallet is unlocked and has accounts. With `silent_mode: true` it never
|
|
71
|
+
* prompts: it returns the accounts if already approved, else `[]`.
|
|
72
|
+
* - `wallet_getPermissions` returns `[]` until that approval, `["accounts"]` after.
|
|
73
|
+
* - `wallet_signTypedData` rejects (INVALID_REQUEST_PAYLOAD, no prompt) when
|
|
74
|
+
* the typed data's `domain.chainId` is set and differs from `deps.chainId`.
|
|
75
|
+
* "SN_MAIN" and "0x534e5f4d41494e" are treated as the same chain.
|
|
76
|
+
*
|
|
64
77
|
* Returns the wallet plus an `emit` controller so the host can fire
|
|
65
78
|
* accountsChanged / networkChanged on connect, disconnect, or lock.
|
|
66
79
|
*/
|
|
@@ -199,7 +212,7 @@ interface RecoverProps {
|
|
|
199
212
|
/**
|
|
200
213
|
* Optional cancel handler. When omitted the cancel button is hidden.
|
|
201
214
|
* Add-device uses `cancel_pending_op` (any owner); guardian-recovery
|
|
202
|
-
* uses `cancel_recovery` (
|
|
215
|
+
* uses `cancel_recovery` (any non-revoked owner, signing with its own owner id).
|
|
203
216
|
*/
|
|
204
217
|
onCancel?: (opId: bigint | string) => Promise<void>;
|
|
205
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,
|
|
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';
|
|
@@ -61,6 +61,19 @@ declare function walletSupportsSessions(wallet: {
|
|
|
61
61
|
* `deps`, so the same object powers walletv2's in-app browser, the hosted
|
|
62
62
|
* web-wallet connector, and WalletConnect transport identically.
|
|
63
63
|
*
|
|
64
|
+
* Approvals are deny-by-default: every sensitive action goes through
|
|
65
|
+
* `deps.requestApproval`. When it is omitted, every approval is denied (and a
|
|
66
|
+
* single `console.warn` says so) instead of being auto-approved.
|
|
67
|
+
*
|
|
68
|
+
* Connection model (per window object, i.e. per injected dApp page):
|
|
69
|
+
* - `wallet_requestAccounts` asks for a `connect` approval once, even when the
|
|
70
|
+
* wallet is unlocked and has accounts. With `silent_mode: true` it never
|
|
71
|
+
* prompts: it returns the accounts if already approved, else `[]`.
|
|
72
|
+
* - `wallet_getPermissions` returns `[]` until that approval, `["accounts"]` after.
|
|
73
|
+
* - `wallet_signTypedData` rejects (INVALID_REQUEST_PAYLOAD, no prompt) when
|
|
74
|
+
* the typed data's `domain.chainId` is set and differs from `deps.chainId`.
|
|
75
|
+
* "SN_MAIN" and "0x534e5f4d41494e" are treated as the same chain.
|
|
76
|
+
*
|
|
64
77
|
* Returns the wallet plus an `emit` controller so the host can fire
|
|
65
78
|
* accountsChanged / networkChanged on connect, disconnect, or lock.
|
|
66
79
|
*/
|
|
@@ -199,7 +212,7 @@ interface RecoverProps {
|
|
|
199
212
|
/**
|
|
200
213
|
* Optional cancel handler. When omitted the cancel button is hidden.
|
|
201
214
|
* Add-device uses `cancel_pending_op` (any owner); guardian-recovery
|
|
202
|
-
* uses `cancel_recovery` (
|
|
215
|
+
* uses `cancel_recovery` (any non-revoked owner, signing with its own owner id).
|
|
203
216
|
*/
|
|
204
217
|
onCancel?: (opId: bigint | string) => Promise<void>;
|
|
205
218
|
/**
|