LiskArchive/lisk-sdk

Interoperability example app scripts are not using the full power of API client

bobanm opened this issue · 0 comments

bobanm commented

Scripts such as sidechain_registration are using API client, but then performing many operations manually, instead of using the API client functionality:

  • No need to manually fetch chain ID of the node. The client does it during its initialization.
  • No need to manually derive public key or address. The client does client does it when creating a transaction.
  • No need to manually fetch the current nonce of the account. The client does it when creating a transaction if nonce was not explicitly provided.
  • No need to manually fetch params schema to encode transaction params. The client does it when creating a transaction.
  • No need to manually sign a transaction. The client does it when creating a transaction.
  • No need to manually invoke txpool_postTransaction to send a transaction. Use provided client.transaction.send() method instead.

While the existing script provides the expected results, it is unnecessarily complex. Since this is an example app which our users will study to understand how to build their own things, I think it makes sense to showcase the full power of SDK and the more elegant way to use API client.