getRailsForPayerAndToken
getRailsForPayerAndToken(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/pay/get-rails-for-payer-and-token.ts:97
Get rails for a payer and token with pagination
Returns paginated list of rails where the specified address is the payer 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 | getRailsForPayerAndToken.OptionsType |
Returns
Section titled “Returns”Paginated rail results getRailsForPayerAndToken.OutputType
Throws
Section titled “Throws”Errors getRailsForPayerAndToken.ErrorType
Example
Section titled “Example”import { getRailsForPayerAndToken } 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 getRailsForPayerAndToken(client, { payer: '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'}`)}