caravan-x
Version:
A terminal-based utility for managing Caravan multisig wallets in regtest mode. This tool simplifies development and testing with Caravan by providing an easy-to-use interface
161 lines (160 loc) • 4.33 kB
TypeScript
/**
* Types for CaravanXBlockchain
*/
interface CaravanState {
blocks: any[];
mempool: any[];
caravans: PIXI.Container[];
traders: PIXI.Graphics[];
miners: PIXI.Graphics[];
outposts: PIXI.Graphics[];
focusedEntity: any | null;
timeOfDay: number;
gameTime: number;
weather: "clear" | "cloudy" | "rainy";
weatherTimer: number;
weatherDuration: number;
isTutorialShown: boolean;
soundEnabled: boolean;
camera: {
x: number;
y: number;
scale: number;
targetScale: number;
dragging: boolean;
lastPosition: {
x: number;
y: number;
} | null;
};
animationIds: any[];
}
interface Sound {
play: () => void;
pause: () => void;
stop?: () => void;
fade?: (from: number, to: number, duration: number) => void;
volume?: (level: number) => void;
}
interface Sounds {
mining: Sound;
transaction: Sound;
click: Sound;
caravan: Sound;
ambient: Sound;
rain: Sound;
}
/**
* CaravanXBlockchain - A pixel art visualization of the blockchain as a trading caravan journey
*
* This class creates an interactive visualization where:
* - Blocks are represented as caravans traveling along a chain
* - Transactions are traders waiting to join caravans
* - Mining is visualized as prospectors creating new caravans
* - The environment changes with time (day/night cycle, weather)
*/
declare class CaravanXBlockchain {
private app;
private worldContainer;
private backgroundLayer;
private trailLayer;
private caravanLayer;
private traderLayer;
private minerLayer;
private outpostLayer;
private effectsLayer;
private uiLayer;
private pathPoints;
private sky;
private sun;
private moon;
private stars;
private clouds;
private trail;
private ground;
private mountains;
private rain;
private rainInterval;
private socket;
private sounds;
private activeAnimations;
private frameCount;
private worldInitialized;
private weathers;
private state;
constructor();
private initializeSounds;
private createDummySounds;
private initializeSocket;
private initialize;
private loadAssets;
private createWorld;
private createSky;
private createCloud;
private createMountains;
private createBlockchainTrail;
private createGround;
private addEnvironmentalElements;
private createOutposts;
private addConnectivityEffect;
private createMinerCamps;
private createMinerCharacter;
private addFireAnimation;
private addMiningAnimation;
private addDecorations;
private addTrees;
private addRocks;
private addBlockchainMonument;
private addTradingOasis;
private addWaterAnimation;
private createWaterRipple;
private createTrader;
private fetchBlockchainData;
private updateStats;
private updateCompassDirection;
private processBlocks;
private processMempool;
private addCaravan;
private addFlagWavingAnimation;
private addTrader;
private moveTraderToCaravan;
private showTooltip;
private hideTooltip;
private showBlockDetails;
private generateCargoItems;
private showTransactionDetails;
private generateTransactionDetails;
private showMinerDetails;
private showOutpostDetails;
private showTraderDetails;
private generateTraderInventory;
private showNotification;
private showTutorial;
private playIntroAnimation;
private setupEventListeners;
private addSafeEventListener;
private processNewBlock;
private processNewTransaction;
private addMiningParticles;
private triggerMineBlock;
private triggerCreateTransaction;
private toggleSound;
private updateWeather;
private changeWeather;
private clearWeatherEffects;
private startRainAnimation;
private createRaindrop;
private updateRainAnimation;
private createRainSplash;
private stopRainAnimation;
private updateTimeOfDay;
private updateDayNightCycle;
private lerpColor;
private updateCaravans;
private updateTraders;
private updateMiners;
private updateClouds;
private triggerRandomEvents;
cleanup(): void;
private gameLoop;
}