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

Implement Take Order Methods for Buy and Sell Orders #15

Open
6 tasks
AndreaDiazCorreia opened this issue Dec 12, 2024 · 0 comments
Open
6 tasks

Implement Take Order Methods for Buy and Sell Orders #15

AndreaDiazCorreia opened this issue Dec 12, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@AndreaDiazCorreia
Copy link
Collaborator

Description

Implement functionality for taking existing buy and sell orders, including all necessary message handling and state management according to the Mostro protocol.

Implementation Requirements

  1. Implement take order methods:
async function takeSell(order: Order, amount?: number): Promise<MostroMessage> {
  // Validate order status
  // Handle amount calculation
  // Create and send take message
  // Handle response
}

async function takeBuy(order: Order, amount?: number): Promise<MostroMessage> {
  // Validate order status
  // Handle amount calculation
  // Create and send take message
  // Handle response
}
  1. Message handling implementation:
interface TakeOrderMessage {
  order: {
    version: number;
    id: string;
    action: Action.TakeSell | Action.TakeBuy;
    content: {
      amount?: number;
      payment_request?: [null, string, number?];
    };
  };
}

Testing Requirements

describe('takeOrder', () => {
  it('should take sell orders correctly');
  it('should take buy orders correctly');
  it('should handle amount specification');
  it('should validate order status');
  it('should handle payment processing');
  it('should manage state transitions');
});

Acceptance Criteria

  • Take sell functionality implemented
  • Take buy functionality implemented
  • Amount handling working
  • Payment request handling
  • State transitions correct
  • Error handling complete

References

@grunch grunch added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants