@cofhe/react 0.2.0 → 0.3.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.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _cofhe_sdk from '@cofhe/sdk';
3
- import { CofhesdkConfig, CofhesdkInputConfig, FheTypeValue, CofhesdkClient, CofhesdkClientConnectionState, EncryptStep, EncryptStepCallbackContext, EncryptedItemInput, EncryptableItem, EncryptedItemInputs, FheTypes, UnsealedItem } from '@cofhe/sdk';
3
+ import { CofheConfig, CofheInputConfig, FheTypeValue, CofheClient, CofheClientConnectionState, EncryptStep, EncryptStepCallbackContext, EncryptedItemInput, EncryptableItem, EncryptedItemInputs, FheTypes, UnsealedItem } from '@cofhe/sdk';
4
4
  import { z } from 'zod';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { QueryClient, UseQueryOptions, UseQueryResult, UseMutationOptions, UseMutationResult, MutationFunctionContext } from '@tanstack/react-query';
@@ -11,70 +11,45 @@ import BigNumber from 'bignumber.js';
11
11
  import * as zustand_middleware from 'zustand/middleware';
12
12
  import * as zustand from 'zustand';
13
13
  import { Abi as Abi$1, CofheReturnType, CofheInputArgsPreTransform, CofheFirstReturnFheType } from '@cofhe/abi';
14
- import { ReactNode } from 'react';
15
- export { createCofhesdkClient } from '@cofhe/sdk/web';
14
+ export { createCofheClient } from '@cofhe/sdk/web';
16
15
 
17
- declare const CofhesdkReactConfigSchema: z.ZodObject<{
16
+ declare const CofheReactConfigSchema: z.ZodObject<{
18
17
  shareablePermits: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
19
18
  enableShieldUnshield: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
20
19
  autogeneratePermits: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
21
20
  permitExpirationOptions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
22
21
  label: z.ZodString;
23
22
  intervalSeconds: z.ZodNumber;
24
- }, "strip", z.ZodTypeAny, {
25
- label: string;
26
- intervalSeconds: number;
27
- }, {
28
- label: string;
29
- intervalSeconds: number;
30
- }>, "many">>>;
23
+ }, z.core.$strip>>>>;
31
24
  defaultPermitExpirationSeconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
32
- pinnedTokens: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>>>;
33
- tokenLists: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>>, Partial<Record<number, string[]>>, Record<string, string[]> | undefined>;
34
- position: z.ZodDefault<z.ZodOptional<z.ZodEnum<["bottom-right", "bottom-left", "top-right", "top-left"]>>>;
35
- initialTheme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["dark", "light"]>>>;
36
- }, "strip", z.ZodTypeAny, {
37
- shareablePermits: boolean;
38
- enableShieldUnshield: boolean;
39
- autogeneratePermits: boolean;
40
- permitExpirationOptions: {
41
- label: string;
42
- intervalSeconds: number;
43
- }[];
44
- defaultPermitExpirationSeconds: number;
45
- pinnedTokens: Record<string, `0x${string}`>;
46
- tokenLists: Partial<Record<number, string[]>>;
47
- position: "bottom-right" | "bottom-left" | "top-right" | "top-left";
48
- initialTheme: "dark" | "light";
49
- }, {
50
- shareablePermits?: boolean | undefined;
51
- enableShieldUnshield?: boolean | undefined;
52
- autogeneratePermits?: boolean | undefined;
53
- permitExpirationOptions?: {
54
- label: string;
55
- intervalSeconds: number;
56
- }[] | undefined;
57
- defaultPermitExpirationSeconds?: number | undefined;
58
- pinnedTokens?: Record<string, `0x${string}`> | undefined;
59
- tokenLists?: Record<string, string[]> | undefined;
60
- position?: "bottom-right" | "bottom-left" | "top-right" | "top-left" | undefined;
61
- initialTheme?: "dark" | "light" | undefined;
62
- }>;
25
+ pinnedTokens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
26
+ tokenLists: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>, z.ZodTransform<Partial<Record<number, string[]>>, Record<string, string[]>>>>;
27
+ position: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
28
+ "bottom-right": "bottom-right";
29
+ "bottom-left": "bottom-left";
30
+ "top-right": "top-right";
31
+ "top-left": "top-left";
32
+ }>>>;
33
+ initialTheme: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
34
+ dark: "dark";
35
+ light: "light";
36
+ }>>>;
37
+ }, z.core.$strip>;
63
38
  /**
64
39
  * Input config type inferred from the schema
65
40
  */
