🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

eliza-plugin-tron

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

eliza-plugin-tron

Core Tron blockchain plugin for Eliza OS that provides essential services and actions for token operations, trading, and DeFi integrations.

unpublished
latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
0
Created
Source

@eliza-plugin-tron

Core Tron blockchain plugin for Eliza OS that provides essential services and actions for token operations, trading, and DeFi integrations.

Description

The TRON plugin provides comprehensive functionality for interacting with TRON blockchain, including token transfers, cross-chain bridging, and token swaps using Symbiosis integration.

Features

  • Native token transfers
  • Cross-chain token bridging via Symbiosis
  • Token swapping on Sunswap
  • Wallet balance tracking
  • Custom RPC endpoint configuration
  • Automatic retry mechanisms

Installation

yarn install eliza-plugin-tron

Configuration

Required Environment Variables

# Required
TRON_PRIVATE_KEY=your-private-key-here

# Optional - Custom RPC URLs
TRON_PROVIDER_URL=https://your-custom-tron-rpc-url

Custom RPC URLs

By default, the RPC URL is inferred from the viem/chains config. To use a custom RPC URL add the following to your .env file:

TRON_PROVIDER_URL=https://your-custom-tron-rpc-url

Example usage:

TRON_PROVIDER_URL=https://tron-network.rpc.thirdweb.com

Provider

The Wallet Provider initializes with the TRON. It:

  • Provides the context of the currently connected address and its balance.
  • Creates Public and Wallet clients to interact with the supported chains.

Actions

1. Transfer

Transfer native tokens on the same chain:

// Example transfer 100 TRX from the connected address to another address
const message: Memory = {
    content: {
        text: "Send 100 TRX  to TH9husb1dF7q8KSe7PVdmZYKqfnuYw5KWL",
        action: transferAction.name,
    },
    agentId: runtime.agentId,
    userId: stringToUuid("test"),
    roomId: stringToUuid("test"),
};

const state = await runtime.composeState(message);
const result = await runtime.processActions(message, [message], state);

2. Bridge

Bridge tokens between different chains using Symbiosis:

// Example Bridge 10 USDC from TRON to ETH
const message: Memory = {
    content: {
        text: "Bridge 10 USDC from TRON to ETHEREUM",
        action: bridgeAction.name,
    },
    agentId: runtime.agentId,
    userId: stringToUuid("test"),
    roomId: stringToUuid("test"),
};
const state = await runtime.composeState(message);
const result = await runtime.processActions(message, [message], state);

3. Swap

Swap tokens on the same chain using SunSwap:

// Example: Swap 10 TRX for USDT on TRON
const message: Memory = {
    content: {
        text: "Swap 10 TRX to USDT",
        action: swapAction.name,
    },
    agentId: runtime.agentId,
    userId: stringToUuid("test"),
    roomId: stringToUuid("test"),
};

const state = await runtime.composeState(message);
const result = await runtime.processActions(message, [message], state);

Development

  • Clone the repository
  • Install dependencies:
yarn install
  • Build the plugin:
yarn run build
  • Run tests:
yarn test

API Reference

Core Components

  • WalletProvider

    • Manages wallet connections
    • Manages RPC endpoints
    • Tracks balances
  • Actions

    • TransferAction: Native token transfers
    • BridgeAction: Cross-chain transfers
    • SwapAction: Same-chain token swaps

FAQs

Package last updated on 10 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts