pyre-world-kit 3.1.2 → 3.2.1

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.
@@ -37,6 +37,9 @@ exports.StateProvider = void 0;
37
37
  const web3_js_1 = require("@solana/web3.js");
38
38
  const vanity_1 = require("../vanity");
39
39
  const util_1 = require("../util");
40
+ // Pre-warm imports — resolved once, cached as module-level promises
41
+ const splTokenImport = Promise.resolve().then(() => __importStar(require('@solana/spl-token')));
42
+ const torchsdkImport = Promise.resolve().then(() => __importStar(require('torchsdk')));
40
43
  const EMPTY_COUNTS = {
41
44
  join: 0,
42
45
  defect: 0,
@@ -60,6 +63,10 @@ class StateProvider {
60
63
  _state = null;
61
64
  checkpointConfig = null;
62
65
  ticksSinceCheckpoint = 0;
66
+ // Lazy vault — undefined = not resolved, null = resolved to nothing
67
+ _vaultCreator = undefined;
68
+ _stronghold = undefined;
69
+ _vaultPromise = null;
63
70
  constructor(connection, registry, publicKey) {
64
71
  this.connection = connection;
65
72
  this.registry = registry;
@@ -68,90 +75,108 @@ class StateProvider {
68
75
  get state() {
69
76
  return this._state;
70
77
  }
71
- get vaultCreator() {
72
- return this._state?.vaultCreator ?? null;
73
- }
74
78
  get initialized() {
75
79
  return this._state?.initialized ?? false;
76
80
  }
77
81
  get tick() {
78
82
  return this._state?.tick ?? 0;
79
83
  }
80
- /** Configure auto-checkpoint behavior */
81
84
  setCheckpointConfig(config) {
82
85
  this.checkpointConfig = config;
83
86
  }
84
- async init() {
85
- if (this._state?.initialized)
86
- return this._state;
87
- const state = {
88
- publicKey: this.publicKey,
89
- vaultCreator: null,
90
- stronghold: null,
91
- tick: 0,
92
- actionCounts: { ...EMPTY_COUNTS },
93
- holdings: new Map(),
94
- activeLoans: new Set(),
95
- founded: [],
96
- rallied: new Set(),
97
- voted: new Set(),
98
- sentiment: new Map(),
99
- recentHistory: [],
100
- personalitySummary: null,
101
- totalSolSpent: 0,
102
- totalSolReceived: 0,
103
- initialized: false,
104
- };
105
- this._state = state;
106
- // resolve vault link
107
- const { getVaultForWallet } = await Promise.resolve().then(() => __importStar(require('torchsdk')));
108
- try {
109
- const vault = await getVaultForWallet(this.connection, this.publicKey);
110
- if (vault) {
111
- state.vaultCreator = vault.creator;
112
- state.stronghold = {
113
- address: vault.address,
114
- creator: vault.creator,
115
- authority: vault.authority,
116
- sol_balance: vault.sol_balance,
117
- total_deposited: vault.total_deposited,
118
- total_withdrawn: vault.total_withdrawn,
119
- total_spent: vault.total_spent,
120
- total_received: vault.total_received,
121
- linked_agents: vault.linked_wallets,
122
- created_at: vault.created_at,
123
- };
124
- }
87
+ async resolveVault() {
88
+ if (this._vaultCreator !== undefined)
89
+ return;
90
+ if (!this._vaultPromise) {
91
+ this._vaultPromise = (async () => {
92
+ const { getVaultForWallet } = await torchsdkImport;
93
+ try {
94
+ const vault = await getVaultForWallet(this.connection, this.publicKey);
95
+ if (vault) {
96
+ this._vaultCreator = vault.creator;
97
+ this._stronghold = {
98
+ address: vault.address,
99
+ creator: vault.creator,
100
+ authority: vault.authority,
101
+ sol_balance: vault.sol_balance,
102
+ total_deposited: vault.total_deposited,
103
+ total_withdrawn: vault.total_withdrawn,
104
+ total_spent: vault.total_spent,
105
+ total_received: vault.total_received,
106
+ linked_agents: vault.linked_wallets,
107
+ created_at: vault.created_at,
108
+ };
109
+ }
110
+ else {
111
+ this._vaultCreator = null;
112
+ this._stronghold = null;
113
+ }
114
+ }
115
+ catch {
116
+ this._vaultCreator = null;
117
+ this._stronghold = null;
118
+ }
119
+ this._vaultPromise = null;
120
+ })();
125
121
  }
126
- catch { }
127
- try {
128
- const profile = await this.registry.getProfile(this.publicKey);
129
- if (profile) {
130
- state.personalitySummary = profile.personality_summary || null;
131
- state.totalSolSpent = profile.total_sol_spent;
132
- state.totalSolReceived = profile.total_sol_received;
133
- state.actionCounts.join = Math.max(state.actionCounts.join, profile.joins);
134
- state.actionCounts.defect = Math.max(state.actionCounts.defect, profile.defects);
135
- state.actionCounts.rally = Math.max(state.actionCounts.rally, profile.rallies);
136
- state.actionCounts.launch = Math.max(state.actionCounts.launch, profile.launches);
137
- state.actionCounts.message = Math.max(state.actionCounts.message, profile.messages);
138
- state.actionCounts.reinforce = Math.max(state.actionCounts.reinforce, profile.reinforces);
139
- state.actionCounts.fud = Math.max(state.actionCounts.fud, profile.fuds);
140
- state.actionCounts.infiltrate = Math.max(state.actionCounts.infiltrate, profile.infiltrates);
141
- state.actionCounts.war_loan = Math.max(state.actionCounts.war_loan, profile.war_loans);
142
- state.actionCounts.repay_loan = Math.max(state.actionCounts.repay_loan, profile.repay_loans);
143
- state.actionCounts.siege = Math.max(state.actionCounts.siege, profile.sieges);
144
- state.actionCounts.ascend = Math.max(state.actionCounts.ascend, profile.ascends);
145
- state.actionCounts.raze = Math.max(state.actionCounts.raze, profile.razes);
146
- state.actionCounts.tithe = Math.max(state.actionCounts.tithe, profile.tithes);
147
- const totalFromCheckpoint = Object.values(state.actionCounts).reduce((a, b) => a + b, 0);
148
- state.tick = totalFromCheckpoint;
122
+ return this._vaultPromise;
123
+ }
124
+ async getVaultCreator() {
125
+ await this.resolveVault();
126
+ return this._vaultCreator ?? null;
127
+ }
128
+ async getStronghold() {
129
+ await this.resolveVault();
130
+ return this._stronghold ?? null;
131
+ }
132
+ async init() {
133
+ if (!this._state?.initialized) {
134
+ const state = {
135
+ publicKey: this.publicKey,
136
+ tick: 0,
137
+ actionCounts: { ...EMPTY_COUNTS },
138
+ activeLoans: new Set(),
139
+ founded: [],
140
+ rallied: new Set(),
141
+ voted: new Set(),
142
+ sentiment: new Map(),
143
+ recentHistory: [],
144
+ personalitySummary: null,
145
+ totalSolSpent: 0,
146
+ totalSolReceived: 0,
147
+ initialized: false,
148
+ };
149
+ // Fire vault resolution in background — don't block init
150
+ this.resolveVault();
151
+ try {
152
+ const profile = await this.registry.getProfile(this.publicKey);
153
+ if (profile) {
154
+ state.personalitySummary = profile.personality_summary || null;
155
+ state.totalSolSpent = profile.total_sol_spent;
156
+ state.totalSolReceived = profile.total_sol_received;
157
+ state.actionCounts.join = Math.max(state.actionCounts.join, profile.joins);
158
+ state.actionCounts.defect = Math.max(state.actionCounts.defect, profile.defects);
159
+ state.actionCounts.rally = Math.max(state.actionCounts.rally, profile.rallies);
160
+ state.actionCounts.launch = Math.max(state.actionCounts.launch, profile.launches);
161
+ state.actionCounts.message = Math.max(state.actionCounts.message, profile.messages);
162
+ state.actionCounts.reinforce = Math.max(state.actionCounts.reinforce, profile.reinforces);
163
+ state.actionCounts.fud = Math.max(state.actionCounts.fud, profile.fuds);
164
+ state.actionCounts.infiltrate = Math.max(state.actionCounts.infiltrate, profile.infiltrates);
165
+ state.actionCounts.war_loan = Math.max(state.actionCounts.war_loan, profile.war_loans);
166
+ state.actionCounts.repay_loan = Math.max(state.actionCounts.repay_loan, profile.repay_loans);
167
+ state.actionCounts.siege = Math.max(state.actionCounts.siege, profile.sieges);
168
+ state.actionCounts.ascend = Math.max(state.actionCounts.ascend, profile.ascends);
169
+ state.actionCounts.raze = Math.max(state.actionCounts.raze, profile.razes);
170
+ state.actionCounts.tithe = Math.max(state.actionCounts.tithe, profile.tithes);
171
+ const totalFromCheckpoint = Object.values(state.actionCounts).reduce((a, b) => a + b, 0);
172
+ state.tick = totalFromCheckpoint;
173
+ }
149
174
  }
175
+ catch { }
176
+ state.initialized = true;
177
+ this._state = state;
150
178
  }
151
- catch { }
152
- await this.refreshHoldings();
153
- state.initialized = true;
154
- return state;
179
+ return this._state;
155
180
  }
156
181
  async record(action, mint, description) {
157
182
  if (!this._state)
@@ -171,7 +196,10 @@ class StateProvider {
171
196
  this._state.recentHistory = this._state.recentHistory.slice(-20);
172
197
  }
173
198
  }
174
- await this.refreshHoldings();
199
+ // Sync P&L from vault every 10 ticks
200
+ if (this._state.tick % 10 === 0) {
201
+ this.syncPnl();
202
+ }
175
203
  if (this.checkpointConfig && this.ticksSinceCheckpoint >= this.checkpointConfig.interval) {
176
204
  this.ticksSinceCheckpoint = 0;
177
205
  this.onCheckpointDue?.();
@@ -182,15 +210,15 @@ class StateProvider {
182
210
  return;
183
211
  const current = this._state.sentiment.get(mint) ?? 0;
184
212
  const SENTIMENT_DELTAS = {
185
- join: 1,
186
- reinforce: 1.5,
187
- defect: -2,
188
- rally: 3,
189
- infiltrate: -5,
190
- message: 0.5,
191
- fud: -1.5,
192
- war_loan: 1,
193
- launch: 3,
213
+ join: 0.1,
214
+ reinforce: 0.15,
215
+ defect: -0.2,
216
+ rally: 0.3,
217
+ infiltrate: -0.5,
218
+ message: 0.05,
219
+ fud: -0.15,
220
+ war_loan: 0.1,
221
+ launch: 0.3,
194
222
  };
195
223
  const delta = SENTIMENT_DELTAS[action] ?? 0;
196
224
  if (delta !== 0) {
@@ -198,42 +226,51 @@ class StateProvider {
198
226
  }
199
227
  }
200
228
  onCheckpointDue = null;
201
- async refreshHoldings() {
229
+ /** Sync totalSolSpent/Received from on-chain vault data (fresh read) */
230
+ async syncPnl() {
202
231
  if (!this._state)
203
232
  return;
204
- const { TOKEN_2022_PROGRAM_ID } = await Promise.resolve().then(() => __importStar(require('@solana/spl-token')));
205
- const walletPk = new web3_js_1.PublicKey(this.publicKey);
206
- let walletValues = [];
207
233
  try {
208
- const walletAccounts = await this.connection.getParsedTokenAccountsByOwner(walletPk, {
209
- programId: TOKEN_2022_PROGRAM_ID,
210
- });
211
- walletValues = walletAccounts.value;
212
- }
213
- catch { }
214
- let vaultValues = [];
215
- if (this._state.stronghold) {
216
- try {
217
- const vaultPk = new web3_js_1.PublicKey(this._state.stronghold.address);
218
- const vaultAccounts = await this.connection.getParsedTokenAccountsByOwner(vaultPk, {
219
- programId: TOKEN_2022_PROGRAM_ID,
220
- });
221
- vaultValues = vaultAccounts.value;
234
+ const { getVaultForWallet } = await torchsdkImport;
235
+ const vault = await getVaultForWallet(this.connection, this.publicKey);
236
+ if (vault) {
237
+ this._state.totalSolSpent = Math.round(vault.total_spent * 1e9);
238
+ this._state.totalSolReceived = Math.round(vault.total_received * 1e9);
222
239
  }
223
- catch { }
224
240
  }
225
- const newHoldings = new Map();
241
+ catch { }
242
+ }
243
+ async getHoldings() {
244
+ const { TOKEN_2022_PROGRAM_ID } = await splTokenImport;
245
+ const walletPk = new web3_js_1.PublicKey(this.publicKey);
246
+ // Parallel scan: wallet + vault
247
+ const stronghold = await this.getStronghold();
248
+ const scanWallet = this.connection
249
+ .getParsedTokenAccountsByOwner(walletPk, { programId: TOKEN_2022_PROGRAM_ID })
250
+ .then((r) => r.value)
251
+ .catch(() => []);
252
+ const scanVault = stronghold
253
+ ? this.connection
254
+ .getParsedTokenAccountsByOwner(new web3_js_1.PublicKey(stronghold.address), {
255
+ programId: TOKEN_2022_PROGRAM_ID,
256
+ })
257
+ .then((r) => r.value)
258
+ .catch(() => [])
259
+ : Promise.resolve([]);
260
+ const [walletValues, vaultValues] = await Promise.all([scanWallet, scanVault]);
261
+ const holdings = new Map();
226
262
  for (const a of [...walletValues, ...vaultValues]) {
227
263
  const mint = a.account.data.parsed.info.mint;
228
264
  const balance = Number(a.account.data.parsed.info.tokenAmount.uiAmount ?? 0);
229
265
  if (balance > 0 && (0, vanity_1.isPyreMint)(mint) && !(0, util_1.isBlacklistedMint)(mint)) {
230
- newHoldings.set(mint, (newHoldings.get(mint) ?? 0) + balance);
266
+ holdings.set(mint, (holdings.get(mint) ?? 0) + balance);
231
267
  }
232
268
  }
233
- this._state.holdings.clear();
234
- for (const [mint, balance] of newHoldings) {
235
- this._state.holdings.set(mint, balance);
236
- }
269
+ return holdings;
270
+ }
271
+ async getBalance(mint) {
272
+ const holdings = await this.getHoldings();
273
+ return holdings.get(mint) ?? 0;
237
274
  }
238
275
  getSentiment(mint) {
239
276
  return this._state?.sentiment.get(mint) ?? 0;
@@ -244,9 +281,6 @@ class StateProvider {
244
281
  get history() {
245
282
  return this._state?.recentHistory ?? [];
246
283
  }
247
- getBalance(mint) {
248
- return this._state?.holdings.get(mint) ?? 0;
249
- }
250
284
  hasVoted(mint) {
251
285
  return this._state?.voted.has(mint) ?? false;
252
286
  }
@@ -260,8 +294,8 @@ class StateProvider {
260
294
  this._state?.rallied.add(mint);
261
295
  }
262
296
  serialize() {
263
- if (!this._state) {
264
- return {
297
+ return !this._state
298
+ ? {
265
299
  publicKey: this.publicKey,
266
300
  vaultCreator: null,
267
301
  tick: 0,
@@ -276,33 +310,32 @@ class StateProvider {
276
310
  personalitySummary: null,
277
311
  totalSolSpent: 0,
278
312
  totalSolReceived: 0,
313
+ }
314
+ : {
315
+ publicKey: this._state.publicKey,
316
+ vaultCreator: this._vaultCreator ?? null,
317
+ tick: this._state.tick,
318
+ actionCounts: { ...this._state.actionCounts },
319
+ holdings: {},
320
+ activeLoans: Array.from(this._state.activeLoans),
321
+ founded: [...this._state.founded],
322
+ rallied: Array.from(this._state.rallied),
323
+ voted: Array.from(this._state.voted),
324
+ sentiment: Object.fromEntries(this._state.sentiment),
325
+ recentHistory: this._state.recentHistory.slice(-20),
326
+ personalitySummary: this._state.personalitySummary,
327
+ totalSolSpent: this._state.totalSolSpent,
328
+ totalSolReceived: this._state.totalSolReceived,
279
329
  };
280
- }
281
- return {
282
- publicKey: this._state.publicKey,
283
- vaultCreator: this._state.vaultCreator,
284
- tick: this._state.tick,
285
- actionCounts: { ...this._state.actionCounts },
286
- holdings: Object.fromEntries(this._state.holdings),
287
- activeLoans: Array.from(this._state.activeLoans),
288
- founded: [...this._state.founded],
289
- rallied: Array.from(this._state.rallied),
290
- voted: Array.from(this._state.voted),
291
- sentiment: Object.fromEntries(this._state.sentiment),
292
- recentHistory: this._state.recentHistory.slice(-20),
293
- personalitySummary: this._state.personalitySummary,
294
- totalSolSpent: this._state.totalSolSpent,
295
- totalSolReceived: this._state.totalSolReceived,
296
- };
297
330
  }
298
331
  hydrate(saved) {
332
+ if (saved.vaultCreator) {
333
+ this._vaultCreator = saved.vaultCreator;
334
+ }
299
335
  this._state = {
300
336
  publicKey: saved.publicKey,
301
- vaultCreator: saved.vaultCreator,
302
- stronghold: null, // will be resolved on next refreshHoldings or init
303
337
  tick: saved.tick,
304
338
  actionCounts: { ...EMPTY_COUNTS, ...saved.actionCounts },
305
- holdings: new Map(Object.entries(saved.holdings)),
306
339
  activeLoans: new Set(saved.activeLoans),
307
340
  founded: [...saved.founded],
308
341
  rallied: new Set(saved.rallied),
@@ -1,9 +1,10 @@
1
- import { AgentFactionPosition, AgentProfile, AllianceCluster, FactionPower, FactionStatus, RivalFaction, WorldEvent, WorldStats } from '../types';
1
+ import { AgentFactionPosition, AgentProfile, AllianceCluster, FactionListResult, FactionPower, FactionStatus, NearbyResult, RivalFaction, WorldEvent, WorldStats } from '../types';
2
2
  export interface Intel {
3
- getAgentFactions(wallet: string, factionLimit?: number): Promise<AgentFactionPosition[]>;
3
+ getAgentFactions(wallet: string): Promise<AgentFactionPosition[]>;
4
4
  getAgentProfile(wallet: string): Promise<AgentProfile>;
5
5
  getAgentSolLamports(wallet: string): Promise<number>;
6
6
  getAllies(mints: string[], holderLimit?: number): Promise<AllianceCluster[]>;
7
+ getAscendedFactions(limit?: number): Promise<FactionListResult>;
7
8
  getFactionPower(mint: string): Promise<FactionPower>;
8
9
  getFactionLeaderboard(opts?: {
9
10
  status?: FactionStatus;
@@ -12,6 +13,11 @@ export interface Intel {
12
13
  getFactionRivals(mint: string, opts?: {
13
14
  limit?: number;
14
15
  }): Promise<RivalFaction[]>;
16
+ getNearbyFactions(wallet: string, opts?: {
17
+ depth?: number;
18
+ limit?: number;
19
+ }): Promise<NearbyResult>;
20
+ getRisingFactions(limit?: number): Promise<FactionListResult>;
15
21
  getWorldFeed(opts?: {
16
22
  limit?: number;
17
23
  factionLimit?: number;
@@ -5,16 +5,10 @@ export type TrackedAction = 'join' | 'defect' | 'rally' | 'launch' | 'message' |
5
5
  export interface AgentGameState {
6
6
  /** Agent wallet public key */
7
7
  publicKey: string;
8
- /** Vault creator key (resolved from on-chain vault link) */
9
- vaultCreator: string | null;
10
- /** Vault info (null if no vault found) */
11
- stronghold: Stronghold | null;
12
8
  /** Monotonic tick counter — increments on each successful action */
13
9
  tick: number;
14
10
  /** Cumulative action counts keyed by action type */
15
11
  actionCounts: Record<TrackedAction, number>;
16
- /** Token holdings: mint → balance (wallet + vault combined) */
17
- holdings: Map<string, number>;
18
12
  /** Mints with active war loans */
19
13
  activeLoans: Set<string>;
20
14
  /** Mints this agent founded */
@@ -69,34 +63,35 @@ export interface CheckpointConfig {
69
63
  export interface State {
70
64
  /** Current game state (null before init) */
71
65
  readonly state: AgentGameState | null;
72
- /** Vault creator key (shorthand for state.vaultCreator) */
73
- readonly vaultCreator: string | null;
74
66
  /** Whether state has been initialized */
75
67
  readonly initialized: boolean;
76
68
  /** Current tick count */
77
69
  readonly tick: number;
78
70
  /**
79
71
  * Initialize state from chain.
80
- * Resolves vault link, loads holdings, loads action counts from registry checkpoint.
81
- * Must be called before any action. Returns the resolved state.
72
+ * Loads action counts from registry checkpoint.
73
+ * Vault and holdings are resolved lazily on first access.
82
74
  */
83
75
  init(): Promise<AgentGameState>;
84
76
  /**
85
77
  * Record a successful action — increments tick, updates action counts,
86
- * updates sentiment, appends to history, refreshes holdings.
87
- * Called by ActionProvider after tx confirmation.
78
+ * updates sentiment, appends to history.
88
79
  */
89
80
  record(action: TrackedAction, mint?: string, description?: string): Promise<void>;
90
- /** Refresh holdings from on-chain (wallet + vault token accounts) */
91
- refreshHoldings(): Promise<void>;
81
+ /** Get vault creator key (lazy resolves on first call, cached after) */
82
+ getVaultCreator(): Promise<string | null>;
83
+ /** Get stronghold info (lazy — resolves on first call, cached after) */
84
+ getStronghold(): Promise<Stronghold | null>;
85
+ /** Get token holdings fresh from chain (wallet + vault) */
86
+ getHoldings(): Promise<Map<string, number>>;
87
+ /** Get token balance for a specific mint (fresh from chain) */
88
+ getBalance(mint: string): Promise<number>;
92
89
  /** Get sentiment score for a faction (-10 to +10) */
93
90
  getSentiment(mint: string): number;
94
91
  /** Get all sentiment entries */
95
92
  readonly sentimentMap: ReadonlyMap<string, number>;
96
93
  /** Get recent action history (for LLM memory block) */
97
94
  readonly history: readonly string[];
98
- /** Get token balance for a specific mint */
99
- getBalance(mint: string): number;
100
95
  /** Check if agent has voted on a faction */
101
96
  hasVoted(mint: string): boolean;
102
97
  /** Check if agent has rallied a faction */
package/dist/types.d.ts CHANGED
@@ -327,6 +327,11 @@ export interface FactionPower {
327
327
  progress_percent: number;
328
328
  status: FactionStatus;
329
329
  }
330
+ /** Result from getNearbyFactions — factions + discovered agents in the social graph */
331
+ export interface NearbyResult extends FactionListResult {
332
+ /** Wallet addresses discovered as co-holders (natural allies) */
333
+ allies: string[];
334
+ }
330
335
  export interface AllianceCluster {
331
336
  factions: string[];
332
337
  shared_members: number;
package/dist/vanity.d.ts CHANGED
@@ -10,8 +10,8 @@ import type { CreateTokenResult, CreateTokenParams } from 'torchsdk';
10
10
  export declare const getBondingCurvePda: (mint: PublicKey) => [PublicKey, number];
11
11
  export declare const getTokenTreasuryPda: (mint: PublicKey) => [PublicKey, number];
12
12
  export declare const getTreasuryLockPda: (mint: PublicKey) => [PublicKey, number];
13
- /** Grind for a keypair whose base58 address ends with "py" */
13
+ /** Grind for a keypair whose base58 address ends with "pw" (pyreworld) */
14
14
  export declare const grindPyreMint: (maxAttempts?: number) => Keypair;
15
- /** Check if a mint address is a pyre faction (ends with "py") */
15
+ /** Check if a mint address is a pyre faction (ends with "pw") */
16
16
  export declare const isPyreMint: (mint: string) => boolean;
17
17
  export declare const buildCreateFactionTransaction: (connection: Connection, params: CreateTokenParams) => Promise<CreateTokenResult>;
package/dist/vanity.js CHANGED
@@ -34,22 +34,19 @@ const getTreasuryTokenAccount = (mint, treasury) => (0, spl_token_1.getAssociate
34
34
  const getTreasuryLockPda = (mint) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(TREASURY_LOCK_SEED), mint.toBuffer()], torchsdk_1.PROGRAM_ID);
35
35
  exports.getTreasuryLockPda = getTreasuryLockPda;
36
36
  const getTreasuryLockTokenAccount = (mint, treasuryLock) => (0, spl_token_1.getAssociatedTokenAddressSync)(mint, treasuryLock, true, TOKEN_2022_PROGRAM_ID);
37
- const makeDummyProvider = (connection, payer) => {
38
- const dummyWallet = {
39
- publicKey: payer,
40
- signTransaction: async (t) => t,
41
- signAllTransactions: async (t) => t,
42
- };
43
- return new anchor_1.AnchorProvider(connection, dummyWallet, {});
44
- };
37
+ const makeDummyProvider = (connection, payer) => new anchor_1.AnchorProvider(connection, {
38
+ publicKey: payer,
39
+ signTransaction: async (t) => t,
40
+ signAllTransactions: async (t) => t,
41
+ }, {});
45
42
  const finalizeTransaction = async (connection, tx, feePayer) => {
46
43
  const { blockhash } = await connection.getLatestBlockhash();
47
44
  tx.recentBlockhash = blockhash;
48
45
  tx.feePayer = feePayer;
49
46
  };
50
47
  // ── Vanity grinder ──
51
- const PYRE_SUFFIX = 'py';
52
- /** Grind for a keypair whose base58 address ends with "py" */
48
+ const PYRE_SUFFIX = 'pw';
49
+ /** Grind for a keypair whose base58 address ends with "pw" (pyreworld) */
53
50
  const grindPyreMint = (maxAttempts = 500_000) => {
54
51
  for (let i = 0; i < maxAttempts; i++) {
55
52
  const kp = web3_js_1.Keypair.generate();
@@ -61,7 +58,7 @@ const grindPyreMint = (maxAttempts = 500_000) => {
61
58
  return web3_js_1.Keypair.generate();
62
59
  };
63
60
  exports.grindPyreMint = grindPyreMint;
64
- /** Check if a mint address is a pyre faction (ends with "py") */
61
+ /** Check if a mint address is a pyre faction (ends with "pw") */
65
62
  const isPyreMint = (mint) => mint.endsWith(PYRE_SUFFIX);
66
63
  exports.isPyreMint = isPyreMint;
67
64
  // ── Build create transaction with pyre vanity address ──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-world-kit",
3
- "version": "3.1.2",
3
+ "version": "3.2.1",
4
4
  "description": "Agent-first faction warfare kit — game-semantic wrapper over torchsdk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",