@xgamesfun/solana 0.27.0 → 0.27.2

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 (38) hide show
  1. package/README.md +34 -17
  2. package/bin/xsolana.mjs +72 -7
  3. package/js/approve/details.mjs +1 -1
  4. package/js/approve/keyfile.mjs +242 -0
  5. package/js/approve/live-check.mjs +5 -2
  6. package/js/approve/server.mjs +94 -13
  7. package/js/approve/with-key.mjs +298 -0
  8. package/js/chain/lookup.js +11 -0
  9. package/js/chain/programs.js +49 -1
  10. package/js/chain/rpc.js +53 -6
  11. package/js/economy/check.mjs +2 -2
  12. package/js/economy/cost.mjs +20 -4
  13. package/js/economy/explain.mjs +3 -3
  14. package/js/economy/guide.mjs +2 -2
  15. package/js/economy/live.mjs +1 -1
  16. package/js/economy/plan.mjs +34 -6
  17. package/js/economy/review.mjs +1 -1
  18. package/js/economy/schema.json +1 -1
  19. package/js/economy/txsize.mjs +3 -2
  20. package/js/mcp/server.mjs +3 -3
  21. package/js/mcp/tools.mjs +51 -14
  22. package/js/play/index.js +466 -118
  23. package/package.json +5 -1
  24. package/release.json +1 -1
  25. package/skills/xsolana-economy/SKILL.md +58 -19
  26. package/skills/xsolana-economy/references/after-launch.md +43 -12
  27. package/skills/xsolana-economy/references/apps.md +7 -3
  28. package/skills/xsolana-economy/references/sentence-to-spec.md +3 -3
  29. package/skills/xsolana-economy/references/telling-the-person.md +18 -11
  30. package/skills/xsolana-economy/references/trust-and-cheating.md +4 -2
  31. package/types/approve/keyfile.d.mts +36 -0
  32. package/types/chain/lookup.d.ts +12 -0
  33. package/types/chain/programs.d.ts +22 -0
  34. package/types/chain/rpc.d.ts +15 -1
  35. package/types/economy/plan.d.mts +21 -4
  36. package/types/mcp/server.d.mts +4 -3
  37. package/types/mcp/tools.d.mts +14 -5
  38. package/types/play/index.d.ts +178 -29
@@ -576,7 +576,9 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
576
576
  * Bids `amount` (whole units) on an auction. The bid it tops goes back to its bidder in the same transaction
577
577
  * (the program opens their account again if they closed it, paid by this bidder). In SOL, only what the player's
578
578
  * wrapped-SOL account does not hold already is wrapped, and the account stays open: if this bid is topped, it comes
579
- * back there.
579
+ * back there. In an auction of NFT bids, an NFT of the topped bid that the project no longer holds (its collection
580
+ * took it back or burned it) can't go back: the bid makes it a hold for its bidder and closes that hold on the
581
+ * proof in the same transaction, so a high bid with an NFT gone can still be topped.
580
582
  */
581
583
  bid(auctionKey: any, amount: any, { shown, listProof, nfts, acceptLeftover, ...others }?: Readonly<Record<string, any>>): Promise<any>;
582
584
  /**
@@ -591,22 +593,41 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
591
593
  * the sale is called off on that evidence, which anyone may: the bid goes back to its bidder (`{ calledOff: true }`).
592
594
  * With no bid, the lot goes home to its seller. An end too big for one transaction otherwise makes each NFT that may
593
595
  * be a hold one, and sends each on with a release after it (`releases`).
596
+ * An NFT that is gone is never sent, whatever its kind, and the result says so (`gone: true`, and `says`, what the
597
+ * end did in words): a lot gone with no bid stays where it is and the auction closes, its rent to its seller; a
598
+ * sale with the lot or an NFT of the bid gone is called off, and what the project still holds goes back; for the
599
+ * project's own lot, or a lot that went first, the end passes the bid's NFT that is gone over and pays the rest.
600
+ * A hold made at the end whose NFT goes before its release is closed on the proof: its entry in `releases` is
601
+ * then `{ asset, gone: true, closed }`, `closed` the signature.
594
602
  */
