XYOracleNetwork/client-xyo-nodejs

View on GitHub
src/context/connectionResolvers/graphql/xyo-graphql-coin-credits.ts

Summary

Maintainability
A
2 hrs
Test Coverage
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { request } from 'graphql-request'
import { IXyoConnectionConfig } from '../../xyo-context-config'

export const coinCredits = async (
  config: IXyoConnectionConfig,
  command: string
) => {
  const query = `
      query CoinCredits($token: String!) {
        coinCredits(token: $token)
      }
    `

  const result = (await request(config.uri, query, {
    token: command,
  })) as any

  return [
    {
      result: result.coinCredits,
      id: config.uri,
    },
  ]
}