Skip to content

Return native token balance to address #991

Open
Kushmanmb wants to merge 25 commits intocoinbase:mainfrom
Kushmanmb:main
Open

Return native token balance to address #991
Kushmanmb wants to merge 25 commits intocoinbase:mainfrom
Kushmanmb:main

Conversation

@Kushmanmb
Copy link

@Kushmanmb Kushmanmb commented Mar 7, 2026

This pull request introduces a new "return native balance" action for wallets, allowing users to transfer their entire native token balance (minus estimated network/gas fees) to a specified address. The implementation includes robust gas/fee estimation for EVM and Solana networks, schema definitions, and comprehensive unit tests. Additional improvements include minor workflow updates and enhancements to schema definitions and tests for existing wallet actions.

Wallet Action: Return Native Balance

  • Added ReturnNativeBalanceSchema in both Python (wallet/schemas.py) and TypeScript (wallet/schemas.ts) to define input for the new action, requiring only a destination address. [1] [2]
  • Implemented return_native_balance action in WalletActionProvider, including logic to estimate gas/transaction fees for EVM (using provider, web3, or fallback) and Solana, and error handling for insufficient balance or transfer failures. [1] [2]
  • Added comprehensive unit tests for the new action in Python, covering EVM and Solana flows, fee estimation, insufficient balance, and error scenarios.
  • Registered the new schema and action in the provider imports and decorator.

Schema and Test Enhancements

  • Added GetBalanceSchema in TypeScript for input validation of the get balance action, and expanded tests for balance retrieval and schema validation. [1] [2]

Workflow and Dependency Updates

  • Changed the CI workflow to use Yarn instead of pnpm for dependency management and caching in unit tests.
  • Updated TypeScript wallet action provider tests to include new schema imports and test cases.

These changes collectively improve wallet action functionality, reliability, and test coverage.<!--
Thanks for contributing to AgentKit!
Please fill out the information below to help reviewers understand your changes.

Note: We require commit signing.
See here for instructions: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification
-->

Description

Tests

Checklist

A couple of things to include in your PR for completeness:

  • Added documentation to all relevant README.md files
  • Added a changelog entry

Copilot AI and others added 13 commits March 7, 2026 09:56
Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
feat(typescript): add get_balance action to WalletActionProvider
Fix `yarn install` in `create-onchain-agent` next template
Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
…pt and Python)

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
Add return_native_balance action: sweep entire wallet balance minus gas fees
feat(typescript): migrate TypeScript monorepo from pnpm to yarn
@Kushmanmb Kushmanmb requested a review from murrlincoln as a code owner March 7, 2026 12:04
@cb-heimdall
Copy link

cb-heimdall commented Mar 7, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@github-actions github-actions bot added action provider New action provider example New example agent framework extension New framework extension python typescript labels Mar 7, 2026
Copy link
Author

@Kushmanmb Kushmanmb left a comment

Choose a reason for hiding this comment

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

kushmanmb.eth

Copy link
Author

@Kushmanmb Kushmanmb left a comment

Choose a reason for hiding this comment

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

Copilot AI and others added 8 commits March 7, 2026 13:32
…Python)

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
…s, fix BigInt precision, fix URL construction

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
…uperfluid test address assertions, use checksummed addresses

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
…ovider.ts


0x6fb9e80dDd0f5DC99D7cB38b07e8b298A57bF253

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…llet/validators.py


0x6fb9e80dDd0f5DC99D7cB38b07e8b298A57bF253

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…case-insensitive 0x prefix

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
Copy link
Author

@Kushmanmb Kushmanmb left a comment

Choose a reason for hiding this comment

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

kushmanmb

Copilot AI and others added 3 commits March 11, 2026 07:53
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 11, 2026
…rabilities

Add EVM zero address protection to wallet transfer actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation example New example agent framework extension New framework extension python typescript

Development

Successfully merging this pull request may close these issues.

3 participants