Skip to content

feat: nomination pools features#68

Merged
CocDap merged 5 commits intomainfrom
feat/nomination-pools
Jul 21, 2025
Merged

feat: nomination pools features#68
CocDap merged 5 commits intomainfrom
feat/nomination-pools

Conversation

@CocDap
Copy link
Copy Markdown
Contributor

@CocDap CocDap commented Jul 19, 2025

PR Description

🚀 Add Comprehensive Nomination Pools Support to Polkadot Agent Kit

Overview

This PR introduces full Nomination Pools functionality to the Polkadot Agent Kit, enabling users to participate in Polkadot's staking system through pooled nominations. This feature provides a complete suite of tools for managing nomination pool operations through AI agents.

✨ New Features

Core Nomination Pool Operations

  • Join Pool: Bond tokens to participate in a nomination pool
  • Bond Extra: Add additional funds from free balance or re-stake rewards
  • Unbond: Remove tokens from the pool (with unbonding period)
  • Withdraw Unbonded: Withdraw tokens after unbonding period expires
  • Claim Rewards: Collect earned staking rewards

Architecture Implementation

Layer 1: Core Business Logic (@polkadot-agent-kit/core)

  • Location: packages/core/src/pallets/nomination-pools/
  • Functions Implemented:
    • joinPool.ts - Join nomination pools
    • bondExtra.ts - Bond additional funds
    • unbond.ts - Unbond tokens
    • withdrawUnbonded.ts - Withdraw unbonded tokens
    • claimRewards.ts - Claim staking rewards
    • getPoolInfo.ts - Query pool information
    • getPoolMembers.ts - Get pool member details

Layer 2: AI Integration (@polkadot-agent-kit/llm)

  • LangChain Tool Schemas: packages/llm/src/types/staking.ts

    • Complete Zod schema definitions for all operations
    • Type-safe input validation
    • Comprehensive documentation with examples
  • LangChain Tool Implementations: packages/llm/src/langchain/staking.ts

    • joinPoolTool - Join pools with specified amount
    • bondExtraTool - Bond extra funds (FreeBalance/Rewards)
    • unbondTool - Unbond tokens from pool
    • withdrawUnbondedTool - Withdraw after unbonding period
    • claimRewardsTool - Claim earned rewards

Tool Naming System

  • Updated: packages/llm/src/types/common.ts
  • New Tool Names:
    • JOIN_POOL
    • BOND_EXTRA
    • UNBOND
    • WITHDRAW_UNBONDED
    • CLAIM_REWARDS

📋 Usage Examples

Join a Nomination Pool

// Join pool with 10 DOT
{
  amount: "10",
  chain: "polkadot"
}

Bond Extra Funds

// Bond from free balance
{
  type: "FreeBalance",
  amount: "5",
  chain: "polkadot"
}

// Re-stake rewards
{
  type: "Rewards", 
  chain: "polkadot"
}

Unbond Tokens

{
  amount: "3",
  chain: "polkadot"
}

@CocDap CocDap merged commit af41ade into main Jul 21, 2025
1 check passed
@CocDap CocDap deleted the feat/nomination-pools branch July 21, 2025 01:40
@CocDap CocDap linked an issue Jul 21, 2025 that may be closed by this pull request
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.

Agentic DeFi Tool: Relaychain Nomination Pools

1 participant