LYNC
DashboardSupport
  • 👋Introducing LYNC
  • Products
    • LYNC Account Abstraction SDK
    • LYNC Account Abstraction WebGL SDK
    • Metamask Wallet
    • LYNC Metamask PC SDK
    • OKX Wallet
    • LYNC In-Game Marketplace SDK
    • NFT Fetcher
    • No-Code Smart Contract Deployer
    • EVM Lootbox SDK
      • Getting Started
      • Using the SDK
        • Creating a new lootbox
        • Opening a lootbox
        • Claiming rewards
        • Whitelisting users using lootbox
        • Lootbox admin functions
        • Useful information functions from LyncLootBox class
        • Multicall : opening and claiming multiple lootboxes in a single transaction
      • Example Codes in React & TypeScript
        • Example code for creating a new lootbox
        • Example code for opening a lootbox
        • Example code for claiming a lootbox
    • Launch your products on Telegram
      • Configure Your Telegram Bot
      • Deploying Your Product on TG
  • APTOS
    • LYNC Paymaster - Supporting Aptos
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • Unity
        • API
        • JavaScript/ TypeScript
    • LYNC Unity Aptos SDK
    • Keyless Accounts
      • Configure Your OIDC Provider
      • Integrate Keyless in Unity
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
        • Send generic transactions on Aptos
    • LYNC Social Login SDK on Aptos
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Aptos Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
  • Movement Labs
    • 📇Indexer
      • How to run index custom data?
      • Example Queries
        • Get Token Info
        • Get Token Balances
        • Get NFTs Owned by an Account
    • NFT Deployer
    • LYNC Social Login SDK on Movement
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types and Enums Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Unity Movement SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
    • LYNC Paymaster - Supporting Movement
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
  • Supra
    • LYNC Paymaster - Supporting Supra L1
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
    • LYNC Unity SUPRA SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • Fuel
    • LYNC Unity Fuel SDK
    • LYNC NFT Deployer
      • Introduction
      • Getting Started
      • Deploying Your NFTs
        • Launch Your Entire Collection
      • Troubleshooting and FAQs
    • LYNC Fuel Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
    • Fuel Marketplace NPM SDK
      • Getting Started
      • Using the SDK
        • Using hooks to get the marketplace data
        • Using services provided by the SDK to list, buy, and manage tokens
        • Some useful functions provided by the SDK
        • Error codes for the SDK
        • Interfaces and Enums provided by the SDK
      • Support
  • Metis
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • NPM Packages
    • Marketplace
      • Hook: useAllCollectionNFT
      • Hook: useAllBuyNFT
      • Hook: useAllOwnerNFT
      • Hook: useNFTDetails
      • Hook: useAllNFTForRent
Powered by GitBook
On this page
  • 1. activate
  • 2. deactivate
  • 3. removeItem
  • 4. permanentlyStop
  • 5. updateRemainingOpensForAddresses
  • 6. changeTrustedForwarder
  • 7. transferOwnership
  1. Products
  2. EVM Lootbox SDK
  3. Using the SDK

Lootbox admin functions

PreviousWhitelisting users using lootboxNextUseful information functions from LyncLootBox class

Last updated 8 months ago

These are function that only the lootbox owner can call. One of the function (update whitelist) is already described above.

Initialize the class before calling any of these functions

import { LyncLootBox, LootBoxError } from "@lyncworld/lootbox-evm-sdk";
import { ethers } from "ethers";

const lb = new LyncLootBox();
await lb.initialize(
	ChainIdentifier.BASE_SEPOLIA, // your chain
	provider, // provider
	lootboxId // your lootbox id / address
);

NOTE -

These functions if called with a signer that is not the owner of the lootbox will throw LBErrorCodes.VALIDATION_ERROR with the message "Signer is not the lootbox owner."

1. activate

This function activates a lootbox which might be deactivated by the owner earlier or might be deactivated while creating the lootbox using the option.

const signer = ... // transaction signer - should be the lootbox owner
const txn = await lb.activate(signer);
console.log(txn);

2. deactivate

This function deactivates the lootbox which stops any new users from opening the lootbox. This will temporarily stop the lootbox and will not remove any items from the lootbox.

NOTE: Users with any pending claims can still claim their rewards.

const signer = ... // transaction signer - should be the lootbox owner
const txn = await lb.deactivate(signer);
console.log(txn);

3. removeItem

This will remove one item from the lootbox. It will withdraw the item if it is present in the lootbox and send it to the owner of the lootbox.

const signer = ... // transaction signer - should be the lootbox owner
const itemAddress = ... // item address - should be present in lootbox
const txn = await lb.removeItem(signer, itemAddress);
console.log(txn);

4. permanentlyStop

This will permanently disable the lootbox and withdraw all the items from the lootbox and send it to lootbox owner. This action will permanently disable all functions of the lootbox except for the claimRewards function. Users who have pending rewards from previous openings will still be able to claim them. This will also stop the lootbox from receiving any new RNGs from supra.

const signer = ... // transaction signer - should be the lootbox owner
const txn = await lb.permanentlyStop(signer);
console.log(txn);

5. updateRemainingOpensForAddresses

Since, there could be multiple opens per wallet. This function can be used to set the number of opens for some addresses other then the default passed during creation.

const signer = ... // transaction signer - should be the lootbox owner
const addresses = [
	"0x...",
	... more addresses
];
const remainingOpens = [
	2,
	... new remainingOpens for other addresses
]
const txn = await lb.updateRemainingOpensForAddresses(
	signer, 
	addresses, 
	remainingOpens
);
console.log(txn);

6. changeTrustedForwarder

Change the trusted forwarder for meta transactions. Can be useful when you switch meta transaction providers.

const signer = ... // transaction signer - should be the lootbox owner
const newForwarder = "0x..." // new forwarder address
const txn = await lb.changeTrustedForwarder(signer, newForwarder);
console.log(txn);

7. transferOwnership

Change the lootbox owner.

NOTE -

If you change the ownership of the lootbox and then withdraw any item or permanently stop the lootbox all the contents of the lootbox will be sent to the new owner.

const signer = ... // transaction signer - should be the lootbox owner
const newOwner = "0x..." // new lootbox owner
const txn = await lb.transferOwnership(signer, newOwner);
console.log(txn);
activateLootbox