feat(clients): idiomatic Go SDK client#153
Conversation
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
|
@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! 🚀 |
Miracle656
left a comment
There was a problem hiding this comment.
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.
Closes #145
What
Adds
clients/go/— a typed Go client for the Wraith API, mirroring the layout of the existingclients/python/. The module path isgithub.com/Miracle656/wraith/clients/go, so:Acceptance criteria
transfers,accounts,assets,nfts,webhooks,status, each a standalone package, sharing a small transport in the rootwraithpackage:transfersIncoming,Outgoing,ForAddress,ByTxaccountsSummary,TransfersassetsPopularAssetsnftsTransferswebhooksList,DeliveriesstatusGetwraithClient/transport,APIError, options, query helpershttptest-based tests asserting request path/query shaping, response decoding, and*APIErrormapping.go test ./... -coverpasses (67–88% per package). The new.github/workflows/go-sdk.ymlrunsgofmtcheck,go vet, andgo test ./... -racewith a coverage summary.Design notes
wraith.New(baseURL, opts...)withWithHTTPClient/WithHeader; resource clients are constructed from it (transfers.New(c)).stringto preserve full i128 precision (matching the Python client).*wraith.APIError(StatusCode,Message); usable witherrors.As.net/http,encoding/json,net/url).Verification
go build ./...,go vet ./...,gofmt -l .all clean.go test ./... -cover→ all packages pass. (-raceruns 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-goimport path; since the deliverable lives atclients/go/, the module isgithub.com/Miracle656/wraith/clients/go. A dedicatedwraith-gorepo or vanity import can alias it later if desired.