logiqical 0.3.0 → 0.4.0

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.mts CHANGED
@@ -385,6 +385,34 @@ declare class PerpsModule {
385
385
  getTradeExecutions(): Promise<any>;
386
386
  getPositions(wallet: string): Promise<any>;
387
387
  getOpenOrders(wallet: string): Promise<any>;
388
+ /** Check USDC balance on Arbitrum */
389
+ getArbitrumUSDCBalance(wallet: string): Promise<string>;
390
+ /** Check ETH balance on Arbitrum (needed for gas) */
391
+ getArbitrumETHBalance(wallet: string): Promise<string>;
392
+ /**
393
+ * Build a USDC deposit transaction for Hyperliquid on Arbitrum.
394
+ * Returns an unsigned tx — use with agent.execute() after switching to Arbitrum network.
395
+ *
396
+ * Flow: agent.switchNetwork("arbitrum") → agent.execute(agent.perps.buildDepositUSDC(...))
397
+ */
398
+ buildDepositUSDC(amount: string): {
399
+ transaction: {
400
+ to: string;
401
+ data: string;
402
+ value: string;
403
+ chainId: number;
404
+ description: string;
405
+ };
406
+ };
407
+ /** Get deposit info (addresses + chain details) */
408
+ getDepositInfo(): {
409
+ chain: string;
410
+ chainId: number;
411
+ usdcAddress: string;
412
+ depositAddress: string;
413
+ decimals: number;
414
+ tip: string;
415
+ };
388
416
  }
389
417
 
