@xgamesfun/solana 0.26.4 → 0.27.1
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 +9 -9
- package/js/client/compressed.js +12 -5
- package/js/client/idl/loot.js +1 -1
- package/js/client/idl/loot.json +53 -7
- package/js/client/ix.js +44 -9
- package/js/economy/check.mjs +2 -2
- package/js/economy/guide.mjs +1 -1
- package/js/mcp/tools.mjs +1 -0
- package/js/play/index.js +943 -283
- package/package.json +1 -1
- package/release.json +5 -5
- package/skills/xsolana-economy/SKILL.md +4 -4
- package/skills/xsolana-economy/references/apps.md +10 -0
- package/skills/xsolana-economy/references/trust-and-cheating.md +4 -3
- package/types/client/compressed.d.ts +5 -2
- package/types/client/ix.d.ts +38 -7
- package/types/play/index.d.ts +375 -141
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ codex plugin add xsolana@xgamesfun
|
|
|
64
64
|
|
|
65
65
|
**claude.ai, ChatGPT or Claude Desktop:** add `https://xgames.fun/mcp` as a custom connector. Nothing to install.
|
|
66
66
|
|
|
67
|
-
**Cursor, Cline, opencode or any MCP client:** run `npx -y --package=@xgamesfun/solana@0.
|
|
67
|
+
**Cursor, Cline, opencode or any MCP client:** run `npx -y --package=@xgamesfun/solana@0.27.1 xsolana mcp`.
|
|
68
68
|
|
|
69
69
|
**Any agent that reads skills** (Copilot, Gemini CLI, Windsurf…): `npx skills add XGamesFun/solana-kit`.
|
|
70
70
|
|
|
@@ -75,22 +75,22 @@ are in [docs/harnesses.md](docs/harnesses.md).
|
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
77
|
# find a worked example close to your idea
|
|
78
|
-
npx -y @xgamesfun/solana@0.
|
|
78
|
+
npx -y @xgamesfun/solana@0.27.1 examples shop with loot boxes
|
|
79
79
|
|
|
80
80
|
# using a coin you already launched? read it from the chain into its "tokens" entry
|
|
81
|
-
npx -y @xgamesfun/solana@0.
|
|
81
|
+
npx -y @xgamesfun/solana@0.27.1 token <its mint address>
|
|
82
82
|
|
|
83
83
|
# does it work? where does the money go? what does it cost?
|
|
84
|
-
npx -y @xgamesfun/solana@0.
|
|
85
|
-
npx -y @xgamesfun/solana@0.
|
|
86
|
-
npx -y @xgamesfun/solana@0.
|
|
84
|
+
npx -y @xgamesfun/solana@0.27.1 check xsolana.json
|
|
85
|
+
npx -y @xgamesfun/solana@0.27.1 simulate xsolana.json
|
|
86
|
+
npx -y @xgamesfun/solana@0.27.1 cost xsolana.json
|
|
87
87
|
|
|
88
88
|
# the whole economy in plain words, and what a cheater could get
|
|
89
|
-
npx -y @xgamesfun/solana@0.
|
|
90
|
-
npx -y @xgamesfun/solana@0.
|
|
89
|
+
npx -y @xgamesfun/solana@0.27.1 explain xsolana.json
|
|
90
|
+
npx -y @xgamesfun/solana@0.27.1 review xsolana.json
|
|
91
91
|
|
|
92
92
|
# go live, approved in your own wallet
|
|
93
|
-
npx -y @xgamesfun/solana@0.
|
|
93
|
+
npx -y @xgamesfun/solana@0.27.1 approve xsolana.json
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Each command names an exact version, so you always run the release you meant to. `xsolana help` lists them all.
|
package/js/client/compressed.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// indexer (DAS `getAsset` and `getAssetProof`). Browser-safe.
|
|
4
4
|
import { decodeBase58 } from '../chain/base58.js';
|
|
5
5
|
|
|
6
|
+
const NOBODY = '11111111111111111111111111111111';
|
|
6
7
|
/** mpl-account-compression's tree header: type, version, max buffer size (u32), max depth (u32), authority, slot, padding. */
|
|
7
8
|
const HEADER = 56;
|
|
8
9
|
|
|
@@ -25,23 +26,29 @@ const bytes = value =>
|
|
|
25
26
|
/**
|
|
26
27
|
* A compressed NFT from an indexer's answers: `asset` (DAS `getAsset`), `proof` (DAS `getAssetProof`) and the tree
|
|
27
28
|
* account's bytes (`treeData`, for how much of the proof to pass). Returns { id, tree, nonce, owner, delegate,
|
|
28
|
-
* collection (or null), dataHash, creatorHash, assetDataHash (or null), flags, root, proof: [node, …] }. The
|
|
29
|
-
* must be against the tree's current root when it lands: fetch it just before sending.
|
|
29
|
+
* collection (or null), dataHash, creatorHash, assetDataHash (or null), flags, root, proof: [node, …], burnt }. The
|
|
30
|
+
* proof must be against the tree's current root when it lands: fetch it just before sending. A burned NFT (DAS says
|
|
31
|
+
* `burnt`) is described as the program takes one: a data hash of all zeros, which `proveLeafIx` then proves against
|
|
32
|
+
* the leaf's empty slot, so its record names no owner (a record that holds it lets go of it on that proof).
|
|
30
33
|
*/
|
|
31
34
|
export function compressedFromDas({ asset, proof, treeData }) {
|
|
32
35
|
const c = asset.compression;
|
|
36
|
+
const burnt = asset.burnt === true || c.burnt === true;
|
|
37
|
+
// A burned leaf names nobody: any address stands in for an owner an indexer no longer gives.
|
|
38
|
+
const owner = asset.ownership?.owner || (burnt ? NOBODY : asset.ownership.owner);
|
|
33
39
|
return {
|
|
34
40
|
id: asset.id,
|
|
35
41
|
tree: c.tree,
|
|
36
42
|
nonce: BigInt(c.leaf_id),
|
|
37
|
-
owner
|
|
38
|
-
delegate: asset.ownership
|
|
43
|
+
owner,
|
|
44
|
+
delegate: asset.ownership?.delegate ?? owner,
|
|
39
45
|
collection: asset.grouping?.find(g => g.group_key === 'collection')?.group_value ?? null,
|
|
40
|
-
dataHash: bytes(c.data_hash),
|
|
46
|
+
dataHash: burnt ? new Uint8Array(32) : bytes(c.data_hash),
|
|
41
47
|
creatorHash: bytes(c.creator_hash),
|
|
42
48
|
assetDataHash: bytes(c.asset_data_hash ?? null),
|
|
43
49
|
flags: Number(c.flags ?? 0),
|
|
44
50
|
root: bytes(proof.root),
|
|
45
51
|
proof: proof.proof.slice(0, proofLength(treeData)),
|
|
52
|
+
burnt,
|
|
46
53
|
};
|
|
47
54
|
}
|