Other Chains Integration
Supported Non-EVM Chains​
Solana​
solana-connector.ts
import { Connection, PublicKey } from '@solana/web3.js';
class SolanaConnector {
private connection: Connection;
constructor(endpoint: string) {
this.connection = new Connection(endpoint);
}
async subscribeProgramAccount(programId: string) {
const publicKey = new PublicKey(programId);
this.connection.onProgramAccountChange(
publicKey,
(accountInfo, context) => {
// Process account changes
this.processAccountChange(accountInfo);
}
);
}
}
Near​
near-connector.ts
import { connect, keyStores, Near } from 'near-api-js';
class NearConnector {
private near: Near;
async initialize() {
this.near = await connect({
networkId: 'mainnet',
keyStore: new keyStores.InMemoryKeyStore(),
nodeUrl: 'https://rpc.mainnet.near.org'
});
}
async subscribeToEvents(contractId: string) {
const account = await this.near.account(contractId);
// Subscribe to contract events
}
}
Chain-Specific Considerations​
Solana​
- Account model vs UTXO
- Program Derived Addresses (PDAs)
- Transaction confirmation strategies
Near​
- Account structure
- Gas fee model
- State access patterns
Best Practices​
-
Chain-Specific Optimizations
- Use native APIs when available
- Implement proper retry logic
- Handle chain-specific error cases
-
Data Consistency
- Validate transaction finality
- Handle chain reorganizations
- Implement proper checkpointing
-
Resource Management
- Monitor RPC usage
- Implement connection pooling
- Handle rate limiting
Next Steps​
- Check Best Practices
- Contact us for chain-specific guidance