@xgamesfun/solana 0.24.0 → 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.
Files changed (92) hide show
  1. package/README.md +94 -51
  2. package/bin/xsolana.mjs +23 -8
  3. package/examples/blind-forge.json +2 -4
  4. package/examples/coin-flip-arena.json +2 -5
  5. package/examples/duel-arena.json +1 -4
  6. package/examples/fair-presale.json +1 -3
  7. package/examples/hero-trials.json +14 -2
  8. package/examples/holder-den.json +38 -0
  9. package/examples/holders-drop.json +105 -0
  10. package/examples/ideas.json +788 -788
  11. package/examples/match-predictions.json +24 -0
  12. package/examples/nft-raffle.json +1 -0
  13. package/examples/pack-league.json +108 -0
  14. package/examples/partner-vault.json +19 -3
  15. package/examples/sacrifice-raffle.json +2 -10
  16. package/examples/shelter-fair.json +1 -0
  17. package/examples/stakers-draw.json +3 -7
  18. package/examples/stride-sneakers.json +164 -0
  19. package/examples/trade-in-shop.json +2 -3
  20. package/js/approve/details.mjs +117 -48
  21. package/js/approve/ed25519.mjs +5 -1
  22. package/js/approve/live-check.mjs +83 -26
  23. package/js/approve/page.html +217 -78
  24. package/js/approve/page.js +43 -15
  25. package/js/approve/server.mjs +276 -74
  26. package/js/chain/base58.js +7 -1
  27. package/js/chain/borsh.js +15 -11
  28. package/js/chain/bytes.js +11 -8
  29. package/js/chain/core.js +21 -5
  30. package/js/chain/curve.js +1 -1
  31. package/js/chain/lookup.js +118 -36
  32. package/js/chain/mint.js +6 -2
  33. package/js/chain/pda.js +2 -2
  34. package/js/chain/programs.js +6 -6
  35. package/js/chain/rpc.js +40 -14
  36. package/js/chain/token.js +13 -2
  37. package/js/chain/token2022.js +55 -16
  38. package/js/chain/tx.js +32 -22
  39. package/js/client/accounts.js +270 -80
  40. package/js/client/compressed.js +4 -3
  41. package/js/client/grant.js +165 -40
  42. package/js/client/idl/loot.js +1 -1
  43. package/js/client/idl/loot.json +104 -16
  44. package/js/client/ix.js +2121 -457
  45. package/js/client/pda.js +20 -18
  46. package/js/client/policy.js +12 -5
  47. package/js/client/random.js +1 -1
  48. package/js/client/sizes.js +220 -65
  49. package/js/client/traits.js +14 -5
  50. package/js/connect/connect.mjs +59 -17
  51. package/js/economy/check.mjs +3873 -690
  52. package/js/economy/cost.mjs +380 -56
  53. package/js/economy/examples.mjs +176 -35
  54. package/js/economy/explain.mjs +461 -110
  55. package/js/economy/guide.mjs +282 -59
  56. package/js/economy/legal.mjs +12 -6
  57. package/js/economy/live.mjs +60 -19
  58. package/js/economy/model.mjs +320 -97
  59. package/js/economy/plan.mjs +1022 -203
  60. package/js/economy/schema.json +127 -369
  61. package/js/economy/secrets.mjs +17 -7
  62. package/js/economy/simulate.mjs +771 -178
  63. package/js/economy/txsize.mjs +15 -3
  64. package/js/economy/validate.mjs +61 -24
  65. package/js/mcp/server.mjs +42 -14
  66. package/js/mcp/tools.mjs +293 -80
  67. package/js/play/index.js +1960 -461
  68. package/js/play/keys.js +35 -9
  69. package/js/results/index.js +223 -30
  70. package/js/results/server.js +230 -0
  71. package/js/results/wire.js +64 -16
  72. package/package.json +6 -4
  73. package/release.json +5 -5
  74. package/skills/xsolana-economy/SKILL.md +30 -16
  75. package/skills/xsolana-economy/references/after-launch.md +30 -20
  76. package/skills/xsolana-economy/references/apps.md +47 -36
  77. package/skills/xsolana-economy/references/sentence-to-spec.md +148 -129
  78. package/skills/xsolana-economy/references/telling-the-person.md +9 -6
  79. package/types/chain/core.d.ts +1 -1
  80. package/types/chain/lookup.d.ts +1 -1
  81. package/types/client/accounts.d.ts +24 -3
  82. package/types/client/grant.d.ts +2 -2
  83. package/types/client/idl/loot.d.ts +22 -0
  84. package/types/client/ix.d.ts +54 -45
  85. package/types/client/pda.d.ts +3 -1
  86. package/types/economy/guide.d.mts +5 -0
  87. package/types/economy/model.d.mts +48 -3
  88. package/types/economy/plan.d.mts +44 -2
  89. package/types/play/index.d.ts +8 -19
  90. package/types/results/index.d.ts +7 -6
  91. package/types/results/server.d.ts +126 -0
  92. package/types/results/wire.d.ts +1 -1
