1.0.9 • Published 7 months ago

@spling-labs/spling-protocol v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Spling Labs - Spling Protocol for building a solana on-chain dApp.

If you have any questions about the SDK, join our Discord to get help!

Quick Setup

Install

Install these dependencies over:

npm:

npm install @spling-labs/spling-protocol

If you plan to install the package in your react.js or next.js project, keep in mind that you need to install this package with the --no-optiona flag:

npm install @spling-labs/spling-protocol --no-optional

Setup (React Example)

import React, { useEffect } from 'react'
import { SplingProtocol } from '@spling-labs/spling-protocol'
import { Keypair } from "@solana/web3.js";

export default function SplingProtocol() {
  useEffect(() => {
    ;(async () => {
      const wallet: Keypair = Keypair.generate()
      const options = { rpcUrl: "https://api.mainnet-beta.solana.com/" } as ProtocolOptions

      // Initialize the spling protocol
      const splingProtocol = await new SplingProtocol(wallet, options).init()

      // You can call now functions like:
      const issuer = await splingProtocol.createIssuer() 
    })()
  }, [wallet?.publicKey])
  return <div></div>
}

Setup (React Native Example)

import React, { useEffect } from 'react'
import { SplingProtocol } from '@spling-labs/spling-protocol'
import { Keypair } from "@solana/web3.js";

export default function SplingProtocol() {
  useEffect(() => {
    ;(async () => {
      const wallet: Keypair = Keypair.generate()
      const options = { rpcUrl: "https://api.mainnet-beta.solana.com/" } as ProtocolOptions

      // Initialize the spling protocol
      const splingProtocol = await new SplingProtocol(wallet, options).init()

      // You can call now functions like:
      const issuer = await splingProtocol.createIssuer() 
    })()
  }, [])
  
  return <View></View>;
}

Setup (NodeJS Example)

import { SplingProtocol } from '@spling-labs/spling-protocol'
const wallet: Keypair = Keypair.generate()
const options = { rpcUrl: "https://api.mainnet-beta.solana.com/" } as ProtocolOptions

// Initialize the spling protocol
const splingProtocol = await new SplingProtocol(wallet, options).init()

// You can call now functions like:
const issuer = await splingProtocol.createIssuer()