Skip to content

getRailsForPayeeAndToken

getRailsForPayeeAndToken(client, options): Promise<OutputType>

Defined in: packages/synapse-core/src/pay/get-rails-for-payee-and-token.ts:97

Get rails for a payee and token with pagination

Returns paginated list of rails where the specified address is the payee for the given token. Use pagination (offset and limit) to handle large result sets efficiently.

ParameterTypeDescription
clientClient<Transport, Chain>The client to use to get the rails.
optionsOptionsTypegetRailsForPayeeAndToken.OptionsType

Promise<OutputType>

Paginated rail results getRailsForPayeeAndToken.OutputType

Errors getRailsForPayeeAndToken.ErrorType

import { getRailsForPayeeAndToken } from '@filoz/synapse-core/pay'
import { createPublicClient, http } from 'viem'
import { calibration } from '@filoz/synapse-core/chains'
const client = createPublicClient({
chain: calibration,
transport: http(),
})
// Get first 10 rails
const result = await getRailsForPayeeAndToken(client, {
payee: '0x1234567890123456789012345678901234567890',
offset: 0n,
limit: 10n,
})
console.log(`Found ${result.total} total rails`)
console.log(`Returned ${result.results.length} rails`)
for (const rail of result.results) {
console.log(`Rail ${rail.railId}: ${rail.isTerminated ? 'Terminated' : 'Active'}`)
}