refactor: drop dbart01/solana-swift dependency#259
Open
Conversation
A small Sendable-clean Solana JSON-RPC client covering the three RPCs the app calls today (latest blockhash, send transaction, simulate transaction). Sets up the seam needed to retire the dbart01/solana-swift dependency in a follow-up commit on this branch.
The legacy account-key sort grouped programs at the end of the read-only section based on a heuristic flag that was only true for accounts added through the program slot, leaving system and sysvar programs sorted alongside non-program accounts. Replaces it with the canonical payer/signer/writable/lex ordering and pins the encoder output with a fixture-based regression test that has been validated as wire-valid.
Cuts the Phantom external-wallet path over to FlipcashCore's own Solana RPC client and transaction encoder. Removes the @preconcurrency import plus the @retroactive @unchecked Sendable workaround the dependency required, and pulls TweetNacl in as a direct package since it was previously transitive through SolanaSwift.
Caches the JSONEncoder and JSONDecoder on the client so a fresh pair isn't allocated per call. Hoists the encoded-bytes test fixture decode to a static, and trims doc comments that restated the name without adding constraint or rationale.
The init paired an optional rpc parameter with a nil-coalesce to a default client, which was just a roundabout way of expressing a default value. There's no scenario where an absent RPC is meaningful, so the parameter takes the production client as its default directly.
6bdfb7a to
287ca11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the dbart01/solana-swift fork with a small Sendable-clean Solana JSON-RPC client living next to the existing transaction encoder in FlipcashCore. The Phantom external-wallet flow now serializes its own transactions instead of round-tripping through SolanaSwift's encoder, which surfaced and fixed a latent ordering bug in the legacy message account-key sort along the way.
Test plan