@xgamesfun/solana 0.25.3 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +145 -228
  2. package/js/approve/details.mjs +52 -2
  3. package/js/approve/live-check.mjs +0 -15
  4. package/js/approve/server.mjs +5 -4
  5. package/js/chain/token2022.js +3 -2
  6. package/js/client/accounts.js +67 -25
  7. package/js/client/grant.js +7 -2
  8. package/js/client/idl/loot.js +1 -1
  9. package/js/client/idl/loot.json +714 -182
  10. package/js/client/ix.js +617 -113
  11. package/js/client/sizes.js +35 -3
  12. package/js/economy/check.mjs +655 -242
  13. package/js/economy/cost.mjs +2 -4
  14. package/js/economy/explain.mjs +16 -2
  15. package/js/economy/guide.mjs +12 -12
  16. package/js/economy/model.mjs +133 -14
  17. package/js/economy/plan.mjs +36 -11
  18. package/js/economy/review.mjs +50 -8
  19. package/js/economy/schema.json +73 -29
  20. package/js/economy/simulate.mjs +116 -13
  21. package/js/mcp/tools.mjs +2 -2
  22. package/js/play/index.js +847 -296
  23. package/package.json +1 -1
  24. package/release.json +5 -5
  25. package/skills/xsolana-economy/SKILL.md +12 -4
  26. package/skills/xsolana-economy/references/after-launch.md +1 -1
  27. package/skills/xsolana-economy/references/apps.md +11 -2
  28. package/skills/xsolana-economy/references/sentence-to-spec.md +3 -3
  29. package/skills/xsolana-economy/references/telling-the-person.md +21 -4
  30. package/skills/xsolana-economy/references/trust-and-cheating.md +15 -5
  31. package/types/chain/token2022.d.ts +3 -2
  32. package/types/client/accounts.d.ts +34 -11
  33. package/types/client/idl/loot.d.ts +25 -4
  34. package/types/client/ix.d.ts +217 -45
  35. package/types/economy/check.d.mts +5 -0
  36. package/types/economy/model.d.mts +75 -12
  37. package/types/economy/plan.d.mts +22 -1
  38. package/types/economy/simulate.d.mts +12 -1
  39. package/types/mcp/server.d.mts +12 -1
  40. package/types/mcp/tools.d.mts +12 -1
  41. package/types/play/index.d.ts +210 -144
