@chipi-stack/chipi-react 14.8.0 → 14.10.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/index.d.mts CHANGED
@@ -4,8 +4,12 @@ import { ChipiSDK, NewOwnerInput } from '@chipi-stack/backend';
4
4
  import { ChipiSDKConfig } from '@chipi-stack/types';
5
5
  export * from '@chipi-stack/types';
6
6
  export { Chain, ChainToken } from '@chipi-stack/types';
7
- export { ChipiWalletData, SessionState, SessionWallet, ThresholdSignState, UseChipiSessionConfig, UseChipiSessionReturn, UseChipiWalletConfig, UseChipiWalletReturn, UseGuardianRecoveryReturn, UseShhhSignerReturn, UseThresholdSignOptions, UseThresholdSignReturn, UseTransferConfig, UseX402PaymentConfig, UseX402PaymentReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransaction, useGetTransactionList, useGetTransactionStatus, useGetWallet, useGuardianRecovery, useMigrateWalletToPasskey, useMigrateWalletToShhh, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useShhhSigner, useSyncOnChainTransfers, useThresholdSign, useTransfer, useUpdateWalletEncryption, useX402Payment } from './hooks.mjs';
7
+ import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-D9-uVlda.mjs';
8
+ export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, a1 as PrivacyConfig, a2 as PrivacyKeys, a5 as PrivacyLedgerEvent, a3 as PrivacyStep, a6 as PrivateBalanceInput, S as SessionState, k as SessionWallet, a4 as ShieldHookInput, X as ThresholdSignState, i as UseChipiSessionConfig, j as UseChipiSessionReturn, e as UseChipiWalletConfig, f as UseChipiWalletReturn, R as UseGuardianRecoveryReturn, P as UseShhhSignerReturn, W as UseThresholdSignOptions, V as UseThresholdSignReturn, p as UseTransferConfig, M as UseX402PaymentConfig, N as UseX402PaymentReturn, $ as derivePrivacyAccount, a0 as netPrivateBalance, H as useAddSessionKeyToContract, q as useApprove, A as useCallAnyContract, h as useChipiSession, d as useChipiWallet, D as useChipiWalletObject, G as useCreateSessionKey, u as useCreateWallet, K as useExecuteWithSession, J as useGetSessionData, z as useGetSku, y as useGetSkuList, x as useGetSkuPurchase, F as useGetTokenBalance, s as useGetTransaction, r as useGetTransactionList, t as useGetTransactionStatus, c as useGetWallet, Q as useGuardianRecovery, l as useMigrateWalletToPasskey, n as useMigrateWalletToShhh, _ as usePrivateBalance, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, Y as useShield, B as useSignTypedData, v as useSyncOnChainTransfers, T as useThresholdSign, o as useTransfer, Z as useUnshield, m as useUpdateWalletEncryption, L as useX402Payment } from './index-D9-uVlda.mjs';
9
+ import { StarknetWindowObject } from '@starknet-io/types-js';
8
10
  import '@tanstack/react-query';
11
+ import 'starknet';
12
+ import '@chipi-stack/core';
9
13
 
