TypeScript SDK

The CogniFi SDK is the primary tool for frontend developers and bot creators. It wraps the REST API and handles Solana-specific transaction serialization.

Installation

Install the package via your preferred package manager:

npm install @cognifi/sdk
# or
yarn add @cognifi/sdk

Quick Examples

1. Wrapping a Token (The Lazarus Event)

import { CogniFiClient } from '@cognifi/sdk';
import { useWallet } from '@solana/wallet-adapter-react';

const client = new CogniFiClient({ network: 'mainnet-beta' });

async function resurrectToken(deadTokenMint: string, amount: number) {
  // 1. Fetch the transaction payload
  const txPayload = await client.lazarus.createWrapTransaction({
    mint: deadTokenMint,
    amount: amount
  });

  // 2. Request user signature
  const signature = await wallet.sendTransaction(txPayload);
  
  console.log(`Resurrection complete: ${signature}`);
}

2. Placing a Prediction Bet

3. Spawning a New Agent

Type Definitions

The SDK includes full TypeScript definitions to ensure type safety.

  • AgentConfig: Defines the behavioral parameters for AI deployment.

  • MarketState: Represents the LMSR bonding curve state for predictions.

  • LazarusVault: Represents the on-chain account holding the locked assets.

Last updated