Skip to content

send_prompt with stored delegation executes transaction from agent account instead of delegating to user account #22

@sergiusweber254-hue

Description

@sergiusweber254-hue

Title

send_prompt with stored delegation executes transaction from agent account instead of delegating to user account

Description

When using set_delegation to store a user account's ERC-7715 delegation and then executing send_prompt with approve_delegation_request, the transaction is executed from the agent's smart account rather than
delegating to the user account that granted the permission.

Expected Behavior

The agent should use the stored delegation from the user account (the from field in the delegation) to execute the transaction, so the funds are deducted from the user account instead of the agent account.

Actual Behavior

The transaction is executed from the agent's smart account (0xb5E32004eAcAb04e8dcEF5d8cB5617C1fCd6071D), and funds are deducted from there instead of the delegating user account
(0x598a30BE8730B2E3f49fBD5eb8241B12ba48ef43).

Reproduction Steps

  1. User approves delegation in MetaMask:
const result = await window.ethereum.request({
  method: "wallet_requestExecutionPermissions",
  params: [{
    chainId: "0xaa36a7",
    to: AGENT_ADDRESS,
    permission: {
      type: "native-token-periodic",
      data: {
        periodAmount: "0x38d7ea4c68000", // 0.001 ETH
        periodDuration: 86400,
        startTime: Math.floor(Date.now() / 1000),
        justification: "Allow AI Agent to transfer up to 0.001 ETH per day"
      },
      isAdjustmentAllowed: true
    },
    rules: []
  }]
});

2. Store the delegation:

npx @coinfello/agent-cli set_delegation '<delegation-json>'

3. Send a prompt requesting a transfer:

npx @coinfello/agent-cli send_prompt "Send 0.0001 ETH to 0xB4d8Ab57C08086741DA8064BBdC98471b557c2eF on Sepolia"

4. Approve the delegation request:

npx @coinfello/agent-cli approve_delegation_request

Result

Transaction executes from agent account. Funds deducted from 0xb5E32004eAcAb04e8dcEF5d8cB5617C1fCd6071D instead of 0x598a30BE8730B2E3f49fBD5eb8241B12ba48ef43.

Config Setup

- Agent account (Secure Enclave): 0xb5E32004eAcAb04e8dcEF5d8cB5617C1fCd6071D
- User account: 0x598a30BE8730B2E3f49fBD5eb8241B12ba48ef43
- Chain: Sepolia (0xaa36a7)
- Stored delegation has user account in from field and agent in to field

Question

Should approve_delegation_request use the stored delegation's from account to execute the transaction, or is there a different way to configure the agent-cli to delegate to a different account?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions