feat(sdk): add 6 account management API endpoints#132
Conversation
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.
|
Reviewed this against everything currently shipped on our fork's Diff Two issues found and fixed in the process (pushed as new commits):
Verified PR description updated to reflect all 5 commits now on this branch. |
…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.
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.
# Conflicts: # cgo/coverage_report.txt
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
NetworkUserwithAuthTypes/WalletAddressso clients can show all linked auth methods without a local heuristic.New Endpoints (all authenticated via JWT)
/auth/generate-seedphrase/auth/regenerate-seedphrase/auth/add-auth/auth/remove-authauth_type/account/change-name/account/claim-nameRestored Seedphrase Fields
AuthLoginArgs.Seedphrase— allows sign-in via seedphraseNetworkCreateResult.Seedphrase— returns seedphrase on instant account creationNetworkUser additions
NetworkUser.AuthTypes(*StringList,auth_types) — flat array of all linked auth methods (e.g.["solana","seedphrase"]) fromGET /network/userNetworkUser.WalletAddress(string,wallet_address) — primary wallet address for quick accessFixups included in this PR
AddAuthArgs*stringfields changed tostring— gomobile can't bridge*stringstruct fields to Swiftgofmtfix for theNetworkUserstruct tag alignmentNetworkUserViewController.FetchNetworkUsernow copiesAuthTypes/WalletAddressinto its manually-constructedNetworkUser— it previously dropped both fields, so any consumer using theNetworkUserViewControllerpattern (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 callsApi.GetNetworkUserdirectly.Verified
go build ./...succeeds andgofmt -lis clean on all files touched by this PR.