@@ -16,7 +16,6 @@ import {
1616 SubmitterFactory ,
1717 SubmitterMetadata ,
1818 TxSubmitterType ,
19- isJsonRpcSubmitterConfig ,
2019} from '@hyperlane-xyz/sdk' ;
2120import {
2221 AltVM ,
@@ -25,7 +24,11 @@ import {
2524 assert ,
2625} from '@hyperlane-xyz/utils' ;
2726
28- import { ExtendedChainSubmissionStrategy } from '../submitters/types.js' ;
27+ import { AltVMFileSubmitter } from '../submitters/AltVMFileSubmitter.js' ;
28+ import {
29+ CustomTxSubmitterType ,
30+ ExtendedChainSubmissionStrategy ,
31+ } from '../submitters/types.js' ;
2932
3033import { SignerKeyProtocolMap } from './types.js' ;
3134
@@ -164,19 +167,16 @@ export class AltVMSignerFactory
164167 // was provided for our chain where we can read our private key
165168 if ( strategyConfig [ chain ] ) {
166169 const rawConfig = strategyConfig [ chain ] ! . submitter ;
167- if ( ! isJsonRpcSubmitterConfig ( rawConfig ) ) {
168- throw new Error (
169- `found unknown submitter in strategy config for chain ${ chain } ` ,
170- ) ;
171- }
172170
173- if ( ! rawConfig . privateKey ) {
174- throw new Error (
175- `missing private key in strategy config for chain ${ chain } ` ,
176- ) ;
177- }
171+ if ( rawConfig . type === TxSubmitterType . JSON_RPC ) {
172+ if ( ! rawConfig . privateKey ) {
173+ throw new Error (
174+ `missing private key in strategy config for chain ${ chain } ` ,
175+ ) ;
176+ }
178177
179- return rawConfig . privateKey ;
178+ return rawConfig . privateKey ;
179+ }
180180 }
181181
182182 // 3. Finally, if no key flag or strategy was provided we prompt the user
@@ -237,21 +237,40 @@ export class AltVMSignerFactory
237237 return new AltVMSignerFactory ( metadataManager , signers ) ;
238238 }
239239
240- public submitterFactories ( ) : ProtocolMap < Record < string , SubmitterFactory > > {
240+ public submitterFactories (
241+ chain : string ,
242+ ) : ProtocolMap < Record < string , SubmitterFactory > > {
243+ const protocol = this . metadataManager . getProtocol ( chain ) ;
244+
241245 const factories : ProtocolMap < Record < string , SubmitterFactory > > = { } ;
242246
247+ if (
248+ protocol === ProtocolType . Ethereum ||
249+ protocol === ProtocolType . Sealevel
250+ ) {
251+ return factories ;
252+ }
253+
254+ const signer = this . get ( chain ) ;
255+
243256 for ( const protocol of this . getSupportedProtocols ( ) ) {
244257 factories [ protocol ] = {
245258 [ TxSubmitterType . JSON_RPC ] : (
246- multiProvider : MultiProvider ,
259+ _multiProvider : MultiProvider ,
247260 metadata : SubmitterMetadata ,
248261 ) => {
249262 // Used to type narrow metadata
250263 assert (
251264 metadata . type === TxSubmitterType . JSON_RPC ,
252265 `Invalid metadata type: ${ metadata . type } , expected ${ TxSubmitterType . JSON_RPC } ` ,
253266 ) ;
254- return new AltVMJsonRpcTxSubmitter ( multiProvider , this , metadata ) ;
267+ return new AltVMJsonRpcTxSubmitter ( signer , metadata ) ;
268+ } ,
269+ [ CustomTxSubmitterType . FILE ] : (
270+ _multiProvider : MultiProvider ,
271+ metadata : any ,
272+ ) => {
273+ return new AltVMFileSubmitter ( signer , metadata ) ;
255274 } ,
256275 } ;
257276 }
0 commit comments