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

bmcgames-sdk-dev

v1.0.5

Published

Typescript SDK to interact with BMCgames program.

Downloads

69

Readme

bmc-games-dev-sdk

Installation

yarn add bmc-games-dev-sdk

BackOffice

Load SDK wrappers

import { BmcGamesSDK, AdminWrapper } from "bmc-games-dev-sdk";
import { SolanaProvider } from "@saberhq/solana-contrib";

const wallet = useWallet();
const { connection } = useConnection();

const provider = SolanaProvider.init({
  connection,
  wallet: wallet as any,
  opts: {
    preflightCommitment: "finalized",
    commitment: "finalized",
  },
});
const bmcGamesSDK = BmcGamesSDK.load({ provider });
const adminWrapper = new AdminWrapper(bmcGamesSDK, wallet.publickKey.toString()); // wallet.publickKey should be String

Add game partner - Admin Wallet

  const tx = await adminWrapper.addGamePartner({
    partnerWalletStr,
    partnerWithdrawalTokenMintAddressStr,
  });

Change voter wallets - Admin Wallet

  const tx = await adminWrapper.changeVoterWithdrawalWallets({
    wallet1Str,
    wallet2Str,
    wallet3Str,
    wallet4Str,
    wallet5Str,
    approvalChin, // number
  });

Decrease liquidity - Withdrawal Wallet

token and amount depends on pool which is going to decrease

  const tx = await adminWrapper.decreaseLiquidity({
    withdrawAmount, // token amount; ex: 3.412
    withdrawalTokenMintAddress, // Pubkey. not string
  });

Increase liquidity - Withdrawal Wallet

token and amount depends on pool which is going to increase

  const tx = await adminWrapper.increaseLiquidity({
    depositAmount, // token amount; ex: 3.412
    depositTokenMintAddress, // Pubkey. not string
  });

Update By Admin - Admin Wallet

  const tx = await adminWrapper.updateByAdmin({
    botWalletStr, // String
    isEnabledVoting, // boolean
    isEmergencyStatus, // boolean
  });

Set deposit token - Admin Wallet

  const tx = await adminWrapper.setDepositToken({
    newDepositTokenMintAddress // Pubkey
  });

Set game partner status - Admin Wallet

  const tx = await adminWrapper.setGamePartnerStatus({
    partnerWalletStr, // String
    isEnabled // boolean
  });

Set game partner token - Admin Wallet

  const tx = await adminWrapper.setGamePartnerToken({
    partnerWalletStr, // String
    newPartnerWithdrawalTokenMintAddress // Pubkey
  });

Set platform withdrawal token - Admin Wallet

:warning: Warning ~~setPlatformWithdrawalToken();~~ This function is deprecated.

  // const tx = await adminWrapper.setPlatformWithdrawalToken({
  //   newPlatformWithdrawalTokenMintAddress // Pubkey
  // });

Set reward token - Admin Wallet

  const tx = await adminWrapper.setRewardToken({
    newRewardWithdrawalTokenMintAddress // Pubkey
  });

Set user status - Admin Wallet

  const tx = await adminWrapper.setUserStatus({
    userWalletStr, // String
    isUnblocked,  // boolean
  });

Start voting withdrawal wallet - Admin Wallet

  const tx = await adminWrapper.startVotingWithdrawalWallet({
    newWithdrawalWalletStr, // String
  });

Withdraw platform fund - Withdrawal Wallet

  const tx = await adminWrapper.withdrawPlatformFund({
    withdrawAmount, // token amount; ex: 3.412
  });

Get global states - admin wrapper

  let info = await adminWrapper.getGlobalInfo();

Get fund status - admin wrapper

  let info = await adminWrapper.calcInsufficientWithdrawalTokenAmount();

Bmc

import { BmcGamesSDK, BmcWrapper } from "bmc-games-dev-sdk";
import { SolanaProvider } from "@saberhq/solana-contrib";

const wallet = useWallet();
const { connection } = useConnection();

const provider = SolanaProvider.init({
  connection,
  wallet: wallet as any,
  opts: {
    preflightCommitment: "finalized",
    commitment: "finalized",
  },
});
const bmcGamesSDK = BmcGamesSDK.load({ provider });
const bmcWrapper = new BmcWrapper(bmcGamesSDK, wallet.publickKey.toString()); // wallet.publickKey should be String

Vote withdrawal wallet - voter Wallet

  const tx = await bmcWrapper.voteWithdrawalWallet();

