interface icon indicating copy to clipboard operation
interface copied to clipboard

is there an alternative REACT_APP_AWS_API_ENDPOINT ?

Open Osub opened this issue 2 years ago • 18 comments

get-graphql-schema https://beta.api.uniswap.org/v1/graphql -j
FetchError: request to https://beta.api.uniswap.org/v1/graphql failed, reason: connect ETIMEDOUT 162.125.82.7:443
    at ClientRequest.<anonymous> (/home/parallels/.nvm/versions/node/v14.21.1/lib/node_modules/get-graphql-schema/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (events.js:400:28)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}

is there an alternative REACT_APP_AWS_API_ENDPOINT ?

What does REACT_APP_AWS_API_ENDPOINT mean?

Osub avatar Nov 19 '22 03:11 Osub

node fetch-schema.js Failed to fetch schema from https://api.uniswap.org/v1/graphql

Osub avatar Nov 19 '22 04:11 Osub

FetchError: request to https://api.uniswap.org/v1/graphql failed, reason: connect ETIMEDOUT 162.125.2.6:443
    at ClientRequest.<anonymous> (/home/parallels/.nvm/versions/node/v14.21.1/lib/node_modules/get-graphql-schema/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (events.js:400:28)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}

Osub avatar Nov 19 '22 05:11 Osub

I had the same problem

yefenghe avatar Nov 26 '22 03:11 yefenghe

interface/src/graphql/data/schema.graphql

"""This directive allows results to be deferred during execution"""
directive @defer on FIELD

"""
Tells the service this field/object has access authorized by a Cognito User Pools token.
"""
directive @aws_cognito_user_pools(
  """List of cognito user pool groups which have access on this field"""
  cognito_groups: [String]
) on OBJECT | FIELD_DEFINITION

"""
Tells the service which subscriptions will be published to when this mutation is
called. This directive is deprecated use @aws_susbscribe directive instead.
"""
directive @aws_publish(
  """
  List of subscriptions which will be published to when this mutation is called.
  """
  subscriptions: [String]
) on FIELD_DEFINITION

"""Tells the service which mutation triggers this subscription."""
directive @aws_subscribe(
  """
  List of mutations which will trigger this subscription when they are called.
  """
  mutations: [String]
) on FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by a Lambda Authorizer.
"""
directive @aws_lambda on OBJECT | FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by an OIDC token.
"""
directive @aws_oidc on OBJECT | FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by sigv4 signing.
"""
directive @aws_iam on OBJECT | FIELD_DEFINITION

"""Directs the schema to enforce authorization on a field"""
directive @aws_auth(
  """List of cognito user pool groups which have access on this field"""
  cognito_groups: [String]
) on FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by an API key.
"""
directive @aws_api_key on OBJECT | FIELD_DEFINITION

enum ActivityType {
  APPROVE
  CANCEL
  CLAIM
  SEND
  RECEIVE
  SWAP
  DEPLOYMENT
  UNKNOWN
  money
  market
  LEND
  BORROW
  REPAY
  WITHDRAW
  NFT
  MINT
  BURN
  Staking
  STAKE
  UNSTAKE
}

type Amount implements IAmount {
  id: ID!
  currency: Currency
  value: Float!
}

type AmountChange {
  id: ID!
  percentage: Amount
  absolute: Amount
}

type AssetActivity {
  id: ID!
  timestamp: Int!
  type: ActivityType!
  gasUsed: Float
  transaction: Transaction!
  assetChanges: [AssetChange]!
}

union AssetChange = TokenTransfer | NftTransfer | TokenApproval | NftApproval | NftApproveForAll

"""
The `AWSJSON` scalar type provided by AWS AppSync, represents a JSON string that
complies with [RFC 8259](https://tools.ietf.org/html/rfc8259).  Maps like
"**{\\"upvotes\\": 10}**", lists like "**[1,2,3]**", and scalar values like
"**\\"AWSJSON example string\\"**", "**1**", and "**true**" are accepted as
valid JSON and will automatically be parsed and loaded in the resolver mapping
templates as Maps, Lists, or Scalar values rather than as the literal input
strings.  Invalid JSON strings like "**{a: 1}**", "**{'a': 1}**" and "**Unquoted
string**" will throw GraphQL validation errors.
"""
scalar AWSJSON

enum Chain {
  ARBITRUM
  ETHEREUM
  ETHEREUM_GOERLI
  OPTIMISM
  POLYGON
  CELO
}

input ContractInput {
  chain: Chain!
  address: String
}

enum Currency {
  USD
  ETH
}

type Dimensions {
  id: ID!
  height: Float
  width: Float
}

enum HighLow {
  HIGH
  LOW
}

