Skip to content

Commit

Permalink
grpc: Fixing unknown transction type (#431)
Browse files Browse the repository at this point in the history
* fixing #430 and #428
  • Loading branch information
b00f authored Nov 19, 2022
1 parent 2f98020 commit 0bb6715
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 187 deletions.
2 changes: 1 addition & 1 deletion wallet/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (h *history) addActivity(addr string, amount int64, trx *pactus.GetTransact
h.Transactions[act.TxID] = transaction{
BlockHeight: trx.BlockHeight,
BlockTime: trx.BlockTime,
PayloadType: payload.Type(trx.Transaction.Type).String(),
PayloadType: payload.Type(trx.Transaction.PayloadType).String(),
Data: hex.EncodeToString(trx.Transaction.Data),
}
}
Expand Down
6 changes: 6 additions & 0 deletions www/grpc/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ func TestGetBlock(t *testing.T) {
assert.Equal(t, res.Data, data)
assert.NotEmpty(t, res.Header)
assert.NotEmpty(t, res.Txs)
for i, trx := range res.Txs {
data, _ := b.Transactions()[i].Bytes()
assert.Equal(t, b.Transactions()[i].ID().Bytes(), trx.Id)
assert.Equal(t, b.Transactions()[i].Signature().Bytes(), trx.Signature)
assert.Equal(t, data, trx.Data)
}
})

