@mania-labs/mania-sdk 1.0.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 +397 -0
- package/dist/index.d.mts +1116 -0
- package/dist/index.d.ts +1116 -0
- package/dist/index.js +1220 -0
- package/dist/index.mjs +1165 -0
- package/package.json +56 -0
- package/src/.claude/settings.local.json +9 -0
- package/src/abi/ManiaFactoryUpgradeable.json +2183 -0
- package/src/abi.ts +268 -0
- package/src/bondingCurve.ts +319 -0
- package/src/constants.ts +72 -0
- package/src/index.ts +71 -0
- package/src/mania.ts +652 -0
- package/src/types.ts +238 -0
- package/src/utils.ts +154 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1116 @@
|
|
|
1
|
+
import { Address, Hash, PublicClient, WalletClient, Chain } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bonding curve state for a token
|
|
5
|
+
*/
|
|
6
|
+
interface BondingCurveState {
|
|
7
|
+
/** Virtual token reserves used in AMM calculation */
|
|
8
|
+
virtualTokenReserves: bigint;
|
|
9
|
+
/** Virtual ETH reserves used in AMM calculation */
|
|
10
|
+
virtualEthReserves: bigint;
|
|
11
|
+
/** Real token reserves available for purchase */
|
|
12
|
+
realTokenReserves: bigint;
|
|
13
|
+
/** Real ETH reserves collected from sales */
|
|
14
|
+
realEthReserves: bigint;
|
|
15
|
+
/** Total supply of the token */
|
|
16
|
+
tokenTotalSupply: bigint;
|
|
17
|
+
/** Whether the bonding curve has completed (reached migration threshold) */
|
|
18
|
+
complete: boolean;
|
|
19
|
+
/** Whether volume tracking is enabled for this token */
|
|
20
|
+
trackVolume: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Global protocol configuration
|
|
24
|
+
*/
|
|
25
|
+
interface GlobalState {
|
|
26
|
+
/** Whether the protocol has been initialized */
|
|
27
|
+
initialized: boolean;
|
|
28
|
+
/** Protocol authority address */
|
|
29
|
+
authority: Address;
|
|
30
|
+
/** Fee recipient address */
|
|
31
|
+
feeRecipient: Address;
|
|
32
|
+
/** Initial virtual token reserves for new curves */
|
|
33
|
+
initialVirtualTokenReserves: bigint;
|
|
34
|
+
/** Initial virtual ETH reserves for new curves */
|
|
35
|
+
initialVirtualEthReserves: bigint;
|
|
36
|
+
/** Initial real token reserves for new curves */
|
|
37
|
+
initialRealTokenReserves: bigint;
|
|
38
|
+
/** Token total supply for new tokens */
|
|
39
|
+
tokenTotalSupply: bigint;
|
|
40
|
+
/** Fee basis points (1 bp = 0.01%) */
|
|
41
|
+
feeBasisPoints: bigint;
|
|
42
|
+
/** Withdraw authority address */
|
|
43
|
+
withdrawAuthority: Address;
|
|
44
|
+
/** Whether migration to Uniswap is enabled */
|
|
45
|
+
enableMigrate: boolean;
|
|
46
|
+
/** Fee charged for pool migration */
|
|
47
|
+
poolMigrationFee: bigint;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parameters for setting global protocol configuration
|
|
51
|
+
*/
|
|
52
|
+
interface SetParamsInput {
|
|
53
|
+
initialVirtualTokenReserves: bigint;
|
|
54
|
+
initialVirtualEthReserves: bigint;
|
|
55
|
+
initialRealTokenReserves: bigint;
|
|
56
|
+
tokenTotalSupply: bigint;
|
|
57
|
+
feeBasisPoints: bigint;
|
|
58
|
+
withdrawAuthority: Address;
|
|
59
|
+
enableMigrate: boolean;
|
|
60
|
+
poolMigrationFee: bigint;
|
|
61
|
+
feeRecipient: Address;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Token creation parameters
|
|
65
|
+
*/
|
|
66
|
+
interface CreateTokenParams {
|
|
67
|
+
/** Token name */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Token symbol */
|
|
70
|
+
symbol: string;
|
|
71
|
+
/** Token metadata URI (e.g., IPFS link) */
|
|
72
|
+
uri: string;
|
|
73
|
+
/** Creator address (receives creator fees) */
|
|
74
|
+
creator: Address;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parameters for creating a token and buying in a single transaction
|
|
78
|
+
*/
|
|
79
|
+
interface CreateAndBuyParams extends CreateTokenParams {
|
|
80
|
+
/** ETH amount to spend on initial buy */
|
|
81
|
+
buyAmountEth: bigint;
|
|
82
|
+
/** Minimum tokens to receive (slippage protection) */
|
|
83
|
+
minTokensOut: bigint;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Buy transaction parameters
|
|
87
|
+
*/
|
|
88
|
+
interface BuyParams {
|
|
89
|
+
/** Token address to buy */
|
|
90
|
+
token: Address;
|
|
91
|
+
/** ETH amount to spend */
|
|
92
|
+
amountEth: bigint;
|
|
93
|
+
/** Minimum tokens to receive (slippage protection) */
|
|
94
|
+
minTokensOut: bigint;
|
|
95
|
+
/** Recipient address for tokens (defaults to sender) */
|
|
96
|
+
recipient?: Address;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sell transaction parameters
|
|
100
|
+
*/
|
|
101
|
+
interface SellParams {
|
|
102
|
+
/** Token address to sell */
|
|
103
|
+
token: Address;
|
|
104
|
+
/** Amount of tokens to sell */
|
|
105
|
+
amountTokens: bigint;
|
|
106
|
+
/** Minimum ETH to receive (slippage protection) */
|
|
107
|
+
minEthOut: bigint;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Migration parameters
|
|
111
|
+
*/
|
|
112
|
+
interface MigrateParams {
|
|
113
|
+
/** Token address to migrate */
|
|
114
|
+
token: Address;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Quote result for buy operations
|
|
118
|
+
*/
|
|
119
|
+
interface BuyQuote {
|
|
120
|
+
/** Tokens that would be received */
|
|
121
|
+
tokensOut: bigint;
|
|
122
|
+
/** Fee amount in ETH */
|
|
123
|
+
fee: bigint;
|
|
124
|
+
/** Net ETH after fees */
|
|
125
|
+
netEth: bigint;
|
|
126
|
+
/** Price per token in ETH */
|
|
127
|
+
pricePerToken: bigint;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Quote result for sell operations
|
|
131
|
+
*/
|
|
132
|
+
interface SellQuote {
|
|
133
|
+
/** ETH that would be received (before fees) */
|
|
134
|
+
ethOutGross: bigint;
|
|
135
|
+
/** Fee amount in ETH */
|
|
136
|
+
fee: bigint;
|
|
137
|
+
/** Net ETH after fees */
|
|
138
|
+
ethOutNet: bigint;
|
|
139
|
+
/** Price per token in ETH */
|
|
140
|
+
pricePerToken: bigint;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Token information combining on-chain data
|
|
144
|
+
*/
|
|
145
|
+
interface TokenInfo {
|
|
146
|
+
/** Token contract address */
|
|
147
|
+
address: Address;
|
|
148
|
+
/** Bonding curve state */
|
|
149
|
+
bondingCurve: BondingCurveState;
|
|
150
|
+
/** Current token price in ETH */
|
|
151
|
+
currentPrice: bigint;
|
|
152
|
+
/** Market cap in ETH */
|
|
153
|
+
marketCapEth: bigint;
|
|
154
|
+
/** Progress towards migration (0-100) */
|
|
155
|
+
migrationProgress: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Transaction result
|
|
159
|
+
*/
|
|
160
|
+
interface TransactionResult {
|
|
161
|
+
/** Transaction hash */
|
|
162
|
+
hash: Hash;
|
|
163
|
+
/** Whether the transaction was successful */
|
|
164
|
+
success: boolean;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Event types emitted by the contract
|
|
168
|
+
*/
|
|
169
|
+
interface CreateEvent {
|
|
170
|
+
name: string;
|
|
171
|
+
symbol: string;
|
|
172
|
+
uri: string;
|
|
173
|
+
mint: Address;
|
|
174
|
+
user: Address;
|
|
175
|
+
creator: Address;
|
|
176
|
+
timestamp: bigint;
|
|
177
|
+
}
|
|
178
|
+
interface TradeEvent {
|
|
179
|
+
mint: Address;
|
|
180
|
+
ethAmount: bigint;
|
|
181
|
+
tokenAmount: bigint;
|
|
182
|
+
isBuy: boolean;
|
|
183
|
+
user: Address;
|
|
184
|
+
timestamp: bigint;
|
|
185
|
+
virtualEthReserves: bigint;
|
|
186
|
+
virtualTokenReserves: bigint;
|
|
187
|
+
realEthReserves: bigint;
|
|
188
|
+
realTokenReserves: bigint;
|
|
189
|
+
}
|
|
190
|
+
interface CompleteEvent {
|
|
191
|
+
user: Address;
|
|
192
|
+
mint: Address;
|
|
193
|
+
timestamp: bigint;
|
|
194
|
+
}
|
|
195
|
+
interface MigrationEvent {
|
|
196
|
+
user: Address;
|
|
197
|
+
mint: Address;
|
|
198
|
+
mintAmount: bigint;
|
|
199
|
+
ethAmount: bigint;
|
|
200
|
+
poolMigrationFee: bigint;
|
|
201
|
+
timestamp: bigint;
|
|
202
|
+
pool: Address;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* SDK Configuration
|
|
206
|
+
*/
|
|
207
|
+
interface ManiaSDKConfig {
|
|
208
|
+
/** ManiaFactory contract address */
|
|
209
|
+
factoryAddress: Address;
|
|
210
|
+
/** RPC URL or viem public client */
|
|
211
|
+
rpcUrl?: string;
|
|
212
|
+
/** Chain ID */
|
|
213
|
+
chainId?: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Slippage configuration
|
|
217
|
+
*/
|
|
218
|
+
interface SlippageConfig {
|
|
219
|
+
/** Slippage tolerance in basis points (e.g., 100 = 1%) */
|
|
220
|
+
slippageBps: number;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* BondingCurve class for handling bonding curve calculations and state
|
|
225
|
+
*
|
|
226
|
+
* The bonding curve uses a constant product formula (x * y = k) similar to Uniswap V2,
|
|
227
|
+
* but with virtual reserves to provide initial liquidity.
|
|
228
|
+
*/
|
|
229
|
+
declare class BondingCurve {
|
|
230
|
+
private state;
|
|
231
|
+
private feeBasisPoints;
|
|
232
|
+
constructor(state: BondingCurveState, feeBasisPoints: bigint);
|
|
233
|
+
/**
|
|
234
|
+
* Get the current bonding curve state
|
|
235
|
+
*/
|
|
236
|
+
getState(): BondingCurveState;
|
|
237
|
+
/**
|
|
238
|
+
* Check if the bonding curve is complete (reached migration threshold)
|
|
239
|
+
*/
|
|
240
|
+
isComplete(): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Check if the bonding curve has been migrated (all reserves are 0)
|
|
243
|
+
*/
|
|
244
|
+
isMigrated(): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Get the current token price in ETH (wei per token)
|
|
247
|
+
*
|
|
248
|
+
* Price is calculated as: virtualEthReserves / virtualTokenReserves
|
|
249
|
+
*/
|
|
250
|
+
getCurrentPrice(): bigint;
|
|
251
|
+
/**
|
|
252
|
+
* Get the market cap in ETH
|
|
253
|
+
*
|
|
254
|
+
* Market cap = current price * total supply
|
|
255
|
+
*/
|
|
256
|
+
getMarketCapEth(): bigint;
|
|
257
|
+
/**
|
|
258
|
+
* Get the progress towards migration threshold (0-100)
|
|
259
|
+
*/
|
|
260
|
+
getMigrationProgress(): number;
|
|
261
|
+
/**
|
|
262
|
+
* Calculate ETH remaining until migration
|
|
263
|
+
*/
|
|
264
|
+
getEthUntilMigration(): bigint;
|
|
265
|
+
/**
|
|
266
|
+
* Get a quote for buying tokens with a specific ETH amount
|
|
267
|
+
*
|
|
268
|
+
* @param ethAmount - Amount of ETH to spend (in wei)
|
|
269
|
+
* @returns Quote with tokens out, fees, and price impact
|
|
270
|
+
*/
|
|
271
|
+
getBuyQuote(ethAmount: bigint): BuyQuote;
|
|
272
|
+
/**
|
|
273
|
+
* Get a quote for selling tokens
|
|
274
|
+
*
|
|
275
|
+
* @param tokenAmount - Amount of tokens to sell
|
|
276
|
+
* @returns Quote with ETH out, fees, and price impact
|
|
277
|
+
*/
|
|
278
|
+
getSellQuote(tokenAmount: bigint): SellQuote;
|
|
279
|
+
/**
|
|
280
|
+
* Calculate minimum tokens out with slippage tolerance
|
|
281
|
+
*
|
|
282
|
+
* @param ethAmount - Amount of ETH to spend
|
|
283
|
+
* @param slippageBps - Slippage tolerance in basis points (e.g., 100 = 1%)
|
|
284
|
+
* @returns Minimum tokens to receive
|
|
285
|
+
*/
|
|
286
|
+
calculateMinTokensOut(ethAmount: bigint, slippageBps: number): bigint;
|
|
287
|
+
/**
|
|
288
|
+
* Calculate minimum ETH out with slippage tolerance
|
|
289
|
+
*
|
|
290
|
+
* @param tokenAmount - Amount of tokens to sell
|
|
291
|
+
* @param slippageBps - Slippage tolerance in basis points (e.g., 100 = 1%)
|
|
292
|
+
* @returns Minimum ETH to receive
|
|
293
|
+
*/
|
|
294
|
+
calculateMinEthOut(tokenAmount: bigint, slippageBps: number): bigint;
|
|
295
|
+
/**
|
|
296
|
+
* Calculate price impact for a buy order
|
|
297
|
+
*
|
|
298
|
+
* @param ethAmount - Amount of ETH to spend
|
|
299
|
+
* @returns Price impact as a percentage (e.g., 2.5 = 2.5%)
|
|
300
|
+
*/
|
|
301
|
+
calculateBuyPriceImpact(ethAmount: bigint): number;
|
|
302
|
+
/**
|
|
303
|
+
* Calculate price impact for a sell order
|
|
304
|
+
*
|
|
305
|
+
* @param tokenAmount - Amount of tokens to sell
|
|
306
|
+
* @returns Price impact as a percentage (negative for sells)
|
|
307
|
+
*/
|
|
308
|
+
calculateSellPriceImpact(tokenAmount: bigint): number;
|
|
309
|
+
/**
|
|
310
|
+
* Check if a buy would exceed the migration threshold
|
|
311
|
+
*
|
|
312
|
+
* @param ethAmount - Amount of ETH to spend
|
|
313
|
+
* @returns True if the buy would exceed threshold
|
|
314
|
+
*/
|
|
315
|
+
wouldExceedMigrationThreshold(ethAmount: bigint): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Calculate maximum ETH that can be spent before hitting migration threshold
|
|
318
|
+
*
|
|
319
|
+
* @returns Maximum ETH amount (in wei)
|
|
320
|
+
*/
|
|
321
|
+
getMaxBuyAmount(): bigint;
|
|
322
|
+
/**
|
|
323
|
+
* Update the internal state (used after trades)
|
|
324
|
+
*/
|
|
325
|
+
updateState(newState: BondingCurveState): void;
|
|
326
|
+
/**
|
|
327
|
+
* Create a BondingCurve instance from raw contract data
|
|
328
|
+
*/
|
|
329
|
+
static fromContractData(data: readonly [bigint, bigint, bigint, bigint, bigint, boolean, boolean], feeBasisPoints: bigint): BondingCurve;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Utility function to calculate tokens out without instantiating a class
|
|
333
|
+
*/
|
|
334
|
+
declare function calculateBuyAmount(virtualTokenReserves: bigint, virtualEthReserves: bigint, ethAmount: bigint, feeBasisPoints: bigint): bigint;
|
|
335
|
+
/**
|
|
336
|
+
* Utility function to calculate ETH out without instantiating a class
|
|
337
|
+
*/
|
|
338
|
+
declare function calculateSellAmount(virtualTokenReserves: bigint, virtualEthReserves: bigint, tokenAmount: bigint, feeBasisPoints: bigint): bigint;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* ManiaSDK - Official SDK for interacting with the Mania Protocol
|
|
342
|
+
*
|
|
343
|
+
* Mania is an EVM-based token launchpad using bonding curves. Tokens are created
|
|
344
|
+
* with an initial bonding curve that allows trading until a migration threshold
|
|
345
|
+
* (4 ETH) is reached. Once complete, liquidity is migrated to Uniswap V3.
|
|
346
|
+
*/
|
|
347
|
+
declare class ManiaSDK {
|
|
348
|
+
publicClient: PublicClient;
|
|
349
|
+
walletClient: WalletClient | null;
|
|
350
|
+
readonly factoryAddress: Address;
|
|
351
|
+
readonly chainId: number;
|
|
352
|
+
/**
|
|
353
|
+
* Create a new ManiaSDK instance
|
|
354
|
+
*
|
|
355
|
+
* @param config - SDK configuration
|
|
356
|
+
* @param config.factoryAddress - ManiaFactory contract address
|
|
357
|
+
* @param config.rpcUrl - RPC URL for the chain
|
|
358
|
+
* @param config.chainId - Chain ID (optional, will be fetched if not provided)
|
|
359
|
+
*/
|
|
360
|
+
constructor(config: ManiaSDKConfig);
|
|
361
|
+
/**
|
|
362
|
+
* Create SDK instance from chain ID using default configuration
|
|
363
|
+
*
|
|
364
|
+
* @param chainId - Chain ID
|
|
365
|
+
* @param rpcUrl - RPC URL (optional, uses public RPC if not provided)
|
|
366
|
+
* @returns ManiaSDK instance
|
|
367
|
+
*/
|
|
368
|
+
static fromChainId(chainId: number, rpcUrl?: string): ManiaSDK;
|
|
369
|
+
/**
|
|
370
|
+
* Connect a wallet for signing transactions
|
|
371
|
+
*
|
|
372
|
+
* @param privateKey - Private key (with or without 0x prefix)
|
|
373
|
+
* @param chain - Viem chain object
|
|
374
|
+
*/
|
|
375
|
+
connectWallet(privateKey: string, chain: Chain): void;
|
|
376
|
+
/**
|
|
377
|
+
* Connect an existing wallet client
|
|
378
|
+
*
|
|
379
|
+
* @param walletClient - Viem wallet client
|
|
380
|
+
*/
|
|
381
|
+
setWalletClient(walletClient: WalletClient): void;
|
|
382
|
+
/**
|
|
383
|
+
* Set a custom public client
|
|
384
|
+
*
|
|
385
|
+
* @param publicClient - Viem public client
|
|
386
|
+
*/
|
|
387
|
+
setPublicClient(publicClient: PublicClient): void;
|
|
388
|
+
/**
|
|
389
|
+
* Get the connected wallet address
|
|
390
|
+
*/
|
|
391
|
+
getWalletAddress(): Address | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* Get global protocol configuration
|
|
394
|
+
*/
|
|
395
|
+
getGlobalState(): Promise<GlobalState>;
|
|
396
|
+
/**
|
|
397
|
+
* Get bonding curve state for a token
|
|
398
|
+
*
|
|
399
|
+
* @param token - Token address
|
|
400
|
+
*/
|
|
401
|
+
getBondingCurve(token: Address): Promise<BondingCurveState>;
|
|
402
|
+
/**
|
|
403
|
+
* Get a BondingCurve instance for calculations
|
|
404
|
+
*
|
|
405
|
+
* @param token - Token address
|
|
406
|
+
*/
|
|
407
|
+
getBondingCurveInstance(token: Address): Promise<BondingCurve>;
|
|
408
|
+
/**
|
|
409
|
+
* Get comprehensive token information
|
|
410
|
+
*
|
|
411
|
+
* @param token - Token address
|
|
412
|
+
*/
|
|
413
|
+
getTokenInfo(token: Address): Promise<TokenInfo>;
|
|
414
|
+
/**
|
|
415
|
+
* Get buy quote from contract
|
|
416
|
+
*
|
|
417
|
+
* @param token - Token address
|
|
418
|
+
* @param ethAmount - ETH amount in wei
|
|
419
|
+
*/
|
|
420
|
+
getBuyQuote(token: Address, ethAmount: bigint): Promise<bigint>;
|
|
421
|
+
/**
|
|
422
|
+
* Get sell quote from contract
|
|
423
|
+
*
|
|
424
|
+
* @param token - Token address
|
|
425
|
+
* @param tokenAmount - Token amount
|
|
426
|
+
*/
|
|
427
|
+
getSellQuote(token: Address, tokenAmount: bigint): Promise<bigint>;
|
|
428
|
+
/**
|
|
429
|
+
* Get fee for a given amount
|
|
430
|
+
*
|
|
431
|
+
* @param amount - Amount in wei
|
|
432
|
+
*/
|
|
433
|
+
getFee(amount: bigint): Promise<bigint>;
|
|
434
|
+
/**
|
|
435
|
+
* Get user volume
|
|
436
|
+
*
|
|
437
|
+
* @param user - User address
|
|
438
|
+
*/
|
|
439
|
+
getUserVolume(user: Address): Promise<bigint>;
|
|
440
|
+
private getConnectedWallet;
|
|
441
|
+
/**
|
|
442
|
+
* Create a new token with bonding curve
|
|
443
|
+
*
|
|
444
|
+
* @param params - Token creation parameters
|
|
445
|
+
* @returns Transaction result with token address
|
|
446
|
+
*/
|
|
447
|
+
create(params: CreateTokenParams): Promise<TransactionResult & {
|
|
448
|
+
tokenAddress?: Address;
|
|
449
|
+
}>;
|
|
450
|
+
/**
|
|
451
|
+
* Create a new token and buy in a single transaction
|
|
452
|
+
*
|
|
453
|
+
* @param params - Creation and buy parameters
|
|
454
|
+
* @returns Transaction result with token address
|
|
455
|
+
*/
|
|
456
|
+
createAndBuy(params: CreateAndBuyParams): Promise<TransactionResult & {
|
|
457
|
+
tokenAddress?: Address;
|
|
458
|
+
}>;
|
|
459
|
+
/**
|
|
460
|
+
* Buy tokens from bonding curve
|
|
461
|
+
*
|
|
462
|
+
* @param params - Buy parameters
|
|
463
|
+
* @returns Transaction result
|
|
464
|
+
*/
|
|
465
|
+
buy(params: BuyParams): Promise<TransactionResult>;
|
|
466
|
+
/**
|
|
467
|
+
* Buy tokens with automatic slippage calculation
|
|
468
|
+
*
|
|
469
|
+
* @param token - Token address
|
|
470
|
+
* @param ethAmount - ETH amount to spend
|
|
471
|
+
* @param slippageBps - Slippage tolerance in basis points (default: 100 = 1%)
|
|
472
|
+
*/
|
|
473
|
+
buyWithSlippage(token: Address, ethAmount: bigint, slippageBps?: number): Promise<TransactionResult>;
|
|
474
|
+
/**
|
|
475
|
+
* Sell tokens to bonding curve
|
|
476
|
+
*
|
|
477
|
+
* @param params - Sell parameters
|
|
478
|
+
* @returns Transaction result
|
|
479
|
+
*/
|
|
480
|
+
sell(params: SellParams): Promise<TransactionResult>;
|
|
481
|
+
/**
|
|
482
|
+
* Sell tokens with automatic slippage calculation
|
|
483
|
+
*
|
|
484
|
+
* @param token - Token address
|
|
485
|
+
* @param tokenAmount - Token amount to sell
|
|
486
|
+
* @param slippageBps - Slippage tolerance in basis points (default: 100 = 1%)
|
|
487
|
+
*/
|
|
488
|
+
sellWithSlippage(token: Address, tokenAmount: bigint, slippageBps?: number): Promise<TransactionResult>;
|
|
489
|
+
/**
|
|
490
|
+
* Migrate liquidity to Uniswap V3
|
|
491
|
+
*
|
|
492
|
+
* @param params - Migration parameters
|
|
493
|
+
* @returns Transaction result with pool address
|
|
494
|
+
*/
|
|
495
|
+
migrate(params: MigrateParams): Promise<TransactionResult & {
|
|
496
|
+
poolAddress?: Address;
|
|
497
|
+
}>;
|
|
498
|
+
/**
|
|
499
|
+
* Watch for new token creation events
|
|
500
|
+
*
|
|
501
|
+
* @param callback - Callback function for each event
|
|
502
|
+
* @returns Unwatch function
|
|
503
|
+
*/
|
|
504
|
+
watchCreateEvents(callback: (event: CreateEvent) => void): () => void;
|
|
505
|
+
/**
|
|
506
|
+
* Watch for trade events on a specific token
|
|
507
|
+
*
|
|
508
|
+
* @param token - Token address (optional, watches all if not provided)
|
|
509
|
+
* @param callback - Callback function for each event
|
|
510
|
+
* @returns Unwatch function
|
|
511
|
+
*/
|
|
512
|
+
watchTradeEvents(token: Address | undefined, callback: (event: TradeEvent) => void): () => void;
|
|
513
|
+
/**
|
|
514
|
+
* Watch for bonding curve completion events
|
|
515
|
+
*
|
|
516
|
+
* @param callback - Callback function for each event
|
|
517
|
+
* @returns Unwatch function
|
|
518
|
+
*/
|
|
519
|
+
watchCompleteEvents(callback: (event: CompleteEvent) => void): () => void;
|
|
520
|
+
/**
|
|
521
|
+
* Watch for migration events
|
|
522
|
+
*
|
|
523
|
+
* @param callback - Callback function for each event
|
|
524
|
+
* @returns Unwatch function
|
|
525
|
+
*/
|
|
526
|
+
watchMigrationEvents(callback: (event: MigrationEvent) => void): () => void;
|
|
527
|
+
/**
|
|
528
|
+
* Check if a token's bonding curve is complete
|
|
529
|
+
*
|
|
530
|
+
* @param token - Token address
|
|
531
|
+
*/
|
|
532
|
+
isComplete(token: Address): Promise<boolean>;
|
|
533
|
+
/**
|
|
534
|
+
* Check if a token has been migrated
|
|
535
|
+
*
|
|
536
|
+
* @param token - Token address
|
|
537
|
+
*/
|
|
538
|
+
isMigrated(token: Address): Promise<boolean>;
|
|
539
|
+
/**
|
|
540
|
+
* Get the factory contract address
|
|
541
|
+
*/
|
|
542
|
+
getFactoryAddress(): Address;
|
|
543
|
+
/**
|
|
544
|
+
* Get the public client
|
|
545
|
+
*/
|
|
546
|
+
getPublicClient(): PublicClient;
|
|
547
|
+
/**
|
|
548
|
+
* Get the wallet client
|
|
549
|
+
*/
|
|
550
|
+
getWalletClient(): WalletClient | null;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Protocol fee constants (matching smart contract)
|
|
555
|
+
*/
|
|
556
|
+
declare const PROTOCOL_FEE_BASIS_POINTS = 70n;
|
|
557
|
+
declare const CREATOR_FEE_BASIS_POINTS = 30n;
|
|
558
|
+
declare const TOTAL_FEE_BASIS_POINTS: bigint;
|
|
559
|
+
declare const MAX_FEE_BASIS_POINTS = 1000n;
|
|
560
|
+
/**
|
|
561
|
+
* Migration constants
|
|
562
|
+
*/
|
|
563
|
+
declare const MIGRATION_THRESHOLD = 4000000000000000000n;
|
|
564
|
+
declare const TOKENS_FOR_LP = 206900000000000000000000000n;
|
|
565
|
+
declare const MAX_MIGRATE_FEES = 300000000000000n;
|
|
566
|
+
/**
|
|
567
|
+
* Uniswap V3 constants
|
|
568
|
+
*/
|
|
569
|
+
declare const UNISWAP_FEE_TIER = 3000;
|
|
570
|
+
declare const TICK_LOWER = -887220;
|
|
571
|
+
declare const TICK_UPPER = 887220;
|
|
572
|
+
/**
|
|
573
|
+
* Default slippage tolerance
|
|
574
|
+
*/
|
|
575
|
+
declare const DEFAULT_SLIPPAGE_BPS = 100;
|
|
576
|
+
/**
|
|
577
|
+
* Basis points denominator
|
|
578
|
+
*/
|
|
579
|
+
declare const BPS_DENOMINATOR = 10000n;
|
|
580
|
+
/**
|
|
581
|
+
* Chain configurations
|
|
582
|
+
*/
|
|
583
|
+
interface ChainConfig {
|
|
584
|
+
chainId: number;
|
|
585
|
+
name: string;
|
|
586
|
+
factoryAddress: Address;
|
|
587
|
+
wethAddress: Address;
|
|
588
|
+
nonfungiblePositionManager: Address;
|
|
589
|
+
uniswapV3Factory: Address;
|
|
590
|
+
blockExplorer: string;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Supported chain configurations
|
|
594
|
+
* Add your deployed contract addresses here
|
|
595
|
+
*/
|
|
596
|
+
declare const CHAIN_CONFIGS: Record<number, ChainConfig>;
|
|
597
|
+
/**
|
|
598
|
+
* Get chain configuration by chain ID
|
|
599
|
+
*/
|
|
600
|
+
declare function getChainConfig(chainId: number): ChainConfig | undefined;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Format a bigint wei value to a human-readable ETH string
|
|
604
|
+
*/
|
|
605
|
+
declare function formatEthValue(wei: bigint, decimals?: number): string;
|
|
606
|
+
/**
|
|
607
|
+
* Format a token amount to a human-readable string
|
|
608
|
+
*/
|
|
609
|
+
declare function formatTokenAmount(amount: bigint, decimals?: number): string;
|
|
610
|
+
/**
|
|
611
|
+
* Parse an ETH string to wei
|
|
612
|
+
*/
|
|
613
|
+
declare function parseEthValue(eth: string): bigint;
|
|
614
|
+
/**
|
|
615
|
+
* Calculate slippage-adjusted minimum amount
|
|
616
|
+
*/
|
|
617
|
+
declare function calculateWithSlippage(amount: bigint, slippageBps: number): bigint;
|
|
618
|
+
/**
|
|
619
|
+
* Calculate percentage of migration threshold reached
|
|
620
|
+
*/
|
|
621
|
+
declare function calculateMigrationProgress(realEthReserves: bigint): number;
|
|
622
|
+
/**
|
|
623
|
+
* Format price with appropriate precision
|
|
624
|
+
*/
|
|
625
|
+
declare function formatPrice(priceWei: bigint): string;
|
|
626
|
+
/**
|
|
627
|
+
* Format market cap in ETH
|
|
628
|
+
*/
|
|
629
|
+
declare function formatMarketCap(marketCapWei: bigint): string;
|
|
630
|
+
/**
|
|
631
|
+
* Validate Ethereum address format
|
|
632
|
+
*/
|
|
633
|
+
declare function isValidAddress(address: string): address is Address;
|
|
634
|
+
/**
|
|
635
|
+
* Truncate address for display
|
|
636
|
+
*/
|
|
637
|
+
declare function truncateAddress(address: Address, chars?: number): string;
|
|
638
|
+
/**
|
|
639
|
+
* Convert basis points to percentage
|
|
640
|
+
*/
|
|
641
|
+
declare function bpsToPercent(bps: number | bigint): number;
|
|
642
|
+
/**
|
|
643
|
+
* Convert percentage to basis points
|
|
644
|
+
*/
|
|
645
|
+
declare function percentToBps(percent: number): number;
|
|
646
|
+
/**
|
|
647
|
+
* Calculate price impact as a percentage
|
|
648
|
+
*/
|
|
649
|
+
declare function calculatePriceImpact(currentPrice: bigint, newPrice: bigint): number;
|
|
650
|
+
/**
|
|
651
|
+
* Sleep utility for polling
|
|
652
|
+
*/
|
|
653
|
+
declare function sleep(ms: number): Promise<void>;
|
|
654
|
+
/**
|
|
655
|
+
* Retry a function with exponential backoff
|
|
656
|
+
*/
|
|
657
|
+
declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, baseDelayMs?: number): Promise<T>;
|
|
658
|
+
|
|
659
|
+
declare const MANIA_FACTORY_ABI: readonly [{
|
|
660
|
+
readonly type: "function";
|
|
661
|
+
readonly name: "bondingCurves";
|
|
662
|
+
readonly inputs: readonly [{
|
|
663
|
+
readonly name: "mint";
|
|
664
|
+
readonly type: "address";
|
|
665
|
+
}];
|
|
666
|
+
readonly outputs: readonly [{
|
|
667
|
+
readonly name: "virtualTokenReserves";
|
|
668
|
+
readonly type: "uint256";
|
|
669
|
+
}, {
|
|
670
|
+
readonly name: "virtualEthReserves";
|
|
671
|
+
readonly type: "uint64";
|
|
672
|
+
}, {
|
|
673
|
+
readonly name: "realTokenReserves";
|
|
674
|
+
readonly type: "uint256";
|
|
675
|
+
}, {
|
|
676
|
+
readonly name: "realEthReserves";
|
|
677
|
+
readonly type: "uint64";
|
|
678
|
+
}, {
|
|
679
|
+
readonly name: "tokenTotalSupply";
|
|
680
|
+
readonly type: "uint256";
|
|
681
|
+
}, {
|
|
682
|
+
readonly name: "complete";
|
|
683
|
+
readonly type: "bool";
|
|
684
|
+
}, {
|
|
685
|
+
readonly name: "trackVolume";
|
|
686
|
+
readonly type: "bool";
|
|
687
|
+
}];
|
|
688
|
+
readonly stateMutability: "view";
|
|
689
|
+
}, {
|
|
690
|
+
readonly type: "function";
|
|
691
|
+
readonly name: "buy";
|
|
692
|
+
readonly inputs: readonly [{
|
|
693
|
+
readonly name: "token";
|
|
694
|
+
readonly type: "address";
|
|
695
|
+
}, {
|
|
696
|
+
readonly name: "minTokensOut";
|
|
697
|
+
readonly type: "uint256";
|
|
698
|
+
}, {
|
|
699
|
+
readonly name: "recipient";
|
|
700
|
+
readonly type: "address";
|
|
701
|
+
}];
|
|
702
|
+
readonly outputs: readonly [];
|
|
703
|
+
readonly stateMutability: "payable";
|
|
704
|
+
}, {
|
|
705
|
+
readonly type: "function";
|
|
706
|
+
readonly name: "create";
|
|
707
|
+
readonly inputs: readonly [{
|
|
708
|
+
readonly name: "name";
|
|
709
|
+
readonly type: "string";
|
|
710
|
+
}, {
|
|
711
|
+
readonly name: "symbol";
|
|
712
|
+
readonly type: "string";
|
|
713
|
+
}, {
|
|
714
|
+
readonly name: "uri";
|
|
715
|
+
readonly type: "string";
|
|
716
|
+
}, {
|
|
717
|
+
readonly name: "creator";
|
|
718
|
+
readonly type: "address";
|
|
719
|
+
}];
|
|
720
|
+
readonly outputs: readonly [{
|
|
721
|
+
readonly name: "token";
|
|
722
|
+
readonly type: "address";
|
|
723
|
+
}];
|
|
724
|
+
readonly stateMutability: "nonpayable";
|
|
725
|
+
}, {
|
|
726
|
+
readonly type: "function";
|
|
727
|
+
readonly name: "createAndBuy";
|
|
728
|
+
readonly inputs: readonly [{
|
|
729
|
+
readonly name: "name";
|
|
730
|
+
readonly type: "string";
|
|
731
|
+
}, {
|
|
732
|
+
readonly name: "symbol";
|
|
733
|
+
readonly type: "string";
|
|
734
|
+
}, {
|
|
735
|
+
readonly name: "uri";
|
|
736
|
+
readonly type: "string";
|
|
737
|
+
}, {
|
|
738
|
+
readonly name: "creator";
|
|
739
|
+
readonly type: "address";
|
|
740
|
+
}, {
|
|
741
|
+
readonly name: "minTokensOut";
|
|
742
|
+
readonly type: "uint256";
|
|
743
|
+
}];
|
|
744
|
+
readonly outputs: readonly [{
|
|
745
|
+
readonly name: "token";
|
|
746
|
+
readonly type: "address";
|
|
747
|
+
}];
|
|
748
|
+
readonly stateMutability: "payable";
|
|
749
|
+
}, {
|
|
750
|
+
readonly type: "function";
|
|
751
|
+
readonly name: "getBondingCurve";
|
|
752
|
+
readonly inputs: readonly [{
|
|
753
|
+
readonly name: "token";
|
|
754
|
+
readonly type: "address";
|
|
755
|
+
}];
|
|
756
|
+
readonly outputs: readonly [{
|
|
757
|
+
readonly name: "curve";
|
|
758
|
+
readonly type: "tuple";
|
|
759
|
+
readonly components: readonly [{
|
|
760
|
+
readonly name: "virtualTokenReserves";
|
|
761
|
+
readonly type: "uint256";
|
|
762
|
+
}, {
|
|
763
|
+
readonly name: "virtualEthReserves";
|
|
764
|
+
readonly type: "uint64";
|
|
765
|
+
}, {
|
|
766
|
+
readonly name: "realTokenReserves";
|
|
767
|
+
readonly type: "uint256";
|
|
768
|
+
}, {
|
|
769
|
+
readonly name: "realEthReserves";
|
|
770
|
+
readonly type: "uint64";
|
|
771
|
+
}, {
|
|
772
|
+
readonly name: "tokenTotalSupply";
|
|
773
|
+
readonly type: "uint256";
|
|
774
|
+
}, {
|
|
775
|
+
readonly name: "complete";
|
|
776
|
+
readonly type: "bool";
|
|
777
|
+
}, {
|
|
778
|
+
readonly name: "trackVolume";
|
|
779
|
+
readonly type: "bool";
|
|
780
|
+
}];
|
|
781
|
+
}];
|
|
782
|
+
readonly stateMutability: "view";
|
|
783
|
+
}, {
|
|
784
|
+
readonly type: "function";
|
|
785
|
+
readonly name: "getBuyQuote";
|
|
786
|
+
readonly inputs: readonly [{
|
|
787
|
+
readonly name: "token";
|
|
788
|
+
readonly type: "address";
|
|
789
|
+
}, {
|
|
790
|
+
readonly name: "ethAmount";
|
|
791
|
+
readonly type: "uint64";
|
|
792
|
+
}];
|
|
793
|
+
readonly outputs: readonly [{
|
|
794
|
+
readonly name: "tokenAmount";
|
|
795
|
+
readonly type: "uint256";
|
|
796
|
+
}];
|
|
797
|
+
readonly stateMutability: "view";
|
|
798
|
+
}, {
|
|
799
|
+
readonly type: "function";
|
|
800
|
+
readonly name: "getFee";
|
|
801
|
+
readonly inputs: readonly [{
|
|
802
|
+
readonly name: "amount";
|
|
803
|
+
readonly type: "uint64";
|
|
804
|
+
}];
|
|
805
|
+
readonly outputs: readonly [{
|
|
806
|
+
readonly name: "fee";
|
|
807
|
+
readonly type: "uint128";
|
|
808
|
+
}];
|
|
809
|
+
readonly stateMutability: "view";
|
|
810
|
+
}, {
|
|
811
|
+
readonly type: "function";
|
|
812
|
+
readonly name: "getSellQuote";
|
|
813
|
+
readonly inputs: readonly [{
|
|
814
|
+
readonly name: "token";
|
|
815
|
+
readonly type: "address";
|
|
816
|
+
}, {
|
|
817
|
+
readonly name: "amount";
|
|
818
|
+
readonly type: "uint256";
|
|
819
|
+
}];
|
|
820
|
+
readonly outputs: readonly [{
|
|
821
|
+
readonly name: "ethOutput";
|
|
822
|
+
readonly type: "uint128";
|
|
823
|
+
}];
|
|
824
|
+
readonly stateMutability: "view";
|
|
825
|
+
}, {
|
|
826
|
+
readonly type: "function";
|
|
827
|
+
readonly name: "global";
|
|
828
|
+
readonly inputs: readonly [];
|
|
829
|
+
readonly outputs: readonly [{
|
|
830
|
+
readonly name: "initialized";
|
|
831
|
+
readonly type: "bool";
|
|
832
|
+
}, {
|
|
833
|
+
readonly name: "authority";
|
|
834
|
+
readonly type: "address";
|
|
835
|
+
}, {
|
|
836
|
+
readonly name: "feeRecipient";
|
|
837
|
+
readonly type: "address";
|
|
838
|
+
}, {
|
|
839
|
+
readonly name: "initialVirtualTokenReserves";
|
|
840
|
+
readonly type: "uint256";
|
|
841
|
+
}, {
|
|
842
|
+
readonly name: "initialVirtualEthReserves";
|
|
843
|
+
readonly type: "uint64";
|
|
844
|
+
}, {
|
|
845
|
+
readonly name: "initialRealTokenReserves";
|
|
846
|
+
readonly type: "uint256";
|
|
847
|
+
}, {
|
|
848
|
+
readonly name: "tokenTotalSupply";
|
|
849
|
+
readonly type: "uint256";
|
|
850
|
+
}, {
|
|
851
|
+
readonly name: "feeBasisPoints";
|
|
852
|
+
readonly type: "uint64";
|
|
853
|
+
}, {
|
|
854
|
+
readonly name: "withdrawAuthority";
|
|
855
|
+
readonly type: "address";
|
|
856
|
+
}, {
|
|
857
|
+
readonly name: "enableMigrate";
|
|
858
|
+
readonly type: "bool";
|
|
859
|
+
}, {
|
|
860
|
+
readonly name: "poolMigrationFee";
|
|
861
|
+
readonly type: "uint64";
|
|
862
|
+
}];
|
|
863
|
+
readonly stateMutability: "view";
|
|
864
|
+
}, {
|
|
865
|
+
readonly type: "function";
|
|
866
|
+
readonly name: "migrate";
|
|
867
|
+
readonly inputs: readonly [{
|
|
868
|
+
readonly name: "token";
|
|
869
|
+
readonly type: "address";
|
|
870
|
+
}];
|
|
871
|
+
readonly outputs: readonly [];
|
|
872
|
+
readonly stateMutability: "payable";
|
|
873
|
+
}, {
|
|
874
|
+
readonly type: "function";
|
|
875
|
+
readonly name: "sell";
|
|
876
|
+
readonly inputs: readonly [{
|
|
877
|
+
readonly name: "token";
|
|
878
|
+
readonly type: "address";
|
|
879
|
+
}, {
|
|
880
|
+
readonly name: "amount";
|
|
881
|
+
readonly type: "uint256";
|
|
882
|
+
}, {
|
|
883
|
+
readonly name: "minEthOutput";
|
|
884
|
+
readonly type: "uint64";
|
|
885
|
+
}];
|
|
886
|
+
readonly outputs: readonly [];
|
|
887
|
+
readonly stateMutability: "nonpayable";
|
|
888
|
+
}, {
|
|
889
|
+
readonly type: "function";
|
|
890
|
+
readonly name: "userVolume";
|
|
891
|
+
readonly inputs: readonly [{
|
|
892
|
+
readonly name: "user";
|
|
893
|
+
readonly type: "address";
|
|
894
|
+
}];
|
|
895
|
+
readonly outputs: readonly [{
|
|
896
|
+
readonly name: "volume";
|
|
897
|
+
readonly type: "uint256";
|
|
898
|
+
}];
|
|
899
|
+
readonly stateMutability: "view";
|
|
900
|
+
}, {
|
|
901
|
+
readonly type: "event";
|
|
902
|
+
readonly name: "CreateEvent";
|
|
903
|
+
readonly inputs: readonly [{
|
|
904
|
+
readonly name: "name";
|
|
905
|
+
readonly type: "string";
|
|
906
|
+
readonly indexed: false;
|
|
907
|
+
}, {
|
|
908
|
+
readonly name: "symbol";
|
|
909
|
+
readonly type: "string";
|
|
910
|
+
readonly indexed: false;
|
|
911
|
+
}, {
|
|
912
|
+
readonly name: "uri";
|
|
913
|
+
readonly type: "string";
|
|
914
|
+
readonly indexed: false;
|
|
915
|
+
}, {
|
|
916
|
+
readonly name: "mint";
|
|
917
|
+
readonly type: "address";
|
|
918
|
+
readonly indexed: true;
|
|
919
|
+
}, {
|
|
920
|
+
readonly name: "user";
|
|
921
|
+
readonly type: "address";
|
|
922
|
+
readonly indexed: true;
|
|
923
|
+
}, {
|
|
924
|
+
readonly name: "creator";
|
|
925
|
+
readonly type: "address";
|
|
926
|
+
readonly indexed: true;
|
|
927
|
+
}, {
|
|
928
|
+
readonly name: "timestamp";
|
|
929
|
+
readonly type: "uint256";
|
|
930
|
+
readonly indexed: false;
|
|
931
|
+
}];
|
|
932
|
+
readonly anonymous: false;
|
|
933
|
+
}, {
|
|
934
|
+
readonly type: "event";
|
|
935
|
+
readonly name: "TradeEvent";
|
|
936
|
+
readonly inputs: readonly [{
|
|
937
|
+
readonly name: "mint";
|
|
938
|
+
readonly type: "address";
|
|
939
|
+
readonly indexed: true;
|
|
940
|
+
}, {
|
|
941
|
+
readonly name: "ethAmount";
|
|
942
|
+
readonly type: "uint64";
|
|
943
|
+
readonly indexed: false;
|
|
944
|
+
}, {
|
|
945
|
+
readonly name: "tokenAmount";
|
|
946
|
+
readonly type: "uint256";
|
|
947
|
+
readonly indexed: false;
|
|
948
|
+
}, {
|
|
949
|
+
readonly name: "isBuy";
|
|
950
|
+
readonly type: "bool";
|
|
951
|
+
readonly indexed: false;
|
|
952
|
+
}, {
|
|
953
|
+
readonly name: "user";
|
|
954
|
+
readonly type: "address";
|
|
955
|
+
readonly indexed: true;
|
|
956
|
+
}, {
|
|
957
|
+
readonly name: "timestamp";
|
|
958
|
+
readonly type: "uint256";
|
|
959
|
+
readonly indexed: false;
|
|
960
|
+
}, {
|
|
961
|
+
readonly name: "virtualEthReserves";
|
|
962
|
+
readonly type: "uint64";
|
|
963
|
+
readonly indexed: false;
|
|
964
|
+
}, {
|
|
965
|
+
readonly name: "virtualTokenReserves";
|
|
966
|
+
readonly type: "uint256";
|
|
967
|
+
readonly indexed: false;
|
|
968
|
+
}, {
|
|
969
|
+
readonly name: "realEthReserves";
|
|
970
|
+
readonly type: "uint64";
|
|
971
|
+
readonly indexed: false;
|
|
972
|
+
}, {
|
|
973
|
+
readonly name: "realTokenReserves";
|
|
974
|
+
readonly type: "uint256";
|
|
975
|
+
readonly indexed: false;
|
|
976
|
+
}];
|
|
977
|
+
readonly anonymous: false;
|
|
978
|
+
}, {
|
|
979
|
+
readonly type: "event";
|
|
980
|
+
readonly name: "CompleteEvent";
|
|
981
|
+
readonly inputs: readonly [{
|
|
982
|
+
readonly name: "user";
|
|
983
|
+
readonly type: "address";
|
|
984
|
+
readonly indexed: true;
|
|
985
|
+
}, {
|
|
986
|
+
readonly name: "mint";
|
|
987
|
+
readonly type: "address";
|
|
988
|
+
readonly indexed: true;
|
|
989
|
+
}, {
|
|
990
|
+
readonly name: "timestamp";
|
|
991
|
+
readonly type: "uint256";
|
|
992
|
+
readonly indexed: false;
|
|
993
|
+
}];
|
|
994
|
+
readonly anonymous: false;
|
|
995
|
+
}, {
|
|
996
|
+
readonly type: "event";
|
|
997
|
+
readonly name: "CompleteManiaAmmMigrationEvent";
|
|
998
|
+
readonly inputs: readonly [{
|
|
999
|
+
readonly name: "user";
|
|
1000
|
+
readonly type: "address";
|
|
1001
|
+
readonly indexed: true;
|
|
1002
|
+
}, {
|
|
1003
|
+
readonly name: "mint";
|
|
1004
|
+
readonly type: "address";
|
|
1005
|
+
readonly indexed: true;
|
|
1006
|
+
}, {
|
|
1007
|
+
readonly name: "mintAmount";
|
|
1008
|
+
readonly type: "uint256";
|
|
1009
|
+
readonly indexed: false;
|
|
1010
|
+
}, {
|
|
1011
|
+
readonly name: "ethAmount";
|
|
1012
|
+
readonly type: "uint64";
|
|
1013
|
+
readonly indexed: false;
|
|
1014
|
+
}, {
|
|
1015
|
+
readonly name: "poolMigrationFee";
|
|
1016
|
+
readonly type: "uint64";
|
|
1017
|
+
readonly indexed: false;
|
|
1018
|
+
}, {
|
|
1019
|
+
readonly name: "timestamp";
|
|
1020
|
+
readonly type: "uint256";
|
|
1021
|
+
readonly indexed: false;
|
|
1022
|
+
}, {
|
|
1023
|
+
readonly name: "pool";
|
|
1024
|
+
readonly type: "address";
|
|
1025
|
+
readonly indexed: true;
|
|
1026
|
+
}];
|
|
1027
|
+
readonly anonymous: false;
|
|
1028
|
+
}];
|
|
1029
|
+
declare const ERC20_ABI: readonly [{
|
|
1030
|
+
readonly type: "function";
|
|
1031
|
+
readonly name: "name";
|
|
1032
|
+
readonly inputs: readonly [];
|
|
1033
|
+
readonly outputs: readonly [{
|
|
1034
|
+
readonly type: "string";
|
|
1035
|
+
}];
|
|
1036
|
+
readonly stateMutability: "view";
|
|
1037
|
+
}, {
|
|
1038
|
+
readonly type: "function";
|
|
1039
|
+
readonly name: "symbol";
|
|
1040
|
+
readonly inputs: readonly [];
|
|
1041
|
+
readonly outputs: readonly [{
|
|
1042
|
+
readonly type: "string";
|
|
1043
|
+
}];
|
|
1044
|
+
readonly stateMutability: "view";
|
|
1045
|
+
}, {
|
|
1046
|
+
readonly type: "function";
|
|
1047
|
+
readonly name: "decimals";
|
|
1048
|
+
readonly inputs: readonly [];
|
|
1049
|
+
readonly outputs: readonly [{
|
|
1050
|
+
readonly type: "uint8";
|
|
1051
|
+
}];
|
|
1052
|
+
readonly stateMutability: "view";
|
|
1053
|
+
}, {
|
|
1054
|
+
readonly type: "function";
|
|
1055
|
+
readonly name: "totalSupply";
|
|
1056
|
+
readonly inputs: readonly [];
|
|
1057
|
+
readonly outputs: readonly [{
|
|
1058
|
+
readonly type: "uint256";
|
|
1059
|
+
}];
|
|
1060
|
+
readonly stateMutability: "view";
|
|
1061
|
+
}, {
|
|
1062
|
+
readonly type: "function";
|
|
1063
|
+
readonly name: "balanceOf";
|
|
1064
|
+
readonly inputs: readonly [{
|
|
1065
|
+
readonly name: "account";
|
|
1066
|
+
readonly type: "address";
|
|
1067
|
+
}];
|
|
1068
|
+
readonly outputs: readonly [{
|
|
1069
|
+
readonly type: "uint256";
|
|
1070
|
+
}];
|
|
1071
|
+
readonly stateMutability: "view";
|
|
1072
|
+
}, {
|
|
1073
|
+
readonly type: "function";
|
|
1074
|
+
readonly name: "allowance";
|
|
1075
|
+
readonly inputs: readonly [{
|
|
1076
|
+
readonly name: "owner";
|
|
1077
|
+
readonly type: "address";
|
|
1078
|
+
}, {
|
|
1079
|
+
readonly name: "spender";
|
|
1080
|
+
readonly type: "address";
|
|
1081
|
+
}];
|
|
1082
|
+
readonly outputs: readonly [{
|
|
1083
|
+
readonly type: "uint256";
|
|
1084
|
+
}];
|
|
1085
|
+
readonly stateMutability: "view";
|
|
1086
|
+
}, {
|
|
1087
|
+
readonly type: "function";
|
|
1088
|
+
readonly name: "approve";
|
|
1089
|
+
readonly inputs: readonly [{
|
|
1090
|
+
readonly name: "spender";
|
|
1091
|
+
readonly type: "address";
|
|
1092
|
+
}, {
|
|
1093
|
+
readonly name: "amount";
|
|
1094
|
+
readonly type: "uint256";
|
|
1095
|
+
}];
|
|
1096
|
+
readonly outputs: readonly [{
|
|
1097
|
+
readonly type: "bool";
|
|
1098
|
+
}];
|
|
1099
|
+
readonly stateMutability: "nonpayable";
|
|
1100
|
+
}, {
|
|
1101
|
+
readonly type: "function";
|
|
1102
|
+
readonly name: "transfer";
|
|
1103
|
+
readonly inputs: readonly [{
|
|
1104
|
+
readonly name: "to";
|
|
1105
|
+
readonly type: "address";
|
|
1106
|
+
}, {
|
|
1107
|
+
readonly name: "amount";
|
|
1108
|
+
readonly type: "uint256";
|
|
1109
|
+
}];
|
|
1110
|
+
readonly outputs: readonly [{
|
|
1111
|
+
readonly type: "bool";
|
|
1112
|
+
}];
|
|
1113
|
+
readonly stateMutability: "nonpayable";
|
|
1114
|
+
}];
|
|
1115
|
+
|
|
1116
|
+
export { BPS_DENOMINATOR, BondingCurve, type BondingCurveState, type BuyParams, type BuyQuote, CHAIN_CONFIGS, CREATOR_FEE_BASIS_POINTS, type ChainConfig, type CompleteEvent, type CreateAndBuyParams, type CreateEvent, type CreateTokenParams, DEFAULT_SLIPPAGE_BPS, ERC20_ABI, type GlobalState, MANIA_FACTORY_ABI, MAX_FEE_BASIS_POINTS, MAX_MIGRATE_FEES, MIGRATION_THRESHOLD, ManiaSDK, type ManiaSDKConfig, type MigrateParams, type MigrationEvent, PROTOCOL_FEE_BASIS_POINTS, type SellParams, type SellQuote, type SetParamsInput, type SlippageConfig, TICK_LOWER, TICK_UPPER, TOKENS_FOR_LP, TOTAL_FEE_BASIS_POINTS, type TokenInfo, type TradeEvent, type TransactionResult, UNISWAP_FEE_TIER, bpsToPercent, calculateBuyAmount, calculateMigrationProgress, calculatePriceImpact, calculateSellAmount, calculateWithSlippage, formatEthValue, formatMarketCap, formatPrice, formatTokenAmount, getChainConfig, isValidAddress, parseEthValue, percentToBps, sleep, truncateAddress, withRetry };
|