66
- type CofhesdkReactInputConfig = CofhesdkInputConfig & {
67
- react?: z.input<typeof CofhesdkReactConfigSchema>;
41
+ type CofheReactInputConfig = CofheInputConfig & {
42
+ react?: z.input<typeof CofheReactConfigSchema>;
68
43
  };
69
- type CofhesdkConfigWithReact = CofhesdkConfig & {
70
- react: z.output<typeof CofhesdkReactConfigSchema>;
44
+ type CofheConfigWithReact = CofheConfig & {
45
+ react: z.output<typeof CofheReactConfigSchema>;
71
46
  };
72
47
  /**
73
- * Creates a CoFHE SDK client plus React react configuration with reasonable defaults.
74
- * @param config - Cofhesdk client input merged with a `react` object (fheKeyStorage defaults to IndexedDB when omitted).
48
+ * Creates a CoFHE client plus React configuration with reasonable defaults.
49
+ * @param config - Cofhe client input merged with a `react` object (fheKeyStorage defaults to IndexedDB when omitted).
75
50
  * @returns The combined client configuration with a validated `react` section and Web defaults applied.
76
51
  */
77
- declare function createCofhesdkConfig(config: CofhesdkReactInputConfig): CofhesdkConfigWithReact;
52
+ declare function createCofheConfig(config: CofheReactInputConfig): CofheConfigWithReact;
78
53
 
79
54
  interface BaseProps {
80
55
  /** Additional CSS class names */
@@ -106,7 +81,6 @@ interface EncryptionStartData {
106
81
  declare enum FloatingButtonPage$1 {
107
82
  Main = "main",
108
83
  Settings = "settings",
109
- TokenList = "tokenlist",
110
84
  TokenInfo = "tokeninfo",
111
85
  Send = "send",
112
86
  Shield = "shield",
@@ -115,8 +89,8 @@ declare enum FloatingButtonPage$1 {
115
89
  GeneratePermits = "generatePermit",
116
90
  DelegatePermits = "delegatePermit",
117
91
  ReceivePermits = "receivePermit",
118
- PermitDetails = "permitDetails",
119
92
  Debug = "debug",
93
+ Portfolio = "portfolio",
120
94
  ClaimableTokens = "claimableTokens"
121
95
  }
122
96
  interface FloatingButtonPagePropsRegistry {
@@ -145,7 +119,7 @@ interface FnxFloatingButtonProps extends BaseProps {
145
119
  }
146
120
 
147
121
  interface CofheContextValue {
148
- client: CofhesdkClient<CofhesdkConfigWithReact>;
122
+ client: CofheClient<CofheConfigWithReact>;
149
123
  state: {
150
124
  position: FloatingButtonPosition;
151
125
  setPosition: (position: FloatingButtonPosition) => void;
@@ -156,8 +130,8 @@ interface CofheContextValue {
156
130
  type CofheProviderProps = {
157
131
  children: React.ReactNode;
158
132
  queryClient?: QueryClient;
159
- cofhesdkClient?: CofhesdkClient<CofhesdkConfigWithReact>;
160
- config?: CofhesdkConfigWithReact;
133
+ cofheClient?: CofheClient<CofheConfigWithReact>;
134
+ config?: CofheConfigWithReact;
161
135
  walletClient?: WalletClient;
162
136
  publicClient?: PublicClient;
163
137
  };
@@ -171,7 +145,7 @@ declare function useCofheContext(): CofheContextValue;
171
145
 
172
146
  declare const useInternalQueryClient: () => QueryClient;
173
147
 
174
- declare const useCofheConnection: () => CofhesdkClientConnectionState;
148
+ declare const useCofheConnection: () => CofheClientConnectionState;
175
149
  declare const useCofhePublicClient: () => {
176
150
  account: undefined;
177
151
  batch?: viem.ClientConfig["batch"] | undefined;
@@ -204,7 +178,6 @@ declare const useCofhePublicClient: () => {
204
178
  nonce: blockTag extends "pending" ? null : `0x${string}`;
205
179
  hash: blockTag extends "pending" ? null : `0x${string}`;
206
180
  timestamp: bigint;
207
- size: bigint;
208
181
  logsBloom: blockTag extends "pending" ? null : `0x${string}`;
209
182
  baseFeePerGas: bigint | null;
210
183
  blobGasUsed: bigint;
@@ -220,6 +193,7 @@ declare const useCofhePublicClient: () => {
220
193
  receiptsRoot: viem.Hex;
221
194
  sealFields: viem.Hex[];
222
195
  sha3Uncles: viem.Hash;
196
+ size: bigint;
223
197
  stateRoot: viem.Hash;
224
198
  totalDifficulty: bigint | null;
225
199
  transactionsRoot: viem.Hash;
@@ -227,8 +201,9 @@ declare const useCofhePublicClient: () => {
227
201
  withdrawals?: viem.Withdrawal[] | undefined;
228
202
  withdrawalsRoot?: viem.Hex | undefined;
229
203
  transactions: includeTransactions extends true ? ({
230
- value: bigint;
231
204
  type: "legacy";
205
+ input: viem.Hex;
206
+ value: bigint;
232
207
  chainId?: number | undefined;
233
208
  r: viem.Hex;
234
209
  s: viem.Hex;
@@ -246,14 +221,14 @@ declare const useCofhePublicClient: () => {
246
221
  accessList?: undefined;
247
222
  authorizationList?: undefined;
248
223
  hash: viem.Hash;
249
- input: viem.Hex;
250
224
  typeHex: viem.Hex | null;
251
225
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
252
226
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
253
227
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
254
228
  } | {
255
- value: bigint;
256
229
  type: "eip2930";
230
+ input: viem.Hex;
231
+ value: bigint;
257
232
  chainId: number;
258
233
  r: viem.Hex;
259
234
  s: viem.Hex;
@@ -271,14 +246,14 @@ declare const useCofhePublicClient: () => {
271
246
  accessList: viem.AccessList;
272
247
  authorizationList?: undefined;
273
248
  hash: viem.Hash;
274
- input: viem.Hex;
275
249
  typeHex: viem.Hex | null;
276
250
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
277
251
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
278
252
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
279
253
  } | {
280
- value: bigint;
281
254
  type: "eip1559";
255
+ input: viem.Hex;
256
+ value: bigint;
282
257
  chainId: number;
283
258
  r: viem.Hex;
284
259
  s: viem.Hex;
@@ -296,14 +271,14 @@ declare const useCofhePublicClient: () => {
296
271
  accessList: viem.AccessList;
297
272
  authorizationList?: undefined;
298
273
  hash: viem.Hash;
299
- input: viem.Hex;
300
274
  typeHex: viem.Hex | null;
301
275
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
302
276
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
303
277
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
304
278
  } | {
305
- value: bigint;
306
279
  type: "eip4844";
280
+ input: viem.Hex;
281
+ value: bigint;
307
282
  chainId: number;
308
283
  r: viem.Hex;
309
284
  s: viem.Hex;
@@ -321,14 +296,14 @@ declare const useCofhePublicClient: () => {
321
296
  accessList: viem.AccessList;
322
297
  authorizationList?: undefined;
323
298
  hash: viem.Hash;
324
- input: viem.Hex;
325
299
  typeHex: viem.Hex | null;
326
300
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
327
301
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
328
302
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
329
303
  } | {
330
- value: bigint;
331
304
  type: "eip7702";
305
+ input: viem.Hex;
306
+ value: bigint;
332
307
  chainId: number;
333
308
  r: viem.Hex;
334
309
  s: viem.Hex;
@@ -346,7 +321,6 @@ declare const useCofhePublicClient: () => {
346
321
  accessList: viem.AccessList;
347
322
  authorizationList: viem.SignedAuthorizationList;
348
323
  hash: viem.Hash;
349
- input: viem.Hex;
350
324
  typeHex: viem.Hex | null;
351
325
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
352
326
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
@@ -377,8 +351,9 @@ declare const useCofhePublicClient: () => {
377
351
  } | undefined) => Promise<viem.EstimateMaxPriorityFeePerGasReturnType>;
378
352
  getStorageAt: (args: viem.GetStorageAtParameters) => Promise<viem.GetStorageAtReturnType>;
379
353
  getTransaction: <blockTag extends viem.BlockTag = "latest">(args: viem.GetTransactionParameters<blockTag>) => Promise<{
380
- value: bigint;
381
354
  type: "legacy";
355
+ input: viem.Hex;
356
+ value: bigint;
382
357
  chainId?: number | undefined;
383
358
  r: viem.Hex;
384
359
  s: viem.Hex;
@@ -396,14 +371,14 @@ declare const useCofhePublicClient: () => {
396
371
  accessList?: undefined;
397
372
  authorizationList?: undefined;
398
373
  hash: viem.Hash;
399
- input: viem.Hex;
400
374
  typeHex: viem.Hex | null;
401
375
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
402
376
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
403
377
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
404
378
  } | {
405
- value: bigint;
406
379
  type: "eip2930";
380
+ input: viem.Hex;
381
+ value: bigint;
407
382
  chainId: number;
408
383
  r: viem.Hex;
409
384
  s: viem.Hex;
@@ -421,14 +396,14 @@ declare const useCofhePublicClient: () => {
421
396
  accessList: viem.AccessList;
422
397
  authorizationList?: undefined;
423
398
  hash: viem.Hash;
424
- input: viem.Hex;
425
399
  typeHex: viem.Hex | null;
426
400
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
427
401
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
428
402
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
429
403
  } | {
430
- value: bigint;
431
404
  type: "eip1559";
405
+ input: viem.Hex;
406
+ value: bigint;
432
407
  chainId: number;
433
408
  r: viem.Hex;
434
409
  s: viem.Hex;
@@ -446,14 +421,14 @@ declare const useCofhePublicClient: () => {
446
421
  accessList: viem.AccessList;
447
422
  authorizationList?: undefined;
448
423
  hash: viem.Hash;
449
- input: viem.Hex;
450
424
  typeHex: viem.Hex | null;
451
425
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
452
426
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
453
427
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
454
428
  } | {
455
- value: bigint;
456
429
  type: "eip4844";
430
+ input: viem.Hex;
431
+ value: bigint;
457
432
  chainId: number;
458
433
  r: viem.Hex;
459
434
  s: viem.Hex;
@@ -471,14 +446,14 @@ declare const useCofhePublicClient: () => {
471
446
  accessList: viem.AccessList;
472
447
  authorizationList?: undefined;
473
448
  hash: viem.Hash;
474
- input: viem.Hex;
475
449
  typeHex: viem.Hex | null;
476
450
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
477
451
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
478
452
  transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
479
453
  } | {
480
- value: bigint;
481
454
  type: "eip7702";
455
+ input: viem.Hex;
456
+ value: bigint;
482
457
  chainId: number;
483
458
  r: viem.Hex;
484
459
  s: viem.Hex;
@@ -496,7 +471,6 @@ declare const useCofhePublicClient: () => {
496
471
  accessList: viem.AccessList;
497
472
  authorizationList: viem.SignedAuthorizationList;
498
473
  hash: viem.Hash;
499
- input: viem.Hex;
500
474
  typeHex: viem.Hex | null;
501
475
  blockNumber: (blockTag extends "pending" ? true : false) extends infer T ? T extends (blockTag extends "pending" ? true : false) ? T extends true ? null : bigint : never : never;
502
476
  blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
@@ -14508,6 +14482,7 @@ declare const useCofheWalletClient: () => {
14508
14482
  [x: string]: readonly viem.TypedDataParameter[];
14509
14483
  [x: `string[${string}]`]: undefined;
14510
14484
  [x: `function[${string}]`]: undefined;
14485
+ [x: `int[${string}]`]: undefined;
14511
14486
  [x: `bool[${string}]`]: undefined;
14512
14487
  [x: `uint8[${string}]`]: undefined;
14513
14488
  [x: `uint16[${string}]`]: undefined;
@@ -14517,11 +14492,11 @@ declare const useCofheWalletClient: () => {
14517
14492
  [x: `address[${string}]`]: undefined;
14518
14493
  [x: `bytes[${string}]`]: undefined;
14519
14494
  [x: `bytes1[${string}]`]: undefined;
14520
- [x: `bytes2[${string}]`]: undefined;
14521
14495
  [x: `bytes4[${string}]`]: undefined;
14496
+ [x: `bytes2[${string}]`]: undefined;
14497
+ [x: `bytes5[${string}]`]: undefined;
14522
14498
  [x: `bytes7[${string}]`]: undefined;
14523
14499
  [x: `bytes3[${string}]`]: undefined;
14524
- [x: `bytes5[${string}]`]: undefined;
14525
14500
  [x: `bytes6[${string}]`]: undefined;
14526
14501
  [x: `bytes8[${string}]`]: undefined;
14527
14502
  [x: `bytes9[${string}]`]: undefined;
@@ -14548,7 +14523,6 @@ declare const useCofheWalletClient: () => {
14548
14523
  [x: `bytes30[${string}]`]: undefined;
14549
14524
  [x: `bytes31[${string}]`]: undefined;
14550
14525
  [x: `bytes32[${string}]`]: undefined;
14551
- [x: `int[${string}]`]: undefined;
14552
14526
  [x: `int8[${string}]`]: undefined;
14553
14527
  [x: `int16[${string}]`]: undefined;
14554
14528
  [x: `int24[${string}]`]: undefined;
@@ -14619,11 +14593,11 @@ declare const useCofheWalletClient: () => {
14619
14593
  address?: undefined;
14620
14594
  bytes?: undefined;
14621
14595
  bytes1?: undefined;
14622
- bytes2?: undefined;
14623
14596
  bytes4?: undefined;
14597
+ bytes2?: undefined;
14598
+ bytes5?: undefined;
14624
14599
  bytes7?: undefined;
14625
14600
  bytes3?: undefined;
14626
- bytes5?: undefined;
14627
14601
  bytes6?: undefined;
14628
14602
  bytes8?: undefined;
14629
14603
  bytes9?: undefined;
@@ -14736,18 +14710,18 @@ declare const useCofheWalletClient: () => {
14736
14710
  } | undefined;
14737
14711
 
14738
14712
  declare const useCofheActivePermit: () => {
14739
- hash: string;
14740
14713
  permit: Permit;
14741
14714
  isValid: boolean;
14742
14715
  } | undefined;
14743
- declare const useCofheAllPermits: () => {
14744
- hash: string;
14745
- permit: Permit;
14746
- }[];
14747
- declare const useCofheRemovePermit: () => (hashToRemove: string) => Promise<void>;
14748
- declare const useCofheSelectPermit: () => (hashToSet: string) => void;
14716
+ declare const useCofheAllPermits: () => Permit[];
14717
+ type Callbacks = {
14718
+ onSuccess?: () => void;
14719
+ onError?: (error: Error) => void;
14720
+ };
14721
+ declare const useCofheRemovePermit: ({ onSuccess, onError }?: Callbacks) => (hashToRemove: string) => Promise<void>;
14722
+ declare const useCofheSelectPermit: ({ onSuccess, onError }?: Callbacks) => (hashToSet: string) => void;
14749
14723
 
14750
- declare const useCofheClient: () => CofhesdkClient<CofhesdkConfigWithReact>;
14724
+ declare const useCofheClient: () => CofheClient<CofheConfigWithReact>;
14751
14725
 
14752
14726
  /**
14753
14727
  * Token types shared across hooks/components/utils.
@@ -14759,7 +14733,7 @@ declare const useCofheClient: () => CofhesdkClient<CofhesdkConfigWithReact>;
14759
14733
  /**
14760
14734
  * Special address representing native ETH (used in erc20Pair for ConfidentialETH tokens)
14761
14735
  */
14762
- declare const ETH_ADDRESS: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
14736
+ declare const ETH_ADDRESS_LOWERCASE: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
14763
14737
  /**
14764
14738
  * ERC20 pair information for wrapped confidential tokens
14765
14739
  */
@@ -14932,7 +14906,7 @@ declare function useCofheTokenTransfer(writeMutationOptions?: UseCofheTokenTrans
14932
14906
  isEncrypting: boolean;
14933
14907
  stepsState: StepsState;
14934
14908
  };
14935
- write: _tanstack_react_query.UseMutationResult<`0x${string}`, Error, viem.WriteContractParameters<readonly unknown[] | viem.Abi, string, readonly unknown[], viem.Chain | undefined, viem.Account | undefined, viem.Chain | undefined> | WalletWriteContractInputWithExtras<TokenTransferExtras>, unknown> & {
14909
+ write: _tanstack_react_query.UseMutationResult<`0x${string}`, Error, viem.WriteContractParameters<viem.Abi | readonly unknown[], string, readonly unknown[], viem.Chain | undefined, viem.Account | undefined, viem.Chain | undefined> | WalletWriteContractInputWithExtras<TokenTransferExtras>, unknown> & {
14936
14910
  writeContractAsync: <TAbi extends viem.Abi | readonly unknown[], TFunctionName extends viem.ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends viem.ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends viem.Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
14937
14911
  writeContractInput: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride>;
14938
14912
  extras: TokenTransferExtras;
@@ -15209,6 +15183,64 @@ type CombinedResult = {
15209
15183
  };
15210
15184
  declare function useCofheTokensClaimable({ tokens, accountAddress: account }: UseUnshieldClaimsManyInput, queryOptions?: UseUnshieldClaimsManyOptions): CombinedResult;
15211
15185
 
15186
+ type CofheReadContractsItem = {
15187
+ result?: unknown;
15188
+ error?: Error;
15189
+ };
15190
+ type UseCofheReadContractsQueryOptions = Omit<UseQueryOptions<CofheReadContractsItem[], Error>, 'queryKey' | 'queryFn'> & {
15191
+ enabled?: boolean;
15192
+ };
15193
+
15194
+ type UseCofheTokensWithExistingBalancesInput = {
15195
+ chainId?: number;
15196
+ accountAddress?: Address;
15197
+ };
15198
+ type UseCofheTokensWithExistingBalancesResult = {
15199
+ tokens: Token[];
15200
+ tokensWithExistingEncryptedBalance: Token[];
15201
+ ctHashByTokenAddress: Record<string, bigint>;
15202
+ isLoading: boolean;
15203
+ isFetching: boolean;
15204
+ isError: boolean;
15205
+ error: Error | null;
15206
+ refetch: () => Promise<unknown>;
15207
+ };
15208
+ /**
15209
+ * Returns tokens whose confidential (encrypted) balance handle exists for the given account.
15210
+ *
15211
+ * This does NOT decrypt balances. It only checks if the encrypted balance return value (ctHash) is non-zero.
15212
+ */
15213
+ declare function useCofheTokensWithExistingEncryptedBalances({ chainId: _chainId, accountAddress }?: UseCofheTokensWithExistingBalancesInput, queryOptions?: UseCofheReadContractsQueryOptions): UseCofheTokensWithExistingBalancesResult;
15214
+
15215
+ type UseTokenBalanceOptions<TSelectedData = bigint> = Omit<UseQueryOptions<bigint, Error, TSelectedData>, 'queryKey' | 'queryFn'>;
15216
+
15217
+ type UseTokensWithPublicBalancesInput = {
15218
+ chainId?: number;
15219
+ accountAddress?: Address;
15220
+ displayDecimals?: number;
15221
+ };
15222
+ type UseTokensWithPublicBalancesResult = {
15223
+ tokens: Token[];
15224
+ tokensWithPublicBalances: Token[];
15225
+ publicBalanceByTokenAddress: Record<string, TokenFormatOutput>;
15226
+ isLoading: boolean;
15227
+ isFetching: boolean;
15228
+ isError: boolean;
15229
+ error: Error | null;
15230
+ refetch: () => Promise<unknown>;
15231
+ };
15232
+ /**
15233
+ * Returns CoFHE tokens which have a non-zero public balance.
15234
+ *
15235
+ * Public balance source:
15236
+ * - `wrapped`: underlying `erc20Pair` (or native ETH)
15237
+ * - `dual`: token contract `balanceOf` (ERC20)
15238
+ * - `pure`: skipped (no public balance)
15239
+ */
15240
+ declare function useTokensWithPublicBalances({ chainId: _chainId, accountAddress, displayDecimals }?: UseTokensWithPublicBalancesInput, options?: {
15241
+ enabled?: boolean;
15242
+ } & Omit<UseTokenBalanceOptions, 'select'>): UseTokensWithPublicBalancesResult;
15243
+
15212
15244
  type UseCofheReadContractQueryOptions<TAbi extends Abi$1, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = Omit<UseQueryOptions<CofheReturnType<TAbi, TfunctionName>, Error>, 'queryKey' | 'queryFn'> & {
15213
15245
  enabled?: boolean;
15214
15246
  };
@@ -15245,6 +15277,57 @@ type UseTransactionReceiptsByHashResult = {
15245
15277
  */
15246
15278
  declare function useTransactionReceiptsByHash({ hashes, chainId: chainIdInput, enabled: enabledInput, queryOptions }?: UseTransactionReceiptsByHashInput): UseTransactionReceiptsByHashResult;
15247
15279
 
15280
+ type UseCoingeckoUsdPriceInput = {
15281
+ chainId?: number;
15282
+ tokenAddress?: Address;
15283
+ /** Defaults to true. */
15284
+ enabled?: boolean;
15285
+ /** Defaults to https://api.coingecko.com/api/v3 */
15286
+ apiBaseUrl?: string;
15287
+ /** Optional override when chainId isn't in our mapping. */
15288
+ platformIdOverride?: string;
15289
+ /** Optional override for native token lookup (ETH_ADDRESS). */
15290
+ nativeCoinIdOverride?: string;
15291
+ };
15292
+ type UseCoingeckoUsdPriceOptions = Omit<UseQueryOptions<number | null, Error, number | null>, 'queryKey' | 'queryFn' | 'enabled'>;
15293
+ /**
15294
+ * Fetches a token's USD price from CoinGecko.
15295
+ * - ERC20: uses /simple/token_price/{platform}
15296
+ * - Native token (ETH_ADDRESS): uses /simple/price?ids={coinId}
15297
+ *
15298
+ * Returns `null` when CoinGecko has no price for the token.
15299
+ */
15300
+ declare function useCoingeckoUsdPrice({ chainId, tokenAddress, enabled: enabledInput, apiBaseUrl, platformIdOverride, nativeCoinIdOverride, }: UseCoingeckoUsdPriceInput, queryOptions?: UseCoingeckoUsdPriceOptions): UseQueryResult<number | null, Error>;
15301
+
15302
+ type CoingeckoMarketChartPoint = {
15303
+ /** Unix ms */
15304
+ ts: number;
15305
+ /** Price value (e.g. USD) */
15306
+ value: number;
15307
+ };
15308
+ type UseCoingeckoContractMarketChartRangeInput = {
15309
+ chainId?: number;
15310
+ contractAddress?: Address;
15311
+ /** Defaults to true. */
15312
+ enabled?: boolean;
15313
+ /** Defaults to https://api.coingecko.com/api/v3 */
15314
+ apiBaseUrl?: string;
15315
+ /** Optional override when chainId isn't in our mapping. */
15316
+ platformIdOverride?: string;
15317
+ /** Defaults to 'usd'. */
15318
+ vsCurrency?: string;
15319
+ /** Defaults to 24 hours. */
15320
+ rangeMs?: number;
15321
+ };
15322
+ type UseCoingeckoContractMarketChartRangeOptions = Omit<UseQueryOptions<CoingeckoMarketChartPoint[] | null, Error, CoingeckoMarketChartPoint[] | null>, 'queryKey' | 'queryFn' | 'enabled'>;
15323
+ /**
15324
+ * Fetches contract market chart data from CoinGecko using:
15325
+ * /coins/{platformId}/contract/{contractAddress}/market_chart/range
15326
+ *
15327
+ * Returns `null` when CoinGecko has no data or request fails.
15328
+ */
15329
+ declare function useCoingeckoContractMarketChartRange({ chainId, contractAddress, enabled: enabledInput, apiBaseUrl, platformIdOverride, vsCurrency, rangeMs, }: UseCoingeckoContractMarketChartRangeInput, queryOptions?: UseCoingeckoContractMarketChartRangeOptions): UseQueryResult<CoingeckoMarketChartPoint[] | null, Error>;
15330
+
15248
15331
  type NoInferLocal<T> = [T][T extends any ? 0 : never];
15249
15332
  type ConfidentialityAwareAbiArgs<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = NoInferLocal<Exclude<CofheInputArgsPreTransform<TAbi, TFunctionName>, undefined>>;
15250
15333
  declare function useCofheEncryptAndWriteContract<TExtraVars = unknown>({ encrypingMutationOptions, writingMutationOptions, }?: {
@@ -15265,7 +15348,7 @@ declare function useCofheEncryptAndWriteContract<TExtraVars = unknown>({ encrypi
15265
15348
  isEncrypting: boolean;
15266
15349
  stepsState: StepsState;
15267
15350
  };
15268
- write: _tanstack_react_query.UseMutationResult<`0x${string}`, Error, WriteContractParameters<readonly unknown[] | Abi, string, readonly unknown[], Chain | undefined, Account | undefined, Chain | undefined> | WalletWriteContractInputWithExtras<TExtraVars>, unknown> & {
15351
+ write: _tanstack_react_query.UseMutationResult<`0x${string}`, Error, WriteContractParameters<Abi | readonly unknown[], string, readonly unknown[], Chain | undefined, Account | undefined, Chain | undefined> | WalletWriteContractInputWithExtras<TExtraVars>, unknown> & {
15269
15352
  writeContractAsync: <TAbi extends Abi | readonly unknown[], TFunctionName extends ContractFunctionName<TAbi, "nonpayable" | "payable">, TArgs extends ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>, TChainOverride extends Chain | undefined = undefined>(params: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride> | {
15270
15353
  writeContractInput: WalletWriteContractParams<TAbi, TFunctionName, TArgs, TChainOverride>;
15271
15354
  extras: TExtraVars;
@@ -15277,11 +15360,6 @@ declare function useCofheEncryptAndWriteContract<TExtraVars = unknown>({ encrypi
15277
15360
  };
15278
15361
  };
15279
15362
 
15280
- declare enum ErrorCause {
15281
- AttemptToFetchCustomData = "attempt_to_fetch_custom_data",
15282
- AttemptToFetchConfidentialBalance = "attempt_to_fetch_confidential_balance"
15283
- }
15284
-
15285
15363
  type SupportedFheTypeFromReturn<TAbi extends Abi, TfunctionName extends ContractFunctionName<TAbi, 'pure' | 'view'>> = CofheFirstReturnFheType<TAbi, TfunctionName> extends FheTypes ? CofheFirstReturnFheType<TAbi, TfunctionName> : FheTypes;
15286
15364
  /**
15287
15365
  * Generic hook: read a confidential contract value and decrypt it.
@@ -15292,7 +15370,6 @@ declare function useCofheReadContractAndDecrypt<TAbi extends Abi, TfunctionName
15292
15370
  functionName?: TfunctionName;
15293
15371
  args?: ContractFunctionArgs<TAbi, 'pure' | 'view', TfunctionName>;
15294
15372
  requiresPermit?: boolean;
15295
- potentialDecryptErrorCause: ErrorCause;
15296
15373
  }, { readQueryOptions, decryptingQueryOptions, }?: {
15297
15374
  readQueryOptions?: UseCofheReadContractQueryOptions<TAbi, TfunctionName>;
15298
15375
  decryptingQueryOptions?: Omit<UseQueryOptions<UnsealedItem<TFheType>, Error, TDecryptedSelectedData>, 'queryKey' | 'queryFn'>;
@@ -15308,28 +15385,11 @@ declare const MainPage: React.FC;
15308
15385
 
15309
15386
  declare const SettingsPage: React.FC;
15310
15387
 
15311
- type TokenListMode = 'view' | 'select';
15312
-
15313
- type PageStateWithoutTokenProp = Omit<PageState, 'props'> & {
15314
- props?: Omit<PageState['props'], 'token'>;
15315
- };
15316
- type TokenListPageProps = {
15317
- title?: string;
15318
- backToPageState: PageStateWithoutTokenProp;
15319
- mode: TokenListMode;
15320
- };
15321
- declare module '../pagesConfig/types' {
15322
- interface FloatingButtonPagePropsRegistry {
15323
- [FloatingButtonPage.TokenList]: TokenListPageProps;
15324
- }
15325
- }
15326
- declare const TokenListPage: React.FC<TokenListPageProps>;
15327
-
15328
15388
  type GeneratePermitPageProps = {
15329
15389
  onSuccessNavigateTo?: () => void;
15330
15390
  onCancel?: () => void;
15331
15391
  onBack?: () => void;
15332
- overridingBody?: ReactNode;
15392
+ cause?: 'clicked_on_confidential_balance';
15333
15393
  };
15334
15394
  declare module '../../../pagesConfig/types' {
15335
15395
  interface FloatingButtonPagePropsRegistry {
@@ -15348,15 +15408,6 @@ declare module '../../../pagesConfig/types' {
15348
15408
  }
15349
15409
  }
15350
15410
 
15351
- type PermitDetailsPageProps = {
15352
- selectedPermitHash: string;
15353
- };
15354
- declare module '../../../pagesConfig/types' {
15355
- interface FloatingButtonPagePropsRegistry {
15356
- [FloatingButtonPage.PermitDetails]: PermitDetailsPageProps;
15357
- }
15358
- }
15359
-
15360
15411
  type TokenInfoPageProps = {
15361
15412
  token: Token;
15362
15413
  };
@@ -15485,14 +15536,12 @@ declare const truncateHash: (value: string, start?: number, end?: number) => str
15485
15536
  */
15486
15537
  declare const formatRelativeTime: (timestamp: number) => string;
15487
15538
 
15488
- declare const fheTypeToString: (fheType: FheTypeValue) => "ebool" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "eaddress" | "unknown";
15539
+ declare const fheTypeToString: (fheType: FheTypeValue) => "unknown" | "ebool" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "eaddress";
15489
15540
  declare const encryptedValueToString: (fheType: FheTypeValue, handle: bigint) => string;
15490
15541
 
15491
15542
  type Input = {
15492
- ReasonBody?: React.FC;
15543
+ cause?: GeneratePermitPageProps['cause'];
15493
15544
  };
15494
- declare const useCofheNavigateToCreatePermit: ({ ReasonBody }?: Input) => () => void;
15495
-
15496
- declare const CREATE_PERMITT_BODY_BY_ERROR_CAUSE: Record<ErrorCause, React.FC>;
15545
+ declare const useCofheNavigateToCreatePermit: () => ({ cause }?: Input) => void;
15497
15546
 
15498
- export { CREATE_PERMITT_BODY_BY_ERROR_CAUSE, type ClaimableAmountByTokenAddress, type CofheClientConfig, type CofheContextValue, CofheProvider, type CofheProviderProps, type CofhesdkConfigWithReact, ETH_ADDRESS, type Erc20Pair, ErrorCause, FheTypesList, type FloatingButtonPosition, FnxEncryptInput, type FnxFloatingButtonProps, FnxFloatingButtonWithProvider, MainPage, SettingsPage, type Token, TokenListPage, type Transaction, type TransactionActionString, TransactionActionType, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseTransactionReceiptsByHashInput, actionToString, createCofhesdkConfig, encryptedValueToString, fheTypeToString, formatRelativeTime, getBlockExplorerAddressUrl, getBlockExplorerTokenUrl, getBlockExplorerTxUrl, getBlockExplorerUrl, isEthPair, isWrappedEthToken, statusToString, truncateHash, useCofheActivePermit, useCofheAllPermits, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheNavigateToCreatePermit, useCofhePublicClient, useCofheReadContractAndDecrypt, useCofheRemovePermit, useCofheSelectPermit, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenShield, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheWalletClient, useCofheWriteContract, useInternalQueryClient, useTransactionReceiptsByHash, useTransactionStore };
15547
+ export { type ClaimableAmountByTokenAddress, type CofheClientConfig, type CofheContextValue, CofheProvider, type CofheProviderProps, type CofheConfigWithReact as CofhesdkConfigWithReact, type CoingeckoMarketChartPoint, ETH_ADDRESS_LOWERCASE, type Erc20Pair, FheTypesList, type FloatingButtonPosition, FnxEncryptInput, type FnxFloatingButtonProps, FnxFloatingButtonWithProvider, MainPage, SettingsPage, type Token, type Transaction, type TransactionActionString, TransactionActionType, TransactionStatus, type TransactionStatusString, type TransactionStore, type UnshieldClaim, type UnshieldClaimsSummary, type UnshieldClaimsSummaryByTokenAddress, type UseCoingeckoContractMarketChartRangeInput, type UseCoingeckoContractMarketChartRangeOptions, type UseCoingeckoUsdPriceInput, type UseCoingeckoUsdPriceOptions, type UseTransactionReceiptsByHashInput, actionToString, createCofheConfig, encryptedValueToString, fheTypeToString, formatRelativeTime, getBlockExplorerAddressUrl, getBlockExplorerTokenUrl, getBlockExplorerTxUrl, getBlockExplorerUrl, isEthPair, isWrappedEthToken, statusToString, truncateHash, useCofheActivePermit, useCofheAllPermits, useCofheAutoConnect, useCofheClient, useCofheConnection, useCofheContext, useCofheEncrypt, useCofheEncryptAndWriteContract, useCofheNavigateToCreatePermit, useCofhePublicClient, useCofheReadContractAndDecrypt, useCofheRemovePermit, useCofheSelectPermit, useCofheTokenClaimUnshielded, useCofheTokenClaimable, useCofheTokenDecryptedBalance, useCofheTokenLists, useCofheTokenShield, useCofheTokenTransfer, useCofheTokenUnshield, useCofheTokens, useCofheTokensClaimable, useCofheTokensWithExistingEncryptedBalances, useCofheWalletClient, useCofheWriteContract, useCoingeckoContractMarketChartRange, useCoingeckoUsdPrice, useInternalQueryClient, useTokensWithPublicBalances, useTransactionReceiptsByHash, useTransactionStore };