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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain> | The client to use to get the rails. |
options | OptionsType | getRailsForPayeeAndToken.OptionsType |
Returns
Section titled “Returns”Paginated rail results getRailsForPayeeAndToken.OutputType
Throws
Section titled “Throws”Errors getRailsForPayeeAndToken.ErrorType
Example
Section titled “Example”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 railsconst 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'}`)}