pyre-world-kit 2.0.11 → 3.0.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 (54) hide show
  1. package/.prettierrc.json +6 -0
  2. package/dist/actions.js +16 -0
  3. package/dist/index.d.ts +38 -4
  4. package/dist/index.js +100 -85
  5. package/dist/providers/action.provider.d.ts +46 -0
  6. package/dist/providers/action.provider.js +331 -0
  7. package/dist/providers/intel.provider.d.ts +29 -0
  8. package/dist/providers/intel.provider.js +363 -0
  9. package/dist/providers/mapper.provider.d.ts +197 -0
  10. package/dist/providers/mapper.provider.js +158 -0
  11. package/dist/providers/registry.provider.d.ts +25 -0
  12. package/dist/providers/registry.provider.js +229 -0
  13. package/dist/providers/state.provider.d.ts +42 -0
  14. package/dist/providers/state.provider.js +348 -0
  15. package/dist/pyre_world.json +34 -229
  16. package/dist/types/action.types.d.ts +41 -0
  17. package/dist/types/action.types.js +2 -0
  18. package/dist/types/intel.types.d.ts +20 -0
  19. package/dist/types/intel.types.js +2 -0
  20. package/dist/types/mapper.types.d.ts +27 -0
  21. package/dist/types/mapper.types.js +22 -0
  22. package/dist/types/registry.types.d.ts +0 -0
  23. package/dist/types/registry.types.js +1 -0
  24. package/dist/types/state.types.d.ts +112 -0
  25. package/dist/types/state.types.js +2 -0
  26. package/dist/types.d.ts +8 -24
  27. package/dist/util.d.ts +29 -0
  28. package/dist/util.js +144 -0
  29. package/dist/vanity.d.ts +3 -3
  30. package/dist/vanity.js +18 -15
  31. package/package.json +4 -2
  32. package/readme.md +134 -122
  33. package/src/index.ts +127 -92
  34. package/src/providers/action.provider.ts +443 -0
  35. package/src/providers/intel.provider.ts +383 -0
  36. package/src/providers/mapper.provider.ts +195 -0
  37. package/src/providers/registry.provider.ts +277 -0
  38. package/src/providers/state.provider.ts +357 -0
  39. package/src/pyre_world.json +35 -230
  40. package/src/types/action.types.ts +76 -0
  41. package/src/types/intel.types.ts +22 -0
  42. package/src/types/mapper.types.ts +84 -0
  43. package/src/types/registry.types.ts +0 -0
  44. package/src/types/state.types.ts +144 -0
  45. package/src/types.ts +329 -333
  46. package/src/util.ts +148 -0
  47. package/src/vanity.ts +27 -14
  48. package/tests/test_e2e.ts +339 -172
  49. package/src/actions.ts +0 -703
  50. package/src/intel.ts +0 -521
  51. package/src/mappers.ts +0 -302
  52. package/src/registry.ts +0 -317
  53. package/tests/test_devnet_e2e.ts +0 -401
  54. package/tests/test_sim.ts +0 -458
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "printWidth": 100
6
+ }
package/dist/actions.js CHANGED
@@ -82,6 +82,22 @@ const DEFAULT_BLACKLIST = [
82
82
  'Fc1V6KcxSriJkUNeDLqz8w5Sm4mp1s8gxornZVLcHEpy', 'FEizyHEUoYenqfpF87kqiGnq3w1R2TReodEfsnTrrfpy',
83
83
  'DmwgcVHoJxKeRiij5LtedY9LWDpqoqa3hGfUyVgBkgpy', 'GUGz1Em5KZ57aKFqEBSd4Y4Vb6WxBd3H2b16fPCC6upy',
84
84
  '6ZWY3Bau5zw1j7vMQQ1czSw4rjBJrExHQ8Renor2vLpy',
85
+ // wave 3
86
+ '4LyPhwUCZNLEp45RsGWdwtkX5tb3wmwydBKEu1V7fxpy', 'FYw8FZKzG6vVweUMQgSXBrY9ViHgquWyN4x5QthaK3py',
87
+ 'DhFhRRpRMkPi2Vz3kErZWHNmWqxgQm5YwXT5pFpgVKpy', '6GLqPmACtuDi4LcMtVpFK43sYkG8yVouYiDfdfBSSVpy',
88
+ '8YYYewvvCTGPZ2UddgrD6oWUZD7CYXe3DBbA9GBkapy', 'FpQT2uDi3oxEpnayKHAUCcWXVhtDaZCb85e7nZzoCUpy',
89
+ '5EWX6grTtA46FQUHGC1kogCW3CsnVfXNvVgrYVtwvRpy', '8HSvBFkr6gu9qtbMKcTAZSjzkj4Ag1d1wkdiaMDHHapy',
90
+ '2hgo2kdtNNQGNuvfEPSfydWDqfhSwfbFTzgeVb758wpy', 'DKvaEayFig3RHQ9rXHnCKBjvMnJCstzuBmSe77Ybf6py',
91
+ 'Cws3YSPxWYxzrEEfguLi3p13ea2vPNi42mjJwwSMTTpy', 'GodcBg2dLzrypiYH5Aqo2bTJ7KiZa5G5XSDwNQ74iYpy',
92
+ '46tUp7tMEhpLeenPXQwvzP8H8V5M4F63vi4M9k4bbbpy', 'a5iH2Soh5c8X81vTVbKZq7A7yPckhFdN1amv1Q2tapy',
93
+ '2zTGWtQeJ5GtdHu888QikPzKkyHJPWVFYtoQjNeJJ7py', 'HNnpL7z1GKsXuxaEHs2a52zW7tTUjU4dZnrSEf8ZsMpy',
94
+ 'EASit9Yrj1SBg6xchFxDSwVV9Rz11RKdDpB4tcNsekpy', 'F7VcdtqsXV6nkDL3yk6esUBu9qGvka4EY9XNTQ7PmZpy',
95
+ '3huHC9Co5dy5Z5U6H8Vf7aVTcuukpKeUr8rDQx8s5Zpy', '97ymhwybP8Jh45VcYBJY1pwQ5xkPLX15u7Tg3P7TG7py',
96
+ '92fMEzcYdcoEXX8A5T8i8vfz2S96P39abzoXXuBghfpy', '2ZeQsU13WjgX2152qV3wyzxURjLg7GwfXznAiA99Jjpy',
97
+ 'FuUHck8jqaXxGiTuLym4gYXJQrueyEsgd8AMUQx2fMpy', 'trTuaGATQZwUeYkYTeyJfQnGGnKRvAriAZRgBWg7Epy',
98
+ 'HEhemzeszztaFzFYR9DjpNwdhghVDD1y7cHxP93EPZpy', 'obuf6MkL1ev6WuUDDjH3bq2q6Ryr6MBNMRsA6dEW4py',
99
+ '76ruUbqBpqSKsysoPesDrpaLsDSahWWphQmXrswiLbpy', '4ci4scCevt5tXCxkGr5xHoWyaeQY1dahp5nFsTnfYApy',
100
+ 'shzuPKgqedBxJmxdrRyWAtajG3hSNyLr72SufvmEvpy',
85
101
  ];
