Skip to content

Conversation

@mindrunner
Copy link
Owner

No description provided.

@mindrunner mindrunner force-pushed the feature/c4-migration branch from 6ca4756 to 773f339 Compare January 21, 2026 14:13
- Update deps: @solana/kit, solana-kite, @staratlas/dev-sage
- Remove: @solana/web3.js, @coral-xyz/anchor, @staratlas/sage
- Rewrite: connection, wallet, tx sending with Kit patterns
- Delete: anchor.ts, programs.ts (no longer needed)
- Add: C4 migration plan in docs/
- Add account-registry.ts with discriminator-based decoding
- Add account-fetcher.ts with fetchAllAccounts/fetchAccount utils
- Add types.ts with AccountWithKey and C4 type re-exports
- Rewrite user-account.ts with Profile/Character/KeyPairSigner
- Rewrite game.ts to use account-fetcher
- Rewrite fleet-state types for __kind discriminators
- Update coordinates.ts to use bigint (no more BN)
- Update transform-sector/time for bigint
- Delete obsolete type-guard files (replaced by __kind)
Rewrote core fleet actions using dev-sage instruction functions:
- dock/undock: getIdleToDockedInstruction, getDockedToIdleInstruction
- move/end-move/stop-subwarp: getWarpToCoordinateInstruction, getStartSubwarpInstruction, getTheOneFleetStateHandlerInstruction, getStopSubwarpInstruction
- mine/end-mine: getStartMiningAsteroidInstruction, getStopMiningAsteroidInstruction
- cargo: getTransferCargoToFleetInstruction with cargoId-based transfers

Deleted ix/ folder (23 files) - inlined into act layer
Removed non-core act files (create-fleet, deposit-cargo, etc.)

Patterns: AccountWithKey<T>, KeyPairSigner, Address, fleet.state.__kind
Error reduction: 588 -> 392 (33%)
- Rewrite fleet-cargo.ts: cargo now on Fleet struct directly
- Rewrite user-fleets.ts: use fetchAllAccounts pattern
- Delete cargo-types.ts, cargo-stats-definition.ts, get-fleet-ships.ts: obsolete in C4
- Rewrite starbases.ts: starbase now embedded in StarSystem
- Rewrite starbase-by-*.ts: use StarSystem with starbase field
- Rewrite starbase-player.ts: use findStarbasePlayerPda pattern
- Rewrite planets*.ts: Planet -> CelestialBody
- Rewrite resources.ts, mine-items.ts: resource data embedded in CelestialBody
- Rewrite world-map.ts: new WorldMap structure for C4
- Stub profile.ts, pod-cleanup.ts, get-random-fleet.ts: TODO for C4
- Fix ships.ts: remove legacy imports
- Update util.ts, show-fleet-*.ts, settle-fleet.ts: use C4 types

Error count: 433 -> 317 (~27% reduction)
- Migrate all FSM files to C4 types (kind, Docked, coordinates)
- Update strategy files: Game → AccountWithKey<Game>
- Fix resource refs: game.data.mints → resource config
- Remove legacy R4 code: src/lib/, fleetbot/, airdrop/, service/fleet, service/gm
- Fix priority fee types: IInstruction → Instruction
- Clean compile with 0 errors
- Rewrite airdrop.ts using Kit types (Address, KeyPairSigner)
- Use superagent directly for airdrop requests
- Integrate with C4 player context for profile checking
Remove deleted fleetbot entry from tsup.config.ts, package.json
script, and docker/bin/fleetbot.sh to fix CI/CD build failures.
@mindrunner mindrunner force-pushed the feature/c4-migration branch from 7a8500c to a0d9bb9 Compare January 21, 2026 14:16
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.

2 participants