assert.Nil(t, conn.Close(), "Error closing connection")
Expand Down
16 changes: 8 additions & 8 deletions www/grpc/gen/dart/transaction.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ class TransactionInfo extends $pb.GeneratedMessage {
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sequence', $pb.PbFieldType.O3)
..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'value')
..aInt64(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fee')
..e<PayloadType>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'Type', $pb.PbFieldType.OE, protoName: 'Type', defaultOrMaker: PayloadType.UNKNOWN, valueOf: PayloadType.valueOf, enumValues: PayloadType.values)
..e<PayloadType>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'PayloadType', $pb.PbFieldType.OE, protoName: 'PayloadType', defaultOrMaker: PayloadType.UNKNOWN, valueOf: PayloadType.valueOf, enumValues: PayloadType.values)
..aOS(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'memo')
..aOS(10, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'publicKey')
..a<$core.List<$core.int>>(11, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signature', $pb.PbFieldType.OY)
Expand All @@ -628,7 +628,7 @@ class TransactionInfo extends $pb.GeneratedMessage {
$core.int? sequence,
$fixnum.Int64? value,
$fixnum.Int64? fee,
PayloadType? type,
PayloadType? payloadType,
$core.String? memo,
$core.String? publicKey,
$core.List<$core.int>? signature,
Expand Down Expand Up @@ -660,8 +660,8 @@ class TransactionInfo extends $pb.GeneratedMessage {
if (fee != null) {
_result.fee = fee;
}
if (type != null) {
_result.type = type;
if (payloadType != null) {
_result.payloadType = payloadType;
}
if (memo != null) {
_result.memo = memo;
Expand Down Expand Up @@ -777,13 +777,13 @@ class TransactionInfo extends $pb.GeneratedMessage {
void clearFee() => clearField(7);

@$pb.TagNumber(8)
PayloadType get type => $_getN(7);
PayloadType get payloadType => $_getN(7);
@$pb.TagNumber(8)
set type(PayloadType v) { setField(8, v); }
set payloadType(PayloadType v) { setField(8, v); }
@$pb.TagNumber(8)
$core.bool hasType() => $_has(7);
$core.bool hasPayloadType() => $_has(7);
@$pb.TagNumber(8)
void clearType() => clearField(8);
void clearPayloadType() => clearField(8);

@$pb.TagNumber(9)
$core.String get memo => $_getSZ(8);
Expand Down
4 changes: 2 additions & 2 deletions www/grpc/gen/dart/transaction.pbjson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const TransactionInfo$json = const {
const {'1': 'sequence', '3': 5, '4': 1, '5': 5, '10': 'sequence'},
const {'1': 'value', '3': 6, '4': 1, '5': 3, '10': 'value'},
const {'1': 'fee', '3': 7, '4': 1, '5': 3, '10': 'fee'},
const {'1': 'Type', '3': 8, '4': 1, '5': 14, '6': '.pactus.PayloadType', '10': 'Type'},
const {'1': 'PayloadType', '3': 8, '4': 1, '5': 14, '6': '.pactus.PayloadType', '10': 'PayloadType'},
const {'1': 'send', '3': 30, '4': 1, '5': 11, '6': '.pactus.PayloadSend', '9': 0, '10': 'send'},
const {'1': 'bond', '3': 31, '4': 1, '5': 11, '6': '.pactus.PayloadBond', '9': 0, '10': 'bond'},
const {'1': 'sortition', '3': 32, '4': 1, '5': 11, '6': '.pactus.PayloadSortition', '9': 0, '10': 'sortition'},
Expand All @@ -161,7 +161,7 @@ const TransactionInfo$json = const {
};

/// Descriptor for `TransactionInfo`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List transactionInfoDescriptor = $convert.base64Decode('Cg9UcmFuc2FjdGlvbkluZm8SDgoCaWQYASABKAxSAmlkEhIKBGRhdGEYAiABKAxSBGRhdGESGAoHdmVyc2lvbhgDIAEoBVIHdmVyc2lvbhIUCgVzdGFtcBgEIAEoDFIFc3RhbXASGgoIc2VxdWVuY2UYBSABKAVSCHNlcXVlbmNlEhQKBXZhbHVlGAYgASgDUgV2YWx1ZRIQCgNmZWUYByABKANSA2ZlZRInCgRUeXBlGAggASgOMhMucGFjdHVzLlBheWxvYWRUeXBlUgRUeXBlEikKBHNlbmQYHiABKAsyEy5wYWN0dXMuUGF5bG9hZFNlbmRIAFIEc2VuZBIpCgRib25kGB8gASgLMhMucGFjdHVzLlBheWxvYWRCb25kSABSBGJvbmQSOAoJc29ydGl0aW9uGCAgASgLMhgucGFjdHVzLlBheWxvYWRTb3J0aXRpb25IAFIJc29ydGl0aW9uEi8KBnVuYm9uZBghIAEoCzIVLnBhY3R1cy5QYXlsb2FkVW5ib25kSABSBnVuYm9uZBI1Cgh3aXRoZHJhdxgiIAEoCzIXLnBhY3R1cy5QYXlsb2FkV2l0aGRyYXdIAFIId2l0aGRyYXcSEgoEbWVtbxgJIAEoCVIEbWVtbxIdCgpwdWJsaWNfa2V5GAogASgJUglwdWJsaWNLZXkSHAoJc2lnbmF0dXJlGAsgASgMUglzaWduYXR1cmVCCQoHUGF5bG9hZA==');
final $typed_data.Uint8List transactionInfoDescriptor = $convert.base64Decode('Cg9UcmFuc2FjdGlvbkluZm8SDgoCaWQYASABKAxSAmlkEhIKBGRhdGEYAiABKAxSBGRhdGESGAoHdmVyc2lvbhgDIAEoBVIHdmVyc2lvbhIUCgVzdGFtcBgEIAEoDFIFc3RhbXASGgoIc2VxdWVuY2UYBSABKAVSCHNlcXVlbmNlEhQKBXZhbHVlGAYgASgDUgV2YWx1ZRIQCgNmZWUYByABKANSA2ZlZRI1CgtQYXlsb2FkVHlwZRgIIAEoDjITLnBhY3R1cy5QYXlsb2FkVHlwZVILUGF5bG9hZFR5cGUSKQoEc2VuZBgeIAEoCzITLnBhY3R1cy5QYXlsb2FkU2VuZEgAUgRzZW5kEikKBGJvbmQYHyABKAsyEy5wYWN0dXMuUGF5bG9hZEJvbmRIAFIEYm9uZBI4Cglzb3J0aXRpb24YICABKAsyGC5wYWN0dXMuUGF5bG9hZFNvcnRpdGlvbkgAUglzb3J0aXRpb24SLwoGdW5ib25kGCEgASgLMhUucGFjdHVzLlBheWxvYWRVbmJvbmRIAFIGdW5ib25kEjUKCHdpdGhkcmF3GCIgASgLMhcucGFjdHVzLlBheWxvYWRXaXRoZHJhd0gAUgh3aXRoZHJhdxISCgRtZW1vGAkgASgJUgRtZW1vEh0KCnB1YmxpY19rZXkYCiABKAlSCXB1YmxpY0tleRIcCglzaWduYXR1cmUYCyABKAxSCXNpZ25hdHVyZUIJCgdQYXlsb2Fk');
const $core.Map<$core.String, $core.dynamic> TransactionServiceBase$json = const {
'1': 'Transaction',
'2': const [
Expand Down
Loading

0 comments on commit 0bb6715

Please sign in to comment.