@xgamesfun/solana 0.20.1 → 0.24.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 +10 -10
- package/examples/coin-flip-arena.json +2 -7
- package/examples/elements-set.json +2 -9
- package/examples/expedition-guild.json +1 -8
- package/examples/guild-missions.json +3 -10
- package/examples/halving-seasons.json +4 -9
- package/examples/hero-trials.json +1 -4
- package/examples/merge-2048.json +5 -5
- package/examples/paper-hands-farm.json +4 -16
- package/examples/partner-vault.json +1 -4
- package/examples/stakers-draw.json +1 -8
- package/examples/star-fleet.json +1 -8
- package/examples/starforce.json +6 -6
- package/js/approve/details.mjs +8 -7
- package/js/approve/server.mjs +20 -5
- package/js/chain/borsh.js +9 -0
- package/js/chain/core.js +14 -2
- package/js/chain/lookup.js +8 -2
- package/js/chain/rpc.js +4 -2
- package/js/client/accounts.js +448 -116
- package/js/client/grant.js +125 -66
- package/js/client/idl/loot.js +1 -1
- package/js/client/idl/loot.json +2360 -2218
- package/js/client/index.js +1 -0
- package/js/client/ix.js +1204 -473
- package/js/client/pda.js +20 -16
- package/js/client/policy.js +44 -23
- package/js/client/random.js +70 -0
- package/js/client/sizes.js +255 -12
- package/js/economy/check.mjs +455 -210
- package/js/economy/cost.mjs +45 -30
- package/js/economy/examples.mjs +2 -2
- package/js/economy/explain.mjs +24 -20
- package/js/economy/guide.mjs +31 -30
- package/js/economy/live.mjs +30 -7
- package/js/economy/model.mjs +171 -56
- package/js/economy/plan.mjs +380 -112
- package/js/economy/schema.json +291 -143
- package/js/economy/simulate.mjs +154 -87
- package/js/mcp/tools.mjs +14 -8
- package/js/play/index.js +1121 -375
- package/js/play/keys.js +167 -0
- package/package.json +1 -1
- package/release.json +5 -5
- package/skills/xsolana-economy/SKILL.md +15 -11
- package/skills/xsolana-economy/references/after-launch.md +37 -27
- package/skills/xsolana-economy/references/apps.md +55 -19
- package/skills/xsolana-economy/references/sentence-to-spec.md +30 -22
- package/skills/xsolana-economy/references/telling-the-person.md +52 -11
- package/types/chain/core.d.ts +3 -1
- package/types/chain/lookup.d.ts +5 -2
- package/types/chain/rpc.d.ts +3 -1
- package/types/client/accounts.d.ts +195 -55
- package/types/client/grant.d.ts +72 -27
- package/types/client/idl/loot.d.ts +590 -559
- package/types/client/index.d.ts +1 -0
- package/types/client/ix.d.ts +3862 -234
- package/types/client/pda.d.ts +19 -15
- package/types/client/policy.d.ts +39 -14
- package/types/client/random.d.ts +26 -0
- package/types/client/sizes.d.ts +93 -5
- package/types/economy/check.d.mts +5 -10
- package/types/economy/cost.d.mts +2 -1
- package/types/economy/live.d.mts +16 -1
- package/types/economy/model.d.mts +105 -37
- package/types/economy/plan.d.mts +193 -192
- package/types/economy/simulate.d.mts +21 -13
- package/types/mcp/tools.d.mts +21 -13
- package/types/play/index.d.ts +450 -39
- package/types/play/keys.d.ts +51 -0
package/types/client/pda.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export declare const COMPRESSION_PROGRAM = "mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcb
|
|
|
11
11
|
export declare const NOOP_PROGRAM = "mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3";
|
|
12
12
|
/** The PDA of these seeds under the loot program, with its bump. */
|
|
13
13
|
export declare const lootAddress: (seeds: any, program?: string) => any;
|
|
14
|
-
declare const keyReceipt: (grant: any, incarnation: any, voucherKey: any) => any;
|
|
15
14
|
export declare const pda: {
|
|
16
15
|
platform: () => any;
|
|
17
16
|
/** A project: any wallet (its creator) opens as many as it likes, each with a number of its own (`id`, a u64). A
|
|
@@ -24,6 +23,10 @@ export declare const pda: {
|
|
|
24
23
|
box: (project: any, id: any) => any;
|
|
25
24
|
/** NFTs the project holds to give away as prizes: a box entry of a stash gives one of them at random. */
|
|
26
25
|
stash: (project: any, id: any) => any;
|
|
26
|
+
/** A table of weighted rows the project writes and seals (a card among thousands, a trait's values), or commits by a Merkle root. */
|
|
27
|
+
table: (project: any, id: any) => any;
|
|
28
|
+
/** What the project keeps about a wallet (its player's profile: XP, level, rank). */
|
|
29
|
+
profile: (project: any, wallet: any) => any;
|
|
27
30
|
schedule: (project: any, id: any) => any;
|
|
28
31
|
lottery: (project: any, id: any) => any;
|
|
29
32
|
recipe: (project: any, id: any) => any;
|
|
@@ -38,12 +41,12 @@ export declare const pda: {
|
|
|
38
41
|
itemAsset: (item: any, serial: any) => any;
|
|
39
42
|
/** A contest's pot, or a lottery's: `["pot", contest or lottery]`. */
|
|
40
43
|
pot: (record: any) => any;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
/** A
|
|
46
|
-
|
|
44
|
+
/** One round of a lottery: its record, opened by the round's first purchase (`["round", lottery, incarnation, round]`). */
|
|
45
|
+
round: (lottery: any, incarnation: any, round: any) => any;
|
|
46
|
+
/** A lottery round's own token account of `mint`, which the round's record owns. */
|
|
47
|
+
roundTokens: (round: any, mint: any) => any;
|
|
48
|
+
/** A contest's list of entries, one record a player (page 0). */
|
|
49
|
+
entries: (contest: any, incarnation: any, page?: number) => any;
|
|
47
50
|
/** A hold names its NFT and its end (Unix seconds): a release sent late never finds a later hold of the NFT. */
|
|
48
51
|
hold: (asset: any, freeAt: any) => any;
|
|
49
52
|
/** An offer: an id is its maker's own. Its money waits in the project's vault for its mint (`vault`). */
|
|
@@ -58,6 +61,8 @@ export declare const pda: {
|
|
|
58
61
|
listing: (project: any, asset: any) => any;
|
|
59
62
|
staked: (farm: any) => any;
|
|
60
63
|
rewards: (farm: any) => any;
|
|
64
|
+
/** A farm's record of when its seats stop earning, for a farm that keeps one (`Farm.keeps_ends`). */
|
|
65
|
+
ends: (farm: any) => any;
|
|
61
66
|
/** A seat: a player's in a farm of tokens, a collectible's (its asset) in a farm of collectibles. */
|
|
62
67
|
seat: (farm: any, by: any) => any;
|
|
63
68
|
/** What the project writes about an NFT it has no authority over (its Sheet): `nft` is a Core asset, a Token Metadata mint or a compressed NFT's asset id. */
|
|
@@ -70,14 +75,13 @@ export declare const pda: {
|
|
|
70
75
|
treeConfig: (tree: any) => any;
|
|
71
76
|
/** A compressed NFT's asset id: Bubblegum's `["asset", tree, nonce]`, `nonce` the count minted before it. */
|
|
72
77
|
compressedAsset: (tree: any, nonce: any) => any;
|
|
73
|
-
/** A wallet's
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
code: typeof keyReceipt;
|
|
78
|
+
/** A wallet's counts in a project: how many times it bought from each box, crafted each recipe or held tickets in
|
|
79
|
+
* a lottery's round that limits it (`decodeCounts`). */
|
|
80
|
+
counts: (project: any, wallet: any) => any;
|
|
81
|
+
/** Shard `shard` of a grant's limit records: what each wallet, person, badge and voucher key claimed. */
|
|
82
|
+
claims: (grant: any, incarnation: any, shard: any) => any;
|
|
83
|
+
/** Shard `shard` of the rounds a grant paid. */
|
|
84
|
+
rounds: (grant: any, incarnation: any, shard: any) => any;
|
|
81
85
|
/** The program's identity, which signs its requests to the oracle. */
|
|
82
86
|
identity: () => any;
|
|
83
87
|
/** The identity the oracle signs callbacks with: the VRF program's PDA for this program. */
|
package/types/client/policy.d.ts
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
1
|
+
/** How long the oracle has to answer before a roll or a draw may be asked again, and a pending order refunded (seconds). */
|
|
2
|
+
export declare const STALE_SECONDS: bigint;
|
|
3
|
+
/** How long after a lottery's first ask the next ask cancels its round, and an asked order holding a payment or an NFT
|
|
4
|
+
* may be refunded (seconds). */
|
|
5
|
+
export declare const LOTTERY_TIMEOUT_SECONDS: bigint;
|
|
3
6
|
/**
|
|
4
|
-
* The earliest
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
+
* The earliest an order can be refunded, as `{ slot, at }` (the program wants a later slot than `slot` and a later
|
|
8
|
+
* second than `at`), or null when it never can be as it stands: a failed order from the next slot; a paid order the
|
|
9
|
+
* oracle never answered 10 minutes after it was asked (`STALE_SECONDS`); an asked roll holding a payment or an NFT 7 days
|
|
10
|
+
* after its first ask. A rolled order has an outcome to carry out, and is settled. A waiting roll, or an asked one holding
|
|
11
|
+
* nothing, is asked (again): `rollAskable`.
|
|
7
12
|
*/
|
|
8
|
-
export declare function
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
export declare function orderRefundAt(order: any): {
|
|
14
|
+
slot: bigint;
|
|
15
|
+
at: null;
|
|
16
|
+
} | {
|
|
17
|
+
slot: bigint;
|
|
18
|
+
at: bigint;
|
|
19
|
+
} | {
|
|
20
|
+
slot: null;
|
|
21
|
+
at: bigint;
|
|
22
|
+
} | null;
|
|
23
|
+
/** Whether an order can be refunded at `slot` and `now` (Unix seconds, the chain's clock): `orderRefundAt`. */
|
|
24
|
+
export declare function orderRefundable(order: any, slot: any, now: any): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether its player or the project's keys may ask the oracle for a mission's or a recipe's roll at `slot` and `now`
|
|
27
|
+
* (Unix seconds, the chain's clock): never asked, or never answered within `STALE_SECONDS`. Once asked, a later ask comes
|
|
28
|
+
* in a later slot than the last (`SameSlot`: never the same seed twice), so a roll that found nothing in stock and waits
|
|
29
|
+
* again is asked from the next slot on.
|
|
30
|
+
*/
|
|
31
|
+
export declare const rollAskable: (order: any, slot: any, now: any) => boolean;
|
|
11
32
|
/**
|
|
12
33
|
* Whether a contest is off at `now` (Unix seconds), as the program reads its verdict: called off, its result
|
|
13
34
|
* overdue, or short of its least pot once entries closed. Every entry of one that is off takes its money back.
|
|
14
35
|
*/
|
|
15
36
|
export declare function contestOff(contest: any, now: any): boolean;
|
|
16
|
-
/** Whether a lottery's draw was asked for and the oracle has not answered within
|
|
17
|
-
|
|
37
|
+
/** Whether a lottery round's draw (`round`: its decoded record) was asked for and the oracle has not answered within
|
|
38
|
+
* `STALE_SECONDS` by `now` (Unix seconds, the chain's clock): anyone may ask again. */
|
|
39
|
+
export declare const lotteryDrawStuck: (round: any, now: any) => boolean;
|
|
18
40
|
/**
|
|
19
|
-
* Whether a lottery's draw was asked for and the oracle has not answered within
|
|
20
|
-
* ask (asking again doesn't move it)
|
|
21
|
-
*
|
|
41
|
+
* Whether a lottery round's draw (`round`: its decoded record) was asked for and the oracle has not answered within
|
|
42
|
+
* `LOTTERY_TIMEOUT_SECONDS` of the first ask (asking again doesn't move it) by `now` (Unix seconds, the chain's clock):
|
|
43
|
+
* the next ask of that round (`drawLotteryIx` with its address) cancels it, and every entry is refunded. A round nobody
|
|
44
|
+
* asked to draw is never cancelled.
|
|
22
45
|
*/
|
|
23
|
-
export declare const lotteryCancellable: (
|
|
46
|
+
export declare const lotteryCancellable: (round: any, now: any) => boolean;
|
|
47
|
+
/** A farm seat's `earns_until` when nothing ends its earning (i64::MAX): no tier term and no fuel it reads. */
|
|
48
|
+
export declare const NO_END: bigint;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** What a path's first word names (`random::tag`): an entry of a box, a stash's NFT, a lottery's ticket, a fresh trait. */
|
|
2
|
+
export declare const TAG: Readonly<{
|
|
3
|
+
ENTRY: 1;
|
|
4
|
+
STASH: 2;
|
|
5
|
+
LOTTERY: 3;
|
|
6
|
+
TRAIT: 4;
|
|
7
|
+
}>;
|
|
8
|
+
/** The most words a path holds. */
|
|
9
|
+
export declare const MAX_PATH = 8;
|
|
10
|
+
/** A stream of the oracle's 32-byte `answer` at `path` (whole numbers): seed = sha256("loot-roll-v1" | answer | path as
|
|
11
|
+
* u32 little-endian words); its nth number the first 8 bytes, little-endian, of sha256(seed | n as u64 little-endian). */
|
|
12
|
+
export declare function stream(answer: any, path?: any[]): {
|
|
13
|
+
next(): bigint;
|
|
14
|
+
};
|
|
15
|
+
/** A number from 0 to `n` - 1, every one as likely: a draw past the last whole multiple of `n` is drawn again. null for
|
|
16
|
+
* `n` 0. */
|
|
17
|
+
export declare function uniform(s: any, n: any): number | null;
|
|
18
|
+
/** The row `at` lands on, the weights walked in order. null past the last. */
|
|
19
|
+
export declare function walk(weights: any, at: any): any;
|
|
20
|
+
/** A row by weight (a weight of 0 never drawn); null when none weighs anything, or they sum past 64 bits. */
|
|
21
|
+
export declare function weighted(s: any, weights: any): any;
|
|
22
|
+
/** A number from `min` to `max`, both included, every one as likely (either order). */
|
|
23
|
+
export declare function range(s: any, min: any, max: any): any;
|
|
24
|
+
/** A fresh unit's range trait `t` (its place among the item's traits) as the program draws it at the mint: from the
|
|
25
|
+
* order's `answer`, `at` the unit's place in the order's `won`. */
|
|
26
|
+
export declare const rangeTrait: (answer: any, at: any, t: any, min: any, max: any) => any;
|
package/types/client/sizes.d.ts
CHANGED
|
@@ -2,12 +2,100 @@
|
|
|
2
2
|
export declare function allocationBytes(name: any): any;
|
|
3
3
|
/** The exact bytes of a dynamically allocated account. */
|
|
4
4
|
export declare const accountBytes: (name: any, value: any) => number;
|
|
5
|
+
/** A seat; a loan's hold (with room for its debt); a hold a player asks for, made without one (`Hold::PLAIN`). */
|
|
5
6
|
export declare const ACCOUNT_BYTES: Readonly<{
|
|
6
|
-
|
|
7
|
+
Seat: any;
|
|
8
|
+
Loan: any;
|
|
9
|
+
Hold: number;
|
|
7
10
|
}>;
|
|
8
11
|
/** A project's bytes with `collections` collections, as the program sizes the account. */
|
|
9
12
|
export declare const projectBytes: (collections?: number) => number;
|
|
10
|
-
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/** The most accounts the oracle's answer to a roll carries (`MAX_CALLBACK_ACCOUNTS`). */
|
|
14
|
+
export declare const MAX_CALLBACK_ACCOUNTS = 21;
|
|
15
|
+
/**
|
|
16
|
+
* The most accounts a roll of `entries` hands the oracle (`catalog::callback_accounts`): the order, the box and the
|
|
17
|
+
* ticket; one for each prize that needs one at the roll (an item, a pool, a stash); and with tokens, the two token
|
|
18
|
+
* programs, the project, and a mint and a vault for each source of tokens.
|
|
19
|
+
*/
|
|
20
|
+
export declare function callbackAccounts(entries: any): number;
|
|
21
|
+
/**
|
|
22
|
+
* How many fresh items' table accounts the oracle's answer to a roll of `entries` can carry (`order::table_budget`):
|
|
23
|
+
* what the box's own accounts leave of `MAX_CALLBACK_ACCOUNTS`. Negative: the box can't be rolled at all.
|
|
24
|
+
*/
|
|
25
|
+
export declare const tableBudget: (entries: any) => number;
|
|
26
|
+
/** The most an order can be (`MAX_ORDER_BYTES`, not in the IDL): a box whose one open's order would be more is refused
|
|
27
|
+
* at its upsert (`BadEntries`). In practice a pack is bounded first by what one oracle answer draws (`drawsFit`). */
|
|
28
|
+
export declare const MAX_ORDER_BYTES = 10240;
|
|
29
|
+
/**
|
|
30
|
+
* The rows of fresh items' tables a draw of each entry writes into its order (`order::rows_of`), walked with the box's
|
|
31
|
+
* table budget as the roll's accounts are (`entryAccounts`: an item whose tables don't fit what is left draws none).
|
|
32
|
+
* `items` maps an item's id to its decoded Item; one left out is taken as not fresh.
|
|
33
|
+
*/
|
|
34
|
+
export declare function entryRows(entries: any, items?: {}): any;
|
|
35
|
+
/**
|
|
36
|
+
* The bytes of an order of `lootBox` with `shares` shares and `opens` opens. With `items` (an item's id to its decoded
|
|
37
|
+
* Item), as `open_box` sizes it (`Order::sized`): each draw at its dearest entry's prizes as the `Won` they become (an
|
|
38
|
+
* item 14 bytes, tokens or an NFT 41, a roll none) and 4 bytes for each table row its fresh items draw now
|
|
39
|
+
* (`entryRows`); its odds and its largest fate. Without `items`, as a roll made inside another call sizes it (a craft,
|
|
40
|
+
* a grant's claim, a mission, a roll lot: `Order::space_for`): the box's whole table budget a draw for a box that
|
|
41
|
+
* gives items. A pack's order grows with its cards.
|
|
42
|
+
*/
|
|
43
|
+
export declare function orderBytes(lootBox: any, shares: number | undefined, opens: number | undefined, items: any): number;
|
|
44
|
+
/**
|
|
45
|
+
* The heap reading a box takes beyond its entries (`order::box_bytes`): its odds, gate, shares, subject, slots and
|
|
46
|
+
* fates, read whole with it, by their bytes and their number. `box`: the box's args, as `upsertBoxIx` takes them.
|
|
47
|
+
*/
|
|
48
|
+
export declare function boxBytes({ odds, gate, shares, subject, slots, fates }: {
|
|
49
|
+
fates?: never[] | undefined;
|
|
50
|
+
gate?: null | undefined;
|
|
51
|
+
odds?: never[] | undefined;
|
|
52
|
+
shares?: never[] | undefined;
|
|
53
|
+
slots?: never[] | undefined;
|
|
54
|
+
subject?: null | undefined;
|
|
55
|
+
}): bigint;
|
|
56
|
+
/**
|
|
57
|
+
* Whether all of `opens` opens of `entries` by `slots` fit one oracle answer (`order::draws_fit`), each draw at the
|
|
58
|
+
* dearest its slot could make, with what is known from the box alone (no table rows, a stash of one group), its `odds`,
|
|
59
|
+
* `shares` and `fates` counted, and `bytes` (`boxBytes`) of heap reading the box takes beyond its entries. `slots` may
|
|
60
|
+
* be a number: that many draws among every entry. The answer's heap counts for a box that rolls, or one sold through
|
|
61
|
+
* the oracle (`oracle`: a box that doesn't roll but one `buy` can't carry, `buyFits`). The program refuses a box whose
|
|
62
|
+
* one open doesn't fit at its upsert, and a purchase that doesn't at `open_box`, where it also reads what the accounts
|
|
63
|
+
* hold (`PackTooLarge`).
|
|
64
|
+
*/
|
|
65
|
+
export declare function drawsFit(entries: any, slots: any, opens?: number, { odds, shares, fates, bytes, oracle }?: {
|
|
66
|
+
bytes?: bigint | undefined;
|
|
67
|
+
fates?: number | undefined;
|
|
68
|
+
odds?: number | undefined;
|
|
69
|
+
oracle?: boolean | undefined;
|
|
70
|
+
shares?: number | undefined;
|
|
71
|
+
}): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether one `buy` of a box that doesn't roll (one entry, given `draws` times: its slots' counts) fits one transaction
|
|
74
|
+
* (`catalog::buy_fits`): its accounts, its instructions and its compute, each prize's at the most it takes. A named NFT
|
|
75
|
+
* is given once at most. A box that doesn't fit sells through the oracle (`open_box`), its answer's heap counted
|
|
76
|
+
* (`drawsFit` with `oracle`), and can't give a roll (`PackTooLarge`). `box`: the box's args.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buyFits(box: any, draws?: any): boolean;
|
|
79
|
+
/** The most program rent and fee one order takes from its player, in lamports (0.01 SOL): a client cap (`opensAnOrder`). */
|
|
80
|
+
export declare const ORDER_COST_CAP = 10000000n;
|
|
81
|
+
/**
|
|
82
|
+
* The most opens of `lootBox` a client puts in one order: what one oracle answer draws (`drawsFit`), and what keeps the
|
|
83
|
+
* order's rent and the player's fee within `ORDER_COST_CAP` (`orderBytes` with `items`, so with the box's shares). At
|
|
84
|
+
* least one: a box whose one open is over the cap is still bought one open an order. A purchase of more is several
|
|
85
|
+
* orders, each its own answer.
|
|
86
|
+
*/
|
|
87
|
+
export declare function opensAnOrder(lootBox: any, { shares, items, rentPerByte }?: {
|
|
88
|
+
items?: {} | undefined;
|
|
89
|
+
rentPerByte?: bigint | undefined;
|
|
90
|
+
shares?: any;
|
|
91
|
+
}): number;
|
|
92
|
+
export declare const LIST_HEAD_BYTES = 7;
|
|
93
|
+
/** A limit record (a wallet's count of a box, a recipe or a lottery round; a grant's claim count): key, count, window, in it. */
|
|
94
|
+
export declare const LIMIT_RECORD_BYTES = 28;
|
|
95
|
+
/** A round a grant paid a wallet: its key alone. */
|
|
96
|
+
export declare const ROUND_RECORD_BYTES = 16;
|
|
97
|
+
/** A contest's entry: of tokens, and of NFTs (the NFT, its place on its side, the picks taken). */
|
|
98
|
+
export declare const CONTEST_ENTRY_BYTES: Readonly<{
|
|
99
|
+
tokens: 43;
|
|
100
|
+
nfts: 83;
|
|
101
|
+
}>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The accounts a route the player pays or asks for (a craft, a buy, a grant's claim) passes after a roll's box and
|
|
3
|
-
* order (`order::askable`, the client's `rollMints`): for each token prize of box `key`, in order, its pool and the
|
|
4
|
-
* pool's mint, or the mint it mints from. Up to 10 distinct accounts a box.
|
|
5
|
-
*/
|
|
6
|
-
export declare function rollMintKeys(key: any, m: any): any;
|
|
7
1
|
/**
|
|
8
2
|
* The transaction a player sends to craft `recipe`, estimated (txsize.mjs): the craft's own accounts, then each
|
|
9
|
-
* line's (craft.rs; a roll's
|
|
3
|
+
* line's (craft.rs; a roll's box and order), a compute limit (a big recipe needs more
|
|
10
4
|
* than the default) and, for each token it gives, the player's token account created if missing.
|
|
11
5
|
*/
|
|
12
6
|
export declare function craftSize(recipe: any, m: any, { detail }?: {
|
|
@@ -77,10 +71,11 @@ export declare function settleSize(b: any, o: any, m: any): {
|
|
|
77
71
|
/**
|
|
78
72
|
* The transaction a player sends to buy box `b` (buy.rs), estimated as `openBoxSize` is: its compute limit and price,
|
|
79
73
|
* the player's token account of the currency created if missing, then `buy`: its own accounts, what the gate takes
|
|
80
|
-
* (a list's proof, or the NFT shown), the accounts its shares name, and each prize's (prize.rs; a roll's
|
|
81
|
-
*
|
|
74
|
+
* (a list's proof, or the NFT shown), the accounts its shares name, and each prize's (prize.rs; a roll's box and
|
|
75
|
+
* order), for each draw of a sale (a fixed amount of tokens once). `count`: the sales in one purchase.
|
|
82
76
|
*/
|
|
83
|
-
export declare function buySize(b: any, m: any, { detail }?: {
|
|
77
|
+
export declare function buySize(b: any, m: any, { detail, count }?: {
|
|
78
|
+
count?: number | undefined;
|
|
84
79
|
detail?: boolean | undefined;
|
|
85
80
|
}): any;
|
|
86
81
|
/** The address a plan stands in for the owner's wallet before one connects (plan.mjs `placeholderContext`). Nobody
|
package/types/economy/cost.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function setupCost(plan: any, economy: any): {
|
|
|
13
13
|
/**
|
|
14
14
|
* What each action costs whoever signs it while the economy runs: games.fun's fee, the network's, and for anything
|
|
15
15
|
* that asks MagicBlock's oracle for a random number (a box's open, a lottery's draw, the authority's `roll`) the
|
|
16
|
-
* oracle's own
|
|
16
|
+
* oracle's own fee (`oracleSol`, model.mjs ORACLE_FEE).
|
|
17
17
|
*/
|
|
18
18
|
export declare function actionCosts(economy: any, { now }?: Readonly<Record<string, any>>): any[];
|
|
19
19
|
/** Setup and play costs for a spec, or its refusals. */
|
|
@@ -41,6 +41,7 @@ export declare function cost(economy: any, { now, only, live }?: {
|
|
|
41
41
|
built: any[];
|
|
42
42
|
instructions: any;
|
|
43
43
|
signers: any[];
|
|
44
|
+
alone: boolean;
|
|
44
45
|
}[];
|
|
45
46
|
approvals: number;
|
|
46
47
|
freshKeys: any[];
|
package/types/economy/live.d.mts
CHANGED
|
@@ -7,13 +7,14 @@ export declare function freshAddresses(names: any, random?: typeof randomBytes):
|
|
|
7
7
|
* The transactions that put `economy` live for `owner`, with `keys` the addresses of the fresh accounts (each signs
|
|
8
8
|
* the transaction that creates it). `live`: what is already live (a change publishes only what differs).
|
|
9
9
|
*/
|
|
10
|
-
export declare function prepare(economy: any, { owner, keys, live, now, rent, only }: {
|
|
10
|
+
export declare function prepare(economy: any, { owner, keys, live, now, rent, only, slot }: {
|
|
11
11
|
keys: any;
|
|
12
12
|
live?: null | undefined;
|
|
13
13
|
now?: number | undefined;
|
|
14
14
|
only?: null | undefined;
|
|
15
15
|
owner: any;
|
|
16
16
|
rent: any;
|
|
17
|
+
slot?: null | undefined;
|
|
17
18
|
}): {
|
|
18
19
|
ok: boolean;
|
|
19
20
|
refusals: any[];
|
|
@@ -33,6 +34,7 @@ export declare function prepare(economy: any, { owner, keys, live, now, rent, on
|
|
|
33
34
|
built: any[];
|
|
34
35
|
instructions: any;
|
|
35
36
|
signers: any[];
|
|
37
|
+
alone: boolean;
|
|
36
38
|
}[];
|
|
37
39
|
approvals: number;
|
|
38
40
|
freshKeys: any[];
|
|
@@ -54,6 +56,7 @@ export declare function prepare(economy: any, { owner, keys, live, now, rent, on
|
|
|
54
56
|
mints: {};
|
|
55
57
|
keys: any;
|
|
56
58
|
rent: any;
|
|
59
|
+
slot: null;
|
|
57
60
|
};
|
|
58
61
|
} | {
|
|
59
62
|
refusals?: undefined;
|
|
@@ -66,6 +69,7 @@ export declare function prepare(economy: any, { owner, keys, live, now, rent, on
|
|
|
66
69
|
built: any[];
|
|
67
70
|
instructions: any;
|
|
68
71
|
signers: any[];
|
|
72
|
+
alone: boolean;
|
|
69
73
|
}[];
|
|
70
74
|
approvals: number;
|
|
71
75
|
freshKeys: any[];
|
|
@@ -79,8 +83,19 @@ export declare function prepare(economy: any, { owner, keys, live, now, rent, on
|
|
|
79
83
|
mints: {};
|
|
80
84
|
keys: any;
|
|
81
85
|
rent: any;
|
|
86
|
+
slot: null;
|
|
82
87
|
};
|
|
83
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* The parts of an economy whose widest transaction passes a legacy transaction, so a player sends it in one approval
|
|
91
|
+
* only with the project's standing lookup table: a box's open or settle and a craft the checker sizes past one
|
|
92
|
+
* (W-TX-V0, W-SETTLE-V0), an auction whose bids are NFTs (each moves with its own accounts), and a farm of another
|
|
93
|
+
* collection's NFTs (a pNFT's stake and exit carry its token record and rule set). [{ where, why }]
|
|
94
|
+
*/
|
|
95
|
+
export declare function wideParts(m: any, warnings?: any[]): {
|
|
96
|
+
where: any;
|
|
97
|
+
why: string;
|
|
98
|
+
}[];
|
|
84
99
|
/**
|
|
85
100
|
* The spec once its setup landed: every part keeps the program number it was given, and `live` names the game, its
|
|
86
101
|
* collection, the treasury, the mints made and the program, with a copy of what is now on chain.
|
|
@@ -10,12 +10,13 @@ export declare const FEES: Readonly<{
|
|
|
10
10
|
* on `open_box` (order.rs), whoever sends `draw_lottery` (lottery.rs, its `payer`), the authority on `roll`
|
|
11
11
|
* (roll.rs). Measured on devnet: 500,000 lamports per open.
|
|
12
12
|
*/
|
|
13
|
-
export declare const ORACLE_FEE =
|
|
13
|
+
export declare const ORACLE_FEE = 800000n;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* What js/play's throwaway settle key is funded with, in the purchase's own transaction, for each prize its settle may
|
|
16
|
+
* open or mint (`loot.SETTLE_RENT_UNIT`): whoever settles pays that rent, the order lends nothing. What the settle
|
|
17
|
+
* doesn't spend goes back to the player when the key empties itself, and all of it when the roll fails.
|
|
17
18
|
*/
|
|
18
|
-
export declare const
|
|
19
|
+
export declare const SETTLE_RENT_UNIT = 6000000n;
|
|
19
20
|
/** Rent: (bytes + 128) × 5,080 lamports, as `solana rent` reads it on devnet and mainnet-beta. */
|
|
20
21
|
export declare const RENT_PER_BYTE = 5080n;
|
|
21
22
|
export declare const ACCOUNT_OVERHEAD = 128n;
|
|
@@ -35,29 +36,36 @@ export declare const COLLECTIBLE_RENT = 3100000n;
|
|
|
35
36
|
export declare const SIGNATURE_FEE = 5000n;
|
|
36
37
|
export declare const LAMPORTS_PER_SOL = 1000000000n;
|
|
37
38
|
export declare const WSOL = "So11111111111111111111111111111111111111112";
|
|
38
|
-
/** The
|
|
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. */
|
|
39
42
|
export declare const LIMITS: Readonly<{
|
|
40
|
-
shares: 4;
|
|
41
|
-
entries: 8;
|
|
42
43
|
callbackAccounts: 21;
|
|
43
|
-
|
|
44
|
-
collectiblesPerCraft:
|
|
45
|
-
places: 8;
|
|
46
|
-
tiers: 4;
|
|
47
|
-
boosts: 4;
|
|
48
|
-
growths: 4;
|
|
49
|
-
gates: 4;
|
|
50
|
-
odds: 4;
|
|
44
|
+
tiers: 256;
|
|
45
|
+
collectiblesPerCraft: 255;
|
|
51
46
|
vouchers: 3;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
nameBytes: 32;
|
|
55
|
-
uriBytes: 200;
|
|
56
|
-
keyBytes: 32;
|
|
47
|
+
compressedNameBytes: 32;
|
|
48
|
+
compressedUriBytes: 200;
|
|
57
49
|
maxBoostBps: 1000000;
|
|
58
50
|
maxTierBps: 110000;
|
|
51
|
+
boxEntries: 128;
|
|
52
|
+
boxSlots: 32;
|
|
53
|
+
boxOdds: 32;
|
|
54
|
+
boxFates: 64;
|
|
55
|
+
entryPrizes: 14;
|
|
56
|
+
itemTraits: 64;
|
|
57
|
+
traitKeyBytes: 64;
|
|
58
|
+
recipeLines: 48;
|
|
59
|
+
farmRules: 32;
|
|
60
|
+
growthSteps: 128;
|
|
61
|
+
contestSides: 1024;
|
|
62
|
+
deciders: 32;
|
|
63
|
+
collections: 32;
|
|
64
|
+
lotteryRuns: 64;
|
|
65
|
+
farmEnds: 100000;
|
|
59
66
|
}>;
|
|
60
|
-
/** Attribute names the program writes itself, which a recipe cannot copy and `Set` cannot change (craft.rs, make.rs)
|
|
67
|
+
/** Attribute names the program writes itself, which a recipe cannot copy and `Set` cannot change (craft.rs, make.rs),
|
|
68
|
+
* and the two a collectible's life keeps (`lifeLines`: its uses and its next use). */
|
|
61
69
|
export declare const RESERVED_ATTRIBUTES: readonly string[];
|
|
62
70
|
export declare const RARITIES: readonly string[];
|
|
63
71
|
/** A refusal raised while reading a value; the checker turns it into a refusal with a code. */
|
|
@@ -79,18 +87,43 @@ export declare function toBps(percent: any): number | null;
|
|
|
79
87
|
/** "7d" → 604800. A number is seconds already. */
|
|
80
88
|
export declare function toSeconds(duration: any): number;
|
|
81
89
|
/**
|
|
82
|
-
* How long what lands in a farm's rewards
|
|
83
|
-
*
|
|
90
|
+
* How long what lands in a farm's rewards vault takes to be released to its seats, in seconds (a farm that shares what
|
|
91
|
+
* lands, `farm.rs` `release_span`): its longest lock tier, and a day at least.
|
|
84
92
|
*/
|
|
85
93
|
export declare const releaseSeconds: (f: any) => number;
|
|
86
94
|
/** A farm's release span in words: "a day", "30 days", "36 hours". */
|
|
87
95
|
export declare function releaseWords(f: any): string;
|
|
96
|
+
/**
|
|
97
|
+
* What a run sent late does, in words (schedule.rs `catches_up`): a sealed schedule's fixed amount pays every run due;
|
|
98
|
+
* any other run pays once, for the latest run due, and the runs before it lapse.
|
|
99
|
+
*/
|
|
100
|
+
export declare const lateRunWords: (s: any) => "a run missed is missed: one sent late pays once, for the latest run due, and the runs before it lapse" | "a run sent late pays every run due since";
|
|
101
|
+
/**
|
|
102
|
+
* Whether a farm's boost reads a number its own growth writes (`refresh_seat` writes it): each level counts from when it is
|
|
103
|
+
* written, so a page or a keeper should refresh seats.
|
|
104
|
+
*/
|
|
105
|
+
export declare const boostReadsGrowth: (f: any) => any;
|
|
106
|
+
/** A box's roll against what is in stock, in words (order.rs): the odds stay as written, whatever is left. */
|
|
107
|
+
export declare const STOCK_WORDS = "The odds stay as written whatever is in stock: a draw that lands on an outcome that can\u2019t 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\u2019s 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";
|
|
108
|
+
/**
|
|
109
|
+
* What a box that rolls does once an outcome can't be given (`whenOut`, order.rs `WhenOut`), in words. `sold`: it is
|
|
110
|
+
* sold (an open checks the stock); a box only other routes roll (a prize, a mission) never stops a sale.
|
|
111
|
+
*/
|
|
112
|
+
export declare function whenOutWords(b: any, { sold }?: {
|
|
113
|
+
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" | "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 any outcome couldn’t cover this purchase’s draws and those of purchases still waiting for the oracle (an item’s units left, a pool’s tokens, a stash’s NFTs), 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";
|
|
88
115
|
/**
|
|
89
116
|
* What the end of a sharing farm that `runs` means, in words, or null (no end, or a fixed rate): its release keeps its
|
|
90
|
-
* pace, so what it has not let go by the end stays in
|
|
91
|
-
*
|
|
117
|
+
* 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
|
|
118
|
+
* a seat forfeits after the end.
|
|
92
119
|
*/
|
|
93
120
|
export declare function farmEndWords(f: any): string | null;
|
|
121
|
+
/**
|
|
122
|
+
* The token a farm's rewards are in (`rewards`, a token key): by default its staked token, or for a farm of
|
|
123
|
+
* collectibles the project's currency. One that names a pool (as farms did before they had a vault of their own) is
|
|
124
|
+
* read as that pool's token, and the checker refuses it.
|
|
125
|
+
*/
|
|
126
|
+
export declare function farmRewardsToken(f: any, tokens: any, currencyKey: any, poolCurrency?: Map<any, any>): any;
|
|
94
127
|
/** A raise's or a shift's `by`: a number, or for a time a duration, which may be negative ("-1d"). */
|
|
95
128
|
export declare function toBy(by: any): any;
|
|
96
129
|
/** "publish", "publish+7d" or a date → Unix seconds, counted from `now` (Unix seconds) for the first two. */
|
|
@@ -130,8 +163,9 @@ export declare function model(economy: any, { now }?: {
|
|
|
130
163
|
/** The project's number among its owner's: its address is ["project", owner, number]. */
|
|
131
164
|
projectNumber: any;
|
|
132
165
|
items: any;
|
|
133
|
-
pools: any
|
|
166
|
+
pools: any;
|
|
134
167
|
stashes: any;
|
|
168
|
+
tables: any;
|
|
135
169
|
boxes: never[];
|
|
136
170
|
payments: any;
|
|
137
171
|
recipes: any;
|
|
@@ -155,12 +189,12 @@ export declare function model(economy: any, { now }?: {
|
|
|
155
189
|
export declare function stashNfts(s: any): any;
|
|
156
190
|
/**
|
|
157
191
|
* A prize as the spec writes it (`$defs/prize`), read the one way: a line { gives, … } as a recipe's `out` lines are:
|
|
158
|
-
* "item" (`item`), "tokens" (`amount`, `from` "mint" with `currency`, or "pool:<key>"),
|
|
192
|
+
* "item" (`item`), "tokens" (`amount`, `from` "mint" with `currency`, or "pool:<key>"),
|
|
159
193
|
* "nft" (`nft`, an address the stash `stash` lists) or "roll" (a roll of `box`; in a recipe, on the collectible kept
|
|
160
194
|
* at `on`). A grant's older `gives` ({ item }, { pool, amount }, { roll }) reads as its line. Null for none.
|
|
161
195
|
*/
|
|
162
196
|
export declare function prizeLine(p: any): any;
|
|
163
|
-
/** The pool a prize line pays from:
|
|
197
|
+
/** The pool a prize line pays from: tokens' "pool:<key>". */
|
|
164
198
|
export declare const prizePool: (p: any) => any;
|
|
165
199
|
/** The token a prize line pays in: its pool's, or the one it mints. */
|
|
166
200
|
export declare const prizeToken: (p: any, m: any) => any;
|
|
@@ -203,25 +237,49 @@ export declare function rollsOf(m: any): {
|
|
|
203
237
|
by: any;
|
|
204
238
|
route: any;
|
|
205
239
|
}[];
|
|
206
|
-
/** A prize line in words: "one Badge", "100 GOLD from “rewards”", "100 GOLD, minted", "
|
|
240
|
+
/** A prize line in words: "one Badge", "100 GOLD from “rewards”", "100 GOLD, minted", "the NFT ab12…cd34 of “vault”", "a roll of “Chest”". */
|
|
207
241
|
export declare function prizeWords(p: any, m: any): string;
|
|
208
242
|
/**
|
|
209
|
-
* What one box outcome gives (catalog.rs
|
|
210
|
-
* "
|
|
243
|
+
* What one box outcome gives (catalog.rs), each in the box's own words: "item", "pay" (a fixed amount from a pool),
|
|
244
|
+
* "stash" (an NFT of a stash at random), "mint"
|
|
211
245
|
* (tokens minted), "nft" (one NFT a stash lists) or "roll" (a roll of another box). A bundle gives its `prizes`; "burn"
|
|
212
246
|
* and "nothing" give none.
|
|
213
247
|
*/
|
|
214
248
|
export declare function outcomeParts(o: any): any;
|
|
215
|
-
/** Whether an outcome burns the payment in place of the box's split: "burn", or a bundle that says `burns`. */
|
|
216
|
-
export declare const outcomeBurns: (o: any) => boolean;
|
|
217
249
|
/** Whether a box leaves its outcome to the oracle (catalog.rs `rolls`): more than one outcome, or an NFT at random. */
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
250
|
+
/** How many draws one open of a box makes: its slots' counts, or one. */
|
|
251
|
+
export declare const drawsOf: (b: any) => any;
|
|
252
|
+
/** Whether a box's prize costs its settle a collectible's rent: an item minted as a Core NFT, or a fresh compressed one
|
|
253
|
+
* (its traits' Sheet). A plain compressed NFT costs no rent. */
|
|
254
|
+
export declare const holdsRent: (p: any, m: any) => boolean;
|
|
255
|
+
/**
|
|
256
|
+
* The units of `SETTLE_RENT_UNIT` a settle of box `b`'s order may spend (`loot.settleRent`), which js/play funds its
|
|
257
|
+
* throwaway settle key with and gets back unspent: for each draw, each part of the richest outcome that opens an
|
|
258
|
+
* account (a collectible, a fresh compressed NFT's Sheet, a stash's NFT); once an order, each source of tokens it may
|
|
259
|
+
* pay, and the fate of the NFT it rolls on.
|
|
260
|
+
*/
|
|
261
|
+
export declare function settleUnits(b: any, m: any): number;
|
|
262
|
+
export declare const boxRolls: (b: any, m: any) => any;
|
|
263
|
+
/** Whether a box sells with `buy`, in one transaction (buy.rs): it doesn't roll and rolls on no NFT, any number of draws
|
|
264
|
+
* a sale (a fixed pack: its prizes given once for each draw). */
|
|
265
|
+
export declare const boxBuys: (b: any, m: any) => boolean;
|
|
266
|
+
/**
|
|
267
|
+
* What a recipe's lines owe the life of each collectible they take (an item's `life`), as the program's needs and
|
|
268
|
+
* raises (craft.rs `Need`, `Raise`), at each collectible's place in the recipe (each burned unit, then each kept one, in
|
|
269
|
+
* line order; a pay line takes none): ready after `readyAfter` (`made` older than it), for `lasts` (`made` within it),
|
|
270
|
+
* on every line that takes it; `uses` times (`used` raised by 1 up to it) and a `cooldown` (`next_use` passed, then
|
|
271
|
+
* raised to that far from now) on a line that uses it or takes it staked; a renew line counts its uses from 0 again.
|
|
272
|
+
* { needs, raises }, in the program's shapes.
|
|
273
|
+
*/
|
|
274
|
+
export declare function lifeLines(r: any, m: any): {
|
|
275
|
+
needs: any[];
|
|
276
|
+
raises: any[];
|
|
277
|
+
};
|
|
221
278
|
/** A lottery's place as { percent, prize }: a number is a share of the pot and no prize. */
|
|
222
279
|
export declare const placeOf: (p: any) => {
|
|
223
280
|
percent: any;
|
|
224
281
|
prize: any;
|
|
282
|
+
times: any;
|
|
225
283
|
};
|
|
226
284
|
/** "pool:house" → { kind: 'pool', key: 'house' }; "burn" → { kind: 'burn' }. */
|
|
227
285
|
export declare function destination(to: any): {
|
|
@@ -237,7 +295,8 @@ export declare const sharesOf: (split: any) => any;
|
|
|
237
295
|
* The program's `To` for a destination, with pool indexes resolved (the IDL's own shape). A wallet ("wallet:<address>")
|
|
238
296
|
* is paid at its own token account of the part's currency (the program opens it when it is not there); "treasury" is the game's treasury wallet's; "chosen"
|
|
239
297
|
* (or "chosen:<item>") is the one the buyer names when they buy; "lottery:<key>" is that lottery's pot
|
|
240
|
-
* ("@pot:<id>", which the plan resolves once the game is
|
|
298
|
+
* ("@pot:<id>") and "farm:<key>" that farm's rewards vault ("@rewards:<id>"), which the plan resolves once the game is
|
|
299
|
+
* known.
|
|
241
300
|
*/
|
|
242
301
|
export declare function toEnum(to: any, m: any): "Burn" | "Treasury" | {
|
|
243
302
|
Pool: any[];
|
|
@@ -361,3 +420,12 @@ export declare function weights(box: any): any;
|
|
|
361
420
|
export declare function poolTakers(m: any): any[];
|
|
362
421
|
/** Every place the spec sends money into a pool. */
|
|
363
422
|
export declare function poolFillers(m: any): any[];
|
|
423
|
+
/**
|
|
424
|
+
* Every place the spec sends money into a farm's rewards vault ("farm:<key>"): a split's share, a schedule that pays it,
|
|
425
|
+
* a craft that pays it, the owner's seed, an early exit's fee into its own vault. [{ farm, by, how }]
|
|
426
|
+
*/
|
|
427
|
+
export declare function farmFillers(m: any): {
|
|
428
|
+
farm: any;
|
|
429
|
+
by: string;
|
|
430
|
+
how: string;
|
|
431
|
+
}[];
|