595
603
  endAuction(auctionKey: any, { holders, ...others }?: Readonly<Record<string, any>>): Promise<{
596
604
  owedPaid: any;
597
605
  waiting?: undefined;
606
+ gone: boolean;
607
+ says: string;
598
608
  paid: any;
609
+ } | {
610
+ owedPaid: any;
611
+ waiting?: undefined;
612
+ gone?: undefined;
599
613
  says?: undefined;
600
- releases?: undefined;
614
+ paid: any;
601
615
  } | {
602
616
  owedPaid: any;
603
617
  waiting?: undefined;
604
618
  paid: null;
605
619
  says: string;
606
- releases?: undefined;
607
620
  } | {
608
621
  owedPaid: any;
609
622
  waiting?: undefined;
623
+ gone: boolean;
624
+ says: string;
625
+ paid: any;
626
+ releases: any[];
627
+ } | {
628
+ owedPaid: any;
629
+ waiting?: undefined;
630
+ gone?: undefined;
610
631
  says?: undefined;
611
632
  paid: any;
612
633
  releases: any[];
@@ -649,9 +670,18 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
649
670
  waiting?: undefined;
650
671
  signature: any;
651
672
  lotFirst: boolean;
673
+ gone: boolean;
674
+ says: string;
652
675
  paid: any;
676
+ } | {
677
+ winner?: any;
678
+ asset?: any;
679
+ waiting?: undefined;
680
+ signature: any;
681
+ lotFirst: boolean;
682
+ gone?: undefined;
653
683
  says?: undefined;
654
- releases?: undefined;
684
+ paid: any;
655
685
  } | {
656
686
  winner?: any;
657
687
  asset?: any;
@@ -660,13 +690,23 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
660
690
  lotFirst: boolean;
661
691
  paid: null;
662
692
  says: string;
663
- releases?: undefined;
664
693
  } | {
665
694
  winner?: any;
666
695
  asset?: any;
667
696
  waiting?: undefined;
668
697
  signature: any;
669
698
  lotFirst: boolean;
699
+ gone: boolean;
700
+ says: string;
701
+ paid: any;
702
+ releases: any[];
703
+ } | {
704
+ winner?: any;
705
+ asset?: any;
706
+ waiting?: undefined;
707
+ signature: any;
708
+ lotFirst: boolean;
709
+ gone?: undefined;
670
710
  says?: undefined;
671
711
  paid: any;
672
712
  releases: any[];
@@ -680,18 +720,31 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
680
720
  callOffSale(auctionKey: any, { ...others }?: Readonly<Record<string, any>>): Promise<{
681
721
  owedPaid: any;
682
722
  waiting?: undefined;
723
+ gone: boolean;
724
+ says: string;
683
725
  paid: any;
726
+ } | {
727
+ owedPaid: any;
728
+ waiting?: undefined;
729
+ gone?: undefined;
684
730
  says?: undefined;
685
- releases?: undefined;
731
+ paid: any;
686
732
  } | {
687
733
  owedPaid: any;
688
734
  waiting?: undefined;
689
735
  paid: null;
690
736
  says: string;
691
- releases?: undefined;
692
737
  } | {
693
738
  owedPaid: any;
694
739
  waiting?: undefined;
740
+ gone: boolean;
741
+ says: string;
742
+ paid: any;
743
+ releases: any[];
744
+ } | {
745
+ owedPaid: any;
746
+ waiting?: undefined;
747
+ gone?: undefined;
695
748
  says?: undefined;
696
749
  paid: any;
697
750
  releases: any[];
@@ -734,9 +787,18 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
734
787
  waiting?: undefined;
735
788
  signature: any;
736
789
  lotFirst: boolean;
790
+ gone: boolean;
791
+ says: string;
737
792
  paid: any;
793
+ } | {
794
+ winner?: any;
795
+ asset?: any;
796
+ waiting?: undefined;
797
+ signature: any;
798
+ lotFirst: boolean;
799
+ gone?: undefined;
738
800
  says?: undefined;
739
- releases?: undefined;
801
+ paid: any;
740
802
  } | {
741
803
  winner?: any;
742
804
  asset?: any;
@@ -745,13 +807,23 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
745
807
  lotFirst: boolean;
746
808
  paid: null;
747
809
  says: string;
748
- releases?: undefined;
749
810
  } | {
750
811
  winner?: any;
751
812
  asset?: any;
752
813
  waiting?: undefined;
753
814
  signature: any;
754
815
  lotFirst: boolean;
816
+ gone: boolean;
817
+ says: string;
818
+ paid: any;
819
+ releases: any[];
820
+ } | {
821
+ winner?: any;
822
+ asset?: any;
823
+ waiting?: undefined;
824
+ signature: any;
825
+ lotFirst: boolean;
826
+ gone?: undefined;
755
827
  says?: undefined;
756
828
  paid: any;
757
829
  releases: any[];
@@ -811,14 +883,22 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
811
883
  unlist(asset: any): Promise<any>;
812
884
  /**
813
885
  * Closes what this project still records of an NFT it no longer holds (`asset`: whoever controls its collection
814
- * took it out of the project's hands or burned it): each hold of it (`release`) and its listing (`take_listing`),
815
- * on the proof that it is gone. Anyone may, at any time, also while a hold runs and for a loan before it is due:
816
- * nothing is sent or paid, and a loan's debt ends unpaid. The sender pays the transaction's fee only; each
817
- * record's rent goes to whoever that record names (a hold's payer, a listing's maker), never to the sender. A
818
- * listing whose rental still runs is left (`waits`): the program keeps a running rental, and the listing closes
819
- * once it has run. Refused in words, with nothing sent, when the project still holds the NFT or nothing shows it
820
- * gone. Returns { signature, closed: [{ kind, address }], waits: [{ kind, address }] }; `signature` is null when
821
- * there was nothing to close.
886
+ * took it out of the project's hands or burned it): each hold of it (`release`), its listing (`take_listing`),
887
+ * and its row on each of the project's stashes that lists it (`stash`, out), on the proof that it is gone. Anyone
888
+ * may, at any time, also while a hold runs and for a loan before it is due: nothing is sent or paid, and a loan's
889
+ * debt ends unpaid. The sender pays the transaction's fee only; each record's rent goes to whoever that record
890
+ * names (a hold's payer, a listing's maker), never to the sender, and a stash keeps the rent its row no longer
891
+ * needs (it goes to the sender only when that is one of the project's keys). With its row off a stash, no roll
892
+ * draws the NFT, and a prize that names it is passed over in place of failing on an NFT that can't move.
893
+ * What is left is in `waits`: a listing whose rental still runs (the program keeps a running rental, and the
894
+ * listing closes once it has run), and a lottery's own stash that lists the NFT (`kind` 'lottery-stash', with its
895
+ * `lottery`, the lottery's id): only the project's keys take a row out of that one (`unraffle`), gone or not.
896
+ * Refused in words, with nothing sent, when the project still holds the NFT or nothing shows it gone.
897
+ * Besides one search of the NFT's holds, this makes one search of the project's stashes, which returns every
898
+ * stash of the project whole (36 bytes for each NFT a stash lists): a stash's rows have no fixed place to look in.
899
+ * Returns { signature, closed: [{ kind, address }], unstashed: [{ address, id }], waits: [{ kind, address }] }:
900
+ * `closed` the holds and the listing it closed, `unstashed` the project's stashes it took the row off;
901
+ * `signature` is null when there was nothing to close.
822
902
  */
823
903
  closeGone(asset: any): Promise<{
824
904
  signature: any;
@@ -826,6 +906,10 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
826
906
  kind: any;
827
907
  address: any;
828
908
  }[];
909
+ unstashed: {
910
+ address: any;
911
+ id: number;
912
+ }[];
829
913
  waits: {
830
914
  kind: any;
831
915
  address: any;
@@ -841,7 +925,13 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
841
925
  * owner they are.
842
926
  */
843
927
  raffle(id: any, nft: any, { price, currency, drawsAt, minSold, perWallet, shares, ...others }?: Readonly<Record<string, any>>): Promise<any>;
844
- /** 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). */
928
+ /**
929
+ * The raffle's owner takes the NFT back out of lottery `id`'s own stash once nothing promises it (the lottery
930
+ * ended, or no place names it). When the project no longer holds the NFT (its collection took it back or burned
931
+ * it), only its row comes off the stash, on that proof: nothing is sent, and the owner gets no NFT back. Only the
932
+ * project's owner or authority may, gone or not: a lottery's own stash is theirs alone (`NotAuthority` for anyone
933
+ * else; `closeGone` leaves it and says so). Returns the signature.
934
+ */
845
935
  unraffle(id: any, nft: any): Promise<any>;
846
936
  /** Turns what waits in the player's wrapped-SOL account (a bid that was topped) into plain SOL. */
847
937
  unwrap(): Promise<any>;
@@ -880,15 +970,20 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
880
970
  * SOL), and a drawn lottery's unpaid places, which anyone may pay so the next round can open. [{ kind, says, … }];
881
971
  * a winner's first claim of a contest of tokens carries `potUnits` and `prizeUnits`, its part as the decision wrote
882
972
  * it (base units, as text). Pass one to `claim`.
973
+ * A `pull`, a `contest` or an `auction` whose claim would hand out an NFT the project no longer holds is flagged
974
+ * `gone` too, with `assets` (those NFTs) and `says`, what the claim does about each in words: a ticket's NFT, a
975
+ * place's NFT, a contest's entry or a loser's NFT picked is not sent anywhere and its part closes; an auction with
976
+ * its lot or an NFT of its winning bid gone is called off, or ended without it. Show `says` before the player signs.
883
977
  */
884
978
  claims(): Promise<({
885
979
  key?: undefined;
886
980
  tree?: undefined;
981
+ gone?: undefined;
887
982
  kind: string;
888
983
  order: any;
889
984
  says: string;
985
+ assets?: undefined;
890
986
  round?: undefined;
891
- pulls?: undefined;
892
987
  asset?: undefined;
893
988
  table?: undefined;
894
989
  } | {
@@ -898,11 +993,27 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
898
993
  kind: string;
899
994
  id: any;
900
995
  side: any;
996
+ gone: boolean;
997
+ assets: any[];
901
998
  says: string;
902
999
  potUnits?: string | undefined;
903
1000
  prizeUnits?: string | undefined;
904
1001
  round?: undefined;
905
- pulls?: undefined;
1002
+ asset?: undefined;
1003
+ table?: undefined;
1004
+ } | {
1005
+ key?: undefined;
1006
+ tree?: undefined;
1007
+ gone?: undefined;
1008
+ order?: undefined;
1009
+ kind: string;
1010
+ id: any;
1011
+ side: any;
1012
+ says: string;
1013
+ potUnits?: string | undefined;
1014
+ prizeUnits?: string | undefined;
1015
+ assets?: undefined;
1016
+ round?: undefined;
906
1017
  asset?: undefined;
907
1018
  table?: undefined;
908
1019
  } | {
@@ -914,48 +1025,63 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
914
1025
  hold: any;
915
1026
  gone: boolean;
916
1027
  says: string;
1028
+ assets?: undefined;
917
1029
  round?: undefined;
918
- pulls?: undefined;
919
1030
  table?: undefined;
920
1031
  } | {
921
1032
  key?: undefined;
922
1033
  tree?: undefined;
1034
+ gone?: undefined;
923
1035
  order?: undefined;
924
1036
  kind: string;
925
1037
  asset: any;
926
1038
  hold: any;
927
1039
  says: string;
1040
+ assets?: undefined;
928
1041
  round?: undefined;
929
- pulls?: undefined;
930
1042
  table?: undefined;
931
1043
  } | {
932
1044
  key?: undefined;
1045
+ gone?: undefined;
933
1046
  order?: undefined;
934
1047
  kind: string;
935
1048
  asset: string;
936
1049
  tree: string;
937
1050
  says: string;
1051
+ assets?: undefined;
1052
+ round?: undefined;
1053
+ table?: undefined;
1054
+ } | {
1055
+ tree?: undefined;
1056
+ order?: undefined;
1057
+ kind: string;
1058
+ key: any;
1059
+ gone: boolean;
1060
+ assets: any[];
1061
+ says: string;
938
1062
  round?: undefined;
939
- pulls?: undefined;
1063
+ asset?: undefined;
940
1064
  table?: undefined;
941
1065
  } | {
942
1066
  tree?: undefined;
1067
+ gone?: undefined;
943
1068
  order?: undefined;
1069
+ assets?: undefined;
944
1070
  kind: string;
945
1071
  key: any;
946
1072
  says: string;
947
1073
  round?: undefined;
948
- pulls?: undefined;
949
1074
  asset?: undefined;
950
1075
  table?: undefined;
951
1076
  } | {
952
1077
  tree?: undefined;
1078
+ gone?: undefined;
953
1079
  order?: undefined;
1080
+ assets?: undefined;
954
1081
  kind: string;
955
1082
  key: any;
956
1083
  round: any;
957
1084
  says: string;
958
- pulls?: undefined;
959
1085
  asset?: undefined;
960
1086
  table?: undefined;
961
1087
  } | {
@@ -965,15 +1091,30 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
965
1091
  key: any;
966
1092
  round: any;
967
1093
  pulls: any;
1094
+ gone: boolean;
1095
+ assets: any[];
1096
+ says: string;
1097
+ asset?: undefined;
1098
+ table?: undefined;
1099
+ } | {
1100
+ tree?: undefined;
1101
+ gone?: undefined;
1102
+ order?: undefined;
1103
+ assets?: undefined;
1104
+ kind: string;
1105
+ key: any;
1106
+ round: any;
1107
+ pulls: any;
968
1108
  says: string;
969
1109
  asset?: undefined;
970
1110
  table?: undefined;
971
1111
  } | {
972
1112
  key?: undefined;
973
1113
  tree?: undefined;
1114
+ gone?: undefined;
974
1115
  order?: undefined;
1116
+ assets?: undefined;
975
1117
  round?: undefined;
976
- pulls?: undefined;
977
1118
  kind: string;
978
1119
  asset: any;
979
1120
  says: string;
@@ -981,9 +1122,10 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
981
1122
  } | {
982
1123
  key?: undefined;
983
1124
  tree?: undefined;
1125
+ gone?: undefined;
984
1126
  order?: undefined;
1127
+ assets?: undefined;
985
1128
  round?: undefined;
986
- pulls?: undefined;
987
1129
  asset?: undefined;
988
1130
  kind: string;
989
1131
  table: any;
@@ -993,8 +1135,15 @@ export declare function solanaApp({ spec, rpcUrl, rpc, wallet, programs, now, ke
993
1135
  * Finishes one of `claims()`, signed by this player. Returns the signature. A `release` flagged `gone` closes its
994
1136
  * hold on the proof that the project no longer holds the NFT: nothing is sent, the hold's rent goes back to whoever
995
1137
  * paid it, and a loan's debt ends unpaid. A winner of a contest of NFTs picks
996
- * which loser's NFT they take (`{ take: asset }`, the NFT of a losing entry that still holds one; the first found by default):
997
- * only the winner can, while any are left.
1138
+ * which loser's NFT they take (`{ take: asset }`, the NFT of a losing entry that still holds one; by default the
1139
+ * first found that the project still holds): only the winner can, while any are left.
1140
+ * An NFT a lottery's round or a contest owes that the project no longer holds (its collection took it back or
1141
+ * burned it) is not sent anywhere, and the claim still finishes. A ticket whose price sends it on (burned, given,
1142
+ * stashed) settles on the proof with nothing moved. A ticket going back to its buyer, a place's NFT and a
1143
+ * contest's NFT are only handed out by the program, which reads nothing first: the claim has it make a hold of
1144
+ * that NFT (`["hold", nft, 0]`) and closes that hold on the proof right after, in the same transaction when it
1145
+ * fits. The signer pays that hold's rent and gets it back at once. The program's receipts for it are those of a
1146
+ * hold made (`Held`, and `PrizeGiven` for a place's prize) and then `NftGone`: no `Released`.
998
1147
  */
999
1148
  claim(c: any, { take, build, ...others }?: Readonly<Record<string, any>>): Promise<any>;
1000
1149
  /**