@txfence/solana
v0.1.2
Published
Solana chain adapter for txfence. Simulation, transaction building, signing, and broadcast for Solana mainnet, devnet, and testnet.
Readme
@txfence/solana
Solana chain adapter for txfence. Simulation, transaction building, signing, and broadcast against Solana mainnet, devnet, and testnet.
Installation
npm install @txfence/solana @txfence/core @solana/kitQuick start
import { createAgent, type Policy } from '@txfence/core'
import {
simulateSolanaAction,
executeSolanaAction,
privateKeySolanaSignerFromBytes,
} from '@txfence/solana'
const signer = privateKeySolanaSignerFromBytes(secretKeyBytes)
const agent = createAgent(
{ chains: ['solana-mainnet'], policies: policy, signer },
{ 'solana-mainnet': { simulate: simulateSolanaAction } },
{ 'solana-mainnet': 'https://api.mainnet-beta.solana.com' },
(action, chainId, rpcUrl, evaluation, simulation) =>
executeSolanaAction(action, chainId, rpcUrl, signer, evaluation, simulation),
)Supported chains
solana-mainnetsolana-devnetsolana-testnet
Use isSolanaChain(chainId) to gate Solana-specific code paths.
Building transactions outside the pipeline
buildSolanaTransaction() produces a SolanaSerializedTransaction suitable for offline signing or external broadcast:
import { buildSolanaTransaction } from '@txfence/solana'
const tx = await buildSolanaTransaction(action, 'solana-mainnet', rpcUrl, fromAddress)Signer
SolanaSigner mirrors the EVM Signer shape. privateKeySolanaSignerFromBytes wraps a 64-byte ed25519 keypair; bring your own custodial or HSM signer by implementing the SolanaSigner interface.
Exports
simulateSolanaAction— pre-flight simulationbuildSolanaTransaction,executeSolanaAction— build and broadcastprivateKeySolanaSignerFromBytes— keypair-backed signerisSolanaChain,SolanaChainId— chain id helpers
Full project README: https://github.com/AdityaChauhanX07/txfence
License
MIT
