@gorbagana/web3.js
v1.0.1
Published
Gorbagana JavaScript SDK - Solana Web3.js for Gorbagana Network
Maintainers
Readme
@gorbagana/web3.js
JavaScript SDK for interacting with the Gorbagana blockchain network - a Solana fork with GOR as the native token.
Installation
npm install @gorbagana/web3.jsQuick Start
const gorbagana = require('@gorbagana/web3.js');
// Connect to Gorbagana
const connection = new gorbagana.Connection(); // Defaults to http://localhost:8899
// Get cluster info
const info = await gorbagana.getGorbaganaClusterInfo(connection);
console.log('Genesis Hash:', info.genesisHash);
console.log('Total Supply:', info.supply.value.total / 1e9, 'GOR');Features
- Full compatibility with Solana Web3.js API
- Pre-configured Gorbagana network endpoints
- Built-in Gorbagana program addresses
- TypeScript support
- Helper functions for common Gorbagana operations
Usage Examples
Basic Connection
const { Connection } = require('@gorbagana/web3.js');
// Connect to default Gorbagana RPC
const connection = new Connection();
// Or specify custom endpoint
const customConnection = new Connection('http://your-gorbagana-node:8899');Using Gorbagana Program IDs
const { GORBAGANA_PROGRAM_IDS } = require('@gorbagana/web3.js');
// Access Gorbagana SPL Token Program
const tokenProgramId = GORBAGANA_PROGRAM_IDS.TOKEN_PROGRAM_ID;
console.log('Token Program:', tokenProgramId.toBase58());
// Output: GhCZfX98EqFNZoKzbW7psCjDkFg7WcZRBMkr5gFxA6ujWorking with Known Addresses
const { GORBAGANA_ADDRESSES, Connection } = require('@gorbagana/web3.js');
const connection = new Connection();
// Check team multisig balance
const balance = await connection.getBalance(GORBAGANA_ADDRESSES.TEAM_MULTISIG);
console.log('Team Balance:', balance / 1e9, 'GOR');Creating Transactions
const {
Connection,
Transaction,
SystemProgram,
sendAndConfirmTransaction,
Keypair,
LAMPORTS_PER_SOL
} = require('@gorbagana/web3.js');
const connection = new Connection();
const payer = Keypair.generate(); // Use your actual keypair
// Create a transfer transaction
const transaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey: payer.publicKey,
toPubkey: GORBAGANA_ADDRESSES.FAUCET,
lamports: 1 * LAMPORTS_PER_SOL, // 1 GOR
})
);
// Send transaction
const signature = await sendAndConfirmTransaction(connection, transaction, [payer]);
console.log('Transaction signature:', signature);Program Addresses
| Program | Solana Address | Gorbagana Address | |---------|----------------|-------------------| | SPL Token | TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA | GhCZfX98EqFNZoKzbW7psCjDkFg7WcZRBMkr5gFxA6uj | | Token 2022 | TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb | 3LfFqp4WFYy8gc9TiysgSxh9i8TCqrmvUuxuawyA3f2S | | ATA | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | 9S3cCu3JThRhKMD1QNf4WVrWzmzy1caUEFN8LaszSBnm |
Constants
// Network Configuration
GORBAGANA_RPC_ENDPOINT = 'http://localhost:8899'
GORBAGANA_GENESIS_HASH = 'E7pCHCmZKJCdHJy3SFWC2iQj86c36WSmzZNTvuLWFZqL'
// Known Addresses
TEAM_MULTISIG = '62fw621KsHjW3oSU7yXjuwezU1Ssaxkj7qS8B4AAh69R'
VALIDATOR_IDENTITY = 'ACcUHcKeWHFiTcUhcroJDDisv2Vn2G2mqEjXBuES1fPj'
FAUCET = '3DtKNjWYz3nfrp4GSM7Zx5uFE8SC5sH5kDCz24PhuzNg'Key Differences from Solana
- Native Token: GOR instead of SOL (1 GOR = 1,000,000,000 lamports)
- Total Supply: 1.4 billion GOR
- Program Addresses: Custom addresses for all SPL programs
- Network: Optimized for single validator operation
- Genesis Hash: Custom genesis block specific to Gorbagana
API Compatibility
This package extends @solana/web3.js and maintains full API compatibility. All Solana Web3.js methods and classes are available, with Gorbagana-specific configurations applied automatically.
Development
# Clone the repository
git clone https://github.com/gorbagana/gorbagana-web3js.git
# Install dependencies
npm install
# Build
npm run build
# Run example
node examples/basic-usage.jsSupport
- GitHub Issues: https://github.com/gorbagana/gorbagana-web3js/issues
- Documentation: https://docs.gorbagana.com
- Discord: https://discord.gg/gorbagana
License
MIT
