diff --git a/go-sdk/client/client.go b/go-sdk/client/client.go index 51f502a..59d6ac2 100644 --- a/go-sdk/client/client.go +++ b/go-sdk/client/client.go @@ -10,8 +10,15 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding" + + vtgrpc "github.com/planetscale/vtprotobuf/codec/grpc" ) +func init() { + encoding.RegisterCodec(vtgrpc.Codec{}) +} + type Config struct { Endpoint string UseTLS bool diff --git a/go-sdk/go.mod b/go-sdk/go.mod index d87253a..9d73455 100644 --- a/go-sdk/go.mod +++ b/go-sdk/go.mod @@ -9,6 +9,7 @@ require ( github.com/consensys/gnark-crypto v0.9.1 github.com/holiman/uint256 v1.3.2 github.com/mr-tron/base58 v1.2.0 + github.com/planetscale/vtprotobuf v0.6.1-0.20240917153116-6f2963f01587 google.golang.org/grpc v1.76.0 google.golang.org/protobuf v1.36.10 ) diff --git a/go-sdk/go.sum b/go-sdk/go.sum index ebe09c2..b48e32a 100644 --- a/go-sdk/go.sum +++ b/go-sdk/go.sum @@ -43,13 +43,15 @@ github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFV github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20240917153116-6f2963f01587 h1:xzZOeCMQLA/W198ZkdVdt4EKFKJtS26B773zNU377ZY= +github.com/planetscale/vtprotobuf v0.6.1-0.20240917153116-6f2963f01587/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= diff --git a/go-sdk/proto/account.pb.go b/go-sdk/proto/account.pb.go index 690f46d..263a1b5 100644 --- a/go-sdk/proto/account.pb.go +++ b/go-sdk/proto/account.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 -// protoc v3.20.3 +// protoc-gen-go v1.36.8 +// protoc v6.32.0 // source: account.proto package proto @@ -435,7 +435,7 @@ const file_account_proto_rawDesc = "" + "\x0eAccountService\x12=\n" + "\n" + "GetAccount\x12\x16.mmn.GetAccountRequest\x1a\x17.mmn.GetAccountResponse\x12L\n" + - "\x0fGetCurrentNonce\x12\x1b.mmn.GetCurrentNonceRequest\x1a\x1c.mmn.GetCurrentNonceResponseB\x11Z\x0fmmn/proto;protob\x06proto3" + "\x0fGetCurrentNonce\x12\x1b.mmn.GetCurrentNonceRequest\x1a\x1c.mmn.GetCurrentNonceResponseB$Z\"github.com/mezonai/mmn/proto;protob\x06proto3" var ( file_account_proto_rawDescOnce sync.Once diff --git a/go-sdk/proto/account.proto b/go-sdk/proto/account.proto index ce3f321..13c08e6 100644 --- a/go-sdk/proto/account.proto +++ b/go-sdk/proto/account.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package mmn; -option go_package = "mmn/proto;proto"; +option go_package = "github.com/mezonai/mmn/proto;proto"; message GetAccountRequest { string address = 1; diff --git a/go-sdk/proto/account_grpc.pb.go b/go-sdk/proto/account_grpc.pb.go index 3c7e98b..26c65b5 100644 --- a/go-sdk/proto/account_grpc.pb.go +++ b/go-sdk/proto/account_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v3.20.3 +// - protoc v6.32.0 // source: account.proto package proto diff --git a/go-sdk/proto/account_vtproto.pb.go b/go-sdk/proto/account_vtproto.pb.go new file mode 100644 index 0000000..3fe29fd --- /dev/null +++ b/go-sdk/proto/account_vtproto.pb.go @@ -0,0 +1,1168 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.6.0 +// source: account.proto + +package proto + +import ( + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *GetAccountRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetAccountRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetAccountRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAccountResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetAccountResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetAccountResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Decimals != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Decimals)) + i-- + dAtA[i] = 0x20 + } + if m.Nonce != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x18 + } + if len(m.Balance) > 0 { + i -= len(m.Balance) + copy(dAtA[i:], m.Balance) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Balance))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxMeta) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TxMeta) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TxMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ExtraInfo) > 0 { + i -= len(m.ExtraInfo) + copy(dAtA[i:], m.ExtraInfo) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ExtraInfo))) + i-- + dAtA[i] = 0x3a + } + if m.Status != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x30 + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x28 + } + if m.Nonce != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x20 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x1a + } + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetCurrentNonceRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetCurrentNonceRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetCurrentNonceRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Tag) > 0 { + i -= len(m.Tag) + copy(dAtA[i:], m.Tag) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Tag))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetCurrentNonceResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetCurrentNonceResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetCurrentNonceResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x22 + } + if len(m.Tag) > 0 { + i -= len(m.Tag) + copy(dAtA[i:], m.Tag) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Tag))) + i-- + dAtA[i] = 0x1a + } + if m.Nonce != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAccountRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetAccountResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Balance) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Nonce)) + } + if m.Decimals != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Decimals)) + } + n += len(m.unknownFields) + return n +} + +func (m *TxMeta) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Nonce)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + if m.Status != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) + } + l = len(m.ExtraInfo) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetCurrentNonceRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Tag) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetCurrentNonceResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Nonce)) + } + l = len(m.Tag) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetAccountRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetAccountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAccountResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Balance = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxMeta) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Recipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= TxMeta_Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetCurrentNonceRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetCurrentNonceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetCurrentNonceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tag", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tag = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetCurrentNonceResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetCurrentNonceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetCurrentNonceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tag", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tag = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/go-sdk/proto/block.pb.go b/go-sdk/proto/block.pb.go index 208cec0..a77493a 100644 --- a/go-sdk/proto/block.pb.go +++ b/go-sdk/proto/block.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 -// protoc v3.20.3 +// protoc-gen-go v1.36.8 +// protoc v6.32.0 // source: block.proto package proto @@ -635,7 +635,7 @@ const file_block_proto_rawDesc = "" + "\fBlockService\x12?\n" + "\x0eGetBlockNumber\x12\x10.mmn.EmptyParams\x1a\x1b.mmn.GetBlockNumberResponse\x12O\n" + "\x10GetBlockByNumber\x12\x1c.mmn.GetBlockByNumberRequest\x1a\x1d.mmn.GetBlockByNumberResponse\x12L\n" + - "\x0fGetBlockByRange\x12\x1b.mmn.GetBlockByRangeRequest\x1a\x1c.mmn.GetBlockByRangeResponseB\x11Z\x0fmmn/proto;protob\x06proto3" + "\x0fGetBlockByRange\x12\x1b.mmn.GetBlockByRangeRequest\x1a\x1c.mmn.GetBlockByRangeResponseB$Z\"github.com/mezonai/mmn/proto;protob\x06proto3" var ( file_block_proto_rawDescOnce sync.Once diff --git a/go-sdk/proto/block.proto b/go-sdk/proto/block.proto index 1a2ffe7..fb2103b 100644 --- a/go-sdk/proto/block.proto +++ b/go-sdk/proto/block.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package mmn; -option go_package = "mmn/proto;proto"; +option go_package = "github.com/mezonai/mmn/proto;proto"; import "tx.proto"; message Entry { diff --git a/go-sdk/proto/block_grpc.pb.go b/go-sdk/proto/block_grpc.pb.go index e5fc4ba..2a6c25b 100644 --- a/go-sdk/proto/block_grpc.pb.go +++ b/go-sdk/proto/block_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v3.20.3 +// - protoc v6.32.0 // source: block.proto package proto diff --git a/go-sdk/proto/block_vtproto.pb.go b/go-sdk/proto/block_vtproto.pb.go new file mode 100644 index 0000000..8f34a26 --- /dev/null +++ b/go-sdk/proto/block_vtproto.pb.go @@ -0,0 +1,2111 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.6.0 +// source: block.proto + +package proto + +import ( + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *Entry) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Entry) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Entry) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TxHashes) > 0 { + for iNdEx := len(m.TxHashes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.TxHashes[iNdEx]) + copy(dAtA[i:], m.TxHashes[iNdEx]) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TxHashes[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.Transactions) > 0 { + for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Transactions[iNdEx]) + copy(dAtA[i:], m.Transactions[iNdEx]) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Transactions[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.NumHashes != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.NumHashes)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Block) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Block) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Block) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TransactionData) > 0 { + for iNdEx := len(m.TransactionData) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.TransactionData[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x42 + } + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x3a + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x32 + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x28 + } + if len(m.LeaderId) > 0 { + i -= len(m.LeaderId) + copy(dAtA[i:], m.LeaderId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.LeaderId))) + i-- + dAtA[i] = 0x22 + } + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Entries[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.PrevHash) > 0 { + i -= len(m.PrevHash) + copy(dAtA[i:], m.PrevHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PrevHash))) + i-- + dAtA[i] = 0x12 + } + if m.Slot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Slot)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EmptyParams) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EmptyParams) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *EmptyParams) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *GetBlockByNumberRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetBlockByNumberRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetBlockByNumberRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.BlockNumbers) > 0 { + var pksize2 int + for _, num := range m.BlockNumbers { + pksize2 += protohelpers.SizeOfVarint(uint64(num)) + } + i -= pksize2 + j1 := i + for _, num := range m.BlockNumbers { + for num >= 1<<7 { + dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA[j1] = uint8(num) + j1++ + } + i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize2)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetBlockNumberResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetBlockNumberResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetBlockNumberResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.BlockNumber != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetBlockByNumberResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetBlockByNumberResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetBlockByNumberResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Decimals != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Decimals)) + i-- + dAtA[i] = 0x20 + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x1a + } + if len(m.Blocks) > 0 { + for iNdEx := len(m.Blocks) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Blocks[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *BlockInfo) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlockInfo) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *BlockInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TransactionData) > 0 { + for iNdEx := len(m.TransactionData) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.TransactionData[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x3a + } + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x32 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x2a + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x20 + } + if len(m.LeaderId) > 0 { + i -= len(m.LeaderId) + copy(dAtA[i:], m.LeaderId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.LeaderId))) + i-- + dAtA[i] = 0x1a + } + if len(m.PrevHash) > 0 { + i -= len(m.PrevHash) + copy(dAtA[i:], m.PrevHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PrevHash))) + i-- + dAtA[i] = 0x12 + } + if m.Slot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Slot)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetBlockByRangeRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetBlockByRangeRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetBlockByRangeRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ToSlot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ToSlot)) + i-- + dAtA[i] = 0x10 + } + if m.FromSlot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.FromSlot)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetBlockByRangeResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetBlockByRangeResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetBlockByRangeResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Decimals != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Decimals)) + i-- + dAtA[i] = 0x20 + } + if len(m.Errors) > 0 { + for iNdEx := len(m.Errors) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Errors[iNdEx]) + copy(dAtA[i:], m.Errors[iNdEx]) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Errors[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.TotalBlocks != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TotalBlocks)) + i-- + dAtA[i] = 0x10 + } + if len(m.Blocks) > 0 { + for iNdEx := len(m.Blocks) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Blocks[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Entry) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NumHashes != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.NumHashes)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Transactions) > 0 { + for _, b := range m.Transactions { + l = len(b) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if len(m.TxHashes) > 0 { + for _, s := range m.TxHashes { + l = len(s) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Block) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Slot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Slot)) + } + l = len(m.PrevHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + l = len(m.LeaderId) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.TransactionData) > 0 { + for _, e := range m.TransactionData { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *EmptyParams) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *GetBlockByNumberRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlockNumbers) > 0 { + l = 0 + for _, e := range m.BlockNumbers { + l += protohelpers.SizeOfVarint(uint64(e)) + } + n += 1 + protohelpers.SizeOfVarint(uint64(l)) + l + } + n += len(m.unknownFields) + return n +} + +func (m *GetBlockNumberResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockNumber != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.BlockNumber)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetBlockByNumberResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Blocks) > 0 { + for _, e := range m.Blocks { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + l = len(m.Error) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Decimals != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Decimals)) + } + n += len(m.unknownFields) + return n +} + +func (m *BlockInfo) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Slot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Slot)) + } + l = len(m.PrevHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.LeaderId) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.TransactionData) > 0 { + for _, e := range m.TransactionData { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *GetBlockByRangeRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FromSlot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.FromSlot)) + } + if m.ToSlot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.ToSlot)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetBlockByRangeResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Blocks) > 0 { + for _, e := range m.Blocks { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if m.TotalBlocks != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.TotalBlocks)) + } + if len(m.Errors) > 0 { + for _, s := range m.Errors { + l = len(s) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if m.Decimals != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Decimals)) + } + n += len(m.unknownFields) + return n +} + +func (m *Entry) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Entry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumHashes", wireType) + } + m.NumHashes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumHashes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transactions = append(m.Transactions, make([]byte, postIndex-iNdEx)) + copy(m.Transactions[len(m.Transactions)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHashes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHashes = append(m.TxHashes, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Block) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Block: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Block: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) + } + m.Slot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Slot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrevHash = append(m.PrevHash[:0], dAtA[iNdEx:postIndex]...) + if m.PrevHash == nil { + m.PrevHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, &Entry{}) + if err := m.Entries[len(m.Entries)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaderId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LeaderId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransactionData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransactionData = append(m.TransactionData, &TransactionData{}) + if err := m.TransactionData[len(m.TransactionData)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EmptyParams) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EmptyParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EmptyParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetBlockByNumberRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetBlockByNumberRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetBlockByNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BlockNumbers = append(m.BlockNumbers, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.BlockNumbers) == 0 { + m.BlockNumbers = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BlockNumbers = append(m.BlockNumbers, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumbers", wireType) + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetBlockNumberResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetBlockNumberResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetBlockNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetBlockByNumberResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetBlockByNumberResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetBlockByNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Blocks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Blocks = append(m.Blocks, &Block{}) + if err := m.Blocks[len(m.Blocks)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockInfo) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlockInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) + } + m.Slot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Slot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrevHash = append(m.PrevHash[:0], dAtA[iNdEx:postIndex]...) + if m.PrevHash == nil { + m.PrevHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaderId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LeaderId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransactionData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransactionData = append(m.TransactionData, &TransactionData{}) + if err := m.TransactionData[len(m.TransactionData)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetBlockByRangeRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetBlockByRangeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetBlockByRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FromSlot", wireType) + } + m.FromSlot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FromSlot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ToSlot", wireType) + } + m.ToSlot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ToSlot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetBlockByRangeResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetBlockByRangeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetBlockByRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Blocks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Blocks = append(m.Blocks, &BlockInfo{}) + if err := m.Blocks[len(m.Blocks)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBlocks", wireType) + } + m.TotalBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalBlocks |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Errors", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Errors = append(m.Errors, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/go-sdk/proto/health.pb.go b/go-sdk/proto/health.pb.go index 96fe9c2..81be717 100644 --- a/go-sdk/proto/health.pb.go +++ b/go-sdk/proto/health.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.7 -// protoc v5.28.3 -// source: proto/health.proto +// protoc-gen-go v1.36.8 +// protoc v6.32.0 +// source: health.proto package proto @@ -57,11 +57,11 @@ func (x HealthCheckResponse_ServingStatus) String() string { } func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor { - return file_proto_health_proto_enumTypes[0].Descriptor() + return file_health_proto_enumTypes[0].Descriptor() } func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType { - return &file_proto_health_proto_enumTypes[0] + return &file_health_proto_enumTypes[0] } func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber { @@ -70,7 +70,7 @@ func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber { // Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead. func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return file_proto_health_proto_rawDescGZIP(), []int{1, 0} + return file_health_proto_rawDescGZIP(), []int{1, 0} } // Empty message for health check requests @@ -82,7 +82,7 @@ type Empty struct { func (x *Empty) Reset() { *x = Empty{} - mi := &file_proto_health_proto_msgTypes[0] + mi := &file_health_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94,7 +94,7 @@ func (x *Empty) String() string { func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_proto_health_proto_msgTypes[0] + mi := &file_health_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107,7 +107,7 @@ func (x *Empty) ProtoReflect() protoreflect.Message { // Deprecated: Use Empty.ProtoReflect.Descriptor instead. func (*Empty) Descriptor() ([]byte, []int) { - return file_proto_health_proto_rawDescGZIP(), []int{0} + return file_health_proto_rawDescGZIP(), []int{0} } // Health check response message @@ -130,7 +130,7 @@ type HealthCheckResponse struct { func (x *HealthCheckResponse) Reset() { *x = HealthCheckResponse{} - mi := &file_proto_health_proto_msgTypes[1] + mi := &file_health_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -142,7 +142,7 @@ func (x *HealthCheckResponse) String() string { func (*HealthCheckResponse) ProtoMessage() {} func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_health_proto_msgTypes[1] + mi := &file_health_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -155,7 +155,7 @@ func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return file_proto_health_proto_rawDescGZIP(), []int{1} + return file_health_proto_rawDescGZIP(), []int{1} } func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { @@ -235,11 +235,11 @@ func (x *HealthCheckResponse) GetErrorMessage() string { return "" } -var File_proto_health_proto protoreflect.FileDescriptor +var File_health_proto protoreflect.FileDescriptor -const file_proto_health_proto_rawDesc = "" + +const file_health_proto_rawDesc = "" + "\n" + - "\x12proto/health.proto\x12\x03mmn\"\a\n" + + "\fhealth.proto\x12\x03mmn\"\a\n" + "\x05Empty\"\xdb\x03\n" + "\x13HealthCheckResponse\x12>\n" + "\x06status\x18\x01 \x01(\x0e2&.mmn.HealthCheckResponse.ServingStatusR\x06status\x12\x17\n" + @@ -264,28 +264,28 @@ const file_proto_health_proto_rawDesc = "" + "\x05Check\x12\n" + ".mmn.Empty\x1a\x18.mmn.HealthCheckResponse\x12/\n" + "\x05Watch\x12\n" + - ".mmn.Empty\x1a\x18.mmn.HealthCheckResponse0\x01B\x11Z\x0fmmn/proto;protob\x06proto3" + ".mmn.Empty\x1a\x18.mmn.HealthCheckResponse0\x01B$Z\"github.com/mezonai/mmn/proto;protob\x06proto3" var ( - file_proto_health_proto_rawDescOnce sync.Once - file_proto_health_proto_rawDescData []byte + file_health_proto_rawDescOnce sync.Once + file_health_proto_rawDescData []byte ) -func file_proto_health_proto_rawDescGZIP() []byte { - file_proto_health_proto_rawDescOnce.Do(func() { - file_proto_health_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_health_proto_rawDesc), len(file_proto_health_proto_rawDesc))) +func file_health_proto_rawDescGZIP() []byte { + file_health_proto_rawDescOnce.Do(func() { + file_health_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_health_proto_rawDesc), len(file_health_proto_rawDesc))) }) - return file_proto_health_proto_rawDescData + return file_health_proto_rawDescData } -var file_proto_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_proto_health_proto_goTypes = []any{ +var file_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_health_proto_goTypes = []any{ (HealthCheckResponse_ServingStatus)(0), // 0: mmn.HealthCheckResponse.ServingStatus (*Empty)(nil), // 1: mmn.Empty (*HealthCheckResponse)(nil), // 2: mmn.HealthCheckResponse } -var file_proto_health_proto_depIdxs = []int32{ +var file_health_proto_depIdxs = []int32{ 0, // 0: mmn.HealthCheckResponse.status:type_name -> mmn.HealthCheckResponse.ServingStatus 1, // 1: mmn.HealthService.Check:input_type -> mmn.Empty 1, // 2: mmn.HealthService.Watch:input_type -> mmn.Empty @@ -298,27 +298,27 @@ var file_proto_health_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_proto_health_proto_init() } -func file_proto_health_proto_init() { - if File_proto_health_proto != nil { +func init() { file_health_proto_init() } +func file_health_proto_init() { + if File_health_proto != nil { return } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_health_proto_rawDesc), len(file_proto_health_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_health_proto_rawDesc), len(file_health_proto_rawDesc)), NumEnums: 1, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_health_proto_goTypes, - DependencyIndexes: file_proto_health_proto_depIdxs, - EnumInfos: file_proto_health_proto_enumTypes, - MessageInfos: file_proto_health_proto_msgTypes, + GoTypes: file_health_proto_goTypes, + DependencyIndexes: file_health_proto_depIdxs, + EnumInfos: file_health_proto_enumTypes, + MessageInfos: file_health_proto_msgTypes, }.Build() - File_proto_health_proto = out.File - file_proto_health_proto_goTypes = nil - file_proto_health_proto_depIdxs = nil + File_health_proto = out.File + file_health_proto_goTypes = nil + file_health_proto_depIdxs = nil } diff --git a/go-sdk/proto/health.proto b/go-sdk/proto/health.proto index 9dad9f1..46ee323 100644 --- a/go-sdk/proto/health.proto +++ b/go-sdk/proto/health.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package mmn; -option go_package = "mmn/proto;proto"; +option go_package = "github.com/mezonai/mmn/proto;proto"; // Empty message for health check requests message Empty { diff --git a/go-sdk/proto/health_grpc.pb.go b/go-sdk/proto/health_grpc.pb.go index df43133..0994e64 100644 --- a/go-sdk/proto/health_grpc.pb.go +++ b/go-sdk/proto/health_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.28.3 -// source: proto/health.proto +// - protoc v6.32.0 +// source: health.proto package proto @@ -167,5 +167,5 @@ var HealthService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "proto/health.proto", + Metadata: "health.proto", } diff --git a/go-sdk/proto/health_vtproto.pb.go b/go-sdk/proto/health_vtproto.pb.go new file mode 100644 index 0000000..dade21c --- /dev/null +++ b/go-sdk/proto/health_vtproto.pb.go @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.6.0 +// source: health.proto + +package proto + +import ( + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *Empty) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Empty) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Empty) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *HealthCheckResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheckResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *HealthCheckResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ErrorMessage) > 0 { + i -= len(m.ErrorMessage) + copy(dAtA[i:], m.ErrorMessage) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ErrorMessage))) + i-- + dAtA[i] = 0x5a + } + if m.Uptime != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Uptime)) + i-- + dAtA[i] = 0x50 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x4a + } + if m.IsFollower { + i-- + if m.IsFollower { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.IsLeader { + i-- + if m.IsLeader { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.MempoolSize != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.MempoolSize)) + i-- + dAtA[i] = 0x30 + } + if m.BlockHeight != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x28 + } + if m.CurrentSlot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CurrentSlot)) + i-- + dAtA[i] = 0x20 + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x18 + } + if len(m.NodeId) > 0 { + i -= len(m.NodeId) + copy(dAtA[i:], m.NodeId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.NodeId))) + i-- + dAtA[i] = 0x12 + } + if m.Status != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Empty) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *HealthCheckResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Status != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) + } + l = len(m.NodeId) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + if m.CurrentSlot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.CurrentSlot)) + } + if m.BlockHeight != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.BlockHeight)) + } + if m.MempoolSize != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.MempoolSize)) + } + if m.IsLeader { + n += 2 + } + if m.IsFollower { + n += 2 + } + l = len(m.Version) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Uptime != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Uptime)) + } + l = len(m.ErrorMessage) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Empty) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheckResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthCheckResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthCheckResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= HealthCheckResponse_ServingStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentSlot", wireType) + } + m.CurrentSlot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentSlot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MempoolSize", wireType) + } + m.MempoolSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MempoolSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsLeader", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsLeader = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsFollower", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsFollower = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Uptime", wireType) + } + m.Uptime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Uptime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/go-sdk/proto/tx.pb.go b/go-sdk/proto/tx.pb.go index c644fed..7bf355a 100644 --- a/go-sdk/proto/tx.pb.go +++ b/go-sdk/proto/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.8 -// protoc v6.31.1 +// protoc v6.32.0 // source: tx.proto package proto @@ -76,18 +76,19 @@ func (TransactionStatus) EnumDescriptor() ([]byte, []int) { // Transaction data structure for transactions type TransactionData struct { - state protoimpl.MessageState `protogen:"open.v1"` - TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` // sender address - Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` // recipient address - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` // amount - Nonce uint64 `protobuf:"varint,5,opt,name=nonce,proto3" json:"nonce,omitempty"` // nonce - Timestamp uint64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Status TransactionStatus `protobuf:"varint,7,opt,name=status,proto3,enum=mmn.TransactionStatus" json:"status,omitempty"` - TextData string `protobuf:"bytes,8,opt,name=text_data,json=textData,proto3" json:"text_data,omitempty"` - ExtraInfo string `protobuf:"bytes,9,opt,name=extra_info,json=extraInfo,proto3" json:"extra_info,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` // sender address + Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` // recipient address + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` // amount + Nonce uint64 `protobuf:"varint,5,opt,name=nonce,proto3" json:"nonce,omitempty"` // nonce + Timestamp uint64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Status TransactionStatus `protobuf:"varint,7,opt,name=status,proto3,enum=mmn.TransactionStatus" json:"status,omitempty"` + TextData string `protobuf:"bytes,8,opt,name=text_data,json=textData,proto3" json:"text_data,omitempty"` + ExtraInfo string `protobuf:"bytes,9,opt,name=extra_info,json=extraInfo,proto3" json:"extra_info,omitempty"` + TransactionType int32 `protobuf:"varint,10,opt,name=transaction_type,json=transactionType,proto3" json:"transaction_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *TransactionData) Reset() { @@ -183,6 +184,13 @@ func (x *TransactionData) GetExtraInfo() string { return "" } +func (x *TransactionData) GetTransactionType() int32 { + if x != nil { + return x.TransactionType + } + return 0 +} + type TxMsg struct { state protoimpl.MessageState `protogen:"open.v1"` Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` @@ -899,7 +907,7 @@ var File_tx_proto protoreflect.FileDescriptor const file_tx_proto_rawDesc = "" + "\n" + - "\btx.proto\x12\x03mmn\"\x98\x02\n" + + "\btx.proto\x12\x03mmn\"\xc3\x02\n" + "\x0fTransactionData\x12\x17\n" + "\atx_hash\x18\x01 \x01(\tR\x06txHash\x12\x16\n" + "\x06sender\x18\x02 \x01(\tR\x06sender\x12\x1c\n" + @@ -910,7 +918,9 @@ const file_tx_proto_rawDesc = "" + "\x06status\x18\a \x01(\x0e2\x16.mmn.TransactionStatusR\x06status\x12\x1b\n" + "\ttext_data\x18\b \x01(\tR\btextData\x12\x1d\n" + "\n" + - "extra_info\x18\t \x01(\tR\textraInfo\"\x8b\x02\n" + + "extra_info\x18\t \x01(\tR\textraInfo\x12)\n" + + "\x10transaction_type\x18\n" + + " \x01(\x05R\x0ftransactionType\"\x8b\x02\n" + "\x05TxMsg\x12\x12\n" + "\x04type\x18\x01 \x01(\x05R\x04type\x12\x16\n" + "\x06sender\x18\x02 \x01(\tR\x06sender\x12\x1c\n" + @@ -986,7 +996,7 @@ const file_tx_proto_rawDesc = "" + "\x05AddTx\x12\x10.mmn.SignedTxMsg\x1a\x12.mmn.AddTxResponse\x12@\n" + "\vGetTxByHash\x12\x17.mmn.GetTxByHashRequest\x1a\x18.mmn.GetTxByHashResponse\x12b\n" + "\x1aSubscribeTransactionStatus\x12&.mmn.SubscribeTransactionStatusRequest\x1a\x1a.mmn.TransactionStatusInfo0\x01\x12a\n" + - "\x16GetPendingTransactions\x12\".mmn.GetPendingTransactionsRequest\x1a#.mmn.GetPendingTransactionsResponseB\x11Z\x0fmmn/proto;protob\x06proto3" + "\x16GetPendingTransactions\x12\".mmn.GetPendingTransactionsRequest\x1a#.mmn.GetPendingTransactionsResponseB$Z\"github.com/mezonai/mmn/proto;protob\x06proto3" var ( file_tx_proto_rawDescOnce sync.Once diff --git a/go-sdk/proto/tx.proto b/go-sdk/proto/tx.proto index 604c8f5..1c3d654 100644 --- a/go-sdk/proto/tx.proto +++ b/go-sdk/proto/tx.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package mmn; -option go_package = "mmn/proto;proto"; +option go_package = "github.com/mezonai/mmn/proto;proto"; // Transaction status enum enum TransactionStatus { @@ -22,6 +22,7 @@ message TransactionData { TransactionStatus status = 7; string text_data = 8; string extra_info = 9; + int32 transaction_type = 10; } message TxMsg { diff --git a/go-sdk/proto/tx_grpc.pb.go b/go-sdk/proto/tx_grpc.pb.go index 5f07729..af6f77c 100644 --- a/go-sdk/proto/tx_grpc.pb.go +++ b/go-sdk/proto/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.31.1 +// - protoc v6.32.0 // source: tx.proto package proto diff --git a/go-sdk/proto/tx_vtproto.pb.go b/go-sdk/proto/tx_vtproto.pb.go new file mode 100644 index 0000000..3f1311a --- /dev/null +++ b/go-sdk/proto/tx_vtproto.pb.go @@ -0,0 +1,3117 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.6.0 +// source: tx.proto + +package proto + +import ( + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *TransactionData) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TransactionData) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TransactionData) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.TransactionType != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TransactionType)) + i-- + dAtA[i] = 0x50 + } + if len(m.ExtraInfo) > 0 { + i -= len(m.ExtraInfo) + copy(dAtA[i:], m.ExtraInfo) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ExtraInfo))) + i-- + dAtA[i] = 0x4a + } + if len(m.TextData) > 0 { + i -= len(m.TextData) + copy(dAtA[i:], m.TextData) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TextData))) + i-- + dAtA[i] = 0x42 + } + if m.Status != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x38 + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x30 + } + if m.Nonce != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x28 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TxMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TxMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ZkPub) > 0 { + i -= len(m.ZkPub) + copy(dAtA[i:], m.ZkPub) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ZkPub))) + i-- + dAtA[i] = 0x52 + } + if len(m.ZkProof) > 0 { + i -= len(m.ZkProof) + copy(dAtA[i:], m.ZkProof) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ZkProof))) + i-- + dAtA[i] = 0x4a + } + if len(m.ExtraInfo) > 0 { + i -= len(m.ExtraInfo) + copy(dAtA[i:], m.ExtraInfo) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ExtraInfo))) + i-- + dAtA[i] = 0x42 + } + if m.Nonce != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x38 + } + if len(m.TextData) > 0 { + i -= len(m.TextData) + copy(dAtA[i:], m.TextData) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TextData))) + i-- + dAtA[i] = 0x32 + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x28 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SignedTxMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SignedTxMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SignedTxMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.TxMsg != nil { + size, err := m.TxMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AddTxResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddTxResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *AddTxResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x1a + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x12 + } + if m.Ok { + i-- + if m.Ok { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetTxByHashRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTxByHashRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetTxByHashRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxInfo) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TxInfo) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TxInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x62 + } + if len(m.ExtraInfo) > 0 { + i -= len(m.ExtraInfo) + copy(dAtA[i:], m.ExtraInfo) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ExtraInfo))) + i-- + dAtA[i] = 0x5a + } + if len(m.ErrMsg) > 0 { + i -= len(m.ErrMsg) + copy(dAtA[i:], m.ErrMsg) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ErrMsg))) + i-- + dAtA[i] = 0x52 + } + if m.Status != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x48 + } + if len(m.Blockhash) > 0 { + i -= len(m.Blockhash) + copy(dAtA[i:], m.Blockhash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Blockhash))) + i-- + dAtA[i] = 0x42 + } + if m.Slot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Slot)) + i-- + dAtA[i] = 0x38 + } + if m.Nonce != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x30 + } + if len(m.TextData) > 0 { + i -= len(m.TextData) + copy(dAtA[i:], m.TextData) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TextData))) + i-- + dAtA[i] = 0x2a + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x20 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x1a + } + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetTxByHashResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTxByHashResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetTxByHashResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Decimals != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Decimals)) + i-- + dAtA[i] = 0x18 + } + if m.Tx != nil { + size, err := m.Tx.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TransactionStatusInfo) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TransactionStatusInfo) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TransactionStatusInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TextData) > 0 { + i -= len(m.TextData) + copy(dAtA[i:], m.TextData) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TextData))) + i-- + dAtA[i] = 0x52 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x4a + } + if len(m.ExtraInfo) > 0 { + i -= len(m.ExtraInfo) + copy(dAtA[i:], m.ExtraInfo) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ExtraInfo))) + i-- + dAtA[i] = 0x42 + } + if m.Timestamp != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x38 + } + if len(m.ErrorMessage) > 0 { + i -= len(m.ErrorMessage) + copy(dAtA[i:], m.ErrorMessage) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ErrorMessage))) + i-- + dAtA[i] = 0x32 + } + if m.Confirmations != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Confirmations)) + i-- + dAtA[i] = 0x28 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x22 + } + if m.BlockSlot != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BlockSlot)) + i-- + dAtA[i] = 0x18 + } + if m.Status != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubscribeTransactionStatusRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubscribeTransactionStatusRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SubscribeTransactionStatusRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *GetPendingTransactionsRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetPendingTransactionsRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetPendingTransactionsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *GetPendingTransactionsResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetPendingTransactionsResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetPendingTransactionsResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x1a + } + if len(m.PendingTxs) > 0 { + for iNdEx := len(m.PendingTxs) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.PendingTxs[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if m.TotalCount != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TotalCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TransactionData) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Nonce)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + if m.Status != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) + } + l = len(m.TextData) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.ExtraInfo) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.TransactionType != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.TransactionType)) + } + n += len(m.unknownFields) + return n +} + +func (m *TxMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Type)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + l = len(m.TextData) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Nonce)) + } + l = len(m.ExtraInfo) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.ZkProof) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.ZkPub) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SignedTxMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TxMsg != nil { + l = m.TxMsg.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *AddTxResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ok { + n += 2 + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetTxByHashRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *TxInfo) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + l = len(m.TextData) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Nonce)) + } + if m.Slot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Slot)) + } + l = len(m.Blockhash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Status != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) + } + l = len(m.ErrMsg) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.ExtraInfo) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetTxByHashResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Error) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Tx != nil { + l = m.Tx.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Decimals != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Decimals)) + } + n += len(m.unknownFields) + return n +} + +func (m *TransactionStatusInfo) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Status != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) + } + if m.BlockSlot != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.BlockSlot)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Confirmations != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Confirmations)) + } + l = len(m.ErrorMessage) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Timestamp)) + } + l = len(m.ExtraInfo) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.TextData) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SubscribeTransactionStatusRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *GetPendingTransactionsRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *GetPendingTransactionsResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TotalCount != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.TotalCount)) + } + if len(m.PendingTxs) > 0 { + for _, e := range m.PendingTxs { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + l = len(m.Error) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *TransactionData) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TransactionData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransactionData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Recipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= TransactionStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TextData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TransactionType", wireType) + } + m.TransactionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TransactionType |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Recipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TextData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ZkProof", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ZkProof = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ZkPub", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ZkPub = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SignedTxMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SignedTxMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignedTxMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TxMsg == nil { + m.TxMsg = &TxMsg{} + } + if err := m.TxMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AddTxResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ok", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Ok = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTxByHashRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTxByHashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTxByHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxInfo) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Recipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TextData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) + } + m.Slot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Slot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Blockhash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Blockhash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= TransactionStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrMsg", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrMsg = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTxByHashResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTxByHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTxByHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tx == nil { + m.Tx = &TxInfo{} + } + if err := m.Tx.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TransactionStatusInfo) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TransactionStatusInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransactionStatusInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= TransactionStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockSlot", wireType) + } + m.BlockSlot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockSlot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Confirmations", wireType) + } + m.Confirmations = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Confirmations |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TextData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubscribeTransactionStatusRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SubscribeTransactionStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubscribeTransactionStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetPendingTransactionsRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetPendingTransactionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetPendingTransactionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetPendingTransactionsResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetPendingTransactionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetPendingTransactionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalCount", wireType) + } + m.TotalCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingTxs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PendingTxs = append(m.PendingTxs, &TransactionData{}) + if err := m.PendingTxs[len(m.PendingTxs)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/mmn-client-js/package-lock.json b/mmn-client-js/package-lock.json index ecab412..1786e40 100644 --- a/mmn-client-js/package-lock.json +++ b/mmn-client-js/package-lock.json @@ -9,12 +9,18 @@ "version": "1.0.15", "license": "MIT", "dependencies": { + "@bufbuild/protobuf": "^1.10.0", + "@connectrpc/connect": "^1.6.0", + "@connectrpc/connect-web": "^1.6.0", "bip39": "^3.1.0", "bs58": "^5.0.0", "crypto-js": "^4.2.0", "tweetnacl": "^1.0.3" }, "devDependencies": { + "@bufbuild/buf": "^1.63.0", + "@bufbuild/protoc-gen-es": "^1.10.0", + "@connectrpc/protoc-gen-connect-es": "^1.6.0", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.0.1", "@rollup/plugin-node-resolve": "^15.2.3", @@ -60,6 +66,255 @@ "node": ">=6.9.0" } }, + "node_modules/@bufbuild/buf": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf/-/buf-1.63.0.tgz", + "integrity": "sha512-SvYWiCs9J8tX8qIh1haNJEwM0MmyauSFDDksHL4wtPjeXcEj+SMvWudIn8KdWoiFbNDY98phn4sqZQ4F6uViPQ==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "buf": "bin/buf", + "protoc-gen-buf-breaking": "bin/protoc-gen-buf-breaking", + "protoc-gen-buf-lint": "bin/protoc-gen-buf-lint" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@bufbuild/buf-darwin-arm64": "1.63.0", + "@bufbuild/buf-darwin-x64": "1.63.0", + "@bufbuild/buf-linux-aarch64": "1.63.0", + "@bufbuild/buf-linux-armv7": "1.63.0", + "@bufbuild/buf-linux-x64": "1.63.0", + "@bufbuild/buf-win32-arm64": "1.63.0", + "@bufbuild/buf-win32-x64": "1.63.0" + } + }, + "node_modules/@bufbuild/buf-darwin-arm64": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-arm64/-/buf-darwin-arm64-1.63.0.tgz", + "integrity": "sha512-Jpbz2mnNO+23E3TmDgLdbYuF+ozqsKu/ASvD37RjDgp9HtqQT+ciJMYOzqd/HdrGiM9tWYN1vhjl/gP/Y23lIw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-darwin-x64": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-x64/-/buf-darwin-x64-1.63.0.tgz", + "integrity": "sha512-HkVMm2cOBnTtT+AZFAQAUyrwcXtnvaBtVCW0ltBi5PzLp6CNgmkH97OAROKWiNPWrXJh5thdhdZBNjGPyTfX3w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-linux-aarch64": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-aarch64/-/buf-linux-aarch64-1.63.0.tgz", + "integrity": "sha512-vFeFKzC+PZSngct0bP3ASGCus7qhBPFxSfz6Hi+3a2zAajn857iJC3iPiX0tRlRIUTOHuj5NmOYxg9dhev0vDw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-linux-armv7": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-armv7/-/buf-linux-armv7-1.63.0.tgz", + "integrity": "sha512-XbrRiOfeY3d/GmR+WNnkcDo480V+cz/ecfj/Ay/JO/ZLe7quEQqHmJ6dMcIQN8QNFPZBKv0IVyhhljh8+0/gkA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-linux-x64": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-x64/-/buf-linux-x64-1.63.0.tgz", + "integrity": "sha512-78TsMWxQ7Rn4FJPN4QZZDM3NTS1U5ZCcwLYJmwOLJbHyfYnFiC1e91yL6sVfYrWXF1Pt9xJZU50yhmJZ+9AtmA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-win32-arm64": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-arm64/-/buf-win32-arm64-1.63.0.tgz", + "integrity": "sha512-sMZ63kK+MuxZVBFAh95Woly9QmeApohgQoWvO9ZppTzNXya7Kznz5lqa0B7f3zfDxgy2/DmOXILOMn3n8GoAww==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-win32-x64": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-x64/-/buf-win32-x64-1.63.0.tgz", + "integrity": "sha512-ooY4o3XPpvJ6BEOWB18pc52beeB9NdRRHMINuZ1oef3HNsFqtbv7DrPX9vm/mmOkzbTQDa8m7M8bjWjBO9ynkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/protobuf": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.10.0.tgz", + "integrity": "sha512-QDdVFLoN93Zjg36NoQPZfsVH9tZew7wKDKyV5qRdj8ntT4wQCOradQjRaTdwMhWUYsgKsvCINKKm87FdEk96Ag==", + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, + "node_modules/@bufbuild/protoc-gen-es": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.10.0.tgz", + "integrity": "sha512-zBYBsVT/ul4uZb6F+kD7/k4sWNHVVbEPfJwKi0FDr+9VJo8MKIofI6pkr5ksBLr4fi/74r+e/75Xi/0clL5dXg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@bufbuild/protobuf": "^1.10.0", + "@bufbuild/protoplugin": "1.10.0" + }, + "bin": { + "protoc-gen-es": "bin/protoc-gen-es" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@bufbuild/protobuf": "1.10.0" + }, + "peerDependenciesMeta": { + "@bufbuild/protobuf": { + "optional": true + } + } + }, + "node_modules/@bufbuild/protoplugin": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.10.0.tgz", + "integrity": "sha512-u6NE4vL0lw1+EK4/PiE/SQB7fKO4LRJNTEScIXVOi2x88K/c8WKc/k0KyEaA0asVBMpwekJQZGnRyj04ZtN5Gg==", + "dev": true, + "license": "(Apache-2.0 AND BSD-3-Clause)", + "dependencies": { + "@bufbuild/protobuf": "1.10.0", + "@typescript/vfs": "^1.4.0", + "typescript": "4.5.2" + } + }, + "node_modules/@bufbuild/protoplugin/node_modules/typescript": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@connectrpc/connect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.6.0.tgz", + "integrity": "sha512-0WEnWOTtYbjlfi71cjiTle8FdmzdD4A6D9N/9Ky6KlsHB2hPvh2FQ3jpzzXma09rZBbJezHF9vvy29qZqeWtwQ==", + "license": "Apache-2.0", + "peerDependencies": { + "@bufbuild/protobuf": "^1.10.0" + } + }, + "node_modules/@connectrpc/connect-web": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-1.6.0.tgz", + "integrity": "sha512-dyjkdSgNKoUSjNyXOkD4r/d5d8gJxgR1q8zinmCZDFKgRKPFZdjzHLRvd4k4s1Fw54R7Zam5aMMj/t7B0/4CIA==", + "license": "Apache-2.0", + "peerDependencies": { + "@bufbuild/protobuf": "^1.10.0", + "@connectrpc/connect": "1.6.0" + } + }, + "node_modules/@connectrpc/protoc-gen-connect-es": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@connectrpc/protoc-gen-connect-es/-/protoc-gen-connect-es-1.6.0.tgz", + "integrity": "sha512-/cyCdYmz6enZqyZpBM+WaaI2j8GN12/jXTzP2x7b500hywqRFl13wyjRgTJZ4qk04TTt62quvSgjefAZQ2YZ1g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@bufbuild/protobuf": "^1.10.0", + "@bufbuild/protoplugin": "^1.10.0" + }, + "bin": { + "protoc-gen-connect-es": "bin/protoc-gen-connect-es" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@bufbuild/protoc-gen-es": "^1.10.0", + "@connectrpc/connect": "1.6.0" + }, + "peerDependenciesMeta": { + "@bufbuild/protoc-gen-es": { + "optional": true + }, + "@connectrpc/connect": { + "optional": true + } + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.9.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", @@ -925,6 +1180,19 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript/vfs": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.6.2.tgz", + "integrity": "sha512-hoBwJwcbKHmvd2QVebiytN1aELvpk9B74B4L1mFm/XT1Q/VOYAWl2vQ9AWRFtQq8zmz6enTpfTV8WRc4ATjW/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1" + }, + "peerDependencies": { + "typescript": "*" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", @@ -2607,4 +2875,4 @@ } } } -} +} \ No newline at end of file diff --git a/mmn-client-js/package.json b/mmn-client-js/package.json index 5976456..3e1977c 100644 --- a/mmn-client-js/package.json +++ b/mmn-client-js/package.json @@ -39,12 +39,18 @@ }, "homepage": "https://github.com/mezonai/mmn-sdk/tree/main/mmn-client-js#readme", "dependencies": { + "@bufbuild/protobuf": "^1.10.0", + "@connectrpc/connect": "^1.6.0", + "@connectrpc/connect-web": "^1.6.0", "bip39": "^3.1.0", "bs58": "^5.0.0", "crypto-js": "^4.2.0", "tweetnacl": "^1.0.3" }, "devDependencies": { + "@bufbuild/buf": "^1.63.0", + "@bufbuild/protoc-gen-es": "^1.10.0", + "@connectrpc/protoc-gen-connect-es": "^1.6.0", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.0.1", "@rollup/plugin-node-resolve": "^15.2.3", diff --git a/mmn-client-js/proto/account.proto b/mmn-client-js/proto/account.proto new file mode 100644 index 0000000..13c08e6 --- /dev/null +++ b/mmn-client-js/proto/account.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +package mmn; + +option go_package = "github.com/mezonai/mmn/proto;proto"; + +message GetAccountRequest { + string address = 1; +} + +message GetAccountResponse { + string address = 1; + string balance = 2; + uint64 nonce = 3; + uint32 decimals = 4; // Number of fractional digits for amount formatting +} + +message TxMeta { + string sender = 1; // sender address + string recipient = 2; // recipient address + string amount = 3; // amount + uint64 nonce = 4; // nonce + uint64 timestamp = 5; + enum Status { + PENDING = 0; + CONFIRMED = 1; + FINALIZED = 2; + FAILED = 3; + } + Status status = 6; + string extra_info = 7; +} + +message GetCurrentNonceRequest { + string address = 1; + string tag = 2; // "latest" or "pending" +} + +message GetCurrentNonceResponse { + string address = 1; + uint64 nonce = 2; + string tag = 3; + string error = 4; +} + + +service AccountService { + rpc GetAccount (GetAccountRequest) returns (GetAccountResponse); + rpc GetCurrentNonce (GetCurrentNonceRequest) returns (GetCurrentNonceResponse); +} \ No newline at end of file diff --git a/mmn-client-js/proto/transaction_infinite.proto b/mmn-client-js/proto/transaction_infinite.proto new file mode 100644 index 0000000..f2a7205 --- /dev/null +++ b/mmn-client-js/proto/transaction_infinite.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package mmn; + +option go_package = "github.com/mezonai/mmn/proto;proto"; + +message TransactionInfiniteResponse { + TransactionInfiniteMeta meta = 1; + repeated TransactionItem data = 2; +} + +message TransactionInfiniteMeta { + string chain_id = 1; + int32 page = 2; + int32 limit = 3; + bool has_more = 4; + uint64 next_timestamp = 5; + string next_hash = 6; +} + +message TransactionItem { + string chain_id = 1; + string hash = 2; + uint64 nonce = 3; + string block_hash = 4; + string block_number = 5; + string from_address = 6; + string to_address = 7; + uint64 transaction_timestamp = 8; + string value = 9; + int32 transaction_type = 10; + optional uint64 status = 11; + string text_data = 12; + string extra_info = 13; + string transaction_extra_info_type = 14; +} + diff --git a/mmn-client-js/proto/tx.proto b/mmn-client-js/proto/tx.proto new file mode 100644 index 0000000..1c3d654 --- /dev/null +++ b/mmn-client-js/proto/tx.proto @@ -0,0 +1,105 @@ +syntax = "proto3"; +package mmn; + +option go_package = "github.com/mezonai/mmn/proto;proto"; + +// Transaction status enum +enum TransactionStatus { + PENDING = 0; // Transaction is in mempool + CONFIRMED = 1; // Transaction is included in a block + FINALIZED = 2; // Transaction is finalized (block has enough votes) + FAILED = 3; // Transaction failed validation +} + +// Transaction data structure for transactions +message TransactionData { + string tx_hash = 1; + string sender = 2; // sender address + string recipient = 3; // recipient address + string amount = 4; // amount + uint64 nonce = 5; // nonce + uint64 timestamp = 6; + TransactionStatus status = 7; + string text_data = 8; + string extra_info = 9; + int32 transaction_type = 10; +} + +message TxMsg { + int32 type = 1; + string sender = 2; + string recipient = 3; + string amount = 4; + uint64 timestamp = 5; + string text_data = 6; + uint64 nonce = 7; + string extra_info = 8; + string zk_proof = 9; + string zk_pub = 10; +} + +message SignedTxMsg { + TxMsg tx_msg = 1; + string signature = 2; +} + +message AddTxResponse { + bool ok = 1; + string tx_hash = 2; + string error = 3; +} + +message GetTxByHashRequest { + string tx_hash = 1; +} + +message TxInfo { + string sender = 1; + string recipient = 2; + string amount = 3; + uint64 timestamp = 4; + string text_data = 5; + uint64 nonce = 6; + uint64 slot = 7; + string blockhash = 8; + TransactionStatus status = 9; + string err_msg = 10; + string extra_info = 11; + string tx_hash = 12; +} + +message GetTxByHashResponse { + string error = 1; + TxInfo tx = 2; + uint32 decimals = 3; // Number of fractional digits for amount formatting +} + +message TransactionStatusInfo { + string tx_hash = 1; + TransactionStatus status = 2; + uint64 block_slot = 3; // Slot where transaction was included (if confirmed/finalized) + string block_hash = 4; // Hash of the block (if confirmed/finalized) + uint64 confirmations = 5; // Number of confirmations + string error_message = 6; // Error message if failed + uint64 timestamp = 7; // Timestamp when status was last updated + string extra_info = 8; // Extra info that was attached to transaction on creation + string amount = 9; // Transaction amount + string text_data = 10; // Transaction text data +} + +message SubscribeTransactionStatusRequest {} + +message GetPendingTransactionsRequest {} + +message GetPendingTransactionsResponse { + uint64 total_count = 1; + repeated TransactionData pending_txs = 2; + string error = 3; +} + +service TxService { + rpc AddTx(SignedTxMsg) returns (AddTxResponse); + rpc GetTxByHash(GetTxByHashRequest) returns (GetTxByHashResponse); + rpc SubscribeTransactionStatus(SubscribeTransactionStatusRequest) returns (stream TransactionStatusInfo); + rpc GetPendingTransactions(GetPendingTransactionsRequest) returns (GetPendingTransactionsResponse); +} diff --git a/mmn-client-js/rollup.config.cjs b/mmn-client-js/rollup.config.cjs index 3bef8c9..89cd7e1 100644 --- a/mmn-client-js/rollup.config.cjs +++ b/mmn-client-js/rollup.config.cjs @@ -7,7 +7,17 @@ const { dts } = require('rollup-plugin-dts'); const packageJson = require('./package.json'); // External dependencies that should not be bundled -const external = ['crypto', 'axios', 'bs58', 'bip39', 'tweetnacl']; +const external = [ + 'crypto', + 'axios', + 'bs58', + 'bip39', + 'tweetnacl', + 'crypto-js', + '@bufbuild/protobuf', + '@connectrpc/connect', + '@connectrpc/connect-web', +]; module.exports = [ // ES Module build diff --git a/mmn-client-js/src/gen/account_connect.ts b/mmn-client-js/src/gen/account_connect.ts new file mode 100644 index 0000000..c2c3736 --- /dev/null +++ b/mmn-client-js/src/gen/account_connect.ts @@ -0,0 +1,35 @@ +// @generated by protoc-gen-connect-es v1.6.0 with parameter "target=ts" +// @generated from file account.proto (package mmn, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { GetAccountRequest, GetAccountResponse, GetCurrentNonceRequest, GetCurrentNonceResponse } from "./account_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service mmn.AccountService + */ +export const AccountService = { + typeName: "mmn.AccountService", + methods: { + /** + * @generated from rpc mmn.AccountService.GetAccount + */ + getAccount: { + name: "GetAccount", + I: GetAccountRequest, + O: GetAccountResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc mmn.AccountService.GetCurrentNonce + */ + getCurrentNonce: { + name: "GetCurrentNonce", + I: GetCurrentNonceRequest, + O: GetCurrentNonceResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/mmn-client-js/src/gen/account_pb.ts b/mmn-client-js/src/gen/account_pb.ts new file mode 100644 index 0000000..06e5a45 --- /dev/null +++ b/mmn-client-js/src/gen/account_pb.ts @@ -0,0 +1,315 @@ +// @generated by protoc-gen-es v1.10.0 with parameter "target=ts" +// @generated from file account.proto (package mmn, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; + +/** + * @generated from message mmn.GetAccountRequest + */ +export class GetAccountRequest extends Message { + /** + * @generated from field: string address = 1; + */ + address = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetAccountRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "address", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetAccountRequest { + return new GetAccountRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetAccountRequest { + return new GetAccountRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetAccountRequest { + return new GetAccountRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetAccountRequest | PlainMessage | undefined, b: GetAccountRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetAccountRequest, a, b); + } +} + +/** + * @generated from message mmn.GetAccountResponse + */ +export class GetAccountResponse extends Message { + /** + * @generated from field: string address = 1; + */ + address = ""; + + /** + * @generated from field: string balance = 2; + */ + balance = ""; + + /** + * @generated from field: uint64 nonce = 3; + */ + nonce = protoInt64.zero; + + /** + * Number of fractional digits for amount formatting + * + * @generated from field: uint32 decimals = 4; + */ + decimals = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetAccountResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "address", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "balance", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 4, name: "decimals", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetAccountResponse { + return new GetAccountResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetAccountResponse { + return new GetAccountResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetAccountResponse { + return new GetAccountResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetAccountResponse | PlainMessage | undefined, b: GetAccountResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetAccountResponse, a, b); + } +} + +/** + * @generated from message mmn.TxMeta + */ +export class TxMeta extends Message { + /** + * sender address + * + * @generated from field: string sender = 1; + */ + sender = ""; + + /** + * recipient address + * + * @generated from field: string recipient = 2; + */ + recipient = ""; + + /** + * amount + * + * @generated from field: string amount = 3; + */ + amount = ""; + + /** + * nonce + * + * @generated from field: uint64 nonce = 4; + */ + nonce = protoInt64.zero; + + /** + * @generated from field: uint64 timestamp = 5; + */ + timestamp = protoInt64.zero; + + /** + * @generated from field: mmn.TxMeta.Status status = 6; + */ + status = TxMeta_Status.PENDING; + + /** + * @generated from field: string extra_info = 7; + */ + extraInfo = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TxMeta"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "sender", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "recipient", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 5, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "status", kind: "enum", T: proto3.getEnumType(TxMeta_Status) }, + { no: 7, name: "extra_info", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TxMeta { + return new TxMeta().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TxMeta { + return new TxMeta().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TxMeta { + return new TxMeta().fromJsonString(jsonString, options); + } + + static equals(a: TxMeta | PlainMessage | undefined, b: TxMeta | PlainMessage | undefined): boolean { + return proto3.util.equals(TxMeta, a, b); + } +} + +/** + * @generated from enum mmn.TxMeta.Status + */ +export enum TxMeta_Status { + /** + * @generated from enum value: PENDING = 0; + */ + PENDING = 0, + + /** + * @generated from enum value: CONFIRMED = 1; + */ + CONFIRMED = 1, + + /** + * @generated from enum value: FINALIZED = 2; + */ + FINALIZED = 2, + + /** + * @generated from enum value: FAILED = 3; + */ + FAILED = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(TxMeta_Status) +proto3.util.setEnumType(TxMeta_Status, "mmn.TxMeta.Status", [ + { no: 0, name: "PENDING" }, + { no: 1, name: "CONFIRMED" }, + { no: 2, name: "FINALIZED" }, + { no: 3, name: "FAILED" }, +]); + +/** + * @generated from message mmn.GetCurrentNonceRequest + */ +export class GetCurrentNonceRequest extends Message { + /** + * @generated from field: string address = 1; + */ + address = ""; + + /** + * "latest" or "pending" + * + * @generated from field: string tag = 2; + */ + tag = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetCurrentNonceRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "address", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "tag", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetCurrentNonceRequest { + return new GetCurrentNonceRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetCurrentNonceRequest { + return new GetCurrentNonceRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetCurrentNonceRequest { + return new GetCurrentNonceRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetCurrentNonceRequest | PlainMessage | undefined, b: GetCurrentNonceRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetCurrentNonceRequest, a, b); + } +} + +/** + * @generated from message mmn.GetCurrentNonceResponse + */ +export class GetCurrentNonceResponse extends Message { + /** + * @generated from field: string address = 1; + */ + address = ""; + + /** + * @generated from field: uint64 nonce = 2; + */ + nonce = protoInt64.zero; + + /** + * @generated from field: string tag = 3; + */ + tag = ""; + + /** + * @generated from field: string error = 4; + */ + error = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetCurrentNonceResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "address", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 3, name: "tag", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetCurrentNonceResponse { + return new GetCurrentNonceResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetCurrentNonceResponse { + return new GetCurrentNonceResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetCurrentNonceResponse { + return new GetCurrentNonceResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetCurrentNonceResponse | PlainMessage | undefined, b: GetCurrentNonceResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetCurrentNonceResponse, a, b); + } +} + diff --git a/mmn-client-js/src/gen/transaction_infinite_pb.ts b/mmn-client-js/src/gen/transaction_infinite_pb.ts new file mode 100644 index 0000000..5ef2a3f --- /dev/null +++ b/mmn-client-js/src/gen/transaction_infinite_pb.ts @@ -0,0 +1,233 @@ +// @generated by protoc-gen-es v1.10.0 with parameter "target=ts" +// @generated from file transaction_infinite.proto (package mmn, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; + +/** + * @generated from message mmn.TransactionInfiniteResponse + */ +export class TransactionInfiniteResponse extends Message { + /** + * @generated from field: mmn.TransactionInfiniteMeta meta = 1; + */ + meta?: TransactionInfiniteMeta; + + /** + * @generated from field: repeated mmn.TransactionItem data = 2; + */ + data: TransactionItem[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TransactionInfiniteResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "meta", kind: "message", T: TransactionInfiniteMeta }, + { no: 2, name: "data", kind: "message", T: TransactionItem, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransactionInfiniteResponse { + return new TransactionInfiniteResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransactionInfiniteResponse { + return new TransactionInfiniteResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransactionInfiniteResponse { + return new TransactionInfiniteResponse().fromJsonString(jsonString, options); + } + + static equals(a: TransactionInfiniteResponse | PlainMessage | undefined, b: TransactionInfiniteResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(TransactionInfiniteResponse, a, b); + } +} + +/** + * @generated from message mmn.TransactionInfiniteMeta + */ +export class TransactionInfiniteMeta extends Message { + /** + * @generated from field: string chain_id = 1; + */ + chainId = ""; + + /** + * @generated from field: int32 page = 2; + */ + page = 0; + + /** + * @generated from field: int32 limit = 3; + */ + limit = 0; + + /** + * @generated from field: bool has_more = 4; + */ + hasMore = false; + + /** + * @generated from field: uint64 next_timestamp = 5; + */ + nextTimestamp = protoInt64.zero; + + /** + * @generated from field: string next_hash = 6; + */ + nextHash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TransactionInfiniteMeta"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "chain_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "page", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 3, name: "limit", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 4, name: "has_more", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 5, name: "next_timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "next_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransactionInfiniteMeta { + return new TransactionInfiniteMeta().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransactionInfiniteMeta { + return new TransactionInfiniteMeta().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransactionInfiniteMeta { + return new TransactionInfiniteMeta().fromJsonString(jsonString, options); + } + + static equals(a: TransactionInfiniteMeta | PlainMessage | undefined, b: TransactionInfiniteMeta | PlainMessage | undefined): boolean { + return proto3.util.equals(TransactionInfiniteMeta, a, b); + } +} + +/** + * @generated from message mmn.TransactionItem + */ +export class TransactionItem extends Message { + /** + * @generated from field: string chain_id = 1; + */ + chainId = ""; + + /** + * @generated from field: string hash = 2; + */ + hash = ""; + + /** + * @generated from field: uint64 nonce = 3; + */ + nonce = protoInt64.zero; + + /** + * @generated from field: string block_hash = 4; + */ + blockHash = ""; + + /** + * @generated from field: string block_number = 5; + */ + blockNumber = ""; + + /** + * @generated from field: string from_address = 6; + */ + fromAddress = ""; + + /** + * @generated from field: string to_address = 7; + */ + toAddress = ""; + + /** + * @generated from field: uint64 transaction_timestamp = 8; + */ + transactionTimestamp = protoInt64.zero; + + /** + * @generated from field: string value = 9; + */ + value = ""; + + /** + * @generated from field: int32 transaction_type = 10; + */ + transactionType = 0; + + /** + * @generated from field: optional uint64 status = 11; + */ + status?: bigint; + + /** + * @generated from field: string text_data = 12; + */ + textData = ""; + + /** + * @generated from field: string extra_info = 13; + */ + extraInfo = ""; + + /** + * @generated from field: string transaction_extra_info_type = 14; + */ + transactionExtraInfoType = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TransactionItem"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "chain_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 4, name: "block_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "block_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "from_address", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "to_address", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "transaction_timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 9, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "transaction_type", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 11, name: "status", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 12, name: "text_data", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 13, name: "extra_info", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 14, name: "transaction_extra_info_type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransactionItem { + return new TransactionItem().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransactionItem { + return new TransactionItem().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransactionItem { + return new TransactionItem().fromJsonString(jsonString, options); + } + + static equals(a: TransactionItem | PlainMessage | undefined, b: TransactionItem | PlainMessage | undefined): boolean { + return proto3.util.equals(TransactionItem, a, b); + } +} + diff --git a/mmn-client-js/src/gen/tx_connect.ts b/mmn-client-js/src/gen/tx_connect.ts new file mode 100644 index 0000000..73aa2bf --- /dev/null +++ b/mmn-client-js/src/gen/tx_connect.ts @@ -0,0 +1,53 @@ +// @generated by protoc-gen-connect-es v1.6.0 with parameter "target=ts" +// @generated from file tx.proto (package mmn, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { AddTxResponse, GetPendingTransactionsRequest, GetPendingTransactionsResponse, GetTxByHashRequest, GetTxByHashResponse, SignedTxMsg, SubscribeTransactionStatusRequest, TransactionStatusInfo } from "./tx_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service mmn.TxService + */ +export const TxService = { + typeName: "mmn.TxService", + methods: { + /** + * @generated from rpc mmn.TxService.AddTx + */ + addTx: { + name: "AddTx", + I: SignedTxMsg, + O: AddTxResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc mmn.TxService.GetTxByHash + */ + getTxByHash: { + name: "GetTxByHash", + I: GetTxByHashRequest, + O: GetTxByHashResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc mmn.TxService.SubscribeTransactionStatus + */ + subscribeTransactionStatus: { + name: "SubscribeTransactionStatus", + I: SubscribeTransactionStatusRequest, + O: TransactionStatusInfo, + kind: MethodKind.ServerStreaming, + }, + /** + * @generated from rpc mmn.TxService.GetPendingTransactions + */ + getPendingTransactions: { + name: "GetPendingTransactions", + I: GetPendingTransactionsRequest, + O: GetPendingTransactionsResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/mmn-client-js/src/gen/tx_pb.ts b/mmn-client-js/src/gen/tx_pb.ts new file mode 100644 index 0000000..b720d76 --- /dev/null +++ b/mmn-client-js/src/gen/tx_pb.ts @@ -0,0 +1,743 @@ +// @generated by protoc-gen-es v1.10.0 with parameter "target=ts" +// @generated from file tx.proto (package mmn, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; + +/** + * Transaction status enum + * + * @generated from enum mmn.TransactionStatus + */ +export enum TransactionStatus { + /** + * Transaction is in mempool + * + * @generated from enum value: PENDING = 0; + */ + PENDING = 0, + + /** + * Transaction is included in a block + * + * @generated from enum value: CONFIRMED = 1; + */ + CONFIRMED = 1, + + /** + * Transaction is finalized (block has enough votes) + * + * @generated from enum value: FINALIZED = 2; + */ + FINALIZED = 2, + + /** + * Transaction failed validation + * + * @generated from enum value: FAILED = 3; + */ + FAILED = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(TransactionStatus) +proto3.util.setEnumType(TransactionStatus, "mmn.TransactionStatus", [ + { no: 0, name: "PENDING" }, + { no: 1, name: "CONFIRMED" }, + { no: 2, name: "FINALIZED" }, + { no: 3, name: "FAILED" }, +]); + +/** + * Transaction data structure for transactions + * + * @generated from message mmn.TransactionData + */ +export class TransactionData extends Message { + /** + * @generated from field: string tx_hash = 1; + */ + txHash = ""; + + /** + * sender address + * + * @generated from field: string sender = 2; + */ + sender = ""; + + /** + * recipient address + * + * @generated from field: string recipient = 3; + */ + recipient = ""; + + /** + * amount + * + * @generated from field: string amount = 4; + */ + amount = ""; + + /** + * nonce + * + * @generated from field: uint64 nonce = 5; + */ + nonce = protoInt64.zero; + + /** + * @generated from field: uint64 timestamp = 6; + */ + timestamp = protoInt64.zero; + + /** + * @generated from field: mmn.TransactionStatus status = 7; + */ + status = TransactionStatus.PENDING; + + /** + * @generated from field: string text_data = 8; + */ + textData = ""; + + /** + * @generated from field: string extra_info = 9; + */ + extraInfo = ""; + + /** + * @generated from field: int32 transaction_type = 10; + */ + transactionType = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TransactionData"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "tx_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "sender", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "recipient", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 7, name: "status", kind: "enum", T: proto3.getEnumType(TransactionStatus) }, + { no: 8, name: "text_data", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "extra_info", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "transaction_type", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransactionData { + return new TransactionData().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransactionData { + return new TransactionData().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransactionData { + return new TransactionData().fromJsonString(jsonString, options); + } + + static equals(a: TransactionData | PlainMessage | undefined, b: TransactionData | PlainMessage | undefined): boolean { + return proto3.util.equals(TransactionData, a, b); + } +} + +/** + * @generated from message mmn.TxMsg + */ +export class TxMsg extends Message { + /** + * @generated from field: int32 type = 1; + */ + type = 0; + + /** + * @generated from field: string sender = 2; + */ + sender = ""; + + /** + * @generated from field: string recipient = 3; + */ + recipient = ""; + + /** + * @generated from field: string amount = 4; + */ + amount = ""; + + /** + * @generated from field: uint64 timestamp = 5; + */ + timestamp = protoInt64.zero; + + /** + * @generated from field: string text_data = 6; + */ + textData = ""; + + /** + * @generated from field: uint64 nonce = 7; + */ + nonce = protoInt64.zero; + + /** + * @generated from field: string extra_info = 8; + */ + extraInfo = ""; + + /** + * @generated from field: string zk_proof = 9; + */ + zkProof = ""; + + /** + * @generated from field: string zk_pub = 10; + */ + zkPub = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TxMsg"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "type", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 2, name: "sender", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "recipient", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "text_data", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 8, name: "extra_info", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "zk_proof", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "zk_pub", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TxMsg { + return new TxMsg().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TxMsg { + return new TxMsg().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TxMsg { + return new TxMsg().fromJsonString(jsonString, options); + } + + static equals(a: TxMsg | PlainMessage | undefined, b: TxMsg | PlainMessage | undefined): boolean { + return proto3.util.equals(TxMsg, a, b); + } +} + +/** + * @generated from message mmn.SignedTxMsg + */ +export class SignedTxMsg extends Message { + /** + * @generated from field: mmn.TxMsg tx_msg = 1; + */ + txMsg?: TxMsg; + + /** + * @generated from field: string signature = 2; + */ + signature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.SignedTxMsg"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "tx_msg", kind: "message", T: TxMsg }, + { no: 2, name: "signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SignedTxMsg { + return new SignedTxMsg().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SignedTxMsg { + return new SignedTxMsg().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SignedTxMsg { + return new SignedTxMsg().fromJsonString(jsonString, options); + } + + static equals(a: SignedTxMsg | PlainMessage | undefined, b: SignedTxMsg | PlainMessage | undefined): boolean { + return proto3.util.equals(SignedTxMsg, a, b); + } +} + +/** + * @generated from message mmn.AddTxResponse + */ +export class AddTxResponse extends Message { + /** + * @generated from field: bool ok = 1; + */ + ok = false; + + /** + * @generated from field: string tx_hash = 2; + */ + txHash = ""; + + /** + * @generated from field: string error = 3; + */ + error = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.AddTxResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "ok", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 2, name: "tx_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AddTxResponse { + return new AddTxResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AddTxResponse { + return new AddTxResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AddTxResponse { + return new AddTxResponse().fromJsonString(jsonString, options); + } + + static equals(a: AddTxResponse | PlainMessage | undefined, b: AddTxResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(AddTxResponse, a, b); + } +} + +/** + * @generated from message mmn.GetTxByHashRequest + */ +export class GetTxByHashRequest extends Message { + /** + * @generated from field: string tx_hash = 1; + */ + txHash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetTxByHashRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "tx_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetTxByHashRequest { + return new GetTxByHashRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetTxByHashRequest { + return new GetTxByHashRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetTxByHashRequest { + return new GetTxByHashRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetTxByHashRequest | PlainMessage | undefined, b: GetTxByHashRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetTxByHashRequest, a, b); + } +} + +/** + * @generated from message mmn.TxInfo + */ +export class TxInfo extends Message { + /** + * @generated from field: string sender = 1; + */ + sender = ""; + + /** + * @generated from field: string recipient = 2; + */ + recipient = ""; + + /** + * @generated from field: string amount = 3; + */ + amount = ""; + + /** + * @generated from field: uint64 timestamp = 4; + */ + timestamp = protoInt64.zero; + + /** + * @generated from field: string text_data = 5; + */ + textData = ""; + + /** + * @generated from field: uint64 nonce = 6; + */ + nonce = protoInt64.zero; + + /** + * @generated from field: uint64 slot = 7; + */ + slot = protoInt64.zero; + + /** + * @generated from field: string blockhash = 8; + */ + blockhash = ""; + + /** + * @generated from field: mmn.TransactionStatus status = 9; + */ + status = TransactionStatus.PENDING; + + /** + * @generated from field: string err_msg = 10; + */ + errMsg = ""; + + /** + * @generated from field: string extra_info = 11; + */ + extraInfo = ""; + + /** + * @generated from field: string tx_hash = 12; + */ + txHash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TxInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "sender", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "recipient", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 5, name: "text_data", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "nonce", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 7, name: "slot", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 8, name: "blockhash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "status", kind: "enum", T: proto3.getEnumType(TransactionStatus) }, + { no: 10, name: "err_msg", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "extra_info", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "tx_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TxInfo { + return new TxInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TxInfo { + return new TxInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TxInfo { + return new TxInfo().fromJsonString(jsonString, options); + } + + static equals(a: TxInfo | PlainMessage | undefined, b: TxInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(TxInfo, a, b); + } +} + +/** + * @generated from message mmn.GetTxByHashResponse + */ +export class GetTxByHashResponse extends Message { + /** + * @generated from field: string error = 1; + */ + error = ""; + + /** + * @generated from field: mmn.TxInfo tx = 2; + */ + tx?: TxInfo; + + /** + * Number of fractional digits for amount formatting + * + * @generated from field: uint32 decimals = 3; + */ + decimals = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetTxByHashResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "tx", kind: "message", T: TxInfo }, + { no: 3, name: "decimals", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetTxByHashResponse { + return new GetTxByHashResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetTxByHashResponse { + return new GetTxByHashResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetTxByHashResponse { + return new GetTxByHashResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetTxByHashResponse | PlainMessage | undefined, b: GetTxByHashResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetTxByHashResponse, a, b); + } +} + +/** + * @generated from message mmn.TransactionStatusInfo + */ +export class TransactionStatusInfo extends Message { + /** + * @generated from field: string tx_hash = 1; + */ + txHash = ""; + + /** + * @generated from field: mmn.TransactionStatus status = 2; + */ + status = TransactionStatus.PENDING; + + /** + * Slot where transaction was included (if confirmed/finalized) + * + * @generated from field: uint64 block_slot = 3; + */ + blockSlot = protoInt64.zero; + + /** + * Hash of the block (if confirmed/finalized) + * + * @generated from field: string block_hash = 4; + */ + blockHash = ""; + + /** + * Number of confirmations + * + * @generated from field: uint64 confirmations = 5; + */ + confirmations = protoInt64.zero; + + /** + * Error message if failed + * + * @generated from field: string error_message = 6; + */ + errorMessage = ""; + + /** + * Timestamp when status was last updated + * + * @generated from field: uint64 timestamp = 7; + */ + timestamp = protoInt64.zero; + + /** + * Extra info that was attached to transaction on creation + * + * @generated from field: string extra_info = 8; + */ + extraInfo = ""; + + /** + * Transaction amount + * + * @generated from field: string amount = 9; + */ + amount = ""; + + /** + * Transaction text data + * + * @generated from field: string text_data = 10; + */ + textData = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.TransactionStatusInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "tx_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "status", kind: "enum", T: proto3.getEnumType(TransactionStatus) }, + { no: 3, name: "block_slot", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 4, name: "block_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "confirmations", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "error_message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 8, name: "extra_info", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "text_data", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransactionStatusInfo { + return new TransactionStatusInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransactionStatusInfo { + return new TransactionStatusInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransactionStatusInfo { + return new TransactionStatusInfo().fromJsonString(jsonString, options); + } + + static equals(a: TransactionStatusInfo | PlainMessage | undefined, b: TransactionStatusInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(TransactionStatusInfo, a, b); + } +} + +/** + * @generated from message mmn.SubscribeTransactionStatusRequest + */ +export class SubscribeTransactionStatusRequest extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.SubscribeTransactionStatusRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SubscribeTransactionStatusRequest { + return new SubscribeTransactionStatusRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SubscribeTransactionStatusRequest { + return new SubscribeTransactionStatusRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SubscribeTransactionStatusRequest { + return new SubscribeTransactionStatusRequest().fromJsonString(jsonString, options); + } + + static equals(a: SubscribeTransactionStatusRequest | PlainMessage | undefined, b: SubscribeTransactionStatusRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(SubscribeTransactionStatusRequest, a, b); + } +} + +/** + * @generated from message mmn.GetPendingTransactionsRequest + */ +export class GetPendingTransactionsRequest extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetPendingTransactionsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetPendingTransactionsRequest { + return new GetPendingTransactionsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetPendingTransactionsRequest { + return new GetPendingTransactionsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetPendingTransactionsRequest { + return new GetPendingTransactionsRequest().fromJsonString(jsonString, options); + } + + static equals(a: GetPendingTransactionsRequest | PlainMessage | undefined, b: GetPendingTransactionsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GetPendingTransactionsRequest, a, b); + } +} + +/** + * @generated from message mmn.GetPendingTransactionsResponse + */ +export class GetPendingTransactionsResponse extends Message { + /** + * @generated from field: uint64 total_count = 1; + */ + totalCount = protoInt64.zero; + + /** + * @generated from field: repeated mmn.TransactionData pending_txs = 2; + */ + pendingTxs: TransactionData[] = []; + + /** + * @generated from field: string error = 3; + */ + error = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mmn.GetPendingTransactionsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "total_count", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 2, name: "pending_txs", kind: "message", T: TransactionData, repeated: true }, + { no: 3, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GetPendingTransactionsResponse { + return new GetPendingTransactionsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GetPendingTransactionsResponse { + return new GetPendingTransactionsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GetPendingTransactionsResponse { + return new GetPendingTransactionsResponse().fromJsonString(jsonString, options); + } + + static equals(a: GetPendingTransactionsResponse | PlainMessage | undefined, b: GetPendingTransactionsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GetPendingTransactionsResponse, a, b); + } +} + diff --git a/mmn-client-js/src/indexer-client.ts b/mmn-client-js/src/indexer-client.ts index 1d8a93b..c9b7f2a 100644 --- a/mmn-client-js/src/indexer-client.ts +++ b/mmn-client-js/src/indexer-client.ts @@ -1,11 +1,16 @@ import { IndexerClientConfig, ListTransactionResponse, + Meta, Transaction, TransactionDetailResponse, WalletDetail, WalletDetailResponse, } from './types'; +import { + TransactionInfiniteResponse, + TransactionItem, +} from './gen/transaction_infinite_pb'; const API_FILTER_PARAMS = { ALL: 0, @@ -13,6 +18,67 @@ const API_FILTER_PARAMS = { RECEIVED: 1, }; +/** + * Convert protobuf TransactionItem to Transaction type + */ +function mapTransactionItemToTransaction(item: TransactionItem): Transaction { + const transaction: Transaction = { + chain_id: item.chainId, + hash: item.hash, + nonce: Number(item.nonce), + block_hash: item.blockHash, + block_number: Number(item.blockNumber), + block_timestamp: 0, + transaction_index: 0, + from_address: item.fromAddress, + to_address: item.toAddress, + value: item.value, + gas: 0, + gas_price: '0', + data: '', + function_selector: '', + max_fee_per_gas: '0', + max_priority_fee_per_gas: '0', + transaction_type: item.transactionType, + r: '', + s: '', + v: '', + transaction_timestamp: Number(item.transactionTimestamp), + text_data: item.textData, + extra_info: item.extraInfo, + }; + + if (item.status !== undefined) { + transaction.status = Number(item.status); + } + + return transaction; +} + +/** + * Convert protobuf TransactionInfiniteResponse to ListTransactionResponse + */ +function mapProtoToListTransactionResponse( + protoResponse: TransactionInfiniteResponse +): ListTransactionResponse { + const meta: Meta = { + chain_id: Number(protoResponse.meta?.chainId) || 0, + page: protoResponse.meta?.page || 0, + limit: protoResponse.meta?.limit || 0, + has_more: protoResponse.meta?.hasMore || false, + next_hash: protoResponse.meta?.nextHash || '', + }; + + // Only set next_timestamp if it exists + if (protoResponse.meta?.nextTimestamp) { + meta.next_timestamp = protoResponse.meta.nextTimestamp.toString(); + } + + const data: Transaction[] = protoResponse.data.map(mapTransactionItemToTransaction); + + return { meta, data }; +} + export class IndexerClient { private endpoint: string; private chainId: string; @@ -145,8 +211,66 @@ export class IndexerClient { break; } - const path = `${this.chainId}/transactions/infinite`; - return this.makeRequest("GET", path, params); + // Build URL with query params + const path = `v2/${this.chainId}/transactions/infinite`; + let url = `${this.endpoint}/${path}`; + if (Object.keys(params).length > 0) { + const searchParams = new URLSearchParams(); + Object.entries(params).forEach(([key, value]) => { + searchParams.append(key, String(value)); + }); + url += `?${searchParams.toString()}`; + } + + // Create AbortController for timeout + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), this.timeout); + + try { + const response = await fetch(url, { + method: 'GET', + mode: 'cors', + credentials: 'omit', + signal: controller.signal, + headers: { + Accept: 'application/x-protobuf', + ...this.headers, + }, + }); + clearTimeout(timeoutId); + + // Handle HTTP errors - server returns JSON for errors + if (!response.ok) { + try { + const errorData = await response.json(); + throw new Error( + errorData.message || + errorData.error || + `HTTP ${response.status}: ${response.statusText}` + ); + } catch (jsonError) { + if (jsonError instanceof Error && jsonError.message.includes('HTTP')) { + throw jsonError; + } + throw new Error(`HTTP ${response.status}: ${response.statusText}`); + } + } + + // Parse binary protobuf response + const arrayBuffer = await response.arrayBuffer(); + const uint8Array = new Uint8Array(arrayBuffer); + const protoResponse = TransactionInfiniteResponse.fromBinary(uint8Array); + return mapProtoToListTransactionResponse(protoResponse); + } catch (error) { + clearTimeout(timeoutId); + if (error instanceof Error) { + if (error.name === 'AbortError') { + throw new Error(`Request timeout after ${this.timeout}ms`); + } + throw error; + } + throw new Error('Request failed'); + } } async getTransactionByWallet( diff --git a/mmn-client-js/src/mmn-client.ts b/mmn-client-js/src/mmn-client.ts index 13f9b96..6165541 100644 --- a/mmn-client-js/src/mmn-client.ts +++ b/mmn-client-js/src/mmn-client.ts @@ -3,20 +3,30 @@ import bs58 from 'bs58'; import nacl from 'tweetnacl'; import CryptoJS from 'crypto-js'; +import { createClient, type Client } from '@connectrpc/connect'; +import { createConnectTransport } from '@connectrpc/connect-web'; import { AddTxResponse, ExtraInfo, GetAccountByAddressResponse, GetCurrentNonceResponse, IEphemeralKeyPair, - JsonRpcRequest, - JsonRpcResponse, MmnClientConfig, SendTransactionRequest, SendTransactionBase, SignedTx, TxMsg, } from './types'; +import { AccountService } from './gen/account_connect.js'; +import { TxService } from './gen/tx_connect.js'; +import { + GetAccountRequest, + GetCurrentNonceRequest, +} from './gen/account_pb.js'; +import { + SignedTxMsg, + TxMsg as ProtoTxMsg, +} from './gen/tx_pb.js'; // Buffer polyfill for mobile environments class BufferPolyfill { @@ -156,73 +166,47 @@ const DECIMALS = 6; export class MmnClient { private config: MmnClientConfig; - private requestId = 0; + private accountClient: Client; + private txClient: Client; constructor(config: MmnClientConfig) { this.config = { timeout: 30000, - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, + headers: {}, ...config, }; - } - - private async makeRequest(method: string, params?: unknown): Promise { - const request: JsonRpcRequest = { - jsonrpc: '2.0', - method, - params, - id: ++this.requestId, - }; - - // Create AbortController for timeout - const controller = new AbortController(); - const timeoutId = setTimeout( - () => controller.abort(), - this.config.timeout || 30000 - ); - try { - const requestOptions: RequestInit = { - method: 'POST', - mode: 'cors', - credentials: 'omit', - signal: controller.signal, - headers: this.config.headers || {}, - body: JSON.stringify(request), - }; - - const response = await fetch(this.config.baseUrl, requestOptions); - clearTimeout(timeoutId); - - if (!response.ok) { - throw new Error(`HTTP ${response.status}: ${response.statusText}`); - } - - const result: JsonRpcResponse = await response.json(); - - if (result.error) { - throw new Error( - `JSON-RPC Error ${result.error.code}: ${result.error.message}` - ); - } + // Create ConnectRPC transport with binary format + const transport = createConnectTransport({ + baseUrl: this.config.baseUrl, + useBinaryFormat: true, + }); - return result.result as T; - } catch (error) { - clearTimeout(timeoutId); + // Initialize gRPC clients + this.accountClient = createClient(AccountService, transport); + this.txClient = createClient(TxService, transport); + } - if (error instanceof Error) { - if (error.name === 'AbortError') { - throw new Error( - `Request timeout after ${this.config.timeout || 30000}ms` - ); - } - throw error; - } - throw new Error('Unknown error occurred'); - } + /** + * Map SignedTx (old format, snake_case) to SignedTxMsg (Proto, camelCase) + */ + private mapSignedTxToProto(signedTx: SignedTx): SignedTxMsg { + const txMsg = signedTx.tx_msg; + return new SignedTxMsg({ + txMsg: new ProtoTxMsg({ + type: txMsg.type, + sender: txMsg.sender, + recipient: txMsg.recipient, + amount: txMsg.amount, + timestamp: BigInt(txMsg.timestamp), + textData: txMsg.text_data, + nonce: BigInt(txMsg.nonce), + extraInfo: txMsg.extra_info, + zkProof: txMsg.zk_proof, + zkPub: txMsg.zk_pub, + }), + signature: signedTx.signature, + }); } /** @@ -592,10 +576,30 @@ export class MmnClient { } /** - * Add a signed transaction to the blockchain + * Add a signed transaction to the blockchain using ConnectRPC */ private async addTx(signedTx: SignedTx): Promise { - return this.makeRequest('tx.addtx', signedTx); + try { + // Map old SignedTx format to Proto SignedTxMsg + const protoSignedTx = this.mapSignedTxToProto(signedTx); + + // Call gRPC service + const response = await this.txClient.addTx(protoSignedTx); + + // Map Proto response back to old interface format + return { + ok: response.ok, + tx_hash: response.txHash, + error: response.error, + }; + } catch (error) { + // Return error in the old format + return { + ok: false, + tx_hash: '', + error: error instanceof Error ? error.message : 'Unknown RPC error', + }; + } } /** @@ -649,36 +653,61 @@ export class MmnClient { } /** - * Get current nonce for an account + * Get current nonce for an account using ConnectRPC */ async getCurrentNonce( userId: string, tag: 'latest' | 'pending' = 'latest' ): Promise { - const address = this.getAddressFromUserId(userId); - return this.makeRequest( - 'account.getcurrentnonce', - { address, tag } - ); - } + try { + const address = this.getAddressFromUserId(userId); + const request = new GetCurrentNonceRequest({ address, tag }); + const response = await this.accountClient.getCurrentNonce(request); - async getCurrentNonceByAddress( - address: string, - tag: 'latest' | 'pending' = 'latest' - ): Promise { - return this.makeRequest( - 'account.getcurrentnonce', - { address, tag } - ); + // Map Proto response to old interface (bigint -> number) + return { + address: response.address, + nonce: Number(response.nonce), + tag: response.tag, + error: response.error, + }; + } catch (error) { + return { + address: '', + nonce: 0, + tag: '', + error: error instanceof Error ? error.message : 'Unknown RPC error', + }; + } } + /** + * Get account details by user ID using ConnectRPC + */ async getAccountByUserId( userId: string ): Promise { - const address = this.getAddressFromUserId(userId); - return this.makeRequest('account.getaccount', { - address, - }); + try { + const address = this.getAddressFromUserId(userId); + const request = new GetAccountRequest({ address }); + const response = await this.accountClient.getAccount(request); + + // Map Proto response to old interface (bigint -> number) + return { + address: response.address, + balance: response.balance, + nonce: Number(response.nonce), + decimals: response.decimals, + }; + } catch (error) { + // Return default error response matching old interface + return { + address: '', + balance: '0', + nonce: 0, + decimals: DECIMALS, + }; + } } scaleAmountToDecimals(