@chipi-stack/chipi-react 14.7.0 → 14.9.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,11 @@ 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-B8e6TdyG.mjs';
8
+ export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, S as SessionState, k as SessionWallet, 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, 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, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, B as useSignTypedData, v as useSyncOnChainTransfers, T as useThresholdSign, o as useTransfer, m as useUpdateWalletEncryption, L as useX402Payment } from './index-B8e6TdyG.mjs';
9
+ import { StarknetWindowObject } from '@starknet-io/types-js';
8
10
  import '@tanstack/react-query';
11
+ import 'starknet';
9
12
 
10
13
  interface PasskeyAdapter {
11
14
  getWalletEncryptKey: (input: {
@@ -31,6 +34,61 @@ declare function ChipiProvider({ children, config, passkeyAdapter }: ChipiProvid
31
34
  */
32
35
  declare function useChipiContext(): ChipiContextValue;
33
36
 
37
+ /**
38
+ * Build a standards-compliant Starknet `StarknetWindowObject` backed by a Chipi
39
+ * wallet. Framework-agnostic: all signing/execution/approval is injected via
40
+ * `deps`, so the same object powers walletv2's in-app browser, the hosted
41
+ * web-wallet connector, and WalletConnect transport identically.
42
+ *
43
+ * Returns the wallet plus an `emit` controller so the host can fire
44
+ * accountsChanged / networkChanged on connect, disconnect, or lock.
45
+ */
46
+ declare function createChipiWindowObject(deps: ChipiWindowObjectDeps): {
47
+ wallet: StarknetWindowObject;
48
+ emit: {
49
+ accountsChanged: (accounts: string[]) => void;
50
+ networkChanged: (chainId: string, accounts?: string[]) => void;
51
+ };
52
+ };
53
+
54
+ interface InjectedChipiWallet {
55
+ /** The injected StarknetWindowObject (also reachable at window.starknet_chipi). */
56
+ wallet: ReturnType<typeof createChipiWindowObject>["wallet"];
57
+ /** Fire accountsChanged / networkChanged to connected dApps. */
58
+ emit: ReturnType<typeof createChipiWindowObject>["emit"];
59
+ /** Remove the injected object + event listeners. */
60
+ dispose: () => void;
61
+ }
62
+ /**
63
+ * Inject a Chipi `StarknetWindowObject` so any dApp built on get-starknet /
64
+ * starknet-react / starknetkit discovers it as a connectable wallet.
65
+ *
66
+ * Discovery is covered two ways for max reach:
67
+ * 1. **Window scan** — set `window.starknet_chipi`. get-starknet v4's
68
+ * `getAvailableWallets()` finds every `window` key starting with `starknet`.
69
+ * 2. **Event announce** — dispatch `starknet:announceWallet` (and re-announce
70
+ * on the dApp's `starknet:requestWallets`), the timing-robust, EIP-6963-style
71
+ * discovery used by newer get-starknet / the Starknet Wallet Standard.
72
+ *
73
+ * Returns a controller to emit account/network changes and to dispose.
74
+ * Only meaningful where Chipi can inject into the dApp page — an in-app browser
75
+ * (native shell) or extension; a hosted wallet on a third-party domain uses the
76
+ * connector path instead.
77
+ */
78
+ declare function injectChipiWallet(deps: ChipiWindowObjectDeps, target?: (Window & typeof globalThis) | undefined): InjectedChipiWallet;
79
+
80
+ interface ChipiInjectorProps extends UseChipiWalletObjectConfig {
81
+ children?: ReactNode;
82
+ }
83
+ /**
84
+ * Inject a Chipi `StarknetWindowObject` into the page so any dApp loaded here
85
+ * (in-app browser / native-shell webview) discovers it via get-starknet /
86
+ * starknet-react / starknetkit. Composes execution + signing + session-first
87
+ * routing from the SDK hooks. Mount it once high in the wallet's in-app browser
88
+ * tree. Emits `accountsChanged` when the connected wallet changes.
89
+ */
90
+ declare function ChipiInjector({ children, ...config }: ChipiInjectorProps): ReactNode;
91
+
34
92
  /**
35
93
  * SHHH V8.4 standalone recovery component (Wave B B6.2).
36
94
  *
@@ -105,4 +163,4 @@ interface RecoverProps {
105
163
  }
106
164
  declare function Recover(props: RecoverProps): React.ReactElement;
107
165
 
108
- export { ChipiProvider, type PasskeyAdapter, Recover, type RecoverProps, useChipiContext };
166
+ 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,11 @@ 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-B8e6TdyG.js';
8
+ export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, S as SessionState, k as SessionWallet, 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, 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, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, B as useSignTypedData, v as useSyncOnChainTransfers, T as useThresholdSign, o as useTransfer, m as useUpdateWalletEncryption, L as useX402Payment } from './index-B8e6TdyG.js';
9
+ import { StarknetWindowObject } from '@starknet-io/types-js';
8
10
  import '@tanstack/react-query';
11
+ import 'starknet';
9
12
 
10
13
  interface PasskeyAdapter {
11
14
  getWalletEncryptKey: (input: {
@@ -31,6 +34,61 @@ declare function ChipiProvider({ children, config, passkeyAdapter }: ChipiProvid
31
34
  */
32
35
  declare function useChipiContext(): ChipiContextValue;
33
36
 
37
+ /**
38
+ * Build a standards-compliant Starknet `StarknetWindowObject` backed by a Chipi
39
+ * wallet. Framework-agnostic: all signing/execution/approval is injected via
40
+ * `deps`, so the same object powers walletv2's in-app browser, the hosted
41
+ * web-wallet connector, and WalletConnect transport identically.
42
+ *
43
+ * Returns the wallet plus an `emit` controller so the host can fire
44
+ * accountsChanged / networkChanged on connect, disconnect, or lock.
45
+ */
46
+ declare function createChipiWindowObject(deps: ChipiWindowObjectDeps): {
47
+ wallet: StarknetWindowObject;
48
+ emit: {
49
+ accountsChanged: (accounts: string[]) => void;
50
+ networkChanged: (chainId: string, accounts?: string[]) => void;
51
+ };
52
+ };
53
+
54
+ interface InjectedChipiWallet {
55
+ /** The injected StarknetWindowObject (also reachable at window.starknet_chipi). */
56
+ wallet: ReturnType<typeof createChipiWindowObject>["wallet"];
57
+ /** Fire accountsChanged / networkChanged to connected dApps. */
58
+ emit: ReturnType<typeof createChipiWindowObject>["emit"];
59
+ /** Remove the injected object + event listeners. */
60
+ dispose: () => void;
61
+ }
62
+ /**
63
+ * Inject a Chipi `StarknetWindowObject` so any dApp built on get-starknet /
64
+ * starknet-react / starknetkit discovers it as a connectable wallet.
65
+ *
66
+ * Discovery is covered two ways for max reach:
67
+ * 1. **Window scan** — set `window.starknet_chipi`. get-starknet v4's
68
+ * `getAvailableWallets()` finds every `window` key starting with `starknet`.
69
+ * 2. **Event announce** — dispatch `starknet:announceWallet` (and re-announce
70
+ * on the dApp's `starknet:requestWallets`), the timing-robust, EIP-6963-style
71
+ * discovery used by newer get-starknet / the Starknet Wallet Standard.
72
+ *
73
+ * Returns a controller to emit account/network changes and to dispose.
74
+ * Only meaningful where Chipi can inject into the dApp page — an in-app browser
75
+ * (native shell) or extension; a hosted wallet on a third-party domain uses the
76
+ * connector path instead.
77
+ */
78
+ declare function injectChipiWallet(deps: ChipiWindowObjectDeps, target?: (Window & typeof globalThis) | undefined): InjectedChipiWallet;
79
+
80
+ interface ChipiInjectorProps extends UseChipiWalletObjectConfig {
81
+ children?: ReactNode;
82
+ }
83
+ /**
84
+ * Inject a Chipi `StarknetWindowObject` into the page so any dApp loaded here
85
+ * (in-app browser / native-shell webview) discovers it via get-starknet /
86
+ * starknet-react / starknetkit. Composes execution + signing + session-first
87
+ * routing from the SDK hooks. Mount it once high in the wallet's in-app browser
88
+ * tree. Emits `accountsChanged` when the connected wallet changes.
89
+ */
90
+ declare function ChipiInjector({ children, ...config }: ChipiInjectorProps): ReactNode;
91
+
34
92
  /**
35
93
  * SHHH V8.4 standalone recovery component (Wave B B6.2).
36
94
  *
@@ -105,4 +163,4 @@ interface RecoverProps {
105
163
  }
106
164
  declare function Recover(props: RecoverProps): React.ReactElement;
107
165
 
108
- export { ChipiProvider, type PasskeyAdapter, Recover, type RecoverProps, useChipiContext };
166
+ export { ChipiInjector, type ChipiInjectorProps, ChipiProvider, ChipiWindowObjectDeps, type InjectedChipiWallet, type PasskeyAdapter, Recover, type RecoverProps, UseChipiWalletObjectConfig, createChipiWindowObject, injectChipiWallet, useChipiContext };