Merge pull request #974 from ViktorTigerstrom/2025-02-credit-debit-accounts-impl

accounts: Add credit and debit account functionality
This commit is contained in:
Elle 2025-04-01 13:13:43 +02:00 committed by GitHub
commit 9e5578cf2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 2713 additions and 103 deletions

View file

@ -63,6 +63,18 @@ type mockService struct {
*requestValuesStore
}
func (m *mockService) CreditAccount(_ context.Context, _ AccountID,
_ lnwire.MilliSatoshi) (*OffChainBalanceAccount, error) {
return nil, nil
}
func (m *mockService) DebitAccount(_ context.Context, _ AccountID,
_ lnwire.MilliSatoshi) (*OffChainBalanceAccount, error) {
return nil, nil
}
func newMockService() *mockService {
return &mockService{
acctBalanceMsat: 0,

View file

@ -331,6 +331,16 @@ type Service interface {
PaymentErrored(ctx context.Context, id AccountID,
hash lntypes.Hash) error
// CreditAccount increases the balance of an existing account in the
// database.
CreditAccount(ctx context.Context, accountID AccountID,
amount lnwire.MilliSatoshi) (*OffChainBalanceAccount, error)
// DebitAccount decreases the balance of an existing account in the
// database.
DebitAccount(ctx context.Context, accountID AccountID,
amount lnwire.MilliSatoshi) (*OffChainBalanceAccount, error)
RequestValuesStore
}

View file

@ -130,6 +130,83 @@ func (s *RPCServer) UpdateAccount(ctx context.Context,
return marshalAccount(account), nil
}
// CreditAccount increases the balance of an existing account in the account
// database, by the given amount.
func (s *RPCServer) CreditAccount(ctx context.Context,
req *litrpc.CreditAccountRequest) (*litrpc.CreditAccountResponse,
error) {
if req.GetAccount() == nil {
return nil, fmt.Errorf("account param must be specified")
}
var id, label string
switch idType := req.Account.Identifier.(type) {
case *litrpc.AccountIdentifier_Id:
id = idType.Id
case *litrpc.AccountIdentifier_Label:
label = idType.Label
}
log.Infof("[creditaccount] id=%s, label=%v, amount=%d", id, label,
req.Amount)
amount := lnwire.MilliSatoshi(req.Amount * 1000)
accountID, err := s.findAccount(ctx, id, label)
if err != nil {
return nil, err
}
account, err := s.service.CreditAccount(ctx, accountID, amount)
if err != nil {
return nil, err
}
return &litrpc.CreditAccountResponse{
Account: marshalAccount(account),
}, nil
}
// DebitAccount decreases the balance of an existing account in the account
// database, by the given amount.
func (s *RPCServer) DebitAccount(ctx context.Context,
req *litrpc.DebitAccountRequest) (*litrpc.DebitAccountResponse, error) {
if req.GetAccount() == nil {
return nil, fmt.Errorf("account param must be specified")
}
var id, label string
switch idType := req.Account.Identifier.(type) {
case *litrpc.AccountIdentifier_Id:
id = idType.Id
case *litrpc.AccountIdentifier_Label:
label = idType.Label
}
log.Infof("[debitaccount] id=%s, label=%v, amount=%d", id, label,
req.Amount)
amount := lnwire.MilliSatoshi(req.Amount * 1000)
accountID, err := s.findAccount(ctx, id, label)
if err != nil {
return nil, err
}
account, err := s.service.DebitAccount(ctx, accountID, amount)
if err != nil {
return nil, err
}
return &litrpc.DebitAccountResponse{
Account: marshalAccount(account),
}, nil
}
// ListAccounts returns all accounts that are currently stored in the account
// database.
func (s *RPCServer) ListAccounts(ctx context.Context,

View file

@ -345,6 +345,56 @@ func (s *InterceptorService) UpdateAccount(ctx context.Context,
return s.store.Account(ctx, accountID)
}
// CreditAccount increases the balance of an existing account in the database.
func (s *InterceptorService) CreditAccount(ctx context.Context,
accountID AccountID,
amount lnwire.MilliSatoshi) (*OffChainBalanceAccount, error) {
s.Lock()
defer s.Unlock()
// As this function updates account balances, we require that the
// service is running before we execute it.
if !s.isRunningUnsafe() {
// This case can only happen if the service is disabled while
// we're processing a request.
return nil, ErrAccountServiceDisabled
}
// Credit the account in the db.
err := s.store.CreditAccount(ctx, accountID, amount)
if err != nil {
return nil, fmt.Errorf("unable to credit account: %w", err)
}
return s.store.Account(ctx, accountID)
}
// DebitAccount decreases the balance of an existing account in the database.
func (s *InterceptorService) DebitAccount(ctx context.Context,
accountID AccountID,
amount lnwire.MilliSatoshi) (*OffChainBalanceAccount, error) {
s.Lock()
defer s.Unlock()
// As this function updates account balances, we require that the
// service is running before we execute it.
if !s.isRunningUnsafe() {
// This case can only happen if the service is disabled while
// we're processing a request.
return nil, ErrAccountServiceDisabled
}
// Debit the account in the db.
err := s.store.DebitAccount(ctx, accountID, amount)
if err != nil {
return nil, fmt.Errorf("unable to debit account: %w", err)
}
return s.store.Account(ctx, accountID)
}
// Account retrieves an account from the bolt DB and un-marshals it. If the
// account cannot be found, then ErrAccNotFound is returned.
func (s *InterceptorService) Account(ctx context.Context,

View file

@ -195,6 +195,102 @@ export namespace UpdateAccountRequest {
}
}
export class CreditAccountRequest extends jspb.Message {
hasAccount(): boolean;
clearAccount(): void;
getAccount(): AccountIdentifier | undefined;
setAccount(value?: AccountIdentifier): void;
getAmount(): string;
setAmount(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreditAccountRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreditAccountRequest): CreditAccountRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreditAccountRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreditAccountRequest;
static deserializeBinaryFromReader(message: CreditAccountRequest, reader: jspb.BinaryReader): CreditAccountRequest;
}
export namespace CreditAccountRequest {
export type AsObject = {
account?: AccountIdentifier.AsObject,
amount: string,
}
}
export class CreditAccountResponse extends jspb.Message {
hasAccount(): boolean;
clearAccount(): void;
getAccount(): Account | undefined;
setAccount(value?: Account): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreditAccountResponse.AsObject;
static toObject(includeInstance: boolean, msg: CreditAccountResponse): CreditAccountResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreditAccountResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreditAccountResponse;
static deserializeBinaryFromReader(message: CreditAccountResponse, reader: jspb.BinaryReader): CreditAccountResponse;
}
export namespace CreditAccountResponse {
export type AsObject = {
account?: Account.AsObject,
}
}
export class DebitAccountRequest extends jspb.Message {
hasAccount(): boolean;
clearAccount(): void;
getAccount(): AccountIdentifier | undefined;
setAccount(value?: AccountIdentifier): void;
getAmount(): string;
setAmount(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebitAccountRequest.AsObject;
static toObject(includeInstance: boolean, msg: DebitAccountRequest): DebitAccountRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebitAccountRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebitAccountRequest;
static deserializeBinaryFromReader(message: DebitAccountRequest, reader: jspb.BinaryReader): DebitAccountRequest;
}
export namespace DebitAccountRequest {
export type AsObject = {
account?: AccountIdentifier.AsObject,
amount: string,
}
}
export class DebitAccountResponse extends jspb.Message {
hasAccount(): boolean;
clearAccount(): void;
getAccount(): Account | undefined;
setAccount(value?: Account): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DebitAccountResponse.AsObject;
static toObject(includeInstance: boolean, msg: DebitAccountResponse): DebitAccountResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DebitAccountResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DebitAccountResponse;
static deserializeBinaryFromReader(message: DebitAccountResponse, reader: jspb.BinaryReader): DebitAccountResponse;
}
export namespace DebitAccountResponse {
export type AsObject = {
account?: Account.AsObject,
}
}
export class ListAccountsRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListAccountsRequest.AsObject;
@ -297,3 +393,38 @@ export namespace RemoveAccountResponse {
}
}
export class AccountIdentifier extends jspb.Message {
hasId(): boolean;
clearId(): void;
getId(): string;
setId(value: string): void;
hasLabel(): boolean;
clearLabel(): void;
getLabel(): string;
setLabel(value: string): void;
getIdentifierCase(): AccountIdentifier.IdentifierCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AccountIdentifier.AsObject;
static toObject(includeInstance: boolean, msg: AccountIdentifier): AccountIdentifier.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AccountIdentifier, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AccountIdentifier;
static deserializeBinaryFromReader(message: AccountIdentifier, reader: jspb.BinaryReader): AccountIdentifier;
}
export namespace AccountIdentifier {
export type AsObject = {
id: string,
label: string,
}
export enum IdentifierCase {
IDENTIFIER_NOT_SET = 0,
ID = 1,
LABEL = 2,
}
}

File diff suppressed because it is too large Load diff

View file

@ -22,6 +22,24 @@ type AccountsUpdateAccount = {
readonly responseType: typeof lit_accounts_pb.Account;
};
type AccountsCreditAccount = {
readonly methodName: string;
readonly service: typeof Accounts;
readonly requestStream: false;
readonly responseStream: false;
readonly requestType: typeof lit_accounts_pb.CreditAccountRequest;
readonly responseType: typeof lit_accounts_pb.CreditAccountResponse;
};
type AccountsDebitAccount = {
readonly methodName: string;
readonly service: typeof Accounts;
readonly requestStream: false;
readonly responseStream: false;
readonly requestType: typeof lit_accounts_pb.DebitAccountRequest;
readonly responseType: typeof lit_accounts_pb.DebitAccountResponse;
};
type AccountsListAccounts = {
readonly methodName: string;
readonly service: typeof Accounts;
@ -53,6 +71,8 @@ export class Accounts {
static readonly serviceName: string;
static readonly CreateAccount: AccountsCreateAccount;
static readonly UpdateAccount: AccountsUpdateAccount;
static readonly CreditAccount: AccountsCreditAccount;
static readonly DebitAccount: AccountsDebitAccount;
static readonly ListAccounts: AccountsListAccounts;
static readonly AccountInfo: AccountsAccountInfo;
static readonly RemoveAccount: AccountsRemoveAccount;
@ -108,6 +128,24 @@ export class AccountsClient {
requestMessage: lit_accounts_pb.UpdateAccountRequest,
callback: (error: ServiceError|null, responseMessage: lit_accounts_pb.Account|null) => void
): UnaryResponse;
creditAccount(
requestMessage: lit_accounts_pb.CreditAccountRequest,
metadata: grpc.Metadata,
callback: (error: ServiceError|null, responseMessage: lit_accounts_pb.CreditAccountResponse|null) => void
): UnaryResponse;
creditAccount(
requestMessage: lit_accounts_pb.CreditAccountRequest,
callback: (error: ServiceError|null, responseMessage: lit_accounts_pb.CreditAccountResponse|null) => void
): UnaryResponse;
debitAccount(
requestMessage: lit_accounts_pb.DebitAccountRequest,
metadata: grpc.Metadata,
callback: (error: ServiceError|null, responseMessage: lit_accounts_pb.DebitAccountResponse|null) => void
): UnaryResponse;
debitAccount(
requestMessage: lit_accounts_pb.DebitAccountRequest,
callback: (error: ServiceError|null, responseMessage: lit_accounts_pb.DebitAccountResponse|null) => void
): UnaryResponse;
listAccounts(
requestMessage: lit_accounts_pb.ListAccountsRequest,
metadata: grpc.Metadata,

View file

@ -28,6 +28,24 @@ Accounts.UpdateAccount = {
responseType: lit_accounts_pb.Account
};
Accounts.CreditAccount = {
methodName: "CreditAccount",
service: Accounts,
requestStream: false,
responseStream: false,
requestType: lit_accounts_pb.CreditAccountRequest,
responseType: lit_accounts_pb.CreditAccountResponse
};
Accounts.DebitAccount = {
methodName: "DebitAccount",
service: Accounts,
requestStream: false,
responseStream: false,
requestType: lit_accounts_pb.DebitAccountRequest,
responseType: lit_accounts_pb.DebitAccountResponse
};
Accounts.ListAccounts = {
methodName: "ListAccounts",
service: Accounts,
@ -124,6 +142,68 @@ AccountsClient.prototype.updateAccount = function updateAccount(requestMessage,
};
};
AccountsClient.prototype.creditAccount = function creditAccount(requestMessage, metadata, callback) {
if (arguments.length === 2) {
callback = arguments[1];
}
var client = grpc.unary(Accounts.CreditAccount, {
request: requestMessage,
host: this.serviceHost,
metadata: metadata,
transport: this.options.transport,
debug: this.options.debug,
onEnd: function (response) {
if (callback) {
if (response.status !== grpc.Code.OK) {
var err = new Error(response.statusMessage);
err.code = response.status;
err.metadata = response.trailers;
callback(err, null);
} else {
callback(null, response.message);
}
}
}
});
return {
cancel: function () {
callback = null;
client.close();
}
};
};
AccountsClient.prototype.debitAccount = function debitAccount(requestMessage, metadata, callback) {
if (arguments.length === 2) {
callback = arguments[1];
}
var client = grpc.unary(Accounts.DebitAccount, {
request: requestMessage,
host: this.serviceHost,
metadata: metadata,
transport: this.options.transport,
debug: this.options.debug,
onEnd: function (response) {
if (callback) {
if (response.status !== grpc.Code.OK) {
var err = new Error(response.statusMessage);
err.code = response.status;
err.metadata = response.trailers;
callback(err, null);
} else {
callback(null, response.message);
}
}
}
});
return {
cancel: function () {
callback = null;
client.close();
}
};
};
AccountsClient.prototype.listAccounts = function listAccounts(requestMessage, metadata, callback) {
if (arguments.length === 2) {
callback = arguments[1];

View file

@ -2,6 +2,7 @@ package main
import (
"encoding/hex"
"errors"
"fmt"
"os"
"strconv"
@ -159,9 +160,10 @@ var updateAccountCommand = cli.Command{
},
cli.Int64Flag{
Name: "new_balance",
Usage: "The new balance of the account; -1 means do " +
"not update the balance.",
Value: -1,
Usage: "(deprecated) The new balance of the account; " +
"-1 means do not update the balance.",
Value: -1,
Hidden: true,
},
cli.Int64Flag{
Name: "new_expiration_date",
@ -173,6 +175,10 @@ var updateAccountCommand = cli.Command{
},
},
Action: updateAccount,
Subcommands: []cli.Command{
creditCommand,
debitCommand,
},
}
func updateAccount(cli *cli.Context) error {
@ -232,6 +238,125 @@ func updateAccount(cli *cli.Context) error {
return nil
}
var creditCommand = cli.Command{
Name: "credit",
ShortName: "c",
Usage: "Increase an account's balance by the given amount.",
ArgsUsage: "[id | label] amount",
Description: "Increases an existing off-chain account's balance by " +
"the given amount.",
Flags: []cli.Flag{
cli.StringFlag{
Name: idName,
Usage: "The ID of the account to credit.",
},
cli.StringFlag{
Name: labelName,
Usage: "(optional) The unique label of the account.",
},
cli.Uint64Flag{
Name: "amount",
Usage: "The amount to credit the account.",
},
},
Action: creditBalance,
}
func creditBalance(cli *cli.Context) error {
return updateBalance(cli, true)
}
var debitCommand = cli.Command{
Name: "debit",
ShortName: "d",
Usage: "Decrease an account's balance by the given amount.",
ArgsUsage: "[id | label] amount",
Description: "Decreases an existing off-chain account's balance by " +
"the given amount.",
Flags: []cli.Flag{
cli.StringFlag{
Name: idName,
Usage: "The ID of the account to debit.",
},
cli.StringFlag{
Name: labelName,
Usage: "(optional) The unique label of the account.",
},
cli.Uint64Flag{
Name: "amount",
Usage: "The amount to debit the account.",
},
},
Action: debitBalance,
}
func debitBalance(cli *cli.Context) error {
return updateBalance(cli, false)
}
func updateBalance(cli *cli.Context, add bool) error {
ctx := getContext()
clientConn, cleanup, err := connectClient(cli, false)
if err != nil {
return err
}
defer cleanup()
client := litrpc.NewAccountsClient(clientConn)
account, args, err := parseAccountIdentifier(cli)
if err != nil {
return err
}
if (!cli.IsSet("amount") && len(args) != 1) ||
(cli.IsSet("amount") && len(args) != 0) {
return errors.New("invalid number of arguments")
}
var amount uint64
switch {
case cli.IsSet("amount"):
amount = cli.Uint64("amount")
case args.Present():
amount, err = strconv.ParseUint(args.First(), 10, 64)
if err != nil {
return fmt.Errorf("unable to decode amount %v", err)
}
args = args.Tail()
default:
return errors.New("must set a value for amount")
}
if add {
req := &litrpc.CreditAccountRequest{
Account: account,
Amount: amount,
}
resp, err := client.CreditAccount(ctx, req)
if err != nil {
return err
}
printRespJSON(resp)
} else {
req := &litrpc.DebitAccountRequest{
Account: account,
Amount: amount,
}
resp, err := client.DebitAccount(ctx, req)
if err != nil {
return err
}
printRespJSON(resp)
}
return nil
}
var listAccountsCommand = cli.Command{
Name: "list",
ShortName: "l",
@ -348,6 +473,39 @@ func removeAccount(cli *cli.Context) error {
return err
}
// parseAccountIdentifier parses either the id or label from the command line,
// and returns the account identifier.
func parseAccountIdentifier(ctx *cli.Context) (
*litrpc.AccountIdentifier, cli.Args, error) {
id, label, args, err := parseIDOrLabel(ctx)
if err != nil {
return nil, nil, err
}
if id == "" && label == "" {
return nil, nil, fmt.Errorf("id argument missing")
}
if id != "" {
identifier := &litrpc.AccountIdentifier{
Identifier: &litrpc.AccountIdentifier_Id{
Id: id,
},
}
return identifier, args, nil
} else {
identifier := &litrpc.AccountIdentifier{
Identifier: &litrpc.AccountIdentifier_Label{
Label: label,
},
}
return identifier, args, nil
}
}
// parseIDOrLabel parses either the id or label from the command line.
func parseIDOrLabel(ctx *cli.Context) (string, string, cli.Args, error) {
var (

View file

@ -11,7 +11,6 @@
- [Faraday](#faraday)
- [Taproot Assets](#taproot-assets)
- [Contributors](#contributors-alphabetical-order)
## Lightning Terminal
### Bug Fixes
@ -31,6 +30,18 @@
## RPC Updates
* [Add account credit and debit
commands](https://github.com/lightninglabs/lightning-terminal/pull/974) that
allow increasing or decreasing the balance of an off-chain account by a
specified amount.
* The [`accounts update` `--new_balance` flag has been
deprecated](https://github.com/lightninglabs/lightning-terminal/pull/974).
Use the `accounts update credit` and `accounts update debit` commands
instead, to update an account's balance. The flag will no longer be
supported in Lightning Terminal `v0.16.0-alpha`.
## Integrated Binary Updates
### LND
@ -45,4 +56,5 @@
# Contributors (Alphabetical Order)
* Elle Mouton
* Elle Mouton
* Viktor

View file

@ -71,6 +71,56 @@ func RegisterAccountsJSONCallbacks(registry map[string]func(ctx context.Context,
callback(string(respBytes), nil)
}
registry["litrpc.Accounts.CreditAccount"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &CreditAccountRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewAccountsClient(conn)
resp, err := client.CreditAccount(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
registry["litrpc.Accounts.DebitAccount"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &DebitAccountRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil {
callback("", err)
return
}
client := NewAccountsClient(conn)
resp, err := client.DebitAccount(ctx, req)
if err != nil {
callback("", err)
return
}
respBytes, err := marshaler.Marshal(resp)
if err != nil {
callback("", err)
return
}
callback(string(respBytes), nil)
}
registry["litrpc.Accounts.ListAccounts"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {

View file

@ -382,7 +382,11 @@ type UpdateAccountRequest struct {
// The ID of the account to update. Either the ID or the label must be set.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// The new account balance to set. Set to -1 to not update the balance.
// Deprecated, use the `litcli update credit` or `litcli update debit`
// commands instead. The new account balance to set. Set to -1 to not
// update the balance.
//
// Deprecated: Marked as deprecated in lit-accounts.proto.
AccountBalance int64 `protobuf:"varint,2,opt,name=account_balance,json=accountBalance,proto3" json:"account_balance,omitempty"`
// The new account expiry to set. Set to -1 to not update the expiry. Set to 0
// to never expire.
@ -431,6 +435,7 @@ func (x *UpdateAccountRequest) GetId() string {
return ""
}
// Deprecated: Marked as deprecated in lit-accounts.proto.
func (x *UpdateAccountRequest) GetAccountBalance() int64 {
if x != nil {
return x.AccountBalance
@ -452,6 +457,216 @@ func (x *UpdateAccountRequest) GetLabel() string {
return ""
}
type CreditAccountRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The identifier of the account to credit.
Account *AccountIdentifier `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
// The amount by which the account's balance should be credited.
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (x *CreditAccountRequest) Reset() {
*x = CreditAccountRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreditAccountRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreditAccountRequest) ProtoMessage() {}
func (x *CreditAccountRequest) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreditAccountRequest.ProtoReflect.Descriptor instead.
func (*CreditAccountRequest) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{6}
}
func (x *CreditAccountRequest) GetAccount() *AccountIdentifier {
if x != nil {
return x.Account
}
return nil
}
func (x *CreditAccountRequest) GetAmount() uint64 {
if x != nil {
return x.Amount
}
return 0
}
type CreditAccountResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The credited account.
Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
}
func (x *CreditAccountResponse) Reset() {
*x = CreditAccountResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreditAccountResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreditAccountResponse) ProtoMessage() {}
func (x *CreditAccountResponse) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreditAccountResponse.ProtoReflect.Descriptor instead.
func (*CreditAccountResponse) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{7}
}
func (x *CreditAccountResponse) GetAccount() *Account {
if x != nil {
return x.Account
}
return nil
}
type DebitAccountRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The identifier of the account to debit.
Account *AccountIdentifier `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
// The amount by which the account's balance should be debited.
Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (x *DebitAccountRequest) Reset() {
*x = DebitAccountRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DebitAccountRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DebitAccountRequest) ProtoMessage() {}
func (x *DebitAccountRequest) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DebitAccountRequest.ProtoReflect.Descriptor instead.
func (*DebitAccountRequest) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{8}
}
func (x *DebitAccountRequest) GetAccount() *AccountIdentifier {
if x != nil {
return x.Account
}
return nil
}
func (x *DebitAccountRequest) GetAmount() uint64 {
if x != nil {
return x.Amount
}
return 0
}
type DebitAccountResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The debited account.
Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
}
func (x *DebitAccountResponse) Reset() {
*x = DebitAccountResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DebitAccountResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DebitAccountResponse) ProtoMessage() {}
func (x *DebitAccountResponse) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DebitAccountResponse.ProtoReflect.Descriptor instead.
func (*DebitAccountResponse) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{9}
}
func (x *DebitAccountResponse) GetAccount() *Account {
if x != nil {
return x.Account
}
return nil
}
type ListAccountsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -461,7 +676,7 @@ type ListAccountsRequest struct {
func (x *ListAccountsRequest) Reset() {
*x = ListAccountsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[6]
mi := &file_lit_accounts_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -474,7 +689,7 @@ func (x *ListAccountsRequest) String() string {
func (*ListAccountsRequest) ProtoMessage() {}
func (x *ListAccountsRequest) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[6]
mi := &file_lit_accounts_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -487,7 +702,7 @@ func (x *ListAccountsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListAccountsRequest.ProtoReflect.Descriptor instead.
func (*ListAccountsRequest) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{6}
return file_lit_accounts_proto_rawDescGZIP(), []int{10}
}
type ListAccountsResponse struct {
@ -502,7 +717,7 @@ type ListAccountsResponse struct {
func (x *ListAccountsResponse) Reset() {
*x = ListAccountsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[7]
mi := &file_lit_accounts_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -515,7 +730,7 @@ func (x *ListAccountsResponse) String() string {
func (*ListAccountsResponse) ProtoMessage() {}
func (x *ListAccountsResponse) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[7]
mi := &file_lit_accounts_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -528,7 +743,7 @@ func (x *ListAccountsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListAccountsResponse.ProtoReflect.Descriptor instead.
func (*ListAccountsResponse) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{7}
return file_lit_accounts_proto_rawDescGZIP(), []int{11}
}
func (x *ListAccountsResponse) GetAccounts() []*Account {
@ -554,7 +769,7 @@ type AccountInfoRequest struct {
func (x *AccountInfoRequest) Reset() {
*x = AccountInfoRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[8]
mi := &file_lit_accounts_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -567,7 +782,7 @@ func (x *AccountInfoRequest) String() string {
func (*AccountInfoRequest) ProtoMessage() {}
func (x *AccountInfoRequest) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[8]
mi := &file_lit_accounts_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -580,7 +795,7 @@ func (x *AccountInfoRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use AccountInfoRequest.ProtoReflect.Descriptor instead.
func (*AccountInfoRequest) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{8}
return file_lit_accounts_proto_rawDescGZIP(), []int{12}
}
func (x *AccountInfoRequest) GetId() string {
@ -613,7 +828,7 @@ type RemoveAccountRequest struct {
func (x *RemoveAccountRequest) Reset() {
*x = RemoveAccountRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[9]
mi := &file_lit_accounts_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -626,7 +841,7 @@ func (x *RemoveAccountRequest) String() string {
func (*RemoveAccountRequest) ProtoMessage() {}
func (x *RemoveAccountRequest) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[9]
mi := &file_lit_accounts_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -639,7 +854,7 @@ func (x *RemoveAccountRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RemoveAccountRequest.ProtoReflect.Descriptor instead.
func (*RemoveAccountRequest) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{9}
return file_lit_accounts_proto_rawDescGZIP(), []int{13}
}
func (x *RemoveAccountRequest) GetId() string {
@ -665,7 +880,7 @@ type RemoveAccountResponse struct {
func (x *RemoveAccountResponse) Reset() {
*x = RemoveAccountResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[10]
mi := &file_lit_accounts_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -678,7 +893,7 @@ func (x *RemoveAccountResponse) String() string {
func (*RemoveAccountResponse) ProtoMessage() {}
func (x *RemoveAccountResponse) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[10]
mi := &file_lit_accounts_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -691,9 +906,92 @@ func (x *RemoveAccountResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use RemoveAccountResponse.ProtoReflect.Descriptor instead.
func (*RemoveAccountResponse) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{10}
return file_lit_accounts_proto_rawDescGZIP(), []int{14}
}
type AccountIdentifier struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Types that are assignable to Identifier:
//
// *AccountIdentifier_Id
// *AccountIdentifier_Label
Identifier isAccountIdentifier_Identifier `protobuf_oneof:"identifier"`
}
func (x *AccountIdentifier) Reset() {
*x = AccountIdentifier{}
if protoimpl.UnsafeEnabled {
mi := &file_lit_accounts_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AccountIdentifier) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AccountIdentifier) ProtoMessage() {}
func (x *AccountIdentifier) ProtoReflect() protoreflect.Message {
mi := &file_lit_accounts_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AccountIdentifier.ProtoReflect.Descriptor instead.
func (*AccountIdentifier) Descriptor() ([]byte, []int) {
return file_lit_accounts_proto_rawDescGZIP(), []int{15}
}
func (m *AccountIdentifier) GetIdentifier() isAccountIdentifier_Identifier {
if m != nil {
return m.Identifier
}
return nil
}
func (x *AccountIdentifier) GetId() string {
if x, ok := x.GetIdentifier().(*AccountIdentifier_Id); ok {
return x.Id
}
return ""
}
func (x *AccountIdentifier) GetLabel() string {
if x, ok := x.GetIdentifier().(*AccountIdentifier_Label); ok {
return x.Label
}
return ""
}
type isAccountIdentifier_Identifier interface {
isAccountIdentifier_Identifier()
}
type AccountIdentifier_Id struct {
// The ID of the account.
Id string `protobuf:"bytes,1,opt,name=id,proto3,oneof"`
}
type AccountIdentifier_Label struct {
// The label of the account.
Label string `protobuf:"bytes,2,opt,name=label,proto3,oneof"`
}
func (*AccountIdentifier_Id) isAccountIdentifier_Identifier() {}
func (*AccountIdentifier_Label) isAccountIdentifier_Identifier() {}
var File_lit_accounts_proto protoreflect.FileDescriptor
var file_lit_accounts_proto_rawDesc = []byte{
@ -740,58 +1038,93 @@ var file_lit_accounts_proto_rawDesc = []byte{
0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73,
0x74, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x61, 0x6d, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x66, 0x75, 0x6c, 0x6c, 0x41,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x27,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2b,
0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0e, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x43, 0x0a,
0x14, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63,
0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x73, 0x22, 0x3a, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65,
0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x3c,
0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x17, 0x0a, 0x15,
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xed, 0x02, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x3e, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x49, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73,
0x12, 0x1b, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x74,
0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70,
0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e,
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62,
0x73, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2d, 0x74, 0x65, 0x72, 0x6d,
0x69, 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x61, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x65,
0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x44, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x63, 0x0a, 0x14, 0x43, 0x72,
0x65, 0x64, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x33, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x07,
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22,
0x42, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72,
0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x22, 0x62, 0x0a, 0x13, 0x44, 0x65, 0x62, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x07, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x69,
0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e,
0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52,
0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x41, 0x0a, 0x14, 0x44, 0x65, 0x62, 0x69, 0x74,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x29, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69,
0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x22, 0x43, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x61, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6c, 0x69,
0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62,
0x65, 0x6c, 0x22, 0x3c, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61,
0x62, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c,
0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4b, 0x0a, 0x11, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x10,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64,
0x12, 0x16, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48,
0x00, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e,
0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x32, 0x86, 0x04, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x4c, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x64,
0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x49, 0x0a, 0x0c, 0x44, 0x65, 0x62, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x1b, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x62, 0x69, 0x74, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c,
0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x62, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x4c, 0x69,
0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x6c, 0x69, 0x74,
0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x0f, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f,
0x76, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69,
0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x69, 0x67, 0x68,
0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2d, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2f, 0x6c,
0x69, 0x74, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -806,7 +1139,7 @@ func file_lit_accounts_proto_rawDescGZIP() []byte {
return file_lit_accounts_proto_rawDescData
}
var file_lit_accounts_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_lit_accounts_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_lit_accounts_proto_goTypes = []any{
(*CreateAccountRequest)(nil), // 0: litrpc.CreateAccountRequest
(*CreateAccountResponse)(nil), // 1: litrpc.CreateAccountResponse
@ -814,32 +1147,45 @@ var file_lit_accounts_proto_goTypes = []any{
(*AccountInvoice)(nil), // 3: litrpc.AccountInvoice
(*AccountPayment)(nil), // 4: litrpc.AccountPayment
(*UpdateAccountRequest)(nil), // 5: litrpc.UpdateAccountRequest
(*ListAccountsRequest)(nil), // 6: litrpc.ListAccountsRequest
(*ListAccountsResponse)(nil), // 7: litrpc.ListAccountsResponse
(*AccountInfoRequest)(nil), // 8: litrpc.AccountInfoRequest
(*RemoveAccountRequest)(nil), // 9: litrpc.RemoveAccountRequest
(*RemoveAccountResponse)(nil), // 10: litrpc.RemoveAccountResponse
(*CreditAccountRequest)(nil), // 6: litrpc.CreditAccountRequest
(*CreditAccountResponse)(nil), // 7: litrpc.CreditAccountResponse
(*DebitAccountRequest)(nil), // 8: litrpc.DebitAccountRequest
(*DebitAccountResponse)(nil), // 9: litrpc.DebitAccountResponse
(*ListAccountsRequest)(nil), // 10: litrpc.ListAccountsRequest
(*ListAccountsResponse)(nil), // 11: litrpc.ListAccountsResponse
(*AccountInfoRequest)(nil), // 12: litrpc.AccountInfoRequest
(*RemoveAccountRequest)(nil), // 13: litrpc.RemoveAccountRequest
(*RemoveAccountResponse)(nil), // 14: litrpc.RemoveAccountResponse
(*AccountIdentifier)(nil), // 15: litrpc.AccountIdentifier
}
var file_lit_accounts_proto_depIdxs = []int32{
2, // 0: litrpc.CreateAccountResponse.account:type_name -> litrpc.Account
3, // 1: litrpc.Account.invoices:type_name -> litrpc.AccountInvoice
4, // 2: litrpc.Account.payments:type_name -> litrpc.AccountPayment
2, // 3: litrpc.ListAccountsResponse.accounts:type_name -> litrpc.Account
0, // 4: litrpc.Accounts.CreateAccount:input_type -> litrpc.CreateAccountRequest
5, // 5: litrpc.Accounts.UpdateAccount:input_type -> litrpc.UpdateAccountRequest
6, // 6: litrpc.Accounts.ListAccounts:input_type -> litrpc.ListAccountsRequest
8, // 7: litrpc.Accounts.AccountInfo:input_type -> litrpc.AccountInfoRequest
9, // 8: litrpc.Accounts.RemoveAccount:input_type -> litrpc.RemoveAccountRequest
1, // 9: litrpc.Accounts.CreateAccount:output_type -> litrpc.CreateAccountResponse
2, // 10: litrpc.Accounts.UpdateAccount:output_type -> litrpc.Account
7, // 11: litrpc.Accounts.ListAccounts:output_type -> litrpc.ListAccountsResponse
2, // 12: litrpc.Accounts.AccountInfo:output_type -> litrpc.Account
10, // 13: litrpc.Accounts.RemoveAccount:output_type -> litrpc.RemoveAccountResponse
9, // [9:14] is the sub-list for method output_type
4, // [4:9] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
15, // 3: litrpc.CreditAccountRequest.account:type_name -> litrpc.AccountIdentifier
2, // 4: litrpc.CreditAccountResponse.account:type_name -> litrpc.Account
15, // 5: litrpc.DebitAccountRequest.account:type_name -> litrpc.AccountIdentifier
2, // 6: litrpc.DebitAccountResponse.account:type_name -> litrpc.Account
2, // 7: litrpc.ListAccountsResponse.accounts:type_name -> litrpc.Account
0, // 8: litrpc.Accounts.CreateAccount:input_type -> litrpc.CreateAccountRequest
5, // 9: litrpc.Accounts.UpdateAccount:input_type -> litrpc.UpdateAccountRequest
6, // 10: litrpc.Accounts.CreditAccount:input_type -> litrpc.CreditAccountRequest
8, // 11: litrpc.Accounts.DebitAccount:input_type -> litrpc.DebitAccountRequest
10, // 12: litrpc.Accounts.ListAccounts:input_type -> litrpc.ListAccountsRequest
12, // 13: litrpc.Accounts.AccountInfo:input_type -> litrpc.AccountInfoRequest
13, // 14: litrpc.Accounts.RemoveAccount:input_type -> litrpc.RemoveAccountRequest
1, // 15: litrpc.Accounts.CreateAccount:output_type -> litrpc.CreateAccountResponse
2, // 16: litrpc.Accounts.UpdateAccount:output_type -> litrpc.Account
7, // 17: litrpc.Accounts.CreditAccount:output_type -> litrpc.CreditAccountResponse
9, // 18: litrpc.Accounts.DebitAccount:output_type -> litrpc.DebitAccountResponse
11, // 19: litrpc.Accounts.ListAccounts:output_type -> litrpc.ListAccountsResponse
2, // 20: litrpc.Accounts.AccountInfo:output_type -> litrpc.Account
14, // 21: litrpc.Accounts.RemoveAccount:output_type -> litrpc.RemoveAccountResponse
15, // [15:22] is the sub-list for method output_type
8, // [8:15] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_lit_accounts_proto_init() }
@ -921,7 +1267,7 @@ func file_lit_accounts_proto_init() {
}
}
file_lit_accounts_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*ListAccountsRequest); i {
switch v := v.(*CreditAccountRequest); i {
case 0:
return &v.state
case 1:
@ -933,7 +1279,7 @@ func file_lit_accounts_proto_init() {
}
}
file_lit_accounts_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*ListAccountsResponse); i {
switch v := v.(*CreditAccountResponse); i {
case 0:
return &v.state
case 1:
@ -945,7 +1291,7 @@ func file_lit_accounts_proto_init() {
}
}
file_lit_accounts_proto_msgTypes[8].Exporter = func(v any, i int) any {
switch v := v.(*AccountInfoRequest); i {
switch v := v.(*DebitAccountRequest); i {
case 0:
return &v.state
case 1:
@ -957,7 +1303,7 @@ func file_lit_accounts_proto_init() {
}
}
file_lit_accounts_proto_msgTypes[9].Exporter = func(v any, i int) any {
switch v := v.(*RemoveAccountRequest); i {
switch v := v.(*DebitAccountResponse); i {
case 0:
return &v.state
case 1:
@ -969,6 +1315,54 @@ func file_lit_accounts_proto_init() {
}
}
file_lit_accounts_proto_msgTypes[10].Exporter = func(v any, i int) any {
switch v := v.(*ListAccountsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_lit_accounts_proto_msgTypes[11].Exporter = func(v any, i int) any {
switch v := v.(*ListAccountsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_lit_accounts_proto_msgTypes[12].Exporter = func(v any, i int) any {
switch v := v.(*AccountInfoRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_lit_accounts_proto_msgTypes[13].Exporter = func(v any, i int) any {
switch v := v.(*RemoveAccountRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_lit_accounts_proto_msgTypes[14].Exporter = func(v any, i int) any {
switch v := v.(*RemoveAccountResponse); i {
case 0:
return &v.state
@ -980,6 +1374,22 @@ func file_lit_accounts_proto_init() {
return nil
}
}
file_lit_accounts_proto_msgTypes[15].Exporter = func(v any, i int) any {
switch v := v.(*AccountIdentifier); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_lit_accounts_proto_msgTypes[15].OneofWrappers = []any{
(*AccountIdentifier_Id)(nil),
(*AccountIdentifier_Label)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -987,7 +1397,7 @@ func file_lit_accounts_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_lit_accounts_proto_rawDesc,
NumEnums: 0,
NumMessages: 11,
NumMessages: 16,
NumExtensions: 0,
NumServices: 1,
},

View file

@ -117,6 +117,126 @@ func local_request_Accounts_UpdateAccount_0(ctx context.Context, marshaler runti
}
func request_Accounts_CreditAccount_0(ctx context.Context, marshaler runtime.Marshaler, client AccountsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreditAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["account.id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account.id")
}
err = runtime.PopulateFieldFromPath(&protoReq, "account.id", val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account.id", err)
}
msg, err := client.CreditAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Accounts_CreditAccount_0(ctx context.Context, marshaler runtime.Marshaler, server AccountsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreditAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["account.id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account.id")
}
err = runtime.PopulateFieldFromPath(&protoReq, "account.id", val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account.id", err)
}
msg, err := server.CreditAccount(ctx, &protoReq)
return msg, metadata, err
}
func request_Accounts_DebitAccount_0(ctx context.Context, marshaler runtime.Marshaler, client AccountsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DebitAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["account.id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account.id")
}
err = runtime.PopulateFieldFromPath(&protoReq, "account.id", val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account.id", err)
}
msg, err := client.DebitAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Accounts_DebitAccount_0(ctx context.Context, marshaler runtime.Marshaler, server AccountsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DebitAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["account.id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account.id")
}
err = runtime.PopulateFieldFromPath(&protoReq, "account.id", val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account.id", err)
}
msg, err := server.DebitAccount(ctx, &protoReq)
return msg, metadata, err
}
func request_Accounts_ListAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client AccountsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListAccountsRequest
var metadata runtime.ServerMetadata
@ -262,6 +382,56 @@ func RegisterAccountsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s
})
mux.Handle("POST", pattern_Accounts_CreditAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/litrpc.Accounts/CreditAccount", runtime.WithHTTPPathPattern("/v1/accounts/credit/{account.id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Accounts_CreditAccount_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Accounts_CreditAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Accounts_DebitAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/litrpc.Accounts/DebitAccount", runtime.WithHTTPPathPattern("/v1/accounts/debit/{account.id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Accounts_DebitAccount_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Accounts_DebitAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Accounts_ListAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -397,6 +567,50 @@ func RegisterAccountsHandlerClient(ctx context.Context, mux *runtime.ServeMux, c
})
mux.Handle("POST", pattern_Accounts_CreditAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/litrpc.Accounts/CreditAccount", runtime.WithHTTPPathPattern("/v1/accounts/credit/{account.id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Accounts_CreditAccount_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Accounts_CreditAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Accounts_DebitAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/litrpc.Accounts/DebitAccount", runtime.WithHTTPPathPattern("/v1/accounts/debit/{account.id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Accounts_DebitAccount_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Accounts_DebitAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Accounts_ListAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -449,6 +663,10 @@ var (
pattern_Accounts_UpdateAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "accounts", "id"}, ""))
pattern_Accounts_CreditAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "accounts", "credit", "account.id"}, ""))
pattern_Accounts_DebitAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "accounts", "debit", "account.id"}, ""))
pattern_Accounts_ListAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "accounts"}, ""))
pattern_Accounts_RemoveAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "accounts", "id"}, ""))
@ -459,6 +677,10 @@ var (
forward_Accounts_UpdateAccount_0 = runtime.ForwardResponseMessage
forward_Accounts_CreditAccount_0 = runtime.ForwardResponseMessage
forward_Accounts_DebitAccount_0 = runtime.ForwardResponseMessage
forward_Accounts_ListAccounts_0 = runtime.ForwardResponseMessage
forward_Accounts_RemoveAccount_0 = runtime.ForwardResponseMessage

View file

@ -25,6 +25,18 @@ service Accounts {
*/
rpc UpdateAccount (UpdateAccountRequest) returns (Account);
/* litcli: `accounts update credit`
CreditAccount increases the balance of an existing account in the account
database.
*/
rpc CreditAccount (CreditAccountRequest) returns (CreditAccountResponse);
/* litcli: `accounts update debit`
DebitAccount decreases the balance of an existing account in the account
database.
*/
rpc DebitAccount (DebitAccountRequest) returns (DebitAccountResponse);
/* litcli: `accounts list`
ListAccounts returns all accounts that are currently stored in the account
database.
@ -132,8 +144,12 @@ message UpdateAccountRequest {
// The ID of the account to update. Either the ID or the label must be set.
string id = 1;
// The new account balance to set. Set to -1 to not update the balance.
int64 account_balance = 2;
/*
Deprecated, use the `litcli update credit` or `litcli update debit`
commands instead. The new account balance to set. Set to -1 to not
update the balance.
*/
int64 account_balance = 2 [deprecated = true];
/*
The new account expiry to set. Set to -1 to not update the expiry. Set to 0
@ -148,6 +164,36 @@ message UpdateAccountRequest {
string label = 4;
}
message CreditAccountRequest {
// The identifier of the account to credit.
AccountIdentifier account = 1;
/*
The amount by which the account's balance should be credited.
*/
uint64 amount = 2;
}
message CreditAccountResponse {
// The credited account.
Account account = 1;
}
message DebitAccountRequest {
// The identifier of the account to debit.
AccountIdentifier account = 1;
/*
The amount by which the account's balance should be debited.
*/
uint64 amount = 3;
}
message DebitAccountResponse {
// The debited account.
Account account = 1;
}
message ListAccountsRequest {
}
@ -186,3 +232,13 @@ message RemoveAccountRequest {
message RemoveAccountResponse {
}
message AccountIdentifier {
oneof identifier {
// The ID of the account.
string id = 1;
// The label of the account.
string label = 2;
}
}

View file

@ -71,6 +71,86 @@
]
}
},
"/v1/accounts/credit/{account.id}": {
"post": {
"summary": "litcli: `accounts update credit`\nCreditAccount increases the balance of an existing account in the account\ndatabase.",
"operationId": "Accounts_CreditAccount",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/litrpcCreditAccountResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "account.id",
"description": "The ID of the account.",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AccountsCreditAccountBody"
}
}
],
"tags": [
"Accounts"
]
}
},
"/v1/accounts/debit/{account.id}": {
"post": {
"summary": "litcli: `accounts update debit`\nDebitAccount decreases the balance of an existing account in the account\ndatabase.",
"operationId": "Accounts_DebitAccount",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/litrpcDebitAccountResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "account.id",
"description": "The ID of the account.",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AccountsDebitAccountBody"
}
}
],
"tags": [
"Accounts"
]
}
},
"/v1/accounts/{id}": {
"delete": {
"summary": "litcli: `accounts remove`\nRemoveAccount removes the given account from the account database.",
@ -150,13 +230,55 @@
}
},
"definitions": {
"AccountsCreditAccountBody": {
"type": "object",
"properties": {
"account": {
"type": "object",
"properties": {
"label": {
"type": "string",
"description": "The label of the account."
}
},
"description": "The identifier of the account to credit.",
"title": "The identifier of the account to credit."
},
"amount": {
"type": "string",
"format": "uint64",
"description": "The amount by which the account's balance should be credited."
}
}
},
"AccountsDebitAccountBody": {
"type": "object",
"properties": {
"account": {
"type": "object",
"properties": {
"label": {
"type": "string",
"description": "The label of the account."
}
},
"description": "The identifier of the account to debit.",
"title": "The identifier of the account to debit."
},
"amount": {
"type": "string",
"format": "uint64",
"description": "The amount by which the account's balance should be debited."
}
}
},
"AccountsUpdateAccountBody": {
"type": "object",
"properties": {
"account_balance": {
"type": "string",
"format": "int64",
"description": "The new account balance to set. Set to -1 to not update the balance."
"description": "Deprecated, use the `litcli update credit` or `litcli update debit`\ncommands instead. The new account balance to set. Set to -1 to not\nupdate the balance."
},
"expiration_date": {
"type": "string",
@ -218,6 +340,19 @@
}
}
},
"litrpcAccountIdentifier": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The ID of the account."
},
"label": {
"type": "string",
"description": "The label of the account."
}
}
},
"litrpcAccountInvoice": {
"type": "object",
"properties": {
@ -280,6 +415,24 @@
}
}
},
"litrpcCreditAccountResponse": {
"type": "object",
"properties": {
"account": {
"$ref": "#/definitions/litrpcAccount",
"description": "The credited account."
}
}
},
"litrpcDebitAccountResponse": {
"type": "object",
"properties": {
"account": {
"$ref": "#/definitions/litrpcAccount",
"description": "The debited account."
}
}
},
"litrpcListAccountsResponse": {
"type": "object",
"properties": {

View file

@ -15,3 +15,9 @@ http:
get: "/v1/accounts"
- selector: litrpc.Accounts.RemoveAccount
delete: "/v1/accounts/{id}"
- selector: litrpc.Accounts.CreditAccount
post: "/v1/accounts/credit/{account.id}"
body: "*"
- selector: litrpc.Accounts.DebitAccount
post: "/v1/accounts/debit/{account.id}"
body: "*"

View file

@ -34,6 +34,14 @@ type AccountsClient interface {
// litcli: `accounts update`
// UpdateAccount updates an existing account in the account database.
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...grpc.CallOption) (*Account, error)
// litcli: `accounts update credit`
// CreditAccount increases the balance of an existing account in the account
// database.
CreditAccount(ctx context.Context, in *CreditAccountRequest, opts ...grpc.CallOption) (*CreditAccountResponse, error)
// litcli: `accounts update debit`
// DebitAccount decreases the balance of an existing account in the account
// database.
DebitAccount(ctx context.Context, in *DebitAccountRequest, opts ...grpc.CallOption) (*DebitAccountResponse, error)
// litcli: `accounts list`
// ListAccounts returns all accounts that are currently stored in the account
// database.
@ -72,6 +80,24 @@ func (c *accountsClient) UpdateAccount(ctx context.Context, in *UpdateAccountReq
return out, nil
}
func (c *accountsClient) CreditAccount(ctx context.Context, in *CreditAccountRequest, opts ...grpc.CallOption) (*CreditAccountResponse, error) {
out := new(CreditAccountResponse)
err := c.cc.Invoke(ctx, "/litrpc.Accounts/CreditAccount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountsClient) DebitAccount(ctx context.Context, in *DebitAccountRequest, opts ...grpc.CallOption) (*DebitAccountResponse, error) {
out := new(DebitAccountResponse)
err := c.cc.Invoke(ctx, "/litrpc.Accounts/DebitAccount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountsClient) ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error) {
out := new(ListAccountsResponse)
err := c.cc.Invoke(ctx, "/litrpc.Accounts/ListAccounts", in, out, opts...)
@ -119,6 +145,14 @@ type AccountsServer interface {
// litcli: `accounts update`
// UpdateAccount updates an existing account in the account database.
UpdateAccount(context.Context, *UpdateAccountRequest) (*Account, error)
// litcli: `accounts update credit`
// CreditAccount increases the balance of an existing account in the account
// database.
CreditAccount(context.Context, *CreditAccountRequest) (*CreditAccountResponse, error)
// litcli: `accounts update debit`
// DebitAccount decreases the balance of an existing account in the account
// database.
DebitAccount(context.Context, *DebitAccountRequest) (*DebitAccountResponse, error)
// litcli: `accounts list`
// ListAccounts returns all accounts that are currently stored in the account
// database.
@ -142,6 +176,12 @@ func (UnimplementedAccountsServer) CreateAccount(context.Context, *CreateAccount
func (UnimplementedAccountsServer) UpdateAccount(context.Context, *UpdateAccountRequest) (*Account, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateAccount not implemented")
}
func (UnimplementedAccountsServer) CreditAccount(context.Context, *CreditAccountRequest) (*CreditAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreditAccount not implemented")
}
func (UnimplementedAccountsServer) DebitAccount(context.Context, *DebitAccountRequest) (*DebitAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DebitAccount not implemented")
}
func (UnimplementedAccountsServer) ListAccounts(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListAccounts not implemented")
}
@ -200,6 +240,42 @@ func _Accounts_UpdateAccount_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _Accounts_CreditAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreditAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountsServer).CreditAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/litrpc.Accounts/CreditAccount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountsServer).CreditAccount(ctx, req.(*CreditAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Accounts_DebitAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DebitAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountsServer).DebitAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/litrpc.Accounts/DebitAccount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountsServer).DebitAccount(ctx, req.(*DebitAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Accounts_ListAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListAccountsRequest)
if err := dec(in); err != nil {
@ -269,6 +345,14 @@ var Accounts_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateAccount",
Handler: _Accounts_UpdateAccount_Handler,
},
{
MethodName: "CreditAccount",
Handler: _Accounts_CreditAccount_Handler,
},
{
MethodName: "DebitAccount",
Handler: _Accounts_DebitAccount_Handler,
},
{
MethodName: "ListAccounts",
Handler: _Accounts_ListAccounts_Handler,

View file

@ -28,6 +28,14 @@ var (
Entity: "account",
Action: "write",
}},
"/litrpc.Accounts/CreditAccount": {{
Entity: "account",
Action: "write",
}},
"/litrpc.Accounts/DebitAccount": {{
Entity: "account",
Action: "write",
}},
"/litrpc.Accounts/ListAccounts": {{
Entity: "account",
Action: "read",

View file

@ -25,6 +25,18 @@ service Accounts {
*/
rpc UpdateAccount (UpdateAccountRequest) returns (Account);
/* litcli: `accounts update credit`
CreditAccount increases the balance of an existing account in the account
database.
*/
rpc CreditAccount (CreditAccountRequest) returns (CreditAccountResponse);
/* litcli: `accounts update debit`
DebitAccount decreases the balance of an existing account in the account
database.
*/
rpc DebitAccount (DebitAccountRequest) returns (DebitAccountResponse);
/* litcli: `accounts list`
ListAccounts returns all accounts that are currently stored in the account
database.
@ -132,8 +144,12 @@ message UpdateAccountRequest {
// The ID of the account to update. Either the ID or the label must be set.
string id = 1;
// The new account balance to set. Set to -1 to not update the balance.
int64 account_balance = 2 [jstype = JS_STRING];
/*
Deprecated, use the `litcli update credit` or `litcli update debit`
commands instead. The new account balance to set. Set to -1 to not
update the balance.
*/
int64 account_balance = 2 [deprecated = true, jstype = JS_STRING];
/*
The new account expiry to set. Set to -1 to not update the expiry. Set to 0
@ -148,6 +164,36 @@ message UpdateAccountRequest {
string label = 4;
}
message CreditAccountRequest {
// The identifier of the account to credit.
AccountIdentifier account = 1;
/*
The amount by which the account's balance should be credited.
*/
uint64 amount = 2 [jstype = JS_STRING];
}
message CreditAccountResponse {
// The credited account.
Account account = 1;
}
message DebitAccountRequest {
// The identifier of the account to debit.
AccountIdentifier account = 1;
/*
The amount by which the account's balance should be debited.
*/
uint64 amount = 3 [jstype = JS_STRING];
}
message DebitAccountResponse {
// The debited account.
Account account = 1;
}
message ListAccountsRequest {
}
@ -186,3 +232,13 @@ message RemoveAccountRequest {
message RemoveAccountResponse {
}
message AccountIdentifier {
oneof identifier {
// The ID of the account.
string id = 1;
// The label of the account.
string label = 2;
}
}