enum HistoryDuration {
  HOUR
  DAY
  WEEK
  MONTH
  YEAR
  MAX
}

interface IAmount {
  currency: Currency
  value: Float!
}

interface IContract {
  chain: Chain!
  address: String
}

type Image {
  id: ID!
  url: String!
  dimensions: Dimensions
}

"""  TODO: deprecate this enum"""
enum MarketSortableField {
  MARKET_CAP
  VOLUME
}

type NftApproval {
  id: ID!
  nftStandard: NftStandard!

  """  can be erc20 or erc1155"""
  asset: NftAsset!
  approvedAddress: String!
}

type NftApproveForAll {
  id: ID!
  nftStandard: NftStandard!

  """  can be erc721 or erc1155"""
  asset: NftAsset!
  operatorAddress: String!
  approved: Boolean!
}

type NftAsset {
  id: ID!
  collection: NftCollection
  description: String
  imageUrl: String
  thumbnailUrl: String
  animationUrl: String
  smallImageUrl: String
  image: Image
  thumbnail: Image
  smallImage: Image
  originalImage: Image
  name: String
  nftContract: NftContract

  """  TODO: may need to be array to support erc1155 cases. not needed at the moment so will revisit.
  """
  ownerAddress: String
  tokenId: String!
  traits: [NftAssetTrait!]
  rarities: [NftAssetRarity!]
  listings(asc: Boolean, first: Int, last: Int, after: String, before: String): NftOrderConnection
  suspiciousFlag: Boolean
  flaggedBy: String
  metadataUrl: String
  creator: NftProfile
}

type NftAssetConnection {
  pageInfo: PageInfo!
  edges: [NftAssetEdge!]!
  totalCount: Int
}

type NftAssetEdge {
  cursor: String!
  node: NftAsset!
}

input NftAssetInput {
  address: String!
  tokenId: String!
}

type NftAssetRarity {
  id: ID!
  score: Float
  rank: Int
  provider: NftRarityProvider
}

input NftAssetsFilterInput {
  tokenSearchQuery: String
  tokenIds: [String!]
  traits: [NftAssetTraitInput!]
  listed: Boolean
  minPrice: String
  maxPrice: String
  marketplaces: [NftMarketplace!]
}

enum NftAssetSortableField {
  PRICE
  RARITY
}

type NftAssetTrait {
  id: ID!
  name: String
  rarity: Float
  value: String
}

input NftAssetTraitInput {
  name: String!
  values: [String!]!
}

type NftBalance {
  id: ID!
  ownedAsset: NftAsset
  listedMarketplaces: [NftMarketplace!]
  lastPrice: TimestampedAmount
  listingFees: [NftFee]
}

type NftBalanceConnection {
  pageInfo: PageInfo!
  edges: [NftBalanceEdge!]!
}

type NftBalanceEdge {
  cursor: String!
  node: NftBalance!
}

input NftBalancesFilterInput {
  addresses: [String!]
  assets: [NftAssetInput!]
}

type NftCollection {
  id: ID!
  collectionId: String!

  """
    TODO: support querying for collection assets here
   assets(page: Int, pageSize: Int, orderBy: NftAssetSortableField): [NftAsset]
  """
  bannerImageUrl: String
  bannerImage: Image
  description: String
  discordUrl: String
  homepageUrl: String
  imageUrl: String
  image: Image
  instagramName: String
  markets(currencies: [Currency!]!): [NftCollectionMarket!]
  name: String
  nftContracts: [NftContract!]
  openseaUrl: String
  traits: [NftCollectionTrait!]
  twitterName: String
  isVerified: Boolean
  numAssets: Int
  creator: NftProfile
}

type NftCollectionConnection {
  pageInfo: PageInfo!
  edges: [NftCollectionEdge!]!
}

type NftCollectionEdge {
  cursor: String!
  node: NftCollection!
}

type NftCollectionMarket {
  id: ID!
  nftContracts: [NftContract!]
  floorPrice: TimestampedAmount
  owners: Int
  volume24h: Amount
  totalVolume: TimestampedAmount
  volume(duration: HistoryDuration): TimestampedAmount
  volumePercentChange(duration: HistoryDuration): TimestampedAmount
  floorPricePercentChange(duration: HistoryDuration): TimestampedAmount
  sales(duration: HistoryDuration): TimestampedAmount
  listings: TimestampedAmount
  marketplaces(marketplaces: [NftMarketplace!]): [NftCollectionMarketplace!]
}

type NftCollectionMarketplace {
  id: ID!
  marketplace: NftMarketplace
  listings: Int
  floorPrice: Float
}

input NftCollectionsFilterInput {
  addresses: [String!]
}

type NftCollectionTrait {
  id: ID!
  name: String
  values: [String!]
  stats: [NftCollectionTraitStats!]
}

