feat: implement Solana chain module (#22)#31
Open
zeroknowledge0x wants to merge 1 commit into
Open
Conversation
New module: chain/solana_connector.rs - SolanaConnector: RPC connection, SOL balance, SOL/SPL transfers - Support for mainnet, devnet, custom RPC endpoints - SPL token operations (balance, transfer with auto-ATA creation) New module: chains/solana.rs - SolanaConstants: well-known program IDs and token mints (USDC, USDT, BONK, JTO, JUP, MSOL) - SplTokenClient: typed client for SPL token operations - Unit tests for mint parsing and client construction Updated: - Chain enum: added Solana, SolanaDevnet variants - chain/mod.rs: is_solana() helper, explorer URLs - chains/mod.rs: expose solana module - examples/multi_chain.rs: Solana devnet queries alongside EVM chains - lib.rs: prelude exports for Solana types - Cargo.toml: solana-sdk, solana-client, spl-token, spl-associated-token-account - README.md: Solana status updated from Planned to MVP Closes kcolbchain#22
Contributor
|
Welcome to kcolbchain, @zeroknowledge0x — glad you're here. 🌱 Here's what happens from this PR:
While you wait:
What happens after your first merge
Thanks for writing the code. We're building this to last. |
Contributor
|
🤖 Audit verdict: Legitimate Solana blockchain integration with clean code, proper error handling, no credentials, no malicious payloads, and all dependencies are official Solana packages. Audited by the kcolbchain PR pipeline. See pipeline docs. |
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
Implements the Solana chain module as requested in #22. Adds Solana connectivity, SOL/SPL token operations, and well-known token constants.
Closes #22
What's Implemented
New:
chain/solana_connector.rsSolanaConnector— Solana RPC client with the same ergonomic pattern asChainConnectormainnet(),devnet(),with_rpc()constructorsbalance(address)— SOL balance in lamportsbalance_sol(address)— SOL balance as f64spl_balance(mint, owner)— SPL token balancetransfer_sol(from, to, lamports)— SOL transfertransfer_spl(from, mint, to, amount)— SPL token transfer with auto-ATA creationslot()— current slot (equivalent to block height)account_info(address)— raw account dataNew:
chains/solana.rsSolanaConstants— well-known program IDs and token mints:SplTokenClient— typed client for SPL token operations:usdc(),usdt(),bonk()constructors with correct decimalsbalance(),balance_ui(),transfer()methodsUpdated
Chainenum: AddedSolanaandSolanaDevnetvariants withis_solana()helperchain/mod.rs: Solana RPC URLs, explorer URLs, native token (SOL)chains/mod.rs: Exposesolanamoduleexamples/multi_chain.rs: Solana devnet queries alongside EVM chainslib.rs: Prelude exports forSolanaConstantsandSplTokenClientCargo.toml:solana-sdk,solana-client,spl-token,spl-associated-token-accountREADME.md: Solana status updated from "Planned" to "MVP"Acceptance Criteria
chain/solana.rs(implemented aschain/solana_connector.rs+chains/solana.rs)solana-clientcrateexamples/multi_chain.rsNotes
SolanaConnectorwas created alongside the existing EVMChainConnectorsolana-test-validatorintegration tests require a running local validator — unit tests are provided for offline validationPayment
Wallet EVM:
0x036E525f4569865DA76A0ef758304b309740aeef