diff --git a/packages/example/src/components/DragAndDrop.tsx b/packages/example/src/components/DragAndDrop.tsx index b485f5a..20232bc 100644 --- a/packages/example/src/components/DragAndDrop.tsx +++ b/packages/example/src/components/DragAndDrop.tsx @@ -1,10 +1,11 @@ +import { PTB_SCHEME } from '@zktx.io/ptb-builder'; import React, { useState } from 'react'; export const DragAndDrop = ({ onDrop, onChancel, }: { - onDrop: (data: object) => void; + onDrop: (data: PTB_SCHEME) => void; onChancel: () => void; }) => { const [isVisible, setIsVisible] = useState(true); @@ -26,7 +27,7 @@ export const DragAndDrop = ({ const json = JSON.parse(e.target?.result as string); onDrop(json); setIsVisible(false); - } catch (error) { + } catch { setMessage('Invalid JSON file.'); } }; diff --git a/packages/example/src/pages/editor.tsx b/packages/example/src/pages/editor.tsx index 2587800..9be44ad 100644 --- a/packages/example/src/pages/editor.tsx +++ b/packages/example/src/pages/editor.tsx @@ -53,9 +53,9 @@ export const Editor = () => { } }; - const handleDrop = (ptb: any) => { - setNetwork((ptb as any).network); - ctx.selectNetwork((ptb as any).network); + const handleDrop = (ptb: PTB_SCHEME) => { + setNetwork(ptb.network || NETWORK); + ctx.selectNetwork(ptb.network || NETWORK); setPtb(JSON.stringify(ptb)); }; @@ -69,8 +69,9 @@ export const Editor = () => { network={network} excuteTx={excuteTx} restore={ptb && JSON.parse(ptb)} - update={(value: PTB_SCHEME) => { - // console.log(value); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + update={(_value: PTB_SCHEME) => { + // console.log(_value); }} options={{ canEdit: true, diff --git a/packages/example/src/pages/viewer.tsx b/packages/example/src/pages/viewer.tsx index 90f0e09..def0fed 100644 --- a/packages/example/src/pages/viewer.tsx +++ b/packages/example/src/pages/viewer.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from 'react'; -import { PTBBuilder } from '@zktx.io/ptb-builder'; +import { PTB_SCHEME, PTBBuilder } from '@zktx.io/ptb-builder'; import { enqueueSnackbar } from 'notistack'; import queryString from 'query-string'; import { useLocation } from 'react-router-dom'; @@ -31,8 +31,9 @@ export const Viewer = () => { canEdit: false, themeSwitch: true, }} - update={(value: any) => { - // console.log(value); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + update={(_value: PTB_SCHEME) => { + // console.log(_value); }} enqueueToast={(message, options) => enqueueSnackbar(message, options)} />