hedera-json-rpc-relay icon indicating copy to clipboard operation
hedera-json-rpc-relay copied to clipboard

feat: added an option for retrieving transaction records from either the Mirror Node or the Consensus Node.

Open quiet-node opened this issue 1 year ago • 6 comments

Description:

  • added GET_RECORD_DEFAULT_TO_CONSENSUS_NODE to configuration docs. This configuration allows the Relay to retrieve transaction record by making calls to Consensus Node (CN) or Mirror Node (MN) based on its input. Default to "false" for MN calls.

  • added getTransactionStatusAndMetrrics() method. This method is the implementation for the logic mentioned above. If GET_RECORD_DEFAULT_TO_CONSENSUS_NODE is set to "true", calls will be made to CN. Otherwise, calls will be made to MN. MirrorNodeClient is injected from eth.ts level. Unit tests are included.

  • modified getTransferAmountSumForAccount so it can be compatible with transfers array returned from MN.

  • added getTransactionStatusAndMetrrics to executeTransaction() and executeTransaction().

  • removed unused methods and added JSDoc to methods in SDKClient, sdkClient.executeGetTransactionRecord() and sdkClient.getTransactionMetrics() as they are now replaced by getTransactionStatusAndMetrrics(). Also added JSDoc comments for all methods in SDKClient.

  • Modified and added new tests in sdkClient.spec.ts reflect the new logic.

Related issue(s):

Fixes #2706

Notes for reviewer:

Checklist

  • [ ] Documented (Code comments, README, etc.)
  • [ ] Tested (unit, integration, etc.)

quiet-node avatar Aug 01 '24 19:08 quiet-node