Skip to content

Commit ff8d75b

Browse files
fix: temporarily fix protobuf errors
Signed-off-by: Ivaylo Nikolov <[email protected]>
1 parent 28d0a03 commit ff8d75b

File tree

7 files changed

+34
-0
lines changed

7 files changed

+34
-0
lines changed

src/fee_schedules.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,9 @@ pub enum FeeDataType {
798798

799799
/// The resource prices are scoped to a submit message operation with custom fees.
800800
SubmitMessageWithCustomFees,
801+
802+
/// The resource prices are scoped to a crypto transfer with hooks.
803+
CryptoTransferWithHooks,
801804
}
802805

803806
impl FromProtobuf<services::SubType> for FeeDataType {
@@ -814,6 +817,7 @@ impl FromProtobuf<services::SubType> for FeeDataType {
814817
SubType::ScheduleCreateContractCall => Self::ScheduleCreateContractCall,
815818
SubType::TopicCreateWithCustomFees => Self::TopicCreateWithCustomFees,
816819
SubType::SubmitMessageWithCustomFees => Self::SubmitMessageWithCustomFees,
820+
SubType::CryptoTransferWithHooks => Self::CryptoTransferWithHooks,
817821
};
818822

819823
Ok(value)
@@ -836,6 +840,7 @@ impl ToProtobuf for FeeDataType {
836840
Self::ScheduleCreateContractCall => SubType::ScheduleCreateContractCall,
837841
Self::TopicCreateWithCustomFees => SubType::TopicCreateWithCustomFees,
838842
Self::SubmitMessageWithCustomFees => SubType::SubmitMessageWithCustomFees,
843+
Self::CryptoTransferWithHooks => SubType::CryptoTransferWithHooks,
839844
}
840845
}
841846
}

src/query/payment_transaction.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ impl ToTransactionDataProtobuf for PaymentTransactionData {
8585
account_id: node_account_id.to_protobuf(),
8686
amount: amount.to_tinybars(),
8787
is_approval: false,
88+
hook_call: None,
8889
},
8990
services::AccountAmount {
9091
account_id: Some(transaction_id.account_id.to_protobuf()),
9192
amount: -(amount.to_tinybars()),
9293
is_approval: false,
94+
hook_call: None,
9395
},
9496
],
9597
}),

src/token/token_airdrop_transaction.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,21 +523,25 @@ mod tests {
523523
account_id: Some(AccountId::from_str("0.0.5008").unwrap().to_protobuf()),
524524
amount: 200,
525525
is_approval: false,
526+
hook_call: None,
526527
},
527528
AccountAmount {
528529
account_id: Some(AccountId::from_str("0.0.5009").unwrap().to_protobuf()),
529530
amount: -100,
530531
is_approval: false,
532+
hook_call: None,
531533
},
532534
AccountAmount {
533535
account_id: Some(AccountId::from_str("0.0.5010").unwrap().to_protobuf()),
534536
amount: 40,
535537
is_approval: false,
538+
hook_call: None,
536539
},
537540
AccountAmount {
538541
account_id: Some(AccountId::from_str("0.0.5011").unwrap().to_protobuf()),
539542
amount: 20,
540543
is_approval: false,
544+
hook_call: None,
541545
},
542546
],
543547
nft_transfers: vec![NftTransfer {
@@ -547,6 +551,8 @@ mod tests {
547551
),
548552
serial_number: 1,
549553
is_approval: true,
554+
receiver_allowance_hook_call: None,
555+
sender_allowance_hook_call: None,
550556
}],
551557
expected_decimals: Some(3),
552558
}],

src/transaction/any.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,16 @@ impl FromProtobuf<services::transaction_body::Data> for AnyTransactionData {
683683
"unsupported transaction `AtomicBatchTransaction`",
684684
))
685685
}
686+
Data::LambdaSstore(_) => {
687+
return Err(Error::from_protobuf(
688+
"unsupported transaction `LambdaSstoreTransaction`",
689+
))
690+
}
691+
Data::HookDispatch(_) => {
692+
return Err(Error::from_protobuf(
693+
"unsupported transaction `HookDispatchTransaction`",
694+
))
695+
}
686696
};
687697

688698
Ok(data)
@@ -1067,6 +1077,12 @@ impl FromProtobuf<Vec<services::transaction_body::Data>> for ServicesTransaction
10671077
Data::AtomicBatch(_) => {
10681078
return Err(Error::from_protobuf("AtomicBatch transactions are not supported"))
10691079
}
1080+
Data::LambdaSstore(_) => {
1081+
return Err(Error::from_protobuf("LambdaSstore transactions are not supported"))
1082+
}
1083+
Data::HookDispatch(_) => {
1084+
return Err(Error::from_protobuf("HookDispatch transactions are not supported"))
1085+
}
10701086
};
10711087

10721088
for transaction in iter {

src/transaction_record.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ impl ToProtobuf for TransactionRecord {
274274
account_id: Some(it.0.to_protobuf()),
275275
amount: *it.1,
276276
is_approval: false,
277+
hook_call: None,
277278
})
278279
.collect(),
279280
nft_transfers: Vec::new(),

src/transfer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ impl ToProtobuf for Transfer {
4343
account_id: Some(self.account_id.to_protobuf()),
4444
amount: self.amount.to_tinybars(),
4545
is_approval: false,
46+
hook_call: None,
4647
}
4748
}
4849
}

src/transfer_transaction.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ impl ToProtobuf for Transfer {
325325
amount: self.amount,
326326
account_id: Some(self.account_id.to_protobuf()),
327327
is_approval: self.is_approval,
328+
hook_call: None,
328329
}
329330
}
330331
}
@@ -371,6 +372,8 @@ impl ToProtobuf for TokenNftTransfer {
371372
receiver_account_id: Some(self.receiver.to_protobuf()),
372373
serial_number: self.serial as i64,
373374
is_approval: self.is_approved,
375+
receiver_allowance_hook_call: None,
376+
sender_allowance_hook_call: None,
374377
}
375378
}
376379
}

0 commit comments

Comments
 (0)