Skip to content

Commit 27b04eb

Browse files
committed
multi: add AccountInfo RPC
1 parent 1e08f4a commit 27b04eb

11 files changed

+518
-57
lines changed

accounts/rpcserver.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,25 @@ func (s *RPCServer) ListAccounts(context.Context,
157157
}, nil
158158
}
159159

160+
// AccountInfo returns the account with the given ID or label.
161+
func (s *RPCServer) AccountInfo(_ context.Context,
162+
req *litrpc.AccountInfoRequest) (*litrpc.Account, error) {
163+
164+
log.Infof("[accountinfo] id=%v, label=%v", req.Id, req.Label)
165+
166+
accountID, err := s.findAccount(req.Id, req.Label)
167+
if err != nil {
168+
return nil, err
169+
}
170+
171+
dbAccount, err := s.service.Account(accountID)
172+
if err != nil {
173+
return nil, fmt.Errorf("error retrieving account: %w", err)
174+
}
175+
176+
return marshalAccount(dbAccount), nil
177+
}
178+
160179
// RemoveAccount removes the given account from the account database.
161180
func (s *RPCServer) RemoveAccount(_ context.Context,
162181
req *litrpc.RemoveAccountRequest) (*litrpc.RemoveAccountResponse,

app/src/types/generated/lit-accounts_pb.d.ts

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-accounts_pb.js

Lines changed: 170 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-accounts_pb_service.d.ts

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-accounts_pb_service.js

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

litrpc/accounts.pb.json.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)