Installation
Install GLIN SDK for your preferred language.
Prerequisites
- TypeScript
- Rust
- Node.js 18 or later
- npm, yarn, or pnpm package manager
Check your Node.js version:
node --version
- Rust 1.70 or later
- Cargo package manager (included with Rust)
Install Rust if you haven't already:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Check your Rust version:
rustc --version
Install SDK
- TypeScript
- Rust
Install via your preferred package manager:
npm:
npm install @glin-ai/sdk
yarn:
yarn add @glin-ai/sdk
pnpm:
pnpm add @glin-ai/sdk
For TypeScript Projects
If you're using TypeScript, the SDK includes built-in type definitions. No additional @types
packages needed!
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"lib": ["ES2020"],
"types": ["node"]
}
}
Add GLIN SDK to your Cargo.toml
:
[dependencies]
glin-client = "0.1"
glin-contracts = "0.1"
glin-types = "0.1"
tokio = { version = "1", features = ["full"] }
anyhow = "1"
Or use cargo add
:
cargo add glin-client glin-contracts glin-types
cargo add tokio --features full
cargo add anyhow
Version Compatibility
The GLIN Rust SDK requires:
- Rust 1.70+
- Tokio runtime for async operations
- Compatible with Substrate-based chains
Verify Installation
Let's verify the SDK is installed correctly:
- TypeScript
- Rust
Create a test file test.ts
:
import { GlinClient } from '@glin-ai/sdk';
console.log('✅ GLIN SDK installed successfully!');
console.log('Version:', require('@glin-ai/sdk/package.json').version);
Run it:
npx tsx test.ts
# or
node --loader ts-node/esm test.ts
Create a test file src/main.rs
:
use glin_client;
fn main() {
println!("✅ GLIN SDK installed successfully!");
println!("Version: {}", env!("CARGO_PKG_VERSION"));
}
Run it:
cargo run
Optional Dependencies
TypeScript
For browser-based applications:
npm install @polkadot/extension-dapp
For Next.js apps:
npm install @glin-ai/sdk next@15
Rust
For CLI development:
cargo add colored indicatif clap --features clap/derive
For indexer development:
cargo add sqlx --features runtime-tokio-rustls,postgres
What's Next?
Now that you have the SDK installed, let's build your first app:
Troubleshooting
Node.js: Module not found
If you see Cannot find module '@glin-ai/sdk'
:
- Make sure you're in the correct directory
- Run
npm install
again - Delete
node_modules
andpackage-lock.json
, then reinstall
Rust: Compilation errors
If you see compilation errors:
- Update Rust:
rustup update
- Make sure you're using Rust 1.70+:
rustc --version
- Clear cache:
cargo clean && cargo build
Network Connection Issues
Make sure you can reach the GLIN testnet:
curl -I https://testnet.glin.ai
Still having issues? Ask on Discord