@@ -1005,11 +1005,20 @@ export declare const instructionOf: (data: any) => {
1005
1005
  args: ({
1006
1006
  name: string;
1007
1007
  type: {
1008
+ defined?: undefined;
1008
1009
  array: (string | number)[];
1009
1010
  };
1010
1011
  } | {
1011
1012
  name: string;
1012
1013
  type: string;
1014
+ } | {
1015
+ name: string;
1016
+ type: {
1017
+ array?: undefined;
1018
+ defined: {
1019
+ name: string;
1020
+ };
1021
+ };
1013
1022
  })[];
1014
1023
  } | {
1015
1024
  name: string;
@@ -3424,6 +3433,18 @@ export declare function shownAccounts(project: any, shown: any): {
3424
3433
  * one, or for a box's odds.
3425
3434
  */
3426
3435
  export declare const gateAccounts: (project: any, { gate, wallet, shown, listProof }?: Readonly<Record<string, any>>) => any[];
3436
+ /** Whether a rule reads the player's profile (`Of::Profile`), not an NFT. */
3437
+ export declare const readsProfile: (rule: any) => boolean;
3438
+ /**
3439
+ * Whether a box's gate or odds read the player's profile (`profile` true) or an NFT (false), as the program's
3440
+ * `LootBox::reads` tells: a gate on a rule, then each odds rule. A box may read both.
3441
+ */
3442
+ export declare const boxReads: (box: any, profile: any) => boolean;
3443
+ /**
3444
+ * What a player shows a gate with (`rules::shown_for`): their own profile, `["profile", project, wallet]`, for a gate on
3445
+ * a rule that reads one; the NFT `shown` otherwise.
3446
+ */
3447
+ export declare const shownFor: (project: any, gate: any, wallet: any, shown: any) => any;
3427
3448
  /**
3428
3449
  * A nonce a prize route names (its `nonce` argument), from what names the prize: a grant, its wallet and rounds, a
3429
3450
  * contest and its player, an auction and its last bid. Any nonce works (the sender picks it); the roll's order
@@ -3608,11 +3629,15 @@ export declare function withDefaults(def: any): {
3608
3629
  [x: string]: any;
3609
3630
  Lottery?: undefined;
3610
3631
  };
3632
+ /** The most "one of" texts a lottery's NFT ticket rule holds: the oracle's answer reads it (`lottery.rs`). */
3633
+ export declare const MAX_TICKET_TEXTS = 170;
3634
+ /** The most places of a lottery that give NFTs of its own stash (`MOST_OWN`): the oracle's answer loads their list. */
3635
+ export declare const MAX_OWN_STASH_PLACES = 256;
3611
3636
  /**
3612
3637
  * The owner writes one record (`def`: { Item: { id, args } }, { Box: … }, …), at its own address. A lottery names
3613
3638
  * its mint, the pot its terms pay from (which a write opens when it isn't open; pot 0's address for a lottery whose
3614
3639
  * rounds pay from their own money, where any account will do), its ticket mint, both token programs and the round it waits on
3615
- * (`lotteryState`: the lottery as it is, null for a new one; `idleRound`: its current round's record, or round 0's once
3640
+ * (`lotteryState`: the lottery as it is, null for a new one; `idleRound`: its current round's record, or its last round's once
3616
3641
  * it drew once and ended: a lottery made again, edited once ended or made to repeat waits while that round runs or
3617
3642
  * still owes NFTs of its own stash), then its own stash when a place holds or draws an NFT of it. A box, a recipe, a grant or a lottery that
3618
3643
  * names a box to roll later passes that box after (`boxesAccounts`), which must be written: a box is written before
@@ -3632,7 +3657,7 @@ export declare function upsertIx({ owner, project, def: given, lotteryState }: {
3632
3657
  * The owner closes the record at `target`, and its rent comes back: a grant's with the funds it held. A lottery
3633
3658
  * (`lottery`: its decoded record) sends what every pot it opened holds (`Lottery::pots`) to `to`, a token account of its
3634
3659
  * mint (the owner's own by default), and closes each, once its current round has no record (one that drew once and
3635
- * ended: once its round 0 gave out every NFT of its own stash, `idleRound`), and once the round its `owing` names has
3660
+ * ended: once its last round gave out every NFT of its own stash, `idleRound`), and once the round its `owing` names has
3636
3661
  * moved in what it owes its pot (pull it first, `Part::Common`). One that never opened a pot names only those rounds.
3637
3662
  */
3638
3663
  export declare function closeRecordIx({ owner, project, target, lottery, schedule, programs, to, extra }: {
@@ -3675,13 +3700,14 @@ export declare function payIx({ player, project, mint, treasury, amount, shares,
3675
3700
  * numbers of the NFT it rolls on: at that NFT's, `nonceOn`, whatever `nonce` says). `poolMints` maps each pool its
3676
3701
  * prizes take tokens from to its mint (a pool's tokens won wait in the project's vault for that mint); one not given
3677
3702
  * is taken to be in the box's currency, one given as null is closed. `shown`: an NFT the player shows for the box's
3678
- * gate or odds; `listProof`: for a list gate, the proof's nodes. `chosenRecipient`: the wallet (or, for a share with an
3703
+ * gate or odds; the player's profile goes before it whenever the box's gate or odds read one (`boxReads`); `listProof`:
3704
+ * for a list gate, the proof's nodes. `chosenRecipient`: the wallet (or, for a share with an
3679
3705
  * item, the collectible, `chosen`) the buyer names for a share the box lets them choose. Every open asks the oracle,
3680
3706
  * even of a box with nothing random (which sells in one step with `buyIx`, when it rolls on no NFT).
3681
3707
  * The player opens the project's vault for the price's mint, and for each prize's, when it is not there. A box that
3682
3708
  * limits each wallet counts the purchase in the player's counts (`pda.counts`, its rent theirs).
3683
3709
  */
3684
- export declare function openBoxIx({ player, project, box, boxAddress, nonce, maxPrice, count, items, shown, listProof, subject, chosenRecipient, chosen, settler, poolMints, playerToken, programs, extra, }: {
3710
+ export declare function openBoxIx({ player, project, box, boxAddress, nonce, maxPrice, count, items, shown, profile, listProof, subject, chosenRecipient, chosen, settler, poolMints, playerToken, programs, extra, }: {
3685
3711
  box: any;
3686
3712
  boxAddress: any;
3687
3713
  chosen?: null | undefined;
@@ -3695,6 +3721,7 @@ export declare function openBoxIx({ player, project, box, boxAddress, nonce, max
3695
3721
  player: any;
3696
3722
  playerToken: any;
3697
3723
  poolMints: any;
3724
+ profile: any;
3698
3725
  programs: any;
3699
3726
  project: any;
3700
3727
  settler?: string | undefined;
@@ -3780,12 +3807,15 @@ export declare function callbackRollIx({ order, orderState, box, boxAddress, ran
3780
3807
  * Item the item; for a collectible (`items[id]` its decoded Item), its collection, its address, Metaplex Core;
3781
3808
  * for a fresh one (`drawn` set), then the table of each of its table traits
3782
3809
  * Tokens the mint, the project's vault for it, the player's account of it (`prizeTo`, when given)
3810
+ * `giveUp`: the places in `won` of the prizes the player, settling their own order, gives up (tokens they can't receive
3811
+ * stay in the project's vault; a collectible's serial is voided): the vault, or the item, goes in the receiver's place.
3783
3812
  * Nft the NFT as `piece` takes it (`nfts[nft]` its kind), going to the player, then a compressed NFT's proof
3784
3813
  * Compressed the item, the tree's config, the tree, the collection, Bubblegum's programs; for a fresh one, then its
3785
3814
  * tables and the Sheet of the NFT it mints
3786
3815
  */
3787
- export declare function wonAccounts({ order, items, nfts, prizeTo, putBack, programs, from, upto, tree, treeMinted, unminted, }: {
3816
+ export declare function wonAccounts({ order, items, nfts, prizeTo, putBack, giveUp, programs, from, upto, tree, treeMinted, unminted, }: {
3788
3817
  from?: number | undefined;
3818
+ giveUp?: never[] | undefined;
3789
3819
  items?: {} | undefined;
3790
3820
  nfts?: {} | undefined;
3791
3821
  order: any;
@@ -3844,17 +3874,22 @@ export declare const SETTLE_LAST = 4294967295;
3844
3874
  * the settle opens or mints (Core assets, token accounts, Sheets, a stash's row, the fate's writes: the order lends
3845
3875
  * nothing, `settleRent`). `order` is the decoded Order; `projectState` the decoded Project; `items` and `nfts` as
3846
3876
  * `wonAccounts` takes them. `putBack`: NFTs won that the player, signing, puts back into their stash in place of taking
3847
- * them (one its collection won't let move). `handBack`: the wallet the box's fate gives the NFT rolled on to
3877
+ * them (one its collection won't let move). `giveUp`: the places in `won` of tokens or collectibles the player,
3878
+ * signing, gives up because they can't receive them (an account its issuer froze, a collection that refuses the mint),
3879
+ * so the rest of the order is not held up: tokens given up stay in the project's vault (`PrizeForgone` says which).
3880
+ * `handBack`: the wallet the box's fate gives the NFT rolled on to
3848
3881
  * (`receiverOf`) is an account of the loot program (`handsBack` of it as read), so the program gives it back to the
3849
3882
  * player, and a Token Metadata NFT's `token` is the player's. `extra`: a hook's or a memo's accounts.
3850
3883
  *
3851
3884
  * `upto`, the part (`settle.rs`): `SETTLE_LAST` (the default, past the end) is the last part, all that is left (maybe
3852
3885
  * nothing); 0 gives no prize and only splits the payment; any other gives the prizes from where the last part stopped
3853
3886
  * (`settled`) up to it, and nothing more. The first call, whichever it is, splits the payment (its shares' accounts
3854
- * ride on it).
3887
+ * ride on it whenever `order.drew` is above 0, a roll that gave nothing included), and moves the numbers on an NFT
3888
+ * rolled on that the project does not hold (that NFT's accounts ride on it, not on the last part).
3855
3889
  */
3856
- export declare function settleIx({ signer, orderAddress, order, projectState, items, nfts, prizeTo, putBack, subject, handBack, holders, programs, upto, tree, treeMinted, unminted, extra, }: {
3890
+ export declare function settleIx({ signer, orderAddress, order, projectState, items, nfts, prizeTo, putBack, giveUp, subject, handBack, holders, programs, upto, tree, treeMinted, unminted, extra, }: {
3857
3891
  extra?: never[] | undefined;
3892
+ giveUp: any;
3858
3893
  handBack?: boolean | undefined;
3859
3894
  holders: any;
3860
3895
  items: any;
@@ -3922,8 +3957,9 @@ export declare function refundIx({ signer, orderAddress, order, subject, program
3922
3957
  * a free roll back to waiting (`Waiting`), for a restock or for its player to end it so. Once asked, every later ask
3923
3958
  * comes in a later slot than the last (`SameSlot`, `rollAskable`).
3924
3959
  */
3925
- export declare function askRollIx({ payer, orderAddress, order, box, settler, poolMints, items, programs }: {
3960
+ export declare function askRollIx({ payer, orderAddress, order, box, settler, poolMints, items, programs, shown, first, }: {
3926
3961
  box: any;
3962
+ first?: boolean | undefined;
3927
3963
  items?: {} | undefined;
3928
3964
  order: any;
3929
3965
  orderAddress: any;
@@ -3931,11 +3967,36 @@ export declare function askRollIx({ payer, orderAddress, order, box, settler, po
3931
3967
  poolMints: any;
3932
3968
  programs: any;
3933
3969
  settler?: string | undefined;
3970
+ shown?: null | undefined;
3934
3971
  }): {
3935
3972
  programId: string;
3936
3973
  keys: any[];
3937
3974
  data: Uint8Array<any>;
3938
3975
  }[];
3976
+ /**
3977
+ * What a roll's first ask reads for its box's odds (`ask_roll`): `profile`, the order's player's profile, when any odds
3978
+ * rule of the box reads a profile; `nft`, an NFT the player shows, when any reads an NFT and the roll is on none (neither
3979
+ * the box nor the order names one). Unlike a purchase, a gate is not read at the ask.
3980
+ */
3981
+ export declare function askReads(box: any, order?: {}): {
3982
+ profile: any;
3983
+ nft: any;
3984
+ };
3985
+ /**
3986
+ * Whether the next ask of `order` is its first, the one that reads the odds' accounts: it was never asked
3987
+ * (`asked_first` 0, or an order not made yet), or its box was edited since (the edit cleared what it read).
3988
+ */
3989
+ export declare const firstAsk: (order: any, box: any) => boolean;
3990
+ /**
3991
+ * How much each NFT of `nfts` would raise a box's odds at a roll's first ask, by the box's rules on an NFT, and the one
3992
+ * that raises the most: { best, raised }. `nfts`: [{ asset, itemId, attributes }] as read (a Core collectible of the
3993
+ * project's: its item and its attributes). `raised` maps each asset to the basis points its rules add in all. A rule
3994
+ * on time (`Ahead`, `Passed`, `Within`, `Older`) or on another collection counts nothing here; pass such an NFT by name.
3995
+ */
3996
+ export declare function bestShown(box: any, nfts: any): {
3997
+ best: any;
3998
+ raised: {};
3999
+ };
3939
4000
  /**
3940
4001
  * The authority moves the project's tokens: `from` { Pool: [i] }, { Mint: [mint] } (newly minted) or { Farm: [id] } (what
3941
4002
  * that farm's rewards vault holds free, beyond what it owes its seats: a fixed amount; `farm`: the farm decoded, so its
@@ -3984,14 +4045,20 @@ export declare function collectibleIx({ authority, project, collection, asset, c
3984
4045
  keys: any[];
3985
4046
  data: Uint8Array<any>;
3986
4047
  };
4048
+ /**
4049
+ * The attributes a make writes, as the program patches them onto nothing (`write_attributes`): the program's own keys
4050
+ * dropped, a repeated key once with its last value, an empty value taking the key off.
4051
+ */
4052
+ export declare function madeAttributes(attributes?: any[]): any[];
3987
4053
  /**
3988
4054
  * The authority makes one of item `item` (`itemState`: its decoded Item, for its collection and next serial) for each
3989
4055
  * of `owners`, in serial order (an owner may come more than once), with `attributes` written over the program's own: a
3990
4056
  * collectible at `pda.itemAsset(item, serial)` (`madeAssets` says which), or with `tree`, a compressed NFT minted into
3991
- * that tree of the project's (no attributes: they go in its Sheet). A switched-off item still makes; one sold out
3992
- * refuses the whole call (`PrizeNotCovered`).
4057
+ * that tree of the project's, whose attributes go in its Sheet (`["sheet", project, asset id]`, after its 9 prize
4058
+ * accounts): `treeMinted` is how many the tree has minted, so the first is `pda.compressedAsset(tree, treeMinted)`. A
4059
+ * switched-off item still makes; one sold out refuses the whole call (`PrizeNotCovered`).
3993
4060
  */
3994
- export declare function makeIx({ authority, project, item, itemState, owners, attributes, tree, reference: ref }: {
4061
+ export declare function makeIx({ authority, project, item, itemState, owners, attributes, tree, treeMinted, reference: ref, }: {
3995
4062
  attributes?: never[] | undefined;
3996
4063
  authority: any;
3997
4064
  item: any;
@@ -4000,6 +4067,7 @@ export declare function makeIx({ authority, project, item, itemState, owners, at
4000
4067
  project: any;
4001
4068
  reference: any;
4002
4069
  tree?: null | undefined;
4070
+ treeMinted: any;
4003
4071
  }): {
4004
4072
  programId: string;
4005
4073
  keys: any[];
@@ -4239,6 +4307,17 @@ export declare const raffledNft: (stash: any, answer: any, place: any) => any;
4239
4307
  * taken out before the next. null for a place whose NFT isn't there (it gets nothing).
4240
4308
  */
4241
4309
  export declare function stashNfts(r: any, stash: any): any;
4310
+ /** The most of the lottery's own stash's NFTs one pull takes out for its places (`ASSIGN_DRAWS`), counted in draws: a
4311
+ * named NFT's search counts one, and one more for each `ASSIGN_ROWS_A_DRAW` rows of the stash. A pull after carries on. */
4312
+ export declare const ASSIGN_DRAWS = 64;
4313
+ export declare const ASSIGN_ROWS_A_DRAW = 1000;
4314
+ /**
4315
+ * How many of a drawn round's places that win an NFT of the lottery's own stash have theirs out of the stash after one
4316
+ * more pull for a place up to `upto` (`LotteryRound::assign`): `r.assigned`, plus as many as one pull takes, in place
4317
+ * order. `stash` is the lottery's own stash, decoded as it is now (its rows count for a named NFT's search). A pull
4318
+ * stops at a place whose NFT is not out yet, so it carries accounts only for places below this.
4319
+ */
4320
+ export declare function pullAssigns(r: any, stash: any, upto: any): number;
4242
4321
  /**
4243
4322
  * Anyone (`payer`) pulls `part` of the round at `roundAddress` (`round` decoded; `partsOwed` and `commonOwed` say what is
4244
4323
  * owed):
@@ -4256,9 +4335,15 @@ export declare function stashNfts(r: any, stash: any): any;
4256
4335
  * cancel (past it), paid where it goes (`holders`, `programs`); `toTreasury` when that can't take it
4257
4336
  * (a pool never opened, the pot closed since or made again in another mint, an account gone: a
4258
4337
  * holder nobody is is found here).
4259
- * The pull that leaves nothing owed closes the round (`projectState`: its treasury and owner; `lotteryClosed` when the
4260
- * lottery is gone, so rent it lent goes to the owner). A round that owes nothing and waits only for its close is closed
4261
- * by any pull.
4338
+ * The pull that leaves nothing owed closes the round (`projectState`: its treasury and owner). While the lottery is
4339
+ * there, the close names it for the rent it lent; once it is gone (`lotteryClosed`), that rent goes to the project's
4340
+ * owner, and only the owner's own closing pull may send it: anyone else's leaves the close off and the round waits. A
4341
+ * round that owes nothing and waits only for its close is closed by any pull. A place's prize that is not tokens is
4342
+ * given as far as `prize.most` places a pull (a run of rolls: two accounts a place; size it from a dry run), and the
4343
+ * lottery's own stash's NFTs as far as one pull takes them out (`pullAssigns`): a pull that stops short carries no
4344
+ * close, and the next carries on. Every pull of one entry's places names the same `nonce`: a place's roll is made at
4345
+ * `prizeRollNonce(nonce + place)`, so a later pull with another nonce can land on an order an earlier pull made and fail
4346
+ * ("already in use"). js/play names `prizeNonce(round, entry)` for every pull of an entry, whoever sends it.
4262
4347
  */
4263
4348
  export declare function pullIx({ payer, project, roundAddress: key, round: r, entry, part, projectState, ticket, handBack, hold, nonce, prize, holders, toTreasury, lotteryClosed, programs, extra, }: {
4264
4349
  entry?: number | undefined;
@@ -4284,9 +4369,13 @@ export declare function pullIx({ payer, project, roundAddress: key, round: r, en
4284
4369
  data: Uint8Array<any>;
4285
4370
  };
4286
4371
  /** The orders the rolls a `{ Prize: [run] }` pull of entry `entry` makes (a place's prize that is a roll), each with its
4287
- * box: [{ order, box }], at `prizeRollNonce(nonce + place)` for the entry's buyer. Ask each in the pull's transaction. */
4288
- export declare function pullRolls({ project, round: r, entry, part, nonce }: {
4372
+ * box: [{ order, box }], at `prizeRollNonce(nonce + place)` for the entry's buyer, the first `most` of its places owed
4373
+ * when the pull carries no more (`pullIx`'s `prize.most`). Ask each in the pull's transaction. Every pull of one entry's
4374
+ * places names the same `nonce` (a different one can land on an order an earlier pull made, "already in use"): js/play
4375
+ * names `prizeNonce(round, entry)` for all of them. */
4376
+ export declare function pullRolls({ project, round: r, entry, part, nonce, most }: {
4289
4377
  entry: any;
4378
+ most?: null | undefined;
4290
4379
  nonce?: bigint | undefined;
4291
4380
  part: any;
4292
4381
  project: any;
@@ -4789,7 +4878,9 @@ export declare const stakeNftIx: ({ player, project, id, farm, asset, collection
4789
4878
  };
4790
4879
  /**
4791
4880
  * `player` takes an NFT out once its lock has run: it grows on its way out (a farm with growth writes on it, or on its
4792
- * Sheet), and from its own seat takes its tier's prize. `forfeit` gives up the rewards and the prize. Leaving a tier
4881
+ * Sheet), and from its own seat takes its tier's prize. `forfeit` gives up the rewards and the prize. `needPrize` (true
4882
+ * by default): a mission prize that can't be given refuses the unstake (`PrizeNotCovered`) and the seat stays; false
4883
+ * lets the NFT go home without it (`Unseated.prize_missed`). Leaving a tier
4793
4884
  * that rolls (`roll`: its box id, `boxes` its decoded box by id), the NFT is rolled on that box, in an order named by
4794
4885
  * `nonce` (`namedRollNonce`: the NFT's own on a box that holds it; its player or the project's keys then ask the oracle,
4795
4886
  * `askRollIx`, and settles); a box that can burn it or give it away keeps it in the project's hands until then. `more`
@@ -4797,7 +4888,7 @@ export declare const stakeNftIx: ({ player, project, id, farm, asset, collection
4797
4888
  * in the same call, one fee, one transfer of rewards: by their seats' addresses, the `i`th's roll at `nonce + 2i` and its
4798
4889
  * prize's at `nonce + 2i + 1` (`seatNonces` says which NFT has which). One still locked refuses the whole call.
4799
4890
  */
4800
- export declare const unstakeNftIx: ({ player, project, id, farm, asset, collection, hasAuthority, tokenMetadata: tm, compressed, forfeit, roll, nonce, tier, projectCollection, poolMints, items, nft, boxes, programs, more, extra, }: {
4891
+ export declare const unstakeNftIx: ({ player, project, id, farm, asset, collection, hasAuthority, tokenMetadata: tm, compressed, forfeit, needPrize, roll, nonce, tier, projectCollection, poolMints, items, nft, boxes, programs, more, extra, }: {
4801
4892
  asset: any;
4802
4893
  boxes?: {} | undefined;
4803
4894
  collection: any;
@@ -4809,6 +4900,7 @@ export declare const unstakeNftIx: ({ player, project, id, farm, asset, collecti
4809
4900
  id: any;
4810
4901
  items: any;
4811
4902
  more?: never[] | undefined;
4903
+ needPrize?: boolean | undefined;
4812
4904
  nft: any;
4813
4905
  nonce?: bigint | undefined;
4814
4906
  player: any;
@@ -4896,12 +4988,17 @@ export declare const refreshSeatIx: ({ signer, project, id, farm, by, seat, coll
4896
4988
  * (`items[id].collection`, the decoded Items; `collection` when not given), written for a burn: Core writes it as it
4897
4989
  * burns a collectible. A recipe's `raises` write on the kept ones, in their Sheet when the project has no
4898
4990
  * authority over them. The player opens any account a line pays into that is not there. A roll it makes (a
4899
- * `Prize::Roll` or a `RollOn`) passes its box and its order, nothing more; a `RollOn`'s order is where `namedRollNonce`
4900
- * says, which reads the rolled box (`boxes`: a box's id to its decoded LootBox). Its player or the project's keys then ask for the roll
4901
- * (`askRollIx`, in the same transaction when it fits).
4991
+ * `Prize::Roll` or a `RollOn`) passes its box and its order, nothing more. A recipe may give several rolls: each is at
4992
+ * the craft's `nonce` plus the rolls before it in the recipe's order (`craftRollNonces`); a `RollOn`'s order is where
4993
+ * `namedRollNonce` says of that, which reads the rolled box (`boxes`: a box's id to its decoded LootBox). Its player or
4994
+ * the project's keys then ask for the roll (`askRollIx`, in the same transaction when it fits).
4995
+ * A payment line nobody can take goes to the treasury (`Crafted.to_treasury`): a collectible nobody holds or the project
4996
+ * holds (`holders`: who holds each now, as read when building; if it changes hands before the craft lands, the craft
4997
+ * fails cleanly), the project's own address, or an address `lootAccounts` names (wallets read as accounts of the loot
4998
+ * program). The treasury's wallet and its account then follow that line's accounts (`treasury`).
4902
4999
  * A craft makes several Core calls: raise the compute limit. `extra`: a token's hook accounts.
4903
5000
  */
4904
- export declare function craftIx({ player, project, collection, id, recipe, assets, times, nonce, holders, programs, treasury, poolMints, items, nfts, boxes, extra, }: {
5001
+ export declare function craftIx({ player, project, collection, id, recipe, assets, times, nonce, holders, programs, treasury, poolMints, items, nfts, boxes, lootAccounts, extra, }: {
4905
5002
  assets?: never[] | undefined;
4906
5003
  boxes?: {} | undefined;
4907
5004
  collection: any;
@@ -4909,6 +5006,7 @@ export declare function craftIx({ player, project, collection, id, recipe, asset
4909
5006
  holders: any;
4910
5007
  id: any;
4911
5008
  items?: {} | undefined;
5009
+ lootAccounts?: never[] | undefined;
4912
5010
  nfts?: {} | undefined;
4913
5011
  nonce?: bigint | undefined;
4914
5012
  player: any;
@@ -4923,6 +5021,18 @@ export declare function craftIx({ player, project, collection, id, recipe, asset
4923
5021
  keys: any[];
4924
5022
  data: Uint8Array<any>;
4925
5023
  };
5024
+ /**
5025
+ * Whether a payment to `to` finds nobody to take it (`rail::Target::Nowhere`), so a recipe's line goes to the treasury:
5026
+ * a collectible nobody holds, or the project holds (`holders`: who holds each now); a wallet that is the project's own
5027
+ * address or an account of the loot program (`lootAccounts`, as read). A pool or a token account always takes it.
5028
+ */
5029
+ export declare function paysNowhere(project: any, to: any, { holders, lootAccounts }?: Readonly<Record<string, any>>): any;
5030
+ /**
5031
+ * The nonce each roll a craft of `recipe` makes is named at, in the recipe's outputs' order: [{ output, nonce }], the
5032
+ * first at `nonce`, each next one more. A `RollOn` on an NFT its box holds is made at that NFT's own nonce
5033
+ * (`namedRollNonce`), but counts all the same.
5034
+ */
5035
+ export declare function craftRollNonces(recipe: any, nonce?: bigint): any;
4926
5036
  /** The collectibles a craft of `recipe` makes: one per `Item` prize among its outputs. */
4927
5037
  export declare const craftNewAssets: (recipe: any) => any;
4928
5038
  /**
@@ -4972,6 +5082,29 @@ export declare function stashIx({ signer, project, id, lottery, lotteryState, as
4972
5082
  keys: any[];
4973
5083
  data: Uint8Array<any>;
4974
5084
  };
5085
+ /**
5086
+ * How many NFTs of one kind one `stash` call puts in, measured on the program (`tests/v026_stash_batch.rs`): in a legacy
5087
+ * transaction, with a lookup table, and with a lookup table and the most memory asked for. A compressed NFT needs its
5088
+ * proof in the same transaction (`proveLeafIx`): one a call.
5089
+ */
5090
+ export declare const STASH_BATCH: Readonly<{
5091
+ own: number[];
5092
+ core: number[];
5093
+ tokenMetadata: number[];
5094
+ programmable: number[];
5095
+ compressed: number[];
5096
+ }>;
5097
+ /** The kind of an NFT as `stashIx` takes it, for `STASH_BATCH`: the project's own Core collectible ('own'), another
5098
+ * collection's Core NFT ('core', `hasAuthority` false), a Token Metadata NFT ('tokenMetadata', or 'programmable' for a
5099
+ * pNFT) or a compressed one ('compressed'). */
5100
+ export declare const stashKind: (n: any) => "compressed" | "core" | "own" | "programmable" | "tokenMetadata";
5101
+ /**
5102
+ * A long list of NFTs to put in a stash (each { asset, weight, collection, hasAuthority, tokenMetadata, compressed }, as
5103
+ * `stashIx` takes them), split into calls of one kind each, as many a call as the measured sizes allow (`STASH_BATCH`):
5104
+ * `lookupTable` when the transactions carry one, `heap` when they also ask for the most memory. Returns the calls, each
5105
+ * a list of NFTs: the first is a call's own (`asset`…), the rest its `more`. Each call is one project fee.
5106
+ */
5107
+ export declare function stashBatches(nfts: any, { lookupTable, heap }?: Readonly<Record<string, any>>): any[];
4975
5108
  /**
4976
5109
  * `player` backs `side` with `amount`, naming the contest's incarnation (which fixes its terms). `contest` is the
4977
5110
  * decoded Contest. A contest of NFTs (`contest.nft`) takes one NFT instead (`nft`: { asset, collection, tokenMetadata,
@@ -5047,11 +5180,13 @@ export declare const auctionEnds: (auction: any) => bigint;
5047
5180
  export declare function leastBid(auction: any): bigint | null;
5048
5181
  /**
5049
5182
  * `seller` opens its auction `id` of `args.lot` ({ Item: [id] }, { Asset: [address] } or { Roll: [box id] }), alone,
5050
- * and pays its rent: a player for an NFT of the project's own collection they hold; the project's owner or authority for an
5051
- * NFT of any kind it holds (`piece`: `collection` a Core asset's own, `tokenMetadata`, or `compressed` after a
5052
- * `proveLeafIx`), a new unit of its item, or a roll of one of its boxes (a mystery lot: the box must be written, burn
5053
- * no share of its price, and make an order with the auction's shares within one call's growth: `LotRefused`). Its
5054
- * address names the seller, so an id is the seller's own.
5183
+ * and pays its rent: anyone for an NFT of any kind and any collection they hold (`piece`: `collection` a Core asset's
5184
+ * own, `tokenMetadata`, or `compressed` after a `proveLeafIx`); the project's owner or authority also for a new unit
5185
+ * of its item (one the shop has switched off too), or a roll of one of its boxes (a mystery lot: the box must be
5186
+ * written and make an order with the auction's shares within one call's growth, `LotRefused`; the auction's shares
5187
+ * split the winning bid, so a share of the box that burns burns nothing here). Its address names the seller, so an id
5188
+ * is the seller's own. An NFT lot of another collection can be stopped or taken back by whoever controls that
5189
+ * collection while the project holds it: its seller is paid only when it reaches the winner (`endAuctionIx`).
5055
5190
  */
5056
5191
  export declare function openAuctionIx({ seller, project, collection, tokenMetadata: tm, compressed, id, mint, args }: {
5057
5192
  args: any;
@@ -5097,23 +5232,45 @@ export declare function bidIx({ bidder, project, id, auction, amount, shown, lis
5097
5232
  keys: any[];
5098
5233
  data: Uint8Array<any>;
5099
5234
  };
5235
+ /** How an auction's end goes, as `end_auction`'s `ending` takes it. With no bid each is the same: the lot goes home. */
5236
+ export declare const ENDINGS: readonly string[];
5100
5237
  /**
5101
- * Anyone ends auction `id` once it is over (its seller calls off one with no bid). Sold: the lot goes to the high
5102
- * bidder (an item that is a collectible is minted to them at `pda.itemAsset(item, serial)`; a roll of a box is made
5103
- * for them in an order at `prizeRollNonce(nonce)`, `nonce` being `prizeNonce(auction, last_bid_at)` by default, which `signer` pays for), the price
5104
- * through the shares, the rest to whoever owned the lot (the seller of an NFT, the treasury for the project's item or
5105
- * roll), however long after the end it is sent. With no bid, the lot goes home. `signer` opens any account the end pays into that is
5106
- * not there. `item` is the decoded Item of an item lot; for an NFT lot, `collection` its Core collection now (the
5107
- * project's when left out), `tokenMetadata` for a Token Metadata NFT, or `compressed` (after a `proveLeafIx`).
5108
- * `hold` (anyone may; true for all, or a list of assets): an end that wouldn't fit otherwise (a compressed lot's long
5109
- * proof, a hooked mint, many shares) makes the NFT lot a hold for whoever it goes to (its hold passed as `order`, no
5110
- * piece nor proof), and a winning NFT of a bid a hold for `proceeds` (its hold's address in its piece's place); anyone
5111
- * then delivers each with `releaseIx`, and the end's sender gets the rent back then.
5238
+ * Anyone ends auction `id` once it is over (its seller calls off one with no bid). `auction` is the decoded Auction,
5239
+ * `ending` one of `ENDINGS` (with no bid each is the same: the lot goes home to its seller, or stays where it is when it
5240
+ * is proven gone). With a bid in:
5241
+ * 'Deliver' (the default): the lot goes to the high bidder and the winning bid through the shares to whoever owned the
5242
+ * lot (the seller of an NFT, the treasury for the project's item or roll), in one instruction, however long after the
5243
+ * end it is sent. An item that is a collectible is minted to the winner at `pda.itemAsset(item, serial)`; a roll of a
5244
+ * box is made for them in an order at `prizeRollNonce(nonce)`, `nonce` being `prizeNonce(auction, last_bid_at)` by
5245
+ * default, which `signer` pays for. An NFT lot that can't move now fails the end, which waits: send it again later.
5246
+ * Once the lot went first (`auction.proceeds_owed` above 0), it pays what the bid still owes and closes the auction:
5247
+ * the auction's address stands in for the lot, then the shares' accounts, then a bid's NFTs to the seller.
5248
+ * 'LotFirst': an NFT lot only, for an end too wide for one transaction (a compressed lot's long proof with many shares
5249
+ * and a hooked coin): the lot goes to the winner now and the whole bid is written as owed; a later 'Deliver' pays it.
5250
+ * Its accounts are the lot's piece and proof, then the tail: no shares, no winning NFT.
5251
+ * 'CallOff': an NFT lot's sale, before the lot moved (`CantCallOff` after): the winning bid goes back to its bidder
5252
+ * (tokens into their account, or its NFTs, each moved or made a hold for them) and the lot home to its seller (moved,
5253
+ * or made a hold for them). Anyone may when the lot or an NFT of the bid is proven gone (its collection took it back
5254
+ * or burned it): that one stays gone. Otherwise only the project's owner or authority, for the project fee.
5255
+ * `signer` opens any account the end pays into that is not there. `item` is the decoded Item of an item lot; for an NFT
5256
+ * lot, `collection` its Core collection now, `tokenMetadata` for a Token Metadata NFT, or `compressed` (after a
5257
+ * `proveLeafIx`: a compressed lot's record must be current whenever it is read, with no bid too). The lot's accounts
5258
+ * also show whether the project still holds it: for a Token Metadata lot that left, `evidence` names the token account
5259
+ * that holds it now, or its mint when it was burned. `held`: the kinds of a winning bid's NFTs (`auction.held`, in order:
5260
+ * { collection, tokenMetadata, evidence }).
5261
+ * `hold` (true for every NFT it may apply to, or a list of assets): a lot going home (no bid, or the sale called off) is
5262
+ * made a hold for its seller (its hold passed as `order`, the lot's accounts only showing it is held); an NFT of a bid
5263
+ * going back on a call-off, or paid to the seller after the lot went first, or to the treasury for the project's own
5264
+ * lot, is made a hold for whoever it goes to (its hold's address in its piece's place). Anyone then delivers each with
5265
+ * `releaseIx`, and the end's sender gets the rent back then. A sold lot is never made a hold (`LotRefused`), nor an NFT
5266
+ * of a bid that buys a player's lot: the two move together, or the end waits.
5112
5267
  */
5113
- export declare function endAuctionIx({ signer, project, projectState, id, auction, item, collection, tokenMetadata: tm, compressed, held, hold, reference: ref, nonce, holders, programs, extra, }: {
5268
+ export declare function endAuctionIx({ signer, project, projectState, id, auction, item, collection, tokenMetadata: tm, compressed, evidence, held, hold, ending, reference: ref, nonce, holders, programs, extra, }: {
5114
5269
  auction: any;
5115
5270
  collection: any;
5116
5271
  compressed: any;
5272
+ ending?: string | undefined;
5273
+ evidence?: null | undefined;
5117
5274
  extra?: never[] | undefined;
5118
5275
  held?: never[] | undefined;
5119
5276
  hold?: boolean | undefined;
@@ -5220,19 +5377,34 @@ export declare function borrowIx({ borrower, project, id, offer, due, asset, col
5220
5377
  };
5221
5378
  /**
5222
5379
  * Anyone (`payer`: the borrower, a friend) repays a loan before it is due (`hold` the decoded Hold, with its debt): the
5223
- * debt's `repay` goes to the lender, and the NFT is the borrower's again. Only money moves: anyone then sends the NFT
5224
- * home with `releaseIx` (in the same transaction, or later: a repaid loan's release has no deadline). Free. `repay`: the
5225
- * debt the payer was shown (`hold.debt.repay` as read): any other amount is refused (`TermsChanged`). `extra`: a
5226
- * transfer hook's accounts.
5380
+ * debt's `repay` goes to the lender. With `home` (the default), the NFT goes home to its borrower in the same
5381
+ * instruction and the hold closes, its rent (and a Token Metadata NFT's emptied account's) to the borrower; an NFT that
5382
+ * can't move now (frozen, its collection's rule refuses, a proof out of date) fails the whole call, and nobody pays.
5383
+ * Without `home`, only the money moves: the hold becomes a plain one that is over, and anyone sends the NFT home with
5384
+ * `releaseIx` whenever it can move (for an NFT frozen for now, so the loan does not fall due meanwhile). Free.
5385
+ * The NFT is any kind: `collection` for a Core asset, `tokenMetadata` for a Token Metadata NFT (`into`: the borrower's
5386
+ * account it goes into, when their associated one can't take it), `compressed` for a compressed one. Either way its
5387
+ * accounts must show the project still holds it: the program takes no repayment for an NFT its collection took back
5388
+ * or burned (`NotTheNft`), nor one nothing shows (`NotProven`). Going home, a compressed NFT is proven
5389
+ * (`proveLeafIx`, in the same transaction) and its proof goes first after the repayment's accounts; the money alone
5390
+ * passes its record and tree, and goes through when the record shows nothing, so prove it in the same transaction when
5391
+ * that fits and the repayment of an NFT that is gone is refused. `repay`: the debt the payer was shown
5392
+ * (`hold.debt.repay` as read): any other amount is refused (`TermsChanged`). `address`: the hold's, when its `free_at`
5393
+ * changed since its loan named it. `extra`: a transfer hook's accounts.
5227
5394
  */
5228
- export declare function repayIx({ payer, project, hold, repay, payerToken, programs, extra }: {
5395
+ export declare function repayIx({ payer, project, hold, repay, home, address, collection, tokenMetadata: tm, compressed, payerToken, programs, extra, }: {
5396
+ address?: null | undefined;
5397
+ collection: any;
5398
+ compressed: any;
5229
5399
  extra?: never[] | undefined;
5230
5400
  hold: any;
5401
+ home?: boolean | undefined;
5231
5402
  payer: any;
5232
5403
  payerToken: any;
5233
5404
  programs: any;
5234
5405
  project: any;
5235
5406
  repay: any;
5407
+ tokenMetadata: any;
5236
5408
  }): {
5237
5409
  programId: string;
5238
5410
  keys: any[];
@@ -81,6 +81,11 @@ export declare function buySize(b: any, m: any, { detail, count }?: {
81
81
  /** The address a plan stands in for the owner's wallet before one connects (plan.mjs `placeholderContext`). Nobody
82
82
  * holds its key, and the approval page calls it "your wallet" until a wallet connects: no spec may name it. */
83
83
  export declare const STAND_IN_OWNER: string;
84
+ /** How far off a time may land before the checker asks whether its unit is right: three years. The program
85
+ * takes any time a date holds; a time written in milliseconds lands thousands of years out and locks what waits on it. */
86
+ export declare const FAR_SECONDS: number;
87
+ /** A Unix time in words, in English: "14 March 2031". Past what a date can show, the year alone. */
88
+ export declare function dateWords(seconds: any): string;
84
89
  /**
85
90
  * Checks an economy spec. `now` (Unix seconds) dates "publish".
86
91
  * Returns { ok, refusals: [{ code, where, message, fix }], warnings: [{ code, where, message, fix? }] }.