@fileverse-dev/dsheet 2.1.3-package-cleanup-2 → 2.1.3-package-cleanup-3
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/editor/components/editor-workbook.d.ts +0 -3
- package/dist/editor/components/smart-contract/error-toast.d.ts +11 -0
- package/dist/editor/components/smart-contract/modal/abi-input-section.d.ts +11 -0
- package/dist/editor/components/smart-contract/modal/contract-name-section.d.ts +13 -0
- package/dist/editor/components/smart-contract/modal/file-upload-section.d.ts +12 -0
- package/dist/editor/components/smart-contract/modal/import-section.d.ts +8 -0
- package/dist/editor/components/smart-contract/modal/modal-header.d.ts +17 -0
- package/dist/editor/components/smart-contract/smart-contract-list-item.d.ts +8 -0
- package/dist/editor/components/smart-contract/smart-contract-modal-ui.d.ts +33 -0
- package/dist/editor/components/smart-contract/smart-contract-modal.d.ts +12 -0
- package/dist/editor/components/smart-contract/smart-contract-reading-intro.d.ts +4 -0
- package/dist/editor/components/smart-contract/smart-contract-view-list.d.ts +6 -0
- package/dist/editor/components/smart-contract/use-address-validation.d.ts +5 -0
- package/dist/editor/components/smart-contract/use-modal-outside-click.d.ts +18 -0
- package/dist/editor/components/smart-contract/use-smart-contract-modal.d.ts +38 -0
- package/dist/editor/contexts/editor-context.d.ts +4 -1
- package/dist/editor/dsheet-editor.d.ts +1 -1
- package/dist/editor/hooks/use-smart-contract.d.ts +26 -0
- package/dist/editor/types/smart-contract.d.ts +88 -0
- package/dist/editor/types.d.ts +3 -3
- package/dist/editor/utils/smart-contract/constants.d.ts +488 -0
- package/dist/editor/utils/smart-contract/error-helper.d.ts +20 -0
- package/dist/editor/utils/smart-contract/helpers.d.ts +4 -0
- package/dist/editor/utils/smart-contract/reading-utils.d.ts +34 -0
- package/dist/editor/utils/smart-contract/signature-utils.d.ts +9 -0
- package/dist/{index-B1GgIaLD.js → index-DwPpxfSA.js} +18798 -16829
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +49 -48
- package/dist/style.css +1 -1
- package/dist/{use-xlsx-import-impl-Ce2uNFrO.js → use-xlsx-import-impl-Cc8p533v.js} +1 -1
- package/dist/{xlsx-export-impl-DxzFr-zj.js → xlsx-export-impl-rKtQDxYh.js} +1 -1
- package/package.json +4 -3
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SidebarPortalRegistryHandle, SidebarPortalRenderer } from '../../sheet-engine/react';
|
|
3
3
|
import { ThemeKey } from '../../sheet-engine/core/theme';
|
|
4
|
-
import { SmartContractQueryHandler } from '../utils/after-update-cell';
|
|
5
4
|
import { OnboardingHandlerType } from '../types';
|
|
6
5
|
import { CommentsConfig } from '../types/comments';
|
|
7
6
|
|
|
8
7
|
type OnboardingHandler = OnboardingHandlerType;
|
|
9
8
|
interface EditorWorkbookProps {
|
|
10
|
-
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
11
9
|
setShowFetchURLModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
10
|
setFetchingURLData?: (fetching: boolean) => void;
|
|
13
11
|
setInputFetchURLDataBlock?: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -23,7 +21,6 @@ interface EditorWorkbookProps {
|
|
|
23
21
|
dsheetId: string;
|
|
24
22
|
onDuneChartEmbed?: () => void;
|
|
25
23
|
onSheetCountChange?: (sheetCount: number) => void;
|
|
26
|
-
handleSmartContractQuery?: SmartContractQueryHandler;
|
|
27
24
|
sidebarActivePanel?: string | null;
|
|
28
25
|
sidebarPortalRegistry?: SidebarPortalRegistryHandle | null;
|
|
29
26
|
sidebarPortalRenderers?: Record<string, SidebarPortalRenderer>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const SmartContractReadingErrorToast: ({ smartContractReadingError, setSmartContractReadingError, openPanel, }: {
|
|
2
|
+
smartContractReadingError: {
|
|
3
|
+
hasError: boolean;
|
|
4
|
+
errorMessage: string;
|
|
5
|
+
};
|
|
6
|
+
setSmartContractReadingError: (error: {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
errorMessage: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
openPanel: (panel: string) => void;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface AbiInputSectionProps {
|
|
4
|
+
abiCode: string;
|
|
5
|
+
setAbiCode: (value: string) => void;
|
|
6
|
+
errorState: {
|
|
7
|
+
message: string;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const AbiInputSection: React.FC<AbiInputSectionProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ContractConfig } from '../../../types/smart-contract';
|
|
3
|
+
|
|
4
|
+
interface ContractNameSectionProps {
|
|
5
|
+
smartContractName: string;
|
|
6
|
+
setSmartContractName: (name: string) => void;
|
|
7
|
+
registryMap: Record<string, ContractConfig>;
|
|
8
|
+
abiCode: string;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
onClickProceed: () => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare const ContractNameSection: React.FC<ContractNameSectionProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface FileUploadSectionProps {
|
|
4
|
+
uploadedFile: any;
|
|
5
|
+
uploadProgress: number;
|
|
6
|
+
isUploading: boolean;
|
|
7
|
+
handleRemoveFile: () => void;
|
|
8
|
+
handleFileInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
10
|
+
}
|
|
11
|
+
export declare const FileUploadSection: React.FC<FileUploadSectionProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SupportedChain } from '../../../types/smart-contract';
|
|
3
|
+
|
|
4
|
+
interface ModalHeaderProps {
|
|
5
|
+
inputAddress: string;
|
|
6
|
+
setFormStep: (step: number) => void;
|
|
7
|
+
onAddressChange: (url: string) => void;
|
|
8
|
+
setSelectedChain: (chain: SupportedChain) => void;
|
|
9
|
+
networks: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: SupportedChain;
|
|
12
|
+
}[];
|
|
13
|
+
selectedChain: SupportedChain;
|
|
14
|
+
showHint: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const ModalHeader: React.FC<ModalHeaderProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Abi } from 'viem';
|
|
2
|
+
import { ContractConfig } from '../../types/smart-contract';
|
|
3
|
+
|
|
4
|
+
export declare const SmartContractListItem: ({ contract, onDelete, fetchContractAbi, }: {
|
|
5
|
+
contract: ContractConfig;
|
|
6
|
+
onDelete?: (name: string) => void;
|
|
7
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React, MutableRefObject } from 'react';
|
|
2
|
+
import { ContractConfig, SupportedChain } from '../../types/smart-contract';
|
|
3
|
+
|
|
4
|
+
interface SmartContractModalUIProps {
|
|
5
|
+
abiCode: string;
|
|
6
|
+
smartContractName: string;
|
|
7
|
+
setSmartContractName: React.Dispatch<React.SetStateAction<string>>;
|
|
8
|
+
setAbiCode: React.Dispatch<React.SetStateAction<string>>;
|
|
9
|
+
uploadedFile: any;
|
|
10
|
+
setUploadedFile: React.Dispatch<React.SetStateAction<any>>;
|
|
11
|
+
uploadProgress: number;
|
|
12
|
+
isUploading: boolean;
|
|
13
|
+
handleRemoveFile: () => void;
|
|
14
|
+
handleUploadAreaClick: () => void;
|
|
15
|
+
handleFileInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
17
|
+
selectedChain: SupportedChain;
|
|
18
|
+
setSelectedChain: React.Dispatch<React.SetStateAction<SupportedChain>>;
|
|
19
|
+
formStep: number;
|
|
20
|
+
setFormStep: React.Dispatch<React.SetStateAction<number>>;
|
|
21
|
+
onClickProceed: (abi?: any) => Promise<void>;
|
|
22
|
+
inputAddress: string;
|
|
23
|
+
isValidURL: boolean;
|
|
24
|
+
modalDivRef: React.RefObject<HTMLDivElement>;
|
|
25
|
+
onAddressChange: (url: string) => void;
|
|
26
|
+
isImportingRef: MutableRefObject<boolean>;
|
|
27
|
+
registryMapRef: MutableRefObject<Record<string, ContractConfig>>;
|
|
28
|
+
errorState: {
|
|
29
|
+
message: string;
|
|
30
|
+
} | null;
|
|
31
|
+
}
|
|
32
|
+
export declare const SmartContractModalUI: React.FC<SmartContractModalUIProps>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React, MutableRefObject } from 'react';
|
|
2
|
+
import { ContractConfig, SupportedChain } from '../../types/smart-contract';
|
|
3
|
+
import { Hex } from 'viem';
|
|
4
|
+
|
|
5
|
+
interface FetchUrlDataBlockProps {
|
|
6
|
+
showSmartContractModal: boolean;
|
|
7
|
+
setShowSmartContractModal: (show: boolean) => void;
|
|
8
|
+
onSaveContract: (address: Hex, chain: SupportedChain, abi: string, smartContractName: string) => Promise<void>;
|
|
9
|
+
registryMapRef: MutableRefObject<Record<string, ContractConfig>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const SmartContractModal: React.FC<FetchUrlDataBlockProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SmartContractListViewProps, MyContractsProps, PopularContractsProps } from '../../types/smart-contract';
|
|
3
|
+
|
|
4
|
+
export declare const MyContracts: React.FC<MyContractsProps>;
|
|
5
|
+
export declare const PopularContracts: React.FC<PopularContractsProps>;
|
|
6
|
+
export declare const SmartContractListView: React.FC<SmartContractListViewProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseFetchUrlModalProps {
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
setInputAddress?: React.Dispatch<React.SetStateAction<string>>;
|
|
6
|
+
shouldPreventClose?: MutableRefObject<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare const useModalOutsideClick: ({ onClose, setInputAddress, shouldPreventClose, }?: UseFetchUrlModalProps) => {
|
|
9
|
+
rowCount: number;
|
|
10
|
+
setRowCount: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
11
|
+
includeHeaders: boolean;
|
|
12
|
+
setIncludeHeaders: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
13
|
+
abortCall: boolean;
|
|
14
|
+
modalDivRef: import('react').RefObject<HTMLDivElement>;
|
|
15
|
+
resetModalState: () => void;
|
|
16
|
+
handleClose: () => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
import { ContractConfig, SupportedChain } from '../../types/smart-contract';
|
|
3
|
+
|
|
4
|
+
export declare function useSmartContractModal({ onSaveContract, setShowSmartContractModal, registryMapRef, }: {
|
|
5
|
+
onSaveContract: (address: Hex, chain: SupportedChain, abi: string, smartContractName: string) => Promise<void>;
|
|
6
|
+
setShowSmartContractModal: (show: boolean) => void;
|
|
7
|
+
registryMapRef: React.MutableRefObject<Record<string, ContractConfig>>;
|
|
8
|
+
}): {
|
|
9
|
+
inputAddress: string;
|
|
10
|
+
setInputAddress: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
11
|
+
selectedChain: SupportedChain;
|
|
12
|
+
setSelectedChain: import('react').Dispatch<import('react').SetStateAction<SupportedChain>>;
|
|
13
|
+
formStep: number;
|
|
14
|
+
setFormStep: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
15
|
+
abiCode: string;
|
|
16
|
+
setAbiCode: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
17
|
+
uploadedFile: any;
|
|
18
|
+
setUploadedFile: import('react').Dispatch<any>;
|
|
19
|
+
uploadProgress: number;
|
|
20
|
+
setUploadProgress: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
21
|
+
isUploading: boolean;
|
|
22
|
+
setIsUploading: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
23
|
+
fileInputRef: import('react').MutableRefObject<any>;
|
|
24
|
+
smartContractName: string;
|
|
25
|
+
setSmartContractName: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
26
|
+
isImportingRef: import('react').MutableRefObject<boolean>;
|
|
27
|
+
modalDivRef: import('react').RefObject<HTMLDivElement>;
|
|
28
|
+
handleFileInputChange: (e: any) => void;
|
|
29
|
+
handleUploadAreaClick: () => void;
|
|
30
|
+
handleRemoveFile: () => void;
|
|
31
|
+
handleAddressInputChange: (url: string) => void;
|
|
32
|
+
onClickProceed: (abi?: any) => Promise<void>;
|
|
33
|
+
isValidAddress: boolean;
|
|
34
|
+
registryMapRef: import('react').MutableRefObject<Record<string, ContractConfig>>;
|
|
35
|
+
errorState: {
|
|
36
|
+
message: string;
|
|
37
|
+
} | null;
|
|
38
|
+
};
|
|
@@ -5,6 +5,8 @@ import { SheetUpdateData, DataBlockEvent } from '../types';
|
|
|
5
5
|
import { CommentsConfig } from '../types/comments';
|
|
6
6
|
import { ApiKeyStorage } from '../utils/api-key-storage';
|
|
7
7
|
import { OpenApiKeyModalFn } from '../utils/data-block-error-handler';
|
|
8
|
+
import { SmartContractConfig } from '../types/smart-contract';
|
|
9
|
+
import { UseSmartContractReturn } from '../hooks/use-smart-contract';
|
|
8
10
|
import { CollaborationProps, CollabState, CollabUser } from '../../sync-local/types';
|
|
9
11
|
import { Awareness } from 'y-protocols/awareness';
|
|
10
12
|
|
|
@@ -60,10 +62,10 @@ export interface EditorContextType {
|
|
|
60
62
|
onSave: (key: string) => void;
|
|
61
63
|
onClose: () => void;
|
|
62
64
|
} | null;
|
|
65
|
+
smartContract: UseSmartContractReturn;
|
|
63
66
|
}
|
|
64
67
|
interface EditorProviderProps {
|
|
65
68
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
66
|
-
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
67
69
|
getDocumentTitle?: (dsheetId: string) => Promise<string>;
|
|
68
70
|
updateDocumentTitle?: (title: string) => void;
|
|
69
71
|
isAuthorized: boolean;
|
|
@@ -87,6 +89,7 @@ interface EditorProviderProps {
|
|
|
87
89
|
liveQueryRefreshRate?: number;
|
|
88
90
|
apiKeyStorage?: ApiKeyStorage;
|
|
89
91
|
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
92
|
+
smartContracts?: SmartContractConfig;
|
|
90
93
|
}
|
|
91
94
|
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
92
95
|
export declare const useEditor: () => EditorContextType;
|
|
@@ -7,5 +7,5 @@ import { DsheetProps } from './types';
|
|
|
7
7
|
* @param props - Component properties
|
|
8
8
|
* @returns The SpreadsheetEditor component
|
|
9
9
|
*/
|
|
10
|
-
declare const SpreadsheetEditor: ({ isReadOnly, allowSheetDownload, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, onboardingComplete, onboardingCompleteLocalStorageKey, onboardingHandler, commentsConfig, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, onDuneChartEmbed, onSheetCountChange, isAuthorized, getDocumentTitle, updateDocumentTitle,
|
|
10
|
+
declare const SpreadsheetEditor: ({ isReadOnly, allowSheetDownload, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, onboardingComplete, onboardingCompleteLocalStorageKey, onboardingHandler, commentsConfig, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, onDuneChartEmbed, onSheetCountChange, isAuthorized, getDocumentTitle, updateDocumentTitle, editorStateRef, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, collaboration, customPanels, apiKeyStorage, onDataBlockEvent, smartContracts, theme, }: DsheetProps) => JSX.Element;
|
|
11
11
|
export default SpreadsheetEditor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Abi, Hex } from 'viem';
|
|
2
|
+
import { ContractConfig, ContractRegistry, SmartContractConfig, SupportedChain } from '../types/smart-contract';
|
|
3
|
+
import { SmartContractQueryHandler } from '../utils/after-update-cell';
|
|
4
|
+
|
|
5
|
+
export declare const useSmartContract: (config?: SmartContractConfig) => {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
showSmartContractModal: boolean;
|
|
8
|
+
setShowSmartContractModal: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
9
|
+
userSmartContracts: ContractConfig[];
|
|
10
|
+
allUserContracts: ContractConfig[];
|
|
11
|
+
registryMapRef: import('react').MutableRefObject<ContractRegistry>;
|
|
12
|
+
handleSmartContractQuery: SmartContractQueryHandler | undefined;
|
|
13
|
+
onImportContract: (address: Hex, network: SupportedChain, abiJson: string, smartContractName: string) => Promise<void>;
|
|
14
|
+
onDelete: (name: string) => Promise<void>;
|
|
15
|
+
handleSearch: (searchText: string) => void;
|
|
16
|
+
smartContractReadingError: {
|
|
17
|
+
hasError: boolean;
|
|
18
|
+
errorMessage: string;
|
|
19
|
+
};
|
|
20
|
+
setSmartContractReadingError: import('react').Dispatch<import('react').SetStateAction<{
|
|
21
|
+
hasError: boolean;
|
|
22
|
+
errorMessage: string;
|
|
23
|
+
}>>;
|
|
24
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
25
|
+
};
|
|
26
|
+
export type UseSmartContractReturn = ReturnType<typeof useSmartContract>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Abi, Hex } from 'viem';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare enum SupportedChain {
|
|
5
|
+
Ethereum = "Ethereum",
|
|
6
|
+
Sepolia = "Sepolia",
|
|
7
|
+
Gnosis = "Gnosis",
|
|
8
|
+
Base = "Base"
|
|
9
|
+
}
|
|
10
|
+
export interface ContractConfig {
|
|
11
|
+
address: Hex;
|
|
12
|
+
abiHash: string;
|
|
13
|
+
network: SupportedChain;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
export type ContractRegistry = Record<string, ContractConfig>;
|
|
17
|
+
export interface NewContractInput {
|
|
18
|
+
name: string;
|
|
19
|
+
address: Hex;
|
|
20
|
+
network: SupportedChain;
|
|
21
|
+
abi: Abi;
|
|
22
|
+
}
|
|
23
|
+
export type SmartContractEventType = 'query-success' | 'query-error' | 'contract-added' | 'contract-deleted';
|
|
24
|
+
export interface SmartContractEvent {
|
|
25
|
+
type: SmartContractEventType;
|
|
26
|
+
contractName?: string;
|
|
27
|
+
functionName?: string;
|
|
28
|
+
chainName?: string;
|
|
29
|
+
errorMessage?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SmartContractConfig {
|
|
32
|
+
/** User's persisted private contracts from consumer keystore. Defaults to []. */
|
|
33
|
+
contracts?: ContractConfig[];
|
|
34
|
+
/** RPC URL per chain. Falls back to bundled defaults when omitted. */
|
|
35
|
+
rpcConfig?: Partial<Record<SupportedChain, string>>;
|
|
36
|
+
/** Resolve ABI from stored reference (e.g. IPFS hash). Required for user-saved contracts with abiHash. */
|
|
37
|
+
resolveAbi?: (abiHash: string) => Promise<Abi>;
|
|
38
|
+
/** Persist a new contract. When omitted, package keeps it in session memory only. */
|
|
39
|
+
onAddContract?: (input: NewContractInput) => Promise<void>;
|
|
40
|
+
/** Remove a persisted contract. When omitted, package removes from session memory only. */
|
|
41
|
+
onDeleteContract?: (contractName: string) => Promise<void>;
|
|
42
|
+
validateAddress?: (address: string, chain: SupportedChain) => boolean | Promise<boolean>;
|
|
43
|
+
onSmartContractEvent?: (event: SmartContractEvent) => void;
|
|
44
|
+
}
|
|
45
|
+
export interface CallerParams {
|
|
46
|
+
abi: Abi;
|
|
47
|
+
contractAddress: Hex;
|
|
48
|
+
chain: import('viem').Chain;
|
|
49
|
+
functionName?: string;
|
|
50
|
+
args?: unknown[];
|
|
51
|
+
}
|
|
52
|
+
export interface FetchAbiParams {
|
|
53
|
+
contractAddress: Hex;
|
|
54
|
+
chain: import('viem').Chain;
|
|
55
|
+
ipfsHash?: string;
|
|
56
|
+
}
|
|
57
|
+
export type ParsedFunction = {
|
|
58
|
+
functionName: string;
|
|
59
|
+
output: string;
|
|
60
|
+
};
|
|
61
|
+
export interface SmartContractListViewProps {
|
|
62
|
+
userSmartContracts: ContractConfig[];
|
|
63
|
+
onDelete: (name: string) => void;
|
|
64
|
+
handleSearch: (searchText: string) => void;
|
|
65
|
+
onOpenImportModal: () => void;
|
|
66
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
67
|
+
isAuthorized: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface MyContractsProps {
|
|
70
|
+
contracts: ContractConfig[];
|
|
71
|
+
onDelete: (name: string) => void;
|
|
72
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
73
|
+
setActiveTab?: React.Dispatch<React.SetStateAction<string>>;
|
|
74
|
+
}
|
|
75
|
+
export interface PopularContractsProps {
|
|
76
|
+
contracts: ContractConfig[];
|
|
77
|
+
onInsert: (name: string) => void;
|
|
78
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
79
|
+
}
|
|
80
|
+
export interface CodeBlockProps {
|
|
81
|
+
code: React.ReactNode;
|
|
82
|
+
copyText: string;
|
|
83
|
+
}
|
|
84
|
+
export interface ParameterDescriptionProps {
|
|
85
|
+
paramName: string;
|
|
86
|
+
description: string;
|
|
87
|
+
optional?: boolean;
|
|
88
|
+
}
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Sheet, WorkbookInstance } from '../sheet-engine/react';
|
|
2
2
|
import { RefObject } from 'react';
|
|
3
3
|
import { ERROR_MESSAGES_FLAG } from './constants/shared-constants';
|
|
4
|
-
import { SmartContractQueryHandler } from './utils/after-update-cell';
|
|
5
4
|
import { CollaborationProps } from '../sync-local/types';
|
|
6
5
|
import { CommentsConfig } from './types/comments';
|
|
6
|
+
import { SmartContractConfig } from './types/smart-contract';
|
|
7
7
|
import { ApiKeyStorage } from './utils/api-key-storage';
|
|
8
8
|
import { ThemeKey } from '../sheet-engine/core/theme';
|
|
9
9
|
|
|
@@ -50,7 +50,6 @@ export type { ApiKeyStorage } from './utils/api-key-storage';
|
|
|
50
50
|
export interface DsheetProps {
|
|
51
51
|
isNewSheet: boolean;
|
|
52
52
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
53
|
-
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
54
53
|
getDocumentTitle?: (dsheetId: string) => Promise<string>;
|
|
55
54
|
updateDocumentTitle?: (title: string) => void;
|
|
56
55
|
isAuthorized: boolean;
|
|
@@ -87,7 +86,8 @@ export interface DsheetProps {
|
|
|
87
86
|
editorStateRef?: React.MutableRefObject<{
|
|
88
87
|
refreshIndexedDB: () => Promise<void>;
|
|
89
88
|
} | null>;
|
|
90
|
-
|
|
89
|
+
/** Smart contract config: execution + UI in package; consumer owns persistence via callbacks. */
|
|
90
|
+
smartContracts?: SmartContractConfig;
|
|
91
91
|
enableLiveQuery?: boolean;
|
|
92
92
|
liveQueryRefreshRate?: number;
|
|
93
93
|
customPanels?: PanelConfig[];
|