pyre-world-kit 2.0.12 → 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.
- package/.prettierrc.json +6 -0
- package/dist/index.d.ts +38 -4
- package/dist/index.js +100 -85
- package/dist/providers/action.provider.d.ts +46 -0
- package/dist/providers/action.provider.js +331 -0
- package/dist/providers/intel.provider.d.ts +29 -0
- package/dist/providers/intel.provider.js +363 -0
- package/dist/providers/mapper.provider.d.ts +197 -0
- package/dist/providers/mapper.provider.js +158 -0
- package/dist/providers/registry.provider.d.ts +25 -0
- package/dist/providers/registry.provider.js +229 -0
- package/dist/providers/state.provider.d.ts +42 -0
- package/dist/providers/state.provider.js +348 -0
- package/dist/pyre_world.json +34 -229
- package/dist/types/action.types.d.ts +41 -0
- package/dist/types/action.types.js +2 -0
- package/dist/types/intel.types.d.ts +20 -0
- package/dist/types/intel.types.js +2 -0
- package/dist/types/mapper.types.d.ts +27 -0
- package/dist/types/mapper.types.js +22 -0
- package/dist/types/registry.types.d.ts +0 -0
- package/dist/types/registry.types.js +1 -0
- package/dist/types/state.types.d.ts +112 -0
- package/dist/types/state.types.js +2 -0
- package/dist/types.d.ts +8 -24
- package/dist/util.d.ts +29 -0
- package/dist/util.js +144 -0
- package/dist/vanity.d.ts +3 -3
- package/dist/vanity.js +18 -15
- package/package.json +4 -2
- package/readme.md +134 -122
- package/src/index.ts +127 -92
- package/src/providers/action.provider.ts +443 -0
- package/src/providers/intel.provider.ts +383 -0
- package/src/providers/mapper.provider.ts +195 -0
- package/src/providers/registry.provider.ts +277 -0
- package/src/providers/state.provider.ts +357 -0
- package/src/pyre_world.json +35 -230
- package/src/types/action.types.ts +76 -0
- package/src/types/intel.types.ts +22 -0
- package/src/types/mapper.types.ts +84 -0
- package/src/types/registry.types.ts +0 -0
- package/src/types/state.types.ts +144 -0
- package/src/types.ts +329 -333
- package/src/util.ts +148 -0
- package/src/vanity.ts +27 -14
- package/tests/test_e2e.ts +339 -172
- package/src/actions.ts +0 -719
- package/src/intel.ts +0 -521
- package/src/mappers.ts +0 -302
- package/src/registry.ts +0 -317
- package/tests/test_devnet_e2e.ts +0 -401
- package/tests/test_sim.ts +0 -458
package/src/util.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pyre Kit Actions
|
|
3
|
+
*
|
|
4
|
+
* Thin wrappers that call torchsdk functions and map params/results
|
|
5
|
+
* into game-semantic Pyre types. No new on-chain logic.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { PublicKey } from '@solana/web3.js'
|
|
9
|
+
import { getRaydiumMigrationAccounts } from 'torchsdk'
|
|
10
|
+
import { Intel } from './types/intel.types'
|
|
11
|
+
|
|
12
|
+
// ─── Blacklist ──────────────────────────────────────────────────────
|
|
13
|
+
// Mints from previous swarm runs. Agents should skip these and only
|
|
14
|
+
// interact with freshly launched factions.
|
|
15
|
+
|
|
16
|
+
const DEFAULT_BLACKLIST = [
|
|
17
|
+
'E1SgYPW6JXhw5BabrvJkr6L2PyvfFenYaoCTePazyNpy',
|
|
18
|
+
'6jWsyDC87RmfrZZRjuxSAxvUxE665HGZwZ2Z8j5z9epy',
|
|
19
|
+
'6J8PLgFxHb98cNURP2Yt2SKwgnUeEXpN6Us2kxaMz1py',
|
|
20
|
+
'5A297UyPQstxWpJyydDnFvn2zN8whCEYdqvnfB5bF9py',
|
|
21
|
+
'8XdWfSKLJusAcRrYzK3bWJ7dy46AkbU8qxF3B55uSfpy',
|
|
22
|
+
'7ZYrKcJbFFbG36keCYRvfc1j1HScQmJW1zRV3wVVD4py',
|
|
23
|
+
'ERQPyG2oqx5bdyuY2Nnm5ZbZY2zcB46TfUxqpzYWH5py',
|
|
24
|
+
'JCvpK3kTnh2EdQG71mqE8ZXcvzLU5EJNG5vgGZme4wpy',
|
|
25
|
+
'9RDFkGSjKpjHtXZ25uuug2MN5P7oSjzkLg16HcrKy3py',
|
|
26
|
+
'2kWcX1Zet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coEXX8A5T8i8vfz2S96P39abzoXXuBghfpy',
|
|
84
|
+
'2ZeQsU13WjgX2152qV3wyzxURjLg7GwfXznAiA99Jjpy',
|
|
85
|
+
'FuUHck8jqaXxGiTuLym4gYXJQrueyEsgd8AMUQx2fMpy',
|
|
86
|
+
'trTuaGATQZwUeYkYTeyJfQnGGnKRvAriAZRgBWg7Epy',
|
|
87
|
+
'HEhemzeszztaFzFYR9DjpNwdhghVDD1y7cHxP93EPZpy',
|
|
88
|
+
'obuf6MkL1ev6WuUDDjH3bq2q6Ryr6MBNMRsA6dEW4py',
|
|
89
|
+
'76ruUbqBpqSKsysoPesDrpaLsDSahWWphQmXrswiLbpy',
|
|
90
|
+
'4ci4scCevt5tXCxkGr5xHoWyaeQY1dahp5nFsTnfYApy',
|
|
91
|
+
'shzuPKgqedBxJmxdrRyWAtajG3hSNyLr72SufvmEvpy',
|
|
92
|
+
// wave 4 (devnet cleanup)
|
|
93
|
+
'ZkprRY78cmfSmjMvDmgb4rWRxnxNrQYpF8chejRt3py',
|
|
94
|
+
'4BFfCqG4L6bsS2tEZTpgQPJjsSqqLPQaxuaWMJcaRjpy',
|
|
95
|
+
'5xRA2q9oHjoxN1XgqMTZW3aRBgGppcLCCbLBURepXApy',
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
const BLACKLISTED_MINTS = new Set<string>(DEFAULT_BLACKLIST)
|
|
99
|
+
|
|
100
|
+
/** Add mints to the blacklist (call at startup with old mints) */
|
|
101
|
+
export function blacklistMints(mints: string[]): void {
|
|
102
|
+
for (const m of mints) BLACKLISTED_MINTS.add(m)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Check if a mint is blacklisted */
|
|
106
|
+
export function isBlacklistedMint(mint: string): boolean {
|
|
107
|
+
return BLACKLISTED_MINTS.has(mint)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Get all blacklisted mints */
|
|
111
|
+
export function getBlacklistedMints(): string[] {
|
|
112
|
+
return Array.from(BLACKLISTED_MINTS)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Create an ephemeral agent keypair (memory-only, zero key management) */
|
|
116
|
+
export { createEphemeralAgent } from 'torchsdk'
|
|
117
|
+
|
|
118
|
+
/** Get the Raydium pool state PDA for an ascended faction's DEX pool */
|
|
119
|
+
export function getDexPool(mint: string): PublicKey {
|
|
120
|
+
const { poolState } = getRaydiumMigrationAccounts(new PublicKey(mint))
|
|
121
|
+
return poolState
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Get Raydium pool vault addresses for an ascended faction */
|
|
125
|
+
export function getDexVaults(mint: string): { solVault: string; tokenVault: string } {
|
|
126
|
+
const accts = getRaydiumMigrationAccounts(new PublicKey(mint))
|
|
127
|
+
return {
|
|
128
|
+
solVault: (accts.isWsolToken0 ? accts.token0Vault : accts.token1Vault).toString(),
|
|
129
|
+
tokenVault: (accts.isWsolToken0 ? accts.token1Vault : accts.token0Vault).toString(),
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const startVaultPnlTracker = async (
|
|
134
|
+
intel: Intel,
|
|
135
|
+
wallet: string,
|
|
136
|
+
): Promise<{ finish: () => Promise<{ spent: number; received: number }> }> => {
|
|
137
|
+
const before = await intel.getAgentSolLamports(wallet)
|
|
138
|
+
return {
|
|
139
|
+
async finish() {
|
|
140
|
+
const after = await intel.getAgentSolLamports(wallet)
|
|
141
|
+
const diff = after - before
|
|
142
|
+
return {
|
|
143
|
+
spent: diff < 0 ? Math.abs(diff) : 0,
|
|
144
|
+
received: diff > 0 ? diff : 0,
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
}
|
package/src/vanity.ts
CHANGED
|
@@ -14,10 +14,7 @@ import {
|
|
|
14
14
|
SYSVAR_RENT_PUBKEY,
|
|
15
15
|
Keypair,
|
|
16
16
|
} from '@solana/web3.js'
|
|
17
|
-
import {
|
|
18
|
-
getAssociatedTokenAddressSync,
|
|
19
|
-
ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
20
|
-
} from '@solana/spl-token'
|
|
17
|
+
import { getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token'
|
|
21
18
|
import { BN, Program, AnchorProvider, Wallet } from '@coral-xyz/anchor'
|
|
22
19
|
import type { CreateTokenResult, CreateTokenParams } from 'torchsdk'
|
|
23
20
|
import { PROGRAM_ID } from 'torchsdk'
|
|
@@ -63,7 +60,11 @@ const makeDummyProvider = (connection: Connection, payer: PublicKey): AnchorProv
|
|
|
63
60
|
return new AnchorProvider(connection, dummyWallet as unknown as Wallet, {})
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
const finalizeTransaction = async (
|
|
63
|
+
const finalizeTransaction = async (
|
|
64
|
+
connection: Connection,
|
|
65
|
+
tx: Transaction,
|
|
66
|
+
feePayer: PublicKey,
|
|
67
|
+
): Promise<void> => {
|
|
67
68
|
const { blockhash } = await connection.getLatestBlockhash()
|
|
68
69
|
tx.recentBlockhash = blockhash
|
|
69
70
|
tx.feePayer = feePayer
|
|
@@ -74,7 +75,7 @@ const finalizeTransaction = async (connection: Connection, tx: Transaction, feeP
|
|
|
74
75
|
const PYRE_SUFFIX = 'py'
|
|
75
76
|
|
|
76
77
|
/** Grind for a keypair whose base58 address ends with "py" */
|
|
77
|
-
export
|
|
78
|
+
export const grindPyreMint = (maxAttempts: number = 500_000): Keypair => {
|
|
78
79
|
for (let i = 0; i < maxAttempts; i++) {
|
|
79
80
|
const kp = Keypair.generate()
|
|
80
81
|
if (kp.publicKey.toBase58().endsWith(PYRE_SUFFIX)) {
|
|
@@ -86,17 +87,22 @@ export function grindPyreMint(maxAttempts: number = 500_000): Keypair {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
/** Check if a mint address is a pyre faction (ends with "py") */
|
|
89
|
-
export
|
|
90
|
-
return mint.endsWith(PYRE_SUFFIX)
|
|
91
|
-
}
|
|
90
|
+
export const isPyreMint = (mint: string): boolean => mint.endsWith(PYRE_SUFFIX)
|
|
92
91
|
|
|
93
92
|
// ── Build create transaction with pyre vanity address ──
|
|
94
93
|
|
|
95
|
-
export async
|
|
94
|
+
export const buildCreateFactionTransaction = async (
|
|
96
95
|
connection: Connection,
|
|
97
96
|
params: CreateTokenParams,
|
|
98
|
-
): Promise<CreateTokenResult> {
|
|
99
|
-
const {
|
|
97
|
+
): Promise<CreateTokenResult> => {
|
|
98
|
+
const {
|
|
99
|
+
creator: creatorStr,
|
|
100
|
+
name,
|
|
101
|
+
symbol,
|
|
102
|
+
metadata_uri,
|
|
103
|
+
sol_target = 0,
|
|
104
|
+
community_token = true,
|
|
105
|
+
} = params
|
|
100
106
|
|
|
101
107
|
const creator = new PublicKey(creatorStr)
|
|
102
108
|
|
|
@@ -125,8 +131,15 @@ export async function buildCreateFactionTransaction(
|
|
|
125
131
|
const provider = makeDummyProvider(connection, creator)
|
|
126
132
|
const program = new Program(idl as any, provider)
|
|
127
133
|
|
|
128
|
-
const createIx = await (
|
|
129
|
-
.createToken({
|
|
134
|
+
const createIx = await (
|
|
135
|
+
program.methods.createToken({
|
|
136
|
+
name,
|
|
137
|
+
symbol,
|
|
138
|
+
uri: metadata_uri,
|
|
139
|
+
solTarget: new BN(sol_target),
|
|
140
|
+
communityToken: community_token,
|
|
141
|
+
}) as any
|
|
142
|
+
)
|
|
130
143
|
.accounts({
|
|
131
144
|
creator,
|
|
132
145
|
globalConfig,
|