10
14
  interface PasskeyAdapter {
11
15
  getWalletEncryptKey: (input: {
@@ -31,6 +35,61 @@ declare function ChipiProvider({ children, config, passkeyAdapter }: ChipiProvid
31
35
  */
32
36
  declare function useChipiContext(): ChipiContextValue;
33
37
 
38
+ /**
39
+ * Build a standards-compliant Starknet `StarknetWindowObject` backed by a Chipi
40
+ * wallet. Framework-agnostic: all signing/execution/approval is injected via
41
+ * `deps`, so the same object powers walletv2's in-app browser, the hosted
42
+ * web-wallet connector, and WalletConnect transport identically.
43
+ *
44
+ * Returns the wallet plus an `emit` controller so the host can fire
45
+ * accountsChanged / networkChanged on connect, disconnect, or lock.
46
+ */
47
+ declare function createChipiWindowObject(deps: ChipiWindowObjectDeps): {
48
+ wallet: StarknetWindowObject;
49
+ emit: {
50
+ accountsChanged: (accounts: string[]) => void;
51
+ networkChanged: (chainId: string, accounts?: string[]) => void;
52
+ };
53
+ };
54
+
55
+ interface InjectedChipiWallet {
56
+ /** The injected StarknetWindowObject (also reachable at window.starknet_chipi). */
57
+ wallet: ReturnType<typeof createChipiWindowObject>["wallet"];
58
+ /** Fire accountsChanged / networkChanged to connected dApps. */
59
+ emit: ReturnType<typeof createChipiWindowObject>["emit"];
60
+ /** Remove the injected object + event listeners. */
61
+ dispose: () => void;
62
+ }
63
+ /**
64
+ * Inject a Chipi `StarknetWindowObject` so any dApp built on get-starknet /
65
+ * starknet-react / starknetkit discovers it as a connectable wallet.
66
+ *
67
+ * Discovery is covered two ways for max reach:
68
+ * 1. **Window scan** — set `window.starknet_chipi`. get-starknet v4's
69
+ * `getAvailableWallets()` finds every `window` key starting with `starknet`.
70
+ * 2. **Event announce** — dispatch `starknet:announceWallet` (and re-announce
71
+ * on the dApp's `starknet:requestWallets`), the timing-robust, EIP-6963-style
72
+ * discovery used by newer get-starknet / the Starknet Wallet Standard.
73
+ *
74
+ * Returns a controller to emit account/network changes and to dispose.
75
+ * Only meaningful where Chipi can inject into the dApp page — an in-app browser
76
+ * (native shell) or extension; a hosted wallet on a third-party domain uses the
77
+ * connector path instead.
78
+ */
79
+ declare function injectChipiWallet(deps: ChipiWindowObjectDeps, target?: (Window & typeof globalThis) | undefined): InjectedChipiWallet;
80
+
81
+ interface ChipiInjectorProps extends UseChipiWalletObjectConfig {
82
+ children?: ReactNode;
83
+ }
84
+ /**
85
+ * Inject a Chipi `StarknetWindowObject` into the page so any dApp loaded here
86
+ * (in-app browser / native-shell webview) discovers it via get-starknet /
87
+ * starknet-react / starknetkit. Composes execution + signing + session-first
88
+ * routing from the SDK hooks. Mount it once high in the wallet's in-app browser
89
+ * tree. Emits `accountsChanged` when the connected wallet changes.
90
+ */
91
+ declare function ChipiInjector({ children, ...config }: ChipiInjectorProps): ReactNode;
92
+
34
93
  /**
35
94
  * SHHH V8.4 standalone recovery component (Wave B B6.2).
36
95
  *
@@ -105,4 +164,4 @@ interface RecoverProps {
105
164
  }
106
165
  declare function Recover(props: RecoverProps): React.ReactElement;
107
166
 
108
- export { ChipiProvider, type PasskeyAdapter, Recover, type RecoverProps, useChipiContext };
167
+ export { ChipiInjector, type ChipiInjectorProps, ChipiProvider, ChipiWindowObjectDeps, type InjectedChipiWallet, type PasskeyAdapter, Recover, type RecoverProps, UseChipiWalletObjectConfig, createChipiWindowObject, injectChipiWallet, useChipiContext };
package/dist/index.d.ts CHANGED
@@ -4,8 +4,12 @@ import { ChipiSDK, NewOwnerInput } from '@chipi-stack/backend';
4
4
  import { ChipiSDKConfig } from '@chipi-stack/types';
5
5
  export * from '@chipi-stack/types';
6
6
  export { Chain, ChainToken } from '@chipi-stack/types';
7
- export { ChipiWalletData, SessionState, SessionWallet, ThresholdSignState, UseChipiSessionConfig, UseChipiSessionReturn, UseChipiWalletConfig, UseChipiWalletReturn, UseGuardianRecoveryReturn, UseShhhSignerReturn, UseThresholdSignOptions, UseThresholdSignReturn, UseTransferConfig, UseX402PaymentConfig, UseX402PaymentReturn, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiSession, useChipiWallet, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransaction, useGetTransactionList, useGetTransactionStatus, useGetWallet, useGuardianRecovery, useMigrateWalletToPasskey, useMigrateWalletToShhh, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useShhhSigner, useSyncOnChainTransfers, useThresholdSign, useTransfer, useUpdateWalletEncryption, useX402Payment } from './hooks.js';
7
+ import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-D9-uVlda.js';
8
+ export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, a1 as PrivacyConfig, a2 as PrivacyKeys, a5 as PrivacyLedgerEvent, a3 as PrivacyStep, a6 as PrivateBalanceInput, S as SessionState, k as SessionWallet, a4 as ShieldHookInput, X as ThresholdSignState, i as UseChipiSessionConfig, j as UseChipiSessionReturn, e as UseChipiWalletConfig, f as UseChipiWalletReturn, R as UseGuardianRecoveryReturn, P as UseShhhSignerReturn, W as UseThresholdSignOptions, V as UseThresholdSignReturn, p as UseTransferConfig, M as UseX402PaymentConfig, N as UseX402PaymentReturn, $ as derivePrivacyAccount, a0 as netPrivateBalance, H as useAddSessionKeyToContract, q as useApprove, A as useCallAnyContract, h as useChipiSession, d as useChipiWallet, D as useChipiWalletObject, G as useCreateSessionKey, u as useCreateWallet, K as useExecuteWithSession, J as useGetSessionData, z as useGetSku, y as useGetSkuList, x as useGetSkuPurchase, F as useGetTokenBalance, s as useGetTransaction, r as useGetTransactionList, t as useGetTransactionStatus, c as useGetWallet, Q as useGuardianRecovery, l as useMigrateWalletToPasskey, n as useMigrateWalletToShhh, _ as usePrivateBalance, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, Y as useShield, B as useSignTypedData, v as useSyncOnChainTransfers, T as useThresholdSign, o as useTransfer, Z as useUnshield, m as useUpdateWalletEncryption, L as useX402Payment } from './index-D9-uVlda.js';
9
+ import { StarknetWindowObject } from '@starknet-io/types-js';
8
10
  import '@tanstack/react-query';
11
+ import 'starknet';
12
+ import '@chipi-stack/core';
9
13
 
10
14
  interface PasskeyAdapter {
11
15
  getWalletEncryptKey: (input: {
@@ -31,6 +35,61 @@ declare function ChipiProvider({ children, config, passkeyAdapter }: ChipiProvid
31
35
  */
32
36
  declare function useChipiContext(): ChipiContextValue;
33
37
 
38
+ /**
39
+ * Build a standards-compliant Starknet `StarknetWindowObject` backed by a Chipi
40
+ * wallet. Framework-agnostic: all signing/execution/approval is injected via
41
+ * `deps`, so the same object powers walletv2's in-app browser, the hosted
42
+ * web-wallet connector, and WalletConnect transport identically.
43
+ *
44
+ * Returns the wallet plus an `emit` controller so the host can fire
45
+ * accountsChanged / networkChanged on connect, disconnect, or lock.
46
+ */
47
+ declare function createChipiWindowObject(deps: ChipiWindowObjectDeps): {
48
+ wallet: StarknetWindowObject;
49
+ emit: {
50
+ accountsChanged: (accounts: string[]) => void;
51
+ networkChanged: (chainId: string, accounts?: string[]) => void;
52
+ };
53
+ };
54
+
55
+ interface InjectedChipiWallet {
56
+ /** The injected StarknetWindowObject (also reachable at window.starknet_chipi). */
57
+ wallet: ReturnType<typeof createChipiWindowObject>["wallet"];
58
+ /** Fire accountsChanged / networkChanged to connected dApps. */
59
+ emit: ReturnType<typeof createChipiWindowObject>["emit"];
60
+ /** Remove the injected object + event listeners. */
61
+ dispose: () => void;
62
+ }
63
+ /**
64
+ * Inject a Chipi `StarknetWindowObject` so any dApp built on get-starknet /
65
+ * starknet-react / starknetkit discovers it as a connectable wallet.
66
+ *
67
+ * Discovery is covered two ways for max reach:
68
+ * 1. **Window scan** — set `window.starknet_chipi`. get-starknet v4's
69
+ * `getAvailableWallets()` finds every `window` key starting with `starknet`.
70
+ * 2. **Event announce** — dispatch `starknet:announceWallet` (and re-announce
71
+ * on the dApp's `starknet:requestWallets`), the timing-robust, EIP-6963-style
72
+ * discovery used by newer get-starknet / the Starknet Wallet Standard.
73
+ *
74
+ * Returns a controller to emit account/network changes and to dispose.
75
+ * Only meaningful where Chipi can inject into the dApp page — an in-app browser
76
+ * (native shell) or extension; a hosted wallet on a third-party domain uses the
77
+ * connector path instead.
78
+ */
79
+ declare function injectChipiWallet(deps: ChipiWindowObjectDeps, target?: (Window & typeof globalThis) | undefined): InjectedChipiWallet;
80
+
81
+ interface ChipiInjectorProps extends UseChipiWalletObjectConfig {
82
+ children?: ReactNode;
83
+ }
84
+ /**
85
+ * Inject a Chipi `StarknetWindowObject` into the page so any dApp loaded here
86
+ * (in-app browser / native-shell webview) discovers it via get-starknet /
87
+ * starknet-react / starknetkit. Composes execution + signing + session-first
88
+ * routing from the SDK hooks. Mount it once high in the wallet's in-app browser
89
+ * tree. Emits `accountsChanged` when the connected wallet changes.
90
+ */
91
+ declare function ChipiInjector({ children, ...config }: ChipiInjectorProps): ReactNode;
92
+
34
93
  /**
35
94
  * SHHH V8.4 standalone recovery component (Wave B B6.2).
36
95
  *
@@ -105,4 +164,4 @@ interface RecoverProps {
105
164
  }
106
165
  declare function Recover(props: RecoverProps): React.ReactElement;
107
166
 
108
- export { ChipiProvider, type PasskeyAdapter, Recover, type RecoverProps, useChipiContext };
167
+ export { ChipiInjector, type ChipiInjectorProps, ChipiProvider, ChipiWindowObjectDeps, type InjectedChipiWallet, type PasskeyAdapter, Recover, type RecoverProps, UseChipiWalletObjectConfig, createChipiWindowObject, injectChipiWallet, useChipiContext };