XYOracleNetwork/sdk-diviner-nodejs

View on GitHub
src/payment/plugin/endpoints/xyo-check-credits-endpoint.ts

Summary

Maintainability
A
3 hrs
Test Coverage
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IXyoPaymentStore } from '../..'

export class XyoCreditEndpoint {
  public static query = 'credits(apiKey: String): Float'
  public static queryName = 'credits'
  private spendStore: IXyoPaymentStore

  constructor(spend: IXyoPaymentStore) {
    this.spendStore = spend
  }

  public async resolve(obj: any, args: any): Promise<any> {
    return this.spendStore.getCreditsForKey(args.apiKey)
  }
}