type NftCollectionTraitStats {
  id: ID!
  name: String
  value: String
  assets: Int
  listings: Int
}

type NftContract implements IContract {
  id: ID!
  address: String!
  chain: Chain!
  name: String
  standard: NftStandard
  symbol: String
  totalSupply: Int
}

type NftFee {
  id: ID!
  payoutAddress: String!
  basisPoints: Int!
}

enum NftMarketplace {
  OPENSEA
  LOOKSRARE
  X2Y2
  SUDOSWAP
  NFTX
  NFT20
  FOUNDATION
  CRYPTOPUNKS
}

enum NftMarketSortableField {
  VOLUME
  FLOOR_PRICE
}

type NftOrder {
  id: ID!
  address: String!
  tokenId: String
  type: OrderType!
  marketplace: NftMarketplace!
  marketplaceUrl: String!
  price: Amount!
  quantity: Int!
  orderHash: String
  status: OrderStatus!
  createdAt: Float!
  startAt: Float!
  endAt: Float
  maker: String!
  taker: String
  auctionType: String
  protocolParameters: AWSJSON
}

type NftOrderConnection {
  pageInfo: PageInfo!
  edges: [NftOrderEdge!]!
}

type NftOrderEdge {
  cursor: String!
  node: NftOrder!
}

type NftProfile {
  id: ID!
  address: String!
  isVerified: Boolean
  profileImage: Image
  username: String
}

enum NftRarityProvider {
  RARITY_SNIPER
}

enum NftStandard {
  ERC721
  ERC1155
  NONCOMPLIANT
}

type NftTransfer {
  id: ID!
  nftStandard: NftStandard!
  asset: NftAsset!
  sender: String!
  recipient: String!
  direction: TransactionDirection!
}

enum OrderStatus {
  VALID
  EXECUTED
  CANCELLED
  EXPIRED
}

enum OrderType {
  LISTING
  OFFER
}

type PageInfo {
  hasPreviousPage: Boolean
  hasNextPage: Boolean
  startCursor: String
  endCursor: String
}

type Portfolio {
  id: ID!
  ownerAddress: String!
  tokensTotalDenominatedValue: Amount
  tokensTotalDenominatedValueChange(duration: HistoryDuration): AmountChange
  tokensTotalDenominatedValueHistory(duration: HistoryDuration): [TimestampedAmount]
  tokenBalances: [TokenBalance]
  assetsValueUSD: Float
  totalValueUSD: Float
  assetsValue: Float
  totalValue: Float
  absoluteChange24H: Float
  relativeChange24H: Float

  """  TODO: (michael.zhang) replace with paginated query"""
  nftBalances: [NftBalance]
  assetActivities(page: Int, pageSize: Int): [AssetActivity]
}

type Query {
  tokens(contracts: [ContractInput!]!): [Token]
  tokenProjects(contracts: [ContractInput!]!): [TokenProject]
  topTokenProjects(orderBy: MarketSortableField!, page: Int!, pageSize: Int!, currency: Currency): [TokenProject]
  searchTokens(searchQuery: String!): [Token]
  searchTokenProjects(searchQuery: String!): [TokenProject]
  assetActivities(address: String!, page: Int, pageSize: Int): [AssetActivity]
  portfolio(ownerAddress: String!): Portfolio
  portfolios(ownerAddresses: [String!]!): [Portfolio]
  nftCollectionsById(collectionIds: [String]): [NftCollection]
  topTokens(chain: Chain, page: Int!, pageSize: Int!, orderBy: TokenSortableField): [Token]
  nftAssets(chain: Chain, address: String!, orderBy: NftAssetSortableField, asc: Boolean, filter: NftAssetsFilterInput, first: Int, last: Int, after: String, before: String): NftAssetConnection
  nftCollections(filter: NftCollectionsFilterInput, first: Int, last: Int, after: String, before: String): NftCollectionConnection
  nftBalances(chain: Chain, ownerAddress: String!, filter: NftBalancesFilterInput, first: Int, last: Int, after: String, before: String): NftBalanceConnection
}

enum SafetyLevel {
  VERIFIED
  MEDIUM_WARNING
  STRONG_WARNING
  BLOCKED
}

type TimestampedAmount implements IAmount {
  id: ID!
  currency: Currency
  value: Float!
  timestamp: Int!
}

type Token implements IContract {
  id: ID!
  chain: Chain!
  address: String
  standard: TokenStandard
  decimals: Int
  name: String
  symbol: String
  project: TokenProject
  market(currency: Currency): TokenMarket
}

type TokenApproval {
  id: ID!
  tokenStandard: TokenStandard!

  """  can be erc20 or erc1155"""
  asset: Token!
  approvedAddress: String!
  quantity: String!
}

