xsolana

io.github.XGamesFun由 GitHub 账号 XGamesFun 发布v0.20.1更新于 Oct 30, 2026

Design, check, simulate and launch Solana game economies on loot, one shared program, no contract.

概览

AI 生成的概览

基于共享 loot 程序,用 JSON 规格而非自写智能合约来设计、校验、模拟并准备上线 Solana 游戏经济系统。

可以做什么
  • 阅读指南并查找商店、盲盒、抽奖、拍卖、质押农场、合成等经济系统的现成范例
  • 校验经济规格中的拒绝项与警告,并模拟预期回报、庄家优势与资金池收支
  • 估算上线成本与每个操作的成本,并用通俗语言解释该经济系统
  • 将校验通过的规格保存到项目中,并准备由所有者在自己钱包中批准的上线步骤
  • 读取已上线经济系统的链上状态,并说明应用如何用玩家钱包调用它
适用场景
适合在有人想搭建或审查 Solana 游戏或社区经济系统(盲盒、抽奖、拍卖、质押农场、合成等),并希望在上链前完成校验与模拟时使用。也适合解释现有经济系统或把游戏客户端接入其中。
运行要求
通过 npm 包 @xgamesfun/solana 以 stdio 在本地运行,需要 Node.js 22 或更高版本。未声明账号、密钥或 API key。可选环境变量:XSOLANA_RPC_URL(approve 与 status 使用的 devnet RPC),以及 XSOLANA_NO_OPEN、XSOLANA_DEBUG。上线需要所有者在本地批准页面连接 devnet 钱包。
安装前请注意
仅限 devnet,且该程序未经独立审计。发布步骤会准备真实交易,须由所有者在自己钱包中批准;助手不会签名也不会索要密钥,规格中不得包含密钥。模拟与成本数字只是估算而非保证,README 声明不提供担保,也不构成法律或财务建议。

安装

在 SourceWeft 中

  1. 打开 控制台中的 xsolana,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

solana-kit

The tools for loot, one shared Solana program for game and community economies. This repository is the npm package @xgamesfun/solana:

  • a JavaScript client with no Solana SDK (@xgamesfun/solana/client), a player module for apps (/play) and a results client (/results);
  • the economy spec and its checker, quick simulation, cost and plain-words explainer;
  • the xsolana CLI and an MCP server with ten xsolana_* tools;
  • the xsolana-economy skill, and one plugin that carries the tools and the skill to Claude Code and Codex;
  • a local approval page where a project's owner approves going live in their own wallet.

An economy is a JSON spec, not a new smart contract. Every project shares the one program, and none writes its own.

Status: loot 0.22.0, program ID 9cwqM1TXytPnFZsLfmUyv2dg4uW6Ch9C6UJVPns7NFQ, devnet only. The program is not independently audited, and nothing runs on mainnet until it is. See SECURITY.md.

Disclaimer: provided as is, with no warranty and no guarantee that the program or the tools are safe. Use them at your own risk; you are responsible for every transaction you approve and for making sure what you build is legal where it runs. Nothing here is legal or financial advice. Read DISCLAIMER.md before you use it.

What an economy can be made of

  • payments and splits, in tokens or with an NFT
  • shops (a purchase in one transaction) and loot boxes
  • pools and timed schedules, sealed or not
  • lotteries and raffles, including no-loss lotteries
  • prizes of any kind on every route, random or not: items, tokens, and NFTs the project holds in a stash
  • an NFT as the price on every route that takes money
  • staking farms with lock tiers, boosts, early exits and tolls
  • crafting recipes
  • holds and contests, with prizes by rank or by stake
  • auctions: the highest bid wins, the outbid refunded at once
  • listings for sale or rent, and bids and loans between players
  • perks, staking and holds for any NFT, whether the project has authority over it or not
  • allowlists of any size (a Merkle list) on every gated route
  • capped rewards and grants that a server vouches for
  • rules on what a collectible says

Every move leaves a public receipt. docs/program.md describes how the program behaves.

Use it from an AI coding agent

The MCP server and the skill let Claude Code, Codex or any MCP agent turn a one-line idea into a checked, simulated economy and hand you the command that puts it live in your own wallet.

Claude Code

/plugin marketplace add XGamesFun/solana-kit/plugin install xsolana@xgamesfun

Codex

codex plugin marketplace add XGamesFun/solana-kitcodex plugin add xsolana@xgamesfun

