Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC GetPaymentsStream #345

Merged
merged 5 commits into from
Oct 4, 2024
Merged

Commits on Oct 3, 2024

  1. RPC GetPaymentsStream

    This introduces a new feature to the ArkService API that allows clients to subscribe to payment events. Here's a breakdown of the changes:
    
    1. **OpenAPI Specification (`service.swagger.json`):**
       - A new endpoint `/v1/payments` is added to the API, supporting a `GET` operation for streaming payment events.
       - New definitions `v1GetPaymentsStreamResponse`, `v1RoundPayment`, and `v1AsyncPayment` are added to describe the structure of the streaming responses.
    
    2. **Protobuf Definition (`service.proto`):**
       - Added a new RPC method `GetPaymentsStream` that streams `GetPaymentsStreamResponse` messages.
       - Defined new message types: `GetPaymentsStreamRequest`, `GetPaymentsStreamResponse`, `RoundPayment`, and `AsyncPayment`.
    
    3. **Generated Protobuf Code (`service.pb.go`, `service.pb.gw.go`, `service_grpc.pb.go`):**
       - The generated code is updated to include the new RPC method and message types.
       - The gateway code includes functions to handle HTTP requests and responses for the new streaming endpoint.
    
    4. **Application Logic (`covenant.go`, `covenantless.go`):**
       - New payment events channels are introduced (`paymentEventsCh`).
       - Payment events are propagated to these channels when a round is finalized or an async payment is completed.
       - New event types `RoundPaymentEvent` and `AsyncPaymentEvent` are defined, implementing a `PaymentEvent` interface.
    
    5. **gRPC Handlers (`arkservice.go`):**
       - Added logic to handle `GetPaymentsStream` requests and manage payment listeners.
       - A new goroutine is started to listen to payment events and forward them to active listeners.
    
    Overall, this patch extends the ArkService to support real-time streaming of payment events, allowing clients to receive updates on both round payments and async payments as they occur.
    sekulicd committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    eb614af View commit details
    Browse the repository at this point in the history
  2. Move emit events in updateVtxoSet & Use generics and parsers (#1)

    * Move sending event to updateVtxoSet
    
    * Use generics and parsers
    altafan authored Oct 3, 2024
    Configuration menu
    Copy the full SHA
    e92fbaf View commit details
    Browse the repository at this point in the history
  3. pr review refactor

    sekulicd committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    3384258 View commit details
    Browse the repository at this point in the history
  4. pr review refactor

    sekulicd committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    da53176 View commit details
    Browse the repository at this point in the history
  5. fix

    sekulicd committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    91142ee View commit details
    Browse the repository at this point in the history