Get voting status - bmc wrapper

  let info = await bmcWrapper.getVoteWalletInfo();

Bot

import { BmcGamesSDK, BotWrapper } from "bmc-games-dev-sdk";
import { SolanaProvider } from "@saberhq/solana-contrib";

const wallet = useWallet();
const { connection } = useConnection();

const provider = SolanaProvider.init({
  connection,
  wallet: wallet as any,
  opts: {
    preflightCommitment: "finalized",
    commitment: "finalized",
  },
});
const bmcGamesSDK = BmcGamesSDK.load({ provider });
const botWrapper = new BotWrapper(bmcGamesSDK, wallet.publickKey.toString()); // wallet.publickKey should be String

Add user - bot Wallet

  const tx = await botWrapper.addUser({
    userWalletStr // String
  });

End season (unlock partner funds) - bot Wallet

token and amount depends on depositToken

  const tx = await botWrapper.endSeasonGamePartner({
    partnerWalletStr, // String
    unlockedAmount, // token amount; ex: 3.412
  });

End season (unlock platform funds) - bot Wallet

token and amount depends on depositToken

  const tx = await botWrapper.endSeasonPlatform({
    unlockedAmount, // token amount; ex: 3.412
  });

End season (unlock user reward ticket) - bot Wallet

token and amount depends on depositToken

  const tx = await botWrapper.endSeasonUser({
    userWalletStr, // String
    unlockedAmount, // token amount; ex: 3.412 - based on beamo depositToken
  });

Purchase game item (deposit from Beamo) - beamo & bot Wallet

token and amount depends on depositToken

  const tx = await botWrapper.purchaseGameItem({
    gamePartnerWalletStr, // String
    depositAmount, // token amount; ex: 3.412 - based on beamo depositToken
    gameStudioPercentage, // 100% = 10000
    rewardPercentage, // 100% = 10000, if isSeasonGame == true then 0%
    isSeasonGame, // boolean
  });

Partner

import { BmcGamesSDK, PartnerWrapper } from "bmc-games-dev-sdk";
import { SolanaProvider } from "@saberhq/solana-contrib";

const wallet = useWallet();
const { connection } = useConnection();

const provider = SolanaProvider.init({
  connection,
  wallet: wallet as any,
  opts: {
    preflightCommitment: "finalized",
    commitment: "finalized",
  },
});
const bmcGamesSDK = BmcGamesSDK.load({ provider });
const partnerWrapper = new PartnerWrapper(bmcGamesSDK, wallet.publickKey.toString()); // wallet.publickKey should be String

Claim game partner fund - partner Wallet

Amount depends on depositToken. Partner will receive with partnerWithdrawalToken. Signers will be partner-wallet and bot-wallet. If smartContract returns InsufficientTokenAmount error, insufficient_withdrawal_pool = true and then send message to admin via slack bot channel. Check diagram.xlsx [checklist] No.4

  const tx = await partnerWrapper.claimGamePartnerFund({
    rewardAmount  // token amount; ex: 3.412
  });

Get partners list - partner wrapper

  let partners = await partnerWrapper.getPartnersInfo();

Get a partner info - partner wrapper

The unit of token amount in returned array is same with depositToken

  let partner = await partnerWrapper.getPartnerInfo(
    partnerWalletStr // String
  );

User

import { BmcGamesSDK, UserWrapper } from "bmc-games-dev-sdk";
import { SolanaProvider } from "@saberhq/solana-contrib";

const wallet = useWallet();
const { connection } = useConnection();

const provider = SolanaProvider.init({
  connection,
  wallet: wallet as any,
  opts: {
    preflightCommitment: "finalized",
    commitment: "finalized",
  },
});
const bmcGamesSDK = BmcGamesSDK.load({ provider });
const userWrapper = new UserWrapper(bmcGamesSDK, wallet.publickKey.toString()); // wallet.publickKey should be String

Claim user reward ticket - user Wallet

Amount depends on depositToken. User will receive with rewardToken. Signers will be user-wallet and bot-wallet. If smartContract returns InsufficientTokenAmount error, insufficient_withdrawal_pool = true and then send message to admin via slack bot channel. Check diagram.xlsx [checklist] No.4

  const tx = await userWrapper.claimUserReward({
    rewardAmount  // token amount; ex: 3.412
  });

Get users list - user wrapper

  let users = await userWrapper.getUsersInfo();

Get a user info - user wrapper

The unit of token amount in returned array is same with depositToken

  let user = await userWrapper.getUserInfo(
    userWalletStr // String
  );