1.0.12 • Published 3 days ago

@xircus-web3/graph-ton v1.0.12

Weekly downloads
-
License
MIT
Repository
-
Last release
3 days ago

@xircus-web3/graph-ton

A GraphQL API dedicated only to interact with TON Chain and aggregate smart contracts data deployed in TON.

Documentation

Read Documentation

Recent Changes

Installation

Install Xircus Graph SDK and its ethers peer dependency.

npm install @xircus-web3/graph-ton graphql graphql-yoga mongoose

or

yarn add @xircus-web3/graph-ton graphql graphql-yoga mongoose

Usage

  • Sample setup with Mongoose, GraphQL Yoga on NextJS
  • Create pages/api/graphql.js in your next app
  • Make sure to have .env file DATABASE_URL=mongodburl
  • to test locally .env DATABASE_URL=mongodb://localhost:27017/DATABASE_NAME
import { createYoga, createSchema } from 'graphql-yoga'
import mongoose from 'mongoose'
import { createMongo, createTonAuth, createTonQuest, createTonSchema, tonSchema } from '@xircus-web3/graph-ton'

mongoose.set('strictQuery', false)
const env = process.env.API_ENV || 'production'

const schema = createTonSchema({
  // extendable graphql mutation and query
  Mutation: { ... },
  Query: { ... }
})


const server = createYoga({
  graphqlEndpoint: '/api/graphql',
  schema: createSchema(schema),
  context: async({ req }) => {
    // db models from any source
    const models = await createMongo(mongoose, tonSchema)

    // extendable services
    const auth = createTonAuth(req, models)
    const quest = createTonQuest(models)

    // extendable params
    return {
      env,
      models,
      auth,
      quest,
      secret: APP_SECRET_KEY
    }
  }
})

export default server

Community

Check out the following places for more xircus-related content:

Support

If you find @xircus-web3/graph-ton useful, please consider supporting our development. Thank you 🙏

1.0.12

3 days ago

1.0.11

4 days ago

1.0.10

5 days ago

1.0.9

5 days ago

1.0.7

5 days ago

1.0.5

5 days ago

1.0.4

6 days ago

1.0.2

7 days ago

1.0.3

7 days ago

1.0.1

30 days ago

1.0.0

1 month ago