86
102
  const BLACKLISTED_MINTS = new Set(DEFAULT_BLACKLIST);
87
103
  /** Add mints to the blacklist (call at startup with old mints) */
package/dist/index.d.ts CHANGED
@@ -5,9 +5,43 @@
5
5
  * This kit translates protocol primitives into faction warfare language
6
6
  * so agents think in factions, not tokens.
7
7
  */
8
- export type { FactionStatus, FactionTier, Strategy, AgentHealth, FactionSummary, FactionDetail, Stronghold, AgentLink, Comms, WarChest, WarLoan, WarLoanWithAgent, Member, FactionListResult, MembersResult, CommsResult, AllWarLoansResult, WarLoanQuote, LaunchFactionParams, JoinFactionParams, DirectJoinFactionParams, DefectParams, MessageFactionParams, FudFactionParams, RallyParams, RequestWarLoanParams, RepayWarLoanParams, SiegeParams, TradeOnDexParams, ClaimSpoilsParams, CreateStrongholdParams, FundStrongholdParams, WithdrawFromStrongholdParams, RecruitAgentParams, ExileAgentParams, CoupParams, WithdrawAssetsParams, AscendParams, RazeParams, TitheParams, ConvertTitheParams, JoinFactionResult, LaunchFactionResult, TransactionResult, EphemeralAgent, SaidVerification, ConfirmResult, FactionSortOption, FactionStatusFilter, FactionListParams, FactionPower, AllianceCluster, RivalFaction, AgentProfile, AgentFactionPosition, WorldEventType, WorldEvent, WorldStats, RegistryProfile, RegistryWalletLink, CheckpointParams, RegisterAgentParams, LinkAgentWalletParams, UnlinkAgentWalletParams, TransferAgentAuthorityParams, } from './types';
9
- export { getFactions, getFaction, getMembers, getComms, getJoinQuote, getDefectQuote, getStronghold, getStrongholdForAgent, getAgentLink, getLinkedAgents, getWarChest, getWarLoan, getAllWarLoans, getMaxWarLoan, blacklistMints, isBlacklistedMint, getBlacklistedMints, launchFaction, joinFaction, directJoinFaction, defect, messageFaction, fudFaction, rally, requestWarLoan, repayWarLoan, tradeOnDex, claimSpoils, createStronghold, fundStronghold, withdrawFromStronghold, recruitAgent, exileAgent, coup, withdrawAssets, siege, ascend, raze, tithe, convertTithe, verifyAgent, confirmAction, createEphemeralAgent, getDexPool, getDexVaults, } from './actions';
10
- export { getFactionPower, getFactionLeaderboard, detectAlliances, getFactionRivals, getAgentProfile, getAgentFactions, getWorldFeed, getWorldStats, getAgentSolLamports, startVaultPnlTracker, } from './intel';
8
+ import { Connection } from '@solana/web3.js';
9
+ import { ActionProvider } from './providers/action.provider';
10
+ import { IntelProvider } from './providers/intel.provider';
11
+ import { RegistryProvider } from './providers/registry.provider';
12
+ import { StateProvider } from './providers/state.provider';
13
+ import type { Action } from './types/action.types';
14
+ import type { Intel } from './types/intel.types';
15
+ import type { CheckpointConfig } from './types/state.types';
16
+ export declare class PyreKit {
17
+ readonly actions: ActionProvider;
18
+ readonly intel: IntelProvider;
19
+ readonly registry: RegistryProvider;
20
+ readonly state: StateProvider;
21
+ constructor(connection: Connection, publicKey: string);
22
+ /** Callback fired when checkpoint interval is reached */
23
+ onCheckpointDue: (() => void) | null;
24
+ /** Configure auto-checkpoint behavior */
25
+ setCheckpointConfig(config: CheckpointConfig): void;
26
+ /**
27
+ * Execute an action with automatic state tracking.
28
+ * On first call, initializes state from chain instead of executing.
29
+ * After execution, records the action and updates state.
30
+ */
31
+ exec<T extends 'actions' | 'intel'>(provider: T, method: T extends 'actions' ? keyof Action : keyof Intel, ...args: any[]): Promise<any>;
32
+ /** Map action method names to tracked action types */
33
+ private methodToAction;
34
+ }
35
+ export type { FactionStatus, Strategy, AgentHealth, FactionSummary, FactionDetail, Stronghold, AgentLink, Comms, WarChest, WarLoan, WarLoanWithAgent, Member, FactionListResult, MembersResult, CommsResult, AllWarLoansResult, WarLoanQuote, LaunchFactionParams, JoinFactionParams, DefectParams, MessageFactionParams, FudFactionParams, RallyParams, RequestWarLoanParams, RepayWarLoanParams, SiegeParams, ClaimSpoilsParams, CreateStrongholdParams, FundStrongholdParams, WithdrawFromStrongholdParams, RecruitAgentParams, ExileAgentParams, CoupParams, WithdrawAssetsParams, AscendParams, RazeParams, TitheParams, JoinFactionResult, LaunchFactionResult, TransactionResult, EphemeralAgent, FactionSortOption, FactionStatusFilter, FactionListParams, FactionPower, AllianceCluster, RivalFaction, AgentProfile, AgentFactionPosition, WorldEventType, WorldEvent, WorldStats, RegistryProfile, RegistryWalletLink, CheckpointParams, RegisterAgentParams, LinkAgentWalletParams, UnlinkAgentWalletParams, TransferAgentAuthorityParams, } from './types';
36
+ export type { Action } from './types/action.types';
37
+ export type { Intel } from './types/intel.types';
38
+ export type { Mapper } from './types/mapper.types';
39
+ export type { State, AgentGameState, SerializedGameState, TrackedAction, CheckpointConfig, } from './types/state.types';
40
+ export { ActionProvider } from './providers/action.provider';
41
+ export { IntelProvider } from './providers/intel.provider';
42
+ export { MapperProvider } from './providers/mapper.provider';
43
+ export { StateProvider } from './providers/state.provider';
44
+ export { RegistryProvider, REGISTRY_PROGRAM_ID, getAgentProfilePda, getAgentWalletLinkPda, } from './providers/registry.provider';
45
+ export { blacklistMints, isBlacklistedMint, getBlacklistedMints, createEphemeralAgent, getDexPool, getDexVaults, startVaultPnlTracker, } from './util';
11
46
  export { isPyreMint, grindPyreMint } from './vanity';
