Skip to content

Commit

Permalink
add UpdateSocket fn to avs writer client
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed May 29, 2024
1 parent aebab47 commit 8bd2a3f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions chainio/clients/avsregistry/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,22 @@ func (w *AvsRegistryChainWriter) DeregisterOperator(
)
return receipt, nil
}

func (w *AvsRegistryChainWriter) UpdateSocket(
ctx context.Context,
socket types.Socket,
) (*gethtypes.Receipt, error) {
noSendTxOpts, err := w.txMgr.GetNoSendTxOpts()
if err != nil {
return nil, err
}
tx, err := w.registryCoordinator.UpdateSocket(noSendTxOpts, socket.ToString())
if err != nil {
return nil, err
}
receipt, err := w.txMgr.Send(ctx, tx)
if err != nil {
return nil, errors.New("failed to send UpdateSocket tx with err: " + err.Error())
}
return receipt, nil
}
4 changes: 4 additions & 0 deletions types/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (o Operator) Validate() error {
// or whatever an avs decides to use
type Socket string

func (s Socket) ToString() string {
return string(s)
}

type OperatorInfo struct {
Socket Socket
Pubkeys OperatorPubkeys
Expand Down

0 comments on commit 8bd2a3f

Please sign in to comment.