@@ -26,11 +26,6 @@ export abstract class Route<
26
26
> {
27
27
wh : Wormhole < N > ;
28
28
29
- // true means this route supports native gas dropoff
30
- abstract readonly NATIVE_GAS_DROPOFF_SUPPORTED : boolean ;
31
- // true means this is a one-transaction route (using a relayer)
32
- abstract readonly IS_AUTOMATIC : boolean ;
33
-
34
29
public constructor ( wh : Wormhole < N > ) {
35
30
this . wh = wh ;
36
31
}
@@ -84,6 +79,10 @@ export interface RouteConstructor<OP extends Options = Options> {
84
79
new < N extends Network > ( wh : Wormhole < N > ) : Route < N , OP > ;
85
80
/** Details about the route provided by the implementation */
86
81
readonly meta : RouteMeta ;
82
+ /** true means this route supports native gas dropoff */
83
+ readonly NATIVE_GAS_DROPOFF_SUPPORTED : boolean ;
84
+ /** true means this is a one-transaction route (using a relayer) */
85
+ readonly IS_AUTOMATIC : boolean ;
87
86
/** get the list of networks this route supports */
88
87
supportedNetworks ( ) : Network [ ] ;
89
88
/** get the list of chains this route supports */
@@ -113,13 +112,13 @@ export abstract class AutomaticRoute<
113
112
VP extends ValidatedTransferParams < OP > = ValidatedTransferParams < OP > ,
114
113
R extends Receipt = Receipt ,
115
114
> extends Route < N , OP , VP , R > {
116
- IS_AUTOMATIC = true ;
115
+ static IS_AUTOMATIC = true ;
117
116
// TODO: search for usagees and update arg
118
117
public abstract isAvailable ( request : RouteTransferRequest < N > ) : Promise < boolean > ;
119
118
}
120
119
121
120
export function isAutomatic < N extends Network > ( route : Route < N > ) : route is AutomaticRoute < N > {
122
- return ( route as AutomaticRoute < N > ) . isAvailable !== undefined && route . IS_AUTOMATIC ;
121
+ return ( route as AutomaticRoute < N > ) . isAvailable !== undefined && ( route . constructor as RouteConstructor ) . IS_AUTOMATIC ;
123
122
}
124
123
125
124
/**
@@ -132,8 +131,8 @@ export abstract class ManualRoute<
132
131
VP extends ValidatedTransferParams < OP > = ValidatedTransferParams < OP > ,
133
132
R extends Receipt = Receipt ,
134
133
> extends Route < N , OP , VP , R > {
135
- NATIVE_GAS_DROPOFF_SUPPORTED = false ;
136
- IS_AUTOMATIC = false ;
134
+ static NATIVE_GAS_DROPOFF_SUPPORTED = false ;
135
+ static IS_AUTOMATIC = false ;
137
136
public abstract complete ( sender : Signer , receipt : R ) : Promise < R > ;
138
137
public abstract resume ( tx : TransactionId ) : Promise < R > ;
139
138
}
0 commit comments