@xgamesfun/solana 0.20.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -52
- package/bin/xsolana.mjs +23 -8
- package/examples/blind-forge.json +2 -4
- package/examples/coin-flip-arena.json +4 -12
- package/examples/duel-arena.json +1 -4
- package/examples/elements-set.json +2 -9
- package/examples/expedition-guild.json +1 -8
- package/examples/fair-presale.json +1 -3
- package/examples/guild-missions.json +3 -10
- package/examples/halving-seasons.json +4 -9
- package/examples/hero-trials.json +15 -6
- package/examples/holder-den.json +38 -0
- package/examples/holders-drop.json +105 -0
- package/examples/ideas.json +788 -788
- package/examples/match-predictions.json +24 -0
- package/examples/merge-2048.json +5 -5
- package/examples/nft-raffle.json +1 -0
- package/examples/pack-league.json +108 -0
- package/examples/paper-hands-farm.json +4 -16
- package/examples/partner-vault.json +20 -7
- package/examples/sacrifice-raffle.json +2 -10
- package/examples/shelter-fair.json +1 -0
- package/examples/stakers-draw.json +4 -15
- package/examples/star-fleet.json +1 -8
- package/examples/starforce.json +6 -6
- package/examples/stride-sneakers.json +164 -0
- package/examples/trade-in-shop.json +2 -3
- package/js/approve/details.mjs +122 -52
- package/js/approve/ed25519.mjs +5 -1
- package/js/approve/live-check.mjs +83 -26
- package/js/approve/page.html +217 -78
- package/js/approve/page.js +43 -15
- package/js/approve/server.mjs +290 -73
- package/js/chain/base58.js +7 -1
- package/js/chain/borsh.js +24 -11
- package/js/chain/bytes.js +11 -8
- package/js/chain/core.js +35 -7
- package/js/chain/curve.js +1 -1
- package/js/chain/lookup.js +124 -36
- package/js/chain/mint.js +6 -2
- package/js/chain/pda.js +2 -2
- package/js/chain/programs.js +6 -6
- package/js/chain/rpc.js +44 -16
- package/js/chain/token.js +13 -2
- package/js/chain/token2022.js +55 -16
- package/js/chain/tx.js +32 -22
- package/js/client/accounts.js +653 -131
- package/js/client/compressed.js +4 -3
- package/js/client/grant.js +267 -83
- package/js/client/idl/loot.js +1 -1
- package/js/client/idl/loot.json +2406 -2176
- package/js/client/index.js +1 -0
- package/js/client/ix.js +3059 -664
- package/js/client/pda.js +39 -33
- package/js/client/policy.js +52 -24
- package/js/client/random.js +70 -0
- package/js/client/sizes.js +414 -16
- package/js/client/traits.js +14 -5
- package/js/connect/connect.mjs +59 -17
- package/js/economy/check.mjs +4153 -725
- package/js/economy/cost.mjs +403 -64
- package/js/economy/examples.mjs +176 -35
- package/js/economy/explain.mjs +466 -111
- package/js/economy/guide.mjs +296 -72
- package/js/economy/legal.mjs +12 -6
- package/js/economy/live.mjs +83 -19
- package/js/economy/model.mjs +462 -124
- package/js/economy/plan.mjs +1306 -219
- package/js/economy/schema.json +390 -484
- package/js/economy/secrets.mjs +17 -7
- package/js/economy/simulate.mjs +883 -223
- package/js/economy/txsize.mjs +15 -3
- package/js/economy/validate.mjs +61 -24
- package/js/mcp/server.mjs +42 -14
- package/js/mcp/tools.mjs +307 -88
- package/js/play/index.js +2864 -619
- package/js/play/keys.js +193 -0
- package/js/results/index.js +223 -30
- package/js/results/server.js +230 -0
- package/js/results/wire.js +64 -16
- package/package.json +6 -4
- package/release.json +5 -5
- package/skills/xsolana-economy/SKILL.md +39 -21
- package/skills/xsolana-economy/references/after-launch.md +58 -38
- package/skills/xsolana-economy/references/apps.md +97 -50
- package/skills/xsolana-economy/references/sentence-to-spec.md +148 -121
- package/skills/xsolana-economy/references/telling-the-person.md +61 -17
- package/types/chain/core.d.ts +4 -2
- package/types/chain/lookup.d.ts +5 -2
- package/types/chain/rpc.d.ts +3 -1
- package/types/client/accounts.d.ts +217 -56
- package/types/client/grant.d.ts +72 -27
- package/types/client/idl/loot.d.ts +602 -549
- package/types/client/index.d.ts +1 -0
- package/types/client/ix.d.ts +3884 -247
- package/types/client/pda.d.ts +22 -16
- 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/guide.d.mts +5 -0
- package/types/economy/live.d.mts +16 -1
- package/types/economy/model.d.mts +151 -38
- package/types/economy/plan.d.mts +237 -194
- package/types/economy/simulate.d.mts +21 -13
- package/types/mcp/tools.d.mts +21 -13
- package/types/play/index.d.ts +453 -53
- package/types/play/keys.d.ts +51 -0
- package/types/results/index.d.ts +7 -6
- package/types/results/server.d.ts +126 -0
- package/types/results/wire.d.ts +1 -1
package/types/client/grant.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
export declare const VOUCHER_DOMAIN = "loot-grant-
|
|
1
|
+
export declare const VOUCHER_DOMAIN = "loot-grant-v5";
|
|
2
2
|
export declare const LIST_DOMAIN = "loot-list-v3";
|
|
3
3
|
export declare const KEY_DOMAIN = "loot-key-v1";
|
|
4
|
-
/**
|
|
5
|
-
export declare const VOUCHER_BYTES =
|
|
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;
|
|
6
8
|
export declare const ZERO_HASH: Uint8Array<ArrayBuffer>;
|
|
7
9
|
export declare const ED25519_PROGRAM = "Ed25519SigVerify111111111111111111111111111";
|
|
8
|
-
/** The day
|
|
10
|
+
/** The day a window of `DAY_SECONDS` counts in, from the unix epoch. */
|
|
9
11
|
export declare const dayOf: (unixSeconds: any) => number;
|
|
10
12
|
/** An i64 little-endian (two's complement), as the program reads `expires`. */
|
|
11
13
|
export declare const i64LE: (value: any) => Uint8Array<any>;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
* win (the project round, draw or giveaway it was won in): the program pays a wallet each round once per grant incarnation.
|
|
15
|
-
*/
|
|
16
|
-
export declare function voucherBytes({ program, grant, incarnation, wallet, personHash, round, expires, amount }: {
|
|
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, }: {
|
|
17
16
|
amount?: bigint | undefined;
|
|
18
17
|
expires: any;
|
|
19
18
|
grant: any;
|
|
@@ -21,18 +20,28 @@ export declare function voucherBytes({ program, grant, incarnation, wallet, pers
|
|
|
21
20
|
personHash: any;
|
|
22
21
|
program?: string | undefined;
|
|
23
22
|
round: any;
|
|
23
|
+
rounds: any;
|
|
24
24
|
wallet: any;
|
|
25
25
|
}): Uint8Array<any>;
|
|
26
|
-
/**
|
|
27
|
-
|
|
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): {
|
|
28
35
|
program: Uint8Array<ArrayBuffer>;
|
|
29
36
|
grant: Uint8Array<ArrayBuffer>;
|
|
30
37
|
incarnation: bigint;
|
|
31
38
|
wallet: Uint8Array<ArrayBuffer>;
|
|
32
39
|
personHash: Uint8Array<ArrayBuffer>;
|
|
33
|
-
round: Uint8Array<ArrayBuffer>;
|
|
34
40
|
expires: bigint;
|
|
35
|
-
|
|
41
|
+
rounds: {
|
|
42
|
+
id: Uint8Array<ArrayBuffer>;
|
|
43
|
+
amount: bigint;
|
|
44
|
+
}[];
|
|
36
45
|
};
|
|
37
46
|
/** A voucher key's leaf under a grant's `key_root`. */
|
|
38
47
|
export declare const keyLeaf: (key: any) => Uint8Array<ArrayBuffer>;
|
|
@@ -81,23 +90,41 @@ export declare function ed25519Ix({ publicKey, signature, message }: {
|
|
|
81
90
|
keys: never[];
|
|
82
91
|
data: Uint8Array<any>;
|
|
83
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;
|
|
84
109
|
/**
|
|
85
110
|
* The claim of grant `id` for `wallet`, sent and signed by `signer` (anyone: the play host, the owner's server, the
|
|
86
|
-
* player). The grant's funds pay its
|
|
87
|
-
* the player fee with its own SOL. `grant` is the decoded Grant
|
|
88
|
-
*
|
|
89
|
-
* A voucher claim goes right after `ed25519Ix` in the same transaction, `voucherKey` the key that signed it (
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* `
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
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`.
|
|
97
125
|
*/
|
|
98
|
-
export declare function claimGrantIx({ project, id, grant, wallet, signer, count, round, expires, personHash, amount, proof, poolMint, item, nft,
|
|
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, }: {
|
|
99
127
|
amount?: bigint | undefined;
|
|
100
|
-
boxes?: {} | undefined;
|
|
101
128
|
count?: number | undefined;
|
|
102
129
|
expires: any;
|
|
103
130
|
extra?: never[] | undefined;
|
|
@@ -107,13 +134,15 @@ export declare function claimGrantIx({ project, id, grant, wallet, signer, count
|
|
|
107
134
|
listProof: any;
|
|
108
135
|
nft: any;
|
|
109
136
|
nonce: any;
|
|
137
|
+
paidRounds?: null | undefined;
|
|
110
138
|
personHash: any;
|
|
111
139
|
poolMint: any;
|
|
112
140
|
programs: any;
|
|
113
141
|
project: any;
|
|
114
142
|
proof?: never[] | undefined;
|
|
115
|
-
|
|
143
|
+
proofs: any;
|
|
116
144
|
round: any;
|
|
145
|
+
rounds: any;
|
|
117
146
|
shown: any;
|
|
118
147
|
signer: any;
|
|
119
148
|
voucherKey: any;
|
|
@@ -123,3 +152,19 @@ export declare function claimGrantIx({ project, id, grant, wallet, signer, count
|
|
|
123
152
|
keys: any[];
|
|
124
153
|
data: Uint8Array<any>;
|
|
125
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
|
+
};
|