Skip to content

Commit 408283b

Browse files
committed
Added GetTransactionStatus to target strategy abstrasction
1 parent 413d14c commit 408283b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

capabilities/writetarget/write_target.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ type TargetStrategy interface {
5454
// TransmitReport constructs the tx to transmit the report, and defines
5555
// any specific handling for sending the report via ChainWriter.
5656
TransmitReport(ctx context.Context, report []byte, reportContext []byte, signatures [][]byte, request capabilities.CapabilityRequest) (string, error)
57+
// Wrapper around the ChainWriter to get the transaction status
58+
GetTransactionStatus(ctx context.Context, transactionID string) (commontypes.TransactionStatus, error)
5759
}
5860

5961
var (
@@ -81,7 +83,6 @@ type writeTarget struct {
8183

8284
cs commontypes.ChainService
8385
cr commontypes.ContractReader
84-
cw commontypes.ContractWriter
8586
evm commontypes.EVMService
8687
configValidateFn func(request capabilities.CapabilityRequest) (string, error)
8788

@@ -104,7 +105,6 @@ type WriteTargetOpts struct {
104105

105106
ChainService commontypes.ChainService
106107
ContractReader commontypes.ContractReader
107-
ChainWriter commontypes.ContractWriter
108108
EVMService commontypes.EVMService
109109
ConfigValidateFn func(request capabilities.CapabilityRequest) (string, error)
110110

@@ -156,7 +156,6 @@ func NewWriteTarget(opts WriteTargetOpts) capabilities.TargetCapability {
156156
opts.Beholder,
157157
opts.ChainService,
158158
opts.ContractReader,
159-
opts.ChainWriter,
160159
opts.EVMService,
161160
opts.ConfigValidateFn,
162161
opts.NodeAddress,
@@ -380,7 +379,7 @@ func (c *writeTarget) acceptAndConfirmWrite(ctx context.Context, info requestInf
380379
// Fn helpers
381380
checkAcceptedStatus := func(ctx context.Context) (commontypes.TransactionStatus, bool, error) {
382381
// Check TXM for status
383-
status, err := c.cw.GetTransactionStatus(ctx, txID)
382+
status, err := c.targetStrategy.GetTransactionStatus(ctx, txID)
384383
if err != nil {
385384
return commontypes.Unknown, false, fmt.Errorf("failed to get tx status: %w", err)
386385
}

0 commit comments

Comments
 (0)