logiqical 0.1.2 → 0.3.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/README.md +402 -81
- package/dist/cli.mjs +3278 -0
- package/dist/index.d.mts +811 -759
- package/dist/index.d.ts +811 -759
- package/dist/index.js +2375 -654
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2357 -652
- package/dist/index.mjs.map +1 -0
- package/package.json +20 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Wallet, JsonRpcProvider, TransactionRequest, TransactionResponse } from 'ethers';
|
|
2
|
+
|
|
3
|
+
interface ChainConfig {
|
|
4
|
+
chainId: number;
|
|
5
|
+
name: string;
|
|
6
|
+
rpcUrl: string;
|
|
7
|
+
nativeCurrency: {
|
|
8
|
+
name: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
};
|
|
12
|
+
blockExplorer?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const CHAINS: Record<string, ChainConfig>;
|
|
15
|
+
interface AgentWalletConfig {
|
|
16
|
+
/** Network name from CHAINS registry, or a custom RPC URL */
|
|
17
|
+
network?: string;
|
|
18
|
+
/** Custom RPC URL (overrides network preset) */
|
|
19
|
+
rpcUrl?: string;
|
|
20
|
+
/** Private key to import (0x-prefixed hex) */
|
|
21
|
+
privateKey?: string;
|
|
22
|
+
/** Password for keystore encryption/decryption */
|
|
23
|
+
password?: string;
|
|
24
|
+
/** Keystore file name (default: "agent") */
|
|
25
|
+
keystoreName?: string;
|
|
26
|
+
}
|
|
27
|
+
declare class AgentWallet {
|
|
28
|
+
readonly wallet: Wallet;
|
|
29
|
+
readonly provider: JsonRpcProvider;
|
|
30
|
+
readonly chain: ChainConfig;
|
|
31
|
+
readonly address: string;
|
|
32
|
+
private constructor();
|
|
33
|
+
/** The private key (use carefully) */
|
|
34
|
+
get privateKey(): string;
|
|
35
|
+
/** Generate a brand new wallet with a random private key */
|
|
36
|
+
static generate(config?: AgentWalletConfig): AgentWallet;
|
|
37
|
+
/** Import an existing wallet from a private key */
|
|
38
|
+
static fromPrivateKey(privateKey: string, config?: AgentWalletConfig): AgentWallet;
|
|
39
|
+
/** Boot from encrypted keystore, or generate + save if none exists */
|
|
40
|
+
static boot(config?: AgentWalletConfig): Promise<AgentWallet>;
|
|
41
|
+
/** Encrypt and save the wallet to the keystore directory */
|
|
42
|
+
saveKeystore(password?: string, name?: string): Promise<string>;
|
|
43
|
+
/** Get native token balance (formatted) */
|
|
44
|
+
getBalance(): Promise<string>;
|
|
45
|
+
/** Get balance of any address */
|
|
46
|
+
getBalanceOf(address: string): Promise<string>;
|
|
47
|
+
/** Sign a message */
|
|
48
|
+
signMessage(message: string): Promise<string>;
|
|
49
|
+
/** Sign typed data (EIP-712) */
|
|
50
|
+
signTypedData(domain: any, types: any, value: any): Promise<string>;
|
|
51
|
+
/** Sign a transaction without broadcasting */
|
|
52
|
+
signTransaction(tx: TransactionRequest): Promise<string>;
|
|
53
|
+
/** Sign and broadcast a transaction */
|
|
54
|
+
sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>;
|
|
55
|
+
/** Send native token to an address */
|
|
56
|
+
send(to: string, amount: string): Promise<TransactionResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Sign and broadcast an unsigned tx object returned by the Logiqical API.
|
|
59
|
+
* Handles the { to, data, value, chainId, gas/gasLimit } format.
|
|
60
|
+
*/
|
|
61
|
+
signAndBroadcast(unsignedTx: {
|
|
62
|
+
to: string;
|
|
63
|
+
data: string;
|
|
64
|
+
value: string;
|
|
65
|
+
chainId?: number;
|
|
66
|
+
gas?: string;
|
|
67
|
+
gasLimit?: string;
|
|
68
|
+
}): Promise<TransactionResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Sign and broadcast multiple unsigned txs in sequence.
|
|
71
|
+
* Waits for each to confirm before sending the next.
|
|
72
|
+
*/
|
|
73
|
+
signAndBroadcastAll(unsignedTxs: Array<{
|
|
74
|
+
to: string;
|
|
75
|
+
data: string;
|
|
76
|
+
value: string;
|
|
77
|
+
chainId?: number;
|
|
78
|
+
gas?: string;
|
|
79
|
+
gasLimit?: string;
|
|
80
|
+
}>, confirmations?: number): Promise<TransactionResponse[]>;
|
|
81
|
+
/** Call a read-only contract method (no gas, no signing) */
|
|
82
|
+
call(tx: TransactionRequest): Promise<string>;
|
|
83
|
+
/** Switch to a different network (returns new AgentWallet instance) */
|
|
84
|
+
switchNetwork(network: string): AgentWallet;
|
|
85
|
+
private static resolveProvider;
|
|
10
86
|
}
|
|
11
87
|
|
|
12
88
|
/** Unsigned transaction ready to be signed and broadcast */
|
|
@@ -19,288 +95,298 @@ interface UnsignedTx {
|
|
|
19
95
|
gasLimit?: string;
|
|
20
96
|
description?: string;
|
|
21
97
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
interface SellQuoteResponse {
|
|
37
|
-
arenaIn: string;
|
|
38
|
-
avaxOut: string;
|
|
39
|
-
avaxOutFormatted: string;
|
|
40
|
-
rate: string;
|
|
41
|
-
priceImpact: string;
|
|
42
|
-
}
|
|
43
|
-
interface SwapBuyResponse {
|
|
44
|
-
transactions: UnsignedTx[];
|
|
45
|
-
summary: string;
|
|
46
|
-
}
|
|
47
|
-
interface SwapSellResponse {
|
|
48
|
-
transactions: UnsignedTx[];
|
|
49
|
-
}
|
|
50
|
-
interface StakeInfoResponse {
|
|
51
|
-
staked: string;
|
|
52
|
-
stakedFormatted: string;
|
|
53
|
-
rewards: string;
|
|
54
|
-
rewardsFormatted: string;
|
|
55
|
-
apy: string;
|
|
56
|
-
}
|
|
57
|
-
interface StakeBuildResponse {
|
|
58
|
-
transactions: UnsignedTx[];
|
|
59
|
-
}
|
|
60
|
-
interface TokenCreator {
|
|
61
|
-
address: string;
|
|
62
|
-
handle: string;
|
|
63
|
-
photoUrl: string;
|
|
64
|
-
twitterFollowers: number | null;
|
|
65
|
-
totalTokensCreated: number | null;
|
|
66
|
-
}
|
|
67
|
-
interface LaunchpadToken {
|
|
68
|
-
tokenId: string;
|
|
69
|
-
type: "AVAX-paired" | "ARENA-paired";
|
|
70
|
-
name: string;
|
|
71
|
-
symbol: string;
|
|
72
|
-
tokenAddress: string;
|
|
73
|
-
photoUrl: string;
|
|
74
|
-
description: string | null;
|
|
75
|
-
creator: TokenCreator;
|
|
76
|
-
price: {
|
|
77
|
-
eth: number;
|
|
78
|
-
usd: number;
|
|
79
|
-
avaxPrice: number;
|
|
80
|
-
};
|
|
81
|
-
volume: {
|
|
82
|
-
totalEth: number;
|
|
83
|
-
totalUsd: number;
|
|
84
|
-
};
|
|
85
|
-
holders: number;
|
|
86
|
-
transactions: number;
|
|
87
|
-
graduationProgress: string | null;
|
|
88
|
-
graduated: boolean;
|
|
89
|
-
supply: number;
|
|
90
|
-
createdAt: string | null;
|
|
91
|
-
whitelist: unknown;
|
|
92
|
-
isOfficial: boolean;
|
|
93
|
-
dexPoolId: string | null;
|
|
94
|
-
}
|
|
95
|
-
interface LaunchpadListResponse {
|
|
96
|
-
count: number;
|
|
97
|
-
tokens: LaunchpadToken[];
|
|
98
|
-
}
|
|
99
|
-
interface TokenStatsTimeframes {
|
|
100
|
-
"5m": number;
|
|
101
|
-
"1h": number;
|
|
102
|
-
"4h": number;
|
|
103
|
-
"12h": number;
|
|
104
|
-
"24h": number;
|
|
105
|
-
}
|
|
106
|
-
interface TokenDetailResponse extends LaunchpadToken {
|
|
107
|
-
stats?: {
|
|
108
|
-
buys: TokenStatsTimeframes;
|
|
109
|
-
sells: TokenStatsTimeframes;
|
|
110
|
-
uniqueBuyers: TokenStatsTimeframes;
|
|
111
|
-
uniqueSellers: TokenStatsTimeframes;
|
|
112
|
-
volume: TokenStatsTimeframes;
|
|
113
|
-
priceChange: TokenStatsTimeframes;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
interface LaunchpadQuoteResponse {
|
|
117
|
-
tokensOut?: string;
|
|
118
|
-
avaxCost?: string;
|
|
119
|
-
avaxOut?: string;
|
|
120
|
-
fees?: Record<string, string>;
|
|
98
|
+
/** Intent for calling a smart contract method */
|
|
99
|
+
interface CallIntent {
|
|
100
|
+
/** Contract address */
|
|
101
|
+
contract: string;
|
|
102
|
+
/** Human-readable ABI (e.g. ["function transfer(address,uint256) returns (bool)"]) */
|
|
103
|
+
abi: string[];
|
|
104
|
+
/** Method name to call */
|
|
105
|
+
method: string;
|
|
106
|
+
/** Method arguments */
|
|
107
|
+
args?: any[];
|
|
108
|
+
/** Native token value to send (human-readable, e.g. "0.1") */
|
|
109
|
+
value?: string;
|
|
110
|
+
/** Gas limit override */
|
|
111
|
+
gasLimit?: string;
|
|
121
112
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
/** Result from execute() or call() */
|
|
114
|
+
interface TransactionResult {
|
|
115
|
+
hash: string;
|
|
116
|
+
receipt: {
|
|
117
|
+
status: number;
|
|
118
|
+
blockNumber: number;
|
|
119
|
+
gasUsed: string;
|
|
120
|
+
transactionHash: string;
|
|
130
121
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Spending policy configuration */
|
|
125
|
+
interface SpendingPolicy {
|
|
126
|
+
/** Max native token (e.g. AVAX) per single transaction in human-readable units */
|
|
127
|
+
maxPerTx?: string;
|
|
128
|
+
/** Max native token spend per hour */
|
|
129
|
+
maxPerHour?: string;
|
|
130
|
+
/** Max native token spend per day (24h rolling) */
|
|
131
|
+
maxPerDay?: string;
|
|
132
|
+
/** Allowed contract addresses (if set, only these can be called) */
|
|
133
|
+
allowedContracts?: string[];
|
|
134
|
+
/** Blocked contract addresses (rejected even if in allowedContracts) */
|
|
135
|
+
blockedContracts?: string[];
|
|
136
|
+
/** Simulate (eth_call) before sending — catches reverts before spending gas */
|
|
137
|
+
simulateBeforeSend?: boolean;
|
|
138
|
+
/** Dry run mode — simulate everything, broadcast nothing */
|
|
139
|
+
dryRun?: boolean;
|
|
140
|
+
}
|
|
141
|
+
declare class PolicyEngine {
|
|
142
|
+
private policy;
|
|
143
|
+
private spendLog;
|
|
144
|
+
constructor(policy?: SpendingPolicy);
|
|
145
|
+
getPolicy(): SpendingPolicy;
|
|
146
|
+
setPolicy(policy: SpendingPolicy): void;
|
|
147
|
+
updatePolicy(updates: Partial<SpendingPolicy>): void;
|
|
148
|
+
/** Check a transaction against the policy. Throws if rejected. */
|
|
149
|
+
check(tx: UnsignedTx): void;
|
|
150
|
+
/** Record a spend after successful broadcast */
|
|
151
|
+
recordSpend(value: bigint): void;
|
|
152
|
+
/** Get budget status */
|
|
153
|
+
getBudgetStatus(): {
|
|
154
|
+
spentLastHour: string;
|
|
155
|
+
spentLast24h: string;
|
|
156
|
+
remainingHour: string | null;
|
|
157
|
+
remainingDay: string | null;
|
|
139
158
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
159
|
+
get shouldSimulate(): boolean;
|
|
160
|
+
get isDryRun(): boolean;
|
|
161
|
+
private getSpendSince;
|
|
143
162
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
163
|
+
type PolicyErrorCode = "MAX_PER_TX_EXCEEDED" | "HOURLY_BUDGET_EXCEEDED" | "DAILY_BUDGET_EXCEEDED" | "CONTRACT_NOT_ALLOWED" | "CONTRACT_BLOCKED" | "SIMULATION_FAILED";
|
|
164
|
+
declare class PolicyError extends Error {
|
|
165
|
+
readonly code: PolicyErrorCode;
|
|
166
|
+
constructor(message: string, code: PolicyErrorCode);
|
|
148
167
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
|
|
169
|
+
declare class SwapModule {
|
|
170
|
+
private provider;
|
|
171
|
+
private arenaToken;
|
|
172
|
+
private lbQuoter;
|
|
173
|
+
constructor(provider: JsonRpcProvider);
|
|
174
|
+
/** Get AVAX and ARENA balances for a wallet */
|
|
175
|
+
getBalances(wallet: string): Promise<{
|
|
176
|
+
avax: string;
|
|
177
|
+
arena: string;
|
|
178
|
+
avaxFormatted: string;
|
|
179
|
+
arenaFormatted: string;
|
|
180
|
+
}>;
|
|
181
|
+
/** Quote how much ARENA for a given AVAX amount (includes 0.3% fee) */
|
|
182
|
+
quote(avaxAmount: string): Promise<{
|
|
183
|
+
arenaOut: string;
|
|
184
|
+
fee: string;
|
|
185
|
+
netAvax: string;
|
|
186
|
+
rate: string;
|
|
187
|
+
}>;
|
|
188
|
+
/** Quote how much AVAX for selling ARENA */
|
|
189
|
+
sellQuote(arenaAmount: string): Promise<{
|
|
190
|
+
avaxOut: string;
|
|
191
|
+
arenaIn: string;
|
|
192
|
+
rate: string;
|
|
193
|
+
}>;
|
|
194
|
+
/** Build unsigned tx to buy ARENA with AVAX via LFJ DEX */
|
|
195
|
+
buildBuy(wallet: string, avaxAmount: string, slippageBps?: number): Promise<{
|
|
196
|
+
transactions: UnsignedTx[];
|
|
197
|
+
summary: string;
|
|
198
|
+
}>;
|
|
199
|
+
/** Build unsigned txs to sell ARENA for AVAX: [approve, swap] */
|
|
200
|
+
buildSell(wallet: string, arenaAmount: string, slippageBps?: number): Promise<{
|
|
201
|
+
transactions: UnsignedTx[];
|
|
202
|
+
}>;
|
|
167
203
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
204
|
+
|
|
205
|
+
declare class StakingModule {
|
|
206
|
+
private provider;
|
|
207
|
+
private arenaToken;
|
|
208
|
+
private staking;
|
|
209
|
+
constructor(provider: JsonRpcProvider);
|
|
210
|
+
/** Get staking info — staked amount, pending rewards */
|
|
211
|
+
getInfo(wallet: string): Promise<{
|
|
212
|
+
staked: string;
|
|
213
|
+
stakedFormatted: string;
|
|
214
|
+
rewards: string;
|
|
215
|
+
rewardsFormatted: string;
|
|
216
|
+
}>;
|
|
217
|
+
/** Build txs to stake ARENA: [approve, deposit] */
|
|
218
|
+
buildStake(wallet: string, amount: string): Promise<{
|
|
219
|
+
transactions: UnsignedTx[];
|
|
220
|
+
}>;
|
|
221
|
+
/** Build tx to unstake ARENA + claim rewards */
|
|
222
|
+
buildUnstake(wallet: string, amount: string): Promise<{
|
|
223
|
+
transactions: UnsignedTx[];
|
|
224
|
+
}>;
|
|
225
|
+
/** Build buy-and-stake flow (3 txs): buy ARENA via LFJ, approve, stake */
|
|
226
|
+
buildBuyAndStake(wallet: string, avaxAmount: string, slippageBps?: number): Promise<{
|
|
227
|
+
transactions: UnsignedTx[];
|
|
228
|
+
}>;
|
|
171
229
|
}
|
|
172
|
-
|
|
173
|
-
|
|
230
|
+
|
|
231
|
+
declare class LaunchpadModule {
|
|
232
|
+
private provider;
|
|
233
|
+
private launchContract;
|
|
234
|
+
private tokenManager;
|
|
235
|
+
private avaxHelper;
|
|
236
|
+
constructor(provider: JsonRpcProvider);
|
|
237
|
+
private isArenaPaired;
|
|
238
|
+
private getContract;
|
|
239
|
+
/** Get platform overview — total tokens, fees, contract addresses */
|
|
240
|
+
getOverview(): Promise<{
|
|
241
|
+
totalAvaxPairedTokens: string;
|
|
242
|
+
totalArenaPairedTokens: string;
|
|
243
|
+
totalTokens: string;
|
|
244
|
+
protocolFeeBps: {
|
|
245
|
+
avaxPaired: any;
|
|
246
|
+
arenaPaired: any;
|
|
247
|
+
};
|
|
248
|
+
contracts: {
|
|
249
|
+
launchContract: string;
|
|
250
|
+
tokenManager: string;
|
|
251
|
+
avaxHelper: string;
|
|
252
|
+
};
|
|
253
|
+
}>;
|
|
254
|
+
/** Get full token info by ID */
|
|
255
|
+
getToken(tokenId: string): Promise<{
|
|
256
|
+
tokenId: string;
|
|
257
|
+
type: string;
|
|
174
258
|
name: string;
|
|
175
259
|
symbol: string;
|
|
176
|
-
|
|
177
|
-
|
|
260
|
+
tokenAddress: any;
|
|
261
|
+
creator: any;
|
|
262
|
+
priceAvax: string;
|
|
263
|
+
graduationProgress: string;
|
|
264
|
+
graduated: any;
|
|
265
|
+
amountSold: string;
|
|
266
|
+
totalSupply: string;
|
|
267
|
+
remainingForSale: string;
|
|
268
|
+
}>;
|
|
269
|
+
/** Get a buy or sell quote */
|
|
270
|
+
quote(tokenId: string, side: "buy" | "sell", amount: string): Promise<{
|
|
178
271
|
tokenId: string;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
interface BuildCreateResponse {
|
|
221
|
-
transaction: UnsignedTx;
|
|
222
|
-
nextTokenId: string;
|
|
223
|
-
}
|
|
224
|
-
interface DexTokenEntry {
|
|
225
|
-
symbol: string;
|
|
226
|
-
address: string;
|
|
227
|
-
decimals: number;
|
|
228
|
-
}
|
|
229
|
-
interface DexTokensResponse {
|
|
230
|
-
tokens: DexTokenEntry[];
|
|
231
|
-
note: string;
|
|
232
|
-
}
|
|
233
|
-
interface DexTokenInfoResponse {
|
|
234
|
-
address: string;
|
|
235
|
-
symbol: string;
|
|
236
|
-
name: string;
|
|
237
|
-
decimals: number;
|
|
238
|
-
}
|
|
239
|
-
interface DexQuoteResponse {
|
|
240
|
-
from: string;
|
|
241
|
-
to: string;
|
|
242
|
-
amountIn: string;
|
|
243
|
-
amountOut: string;
|
|
244
|
-
rate: string;
|
|
245
|
-
priceImpact: string;
|
|
246
|
-
path: string[];
|
|
247
|
-
}
|
|
248
|
-
interface DexBalanceResponse {
|
|
249
|
-
wallet: string;
|
|
250
|
-
token: string;
|
|
251
|
-
balance: string;
|
|
252
|
-
formatted: string;
|
|
253
|
-
symbol: string;
|
|
254
|
-
}
|
|
255
|
-
interface DexSwapResponse {
|
|
256
|
-
transactions: UnsignedTx[];
|
|
257
|
-
summary: string;
|
|
258
|
-
}
|
|
259
|
-
interface PerpsSetupResponse {
|
|
260
|
-
success: boolean;
|
|
261
|
-
message: string;
|
|
272
|
+
side: "buy";
|
|
273
|
+
avaxIn: string;
|
|
274
|
+
tokensOut: string;
|
|
275
|
+
note: string;
|
|
276
|
+
tokenAmount?: undefined;
|
|
277
|
+
rewardAvax?: undefined;
|
|
278
|
+
rewardArena?: undefined;
|
|
279
|
+
} | {
|
|
280
|
+
tokenId: string;
|
|
281
|
+
side: "buy";
|
|
282
|
+
avaxIn: string;
|
|
283
|
+
tokensOut: string;
|
|
284
|
+
note?: undefined;
|
|
285
|
+
tokenAmount?: undefined;
|
|
286
|
+
rewardAvax?: undefined;
|
|
287
|
+
rewardArena?: undefined;
|
|
288
|
+
} | {
|
|
289
|
+
tokenId: string;
|
|
290
|
+
side: "sell";
|
|
291
|
+
tokenAmount: string;
|
|
292
|
+
rewardAvax: string | undefined;
|
|
293
|
+
rewardArena: string | undefined;
|
|
294
|
+
avaxIn?: undefined;
|
|
295
|
+
tokensOut?: undefined;
|
|
296
|
+
note?: undefined;
|
|
297
|
+
}>;
|
|
298
|
+
/** Get recent token launches */
|
|
299
|
+
getRecent(count?: number): Promise<{
|
|
300
|
+
count: number;
|
|
301
|
+
tokens: any[];
|
|
302
|
+
}>;
|
|
303
|
+
/** Build unsigned tx to buy a launchpad token */
|
|
304
|
+
buildBuy(wallet: string, tokenId: string, avax: string, slippageBps?: number): Promise<{
|
|
305
|
+
transactions: UnsignedTx[];
|
|
306
|
+
}>;
|
|
307
|
+
/** Build unsigned txs to sell a launchpad token: [approve, sell] */
|
|
308
|
+
buildSell(wallet: string, tokenId: string, amount: string, slippageBps?: number): Promise<{
|
|
309
|
+
transactions: UnsignedTx[];
|
|
310
|
+
}>;
|
|
311
|
+
/** Binary search for max tokens purchasable with given AVAX */
|
|
312
|
+
private binarySearchTokenAmount;
|
|
262
313
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
marginMode: string;
|
|
278
|
-
}
|
|
279
|
-
interface PerpsTradingPairsResponse {
|
|
280
|
-
pairs: PerpsTradingPair[];
|
|
281
|
-
cachedAt: string;
|
|
282
|
-
count: number;
|
|
283
|
-
}
|
|
284
|
-
interface PerpsOrderResponse {
|
|
285
|
-
[key: string]: any;
|
|
286
|
-
}
|
|
287
|
-
interface PerpsPositionsResponse {
|
|
288
|
-
assetPositions?: any[];
|
|
289
|
-
marginSummary?: {
|
|
290
|
-
accountValue: string;
|
|
291
|
-
totalMarginUsed: string;
|
|
292
|
-
totalNtlPos: string;
|
|
293
|
-
totalRawUsd: string;
|
|
314
|
+
|
|
315
|
+
declare class DexModule {
|
|
316
|
+
private provider;
|
|
317
|
+
private lbQuoter;
|
|
318
|
+
constructor(provider: JsonRpcProvider);
|
|
319
|
+
/** Resolve token symbol or address to a checksummed address */
|
|
320
|
+
private resolveToken;
|
|
321
|
+
/** List known tokens */
|
|
322
|
+
getTokens(): {
|
|
323
|
+
tokens: Array<{
|
|
324
|
+
symbol: string;
|
|
325
|
+
address: string;
|
|
326
|
+
}>;
|
|
327
|
+
note: string;
|
|
294
328
|
};
|
|
295
|
-
|
|
329
|
+
/** Look up any ERC-20 token by address */
|
|
330
|
+
getTokenInfo(address: string): Promise<{
|
|
331
|
+
address: string;
|
|
332
|
+
symbol: string;
|
|
333
|
+
name: string;
|
|
334
|
+
decimals: number;
|
|
335
|
+
}>;
|
|
336
|
+
/** Get balance of any token */
|
|
337
|
+
getBalance(wallet: string, tokenOrAddress: string): Promise<{
|
|
338
|
+
wallet: string;
|
|
339
|
+
token: string;
|
|
340
|
+
balance: string;
|
|
341
|
+
formatted: string;
|
|
342
|
+
symbol: string;
|
|
343
|
+
}>;
|
|
344
|
+
/** Quote a swap between any two tokens */
|
|
345
|
+
quote(from: string, to: string, amount: string): Promise<{
|
|
346
|
+
from: string;
|
|
347
|
+
to: string;
|
|
348
|
+
amountIn: string;
|
|
349
|
+
amountOut: string;
|
|
350
|
+
rate: string;
|
|
351
|
+
path: string[];
|
|
352
|
+
}>;
|
|
353
|
+
/** Build swap transactions (1 tx for AVAX→token, 2 txs for token→token with approve) */
|
|
354
|
+
buildSwap(wallet: string, from: string, to: string, amount: string, slippageBps?: number): Promise<{
|
|
355
|
+
transactions: UnsignedTx[];
|
|
356
|
+
summary: string;
|
|
357
|
+
}>;
|
|
296
358
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
359
|
+
|
|
360
|
+
declare class PerpsModule {
|
|
361
|
+
private arenaApiKey?;
|
|
362
|
+
constructor(arenaApiKey?: string | undefined);
|
|
363
|
+
setArenaApiKey(key: string): void;
|
|
364
|
+
private arenaRequest;
|
|
365
|
+
private hlPost;
|
|
366
|
+
register(): Promise<any>;
|
|
367
|
+
getRegistrationStatus(): Promise<any>;
|
|
368
|
+
getWalletAddress(): Promise<any>;
|
|
369
|
+
getAuthStatus(): Promise<any>;
|
|
370
|
+
getAuthPayload(step: string, mainWalletAddress?: string): Promise<any>;
|
|
371
|
+
submitAuthSignature(step: string, signature: string, mainWalletAddress?: string, metadata?: any): Promise<any>;
|
|
372
|
+
enableHip3(): Promise<any>;
|
|
373
|
+
getTradingPairs(): Promise<{
|
|
374
|
+
pairs: any[];
|
|
375
|
+
count: number;
|
|
376
|
+
}>;
|
|
377
|
+
updateLeverage(symbol: string, leverage: number, leverageType?: "cross" | "isolated"): Promise<any>;
|
|
378
|
+
placeOrder(orders: any[]): Promise<any>;
|
|
379
|
+
cancelOrders(cancels: {
|
|
380
|
+
assetIndex: number;
|
|
381
|
+
oid: number;
|
|
382
|
+
}[]): Promise<any>;
|
|
383
|
+
closePosition(symbol: string, positionSide: "long" | "short", size: number, currentPrice: number, closePercent?: number): Promise<any>;
|
|
384
|
+
getOrders(): Promise<any>;
|
|
385
|
+
getTradeExecutions(): Promise<any>;
|
|
386
|
+
getPositions(wallet: string): Promise<any>;
|
|
387
|
+
getOpenOrders(wallet: string): Promise<any>;
|
|
303
388
|
}
|
|
389
|
+
|
|
304
390
|
interface BridgeQuoteResponse {
|
|
305
391
|
id: string;
|
|
306
392
|
fromChainId: number;
|
|
@@ -312,11 +398,13 @@ interface BridgeQuoteResponse {
|
|
|
312
398
|
estimatedGas: string;
|
|
313
399
|
estimatedTime: number;
|
|
314
400
|
tool: string;
|
|
315
|
-
transaction?:
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
401
|
+
transaction?: {
|
|
402
|
+
to: string;
|
|
403
|
+
data: string;
|
|
404
|
+
value: string;
|
|
405
|
+
gasLimit?: string;
|
|
406
|
+
chainId: number;
|
|
407
|
+
};
|
|
320
408
|
}
|
|
321
409
|
interface BridgeStatusResponse {
|
|
322
410
|
status: "NOT_FOUND" | "PENDING" | "DONE" | "FAILED";
|
|
@@ -347,520 +435,484 @@ interface BridgeLiFiChain {
|
|
|
347
435
|
address: string;
|
|
348
436
|
};
|
|
349
437
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
438
|
+
declare class BridgeModule {
|
|
439
|
+
getChains(): Promise<{
|
|
440
|
+
chains: BridgeLiFiChain[];
|
|
441
|
+
count: number;
|
|
442
|
+
}>;
|
|
443
|
+
getTokens(chains: string): Promise<{
|
|
444
|
+
tokens: Record<string, BridgeLiFiToken[]>;
|
|
445
|
+
}>;
|
|
446
|
+
getToken(chainId: number, address: string): Promise<BridgeLiFiToken>;
|
|
447
|
+
getConnections(fromChainId: number, toChainId: number, fromToken?: string, toToken?: string): Promise<{
|
|
448
|
+
connections: any[];
|
|
449
|
+
}>;
|
|
450
|
+
getQuote(fromChainId: number, toChainId: number, fromToken: string, toToken: string, fromAmount: string, fromAddress: string, toAddress?: string, slippage?: number, fromDecimals?: number): Promise<BridgeQuoteResponse>;
|
|
451
|
+
getRoutes(fromChainId: number, toChainId: number, fromToken: string, toToken: string, fromAmount: string, fromAddress: string, toAddress?: string, slippage?: number, fromDecimals?: number): Promise<{
|
|
452
|
+
routes: BridgeQuoteResponse[];
|
|
453
|
+
count: number;
|
|
454
|
+
}>;
|
|
455
|
+
getStatus(txHash: string, fromChainId: number, toChainId: number, bridge?: string): Promise<BridgeStatusResponse>;
|
|
456
|
+
getInfo(): {
|
|
457
|
+
chains: {
|
|
458
|
+
readonly ethereum: 1;
|
|
459
|
+
readonly base: 8453;
|
|
460
|
+
readonly arbitrum: 42161;
|
|
461
|
+
readonly optimism: 10;
|
|
462
|
+
readonly polygon: 137;
|
|
463
|
+
readonly bsc: 56;
|
|
464
|
+
readonly avalanche: 43114;
|
|
465
|
+
readonly fantom: 250;
|
|
466
|
+
readonly gnosis: 100;
|
|
467
|
+
readonly zksync: 324;
|
|
468
|
+
readonly linea: 59144;
|
|
469
|
+
readonly scroll: 534352;
|
|
470
|
+
readonly blast: 81457;
|
|
471
|
+
readonly mantle: 5000;
|
|
472
|
+
};
|
|
473
|
+
usdc: Record<string, string>;
|
|
474
|
+
nativeToken: string;
|
|
475
|
+
tip: string;
|
|
476
|
+
};
|
|
477
|
+
private parseUnits;
|
|
478
|
+
private parseQuote;
|
|
479
|
+
private parseRoute;
|
|
358
480
|
}
|
|
359
|
-
|
|
360
|
-
|
|
481
|
+
|
|
482
|
+
interface TicketPriceResponse {
|
|
483
|
+
price: string;
|
|
484
|
+
priceWithFee?: string;
|
|
485
|
+
priceAfterFee?: string;
|
|
486
|
+
tickets: string;
|
|
487
|
+
fractionalAmount: number;
|
|
488
|
+
}
|
|
489
|
+
interface TicketBalanceResponse {
|
|
490
|
+
tickets: string;
|
|
491
|
+
fractionalAmount: string;
|
|
492
|
+
}
|
|
493
|
+
interface TicketSupplyResponse {
|
|
494
|
+
wholeSupply: string;
|
|
495
|
+
fractionalSupply: string;
|
|
496
|
+
tickets: string;
|
|
497
|
+
}
|
|
498
|
+
interface TicketFeesResponse {
|
|
499
|
+
protocolFee: string;
|
|
500
|
+
subjectFee: string;
|
|
501
|
+
referralFee: string;
|
|
502
|
+
totalFeePercent: string;
|
|
503
|
+
}
|
|
504
|
+
declare class TicketsModule {
|
|
505
|
+
private provider;
|
|
506
|
+
private contract;
|
|
507
|
+
constructor(provider: JsonRpcProvider);
|
|
508
|
+
getBuyPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
|
|
509
|
+
getSellPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
|
|
510
|
+
getBalance(subject: string, user: string): Promise<TicketBalanceResponse>;
|
|
511
|
+
getSupply(subject: string): Promise<TicketSupplyResponse>;
|
|
512
|
+
getFees(): Promise<TicketFeesResponse>;
|
|
513
|
+
buildBuyTx(wallet: string, subject: string, amount?: string): Promise<{
|
|
514
|
+
transaction: UnsignedTx;
|
|
515
|
+
}>;
|
|
516
|
+
buildSellTx(wallet: string, subject: string, amount?: string): Promise<{
|
|
517
|
+
transaction: UnsignedTx;
|
|
518
|
+
}>;
|
|
519
|
+
private ticketsToFractional;
|
|
361
520
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
521
|
+
|
|
522
|
+
declare class SocialModule {
|
|
523
|
+
private arenaApiKey?;
|
|
524
|
+
constructor(arenaApiKey?: string | undefined);
|
|
525
|
+
setArenaApiKey(key: string): void;
|
|
526
|
+
private request;
|
|
527
|
+
searchUsers(q: string, page?: number, pageSize?: number): Promise<any>;
|
|
528
|
+
getUserByHandle(handle: string): Promise<any>;
|
|
529
|
+
getUserById(userId: string): Promise<any>;
|
|
530
|
+
getTopUsers(page?: number, pageSize?: number): Promise<any>;
|
|
531
|
+
getMe(): Promise<any>;
|
|
532
|
+
updateProfile(updates: {
|
|
533
|
+
userName?: string;
|
|
534
|
+
bio?: string;
|
|
535
|
+
profilePicture?: string;
|
|
536
|
+
}): Promise<any>;
|
|
537
|
+
updateBanner(bannerUrl: string): Promise<any>;
|
|
538
|
+
follow(userId: string): Promise<any>;
|
|
539
|
+
unfollow(userId: string): Promise<any>;
|
|
540
|
+
getFollowers(userId: string, page?: number, pageSize?: number): Promise<any>;
|
|
541
|
+
getFollowing(userId: string, page?: number, pageSize?: number): Promise<any>;
|
|
542
|
+
getSharesStats(userId: string): Promise<any>;
|
|
543
|
+
getShareHolders(userId?: string, page?: number, pageSize?: number): Promise<any>;
|
|
544
|
+
getHoldings(page?: number, pageSize?: number): Promise<any>;
|
|
545
|
+
getConversations(page?: number): Promise<any>;
|
|
546
|
+
getDirectMessages(): Promise<any>;
|
|
547
|
+
getGroupChats(): Promise<any>;
|
|
548
|
+
getGroup(groupId: string): Promise<any>;
|
|
549
|
+
getMembers(groupId: string): Promise<any>;
|
|
550
|
+
getOrCreateDM(userId: string): Promise<any>;
|
|
551
|
+
acceptChat(groupId: string): Promise<any>;
|
|
552
|
+
sendMessage(groupId: string, text: string, replyId?: string): Promise<any>;
|
|
553
|
+
getMessages(groupId: string, after?: string): Promise<any>;
|
|
554
|
+
searchMessages(q: string, groupId?: string): Promise<any>;
|
|
555
|
+
getMentions(groupId?: string): Promise<any>;
|
|
556
|
+
react(messageId: string, groupId: string, reaction: string): Promise<any>;
|
|
557
|
+
pinMessage(messageId: string, groupId: string, isPinned?: boolean): Promise<any>;
|
|
558
|
+
getPinnedMessages(groupId: string): Promise<any>;
|
|
559
|
+
createThread(content: string, replyToId?: string): Promise<any>;
|
|
560
|
+
likeThread(threadId: string): Promise<any>;
|
|
561
|
+
repost(threadId: string): Promise<any>;
|
|
367
562
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
563
|
+
|
|
564
|
+
interface HlAssetCtx {
|
|
565
|
+
coin: string;
|
|
566
|
+
markPx: string;
|
|
567
|
+
midPx: string;
|
|
568
|
+
oraclePx: string;
|
|
569
|
+
openInterest: string;
|
|
570
|
+
funding: string;
|
|
571
|
+
premium: string;
|
|
572
|
+
dayNtlVlm: string;
|
|
573
|
+
prevDayPx: string;
|
|
574
|
+
}
|
|
575
|
+
interface HlMeta {
|
|
371
576
|
name: string;
|
|
577
|
+
szDecimals: number;
|
|
578
|
+
maxLeverage: number;
|
|
372
579
|
}
|
|
373
|
-
interface
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
constructor(http: HttpClient, auth: () => Promise<void>);
|
|
386
|
-
/**
|
|
387
|
-
* Get AVAX and ARENA token balances for a wallet.
|
|
388
|
-
* @param wallet - Wallet address to check
|
|
389
|
-
*/
|
|
390
|
-
getBalances(wallet: string): Promise<BalancesResponse>;
|
|
391
|
-
/**
|
|
392
|
-
* Quote how much ARENA you get for a given amount of AVAX.
|
|
393
|
-
* @param avax - Amount of AVAX to spend
|
|
394
|
-
*/
|
|
395
|
-
quote(avax: string): Promise<BuyQuoteResponse>;
|
|
396
|
-
/**
|
|
397
|
-
* Quote how much AVAX you get for selling a given amount of ARENA.
|
|
398
|
-
* @param arena - Amount of ARENA to sell
|
|
399
|
-
*/
|
|
400
|
-
sellQuote(arena: string): Promise<SellQuoteResponse>;
|
|
401
|
-
/**
|
|
402
|
-
* Build unsigned transaction to buy ARENA with AVAX.
|
|
403
|
-
*
|
|
404
|
-
* Sign the transaction, then broadcast via `client.broadcast()`.
|
|
405
|
-
*
|
|
406
|
-
* @param wallet - Your wallet address
|
|
407
|
-
* @param avax - Amount of AVAX to spend
|
|
408
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
409
|
-
*/
|
|
410
|
-
buildBuy(wallet: string, avax: string, slippage?: number): Promise<SwapBuyResponse>;
|
|
411
|
-
/**
|
|
412
|
-
* Build unsigned transactions to sell ARENA for AVAX.
|
|
413
|
-
*
|
|
414
|
-
* Returns 2 transactions — execute in order:
|
|
415
|
-
* 1. Approve — allows the DEX router to spend your ARENA
|
|
416
|
-
* 2. Swap — executes the ARENA → AVAX swap
|
|
417
|
-
*
|
|
418
|
-
* Sign each, broadcast via `client.broadcast()`, wait for confirmation before the next.
|
|
419
|
-
*
|
|
420
|
-
* @param wallet - Your wallet address
|
|
421
|
-
* @param amount - Amount of ARENA to sell, or "max" for entire balance
|
|
422
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
423
|
-
*/
|
|
424
|
-
buildSell(wallet: string, amount: string, slippage?: number): Promise<SwapSellResponse>;
|
|
580
|
+
interface MarketSignal {
|
|
581
|
+
coin: string;
|
|
582
|
+
price: number;
|
|
583
|
+
oraclePrice: number;
|
|
584
|
+
change24h: number;
|
|
585
|
+
change24hPct: number;
|
|
586
|
+
volume24h: number;
|
|
587
|
+
openInterest: number;
|
|
588
|
+
fundingRate: number;
|
|
589
|
+
fundingAnnualized: number;
|
|
590
|
+
fundingBias: "long-heavy" | "short-heavy" | "neutral";
|
|
591
|
+
maxLeverage: number;
|
|
425
592
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
buildBuyAndStake(wallet: string, avax: string, slippage?: number): Promise<StakeBuildResponse>;
|
|
457
|
-
/**
|
|
458
|
-
* Build unsigned transaction to unstake ARENA tokens and claim rewards.
|
|
459
|
-
* @param wallet - Your wallet address
|
|
460
|
-
* @param amount - Amount of ARENA to unstake
|
|
461
|
-
*/
|
|
462
|
-
buildUnstake(wallet: string, amount: string): Promise<UnsignedTx>;
|
|
593
|
+
interface TechnicalSignal {
|
|
594
|
+
coin: string;
|
|
595
|
+
price: number;
|
|
596
|
+
sma20: number;
|
|
597
|
+
sma50: number;
|
|
598
|
+
rsi14: number;
|
|
599
|
+
trend: "bullish" | "bearish" | "neutral";
|
|
600
|
+
momentum: "strong" | "moderate" | "weak";
|
|
601
|
+
priceVsSma20: number;
|
|
602
|
+
priceVsSma50: number;
|
|
603
|
+
volatility: number;
|
|
604
|
+
support: number;
|
|
605
|
+
resistance: number;
|
|
606
|
+
}
|
|
607
|
+
interface SignalSummary {
|
|
608
|
+
coin: string;
|
|
609
|
+
timestamp: string;
|
|
610
|
+
market: MarketSignal;
|
|
611
|
+
technical: TechnicalSignal;
|
|
612
|
+
whaleActivity: {
|
|
613
|
+
topLongs: any[];
|
|
614
|
+
topShorts: any[];
|
|
615
|
+
netBias: "long" | "short" | "neutral";
|
|
616
|
+
largestPosition: any | null;
|
|
617
|
+
};
|
|
618
|
+
verdict: {
|
|
619
|
+
direction: "long" | "short" | "wait";
|
|
620
|
+
confidence: "high" | "medium" | "low";
|
|
621
|
+
reasons: string[];
|
|
622
|
+
};
|
|
463
623
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
private
|
|
467
|
-
private
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
* @param type - Filter: "all", "avax" (AVAX-paired), or "arena" (ARENA-paired)
|
|
473
|
-
*/
|
|
474
|
-
getRecent(count?: number, type?: "all" | "avax" | "arena"): Promise<LaunchpadListResponse>;
|
|
475
|
-
/**
|
|
476
|
-
* Search for a token by name, symbol, or contract address.
|
|
477
|
-
* @param q - Search query — name, symbol, or 0x contract address
|
|
478
|
-
*/
|
|
479
|
-
search(q: string): Promise<LaunchpadListResponse | LaunchpadToken>;
|
|
480
|
-
/**
|
|
481
|
-
* Get tokens that are closest to graduating from the bonding curve to DEX.
|
|
482
|
-
* @param count - Number of tokens (max 20, default 5)
|
|
483
|
-
*/
|
|
484
|
-
getGraduating(count?: number): Promise<LaunchpadListResponse>;
|
|
485
|
-
/**
|
|
486
|
-
* Get tokens that have already graduated from the bonding curve to DEX.
|
|
487
|
-
* @param count - Number of tokens (max 50, default 10)
|
|
488
|
-
*/
|
|
489
|
-
getGraduated(count?: number): Promise<LaunchpadListResponse>;
|
|
490
|
-
/**
|
|
491
|
-
* Get top tokens by trading volume.
|
|
492
|
-
* @param timeframe - "5m", "1h", "4h", "24h", or "all_time"
|
|
493
|
-
* @param count - Number of tokens (max 50, default 10)
|
|
494
|
-
*/
|
|
495
|
-
getTopVolume(timeframe?: "5m" | "1h" | "4h" | "24h" | "all_time", count?: number): Promise<LaunchpadListResponse & {
|
|
496
|
-
timeframe: string;
|
|
624
|
+
declare class SignalsModule {
|
|
625
|
+
private assetCache;
|
|
626
|
+
private candleCache;
|
|
627
|
+
private hlPost;
|
|
628
|
+
/** Get all asset contexts (cached 10s) */
|
|
629
|
+
getAssetContexts(): Promise<{
|
|
630
|
+
meta: HlMeta[];
|
|
631
|
+
contexts: HlAssetCtx[];
|
|
497
632
|
}>;
|
|
498
|
-
/**
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
getMarketCap(tokenId: string): Promise<unknown>;
|
|
521
|
-
/**
|
|
522
|
-
* Get recent trade activity for a token.
|
|
523
|
-
* @param tokenId - Arena token ID
|
|
524
|
-
* @param address - Or token contract address
|
|
525
|
-
* @param count - Number of trades (max 50, default 20)
|
|
526
|
-
*/
|
|
527
|
-
getActivity(tokenId?: string, address?: string, count?: number): Promise<TokenActivityResponse>;
|
|
528
|
-
/**
|
|
529
|
-
* Get top holders for a token with PnL data.
|
|
530
|
-
* @param address - Token contract address
|
|
531
|
-
* @param tokenId - Or Arena token ID
|
|
532
|
-
* @param count - Number of holders (max 50, default 20)
|
|
533
|
-
*/
|
|
534
|
-
getHolders(address?: string, tokenId?: string, count?: number): Promise<TokenHoldersResponse>;
|
|
535
|
-
/**
|
|
536
|
-
* Get platform overview — total tokens launched, contract addresses, stats.
|
|
537
|
-
*/
|
|
538
|
-
getOverview(): Promise<unknown>;
|
|
539
|
-
/**
|
|
540
|
-
* Get the global trade feed across all launchpad tokens.
|
|
541
|
-
* @param count - Number of trades (max 100, default 50)
|
|
542
|
-
* @param offset - Pagination offset
|
|
543
|
-
*/
|
|
544
|
-
getTrades(count?: number, offset?: number): Promise<GlobalTradesResponse>;
|
|
545
|
-
/**
|
|
546
|
-
* Launch a new token on Arena — uploads image, creates community, and returns the unsigned createToken transaction.
|
|
547
|
-
*
|
|
548
|
-
* @param wallet - Creator wallet address
|
|
549
|
-
* @param name - Token name (also used as community name)
|
|
550
|
-
* @param symbol - Token ticker symbol
|
|
551
|
-
* @param imageBase64 - Token image as base64 string (optional)
|
|
552
|
-
* @param paymentToken - "avax" or "arena" (default: "arena")
|
|
553
|
-
* @param initialBuyAvax - AVAX amount for initial buy at creation (default: "0")
|
|
554
|
-
*/
|
|
555
|
-
launch(wallet: string, name: string, symbol: string, imageBase64?: string, paymentToken?: "avax" | "arena", initialBuyAvax?: string): Promise<LaunchTokenResponse>;
|
|
556
|
-
/**
|
|
557
|
-
* Upload a token image to Arena's CDN and get the hosted URL.
|
|
558
|
-
* Use this before launch() if you want to preview the image URL first.
|
|
559
|
-
*
|
|
560
|
-
* @param imageBase64 - Image as base64 string
|
|
561
|
-
* @param fileType - MIME type (default: "image/jpeg")
|
|
562
|
-
*/
|
|
563
|
-
uploadImage(imageBase64: string, fileType?: string): Promise<UploadImageResponse>;
|
|
564
|
-
/**
|
|
565
|
-
* Build only the createToken transaction (no image or community creation).
|
|
566
|
-
* Useful if you want to handle image upload and community creation separately.
|
|
567
|
-
*
|
|
568
|
-
* @param wallet - Creator wallet address
|
|
569
|
-
* @param name - Token name
|
|
570
|
-
* @param symbol - Token ticker symbol
|
|
571
|
-
* @param paymentToken - "avax" or "arena" (default: "arena")
|
|
572
|
-
* @param initialBuyAvax - AVAX for initial buy (default: "0")
|
|
573
|
-
*/
|
|
574
|
-
buildCreate(wallet: string, name: string, symbol: string, paymentToken?: "avax" | "arena", initialBuyAvax?: string): Promise<BuildCreateResponse>;
|
|
575
|
-
/**
|
|
576
|
-
* Build unsigned transaction to buy a launchpad token with AVAX.
|
|
577
|
-
*
|
|
578
|
-
* Auto-detects if the token is AVAX-paired or ARENA-paired and routes accordingly.
|
|
579
|
-
* If the token has graduated to DEX, returns transactions for DEX swap instead.
|
|
580
|
-
*
|
|
581
|
-
* @param wallet - Your wallet address
|
|
582
|
-
* @param tokenId - Arena token ID
|
|
583
|
-
* @param avax - Amount of AVAX to spend
|
|
584
|
-
* @param slippage - Slippage in basis points (default: 500 = 5%)
|
|
585
|
-
*/
|
|
586
|
-
buildBuy(wallet: string, tokenId: string, avax: string, slippage?: number): Promise<LaunchpadBuyResponse>;
|
|
587
|
-
/**
|
|
588
|
-
* Build unsigned transaction(s) to sell a launchpad token.
|
|
589
|
-
*
|
|
590
|
-
* Returns approve + sell transactions. Execute in order.
|
|
591
|
-
* Use amount="max" to sell entire balance.
|
|
592
|
-
*
|
|
593
|
-
* If the token has graduated to DEX, returns transactions for DEX swap instead.
|
|
594
|
-
*
|
|
595
|
-
* @param wallet - Your wallet address
|
|
596
|
-
* @param tokenId - Arena token ID
|
|
597
|
-
* @param amount - Token amount to sell, or "max" for entire balance
|
|
598
|
-
* @param slippage - Slippage in basis points (default: 500 = 5%)
|
|
599
|
-
*/
|
|
600
|
-
buildSell(wallet: string, tokenId: string, amount: string, slippage?: number): Promise<LaunchpadSellResponse>;
|
|
633
|
+
/** Get market signal for a specific asset */
|
|
634
|
+
getMarketSignal(coin: string): Promise<MarketSignal>;
|
|
635
|
+
/** Get funding rate extremes across all markets */
|
|
636
|
+
getFundingExtremes(count?: number): Promise<{
|
|
637
|
+
mostPositive: MarketSignal[];
|
|
638
|
+
mostNegative: MarketSignal[];
|
|
639
|
+
}>;
|
|
640
|
+
/** Get candle data for technical analysis (cached 60s) */
|
|
641
|
+
getCandles(coin: string, interval?: string, count?: number): Promise<number[][]>;
|
|
642
|
+
/** Compute technical signals from candle data */
|
|
643
|
+
getTechnicalSignal(coin: string, interval?: string): Promise<TechnicalSignal>;
|
|
644
|
+
/** Get whale positions from orderbook depth */
|
|
645
|
+
getWhalePositions(coin: string, minPositionUsd?: number): Promise<any[]>;
|
|
646
|
+
/** Full signal summary — everything an agent needs to decide */
|
|
647
|
+
summary(coin: string): Promise<SignalSummary>;
|
|
648
|
+
/** Scan for top trading opportunities */
|
|
649
|
+
scan(count?: number): Promise<SignalSummary[]>;
|
|
650
|
+
private getTopMovers;
|
|
651
|
+
private buildSignal;
|
|
652
|
+
private sma;
|
|
653
|
+
private rsi;
|
|
654
|
+
private intervalToMs;
|
|
601
655
|
}
|
|
602
656
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
*/
|
|
611
|
-
getTokens(): Promise<DexTokensResponse>;
|
|
612
|
-
/**
|
|
613
|
-
* Get on-chain info for any token by contract address — name, symbol, decimals.
|
|
614
|
-
* @param address - Token contract address (0x...)
|
|
615
|
-
*/
|
|
616
|
-
getTokenInfo(address: string): Promise<DexTokenInfoResponse>;
|
|
617
|
-
/**
|
|
618
|
-
* Quote a swap between any two tokens on Avalanche.
|
|
619
|
-
* @param from - Source token symbol or contract address
|
|
620
|
-
* @param to - Destination token symbol or contract address
|
|
621
|
-
* @param amount - Amount of source token to swap
|
|
622
|
-
*/
|
|
623
|
-
quote(from: string, to: string, amount: string): Promise<DexQuoteResponse>;
|
|
624
|
-
/**
|
|
625
|
-
* Get the balance of any token for a wallet.
|
|
626
|
-
* @param wallet - Wallet address
|
|
627
|
-
* @param token - Token symbol or contract address
|
|
628
|
-
*/
|
|
629
|
-
getBalance(wallet: string, token: string): Promise<DexBalanceResponse>;
|
|
630
|
-
/**
|
|
631
|
-
* Build unsigned transaction(s) to swap any token pair on Avalanche via LFJ/Pharaoh DEX.
|
|
632
|
-
*
|
|
633
|
-
* May return multiple transactions (approve + swap). Execute in order.
|
|
634
|
-
*
|
|
635
|
-
* @param wallet - Your wallet address
|
|
636
|
-
* @param from - Source token symbol or contract address
|
|
637
|
-
* @param to - Destination token symbol or contract address
|
|
638
|
-
* @param amount - Amount to swap, or "max" for entire balance
|
|
639
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
640
|
-
*/
|
|
641
|
-
buildSwap(wallet: string, from: string, to: string, amount: string, slippage?: number): Promise<DexSwapResponse>;
|
|
657
|
+
interface PriceData {
|
|
658
|
+
[coinId: string]: {
|
|
659
|
+
usd: number;
|
|
660
|
+
usd_24h_change?: number;
|
|
661
|
+
usd_market_cap?: number;
|
|
662
|
+
usd_24h_vol?: number;
|
|
663
|
+
};
|
|
642
664
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
/**
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
* Cancel one or more open orders.
|
|
692
|
-
* @param cancels - Array of { assetIndex, oid }
|
|
693
|
-
*/
|
|
694
|
-
cancelOrders(cancels: {
|
|
695
|
-
assetIndex: number;
|
|
696
|
-
oid: number;
|
|
697
|
-
}[]): Promise<any>;
|
|
698
|
-
/**
|
|
699
|
-
* Modify an existing order.
|
|
700
|
-
* @param oid - Order ID to modify
|
|
701
|
-
* @param order - New order parameters
|
|
702
|
-
*/
|
|
703
|
-
modifyOrder(oid: number, order: any): Promise<any>;
|
|
704
|
-
/**
|
|
705
|
-
* Close a position (convenience — creates reduce-only IOC with 10% slippage).
|
|
706
|
-
* @param symbol - Market symbol
|
|
707
|
-
* @param positionSide - "long" or "short"
|
|
708
|
-
* @param size - Position size to close
|
|
709
|
-
* @param currentPrice - Current market price
|
|
710
|
-
* @param closePercent - Percentage to close (default: 100)
|
|
711
|
-
*/
|
|
712
|
-
closePosition(symbol: string, positionSide: "long" | "short", size: number, currentPrice: number, closePercent?: number): Promise<any>;
|
|
713
|
-
/** Get open orders */
|
|
714
|
-
getOrders(): Promise<any>;
|
|
715
|
-
/** Get trade execution history */
|
|
716
|
-
getTradeExecutions(): Promise<any>;
|
|
717
|
-
/**
|
|
718
|
-
* Get positions and margin summary (queries Hyperliquid directly).
|
|
719
|
-
* @param wallet - Your Hyperliquid wallet address (from getWalletAddress)
|
|
720
|
-
*/
|
|
721
|
-
getPositions(wallet: string): Promise<PerpsPositionsResponse>;
|
|
722
|
-
/**
|
|
723
|
-
* Get open orders from Hyperliquid directly.
|
|
724
|
-
* @param wallet - Your Hyperliquid wallet address
|
|
725
|
-
*/
|
|
726
|
-
getOpenOrders(wallet: string): Promise<any>;
|
|
665
|
+
interface TrendingCoin {
|
|
666
|
+
id: string;
|
|
667
|
+
name: string;
|
|
668
|
+
symbol: string;
|
|
669
|
+
market_cap_rank: number;
|
|
670
|
+
thumb: string;
|
|
671
|
+
price_btc: number;
|
|
672
|
+
}
|
|
673
|
+
interface MarketEntry {
|
|
674
|
+
id: string;
|
|
675
|
+
symbol: string;
|
|
676
|
+
name: string;
|
|
677
|
+
current_price: number;
|
|
678
|
+
market_cap: number;
|
|
679
|
+
price_change_percentage_24h: number;
|
|
680
|
+
total_volume: number;
|
|
681
|
+
market_cap_rank: number;
|
|
682
|
+
}
|
|
683
|
+
declare class MarketModule {
|
|
684
|
+
/** Get prices for one or more coins (by CoinGecko ID) */
|
|
685
|
+
price(ids: string | string[]): Promise<PriceData>;
|
|
686
|
+
/** Get trending coins */
|
|
687
|
+
trending(): Promise<{
|
|
688
|
+
coins: TrendingCoin[];
|
|
689
|
+
}>;
|
|
690
|
+
/** Get top coins by market cap */
|
|
691
|
+
markets(count?: number, page?: number): Promise<{
|
|
692
|
+
coins: MarketEntry[];
|
|
693
|
+
}>;
|
|
694
|
+
/** Search for coins by query */
|
|
695
|
+
search(query: string): Promise<{
|
|
696
|
+
coins: Array<{
|
|
697
|
+
id: string;
|
|
698
|
+
name: string;
|
|
699
|
+
symbol: string;
|
|
700
|
+
market_cap_rank: number;
|
|
701
|
+
}>;
|
|
702
|
+
}>;
|
|
703
|
+
/** Get AVAX price specifically */
|
|
704
|
+
avaxPrice(): Promise<{
|
|
705
|
+
usd: number;
|
|
706
|
+
change24h: number;
|
|
707
|
+
}>;
|
|
708
|
+
/** Get ARENA price specifically */
|
|
709
|
+
arenaPrice(): Promise<{
|
|
710
|
+
usd: number;
|
|
711
|
+
change24h: number;
|
|
712
|
+
}>;
|
|
727
713
|
}
|
|
728
714
|
|
|
729
|
-
declare class
|
|
730
|
-
private
|
|
731
|
-
private
|
|
732
|
-
constructor(
|
|
733
|
-
/**
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
* @param fromChainId - Source chain ID
|
|
779
|
-
* @param toChainId - Destination chain ID
|
|
780
|
-
* @param bridge - Optional bridge tool name
|
|
781
|
-
*/
|
|
782
|
-
getStatus(txHash: string, fromChainId: number, toChainId: number, bridge?: string): Promise<BridgeStatusResponse>;
|
|
783
|
-
/**
|
|
784
|
-
* Get reference info — common chain IDs, USDC addresses, native token constant.
|
|
785
|
-
*/
|
|
786
|
-
getInfo(): Promise<BridgeInfoResponse>;
|
|
715
|
+
declare class DefiModule {
|
|
716
|
+
private provider;
|
|
717
|
+
private savax;
|
|
718
|
+
constructor(provider: JsonRpcProvider);
|
|
719
|
+
/** Get sAVAX staking info: exchange rate, total staked, your balance */
|
|
720
|
+
sAvaxInfo(wallet?: string): Promise<{
|
|
721
|
+
exchangeRate: string;
|
|
722
|
+
totalPooledAvax: string;
|
|
723
|
+
totalShares: string;
|
|
724
|
+
balance?: string;
|
|
725
|
+
balanceInAvax?: string;
|
|
726
|
+
}>;
|
|
727
|
+
/** Quote: how much sAVAX for staking AVAX */
|
|
728
|
+
sAvaxStakeQuote(avaxAmount: string): Promise<{
|
|
729
|
+
avaxIn: string;
|
|
730
|
+
savaxOut: string;
|
|
731
|
+
}>;
|
|
732
|
+
/** Build tx to stake AVAX → sAVAX */
|
|
733
|
+
buildSAvaxStake(avaxAmount: string): Promise<{
|
|
734
|
+
transactions: UnsignedTx[];
|
|
735
|
+
}>;
|
|
736
|
+
/** Build tx to request unstake sAVAX → AVAX (delayed) */
|
|
737
|
+
buildSAvaxUnstake(wallet: string, amount: string): Promise<{
|
|
738
|
+
transactions: UnsignedTx[];
|
|
739
|
+
}>;
|
|
740
|
+
/** Get info about any ERC-4626 vault */
|
|
741
|
+
vaultInfo(vaultAddress: string, wallet?: string): Promise<{
|
|
742
|
+
name: string;
|
|
743
|
+
symbol: string;
|
|
744
|
+
asset: string;
|
|
745
|
+
totalAssets: string;
|
|
746
|
+
totalSupply: string;
|
|
747
|
+
sharePrice: string;
|
|
748
|
+
userShares?: string;
|
|
749
|
+
userAssets?: string;
|
|
750
|
+
}>;
|
|
751
|
+
/** Quote vault deposit — how many shares for given assets */
|
|
752
|
+
vaultDepositQuote(vaultAddress: string, amount: string): Promise<{
|
|
753
|
+
assetsIn: string;
|
|
754
|
+
sharesOut: string;
|
|
755
|
+
}>;
|
|
756
|
+
/** Build txs to deposit into an ERC-4626 vault: [approve, deposit] */
|
|
757
|
+
buildVaultDeposit(wallet: string, vaultAddress: string, amount: string): Promise<{
|
|
758
|
+
transactions: UnsignedTx[];
|
|
759
|
+
}>;
|
|
760
|
+
/** Build tx to withdraw from an ERC-4626 vault */
|
|
761
|
+
buildVaultWithdraw(wallet: string, vaultAddress: string, amount: string): Promise<{
|
|
762
|
+
transactions: UnsignedTx[];
|
|
763
|
+
}>;
|
|
787
764
|
}
|
|
788
765
|
|
|
789
766
|
interface LogiqicalConfig {
|
|
790
|
-
/**
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
|
|
796
|
-
/**
|
|
767
|
+
/** Private key — creates a local wallet for signing (0x-prefixed hex) */
|
|
768
|
+
privateKey?: string;
|
|
769
|
+
/** Mnemonic phrase — derives wallet from HD path */
|
|
770
|
+
mnemonic?: string;
|
|
771
|
+
/** Wallet address (required if no privateKey/mnemonic) */
|
|
772
|
+
wallet?: string;
|
|
773
|
+
/** Arena API key for social, perps, tickets endpoints */
|
|
774
|
+
arenaApiKey?: string;
|
|
775
|
+
/** Network name from chain registry (default: "avalanche") */
|
|
776
|
+
network?: string;
|
|
777
|
+
/** Custom RPC URL (overrides network) */
|
|
778
|
+
rpcUrl?: string;
|
|
779
|
+
/** Agent display name */
|
|
797
780
|
name?: string;
|
|
781
|
+
/** Password for keystore encryption (default: "logiqical-agent") */
|
|
782
|
+
password?: string;
|
|
783
|
+
/** Spending policy — per-tx limits, budgets, allowlists, simulation */
|
|
784
|
+
policy?: SpendingPolicy;
|
|
798
785
|
}
|
|
799
786
|
/**
|
|
800
|
-
* Logiqical
|
|
787
|
+
* Logiqical — standalone agent wallet SDK for Avalanche + Arena.
|
|
801
788
|
*
|
|
802
789
|
* ```ts
|
|
803
|
-
* import {
|
|
790
|
+
* import { Logiqical } from "logiqical";
|
|
804
791
|
*
|
|
805
|
-
* const
|
|
792
|
+
* const agent = await Logiqical.boot({
|
|
793
|
+
* policy: { maxPerTx: "1.0", maxPerDay: "10.0", simulateBeforeSend: true },
|
|
794
|
+
* });
|
|
806
795
|
*
|
|
807
|
-
* //
|
|
808
|
-
*
|
|
809
|
-
* const tokens = await client.launchpad.getRecent(10);
|
|
810
|
-
* const tx = await client.dex.buildSwap("0xWallet", "AVAX", "USDC", "1.0");
|
|
796
|
+
* // One-liner: policy check + simulate + sign + broadcast
|
|
797
|
+
* await agent.execute(agent.dex.buildSwap(agent.address, "AVAX", "USDC", "1.0"));
|
|
811
798
|
* ```
|
|
812
799
|
*/
|
|
813
|
-
declare class
|
|
800
|
+
declare class Logiqical {
|
|
814
801
|
/** Buy/sell ARENA tokens via LFJ DEX */
|
|
815
802
|
readonly swap: SwapModule;
|
|
816
803
|
/** Stake ARENA tokens for rewards */
|
|
817
804
|
readonly staking: StakingModule;
|
|
818
805
|
/** Discover, research, and trade launchpad tokens on bonding curves */
|
|
819
806
|
readonly launchpad: LaunchpadModule;
|
|
820
|
-
/** Swap any Avalanche token via LFJ
|
|
807
|
+
/** Swap any Avalanche token via LFJ DEX */
|
|
821
808
|
readonly dex: DexModule;
|
|
822
809
|
/** Trade perpetual futures on Hyperliquid via Arena */
|
|
823
810
|
readonly perps: PerpsModule;
|
|
824
|
-
/** Cross-chain token bridging via Li.Fi
|
|
811
|
+
/** Cross-chain token bridging via Li.Fi */
|
|
825
812
|
readonly bridge: BridgeModule;
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
813
|
+
/** Buy/sell Arena tickets */
|
|
814
|
+
readonly tickets: TicketsModule;
|
|
815
|
+
/** Arena social: chat, DMs, posts, follow, user discovery */
|
|
816
|
+
readonly social: SocialModule;
|
|
817
|
+
/** Market signals intelligence — scan, funding rates, whale tracking */
|
|
818
|
+
readonly signals: SignalsModule;
|
|
819
|
+
/** Market data — prices, trending, top coins via CoinGecko */
|
|
820
|
+
readonly market: MarketModule;
|
|
821
|
+
/** DeFi — sAVAX liquid staking + ERC-4626 vaults */
|
|
822
|
+
readonly defi: DefiModule;
|
|
823
|
+
/** The agent's wallet address */
|
|
824
|
+
readonly address: string;
|
|
825
|
+
/** The local wallet (null if read-only mode) */
|
|
826
|
+
readonly agentWallet: AgentWallet | null;
|
|
827
|
+
/** The JSON-RPC provider for direct chain reads */
|
|
828
|
+
readonly provider: JsonRpcProvider;
|
|
829
|
+
/** The spending policy engine */
|
|
830
|
+
readonly policyEngine: PolicyEngine;
|
|
831
|
+
private config;
|
|
830
832
|
constructor(config: LogiqicalConfig);
|
|
831
|
-
/**
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
*
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}
|
|
833
|
+
/** Generate a brand new agent wallet */
|
|
834
|
+
static generate(config?: Omit<LogiqicalConfig, "privateKey" | "mnemonic" | "wallet">): Logiqical;
|
|
835
|
+
/** Boot from encrypted keystore — creates wallet on first run, loads on subsequent runs */
|
|
836
|
+
static boot(config?: Omit<LogiqicalConfig, "privateKey" | "mnemonic" | "wallet"> & {
|
|
837
|
+
keystoreName?: string;
|
|
838
|
+
}): Promise<Logiqical>;
|
|
839
|
+
/**
|
|
840
|
+
* Execute any module result — policy check + simulate + sign + broadcast.
|
|
841
|
+
*
|
|
842
|
+
* ```ts
|
|
843
|
+
* await agent.execute(agent.dex.buildSwap(agent.address, "AVAX", "USDC", "1.0"));
|
|
844
|
+
* await agent.execute(agent.launchpad.buildBuy(agent.address, "42", "0.5"));
|
|
845
|
+
* ```
|
|
846
|
+
*/
|
|
847
|
+
execute(resultOrPromise: Promise<{
|
|
848
|
+
transactions?: UnsignedTx[];
|
|
849
|
+
transaction?: UnsignedTx;
|
|
850
|
+
[key: string]: any;
|
|
851
|
+
}> | {
|
|
852
|
+
transactions?: UnsignedTx[];
|
|
853
|
+
transaction?: UnsignedTx;
|
|
854
|
+
[key: string]: any;
|
|
855
|
+
}, confirmations?: number): Promise<TransactionResult[]>;
|
|
856
|
+
/**
|
|
857
|
+
* Call any smart contract method — policy check + simulate + sign + broadcast.
|
|
858
|
+
*
|
|
859
|
+
* ```ts
|
|
860
|
+
* await agent.call({
|
|
861
|
+
* contract: "0x...",
|
|
862
|
+
* abi: ["function transfer(address,uint256) returns (bool)"],
|
|
863
|
+
* method: "transfer",
|
|
864
|
+
* args: ["0xRecipient", ethers.parseUnits("100", 18)],
|
|
865
|
+
* });
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
call(intent: CallIntent): Promise<TransactionResult>;
|
|
869
|
+
/** Send native token (AVAX) — policy check + simulate + sign + broadcast */
|
|
870
|
+
send(to: string, amount: string): Promise<TransactionResult>;
|
|
871
|
+
/** Simulate a transaction via eth_call — throws PolicyError if it would revert */
|
|
872
|
+
simulate(tx: UnsignedTx): Promise<void>;
|
|
873
|
+
/** Get the current spending policy */
|
|
874
|
+
getPolicy(): SpendingPolicy;
|
|
875
|
+
/** Replace the entire spending policy */
|
|
876
|
+
setPolicy(policy: SpendingPolicy): void;
|
|
877
|
+
/** Update specific policy fields */
|
|
878
|
+
updatePolicy(updates: Partial<SpendingPolicy>): void;
|
|
879
|
+
/** Get budget status: spent this hour, today, remaining */
|
|
880
|
+
getBudgetStatus(): {
|
|
881
|
+
spentLastHour: string;
|
|
882
|
+
spentLast24h: string;
|
|
883
|
+
remainingHour: string | null;
|
|
884
|
+
remainingDay: string | null;
|
|
885
|
+
};
|
|
886
|
+
/** Check if this client has a local wallet for signing */
|
|
887
|
+
get canSign(): boolean;
|
|
888
|
+
/** The private key (only available in wallet mode) */
|
|
889
|
+
get privateKey(): string;
|
|
890
|
+
/** Get native token balance (formatted) */
|
|
891
|
+
getBalance(): Promise<string>;
|
|
892
|
+
/** Sign a message */
|
|
893
|
+
signMessage(message: string): Promise<string>;
|
|
894
|
+
/** Sign EIP-712 typed data */
|
|
895
|
+
signTypedData(domain: any, types: any, value: any): Promise<string>;
|
|
896
|
+
/** Switch to a different network (returns new Logiqical instance with same keys) */
|
|
897
|
+
switchNetwork(network: string): Logiqical;
|
|
898
|
+
/** Save the wallet to an encrypted keystore file */
|
|
899
|
+
saveKeystore(password?: string, name?: string): Promise<string>;
|
|
900
|
+
/** Sign and broadcast a single unsigned tx — bypasses policy engine */
|
|
901
|
+
signAndBroadcast(unsignedTx: UnsignedTx): Promise<TransactionResponse>;
|
|
902
|
+
/** Sign and broadcast multiple unsigned txs — bypasses policy engine */
|
|
903
|
+
signAndBroadcastAll(unsignedTxs: UnsignedTx[], confirmations?: number): Promise<TransactionResponse[]>;
|
|
904
|
+
private requireWallet;
|
|
905
|
+
private static resolveProvider;
|
|
906
|
+
}
|
|
907
|
+
/** @deprecated Use `Logiqical` instead */
|
|
908
|
+
declare const LogiqicalClient: typeof Logiqical;
|
|
854
909
|
|
|
855
|
-
|
|
910
|
+
type LogiqicalErrorCode = "INSUFFICIENT_BALANCE" | "SLIPPAGE_EXCEEDED" | "TOKEN_NOT_FOUND" | "CONTRACT_REVERT" | "NO_LIQUIDITY" | "TX_FAILED" | "INVALID_ADDRESS" | "INVALID_AMOUNT" | "NO_WALLET" | "NETWORK_ERROR" | "API_ERROR" | "UNKNOWN";
|
|
856
911
|
declare class LogiqicalError extends Error {
|
|
857
|
-
readonly
|
|
858
|
-
readonly
|
|
859
|
-
constructor(message: string,
|
|
860
|
-
|
|
861
|
-
/** Authentication error — invalid or missing API key */
|
|
862
|
-
declare class LogiqicalAuthError extends LogiqicalError {
|
|
863
|
-
constructor(endpoint: string);
|
|
912
|
+
readonly code: LogiqicalErrorCode;
|
|
913
|
+
readonly cause?: Error | undefined;
|
|
914
|
+
constructor(message: string, code: LogiqicalErrorCode, cause?: Error | undefined);
|
|
915
|
+
static from(e: unknown, code?: LogiqicalErrorCode): LogiqicalError;
|
|
864
916
|
}
|
|
865
917
|
|
|
866
|
-
export {
|
|
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 };
|