UNPKG

@wuwei-labs/srsly

Version:
78 lines 2.91 kB
"use strict"; /** * Constants used for PDA derivation across SRSLY, SAGE, and Thread programs * @module pda/constants */ Object.defineProperty(exports, "__esModule", { value: true }); exports.THREAD_FIBER_SEED = exports.THREAD_SEED = exports.ANTEGEN_FIBER_PROGRAM = exports.ANTEGEN_THREAD_PROGRAM = exports.QUEUED_RENTAL_SEED = exports.ACTIVE_RENTAL_SEED = exports.CONFIG_SEED = exports.BORROWER_STATE_SEED = exports.RENTAL_AUTHORITY_SEED = exports.RENTAL_SEED = exports.CONTRACT_SEED = exports.PROFILE_FACTION_SEED = exports.SAGE_PLAYER_PROFILE_SEED = exports.STARBASE_PLAYER_SEED = exports.STARBASE_SEED = exports.FACTION_MAPPING = exports.FACTION_COORDINATES = void 0; exports.isValidFactionName = isValidFactionName; exports.getFactionName = getFactionName; exports.getFactionCoordinates = getFactionCoordinates; /** * Faction-specific coordinates for starbase derivation in SAGE * These coordinates are used to derive starbase PDAs */ exports.FACTION_COORDINATES = { mud: { x: 0, y: -39 }, oni: { x: -40, y: 30 }, ustur: { x: 40, y: 30 }, }; /** * Mapping of numeric faction IDs to faction names */ exports.FACTION_MAPPING = { 1: 'mud', 2: 'oni', 3: 'ustur', }; /** * Seed constants for SAGE program PDA derivation */ exports.STARBASE_SEED = 'Starbase'; exports.STARBASE_PLAYER_SEED = 'starbase_player'; exports.SAGE_PLAYER_PROFILE_SEED = 'sage_player_profile'; exports.PROFILE_FACTION_SEED = 'player_faction'; /** * Seed constants for SRSLY program PDA derivation */ exports.CONTRACT_SEED = 'rental_contract'; exports.RENTAL_SEED = 'rental_state'; exports.RENTAL_AUTHORITY_SEED = 'rental_authority'; exports.BORROWER_STATE_SEED = 'borrower_state'; exports.CONFIG_SEED = 'config'; exports.ACTIVE_RENTAL_SEED = 'active'; exports.QUEUED_RENTAL_SEED = 'queued'; /** * Antegen program addresses and seed constants for PDA derivation */ exports.ANTEGEN_THREAD_PROGRAM = 'AgTv5w1UvUb6zeqkThwMrztGu9hpepBu8YLghuR4dpSx'; exports.ANTEGEN_FIBER_PROGRAM = 'AgFv5afjW9DmSPkiEvJ1er5bAAmRUqaBeTB6Cr8e1hKx'; exports.THREAD_SEED = 'thread'; exports.THREAD_FIBER_SEED = 'thread_fiber'; /** * Type guard to check if a value is a valid faction name */ function isValidFactionName(faction) { return faction === 'mud' || faction === 'oni' || faction === 'ustur'; } /** * Get faction name from numeric faction ID */ function getFactionName(factionId) { const name = exports.FACTION_MAPPING[factionId]; if (!name) { throw new Error(`Invalid faction ID: ${factionId}. Expected 1 (mud), 2 (oni), or 3 (ustur)`); } return name; } /** * Get faction coordinates by name */ function getFactionCoordinates(faction) { const coords = exports.FACTION_COORDINATES[faction.toLowerCase()]; if (!coords) { throw new Error(`Invalid faction: ${faction}. Expected 'mud', 'oni', or 'ustur'`); } return coords; } //# sourceMappingURL=constants.js.map