Giter Site home page Giter Site logo

saturn-v2-integration's Introduction

Welcome to the Saturn V2 Integration Library!

Saturn Integration Home

Getting Started

First, we need to install the pnpm package manager.

Next, install all dependencies and run the development server:

pnpm i
pnpm run dev

Open http://localhost:3000 with your browser to see the result.

API Minting NFTs

Minting NFTs with our API is as simple as implementing the copy / pastable code in this library. This library has a demo that can be tested as well.

  • Click on the "Mint NFTs" button in the Navbar.

Saturn Integration Mint

  • We need to get a preprod Saturn API key by following these steps:
  1. Go to Preprod Saturn
  2. Connect a preprod wallet (Nami is recommended you can switch to preprod in the settings).
  3. Enter the studio and go to the "Settings Page" which is the gear icon on the left hand sidebar.
  4. Click on the "Add API Key" button. Make sure to save this key as you will not be able to view it again (Note: the key in the image is revoked)

Saturn Integration API Key

  • After we have our API Key, paste it into the Saturn V2 Integration "Mint NFTs" page, connect your wallet, and press the "Mint NFT" button.
  • This will have us execute 2 transactions, 1 to deploy the minting smart contract on the blockchain and 1 right after to mint the NFT.
  • Note: when you mint your project, you only need to deploy the smart contract once and you can do so in the Saturn app. You do not need to deploy the contract on chain multiple times.

Here is the code for the 2 graphQL mutations required to Create an NFT Minting Transaction and to Submit an NFT Minting Transaction:

//---------------------------------------------------------------------------------------------------//
// Create and Submit NFT Transaction Functions
//---------------------------------------------------------------------------------------------------//
export const mutateCreateNFTMintBurnUpdateTransaction = async (input: CreateNFTMintBurnUpdateTransactionInput) => {
    const parameters = { input: input };
    v2GraphQLClient.setHeaders(await getGraphQLHeaders());
    const response: any = await v2GraphQLClient.request(
        gql`
            mutation CreateNFTMintBurnUpdateTransaction($input: CreateNFTMintBurnUpdateTransactionInput!) {
                createNFTMintBurnUpdateTransaction(input: $input) {
                    successTransactions {
                        transactionId
                        hexTransaction
                    }
                    error {
                        message
                    }
                }
            }
        `,
        parameters
    );
    const createNFTMintBurnUpdateTransactionPayload: CreateNFTMintBurnUpdateTransactionPayload =
        response?.createNFTMintBurnUpdateTransaction || {};
    return createNFTMintBurnUpdateTransactionPayload;
};

export const mutateSubmitNFTMintBurnUpdateTransaction = async (input: SubmitNFTMintBurnUpdateTransactionInput) => {
    const parameters = { input: input };
    v2GraphQLClient.setHeaders(await getGraphQLHeaders());
    const response: any = await v2GraphQLClient.request(
        gql`
            mutation SubmitNFTMintBurnUpdateTransaction($input: SubmitNFTMintBurnUpdateTransactionInput!) {
                submitNFTMintBurnUpdateTransaction(input: $input) {
                    transactionIds
                    error {
                        message
                    }
                }
            }
        `,
        parameters
    );
    const submitNFTMintBurnUpdateTransactionPayload: SubmitNFTMintBurnUpdateTransactionPayload =
        response?.submitNFTMintBurnUpdateTransaction || {};
    return submitNFTMintBurnUpdateTransactionPayload;
};
//---------------------------------------------------------------------------------------------------//

API Upgrading NFTs

After minting an NFT, now we want to upgrade the NFT. Make sure to check the console for the Saturn NFT Id that we just minted. Take that NFT Id along with the API Key and navigate to the Upgrade NFTs page.

Saturn Integration Upgrade

Input the API Key as well as the NFT Id, click "Upgrade NFT" and you will be asked to sign an upgrade transaction! Congrats we have minted and upgraded an NFT!

The graphQL mutations that allow for minting the NFTs are the same for updating the NFTs to allow for composable transactions. This code is copy and pastable from the integration library so you can customize any type of minting logic you like.

You can even create complex gamification and crafting systems by combing Token Project and NFT Project transactions together with the APIs!

API Documentation

You can view the full GraphQL API allowing for a simple developer experience that can be implemented seamlessly into any front ends you build!

API Documentation

Discord Server

If you have any further questions, or need support with the API Documentation or this library, we have the Saturn Discord Server to ask any questions that you have!

saturn-v2-integration's People

Contributors

avatar-nick avatar theavatarchris 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.