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

OKX integration #97

Merged
merged 36 commits into from
Jan 10, 2025
Merged

OKX integration #97

merged 36 commits into from
Jan 10, 2025

Conversation

mstrug
Copy link
Collaborator

@mstrug mstrug commented Dec 18, 2024

Description

OKX dex integration.
See also dedicated issue: #93

Changes

Added new okx modules in dex, config and tests.
Created dto basing on documentation: https://www.okx.com/en-au/web3/build/docs/waas/dex-swap.

OKX requires signing of swap request, it is implemented in function: sign_request(), basing on documentation: https://www.okx.com/en-au/web3/build/docs/waas/rest-authentication#signature

Also implemented custom error handling function: handle_api_error(), as OKX in error cases returns valid json http body which causes that trait implementation from RoundtripError to dto::Error is not used.

How to test

Created dedicated tests which uses http mocking and real endpoint tests (ignored) which requires providing API credentials. If API credentials are needed for running ignored test I can provide that.

src/infra/dex/okx/dto.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/dto.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/dto.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/dto.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/dto.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
src/infra/config/dex/okx/file.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
@mstrug mstrug marked this pull request as ready for review January 9, 2025 15:47
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
src/infra/dex/okx/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Only nits.

config/example.okx.toml Outdated Show resolved Hide resolved
config/example.okx.toml Outdated Show resolved Hide resolved
src/infra/config/dex/okx/file.rs Outdated Show resolved Hide resolved
src/infra/config/dex/okx/file.rs Outdated Show resolved Hide resolved
src/tests/okx/api_calls.rs Outdated Show resolved Hide resolved
@mstrug mstrug merged commit b76dcc2 into main Jan 10, 2025
3 checks passed
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.

3 participants