haveno-ts/docs/adding_api_functions.md

2.0 KiB

How to add and test new gRPC API functions in Haveno

  1. Follow instructions to run Haveno's existing API tests successfully.
  2. Define the new service or message in Haveno's protobuf definition.
  3. Clean and build Haveno after modifying the protobuf definition: make clean && make
  4. Implement the new service in Haveno's backend, following existing patterns.
    For example, the gRPC function to get offers is implemented by GrpcServer > GrpcOffersService.getOffers(...) > CoreApi.getOffers(...) > CoreOffersService.getOffers(...) > OfferBookService.getOffers().
  5. Build Haveno: make
  6. Follow instructions to update the protobuf client in haveno-ui-poc.
  7. Add the corresponding typescript method(s) to HavenoDaemon.tsx with clear and concise documentation.
  8. Add clean and comprehensive tests to HavenoDaemon.test.tsx, following existing patterns.
  9. Verify the tests with npm run test -- -t 'my test' to run tests by name and npm test to run all tests together.
  10. Open a pull request for review.