Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mirrorworld/library.gen2.new

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mirrorworld/library.gen2.new

mirror generation two SDK

  • 1.0.0-alpha.35
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
0
Weekly downloads
 
Created
Source

@mirrorworld/library.gen2 Client SDK

This SDK contains the client side methods for the Mirror Generation Two 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

Keywords

FAQs

Package last updated on 11 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc