logiqical 0.1.2 → 0.2.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
@@ -4,8 +4,9 @@ declare class HttpClient {
4
4
  constructor(baseUrl: string, apiKey?: string);
5
5
  setApiKey(key: string): void;
6
6
  getApiKey(): string | null;
7
- get<T>(path: string, params?: Record<string, string | number | undefined>, skipAuth?: boolean): Promise<T>;
8
- post<T>(path: string, body: Record<string, unknown>): Promise<T>;
7
+ get<T>(path: string, params?: Record<string, string | number | undefined>, skipAuth?: boolean | Record<string, string>): Promise<T>;
8
+ post<T>(path: string, body: Record<string, unknown>, extraHeaders?: Record<string, string>): Promise<T>;
9
+ patch<T>(path: string, body: Record<string, unknown>, extraHeaders?: Record<string, string>): Promise<T>;
9
10
  private handleResponse;
10
11
  }
11
12
 
@@ -786,6 +787,96 @@ declare class BridgeModule {
786
787
  getInfo(): Promise<BridgeInfoResponse>;
787
788
  }
788
789
 
790
+ interface TicketPriceResponse {
791
+ price: string;
792
+ priceWithFee?: string;
793
+ priceAfterFee?: string;
794
+ tickets: string;
795
+ fractionalAmount: number;
796
+ }
797
+ interface TicketBalanceResponse {
798
+ tickets: string;
799
+ fractionalAmount: string;
800
+ }
801
+ interface TicketSupplyResponse {
802
+ wholeSupply: string;
803
+ fractionalSupply: string;
804
+ tickets: string;
805
+ }
806
+ interface TicketFeesResponse {
807
+ protocolFee: string;
808
+ subjectFee: string;
809
+ referralFee: string;
810
+ totalFeePercent: string;
811
+ }
812
+ declare class TicketsModule {
813
+ private http;
814
+ private auth;
815
+ constructor(http: HttpClient, auth: () => Promise<void>);
816
+ /** Get buy price for tickets (supports fractional: "0.5", "1.2", "3") */
817
+ getBuyPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
818
+ /** Get sell price for tickets */
819
+ getSellPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
820
+ /** Get ticket balance for a user on a subject */
821
+ getBalance(subject: string, user: string): Promise<TicketBalanceResponse>;
822
+ /** Get ticket supply for a subject */
823
+ getSupply(subject: string): Promise<TicketSupplyResponse>;
824
+ /** Get fee structure */
825
+ getFees(): Promise<TicketFeesResponse>;
826
+ /** Build unsigned tx to buy tickets */
827
+ buildBuyTx(wallet: string, subject: string, amount?: string): Promise<{
828
+ transaction: any;
829
+ }>;
830
+ /** Build unsigned tx to sell tickets */
831
+ buildSellTx(wallet: string, subject: string, amount?: string): Promise<{
832
+ transaction: any;
833
+ }>;
834
+ }
835
+
836
+ declare class SocialModule {
837
+ private http;
838
+ private auth;
839
+ private arenaApiKey?;
840
+ constructor(http: HttpClient, auth: () => Promise<void>, arenaApiKey?: string | undefined);
841
+ private headers;
842
+ /** Set the Arena API key for social endpoints */
843
+ setArenaApiKey(key: string): void;
844
+ searchUsers(q: string, page?: number, pageSize?: number): Promise<any>;
845
+ getUserByHandle(handle: string): Promise<any>;
846
+ getUserById(userId: string): Promise<any>;
847
+ getTopUsers(page?: number, pageSize?: number): Promise<any>;
848
+ getMe(): Promise<any>;
849
+ updateProfile(updates: {
850
+ userName?: string;
851
+ bio?: string;
852
+ profilePicture?: string;
853
+ }): Promise<any>;
854
+ follow(userId: string): Promise<any>;
855
+ unfollow(userId: string): Promise<any>;
856
+ getFollowers(userId: string): Promise<any>;
857
+ getFollowing(userId: string): Promise<any>;
858
+ getSharesStats(userId: string): Promise<any>;
859
+ getShareHolders(userId?: string): Promise<any>;
860
+ getHoldings(): Promise<any>;
861
+ getConversations(page?: number): Promise<any>;
862
+ getDirectMessages(): Promise<any>;
863
+ getGroupChats(): Promise<any>;
864
+ getGroup(groupId: string): Promise<any>;
865
+ getMembers(groupId: string): Promise<any>;
866
+ getOrCreateDM(userId: string): Promise<any>;
867
+ acceptChat(groupId: string): Promise<any>;
868
+ sendMessage(groupId: string, text: string, replyId?: string): Promise<any>;
869
+ getMessages(groupId: string, after?: string): Promise<any>;
870
+ searchMessages(q: string, groupId?: string): Promise<any>;
871
+ getMentions(groupId?: string): Promise<any>;
872
+ react(messageId: string, groupId: string, reaction: string): Promise<any>;
873
+ pinMessage(messageId: string, groupId: string, isPinned?: boolean): Promise<any>;
874
+ getPinnedMessages(groupId: string): Promise<any>;
875
+ createThread(content: string, replyToId?: string): Promise<any>;
876
+ likeThread(threadId: string): Promise<any>;
877
+ repost(threadId: string): Promise<any>;
878
+ }
879
+
789
880
  interface LogiqicalConfig {
790
881
  /** Your wallet address — used for auto-registration */
791
882
  wallet: string;
@@ -823,6 +914,10 @@ declare class LogiqicalClient {
823
914
  readonly perps: PerpsModule;
824
915
  /** Cross-chain token bridging via Li.Fi — any token, any chain */
825
916
  readonly bridge: BridgeModule;
917
+ /** Buy/sell Arena tickets (keys) — gives access to private chat rooms */
918
+ readonly tickets: TicketsModule;
919
+ /** Arena social: chat, DMs, posts, follow, user discovery */
920
+ readonly social: SocialModule;
826
921
  private http;
827
922
  private wallet;
828
923
  private agentName;
@@ -863,4 +958,4 @@ declare class LogiqicalAuthError extends LogiqicalError {
863
958
  constructor(endpoint: string);
864
959
  }
865
960
 
866
- export { type ArenaCommunity, type BalancesResponse, type BridgeChainsResponse, type BridgeConnectionsResponse, type BridgeInfoResponse, type BridgeLiFiChain, type BridgeLiFiToken, BridgeModule, type BridgeQuoteResponse, type BridgeRoutesResponse, type BridgeStatusResponse, type BridgeTokenResponse, type BridgeTokensResponse, type BridgeTransaction, type BroadcastResponse, type BuildCreateResponse, type BuyQuoteResponse, type DexBalanceResponse, DexModule, type DexQuoteResponse, type DexSwapResponse, type DexTokenEntry, type DexTokenInfoResponse, type DexTokensResponse, type GlobalTradeEntry, type GlobalTradesResponse, type HealthResponse, type HolderEntry, type LaunchTokenResponse, type LaunchpadBuyResponse, type LaunchpadListResponse, LaunchpadModule, type LaunchpadQuoteResponse, type LaunchpadSellResponse, type LaunchpadToken, LogiqicalAuthError, LogiqicalClient, type LogiqicalConfig, LogiqicalError, PerpsModule, type PerpsOrderResponse, type PerpsPositionsResponse, type PerpsSetupResponse, type PerpsTradingPair, type PerpsTradingPairsResponse, type RegisterResponse, type SellQuoteResponse, type StakeBuildResponse, type StakeInfoResponse, StakingModule, type SwapBuyResponse, SwapModule, type SwapSellResponse, type TokenActivityResponse, type TokenCreator, type TokenDetailResponse, type TokenHoldersResponse, type TokenStatsTimeframes, type TradeEntry, type UnsignedTx, type UploadImageResponse };
961
+ export { type ArenaCommunity, type BalancesResponse, type BridgeChainsResponse, type BridgeConnectionsResponse, type BridgeInfoResponse, type BridgeLiFiChain, type BridgeLiFiToken, BridgeModule, type BridgeQuoteResponse, type BridgeRoutesResponse, type BridgeStatusResponse, type BridgeTokenResponse, type BridgeTokensResponse, type BridgeTransaction, type BroadcastResponse, type BuildCreateResponse, type BuyQuoteResponse, type DexBalanceResponse, DexModule, type DexQuoteResponse, type DexSwapResponse, type DexTokenEntry, type DexTokenInfoResponse, type DexTokensResponse, type GlobalTradeEntry, type GlobalTradesResponse, type HealthResponse, type HolderEntry, type LaunchTokenResponse, type LaunchpadBuyResponse, type LaunchpadListResponse, LaunchpadModule, type LaunchpadQuoteResponse, type LaunchpadSellResponse, type LaunchpadToken, LogiqicalAuthError, LogiqicalClient, type LogiqicalConfig, LogiqicalError, PerpsModule, type PerpsOrderResponse, type PerpsPositionsResponse, type PerpsSetupResponse, type PerpsTradingPair, type PerpsTradingPairsResponse, type RegisterResponse, type SellQuoteResponse, SocialModule, type StakeBuildResponse, type StakeInfoResponse, StakingModule, type SwapBuyResponse, SwapModule, type SwapSellResponse, type TicketBalanceResponse, type TicketFeesResponse, type TicketPriceResponse, type TicketSupplyResponse, TicketsModule, type TokenActivityResponse, type TokenCreator, type TokenDetailResponse, type TokenHoldersResponse, type TokenStatsTimeframes, type TradeEntry, type UnsignedTx, type UploadImageResponse };
package/dist/index.d.ts CHANGED
@@ -4,8 +4,9 @@ declare class HttpClient {
4
4
  constructor(baseUrl: string, apiKey?: string);
5
5
  setApiKey(key: string): void;
6
6
  getApiKey(): string | null;
7
- get<T>(path: string, params?: Record<string, string | number | undefined>, skipAuth?: boolean): Promise<T>;
8
- post<T>(path: string, body: Record<string, unknown>): Promise<T>;
7
+ get<T>(path: string, params?: Record<string, string | number | undefined>, skipAuth?: boolean | Record<string, string>): Promise<T>;
8
+ post<T>(path: string, body: Record<string, unknown>, extraHeaders?: Record<string, string>): Promise<T>;
9
+ patch<T>(path: string, body: Record<string, unknown>, extraHeaders?: Record<string, string>): Promise<T>;
9
10
  private handleResponse;
10
11
  }
11
12
 
@@ -786,6 +787,96 @@ declare class BridgeModule {
786
787
  getInfo(): Promise<BridgeInfoResponse>;
787
788
  }
788
789
 
790
+ interface TicketPriceResponse {
791
+ price: string;
792
+ priceWithFee?: string;
793
+ priceAfterFee?: string;
794
+ tickets: string;
795
+ fractionalAmount: number;
796
+ }
797
+ interface TicketBalanceResponse {
798
+ tickets: string;
799
+ fractionalAmount: string;
800
+ }
801
+ interface TicketSupplyResponse {
802
+ wholeSupply: string;
803
+ fractionalSupply: string;
804
+ tickets: string;
805
+ }
806
+ interface TicketFeesResponse {
807
+ protocolFee: string;
808
+ subjectFee: string;
809
+ referralFee: string;
810
+ totalFeePercent: string;
811
+ }
812
+ declare class TicketsModule {
813
+ private http;
814
+ private auth;
815
+ constructor(http: HttpClient, auth: () => Promise<void>);
816
+ /** Get buy price for tickets (supports fractional: "0.5", "1.2", "3") */
817
+ getBuyPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
818
+ /** Get sell price for tickets */
819
+ getSellPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
820
+ /** Get ticket balance for a user on a subject */
821
+ getBalance(subject: string, user: string): Promise<TicketBalanceResponse>;
822
+ /** Get ticket supply for a subject */
823
+ getSupply(subject: string): Promise<TicketSupplyResponse>;
824
+ /** Get fee structure */
825
+ getFees(): Promise<TicketFeesResponse>;
826
+ /** Build unsigned tx to buy tickets */
827
+ buildBuyTx(wallet: string, subject: string, amount?: string): Promise<{
828
+ transaction: any;
829
+ }>;
830
+ /** Build unsigned tx to sell tickets */
831
+ buildSellTx(wallet: string, subject: string, amount?: string): Promise<{
832
+ transaction: any;
833
+ }>;
834
+ }
835
+
836
+ declare class SocialModule {
837
+ private http;
838
+ private auth;
839
+ private arenaApiKey?;
840
+ constructor(http: HttpClient, auth: () => Promise<void>, arenaApiKey?: string | undefined);
841
+ private headers;
842
+ /** Set the Arena API key for social endpoints */
843
+ setArenaApiKey(key: string): void;
844
+ searchUsers(q: string, page?: number, pageSize?: number): Promise<any>;
845
+ getUserByHandle(handle: string): Promise<any>;
846
+ getUserById(userId: string): Promise<any>;
847
+ getTopUsers(page?: number, pageSize?: number): Promise<any>;
848
+ getMe(): Promise<any>;
849
+ updateProfile(updates: {
850
+ userName?: string;
851
+ bio?: string;
852
+ profilePicture?: string;
853
+ }): Promise<any>;
854
+ follow(userId: string): Promise<any>;
855
+ unfollow(userId: string): Promise<any>;
856
+ getFollowers(userId: string): Promise<any>;
857
+ getFollowing(userId: string): Promise<any>;
858
+ getSharesStats(userId: string): Promise<any>;
859
+ getShareHolders(userId?: string): Promise<any>;
860
+ getHoldings(): Promise<any>;
861
+ getConversations(page?: number): Promise<any>;
862
+ getDirectMessages(): Promise<any>;
863
+ getGroupChats(): Promise<any>;
864
+ getGroup(groupId: string): Promise<any>;
865
+ getMembers(groupId: string): Promise<any>;
866
+ getOrCreateDM(userId: string): Promise<any>;
867
+ acceptChat(groupId: string): Promise<any>;
868
+ sendMessage(groupId: string, text: string, replyId?: string): Promise<any>;
869
+ getMessages(groupId: string, after?: string): Promise<any>;
870
+ searchMessages(q: string, groupId?: string): Promise<any>;
871
+ getMentions(groupId?: string): Promise<any>;
872
+ react(messageId: string, groupId: string, reaction: string): Promise<any>;
873
+ pinMessage(messageId: string, groupId: string, isPinned?: boolean): Promise<any>;
874
+ getPinnedMessages(groupId: string): Promise<any>;
875
+ createThread(content: string, replyToId?: string): Promise<any>;
876
+ likeThread(threadId: string): Promise<any>;
877
+ repost(threadId: string): Promise<any>;
878
+ }
879
+
789
880
  interface LogiqicalConfig {
790
881
  /** Your wallet address — used for auto-registration */
791
882
  wallet: string;
@@ -823,6 +914,10 @@ declare class LogiqicalClient {
823
914
  readonly perps: PerpsModule;
824
915
  /** Cross-chain token bridging via Li.Fi — any token, any chain */
825
916
  readonly bridge: BridgeModule;
917
+ /** Buy/sell Arena tickets (keys) — gives access to private chat rooms */
918
+ readonly tickets: TicketsModule;
919
+ /** Arena social: chat, DMs, posts, follow, user discovery */
920
+ readonly social: SocialModule;
826
921
  private http;
827
922
  private wallet;
828
923
  private agentName;
@@ -863,4 +958,4 @@ declare class LogiqicalAuthError extends LogiqicalError {
863
958
  constructor(endpoint: string);
864
959
  }
865
960
 
866
- export { type ArenaCommunity, type BalancesResponse, type BridgeChainsResponse, type BridgeConnectionsResponse, type BridgeInfoResponse, type BridgeLiFiChain, type BridgeLiFiToken, BridgeModule, type BridgeQuoteResponse, type BridgeRoutesResponse, type BridgeStatusResponse, type BridgeTokenResponse, type BridgeTokensResponse, type BridgeTransaction, type BroadcastResponse, type BuildCreateResponse, type BuyQuoteResponse, type DexBalanceResponse, DexModule, type DexQuoteResponse, type DexSwapResponse, type DexTokenEntry, type DexTokenInfoResponse, type DexTokensResponse, type GlobalTradeEntry, type GlobalTradesResponse, type HealthResponse, type HolderEntry, type LaunchTokenResponse, type LaunchpadBuyResponse, type LaunchpadListResponse, LaunchpadModule, type LaunchpadQuoteResponse, type LaunchpadSellResponse, type LaunchpadToken, LogiqicalAuthError, LogiqicalClient, type LogiqicalConfig, LogiqicalError, PerpsModule, type PerpsOrderResponse, type PerpsPositionsResponse, type PerpsSetupResponse, type PerpsTradingPair, type PerpsTradingPairsResponse, type RegisterResponse, type SellQuoteResponse, type StakeBuildResponse, type StakeInfoResponse, StakingModule, type SwapBuyResponse, SwapModule, type SwapSellResponse, type TokenActivityResponse, type TokenCreator, type TokenDetailResponse, type TokenHoldersResponse, type TokenStatsTimeframes, type TradeEntry, type UnsignedTx, type UploadImageResponse };
961
+ export { type ArenaCommunity, type BalancesResponse, type BridgeChainsResponse, type BridgeConnectionsResponse, type BridgeInfoResponse, type BridgeLiFiChain, type BridgeLiFiToken, BridgeModule, type BridgeQuoteResponse, type BridgeRoutesResponse, type BridgeStatusResponse, type BridgeTokenResponse, type BridgeTokensResponse, type BridgeTransaction, type BroadcastResponse, type BuildCreateResponse, type BuyQuoteResponse, type DexBalanceResponse, DexModule, type DexQuoteResponse, type DexSwapResponse, type DexTokenEntry, type DexTokenInfoResponse, type DexTokensResponse, type GlobalTradeEntry, type GlobalTradesResponse, type HealthResponse, type HolderEntry, type LaunchTokenResponse, type LaunchpadBuyResponse, type LaunchpadListResponse, LaunchpadModule, type LaunchpadQuoteResponse, type LaunchpadSellResponse, type LaunchpadToken, LogiqicalAuthError, LogiqicalClient, type LogiqicalConfig, LogiqicalError, PerpsModule, type PerpsOrderResponse, type PerpsPositionsResponse, type PerpsSetupResponse, type PerpsTradingPair, type PerpsTradingPairsResponse, type RegisterResponse, type SellQuoteResponse, SocialModule, type StakeBuildResponse, type StakeInfoResponse, StakingModule, type SwapBuyResponse, SwapModule, type SwapSellResponse, type TicketBalanceResponse, type TicketFeesResponse, type TicketPriceResponse, type TicketSupplyResponse, TicketsModule, type TokenActivityResponse, type TokenCreator, type TokenDetailResponse, type TokenHoldersResponse, type TokenStatsTimeframes, type TradeEntry, type UnsignedTx, type UploadImageResponse };
package/dist/index.js CHANGED
@@ -27,8 +27,10 @@ __export(index_exports, {
27
27
  LogiqicalClient: () => LogiqicalClient,
28
28
  LogiqicalError: () => LogiqicalError,
29
29
  PerpsModule: () => PerpsModule,
30
+ SocialModule: () => SocialModule,
30
31
  StakingModule: () => StakingModule,
31
- SwapModule: () => SwapModule
32
+ SwapModule: () => SwapModule,
33
+ TicketsModule: () => TicketsModule
32
34
  });
33
35
  module.exports = __toCommonJS(index_exports);
34
36
 
@@ -61,25 +63,34 @@ var HttpClient = class {
61
63
  getApiKey() {
62
64
  return this.apiKey;
63
65
  }
64
- async get(path, params, skipAuth = false) {
66
+ async get(path, params, skipAuth) {
65
67
  const url = new URL(path, this.baseUrl);
68
+ const isSkipAuth = typeof skipAuth === "boolean" ? skipAuth : false;
69
+ const extraHeaders = typeof skipAuth === "object" ? skipAuth : void 0;
66
70
  if (params) {
67
71
  for (const [k, v] of Object.entries(params)) {
68
72
  if (v !== void 0) url.searchParams.set(k, String(v));
69
73
  }
70
74
  }
71
- const headers = {};
72
- if (!skipAuth && this.apiKey) headers["X-API-Key"] = this.apiKey;
75
+ const headers = { ...extraHeaders };
76
+ if (!isSkipAuth && this.apiKey) headers["X-API-Key"] = this.apiKey;
73
77
  const res = await fetch(url.toString(), { headers });
74
78
  return this.handleResponse(res, path);
75
79
  }
76
- async post(path, body) {
80
+ async post(path, body, extraHeaders) {
77
81
  const url = new URL(path, this.baseUrl);
78
- const headers = { "Content-Type": "application/json" };
82
+ const headers = { "Content-Type": "application/json", ...extraHeaders };
79
83
  if (this.apiKey) headers["X-API-Key"] = this.apiKey;
80
84
  const res = await fetch(url.toString(), { method: "POST", headers, body: JSON.stringify(body) });
81
85
  return this.handleResponse(res, path);
82
86
  }
87
+ async patch(path, body, extraHeaders) {
88
+ const url = new URL(path, this.baseUrl);
89
+ const headers = { "Content-Type": "application/json", ...extraHeaders };
90
+ if (this.apiKey) headers["X-API-Key"] = this.apiKey;
91
+ const res = await fetch(url.toString(), { method: "PATCH", headers, body: JSON.stringify(body) });
92
+ return this.handleResponse(res, path);
93
+ }
83
94
  async handleResponse(res, endpoint) {
84
95
  if (res.status === 401) throw new LogiqicalAuthError(endpoint);
85
96
  const data = await res.json().catch(() => null);
@@ -719,6 +730,199 @@ var BridgeModule = class {
719
730
  }
720
731
  };
721
732
 
733
+ // src/modules/tickets.ts
734
+ var TicketsModule = class {
735
+ constructor(http, auth) {
736
+ this.http = http;
737
+ this.auth = auth;
738
+ }
739
+ /** Get buy price for tickets (supports fractional: "0.5", "1.2", "3") */
740
+ async getBuyPrice(subject, amount = "1") {
741
+ await this.auth();
742
+ return this.http.get(`/tickets/price/buy?subject=${subject}&amount=${amount}`);
743
+ }
744
+ /** Get sell price for tickets */
745
+ async getSellPrice(subject, amount = "1") {
746
+ await this.auth();
747
+ return this.http.get(`/tickets/price/sell?subject=${subject}&amount=${amount}`);
748
+ }
749
+ /** Get ticket balance for a user on a subject */
750
+ async getBalance(subject, user) {
751
+ await this.auth();
752
+ return this.http.get(`/tickets/balance?subject=${subject}&user=${user}`);
753
+ }
754
+ /** Get ticket supply for a subject */
755
+ async getSupply(subject) {
756
+ await this.auth();
757
+ return this.http.get(`/tickets/supply?subject=${subject}`);
758
+ }
759
+ /** Get fee structure */
760
+ async getFees() {
761
+ await this.auth();
762
+ return this.http.get("/tickets/fees");
763
+ }
764
+ /** Build unsigned tx to buy tickets */
765
+ async buildBuyTx(wallet, subject, amount = "1") {
766
+ await this.auth();
767
+ return this.http.post("/tickets/buy", { wallet, subject, amount });
768
+ }
769
+ /** Build unsigned tx to sell tickets */
770
+ async buildSellTx(wallet, subject, amount = "1") {
771
+ await this.auth();
772
+ return this.http.post("/tickets/sell", { wallet, subject, amount });
773
+ }
774
+ };
775
+
776
+ // src/modules/social.ts
777
+ var SocialModule = class {
778
+ constructor(http, auth, arenaApiKey) {
779
+ this.http = http;
780
+ this.auth = auth;
781
+ this.arenaApiKey = arenaApiKey;
782
+ }
783
+ headers() {
784
+ const h = {};
785
+ if (this.arenaApiKey) h["X-Arena-Api-Key"] = this.arenaApiKey;
786
+ return h;
787
+ }
788
+ /** Set the Arena API key for social endpoints */
789
+ setArenaApiKey(key) {
790
+ this.arenaApiKey = key;
791
+ }
792
+ // ─── User Discovery ──────────────────────────────────────
793
+ async searchUsers(q, page = 1, pageSize = 20) {
794
+ await this.auth();
795
+ return this.http.get(`/social/users/search?q=${encodeURIComponent(q)}&page=${page}&pageSize=${pageSize}`, void 0, this.headers());
796
+ }
797
+ async getUserByHandle(handle) {
798
+ await this.auth();
799
+ return this.http.get(`/social/users/handle/${encodeURIComponent(handle)}`, void 0, this.headers());
800
+ }
801
+ async getUserById(userId) {
802
+ await this.auth();
803
+ return this.http.get(`/social/users/id/${userId}`, void 0, this.headers());
804
+ }
805
+ async getTopUsers(page = 1, pageSize = 20) {
806
+ await this.auth();
807
+ return this.http.get(`/social/users/top?page=${page}&pageSize=${pageSize}`, void 0, this.headers());
808
+ }
809
+ async getMe() {
810
+ await this.auth();
811
+ return this.http.get("/social/me", void 0, this.headers());
812
+ }
813
+ // ─── Profile ─────────────────────────────────────────────
814
+ async updateProfile(updates) {
815
+ await this.auth();
816
+ return this.http.patch("/social/profile", updates, this.headers());
817
+ }
818
+ // ─── Follow ──────────────────────────────────────────────
819
+ async follow(userId) {
820
+ await this.auth();
821
+ return this.http.post("/social/follow", { userId }, this.headers());
822
+ }
823
+ async unfollow(userId) {
824
+ await this.auth();
825
+ return this.http.post("/social/unfollow", { userId }, this.headers());
826
+ }
827
+ async getFollowers(userId) {
828
+ await this.auth();
829
+ return this.http.get(`/social/followers/${userId}`, void 0, this.headers());
830
+ }
831
+ async getFollowing(userId) {
832
+ await this.auth();
833
+ return this.http.get(`/social/following/${userId}`, void 0, this.headers());
834
+ }
835
+ // ─── Shares ──────────────────────────────────────────────
836
+ async getSharesStats(userId) {
837
+ await this.auth();
838
+ return this.http.get(`/social/shares/stats/${userId}`, void 0, this.headers());
839
+ }
840
+ async getShareHolders(userId) {
841
+ await this.auth();
842
+ const q = userId ? `?userId=${userId}` : "";
843
+ return this.http.get(`/social/shares/holders${q}`, void 0, this.headers());
844
+ }
845
+ async getHoldings() {
846
+ await this.auth();
847
+ return this.http.get("/social/shares/holdings", void 0, this.headers());
848
+ }
849
+ // ─── Chat: Conversations ────────────────────────────────
850
+ async getConversations(page = 1) {
851
+ await this.auth();
852
+ return this.http.get(`/social/chat/conversations?page=${page}`, void 0, this.headers());
853
+ }
854
+ async getDirectMessages() {
855
+ await this.auth();
856
+ return this.http.get("/social/chat/dms", void 0, this.headers());
857
+ }
858
+ async getGroupChats() {
859
+ await this.auth();
860
+ return this.http.get("/social/chat/groups", void 0, this.headers());
861
+ }
862
+ async getGroup(groupId) {
863
+ await this.auth();
864
+ return this.http.get(`/social/chat/group/${groupId}`, void 0, this.headers());
865
+ }
866
+ async getMembers(groupId) {
867
+ await this.auth();
868
+ return this.http.get(`/social/chat/members/${groupId}`, void 0, this.headers());
869
+ }
870
+ async getOrCreateDM(userId) {
871
+ await this.auth();
872
+ return this.http.post("/social/chat/dm", { userId }, this.headers());
873
+ }
874
+ async acceptChat(groupId) {
875
+ await this.auth();
876
+ return this.http.post("/social/chat/accept", { groupId }, this.headers());
877
+ }
878
+ // ─── Chat: Messages ─────────────────────────────────────
879
+ async sendMessage(groupId, text, replyId) {
880
+ await this.auth();
881
+ return this.http.post("/social/chat/send", { groupId, text, replyId }, this.headers());
882
+ }
883
+ async getMessages(groupId, after) {
884
+ await this.auth();
885
+ const q = after ? `?after=${after}` : "";
886
+ return this.http.get(`/social/chat/messages/${groupId}${q}`, void 0, this.headers());
887
+ }
888
+ async searchMessages(q, groupId) {
889
+ await this.auth();
890
+ const gq = groupId ? `&groupId=${groupId}` : "";
891
+ return this.http.get(`/social/chat/search?q=${encodeURIComponent(q)}${gq}`, void 0, this.headers());
892
+ }
893
+ async getMentions(groupId) {
894
+ await this.auth();
895
+ const q = groupId ? `?groupId=${groupId}` : "";
896
+ return this.http.get(`/social/chat/mentions${q}`, void 0, this.headers());
897
+ }
898
+ // ─── Chat: Reactions & Pins ─────────────────────────────
899
+ async react(messageId, groupId, reaction) {
900
+ await this.auth();
901
+ return this.http.post("/social/chat/react", { messageId, groupId, reaction }, this.headers());
902
+ }
903
+ async pinMessage(messageId, groupId, isPinned = true) {
904
+ await this.auth();
905
+ return this.http.post("/social/chat/pin", { messageId, groupId, isPinned }, this.headers());
906
+ }
907
+ async getPinnedMessages(groupId) {
908
+ await this.auth();
909
+ return this.http.get(`/social/chat/pinned/${groupId}`, void 0, this.headers());
910
+ }
911
+ // ─── Threads ────────────────────────────────────────────
912
+ async createThread(content, replyToId) {
913
+ await this.auth();
914
+ return this.http.post("/social/thread", { content, replyToId }, this.headers());
915
+ }
916
+ async likeThread(threadId) {
917
+ await this.auth();
918
+ return this.http.post("/social/thread/like", { threadId }, this.headers());
919
+ }
920
+ async repost(threadId) {
921
+ await this.auth();
922
+ return this.http.post("/social/thread/repost", { threadId }, this.headers());
923
+ }
924
+ };
925
+
722
926
  // src/client.ts
723
927
  var DEFAULT_BASE_URL = "https://brave-alignment-production-1706.up.railway.app";
724
928
  var LogiqicalClient = class {
@@ -734,6 +938,10 @@ var LogiqicalClient = class {
734
938
  perps;
735
939
  /** Cross-chain token bridging via Li.Fi — any token, any chain */
736
940
  bridge;
941
+ /** Buy/sell Arena tickets (keys) — gives access to private chat rooms */
942
+ tickets;
943
+ /** Arena social: chat, DMs, posts, follow, user discovery */
944
+ social;
737
945
  http;
738
946
  wallet;
739
947
  agentName;
@@ -749,6 +957,8 @@ var LogiqicalClient = class {
749
957
  this.dex = new DexModule(this.http, auth);
750
958
  this.perps = new PerpsModule(this.http, auth);
751
959
  this.bridge = new BridgeModule(this.http, auth);
960
+ this.tickets = new TicketsModule(this.http, auth);
961
+ this.social = new SocialModule(this.http, auth);
752
962
  }
753
963
  /** The API key (available after first call or if provided in config) */
754
964
  get apiKey() {
@@ -810,6 +1020,8 @@ var LogiqicalClient = class {
810
1020
  LogiqicalClient,
811
1021
  LogiqicalError,
812
1022
  PerpsModule,
1023
+ SocialModule,
813
1024
  StakingModule,
814
- SwapModule
1025
+ SwapModule,
1026
+ TicketsModule
815
1027
  });
package/dist/index.mjs CHANGED
@@ -27,25 +27,34 @@ var HttpClient = class {
27
27
  getApiKey() {
28
28
  return this.apiKey;
29
29
  }
30
- async get(path, params, skipAuth = false) {
30
+ async get(path, params, skipAuth) {
31
31
  const url = new URL(path, this.baseUrl);
32
+ const isSkipAuth = typeof skipAuth === "boolean" ? skipAuth : false;
33
+ const extraHeaders = typeof skipAuth === "object" ? skipAuth : void 0;
32
34
  if (params) {
33
35
  for (const [k, v] of Object.entries(params)) {
34
36
  if (v !== void 0) url.searchParams.set(k, String(v));
35
37
  }
36
38
  }
37
- const headers = {};
38
- if (!skipAuth && this.apiKey) headers["X-API-Key"] = this.apiKey;
39
+ const headers = { ...extraHeaders };
40
+ if (!isSkipAuth && this.apiKey) headers["X-API-Key"] = this.apiKey;
39
41
  const res = await fetch(url.toString(), { headers });
40
42
  return this.handleResponse(res, path);
41
43
  }
42
- async post(path, body) {
44
+ async post(path, body, extraHeaders) {
43
45
  const url = new URL(path, this.baseUrl);
44
- const headers = { "Content-Type": "application/json" };
46
+ const headers = { "Content-Type": "application/json", ...extraHeaders };
45
47
  if (this.apiKey) headers["X-API-Key"] = this.apiKey;
46
48
  const res = await fetch(url.toString(), { method: "POST", headers, body: JSON.stringify(body) });
47
49
  return this.handleResponse(res, path);
48
50
  }
51
+ async patch(path, body, extraHeaders) {
52
+ const url = new URL(path, this.baseUrl);
53
+ const headers = { "Content-Type": "application/json", ...extraHeaders };
54
+ if (this.apiKey) headers["X-API-Key"] = this.apiKey;
55
+ const res = await fetch(url.toString(), { method: "PATCH", headers, body: JSON.stringify(body) });
56
+ return this.handleResponse(res, path);
57
+ }
49
58
  async handleResponse(res, endpoint) {
50
59
  if (res.status === 401) throw new LogiqicalAuthError(endpoint);
51
60
  const data = await res.json().catch(() => null);
@@ -685,6 +694,199 @@ var BridgeModule = class {
685
694
  }
686
695
  };
687
696
 
697
+ // src/modules/tickets.ts
698
+ var TicketsModule = class {
699
+ constructor(http, auth) {
700
+ this.http = http;
701
+ this.auth = auth;
702
+ }
703
+ /** Get buy price for tickets (supports fractional: "0.5", "1.2", "3") */
704
+ async getBuyPrice(subject, amount = "1") {
705
+ await this.auth();
706
+ return this.http.get(`/tickets/price/buy?subject=${subject}&amount=${amount}`);
707
+ }
708
+ /** Get sell price for tickets */
709
+ async getSellPrice(subject, amount = "1") {
710
+ await this.auth();
711
+ return this.http.get(`/tickets/price/sell?subject=${subject}&amount=${amount}`);
712
+ }
713
+ /** Get ticket balance for a user on a subject */
714
+ async getBalance(subject, user) {
715
+ await this.auth();
716
+ return this.http.get(`/tickets/balance?subject=${subject}&user=${user}`);
717
+ }
718
+ /** Get ticket supply for a subject */
719
+ async getSupply(subject) {
720
+ await this.auth();
721
+ return this.http.get(`/tickets/supply?subject=${subject}`);
722
+ }
723
+ /** Get fee structure */
724
+ async getFees() {
725
+ await this.auth();
726
+ return this.http.get("/tickets/fees");
727
+ }
728
+ /** Build unsigned tx to buy tickets */
729
+ async buildBuyTx(wallet, subject, amount = "1") {
730
+ await this.auth();
731
+ return this.http.post("/tickets/buy", { wallet, subject, amount });
732
+ }
733
+ /** Build unsigned tx to sell tickets */
734
+ async buildSellTx(wallet, subject, amount = "1") {
735
+ await this.auth();
736
+ return this.http.post("/tickets/sell", { wallet, subject, amount });
737
+ }
738
+ };
739
+
740
+ // src/modules/social.ts
741
+ var SocialModule = class {
742
+ constructor(http, auth, arenaApiKey) {
743
+ this.http = http;
744
+ this.auth = auth;
745
+ this.arenaApiKey = arenaApiKey;
746
+ }
747
+ headers() {
748
+ const h = {};
749
+ if (this.arenaApiKey) h["X-Arena-Api-Key"] = this.arenaApiKey;
750
+ return h;
751
+ }
752
+ /** Set the Arena API key for social endpoints */
753
+ setArenaApiKey(key) {
754
+ this.arenaApiKey = key;
755
+ }
756
+ // ─── User Discovery ──────────────────────────────────────
757
+ async searchUsers(q, page = 1, pageSize = 20) {
758
+ await this.auth();
759
+ return this.http.get(`/social/users/search?q=${encodeURIComponent(q)}&page=${page}&pageSize=${pageSize}`, void 0, this.headers());
760
+ }
761
+ async getUserByHandle(handle) {
762
+ await this.auth();
763
+ return this.http.get(`/social/users/handle/${encodeURIComponent(handle)}`, void 0, this.headers());
764
+ }
765
+ async getUserById(userId) {
766
+ await this.auth();
767
+ return this.http.get(`/social/users/id/${userId}`, void 0, this.headers());
768
+ }
769
+ async getTopUsers(page = 1, pageSize = 20) {
770
+ await this.auth();
771
+ return this.http.get(`/social/users/top?page=${page}&pageSize=${pageSize}`, void 0, this.headers());
772
+ }
773
+ async getMe() {
774
+ await this.auth();
775
+ return this.http.get("/social/me", void 0, this.headers());
776
+ }
777
+ // ─── Profile ─────────────────────────────────────────────
778
+ async updateProfile(updates) {
779
+ await this.auth();
780
+ return this.http.patch("/social/profile", updates, this.headers());
781
+ }
782
+ // ─── Follow ──────────────────────────────────────────────
783
+ async follow(userId) {
784
+ await this.auth();
785
+ return this.http.post("/social/follow", { userId }, this.headers());
786
+ }
787
+ async unfollow(userId) {
788
+ await this.auth();
789
+ return this.http.post("/social/unfollow", { userId }, this.headers());
790
+ }
791
+ async getFollowers(userId) {
792
+ await this.auth();
793
+ return this.http.get(`/social/followers/${userId}`, void 0, this.headers());
794
+ }
795
+ async getFollowing(userId) {
796
+ await this.auth();
797
+ return this.http.get(`/social/following/${userId}`, void 0, this.headers());
798
+ }
799
+ // ─── Shares ──────────────────────────────────────────────
800
+ async getSharesStats(userId) {
801
+ await this.auth();
802
+ return this.http.get(`/social/shares/stats/${userId}`, void 0, this.headers());
803
+ }
804
+ async getShareHolders(userId) {
805
+ await this.auth();
806
+ const q = userId ? `?userId=${userId}` : "";
807
+ return this.http.get(`/social/shares/holders${q}`, void 0, this.headers());
808
+ }
809
+ async getHoldings() {
810
+ await this.auth();
811
+ return this.http.get("/social/shares/holdings", void 0, this.headers());
812
+ }
813
+ // ─── Chat: Conversations ────────────────────────────────
814
+ async getConversations(page = 1) {
815
+ await this.auth();
816
+ return this.http.get(`/social/chat/conversations?page=${page}`, void 0, this.headers());
817
+ }
818
+ async getDirectMessages() {
819
+ await this.auth();
820
+ return this.http.get("/social/chat/dms", void 0, this.headers());
821
+ }
822
+ async getGroupChats() {
823
+ await this.auth();
824
+ return this.http.get("/social/chat/groups", void 0, this.headers());
825
+ }
826
+ async getGroup(groupId) {
827
+ await this.auth();
828
+ return this.http.get(`/social/chat/group/${groupId}`, void 0, this.headers());
829
+ }
830
+ async getMembers(groupId) {
831
+ await this.auth();
832
+ return this.http.get(`/social/chat/members/${groupId}`, void 0, this.headers());
833
+ }
834
+ async getOrCreateDM(userId) {
835
+ await this.auth();
836
+ return this.http.post("/social/chat/dm", { userId }, this.headers());
837
+ }
838
+ async acceptChat(groupId) {
839
+ await this.auth();
840
+ return this.http.post("/social/chat/accept", { groupId }, this.headers());
841
+ }
842
+ // ─── Chat: Messages ─────────────────────────────────────
843
+ async sendMessage(groupId, text, replyId) {
844
+ await this.auth();
845
+ return this.http.post("/social/chat/send", { groupId, text, replyId }, this.headers());
846
+ }
847
+ async getMessages(groupId, after) {
848
+ await this.auth();
849
+ const q = after ? `?after=${after}` : "";
850
+ return this.http.get(`/social/chat/messages/${groupId}${q}`, void 0, this.headers());
851
+ }
852
+ async searchMessages(q, groupId) {
853
+ await this.auth();
854
+ const gq = groupId ? `&groupId=${groupId}` : "";
855
+ return this.http.get(`/social/chat/search?q=${encodeURIComponent(q)}${gq}`, void 0, this.headers());
856
+ }
857
+ async getMentions(groupId) {
858
+ await this.auth();
859
+ const q = groupId ? `?groupId=${groupId}` : "";
860
+ return this.http.get(`/social/chat/mentions${q}`, void 0, this.headers());
861
+ }
862
+ // ─── Chat: Reactions & Pins ─────────────────────────────
863
+ async react(messageId, groupId, reaction) {
864
+ await this.auth();
865
+ return this.http.post("/social/chat/react", { messageId, groupId, reaction }, this.headers());
866
+ }
867
+ async pinMessage(messageId, groupId, isPinned = true) {
868
+ await this.auth();
869
+ return this.http.post("/social/chat/pin", { messageId, groupId, isPinned }, this.headers());
870
+ }
871
+ async getPinnedMessages(groupId) {
872
+ await this.auth();
873
+ return this.http.get(`/social/chat/pinned/${groupId}`, void 0, this.headers());
874
+ }
875
+ // ─── Threads ────────────────────────────────────────────
876
+ async createThread(content, replyToId) {
877
+ await this.auth();
878
+ return this.http.post("/social/thread", { content, replyToId }, this.headers());
879
+ }
880
+ async likeThread(threadId) {
881
+ await this.auth();
882
+ return this.http.post("/social/thread/like", { threadId }, this.headers());
883
+ }
884
+ async repost(threadId) {
885
+ await this.auth();
886
+ return this.http.post("/social/thread/repost", { threadId }, this.headers());
887
+ }
888
+ };
889
+
688
890
  // src/client.ts
689
891
  var DEFAULT_BASE_URL = "https://brave-alignment-production-1706.up.railway.app";
690
892
  var LogiqicalClient = class {
@@ -700,6 +902,10 @@ var LogiqicalClient = class {
700
902
  perps;
701
903
  /** Cross-chain token bridging via Li.Fi — any token, any chain */
702
904
  bridge;
905
+ /** Buy/sell Arena tickets (keys) — gives access to private chat rooms */
906
+ tickets;
907
+ /** Arena social: chat, DMs, posts, follow, user discovery */
908
+ social;
703
909
  http;
704
910
  wallet;
705
911
  agentName;
@@ -715,6 +921,8 @@ var LogiqicalClient = class {
715
921
  this.dex = new DexModule(this.http, auth);
716
922
  this.perps = new PerpsModule(this.http, auth);
717
923
  this.bridge = new BridgeModule(this.http, auth);
924
+ this.tickets = new TicketsModule(this.http, auth);
925
+ this.social = new SocialModule(this.http, auth);
718
926
  }
719
927
  /** The API key (available after first call or if provided in config) */
720
928
  get apiKey() {
@@ -775,6 +983,8 @@ export {
775
983
  LogiqicalClient,
776
984
  LogiqicalError,
777
985
  PerpsModule,
986
+ SocialModule,
778
987
  StakingModule,
779
- SwapModule
988
+ SwapModule,
989
+ TicketsModule
780
990
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logiqical",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for AI agents to trade on Avalanche — swaps, staking, launchpad, DEX, perps, bridge",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",