Skip to content

getRail(client, options): Promise<OutputType>

Defined in: packages/synapse-core/src/pay/get-rail.ts:89

Get rail information from the Filecoin Pay contract

Returns detailed information about a payment rail including payer, payee, payment rate, lockup details, settlement status, and termination status.

ParameterTypeDescription
clientClient<Transport, Chain>The client to use to get the rail info.
optionsOptionsTypegetRail.OptionsType

Promise<OutputType>

The rail information getRail.OutputType

Errors getRail.ErrorType

import { getRail } from '@filoz/synapse-core/pay'
import { createPublicClient, http } from 'viem'
import { calibration } from '@filoz/synapse-core/chains'
const client = createPublicClient({
chain: calibration,
transport: http(),
})
const rail = await getRail(client, {
railId: 1n,
})
console.log('Payer:', rail.from)
console.log('Payee:', rail.to)
console.log('Payment rate:', rail.paymentRate)
console.log('Is terminated:', rail.endEpoch > 0n)