@@ -111,7 +111,7 @@ export declare const STOCK_WORDS = "The odds stay as written whatever is in stoc
111
111
  */
112
112
  export declare function whenOutWords(b: any, { sold }?: {
113
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";
114
+ }): "The odds stay as written whatever is in stock: a draw that lands on an outcome that can’t be given then (its pool short of the whole amount, its item or stash gone) is not made, no other outcome takes its place, and that draw’s worth of the price goes back at the settle; with no draw made at all, a paid open fails and is refunded, and a free roll goes back to waiting. A free roll (a prize, a recipe’s, a mission’s chest) is on the odds as written too: a draw on an outcome that is out misses and gives nothing back (a pack keeps what its other draws won; a roll that drew nothing waits to be asked again), so emptying a shared source before asking steers nothing. A pack that should draw among what is left needs \"whenOut\": \"drawLeft\"" | "When an outcome runs out (an item sold out, a pool short of its prize, a stash empty), a roll draws among the outcomes still there by their written weights, so the others’ chances rise; with nothing left at all, a free roll waits to be asked again and a paid one is refunded" | "When an outcome runs out (an item sold out, a pool short of its prize, a stash empty), the box keeps selling while its first draw has anything left, and a roll draws among the outcomes still there by their written weights: the others’ chances rise as one runs out, so a player can empty a common outcome to make a rare one likelier (a box selling a rare prize should stop selling instead, the default)" | "When an outcome runs out, the box stops selling: it isn’t sold while anything an outcome takes (an item’s units left, a pool’s tokens, a stash’s NFTs) couldn’t cover, at the most any outcome sharing it takes in one draw, this purchase’s draws and those of purchases still waiting for the oracle, so every roll is on the odds as written and nobody can buy their way to a refund on every miss; it sells again once the project restocks or edits the box (an outcome whose odds shrink with stock needs no cover). An outcome emptied another way all the same (another route sharing its pool, item or stash) makes no draw, no other outcome taking its place, and gives back that draw’s worth of the price at the settle; with no draw made at all, the open is refunded";
115
115
  /**
116
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
117
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
@@ -275,7 +275,7 @@ export declare function lifeLines(r: any, m: any): {
275
275
  needs: any[];
276
276
  raises: any[];
277
277
  };
278
- /** A lottery's place as { percent, prize }: a number is a share of the pot and no prize. */
278
+ /** A lottery's place as { percent, prize }: a number is a percent of what the round pays from, and no prize. */
279
279
  export declare const placeOf: (p: any) => {
280
280
  percent: any;
281
281
  prize: any;
@@ -295,7 +295,7 @@ export declare const sharesOf: (split: any) => any;
295
295
  * The program's `To` for a destination, with pool indexes resolved (the IDL's own shape). A wallet ("wallet:<address>")
296
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"
297
297
  * (or "chosen:<item>") is the one the buyer names when they buy; "lottery:<key>" is that lottery's pot
298
- * ("@pot:<id>") and "farm:<key>" that farm's rewards vault ("@rewards:<id>"), which the plan resolves once the game is
298
+ * ("@pot:<lottery id>:<pot id>") and "farm:<key>" that farm's rewards vault ("@rewards:<id>"), which the plan resolves once the game is
299
299
  * known.
