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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kyriework/pzm-sdk

v0.1.10

Published

A Solana SDK for PZM game interactions

Downloads

12

Readme

@kyriework/pzm-sdk

安装

npm install @kyriework/pzm-sdk
# 或者
yarn add @kyriework/pzm-sdk
# 或者
pnpm add @kyriework/pzm-sdk

快速开始

import { PzmSdk } from '@kyriework/pzm-sdk';
import { Connection, PublicKey } from '@solana/web3.js';

// 初始化 SDK
const sdk = new PzmSdk({
  programId: new PublicKey('你的程序ID'),
  tokenMint: new PublicKey('代币铸造地址'),
  feesWallet: new PublicKey('费用钱包地址'),
  referrerWallet: new PublicKey('默认推荐人钱包地址'),
  rpcUrl: 'https://api.devnet.solana.com', // 或者其他 RPC 地址
});

// 使用示例
async function example() {
  try {
    // 购买初始农场
    const txHash = await sdk.purchaseInitialFarm('你的私钥');
    console.log('购买成功:', txHash);

    // 获取玩家数据
    const connection = new Connection('https://api.devnet.solana.com');
    const playerPublicKey = await sdk.getPlayerPublicKey('你的私钥');
    const playerData = await sdk.getPlayerData(connection, playerPublicKey);
    console.log('玩家数据:', playerData);
  } catch (error) {
    console.error('操作失败:', error);
  }
}

主要功能

游戏核心功能

  • purchaseInitialFarm(privateKey: string) - 购买初始农场
  • upgradeFarm(privateKey: string, farmType: number) - 升级农场

卡牌相关功能

  • stakeCard(privateKey: string, cardIndex: number) - 质押卡牌
  • unstakeCard(privateKey: string, cardIndex: number) - 取消质押卡牌
  • recycleCardsCommit(privateKey: string, cardIndices: number[]) - 回收卡牌(第一步)
  • recycleCardsSettle(privateKey: string) - 回收卡牌(第二步)

开包相关功能

  • openBoosterCommit(privateKey: string) - 开包(第一步)
  • settleOpenBooster(privateKey: string) - 开包(第二步)

奖励相关功能

  • claimRewards(privateKey: string) - 领取奖励

其他功能

  • cancelPendingAction(privateKey: string) - 取消待处理的操作
  • getPlayerData(connection: Connection, playerWallet: PublicKey) - 获取玩家数据
  • getGlobalStateData(connection: Connection) - 获取全局状态数据
  • getPlayerKeyPair(privateKey: string) - 从私钥获取密钥对

错误处理

SDK 使用自定义的 PzmError 类进行错误处理:

try {
  await sdk.purchaseInitialFarm(privateKey);
} catch (error) {
  if (error instanceof PzmError) {
    console.error(`操作失败: ${error.message} (${error.code})`);
  }
}

其他导出模块

PzmTypes

类型定义模块,包含了所有游戏相关的类型定义:

  • PzmConfig - SDK 配置类型
  • PzmError - 错误处理类
  • ErrorCode - 错误代码枚举
  • 各种账户数据结构类型定义

PzmPDA

PDA(Program Derived Address)相关工具模块:

  • findGlobalStatePDA - 查找全局状态账户地址
  • findPlayerPDA - 查找玩家账户地址

PzmInstruction

指令创建模块,包含所有游戏操作的指令创建方法:

  • 农场相关指令(购买、升级)
  • 卡牌相关指令(质押、取消质押、回收)
  • 开包相关指令
  • 奖励相关指令

PzmUtils

实用工具模块:

  • getAccountData - 获取账户数据
  • sendTxFromPrivateKey - 使用私钥发送交易

PzmBorsh

Borsh 序列化相关模块:

  • 提供了与 Borsh 序列化/反序列化相关的工具函数
  • 包含自定义的数据布局定义