type TokenBalance {
  id: ID!
  blockNumber: Int
  blockTimestamp: Int
  quantity: Float
  denominatedValue: Amount
  ownerAddress: String!
  token: Token
  tokenProjectMarket: TokenProjectMarket
}

type TokenMarket {
  id: ID!
  token: Token!
  price: Amount
  totalValueLocked: Amount
  volume(duration: HistoryDuration!): Amount
  pricePercentChange(duration: HistoryDuration!): Amount
  priceHistory(duration: HistoryDuration!): [TimestampedAmount]
  priceHighLow(duration: HistoryDuration!, highLow: HighLow!): Amount
}

type TokenProject {
  id: ID!
  name: String
  tokens: [Token!]!
  description: String
  twitterName: String
  homepageUrl: String
  logoUrl: String
  logo: Image
  smallLogo: Image
  isSpam: Boolean
  safetyLevel: SafetyLevel
  markets(currencies: [Currency!]!): [TokenProjectMarket]
}

type TokenProjectMarket {
  id: ID!
  tokenProject: TokenProject!
  currency: Currency!
  price: Amount
  volume24h: Amount
  pricePercentChange24h: Amount
  marketCap: Amount
  fullyDilutedMarketCap: Amount
  priceHistory(duration: HistoryDuration!): [TimestampedAmount]
  volume(duration: HistoryDuration!): Amount
  pricePercentChange(duration: HistoryDuration!): Amount
  priceHighLow(duration: HistoryDuration!, highLow: HighLow!): Amount
}

"""  TODO: implement MARKET_CAP and VOLUME, they return mock data"""
enum TokenSortableField {
  TOTAL_VALUE_LOCKED
  MARKET_CAP
  VOLUME
}

enum TokenStandard {
  NATIVE
  ERC20
  ERC1155
}

type TokenTransfer {
  id: ID!
  tokenStandard: TokenStandard!
  asset: Token!
  sender: String!
  recipient: String!
  quantity: String!
  direction: TransactionDirection!
  transactedValue: Amount
}

type Transaction {
  id: ID!
  blockNumber: Int!
  from: String!
  to: String!
  hash: String!
  nonce: Int!
  gasLimit: Float
  maxFeePerGas: Float
  status: TransactionStatus!
}

enum TransactionDirection {
  IN
  OUT
  SELF
}

enum TransactionStatus {
  FAILED
  CONFIRMED
  PENDING
}



Osub avatar Nov 27 '22 02:11 Osub

Where did you find it!

yefenghe avatar Nov 27 '22 03:11 yefenghe

get-graphql-schema https://beta.api.uniswap.org/v1/graphql -j
FetchError: request to https://beta.api.uniswap.org/v1/graphql failed, reason: connect ETIMEDOUT 162.125.82.7:443
    at ClientRequest.<anonymous> (/home/parallels/.nvm/versions/node/v14.21.1/lib/node_modules/get-graphql-schema/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (events.js:400:28)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}

is there an alternative REACT_APP_AWS_API_ENDPOINT ?

What does REACT_APP_AWS_API_ENDPOINT mean?

Had you fixed this problem? would you like to sharing ? I have the same issue.

Randyshu2018 avatar Feb 13 '23 02:02 Randyshu2018

I fixed it by enable http proxy. In my case, I'm using proxy client Clashx Pro on mac and enable ’增强模式‘ to make sure node command pass through the proxy. And you can also use other tools to make the node command pass through the proxy

easoninus avatar Mar 02 '23 07:03 easoninus

I fixed it by enable http proxy. In my case, I'm using proxy client Clashx Pro on mac and enable ’增强模式‘ to make sure node command pass through the proxy. And you can also use other tools to make the node command pass through the proxy

Your answer helped me, and I solved the problem by setting up the virtual network card. If you use wall-climbing software, you should have a similar setting.

ziyiyu avatar Mar 09 '23 08:03 ziyiyu

Error: FetchError: request to https://api.uniswap.org/v1/graphql failed, reason: Hostname/IP does not match certificate's altnames: Host: api.uniswap.org. is not in the cert's altnames: DNS:*.facebook.com, DNS:*.facebook.net, DNS:*.fbcdn.net, DNS:*.fbsbx.com, DNS:*.m.facebook.com, DNS:*.messenger.com, DNS:*.xx.fbcdn.net, DNS:*.xy.fbcdn.net, DNS:*.xz.fbcdn.net, DNS:facebook.com, DNS:messenger.com
    at ClientRequest.<anonymous> (/Users/zhangshuyao/Sites/workspace-maple/interface/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (events.js:400:28)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  type: 'system',
  errno: 'ERR_TLS_CERT_ALTNAME_INVALID',
  code: 'ERR_TLS_CERT_ALTNAME_INVALID'
}

    at /Users/zhangshuyao/Sites/workspace-maple/interface/scripts/fetch-schema.js:16:15
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
Failed to fetch schema from https://api.uniswap.org/v1/graphql

