0

I am working on Hyperledger Composer and I want to access "to" field in 'eventsEmitted' array in history:

"eventsEmitted": [
  {
    "$class": "org.poc.wallet.WalletTransferEvent",
    "from": "resource:org.poc.wallet.Wallet#wallet2",
    "to": "resource:org.poc.wallet.Wallet#wallet3",
    "amount": 100,
    "eventId": "7c180da643f418f4bfb40187ccecef7dddd2d3f4ff952ab16fd913bcccedeac2#0",
    "timestamp": "2018-06-05T08:04:38.857Z"
  }
]

I have tried that in my ACL file but the rule is not triggered:

rule CustomersSeeHistoryForWalletTransaction {
  description: "Customers should be able to see the history of their own transactions only"
  participant(p): "org.poc.wallet.Customer"
  operation: READ
  resource(r): "org.hyperledger.composer.system.HistorianRecord"
  condition: (r.eventsEmitted[0].to.owner.getIdentifier() === p.getIdentifier())
  action: ALLOW
}
Maloc
  • 3
  • 1

1 Answers1

0

see answer here -> how to access the 'eventEmitted' field in transaction history of hyperledger fabric (based on using Event in the trade-network sample network) - and the Event class as described here -> https://github.com/hyperledger/composer/blob/master/packages/composer-common/lib/system/org.hyperledger.composer.system.cto#L144 -

Note also there is currently an issue created for Composer queries - ie ability to query Historian based on custom events in Event definition, and have custom Event fields within the eventsEmitted array in the historian to search on - see https://github.com/hyperledger/composer/issues/3540

Paul O'Mahony
  • 6,740
  • 1
  • 10
  • 15