390
418
  interface BridgeQuoteResponse {
@@ -519,10 +547,44 @@ declare class TicketsModule {
519
547
  private ticketsToFractional;
520
548
  }
521
549
 
550
+ interface AgentRegistration {
551
+ agentId: string;
552
+ apiKey: string;
553
+ verificationCode: string;
554
+ id: string;
555
+ handle: string;
556
+ userName: string;
557
+ address: string;
558
+ createdOn: string;
559
+ }
522
560
  declare class SocialModule {
523
561
  private arenaApiKey?;
524
562
  constructor(arenaApiKey?: string | undefined);
525
563
  setArenaApiKey(key: string): void;
564
+ /**
565
+ * Register a new AI agent on Arena. Returns API key (shown once — save immediately).
566
+ * After registration, owner must claim by posting: "I'm claiming my AI Agent \"<name>\"\nVerification Code: <code>"
567
+ */
568
+ static registerAgent(opts: {
569
+ name: string;
570
+ handle: string;
571
+ address: string;
572
+ bio?: string;
573
+ profilePictureUrl?: string;
574
+ bannerUrl?: string;
575
+ }): Promise<AgentRegistration>;
576
+ /** Post a formatted trade update to the Arena feed */
577
+ postTradeUpdate(trade: {
578
+ action: "buy" | "sell" | "swap" | "bridge" | "stake" | "long" | "short" | "close";
579
+ token?: string;
580
+ amount?: string;
581
+ price?: string;
582
+ fromToken?: string;
583
+ toToken?: string;
584
+ pnl?: string;
585
+ hash?: string;
586
+ extra?: string;
587
+ }): Promise<any>;
526
588
  private request;
527
589
  searchUsers(q: string, page?: number, pageSize?: number): Promise<any>;
528
590
  getUserByHandle(handle: string): Promise<any>;
@@ -763,6 +825,61 @@ declare class DefiModule {
763
825
  }>;
764
826
  }
765
827
 
828
+ interface Position {
829
+ coin: string;
830
+ szi: string;
831
+ entryPx: string;
832
+ positionValue: string;
833
+ unrealizedPnl: string;
834
+ leverage: {
835
+ type: string;
836
+ value: number;
837
+ };
838
+ }
839
+ interface CopyOrder {
840
+ symbol: string;
841
+ direction: "long" | "short";
842
+ size: number;
843
+ action: "open" | "close";
844
+ reason: string;
845
+ }
846
+ declare class CopyTradingModule {
847
+ private perps;
848
+ constructor(perps: PerpsModule);
849
+ /** Fetch all open positions for a Hyperliquid wallet */
850
+ getTargetPositions(targetWallet: string): Promise<Position[]>;
851
+ /** Fetch your agent's current positions */
852
+ getAgentPositions(agentWallet: string): Promise<Position[]>;
853
+ /**
854
+ * Compare target wallet positions with agent positions and return orders needed to mirror.
855
+ * Uses proportional sizing based on the scale factor.
856
+ *
857
+ * @param targetWallet - Wallet to copy from
858
+ * @param agentWallet - Your agent's wallet
859
+ * @param scaleFactor - Position scale (0.1 = 10% of target size, 1.0 = same size)
860
+ */
861
+ calculateMirrorOrders(targetWallet: string, agentWallet: string, scaleFactor?: number): Promise<{
862
+ orders: CopyOrder[];
863
+ targetPositions: Position[];
864
+ agentPositions: Position[];
865
+ }>;
866
+ /**
867
+ * Execute mirror orders via the perps module (Arena API).
868
+ * Returns results for each order.
869
+ */
870
+ executeMirrorOrders(orders: CopyOrder[], currentPrices: Record<string, number>): Promise<any[]>;
871
+ /**
872
+ * One-shot copy: calculate + execute mirror orders in one call.
873
+ * Fetches current prices from Hyperliquid for execution.
874
+ */
875
+ copyOnce(targetWallet: string, agentWallet: string, scaleFactor?: number): Promise<{
876
+ orders: CopyOrder[];
877
+ results: any[];
878
+ }>;
879
+ /** Fetch mid-market prices from Hyperliquid for given symbols */
880
+ private fetchMidPrices;
881
+ }
882
+
766
883
  interface LogiqicalConfig {
767
884
  /** Private key — creates a local wallet for signing (0x-prefixed hex) */
768
885
  privateKey?: string;
@@ -820,6 +937,8 @@ declare class Logiqical {
820
937
  readonly market: MarketModule;
821
938
  /** DeFi — sAVAX liquid staking + ERC-4626 vaults */
822
939
  readonly defi: DefiModule;
940
+ /** Copy trading — mirror Hyperliquid wallet positions */
941
+ readonly copyTrading: CopyTradingModule;
823
942
  /** The agent's wallet address */
824
943
  readonly address: string;
825
944
  /** The local wallet (null if read-only mode) */
@@ -915,4 +1034,4 @@ declare class LogiqicalError extends Error {
915
1034
  static from(e: unknown, code?: LogiqicalErrorCode): LogiqicalError;
916
1035
  }
917
1036
 
918
- export { AgentWallet, type AgentWalletConfig, BridgeModule, CHAINS, type CallIntent, type ChainConfig, DefiModule, DexModule, LaunchpadModule, Logiqical, LogiqicalClient, type LogiqicalConfig, LogiqicalError, type LogiqicalErrorCode, MarketModule, type MarketSignal, PerpsModule, PolicyEngine, PolicyError, type PolicyErrorCode, type SignalSummary, SignalsModule, SocialModule, type SpendingPolicy, StakingModule, SwapModule, type TechnicalSignal, type TicketBalanceResponse, type TicketFeesResponse, type TicketPriceResponse, type TicketSupplyResponse, TicketsModule, type TransactionResult, type UnsignedTx };
1037
+ export { type AgentRegistration, AgentWallet, type AgentWalletConfig, BridgeModule, CHAINS, type CallIntent, type ChainConfig, type CopyOrder, CopyTradingModule, DefiModule, DexModule, LaunchpadModule, Logiqical, LogiqicalClient, type LogiqicalConfig, LogiqicalError, type LogiqicalErrorCode, MarketModule, type MarketSignal, PerpsModule, PolicyEngine, PolicyError, type PolicyErrorCode, type Position, type SignalSummary, SignalsModule, SocialModule, type SpendingPolicy, StakingModule, SwapModule, type TechnicalSignal, type TicketBalanceResponse, type TicketFeesResponse, type TicketPriceResponse, type TicketSupplyResponse, TicketsModule, type TransactionResult, type UnsignedTx };
package/dist/index.d.ts CHANGED
@@ -385,6 +385,34 @@ declare class PerpsModule {
385
385
  getTradeExecutions(): Promise<any>;
386
386
  getPositions(wallet: string): Promise<any>;
387
387
  getOpenOrders(wallet: string): Promise<any>;
388
+ /** Check USDC balance on Arbitrum */
389
+ getArbitrumUSDCBalance(wallet: string): Promise<string>;
390
+ /** Check ETH balance on Arbitrum (needed for gas) */
391
+ getArbitrumETHBalance(wallet: string): Promise<string>;
392
+ /**
393
+ * Build a USDC deposit transaction for Hyperliquid on Arbitrum.
394
+ * Returns an unsigned tx — use with agent.execute() after switching to Arbitrum network.
395
+ *
396
+ * Flow: agent.switchNetwork("arbitrum") → agent.execute(agent.perps.buildDepositUSDC(...))
397
+ */
398
+ buildDepositUSDC(amount: string): {
399
+ transaction: {
400
+ to: string;
401
+ data: string;
402
+ value: string;
403
+ chainId: number;
404
+ description: string;
405
+ };
406
+ };
407
+ /** Get deposit info (addresses + chain details) */
408
+ getDepositInfo(): {
409
+ chain: string;
410
+ chainId: number;
411
+ usdcAddress: string;
412
+ depositAddress: string;
413
+ decimals: number;
414
+ tip: string;
415
+ };
388
416
  }
389
417
 
390
418
  interface BridgeQuoteResponse {
@@ -519,10 +547,44 @@ declare class TicketsModule {
519
547
  private ticketsToFractional;
520
548
  }
521
549
 
550
+ interface AgentRegistration {
551
+ agentId: string;
552
+ apiKey: string;
553
+ verificationCode: string;
554
+ id: string;
555
+ handle: string;
556
+ userName: string;
557
+ address: string;
558
+ createdOn: string;
559
+ }
522
560
  declare class SocialModule {
523
561
  private arenaApiKey?;
524
562
  constructor(arenaApiKey?: string | undefined);
525
563
  setArenaApiKey(key: string): void;
564
+ /**
565
+ * Register a new AI agent on Arena. Returns API key (shown once — save immediately).
566
+ * After registration, owner must claim by posting: "I'm claiming my AI Agent \"<name>\"\nVerification Code: <code>"
567
+ */
568
+ static registerAgent(opts: {
569
+ name: string;
570
+ handle: string;
571
+ address: string;
572
+ bio?: string;
573
+ profilePictureUrl?: string;
574
+ bannerUrl?: string;
575
+ }): Promise<AgentRegistration>;
576
+ /** Post a formatted trade update to the Arena feed */
577
+ postTradeUpdate(trade: {
578
+ action: "buy" | "sell" | "swap" | "bridge" | "stake" | "long" | "short" | "close";
579
+ token?: string;
580
+ amount?: string;
581
+ price?: string;
582
+ fromToken?: string;
583
+ toToken?: string;
584
+ pnl?: string;
585
+ hash?: string;
586
+ extra?: string;
587
+ }): Promise<any>;
526
588
  private request;
527
589
  searchUsers(q: string, page?: number, pageSize?: number): Promise<any>;
528
590
  getUserByHandle(handle: string): Promise<any>;
@@ -763,6 +825,61 @@ declare class DefiModule {
763
825
  }>;
764
826
  }
765
827
 
828
+ interface Position {
829
+ coin: string;
830
+ szi: string;
831
+ entryPx: string;
832
+ positionValue: string;
833
+ unrealizedPnl: string;
834
+ leverage: {
835
+ type: string;
836
+ value: number;
837
+ };
838
+ }
839
+ interface CopyOrder {
840
+ symbol: string;
841
+ direction: "long" | "short";
842
+ size: number;
843
+ action: "open" | "close";
844
+ reason: string;
845
+ }
846
+ declare class CopyTradingModule {
847
+ private perps;
848
+ constructor(perps: PerpsModule);
849
+ /** Fetch all open positions for a Hyperliquid wallet */
850
+ getTargetPositions(targetWallet: string): Promise<Position[]>;
851
+ /** Fetch your agent's current positions */
852
+ getAgentPositions(agentWallet: string): Promise<Position[]>;
853
+ /**
854
+ * Compare target wallet positions with agent positions and return orders needed to mirror.
855
+ * Uses proportional sizing based on the scale factor.
856
+ *
857
+ * @param targetWallet - Wallet to copy from
858
+ * @param agentWallet - Your agent's wallet
859
+ * @param scaleFactor - Position scale (0.1 = 10% of target size, 1.0 = same size)
860
+ */
861
+ calculateMirrorOrders(targetWallet: string, agentWallet: string, scaleFactor?: number): Promise<{
862
+ orders: CopyOrder[];
863
+ targetPositions: Position[];
864
+ agentPositions: Position[];
865
+ }>;
866
+ /**
867
+ * Execute mirror orders via the perps module (Arena API).
868
+ * Returns results for each order.
869
+ */
870
+ executeMirrorOrders(orders: CopyOrder[], currentPrices: Record<string, number>): Promise<any[]>;
871
+ /**
872
+ * One-shot copy: calculate + execute mirror orders in one call.
873
+ * Fetches current prices from Hyperliquid for execution.
874
+ */
875
+ copyOnce(targetWallet: string, agentWallet: string, scaleFactor?: number): Promise<{
876
+ orders: CopyOrder[];
877
+ results: any[];
878
+ }>;
879
+ /** Fetch mid-market prices from Hyperliquid for given symbols */
880
+ private fetchMidPrices;
881
+ }
882
+
766
883
  interface LogiqicalConfig {
767
884
  /** Private key — creates a local wallet for signing (0x-prefixed hex) */
768
885
  privateKey?: string;
@@ -820,6 +937,8 @@ declare class Logiqical {
820
937
  readonly market: MarketModule;
821
938
  /** DeFi — sAVAX liquid staking + ERC-4626 vaults */
822
939
  readonly defi: DefiModule;
940
+ /** Copy trading — mirror Hyperliquid wallet positions */
941
+ readonly copyTrading: CopyTradingModule;
823
942
  /** The agent's wallet address */
824
943
  readonly address: string;
825
944
  /** The local wallet (null if read-only mode) */
@@ -915,4 +1034,4 @@ declare class LogiqicalError extends Error {
915
1034
  static from(e: unknown, code?: LogiqicalErrorCode): LogiqicalError;
916
1035
  }
917
1036
 
918
- export { AgentWallet, type AgentWalletConfig, BridgeModule, CHAINS, type CallIntent, type ChainConfig, DefiModule, DexModule, LaunchpadModule, Logiqical, LogiqicalClient, type LogiqicalConfig, LogiqicalError, type LogiqicalErrorCode, MarketModule, type MarketSignal, PerpsModule, PolicyEngine, PolicyError, type PolicyErrorCode, type SignalSummary, SignalsModule, SocialModule, type SpendingPolicy, StakingModule, SwapModule, type TechnicalSignal, type TicketBalanceResponse, type TicketFeesResponse, type TicketPriceResponse, type TicketSupplyResponse, TicketsModule, type TransactionResult, type UnsignedTx };
1037
+ export { type AgentRegistration, AgentWallet, type AgentWalletConfig, BridgeModule, CHAINS, type CallIntent, type ChainConfig, type CopyOrder, CopyTradingModule, DefiModule, DexModule, LaunchpadModule, Logiqical, LogiqicalClient, type LogiqicalConfig, LogiqicalError, type LogiqicalErrorCode, MarketModule, type MarketSignal, PerpsModule, PolicyEngine, PolicyError, type PolicyErrorCode, type Position, type SignalSummary, SignalsModule, SocialModule, type SpendingPolicy, StakingModule, SwapModule, type TechnicalSignal, type TicketBalanceResponse, type TicketFeesResponse, type TicketPriceResponse, type TicketSupplyResponse, TicketsModule, type TransactionResult, type UnsignedTx };