@@ -38,6 +38,11 @@ type SenderFixture = {
3838 retryStrategy : any ;
3939} ;
4040
41+ type BaseLayerStub = {
42+ isLocalBlockChain : ( ) => boolean ;
43+ config : { network : { type : "local" | "remote" | "lightnet" } } ;
44+ } ;
45+
4146function makeSender (
4247 pendingStorage : PendingL1TransactionStorage ,
4348 dispatcherConfig : {
@@ -47,6 +52,10 @@ function makeSender(
4752 } = {
4853 pollIntervalMs : 5 ,
4954 statusCheckIntervalMs : 5 ,
55+ } ,
56+ baseLayerStub : BaseLayerStub = {
57+ isLocalBlockChain : ( ) => true ,
58+ config : { network : { type : "local" } } ,
5059 }
5160) : SenderFixture {
5261 const flowCreator = {
@@ -73,8 +82,6 @@ function makeSender(
7382 applyTransaction : jest . fn ( async ( ) => undefined ) ,
7483 } as any ;
7584
76- const baseLayer = { config : { network : { type : "local" } } } as any ;
77-
7885 const retryStrategy = {
7986 shouldRetry : jest . fn ( async ( ) => true ) ,
8087 prepareRetryTransaction : jest . fn ( async ( record : any ) => record . transaction ) ,
@@ -89,13 +96,14 @@ function makeSender(
8996 retryStrategy as any ,
9097 signer as any ,
9198 waiter ,
92- dispatcherConfig
99+ dispatcherConfig ,
100+ baseLayerStub as any
93101 ) ;
94102 const sender = new MinaTransactionSender (
95103 flowCreator ,
96104 provingTask ,
97105 simulator ,
98- baseLayer ,
106+ baseLayerStub as any ,
99107 pendingStorage as any ,
100108 signer ,
101109 feeStrategy ,
@@ -134,7 +142,6 @@ describe("MinaTransactionSender (unit)", () => {
134142 const pendingStorage : PendingL1TransactionStorage =
135143 new InMemoryPendingL1TransactionStorage ( ) ;
136144 const { sender } = makeSender ( pendingStorage ) ;
137- checkZkappTransactionStatus . mockResolvedValue ( { success : false } ) ;
138145
139146 const { tx } = makeTx ( { senderBase58 : "S" , nonce : 0 , hash : "H1" } ) ;
140147
@@ -159,7 +166,6 @@ describe("MinaTransactionSender (unit)", () => {
159166 const pendingStorage : PendingL1TransactionStorage =
160167 new InMemoryPendingL1TransactionStorage ( ) ;
161168 const { sender } = makeSender ( pendingStorage ) ;
162- checkZkappTransactionStatus . mockResolvedValueOnce ( { success : true } ) ;
163169
164170 const { tx } = makeTx ( { senderBase58 : "S" , nonce : 0 , hash : "H2" } ) ;
165171 try {
@@ -178,7 +184,6 @@ describe("MinaTransactionSender (unit)", () => {
178184 const pendingStorage : PendingL1TransactionStorage =
179185 new InMemoryPendingL1TransactionStorage ( ) ;
180186 const { sender } = makeSender ( pendingStorage ) ;
181- checkZkappTransactionStatus . mockResolvedValue ( { success : false } ) ;
182187
183188 const tx0 = makeTx ( { senderBase58 : "S" , nonce : 0 , hash : "H0" } ) ;
184189 const tx1 = makeTx ( { senderBase58 : "S" , nonce : 1 , hash : "H1" } ) ;
@@ -202,11 +207,18 @@ describe("MinaTransactionSender (unit)", () => {
202207 it ( "should retry a transaction if first attempt fails" , async ( ) => {
203208 const pendingStorage : PendingL1TransactionStorage =
204209 new InMemoryPendingL1TransactionStorage ( ) ;
205- const { sender } = makeSender ( pendingStorage , {
206- pollIntervalMs : 5 ,
207- statusCheckIntervalMs : 0 ,
208- inclusionTimeoutMs : 0 ,
209- } ) ;
210+ const { sender } = makeSender (
211+ pendingStorage ,
212+ {
213+ pollIntervalMs : 5 ,
214+ statusCheckIntervalMs : 0 ,
215+ inclusionTimeoutMs : 0 ,
216+ } ,
217+ {
218+ isLocalBlockChain : ( ) => false ,
219+ config : { network : { type : "remote" } } ,
220+ }
221+ ) ;
210222
211223 const { tx } = makeTx ( { senderBase58 : "S" , nonce : 0 , hash : "H-R1" } ) ;
212224
@@ -238,11 +250,18 @@ describe("MinaTransactionSender (unit)", () => {
238250 it ( "should stop retrying when shouldRetry returns false" , async ( ) => {
239251 const pendingStorage : PendingL1TransactionStorage =
240252 new InMemoryPendingL1TransactionStorage ( ) ;
241- const { sender, retryStrategy } = makeSender ( pendingStorage , {
242- pollIntervalMs : 5 ,
243- statusCheckIntervalMs : 0 ,
244- inclusionTimeoutMs : 0 ,
245- } ) ;
253+ const { sender, retryStrategy } = makeSender (
254+ pendingStorage ,
255+ {
256+ pollIntervalMs : 5 ,
257+ statusCheckIntervalMs : 0 ,
258+ inclusionTimeoutMs : 0 ,
259+ } ,
260+ {
261+ isLocalBlockChain : ( ) => false ,
262+ config : { network : { type : "remote" } } ,
263+ }
264+ ) ;
246265
247266 // Force "no retry"
248267 retryStrategy . shouldRetry = jest . fn ( async ( ) => false ) ;
0 commit comments