Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created November 13, 2019 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulRBerg/696201a8e0c0e87618b811cea0cbde2f to your computer and use it in GitHub Desktop.
Save PaulRBerg/696201a8e0c0e87618b811cea0cbde2f to your computer and use it in GitHub Desktop.
import gql from "graphql-tag";
export const BUNDLE = `
{
cash
percentage
units
wei
}
`;
export const CANCELLATION = `
cancellation {
id
recipientBalance
recipientInterest
sablierInterest
senderBalance
senderInterest
timeLabel @client
timestamp
txhash
}
`;
export const TIME_LABELS = `
timeLabels @client {
passed
remaining
startTime
stopTime
}
`;
export const TOKEN = `
token {
id
address @client
decimals
name
symbol
}
`;
const TXS = `
txs(where: { event: "CreateStream" }) {
id
block
event
timestamp
}
`;
export const WITHDRAWALS = `
withdrawals {
id
amount
}
`;
export const STREAM = `
id
${CANCELLATION}
deposit
exchangeRateInitial
outstanding @client ${BUNDLE}
paid @client ${BUNDLE}
ratePerSecond
recipient
recipientSharePercentage
sender
senderSharePercentage
startTime
status @client
stopTime
${TIME_LABELS}
timestamp
${TOKEN}
${TXS}
${WITHDRAWALS}
withdrawn @client ${BUNDLE}
withdrawable @client ${BUNDLE}
`;
export const GET_RECIPIENT_STREAMS = gql`
query Streams($recipient: String!) {
streams(first: 100, orderBy: id, orderDirection: desc, where: { recipient: $recipient }) {
${STREAM}
}
}
`;
export const GET_SENDER_STREAMS = gql`
query Streams($sender: String!) {
streams(first: 100, orderBy: id, orderDirection: desc, where: { sender: $sender }) {
${STREAM}
}
}
`;
export const GET_STREAM = gql`
query Stream($id: ID!) {
stream(id: $id) {
${STREAM}
}
}
`;
export const GET_STREAM_DEPOSIT = gql`
query StreamDeposit($id: ID!) {
stream(id: $id) {
deposit
}
}
`;
export const GET_STREAM_PAID_BUNDLE = gql`
query StreamPaidBundle($id: ID!) {
stream(id: $id) {
paid @client ${BUNDLE}
}
}
`;
export const GET_STREAM_TOKEN = gql`
query StreamToken($id: ID!) {
stream(id: $id) {
${TOKEN}
}
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment