Skip to content

Commit

Permalink
Adding list users and list permissions APIs to EL reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Chatham committed Dec 10, 2024
1 parent fe823e1 commit beb1a3c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,3 +661,28 @@ func (r *ChainReader) UserCanCall(
}
return canCall, nil
}

func (r *ChainReader) ListUsers(
ctx context.Context,
userAddress gethcommon.Address,
target gethcommon.Address,
selector [4]byte,
) ([]gethcommon.Address, error) {
appointees, err := r.permissionController.GetAppointees(&bind.CallOpts{Context: ctx}, userAddress, target, selector)
if err != nil {
return nil, errors.New("call to permission controller failed: " + err.Error())
}
return appointees, nil
}

func (r *ChainReader) ListUserPermissions(
ctx context.Context,
appointed gethcommon.Address,
userAddress gethcommon.Address,
) ([]gethcommon.Address, [][4]byte, error) {
targets, selectors, err := r.permissionController.GetAppointeePermissions(&bind.CallOpts{Context: ctx}, appointed, userAddress)
if err != nil {
return nil, nil, errors.New("call to permission controller failed: " + err.Error())
}
return targets, selectors, nil
}

0 comments on commit beb1a3c

Please sign in to comment.