300
300
  */
301
301
  export declare function toEnum(to: any, m: any): "Burn" | "Treasury" | {
@@ -401,6 +401,51 @@ export declare const windowOf: (part: any, now: any) => {
401
401
  opens_at: bigint;
402
402
  closes_at: bigint;
403
403
  };
404
+ /** Whether lottery `l` pays its places from a pot it keeps (`"pot"`, `PaysFrom::Pot`); false when each round pays from
405
+ * its own ticket money and sends what its places leave to `"rest"` (`PaysFrom::Round`). */
406
+ export declare const keepsPot: (l: any) => boolean;
407
+ /** The program's `PaysFrom` for a lottery: `{ Pot: [id] }` or `{ Round: { rest } }` (its `rest` as `toEnum` gives it). */
408
+ export declare const paysFromOf: (l: any, m: any) => {
409
+ Pot: any[];
410
+ Round?: undefined;
411
+ } | {
412
+ Pot?: undefined;
413
+ Round: {
414
+ rest: string | {
415
+ Pool: any[];
416
+ Account?: undefined;
417
+ Wallet?: undefined;
418
+ Chosen?: undefined;
419
+ Holder?: undefined;
420
+ } | {
421
+ Pool?: undefined;
422
+ Account: (string | undefined)[];
423
+ Wallet?: undefined;
424
+ Chosen?: undefined;
425
+ Holder?: undefined;
426
+ } | {
427
+ Pool?: undefined;
428
+ Account?: undefined;
429
+ Wallet: (string | undefined)[];
430
+ Chosen?: undefined;
431
+ Holder?: undefined;
432
+ } | {
433
+ Pool?: undefined;
434
+ Account?: undefined;
435
+ Wallet?: undefined;
436
+ Chosen: {
437
+ item: any;
438
+ };
439
+ Holder?: undefined;
440
+ } | {
441
+ Pool?: undefined;
442
+ Account?: undefined;
443
+ Wallet?: undefined;
444
+ Chosen?: undefined;
445
+ Holder: (string | undefined)[];
446
+ };
447
+ };
448
+ };
404
449
  /** A lottery's split of ticket money: its own, and "cutPercent" as a share to the treasury. */
405
450
  export declare const lotterySplit: (l: any) => any[];
406
451
  /** The program's `Effect` for a spec effect: a flat share, or a share per point of the attribute. */
@@ -405,13 +405,55 @@ export declare function prizeArgs(p: any, m: any): "Raffled" | {
405
405
  */
406
406
  export declare const listLeaves: (list: any, t: any) => any;
407
407
  /**
408
- * A lottery's args: its own pot in `currency` (the project's by default), ticket money split by `split` (and
409
- * `cutPercent` to the treasury) with the rest into the pot. No `every` draws once, at `firstDraw`.
408
+ * A lottery's args: its money in `currency` (the project's by default), ticket money split by `split` (and
409
+ * `cutPercent` to the treasury) with the rest for the places, which are paid from its pot (`pot`) or from each round's
410
+ * own money, what they leave going to `rest` (`paysFromOf`). No `every` draws once, at `firstDraw`.
410
411
  */
411
412
  export declare function lotteryArgs(l: any, m: any): {
412
413
  terms: {
413
414
  price: bigint;
414
415
  mint: string;
416
+ pays_from: {
417
+ Pot: any[];
418
+ Round?: undefined;
419
+ } | {
420
+ Pot?: undefined;
421
+ Round: {
422
+ rest: string | {
423
+ Pool: any[];
424
+ Account?: undefined;
425
+ Wallet?: undefined;
426
+ Chosen?: undefined;
427
+ Holder?: undefined;
428
+ } | {
429
+ Account: (string | undefined)[];
430
+ Wallet?: undefined;
431
+ Chosen?: undefined;
432
+ Holder?: undefined;
433
+ Pool?: undefined;
434
+ } | {
435
+ Account?: undefined;
436
+ Wallet: (string | undefined)[];
437
+ Chosen?: undefined;
438
+ Holder?: undefined;
439
+ Pool?: undefined;
440
+ } | {
441
+ Account?: undefined;
442
+ Wallet?: undefined;
443
+ Chosen: {
444
+ item: any;
445
+ };
446
+ Holder?: undefined;
447
+ Pool?: undefined;
448
+ } | {
449
+ Account?: undefined;
450
+ Wallet?: undefined;
451
+ Chosen?: undefined;
452
+ Holder: (string | undefined)[];
453
+ Pool?: undefined;
454
+ };
455
+ };
456
+ };
415
457
  shares: any;
416
458
  places: any;
417
459
  ticket_mint: string;
@@ -22,7 +22,7 @@ export declare const units: (amount: any, decimals: any) => bigint;
22
22
  * be made again from the wallet's signature is kept, encrypted (`browserStore()` in a browser; null keeps keys in memory
23
23
  * only).
24
24
  */
25
- export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, keyStore }: {
25
+ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, keyStore, }: {
26
26
  keyStore?: {
27
27
  get: (k: any) => string | null;
28
28
  set: (k: any, v: any) => void;
@@ -691,7 +691,9 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
691
691
  * nothing but the lottery can take it while a place names it; the winner gets it before any ticket money moves.
692
692
  * `price` (whole units of `currency`) a ticket, `drawsAt` (Unix seconds) its one draw, `minSold` the least tickets
693
693
  * (fewer: the round is cancelled and refunded), `shares` where the ticket money goes (the seller's own wallet by
694
- * default: the treasury). A seller runs it in a project of their own, whose owner they are.
694
+ * default: the treasury). Its one place takes no money, so it keeps no pot: the round pays from its own ticket
695
+ * money, and what the shares leave goes to the treasury too. A seller runs it in a project of their own, whose
696
+ * owner they are.
695
697
  */
696
698
  raffle(id: any, nft: any, { price, currency, drawsAt, minSold, perWallet, shares, ...others }?: Readonly<Record<string, any>>): Promise<any>;
697
699
  /** The raffle's owner takes the NFT back out of lottery `id`'s own stash once nothing promises it (the lottery ended, or no place names it). */
@@ -729,7 +731,8 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
729
731
  * collectible to take home, an auction they won (or one off by the clock: their bid back), a lottery place they
730
732
  * won, a draw that is due (anyone may reveal it, or ask again when the oracle never answered; it takes 0.0008
731
733
  * SOL), and a drawn lottery's unpaid places, which anyone may pay so the next round can open. [{ kind, says, … }];
732
- * pass one to `claim`.
734
+ * a winner's first claim of a contest of tokens carries `potUnits` and `prizeUnits`, its part as the decision wrote
735
+ * it (base units, as text). Pass one to `claim`.
733
736
  */
734
737
  claims(): Promise<({
735
738
  key?: undefined;
@@ -737,8 +740,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
737
740
  kind: string;
738
741
  order: any;
739
742
  says: string;
740
- id?: undefined;
741
- side?: undefined;
742
743
  hold?: undefined;
743
744
  round?: undefined;
744
745
  pulls?: undefined;
@@ -752,6 +753,8 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
752
753
  id: any;
753
754
  side: any;
754
755
  says: string;
756
+ potUnits?: string | undefined;
757
+ prizeUnits?: string | undefined;
755
758
  hold?: undefined;
756
759
  round?: undefined;
757
760
  pulls?: undefined;
@@ -761,8 +764,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
761
764
  key?: undefined;
762
765
  tree?: undefined;
763
766
  order?: undefined;
764
- id?: undefined;
765
- side?: undefined;
766
767
  kind: string;
767
768
  asset: any;
768
769
  hold: any;
@@ -773,8 +774,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
773
774
  } | {
774
775
  key?: undefined;
775
776
  order?: undefined;
776
- id?: undefined;
777
- side?: undefined;
778
777
  hold?: undefined;
779
778
  kind: string;
780
779
  asset: string;
@@ -786,8 +785,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
786
785
  } | {
787
786
  tree?: undefined;
788
787
  order?: undefined;
789
- id?: undefined;
790
- side?: undefined;
791
788
  hold?: undefined;
792
789
  kind: string;
793
790
  key: any;
@@ -799,8 +796,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
799
796
  } | {
800
797
  tree?: undefined;
801
798
  order?: undefined;
802
- id?: undefined;
803
- side?: undefined;
804
799
  hold?: undefined;
805
800
  kind: string;
806
801
  key: any;
@@ -812,8 +807,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
812
807
  } | {
813
808
  tree?: undefined;
814
809
  order?: undefined;
815
- id?: undefined;
816
- side?: undefined;
817
810
  hold?: undefined;
818
811
  kind: string;
819
812
  key: any;
@@ -826,8 +819,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
826
819
  key?: undefined;
827
820
  tree?: undefined;
828
821
  order?: undefined;
829
- id?: undefined;
830
- side?: undefined;
831
822
  hold?: undefined;
832
823
  round?: undefined;
833
824
  pulls?: undefined;
@@ -839,8 +830,6 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
839
830
  key?: undefined;
840
831
  tree?: undefined;
841
832
  order?: undefined;
842
- id?: undefined;
843
- side?: undefined;
844
833
  hold?: undefined;
845
834
  round?: undefined;
846
835
  pulls?: undefined;
@@ -1,4 +1,4 @@
1
- export { canonicalJson, CERT_KINDS, CLUSTERS, drawText, entryText, giveawayHostText, hostCertText, lockText, NO_GRANT, RESULT_DOMAIN, resultBytes, revokeGiveawayText, revokeText, rosterHash } from './wire.js';
1
+ export { canonicalJson, CERT_KINDS, CLUSTERS, drawText, entryText, giveawayHostText, hostCertText, lockText, NO_GRANT, RESULT_DOMAIN, resultBytes, revokeGiveawayText, revokeText, rosterHash, } from './wire.js';
2
2
  /** games.fun's results server, on its play host (devnet until the program's audit). */
3
3
  export declare const RESULTS_SERVER = "https://play.xgames.fun/xsolana";
4
4
  /** A fresh round id: 16 random bytes, in hex. Make it when the round starts. */
@@ -28,7 +28,7 @@ export declare function signResult(signer: any, result: any, cluster?: string):
28
28
  * with the same result is safe: it is the same answer. Returns the server's answer, { result, vouchers }, or throws its
29
29
  * { code, why }.
30
30
  */
31
- export declare function report({ server, cert, signer, game, round, endedAt, winners, cluster, fetchImpl }: {
31
+ export declare function report({ server, cert, signer, game, round, endedAt, winners, cluster, fetchImpl, }: {
32
32
  cert: any;
33
33
  cluster?: string | undefined;
34
34
  endedAt: any;
@@ -58,7 +58,7 @@ export declare function fetchVouchers({ server, game, round, wallet, fetchImpl }
58
58
  * Returns { wallet, grant, incarnation, publicKey, signature, round, expires, personHash, amount } for js/play claimGrant,
59
59
  * plain JSON (`incarnation` and `amount` as decimal text), so a server can send it as it is.
60
60
  */
61
- export declare function signVoucher({ signer, game, grant, incarnation, wallet, round, now, seconds, personHash, amount }: {
61
+ export declare function signVoucher({ signer, game, grant, incarnation, wallet, round, now, seconds, personHash, amount, }: {
62
62
  amount?: bigint | undefined;
63
63
  game: any;
64
64
  grant: any;
@@ -95,7 +95,7 @@ export declare const draws: {
95
95
  signMessage: any;
96
96
  }) => Promise<any>;
97
97
  /** A player enters with their play-host token, or with their wallet's signature (`wallet`, `signMessage`). */
98
- enter: ({ server, game, draw, token, wallet, signMessage, cluster, fetchImpl }: {
98
+ enter: ({ server, game, draw, token, wallet, signMessage, cluster, fetchImpl, }: {
99
99
  cluster?: string | undefined;
100
100
  draw: any;
101
101
  fetchImpl?: typeof fetch | undefined;
@@ -106,7 +106,7 @@ export declare const draws: {
106
106
  wallet?: null | undefined;
107
107
  }) => Promise<any>;
108
108
  /** Locks the players the server holds now to `beacon`, a drand round still to come. Checks their hash itself. */
109
- lock: ({ server, game, draw, beacon, signMessage, by, cert, cluster, net, fetchImpl }: {
109
+ lock: ({ server, game, draw, beacon, signMessage, by, cert, cluster, net, fetchImpl, }: {
110
110
  beacon: any;
111
111
  by: any;
112
112
  cert?: null | undefined;
@@ -141,7 +141,7 @@ export declare const giveaways: {
141
141
  winners: any;
142
142
  }) => Promise<any>;
143
143
  /** Reports its result, signed by its session key. `grant`: the host's grant (each winner is paid from it). */
144
- report: ({ server, game, giveaway, session, endedAt, winners, grant, cluster, fetchImpl }: {
144
+ report: ({ server, game, giveaway, session, endedAt, winners, grant, cluster, fetchImpl, }: {
145
145
  cluster?: string | undefined;
146
146
  endedAt: any;
147
147
  fetchImpl?: typeof fetch | undefined;
@@ -153,3 +153,4 @@ export declare const giveaways: {
153
153
  winners: any;
154
154
  }) => Promise<any>;
155
155
  };
156
+ export { codeAddresses, codeKey, codeVoucher, collectiblesOf, holds, makeCodes, normalizeCode, proofRequest, proofText, readProof, verifyProof, } from './server.js';
@@ -0,0 +1,126 @@
1
+ /**
2
+ * The game's collectibles `wallet` holds now, read from the chain (Metaplex Core assets of the live spec's collection
3
+ * and of the collections it names): [{ asset, item (its key in the spec, or null), itemId, name, uri, attributes,
4
+ * frozen }]. `rpc`: an RPC link or a `rpcClient`. Token Metadata and compressed NFTs are not read here.
5
+ */
6
+ export declare function collectiblesOf({ rpc, spec, wallet }: {
7
+ rpc: any;
8
+ spec: any;
9
+ wallet: any;
10
+ }): Promise<{
11
+ owner: string;
12
+ collection: string | null;
13
+ name: string;
14
+ uri: string;
15
+ attributes: {};
16
+ frozen: boolean;
17
+ soulbound: boolean;
18
+ asset: any;
19
+ itemId: number | null;
20
+ item: any;
21
+ }[]>;
22
+ /**
23
+ * Whether `wallet` holds at least `atLeast` of the game's collectible `item` (its key in the spec), or of any of the
24
+ * game's collectibles when `item` is left out. With `attribute`, only those whose number under it is at least
25
+ * `minimum` count (a level, a rarity). → the count it holds when that is enough, else 0.
26
+ */
27
+ export declare function holds({ rpc, spec, wallet, item, atLeast, attribute, minimum }: {
28
+ atLeast?: number | undefined;
29
+ attribute?: null | undefined;
30
+ item?: null | undefined;
31
+ minimum?: number | undefined;
32
+ rpc: any;
33
+ spec: any;
34
+ wallet: any;
35
+ }): Promise<number>;
36
+ /** The exact text a wallet signs to prove it is its owner's: fixed lines, so nothing else can be passed off as it. */
37
+ export declare const proofText: ({ cluster, game, wallet, purpose, nonce, expires }: {
38
+ cluster?: string | undefined;
39
+ expires: any;
40
+ game: any;
41
+ nonce: any;
42
+ purpose: any;
43
+ wallet: any;
44
+ }) => string;
45
+ /**
46
+ * A proof to ask of `wallet`, made by the server: { text, nonce, expires }. The server keeps `nonce` until `expires`
47
+ * (unix seconds, `seconds` from now) and takes each nonce once, so a signed proof can't be replayed.
48
+ */
49
+ export declare function proofRequest({ cluster, game, wallet, purpose, seconds, now, }: {
50
+ cluster?: string | undefined;
51
+ game: any;
52
+ now?: number | undefined;
53
+ purpose?: string | undefined;
54
+ seconds?: number | undefined;
55
+ wallet: any;
56
+ }): {
57
+ text: string;
58
+ nonce: string;
59
+ expires: number;
60
+ };
61
+ /** A proof text's fields, or null when it is not one. */
62
+ export declare function readProof(text: any): {
63
+ expires: any;
64
+ } | null;
65
+ /**
66
+ * Checks a wallet's signed proof: the text is a proof for this `game` (and `purpose`, when given), for `wallet`, not
67
+ * expired at `now`, and `signature` (base58, or 64 bytes) is that wallet's Ed25519 signature of it. → the proof's
68
+ * fields ({ wallet, nonce, expires, … }), or throws in words. Taking each nonce once is the caller's: check
69
+ * `fields.nonce` against the ones the server handed out and not yet used.
70
+ */
71
+ export declare function verifyProof({ text, signature, wallet, game, purpose, cluster, now, }: {
72
+ cluster?: string | undefined;
73
+ game: any;
74
+ now?: number | undefined;
75
+ purpose?: null | undefined;
76
+ signature: any;
77
+ text: any;
78
+ wallet: any;
79
+ }): Promise<{
80
+ expires: any;
81
+ }>;
82
+ /**
83
+ * `n` fresh promo codes, each `bits` of randomness (80 by default, 16 characters of Crockford base32, in groups of 4).
84
+ * A code's key is in the spec for anyone to read, so a short code can be found by trying them all offline: fewer than
85
+ * 64 bits is refused.
86
+ */
87
+ export declare function makeCodes(n: any, { bits, group }?: {
88
+ bits?: number | undefined;
89
+ group?: number | undefined;
90
+ }): string[];
91
+ /** A code as typed, read the forgiving way (Crockford): case, spaces and dashes don't matter, O reads 0, I and L read 1. */
92
+ export declare const normalizeCode: (code: any) => string;
93
+ /** The key a code stands for: { address, sign } (Ed25519, its seed sha256 of the domain and the code). */
94
+ export declare function codeKey(code: any, { domain }?: {
95
+ domain?: string | undefined;
96
+ }): Promise<{
97
+ address: string;
98
+ sign: (message: any) => Promise<Uint8Array<ArrayBuffer>>;
99
+ }>;
100
+ /** The public keys for a grant's `keys`, one per code, in order. */
101
+ export declare const codeAddresses: (codes: any, options: any) => Promise<any[]>;
102
+ /**
103
+ * A voucher a typed code signs for `wallet` (the page, or a server, makes it): the grant pays it once per code with
104
+ * `limits.perKey: 1`. Its round is the code's own, so one wallet can't use one code twice either. `incarnation` is the
105
+ * grant's, read from the chain; `now` the cluster's clock.
106
+ */
107
+ export declare function codeVoucher({ code, game, grant, incarnation, wallet, now, seconds, domain, }: {
108
+ code: any;
109
+ domain?: string | undefined;
110
+ game: any;
111
+ grant: any;
112
+ incarnation: any;
113
+ now: any;
114
+ seconds?: number | undefined;
115
+ wallet: any;
116
+ }): Promise<{
117
+ wallet: any;
118
+ grant: any;
119
+ incarnation: string;
120
+ publicKey: any;
121
+ signature: string;
122
+ round: any;
123
+ expires: number;
124
+ personHash: string;
125
+ amount: string;
126
+ }>;
@@ -56,7 +56,7 @@ export declare const revokeText: ({ cluster, game, host }: {
56
56
  * `slug`: the game's play-host name (its tokens' audience), or '-'; `rates`: the sha256 of the engine's rates (canonical
57
57
  * JSON), or 'default'.
58
58
  */
59
- export declare const drawText: ({ cluster, game, draw, engine, winners, prizes, payout, identity, slug, rates }: {
59
+ export declare const drawText: ({ cluster, game, draw, engine, winners, prizes, payout, identity, slug, rates, }: {
60
60
  cluster?: string | undefined;
61
61
  draw: any;
62
62
  engine: any;