@xgamesfun/solana 0.28.3 → 0.28.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/js/client/accounts.js +6 -0
- package/js/play/index.js +10 -2
- package/package.json +5 -1
- package/release.json +1 -1
- package/skills/xsolana-economy/SKILL.md +5 -5
- package/types/approve/wallet-adds.d.mts +15 -0
- package/types/client/accounts.d.ts +5 -0
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ codex plugin add xsolana@xgamesfun
|
|
|
77
77
|
|
|
78
78
|
**claude.ai, ChatGPT or Claude Desktop:** add `https://xgames.fun/mcp` as a custom connector. Nothing to install.
|
|
79
79
|
|
|
80
|
-
**Cursor, Cline, opencode or any MCP client:** run `npx -y --package=@xgamesfun/solana@0.28.
|
|
80
|
+
**Cursor, Cline, opencode or any MCP client:** run `npx -y --package=@xgamesfun/solana@0.28.5 xsolana mcp`.
|
|
81
81
|
|
|
82
82
|
**Any agent that reads skills** (Copilot, Gemini CLI, Windsurf…): `npx skills add XGamesFun/solana-kit`.
|
|
83
83
|
|
|
@@ -88,26 +88,26 @@ are in [docs/harnesses.md](docs/harnesses.md).
|
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
90
|
# find a worked example close to your idea
|
|
91
|
-
npx -y @xgamesfun/solana@0.28.
|
|
91
|
+
npx -y @xgamesfun/solana@0.28.5 examples shop with loot boxes
|
|
92
92
|
|
|
93
93
|
# using a coin you already launched? read it from the chain into its "tokens" entry
|
|
94
|
-
npx -y @xgamesfun/solana@0.28.
|
|
94
|
+
npx -y @xgamesfun/solana@0.28.5 token <its mint address>
|
|
95
95
|
|
|
96
96
|
# does it work? where does the money go? what does it cost?
|
|
97
|
-
npx -y @xgamesfun/solana@0.28.
|
|
98
|
-
npx -y @xgamesfun/solana@0.28.
|
|
99
|
-
npx -y @xgamesfun/solana@0.28.
|
|
97
|
+
npx -y @xgamesfun/solana@0.28.5 check xsolana.json
|
|
98
|
+
npx -y @xgamesfun/solana@0.28.5 simulate xsolana.json
|
|
99
|
+
npx -y @xgamesfun/solana@0.28.5 cost xsolana.json
|
|
100
100
|
|
|
101
101
|
# the whole economy in plain words, and what a cheater could get
|
|
102
|
-
npx -y @xgamesfun/solana@0.28.
|
|
103
|
-
npx -y @xgamesfun/solana@0.28.
|
|
102
|
+
npx -y @xgamesfun/solana@0.28.5 explain xsolana.json
|
|
103
|
+
npx -y @xgamesfun/solana@0.28.5 review xsolana.json
|
|
104
104
|
|
|
105
105
|
# go live: a key file for the project (it prints the address to send SOL to, never the key)…
|
|
106
|
-
npx -y @xgamesfun/solana@0.28.
|
|
106
|
+
npx -y @xgamesfun/solana@0.28.5 keygen ~/.config/xsolana/my-game.json
|
|
107
107
|
# …then everything going live would send, and a code; nothing is sent
|
|
108
|
-
npx -y @xgamesfun/solana@0.28.
|
|
108
|
+
npx -y @xgamesfun/solana@0.28.5 approve xsolana.json --keypair ~/.config/xsolana/my-game.json
|
|
109
109
|
# …and with that code, exactly what it listed is sent
|
|
110
|
-
npx -y @xgamesfun/solana@0.28.
|
|
110
|
+
npx -y @xgamesfun/solana@0.28.5 approve xsolana.json --keypair ~/.config/xsolana/my-game.json --yes <code>
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
Each command names an exact version, so you always run the release you meant to. `xsolana help` lists them all.
|
package/js/client/accounts.js
CHANGED
|
@@ -406,6 +406,12 @@ export function decodeStash(data) {
|
|
|
406
406
|
* collection (or null), flags, nonce, root (hex: the tree's root it holds for), payer }. Routes read it only while the
|
|
407
407
|
* tree's root is still `root`; after that anyone may close it (`closeLeafIx`).
|
|
408
408
|
*/
|
|
409
|
+
/**
|
|
410
|
+
* Where a Proven record's payer is: after the tag, eight 32-byte fields, the asset data hash's flag (and its 32 bytes
|
|
411
|
+
* when it has one), the flags and the nonce. Without an asset data hash, then with one.
|
|
412
|
+
*/
|
|
413
|
+
export const PROVEN_PAYER_AT = Object.freeze([1 + 32 * 8 + 1 + 1 + 8, 1 + 32 * 8 + 33 + 1 + 8]);
|
|
414
|
+
|
|
409
415
|
export function decodeProven(data) {
|
|
410
416
|
// Its shortest: the tag, five addresses, the root, data hash and creator hash, no asset data hash, the flags and
|
|
411
417
|
// nonce, and its payer.
|
package/js/play/index.js
CHANGED
|
@@ -5166,8 +5166,16 @@ export function solanaApp({
|
|
|
5166
5166
|
else if (hold.debt?.lender === me && time >= BigInt(hold.free_at))
|
|
5167
5167
|
out.push({ ...claim, says: 'A loan you made is overdue and unpaid: take its NFT.' });
|
|
5168
5168
|
}
|
|
5169
|
-
// A compressed NFT's proof record this wallet paid for and left open: closing it brings its rent back.
|
|
5170
|
-
|
|
5169
|
+
// A compressed NFT's proof record this wallet paid for and left open: closing it brings its rent back. Found by its
|
|
5170
|
+
// payer, which sits at one of two places (without an asset data hash, and with one: `loot.PROVEN_PAYER_AT`): a
|
|
5171
|
+
// scan of every proof record of the program is refused by the play host's relay, and by any RPC that bounds what
|
|
5172
|
+
// a scan may ask. These records only give rent back, so a scan that is refused leaves them out and lists the rest.
|
|
5173
|
+
const proven = new Map();
|
|
5174
|
+
for (const offset of loot.PROVEN_PAYER_AT) {
|
|
5175
|
+
const found = await client.programAccounts(loot.lootProgram(), [tag('Proven'), at(offset, me)]).catch(() => []);
|
|
5176
|
+
for (const x of found) proven.set(x.pubkey, x);
|
|
5177
|
+
}
|
|
5178
|
+
for (const { account } of proven.values()) {
|
|
5171
5179
|
const leaf = (() => {
|
|
5172
5180
|
try {
|
|
5173
5181
|
return loot.decodeProven(account.data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xgamesfun/solana",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.5",
|
|
4
4
|
"mcpName": "io.github.XGamesFun/solana-kit",
|
|
5
5
|
"description": "Loot boxes, gacha, shops, lotteries, auctions, NFT staking, crafting and rewards on Solana without writing a smart contract: one shared program, its JS client, a CLI, and an MCP server and skill so Claude Code, Codex or any AI agent can design, check, simulate and launch an economy.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
"types": "./types/approve/keyfile.d.mts",
|
|
75
75
|
"default": "./js/approve/keyfile.mjs"
|
|
76
76
|
},
|
|
77
|
+
"./wallet-adds": {
|
|
78
|
+
"types": "./types/approve/wallet-adds.d.mts",
|
|
79
|
+
"default": "./js/approve/wallet-adds.mjs"
|
|
80
|
+
},
|
|
77
81
|
"./idl.json": "./js/client/idl/loot.json",
|
|
78
82
|
"./package.json": "./package.json",
|
|
79
83
|
"./release.json": "./release.json",
|
package/release.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sbfBytes": 1794616,
|
|
5
5
|
"sbfSha256": "ac8b09ed2c3a3f7daa2dfab55d2f6dea19fa43e4c98b44a82da2a68a7bc8ebbe",
|
|
6
6
|
"idlSha256": "ef3b8043d62c606e850df75773b4535cdb08206216e17aca653111a77403abd7",
|
|
7
|
-
"clientSha256": "
|
|
7
|
+
"clientSha256": "c8068236d278f2d164a95ad1d70a44d5763e08e77355c4fa3fbda0d336b5947e",
|
|
8
8
|
"mainnet": {
|
|
9
9
|
"programId": "xgames8C758PyweWB9sDw8evvwsTVwyA2fGRUeAXVPy",
|
|
10
10
|
"sbfBytes": 1794616,
|
|
@@ -11,9 +11,9 @@ signed by a key file on the owner's own machine, once they have read what will b
|
|
|
11
11
|
**devnet**, where nothing is real money, and on **mainnet**, where everything is: an economy is on devnet unless its
|
|
12
12
|
file says `"network": "mainnet"`.
|
|
13
13
|
|
|
14
|
-
The tools are the `xsolana_*` MCP tools. Without MCP, the same from a terminal: `npx -y @xgamesfun/solana@0.28.
|
|
15
|
-
`npx -y @xgamesfun/solana@0.28.
|
|
16
|
-
or `npx -y @xgamesfun/solana@0.28.
|
|
14
|
+
The tools are the `xsolana_*` MCP tools. Without MCP, the same from a terminal: `npx -y @xgamesfun/solana@0.28.5 <guide|examples|check|simulate|cost|explain|review|publish|status> [xsolana.json]`,
|
|
15
|
+
`npx -y @xgamesfun/solana@0.28.5 token <mint>` for a coin made elsewhere,
|
|
16
|
+
or `npx -y @xgamesfun/solana@0.28.5 tool <name> '<json>'` for any tool (always with the exact version).
|
|
17
17
|
|
|
18
18
|
## Rules (always)
|
|
19
19
|
|
|
@@ -141,7 +141,7 @@ or `npx -y @xgamesfun/solana@0.28.3 tool <name> '<json>'` for any tool (always w
|
|
|
141
141
|
9. **When they say "put it live"**: `xsolana_publish` lists every step and its cost and gives the commands, which you
|
|
142
142
|
run in the project folder exactly as given (they name the exact version; never drop it):
|
|
143
143
|
- **A new economy gets a key file**, unless the project has one:
|
|
144
|
-
`npx -y @xgamesfun/solana@0.28.
|
|
144
|
+
`npx -y @xgamesfun/solana@0.28.5 keygen ~/.config/xsolana/<name>.json`. Give the person the address it prints. A
|
|
145
145
|
Solana key file they already have and name themselves (`~/.config/solana/id.json`) works the same; never go
|
|
146
146
|
looking for one.
|
|
147
147
|
- **Say what the key file is** before anything is sent: the project's owner, and, unless the spec says otherwise,
|
|
@@ -156,7 +156,7 @@ or `npx -y @xgamesfun/solana@0.28.3 tool <name> '<json>'` for any tool (always w
|
|
|
156
156
|
devnet SOL for an economy on devnet, real SOL for one on mainnet), any seed in a coin that already exists, and every NFT a stash, a raffle or an auction names. A
|
|
157
157
|
collection they already have needs the key's address as its update authority. If they would rather not move
|
|
158
158
|
those, offer the browser wallet.
|
|
159
|
-
- **Show it**: `npx -y @xgamesfun/solana@0.28.
|
|
159
|
+
- **Show it**: `npx -y @xgamesfun/solana@0.28.5 approve xsolana.json --keypair <key file>` prints every step with
|
|
160
160
|
what it pays and trusts, the warnings, the notice and a code, and sends nothing. Give the person that printout as
|
|
161
161
|
it is, not a summary of it, and ask.
|
|
162
162
|
- **On their yes**, the same command with `--yes <code>`. What lands is written back into `xsolana.json`. If it
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `theirs`, the message a wallet signed, is `ours`, the message prepared for it, with nothing but a wallet's
|
|
3
|
+
* own additions. `wallet`: the address the transaction was prepared for.
|
|
4
|
+
* → { ok: true, added: [what it added, in words] } or { ok: false, why: what it did, in words after "it …" }.
|
|
5
|
+
* Two messages that are the same bytes are not this function's to judge (nothing was added).
|
|
6
|
+
*/
|
|
7
|
+
export declare function walletAdded(ours: any, theirs: any, wallet: any): {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
added: any[];
|
|
10
|
+
why?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
added?: undefined;
|
|
13
|
+
ok: boolean;
|
|
14
|
+
why: string;
|
|
15
|
+
};
|
|
@@ -161,6 +161,11 @@ export declare function decodeStash(data: any): {
|
|
|
161
161
|
* collection (or null), flags, nonce, root (hex: the tree's root it holds for), payer }. Routes read it only while the
|
|
162
162
|
* tree's root is still `root`; after that anyone may close it (`closeLeafIx`).
|
|
163
163
|
*/
|
|
164
|
+
/**
|
|
165
|
+
* Where a Proven record's payer is: after the tag, eight 32-byte fields, the asset data hash's flag (and its 32 bytes
|
|
166
|
+
* when it has one), the flags and the nonce. Without an asset data hash, then with one.
|
|
167
|
+
*/
|
|
168
|
+
export declare const PROVEN_PAYER_AT: readonly number[];
|
|
164
169
|
export declare function decodeProven(data: any): {
|
|
165
170
|
asset: string;
|
|
166
171
|
tree: string;
|