pyre-world-kit 1.0.20 → 1.0.22
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/dist/actions.d.ts +4 -2
- package/dist/actions.js +28 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/package.json +2 -2
- package/src/actions.ts +37 -2
- package/src/index.ts +1 -0
package/dist/actions.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
8
8
|
import type { BuyQuoteResult, SellQuoteResult, TransactionResult, SaidVerification, ConfirmResult } from 'torchsdk';
|
|
9
|
-
import type { FactionListParams, FactionListResult, FactionDetail, MembersResult, CommsResult, Stronghold, AgentLink, WarChest, WarLoan, WarLoanQuote, AllWarLoansResult, 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 } from './types';
|
|
9
|
+
import type { FactionListParams, FactionListResult, FactionDetail, MembersResult, CommsResult, Stronghold, AgentLink, WarChest, WarLoan, WarLoanQuote, AllWarLoansResult, 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, FactionStatus } from './types';
|
|
10
10
|
/** Add mints to the blacklist (call at startup with old mints) */
|
|
11
11
|
export declare function blacklistMints(mints: string[]): void;
|
|
12
12
|
/** Check if a mint is blacklisted */
|
|
@@ -20,7 +20,7 @@ export declare function getFaction(connection: Connection, mint: string): Promis
|
|
|
20
20
|
/** Get faction members (top holders, excluding program-owned accounts) */
|
|
21
21
|
export declare function getMembers(connection: Connection, mint: string, limit?: number): Promise<MembersResult>;
|
|
22
22
|
/** Get faction comms (trade-bundled messages, including post-ascension DEX messages) */
|
|
23
|
-
export declare function getComms(connection: Connection, mint: string, limit?: number): Promise<CommsResult>;
|
|
23
|
+
export declare function getComms(connection: Connection, mint: string, limit?: number, status?: FactionStatus): Promise<CommsResult>;
|
|
24
24
|
/** Get a quote for joining a faction (buying tokens) */
|
|
25
25
|
export declare function getJoinQuote(connection: Connection, mint: string, amountSolLamports: number): Promise<BuyQuoteResult>;
|
|
26
26
|
/** Get a quote for defecting from a faction (selling tokens) */
|
|
@@ -31,6 +31,8 @@ export declare function getStronghold(connection: Connection, creator: string):
|
|
|
31
31
|
export declare function getStrongholdForAgent(connection: Connection, wallet: string): Promise<Stronghold | null>;
|
|
32
32
|
/** Get agent link info for a wallet */
|
|
33
33
|
export declare function getAgentLink(connection: Connection, wallet: string): Promise<AgentLink | null>;
|
|
34
|
+
/** Get all linked agents for a vault (via getProgramAccounts) */
|
|
35
|
+
export declare function getLinkedAgents(connection: Connection, vaultAddress: string): Promise<AgentLink[]>;
|
|
34
36
|
/** Get war chest (lending info) for a faction */
|
|
35
37
|
export declare function getWarChest(connection: Connection, mint: string): Promise<WarChest>;
|
|
36
38
|
/** Get war loan position for a specific agent on a faction */
|
package/dist/actions.js
CHANGED
|
@@ -19,6 +19,7 @@ exports.getDefectQuote = getDefectQuote;
|
|
|
19
19
|
exports.getStronghold = getStronghold;
|
|
20
20
|
exports.getStrongholdForAgent = getStrongholdForAgent;
|
|
21
21
|
exports.getAgentLink = getAgentLink;
|
|
22
|
+
exports.getLinkedAgents = getLinkedAgents;
|
|
22
23
|
exports.getWarChest = getWarChest;
|
|
23
24
|
exports.getWarLoan = getWarLoan;
|
|
24
25
|
exports.getAllWarLoans = getAllWarLoans;
|
|
@@ -132,8 +133,11 @@ async function getMembers(connection, mint, limit) {
|
|
|
132
133
|
return (0, mappers_1.mapHoldersResult)(result);
|
|
133
134
|
}
|
|
134
135
|
/** Get faction comms (trade-bundled messages, including post-ascension DEX messages) */
|
|
135
|
-
async function getComms(connection, mint, limit) {
|
|
136
|
-
|
|
136
|
+
async function getComms(connection, mint, limit, status) {
|
|
137
|
+
// Non-ascended: bonding curve only (1 RPC call)
|
|
138
|
+
// Ascended: pool only (1 RPC call) — bonding curve is stale post-migration
|
|
139
|
+
const source = status === 'ascended' ? 'pool' : status ? 'bonding' : 'all';
|
|
140
|
+
const result = await (0, torchsdk_1.getMessages)(connection, mint, limit, { source });
|
|
137
141
|
return (0, mappers_1.mapMessagesResult)(result);
|
|
138
142
|
}
|
|
139
143
|
/** Get a quote for joining a faction (buying tokens) */
|
|
@@ -159,6 +163,28 @@ async function getAgentLink(connection, wallet) {
|
|
|
159
163
|
const link = await (0, torchsdk_1.getVaultWalletLink)(connection, wallet);
|
|
160
164
|
return link ? (0, mappers_1.mapWalletLinkToAgentLink)(link) : null;
|
|
161
165
|
}
|
|
166
|
+
/** Get all linked agents for a vault (via getProgramAccounts) */
|
|
167
|
+
async function getLinkedAgents(connection, vaultAddress) {
|
|
168
|
+
// VaultWalletLink account layout: 8-byte discriminator + 32-byte vault + 32-byte wallet + 8-byte linked_at + 1-byte bump
|
|
169
|
+
const DISCRIMINATOR = Buffer.from([111, 59, 70, 89, 148, 117, 217, 156]); // sha256("account:VaultWalletLink")[0..8]
|
|
170
|
+
const vaultPubkey = new web3_js_1.PublicKey(vaultAddress);
|
|
171
|
+
const filters = [
|
|
172
|
+
{ dataSize: 81 }, // 8 + 32 + 32 + 8 + 1
|
|
173
|
+
{ memcmp: { offset: 8, bytes: vaultPubkey.toBase58() } },
|
|
174
|
+
];
|
|
175
|
+
const accounts = await connection.getProgramAccounts(torchsdk_1.PROGRAM_ID, { filters });
|
|
176
|
+
return accounts.map((acc) => {
|
|
177
|
+
const data = acc.account.data;
|
|
178
|
+
const wallet = new web3_js_1.PublicKey(data.subarray(40, 72)).toBase58();
|
|
179
|
+
const linked_at = Number(data.readBigInt64LE(72));
|
|
180
|
+
return {
|
|
181
|
+
address: acc.pubkey.toBase58(),
|
|
182
|
+
stronghold: vaultAddress,
|
|
183
|
+
wallet,
|
|
184
|
+
linked_at,
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
162
188
|
/** Get war chest (lending info) for a faction */
|
|
163
189
|
async function getWarChest(connection, mint) {
|
|
164
190
|
const info = await (0, torchsdk_1.getLendingInfo)(connection, mint);
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* so agents think in factions, not tokens.
|
|
7
7
|
*/
|
|
8
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, } from './types';
|
|
9
|
-
export { getFactions, getFaction, getMembers, getComms, getJoinQuote, getDefectQuote, getStronghold, getStrongholdForAgent, getAgentLink, 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';
|
|
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
10
|
export { getFactionPower, getFactionLeaderboard, detectAlliances, getFactionRivals, getAgentProfile, getAgentFactions, getWorldFeed, getWorldStats, } from './intel';
|
|
11
11
|
export { isPyreMint, grindPyreMint } from './vanity';
|
|
12
12
|
export { PROGRAM_ID, LAMPORTS_PER_SOL, TOKEN_MULTIPLIER, TOTAL_SUPPLY } from 'torchsdk';
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* so agents think in factions, not tokens.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
exports.TOTAL_SUPPLY = exports.TOKEN_MULTIPLIER = exports.LAMPORTS_PER_SOL = exports.PROGRAM_ID = exports.grindPyreMint = exports.isPyreMint = exports.getWorldStats = exports.getWorldFeed = void 0;
|
|
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.grindPyreMint = exports.isPyreMint = exports.getWorldStats = exports.getWorldFeed = exports.getAgentFactions = void 0;
|
|
12
12
|
// ─── Actions ───────────────────────────────────────────────────────
|
|
13
13
|
var actions_1 = require("./actions");
|
|
14
14
|
// Read operations
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "getDefectQuote", { enumerable: true, get: functi
|
|
|
21
21
|
Object.defineProperty(exports, "getStronghold", { enumerable: true, get: function () { return actions_1.getStronghold; } });
|
|
22
22
|
Object.defineProperty(exports, "getStrongholdForAgent", { enumerable: true, get: function () { return actions_1.getStrongholdForAgent; } });
|
|
23
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; } });
|
|
24
25
|
Object.defineProperty(exports, "getWarChest", { enumerable: true, get: function () { return actions_1.getWarChest; } });
|
|
25
26
|
Object.defineProperty(exports, "getWarLoan", { enumerable: true, get: function () { return actions_1.getWarLoan; } });
|
|
26
27
|
Object.defineProperty(exports, "getAllWarLoans", { enumerable: true, get: function () { return actions_1.getAllWarLoans; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pyre-world-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
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",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@solana/spl-token": "^0.4.6",
|
|
16
16
|
"@solana/web3.js": "^1.98.4",
|
|
17
17
|
"bs58": "^6.0.0",
|
|
18
|
-
"torchsdk": "^3.7.
|
|
18
|
+
"torchsdk": "^3.7.36"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^22.15.0",
|
package/src/actions.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* into game-semantic Pyre types. No new on-chain logic.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { Connection, PublicKey } from '@solana/web3.js';
|
|
8
|
+
import { Connection, PublicKey, type GetProgramAccountsFilter } from '@solana/web3.js';
|
|
9
9
|
import {
|
|
10
10
|
// Read operations
|
|
11
11
|
getTokens,
|
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
// Utilities
|
|
48
48
|
verifySaid,
|
|
49
49
|
confirmTransaction,
|
|
50
|
+
PROGRAM_ID,
|
|
50
51
|
} from 'torchsdk';
|
|
51
52
|
|
|
52
53
|
import type { BuyQuoteResult, SellQuoteResult, TransactionResult, SaidVerification, ConfirmResult } from 'torchsdk';
|
|
@@ -88,6 +89,7 @@ import type {
|
|
|
88
89
|
ConvertTitheParams,
|
|
89
90
|
JoinFactionResult,
|
|
90
91
|
LaunchFactionResult,
|
|
92
|
+
FactionStatus,
|
|
91
93
|
} from './types';
|
|
92
94
|
|
|
93
95
|
import {
|
|
@@ -209,8 +211,12 @@ export async function getComms(
|
|
|
209
211
|
connection: Connection,
|
|
210
212
|
mint: string,
|
|
211
213
|
limit?: number,
|
|
214
|
+
status?: FactionStatus,
|
|
212
215
|
): Promise<CommsResult> {
|
|
213
|
-
|
|
216
|
+
// Non-ascended: bonding curve only (1 RPC call)
|
|
217
|
+
// Ascended: pool only (1 RPC call) — bonding curve is stale post-migration
|
|
218
|
+
const source = status === 'ascended' ? 'pool' : status ? 'bonding' : 'all';
|
|
219
|
+
const result = await getMessages(connection, mint, limit, { source });
|
|
214
220
|
return mapMessagesResult(result);
|
|
215
221
|
}
|
|
216
222
|
|
|
@@ -259,6 +265,35 @@ export async function getAgentLink(
|
|
|
259
265
|
return link ? mapWalletLinkToAgentLink(link) : null;
|
|
260
266
|
}
|
|
261
267
|
|
|
268
|
+
/** Get all linked agents for a vault (via getProgramAccounts) */
|
|
269
|
+
export async function getLinkedAgents(
|
|
270
|
+
connection: Connection,
|
|
271
|
+
vaultAddress: string,
|
|
272
|
+
): Promise<AgentLink[]> {
|
|
273
|
+
// VaultWalletLink account layout: 8-byte discriminator + 32-byte vault + 32-byte wallet + 8-byte linked_at + 1-byte bump
|
|
274
|
+
const DISCRIMINATOR = Buffer.from([111, 59, 70, 89, 148, 117, 217, 156]); // sha256("account:VaultWalletLink")[0..8]
|
|
275
|
+
const vaultPubkey = new PublicKey(vaultAddress);
|
|
276
|
+
|
|
277
|
+
const filters: GetProgramAccountsFilter[] = [
|
|
278
|
+
{ dataSize: 81 }, // 8 + 32 + 32 + 8 + 1
|
|
279
|
+
{ memcmp: { offset: 8, bytes: vaultPubkey.toBase58() } },
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
const accounts = await connection.getProgramAccounts(PROGRAM_ID, { filters });
|
|
283
|
+
|
|
284
|
+
return accounts.map((acc) => {
|
|
285
|
+
const data = acc.account.data;
|
|
286
|
+
const wallet = new PublicKey(data.subarray(40, 72)).toBase58();
|
|
287
|
+
const linked_at = Number(data.readBigInt64LE(72));
|
|
288
|
+
return {
|
|
289
|
+
address: acc.pubkey.toBase58(),
|
|
290
|
+
stronghold: vaultAddress,
|
|
291
|
+
wallet,
|
|
292
|
+
linked_at,
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
262
297
|
/** Get war chest (lending info) for a faction */
|
|
263
298
|
export async function getWarChest(
|
|
264
299
|
connection: Connection,
|