Skip to content

Gill

gill

gill is a modern SDK for interacting with the Solana blockchain, providing a clean, high-performance API to help developers quickly build Solana applications.

Official Website: https://www.gillsdk.com/

Core Features

Modern Design - Clean and intuitive API - TypeScript first - Complete type definitions - Excellent developer experience

High Performance - Optimized serialization/deserialization - Efficient RPC calls - Smart caching mechanism - Concurrent request optimization

Ease of Use - Clear documentation - Rich example code - Quick to get started - Active community support

Main Features

1. On-chain Data Queries Retrieve account, transaction, block, and other information:

import { gill } from 'gill-sdk';

// Query account info
const account = await gill.getAccount(publicKey);

// Query transaction
const transaction = await gill.getTransaction(signature);

// Query balance
const balance = await gill.getBalance(address);

2. Transaction Building and Sending Simplified transaction building flow:

// Build a transfer transaction
const tx = await gill.transfer({
  from: sender,
  to: receiver,
  amount: 1_000_000, // lamports
});

// Sign and send
const signature = await gill.sendAndConfirm(tx);

3. Program Interaction Invoking smart contracts:

// Call a program instruction
const result = await gill.program(programId).methods
  .initialize(params)
  .accounts(accounts)
  .rpc();

4. Token Operations Convenient SPL Token operations:

// Create a token account
const tokenAccount = await gill.token.createAccount(mint, owner);

// Transfer tokens
await gill.token.transfer({
  source: sourceAccount,
  destination: destAccount,
  amount: 100,
});

5. NFT Support NFT-related operations (e.g., Metaplex support):

// Get NFT metadata
const nft = await gill.nft.get(mintAddress);

// Query wallet NFTs
const nfts = await gill.nft.findByOwner(ownerAddress);

Use Cases

Frontend DApps - React/Vue/Next.js applications - Wallet integration - DeFi interfaces - NFT marketplaces

Backend Services - Transaction monitoring - Data indexing - Automated tasks - API services

Scripts and Tools - Batch operations - Data export - Testing tools - Deployment scripts

Bot Development - Trading bots - Arbitrage programs - Monitoring alerts - Automated trading

Comparison with Other SDKs

Feature gill @solana/web3.js Anchor TS
Ease of Use Very high Moderate High
Type Support Complete Partial Complete
Performance Optimized Standard Standard
Feature Richness Rich Basic Strong program interaction
Learning Curve Gentle Moderate Steep
Use Case General development General development Anchor programs

Quick Start

Installation

npm install gill-sdk
# or
yarn add gill-sdk

Initialization

import { Gill } from 'gill-sdk';

const gill = new Gill({
  endpoint: 'https://api.mainnet-beta.solana.com',
  // Or use a professional RPC
  // endpoint: 'https://your-helius-endpoint',
});

Basic Example

// Query SOL balance
const balance = await gill.getBalance(publicKey);
console.log(`Balance: ${balance / 1e9} SOL`);

// Transfer
const tx = await gill.transfer({
  from: fromKeypair,
  to: toPublicKey,
  amount: 0.1 * 1e9, // 0.1 SOL
});

const signature = await gill.sendAndConfirm(tx);
console.log(`Transaction: ${signature}`);

Advanced Features

1. Batch Operations Send multiple transactions at once:

const results = await gill.batch([
  gill.transfer({ from, to: to1, amount: 1e9 }),
  gill.transfer({ from, to: to2, amount: 1e9 }),
]);

2. Transaction Simulation Simulate a transaction before sending:

const simulation = await gill.simulate(transaction);
if (simulation.err) {
  console.error('Transaction will fail:', simulation.err);
}

3. Event Listening Listen to on-chain events:

gill.onTransaction(programId, (tx) => {
  console.log('New transaction:', tx);
});

4. Custom Serialization Efficient data serialization:

const data = gill.serialize(myData, schema);
const parsed = gill.deserialize(buffer, schema);

Performance Optimization

Connection Pool Management gill automatically manages RPC connection pools to improve concurrency performance.

Smart Caching Frequently queried data is automatically cached to reduce RPC calls.

Batch Requests Multiple requests are automatically merged to improve efficiency.

Retry Mechanism Automatic retry on network failures to improve reliability.

Best Practices

1. Use Professional RPCs A professional RPC is recommended for production environments, such as Helius or QuickNode:

const gill = new Gill({
  endpoint: process.env.HELIUS_RPC_URL,
});

2. Error Handling Comprehensive error handling:

try {
  await gill.sendAndConfirm(tx);
} catch (error) {
  if (error.code === 'INSUFFICIENT_FUNDS') {
    console.error('Insufficient balance');
  }
}

3. Environment Configuration Separate development and production environments:

const gill = new Gill({
  endpoint: process.env.NODE_ENV === 'production'
    ? MAINNET_ENDPOINT
    : DEVNET_ENDPOINT,
});

4. Type Safety Fully leverage TypeScript:

import { PublicKey, Transaction } from 'gill-sdk';

function sendSOL(to: PublicKey, amount: number): Promise<string> {
  // TypeScript provides complete type checking
}

Community and Support

Official Resources - Official Website: https://www.gillsdk.com/ - Documentation: Detailed API documentation and tutorials - GitHub: Open source code and examples

Community - Discord community - GitHub Issues - Regular updates and maintenance

Development Status

gill is under active development: - New features are continuously being added - Regular updates and optimizations - Community feedback driven

  • @solana/web3.js: Solana's official JavaScript SDK, an alternative to gill
  • Anchor: Smart contract development framework, also provides a TypeScript client
  • RPC: Remote Procedure Call, gill interacts with Solana via RPC
  • SDK: Software Development Kit, wrapping low-level APIs to provide convenient interfaces
  • TypeScript: A superset of JavaScript providing type safety