Skip to content

Fix create payload route context#1

Open
seppegadeyne wants to merge 2 commits into
KYC-rip:masterfrom
seppegadeyne:fix/create-payload-contract
Open

Fix create payload route context#1
seppegadeyne wants to merge 2 commits into
KYC-rip:masterfrom
seppegadeyne:fix/create-payload-contract

Conversation

@seppegadeyne

Copy link
Copy Markdown

Summary

This fixes the create-order payload path so terminal swaps carry the same route context the web app sends when an order is created.

Changes:

  • send website-compatible quote params (from_net, to_net, type=from) while keeping the existing network_from / network_to aliases
  • include quote/route context in create payloads (trade_id, selected route amount_to, selected route fixed_rate)
  • validate required create fields client-side before POSTing, so the TUI fails locally instead of calling the API with an incomplete payload
  • add regression coverage for the quote params, create payload shape, and local missing-field validation

Why

For routes like USDC-Base -> QUBIC-Mainnet, the estimate succeeds but the order creation path can fail with:

api POST /v2/exchange/create: 400 {"error":"Missing required params: provider, address_to, from_currency, to_currency","code":"MISSING_PARAMS"}

The web app create flow sends the selected quote/route context explicitly. Mirroring that shape in the CLI makes the create request less ambiguous and prevents incomplete create payloads from reaching the API.

Verification

go test ./internal/api
go test ./...
make kyc-cli
./bin/kyc-cli --version

Local verification was run with Go 1.25.11.

@seppegadeyne

Copy link
Copy Markdown
Author

Follow-up after local TUI testing:

  • Fixed a regression where a free-text destination ticker/network (for example QUBIC-Mainnet) was cleared immediately after pressing Enter in the destination picker.
  • Added TestFreeTextDestinationPersistsAfterPickerEnter to cover that picker flow.
  • Re-ran go test ./... successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant