@rholabs/rho-sdk
Version:
Rho Protocol SDK
35 lines (30 loc) • 861 B
text/typescript
import { describe, expect, test } from '@jest/globals'
import { SubgraphAPI } from '../src/v1'
const apiUrl = 'https://api.studio.thegraph.com/query/47283/rho-testnet/v0.0.4'
let api: SubgraphAPI
const waitTimeout = 5000
beforeAll(async () => {
api = new SubgraphAPI({ apiUrl })
})
describe('Subgraph API', () => {
test(
'getTrades',
async () => {
const events = await api.getTrades()
expect(events.length).toBeGreaterThan(0)
expect(events[0].id).toMatch('0x')
},
waitTimeout
)
test(
'getTrades (limit = 10)',
async () => {
const events = await api.getTrades({ limit: 10 })
expect(events.length).toBe(10)
expect(typeof events[0].id).toBe('string')
expect(typeof events[0].direction).toBe('number')
expect(typeof events[0].notional).toBe('bigint')
},
waitTimeout
)
})