From c1470ecc039da958348b8a13239a5a4ae120e24c Mon Sep 17 00:00:00 2001 From: naman <35531672+i-naman@users.noreply.github.com> Date: Thu, 4 Jun 2026 17:09:15 +0530 Subject: [PATCH] feat(types): align account struct with TxNonce and TxCountSent --- common/proto/accounts/accounts.pb.go | 32 ++++++++++++++++++++++------ common/proto/accounts/accounts.proto | 6 +++++- common/types/Block.go | 8 ++++--- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/common/proto/accounts/accounts.pb.go b/common/proto/accounts/accounts.pb.go index d2d9493..196261a 100644 --- a/common/proto/accounts/accounts.pb.go +++ b/common/proto/accounts/accounts.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.9 -// protoc v6.32.0 +// protoc-gen-go v1.36.11 +// protoc v7.35.0 // source: accounts/accounts.proto package accounts @@ -41,8 +41,11 @@ type Account struct { AccountType string `protobuf:"bytes,5,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` // "did" or "publickey" CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt int64 `protobuf:"varint,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + // Consensus Identity + TxNonce uint64 `protobuf:"varint,8,opt,name=tx_nonce,json=txNonce,proto3" json:"tx_nonce,omitempty"` + TxCountSent uint64 `protobuf:"varint,9,opt,name=tx_count_sent,json=txCountSent,proto3" json:"tx_count_sent,omitempty"` // Optional arbitrary metadata (maps from map[string]interface{} on the wire) - Metadata *structpb.Struct `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"` + Metadata *structpb.Struct `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -126,6 +129,20 @@ func (x *Account) GetUpdatedAt() int64 { return 0 } +func (x *Account) GetTxNonce() uint64 { + if x != nil { + return x.TxNonce + } + return 0 +} + +func (x *Account) GetTxCountSent() uint64 { + if x != nil { + return x.TxCountSent + } + return 0 +} + func (x *Account) GetMetadata() *structpb.Struct { if x != nil { return x.Metadata @@ -674,7 +691,7 @@ var File_accounts_accounts_proto protoreflect.FileDescriptor const file_accounts_accounts_proto_rawDesc = "" + "\n" + - "\x17accounts/accounts.proto\x12\baccounts\x1a\x1cgoogle/protobuf/struct.proto\x1a\rack/ack.proto\x1a\x11phase/phase.proto\x1a\x11tagging/tag.proto\x1a\x17checksum/checksum.proto\"\x8a\x02\n" + + "\x17accounts/accounts.proto\x12\baccounts\x1a\x1cgoogle/protobuf/struct.proto\x1a\rack/ack.proto\x1a\x11phase/phase.proto\x1a\x11tagging/tag.proto\x1a\x17checksum/checksum.proto\"\xc9\x02\n" + "\aAccount\x12\x1f\n" + "\vdid_address\x18\x01 \x01(\tR\n" + "didAddress\x12\x18\n" + @@ -685,8 +702,11 @@ const file_accounts_accounts_proto_rawDesc = "" + "\n" + "created_at\x18\x06 \x01(\x03R\tcreatedAt\x12\x1d\n" + "\n" + - "updated_at\x18\a \x01(\x03R\tupdatedAt\x123\n" + - "\bmetadata\x18\b \x01(\v2\x17.google.protobuf.StructR\bmetadata\"\x8a\x02\n" + + "updated_at\x18\a \x01(\x03R\tupdatedAt\x12\x19\n" + + "\btx_nonce\x18\b \x01(\x04R\atxNonce\x12\"\n" + + "\rtx_count_sent\x18\t \x01(\x04R\vtxCountSent\x123\n" + + "\bmetadata\x18\n" + + " \x01(\v2\x17.google.protobuf.StructR\bmetadata\"\x8a\x02\n" + "\x17AccountNonceSyncRequest\x12\x10\n" + "\x03art\x18\x01 \x01(\fR\x03art\x12\x1d\n" + "\n" + diff --git a/common/proto/accounts/accounts.proto b/common/proto/accounts/accounts.proto index c8048bf..256ff66 100644 --- a/common/proto/accounts/accounts.proto +++ b/common/proto/accounts/accounts.proto @@ -33,8 +33,12 @@ message Account { int64 created_at = 6; int64 updated_at = 7; + // Consensus Identity + uint64 tx_nonce = 8; + uint64 tx_count_sent = 9; + // Optional arbitrary metadata (maps from map[string]interface{} on the wire) - google.protobuf.Struct metadata = 8; + google.protobuf.Struct metadata = 10; } diff --git a/common/types/Block.go b/common/types/Block.go index e60b985..e44f1ec 100644 --- a/common/types/Block.go +++ b/common/types/Block.go @@ -138,9 +138,11 @@ type Account struct { DIDAddress string `json:"did,omitempty"` // New PublicKey based fields - Address common.Address `json:"address"` // Derived from PublicKey - Balance string `json:"balance,omitempty"` - Nonce uint64 `json:"nonce"` + Address common.Address `json:"address"` // Derived from PublicKey + Balance string `json:"balance,omitempty"` + Nonce uint64 `json:"nonce"` + TxNonce uint64 `json:"tx_nonce"` + TxCountSent uint64 `json:"tx_count_sent"` // Account metadata AccountType string `json:"account_type"` // "did" or "publickey"