pyre-world-kit 1.0.21 → 1.0.23
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 +2 -0
- package/dist/actions.js +23 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/src/actions.ts +31 -1
- package/src/index.ts +1 -0
package/dist/actions.d.ts
CHANGED
|
@@ -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;
|
|
@@ -162,6 +163,28 @@ async function getAgentLink(connection, wallet) {
|
|
|
162
163
|
const link = await (0, torchsdk_1.getVaultWalletLink)(connection, wallet);
|
|
163
164
|
return link ? (0, mappers_1.mapWalletLinkToAgentLink)(link) : null;
|
|
164
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
|
+
}
|
|
165
188
|
/** Get war chest (lending info) for a faction */
|
|
166
189
|
async function getWarChest(connection, mint) {
|
|
167
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
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';
|
|
@@ -264,6 +265,35 @@ export async function getAgentLink(
|
|
|
264
265
|
return link ? mapWalletLinkToAgentLink(link) : null;
|
|
265
266
|
}
|
|
266
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
|
+
|
|
267
297
|
/** Get war chest (lending info) for a faction */
|
|
268
298
|
export async function getWarChest(
|
|
269
299
|
connection: Connection,
|