From c7cb50a302cbb41411b7a69398a46d65495b12f6 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 18 Jun 2024 14:59:32 +0200 Subject: [PATCH] updates after rebase --- packages/snaps-controllers/coverage.json | 8 ++++---- .../snaps-simulator/src/contexts/SnapInterface.tsx | 10 +++++----- .../src/features/renderer/components/Input.tsx | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/snaps-controllers/coverage.json b/packages/snaps-controllers/coverage.json index 8ecb65b9fd..eed36026c2 100644 --- a/packages/snaps-controllers/coverage.json +++ b/packages/snaps-controllers/coverage.json @@ -1,6 +1,6 @@ { - "branches": 91.78, - "functions": 96.77, - "lines": 97.9, - "statements": 97.57 + "branches": 91.59, + "functions": 96.45, + "lines": 97.66, + "statements": 97.34 } diff --git a/packages/snaps-simulator/src/contexts/SnapInterface.tsx b/packages/snaps-simulator/src/contexts/SnapInterface.tsx index 5f98fa7b21..da21d7dbed 100644 --- a/packages/snaps-simulator/src/contexts/SnapInterface.tsx +++ b/packages/snaps-simulator/src/contexts/SnapInterface.tsx @@ -1,5 +1,5 @@ import { UserInputEventType } from '@metamask/snaps-sdk'; -import type { FormState, InterfaceState } from '@metamask/snaps-sdk'; +import type { FormState, State } from '@metamask/snaps-sdk'; import { HandlerType } from '@metamask/snaps-utils'; import debounce from 'lodash.debounce'; import throttle from 'lodash.throttle'; @@ -23,7 +23,7 @@ const noOp = () => { /* No Op */ }; -export type GetValue = (name: string, form?: string) => string | undefined; +export type GetValue = (name: string, form?: string) => State | undefined; export type HandleInputChange = ( name: string, @@ -34,7 +34,7 @@ export type HandleInputChange = ( export type HandleEvent = (args: { event: UserInputEventType; name?: string; - value?: string; + value?: State; }) => void; export type SnapInterfaceContextType = { @@ -99,7 +99,7 @@ export const SnapInterfaceContextProvider: FunctionComponent< const rawSnapRequestFunction = ( event: UserInputEventType, name?: string, - value?: string | InterfaceState, + value?: State | FormState, ) => { dispatch( sendRequest({ @@ -143,7 +143,7 @@ export const SnapInterfaceContextProvider: FunctionComponent< const handleEvent: HandleEvent = ({ event, name, - value = name ? state[name] ?? undefined : undefined, + value = name ? (state as FormState)[name] ?? undefined : undefined, }) => { const fn = THROTTLED_EVENTS.includes(event) ? snapRequestThrottled diff --git a/packages/snaps-simulator/src/features/renderer/components/Input.tsx b/packages/snaps-simulator/src/features/renderer/components/Input.tsx index 24d78338c0..467fe7eaff 100644 --- a/packages/snaps-simulator/src/features/renderer/components/Input.tsx +++ b/packages/snaps-simulator/src/features/renderer/components/Input.tsx @@ -27,7 +27,7 @@ export const Input: FunctionComponent = ({ node, id, form }) => { return (