@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.
Files changed (41) hide show
  1. package/README.md +145 -228
  2. package/js/approve/details.mjs +52 -2
  3. package/js/approve/live-check.mjs +0 -15
  4. package/js/approve/server.mjs +5 -4
  5. package/js/chain/token2022.js +3 -2
  6. package/js/client/accounts.js +67 -25
  7. package/js/client/grant.js +7 -2
  8. package/js/client/idl/loot.js +1 -1
  9. package/js/client/idl/loot.json +714 -182
  10. package/js/client/ix.js +617 -113
  11. package/js/client/sizes.js +35 -3
  12. package/js/economy/check.mjs +655 -242
  13. package/js/economy/cost.mjs +2 -4
  14. package/js/economy/explain.mjs +16 -2
  15. package/js/economy/guide.mjs +12 -12
  16. package/js/economy/model.mjs +133 -14
  17. package/js/economy/plan.mjs +36 -11
  18. package/js/economy/review.mjs +50 -8
  19. package/js/economy/schema.json +73 -29
  20. package/js/economy/simulate.mjs +116 -13
  21. package/js/mcp/tools.mjs +2 -2
  22. package/js/play/index.js +847 -296
  23. package/package.json +1 -1
  24. package/release.json +5 -5
  25. package/skills/xsolana-economy/SKILL.md +12 -4
  26. package/skills/xsolana-economy/references/after-launch.md +1 -1
  27. package/skills/xsolana-economy/references/apps.md +11 -2
  28. package/skills/xsolana-economy/references/sentence-to-spec.md +3 -3
  29. package/skills/xsolana-economy/references/telling-the-person.md +21 -4
  30. package/skills/xsolana-economy/references/trust-and-cheating.md +15 -5
  31. package/types/chain/token2022.d.ts +3 -2
  32. package/types/client/accounts.d.ts +34 -11
  33. package/types/client/idl/loot.d.ts +25 -4
  34. package/types/client/ix.d.ts +217 -45
  35. package/types/economy/check.d.mts +5 -0
  36. package/types/economy/model.d.mts +75 -12
  37. package/types/economy/plan.d.mts +22 -1
  38. package/types/economy/simulate.d.mts +12 -1
  39. package/types/mcp/server.d.mts +12 -1
  40. package/types/mcp/tools.d.mts +12 -1
  41. 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) and the two
41
- * caps that keep a farm's numbers from overflowing. Since loot 0.22 the program caps no count or size of its own. */
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: 1000000;
50
- maxTierBps: 110000;
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
- farmEnds: 100000;
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
- }): "The odds stay as written whatever is in stock: a draw that lands on an outcome that can’t be given then (its pool short of the whole amount, its item or stash gone) is not made, no other outcome takes its place, and that draw’s worth of the price goes back at the settle; with no draw made at all, a paid open fails and is refunded, and a free roll goes back to waiting. A free roll (a prize, a recipe’s, a mission’s chest) is on the odds as written too: a draw on an outcome that is out misses and gives nothing back (a pack keeps what its other draws won; a roll that drew nothing waits to be asked again), so emptying a shared source before asking steers nothing. A pack that should draw among what is left needs \"whenOut\": \"drawLeft\"" | "When an outcome runs out (an item sold out, a pool short of its prize, a stash empty), a roll draws among the outcomes still there by their written weights, so the others’ chances rise; with nothing left at all, a free roll waits to be asked again and a paid one is refunded" | "When an outcome runs out (an item sold out, a pool short of its prize, a stash empty), the box keeps selling while its first draw has anything left, and a roll draws among the outcomes still there by their written weights: the others’ chances rise as one runs out, so a player can empty a common outcome to make a rare one likelier (a box selling a rare prize should stop selling instead, the default)" | "When an outcome runs out, the box stops selling: it isn’t sold while anything an outcome takes (an item’s units left, a pool’s tokens, a stash’s NFTs) couldn’t cover, at the most any outcome sharing it takes in one draw, this purchase’s draws and those of purchases still waiting for the oracle, so every roll is on the odds as written and nobody can buy their way to a refund on every miss; it sells again once the project restocks or edits the box (an outcome whose odds shrink with stock needs no cover). An outcome emptied another way all the same (another route sharing its pool, item or stash) makes no draw, no other outcome taking its place, and gives back that draw’s worth of the price at the settle; with no draw made at all, the open is refunded";
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): {
@@ -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: string;
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?: string | undefined;
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;
@@ -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?: string | undefined;
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;
@@ -278,11 +278,22 @@ export declare const tools: ({
278
278
  holdSol: any;
279
279
  };
280
280
  limitedStock?: boolean | undefined;
281
- whenOut?: string | undefined;
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;