Skip to content

Commit

Permalink
Add more Logs (#766)
Browse files Browse the repository at this point in the history
* Add more Logs to Hedera client

Signed-off-by: Stanislav Viyachev <[email protected]>
  • Loading branch information
Coiling-Dragon authored Nov 22, 2022
1 parent 0b7311a commit caddd89
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions app/clients/hedera/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (hc Node) SubmitScheduledTokenMintTransaction(tokenID hedera.TokenID, amoun
return nil, err
}

hc.logger.Infof("[%s] Signing transaction with ID: [%s] and Node Account IDs: %v", memo, tx.GetTransactionID().String(), tx.GetNodeAccountIDs())
hc.logger.Infof("[%s] - Signing transaction with ID: [%s] and Node Account IDs: %v", memo, tx.GetTransactionID().String(), tx.GetNodeAccountIDs())
signedTransaction, err := tx.
SignWithOperator(hc.GetClient())
if err != nil {
Expand All @@ -112,7 +112,7 @@ func (hc Node) SubmitScheduledTokenBurnTransaction(tokenID hedera.TokenID, amoun
return nil, err
}

hc.logger.Infof("[%s] Signing transaction with ID: [%s] and Node Account IDs: %v", memo, tx.GetTransactionID().String(), tx.GetNodeAccountIDs())
hc.logger.Infof("[%s] - Signing transaction with ID: [%s] and Node Account IDs: %v", memo, tx.GetTransactionID().String(), tx.GetNodeAccountIDs())
signedTransaction, err := tx.
SignWithOperator(hc.GetClient())
if err != nil {
Expand All @@ -125,28 +125,49 @@ func (hc Node) SubmitScheduledTokenBurnTransaction(tokenID hedera.TokenID, amoun
// SubmitTopicConsensusMessage submits the provided message bytes to the
// specified HCS `topicId`
func (hc Node) SubmitTopicConsensusMessage(topicId hedera.TopicID, message []byte) (*hedera.TransactionID, error) {
txResponse, err := hedera.NewTopicMessageSubmitTransaction().
tx, err := hedera.NewTopicMessageSubmitTransaction().
SetTopicID(topicId).
SetMessage(message).
SetMaxRetry(hc.maxRetry).
Execute(hc.client)
FreezeWith(hc.client)

if err != nil {
return nil, err
}

_, err = hc.checkTransactionReceipt(txResponse)
hc.logger.Debugf("Submit Topic Consensus Message, with transaction ID [%s] and Node Account IDs: %v",
tx.GetTransactionID(),
tx.GetNodeAccountIDs(),
)

return &txResponse.TransactionID, err
response, err := tx.Execute(hc.GetClient())

if err != nil {
return nil, err
}

_, err = hc.checkTransactionReceipt(response)

return &response.TransactionID, err
}

// SubmitScheduleSign submits a ScheduleSign transaction for a given ScheduleID
func (hc Node) SubmitScheduleSign(scheduleID hedera.ScheduleID) (*hedera.TransactionResponse, error) {
response, err := hedera.NewScheduleSignTransaction().
tx, err := hedera.NewScheduleSignTransaction().
SetScheduleID(scheduleID).
SetMaxRetry(hc.maxRetry).
Execute(hc.GetClient())
FreezeWith(hc.GetClient())

if err != nil {
return nil, err
}

hc.logger.Debugf("Submit Schedule Sign, with transaction ID [%s], schedule ID: [%s] and Node Account IDs: %v",
tx.GetTransactionID(),
tx.GetScheduleID(),
tx.GetNodeAccountIDs(),
)
response, err := tx.Execute(hc.GetClient())
return &response, err
}

Expand Down Expand Up @@ -209,7 +230,7 @@ func (hc Node) submitScheduledTransferTransaction(payerAccountID hedera.AccountI
return nil, err
}

hc.logger.Infof("[%s] Signing transaction with ID: [%s] and Node Account IDs: %v", memo, tx.GetTransactionID().String(), tx.GetNodeAccountIDs())
hc.logger.Infof("[%s] - Signing transaction with ID: [%s] and Node Account IDs: %v", memo, tx.GetTransactionID().String(), tx.GetNodeAccountIDs())
signedTransaction, err := tx.
SignWithOperator(hc.GetClient())
if err != nil {
Expand Down

0 comments on commit caddd89

Please sign in to comment.