# Get Wallet Transactions — Codex

> Returns token holdings and aggregated trading stats for one or more wallet addresses. Each result includes token balance, realized P&L, buy/sell counts, and average hold period across 1d, 1w, 30d, and 1y windows. Filter by wallet address…

- Key: `codex-get-wallet-transactions`
- Type: Action (Read-only)
- Version: 0.0.2
- App: Codex (`codex`) — https://pipedream.com/apps/codex.md
- This page (HTML): https://pipedream.com/apps/codex/actions/get-wallet-transactions
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/codex/actions/get-wallet-transactions/get-wallet-transactions.mjs

## Description

Returns token holdings and aggregated trading stats for one or more wallet addresses. Each result includes token balance, realized P&L, buy/sell counts, and average hold period across 1d, 1w, 30d, and 1y windows. Filter by wallet address, token, network, labels, or numeric range filters. Use **Get Networks** to resolve the numeric `networkId` if needed. Supports offset-based pagination — pass `offset` (and optional `limit`) to fetch subsequent pages. [See the documentation](https://docs.codex.io/api-reference/queries/filtertokenwallets)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `wallets` | `string[]` | No | Filter results to one or more wallet addresses. |
| `tokenIds` | `string[]` | No | Filter by token(s) in address:networkId format (e.g., 0xc02aaa...c756cc2:1). Maximum 50 per request. |
| `networkId` | `integer` | No | Filter results to a specific blockchain network. Use Get Networks to find IDs. |
| `phrase` | `string` | No | Search phrase for wallet filtering. |
| `includeLabels` | `string[]` | No | Return only wallets that have all of the specified labels. |
| `excludeLabels` | `string[]` | No | Exclude wallets that have any of the specified labels. |
| `rankings` | `string` | No | Sort results by one or more attributes. Provide a JSON array of ranking objects, each with attribute (e.g., tokenBalanceLiveUsd, realizedProfitUsd1w) and direction (ASC or DESC). Example: [{"attribute": "realizedProfitUsd1w", "direction": "DESC"}]. |
| `filtersV2` | `string` | No | Numeric range filters as a JSON object. Supports gt, gte, lt, lte operators on fields like tokenBalanceLiveUsd, realizedProfitUsd1w, buys1d, sells1d, etc. Example: {"tokenBalanceLiveUsd": {"gt": 1000}}. |
| `limit` | `integer` | No | Maximum number of results to return. |
| `offset` | `integer` | No | Number of results to skip. Use with limit to page through results (e.g., offset: 20, limit: 20 fetches the second page). |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "codex",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "codex-get-wallet-transactions",
  arguments: {
    wallets: ["Wallet Addresses"],
    tokenIds: ["Token IDs"],
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "codex-get-wallet-transactions",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    codex: { authProvisionId: "apn_xxxxxxx" },
    wallets: ["Wallet Addresses"],
    tokenIds: ["Token IDs"],
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "codex-get-wallet-transactions",
    "configured_props": {
      "codex": { "authProvisionId": "apn_xxxxxxx" },
      "wallets": ["Wallet Addresses"],
      "tokenIds": ["Token IDs"]
    }
  }'
```

---

- App: https://pipedream.com/apps/codex.md · All apps: https://pipedream.com/apps
