generate guess types

This commit is contained in:
Dexter 2022-02-17 00:04:49 +00:00 committed by Dexter Edwards
parent 6c70328bb6
commit 4bb61ad74c
3 changed files with 50 additions and 6 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"

View File

@ -0,0 +1,39 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
// ====================================================
// GraphQL query operation: Guess
// ====================================================
export interface Guess_party {
__typename: 'Party';
/**
* Party identifier
*/
id: string;
}
export interface Guess_market {
__typename: 'Market';
/**
* Market ID
*/
id: string;
}
export interface Guess {
/**
* An entity that is trading on the VEGA network
*/
party: Guess_party | null;
/**
* An instrument that is trading on the VEGA network
*/
market: Guess_market | null;
}
export interface GuessVariables {
guess: string;
}

View File

@ -4,6 +4,7 @@ import { useState } from 'react';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import debounce from 'lodash.debounce';
import { Guess, GuessVariables } from './__generated__/Guess';
const TX_LENGTH = 64;
@ -28,12 +29,15 @@ const GUESS_QUERY = gql`
const usePossibleType = (search: string) => {
const [possibleType, setPossibleType] = useState<PossibleIdTypes>();
const { data, loading, error } = useQuery<any, any>(GUESS_QUERY, {
variables: {
guess: search,
},
skip: !search,
});
const { data, loading, error } = useQuery<Guess, GuessVariables>(
GUESS_QUERY,
{
variables: {
guess: search,
},
skip: !search,
}
);
React.useEffect(() => {
if (!isNaN(Number(search))) {