Any agent with MCP (Cursor, opencode, Cline…): run the server with npx -y --package=@xgamesfun/[email protected] xsolana mcp. Or let npx -y @xgamesfun/[email protected] connect register it, with the skill, for Claude Code and Codex.

Then ask for an economy, for example "a fishing game where each cast costs 0.02 SOL, with a rare golden fish and a monthly draw".

Going live is always yours: npx -y @xgamesfun/[email protected] approve opens a page on your computer where you connect a devnet wallet and approve each transaction. The agent never signs and never asks for a key.

Use it from a terminal

Every tool runs from the CLI too, on a spec file (xsolana.json by default):

bash
npx -y @xgamesfun/[email protected] examples shop with loot boxes   # the nearest worked examplesnpx -y @xgamesfun/[email protected] check xsolana.json                 # refusals and warningsnpx -y @xgamesfun/[email protected] simulate xsolana.json              # where the money goes, day by daynpx -y @xgamesfun/[email protected] cost xsolana.json                  # what going live and each action costnpx -y @xgamesfun/[email protected] explain xsolana.json               # the economy in plain wordsnpx -y @xgamesfun/[email protected] approve xsolana.json               # go live, approved in your own wallet

xsolana help lists every command. Every command names the exact version, so npx runs that release and never whatever is newest under the name.

Use it from code