12
- export { REGISTRY_PROGRAM_ID, getAgentProfilePda, getAgentWalletLinkPda, getRegistryProfile, getRegistryWalletLink, buildRegisterAgentTransaction, buildCheckpointTransaction, buildLinkAgentWalletTransaction, buildUnlinkAgentWalletTransaction, buildTransferAgentAuthorityTransaction, } from './registry';
13
47
  export { PROGRAM_ID, LAMPORTS_PER_SOL, TOKEN_MULTIPLIER, TOTAL_SUPPLY } from 'torchsdk';
package/dist/index.js CHANGED
@@ -7,94 +7,109 @@
7
7
  * so agents think in factions, not tokens.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.getAgentProfile = exports.getFactionRivals = exports.detectAlliances = exports.getFactionLeaderboard = exports.getFactionPower = exports.getDexVaults = exports.getDexPool = exports.createEphemeralAgent = exports.confirmAction = exports.verifyAgent = exports.convertTithe = exports.tithe = exports.raze = exports.ascend = exports.siege = exports.withdrawAssets = exports.coup = exports.exileAgent = exports.recruitAgent = exports.withdrawFromStronghold = exports.fundStronghold = exports.createStronghold = exports.claimSpoils = exports.tradeOnDex = exports.repayWarLoan = exports.requestWarLoan = exports.rally = exports.fudFaction = exports.messageFaction = exports.defect = exports.directJoinFaction = exports.joinFaction = exports.launchFaction = exports.getBlacklistedMints = exports.isBlacklistedMint = exports.blacklistMints = exports.getMaxWarLoan = exports.getAllWarLoans = exports.getWarLoan = exports.getWarChest = exports.getLinkedAgents = exports.getAgentLink = exports.getStrongholdForAgent = exports.getStronghold = exports.getDefectQuote = exports.getJoinQuote = exports.getComms = exports.getMembers = exports.getFaction = exports.getFactions = void 0;
