Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix Parameter Parsing in plugin-evm TransferAction and Return Transaction Hash #965

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

FWangZil
Copy link
Contributor

Relates to:

#964

Risks

Low – The changes affect the EVM plugin's transfer function, specifically the template parsing and parameter extraction. Other parts of the system should remain unaffected.

Background

What does this PR do?

  • Fixes the parsing of transfer parameters in the plugin-evm module to ensure the TransferAction function receives the correct parameters.
  • Improves the template parsing prompt for EVM transfers.
  • Returns the transaction hash upon successful transfer execution.

What kind of change is this?

  • Bug fix: Resolves issues with parameter parsing preventing transfer execution.
  • Improvement: Enhances the transfer template parsing and response handling to return transaction hashes.

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

Where should a reviewer start?

  • Review changes in the EVM plugin’s transfer function and template parsing logic.

Detailed testing steps

  1. Configure an EVM wallet.
  2. Ensure the wallet has sufficient ETH.
  3. Issue a natural language command to perform a transfer (e.g., "Send 0.5 ETH to 0x123...").
  4. Verify that the transfer is executed successfully and the transaction hash is returned.

Discord username

0xtogo

const walletProvider = new WalletProvider(runtime);
const action = new TransferAction(walletProvider);
return action.transfer(runtime, options);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is options ignored now? Prefer an LLM options over explicitly passed ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the previous way of directly passing options into action.transfer was in

async transfer(
runtime: IAgentRuntime,
params: TransferParams
): Promise<Transaction>

The parameters cannot be parsed out smoothly, so I refer to the writing method of plugin-solana

https://github.com/ai16z/eliza/blob/main/packages/plugin-solana/src/actions/transfer.ts#L116

Manually built parameters replace those passed to action.transfer.

@odilitime odilitime changed the base branch from main to develop December 16, 2024 21:05
@odilitime odilitime changed the title Fix Parameter Parsing in plugin-evm TransferAction and Return Transaction Hash fix: Fix Parameter Parsing in plugin-evm TransferAction and Return Transaction Hash Dec 16, 2024
@odilitime odilitime merged commit ca5edca into elizaOS:develop Dec 16, 2024
3 of 4 checks passed
@FWangZil FWangZil deleted the fix/plugin-evm branch December 24, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants