Skip to content

Fix/vaultaddr response parsing - #16

Merged
sonirico merged 3 commits into
sonirico:masterfrom
terwey:fix/vaultaddr-response-parsing
Aug 9, 2025
Merged

Fix/vaultaddr response parsing#16
sonirico merged 3 commits into
sonirico:masterfrom
terwey:fix/vaultaddr-response-parsing

Conversation

@terwey

@terwey terwey commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

Pull Request

Description

Fixes multiple issues in API response handling and request building:

  • Correctly parse response.data as JSON when it’s an object or array.
  • Omit vaultAddress from payloads when empty to avoid API 422 errors.
  • Change OrderStatus.Error from *error to *string for proper unmarshalling, and add a String() helper for easier debugging.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have run make ci-full and all checks pass

The existing tests pass/fail the same as before, they are broken. Not going to fix them.

Code Quality

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

terwey added 3 commits August 9, 2025 21:22
Use fastjson.Get(...).MarshalTo(nil) for response.data instead of GetStringBytes,
allowing proper unmarshalling when the field is an object or array.
Only include vaultAddress in payloads when non-empty (except usdClassTransfer handling)
to prevent API 422 errors from sending an empty string.
Change OrderStatus.Error from *error to *string for proper JSON unmarshalling.
Add a String() helper to OrderStatus for easier debugging/logging.
@sonirico
sonirico merged commit 69047bb into sonirico:master Aug 9, 2025
4 checks passed
@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 16852915467

Details

  • 0 of 20 (0.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 11.892%

Changes Missing Coverage Covered Lines Changed/Added Lines %
exchange_orders.go 0 3 0.0%
api.go 0 6 0.0%
exchange.go 0 11 0.0%
Files with Coverage Reduction New Missed Lines %
exchange_orders.go 1 0.0%
Totals Coverage Status
Change from base Build 16777118411: -0.04%
Covered Lines: 325
Relevant Lines: 2733

💛 - Coveralls

@sonirico

sonirico commented Aug 9, 2025

Copy link
Copy Markdown
Owner

thx! @terwey

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