Skip to content

feat(sdk): add 6 account management API endpoints#132

Draft
Ryanmello07 wants to merge 7 commits into
urnetwork:mainfrom
Ryanmello07:feat/upstream-pr
Draft

feat(sdk): add 6 account management API endpoints#132
Ryanmello07 wants to merge 7 commits into
urnetwork:mainfrom
Ryanmello07:feat/upstream-pr

Conversation

@Ryanmello07

@Ryanmello07 Ryanmello07 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds 6 new SDK API endpoints for account management, plus restores Seedphrase fields needed for seedphrase-based sign-in and instant account creation flows on iOS. Also extends NetworkUser with AuthTypes/WalletAddress so clients can show all linked auth methods without a local heuristic.

New Endpoints (all authenticated via JWT)

Endpoint HTTP Description
/auth/generate-seedphrase POST Generate a new seedphrase for the account
/auth/regenerate-seedphrase POST Regenerate the account's seedphrase
/auth/add-auth POST Add an authentication method
/auth/remove-auth POST Remove an authentication method by auth_type
/account/change-name POST Change the network name
/account/claim-name POST Claim a new network name

Restored Seedphrase Fields

  • AuthLoginArgs.Seedphrase — allows sign-in via seedphrase
  • NetworkCreateResult.Seedphrase — returns seedphrase on instant account creation

NetworkUser additions

  • NetworkUser.AuthTypes (*StringList, auth_types) — flat array of all linked auth methods (e.g. ["solana","seedphrase"]) from GET /network/user
  • NetworkUser.WalletAddress (string, wallet_address) — primary wallet address for quick access

Fixups included in this PR

  • AddAuthArgs *string fields changed to string — gomobile can't bridge *string struct fields to Swift
  • gofmt fix for the NetworkUser struct tag alignment
  • NetworkUserViewController.FetchNetworkUser now copies AuthTypes/WalletAddress into its manually-constructed NetworkUser — it previously dropped both fields, so any consumer using the NetworkUserViewController pattern (the cgo-exported path, e.g. non-iOS platforms) would always see them as nil/empty regardless of server response. iOS is unaffected since it calls Api.GetNetworkUser directly.

Verified go build ./... succeeds and gofmt -l is clean on all files touched by this PR.

Add SDK functions for seedphrase generation, auth method management,
and network name management:

- GenerateSeedphrase: POST /auth/generate-seedphrase
- RegenerateSeedphrase: POST /auth/regenerate-seedphrase
- AddAuth: POST /auth/add-auth
- RemoveAuth: POST /auth/remove-auth (auth_type: email, phone, apple, google, solana, seedphrase)
- ChangeNetworkName: POST /account/change-name
- ClaimNetworkName: POST /account/claim-name

Also adds Seedphrase field to AuthLoginArgs and NetworkCreateResult
for seedphrase-based sign-in flows.

All endpoints follow the existing AuthLogin/NetworkCreate pattern
using connect.HttpPostWithRawFunction with JWT auth.
…bility

Gomobile cannot expose Go *string pointer fields to Swift via
setters or direct property access. Changed UserAuth, Password,
AuthJwt, AuthJwtType from *string to string to match the
pattern used by AuthLoginArgs, NetworkCreateArgs, and all
other SDK struct types.
- AuthTypes *StringList — flat array of all linked auth methods
  (e.g. ["solana","seedphrase"]) from GET /network/user
- WalletAddress string — primary wallet address for quick access
Align WalletAddress/AuthTypes struct tag columns with the rest of
NetworkUser (added in 615f80c without running gofmt).
…tchNetworkUser

FetchNetworkUser manually rebuilds a NetworkUser from the API result
field-by-field. 615f80c added AuthTypes/WalletAddress to the struct
but never added them to this mapping, so any consumer using the
NetworkUserViewController pattern (the cgo-exported path other
platforms use) always got a nil/empty value for both fields
regardless of what the server returned. iOS is unaffected since it
calls Api.GetNetworkUser directly and reads the raw result instead
of going through this view controller.
@Ryanmello07

Copy link
Copy Markdown
Contributor Author

Reviewed this against everything currently shipped on our fork's beta/custom-server branch (which has been running in production beta) to make sure nothing feature-worthy was left behind after the initial cherry-pick.

Diff feat/upstream-pr vs beta/custom-server: the only differences were .github/workflows/beta-build.yml (fork-only CI), an internal agent progress-tracking doc, and planning docs for an unrelated, already-merged feature (solana wallet challenge login). api.go, network_user_view_controller.go, and all generated cgo/* bindings are byte-identical — so this PR already contains all the account-management-endpoints feature code that's live on beta. Nothing was cherry-picked in as a result of this pass.

Two issues found and fixed in the process (pushed as new commits):

  1. gofmt had drifted on the NetworkUser struct (WalletAddress/AuthTypes tag columns weren't aligned).
  2. Real bug: NetworkUserViewController.FetchNetworkUser manually rebuilds NetworkUser field-by-field and never picked up the new AuthTypes/WalletAddress fields, so any consumer using the NetworkUserViewController pattern (the cgo-exported path other platforms use) would always get nil/empty for both regardless of the server response. iOS doesn't hit this since it calls Api.GetNetworkUser directly and reads the raw result.

Verified go build ./... succeeds and gofmt -l is clean on the touched files (using the correct beta/custom-server-branch connect/glog siblings, matching the CI setup).

PR description updated to reflect all 5 commits now on this branch.

Ryanmello07 added a commit to Ryanmello07/urnetwork-sdk that referenced this pull request Jul 20, 2026
…tchNetworkUser

FetchNetworkUser manually rebuilds a NetworkUser from the API result
field-by-field but never copied AuthTypes/WalletAddress, so any
consumer using the NetworkUserViewController pattern (the cgo-exported
path other platforms use, e.g. Android) always got nil/empty for both
fields regardless of what the server returned. iOS is unaffected since
it calls Api.GetNetworkUser directly and reads the raw result.

Same fix already applied upstream on feat/upstream-pr (commit 4ba16b9,
PR urnetwork#132); this brings beta/custom-server in line so
Android builds pick it up.
Ryanmello07 and others added 2 commits July 20, 2026 20:41
Pulls in upstream's connection/perf fixes (perf and correctness fixes,
perf improvements). Only real conflict was cgo/coverage_report.txt (a
generated file) -- resolved by regenerating it via cgo/gen, which now
reports 540 exported symbols reflecting both this PR's new endpoints
and upstream's additions. Everything else (exports_gen.go, the
generated headers/def file, and all logic files) merged cleanly with
no manual resolution needed.

Verified against upstream connect@main (paired dependency for
upstream's new commits): go build ./..., go vet ./..., and
go test -run=NoSuchTest ./... (compile-only) all clean.
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.

1 participant