@xgamesfun/solana 0.25.3 → 0.26.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 +145 -228
- package/js/approve/details.mjs +52 -2
- package/js/approve/live-check.mjs +0 -15
- package/js/approve/server.mjs +5 -4
- package/js/chain/token2022.js +3 -2
- package/js/client/accounts.js +67 -25
- package/js/client/grant.js +7 -2
- package/js/client/idl/loot.js +1 -1
- package/js/client/idl/loot.json +714 -182
- package/js/client/ix.js +617 -113
- package/js/client/sizes.js +35 -3
- package/js/economy/check.mjs +655 -242
- package/js/economy/cost.mjs +2 -4
- package/js/economy/explain.mjs +16 -2
- package/js/economy/guide.mjs +12 -12
- package/js/economy/model.mjs +133 -14
- package/js/economy/plan.mjs +36 -11
- package/js/economy/review.mjs +50 -8
- package/js/economy/schema.json +73 -29
- package/js/economy/simulate.mjs +116 -13
- package/js/mcp/tools.mjs +2 -2
- package/js/play/index.js +847 -296
- package/package.json +1 -1
- package/release.json +5 -5
- package/skills/xsolana-economy/SKILL.md +12 -4
- package/skills/xsolana-economy/references/after-launch.md +1 -1
- package/skills/xsolana-economy/references/apps.md +11 -2
- package/skills/xsolana-economy/references/sentence-to-spec.md +3 -3
- package/skills/xsolana-economy/references/telling-the-person.md +21 -4
- package/skills/xsolana-economy/references/trust-and-cheating.md +15 -5
- package/types/chain/token2022.d.ts +3 -2
- package/types/client/accounts.d.ts +34 -11
- package/types/client/idl/loot.d.ts +25 -4
- package/types/client/ix.d.ts +217 -45
- package/types/economy/check.d.mts +5 -0
- package/types/economy/model.d.mts +75 -12
- package/types/economy/plan.d.mts +22 -1
- package/types/economy/simulate.d.mts +12 -1
- package/types/mcp/server.d.mts +12 -1
- package/types/mcp/tools.d.mts +12 -1
- package/types/play/index.d.ts +210 -144
|
@@ -37,8 +37,8 @@ export declare const SIGNATURE_FEE = 5000n;
|
|
|
37
37
|
export declare const LAMPORTS_PER_SOL = 1000000000n;
|
|
38
38
|
export declare const WSOL = "So11111111111111111111111111111111111111112";
|
|
39
39
|
/** The limits a spec meets: the chain's (the oracle's answer carries 21 accounts; a farm names a tier and a recipe a
|
|
40
|
-
* collectible's place in a byte; Bubblegum keeps a compressed NFT's link in 200 bytes and its name in 32)
|
|
41
|
-
* caps that keep a farm's numbers from overflowing
|
|
40
|
+
* collectible's place in a byte; Bubblegum keeps a compressed NFT's link in 200 bytes and its name in 32), the two
|
|
41
|
+
* caps that keep a farm's numbers from overflowing, and the lists the program still bounds. */
|
|
42
42
|
export declare const LIMITS: Readonly<{
|
|
43
43
|
callbackAccounts: 21;
|
|
44
44
|
tiers: 256;
|
|
@@ -46,23 +46,44 @@ export declare const LIMITS: Readonly<{
|
|
|
46
46
|
vouchers: 3;
|
|
47
47
|
compressedNameBytes: 32;
|
|
48
48
|
compressedUriBytes: 200;
|
|
49
|
-
maxBoostBps:
|
|
50
|
-
maxTierBps:
|
|
51
|
-
boxEntries: 128;
|
|
52
|
-
boxSlots: 32;
|
|
53
|
-
boxOdds: 32;
|
|
54
|
-
boxFates: 64;
|
|
55
|
-
entryPrizes: 14;
|
|
49
|
+
maxBoostBps: 10000000;
|
|
50
|
+
maxTierBps: 1000000;
|
|
56
51
|
itemTraits: 64;
|
|
57
52
|
traitKeyBytes: 64;
|
|
58
|
-
recipeLines: 48;
|
|
59
53
|
farmRules: 32;
|
|
60
54
|
growthSteps: 128;
|
|
61
55
|
contestSides: 1024;
|
|
62
56
|
deciders: 32;
|
|
63
57
|
collections: 32;
|
|
64
58
|
lotteryRuns: 64;
|
|
65
|
-
|
|
59
|
+
entryPrizes: 255;
|
|
60
|
+
ownStashPlaces: 256;
|
|
61
|
+
ticketOneOf: 170;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* What one answer of the oracle's holds, as measured on the program: a box is refused when it is written
|
|
65
|
+
* (PackTooLarge, or TooManyAccounts) when one answer can't hold a draw of it, a box of one draw included. Each number is
|
|
66
|
+
* the most of that one thing in a box that is otherwise small: `entriesOfNothing` outcomes that give nothing,
|
|
67
|
+
* `entriesOfTokens` outcomes of token amounts, `entriesOfItems` outcomes each of its own item, `slots`, `odds` rules,
|
|
68
|
+
* `entryTokens` token prizes or `entryCollectibles` collectibles in one outcome, `gateTexts` "one of" texts in a box's
|
|
69
|
+
* gate. A box that mixes them fits less. A recipe: `recipePayments` payments in one coin, `recipeCoins` in different
|
|
70
|
+
* coins, `recipePoolOutputs` outputs from a pool, `recipeRaises` raises or needs; past those it is written but never
|
|
71
|
+
* crafts. `recipeRolls`: the rolls whose receipts a transaction's log still holds.
|
|
72
|
+
*/
|
|
73
|
+
export declare const ANSWER_HOLDS: Readonly<{
|
|
74
|
+
entriesOfNothing: 128;
|
|
75
|
+
entriesOfTokens: 29;
|
|
76
|
+
entriesOfItems: 18;
|
|
77
|
+
slots: 41;
|
|
78
|
+
odds: 72;
|
|
79
|
+
entryTokens: 16;
|
|
80
|
+
entryCollectibles: 18;
|
|
81
|
+
gateTexts: 340;
|
|
82
|
+
recipePayments: 60;
|
|
83
|
+
recipeCoins: 26;
|
|
84
|
+
recipePoolOutputs: 59;
|
|
85
|
+
recipeRaises: 108;
|
|
86
|
+
recipeRolls: 15;
|
|
66
87
|
}>;
|
|
67
88
|
/** Attribute names the program writes itself, which a recipe cannot copy and `Set` cannot change (craft.rs, make.rs),
|
|
68
89
|
* and the two a collectible's life keeps (`lifeLines`: its uses and its next use). */
|
|
@@ -111,7 +132,43 @@ export declare const STOCK_WORDS = "The odds stay as written whatever is in stoc
|
|
|
111
132
|
*/
|
|
112
133
|
export declare function whenOutWords(b: any, { sold }?: {
|
|
113
134
|
sold?: boolean | undefined;
|
|
114
|
-
}):
|
|
135
|
+
}): string;
|
|
136
|
+
/** Whether a box stops selling while an outcome is out (`whenOut` "stopSales", the default). */
|
|
137
|
+
export declare const stopsSales: (b: any) => boolean;
|
|
138
|
+
/** The largest weight an outcome has (a `u32`). */
|
|
139
|
+
export declare const MOST_WEIGHT = 4294967295n;
|
|
140
|
+
/**
|
|
141
|
+
* An outcome's weight grown by `bps` basis points (rules.rs `boosted`): rounded down, and never past the largest weight.
|
|
142
|
+
* Counted in BigInt: the largest weight times the largest boost passes 2^53. Two outcomes boosted past the largest
|
|
143
|
+
* weight are equally likely.
|
|
144
|
+
*/
|
|
145
|
+
export declare function boostedWeight(weight: any, bps: any): bigint;
|
|
146
|
+
/**
|
|
147
|
+
* Box `b`'s weights for a player who passes every one of its odds rules at their most (order.rs): the rules' boosts on
|
|
148
|
+
* one outcome add up, and stop at the largest `u32`; each outcome's weight is then boosted (`boostedWeight`). A boost
|
|
149
|
+
* per point counts its `upTo` points. BigInt weights, outcome by outcome.
|
|
150
|
+
*/
|
|
151
|
+
export declare function boostedWeights(b: any): any;
|
|
152
|
+
/**
|
|
153
|
+
* What places of tokens paid from one pool get when it holds `holds` and they win more (lottery.rs `WhenShort`), as a
|
|
154
|
+
* pull pays them: `runs` are [{ each, places }] in place order (base units, BigInt), `whenShort` the setting they all
|
|
155
|
+
* say. Each run gets [{ each, sent }]. "inOrder": whole prizes, first to last, while what is left covers one;
|
|
156
|
+
* "inProportion": every place the same share of its prize, rounded down; "nothing": no place, and the pool keeps it.
|
|
157
|
+
* Prizes of 1,000, 500 and 500 from a pool holding 1,700: 1,000, 500 and 0; 850, 425 and 425; or nothing.
|
|
158
|
+
*/
|
|
159
|
+
export declare function shortPays(runs: any, holds: any, whenShort?: string): any;
|
|
160
|
+
/**
|
|
161
|
+
* What a purchase of `count` tickets at `at` weighs in a lottery that weighs tickets by time (lottery.rs
|
|
162
|
+
* `time_weighted`): each ticket the seconds from it to the close of sales (`drawsAt` less `closesBefore`), at least 1.
|
|
163
|
+
* Off, a ticket weighs one. BigInt.
|
|
164
|
+
*/
|
|
165
|
+
export declare function purchaseWeight(count: any, at: any, drawsAt: any, closesBefore?: number, weighted?: boolean): bigint;
|
|
166
|
+
/**
|
|
167
|
+
* The entry that wins each place of a round (lottery.rs `ticket_of_place`): place `k` is at `first + k × (total /
|
|
168
|
+
* winners)`, rounding the end, and its winner is the entry whose slice of the draw holds that point. `entries` are each
|
|
169
|
+
* purchase's weight in order (BigInt), `first` the answer's point below the total. The entry's index for each place.
|
|
170
|
+
*/
|
|
171
|
+
export declare function placeWinners(entries: any, winners: any, first: any): number[];
|
|
115
172
|
/**
|
|
116
173
|
* What the end of a sharing farm that `runs` means, in words, or null (no end, or a fixed rate): its release keeps its
|
|
117
174
|
* pace, so what it has not let go by the end stays in its vault, free for the authority to take back, and so does what
|
|
@@ -280,6 +337,12 @@ export declare const placeOf: (p: any) => {
|
|
|
280
337
|
percent: any;
|
|
281
338
|
prize: any;
|
|
282
339
|
times: any;
|
|
340
|
+
whenShort: any;
|
|
341
|
+
} | {
|
|
342
|
+
whenShort?: undefined;
|
|
343
|
+
percent: any;
|
|
344
|
+
prize: null;
|
|
345
|
+
times: number;
|
|
283
346
|
};
|
|
284
347
|
/** "pool:house" → { kind: 'pool', key: 'house' }; "burn" → { kind: 'burn' }. */
|
|
285
348
|
export declare function destination(to: any): {
|
package/types/economy/plan.d.mts
CHANGED
|
@@ -102,7 +102,7 @@ export declare function boxArgs(b: any, m: any): {
|
|
|
102
102
|
shared: boolean;
|
|
103
103
|
} | null;
|
|
104
104
|
stock_odds: boolean;
|
|
105
|
-
when_out:
|
|
105
|
+
when_out: any;
|
|
106
106
|
active: boolean;
|
|
107
107
|
shares: any;
|
|
108
108
|
slots: any;
|
|
@@ -480,6 +480,8 @@ export declare function lotteryArgs(l: any, m: any): {
|
|
|
480
480
|
} | null;
|
|
481
481
|
returns: boolean;
|
|
482
482
|
min_sold: bigint;
|
|
483
|
+
closes_before: bigint;
|
|
484
|
+
time_weighted: boolean;
|
|
483
485
|
};
|
|
484
486
|
every: bigint;
|
|
485
487
|
gate: {
|
|
@@ -521,6 +523,21 @@ export declare function lotteryArgs(l: any, m: any): {
|
|
|
521
523
|
} | null;
|
|
522
524
|
per_wallet: any;
|
|
523
525
|
};
|
|
526
|
+
/** A box's `whenOut` in the spec, and the program's `WhenOut`: stop selling while an outcome is out (a paid miss is
|
|
527
|
+
* refunded), draw among what is left, or give nothing for a draw on an outcome that is out. */
|
|
528
|
+
export declare const WHEN_OUT: {
|
|
529
|
+
stopSales: string;
|
|
530
|
+
drawLeft: string;
|
|
531
|
+
giveNothing: string;
|
|
532
|
+
};
|
|
533
|
+
/** A place's `whenShort` in the spec, and the program's `WhenShort`: what places of tokens from one pool get when the
|
|
534
|
+
* pool holds less than they win. Prizes of 1,000, 500 and 500 from a pool holding 1,700: 1,000, 500 and 0 in order;
|
|
535
|
+
* 850, 425 and 425 in proportion; or nothing. */
|
|
536
|
+
export declare const WHEN_SHORT: {
|
|
537
|
+
inOrder: string;
|
|
538
|
+
inProportion: string;
|
|
539
|
+
nothing: string;
|
|
540
|
+
};
|
|
524
541
|
/**
|
|
525
542
|
* A lottery round's header as its first purchase sizes it (`LotteryRound::new`: its `head`), and the token accounts a
|
|
526
543
|
* round may open (`accounts`: the payment mint's, the pot's, one for each run whose prize comes from a pool). The
|
|
@@ -531,6 +548,10 @@ export declare function roundSize(l: any, m: any): {
|
|
|
531
548
|
head: number;
|
|
532
549
|
accounts: any;
|
|
533
550
|
};
|
|
551
|
+
/** What decides the bytes of a purchase's entry in a lottery's round (`loot.entryWidth`'s arguments): whether it keeps
|
|
552
|
+
* what arrived (a share the buyer chooses, or a weighted round of paid tickets), whether the ticket is an NFT, and
|
|
553
|
+
* whether the round weighs its tickets by time. */
|
|
554
|
+
export declare const entryShape: (l: any) => boolean[];
|
|
534
555
|
/** How many rounds of a lottery are open or still paying out at once, and how many purchases a round takes, as the
|
|
535
556
|
* spec expects them (`expect`): by default two rounds of a lottery that draws again (one selling, one paying out) and
|
|
536
557
|
* one of a lottery that draws once; a round's purchases from the scenario's purchases a day over a round, else 100. */
|
|
@@ -62,11 +62,22 @@ export declare function simulate(economy: any, { now }?: {
|
|
|
62
62
|
holdSol: any;
|
|
63
63
|
};
|
|
64
64
|
limitedStock?: boolean | undefined;
|
|
65
|
-
whenOut?:
|
|
65
|
+
whenOut?: any;
|
|
66
|
+
oddsBoosted?: any;
|
|
66
67
|
stock?: {
|
|
67
68
|
whenOut: string;
|
|
68
69
|
stopsSellingInDays: any;
|
|
69
70
|
by: any;
|
|
71
|
+
runsOut?: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
stopsSellingInDays?: undefined;
|
|
74
|
+
by?: undefined;
|
|
75
|
+
whenOut: string;
|
|
76
|
+
runsOut: {
|
|
77
|
+
inDays: any;
|
|
78
|
+
outcomes: any;
|
|
79
|
+
missPercent: any;
|
|
80
|
+
}[];
|
|
70
81
|
} | {
|
|
71
82
|
by?: undefined;
|
|
72
83
|
whenOut: string;
|
package/types/mcp/server.d.mts
CHANGED
|
@@ -105,11 +105,22 @@ export declare function runTool(name: any, input?: {}, ctx?: {}): Promise<{
|
|
|
105
105
|
holdSol: any;
|
|
106
106
|
};
|
|
107
107
|
limitedStock?: boolean | undefined;
|
|
108
|
-
whenOut?:
|
|
108
|
+
whenOut?: any;
|
|
109
|
+
oddsBoosted?: any;
|
|
109
110
|
stock?: {
|
|
110
111
|
whenOut: string;
|
|
111
112
|
stopsSellingInDays: any;
|
|
112
113
|
by: any;
|
|
114
|
+
runsOut?: undefined;
|
|
115
|
+
} | {
|
|
116
|
+
stopsSellingInDays?: undefined;
|
|
117
|
+
by?: undefined;
|
|
118
|
+
whenOut: string;
|
|
119
|
+
runsOut: {
|
|
120
|
+
inDays: any;
|
|
121
|
+
outcomes: any;
|
|
122
|
+
missPercent: any;
|
|
123
|
+
}[];
|
|
113
124
|
} | {
|
|
114
125
|
by?: undefined;
|
|
115
126
|
whenOut: string;
|
package/types/mcp/tools.d.mts
CHANGED
|
@@ -278,11 +278,22 @@ export declare const tools: ({
|
|
|
278
278
|
holdSol: any;
|
|
279
279
|
};
|
|
280
280
|
limitedStock?: boolean | undefined;
|
|
281
|
-
whenOut?:
|
|
281
|
+
whenOut?: any;
|
|
282
|
+
oddsBoosted?: any;
|
|
282
283
|
stock?: {
|
|
283
284
|
whenOut: string;
|
|
284
285
|
stopsSellingInDays: any;
|
|
285
286
|
by: any;
|
|
287
|
+
runsOut?: undefined;
|
|
288
|
+
} | {
|
|
289
|
+
stopsSellingInDays?: undefined;
|
|
290
|
+
by?: undefined;
|
|
291
|
+
whenOut: string;
|
|
292
|
+
runsOut: {
|
|
293
|
+
inDays: any;
|
|
294
|
+
outcomes: any;
|
|
295
|
+
missPercent: any;
|
|
296
|
+
}[];
|
|
286
297
|
} | {
|
|
287
298
|
by?: undefined;
|
|
288
299
|
whenOut: string;
|