From fdae59339a81b35f212e9ec60f0da7590eb21f8f Mon Sep 17 00:00:00 2001 From: Brandon Chatham Date: Tue, 10 Dec 2024 15:46:12 -0800 Subject: [PATCH] Adding IsPendingAdmin & IsAdmin read APIs. --- chainio/clients/elcontracts/reader.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/chainio/clients/elcontracts/reader.go b/chainio/clients/elcontracts/reader.go index d9009a2a..a88f99d3 100644 --- a/chainio/clients/elcontracts/reader.go +++ b/chainio/clients/elcontracts/reader.go @@ -718,3 +718,27 @@ func (r *ChainReader) ListAdmins( } return pendingAdmins, nil } + +func (r *ChainReader) IsPendingAdmin( + ctx context.Context, + accountAddress gethcommon.Address, + pendingAdminAddress gethcommon.Address, +) (bool, error) { + isPendingAdmin, err := r.permissionController.IsPendingAdmin(&bind.CallOpts{Context: ctx}, accountAddress, pendingAdminAddress) + if err != nil { + return isPendingAdmin, errors.New("call to permission controller failed: " + err.Error()) + } + return isPendingAdmin, nil +} + +func (r *ChainReader) IsAdmin( + ctx context.Context, + accountAddress gethcommon.Address, + adminAddress gethcommon.Address, +) (bool, error) { + isAdmin, err := r.permissionController.IsAdmin(&bind.CallOpts{Context: ctx}, accountAddress, adminAddress) + if err != nil { + return isAdmin, errors.New("call to permission controller failed: " + err.Error()) + } + return isAdmin, nil +}