# Get Pool Position Rewards

### Quick Start

```typescript
// Get rewards for single position
const pool = await sdk.Pool.getPool(poolId)
const rewards = await sdk.Rewarder.fetchPositionRewarders(pool, positionId)

rewards.forEach(reward => {
  console.log({
    token: reward.coin_address,
    amount: reward.amount_owed.toString()
  })
})
```

### Check Pool Rewards

```typescript
// Get position with full reward info
const position = await sdk.Position.getPositionById(positionId, true)

// Access reward amounts
if (position.rewards) {
  position.rewards.forEach(reward => {
    console.log({
      token: reward.coin_type,
      amount: reward.amount_owed
    })
  })
}
```

### Batch Check Rewards

Check rewards for multiple positions:

```typescript
const positionIds = ['0x1...', '0x2...', '0x3...']

// Batch fetch all rewards
const allRewards = await sdk.Rewarder.batchFetchPositionRewarders(positionIds)

// Display results
Object.entries(allRewards).forEach(([posId, rewards]) => {
  console.log(`Position ${posId}:`)
  rewards.forEach(reward => {
    console.log(`  ${reward.coin_address}: ${reward.amount_owed}`)
  })
})

// Batch fetch fees
const allFees = await sdk.Position.batchFetchPositionFees(positionIds)
```

### Pool Reward Info

#### Daily Emissions

```typescript
// Check how much rewards pool distributes daily
const emissions = await sdk.Rewarder.emissionsEveryDay(poolId)

emissions?.forEach(emission => {
  console.log({
    token: emission.coin_address,
    perDay: emission.emissions
  })
})
```

#### Total User Rewards

```typescript
// Get total rewards across all positions in pool
const totalRewards = await sdk.Rewarder.fetchPoolRewardersAmount(
  userAddress,
  poolId
)

totalRewards.forEach((amount, index) => {
  if (amount.gt(new BN(0))) {
    console.log(`Rewarder ${index}: ${amount.toString()}`)
  }
})
```

### Complete Example

```typescript
// 1. Get user positions
const positions = await sdk.Position.getPositionList(userAddress)

// 2. Group by pool
const poolGroups = {}
positions.forEach(pos => {
  if (!poolGroups[pos.pool]) poolGroups[pos.pool] = []
  poolGroups[pos.pool].push(pos)
})

// 3. Check rewards for each pool
for (const [poolId, poolPositions] of Object.entries(poolGroups)) {
  const pool = await sdk.Pool.getPool(poolId)
  
  console.log(`\nPool: ${poolId}`)
  console.log(`Rewarders: ${pool.rewarder_infos.length}`)
  
  // Check emissions
  const emissions = await sdk.Rewarder.emissionsEveryDay(poolId)
  emissions?.forEach(e => {
    console.log(`  Daily ${e.coin_address}: ${e.emissions}`)
  })
  
  // Check each position
  for (const pos of poolPositions) {
    // Fees
    const fees = await sdk.Position.calculateFee({
      pool_id: pos.pool,
      pos_id: pos.pos_object_id,
      coinTypeA: pos.coin_type_a,
      coinTypeB: pos.coin_type_b
    })
    
    // Rewards
    const rewards = await sdk.Rewarder.fetchPositionRewarders(pool, pos.pos_object_id)
    
    console.log(`\n  Position ${pos.pos_object_id}:`)
    console.log(`    Fees: ${fees.feeOwedA} / ${fees.feeOwedB}`)
    rewards.forEach(r => {
      console.log(`    ${r.coin_address}: ${r.amount_owed}`)
    })
  }
}
```

### Response Types

```typescript
interface RewarderAmountOwed {
  amount_owed: BN
  coin_address: string
}

interface CollectFeesQuote {
  feeOwedA: BN
  feeOwedB: BN
  position_id: string
}
```

### Important Notes

* Rewards accumulate in real-time based on liquidity and time
* Trading fees come from swaps in your price range
* Pool rewards are additional incentives from protocol
* Use `calculateRewards: true` when getting position to include rewards
* Batch methods are more efficient for multiple positions


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ferra.ag/integration/clmm/typescript-sdk/get-pool-position-rewards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
