Git Product home page Git Product logo

graphql-wallet's Introduction

graphql-icon GraphQL Wallet

With the new Web3.js 2.0 comes a brand-new client-side GraphQL resolver for the Solana JSON RPC.

@solana/rpc-graphql

This GraphQL library:

  • Allows developers to make requests to the Solana JSON RPC using GraphQL queries.
  • Provides a full type schema around Solana's jsonParsed type spec.
  • Offers highly-optimized usage of RPC requests out of the box.
  • Supports the Relay server specification, enabling Relay-native web applications.

Provided here for demonstration is a web application - a basic, read-only wallet and block explorer - that aims to showcase the GraphQL library's capabilities.

  • Querying the Solana RPC with GraphQL
  • Accounts:
    • Querying program accounts
    • Subslicing encoded account data
    • JSON-parsed types
    • Extending account types (IDL)
  • Instructions:
    • Querying transactions
    • Querying blocks
    • JSON-parsed types
    • Extending instruction types (IDL)
  • RPC request optimization:
    • Request coalescing
    • Nested queries
    • Response caching
  • Relay:
    • node queries
    • Connections

Running the Demo

Requirements:

  • NodeJS 20
  • NPM
  • Rust
  • Shank CLI: cargo-install shank-cli
  • Solana 1.18: sh -c "$(curl -sSfL https://release.solana.com/v1.18.12/install)"

Install the application's dependencies.

npm install

In a separate terminal, start a local test validator. Note the provided npm command will start the local validator with all of the necessary account fixtures and the BPF program.

npm run test-validator

Run the script to generate a bunch of transactions. LOCAL_VALIDATOR_RPC_ENDPOINT will default to http://127.0.0.1:8899 if not provided.

npm run generate-transactions <LOCAL_VALIDATOR_RPC_ENDPOINT>

Launch the application. Note you can define an RPC_ENDPOINT variable in a .env file in the root of the repository if you wish to use a custom endpoint. This value will default to http://127.0.0.1:8899 if not provided.

npm start

graphql-wallet's People

Contributors

buffalojoec avatar hrushi20 avatar nasjuice avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.