Skip to content

geolocation: add Go Read SDK for GeolocationUser types and client methods#3305

Merged
ben-dz merged 4 commits intomainfrom
bdz/doublezero-3012
Mar 19, 2026
Merged

geolocation: add Go Read SDK for GeolocationUser types and client methods#3305
ben-dz merged 4 commits intomainfrom
bdz/doublezero-3012

Conversation

@ben-dz
Copy link
Contributor

@ben-dz ben-dz commented Mar 18, 2026

Resolves: #3012

Summary of Changes

  • Add GeolocationUser struct and related types (GeolocationTarget, GeolocationBillingConfig, enums) with Borsh serialization/deserialization matching the Rust onchain layout
  • Add DeriveGeolocationUserPDA() using seeds ["doublezero", "geouser", code]
  • Add GetGeolocationUserByCode() and GetGeolocationUsers() client read methods
  • Add AccountTypeGeolocationUser = 3 discriminator, GeolocationUserSeed, and MaxTargets constants

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 4 +351 / -3 +348
Tests 4 +405 / -0 +405

Core logic and tests in roughly equal proportion.

Key files (click to expand)
  • sdk/geolocation/go/state.go — new types (GeolocationUser, GeolocationTarget, GeolocationBillingConfig, enums) with Serialize/Deserialize methods
  • sdk/geolocation/go/client.go — GetGeolocationUserByCode and GetGeolocationUsers methods
  • sdk/geolocation/go/pda.go — DeriveGeolocationUserPDA function
  • sdk/geolocation/go/deserialize.go — DeserializeGeolocationUser discriminator wrapper
  • sdk/geolocation/go/constants.go — GeolocationUserSeed and MaxTargets constants

Testing Verification

  • Serialization round-trip tests for GeolocationUser with targets, empty targets, and individual target structs
  • Deserialize wrapper tests: happy path, wrong account type, truncated data
  • PDA derivation tests: determinism, uniqueness across codes, empty/too-long code rejection
  • Client tests: mock RPC happy path and not-found for both single and batch fetch
  • Enum String() method coverage for all new enum types

@ben-dz ben-dz force-pushed the bdz/doublezero-3012 branch from 83b0f0f to b1242b7 Compare March 18, 2026 18:41
@ben-dz ben-dz requested a review from nikw9944 March 18, 2026 18:43
@ben-dz ben-dz marked this pull request as ready for review March 18, 2026 18:43
@ben-dz ben-dz enabled auto-merge (squash) March 19, 2026 18:41
@ben-dz ben-dz merged commit 837da06 into main Mar 19, 2026
31 checks passed
@ben-dz ben-dz deleted the bdz/doublezero-3012 branch March 19, 2026 18:52
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.

geolocation: Go Read SDK — GeolocationUser types, deserialization, and read methods

2 participants