Skip to content

Commit

Permalink
store ledger_key_hash in an array
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaszanotelli committed Apr 12, 2024
1 parent 193e695 commit f829e64
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions internal/transform/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1792,22 +1792,21 @@ func contractCodeHashFromTxEnvelope(transactionEnvelope xdr.TransactionV1Envelop
return ""
}

func ledgerKeyHashFromTxEnvelope(transactionEnvelope xdr.TransactionV1Envelope) string {
func ledgerKeyHashFromTxEnvelope(transactionEnvelope xdr.TransactionV1Envelope) []string {
var ledgerKeyHash []string
for _, ledgerKey := range transactionEnvelope.Tx.Ext.SorobanData.Resources.Footprint.ReadOnly {
ledgerKeyHash := utils.LedgerKeyToLedgerKeyHash(ledgerKey)
if ledgerKeyHash != "" {
return ledgerKeyHash
if utils.LedgerKeyToLedgerKeyHash(ledgerKey) != "" {
ledgerKeyHash = append(ledgerKeyHash, utils.LedgerKeyToLedgerKeyHash(ledgerKey))
}
}

for _, ledgerKey := range transactionEnvelope.Tx.Ext.SorobanData.Resources.Footprint.ReadWrite {
ledgerKeyHash := utils.LedgerKeyToLedgerKeyHash(ledgerKey)
if ledgerKeyHash != "" {
return ledgerKeyHash
if utils.LedgerKeyToLedgerKeyHash(ledgerKey) != "" {
ledgerKeyHash = append(ledgerKeyHash, utils.LedgerKeyToLedgerKeyHash(ledgerKey))
}
}

return ""
return ledgerKeyHash
}

func contractCodeFromContractData(ledgerKey xdr.LedgerKey) string {
Expand Down

0 comments on commit f829e64

Please sign in to comment.