Skip to content

feat(clients): idiomatic Go SDK client#153

Merged
Miracle656 merged 1 commit into
Miracle656:mainfrom
Salmatcre8:feat/go-sdk-client
Jun 29, 2026
Merged

feat(clients): idiomatic Go SDK client#153
Miracle656 merged 1 commit into
Miracle656:mainfrom
Salmatcre8:feat/go-sdk-client

Conversation

@Salmatcre8

Copy link
Copy Markdown
Contributor

Closes #145

What

Adds clients/go/ — a typed Go client for the Wraith API, mirroring the layout of the existing clients/python/. The module path is github.com/Miracle656/wraith/clients/go, so:

go get github.com/Miracle656/wraith/clients/go

Acceptance criteria

  • One package per resourcetransfers, accounts, assets, nfts, webhooks, status, each a standalone package, sharing a small transport in the root wraith package:
    Package List methods
    transfers Incoming, Outgoing, ForAddress, ByTx
    accounts Summary, Transfers
    assets PopularAssets
    nfts Transfers
    webhooks List, Deliveries
    status Get
    wraith shared Client/transport, APIError, options, query helpers
  • Coverage tests — every package has httptest-based tests asserting request path/query shaping, response decoding, and *APIError mapping. go test ./... -cover passes (67–88% per package). The new .github/workflows/go-sdk.yml runs gofmt check, go vet, and go test ./... -race with a coverage summary.

Design notes

  • wraith.New(baseURL, opts...) with WithHTTPClient / WithHeader; resource clients are constructed from it (transfers.New(c)).
  • Amounts are returned as string to preserve full i128 precision (matching the Python client).
  • Non-2xx responses are returned as *wraith.APIError (StatusCode, Message); usable with errors.As.
  • Only the standard library is used (net/http, encoding/json, net/url).

Verification

  • go build ./..., go vet ./..., gofmt -l . all clean.
  • go test ./... -cover → all packages pass. (-race runs in CI on Linux; locally cgo/gcc isn't available, but the test handlers hold no cross-goroutine shared state.)

Note: the issue mentions the github.com/Miracle656/wraith-go import path; since the deliverable lives at clients/go/, the module is github.com/Miracle656/wraith/clients/go. A dedicated wraith-go repo or vanity import can alias it later if desired.

Add clients/go/ — a typed Go client for the Wraith API, one package per
resource sharing a small transport in the root wraith package.

- wraith: Client (New, WithHTTPClient, WithHeader), a shared Get that
  decodes JSON and maps non-2xx to *APIError, and query helpers.
- transfers: Incoming, Outgoing, ForAddress, ByTx (+ ListParams, Transfer,
  Page). accounts: Summary, Transfers. assets: PopularAssets. nfts:
  Transfers. webhooks: List, Deliveries. status: Get.
- Amounts are kept as strings to preserve full i128 precision.
- Coverage tests for every package using httptest (request path/query
  shaping, response decoding, and *APIError mapping).
- Go SDK workflow runs gofmt check, go vet, and go test ./... -race with a
  coverage summary.

Closes Miracle656#145
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Salmatcre8 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Clean, fully-isolated Go SDK (clients/go/, own go.mod). Stdlib-only (net/http, encoding/json, net/url), one package per resource sharing a small transport, amounts as string to preserve i128 precision (matches the Python client), *wraith.APIError via errors.As. Every package has httptest-based tests for path/query shaping + decoding + error mapping — the dedicated 'Vet & test wraith-go' CI passes. The failing 'Typecheck & build' / 'Integration tests' are the Node jobs (pre-existing CI), unaffected by a Go-only PR. Closes #145.

@Miracle656 Miracle656 merged commit 2ea5b16 into Miracle656:main Jun 29, 2026
2 of 4 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.

Go SDK client

2 participants