11import type { CompilationFileSources , CompilationResult , SourceWithTarget } from "@remixproject/plugin-api" ;
22import type { Relayer } from "./relayer" ;
33import type { ApiKeyCapability , Credentials } from "./auth" ;
4- import type { ApprovalProcess } from "./approval-process" ;
4+ import type { ApprovalProcess , ApprovalProcessToCreate } from "./approval-process" ;
55import type { TenantNetworkResponse } from "./network" ;
66
7- export type DropdownItem = {
7+ export type DropdownItem < TValue = any > = {
88 label : string ;
9- value : any ;
9+ value : TValue ;
1010 group ?: string ;
1111}
1212
13+ type HTMLInputExtendedElement < TId = string , TValue = string , TName = string > = HTMLInputElement & { id : TId , name : TName , value : TValue , checked : boolean }
14+ export type HTMLInputElementEvent < TId = string , TValue = string , TName = string > = Event & { currentTarget : HTMLInputExtendedElement < TId , TValue , TName > }
15+
1316export type GlobalState = {
1417 authenticated : boolean ;
1518 error ?: string ;
@@ -25,23 +28,37 @@ export type GlobalState = {
2528 version ?: string ,
2629 data ?: CompilationResult | null ,
2730 enforceDeterministicReason ?: string ,
31+ groupNetworksBy ?: 'superchain' ,
2832 }
2933 form : {
3034 network ?: string | TenantNetworkResponse ;
3135 approvalProcessSelected ?: ApprovalProcess ;
32- approvalProcessToCreate ?: {
33- viaType : 'EOA' | 'Safe' | 'Relayer' ;
34- via ?: string ;
35- relayerId ?: string ;
36- network ? : string ;
36+ approvalProcessToCreate ?: ApprovalProcessToCreate ;
37+ approvalType ?: SelectedApprovalProcessType ;
38+ constructorArguments : {
39+ values : Record < string , string | number | boolean > ,
40+ required : string [ ] ,
3741 }
38- approvalType ?: 'existing' | 'new' | 'injected' ;
42+ deterministic : {
43+ isSelected : boolean ;
44+ isEnforced : boolean ;
45+ salt ?: string
46+ } ;
3947 completed ?: boolean ;
40- } ;
48+ } ,
49+ clearDeploymentStatus ?: ( ) => void ;
4150} ;
4251
4352export type APIResponse < T > = {
4453 success : boolean ;
4554 error ?: string ;
4655 data ?: T ;
47- }
56+ }
57+
58+ const selectedApprovalProcessTypes = [ 'existing' , 'new' , 'injected' ] as const ;
59+ export type SelectedApprovalProcessType = typeof selectedApprovalProcessTypes [ number ] ;
60+
61+ export const isSelectedApprovalProcessType = ( selectedApprovalProcessType : string ) : selectedApprovalProcessType is SelectedApprovalProcessType => {
62+ const expectedTypes : string [ ] = [ ...selectedApprovalProcessTypes ] ;
63+ return expectedTypes . includes ( selectedApprovalProcessType ) ;
64+ } ;
0 commit comments