npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@near-agent/elizaos-plugin-near

v0.25.6-alpha.1

Published

NEAR Protocol integration plugin for Eliza OS that enables token management, transfers, and swaps using Ref Finance.

Readme

@elizaos/plugin-near

NEAR Protocol integration plugin for Eliza OS that enables token management, transfers, and swaps using Ref Finance.

Overview

This plugin aims to be the basis of all interactions with the NEAR ecosystem, providing seamless integration with NEAR Protocol and Ref Finance DEX.

Features

  • NEAR token transfers
  • Token swaps via Ref Finance
  • Multiple network support (mainnet, testnet)
  • Secure transaction signing
  • Automatic storage deposit handling
  • Real-time price feeds
  • Portfolio tracking and management
  • Smart routing for optimal swaps
  • Built-in denomination handling
  • Comprehensive error handling

Installation

pnpm install @elizaos/plugin-near

Configuration

The plugin requires environment variables or runtime settings:

NEAR_WALLET_SECRET_KEY=your-wallet-private-key
NEAR_WALLET_PUBLIC_KEY=your-wallet-public-key
NEAR_ADDRESS=your-account.near
NEAR_NETWORK=testnet  # mainnet or testnet
NEAR_RPC_URL=https://neart.lava.build
NEAR_SLIPPAGE=0.01  # 1% slippage tolerance

Usage

Token Transfer

import { nearPlugin } from "@elizaos/plugin-near";

// Send NEAR
const result = await eliza.execute({
    action: "SEND_NEAR",
    content: {
        recipient: "bob.near",
        amount: "1.5",
    },
});

Token Swap

const result = await eliza.execute({
    action: "EXECUTE_SWAP_NEAR",
    content: {
        inputTokenId: "wrap.near",
        outputTokenId: "token.v2.ref-finance.near",
        amount: "10",
    },
});

API Reference

Actions

SEND_NEAR

Transfers NEAR tokens to another account.

{
  action: 'SEND_NEAR',
  content: {
    recipient: string,    // Recipient's NEAR account (e.g., "bob.near")
    amount: string,       // Amount to send (in NEAR)
    tokenAddress?: string // Optional: for NEP-141 tokens
  }
}

EXECUTE_SWAP_NEAR

Executes a token swap using Ref Finance.

{
  action: 'EXECUTE_SWAP_NEAR',
  content: {
    inputTokenId: string,  // Input token contract (e.g., "wrap.near")
    outputTokenId: string, // Output token contract
    amount: string,        // Amount to swap
    slippageTolerance?: number // Optional: default from config
  }
}

Providers

Wallet Provider

Provides wallet information and portfolio tracking.

const walletInfo = await eliza.getProvider("wallet");
// Returns formatted portfolio including:
// - Account balance
// - Token balances
// - USD values
// - Market prices

Troubleshooting

Common Issues

  1. Transaction Failures

    • Check account balance
    • Verify storage deposits
    • Ensure sufficient gas
    • Confirm slippage tolerance
  2. Connection Problems

    • Verify RPC endpoint
    • Check network selection
    • Ensure valid credentials
    • Monitor API rate limits
  3. Swap Issues

    • Verify token pairs exist
    • Check liquidity pools
    • Confirm price impact
    • Monitor slippage settings

Security Best Practices

  1. Key Management

    • Store private keys securely
    • Use environment variables
    • Implement key rotation
    • Monitor account activity
  2. Transaction Safety

    • Validate all inputs
    • Implement amount limits
    • Double-check recipients
    • Monitor transaction status
  3. Network Security

    • Use secure RPC endpoints
    • Implement retry mechanisms
    • Monitor for suspicious activity
    • Keep dependencies updated
  4. Error Handling

    • Log all transaction attempts
    • Handle timeouts gracefully
    • Validate all user inputs
    • Provide clear error messages

Testing

Run the test suite:

pnpm test

Watch mode for development:

pnpm test:watch

Dependencies

  • near-api-js: ^5.0.1
  • @ref-finance/ref-sdk: ^1.4.6
  • bignumber.js: ^9.1.2
  • node-cache: ^5.1.2

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for more information.

Credits

This plugin integrates with:

Special thanks to:

  • The NEAR Protocol team for developing the NEAR blockchain
  • The Ref Finance team for developing the Ref Finance DEX
  • The Eliza community for their contributions and feedback.

For more information about NEAR blockchain capabilities:

License

This plugin is part of the Eliza project. See the main project repository for license information.