@pickhooks/sdk 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +309 -3
- package/dist/abis/any3.d.ts +2123 -0
- package/dist/abis/any3.js +3 -0
- package/dist/abis/anytax.d.ts +1786 -0
- package/dist/abis/anytax.js +3 -0
- package/dist/abis/calls.d.ts +2515 -0
- package/dist/abis/calls.js +4 -0
- package/dist/abis/common.d.ts +449 -0
- package/dist/abis/common.js +91 -0
- package/dist/abis/dips.d.ts +897 -0
- package/dist/abis/dips.js +2 -0
- package/dist/abis/index.d.ts +12 -0
- package/dist/abis/index.js +12 -0
- package/dist/abis/infra.d.ts +701 -0
- package/dist/abis/infra.js +4 -0
- package/dist/abis/lever.d.ts +1710 -0
- package/dist/abis/lever.js +5 -0
- package/dist/abis/lever2.d.ts +2710 -0
- package/dist/abis/lever2.js +5 -0
- package/dist/abis/pools.d.ts +1898 -0
- package/dist/abis/pools.js +4 -0
- package/dist/abis/sticky.d.ts +953 -0
- package/dist/abis/sticky.js +4 -0
- package/dist/abis/v1.d.ts +1627 -0
- package/dist/abis/v1.js +5 -0
- package/dist/abis/v2.d.ts +3264 -0
- package/dist/abis/v2.js +8 -0
- package/dist/addresses.d.ts +87 -0
- package/dist/addresses.js +62 -0
- package/dist/any.d.ts +447 -0
- package/dist/any.js +729 -0
- package/dist/api.d.ts +62 -0
- package/dist/api.js +30 -0
- package/dist/blocks.d.ts +107 -0
- package/dist/blocks.js +126 -0
- package/dist/coin-rules-config.d.ts +8 -0
- package/dist/coin-rules-config.js +13 -0
- package/dist/coin-rules.d.ts +383 -0
- package/dist/coin-rules.js +878 -0
- package/dist/coins.d.ts +217 -0
- package/dist/coins.js +520 -0
- package/dist/dips.d.ts +133 -0
- package/dist/dips.js +148 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +347 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +58 -0
- package/dist/infinity.d.ts +63 -0
- package/dist/infinity.js +96 -0
- package/dist/infra.d.ts +112 -0
- package/dist/infra.js +114 -0
- package/dist/lever.d.ts +391 -0
- package/dist/lever.js +419 -0
- package/dist/pools.d.ts +274 -0
- package/dist/pools.js +405 -0
- package/dist/sticky-rules.d.ts +179 -0
- package/dist/sticky-rules.js +580 -0
- package/dist/sticky.d.ts +216 -0
- package/dist/sticky.js +292 -0
- package/dist/tx.d.ts +70 -0
- package/dist/tx.js +69 -0
- package/dist/v3.d.ts +42 -0
- package/dist/v3.js +98 -0
- package/package.json +58 -4
package/dist/any.d.ts
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { type Address, type Hex, type TransactionReceipt } from "viem";
|
|
2
|
+
import { type PoolKey, poolIdOf } from "./infinity.js";
|
|
3
|
+
import { type Ctx, type SendOptions, type Sent, type TxRequest } from "./tx.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hook any coin: a PancakeSwap Infinity pool BNB / coin next to a coin's own pools, with a normal dynamic LP fee (routers
|
|
6
|
+
* see a plain pool). Two lines:
|
|
7
|
+
* - main (v3, factory 0x1662…be117): after a swap the hook closes the gap to the coin's PancakeSwap V2 pair in the same
|
|
8
|
+
* transaction (arb recapture) and gives the trader a share of that profit. Fees and recapture profits are split:
|
|
9
|
+
* opener side (and its jackpot), then of the platform's part a share for the pool's partner and for a listed router.
|
|
10
|
+
* - tax (flap tax coins, off until addresses.anyTaxFactory is set): in flap's anti-farmer state the coin's tax applies in
|
|
11
|
+
* the pool like on its main pool; sells must pay their coins in first (the SDK does that), terminals sell in the main
|
|
12
|
+
* pool. No recapture, partners or routers on this line.
|
|
13
|
+
*/
|
|
14
|
+
export type { PoolKey } from "./infinity.js";
|
|
15
|
+
export { poolIdOf } from "./infinity.js";
|
|
16
|
+
export type AnyLine = "main" | "tax";
|
|
17
|
+
/** A pool id, a pool key, or a pool read with pools()/pool(). */
|
|
18
|
+
export type PoolRef = Hex | PoolKey | {
|
|
19
|
+
id: Hex;
|
|
20
|
+
key: PoolKey;
|
|
21
|
+
line?: AnyLine;
|
|
22
|
+
};
|
|
23
|
+
/** What a pool does, fixed when it opened (basis points unless named otherwise). */
|
|
24
|
+
export type PoolConfig = {
|
|
25
|
+
/** the LP fee, 20 to 100 (0.2 % to 1 %) */
|
|
26
|
+
feeBps: number;
|
|
27
|
+
/** the LP fee for wallets holding at least holderMin $hooks (raw, 18 decimals); holderMin 0 means none */
|
|
28
|
+
holderFeeBps: number;
|
|
29
|
+
holderMin: bigint;
|
|
30
|
+
/** the opener's side of every BNB fee and recapture profit (the jackpot's share comes out of it) */
|
|
31
|
+
openerBps: number;
|
|
32
|
+
potBps: number;
|
|
33
|
+
/** the fire: share of every buy's coins burned out of the coin's chest */
|
|
34
|
+
chestBps: number;
|
|
35
|
+
jackpotShareBps: number;
|
|
36
|
+
jackpotSilence: number;
|
|
37
|
+
jackpotMinBuy: bigint;
|
|
38
|
+
bonusBps: number;
|
|
39
|
+
bonusLock: number;
|
|
40
|
+
bonusMinBuy: bigint;
|
|
41
|
+
bonusCap: bigint;
|
|
42
|
+
/** main line: the coin's V2 pair the hook recaptures against; zero address: no recapture (always on the tax line) */
|
|
43
|
+
pair: Address;
|
|
44
|
+
/** main line: the trader's share of each recapture */
|
|
45
|
+
traderBps: number;
|
|
46
|
+
/** main line: the partner that brought the pool, and its share of the platform's part; zero address: none */
|
|
47
|
+
partner: Address;
|
|
48
|
+
partnerBps: number;
|
|
49
|
+
/** tax line: the coin had the Infinity vault on its tax list when the pool opened */
|
|
50
|
+
vaultTaxed: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type PoolPosition = {
|
|
53
|
+
index: number;
|
|
54
|
+
tickLower: number;
|
|
55
|
+
tickUpper: number;
|
|
56
|
+
liquidity: bigint;
|
|
57
|
+
unlockAt: number;
|
|
58
|
+
};
|
|
59
|
+
/** a flap tax coin's tax as it stands now (it changes over time), and what of it applies in a tax-line pool */
|
|
60
|
+
export type TaxLive = {
|
|
61
|
+
/** flap's state: 2 anti-farmer (every pool transfer taxed, the vault too), 3 only the main pool taxed, 4 tax free */
|
|
62
|
+
state: number;
|
|
63
|
+
buyBps: number;
|
|
64
|
+
sellBps: number;
|
|
65
|
+
/** when the anti-farmer time ends (unix); the state moves on at the first sell into the main pool after it */
|
|
66
|
+
antiFarmerEnd: number;
|
|
67
|
+
/** the coin has the Infinity vault on its tax list */
|
|
68
|
+
vaultTaxed: boolean;
|
|
69
|
+
/** the tax a buy and a sell pay in the pool right now */
|
|
70
|
+
poolBuyBps: number;
|
|
71
|
+
poolSellBps: number;
|
|
72
|
+
/** sells must pay their coins in first (the SDK's sell does; a plain router sell is refused with PayFirst) */
|
|
73
|
+
payFirst: boolean;
|
|
74
|
+
/** the coin's quote token (WBNB, or a stock token such as QQQB) */
|
|
75
|
+
quote: Address;
|
|
76
|
+
};
|
|
77
|
+
export type AnyPool = {
|
|
78
|
+
id: Hex;
|
|
79
|
+
line: AnyLine;
|
|
80
|
+
/** the factory that opened the pool and its hook: every call for this pool goes there */
|
|
81
|
+
factory: Address;
|
|
82
|
+
hook: Address;
|
|
83
|
+
key: PoolKey;
|
|
84
|
+
token: Address;
|
|
85
|
+
name: string;
|
|
86
|
+
symbol: string;
|
|
87
|
+
decimals: number;
|
|
88
|
+
/** slot n is the pool with tick spacing 10 + n; a coin can have up to 50 pools per line */
|
|
89
|
+
slot: number;
|
|
90
|
+
opener: Address;
|
|
91
|
+
start: number;
|
|
92
|
+
config: PoolConfig;
|
|
93
|
+
buys: number;
|
|
94
|
+
sells: number;
|
|
95
|
+
volumeBnb: bigint;
|
|
96
|
+
feesBnb: bigint;
|
|
97
|
+
burned: bigint;
|
|
98
|
+
burnedFromChest: bigint;
|
|
99
|
+
/** the jackpot, BNB */
|
|
100
|
+
pot: bigint;
|
|
101
|
+
lastBuyer: Address;
|
|
102
|
+
lastBuyTime: number;
|
|
103
|
+
bonusPot: bigint;
|
|
104
|
+
bonusGiven: bigint;
|
|
105
|
+
/** main line: BNB profit of all recaptures, and how many */
|
|
106
|
+
recaptured: bigint;
|
|
107
|
+
recaptures: number;
|
|
108
|
+
/** main line: router credits for buys here that the next collect funds */
|
|
109
|
+
routerDue: bigint;
|
|
110
|
+
/** coins in the coin's chest (the fire), shared by all its pools of the line */
|
|
111
|
+
chest: bigint;
|
|
112
|
+
/** tax line: the coin's tax now; null on the main line */
|
|
113
|
+
tax: TaxLive | null;
|
|
114
|
+
positions: PoolPosition[];
|
|
115
|
+
sqrtPriceX96: bigint;
|
|
116
|
+
tick: number;
|
|
117
|
+
/** the LP fee as the pool manager stores it, hundredths of a bip */
|
|
118
|
+
lpFee: number;
|
|
119
|
+
/** coins per BNB in whole units, at the pool's price */
|
|
120
|
+
price: number;
|
|
121
|
+
/** the latest block's timestamp when this was read */
|
|
122
|
+
chainNow: number;
|
|
123
|
+
};
|
|
124
|
+
export type CoinCheck = {
|
|
125
|
+
token: Address;
|
|
126
|
+
/** which line takes the coin: the main one, or the tax line for a flap tax coin (when it is on) */
|
|
127
|
+
line: AnyLine;
|
|
128
|
+
factory: Address;
|
|
129
|
+
/** factory.check(): 0 the coin can get a pool, else the reason (see text) */
|
|
130
|
+
code: number;
|
|
131
|
+
ok: boolean;
|
|
132
|
+
text: string;
|
|
133
|
+
name: string;
|
|
134
|
+
symbol: string;
|
|
135
|
+
decimals: number;
|
|
136
|
+
/** the price a pool opens at (coin per BNB, Q64.96) and where it comes from */
|
|
137
|
+
sqrtPrice: bigint;
|
|
138
|
+
priceSource: Address;
|
|
139
|
+
/** BNB (tax line: BNB of value) in that price source: a new pool must be at least this deep for buys */
|
|
140
|
+
depth: bigint;
|
|
141
|
+
/** coins per BNB in whole units */
|
|
142
|
+
price: number;
|
|
143
|
+
/** the coin's owner() if it has one (it could pause or blacklist); null for flap tax coins */
|
|
144
|
+
owner: Address | null;
|
|
145
|
+
slotsUsed: number[];
|
|
146
|
+
/** the first free slot, or null when all 50 are taken */
|
|
147
|
+
freeSlot: number | null;
|
|
148
|
+
/** the coin's V2 pair against WBNB (zero address when none): what a main-line pool recaptures against */
|
|
149
|
+
pair: Address;
|
|
150
|
+
/** tax line: the coin's tax now */
|
|
151
|
+
tax: TaxLive | null;
|
|
152
|
+
};
|
|
153
|
+
export type RangeKind = "ladder" | "ladder10" | "around";
|
|
154
|
+
export type OpenParams = {
|
|
155
|
+
token: Address;
|
|
156
|
+
slot: number;
|
|
157
|
+
feeBps: number;
|
|
158
|
+
holderFeeBps: number;
|
|
159
|
+
holderMin: bigint;
|
|
160
|
+
chestBps: number;
|
|
161
|
+
potShareBps: number;
|
|
162
|
+
jackpotShareBps: number;
|
|
163
|
+
jackpotSilence: number;
|
|
164
|
+
jackpotMinBuy: bigint;
|
|
165
|
+
bonusBps: number;
|
|
166
|
+
bonusLock: number;
|
|
167
|
+
bonusMinBuy: bigint;
|
|
168
|
+
bonusCap: bigint;
|
|
169
|
+
expectedSqrtPrice: bigint;
|
|
170
|
+
maxMoveBps: number;
|
|
171
|
+
tickLower: number;
|
|
172
|
+
tickUpper: number;
|
|
173
|
+
tokenAmount: bigint;
|
|
174
|
+
/** main line only */
|
|
175
|
+
partner: Address;
|
|
176
|
+
noRecapture: boolean;
|
|
177
|
+
};
|
|
178
|
+
/** A pool's rules in plain numbers; everything has the site's default. */
|
|
179
|
+
export type OpenOptions = {
|
|
180
|
+
token: Address;
|
|
181
|
+
/** coins the opener puts in (raw units); a pool must be at least as deep as the coin's main pool, see depthNeeds() */
|
|
182
|
+
tokenAmount: bigint;
|
|
183
|
+
/** BNB for a range around the price; ladders take none */
|
|
184
|
+
bnb?: bigint;
|
|
185
|
+
/**
|
|
186
|
+
* ladder: coins only from the price up, no top; ladder10: coins only up to 10x (default); around: coins and BNB, half
|
|
187
|
+
* to twice the price; or exact ticks (fitLadder() gives the widest ladder the coins can make as deep as the main pool)
|
|
188
|
+
*/
|
|
189
|
+
range?: RangeKind | {
|
|
190
|
+
tickLower: number;
|
|
191
|
+
tickUpper: number;
|
|
192
|
+
};
|
|
193
|
+
slot?: number;
|
|
194
|
+
/** default 30 (0.3 %) */
|
|
195
|
+
feeBps?: number;
|
|
196
|
+
/** default 5 (0.05 %) for wallets with holderMin $hooks; holderMin 0n switches it off */
|
|
197
|
+
holderFeeBps?: number;
|
|
198
|
+
/** default 10,000 $hooks */
|
|
199
|
+
holderMin?: bigint;
|
|
200
|
+
/** the fire, default 200 (2 % of every buy's coins burned out of the chest) */
|
|
201
|
+
chestBps?: number;
|
|
202
|
+
/** lock to earn: default 500 (5 %) for 7 days, buys from 0.05 BNB; false for none */
|
|
203
|
+
bonus?: false | {
|
|
204
|
+
bps?: number;
|
|
205
|
+
lockSeconds?: number;
|
|
206
|
+
minBuy?: bigint;
|
|
207
|
+
cap?: bigint;
|
|
208
|
+
};
|
|
209
|
+
/** default off; on: the opener's side feeds a pot the last buyer wins after `silenceSeconds` without a qualifying buy */
|
|
210
|
+
jackpot?: false | {
|
|
211
|
+
potShareBps?: number;
|
|
212
|
+
shareBps?: number;
|
|
213
|
+
silenceSeconds?: number;
|
|
214
|
+
minBuy?: bigint;
|
|
215
|
+
};
|
|
216
|
+
/** main line: a partner listed by pickhooks (partnerBps > 0) that brought the pool */
|
|
217
|
+
partner?: Address;
|
|
218
|
+
/** main line, default true: the hook closes the gap to the coin's V2 pair after every swap */
|
|
219
|
+
recapture?: boolean;
|
|
220
|
+
/** how far the price may move between the check and the open, default 100 (1 %) */
|
|
221
|
+
maxMoveBps?: number;
|
|
222
|
+
};
|
|
223
|
+
export type Recapture = {
|
|
224
|
+
profit: bigint;
|
|
225
|
+
toTrader: bigint;
|
|
226
|
+
soldHere: boolean;
|
|
227
|
+
};
|
|
228
|
+
export type TradeResult = Sent & {
|
|
229
|
+
side: "buy" | "sell";
|
|
230
|
+
/** what the quote said (after a tax-line coin's tax) and the minimum the trade accepted (on the pool's own amount) */
|
|
231
|
+
quoted: bigint;
|
|
232
|
+
minOut: bigint;
|
|
233
|
+
amountIn: bigint;
|
|
234
|
+
/** from the hook's Traded event: coins out of the pool for a buy (before a buy tax), BNB for a sell */
|
|
235
|
+
amountOut: bigint;
|
|
236
|
+
/** main line: the recapture in this transaction, if the hook closed a gap */
|
|
237
|
+
recapture: Recapture | null;
|
|
238
|
+
/** main line: BNB credited to a listed router's payout wallet by this trade */
|
|
239
|
+
routerCredit: bigint;
|
|
240
|
+
};
|
|
241
|
+
export type Earnings = {
|
|
242
|
+
/** BNB claim() pays on the main line: opener side, jackpot wins, recapture shares, a partner's share */
|
|
243
|
+
owed: bigint;
|
|
244
|
+
/** BNB credited to this wallet as a router payout, and how much of it claimRouter() pays now (funded by collects) */
|
|
245
|
+
routerCredit: bigint;
|
|
246
|
+
routerClaimable: bigint;
|
|
247
|
+
/** this address as a partner: its share of the platform's part in pools opened with it (0: not listed) */
|
|
248
|
+
partnerBps: number;
|
|
249
|
+
/** BNB claim({ line: "tax" }) pays on the tax line (0 while it is off) */
|
|
250
|
+
taxOwed: bigint;
|
|
251
|
+
};
|
|
252
|
+
export type AnyQuote = {
|
|
253
|
+
/** what the trader gets: coins after the buy tax, or BNB */
|
|
254
|
+
amountOut: bigint;
|
|
255
|
+
/** the pool's own amount (coins before the buy tax): what a router's minimum counts */
|
|
256
|
+
gross: bigint;
|
|
257
|
+
/** the tax this trade pays in the pool now (tax line), basis points */
|
|
258
|
+
taxBps: number;
|
|
259
|
+
gasEstimate: bigint;
|
|
260
|
+
};
|
|
261
|
+
export declare const MIN_TICK = -887272;
|
|
262
|
+
export declare const MAX_TICK = 887272;
|
|
263
|
+
/** AnyTaxHook.QUOTE = keccak256("pickhooks.any.tax.quote"): a sell quote carries it to look past the pay-first guard */
|
|
264
|
+
export declare const TAX_QUOTE_MARK: Hex;
|
|
265
|
+
/** The tick of a sqrt price (Q64.96), rounded down. */
|
|
266
|
+
export declare function tickOf(sqrtPrice: bigint): number;
|
|
267
|
+
/**
|
|
268
|
+
* The ticks of a range for a slot. The pool's price is coin per BNB, so the coin gets dearer as the tick falls.
|
|
269
|
+
* ladder: coins only, from the price up with no top; ladder10: coins only, up to 10x; around: half to twice the price.
|
|
270
|
+
*/
|
|
271
|
+
export declare function rangeFor(kind: RangeKind, sqrtPrice: bigint, slot: number): {
|
|
272
|
+
lower: number;
|
|
273
|
+
upper: number;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* About how many coins (raw) and how much BNB a range needs so the new pool is as deep for buys as the coin's main pool
|
|
277
|
+
* (the factory refuses a shallower one with TooShallow), with a 3 % margin. Depth is liquidity / sqrt price, the number a
|
|
278
|
+
* V2 pool's BNB reserve means. A tax-line coin arrives less its sell tax: pass `sellTaxBps` (CoinCheck.tax.poolSellBps).
|
|
279
|
+
*/
|
|
280
|
+
export declare function depthNeeds(check: Pick<CoinCheck, "sqrtPrice" | "depth">, range: RangeKind, slot: number, sellTaxBps?: number): {
|
|
281
|
+
coins: bigint;
|
|
282
|
+
bnb: bigint;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* The widest coins-only ladder right above the price that `coins` can make at least as deep as the coin's main pool
|
|
286
|
+
* (plus marginBps, default 500): the way to open with few coins (depth sits at the price, the ladder ends sooner).
|
|
287
|
+
* A tax-line coin arrives less its sell tax. Null when the coins cannot fill even one tick spacing.
|
|
288
|
+
*/
|
|
289
|
+
export declare function fitLadder(check: Pick<CoinCheck, "sqrtPrice" | "depth">, coins: bigint, slot: number, sellTaxBps?: number, marginBps?: number): {
|
|
290
|
+
tickLower: number;
|
|
291
|
+
tickUpper: number;
|
|
292
|
+
} | null;
|
|
293
|
+
/** The site's link that opens a pool with this partner named (the open form reads ?partner=). */
|
|
294
|
+
export declare function partnerLink(partner: Address, site?: string): string;
|
|
295
|
+
/** what arrives of `amount` after a tax of `bps` (flap floors the tax) */
|
|
296
|
+
export declare const afterTax: (amount: bigint, bps: number) => bigint;
|
|
297
|
+
export declare function anyModule(ctx: Ctx): {
|
|
298
|
+
/** the main factory and hook, and whether the tax line is on */
|
|
299
|
+
factory: `0x${string}`;
|
|
300
|
+
hook: `0x${string}`;
|
|
301
|
+
taxLineOn: boolean;
|
|
302
|
+
terms: () => Promise<{
|
|
303
|
+
owner: Address;
|
|
304
|
+
platformWallet: Address;
|
|
305
|
+
openerBps: number;
|
|
306
|
+
traderBps: number;
|
|
307
|
+
hook: Address;
|
|
308
|
+
}>;
|
|
309
|
+
check: (token: Address) => Promise<CoinCheck>;
|
|
310
|
+
taxOf: (token: Address) => Promise<TaxLive>;
|
|
311
|
+
depthNeeds: typeof depthNeeds;
|
|
312
|
+
fitLadder: typeof fitLadder;
|
|
313
|
+
rangeFor: typeof rangeFor;
|
|
314
|
+
count: (line?: AnyLine) => Promise<number>;
|
|
315
|
+
pools: (o?: {
|
|
316
|
+
limit?: number;
|
|
317
|
+
offset?: number;
|
|
318
|
+
line?: AnyLine;
|
|
319
|
+
}) => Promise<AnyPool[]>;
|
|
320
|
+
pool: (ref: PoolRef) => Promise<AnyPool | null>;
|
|
321
|
+
poolsOf: (token: Address) => Promise<AnyPool[]>;
|
|
322
|
+
key: (ref: PoolRef) => Promise<PoolKey>;
|
|
323
|
+
poolId: typeof poolIdOf;
|
|
324
|
+
earnings: (who: Address) => Promise<Earnings>;
|
|
325
|
+
router: (routerContract: Address) => Promise<{
|
|
326
|
+
payout: Address;
|
|
327
|
+
bps: number;
|
|
328
|
+
}>;
|
|
329
|
+
partnerBps: (partner: Address) => Promise<number>;
|
|
330
|
+
partnerLink: (partner: Address) => string;
|
|
331
|
+
bonusOf: (ref: PoolRef, who: Address) => Promise<{
|
|
332
|
+
bought: bigint;
|
|
333
|
+
locked: bigint;
|
|
334
|
+
owed: bigint;
|
|
335
|
+
total: bigint;
|
|
336
|
+
unlockAt: number;
|
|
337
|
+
}>;
|
|
338
|
+
pendingFees: (ref: PoolRef) => Promise<{
|
|
339
|
+
bnb: bigint;
|
|
340
|
+
coins: bigint;
|
|
341
|
+
}>;
|
|
342
|
+
quote: (q: {
|
|
343
|
+
pool: PoolRef;
|
|
344
|
+
side: "buy" | "sell";
|
|
345
|
+
amount: bigint;
|
|
346
|
+
from?: Address;
|
|
347
|
+
}) => Promise<AnyQuote>;
|
|
348
|
+
sellApprovals: (owner: Address, token: Address, amount: bigint) => Promise<TxRequest[]>;
|
|
349
|
+
approvalFor: (owner: Address, token: Address, spender: Address, amount: bigint) => Promise<TxRequest | null>;
|
|
350
|
+
openParams: (o: OpenOptions, checked?: CoinCheck) => Promise<{
|
|
351
|
+
params: OpenParams;
|
|
352
|
+
value: bigint;
|
|
353
|
+
check: CoinCheck;
|
|
354
|
+
}>;
|
|
355
|
+
readTrade: (receipt: TransactionReceipt) => {
|
|
356
|
+
side: "buy" | "sell" | null;
|
|
357
|
+
tokens: bigint;
|
|
358
|
+
bnb: bigint;
|
|
359
|
+
recapture: Recapture | null;
|
|
360
|
+
routerCredit: bigint;
|
|
361
|
+
};
|
|
362
|
+
build: {
|
|
363
|
+
buy: (b: {
|
|
364
|
+
key: PoolKey;
|
|
365
|
+
bnbIn: bigint;
|
|
366
|
+
minOut: bigint;
|
|
367
|
+
deadline?: bigint;
|
|
368
|
+
recapture?: boolean;
|
|
369
|
+
}) => TxRequest;
|
|
370
|
+
sell: (s: {
|
|
371
|
+
key: PoolKey;
|
|
372
|
+
amount: bigint;
|
|
373
|
+
minOut: bigint;
|
|
374
|
+
deadline?: bigint;
|
|
375
|
+
recapture?: boolean;
|
|
376
|
+
}) => TxRequest;
|
|
377
|
+
sellPayFirst: (s: {
|
|
378
|
+
key: PoolKey;
|
|
379
|
+
amount: bigint;
|
|
380
|
+
minOut: bigint;
|
|
381
|
+
deadline?: bigint;
|
|
382
|
+
}) => TxRequest;
|
|
383
|
+
open: (params: OpenParams, value?: bigint, line?: AnyLine) => TxRequest;
|
|
384
|
+
/** main line: opener side, jackpot wins, recapture shares, a partner's share; { line: "tax" } for the tax line's hook */
|
|
385
|
+
claim: (o?: {
|
|
386
|
+
line?: AnyLine;
|
|
387
|
+
}) => TxRequest;
|
|
388
|
+
/** a router's payout wallet takes what collects have funded of its credit */
|
|
389
|
+
claimRouter: () => TxRequest;
|
|
390
|
+
/** anyone: collects the pool's fees and books them (funds router credits) */
|
|
391
|
+
collect: (ref: PoolRef) => Promise<TxRequest>;
|
|
392
|
+
settleJackpot: (ref: PoolRef) => Promise<TxRequest>;
|
|
393
|
+
fundPot: (ref: PoolRef, wei: bigint) => Promise<TxRequest>;
|
|
394
|
+
/** these move coins into the hook: approve the coin to the hook first (approvalFor) */
|
|
395
|
+
feedChest: (token: Address, amount: bigint, line?: AnyLine) => Promise<TxRequest>;
|
|
396
|
+
fundBonus: (ref: PoolRef, amount: bigint) => Promise<TxRequest>;
|
|
397
|
+
lockBonus: (ref: PoolRef, amount: bigint) => Promise<TxRequest>;
|
|
398
|
+
unlockBonus: (ref: PoolRef) => Promise<TxRequest>;
|
|
399
|
+
/** the opener: more liquidity (approve the coin to the factory first), or a position out after its 30 days */
|
|
400
|
+
addLiquidity: (token: Address, slot: number, tickLower: number, tickUpper: number, tokenAmount: bigint, bnb?: bigint, line?: AnyLine) => TxRequest;
|
|
401
|
+
removeLiquidity: (ref: PoolRef, index: number) => Promise<TxRequest>;
|
|
402
|
+
};
|
|
403
|
+
buy: (b: {
|
|
404
|
+
pool: PoolRef;
|
|
405
|
+
bnbIn: bigint;
|
|
406
|
+
slippageBps?: number;
|
|
407
|
+
minOut?: bigint;
|
|
408
|
+
recapture?: boolean;
|
|
409
|
+
deadline?: bigint;
|
|
410
|
+
}, o?: SendOptions) => Promise<TradeResult>;
|
|
411
|
+
sell: (s: {
|
|
412
|
+
pool: PoolRef;
|
|
413
|
+
amount: bigint;
|
|
414
|
+
slippageBps?: number;
|
|
415
|
+
minOut?: bigint;
|
|
416
|
+
recapture?: boolean;
|
|
417
|
+
deadline?: bigint;
|
|
418
|
+
}, o?: SendOptions) => Promise<TradeResult>;
|
|
419
|
+
open: (o: OpenOptions, s?: SendOptions) => Promise<Sent & {
|
|
420
|
+
id: Hex;
|
|
421
|
+
params: OpenParams;
|
|
422
|
+
line: AnyLine;
|
|
423
|
+
}>;
|
|
424
|
+
claim: (s?: SendOptions & {
|
|
425
|
+
line?: AnyLine;
|
|
426
|
+
}) => Promise<Sent>;
|
|
427
|
+
claimRouter: (s?: SendOptions) => Promise<Sent>;
|
|
428
|
+
collect: (ref: PoolRef, s?: SendOptions) => Promise<Sent>;
|
|
429
|
+
settleJackpot: (ref: PoolRef, s?: SendOptions) => Promise<Sent>;
|
|
430
|
+
fundPot: (ref: PoolRef, wei: bigint, s?: SendOptions) => Promise<Sent>;
|
|
431
|
+
feedChest: (token: Address, amount: bigint, s?: SendOptions & {
|
|
432
|
+
line?: AnyLine;
|
|
433
|
+
}) => Promise<Sent>;
|
|
434
|
+
fundBonus: (ref: PoolRef, amount: bigint, s?: SendOptions) => Promise<Sent>;
|
|
435
|
+
lockBonus: (ref: PoolRef, amount: bigint, s?: SendOptions) => Promise<Sent>;
|
|
436
|
+
unlockBonus: (ref: PoolRef, s?: SendOptions) => Promise<Sent>;
|
|
437
|
+
addLiquidity: (ref: PoolRef, range: {
|
|
438
|
+
tickLower: number;
|
|
439
|
+
tickUpper: number;
|
|
440
|
+
}, tokenAmount: bigint, bnb?: bigint, s?: SendOptions) => Promise<Sent>;
|
|
441
|
+
removeLiquidity: (ref: PoolRef, index: number, s?: SendOptions) => Promise<Sent>;
|
|
442
|
+
/** the tax line's hook: anyone sends a surplus to its place (the coin's own into the fire, other tokens to the platform) */
|
|
443
|
+
sweep: (token: Address, s?: SendOptions) => Promise<Sent>;
|
|
444
|
+
lineOf: (ref: PoolRef) => Promise<AnyLine>;
|
|
445
|
+
lineOfFactory: (f: Address) => AnyLine;
|
|
446
|
+
};
|
|
447
|
+
export type AnyModule = ReturnType<typeof anyModule>;
|