11// Package infrastructure provides Soroban transaction helpers for integration tests.
22//
3- // This file adds thin, typed wrappers over executeSorobanOperationAs for each Blend v2 contract
3+ // This file adds thin, typed wrappers over executeSorobanOperation for each Blend v2 contract
44// call the integration tests need to drive. Each wrapper builds an InvokeHostFunction from a
55// contract address, function name, and ScVal args (using the builders in blend_operations.go),
66// executes it, and returns either the transaction hash or a decoded return value.
@@ -149,7 +149,7 @@ func (s *SharedContainers) PoolSubmit(ctx context.Context, t *testing.T, poolID
149149 args := []xdr.ScVal {userAddr , userAddr , userAddr , scRequestVec (t , requests )}
150150 op := buildInvokeOp (t , poolID , "submit" , args , user .Address ())
151151
152- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
152+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
153153 require .NoError (t , err , "submitting pool requests" )
154154 return hash
155155}
@@ -162,7 +162,7 @@ func (s *SharedContainers) PoolClaim(ctx context.Context, t *testing.T, poolID s
162162 args := []xdr.ScVal {userAddr , scU32Vec (reserveTokenIDs ), userAddr }
163163 op := buildInvokeOp (t , poolID , "claim" , args , user .Address ())
164164
165- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
165+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
166166 require .NoError (t , err , "claiming pool emissions" )
167167 return hash
168168}
@@ -175,7 +175,7 @@ func (s *SharedContainers) PoolNewAuction(ctx context.Context, t *testing.T, poo
175175 args := []xdr.ScVal {scU32 (auctionType ), scAddr (t , user ), scAddressVec (t , bid ), scAddressVec (t , lot ), scU32 (percent )}
176176 op := buildInvokeOp (t , poolID , "new_auction" , args , caller .Address ())
177177
178- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
178+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
179179 require .NoError (t , err , "creating pool auction" )
180180 return hash
181181}
@@ -187,7 +187,7 @@ func (s *SharedContainers) PoolSetStatus(ctx context.Context, t *testing.T, pool
187187 args := []xdr.ScVal {scU32 (status )}
188188 op := buildInvokeOp (t , poolID , "set_status" , args , admin .Address ())
189189
190- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
190+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
191191 require .NoError (t , err , "setting pool status" )
192192 return hash
193193}
@@ -199,7 +199,7 @@ func (s *SharedContainers) PoolQueueSetReserve(ctx context.Context, t *testing.T
199199 args := []xdr.ScVal {scAddr (t , asset ), scReserveConfig (t , cfg )}
200200 op := buildInvokeOp (t , poolID , "queue_set_reserve" , args , admin .Address ())
201201
202- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
202+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
203203 require .NoError (t , err , "queueing pool reserve config" )
204204 return hash
205205}
@@ -212,7 +212,7 @@ func (s *SharedContainers) PoolSetReserve(ctx context.Context, t *testing.T, poo
212212 args := []xdr.ScVal {scAddr (t , asset )}
213213 op := buildInvokeOp (t , poolID , "set_reserve" , args , admin .Address ())
214214
215- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
215+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
216216 require .NoError (t , err , "setting pool reserve" )
217217 return hash
218218}
@@ -225,7 +225,7 @@ func (s *SharedContainers) PoolSetEmissionsConfig(ctx context.Context, t *testin
225225 args := []xdr.ScVal {scEmissionMetadataVec (t , metas )}
226226 op := buildInvokeOp (t , poolID , "set_emissions_config" , args , admin .Address ())
227227
228- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
228+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
229229 require .NoError (t , err , "setting pool emissions config" )
230230 return hash
231231}
@@ -237,7 +237,7 @@ func (s *SharedContainers) PoolGulpEmissions(ctx context.Context, t *testing.T,
237237
238238 op := buildInvokeOp (t , poolID , "gulp_emissions" , nil , caller .Address ())
239239
240- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
240+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
241241 require .NoError (t , err , "gulping pool emissions" )
242242 return hash
243243}
@@ -254,7 +254,7 @@ func (s *SharedContainers) BackstopDeposit(ctx context.Context, t *testing.T, ba
254254 args := []xdr.ScVal {scAddr (t , user .Address ()), scAddr (t , poolID ), scI128 (t , amount )}
255255 op := buildInvokeOp (t , backstopID , "deposit" , args , user .Address ())
256256
257- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
257+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
258258 require .NoError (t , err , "depositing into backstop" )
259259 return hash
260260}
@@ -267,7 +267,7 @@ func (s *SharedContainers) BackstopQueueWithdrawal(ctx context.Context, t *testi
267267 args := []xdr.ScVal {scAddr (t , user .Address ()), scAddr (t , poolID ), scI128 (t , amount )}
268268 op := buildInvokeOp (t , backstopID , "queue_withdrawal" , args , user .Address ())
269269
270- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
270+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
271271 require .NoError (t , err , "queueing backstop withdrawal" )
272272 return hash
273273}
@@ -280,7 +280,7 @@ func (s *SharedContainers) BackstopDequeueWithdrawal(ctx context.Context, t *tes
280280 args := []xdr.ScVal {scAddr (t , user .Address ()), scAddr (t , poolID ), scI128 (t , amount )}
281281 op := buildInvokeOp (t , backstopID , "dequeue_withdrawal" , args , user .Address ())
282282
283- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
283+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
284284 require .NoError (t , err , "dequeueing backstop withdrawal" )
285285 return hash
286286}
@@ -293,7 +293,7 @@ func (s *SharedContainers) BackstopClaim(ctx context.Context, t *testing.T, back
293293 args := []xdr.ScVal {scAddr (t , user .Address ()), scAddressVec (t , poolIDs ), scI128 (t , minLPTokensOut )}
294294 op := buildInvokeOp (t , backstopID , "claim" , args , user .Address ())
295295
296- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
296+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
297297 require .NoError (t , err , "claiming backstop emissions" )
298298 return hash
299299}
@@ -305,7 +305,7 @@ func (s *SharedContainers) BackstopDistribute(ctx context.Context, t *testing.T,
305305
306306 op := buildInvokeOp (t , backstopID , "distribute" , nil , caller .Address ())
307307
308- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
308+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
309309 require .NoError (t , err , "distributing backstop emissions" )
310310 return hash
311311}
@@ -318,7 +318,7 @@ func (s *SharedContainers) BackstopAddReward(ctx context.Context, t *testing.T,
318318 args := []xdr.ScVal {scAddr (t , toAdd ), scVoid ()}
319319 op := buildInvokeOp (t , backstopID , "add_reward" , args , caller .Address ())
320320
321- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
321+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
322322 require .NoError (t , err , "adding backstop reward" )
323323 return hash
324324}
@@ -334,7 +334,7 @@ func (s *SharedContainers) EmitterDistribute(ctx context.Context, t *testing.T,
334334
335335 op := buildInvokeOp (t , emitterID , "distribute" , nil , caller .Address ())
336336
337- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
337+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
338338 require .NoError (t , err , "distributing emitter emissions" )
339339 return hash
340340}
@@ -347,7 +347,7 @@ func (s *SharedContainers) EmitterInitialize(ctx context.Context, t *testing.T,
347347 args := []xdr.ScVal {scAddr (t , blndToken ), scAddr (t , backstop ), scAddr (t , backstopToken )}
348348 op := buildInvokeOp (t , emitterID , "initialize" , args , caller .Address ())
349349
350- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
350+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
351351 require .NoError (t , err , "initializing emitter" )
352352 return hash
353353}
@@ -370,7 +370,7 @@ func (s *SharedContainers) OracleSetData(ctx context.Context, t *testing.T, orac
370370 }
371371 op := buildInvokeOp (t , oracleID , "set_data" , args , admin .Address ())
372372
373- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
373+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
374374 require .NoError (t , err , "setting oracle data" )
375375 return hash
376376}
@@ -382,7 +382,7 @@ func (s *SharedContainers) OracleSetPriceStable(ctx context.Context, t *testing.
382382 args := []xdr.ScVal {scI128Vec (t , prices )}
383383 op := buildInvokeOp (t , oracleID , "set_price_stable" , args , admin .Address ())
384384
385- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
385+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
386386 require .NoError (t , err , "setting oracle stable prices" )
387387 return hash
388388}
@@ -398,7 +398,7 @@ func (s *SharedContainers) CometFactoryInit(ctx context.Context, t *testing.T, f
398398 args := []xdr.ScVal {scBytes32 (wasmHash )}
399399 op := buildInvokeOp (t , factoryID , "init" , args , caller .Address ())
400400
401- hash , err := s .executeSorobanOperationAs (ctx , t , op , caller , nil , DefaultConfirmationRetries )
401+ hash , err := s .executeSorobanOperation (ctx , t , op , caller , nil , DefaultConfirmationRetries )
402402 require .NoError (t , err , "initializing comet factory" )
403403 return hash
404404}
@@ -419,7 +419,7 @@ func (s *SharedContainers) CometFactoryNewPool(ctx context.Context, t *testing.T
419419 }
420420 op := buildInvokeOp (t , factoryID , "new_c_pool" , args , controller .Address ())
421421
422- hash , err := s .executeSorobanOperationAs (ctx , t , op , controller , nil , DefaultConfirmationRetries )
422+ hash , err := s .executeSorobanOperation (ctx , t , op , controller , nil , DefaultConfirmationRetries )
423423 require .NoError (t , err , "deploying comet pool" )
424424
425425 poolAddr , err := s .invokeResultAddress (ctx , t , hash )
@@ -435,7 +435,7 @@ func (s *SharedContainers) CometJoinPool(ctx context.Context, t *testing.T, come
435435 args := []xdr.ScVal {scI128 (t , poolAmountOut ), scI128Vec (t , maxAmountsIn ), scAddr (t , user .Address ())}
436436 op := buildInvokeOp (t , cometID , "join_pool" , args , user .Address ())
437437
438- hash , err := s .executeSorobanOperationAs (ctx , t , op , user , nil , DefaultConfirmationRetries )
438+ hash , err := s .executeSorobanOperation (ctx , t , op , user , nil , DefaultConfirmationRetries )
439439 require .NoError (t , err , "joining comet pool" )
440440 return hash
441441}
@@ -461,7 +461,7 @@ func (s *SharedContainers) PoolFactoryDeploy(ctx context.Context, t *testing.T,
461461 }
462462 op := buildInvokeOp (t , factoryID , "deploy" , args , admin .Address ())
463463
464- hash , err := s .executeSorobanOperationAs (ctx , t , op , admin , nil , DefaultConfirmationRetries )
464+ hash , err := s .executeSorobanOperation (ctx , t , op , admin , nil , DefaultConfirmationRetries )
465465 require .NoError (t , err , "deploying pool" )
466466
467467 poolAddr , err := s .invokeResultAddress (ctx , t , hash )
@@ -474,18 +474,13 @@ func (s *SharedContainers) PoolFactoryDeploy(ctx context.Context, t *testing.T,
474474// ---------------------------------------------------------------------------------------------
475475
476476// SACSetAdmin invokes set_admin(new_admin) on a Stellar Asset Contract, signed by currentAdmin.
477- //
478- // Note: since currentAdmin is often the shared master account acting as an arbitrary
479- // executeSorobanOperationAs source (rather than through executeSorobanOperation), the master
480- // account's locally tracked sequence counter drifts from the ledger's view. Call
481- // SyncMasterSequence before resuming master-account operations through executeSorobanOperation.
482477func (s * SharedContainers ) SACSetAdmin (ctx context.Context , t * testing.T , sacID string , currentAdmin * keypair.Full , newAdmin string ) string {
483478 t .Helper ()
484479
485480 args := []xdr.ScVal {scAddr (t , newAdmin )}
486481 op := buildInvokeOp (t , sacID , "set_admin" , args , currentAdmin .Address ())
487482
488- hash , err := s .executeSorobanOperationAs (ctx , t , op , currentAdmin , nil , DefaultConfirmationRetries )
483+ hash , err := s .executeSorobanOperation (ctx , t , op , currentAdmin , nil , DefaultConfirmationRetries )
489484 require .NoError (t , err , "setting SAC admin" )
490485 return hash
491486}
0 commit comments