Catalog npm
Back to packageRELEASE DETAILS

1.0.0

npm

@0xshikhar/nexus-agents-atoma

A specialized AI agent package for interacting with the Sui blockchain on top of the Atoma agent with support for Aftermath Finance operations, SuiLend, Navi and Bluefin.

Published10 Feb 2025
Direct dependencies15
Transitive dependenciesNot calculated

README

Current package documentation

Nexus Agent Package

A specialized AI agent package for interacting with the Sui blockchain on top of the Atoma agent with support for Aftermath Finance operations, SuiLend, Navi and Bluefin.

Features

Price Operations

  • Get single token prices
  • Get multiple token prices in one query
  • Price tracking and historical data

Pool Operations

  • Get detailed pool information
  • List all available pools
  • Get pool events (deposits/withdrawals)
  • Rank pools by various metrics (APR, TVL, fees, volume)
  • Filter pools by criteria (min TVL, min APR, tokens)

Trading Operations

  • Get spot prices between tokens
  • Calculate trade outputs
  • Find optimal trade routes
  • Generate deposit transactions
  • Generate withdrawal transactions

Transaction Operations

  • Transfer single coins
  • Multi-coin transfers
  • Merge coins
  • Estimate gas costs

Technical Details

Environment Setup

Create a .env file in the sui-agent directory with the following variables:

PORT=2512
ATOMASDK_BEARER_AUTH=your_atoma_sdk_auth_token

API Endpoints

Query Endpoint

POST /query
Content-Type: application/json

Request Body:

{
  "prompt": "your natural language query here"
}

Tool Registry

The agent uses a tool registry system for managing different operations. Each tool follows this structure:

{
  name: string; // Unique identifier for the tool
  description: string; // What the tool does
  parameters: {
    // Parameters the tool accepts
    name: string;
    type: string;
    description: string;
    required: boolean;
  }
  [];
  process: Function; // The actual implementation
}

Supported Token Types

The agent supports various token types on Sui, including:

  • SUI
  • USDC
  • BTC
  • AFSUI
  • MSUI
  • And many more (see @types/interface.ts for full list)

Example Usage

Get Token Prices

curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "what is the current price of SUI and USDC"}'

Get Pool Information

curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "show me information for pool 0x123..."}'

Get Top Pools

curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "show me the top 5 pools by APR"}'

Deposit into Top Pools

# Deposit into top APR pools
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "deposit 1 SUI into each of the top 5 pools by APR with 1% slippage from my wallet 0x123..."}'

# Deposit into top TVL pools
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "find the top 3 pools by TVL and deposit 0.5 SUI into each from wallet 0x123... with 0.5% slippage"}'

# Deposit into top fee-generating pools
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "deposit 2 SUI each into the top 10 pools by fees from my wallet 0x123... using 1% slippage"}'

Withdraw from Pools

curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "withdraw 1000000 LP tokens from pool 0xabc... using wallet 0x123... with 0.5% slippage"}'

Staking Operations

# Get staking positions
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "show me the staking positions for wallet 0x123..."}'

# Get total SUI TVL in staking
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "what is the total SUI TVL in staking?"}'

# Get afSUI exchange rate
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "what is the current afSUI to SUI exchange rate?"}'

# Create staking transaction
curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "stake 100 SUI from wallet 0x123... with validator 0xabc..."}'

Transfer Tokens

curl -X POST http://localhost:2512/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "transfer 1 SUI from 0xsender to 0xrecipient"}'

Adding New Tools

  1. Create a new file in the appropriate directory under src/
  2. Implement your tool function:
export async function yourTool(param1: string): Promise<string> {
  try {
    // Your implementation
    return JSON.stringify([
      {
        reasoning: 'Explanation of what happened',
        response: 'The result',
        status: 'success',
        query: 'Original query',
        errors: [],
      },
    ]);
  } catch (error) {
    return JSON.stringify([
      {
        reasoning: 'What went wrong',
        response: 'Error message',
        status: 'failure',
        query: 'Original query',
        errors: [error.message],
      },
    ]);
  }
}
  1. Register your tool in src/tools/ToolRegistry.ts:
tools.registerTool(
  'your_tool_name',
  'Description of your tool',
  [
    {
      name: 'param1',
      type: 'string',
      description: 'Parameter description',
      required: true,
    },
  ],
  yourTool,
);

Error Handling

The agent uses a standardized error response format:

{
  reasoning: string;     // Why the error occurred
  response: string;      // User-friendly error message
  status: "failure";     // Error status
  query: string;         // Original query
  errors: string[];      // Array of error messages
}

Development

Running Tests

npm test

Building

npm run build

Development Server

npm run dev

Dependencies

  • aftermath-ts-sdk: Aftermath Finance SDK
  • @mysten/sui.js: Sui blockchain interaction
  • express: API server
  • atoma-sdk: AI capabilities
  • typescript: Type safety and development

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Implement your changes
  4. Add tests if applicable
  5. Submit a pull request

License

Apache License 2.0. See LICENSE for details.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 15

Native requirements
15 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^1.7.9runtime
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^16.4.7runtime
mongoose
Environment
{
  "local_name": "mongoose",
  "alias": false,
  "peer_metadata": null
}
^8.10.0runtime
navi-sdk
Environment
{
  "local_name": "navi-sdk",
  "alias": false,
  "peer_metadata": null
}
^1.4.24runtime
atoma-sdk
Environment
{
  "local_name": "atoma-sdk",
  "alias": false,
  "peer_metadata": null
}
github:atoma-network/atoma-sdk-typescriptruntime
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.7.3runtime
@mysten/sui
Environment
{
  "local_name": "@mysten/sui",
  "alias": false,
  "peer_metadata": null
}
1.1.0runtime
aftermath-ts-sdk
Environment
{
  "local_name": "aftermath-ts-sdk",
  "alias": false,
  "peer_metadata": null
}
^1.2.49runtime
@bluefin-exchange/bluefin-v2-client
Environment
{
  "local_name": "@bluefin-exchange/bluefin-v2-client",
  "alias": false,
  "peer_metadata": null
}
^6.1.29runtime
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^8.57.0development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^3.4.2development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^20.11.19development
@types/dotenv
Environment
{
  "local_name": "@types/dotenv",
  "alias": false,
  "peer_metadata": null
}
^8.2.0development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
^5.0.0development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^5.0.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "b25e896b1df1199196129ee56f1d127611348476",
  "tarball": "https://registry.npmjs.org/@0xshikhar/nexus-agents-atoma/-/nexus-agents-atoma-1.0.0.tgz",
  "fileCount": 35,
  "integrity": "sha512-ZN1UeFV7yvLiu5u88HWwNfGyC7jbePPsxw4yVI4xc4zP4x82oZb1MleHfUknZ8mticq7hMJ+YxDBCWp0CVXx4w==",
  "signatures": [
    {
      "sig": "MEUCIQDQvZSWK/7a5l4gkj8pPoQ62Fw3aFH0fJUJAbUmVH/fwwIgY8Ceh1FOyyqQTnnULfVtCAa0uGwOQk2g/6aqwespWi0=",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 418679
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:27 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:23916b6b5d64c19d4079b3d4ee0e0fa73e3677d1834cc9bc382ac65091729ad6

Other collected versions

1.1.311 Feb1.1.111 Feb1.1.011 FebView all collected versions →