npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mirrorworld/library.upgrade.new

v2.0.0-alpha.29

Published

Level upgrade SDK

Downloads

76

Readme

This SDK contains the client side methods for the Level Upgrade Solana Program

Installation

🚨 Please make sure to add this NPM token in your .npmrc file: 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

yarn add @mirrorworld/library.upgrade

Usage

Import the LevelUpgrade instance into your client. It expects a connection and wallet instance. You can get these by using one of the Solana Wallet Adapters your application will use to connect to a Solana RPC.

These transactions require you to sign the transaction using your wallet. That means you need to have SOL. You can request SOL from the SolFaucet

import {
    LevelUpgrade,
    // Required
    LEVEL_UPGRADE_PROGRAM_ID
} from '@mirrorworld/library.upgrade'

const connection = useConnection()

/** Make sure your wallet is initialized and connected to the browser before providing to LevelUpgrade */ 
const wallet = useWallet()

/** LevelUpgrade instance */
const levelUpgrade = new LevelUpgrade(
    LEVEL_UPGRADE_PROGRAM_ID,
    connection,
    wallet
);

Demo

Example: You can see example project in this repo here:

Create Update NFT Level Transaction

Create Update NFT Level Transaction object LevelUpgrade.updateLevel method. See docs for details.

let levelUpdateTransaction: Transaction = await levelUpgrade.updateLevel(
    nftAddress,
    userWallet.publicKey,
    newNftLevel,
    signingAuthorityWalletKeypair.publicKey
);

See example here

Signing Authority Sign Transaction

Sign Transaction object with secret Key LevelUpgrade.signTransaction method. See docs for details.

const signingAuthoritySignedLevelUpdateTransaction: Transaction = levelUpgrade.signTransaction(
    levelUpdateTransaction,
    signingAuthorityWalletSecretKey
);

See example here

Get NFT Level Up Account Data

Get NFT Level Up Account Data from the PDA Address LevelUpgrade.getLevelUpAccountPdaData method. See docs for details.

const levelUpAccountPdaAddressData = await levelUpgrade.getLevelUpAccountPdaData(
    levelupAccountPdaAddress
);

console.log("NFT address: ", levelUpAccountPdaAddressData.tokenKey.toBase58());
console.log("NFT Current Level: ", levelUpAccountPdaAddressData.level);

console.log("Levelup account pda address data: ", levelUpAccountPdaAddressData);

See example here

Get NFT Level

Get NFT Level from the NFT address LevelUpgrade.getNftLevel method. See docs for details.

const nftLevel = await levelUpgrade.getNftLevel(nftAddress);
console.log("Nft level: ", nftLevel);

See example here

Get NFT Level Or Default

Get NFT Level from the NFT address (If nft not exist in the program it will return 0 by default) LevelUpgrade.getNftLevelOrDefault method. See docs for details.

const nftLevelOrDefault = await levelUpgrade.getNftLevelOrDefault(nftAddress);
console.log("Nft level or default: ", nftLevel);

See example here