@xgamesfun/solana 0.0.0-stage → 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/DISCLAIMER.md +41 -0
- package/LICENSE +202 -0
- package/NOTICE +13 -0
- package/README.md +172 -2
- package/bin/xsolana.mjs +189 -0
- package/examples/artwork-auction.json +51 -0
- package/examples/blind-forge.json +128 -0
- package/examples/coin-flip-arena.json +103 -0
- package/examples/duel-arena.json +137 -0
- package/examples/elements-set.json +274 -0
- package/examples/event-badges.json +67 -0
- package/examples/expedition-guild.json +154 -0
- package/examples/fair-presale.json +48 -0
- package/examples/falling-drop.json +90 -0
- package/examples/guild-missions.json +137 -0
- package/examples/halving-seasons.json +107 -0
- package/examples/hero-trials.json +93 -0
- package/examples/ideas.json +789 -0
- package/examples/level-ladder.json +65 -0
- package/examples/merge-2048.json +128 -0
- package/examples/nft-raffle.json +33 -0
- package/examples/paper-hands-farm.json +44 -0
- package/examples/partner-vault.json +112 -0
- package/examples/sacrifice-raffle.json +118 -0
- package/examples/scorched-treasury.json +84 -0
- package/examples/shelter-fair.json +164 -0
- package/examples/spark-pity.json +153 -0
- package/examples/stakers-draw.json +118 -0
- package/examples/star-fleet.json +150 -0
- package/examples/starforce.json +116 -0
- package/examples/stud-farm.json +134 -0
- package/examples/team-vesting.json +70 -0
- package/examples/trade-in-shop.json +168 -0
- package/js/approve/details.mjs +263 -0
- package/js/approve/ed25519.mjs +36 -0
- package/js/approve/live-check.mjs +144 -0
- package/js/approve/page.html +86 -0
- package/js/approve/page.js +203 -0
- package/js/approve/server.mjs +726 -0
- package/js/chain/base58.js +73 -0
- package/js/chain/borsh.js +270 -0
- package/js/chain/bytes.js +141 -0
- package/js/chain/core.js +181 -0
- package/js/chain/curve.js +52 -0
- package/js/chain/lookup.js +279 -0
- package/js/chain/mint.js +96 -0
- package/js/chain/pda.js +66 -0
- package/js/chain/programs.js +102 -0
- package/js/chain/rpc.js +219 -0
- package/js/chain/sha256.js +68 -0
- package/js/chain/token.js +85 -0
- package/js/chain/token2022.js +247 -0
- package/js/chain/tx.js +224 -0
- package/js/client/accounts.js +679 -0
- package/js/client/compressed.js +46 -0
- package/js/client/grant.js +299 -0
- package/js/client/idl/loot.js +2 -0
- package/js/client/idl/loot.json +17206 -0
- package/js/client/index.js +10 -0
- package/js/client/ix.js +2887 -0
- package/js/client/pda.js +114 -0
- package/js/client/policy.js +69 -0
- package/js/client/random.js +70 -0
- package/js/client/sizes.js +297 -0
- package/js/client/traits.js +44 -0
- package/js/connect/connect.mjs +182 -0
- package/js/economy/check.mjs +2236 -0
- package/js/economy/cost.mjs +185 -0
- package/js/economy/examples.mjs +114 -0
- package/js/economy/explain.mjs +239 -0
- package/js/economy/guide.mjs +232 -0
- package/js/economy/legal.mjs +15 -0
- package/js/economy/live.mjs +130 -0
- package/js/economy/model.mjs +698 -0
- package/js/economy/plan.mjs +1155 -0
- package/js/economy/schema.json +3071 -0
- package/js/economy/secrets.mjs +60 -0
- package/js/economy/simulate.mjs +1019 -0
- package/js/economy/txsize.mjs +45 -0
- package/js/economy/validate.mjs +85 -0
- package/js/index.js +10 -0
- package/js/mcp/server.mjs +113 -0
- package/js/mcp/tools.mjs +485 -0
- package/js/play/index.js +2855 -0
- package/js/play/keys.js +167 -0
- package/js/results/index.js +184 -0
- package/js/results/wire.js +90 -0
- package/package.json +100 -4
- package/release.json +8 -0
- package/skills/xsolana-economy/SKILL.md +109 -0
- package/skills/xsolana-economy/references/after-launch.md +124 -0
- package/skills/xsolana-economy/references/apps.md +193 -0
- package/skills/xsolana-economy/references/sentence-to-spec.md +180 -0
- package/skills/xsolana-economy/references/telling-the-person.md +134 -0
- package/types/chain/base58.d.ts +10 -0
- package/types/chain/borsh.d.ts +23 -0
- package/types/chain/bytes.d.ts +45 -0
- package/types/chain/core.d.ts +52 -0
- package/types/chain/curve.d.ts +1 -0
- package/types/chain/lookup.d.ts +194 -0
- package/types/chain/mint.d.ts +25 -0
- package/types/chain/pda.d.ts +25 -0
- package/types/chain/programs.d.ts +65 -0
- package/types/chain/rpc.d.ts +68 -0
- package/types/chain/sha256.d.ts +1 -0
- package/types/chain/token.d.ts +141 -0
- package/types/chain/token2022.d.ts +53 -0
- package/types/chain/tx.d.ts +60 -0
- package/types/client/accounts.d.ts +318 -0
- package/types/client/compressed.d.ts +29 -0
- package/types/client/grant.d.ts +170 -0
- package/types/client/idl/loot.d.ts +4498 -0
- package/types/client/index.d.ts +9 -0
- package/types/client/ix.d.ts +5315 -0
- package/types/client/pda.d.ts +95 -0
- package/types/client/policy.d.ts +48 -0
- package/types/client/random.d.ts +26 -0
- package/types/client/sizes.d.ts +101 -0
- package/types/client/traits.d.ts +12 -0
- package/types/economy/check.d.mts +100 -0
- package/types/economy/cost.d.mts +69 -0
- package/types/economy/examples.d.mts +27 -0
- package/types/economy/explain.d.mts +19 -0
- package/types/economy/guide.d.mts +140 -0
- package/types/economy/legal.d.mts +12 -0
- package/types/economy/live.d.mts +124 -0
- package/types/economy/model.d.mts +431 -0
- package/types/economy/plan.d.mts +1014 -0
- package/types/economy/secrets.d.mts +4 -0
- package/types/economy/simulate.d.mts +164 -0
- package/types/economy/txsize.d.mts +17 -0
- package/types/economy/validate.d.mts +3 -0
- package/types/index.d.ts +9 -0
- package/types/mcp/tools.d.mts +635 -0
- package/types/play/index.d.ts +880 -0
- package/types/play/keys.d.ts +51 -0
- package/types/results/index.d.ts +155 -0
- package/types/results/wire.d.ts +122 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/** The bytes of one time in a farm's record of ends (`decodeEnds`): rent its writer pays, not refunded when a seat leaves. */
|
|
2
|
+
export declare const END_BYTES = 44;
|
|
3
|
+
/** The bytes of a farm's record of ends with no time in it, its owner's rent at `open_farm`. */
|
|
4
|
+
export declare const ENDS_HEAD_BYTES = 7;
|
|
5
|
+
/** Account tags: each account's first byte, as the program writes it; every list of records (`decodeList`) is 26. */
|
|
6
|
+
export declare const TAGS: Readonly<{
|
|
7
|
+
Platform: 1;
|
|
8
|
+
Project: 2;
|
|
9
|
+
Item: 3;
|
|
10
|
+
LootBox: 4;
|
|
11
|
+
Order: 5;
|
|
12
|
+
Schedule: 6;
|
|
13
|
+
Lottery: 7;
|
|
14
|
+
Recipe: 8;
|
|
15
|
+
Hold: 9;
|
|
16
|
+
Contest: 10;
|
|
17
|
+
Sheet: 12;
|
|
18
|
+
Traits: 13;
|
|
19
|
+
LotteryRound: 16;
|
|
20
|
+
Farm: 17;
|
|
21
|
+
Seat: 18;
|
|
22
|
+
Proven: 19;
|
|
23
|
+
Auction: 20;
|
|
24
|
+
Offer: 22;
|
|
25
|
+
Listing: 23;
|
|
26
|
+
Profile: 24;
|
|
27
|
+
Grant: 27;
|
|
28
|
+
Table: 25;
|
|
29
|
+
List: 26;
|
|
30
|
+
Ends: 29;
|
|
31
|
+
}>;
|
|
32
|
+
/** The kind of a loot account from its first byte, or null. */
|
|
33
|
+
export declare const accountKind: (data: any) => string | null;
|
|
34
|
+
/** A loot account of the named kind (one the IDL describes, or a `LotteryRound`). Throws when the data is not one. */
|
|
35
|
+
export declare const decode: (name: any, data: any) => any;
|
|
36
|
+
/** Any loot account: { kind, value }, or null for data that is no loot account. */
|
|
37
|
+
export declare function decodeAny(data: any): {
|
|
38
|
+
kind: string;
|
|
39
|
+
value: any;
|
|
40
|
+
} | null;
|
|
41
|
+
/**
|
|
42
|
+
* A list of records (tag 26, `list.rs`): { width, records } in their order: a wallet's counts
|
|
43
|
+
* (`["counts", project, wallet]`) and a grant's claims are limit records (28 bytes, `readLimit`), a grant's rounds 16
|
|
44
|
+
* bytes, a contest's entries 43 or 83 (`decodeEntries`).
|
|
45
|
+
*/
|
|
46
|
+
export declare function decodeList(data: any): {
|
|
47
|
+
width: number;
|
|
48
|
+
records: Uint8Array<ArrayBufferLike>[];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A farm's record of when its seats stop earning (`["ends", farm]`, tag 29; `Farm.keeps_ends`): its times in order, each
|
|
52
|
+
* `{ at, rewardPerWeight, weight, seats }`: the time (Unix seconds), `reward_per_weight` there once the farm has walked past
|
|
53
|
+
* it, the weight that stops earning then, and the seats that still need the record.
|
|
54
|
+
*/
|
|
55
|
+
export declare function decodeEnds(data: any): {
|
|
56
|
+
at: bigint;
|
|
57
|
+
rewardPerWeight: bigint;
|
|
58
|
+
weight: bigint;
|
|
59
|
+
seats: number;
|
|
60
|
+
}[];
|
|
61
|
+
/** The first 16 bytes of the sha256 of `parts` (addresses, bytes or u64s): a record's key in a list. */
|
|
62
|
+
export declare const recordKey16: (...parts: any[]) => Uint8Array<ArrayBuffer>;
|
|
63
|
+
/** The key of a wallet's count for a box, a recipe (incarnation 0) or a lottery (its incarnation), in its counts. */
|
|
64
|
+
export declare const countKey: (record: any, incarnation?: number) => Uint8Array<ArrayBuffer>;
|
|
65
|
+
/** What the limit record at `key` counts in a decoded list (`decodeList`, or null for none): { count, window, inWindow }. */
|
|
66
|
+
export declare function readLimit(list: any, key: any): {
|
|
67
|
+
count: number;
|
|
68
|
+
window: number;
|
|
69
|
+
inWindow: number;
|
|
70
|
+
};
|
|
71
|
+
/** A fetched list account, or null for none (or an empty System account someone sent SOL to, which the program opens
|
|
72
|
+
* as the list). Any other owner or layout is refused. */
|
|
73
|
+
export declare function readListAccount(account: any): {
|
|
74
|
+
width: number;
|
|
75
|
+
records: Uint8Array<ArrayBufferLike>[];
|
|
76
|
+
} | null;
|
|
77
|
+
/**
|
|
78
|
+
* A contest's entries (`["entries", contest, incarnation, 0]`), in the list's order (by player): [{ player, side,
|
|
79
|
+
* amount (0 once paid or refunded; 1 while a contest of NFTs holds its NFT), bits (`CLAIMED`, `ENDED`), nft, place (how
|
|
80
|
+
* many entered its side before it), taken (the losers' NFTs a winner took) }]. A claim names an entry by its index here.
|
|
81
|
+
*/
|
|
82
|
+
export declare function decodeEntries(data: any): any[];
|
|
83
|
+
/** A winner's first claim came (its prize given or forgone); a winner ended its picks early. */
|
|
84
|
+
export declare const CLAIMED = 1;
|
|
85
|
+
export declare const ENDED = 2;
|
|
86
|
+
/** How many losers' NFTs a winner of a contest of NFTs takes: the share fixed at the decision, one more for an early
|
|
87
|
+
* place on its side. */
|
|
88
|
+
export declare const shareOf: (contest: any, entry: any) => number;
|
|
89
|
+
/** What a count allows `n` more of at `now` under `limit` ({ total, per_window, window }, 0 is no limit; a lottery's
|
|
90
|
+
* window is its round plus one, given as `window`). */
|
|
91
|
+
export declare function countAllows(count: any, limit: any, now: any, n?: number, window?: number): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* A Sheet (`["sheet", project, nft]`): what the project wrote about an NFT it has no authority over. Returns { project, nft,
|
|
94
|
+
* attributes: [{ key, value }] }. A Sheet never written reads as none: pass `null` data for no account.
|
|
95
|
+
*/
|
|
96
|
+
export declare function decodeSheet(data: any): {
|
|
97
|
+
project: string;
|
|
98
|
+
nft: string;
|
|
99
|
+
attributes: {
|
|
100
|
+
key: string;
|
|
101
|
+
value: string;
|
|
102
|
+
}[];
|
|
103
|
+
} | null;
|
|
104
|
+
/** A player's profile (`["profile", project, wallet]`): { project, wallet, attributes }, what the project keeps about
|
|
105
|
+
* the wallet (its XP, level, rank). Its layout is a Sheet's, under its own tag. */
|
|
106
|
+
export declare function decodeProfile(data: any): {
|
|
107
|
+
project: string;
|
|
108
|
+
wallet: string;
|
|
109
|
+
attributes: {
|
|
110
|
+
key: string;
|
|
111
|
+
value: string;
|
|
112
|
+
}[];
|
|
113
|
+
} | null;
|
|
114
|
+
/** What a table's rows carry (its payload byte). */
|
|
115
|
+
export declare const PAYLOAD: Readonly<{
|
|
116
|
+
Number: 0;
|
|
117
|
+
Label: 1;
|
|
118
|
+
Nft: 2;
|
|
119
|
+
}>;
|
|
120
|
+
/** Where row `r` of a table of `len`-byte rows is: groups of 64 blocks of 64 rows, each led by its weight in stock. */
|
|
121
|
+
export declare function tableRowAt(len: any, r: any): number;
|
|
122
|
+
/**
|
|
123
|
+
* A table (`["table", project, id]`, `table.rs`): { project, id, payload ('Number' | 'Label'), sealed, count, total
|
|
124
|
+
* (the weight in stock), rows: [{ weight, left, label }] }. A row's `left` is `NO_LIMIT` (4294967295) for a stock that
|
|
125
|
+
* never runs out.
|
|
126
|
+
*/
|
|
127
|
+
export declare function decodeTable(data: any): {
|
|
128
|
+
project: string;
|
|
129
|
+
id: number;
|
|
130
|
+
payload: string;
|
|
131
|
+
sealed: boolean;
|
|
132
|
+
count: number;
|
|
133
|
+
total: bigint;
|
|
134
|
+
rows: {
|
|
135
|
+
weight: number;
|
|
136
|
+
left: number;
|
|
137
|
+
label: string;
|
|
138
|
+
}[];
|
|
139
|
+
} | null;
|
|
140
|
+
/** A stash (`["stash", project, id]`, or a lottery's own): { project, id, nfts, weights }, the NFTs the project holds to
|
|
141
|
+
* give away and the weight each is drawn by, as a table of NFTs keeps them (a row: its weight, then the NFT). */
|
|
142
|
+
export declare function decodeStash(data: any): {
|
|
143
|
+
project: string;
|
|
144
|
+
id: number;
|
|
145
|
+
nfts: string[];
|
|
146
|
+
weights: number[];
|
|
147
|
+
} | null;
|
|
148
|
+
/**
|
|
149
|
+
* A compressed NFT's record (`["leaf", asset]`, `prove_leaf`): { asset, tree, owner (null once burned), delegate,
|
|
150
|
+
* collection (or null), flags, nonce, root (hex: the tree's root it holds for), payer }. Routes read it only while the
|
|
151
|
+
* tree's root is still `root`; after that anyone may close it (`closeLeafIx`).
|
|
152
|
+
*/
|
|
153
|
+
export declare function decodeProven(data: any): {
|
|
154
|
+
asset: string;
|
|
155
|
+
tree: string;
|
|
156
|
+
owner: any;
|
|
157
|
+
delegate: any;
|
|
158
|
+
collection: any;
|
|
159
|
+
flags: number;
|
|
160
|
+
nonce: bigint;
|
|
161
|
+
root: string;
|
|
162
|
+
payer: string;
|
|
163
|
+
};
|
|
164
|
+
/** The traits a project vouches for (`["traits", project, key]`): { project, key, root (hex) }. */
|
|
165
|
+
export declare function decodeTraits(data: any): {
|
|
166
|
+
project: string;
|
|
167
|
+
key: string;
|
|
168
|
+
root: string;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* A Token Metadata account (`MetadataV1`), read as far as a farm needs: { mint, collection (the one it is verified
|
|
172
|
+
* in, or null), programmable (a pNFT), ruleSet (a pNFT's, or null) }. Null for anything else. Older accounts end
|
|
173
|
+
* early: what is not there reads as none.
|
|
174
|
+
*/
|
|
175
|
+
export declare function decodeTokenMetadata(data: any): {
|
|
176
|
+
mint: string;
|
|
177
|
+
collection: string | null;
|
|
178
|
+
programmable: boolean;
|
|
179
|
+
ruleSet: string | null;
|
|
180
|
+
} | null;
|
|
181
|
+
export declare const OWN_PAID: bigint;
|
|
182
|
+
/** The mint a lottery's tickets are paid in (`terms`: a Lottery's or a round's): its ticket mint, burned, or its pot's. */
|
|
183
|
+
export declare const paymentMint: (terms: any) => any;
|
|
184
|
+
/** Whether a lottery's tickets are burned: they are paid in a ticket mint of its own. */
|
|
185
|
+
export declare const ticketsBurn: (terms: any) => boolean;
|
|
186
|
+
/** A share the buyer chooses (a referrer, a collectible's holder): paid out of the price as they buy, from their own account. */
|
|
187
|
+
export declare const chosenAtPurchase: (share: any) => boolean;
|
|
188
|
+
/** The bytes of one entry of a round: buyer, word, what arrived (`fee`: a fee mint, or a chosen share), the NFT ticket. */
|
|
189
|
+
export declare const entryWidth: (fee: any, nft: any) => number;
|
|
190
|
+
/**
|
|
191
|
+
* A lottery round (`["round", lottery, incarnation, round]`): its header (`status` 'Open' | 'Drawing' | 'Drawn' |
|
|
192
|
+
* 'Cancelled', the terms it copied, `sold`, `owed`, the draw and the money the ask fixed, `nfts` the NFT of the
|
|
193
|
+
* lottery's own stash each such place got), and `entries`, one a purchase: { buyer, start, end (its tickets), paid (its
|
|
194
|
+
* own part's bit), amount (what reached the round), nft (its NFT ticket) }.
|
|
195
|
+
*/
|
|
196
|
+
export declare function decodeRound(data: any): any;
|
|
197
|
+
/** How many places a lottery's (or a round's) `places` are, every run counted (`Place.times`). */
|
|
198
|
+
export declare const placeCount: (places: any) => any;
|
|
199
|
+
/** The places of a round that have a winner: every place, but no more than tickets. */
|
|
200
|
+
export declare const roundWinners: (r: any) => number;
|
|
201
|
+
/** The ticket that wins `place` of a drawn round: even steps around the list from first place's ticket. */
|
|
202
|
+
export declare function ticketOfPlace(r: any, place: any): bigint;
|
|
203
|
+
/** The run of places that holds `place`, and its first place. */
|
|
204
|
+
export declare function runOf(r: any, place: any): any[];
|
|
205
|
+
/** The places of run `run` with a winner: [first, end). */
|
|
206
|
+
export declare function runPlaces(r: any, run: any): number[];
|
|
207
|
+
/** The places of run `run` whose ticket is in `start..end` (an entry's), in order. */
|
|
208
|
+
export declare function placesIn(r: any, run: any, start: any, end: any): any[];
|
|
209
|
+
/**
|
|
210
|
+
* What place `place` (counted from the first place of `runs`) takes of a pass-through amount, as the program splits it:
|
|
211
|
+
* runs of `[a, n]` (n places taking `a` each), `sent` what the places are owed and `arrived` what the round holds for
|
|
212
|
+
* them; the last place with a part takes what the others leave.
|
|
213
|
+
*/
|
|
214
|
+
export declare function splitPart(runs: any, sent: any, arrived: any, place: any): number | bigint;
|
|
215
|
+
/** Whether place `place`'s part is paid: its pot part's bit (every place's first), or with `prize` its prize's (after
|
|
216
|
+
* every place's pot bit). */
|
|
217
|
+
export declare const placePaid: (r: any, place: any, prize: any) => boolean;
|
|
218
|
+
/** What entry `i`'s places in run `run` take and are not paid yet, of its pot part or (`prize`) its token prize. */
|
|
219
|
+
export declare const placesOwed: (r: any, i: any, run: any, prize: any) => bigint;
|
|
220
|
+
/** How many of the round's owed parts a pull of `{ Pot: [run] }` or a token `{ Prize: [run] }` for entry `i` settles:
|
|
221
|
+
* its places there that take more than nothing (one pull pays them all). */
|
|
222
|
+
export declare const placesPulled: (r: any, i: any, run: any, prize: any) => number;
|
|
223
|
+
/** Whether run `run` of a round's places gives tokens (its prize is fixed at the ask, a `TokenPrize`). */
|
|
224
|
+
export declare const tokenRun: (r: any, run: any) => boolean;
|
|
225
|
+
/** A place whose prize is an NFT of the lottery's own stash (`Held`, `Raffled`): assigned by the pulls, in place order. */
|
|
226
|
+
export declare const ownStash: (place: any) => boolean;
|
|
227
|
+
/** Entry `i`'s places in run `run` whose prize (not tokens) is not given yet, lowest first. */
|
|
228
|
+
export declare const prizePlacesOwed: (r: any, i: any, run: any) => any[];
|
|
229
|
+
/** Where in `r.nfts` the NFT of `place` is (a place of a run that holds or draws one of the lottery's own stash). */
|
|
230
|
+
export declare function nftSlot(r: any, place: any): number;
|
|
231
|
+
/** How many places of a round win an NFT of the lottery's own stash (every such place with a winner). */
|
|
232
|
+
export declare function stashPlacesWon(r: any): number;
|
|
233
|
+
/** Whether entry `i`'s places in run `run` (an NFT of the lottery's own stash) wait for their NFTs to be taken out
|
|
234
|
+
* (`LotteryRound::assign`): a pull with the stash alone does it, and `r.nfts` then names each. */
|
|
235
|
+
export declare function awaitsNfts(r: any, i: any, run: any): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* The parts entry `i` of a round is owed now, in the order a keeper pulls them (`pullIx`'s `part`): its own ('Own': a
|
|
238
|
+
* refund, a no-loss ticket's price, its NFT ticket back or where its price sends it), and with `places`, its places'
|
|
239
|
+
* parts of the pot ({ Pot: [run] }) and prizes ({ Prize: [run] }). Parts owed in common (a share, the pot's, a pool's
|
|
240
|
+
* prize back) are no entry's: `commonOwed`.
|
|
241
|
+
*/
|
|
242
|
+
export declare function partsOwed(r: any, i: any, { places }?: {
|
|
243
|
+
places?: boolean | undefined;
|
|
244
|
+
}): (string | {
|
|
245
|
+
Pot: number[];
|
|
246
|
+
Prize?: undefined;
|
|
247
|
+
} | {
|
|
248
|
+
Pot?: undefined;
|
|
249
|
+
Prize: number[];
|
|
250
|
+
})[];
|
|
251
|
+
/**
|
|
252
|
+
* The parts of a round owed in common, of no entry (`{ Common: [i] }`): each share paid in common once drawn (one that
|
|
253
|
+
* burns is burned at the close), then what the round owes the lottery's pot (`i` = the shares' count), then after a
|
|
254
|
+
* cancel each pool's token prize back to its pool (past it).
|
|
255
|
+
*/
|
|
256
|
+
export declare function commonOwed(r: any): {
|
|
257
|
+
Common: any[];
|
|
258
|
+
}[];
|
|
259
|
+
/** The entry of a round holding `ticket`. */
|
|
260
|
+
export declare const entryOf: (r: any, ticket: any) => any;
|
|
261
|
+
/** Whether a round is done and owes nothing: the next pull closes it, given its close's accounts. */
|
|
262
|
+
export declare const roundFinished: (r: any) => boolean;
|
|
263
|
+
/** Whether a lottery's place wins something: a share of the pot, a prize, or both. */
|
|
264
|
+
export declare const placeSet: (place: any) => boolean;
|
|
265
|
+
/** The address of a lottery's current round's record (there or not). */
|
|
266
|
+
export declare const roundAddress: (lotteryAddress: any, lottery: any) => any;
|
|
267
|
+
/** Whether a lottery (decoded) drew once and has ended. */
|
|
268
|
+
export declare const lotteryEnded: (lottery: any) => boolean;
|
|
269
|
+
/** The round a lottery's close, its write again and its own stash's moves name (`lottery::check_idle`): its current
|
|
270
|
+
* round's, or once a lottery that draws once has ended, round 0's (which keeps its stash's NFTs until its places took
|
|
271
|
+
* them out). */
|
|
272
|
+
export declare const idleRound: (lotteryAddress: any, lottery: any) => any;
|
|
273
|
+
/**
|
|
274
|
+
* Who rents a listed NFT at `now` (Unix seconds), from its decoded Listing (or null for none): the renter's wallet while
|
|
275
|
+
* a rental runs, else null (a sale listing, or a rental that is over).
|
|
276
|
+
*/
|
|
277
|
+
export declare function renterOf(listing: any, now: any): any;
|
|
278
|
+
/** Whether a schedule pays every run due when it is sent late (`schedule::catches_up`): only a sealed fixed amount. */
|
|
279
|
+
export declare const scheduleCatchesUp: (schedule: any) => boolean;
|
|
280
|
+
/**
|
|
281
|
+
* How many runs of a schedule are due at `now` (Unix seconds, the chain's clock, never the computer's). One `run_schedule`
|
|
282
|
+
* makes them all. A sealed schedule's fixed amount pays each of them (`scheduleCatchesUp`; up to its `upto`, the runs made
|
|
283
|
+
* after it: `schedule.runs` plus these, and a long backlog takes a few calls). Any other run pays once, for the latest
|
|
284
|
+
* run due, and those before it lapse. A sealed schedule past its last run is due once whenever its vault holds something
|
|
285
|
+
* (`vaultBalance`), which goes where it always went.
|
|
286
|
+
*/
|
|
287
|
+
export declare function runsDue(schedule: any, now: any, vaultBalance?: bigint): number;
|
|
288
|
+
/**
|
|
289
|
+
* The receipts (Anchor events) of a transaction that succeeded: [{ name, data }]. Pass what getTransaction returns
|
|
290
|
+
* (`{ meta: { err, logMessages } }`), or the logs and the transaction's `meta.err`. Success is `meta.err === null` and
|
|
291
|
+
* nothing else: a transaction can fail after every instruction logged success (the runtime's rent check, for one),
|
|
292
|
+
* and its logs still hold every receipt, so a transaction with an error gives none. A backend delivers from a
|
|
293
|
+
* finalized transaction's receipts, once per order or reference.
|
|
294
|
+
*/
|
|
295
|
+
export declare function receipts(tx: any, err: any): {
|
|
296
|
+
name: any;
|
|
297
|
+
data: any;
|
|
298
|
+
}[];
|
|
299
|
+
/** The program's errors by code: { code: { name, msg } }. */
|
|
300
|
+
export declare const ERRORS: Readonly<{
|
|
301
|
+
[k: string]: {
|
|
302
|
+
name: string;
|
|
303
|
+
msg: string;
|
|
304
|
+
};
|
|
305
|
+
}>;
|
|
306
|
+
/**
|
|
307
|
+
* The loot error in a failed transaction's logs ("custom program error: 0x…", or Anchor's "Error Code: …" line), or
|
|
308
|
+
* null: { code, name, msg }, `msg` the IDL's sentence (the program's own log names the error only: its text is
|
|
309
|
+
* compiled out). Only loot's own: another program the transaction calls (Bubblegum, the VRF program, …) has codes of its own
|
|
310
|
+
* that may be the same numbers, so an error is loot's only when loot is the program that logged it or failed with it.
|
|
311
|
+
* The first program that fails is where the error came from; the programs that called it fail after it with the same
|
|
312
|
+
* code.
|
|
313
|
+
*/
|
|
314
|
+
export declare function lootError(logs: any): {
|
|
315
|
+
name: string;
|
|
316
|
+
msg: string;
|
|
317
|
+
code: number;
|
|
318
|
+
} | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many of a proof's nodes a transaction passes for this tree: the levels its canopy does not keep. `treeData` is
|
|
3
|
+
* the tree account's bytes.
|
|
4
|
+
*/
|
|
5
|
+
export declare function proofLength(treeData: any): number;
|
|
6
|
+
/**
|
|
7
|
+
* A compressed NFT from an indexer's answers: `asset` (DAS `getAsset`), `proof` (DAS `getAssetProof`) and the tree
|
|
8
|
+
* account's bytes (`treeData`, for how much of the proof to pass). Returns { id, tree, nonce, owner, delegate,
|
|
9
|
+
* collection (or null), dataHash, creatorHash, assetDataHash (or null), flags, root, proof: [node, …] }. The proof
|
|
10
|
+
* must be against the tree's current root when it lands: fetch it just before sending.
|
|
11
|
+
*/
|
|
12
|
+
export declare function compressedFromDas({ asset, proof, treeData }: {
|
|
13
|
+
asset: any;
|
|
14
|
+
proof: any;
|
|
15
|
+
treeData: any;
|
|
16
|
+
}): {
|
|
17
|
+
id: any;
|
|
18
|
+
tree: any;
|
|
19
|
+
nonce: bigint;
|
|
20
|
+
owner: any;
|
|
21
|
+
delegate: any;
|
|
22
|
+
collection: any;
|
|
23
|
+
dataHash: Uint8Array<ArrayBuffer> | null;
|
|
24
|
+
creatorHash: Uint8Array<ArrayBuffer> | null;
|
|
25
|
+
assetDataHash: Uint8Array<ArrayBuffer> | null;
|
|
26
|
+
flags: number;
|
|
27
|
+
root: Uint8Array<ArrayBuffer> | null;
|
|
28
|
+
proof: any;
|
|
29
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export declare const VOUCHER_DOMAIN = "loot-grant-v5";
|
|
2
|
+
export declare const LIST_DOMAIN = "loot-list-v3";
|
|
3
|
+
export declare const KEY_DOMAIN = "loot-key-v1";
|
|
4
|
+
/** What a voucher key signs: the prefix (13 bytes), then the sha256 of the voucher's body. */
|
|
5
|
+
export declare const VOUCHER_BYTES = 45;
|
|
6
|
+
/** A grant claim's compute limit: its rounds' records and prizes can pass the 200,000 a transaction has by default. */
|
|
7
|
+
export declare const CLAIM_COMPUTE_UNITS = 400000;
|
|
8
|
+
export declare const ZERO_HASH: Uint8Array<ArrayBuffer>;
|
|
9
|
+
export declare const ED25519_PROGRAM = "Ed25519SigVerify111111111111111111111111111";
|
|
10
|
+
/** The day a window of `DAY_SECONDS` counts in, from the unix epoch. */
|
|
11
|
+
export declare const dayOf: (unixSeconds: any) => number;
|
|
12
|
+
/** An i64 little-endian (two's complement), as the program reads `expires`. */
|
|
13
|
+
export declare const i64LE: (value: any) => Uint8Array<any>;
|
|
14
|
+
/** A voucher's body, which its key signs the sha256 of (`voucherBytes`). */
|
|
15
|
+
export declare function voucherBody({ program, grant, incarnation, wallet, personHash, expires, rounds, round, amount }: {
|
|
16
|
+
amount?: bigint | undefined;
|
|
17
|
+
expires: any;
|
|
18
|
+
grant: any;
|
|
19
|
+
incarnation: any;
|
|
20
|
+
personHash: any;
|
|
21
|
+
program?: string | undefined;
|
|
22
|
+
round: any;
|
|
23
|
+
rounds: any;
|
|
24
|
+
wallet: any;
|
|
25
|
+
}): Uint8Array<any>;
|
|
26
|
+
/**
|
|
27
|
+
* The 45 bytes a voucher key signs and `claim_grant` rebuilds from its own accounts and arguments: the prefix, then the
|
|
28
|
+
* sha256 of the voucher's body (`voucherBody`), so a voucher of many rounds is as short to check as one of one. `rounds`
|
|
29
|
+
* ([{ id, amount }], or one `round` and its `amount`) names the wins (the project round, draw or giveaway each was won
|
|
30
|
+
* in): the program pays a wallet each round once per grant incarnation.
|
|
31
|
+
*/
|
|
32
|
+
export declare const voucherBytes: (fields: any) => Uint8Array<any>;
|
|
33
|
+
/** The fields back from a voucher's body (`voucherBody`; addresses as bytes, rounds as [{ id, amount }]). */
|
|
34
|
+
export declare function readVoucher(body: any): {
|
|
35
|
+
program: Uint8Array<ArrayBuffer>;
|
|
36
|
+
grant: Uint8Array<ArrayBuffer>;
|
|
37
|
+
incarnation: bigint;
|
|
38
|
+
wallet: Uint8Array<ArrayBuffer>;
|
|
39
|
+
personHash: Uint8Array<ArrayBuffer>;
|
|
40
|
+
expires: bigint;
|
|
41
|
+
rounds: {
|
|
42
|
+
id: Uint8Array<ArrayBuffer>;
|
|
43
|
+
amount: bigint;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
/** A voucher key's leaf under a grant's `key_root`. */
|
|
47
|
+
export declare const keyLeaf: (key: any) => Uint8Array<ArrayBuffer>;
|
|
48
|
+
/** A list entry's round as the leaf names it: a number (a spec's `round`) in the first 8 of 16 bytes; 0 is zeros. */
|
|
49
|
+
export declare const listRound: (n?: number) => Uint8Array<ArrayBuffer>;
|
|
50
|
+
/**
|
|
51
|
+
* A leaf of an approved list: `wallet` won `round` (16 bytes or 32 hex characters; zeros when not given). A round is
|
|
52
|
+
* paid once, so a list can name the winners of many rounds, and a wallet's earlier wins stay claimable when a new
|
|
53
|
+
* list adds later ones.
|
|
54
|
+
*/
|
|
55
|
+
export declare const listLeaf: (wallet: any, personHash: any, round: any, amount?: bigint) => Uint8Array<ArrayBuffer>;
|
|
56
|
+
/** The prefix of a wallet's leaf in a list gate (`gateListLeaf`). */
|
|
57
|
+
export declare const GATE_LIST_DOMAIN = "loot-list-v1";
|
|
58
|
+
/** A wallet's leaf in a list gate (`Gate::List`): sha256("loot-list-v1" | wallet). Its tree is a list's
|
|
59
|
+
* (`merkleRoot`, `merkleProof`), and its proof's nodes go where an NFT shown would (`gateAccounts`'s `listProof`). */
|
|
60
|
+
export declare const gateListLeaf: (wallet: any) => Uint8Array<ArrayBuffer>;
|
|
61
|
+
/** The parent of two nodes: sha256 of the smaller then the larger. */
|
|
62
|
+
export declare const parentOf: (a: any, b: any) => Uint8Array<ArrayBuffer>;
|
|
63
|
+
/** The root of the leaves, in the order given. Whoever builds the list keeps that order. */
|
|
64
|
+
export declare const merkleRoot: (leaves: any) => any;
|
|
65
|
+
/** The siblings of leaf `index`, from the bottom up. */
|
|
66
|
+
export declare function merkleProof(leaves: any, index: any): any[];
|
|
67
|
+
/**
|
|
68
|
+
* A list gate's tree (`Gate::List`) for `wallets`, in the order given: its `root`, its `depth`, and `proofOf(wallet)`.
|
|
69
|
+
* The gate reads exactly `depth` nodes, so the leaves are filled up to a power of two with a leaf no wallet has (all
|
|
70
|
+
* zeros): every wallet's proof is then `depth` nodes long.
|
|
71
|
+
*/
|
|
72
|
+
export declare function gateList(wallets: any): {
|
|
73
|
+
root: any;
|
|
74
|
+
depth: number;
|
|
75
|
+
proofOf: (wallet: any) => any[];
|
|
76
|
+
};
|
|
77
|
+
/** Whether `proof` leads from `leaf` to `root`. */
|
|
78
|
+
export declare function verifyProof(leaf: any, proof: any, root: any): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The Ed25519 precompile instruction for one signature, everything in its own data: count 1, padding, seven u16
|
|
81
|
+
* offsets with instruction index 0xffff (this instruction), then the key at 16, the signature at 48, the message at
|
|
82
|
+
* 112. `claim_grant` reads it through the instructions sysvar, in the instruction right before itself.
|
|
83
|
+
*/
|
|
84
|
+
export declare function ed25519Ix({ publicKey, signature, message }: {
|
|
85
|
+
message: any;
|
|
86
|
+
publicKey: any;
|
|
87
|
+
signature: any;
|
|
88
|
+
}): {
|
|
89
|
+
programId: string;
|
|
90
|
+
keys: never[];
|
|
91
|
+
data: Uint8Array<any>;
|
|
92
|
+
};
|
|
93
|
+
/** The key of a grant's limit record of `kind` ('wallet', 'person', 'badge', 'code') for `subject` (an address or 32
|
|
94
|
+
* bytes): sha256(kind | subject)[..16]. */
|
|
95
|
+
export declare const limitKey: (kind: any, subject: any) => Uint8Array<ArrayBuffer>;
|
|
96
|
+
/** The key of a wallet's record of a round a grant paid it: sha256(round | wallet)[..16]. */
|
|
97
|
+
export declare const roundKey: (round: any, wallet: any) => Uint8Array<ArrayBuffer>;
|
|
98
|
+
/** The shard a record's key falls in, of a grant's `2^bits`: the top `bits` bits of its first byte. */
|
|
99
|
+
export declare const shardOf: (key: any, bits: any) => number;
|
|
100
|
+
/** The rounds shard a wallet's paid rounds are kept in: its own limit record's. */
|
|
101
|
+
export declare const walletShard: (grant: any, wallet: any) => number;
|
|
102
|
+
/** Whether a grant paid `wallet` for `round`, from the wallet's decoded rounds shard (`decodeList`, null for none). */
|
|
103
|
+
export declare const roundPaid: (list: any, wallet: any, round: any) => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The fewest shard bits (0 to 8) that keep each of a grant's lists under ~100,000 records over its life: `wallets` ×
|
|
106
|
+
* the rounds each may claim (`rounds`). A 10,000-wallet airdrop takes 0 (one shard).
|
|
107
|
+
*/
|
|
108
|
+
export declare function shardBitsFor(wallets: any, rounds?: number): number;
|
|
109
|
+
/**
|
|
110
|
+
* The claim of grant `id` for `wallet`, sent and signed by `signer` (anyone: the play host, the owner's server, the
|
|
111
|
+
* player). The grant's funds pay its records through the signer; what they can't cover, the signer pays. The signer pays
|
|
112
|
+
* the player fee, and a roll's order, with its own SOL. `grant` is the decoded Grant.
|
|
113
|
+
*
|
|
114
|
+
* A voucher claim goes right after `ed25519Ix` in the same transaction, `voucherKey` the key that signed it (a key under
|
|
115
|
+
* the key root carries its proof as `proofs[0]`); a list claim carries a proof for each round (`proofs`); an open grant
|
|
116
|
+
* (no keys, no key root, no list) names no round and pays one prize (`count`: the wallet's claims before it, for its
|
|
117
|
+
* roll's nonce). `rounds` ([{ id, amount }], or one `round` and its `amount`) are the wins it names: each paid once, so
|
|
118
|
+
* one already paid is skipped (`paidRounds`: the wallet's decoded rounds shard, `decodeList`, to leave out its prize's
|
|
119
|
+
* accounts). What passes its gate (`shown`, or `listProof` for a list gate) comes first, then each shard of the grant's
|
|
120
|
+
* claims it counts in, then each round's prize (`grant.gives`, `prizeMetas`): `poolMint` for tokens from a pool, `item`
|
|
121
|
+
* (the decoded Item) for a collectible or a compressed NFT of one, `nft` for an NFT of a stash; round `i`'s roll at
|
|
122
|
+
* `prizeRollNonce(nonce + i)` (`nonce`: `prizeNonce` of the grant, the wallet and its rounds by default), its box and
|
|
123
|
+
* order only (`askRollIx` then asks for it, in the same transaction when it fits). Send it with a compute limit of
|
|
124
|
+
* `CLAIM_COMPUTE_UNITS`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function claimGrantIx({ project, id, grant, wallet, signer, count, rounds, round, expires, personHash, amount, proofs, proof, paidRounds, poolMint, item, nft, shown, listProof, programs, voucherKey, nonce, extra }: {
|
|
127
|
+
amount?: bigint | undefined;
|
|
128
|
+
count?: number | undefined;
|
|
129
|
+
expires: any;
|
|
130
|
+
extra?: never[] | undefined;
|
|
131
|
+
grant: any;
|
|
132
|
+
id: any;
|
|
133
|
+
item: any;
|
|
134
|
+
listProof: any;
|
|
135
|
+
nft: any;
|
|
136
|
+
nonce: any;
|
|
137
|
+
paidRounds?: null | undefined;
|
|
138
|
+
personHash: any;
|
|
139
|
+
poolMint: any;
|
|
140
|
+
programs: any;
|
|
141
|
+
project: any;
|
|
142
|
+
proof?: never[] | undefined;
|
|
143
|
+
proofs: any;
|
|
144
|
+
round: any;
|
|
145
|
+
rounds: any;
|
|
146
|
+
shown: any;
|
|
147
|
+
signer: any;
|
|
148
|
+
voucherKey: any;
|
|
149
|
+
wallet: any;
|
|
150
|
+
}): {
|
|
151
|
+
programId: string;
|
|
152
|
+
keys: any[];
|
|
153
|
+
data: Uint8Array<any>;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Anyone closes shard `shard` of a grant's rounds (`rounds`) or claims once the grant is closed or made again
|
|
157
|
+
* (`incarnation` the one the shard is of): its rent goes to the project's `owner`.
|
|
158
|
+
*/
|
|
159
|
+
export declare const closeShardIx: ({ project, id, incarnation, rounds, shard, owner }: {
|
|
160
|
+
id: any;
|
|
161
|
+
incarnation: any;
|
|
162
|
+
owner: any;
|
|
163
|
+
project: any;
|
|
164
|
+
rounds?: boolean | undefined;
|
|
165
|
+
shard: any;
|
|
166
|
+
}) => {
|
|
167
|
+
programId: string;
|
|
168
|
+
keys: any[];
|
|
169
|
+
data: Uint8Array<any>;
|
|
170
|
+
};
|