It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
70%
Published
9 months ago (1.0.0)
IQ-6900
A Solana-based utility for retrieving and processing on-chain data from the IQ blockchain.
Installation
# Using pnpm (recommended) pnpm add @sterling/iq-6900 # Using npm npm install @sterling/iq-6900 # Using yarn yarn add @sterling/iq-6900 # Using Deno import { getOnchainJson, getOnchainData } from "@sterling/iq-6900";
Usage
The library provides APIs for retrieving on-chain JSON data:
Get Raw JSON String
import { getOnchainJson } from "@sterling/iq-6900"; // Pass configuration options const jsonString = await getOnchainJson({ walletAddress: "your-wallet-address", rpcUrl: "https://api.mainnet-beta.solana.com", // Optional apiHost: "https://solanacontractapi.uc.r.appspot.com", // Optional }); console.log(jsonString);
Get Parsed JSON Data (Recommended)
import { getOnchainData } from "@sterling/iq-6900"; // This will automatically parse the JSON for you const data = await getOnchainData({ walletAddress: "your-wallet-address", }); if (data) { // TypeScript support with generic type parameter const typedData = await getOnchainData<YourDataType>({ walletAddress: "your-wallet-address", }); console.log(data.someProperty); }
The original function is still available for backward compatibility:
import { bringAgentWithWalletAddress } from "@sterling/iq-6900"; const jsonString = await bringAgentWithWalletAddress({ walletAddress: "your-wallet-address", });
Configuration Options
All functions require a configuration object with the following options:
| Option | Description | Default |
|---|---|---|
walletAddress |
Your Solana wallet address (required) | None - must be provided |
rpcUrl |
Solana RPC URL (optional) | "https://api.mainnet-beta.solana.com" |
apiHost |
IQ Contract API host (optional) | "https://solanacontractapi.uc.r.appspot.com" |
Development
Setup
# Clone the repository git clone https://github.com/sterling/iq-6900.git cd iq-6900 # Install dependencies pnpm install
Testing
# Run tests pnpm test # Run tests with coverage pnpm test:coverage # Run tests in watch mode pnpm test:watch
Building
# Build the package pnpm build
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
Publishing
To publish a new version:
- Install the JSR CLI:
pnpm add -g @jsr/cli - Login:
jsr auth - Publish:
jsr publish
License
ISC
Add Package
deno add jsr:@sterling/iq-6900
Import symbol
import * as iq_____ from "@sterling/iq-6900";
Import directly with a jsr specifier
import * as iq_____ from "jsr:@sterling/iq-6900";
Add Package
pnpm i jsr:@sterling/iq-6900
pnpm dlx jsr add @sterling/iq-6900
Import symbol
import * as iq_____ from "@sterling/iq-6900";
Add Package
yarn add jsr:@sterling/iq-6900
yarn dlx jsr add @sterling/iq-6900
Import symbol
import * as iq_____ from "@sterling/iq-6900";
Add Package
vlt install jsr:@sterling/iq-6900
Import symbol
import * as iq_____ from "@sterling/iq-6900";
Add Package
npx jsr add @sterling/iq-6900
Import symbol
import * as iq_____ from "@sterling/iq-6900";
Add Package
bunx jsr add @sterling/iq-6900
Import symbol
import * as iq_____ from "@sterling/iq-6900";