bash
npm install @xgamesfun/solana
js
import * as loot from '@xgamesfun/solana/client';const ix = loot.openBoxIx({ player, project, box, nonce }); // one builder per instruction, no Solana SDK
ImportWhat
@xgamesfun/solanathe economy tools: check, simulate, plan, cost, explainEconomy, model
@xgamesfun/solana/clientevery PDA, one builder per instruction, account and receipt decoders, grant vouchers
@xgamesfun/solana/playsolanaApp: what a player does with a live economy, from a browser app
@xgamesfun/solana/resultsresults and vouchers a game's server signs
@xgamesfun/solana/chain/*browser-safe Solana primitives: base58, Borsh, transactions, PDAs, tokens, Core
@xgamesfun/solana/idl.jsonthe program's IDL, the authority for account and argument layouts
@xgamesfun/solana/release.jsonthe program build, IDL and client this release is pinned to

The client, chain and play modules run in browsers and Node 22 or later, with no bundler required. The package ships TypeScript declarations for every entry point.

Documentation

docs/program.mdthe program: who signs, accounts, every instruction, fees, limits, receipts, costs
docs/nfts.mdNFTs and tokens, with and without the project's authority
docs/harnesses.mdhow the plugin reaches Claude Code and Codex, and the release checklist
skills/xsolana-economythe skill an agent follows
examples/whole economies that check and go live in the tests; ideas.json, 112 real economies rated
evals/fresh-session evals of agents building on loot
CHANGELOG.md, SECURITY.mdversions, the trust model, reporting a vulnerability

Layout

PathWhat
js/chain/browser-safe Solana primitives, no SDK
js/client/the client; idl/ is the program's IDL
js/economy/the economy spec (version 2, schema.json), checker, simulation, setup plan, cost, explainer, guide
js/play/, js/results/a player's side of a live economy; results a server vouches for
js/approve/, js/mcp/, js/connect/the approval page, the MCP server and its tools, xsolana connect
js/sim/, js/test/LiteSVM running the real program; the tests and their pinned fixtures
bin/xsolana.mjsthe CLI
skills/, plugin/the skill (copied to plugin/skills, .claude/skills, .agents/skills) and the plugin
scripts/fixtures, skill sync, IDL sync, release manifest, a devnet end-to-end run
release.jsonthe program binary, IDL and client hashes this version is pinned to

Development

Node 22 or later.

bash
npm cinpm run fixtures   # downloads the loot program from devnet and the programs it calls from mainnet, each checked by hashnpm test           # every instruction the client builds, and every example's whole setup, against the real program in LiteSVMnpm run lint       # ESLintnpm run check      # fixtures, skill copies and release.json in step, lint, then the tests

Nothing in the tests deploys or spends SOL.

VariableWhat it does
XSOLANA_RPC_URLa devnet RPC of your own for xsolana approve and xsolana status (a mainnet URL is refused)
XSOLANA_NO_OPENxsolana approve prints its link without opening a browser
XSOLANA_DEBUGthe CLI prints a failure's whole stack, not one line
XSOLANA_PROGRAM_DIRthe tests run that program build's target/deploy/loot.so, and check the IDL against it
node bin/xsolana.mjs connect --local registers this checkout's MCP server and the skill with Claude Code and Codex
(--remove takes them out again).

After editing skills/, run npm run sync-skills. Changes to tool texts, the skill or the plugin are best measured with the evals before and after (evals/README.md). AGENTS.md has the rules for working in this repository, for people and coding agents alike.

Contributing

Issues and pull requests are welcome: see CONTRIBUTING.md. Please run npm run check before sending a change, and report a vulnerability privately as SECURITY.md describes.

License

Apache-2.0. See NOTICE and DISCLAIMER.md: provided as is, without warranty, at your own risk.

来源:README.md,提交 30826a2

工具

10

xsolana_guide

Read this first whenever someone wants a web3 economy, game economy, token economy, NFT mechanic or onchain reward system: a shop, loot boxes or packs, gacha, a lottery or raffle, an auction (highest bid wins, the outbid refunded at once), staking or a farm, crafting or merging, seasons and emissions, a prediction pool or contest, quests and airdrops, holder-gated drops, using NFTs of any other collection in a game. loot is ONE shared Solana program (devnet until it is audited): the economy is a JSON spec, not a new smart contract, so never write Anchor/Rust for what it covers. Returns every part an economy can have (fields from the schema, who acts at play time, fees), how to write a spec, and what loot cannot do (with the nearest alternative). Pass `part` for one part with its nested shapes.

输入参数part

xsolana_examples

Find an economy to start from. With `query` (the person’s own words, as they said them), returns the closest worked examples (whole specs that check and go live in the tests), the closest of 112 real or trending economies rated against loot (great / some / a-lot / cannot, with what carries it or what is missing), and what loot can’t do exactly in the ask, each with the nearest versions it can. Call it again with the words of any part that looks impossible: the answer is a nearest version to offer, not a dead end. With `name`, returns that example’s whole spec to copy and change. With neither, lists every example.

输入参数fitnamelimitquery

xsolana_check

Check an economy spec: refusals (each with a code, what it means and its fix) stop it from going live; warnings are what the person must hear (chance that pays money, revenue paid to stakers, an unfunded prize, a grant without limits, a mint’s powers). Run it after every change. Give the spec inline (`spec`), a file, or an example.

输入参数filespecexample

xsolana_simulate

The quick simulation (expected values from the spec, instant): what each box, ticket and craft gives back against its price, the house edge, each pool’s money in and out per day and whether it runs dry, settles or grows, farm rewards per unit staked, what players, the treasury and the platform get each day. `scenario` overrides the spec’s own ({"perDay": {"box:flip": 1000}, "days": 30, "staked": {"<farm>": 1000}}). Quote its numbers; never your own arithmetic.

输入参数filejsonspecexamplescenario

xsolana_cost

What going live costs (each account’s rent, the program’s fees, network fees, the seeds, the transactions and wallet approvals it takes) and what each action costs whoever signs it while it runs.

输入参数filespecexample

xsolana_explain

The economy in plain words for the person: what players do and what it costs and is worth, how the pools fill and drain, what runs by itself, what the authority must sign, what going live costs, and what is flagged for the law. Tell them the essentials in a few lines, from this text.

输入参数filespecexample

xsolana_save

Save a spec into the project (default xsolana.json), only if it checks. A file that is already live keeps its program numbers and its live section. Never put a key in it: the checker refuses one.

输入参数filespec必填

xsolana_publish

When the person says to put it live: returns what going live does (every step, in order, and its cost) and the one command they run themselves to approve it in their own wallet (`npx -y @xgamesfun/[email protected] approve`, pinned to this exact version: give it as it is): it opens a local page where they connect a devnet wallet and approve each transaction. You never sign, never ask for a key, and never run the approval for them.

输入参数filespecexample

xsolana_status

A live economy as it is on chain: the project, every pool’s balance, every record the spec names (found or missing). Reads devnet (or XSOLANA_RPC_URL).

输入参数file

xsolana_client

How an app (a game, a site, a bot) uses a live economy: the program’s address and cluster, the npm package and IDL, and the calls a page makes with the player’s own wallet (open a box, buy, stake, craft, enter, claim). Use this instead of writing chain code from memory.

无需输入参数。

版本历史

1
  1. v0.20.1最新Oct 30, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分