@cofhe/react 0.0.0-alpha-20260527080106 → 0.0.0-alpha-20260602122344
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/{types-BTBGwral.d.cts → StatusBarContent-BOe91ztF.d.cts} +128 -3
- package/dist/{types-BTBGwral.d.ts → StatusBarContent-BOe91ztF.d.ts} +128 -3
- package/dist/chunk-DSFIX7QP.js +11209 -0
- package/dist/chunk-DSFIX7QP.js.map +1 -0
- package/dist/chunk-SNIXBOED.cjs +11209 -0
- package/dist/chunk-SNIXBOED.cjs.map +1 -0
- package/dist/index.cjs +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +436 -333
- package/dist/index.d.ts +436 -333
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/ui-base.cjs +3 -5669
- package/dist/ui-base.cjs.map +1 -1
- package/dist/ui-base.d.cts +9 -48
- package/dist/ui-base.d.ts +9 -48
- package/dist/ui-base.js +16 -5682
- package/dist/ui-base.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-KDQU3H3X.cjs +0 -5974
- package/dist/chunk-KDQU3H3X.cjs.map +0 -1
- package/dist/chunk-ZIOLHMRJ.js +0 -5974
- package/dist/chunk-ZIOLHMRJ.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FheTypeValue } from '@cofhe/sdk';
|
|
2
2
|
import { Address } from 'viem';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
interface BaseProps {
|
|
5
6
|
/** Additional CSS class names */
|
|
@@ -67,6 +68,51 @@ interface CofheFloatingButtonProps extends BaseProps {
|
|
|
67
68
|
darkMode?: boolean;
|
|
68
69
|
overriddingPage?: PageState;
|
|
69
70
|
}
|
|
71
|
+
declare const CofheStatusActionIntents: {
|
|
72
|
+
readonly openPermits: "open-permits";
|
|
73
|
+
readonly openClaimableTokens: "open-claimable-tokens";
|
|
74
|
+
};
|
|
75
|
+
type CofheStatusActionIntent = (typeof CofheStatusActionIntents)[keyof typeof CofheStatusActionIntents];
|
|
76
|
+
/**
|
|
77
|
+
* Status ids emitted by the SDK's built-in status watchers.
|
|
78
|
+
*
|
|
79
|
+
* `useCofheStatuses()` may still include additional custom statuses added by
|
|
80
|
+
* internal or app-specific flows, so treat this as the known built-in subset.
|
|
81
|
+
*/
|
|
82
|
+
declare const COFHE_STATUS_IDS: {
|
|
83
|
+
readonly claimsAvailable: "claims-available";
|
|
84
|
+
readonly missingPermit: "missing-permit";
|
|
85
|
+
readonly permitExpired: "permit-expired";
|
|
86
|
+
readonly permitExpiringSoon: "permit-expiring-soon";
|
|
87
|
+
readonly permitShared: "permit-shared";
|
|
88
|
+
};
|
|
89
|
+
type CofheStatusId = (typeof COFHE_STATUS_IDS)[keyof typeof COFHE_STATUS_IDS];
|
|
90
|
+
type CofheStatusAction = {
|
|
91
|
+
label: string;
|
|
92
|
+
intent: CofheStatusActionIntent;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Public status shape exposed to consumers.
|
|
96
|
+
*
|
|
97
|
+
* Consumer-facing status actions must declare an intent so the widget can map
|
|
98
|
+
* them to the correct internal handler.
|
|
99
|
+
*/
|
|
100
|
+
type CofheStatus = {
|
|
101
|
+
id: string;
|
|
102
|
+
variant: CofheStatusVariant;
|
|
103
|
+
title: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
action?: CofheStatusAction;
|
|
106
|
+
};
|
|
107
|
+
type CofheStatusVariant = 'error' | 'warning' | 'info';
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the public consumer-facing status list.
|
|
111
|
+
*
|
|
112
|
+
* Only statuses with the public intent-based action shape are exposed here.
|
|
113
|
+
* Internal callback-action statuses remain widget-only and are filtered out.
|
|
114
|
+
*/
|
|
115
|
+
declare const useCofheStatuses: () => readonly CofheStatus[];
|
|
70
116
|
|
|
71
117
|
/**
|
|
72
118
|
* Token types shared across hooks/components/utils.
|
|
@@ -89,11 +135,13 @@ type Erc20Pair = {
|
|
|
89
135
|
decimals: number;
|
|
90
136
|
logoURI?: string;
|
|
91
137
|
};
|
|
138
|
+
type TokenWrapperKind = 'erc20' | 'native';
|
|
139
|
+
type TokenConfidentialValueType = 'uint64' | 'uint128';
|
|
92
140
|
declare const TOKEN_CONFIDENTIALITY_SUPPORT: {
|
|
93
141
|
readonly wrapped: {
|
|
94
142
|
readonly enabled: true;
|
|
95
143
|
readonly label: "Wrapped confidential token";
|
|
96
|
-
readonly confidentialValueType: "
|
|
144
|
+
readonly confidentialValueType: "uint64";
|
|
97
145
|
readonly publicBalanceSource: "erc20Pair";
|
|
98
146
|
readonly operations: {
|
|
99
147
|
readonly confidentialBalance: true;
|
|
@@ -147,12 +195,23 @@ type Token = {
|
|
|
147
195
|
extensions: Record<string, unknown> & {
|
|
148
196
|
fhenix: {
|
|
149
197
|
confidentialityType: TokenConfidentialityType;
|
|
150
|
-
confidentialValueType:
|
|
198
|
+
confidentialValueType: TokenConfidentialValueType;
|
|
199
|
+
wrapperKind?: TokenWrapperKind;
|
|
151
200
|
/** ERC20 pair for wrapped tokens - contains underlying token info */
|
|
152
201
|
erc20Pair?: Erc20Pair;
|
|
153
202
|
};
|
|
154
203
|
};
|
|
155
204
|
};
|
|
205
|
+
type SourceToken = Omit<Token, 'extensions'> & {
|
|
206
|
+
extensions?: Record<string, unknown> & {
|
|
207
|
+
fhenix?: {
|
|
208
|
+
confidentialityType?: string;
|
|
209
|
+
confidentialValueType?: TokenConfidentialValueType;
|
|
210
|
+
erc20Pair?: Erc20Pair;
|
|
211
|
+
};
|
|
212
|
+
erc20Pair?: Erc20Pair;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
156
215
|
|
|
157
216
|
/**
|
|
158
217
|
* Gets the block explorer URL for a given chain ID
|
|
@@ -231,4 +290,70 @@ declare module '../../../pagesConfig/types' {
|
|
|
231
290
|
}
|
|
232
291
|
}
|
|
233
292
|
|
|
234
|
-
|
|
293
|
+
type DelegatePermitPageProps = {
|
|
294
|
+
onSuccessNavigateTo?: () => void;
|
|
295
|
+
onCancel?: () => void;
|
|
296
|
+
onBack?: () => void;
|
|
297
|
+
};
|
|
298
|
+
declare module '../../../pagesConfig/types' {
|
|
299
|
+
interface FloatingButtonPagePropsRegistry {
|
|
300
|
+
[FloatingButtonPage.DelegatePermits]: DelegatePermitPageProps;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
type TokenInfoPageProps = {
|
|
305
|
+
token: Token;
|
|
306
|
+
};
|
|
307
|
+
declare module '../pagesConfig/types' {
|
|
308
|
+
interface FloatingButtonPagePropsRegistry {
|
|
309
|
+
[FloatingButtonPage.TokenInfo]: TokenInfoPageProps;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
type SendPageProps = {
|
|
314
|
+
token: Token;
|
|
315
|
+
};
|
|
316
|
+
declare module '../pagesConfig/types' {
|
|
317
|
+
interface FloatingButtonPagePropsRegistry {
|
|
318
|
+
[FloatingButtonPage.Send]: SendPageProps;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
type Mode = 'shield' | 'unshield';
|
|
323
|
+
type ShieldPageProps = {
|
|
324
|
+
token: Token;
|
|
325
|
+
defaultMode?: Mode;
|
|
326
|
+
};
|
|
327
|
+
declare module '../pagesConfig/types' {
|
|
328
|
+
interface FloatingButtonPagePropsRegistry {
|
|
329
|
+
[FloatingButtonPage.Shield]: ShieldPageProps;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
interface CofheFloatingButtonProviderProps {
|
|
334
|
+
children?: ReactNode;
|
|
335
|
+
}
|
|
336
|
+
declare const CofheFloatingButtonProvider: React.FC<CofheFloatingButtonProviderProps>;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Internal-only action shape used inside the React widget implementation.
|
|
340
|
+
*
|
|
341
|
+
* The callback form must not cross the public API boundary. Any status exposed
|
|
342
|
+
* to consumers should be represented as {@link CofheStatus} with an intent.
|
|
343
|
+
*/
|
|
344
|
+
type CofheFloatingButtonInternalAction = CofheStatusAction | {
|
|
345
|
+
label: string;
|
|
346
|
+
onClick: () => void;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Internal widget status shape stored and rendered by the floating button.
|
|
350
|
+
*
|
|
351
|
+
* Use {@link CofheStatus} for any consumer-facing API.
|
|
352
|
+
*/
|
|
353
|
+
type CofheFloatingButtonInternalStatus = Omit<CofheStatus, 'action'> & {
|
|
354
|
+
action?: CofheFloatingButtonInternalAction;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
declare function sortCofheStatuses(a: Pick<CofheFloatingButtonInternalStatus, 'id'>, b: Pick<CofheFloatingButtonInternalStatus, 'id'>): number;
|
|
358
|
+
|
|
359
|
+
export { type BaseProps as B, CofheFloatingButtonProvider as C, type DropdownOption as D, ETH_ADDRESS_LOWERCASE as E, type FloatingButtonPosition as F, type GeneratePermitPageProps as G, type SourceToken as S, type Token as T, type Erc20Pair as a, FheTypesList as b, getBlockExplorerTokenUrl as c, getBlockExplorerTxUrl as d, getBlockExplorerUrl as e, formatRelativeTime as f, getBlockExplorerAddressUrl as g, isWrappedEthToken as h, isEthPair as i, COFHE_STATUS_IDS as j, CofheStatusActionIntents as k, type CofheStatus as l, type CofheStatusActionIntent as m, type CofheStatusId as n, type ComponentSize as o, type EncryptionStartData as p, type EncryptionProgressData as q, type EncryptionResultData as r, sortCofheStatuses as s, truncateHash as t, useCofheStatuses as u, type CofheFloatingButtonProps as v };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FheTypeValue } from '@cofhe/sdk';
|
|
2
2
|
import { Address } from 'viem';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
interface BaseProps {
|
|
5
6
|
/** Additional CSS class names */
|
|
@@ -67,6 +68,51 @@ interface CofheFloatingButtonProps extends BaseProps {
|
|
|
67
68
|
darkMode?: boolean;
|
|
68
69
|
overriddingPage?: PageState;
|
|
69
70
|
}
|
|
71
|
+
declare const CofheStatusActionIntents: {
|
|
72
|
+
readonly openPermits: "open-permits";
|
|
73
|
+
readonly openClaimableTokens: "open-claimable-tokens";
|
|
74
|
+
};
|
|
75
|
+
type CofheStatusActionIntent = (typeof CofheStatusActionIntents)[keyof typeof CofheStatusActionIntents];
|
|
76
|
+
/**
|
|
77
|
+
* Status ids emitted by the SDK's built-in status watchers.
|
|
78
|
+
*
|
|
79
|
+
* `useCofheStatuses()` may still include additional custom statuses added by
|
|
80
|
+
* internal or app-specific flows, so treat this as the known built-in subset.
|
|
81
|
+
*/
|
|
82
|
+
declare const COFHE_STATUS_IDS: {
|
|
83
|
+
readonly claimsAvailable: "claims-available";
|
|
84
|
+
readonly missingPermit: "missing-permit";
|
|
85
|
+
readonly permitExpired: "permit-expired";
|
|
86
|
+
readonly permitExpiringSoon: "permit-expiring-soon";
|
|
87
|
+
readonly permitShared: "permit-shared";
|
|
88
|
+
};
|
|
89
|
+
type CofheStatusId = (typeof COFHE_STATUS_IDS)[keyof typeof COFHE_STATUS_IDS];
|
|
90
|
+
type CofheStatusAction = {
|
|
91
|
+
label: string;
|
|
92
|
+
intent: CofheStatusActionIntent;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Public status shape exposed to consumers.
|
|
96
|
+
*
|
|
97
|
+
* Consumer-facing status actions must declare an intent so the widget can map
|
|
98
|
+
* them to the correct internal handler.
|
|
99
|
+
*/
|
|
100
|
+
type CofheStatus = {
|
|
101
|
+
id: string;
|
|
102
|
+
variant: CofheStatusVariant;
|
|
103
|
+
title: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
action?: CofheStatusAction;
|
|
106
|
+
};
|
|
107
|
+
type CofheStatusVariant = 'error' | 'warning' | 'info';
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the public consumer-facing status list.
|
|
111
|
+
*
|
|
112
|
+
* Only statuses with the public intent-based action shape are exposed here.
|
|
113
|
+
* Internal callback-action statuses remain widget-only and are filtered out.
|
|
114
|
+
*/
|
|
115
|
+
declare const useCofheStatuses: () => readonly CofheStatus[];
|
|
70
116
|
|
|
71
117
|
/**
|
|
72
118
|
* Token types shared across hooks/components/utils.
|
|
@@ -89,11 +135,13 @@ type Erc20Pair = {
|
|
|
89
135
|
decimals: number;
|
|
90
136
|
logoURI?: string;
|
|
91
137
|
};
|
|
138
|
+
type TokenWrapperKind = 'erc20' | 'native';
|
|
139
|
+
type TokenConfidentialValueType = 'uint64' | 'uint128';
|
|
92
140
|
declare const TOKEN_CONFIDENTIALITY_SUPPORT: {
|
|
93
141
|
readonly wrapped: {
|
|
94
142
|
readonly enabled: true;
|
|
95
143
|
readonly label: "Wrapped confidential token";
|
|
96
|
-
readonly confidentialValueType: "
|
|
144
|
+
readonly confidentialValueType: "uint64";
|
|
97
145
|
readonly publicBalanceSource: "erc20Pair";
|
|
98
146
|
readonly operations: {
|
|
99
147
|
readonly confidentialBalance: true;
|
|
@@ -147,12 +195,23 @@ type Token = {
|
|
|
147
195
|
extensions: Record<string, unknown> & {
|
|
148
196
|
fhenix: {
|
|
149
197
|
confidentialityType: TokenConfidentialityType;
|
|
150
|
-
confidentialValueType:
|
|
198
|
+
confidentialValueType: TokenConfidentialValueType;
|
|
199
|
+
wrapperKind?: TokenWrapperKind;
|
|
151
200
|
/** ERC20 pair for wrapped tokens - contains underlying token info */
|
|
152
201
|
erc20Pair?: Erc20Pair;
|
|
153
202
|
};
|
|
154
203
|
};
|
|
155
204
|
};
|
|
205
|
+
type SourceToken = Omit<Token, 'extensions'> & {
|
|
206
|
+
extensions?: Record<string, unknown> & {
|
|
207
|
+
fhenix?: {
|
|
208
|
+
confidentialityType?: string;
|
|
209
|
+
confidentialValueType?: TokenConfidentialValueType;
|
|
210
|
+
erc20Pair?: Erc20Pair;
|
|
211
|
+
};
|
|
212
|
+
erc20Pair?: Erc20Pair;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
156
215
|
|
|
157
216
|
/**
|
|
158
217
|
* Gets the block explorer URL for a given chain ID
|
|
@@ -231,4 +290,70 @@ declare module '../../../pagesConfig/types' {
|
|
|
231
290
|
}
|
|
232
291
|
}
|
|
233
292
|
|
|
234
|
-
|
|
293
|
+
type DelegatePermitPageProps = {
|
|
294
|
+
onSuccessNavigateTo?: () => void;
|
|
295
|
+
onCancel?: () => void;
|
|
296
|
+
onBack?: () => void;
|
|
297
|
+
};
|
|
298
|
+
declare module '../../../pagesConfig/types' {
|
|
299
|
+
interface FloatingButtonPagePropsRegistry {
|
|
300
|
+
[FloatingButtonPage.DelegatePermits]: DelegatePermitPageProps;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
type TokenInfoPageProps = {
|
|
305
|
+
token: Token;
|
|
306
|
+
};
|
|
307
|
+
declare module '../pagesConfig/types' {
|
|
308
|
+
interface FloatingButtonPagePropsRegistry {
|
|
309
|
+
[FloatingButtonPage.TokenInfo]: TokenInfoPageProps;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
type SendPageProps = {
|
|
314
|
+
token: Token;
|
|
315
|
+
};
|
|
316
|
+
declare module '../pagesConfig/types' {
|
|
317
|
+
interface FloatingButtonPagePropsRegistry {
|
|
318
|
+
[FloatingButtonPage.Send]: SendPageProps;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
type Mode = 'shield' | 'unshield';
|
|
323
|
+
type ShieldPageProps = {
|
|
324
|
+
token: Token;
|
|
325
|
+
defaultMode?: Mode;
|
|
326
|
+
};
|
|
327
|
+
declare module '../pagesConfig/types' {
|
|
328
|
+
interface FloatingButtonPagePropsRegistry {
|
|
329
|
+
[FloatingButtonPage.Shield]: ShieldPageProps;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
interface CofheFloatingButtonProviderProps {
|
|
334
|
+
children?: ReactNode;
|
|
335
|
+
}
|
|
336
|
+
declare const CofheFloatingButtonProvider: React.FC<CofheFloatingButtonProviderProps>;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Internal-only action shape used inside the React widget implementation.
|
|
340
|
+
*
|
|
341
|
+
* The callback form must not cross the public API boundary. Any status exposed
|
|
342
|
+
* to consumers should be represented as {@link CofheStatus} with an intent.
|
|
343
|
+
*/
|
|
344
|
+
type CofheFloatingButtonInternalAction = CofheStatusAction | {
|
|
345
|
+
label: string;
|
|
346
|
+
onClick: () => void;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Internal widget status shape stored and rendered by the floating button.
|
|
350
|
+
*
|
|
351
|
+
* Use {@link CofheStatus} for any consumer-facing API.
|
|
352
|
+
*/
|
|
353
|
+
type CofheFloatingButtonInternalStatus = Omit<CofheStatus, 'action'> & {
|
|
354
|
+
action?: CofheFloatingButtonInternalAction;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
declare function sortCofheStatuses(a: Pick<CofheFloatingButtonInternalStatus, 'id'>, b: Pick<CofheFloatingButtonInternalStatus, 'id'>): number;
|
|
358
|
+
|
|
359
|
+
export { type BaseProps as B, CofheFloatingButtonProvider as C, type DropdownOption as D, ETH_ADDRESS_LOWERCASE as E, type FloatingButtonPosition as F, type GeneratePermitPageProps as G, type SourceToken as S, type Token as T, type Erc20Pair as a, FheTypesList as b, getBlockExplorerTokenUrl as c, getBlockExplorerTxUrl as d, getBlockExplorerUrl as e, formatRelativeTime as f, getBlockExplorerAddressUrl as g, isWrappedEthToken as h, isEthPair as i, COFHE_STATUS_IDS as j, CofheStatusActionIntents as k, type CofheStatus as l, type CofheStatusActionIntent as m, type CofheStatusId as n, type ComponentSize as o, type EncryptionStartData as p, type EncryptionProgressData as q, type EncryptionResultData as r, sortCofheStatuses as s, truncateHash as t, useCofheStatuses as u, type CofheFloatingButtonProps as v };
|