11
- exports.TOTAL_SUPPLY = exports.TOKEN_MULTIPLIER = exports.LAMPORTS_PER_SOL = exports.PROGRAM_ID = exports.buildTransferAgentAuthorityTransaction = exports.buildUnlinkAgentWalletTransaction = exports.buildLinkAgentWalletTransaction = exports.buildCheckpointTransaction = exports.buildRegisterAgentTransaction = exports.getRegistryWalletLink = exports.getRegistryProfile = exports.getAgentWalletLinkPda = exports.getAgentProfilePda = exports.REGISTRY_PROGRAM_ID = exports.grindPyreMint = exports.isPyreMint = exports.startVaultPnlTracker = exports.getAgentSolLamports = exports.getWorldStats = exports.getWorldFeed = exports.getAgentFactions = void 0;
12
- // ─── Actions ───────────────────────────────────────────────────────
13
- var actions_1 = require("./actions");
14
- // Read operations
15
- Object.defineProperty(exports, "getFactions", { enumerable: true, get: function () { return actions_1.getFactions; } });
16
- Object.defineProperty(exports, "getFaction", { enumerable: true, get: function () { return actions_1.getFaction; } });
17
- Object.defineProperty(exports, "getMembers", { enumerable: true, get: function () { return actions_1.getMembers; } });
18
- Object.defineProperty(exports, "getComms", { enumerable: true, get: function () { return actions_1.getComms; } });
19
- Object.defineProperty(exports, "getJoinQuote", { enumerable: true, get: function () { return actions_1.getJoinQuote; } });
20
- Object.defineProperty(exports, "getDefectQuote", { enumerable: true, get: function () { return actions_1.getDefectQuote; } });
21
- Object.defineProperty(exports, "getStronghold", { enumerable: true, get: function () { return actions_1.getStronghold; } });
22
- Object.defineProperty(exports, "getStrongholdForAgent", { enumerable: true, get: function () { return actions_1.getStrongholdForAgent; } });
23
- Object.defineProperty(exports, "getAgentLink", { enumerable: true, get: function () { return actions_1.getAgentLink; } });
24
- Object.defineProperty(exports, "getLinkedAgents", { enumerable: true, get: function () { return actions_1.getLinkedAgents; } });
25
- Object.defineProperty(exports, "getWarChest", { enumerable: true, get: function () { return actions_1.getWarChest; } });
26
- Object.defineProperty(exports, "getWarLoan", { enumerable: true, get: function () { return actions_1.getWarLoan; } });
27
- Object.defineProperty(exports, "getAllWarLoans", { enumerable: true, get: function () { return actions_1.getAllWarLoans; } });
28
- Object.defineProperty(exports, "getMaxWarLoan", { enumerable: true, get: function () { return actions_1.getMaxWarLoan; } });
29
- // Blacklist
30
- Object.defineProperty(exports, "blacklistMints", { enumerable: true, get: function () { return actions_1.blacklistMints; } });
31
- Object.defineProperty(exports, "isBlacklistedMint", { enumerable: true, get: function () { return actions_1.isBlacklistedMint; } });
32
- Object.defineProperty(exports, "getBlacklistedMints", { enumerable: true, get: function () { return actions_1.getBlacklistedMints; } });
33
- // Faction operations
34
- Object.defineProperty(exports, "launchFaction", { enumerable: true, get: function () { return actions_1.launchFaction; } });
35
- Object.defineProperty(exports, "joinFaction", { enumerable: true, get: function () { return actions_1.joinFaction; } });
36
- Object.defineProperty(exports, "directJoinFaction", { enumerable: true, get: function () { return actions_1.directJoinFaction; } });
37
- Object.defineProperty(exports, "defect", { enumerable: true, get: function () { return actions_1.defect; } });
38
- Object.defineProperty(exports, "messageFaction", { enumerable: true, get: function () { return actions_1.messageFaction; } });
39
- Object.defineProperty(exports, "fudFaction", { enumerable: true, get: function () { return actions_1.fudFaction; } });
40
- Object.defineProperty(exports, "rally", { enumerable: true, get: function () { return actions_1.rally; } });
41
- Object.defineProperty(exports, "requestWarLoan", { enumerable: true, get: function () { return actions_1.requestWarLoan; } });
42
- Object.defineProperty(exports, "repayWarLoan", { enumerable: true, get: function () { return actions_1.repayWarLoan; } });
43
- Object.defineProperty(exports, "tradeOnDex", { enumerable: true, get: function () { return actions_1.tradeOnDex; } });
44
- Object.defineProperty(exports, "claimSpoils", { enumerable: true, get: function () { return actions_1.claimSpoils; } });
45
- // Stronghold operations
46
- Object.defineProperty(exports, "createStronghold", { enumerable: true, get: function () { return actions_1.createStronghold; } });
47
- Object.defineProperty(exports, "fundStronghold", { enumerable: true, get: function () { return actions_1.fundStronghold; } });
48
- Object.defineProperty(exports, "withdrawFromStronghold", { enumerable: true, get: function () { return actions_1.withdrawFromStronghold; } });
49
- Object.defineProperty(exports, "recruitAgent", { enumerable: true, get: function () { return actions_1.recruitAgent; } });
50
- Object.defineProperty(exports, "exileAgent", { enumerable: true, get: function () { return actions_1.exileAgent; } });
51
- Object.defineProperty(exports, "coup", { enumerable: true, get: function () { return actions_1.coup; } });
52
- Object.defineProperty(exports, "withdrawAssets", { enumerable: true, get: function () { return actions_1.withdrawAssets; } });
53
- // Permissionless operations
54
- Object.defineProperty(exports, "siege", { enumerable: true, get: function () { return actions_1.siege; } });
55
- Object.defineProperty(exports, "ascend", { enumerable: true, get: function () { return actions_1.ascend; } });
56
- Object.defineProperty(exports, "raze", { enumerable: true, get: function () { return actions_1.raze; } });
57
- Object.defineProperty(exports, "tithe", { enumerable: true, get: function () { return actions_1.tithe; } });
58
- Object.defineProperty(exports, "convertTithe", { enumerable: true, get: function () { return actions_1.convertTithe; } });
59
- // SAID operations
60
- Object.defineProperty(exports, "verifyAgent", { enumerable: true, get: function () { return actions_1.verifyAgent; } });
61
- Object.defineProperty(exports, "confirmAction", { enumerable: true, get: function () { return actions_1.confirmAction; } });
62
- // Utility
63
- Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return actions_1.createEphemeralAgent; } });
64
- Object.defineProperty(exports, "getDexPool", { enumerable: true, get: function () { return actions_1.getDexPool; } });
65
- Object.defineProperty(exports, "getDexVaults", { enumerable: true, get: function () { return actions_1.getDexVaults; } });
66
- // ─── Intel ─────────────────────────────────────────────────────────
67
- var intel_1 = require("./intel");
68
- Object.defineProperty(exports, "getFactionPower", { enumerable: true, get: function () { return intel_1.getFactionPower; } });
69
- Object.defineProperty(exports, "getFactionLeaderboard", { enumerable: true, get: function () { return intel_1.getFactionLeaderboard; } });
70
- Object.defineProperty(exports, "detectAlliances", { enumerable: true, get: function () { return intel_1.detectAlliances; } });
71
- Object.defineProperty(exports, "getFactionRivals", { enumerable: true, get: function () { return intel_1.getFactionRivals; } });
72
- Object.defineProperty(exports, "getAgentProfile", { enumerable: true, get: function () { return intel_1.getAgentProfile; } });
73
- Object.defineProperty(exports, "getAgentFactions", { enumerable: true, get: function () { return intel_1.getAgentFactions; } });
74
- Object.defineProperty(exports, "getWorldFeed", { enumerable: true, get: function () { return intel_1.getWorldFeed; } });
75
- Object.defineProperty(exports, "getWorldStats", { enumerable: true, get: function () { return intel_1.getWorldStats; } });
76
- Object.defineProperty(exports, "getAgentSolLamports", { enumerable: true, get: function () { return intel_1.getAgentSolLamports; } });
77
- Object.defineProperty(exports, "startVaultPnlTracker", { enumerable: true, get: function () { return intel_1.startVaultPnlTracker; } });
78
- // ─── Vanity ─────────────────────────────────────────────────────────
10
+ exports.TOTAL_SUPPLY = exports.TOKEN_MULTIPLIER = exports.LAMPORTS_PER_SOL = exports.PROGRAM_ID = exports.grindPyreMint = exports.isPyreMint = exports.startVaultPnlTracker = exports.getDexVaults = exports.getDexPool = exports.createEphemeralAgent = exports.getBlacklistedMints = exports.isBlacklistedMint = exports.blacklistMints = exports.getAgentWalletLinkPda = exports.getAgentProfilePda = exports.REGISTRY_PROGRAM_ID = exports.RegistryProvider = exports.StateProvider = exports.MapperProvider = exports.IntelProvider = exports.ActionProvider = exports.PyreKit = void 0;
11
+ const action_provider_1 = require("./providers/action.provider");
12
+ const intel_provider_1 = require("./providers/intel.provider");
13
+ const registry_provider_1 = require("./providers/registry.provider");
14
+ const state_provider_1 = require("./providers/state.provider");
15
+ // ─── Top-level Kit ────────────────────────────────────────────────
16
+ class PyreKit {
17
+ actions;
18
+ intel;
19
+ registry;
20
+ state;
21
+ constructor(connection, publicKey) {
22
+ this.registry = new registry_provider_1.RegistryProvider(connection);
23
+ this.state = new state_provider_1.StateProvider(connection, publicKey, this.registry);
24
+ this.actions = new action_provider_1.ActionProvider(connection);
25
+ this.intel = new intel_provider_1.IntelProvider(connection, this.actions);
26
+ // Wire auto-checkpoint callback
27
+ this.state.onCheckpointDue = () => this.onCheckpointDue?.();
28
+ }
29
+ /** Callback fired when checkpoint interval is reached */
30
+ onCheckpointDue = null;
31
+ /** Configure auto-checkpoint behavior */
32
+ setCheckpointConfig(config) {
33
+ this.state.setCheckpointConfig(config);
34
+ }
35
+ /**
36
+ * Execute an action with automatic state tracking.
37
+ * On first call, initializes state from chain instead of executing.
38
+ * After execution, records the action and updates state.
39
+ */
40
+ async exec(provider, method, ...args) {
41
+ // First exec: initialize state
42
+ if (!this.state.initialized) {
43
+ await this.state.init();
44
+ return null;
45
+ }
46
+ const target = provider === 'actions' ? this.actions : this.intel;
47
+ const fn = target[method];
48
+ if (typeof fn !== 'function')
49
+ throw new Error(`Unknown method: ${provider}.${String(method)}`);
50
+ const result = await fn.call(target, ...args);
51
+ // Track action if it's a state-mutating action method
52
+ if (provider === 'actions') {
53
+ const action = this.methodToAction(method);
54
+ if (action) {
55
+ const mint = args[0]?.mint;
56
+ const message = args[0]?.message;
57
+ const description = message
58
+ ? `${action} ${mint?.slice(0, 8) ?? '?'} "${message}"`
59
+ : `${action} ${mint?.slice(0, 8) ?? '?'}`;
60
+ await this.state.record(action, mint, description);
61
+ }
62
+ }
63
+ return result;
64
+ }
65
+ /** Map action method names to tracked action types */
66
+ methodToAction(method) {
67
+ const map = {
68
+ join: 'join',
69
+ defect: 'defect',
70
+ rally: 'rally',
71
+ launch: 'launch',
72
+ message: 'message',
73
+ fud: 'fud',
74
+ requestWarLoan: 'war_loan',
75
+ repayWarLoan: 'repay_loan',
76
+ siege: 'siege',
77
+ ascend: 'ascend',
78
+ raze: 'raze',
79
+ tithe: 'tithe',
80
+ };
81
+ return map[method] ?? null;
82
+ }
83
+ }
84
+ exports.PyreKit = PyreKit;
85
+ // ─── Providers ────────────────────────────────────────────────────
86
+ var action_provider_2 = require("./providers/action.provider");
87
+ Object.defineProperty(exports, "ActionProvider", { enumerable: true, get: function () { return action_provider_2.ActionProvider; } });
88
+ var intel_provider_2 = require("./providers/intel.provider");
89
+ Object.defineProperty(exports, "IntelProvider", { enumerable: true, get: function () { return intel_provider_2.IntelProvider; } });
90
+ var mapper_provider_1 = require("./providers/mapper.provider");
91
+ Object.defineProperty(exports, "MapperProvider", { enumerable: true, get: function () { return mapper_provider_1.MapperProvider; } });
92
+ var state_provider_2 = require("./providers/state.provider");
93
+ Object.defineProperty(exports, "StateProvider", { enumerable: true, get: function () { return state_provider_2.StateProvider; } });
94
+ var registry_provider_2 = require("./providers/registry.provider");
95
+ Object.defineProperty(exports, "RegistryProvider", { enumerable: true, get: function () { return registry_provider_2.RegistryProvider; } });
96
+ Object.defineProperty(exports, "REGISTRY_PROGRAM_ID", { enumerable: true, get: function () { return registry_provider_2.REGISTRY_PROGRAM_ID; } });
97
+ Object.defineProperty(exports, "getAgentProfilePda", { enumerable: true, get: function () { return registry_provider_2.getAgentProfilePda; } });
98
+ Object.defineProperty(exports, "getAgentWalletLinkPda", { enumerable: true, get: function () { return registry_provider_2.getAgentWalletLinkPda; } });
99
+ // ─── Utilities ────────────────────────────────────────────────────
100
+ var util_1 = require("./util");
101
+ Object.defineProperty(exports, "blacklistMints", { enumerable: true, get: function () { return util_1.blacklistMints; } });
102
+ Object.defineProperty(exports, "isBlacklistedMint", { enumerable: true, get: function () { return util_1.isBlacklistedMint; } });
103
+ Object.defineProperty(exports, "getBlacklistedMints", { enumerable: true, get: function () { return util_1.getBlacklistedMints; } });
104
+ Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return util_1.createEphemeralAgent; } });
105
+ Object.defineProperty(exports, "getDexPool", { enumerable: true, get: function () { return util_1.getDexPool; } });
106
+ Object.defineProperty(exports, "getDexVaults", { enumerable: true, get: function () { return util_1.getDexVaults; } });
107
+ Object.defineProperty(exports, "startVaultPnlTracker", { enumerable: true, get: function () { return util_1.startVaultPnlTracker; } });
108
+ // ─── Vanity ───────────────────────────────────────────────────────
79
109
  var vanity_1 = require("./vanity");