ccforeverd avatar May 17 '23 03:05 ccforeverd

interface/src/graphql/data/schema.graphql

"""This directive allows results to be deferred during execution"""
directive @defer on FIELD

"""
Tells the service this field/object has access authorized by a Cognito User Pools token.
"""
directive @aws_cognito_user_pools(
  """List of cognito user pool groups which have access on this field"""
  cognito_groups: [String]
) on OBJECT | FIELD_DEFINITION

"""
Tells the service which subscriptions will be published to when this mutation is
called. This directive is deprecated use @aws_susbscribe directive instead.
"""
directive @aws_publish(
  """
  List of subscriptions which will be published to when this mutation is called.
  """
  subscriptions: [String]
) on FIELD_DEFINITION

"""Tells the service which mutation triggers this subscription."""
directive @aws_subscribe(
  """
  List of mutations which will trigger this subscription when they are called.
  """
  mutations: [String]
) on FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by a Lambda Authorizer.
"""
directive @aws_lambda on OBJECT | FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by an OIDC token.
"""
directive @aws_oidc on OBJECT | FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by sigv4 signing.
"""
directive @aws_iam on OBJECT | FIELD_DEFINITION

"""Directs the schema to enforce authorization on a field"""
directive @aws_auth(
  """List of cognito user pool groups which have access on this field"""
  cognito_groups: [String]
) on FIELD_DEFINITION

"""
Tells the service this field/object has access authorized by an API key.
"""
directive @aws_api_key on OBJECT | FIELD_DEFINITION

enum ActivityType {
  APPROVE
  CANCEL
  CLAIM
  SEND
  RECEIVE
  SWAP
  DEPLOYMENT
  UNKNOWN
  money
  market
  LEND
  BORROW
  REPAY
  WITHDRAW
  NFT
  MINT
  BURN
  Staking
  STAKE
  UNSTAKE
}

type Amount implements IAmount {
  id: ID!
  currency: Currency
  value: Float!
}

type AmountChange {
  id: ID!
  percentage: Amount
  absolute: Amount
}

type AssetActivity {
  id: ID!
  timestamp: Int!
  type: ActivityType!
  gasUsed: Float
  transaction: Transaction!
  assetChanges: [AssetChange]!
}

union AssetChange = TokenTransfer | NftTransfer | TokenApproval | NftApproval | NftApproveForAll

"""
The `AWSJSON` scalar type provided by AWS AppSync, represents a JSON string that
complies with [RFC 8259](https://tools.ietf.org/html/rfc8259).  Maps like
"**{\\"upvotes\\": 10}**", lists like "**[1,2,3]**", and scalar values like
"**\\"AWSJSON example string\\"**", "**1**", and "**true**" are accepted as
valid JSON and will automatically be parsed and loaded in the resolver mapping
templates as Maps, Lists, or Scalar values rather than as the literal input
strings.  Invalid JSON strings like "**{a: 1}**", "**{'a': 1}**" and "**Unquoted
string**" will throw GraphQL validation errors.
"""
scalar AWSJSON

enum Chain {
  ARBITRUM
  ETHEREUM
  ETHEREUM_GOERLI
  OPTIMISM
  POLYGON
  CELO
}

input ContractInput {
  chain: Chain!
  address: String
}

enum Currency {
  USD
  ETH
}

type Dimensions {
  id: ID!
  height: Float
  width: Float
}

enum HighLow {
  HIGH
  LOW
}

enum HistoryDuration {
  HOUR
  DAY
  WEEK
  MONTH
  YEAR
  MAX
}

interface IAmount {
  currency: Currency
  value: Float!
}

interface IContract {
  chain: Chain!
  address: String
}

type Image {
  id: ID!
  url: String!
  dimensions: Dimensions
}

"""  TODO: deprecate this enum"""
enum MarketSortableField {
  MARKET_CAP
  VOLUME
}

type NftApproval {
  id: ID!
  nftStandard: NftStandard!

  """  can be erc20 or erc1155"""
  asset: NftAsset!
  approvedAddress: String!
}

type NftApproveForAll {
  id: ID!
  nftStandard: NftStandard!

  """  can be erc721 or erc1155"""
  asset: NftAsset!
  operatorAddress: String!
  approved: Boolean!
}

type NftAsset {
  id: ID!
  collection: NftCollection
  description: String
  imageUrl: String
  thumbnailUrl: String
  animationUrl: String
  smallImageUrl: String
  image: Image
  thumbnail: Image
  smallImage: Image
  originalImage: Image
  name: String
  nftContract: NftContract

  """  TODO: may need to be array to support erc1155 cases. not needed at the moment so will revisit.
  """
  ownerAddress: String
  tokenId: String!
  traits: [NftAssetTrait!]
  rarities: [NftAssetRarity!]
  listings(asc: Boolean, first: Int, last: Int, after: String, before: String): NftOrderConnection
  suspiciousFlag: Boolean
  flaggedBy: String
  metadataUrl: String
  creator: NftProfile
}

type NftAssetConnection {
  pageInfo: PageInfo!
  edges: [NftAssetEdge!]!
  totalCount: Int
}

type NftAssetEdge {
  cursor: String!
  node: NftAsset!
}

input NftAssetInput {
  address: String!
  tokenId: String!
}

type NftAssetRarity {
  id: ID!
  score: Float
  rank: Int
  provider: NftRarityProvider
}

input NftAssetsFilterInput {
  tokenSearchQuery: String
  tokenIds: [String!]
  traits: [NftAssetTraitInput!]
  listed: Boolean
  minPrice: String
  maxPrice: String
  marketplaces: [NftMarketplace!]
}

enum NftAssetSortableField {
  PRICE
  RARITY
}

type NftAssetTrait {
  id: ID!
  name: String
  rarity: Float
  value: String
}

input NftAssetTraitInput {
  name: String!
  values: [String!]!
}

type NftBalance {
  id: ID!
  ownedAsset: NftAsset
  listedMarketplaces: [NftMarketplace!]
  lastPrice: TimestampedAmount
  listingFees: [NftFee]
}

type NftBalanceConnection {
  pageInfo: PageInfo!
  edges: [NftBalanceEdge!]!
}

type NftBalanceEdge {
  cursor: String!
  node: NftBalance!
}

input NftBalancesFilterInput {
  addresses: [String!]
  assets: [NftAssetInput!]
}

type NftCollection {
  id: ID!
  collectionId: String!

  """
    TODO: support querying for collection assets here
   assets(page: Int, pageSize: Int, orderBy: NftAssetSortableField): [NftAsset]
  """
  bannerImageUrl: String
  bannerImage: Image
  description: String
  discordUrl: String
  homepageUrl: String
  imageUrl: String
  image: Image
  instagramName: String
  markets(currencies: [Currency!]!): [NftCollectionMarket!]
  name: String
  nftContracts: [NftContract!]
  openseaUrl: String
  traits: [NftCollectionTrait!]
  twitterName: String
  isVerified: Boolean
  numAssets: Int
  creator: NftProfile
}

type NftCollectionConnection {
  pageInfo: PageInfo!
  edges: [NftCollectionEdge!]!
}

type NftCollectionEdge {
  cursor: String!
  node: NftCollection!
}

type NftCollectionMarket {
  id: ID!
  nftContracts: [NftContract!]
  floorPrice: TimestampedAmount
  owners: Int
  volume24h: Amount
  totalVolume: TimestampedAmount
  volume(duration: HistoryDuration): TimestampedAmount
  volumePercentChange(duration: HistoryDuration): TimestampedAmount
  floorPricePercentChange(duration: HistoryDuration): TimestampedAmount
  sales(duration: HistoryDuration): TimestampedAmount
  listings: TimestampedAmount
  marketplaces(marketplaces: [NftMarketplace!]): [NftCollectionMarketplace!]
}

type NftCollectionMarketplace {
  id: ID!
  marketplace: NftMarketplace
  listings: Int
  floorPrice: Float
}

input NftCollectionsFilterInput {
  addresses: [String!]
}

type NftCollectionTrait {
  id: ID!
  name: String
  values: [String!]
  stats: [NftCollectionTraitStats!]
}

type NftCollectionTraitStats {
  id: ID!
  name: String
  value: String
  assets: Int
  listings: Int
}

type NftContract implements IContract {
  id: ID!
  address: String!
  chain: Chain!
  name: String
  standard: NftStandard
  symbol: String
  totalSupply: Int
}

type NftFee {
  id: ID!
  payoutAddress: String!
  basisPoints: Int!
}

enum NftMarketplace {
  OPENSEA
  LOOKSRARE
  X2Y2
  SUDOSWAP
  NFTX
  NFT20
  FOUNDATION
  CRYPTOPUNKS
}

enum NftMarketSortableField {
  VOLUME
  FLOOR_PRICE
}

type NftOrder {
  id: ID!
  address: String!
  tokenId: String
  type: OrderType!
  marketplace: NftMarketplace!
  marketplaceUrl: String!
  price: Amount!
  quantity: Int!
  orderHash: String
  status: OrderStatus!
  createdAt: Float!
  startAt: Float!
  endAt: Float
  maker: String!
  taker: String
  auctionType: String
  protocolParameters: AWSJSON
}

type NftOrderConnection {
  pageInfo: PageInfo!
  edges: [NftOrderEdge!]!
}

type NftOrderEdge {
  cursor: String!
  node: NftOrder!
}

type NftProfile {
  id: ID!
  address: String!
  isVerified: Boolean
  profileImage: Image
  username: String
}

enum NftRarityProvider {
  RARITY_SNIPER
}

enum NftStandard {
  ERC721
  ERC1155
  NONCOMPLIANT
}

type NftTransfer {
  id: ID!
  nftStandard: NftStandard!
  asset: NftAsset!
  sender: String!
  recipient: String!
  direction: TransactionDirection!
}

enum OrderStatus {
  VALID
  EXECUTED
  CANCELLED
  EXPIRED
}

enum OrderType {
  LISTING
  OFFER
}

type PageInfo {
  hasPreviousPage: Boolean
  hasNextPage: Boolean
  startCursor: String
  endCursor: String
}

type Portfolio {
  id: ID!
  ownerAddress: String!
  tokensTotalDenominatedValue: Amount
  tokensTotalDenominatedValueChange(duration: HistoryDuration): AmountChange
  tokensTotalDenominatedValueHistory(duration: HistoryDuration): [TimestampedAmount]
  tokenBalances: [TokenBalance]
  assetsValueUSD: Float
  totalValueUSD: Float
  assetsValue: Float
  totalValue: Float
  absoluteChange24H: Float
  relativeChange24H: Float

  """  TODO: (michael.zhang) replace with paginated query"""
  nftBalances: [NftBalance]
  assetActivities(page: Int, pageSize: Int): [AssetActivity]
}

type Query {
  tokens(contracts: [ContractInput!]!): [Token]
  tokenProjects(contracts: [ContractInput!]!): [TokenProject]
  topTokenProjects(orderBy: MarketSortableField!, page: Int!, pageSize: Int!, currency: Currency): [TokenProject]
  searchTokens(searchQuery: String!): [Token]
  searchTokenProjects(searchQuery: String!): [TokenProject]
  assetActivities(address: String!, page: Int, pageSize: Int): [AssetActivity]
  portfolio(ownerAddress: String!): Portfolio
  portfolios(ownerAddresses: [String!]!): [Portfolio]
  nftCollectionsById(collectionIds: [String]): [NftCollection]
  topTokens(chain: Chain, page: Int!, pageSize: Int!, orderBy: TokenSortableField): [Token]
  nftAssets(chain: Chain, address: String!, orderBy: NftAssetSortableField, asc: Boolean, filter: NftAssetsFilterInput, first: Int, last: Int, after: String, before: String): NftAssetConnection
  nftCollections(filter: NftCollectionsFilterInput, first: Int, last: Int, after: String, before: String): NftCollectionConnection
  nftBalances(chain: Chain, ownerAddress: String!, filter: NftBalancesFilterInput, first: Int, last: Int, after: String, before: String): NftBalanceConnection
}

enum SafetyLevel {
  VERIFIED
  MEDIUM_WARNING
  STRONG_WARNING
  BLOCKED
}

type TimestampedAmount implements IAmount {
  id: ID!
  currency: Currency
  value: Float!
  timestamp: Int!
}

type Token implements IContract {
  id: ID!
  chain: Chain!
  address: String
  standard: TokenStandard
  decimals: Int
  name: String
  symbol: String
  project: TokenProject
  market(currency: Currency): TokenMarket
}

type TokenApproval {
  id: ID!
  tokenStandard: TokenStandard!

  """  can be erc20 or erc1155"""
  asset: Token!
  approvedAddress: String!
  quantity: String!
}

type TokenBalance {
  id: ID!
  blockNumber: Int
  blockTimestamp: Int
  quantity: Float
  denominatedValue: Amount
  ownerAddress: String!
  token: Token
  tokenProjectMarket: TokenProjectMarket
}

type TokenMarket {
  id: ID!
  token: Token!
  price: Amount
  totalValueLocked: Amount
  volume(duration: HistoryDuration!): Amount
  pricePercentChange(duration: HistoryDuration!): Amount
  priceHistory(duration: HistoryDuration!): [TimestampedAmount]
  priceHighLow(duration: HistoryDuration!, highLow: HighLow!): Amount
}

type TokenProject {
  id: ID!
  name: String
  tokens: [Token!]!
  description: String
  twitterName: String
  homepageUrl: String
  logoUrl: String
  logo: Image
  smallLogo: Image
  isSpam: Boolean
  safetyLevel: SafetyLevel
  markets(currencies: [Currency!]!): [TokenProjectMarket]
}

type TokenProjectMarket {
  id: ID!
  tokenProject: TokenProject!
  currency: Currency!
  price: Amount
  volume24h: Amount
  pricePercentChange24h: Amount
  marketCap: Amount
  fullyDilutedMarketCap: Amount
  priceHistory(duration: HistoryDuration!): [TimestampedAmount]
  volume(duration: HistoryDuration!): Amount
  pricePercentChange(duration: HistoryDuration!): Amount
  priceHighLow(duration: HistoryDuration!, highLow: HighLow!): Amount
}

"""  TODO: implement MARKET_CAP and VOLUME, they return mock data"""
enum TokenSortableField {
  TOTAL_VALUE_LOCKED
  MARKET_CAP
  VOLUME
}

enum TokenStandard {
  NATIVE
  ERC20
  ERC1155
}

type TokenTransfer {
  id: ID!
  tokenStandard: TokenStandard!
  asset: Token!
  sender: String!
  recipient: String!
  quantity: String!
  direction: TransactionDirection!
  transactedValue: Amount
}

type Transaction {
  id: ID!
  blockNumber: Int!
  from: String!
  to: String!
  hash: String!
  nonce: Int!
  gasLimit: Float
  maxFeePerGas: Float
  status: TransactionStatus!
}

enum TransactionDirection {
  IN
  OUT
  SELF
}

enum TransactionStatus {
  FAILED
  CONFIRMED
  PENDING
}

I use this schema and run npx graphql-codegen --config graphql.data.codegen.config.ts but got:

✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to src/graphql/data/__generated__/types-and-hooks.ts
    ✔ Load GraphQL schemas
    ✔ Load GraphQL documents
    ✖ GraphQL Document Validation failed with 13 errors;
      Error 0: Cannot query field "token" on type "Query". Did you mean "tokens"?
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/Token.ts:3:5
      Error 1: Cannot query field "token" on type "Query". Did you mean "tokens"?
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/TokenPrice.ts:3:5
      Error 2: Cannot query field "token" on type "Query". Did you mean "tokens"?
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/TokenSpotPrice.ts:3:5
      Error 3: Field "nameQuery" is not defined by type "NftCollectionsFilterInput".
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/CollectionSearch.ts:3:30
      Error 4: Unknown type "NftActivityFilterInput". Did you mean "NftAssetsFilterInput", "NftBalancesFilterIn…
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/NftActivity.ts:2:30
      Error 5: Cannot query field "nftActivity" on type "Query".
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/NftActivity.ts:3:5
      Error 6: Cannot query field "nftRoute" on type "Query".
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/NftUniversalRouterAddress.ts:3…
      Error 7: Unknown type "NftTradeInput". Did you mean "ContractInput" or "NftAssetInput"?
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/Routing.ts:5:18
      Error 8: Unknown type "TokenTradeInput". Did you mean "ContractInput", "TokenMarket", "TokenProject", or …
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/Routing.ts:6:20
      Error 9: Cannot query field "nftRoute" on type "Query".
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/Routing.ts:8:5
      Error 10: Cannot query field "topCollections" on type "Query". Did you mean "nftCollections"?
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/nft/TrendingCollections.ts:3:5
      Error 11: Unknown argument "chains" on field "Query.portfolios".
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/portfolios.ts:3:49
      Error 12: Cannot query field "chain" on type "AssetActivity".
      at /Users/zhangshuyao/Sites/workspace-maple/interface/src/graphql/data/transactions.graphql:109:3

ccforeverd avatar May 17 '23 03:05 ccforeverd

I have the same issue. Maybe someone knows how to solve it

MaksHladun avatar Jun 14 '23 08:06 MaksHladun

me too

pengwenan avatar Aug 10 '23 03:08 pengwenan

me to

BigOceanGG avatar Aug 15 '23 02:08 BigOceanGG

Guys, I solved this problem just by installing vpn with US location and everything is good. This only needs to be done the first time for the types to download. Then run without vpn. Working 100%

That is, you do not modify anything, you do not add anything. Just vpn and yarn/npm install

MaksHladun avatar Aug 15 '23 06:08 MaksHladun

@MaksHladun thanks

BigOceanGG avatar Aug 15 '23 06:08 BigOceanGG

I used US vpn but the fetch still didn't work

theoiorga avatar Nov 12 '23 14:11 theoiorga

I used US vpn but the fetch still didn't work

kingport avatar Nov 15 '23 03:11 kingport

VPN(Europe or USA)

Add on 14 row scripts/compile-ajv-validators.js this code

fs.mkdirSync(path.join(__dirname, '../src/utils/__generated__'), { recursive: true })

yarn yarn start

And it works for me.

andriyjunior avatar Jan 12 '24 13:01 andriyjunior