Open opticyclic opened 4 years ago
Seems like a good idea - thanks!
I'm questioning if we can also let the accountService.accountInfo(...)
helpers just return the AccountInfo
object instead of StateAndRef
…
We can't change them as it would break backwards compatibility but we can add new methods that do what you describe.
Good point. It's not really needed, but promotes cleaner code (IMHO); maybe we can break that behaviour with v2.0 :P (and introduce new methods for those who may need the stateAndRef
)
Yeah fair point. Reason for returning StateAndRef
was that then you can then build transactions with it. With just the AccountInfo
you can't use it as an input or reference in a transaction.
Makes sense to have such an helper, even thought I'm not sure about the direct use of AccountInfo
in transactions (i.e. accounts are handled with flows, while states refers to AnonymousParty
, not LinearPointer
of AccountInfo
)
Another idea for an helper: something to use in the SignTransactionFlow::checkTransaction
that, given an AnonymousParty
/ PublicKey
, throws an exception if:
Again, it's not needed, but can by handy. :)
Discussion before adding a pull request:
In my test code I have a few extension functions to make using the accounts SDK easier. e.g. this:
allows me to do this:
Instead of this:
However, calling kotlin extension functions from Java is tricky.
Would this and other similar helper functions be better in
AccountService
/KeyManagementBackedAccountService
?See also https://github.com/corda/accounts/issues/37