80
110
  Object.defineProperty(exports, "isPyreMint", { enumerable: true, get: function () { return vanity_1.isPyreMint; } });
81
111
  Object.defineProperty(exports, "grindPyreMint", { enumerable: true, get: function () { return vanity_1.grindPyreMint; } });
82
- // ─── Registry (pyre_world on-chain agent identity) ──────────────────
83
- var registry_1 = require("./registry");
84
- // Program ID & PDA helpers
85
- Object.defineProperty(exports, "REGISTRY_PROGRAM_ID", { enumerable: true, get: function () { return registry_1.REGISTRY_PROGRAM_ID; } });
86
- Object.defineProperty(exports, "getAgentProfilePda", { enumerable: true, get: function () { return registry_1.getAgentProfilePda; } });
87
- Object.defineProperty(exports, "getAgentWalletLinkPda", { enumerable: true, get: function () { return registry_1.getAgentWalletLinkPda; } });
88
- // Read operations
89
- Object.defineProperty(exports, "getRegistryProfile", { enumerable: true, get: function () { return registry_1.getRegistryProfile; } });
90
- Object.defineProperty(exports, "getRegistryWalletLink", { enumerable: true, get: function () { return registry_1.getRegistryWalletLink; } });
91
- // Transaction builders
92
- Object.defineProperty(exports, "buildRegisterAgentTransaction", { enumerable: true, get: function () { return registry_1.buildRegisterAgentTransaction; } });
93
- Object.defineProperty(exports, "buildCheckpointTransaction", { enumerable: true, get: function () { return registry_1.buildCheckpointTransaction; } });
94
- Object.defineProperty(exports, "buildLinkAgentWalletTransaction", { enumerable: true, get: function () { return registry_1.buildLinkAgentWalletTransaction; } });
95
- Object.defineProperty(exports, "buildUnlinkAgentWalletTransaction", { enumerable: true, get: function () { return registry_1.buildUnlinkAgentWalletTransaction; } });
96
- Object.defineProperty(exports, "buildTransferAgentAuthorityTransaction", { enumerable: true, get: function () { return registry_1.buildTransferAgentAuthorityTransaction; } });
97
- // ─── Re-export torchsdk constants for convenience ──────────────────
112
+ // ─── Re-export torchsdk constants for convenience ─────────────────
98
113
  var torchsdk_1 = require("torchsdk");
