pyre-world-kit 2.0.8 → 2.0.10
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/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/intel.d.ts +23 -0
- package/dist/intel.js +47 -0
- package/dist/pyre_world.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/intel.ts +51 -0
- package/src/pyre_world.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
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, RegistryProfile, RegistryWalletLink, CheckpointParams, RegisterAgentParams, LinkAgentWalletParams, UnlinkAgentWalletParams, TransferAgentAuthorityParams, } from './types';
|
|
9
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, } from './intel';
|
|
10
|
+
export { getFactionPower, getFactionLeaderboard, detectAlliances, getFactionRivals, getAgentProfile, getAgentFactions, getWorldFeed, getWorldStats, getAgentSolLamports, startVaultPnlTracker, } from './intel';
|
|
11
11
|
export { isPyreMint, grindPyreMint } from './vanity';
|
|
12
12
|
export { REGISTRY_PROGRAM_ID, getAgentProfilePda, getAgentWalletLinkPda, getRegistryProfile, getRegistryWalletLink, buildRegisterAgentTransaction, buildCheckpointTransaction, buildLinkAgentWalletTransaction, buildUnlinkAgentWalletTransaction, buildTransferAgentAuthorityTransaction, } from './registry';
|
|
13
13
|
export { PROGRAM_ID, LAMPORTS_PER_SOL, TOKEN_MULTIPLIER, TOTAL_SUPPLY } from 'torchsdk';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
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.getWorldStats = exports.getWorldFeed = exports.getAgentFactions = 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
12
|
// ─── Actions ───────────────────────────────────────────────────────
|
|
13
13
|
var actions_1 = require("./actions");
|
|
14
14
|
// Read operations
|
|
@@ -73,6 +73,8 @@ Object.defineProperty(exports, "getAgentProfile", { enumerable: true, get: funct
|
|
|
73
73
|
Object.defineProperty(exports, "getAgentFactions", { enumerable: true, get: function () { return intel_1.getAgentFactions; } });
|
|
74
74
|
Object.defineProperty(exports, "getWorldFeed", { enumerable: true, get: function () { return intel_1.getWorldFeed; } });
|
|
75
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; } });
|
|
76
78
|
// ─── Vanity ─────────────────────────────────────────────────────────
|
|
77
79
|
var vanity_1 = require("./vanity");
|
|
78
80
|
Object.defineProperty(exports, "isPyreMint", { enumerable: true, get: function () { return vanity_1.isPyreMint; } });
|
package/dist/intel.d.ts
CHANGED
|
@@ -60,3 +60,26 @@ export declare function getWorldFeed(connection: Connection, opts?: {
|
|
|
60
60
|
* Global stats: total factions, total agents, total SOL locked.
|
|
61
61
|
*/
|
|
62
62
|
export declare function getWorldStats(connection: Connection): Promise<WorldStats>;
|
|
63
|
+
/**
|
|
64
|
+
* Get total SOL balance in lamports for an agent: vault + wallet.
|
|
65
|
+
* Checks vault first (where most SOL flows), falls back to wallet if no vault.
|
|
66
|
+
* Returns the combined balance so P&L captures all SOL movement.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getAgentSolLamports(connection: Connection, wallet: string): Promise<number>;
|
|
69
|
+
/**
|
|
70
|
+
* Start tracking P&L for a single action/tick.
|
|
71
|
+
*
|
|
72
|
+
* Snapshots wallet + vault SOL before the action. Call `finish()` after
|
|
73
|
+
* to get the diff. Covers both vault and wallet flows so no SOL is missed.
|
|
74
|
+
*
|
|
75
|
+
* Usage:
|
|
76
|
+
* const pnl = await startVaultPnlTracker(connection, wallet)
|
|
77
|
+
* // ... do action ...
|
|
78
|
+
* const { spent, received } = await pnl.finish()
|
|
79
|
+
*/
|
|
80
|
+
export declare function startVaultPnlTracker(connection: Connection, wallet: string): Promise<{
|
|
81
|
+
finish: () => Promise<{
|
|
82
|
+
spent: number;
|
|
83
|
+
received: number;
|
|
84
|
+
}>;
|
|
85
|
+
}>;
|
package/dist/intel.js
CHANGED
|
@@ -47,6 +47,8 @@ exports.getAgentProfile = getAgentProfile;
|
|
|
47
47
|
exports.getAgentFactions = getAgentFactions;
|
|
48
48
|
exports.getWorldFeed = getWorldFeed;
|
|
49
49
|
exports.getWorldStats = getWorldStats;
|
|
50
|
+
exports.getAgentSolLamports = getAgentSolLamports;
|
|
51
|
+
exports.startVaultPnlTracker = startVaultPnlTracker;
|
|
50
52
|
const web3_js_1 = require("@solana/web3.js");
|
|
51
53
|
const torchsdk_1 = require("torchsdk");
|
|
52
54
|
const mappers_1 = require("./mappers");
|
|
@@ -401,6 +403,51 @@ async function getPyreHolders(connection, mint, limit) {
|
|
|
401
403
|
result.holders = result.holders.filter(h => !excluded.has(h.address)).slice(0, limit);
|
|
402
404
|
return result;
|
|
403
405
|
}
|
|
406
|
+
// ─── Vault P&L ────────────────────────────────────────────────────
|
|
407
|
+
/**
|
|
408
|
+
* Get total SOL balance in lamports for an agent: vault + wallet.
|
|
409
|
+
* Checks vault first (where most SOL flows), falls back to wallet if no vault.
|
|
410
|
+
* Returns the combined balance so P&L captures all SOL movement.
|
|
411
|
+
*/
|
|
412
|
+
async function getAgentSolLamports(connection, wallet) {
|
|
413
|
+
const walletPk = new web3_js_1.PublicKey(wallet);
|
|
414
|
+
let total = 0;
|
|
415
|
+
try {
|
|
416
|
+
total += await connection.getBalance(walletPk);
|
|
417
|
+
}
|
|
418
|
+
catch { }
|
|
419
|
+
try {
|
|
420
|
+
const vault = await (0, torchsdk_1.getVaultForWallet)(connection, wallet);
|
|
421
|
+
if (vault)
|
|
422
|
+
total += Math.round(vault.sol_balance * 1e9);
|
|
423
|
+
}
|
|
424
|
+
catch { }
|
|
425
|
+
return total;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Start tracking P&L for a single action/tick.
|
|
429
|
+
*
|
|
430
|
+
* Snapshots wallet + vault SOL before the action. Call `finish()` after
|
|
431
|
+
* to get the diff. Covers both vault and wallet flows so no SOL is missed.
|
|
432
|
+
*
|
|
433
|
+
* Usage:
|
|
434
|
+
* const pnl = await startVaultPnlTracker(connection, wallet)
|
|
435
|
+
* // ... do action ...
|
|
436
|
+
* const { spent, received } = await pnl.finish()
|
|
437
|
+
*/
|
|
438
|
+
async function startVaultPnlTracker(connection, wallet) {
|
|
439
|
+
const before = await getAgentSolLamports(connection, wallet);
|
|
440
|
+
return {
|
|
441
|
+
async finish() {
|
|
442
|
+
const after = await getAgentSolLamports(connection, wallet);
|
|
443
|
+
const diff = after - before;
|
|
444
|
+
return {
|
|
445
|
+
spent: diff < 0 ? Math.abs(diff) : 0,
|
|
446
|
+
received: diff > 0 ? diff : 0,
|
|
447
|
+
};
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
404
451
|
// ─── Internal Helpers ──────────────────────────────────────────────
|
|
405
452
|
function computePowerScore(t) {
|
|
406
453
|
const mcWeight = 0.4;
|
package/dist/pyre_world.json
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/intel.ts
CHANGED
|
@@ -444,6 +444,57 @@ async function getPyreHolders(connection: Connection, mint: string, limit: numbe
|
|
|
444
444
|
return result;
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
+
// ─── Vault P&L ────────────────────────────────────────────────────
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Get total SOL balance in lamports for an agent: vault + wallet.
|
|
451
|
+
* Checks vault first (where most SOL flows), falls back to wallet if no vault.
|
|
452
|
+
* Returns the combined balance so P&L captures all SOL movement.
|
|
453
|
+
*/
|
|
454
|
+
export async function getAgentSolLamports(
|
|
455
|
+
connection: Connection,
|
|
456
|
+
wallet: string,
|
|
457
|
+
): Promise<number> {
|
|
458
|
+
const walletPk = new PublicKey(wallet);
|
|
459
|
+
let total = 0;
|
|
460
|
+
try {
|
|
461
|
+
total += await connection.getBalance(walletPk);
|
|
462
|
+
} catch {}
|
|
463
|
+
try {
|
|
464
|
+
const vault = await getVaultForWallet(connection, wallet);
|
|
465
|
+
if (vault) total += Math.round(vault.sol_balance * 1e9);
|
|
466
|
+
} catch {}
|
|
467
|
+
return total;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Start tracking P&L for a single action/tick.
|
|
472
|
+
*
|
|
473
|
+
* Snapshots wallet + vault SOL before the action. Call `finish()` after
|
|
474
|
+
* to get the diff. Covers both vault and wallet flows so no SOL is missed.
|
|
475
|
+
*
|
|
476
|
+
* Usage:
|
|
477
|
+
* const pnl = await startVaultPnlTracker(connection, wallet)
|
|
478
|
+
* // ... do action ...
|
|
479
|
+
* const { spent, received } = await pnl.finish()
|
|
480
|
+
*/
|
|
481
|
+
export async function startVaultPnlTracker(
|
|
482
|
+
connection: Connection,
|
|
483
|
+
wallet: string,
|
|
484
|
+
): Promise<{ finish: () => Promise<{ spent: number; received: number }> }> {
|
|
485
|
+
const before = await getAgentSolLamports(connection, wallet);
|
|
486
|
+
return {
|
|
487
|
+
async finish() {
|
|
488
|
+
const after = await getAgentSolLamports(connection, wallet);
|
|
489
|
+
const diff = after - before;
|
|
490
|
+
return {
|
|
491
|
+
spent: diff < 0 ? Math.abs(diff) : 0,
|
|
492
|
+
received: diff > 0 ? diff : 0,
|
|
493
|
+
};
|
|
494
|
+
},
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
447
498
|
// ─── Internal Helpers ──────────────────────────────────────────────
|
|
448
499
|
|
|
449
500
|
function computePowerScore(t: TokenDetail): number {
|