@xgamesfun/solana 0.24.0 → 0.25.0
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 +94 -51
- package/bin/xsolana.mjs +23 -8
- package/examples/blind-forge.json +2 -4
- package/examples/coin-flip-arena.json +2 -5
- package/examples/duel-arena.json +1 -4
- package/examples/fair-presale.json +1 -3
- package/examples/hero-trials.json +14 -2
- package/examples/holder-den.json +38 -0
- package/examples/holders-drop.json +105 -0
- package/examples/ideas.json +788 -788
- package/examples/match-predictions.json +24 -0
- package/examples/nft-raffle.json +1 -0
- package/examples/pack-league.json +108 -0
- package/examples/partner-vault.json +19 -3
- package/examples/sacrifice-raffle.json +2 -10
- package/examples/shelter-fair.json +1 -0
- package/examples/stakers-draw.json +3 -7
- package/examples/stride-sneakers.json +164 -0
- package/examples/trade-in-shop.json +2 -3
- package/js/approve/details.mjs +117 -48
- package/js/approve/ed25519.mjs +5 -1
- package/js/approve/live-check.mjs +83 -26
- package/js/approve/page.html +217 -78
- package/js/approve/page.js +43 -15
- package/js/approve/server.mjs +276 -74
- package/js/chain/base58.js +7 -1
- package/js/chain/borsh.js +15 -11
- package/js/chain/bytes.js +11 -8
- package/js/chain/core.js +21 -5
- package/js/chain/curve.js +1 -1
- package/js/chain/lookup.js +118 -36
- package/js/chain/mint.js +6 -2
- package/js/chain/pda.js +2 -2
- package/js/chain/programs.js +6 -6
- package/js/chain/rpc.js +40 -14
- package/js/chain/token.js +13 -2
- package/js/chain/token2022.js +55 -16
- package/js/chain/tx.js +32 -22
- package/js/client/accounts.js +270 -80
- package/js/client/compressed.js +4 -3
- package/js/client/grant.js +165 -40
- package/js/client/idl/loot.js +1 -1
- package/js/client/idl/loot.json +104 -16
- package/js/client/ix.js +2121 -457
- package/js/client/pda.js +20 -18
- package/js/client/policy.js +12 -5
- package/js/client/random.js +1 -1
- package/js/client/sizes.js +220 -65
- package/js/client/traits.js +14 -5
- package/js/connect/connect.mjs +59 -17
- package/js/economy/check.mjs +3873 -690
- package/js/economy/cost.mjs +380 -56
- package/js/economy/examples.mjs +176 -35
- package/js/economy/explain.mjs +461 -110
- package/js/economy/guide.mjs +282 -59
- package/js/economy/legal.mjs +12 -6
- package/js/economy/live.mjs +60 -19
- package/js/economy/model.mjs +320 -97
- package/js/economy/plan.mjs +1022 -203
- package/js/economy/schema.json +127 -369
- package/js/economy/secrets.mjs +17 -7
- package/js/economy/simulate.mjs +771 -178
- package/js/economy/txsize.mjs +15 -3
- package/js/economy/validate.mjs +61 -24
- package/js/mcp/server.mjs +42 -14
- package/js/mcp/tools.mjs +293 -80
- package/js/play/index.js +1960 -461
- package/js/play/keys.js +35 -9
- package/js/results/index.js +223 -30
- package/js/results/server.js +230 -0
- package/js/results/wire.js +64 -16
- package/package.json +6 -4
- package/release.json +5 -5
- package/skills/xsolana-economy/SKILL.md +30 -16
- package/skills/xsolana-economy/references/after-launch.md +30 -20
- package/skills/xsolana-economy/references/apps.md +47 -36
- package/skills/xsolana-economy/references/sentence-to-spec.md +148 -129
- package/skills/xsolana-economy/references/telling-the-person.md +9 -6
- package/types/chain/core.d.ts +1 -1
- package/types/chain/lookup.d.ts +1 -1
- package/types/client/accounts.d.ts +24 -3
- package/types/client/grant.d.ts +2 -2
- package/types/client/idl/loot.d.ts +22 -0
- package/types/client/ix.d.ts +54 -45
- package/types/client/pda.d.ts +3 -1
- package/types/economy/guide.d.mts +5 -0
- package/types/economy/model.d.mts +48 -3
- package/types/economy/plan.d.mts +44 -2
- package/types/play/index.d.ts +8 -19
- package/types/results/index.d.ts +7 -6
- package/types/results/server.d.ts +126 -0
- package/types/results/wire.d.ts +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"network": "devnet",
|
|
4
|
+
"name": "Match Predictions",
|
|
5
|
+
"prompt": "A prediction pool for each match: back home, draw or away with any amount of SOL. Entries close two days after it opens, and the result is due a day later or everyone gets their money back. Winners share the pot by stake, after a 5% rake to the treasury. Our results server signs the result.",
|
|
6
|
+
"currency": "sol",
|
|
7
|
+
"tokens": [{ "key": "sol", "source": "sol" }],
|
|
8
|
+
"collection": false,
|
|
9
|
+
"contests": [
|
|
10
|
+
{
|
|
11
|
+
"key": "match",
|
|
12
|
+
"name": "Match pool",
|
|
13
|
+
"sides": 3,
|
|
14
|
+
"sideNames": ["Home", "Draw", "Away"],
|
|
15
|
+
"entriesClose": "2d",
|
|
16
|
+
"resultDue": "3d",
|
|
17
|
+
"every": "1d",
|
|
18
|
+
"split": [{ "to": "treasury", "percent": 5 }],
|
|
19
|
+
"decidedBy": "the results server, from the match's final score",
|
|
20
|
+
"deciders": ["GnUcZZf8bwSCj8CFkdVPeeu81ptCV4RxQvExdKjvStyd"]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"scenario": { "days": 30, "perDay": { "contest:match": 150 } }
|
|
24
|
+
}
|
package/examples/nft-raffle.json
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"network": "devnet",
|
|
4
|
+
"name": "Pack League",
|
|
5
|
+
"prompt": "A trading card game. A pack is 0.05 SOL for five cards, and the fifth card is always rare or better. A fifth of every pack goes into the weekly league pot. Card holders buy league tickets for 0.001 SOL, and each week the top three share the pot.",
|
|
6
|
+
"currency": "sol",
|
|
7
|
+
"tokens": [
|
|
8
|
+
{
|
|
9
|
+
"key": "sol",
|
|
10
|
+
"source": "sol"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"collection": {
|
|
14
|
+
"name": "Pack League"
|
|
15
|
+
},
|
|
16
|
+
"items": [
|
|
17
|
+
{
|
|
18
|
+
"key": "common",
|
|
19
|
+
"name": "Common Card",
|
|
20
|
+
"rarity": "Common"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"key": "rare",
|
|
24
|
+
"name": "Rare Card",
|
|
25
|
+
"rarity": "Rare"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"key": "epic",
|
|
29
|
+
"name": "Epic Card",
|
|
30
|
+
"rarity": "Epic",
|
|
31
|
+
"supply": 3000
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "legendary",
|
|
35
|
+
"name": "Legendary Card",
|
|
36
|
+
"rarity": "Legendary",
|
|
37
|
+
"supply": 300
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"boxes": [
|
|
41
|
+
{
|
|
42
|
+
"key": "pack",
|
|
43
|
+
"name": "Card Pack",
|
|
44
|
+
"price": 0.05,
|
|
45
|
+
"split": [
|
|
46
|
+
{
|
|
47
|
+
"to": "lottery:league",
|
|
48
|
+
"percent": 20
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"outcomes": [
|
|
52
|
+
{
|
|
53
|
+
"gives": "item",
|
|
54
|
+
"item": "common",
|
|
55
|
+
"chance": 75
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"gives": "item",
|
|
59
|
+
"item": "rare",
|
|
60
|
+
"chance": 19
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"gives": "item",
|
|
64
|
+
"item": "epic",
|
|
65
|
+
"chance": 5
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"gives": "item",
|
|
69
|
+
"item": "legendary",
|
|
70
|
+
"chance": 1
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"slots": [
|
|
74
|
+
{
|
|
75
|
+
"count": 4,
|
|
76
|
+
"share": 70
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"count": 1,
|
|
80
|
+
"from": [1, 2, 3],
|
|
81
|
+
"share": 30
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"lotteries": [
|
|
87
|
+
{
|
|
88
|
+
"key": "league",
|
|
89
|
+
"name": "Weekly League",
|
|
90
|
+
"price": 0.001,
|
|
91
|
+
"places": [50, 30, 20],
|
|
92
|
+
"every": "7d",
|
|
93
|
+
"firstDraw": "publish+7d",
|
|
94
|
+
"gate": {
|
|
95
|
+
"item": "common"
|
|
96
|
+
},
|
|
97
|
+
"perWallet": 100,
|
|
98
|
+
"pot": 0
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"scenario": {
|
|
102
|
+
"days": 28,
|
|
103
|
+
"perDay": {
|
|
104
|
+
"box:pack": 100,
|
|
105
|
+
"lottery:league": 200
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -18,7 +18,11 @@
|
|
|
18
18
|
"key": "vault",
|
|
19
19
|
"name": "Partner vault",
|
|
20
20
|
"collection": "5q8LtcGwYhYRq5M8dQ79wkeLvo8N993a7aoE6DLDBXaw",
|
|
21
|
-
"nfts": [
|
|
21
|
+
"nfts": [
|
|
22
|
+
"4vd1uA3jK28MwhufZnbtQpyJkVMXEVpKHzDRPUH9DT3v",
|
|
23
|
+
"E53iEjsuDnz1jP6MJbnhecvTBRWCs5MsmjusfhYNDjD4",
|
|
24
|
+
"B53EzSitDoQ4usvMN4nKhQRUVb7BhNh9PZPwgyQobpsV"
|
|
25
|
+
],
|
|
22
26
|
"about": "Given by the paid crate and the mystery lot."
|
|
23
27
|
},
|
|
24
28
|
{
|
|
@@ -31,7 +35,12 @@
|
|
|
31
35
|
{
|
|
32
36
|
"key": "rare",
|
|
33
37
|
"name": "The rare one",
|
|
34
|
-
"nfts": [
|
|
38
|
+
"nfts": [
|
|
39
|
+
{
|
|
40
|
+
"asset": "BQqnw2mh6xEAhAxC8WrA2uqPg9ShsT13AqriUa9x4ab4",
|
|
41
|
+
"collection": "5q8LtcGwYhYRq5M8dQ79wkeLvo8N993a7aoE6DLDBXaw"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
35
44
|
"about": "The raffle's first prize, named by it and given when its place is paid: kept apart so no roll can take it."
|
|
36
45
|
}
|
|
37
46
|
],
|
|
@@ -80,8 +89,15 @@
|
|
|
80
89
|
{
|
|
81
90
|
"key": "raffle",
|
|
82
91
|
"name": "Rare NFT raffle",
|
|
92
|
+
"rest": "treasury",
|
|
83
93
|
"price": 0.01,
|
|
84
|
-
"places": [
|
|
94
|
+
"places": [
|
|
95
|
+
{
|
|
96
|
+
"percent": 0,
|
|
97
|
+
"prize": { "gives": "nft", "stash": "rare", "nft": "BQqnw2mh6xEAhAxC8WrA2uqPg9ShsT13AqriUa9x4ab4" }
|
|
98
|
+
},
|
|
99
|
+
90
|
|
100
|
+
],
|
|
85
101
|
"firstDraw": "publish+7d"
|
|
86
102
|
}
|
|
87
103
|
],
|
|
@@ -90,18 +90,10 @@
|
|
|
90
90
|
{
|
|
91
91
|
"key": "weekly",
|
|
92
92
|
"name": "Grand and minors",
|
|
93
|
+
"pot": 0,
|
|
93
94
|
"price": 1,
|
|
94
95
|
"ticketCurrency": "ticket",
|
|
95
|
-
"places": [
|
|
96
|
-
50,
|
|
97
|
-
10,
|
|
98
|
-
10,
|
|
99
|
-
10,
|
|
100
|
-
5,
|
|
101
|
-
5,
|
|
102
|
-
5,
|
|
103
|
-
5
|
|
104
|
-
],
|
|
96
|
+
"places": [50, 10, 10, 10, 5, 5, 5, 5],
|
|
105
97
|
"every": "7d"
|
|
106
98
|
}
|
|
107
99
|
],
|
|
@@ -66,13 +66,11 @@
|
|
|
66
66
|
{
|
|
67
67
|
"key": "draw",
|
|
68
68
|
"name": "The stakers' draw",
|
|
69
|
+
"pot": 0,
|
|
69
70
|
"price": 0.01,
|
|
70
71
|
"noLoss": true,
|
|
71
72
|
"seed": 0.1,
|
|
72
|
-
"places": [
|
|
73
|
-
60,
|
|
74
|
-
40
|
|
75
|
-
],
|
|
73
|
+
"places": [60, 40],
|
|
76
74
|
"every": "7d",
|
|
77
75
|
"perWallet": 20,
|
|
78
76
|
"gate": {
|
|
@@ -93,9 +91,7 @@
|
|
|
93
91
|
"currency": "gem",
|
|
94
92
|
"from": "mint"
|
|
95
93
|
},
|
|
96
|
-
"vouchers": [
|
|
97
|
-
"AKnL4NNf3DGWZJS6cPknBuEGnVsV4A4m5tgebLHaRSZ9"
|
|
98
|
-
],
|
|
94
|
+
"vouchers": ["AKnL4NNf3DGWZJS6cPknBuEGnVsV4A4m5tgebLHaRSZ9"],
|
|
99
95
|
"limits": {
|
|
100
96
|
"perWallet": 52,
|
|
101
97
|
"perDay": 10
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"network": "devnet",
|
|
4
|
+
"name": "Stride Sneakers",
|
|
5
|
+
"prompt": "A move-to-earn game. Players buy a shoebox for 0.1 SOL and get a sneaker with random efficiency and luck, or a rare golden one. Walking earns STRIDE: the app's server vouches for a day's steps, once a day per wallet. Two sneakers and 200 STRIDE mint a new shoebox, at most 7 times per sneaker. 50 STRIDE levels a sneaker up, to level 30. Sneakers can be rented out from the app.",
|
|
6
|
+
"currency": "sol",
|
|
7
|
+
"tokens": [
|
|
8
|
+
{
|
|
9
|
+
"key": "sol",
|
|
10
|
+
"source": "sol"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"key": "stride",
|
|
14
|
+
"source": "project",
|
|
15
|
+
"name": "Stride",
|
|
16
|
+
"symbol": "STRIDE",
|
|
17
|
+
"decimals": 6
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"collection": {
|
|
21
|
+
"name": "Stride Sneakers"
|
|
22
|
+
},
|
|
23
|
+
"items": [
|
|
24
|
+
{
|
|
25
|
+
"key": "sneaker",
|
|
26
|
+
"name": "Sneaker",
|
|
27
|
+
"drawn": [
|
|
28
|
+
{
|
|
29
|
+
"attribute": "efficiency",
|
|
30
|
+
"min": 1,
|
|
31
|
+
"max": 10
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"attribute": "luck",
|
|
35
|
+
"min": 1,
|
|
36
|
+
"max": 10
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"key": "golden",
|
|
42
|
+
"name": "Golden Sneaker",
|
|
43
|
+
"rarity": "Legendary",
|
|
44
|
+
"supply": 100
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"boxes": [
|
|
48
|
+
{
|
|
49
|
+
"key": "shoebox",
|
|
50
|
+
"name": "Shoebox",
|
|
51
|
+
"price": 0.1,
|
|
52
|
+
"outcomes": [
|
|
53
|
+
{
|
|
54
|
+
"gives": "item",
|
|
55
|
+
"item": "sneaker",
|
|
56
|
+
"chance": 98
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"gives": "item",
|
|
60
|
+
"item": "golden",
|
|
61
|
+
"chance": 2
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"recipes": [
|
|
67
|
+
{
|
|
68
|
+
"key": "mint",
|
|
69
|
+
"name": "Mint a shoebox",
|
|
70
|
+
"in": [
|
|
71
|
+
{
|
|
72
|
+
"takes": "use",
|
|
73
|
+
"item": "sneaker"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"takes": "use",
|
|
77
|
+
"item": "sneaker"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"takes": "pay",
|
|
81
|
+
"amount": 200,
|
|
82
|
+
"currency": "stride",
|
|
83
|
+
"to": "burn"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"raises": [
|
|
87
|
+
{
|
|
88
|
+
"place": 0,
|
|
89
|
+
"key": "mints",
|
|
90
|
+
"by": 1,
|
|
91
|
+
"upTo": 7
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"place": 1,
|
|
95
|
+
"key": "mints",
|
|
96
|
+
"by": 1,
|
|
97
|
+
"upTo": 7
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"out": [
|
|
101
|
+
{
|
|
102
|
+
"gives": "roll",
|
|
103
|
+
"box": "shoebox"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"key": "level-up",
|
|
109
|
+
"name": "Level up",
|
|
110
|
+
"in": [
|
|
111
|
+
{
|
|
112
|
+
"takes": "use",
|
|
113
|
+
"item": "sneaker"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"takes": "pay",
|
|
117
|
+
"amount": 50,
|
|
118
|
+
"currency": "stride",
|
|
119
|
+
"to": "burn"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"raises": [
|
|
123
|
+
{
|
|
124
|
+
"place": 0,
|
|
125
|
+
"key": "level",
|
|
126
|
+
"by": 1,
|
|
127
|
+
"upTo": 30
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"grants": [
|
|
133
|
+
{
|
|
134
|
+
"key": "steps",
|
|
135
|
+
"name": "Daily steps",
|
|
136
|
+
"prize": {
|
|
137
|
+
"gives": "tokens",
|
|
138
|
+
"amount": 20,
|
|
139
|
+
"currency": "stride",
|
|
140
|
+
"from": "mint"
|
|
141
|
+
},
|
|
142
|
+
"vouchers": ["B8CrCHTMi223kknNgaJXXp8QGqNR9pwD1bfZVYvr5fmJ"],
|
|
143
|
+
"limits": {
|
|
144
|
+
"perWalletEach": {
|
|
145
|
+
"count": 1,
|
|
146
|
+
"every": "1d"
|
|
147
|
+
},
|
|
148
|
+
"perDay": 1000
|
|
149
|
+
},
|
|
150
|
+
"wallets": 1000,
|
|
151
|
+
"rounds": 365,
|
|
152
|
+
"fund": 0.5
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"scenario": {
|
|
156
|
+
"days": 30,
|
|
157
|
+
"perDay": {
|
|
158
|
+
"box:shoebox": 20,
|
|
159
|
+
"grant:steps": 300,
|
|
160
|
+
"recipe:mint": 15,
|
|
161
|
+
"recipe:level-up": 60
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -142,6 +142,7 @@
|
|
|
142
142
|
{
|
|
143
143
|
"key": "shield-raffle",
|
|
144
144
|
"name": "Shield raffle",
|
|
145
|
+
"pot": 0,
|
|
145
146
|
"ticketNft": {
|
|
146
147
|
"rule": {
|
|
147
148
|
"item": "shield"
|
|
@@ -149,9 +150,7 @@
|
|
|
149
150
|
"then": "burn"
|
|
150
151
|
},
|
|
151
152
|
"seed": 0.1,
|
|
152
|
-
"places": [
|
|
153
|
-
100
|
|
154
|
-
],
|
|
153
|
+
"places": [100],
|
|
155
154
|
"every": "7d"
|
|
156
155
|
}
|
|
157
156
|
],
|