99
114
  Object.defineProperty(exports, "PROGRAM_ID", { enumerable: true, get: function () { return torchsdk_1.PROGRAM_ID; } });
100
115
  Object.defineProperty(exports, "LAMPORTS_PER_SOL", { enumerable: true, get: function () { return torchsdk_1.LAMPORTS_PER_SOL; } });
@@ -0,0 +1,46 @@
1
+ import { Connection } from '@solana/web3.js';
2
+ import { Action } from '../types/action.types';
3
+ import { BuyQuoteResult, SellQuoteResult, TransactionResult } from 'torchsdk';
4
+ import { AgentLink, AllWarLoansResult, AscendParams, ClaimSpoilsParams, CommsResult, CoupParams, CreateStrongholdParams, DefectParams, ExileAgentParams, FactionDetail, FactionListParams, FactionListResult, FactionStatus, FudFactionParams, FundStrongholdParams, JoinFactionParams, JoinFactionResult, LaunchFactionParams, LaunchFactionResult, MembersResult, MessageFactionParams, RallyParams, RazeParams, RecruitAgentParams, RepayWarLoanParams, RequestWarLoanParams, SiegeParams, Stronghold, TitheParams, WarChest, WarLoan, WarLoanQuote, WithdrawAssetsParams, WithdrawFromStrongholdParams } from '../types';
5
+ export declare class ActionProvider implements Action {
6
+ private connection;
7
+ private mapper;
8
+ constructor(connection: Connection);
9
+ createStronghold(params: CreateStrongholdParams): Promise<TransactionResult>;
10
+ coup(params: CoupParams): Promise<TransactionResult>;
11
+ exileAgent(params: ExileAgentParams): Promise<TransactionResult>;
12
+ fundStronghold(params: FundStrongholdParams): Promise<TransactionResult>;
13
+ recruitAgent(params: RecruitAgentParams): Promise<TransactionResult>;
14
+ withdrawAssets(params: WithdrawAssetsParams): Promise<TransactionResult>;
15
+ withdrawFromStronghold(params: WithdrawFromStrongholdParams): Promise<TransactionResult>;
16
+ getAgentLink(wallet: string): Promise<AgentLink | undefined>;
17
+ getComms(mint: string, { limit, status }: {
18
+ limit?: number;
19
+ status?: FactionStatus;
20
+ }): Promise<CommsResult>;
21
+ getDefectQuote(mint: string, amountTokens: number): Promise<SellQuoteResult>;
22
+ getJoinQuote(mint: string, amountSolLamports: number): Promise<BuyQuoteResult>;
23
+ getFaction(mint: string): Promise<FactionDetail>;
24
+ getFactions(params?: FactionListParams): Promise<FactionListResult>;
25
+ getLinkedAgents(vaultAddress: string): Promise<AgentLink[]>;
26
+ getMembers(mint: string, limit?: number): Promise<MembersResult>;
27
+ getStronghold(creator: string): Promise<Stronghold | undefined>;
28
+ getStrongholdForAgent(wallet: string): Promise<Stronghold | undefined>;
29
+ getWarChest(mint: string): Promise<WarChest>;
30
+ getWarLoan(mint: string, wallet: string): Promise<WarLoan>;
31
+ getWarLoanQuote(mint: string, collateralAmount: number): Promise<WarLoanQuote>;
32
+ getWarLoansForFaction(mint: string): Promise<AllWarLoansResult>;
33
+ ascend(params: AscendParams): Promise<TransactionResult>;
34
+ claimSpoils(params: ClaimSpoilsParams): Promise<TransactionResult>;
35
+ defect(params: DefectParams): Promise<TransactionResult>;
36
+ fud(params: FudFactionParams): Promise<TransactionResult>;
37
+ join(params: JoinFactionParams): Promise<JoinFactionResult>;
38
+ launch(params: LaunchFactionParams): Promise<LaunchFactionResult>;
39
+ message(params: MessageFactionParams): Promise<TransactionResult>;
40
+ rally(params: RallyParams): Promise<TransactionResult>;
41
+ raze(params: RazeParams): Promise<TransactionResult>;
42
+ repayWarLoan(params: RepayWarLoanParams): Promise<TransactionResult>;
43
+ requestWarLoan(params: RequestWarLoanParams): Promise<TransactionResult>;
44
+ siege(params: SiegeParams): Promise<TransactionResult>;
45
+ tithe(params: TitheParams): Promise<TransactionResult>;
46
+ }