Skip to content

Commit

Permalink
Add signature for fee bump account as well
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Jul 29, 2024
1 parent 461c762 commit ced69a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions internal/transform/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe
outputMinSequenceLedgerGap = null.IntFrom(int64(*minSequenceLedgerGap))
}

xdrSignatures := transaction.Envelope.Signatures()
signatures := make([]string, len(xdrSignatures))
for i, sig := range xdrSignatures {
signatures[i] = base64.StdEncoding.EncodeToString(sig.Signature)
}

// Soroban fees and resources
// Note: MaxFee and FeeCharged is the sum of base transaction fees + Soroban fees
// Breakdown of Soroban fees can be calculated by the config_setting resource pricing * the resources used
Expand Down Expand Up @@ -230,7 +224,7 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe
TotalNonRefundableResourceFeeCharged: outputTotalNonRefundableResourceFeeCharged,
TotalRefundableResourceFeeCharged: outputTotalRefundableResourceFeeCharged,
RentFeeCharged: outputRentFeeCharged,
Signatures: signatures,
Signatures: getSignatures(transaction.Envelope.Signatures()),
}

// Add Muxed Account Details, if exists
Expand All @@ -255,6 +249,8 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe
innerHash := transaction.Result.InnerHash()
transformedTransaction.InnerTransactionHash = hex.EncodeToString(innerHash[:])
transformedTransaction.NewMaxFee = uint32(transaction.Envelope.FeeBumpFee())

transformedTransaction.Signatures = getSignatures(transaction.Envelope.FeeBump.Signatures)
}

return transformedTransaction, nil
Expand Down Expand Up @@ -302,3 +298,12 @@ func formatSigners(s []xdr.SignerKey) pq.StringArray {

return signers
}

func getSignatures(xdrSignatures []xdr.DecoratedSignature) []string {
signatures := make([]string, len(xdrSignatures))
for i, sig := range xdrSignatures {
signatures[i] = base64.StdEncoding.EncodeToString(sig.Signature)
}

return signatures
}
2 changes: 1 addition & 1 deletion internal/transform/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func makeTransactionTestOutput() (output []TransactionOutput, err error) {
SorobanResourcesReadBytes: 0,
SorobanResourcesWriteBytes: 0,
TransactionResultCode: "TransactionResultCodeTxFeeBumpInnerSuccess", //inner fee bump success
Signatures: []string{},
Signatures: []string{"9GuLXL2cz09UOAJGSxbtMmTyn7Eb8EJ6ti29TgV/Gj2z7uVMIM56DZqFlJUd+jCELFajOCAsS1fi+0wEO7aECA=="},
},
{
TxEnvelope: "AAAAAgAAAAAcR0GXGO76pFs4y38vJVAanjnLg4emNun7zAx0pHcDGAAAAGQBpLyvsiV6gwAAAAIAAAABAAAAAAAAAAAAAAAAXwardAAAAAEAAAAFAAAACgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAMCAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAABdITDVhQ2dvelFISVc3c1NjNVhkY2ZtUgAAAAABAAAAAQAAAABrWN1saJMLbQMdxbv64j76HsPwu1jCvI2TjUfB37O+cwAAAAIAAAAAAAAAAAAAAAAAAAAAAQIDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFjQq+PAAAAQPRri1y9nM9PVDgCRksW7TJk8p+xG/BCerYtvU4Ffxo9s+7lTCDOeg2ahZSVHfowhCxWozggLEtX4vtMBDu2hAg=",
Expand Down

0 comments on commit ced69a3

Please sign in to comment.