logiqical 0.2.0 → 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 +749 -792
- package/dist/index.d.ts +749 -792
- package/dist/index.js +2283 -774
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2268 -773
- package/dist/index.mjs.map +1 -0
- package/package.json +20 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
11
86
|
}
|
|
12
87
|
|
|
13
88
|
/** Unsigned transaction ready to be signed and broadcast */
|
|
@@ -20,288 +95,298 @@ interface UnsignedTx {
|
|
|
20
95
|
gasLimit?: string;
|
|
21
96
|
description?: string;
|
|
22
97
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
interface SellQuoteResponse {
|
|
38
|
-
arenaIn: string;
|
|
39
|
-
avaxOut: string;
|
|
40
|
-
avaxOutFormatted: string;
|
|
41
|
-
rate: string;
|
|
42
|
-
priceImpact: string;
|
|
43
|
-
}
|
|
44
|
-
interface SwapBuyResponse {
|
|
45
|
-
transactions: UnsignedTx[];
|
|
46
|
-
summary: string;
|
|
47
|
-
}
|
|
48
|
-
interface SwapSellResponse {
|
|
49
|
-
transactions: UnsignedTx[];
|
|
50
|
-
}
|
|
51
|
-
interface StakeInfoResponse {
|
|
52
|
-
staked: string;
|
|
53
|
-
stakedFormatted: string;
|
|
54
|
-
rewards: string;
|
|
55
|
-
rewardsFormatted: string;
|
|
56
|
-
apy: string;
|
|
57
|
-
}
|
|
58
|
-
interface StakeBuildResponse {
|
|
59
|
-
transactions: UnsignedTx[];
|
|
60
|
-
}
|
|
61
|
-
interface TokenCreator {
|
|
62
|
-
address: string;
|
|
63
|
-
handle: string;
|
|
64
|
-
photoUrl: string;
|
|
65
|
-
twitterFollowers: number | null;
|
|
66
|
-
totalTokensCreated: number | null;
|
|
67
|
-
}
|
|
68
|
-
interface LaunchpadToken {
|
|
69
|
-
tokenId: string;
|
|
70
|
-
type: "AVAX-paired" | "ARENA-paired";
|
|
71
|
-
name: string;
|
|
72
|
-
symbol: string;
|
|
73
|
-
tokenAddress: string;
|
|
74
|
-
photoUrl: string;
|
|
75
|
-
description: string | null;
|
|
76
|
-
creator: TokenCreator;
|
|
77
|
-
price: {
|
|
78
|
-
eth: number;
|
|
79
|
-
usd: number;
|
|
80
|
-
avaxPrice: number;
|
|
81
|
-
};
|
|
82
|
-
volume: {
|
|
83
|
-
totalEth: number;
|
|
84
|
-
totalUsd: number;
|
|
85
|
-
};
|
|
86
|
-
holders: number;
|
|
87
|
-
transactions: number;
|
|
88
|
-
graduationProgress: string | null;
|
|
89
|
-
graduated: boolean;
|
|
90
|
-
supply: number;
|
|
91
|
-
createdAt: string | null;
|
|
92
|
-
whitelist: unknown;
|
|
93
|
-
isOfficial: boolean;
|
|
94
|
-
dexPoolId: string | null;
|
|
95
|
-
}
|
|
96
|
-
interface LaunchpadListResponse {
|
|
97
|
-
count: number;
|
|
98
|
-
tokens: LaunchpadToken[];
|
|
99
|
-
}
|
|
100
|
-
interface TokenStatsTimeframes {
|
|
101
|
-
"5m": number;
|
|
102
|
-
"1h": number;
|
|
103
|
-
"4h": number;
|
|
104
|
-
"12h": number;
|
|
105
|
-
"24h": number;
|
|
106
|
-
}
|
|
107
|
-
interface TokenDetailResponse extends LaunchpadToken {
|
|
108
|
-
stats?: {
|
|
109
|
-
buys: TokenStatsTimeframes;
|
|
110
|
-
sells: TokenStatsTimeframes;
|
|
111
|
-
uniqueBuyers: TokenStatsTimeframes;
|
|
112
|
-
uniqueSellers: TokenStatsTimeframes;
|
|
113
|
-
volume: TokenStatsTimeframes;
|
|
114
|
-
priceChange: TokenStatsTimeframes;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
interface LaunchpadQuoteResponse {
|
|
118
|
-
tokensOut?: string;
|
|
119
|
-
avaxCost?: string;
|
|
120
|
-
avaxOut?: string;
|
|
121
|
-
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;
|
|
122
112
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
tokenAmount: number;
|
|
133
|
-
costOrReward?: {
|
|
134
|
-
eth: number;
|
|
135
|
-
usd: number;
|
|
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;
|
|
136
121
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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;
|
|
140
158
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
159
|
+
get shouldSimulate(): boolean;
|
|
160
|
+
get isDryRun(): boolean;
|
|
161
|
+
private getSpendSince;
|
|
144
162
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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);
|
|
149
167
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
+
}>;
|
|
168
203
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
+
}>;
|
|
172
229
|
}
|
|
173
|
-
|
|
174
|
-
|
|
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;
|
|
175
258
|
name: string;
|
|
176
259
|
symbol: string;
|
|
177
|
-
|
|
178
|
-
|
|
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<{
|
|
179
271
|
tokenId: string;
|
|
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
|
-
|
|
221
|
-
interface BuildCreateResponse {
|
|
222
|
-
transaction: UnsignedTx;
|
|
223
|
-
nextTokenId: string;
|
|
224
|
-
}
|
|
225
|
-
interface DexTokenEntry {
|
|
226
|
-
symbol: string;
|
|
227
|
-
address: string;
|
|
228
|
-
decimals: number;
|
|
229
|
-
}
|
|
230
|
-
interface DexTokensResponse {
|
|
231
|
-
tokens: DexTokenEntry[];
|
|
232
|
-
note: string;
|
|
233
|
-
}
|
|
234
|
-
interface DexTokenInfoResponse {
|
|
235
|
-
address: string;
|
|
236
|
-
symbol: string;
|
|
237
|
-
name: string;
|
|
238
|
-
decimals: number;
|
|
239
|
-
}
|
|
240
|
-
interface DexQuoteResponse {
|
|
241
|
-
from: string;
|
|
242
|
-
to: string;
|
|
243
|
-
amountIn: string;
|
|
244
|
-
amountOut: string;
|
|
245
|
-
rate: string;
|
|
246
|
-
priceImpact: string;
|
|
247
|
-
path: string[];
|
|
248
|
-
}
|
|
249
|
-
interface DexBalanceResponse {
|
|
250
|
-
wallet: string;
|
|
251
|
-
token: string;
|
|
252
|
-
balance: string;
|
|
253
|
-
formatted: string;
|
|
254
|
-
symbol: string;
|
|
255
|
-
}
|
|
256
|
-
interface DexSwapResponse {
|
|
257
|
-
transactions: UnsignedTx[];
|
|
258
|
-
summary: string;
|
|
259
|
-
}
|
|
260
|
-
interface PerpsSetupResponse {
|
|
261
|
-
success: boolean;
|
|
262
|
-
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;
|
|
263
313
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
marginMode: string;
|
|
279
|
-
}
|
|
280
|
-
interface PerpsTradingPairsResponse {
|
|
281
|
-
pairs: PerpsTradingPair[];
|
|
282
|
-
cachedAt: string;
|
|
283
|
-
count: number;
|
|
284
|
-
}
|
|
285
|
-
interface PerpsOrderResponse {
|
|
286
|
-
[key: string]: any;
|
|
287
|
-
}
|
|
288
|
-
interface PerpsPositionsResponse {
|
|
289
|
-
assetPositions?: any[];
|
|
290
|
-
marginSummary?: {
|
|
291
|
-
accountValue: string;
|
|
292
|
-
totalMarginUsed: string;
|
|
293
|
-
totalNtlPos: string;
|
|
294
|
-
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;
|
|
295
328
|
};
|
|
296
|
-
|
|
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
|
+
}>;
|
|
297
358
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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>;
|
|
304
388
|
}
|
|
389
|
+
|
|
305
390
|
interface BridgeQuoteResponse {
|
|
306
391
|
id: string;
|
|
307
392
|
fromChainId: number;
|
|
@@ -313,11 +398,13 @@ interface BridgeQuoteResponse {
|
|
|
313
398
|
estimatedGas: string;
|
|
314
399
|
estimatedTime: number;
|
|
315
400
|
tool: string;
|
|
316
|
-
transaction?:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
401
|
+
transaction?: {
|
|
402
|
+
to: string;
|
|
403
|
+
data: string;
|
|
404
|
+
value: string;
|
|
405
|
+
gasLimit?: string;
|
|
406
|
+
chainId: number;
|
|
407
|
+
};
|
|
321
408
|
}
|
|
322
409
|
interface BridgeStatusResponse {
|
|
323
410
|
status: "NOT_FOUND" | "PENDING" | "DONE" | "FAILED";
|
|
@@ -348,443 +435,48 @@ interface BridgeLiFiChain {
|
|
|
348
435
|
address: string;
|
|
349
436
|
};
|
|
350
437
|
}
|
|
351
|
-
interface BridgeTokensResponse {
|
|
352
|
-
tokens: Record<string, BridgeLiFiToken[]>;
|
|
353
|
-
}
|
|
354
|
-
interface BridgeTokenResponse extends BridgeLiFiToken {
|
|
355
|
-
}
|
|
356
|
-
interface BridgeChainsResponse {
|
|
357
|
-
chains: BridgeLiFiChain[];
|
|
358
|
-
count: number;
|
|
359
|
-
}
|
|
360
|
-
interface BridgeConnectionsResponse {
|
|
361
|
-
connections: any[];
|
|
362
|
-
}
|
|
363
|
-
interface BridgeInfoResponse {
|
|
364
|
-
chains: Record<string, number>;
|
|
365
|
-
usdc: Record<string, string>;
|
|
366
|
-
nativeToken: string;
|
|
367
|
-
tip: string;
|
|
368
|
-
}
|
|
369
|
-
interface RegisterResponse {
|
|
370
|
-
apiKey: string;
|
|
371
|
-
wallet: string;
|
|
372
|
-
name: string;
|
|
373
|
-
}
|
|
374
|
-
interface BroadcastResponse {
|
|
375
|
-
txHash: string;
|
|
376
|
-
}
|
|
377
|
-
interface HealthResponse {
|
|
378
|
-
status: string;
|
|
379
|
-
router: string;
|
|
380
|
-
fee: string;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
declare class SwapModule {
|
|
384
|
-
private http;
|
|
385
|
-
private auth;
|
|
386
|
-
constructor(http: HttpClient, auth: () => Promise<void>);
|
|
387
|
-
/**
|
|
388
|
-
* Get AVAX and ARENA token balances for a wallet.
|
|
389
|
-
* @param wallet - Wallet address to check
|
|
390
|
-
*/
|
|
391
|
-
getBalances(wallet: string): Promise<BalancesResponse>;
|
|
392
|
-
/**
|
|
393
|
-
* Quote how much ARENA you get for a given amount of AVAX.
|
|
394
|
-
* @param avax - Amount of AVAX to spend
|
|
395
|
-
*/
|
|
396
|
-
quote(avax: string): Promise<BuyQuoteResponse>;
|
|
397
|
-
/**
|
|
398
|
-
* Quote how much AVAX you get for selling a given amount of ARENA.
|
|
399
|
-
* @param arena - Amount of ARENA to sell
|
|
400
|
-
*/
|
|
401
|
-
sellQuote(arena: string): Promise<SellQuoteResponse>;
|
|
402
|
-
/**
|
|
403
|
-
* Build unsigned transaction to buy ARENA with AVAX.
|
|
404
|
-
*
|
|
405
|
-
* Sign the transaction, then broadcast via `client.broadcast()`.
|
|
406
|
-
*
|
|
407
|
-
* @param wallet - Your wallet address
|
|
408
|
-
* @param avax - Amount of AVAX to spend
|
|
409
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
410
|
-
*/
|
|
411
|
-
buildBuy(wallet: string, avax: string, slippage?: number): Promise<SwapBuyResponse>;
|
|
412
|
-
/**
|
|
413
|
-
* Build unsigned transactions to sell ARENA for AVAX.
|
|
414
|
-
*
|
|
415
|
-
* Returns 2 transactions — execute in order:
|
|
416
|
-
* 1. Approve — allows the DEX router to spend your ARENA
|
|
417
|
-
* 2. Swap — executes the ARENA → AVAX swap
|
|
418
|
-
*
|
|
419
|
-
* Sign each, broadcast via `client.broadcast()`, wait for confirmation before the next.
|
|
420
|
-
*
|
|
421
|
-
* @param wallet - Your wallet address
|
|
422
|
-
* @param amount - Amount of ARENA to sell, or "max" for entire balance
|
|
423
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
424
|
-
*/
|
|
425
|
-
buildSell(wallet: string, amount: string, slippage?: number): Promise<SwapSellResponse>;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
declare class StakingModule {
|
|
429
|
-
private http;
|
|
430
|
-
private auth;
|
|
431
|
-
constructor(http: HttpClient, auth: () => Promise<void>);
|
|
432
|
-
/**
|
|
433
|
-
* Get staking info for a wallet — staked amount, pending rewards, APY.
|
|
434
|
-
* @param wallet - Wallet address to check
|
|
435
|
-
*/
|
|
436
|
-
getInfo(wallet: string): Promise<StakeInfoResponse>;
|
|
437
|
-
/**
|
|
438
|
-
* Build unsigned transactions to stake ARENA tokens.
|
|
439
|
-
*
|
|
440
|
-
* Returns 2 transactions — execute in order:
|
|
441
|
-
* 1. Approve — allows the staking contract to spend your ARENA
|
|
442
|
-
* 2. Stake — deposits ARENA into staking
|
|
443
|
-
*
|
|
444
|
-
* @param wallet - Your wallet address
|
|
445
|
-
* @param amount - Amount of ARENA to stake
|
|
446
|
-
*/
|
|
447
|
-
buildStake(wallet: string, amount: string): Promise<StakeBuildResponse>;
|
|
448
|
-
/**
|
|
449
|
-
* Build unsigned transactions to buy ARENA with AVAX and stake in one flow.
|
|
450
|
-
*
|
|
451
|
-
* Combines swap + approve + stake. Returns multiple transactions — execute in order.
|
|
452
|
-
*
|
|
453
|
-
* @param wallet - Your wallet address
|
|
454
|
-
* @param avax - Amount of AVAX to spend
|
|
455
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
456
|
-
*/
|
|
457
|
-
buildBuyAndStake(wallet: string, avax: string, slippage?: number): Promise<StakeBuildResponse>;
|
|
458
|
-
/**
|
|
459
|
-
* Build unsigned transaction to unstake ARENA tokens and claim rewards.
|
|
460
|
-
* @param wallet - Your wallet address
|
|
461
|
-
* @param amount - Amount of ARENA to unstake
|
|
462
|
-
*/
|
|
463
|
-
buildUnstake(wallet: string, amount: string): Promise<UnsignedTx>;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
declare class LaunchpadModule {
|
|
467
|
-
private http;
|
|
468
|
-
private auth;
|
|
469
|
-
constructor(http: HttpClient, auth: () => Promise<void>);
|
|
470
|
-
/**
|
|
471
|
-
* Get recently launched tokens on Arena.
|
|
472
|
-
* @param count - Number of tokens (max 50, default 10)
|
|
473
|
-
* @param type - Filter: "all", "avax" (AVAX-paired), or "arena" (ARENA-paired)
|
|
474
|
-
*/
|
|
475
|
-
getRecent(count?: number, type?: "all" | "avax" | "arena"): Promise<LaunchpadListResponse>;
|
|
476
|
-
/**
|
|
477
|
-
* Search for a token by name, symbol, or contract address.
|
|
478
|
-
* @param q - Search query — name, symbol, or 0x contract address
|
|
479
|
-
*/
|
|
480
|
-
search(q: string): Promise<LaunchpadListResponse | LaunchpadToken>;
|
|
481
|
-
/**
|
|
482
|
-
* Get tokens that are closest to graduating from the bonding curve to DEX.
|
|
483
|
-
* @param count - Number of tokens (max 20, default 5)
|
|
484
|
-
*/
|
|
485
|
-
getGraduating(count?: number): Promise<LaunchpadListResponse>;
|
|
486
|
-
/**
|
|
487
|
-
* Get tokens that have already graduated from the bonding curve to DEX.
|
|
488
|
-
* @param count - Number of tokens (max 50, default 10)
|
|
489
|
-
*/
|
|
490
|
-
getGraduated(count?: number): Promise<LaunchpadListResponse>;
|
|
491
|
-
/**
|
|
492
|
-
* Get top tokens by trading volume.
|
|
493
|
-
* @param timeframe - "5m", "1h", "4h", "24h", or "all_time"
|
|
494
|
-
* @param count - Number of tokens (max 50, default 10)
|
|
495
|
-
*/
|
|
496
|
-
getTopVolume(timeframe?: "5m" | "1h" | "4h" | "24h" | "all_time", count?: number): Promise<LaunchpadListResponse & {
|
|
497
|
-
timeframe: string;
|
|
498
|
-
}>;
|
|
499
|
-
/**
|
|
500
|
-
* Get full token profile with stats — price, market cap, graduation progress, buy/sell activity.
|
|
501
|
-
* @param tokenId - Arena token ID
|
|
502
|
-
* @param address - Or token contract address (0x...)
|
|
503
|
-
*/
|
|
504
|
-
getToken(tokenId?: string, address?: string): Promise<TokenDetailResponse>;
|
|
505
|
-
/**
|
|
506
|
-
* Get a buy or sell quote for a bonding curve token.
|
|
507
|
-
* @param tokenId - Arena token ID
|
|
508
|
-
* @param side - "buy" or "sell"
|
|
509
|
-
* @param amount - For buy: AVAX amount. For sell: token amount.
|
|
510
|
-
*/
|
|
511
|
-
quote(tokenId: string, side: "buy" | "sell", amount: string): Promise<LaunchpadQuoteResponse>;
|
|
512
|
-
/**
|
|
513
|
-
* Get agent's tracked portfolio — all launchpad tokens the agent has bought.
|
|
514
|
-
* @param wallet - Agent wallet address
|
|
515
|
-
*/
|
|
516
|
-
getPortfolio(wallet: string): Promise<unknown>;
|
|
517
|
-
/**
|
|
518
|
-
* Get market cap data for a token.
|
|
519
|
-
* @param tokenId - Arena token ID
|
|
520
|
-
*/
|
|
521
|
-
getMarketCap(tokenId: string): Promise<unknown>;
|
|
522
|
-
/**
|
|
523
|
-
* Get recent trade activity for a token.
|
|
524
|
-
* @param tokenId - Arena token ID
|
|
525
|
-
* @param address - Or token contract address
|
|
526
|
-
* @param count - Number of trades (max 50, default 20)
|
|
527
|
-
*/
|
|
528
|
-
getActivity(tokenId?: string, address?: string, count?: number): Promise<TokenActivityResponse>;
|
|
529
|
-
/**
|
|
530
|
-
* Get top holders for a token with PnL data.
|
|
531
|
-
* @param address - Token contract address
|
|
532
|
-
* @param tokenId - Or Arena token ID
|
|
533
|
-
* @param count - Number of holders (max 50, default 20)
|
|
534
|
-
*/
|
|
535
|
-
getHolders(address?: string, tokenId?: string, count?: number): Promise<TokenHoldersResponse>;
|
|
536
|
-
/**
|
|
537
|
-
* Get platform overview — total tokens launched, contract addresses, stats.
|
|
538
|
-
*/
|
|
539
|
-
getOverview(): Promise<unknown>;
|
|
540
|
-
/**
|
|
541
|
-
* Get the global trade feed across all launchpad tokens.
|
|
542
|
-
* @param count - Number of trades (max 100, default 50)
|
|
543
|
-
* @param offset - Pagination offset
|
|
544
|
-
*/
|
|
545
|
-
getTrades(count?: number, offset?: number): Promise<GlobalTradesResponse>;
|
|
546
|
-
/**
|
|
547
|
-
* Launch a new token on Arena — uploads image, creates community, and returns the unsigned createToken transaction.
|
|
548
|
-
*
|
|
549
|
-
* @param wallet - Creator wallet address
|
|
550
|
-
* @param name - Token name (also used as community name)
|
|
551
|
-
* @param symbol - Token ticker symbol
|
|
552
|
-
* @param imageBase64 - Token image as base64 string (optional)
|
|
553
|
-
* @param paymentToken - "avax" or "arena" (default: "arena")
|
|
554
|
-
* @param initialBuyAvax - AVAX amount for initial buy at creation (default: "0")
|
|
555
|
-
*/
|
|
556
|
-
launch(wallet: string, name: string, symbol: string, imageBase64?: string, paymentToken?: "avax" | "arena", initialBuyAvax?: string): Promise<LaunchTokenResponse>;
|
|
557
|
-
/**
|
|
558
|
-
* Upload a token image to Arena's CDN and get the hosted URL.
|
|
559
|
-
* Use this before launch() if you want to preview the image URL first.
|
|
560
|
-
*
|
|
561
|
-
* @param imageBase64 - Image as base64 string
|
|
562
|
-
* @param fileType - MIME type (default: "image/jpeg")
|
|
563
|
-
*/
|
|
564
|
-
uploadImage(imageBase64: string, fileType?: string): Promise<UploadImageResponse>;
|
|
565
|
-
/**
|
|
566
|
-
* Build only the createToken transaction (no image or community creation).
|
|
567
|
-
* Useful if you want to handle image upload and community creation separately.
|
|
568
|
-
*
|
|
569
|
-
* @param wallet - Creator wallet address
|
|
570
|
-
* @param name - Token name
|
|
571
|
-
* @param symbol - Token ticker symbol
|
|
572
|
-
* @param paymentToken - "avax" or "arena" (default: "arena")
|
|
573
|
-
* @param initialBuyAvax - AVAX for initial buy (default: "0")
|
|
574
|
-
*/
|
|
575
|
-
buildCreate(wallet: string, name: string, symbol: string, paymentToken?: "avax" | "arena", initialBuyAvax?: string): Promise<BuildCreateResponse>;
|
|
576
|
-
/**
|
|
577
|
-
* Build unsigned transaction to buy a launchpad token with AVAX.
|
|
578
|
-
*
|
|
579
|
-
* Auto-detects if the token is AVAX-paired or ARENA-paired and routes accordingly.
|
|
580
|
-
* If the token has graduated to DEX, returns transactions for DEX swap instead.
|
|
581
|
-
*
|
|
582
|
-
* @param wallet - Your wallet address
|
|
583
|
-
* @param tokenId - Arena token ID
|
|
584
|
-
* @param avax - Amount of AVAX to spend
|
|
585
|
-
* @param slippage - Slippage in basis points (default: 500 = 5%)
|
|
586
|
-
*/
|
|
587
|
-
buildBuy(wallet: string, tokenId: string, avax: string, slippage?: number): Promise<LaunchpadBuyResponse>;
|
|
588
|
-
/**
|
|
589
|
-
* Build unsigned transaction(s) to sell a launchpad token.
|
|
590
|
-
*
|
|
591
|
-
* Returns approve + sell transactions. Execute in order.
|
|
592
|
-
* Use amount="max" to sell entire balance.
|
|
593
|
-
*
|
|
594
|
-
* If the token has graduated to DEX, returns transactions for DEX swap instead.
|
|
595
|
-
*
|
|
596
|
-
* @param wallet - Your wallet address
|
|
597
|
-
* @param tokenId - Arena token ID
|
|
598
|
-
* @param amount - Token amount to sell, or "max" for entire balance
|
|
599
|
-
* @param slippage - Slippage in basis points (default: 500 = 5%)
|
|
600
|
-
*/
|
|
601
|
-
buildSell(wallet: string, tokenId: string, amount: string, slippage?: number): Promise<LaunchpadSellResponse>;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
declare class DexModule {
|
|
605
|
-
private http;
|
|
606
|
-
private auth;
|
|
607
|
-
constructor(http: HttpClient, auth: () => Promise<void>);
|
|
608
|
-
/**
|
|
609
|
-
* List all known tokens with addresses and decimals.
|
|
610
|
-
* You can also pass any contract address directly to other methods — not limited to this list.
|
|
611
|
-
*/
|
|
612
|
-
getTokens(): Promise<DexTokensResponse>;
|
|
613
|
-
/**
|
|
614
|
-
* Get on-chain info for any token by contract address — name, symbol, decimals.
|
|
615
|
-
* @param address - Token contract address (0x...)
|
|
616
|
-
*/
|
|
617
|
-
getTokenInfo(address: string): Promise<DexTokenInfoResponse>;
|
|
618
|
-
/**
|
|
619
|
-
* Quote a swap between any two tokens on Avalanche.
|
|
620
|
-
* @param from - Source token symbol or contract address
|
|
621
|
-
* @param to - Destination token symbol or contract address
|
|
622
|
-
* @param amount - Amount of source token to swap
|
|
623
|
-
*/
|
|
624
|
-
quote(from: string, to: string, amount: string): Promise<DexQuoteResponse>;
|
|
625
|
-
/**
|
|
626
|
-
* Get the balance of any token for a wallet.
|
|
627
|
-
* @param wallet - Wallet address
|
|
628
|
-
* @param token - Token symbol or contract address
|
|
629
|
-
*/
|
|
630
|
-
getBalance(wallet: string, token: string): Promise<DexBalanceResponse>;
|
|
631
|
-
/**
|
|
632
|
-
* Build unsigned transaction(s) to swap any token pair on Avalanche via LFJ/Pharaoh DEX.
|
|
633
|
-
*
|
|
634
|
-
* May return multiple transactions (approve + swap). Execute in order.
|
|
635
|
-
*
|
|
636
|
-
* @param wallet - Your wallet address
|
|
637
|
-
* @param from - Source token symbol or contract address
|
|
638
|
-
* @param to - Destination token symbol or contract address
|
|
639
|
-
* @param amount - Amount to swap, or "max" for entire balance
|
|
640
|
-
* @param slippage - Slippage tolerance in basis points (default: 500 = 5%)
|
|
641
|
-
*/
|
|
642
|
-
buildSwap(wallet: string, from: string, to: string, amount: string, slippage?: number): Promise<DexSwapResponse>;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
declare class PerpsModule {
|
|
646
|
-
private http;
|
|
647
|
-
private auth;
|
|
648
|
-
constructor(http: HttpClient, auth: () => Promise<void>);
|
|
649
|
-
/**
|
|
650
|
-
* Link your Arena API key to enable perps trading.
|
|
651
|
-
* One-time setup — after this, all /perp endpoints work automatically.
|
|
652
|
-
* @param arenaApiKey - Your Arena API key (from arena.social)
|
|
653
|
-
*/
|
|
654
|
-
setup(arenaApiKey: string): Promise<PerpsSetupResponse>;
|
|
655
|
-
/** Register for perps trading on Hyperliquid */
|
|
656
|
-
register(): Promise<any>;
|
|
657
|
-
/** Check perps registration status */
|
|
658
|
-
getRegistrationStatus(): Promise<any>;
|
|
659
|
-
/** Get your Hyperliquid API wallet address */
|
|
660
|
-
getWalletAddress(): Promise<any>;
|
|
661
|
-
/** Check which auth steps are completed */
|
|
662
|
-
getAuthStatus(): Promise<any>;
|
|
663
|
-
/**
|
|
664
|
-
* Get EIP-712 payload for an auth step.
|
|
665
|
-
* @param step - Auth step: "accept-terms", "approve-agent", "set-referrer", "approve-builder-fee"
|
|
666
|
-
* @param body - Optional body (accept-terms requires mainWalletAddress)
|
|
667
|
-
*/
|
|
668
|
-
getAuthPayload(step: string, body?: any): Promise<any>;
|
|
669
|
-
/**
|
|
670
|
-
* Submit signed EIP-712 payload for an auth step.
|
|
671
|
-
* @param step - Auth step
|
|
672
|
-
* @param body - Signed payload with signature and metadata
|
|
673
|
-
*/
|
|
674
|
-
submitAuthSignature(step: string, body: any): Promise<any>;
|
|
675
|
-
/** Enable HIP-3 abstraction (automated, no signature needed) */
|
|
676
|
-
enableHip3(): Promise<any>;
|
|
677
|
-
/** Get all available perpetual trading pairs (250+ markets) */
|
|
678
|
-
getTradingPairs(): Promise<PerpsTradingPairsResponse>;
|
|
679
|
-
/**
|
|
680
|
-
* Update leverage for a market. Must be called before first order.
|
|
681
|
-
* @param symbol - Market symbol (e.g. "BTC", "ETH")
|
|
682
|
-
* @param leverage - Leverage multiplier (1-50 depending on market)
|
|
683
|
-
* @param leverageType - "cross" or "isolated"
|
|
684
|
-
*/
|
|
685
|
-
updateLeverage(symbol: string, leverage: number, leverageType?: "cross" | "isolated"): Promise<any>;
|
|
686
|
-
/**
|
|
687
|
-
* Place one or more perpetual orders.
|
|
688
|
-
* @param orders - Array of order objects (see docs for BaseOrderParams)
|
|
689
|
-
*/
|
|
690
|
-
placeOrder(orders: any[]): Promise<PerpsOrderResponse>;
|
|
691
|
-
/**
|
|
692
|
-
* Cancel one or more open orders.
|
|
693
|
-
* @param cancels - Array of { assetIndex, oid }
|
|
694
|
-
*/
|
|
695
|
-
cancelOrders(cancels: {
|
|
696
|
-
assetIndex: number;
|
|
697
|
-
oid: number;
|
|
698
|
-
}[]): Promise<any>;
|
|
699
|
-
/**
|
|
700
|
-
* Modify an existing order.
|
|
701
|
-
* @param oid - Order ID to modify
|
|
702
|
-
* @param order - New order parameters
|
|
703
|
-
*/
|
|
704
|
-
modifyOrder(oid: number, order: any): Promise<any>;
|
|
705
|
-
/**
|
|
706
|
-
* Close a position (convenience — creates reduce-only IOC with 10% slippage).
|
|
707
|
-
* @param symbol - Market symbol
|
|
708
|
-
* @param positionSide - "long" or "short"
|
|
709
|
-
* @param size - Position size to close
|
|
710
|
-
* @param currentPrice - Current market price
|
|
711
|
-
* @param closePercent - Percentage to close (default: 100)
|
|
712
|
-
*/
|
|
713
|
-
closePosition(symbol: string, positionSide: "long" | "short", size: number, currentPrice: number, closePercent?: number): Promise<any>;
|
|
714
|
-
/** Get open orders */
|
|
715
|
-
getOrders(): Promise<any>;
|
|
716
|
-
/** Get trade execution history */
|
|
717
|
-
getTradeExecutions(): Promise<any>;
|
|
718
|
-
/**
|
|
719
|
-
* Get positions and margin summary (queries Hyperliquid directly).
|
|
720
|
-
* @param wallet - Your Hyperliquid wallet address (from getWalletAddress)
|
|
721
|
-
*/
|
|
722
|
-
getPositions(wallet: string): Promise<PerpsPositionsResponse>;
|
|
723
|
-
/**
|
|
724
|
-
* Get open orders from Hyperliquid directly.
|
|
725
|
-
* @param wallet - Your Hyperliquid wallet address
|
|
726
|
-
*/
|
|
727
|
-
getOpenOrders(wallet: string): Promise<any>;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
438
|
declare class BridgeModule {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
getTokens(chains: string): Promise<BridgeTokensResponse>;
|
|
743
|
-
/**
|
|
744
|
-
* Get info for a specific token on a chain.
|
|
745
|
-
* @param chainId - Chain ID
|
|
746
|
-
* @param address - Token contract address
|
|
747
|
-
*/
|
|
748
|
-
getToken(chainId: number, address: string): Promise<BridgeTokenResponse>;
|
|
749
|
-
/**
|
|
750
|
-
* Get available bridge connections between two chains.
|
|
751
|
-
* @param fromChainId - Source chain ID
|
|
752
|
-
* @param toChainId - Destination chain ID
|
|
753
|
-
* @param fromToken - Optional source token address
|
|
754
|
-
* @param toToken - Optional destination token address
|
|
755
|
-
*/
|
|
756
|
-
getConnections(fromChainId: number, toChainId: number, fromToken?: string, toToken?: string): Promise<BridgeConnectionsResponse>;
|
|
757
|
-
/**
|
|
758
|
-
* Get a bridge quote with unsigned transaction data.
|
|
759
|
-
* The agent signs the returned tx on the source chain.
|
|
760
|
-
*
|
|
761
|
-
* @param fromChainId - Source chain ID
|
|
762
|
-
* @param toChainId - Destination chain ID
|
|
763
|
-
* @param fromToken - Source token address (use 0x0000...0000 for native tokens)
|
|
764
|
-
* @param toToken - Destination token address
|
|
765
|
-
* @param fromAmount - Human-readable amount (e.g. "0.1")
|
|
766
|
-
* @param fromAddress - Sender wallet address
|
|
767
|
-
* @param toAddress - Optional receiver address (defaults to fromAddress)
|
|
768
|
-
* @param slippage - Slippage tolerance as decimal (default 0.03 = 3%)
|
|
769
|
-
* @param fromDecimals - Token decimals (default 18)
|
|
770
|
-
*/
|
|
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
|
+
}>;
|
|
771
450
|
getQuote(fromChainId: number, toChainId: number, fromToken: string, toToken: string, fromAmount: string, fromAddress: string, toAddress?: string, slippage?: number, fromDecimals?: number): Promise<BridgeQuoteResponse>;
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* Check bridge transfer status.
|
|
778
|
-
* @param txHash - Source chain transaction hash
|
|
779
|
-
* @param fromChainId - Source chain ID
|
|
780
|
-
* @param toChainId - Destination chain ID
|
|
781
|
-
* @param bridge - Optional bridge tool name
|
|
782
|
-
*/
|
|
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
|
+
}>;
|
|
783
455
|
getStatus(txHash: string, fromChainId: number, toChainId: number, bridge?: string): Promise<BridgeStatusResponse>;
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
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;
|
|
788
480
|
}
|
|
789
481
|
|
|
790
482
|
interface TicketPriceResponse {
|
|
@@ -810,37 +502,28 @@ interface TicketFeesResponse {
|
|
|
810
502
|
totalFeePercent: string;
|
|
811
503
|
}
|
|
812
504
|
declare class TicketsModule {
|
|
813
|
-
private
|
|
814
|
-
private
|
|
815
|
-
constructor(
|
|
816
|
-
/** Get buy price for tickets (supports fractional: "0.5", "1.2", "3") */
|
|
505
|
+
private provider;
|
|
506
|
+
private contract;
|
|
507
|
+
constructor(provider: JsonRpcProvider);
|
|
817
508
|
getBuyPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
|
|
818
|
-
/** Get sell price for tickets */
|
|
819
509
|
getSellPrice(subject: string, amount?: string): Promise<TicketPriceResponse>;
|
|
820
|
-
/** Get ticket balance for a user on a subject */
|
|
821
510
|
getBalance(subject: string, user: string): Promise<TicketBalanceResponse>;
|
|
822
|
-
/** Get ticket supply for a subject */
|
|
823
511
|
getSupply(subject: string): Promise<TicketSupplyResponse>;
|
|
824
|
-
/** Get fee structure */
|
|
825
512
|
getFees(): Promise<TicketFeesResponse>;
|
|
826
|
-
/** Build unsigned tx to buy tickets */
|
|
827
513
|
buildBuyTx(wallet: string, subject: string, amount?: string): Promise<{
|
|
828
|
-
transaction:
|
|
514
|
+
transaction: UnsignedTx;
|
|
829
515
|
}>;
|
|
830
|
-
/** Build unsigned tx to sell tickets */
|
|
831
516
|
buildSellTx(wallet: string, subject: string, amount?: string): Promise<{
|
|
832
|
-
transaction:
|
|
517
|
+
transaction: UnsignedTx;
|
|
833
518
|
}>;
|
|
519
|
+
private ticketsToFractional;
|
|
834
520
|
}
|
|
835
521
|
|
|
836
522
|
declare class SocialModule {
|
|
837
|
-
private http;
|
|
838
|
-
private auth;
|
|
839
523
|
private arenaApiKey?;
|
|
840
|
-
constructor(
|
|
841
|
-
private headers;
|
|
842
|
-
/** Set the Arena API key for social endpoints */
|
|
524
|
+
constructor(arenaApiKey?: string | undefined);
|
|
843
525
|
setArenaApiKey(key: string): void;
|
|
526
|
+
private request;
|
|
844
527
|
searchUsers(q: string, page?: number, pageSize?: number): Promise<any>;
|
|
845
528
|
getUserByHandle(handle: string): Promise<any>;
|
|
846
529
|
getUserById(userId: string): Promise<any>;
|
|
@@ -851,13 +534,14 @@ declare class SocialModule {
|
|
|
851
534
|
bio?: string;
|
|
852
535
|
profilePicture?: string;
|
|
853
536
|
}): Promise<any>;
|
|
537
|
+
updateBanner(bannerUrl: string): Promise<any>;
|
|
854
538
|
follow(userId: string): Promise<any>;
|
|
855
539
|
unfollow(userId: string): Promise<any>;
|
|
856
|
-
getFollowers(userId: string): Promise<any>;
|
|
857
|
-
getFollowing(userId: string): Promise<any>;
|
|
540
|
+
getFollowers(userId: string, page?: number, pageSize?: number): Promise<any>;
|
|
541
|
+
getFollowing(userId: string, page?: number, pageSize?: number): Promise<any>;
|
|
858
542
|
getSharesStats(userId: string): Promise<any>;
|
|
859
|
-
getShareHolders(userId?: string): Promise<any>;
|
|
860
|
-
getHoldings(): Promise<any>;
|
|
543
|
+
getShareHolders(userId?: string, page?: number, pageSize?: number): Promise<any>;
|
|
544
|
+
getHoldings(page?: number, pageSize?: number): Promise<any>;
|
|
861
545
|
getConversations(page?: number): Promise<any>;
|
|
862
546
|
getDirectMessages(): Promise<any>;
|
|
863
547
|
getGroupChats(): Promise<any>;
|
|
@@ -877,85 +561,358 @@ declare class SocialModule {
|
|
|
877
561
|
repost(threadId: string): Promise<any>;
|
|
878
562
|
}
|
|
879
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 {
|
|
576
|
+
name: string;
|
|
577
|
+
szDecimals: number;
|
|
578
|
+
maxLeverage: number;
|
|
579
|
+
}
|
|
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;
|
|
592
|
+
}
|
|
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
|
+
};
|
|
623
|
+
}
|
|
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[];
|
|
632
|
+
}>;
|
|
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;
|
|
655
|
+
}
|
|
656
|
+
|
|
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
|
+
};
|
|
664
|
+
}
|
|
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
|
+
}>;
|
|
713
|
+
}
|
|
714
|
+
|
|
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
|
+
}>;
|
|
764
|
+
}
|
|
765
|
+
|
|
880
766
|
interface LogiqicalConfig {
|
|
881
|
-
/**
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
|
|
887
|
-
/**
|
|
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 */
|
|
888
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;
|
|
889
785
|
}
|
|
890
786
|
/**
|
|
891
|
-
* Logiqical
|
|
787
|
+
* Logiqical — standalone agent wallet SDK for Avalanche + Arena.
|
|
892
788
|
*
|
|
893
789
|
* ```ts
|
|
894
|
-
* import {
|
|
790
|
+
* import { Logiqical } from "logiqical";
|
|
895
791
|
*
|
|
896
|
-
* const
|
|
792
|
+
* const agent = await Logiqical.boot({
|
|
793
|
+
* policy: { maxPerTx: "1.0", maxPerDay: "10.0", simulateBeforeSend: true },
|
|
794
|
+
* });
|
|
897
795
|
*
|
|
898
|
-
* //
|
|
899
|
-
*
|
|
900
|
-
* const tokens = await client.launchpad.getRecent(10);
|
|
901
|
-
* 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"));
|
|
902
798
|
* ```
|
|
903
799
|
*/
|
|
904
|
-
declare class
|
|
800
|
+
declare class Logiqical {
|
|
905
801
|
/** Buy/sell ARENA tokens via LFJ DEX */
|
|
906
802
|
readonly swap: SwapModule;
|
|
907
803
|
/** Stake ARENA tokens for rewards */
|
|
908
804
|
readonly staking: StakingModule;
|
|
909
805
|
/** Discover, research, and trade launchpad tokens on bonding curves */
|
|
910
806
|
readonly launchpad: LaunchpadModule;
|
|
911
|
-
/** Swap any Avalanche token via LFJ
|
|
807
|
+
/** Swap any Avalanche token via LFJ DEX */
|
|
912
808
|
readonly dex: DexModule;
|
|
913
809
|
/** Trade perpetual futures on Hyperliquid via Arena */
|
|
914
810
|
readonly perps: PerpsModule;
|
|
915
|
-
/** Cross-chain token bridging via Li.Fi
|
|
811
|
+
/** Cross-chain token bridging via Li.Fi */
|
|
916
812
|
readonly bridge: BridgeModule;
|
|
917
|
-
/** Buy/sell Arena tickets
|
|
813
|
+
/** Buy/sell Arena tickets */
|
|
918
814
|
readonly tickets: TicketsModule;
|
|
919
815
|
/** Arena social: chat, DMs, posts, follow, user discovery */
|
|
920
816
|
readonly social: SocialModule;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
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;
|
|
925
832
|
constructor(config: LogiqicalConfig);
|
|
926
|
-
/**
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
*
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
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;
|
|
949
909
|
|
|
950
|
-
|
|
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";
|
|
951
911
|
declare class LogiqicalError extends Error {
|
|
952
|
-
readonly
|
|
953
|
-
readonly
|
|
954
|
-
constructor(message: string,
|
|
955
|
-
|
|
956
|
-
/** Authentication error — invalid or missing API key */
|
|
957
|
-
declare class LogiqicalAuthError extends LogiqicalError {
|
|
958
|
-
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;
|
|
959
916
|
}
|
|
960
917
|
|
|
961
|
-
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 };
|