Constant Functions
Get Stream
Returns all properties for the provided stream id.
function getStream(uint256 streamId) view returns (address sender, address recipient, address tokenAddress, uint256 balance, uint256 startTime, uint256 stopTime, uint256 remainingBalance, uint256 ratePerSecond)
streamId: The id of the stream to query.RETURNsender: The address that created and funded the stream.recipient: The address towards which the tokens are streamed.tokenAddress: The address of the ERC-20 token used as streaming currency.startTime: The unix timestamp for when the stream starts, in seconds.stopTime: The unix timestamp for when the stream stops, in seconds.remainingBalance: How much tokens are still allocated to this stream, in the smart contract.ratePerSecond: How much tokens are allocated from the sender to the recipient every second.
Solidity
Sablier sablier = Sablier(0xabcd...);
uint256 streamId = 42;
(uint256 sender, uint256 recipient, uint256 deposit, address tokenAddress, uint256 startTime, uint256 stopTime, uint256 remainingBalance, uint256 ratePerSecond) = sablier.getStream(streamId);
Ethers.js
const sablier = new ethers.Contract(0xabcd..., sablierABI, signerOrProvider);
const streamId = 42;
const stream = await sablier.getStream(streamId);
Balance Of
Returns the real-time balance of an account with regards to a specific stream.
function balanceOf(uint256 streamId, address who) view returns (uint256)
streamId: The id of the stream for which to query the balance.who: The address for which to query the balance.RETURN: The available balance in units of the underlying ERC-20 token.
info
This is the amount of tokens that can be withdrawn from the contract, not the total amount of tokens streamed. If the contract streamed 1,000 tokens to Bob, but Bob withdrew 400 tokens already, this function will return 600 and not 1,000.