Skip to content

feat: Implementing close_position method#386

Closed
ndatta-nethermind wants to merge 82 commits into
dydxprotocol:mainfrom
NethermindEth:ndatta/node-close-position
Closed

feat: Implementing close_position method#386
ndatta-nethermind wants to merge 82 commits into
dydxprotocol:mainfrom
NethermindEth:ndatta/node-close-position

Conversation

@ndatta-nethermind
Copy link
Copy Markdown
Contributor

No description provided.

@ndatta-nethermind ndatta-nethermind marked this pull request as ready for review July 29, 2025 09:41
@ndatta-nethermind ndatta-nethermind requested review from a team as code owners July 29, 2025 09:41
This pull request introduces support for proxy configurations in the
`v4-client-js` package. The changes include adding proxy support to both
REST and WebSocket clients, updating constructors, and introducing
utility functions to handle proxy agents.

### Proxy Support Enhancements:

* **Proxy configuration added to `IndexerConfig`:** The `IndexerConfig`
class now includes an optional `proxy` parameter of type
`AxiosProxyConfig`, allowing users to specify proxy settings. The
constructor was updated to initialize this property.
(`v4-client-js/src/clients/constants.ts`,
[v4-client-js/src/clients/constants.tsR247-R252](diffhunk://#diff-1a0931f9cb2a865b6d73148c440e7d29f6fe1f6991fb406a190f2e56082bcbd5R247-R252))
* **REST client proxy integration:** The `RestClient` class now uses an
`axios` instance configured with the optional `proxy` parameter. This
replaces the previous direct use of the `request` function for HTTP
requests. (`v4-client-js/src/clients/modules/rest.ts`,
[[1]](diffhunk://#diff-0a6ead65c843f918b4acedfc6e9b595005415d093160fbdb43bca1c867dd49ecR1-R28)
[[2]](diffhunk://#diff-0a6ead65c843f918b4acedfc6e9b595005415d093160fbdb43bca1c867dd49ecL32-R39)
* **WebSocket client proxy integration:** The `SocketClient` class now
supports proxy configurations by utilizing the `HttpsProxyAgent`
library. The `proxyAgent` is initialized using a new utility function,
`getProxyAgent`, and passed to the WebSocket connection.
(`v4-client-js/src/clients/socket-client.ts`,
[[1]](diffhunk://#diff-c4c36d3ced6c5f292f1d45c1ff474d57f921370435bd85caafbe72b6465d260cR1-R5)
[[2]](diffhunk://#diff-c4c36d3ced6c5f292f1d45c1ff474d57f921370435bd85caafbe72b6465d260cR42)
[[3]](diffhunk://#diff-c4c36d3ced6c5f292f1d45c1ff474d57f921370435bd85caafbe72b6465d260cR57-R67)
* **Utility function for proxy agent creation:** A new utility function,
`getProxyAgent`, was added to generate an `HttpsProxyAgent` instance
from an `AxiosProxyConfig` object. (`v4-client-js/src/lib/utils.ts`,
[[1]](diffhunk://#diff-63d05f995846a96324239cfaf78bdd5bfb2b1e5a32726bb236915b6ce379e201R1-R3)
[[2]](diffhunk://#diff-63d05f995846a96324239cfaf78bdd5bfb2b1e5a32726bb236915b6ce379e201R80-R84)

### Dependency Updates:

* **Added `https-proxy-agent` dependency:** The `https-proxy-agent`
library was added to the `package.json` file to enable proxy support for
WebSocket connections. (`v4-client-js/package.json`,
[v4-client-js/package.jsonR65](diffhunk://#diff-ec61c6dbaf924b282dbb0275f615f0fe5daa0eab5e3f720e5cedb87fa3caeffaR65))
Comment thread v4-client-py-v2/examples/close_position_example.py
Comment thread v4-client-py-v2/dydx_v4_client/node/client.py Outdated
Comment thread v4-client-py-v2/dydx_v4_client/node/client.py Outdated
Comment thread v4-client-py-v2/tests/test_mutating_node_client.py Outdated
@ndatta-nethermind
Copy link
Copy Markdown
Contributor Author

Created another PR with cleaned up code here: #421

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

10 participants