@@ -48,10 +48,10 @@ type TransmissionState struct {
4848type TargetStrategy interface {
4949 // QueryTransmissionState defines how the report should be queried
5050 // via ChainReader, and how resulting errors should be classified.
51- QueryTransmissionState (ctx context.Context , rec string , workflowExecutionID string , reportID uint16 ) (* TransmissionState , error )
51+ QueryTransmissionState (ctx context.Context , reportID uint16 , request capabilities. CapabilityRequest ) (* TransmissionState , error )
5252 // TransmitReport constructs the tx to transmit the report, and defines
5353 // any specific handling for sending the report via ChainWriter.
54- TransmitReport (ctx context.Context , receiver string , report []byte , reportContext []byte , signatures [][]byte , workflowExecutionID string ) (string , error )
54+ TransmitReport (ctx context.Context , report []byte , reportContext []byte , signatures [][]byte , request capabilities. CapabilityRequest ) (string , error )
5555}
5656
5757var (
@@ -80,7 +80,7 @@ type writeTarget struct {
8080 cs commontypes.ChainService
8181 cr commontypes.ContractReader
8282 cw commontypes.ContractWriter
83- configValidateFn func (config ReqConfig ) error
83+ configValidateFn func (request capabilities. CapabilityRequest ) ( string , error )
8484
8585 nodeAddress string
8686 forwarderAddress string
@@ -102,7 +102,7 @@ type WriteTargetOpts struct {
102102 ChainService commontypes.ChainService
103103 ContractReader commontypes.ContractReader
104104 ChainWriter commontypes.ContractWriter
105- ConfigValidateFn func (config ReqConfig ) error
105+ ConfigValidateFn func (request capabilities. CapabilityRequest ) ( string , error )
106106
107107 NodeAddress string
108108 ForwarderAddress string
@@ -190,23 +190,15 @@ func (c *writeTarget) Execute(ctx context.Context, request capabilities.Capabili
190190 // Helper to build monitoring (Beholder) messages
191191 builder := NewMessageBuilder (c .chainInfo , capInfo )
192192
193- // Parse the request (WT-specific) config
194- var reqConfig ReqConfig
195- err := request .Config .UnwrapTo (& reqConfig )
196- if err != nil {
197- msg := builder .buildWriteError (info , 0 , "failed to parse config" , err .Error ())
198- return capabilities.CapabilityResponse {}, c .asEmittedError (ctx , msg )
199- }
200-
201193 // Validate the config
202- err = c .configValidateFn (reqConfig )
194+ receiver , err : = c .configValidateFn (request )
203195 if err != nil {
204196 msg := builder .buildWriteError (info , 0 , "failed to validate config" , err .Error ())
205197 return capabilities.CapabilityResponse {}, c .asEmittedError (ctx , msg )
206198 }
207199
208200 // Source the receiver address from the config
209- info .receiver = reqConfig . Address
201+ info .receiver = receiver
210202
211203 // Source the signed report from the request
212204 signedReport , ok := request .Inputs .Underlying [KeySignedReport ]
@@ -285,7 +277,7 @@ func (c *writeTarget) Execute(ctx context.Context, request capabilities.Capabili
285277 "executionID" , request .Metadata .WorkflowExecutionID ,
286278 )
287279
288- state , err := c .targetStrategy .QueryTransmissionState (ctx , info .receiver , request . Metadata . WorkflowExecutionID , info . reportInfo .reportID )
280+ state , err := c .targetStrategy .QueryTransmissionState (ctx , info .reportInfo .reportID , request )
289281
290282 if err != nil {
291283 msg := builder .buildWriteError (info , 0 , "failed to fetch [TransmissionState]" , err .Error ())
@@ -311,7 +303,7 @@ func (c *writeTarget) Execute(ctx context.Context, request capabilities.Capabili
311303 "executionID" , request .Metadata .WorkflowExecutionID ,
312304 )
313305
314- txID , err := c .targetStrategy .TransmitReport (ctx , info . receiver , inputs .Report , inputs .Context , inputs .Signatures , request . Metadata . WorkflowExecutionID )
306+ txID , err := c .targetStrategy .TransmitReport (ctx , inputs .Report , inputs .Context , inputs .Signatures , request )
315307 c .lggr .Debugw ("Transaction submitted" , "request" , request , "transaction-id" , txID )
316308 if err != nil {
317309 msg := builder .buildWriteError (info , 0 , "failed to transmit the report" , err .Error ())
@@ -438,7 +430,7 @@ func (c *writeTarget) acceptAndConfirmWrite(ctx context.Context, info requestInf
438430 }
439431
440432 // Check confirmation status (transmission state)
441- state , err := c .targetStrategy .QueryTransmissionState (ctx , info .receiver , info . request . Metadata . WorkflowExecutionID , info .reportInfo . reportID )
433+ state , err := c .targetStrategy .QueryTransmissionState (ctx , info .reportInfo . reportID , info .request )
442434 if err != nil {
443435 lggr .Errorw ("failed to check confirmed status" , "txID" , txID , "err" , err )
444436 continue
0 commit comments