Skip to content

Commit f05adb2

Browse files
committed
multi: add CreditAccount & DebitAccount endpoints
This commit introduces the structure for new endpoints in the accounts subsystem, enabling balance adjustments by crediting or debiting a specified amount. This contrasts with the existing `UpdateAccount` implementation, which directly sets the balance to a fixed value. For more details on the drawbacks of the current implementation, see [issue #648](#648). The actual implementation of the endpoints will be introduced in subsequent commits.
1 parent acc1f38 commit f05adb2

File tree

11 files changed

+761
-85
lines changed

11 files changed

+761
-85
lines changed

accounts/rpcserver.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,28 @@ func (s *RPCServer) UpdateAccount(ctx context.Context,
130130
return marshalAccount(account), nil
131131
}
132132

133+
// CreditAccount increases the balance of an existing account in the account
134+
// database, by the given amount.
135+
func (s *RPCServer) CreditAccount(ctx context.Context,
136+
req *litrpc.UpdateAccountBalanceRequest) (*litrpc.Account, error) {
137+
138+
log.Infof("[creditaccount] id=%s, label=%v, amount=%d",
139+
req.Id, req.Label, req.Amount)
140+
141+
return nil, fmt.Errorf("not implemented")
142+
}
143+
144+
// DebitAccount decreases the balance of an existing account in the account
145+
// database, by the given amount.
146+
func (s *RPCServer) DebitAccount(ctx context.Context,
147+
req *litrpc.UpdateAccountBalanceRequest) (*litrpc.Account, error) {
148+
149+
log.Infof("[debitaccount] id=%s, label=%v, amount=%d",
150+
req.Id, req.Label, req.Amount)
151+
152+
return nil, fmt.Errorf("not implemented")
153+
}
154+
133155
// ListAccounts returns all accounts that are currently stored in the account
134156
// database.
135157
func (s *RPCServer) ListAccounts(ctx context.Context,

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

Lines changed: 28 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: 212 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: 38 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)