@pickhooks/sdk 0.0.0-stage → 0.4.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.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +418 -3
  3. package/dist/abis/agents.d.ts +2418 -0
  4. package/dist/abis/agents.js +4 -0
  5. package/dist/abis/any3.d.ts +2123 -0
  6. package/dist/abis/any3.js +3 -0
  7. package/dist/abis/anytax.d.ts +1786 -0
  8. package/dist/abis/anytax.js +3 -0
  9. package/dist/abis/calls.d.ts +2515 -0
  10. package/dist/abis/calls.js +4 -0
  11. package/dist/abis/common.d.ts +449 -0
  12. package/dist/abis/common.js +91 -0
  13. package/dist/abis/dips.d.ts +897 -0
  14. package/dist/abis/dips.js +2 -0
  15. package/dist/abis/index.d.ts +14 -0
  16. package/dist/abis/index.js +14 -0
  17. package/dist/abis/infra.d.ts +701 -0
  18. package/dist/abis/infra.js +4 -0
  19. package/dist/abis/lever.d.ts +1710 -0
  20. package/dist/abis/lever.js +5 -0
  21. package/dist/abis/lever2.d.ts +2710 -0
  22. package/dist/abis/lever2.js +5 -0
  23. package/dist/abis/pools.d.ts +1898 -0
  24. package/dist/abis/pools.js +4 -0
  25. package/dist/abis/sticky.d.ts +953 -0
  26. package/dist/abis/sticky.js +4 -0
  27. package/dist/abis/sticky2.d.ts +3750 -0
  28. package/dist/abis/sticky2.js +8 -0
  29. package/dist/abis/v1.d.ts +1627 -0
  30. package/dist/abis/v1.js +5 -0
  31. package/dist/abis/v2.d.ts +3264 -0
  32. package/dist/abis/v2.js +8 -0
  33. package/dist/addresses.d.ts +100 -0
  34. package/dist/addresses.js +71 -0
  35. package/dist/agents-catalog.d.ts +318 -0
  36. package/dist/agents-catalog.js +353 -0
  37. package/dist/agents.d.ts +543 -0
  38. package/dist/agents.js +667 -0
  39. package/dist/any.d.ts +447 -0
  40. package/dist/any.js +729 -0
  41. package/dist/api.d.ts +62 -0
  42. package/dist/api.js +30 -0
  43. package/dist/blocks.d.ts +107 -0
  44. package/dist/blocks.js +126 -0
  45. package/dist/coin-rules-config.d.ts +8 -0
  46. package/dist/coin-rules-config.js +13 -0
  47. package/dist/coin-rules.d.ts +383 -0
  48. package/dist/coin-rules.js +878 -0
  49. package/dist/coins.d.ts +217 -0
  50. package/dist/coins.js +520 -0
  51. package/dist/desks.d.ts +298 -0
  52. package/dist/desks.js +343 -0
  53. package/dist/dips.d.ts +133 -0
  54. package/dist/dips.js +148 -0
  55. package/dist/errors.d.ts +35 -0
  56. package/dist/errors.js +414 -0
  57. package/dist/index.d.ts +104 -0
  58. package/dist/index.js +91 -0
  59. package/dist/infinity.d.ts +63 -0
  60. package/dist/infinity.js +96 -0
  61. package/dist/infra.d.ts +112 -0
  62. package/dist/infra.js +114 -0
  63. package/dist/lever.d.ts +391 -0
  64. package/dist/lever.js +419 -0
  65. package/dist/pools.d.ts +274 -0
  66. package/dist/pools.js +405 -0
  67. package/dist/sticky-rules.d.ts +179 -0
  68. package/dist/sticky-rules.js +580 -0
  69. package/dist/sticky-sim.d.ts +125 -0
  70. package/dist/sticky-sim.js +637 -0
  71. package/dist/sticky.d.ts +286 -0
  72. package/dist/sticky.js +420 -0
  73. package/dist/tlock.d.ts +67 -0
  74. package/dist/tlock.js +185 -0
  75. package/dist/tx.d.ts +72 -0
  76. package/dist/tx.js +78 -0
  77. package/dist/v2.d.ts +106 -0
  78. package/dist/v2.js +61 -0
  79. package/dist/v3.d.ts +42 -0
  80. package/dist/v3.js +98 -0
  81. package/dist/wallet.d.ts +80 -0
  82. package/dist/wallet.js +115 -0
  83. package/dist/watch.d.ts +82 -0
  84. package/dist/watch.js +194 -0
  85. package/package.json +67 -4
@@ -0,0 +1,286 @@
1
+ import { type Address, type Hex } from "viem";
2
+ import { type EditRow, type Pick as RulePick, compile } from "./sticky-rules.js";
3
+ import { type SimReport } from "./sticky-sim.js";
4
+ import { type Ctx, type SendOptions, type Sent, type TxRequest } from "./tx.js";
5
+ import { type Venue } from "./v2.js";
6
+ /**
7
+ * sticky rules: a coin whose rules stick to the coins, not to the wallet. Every buy is a lot with its time and marks, a
8
+ * send moves lots along, so a fresh wallet takes the rules with it. The creator picks up to eight rows from templates; the
9
+ * validator checks the table at launch and the coin checks every transfer. Sticky coins trade in a PancakeSwap V3 pool
10
+ * of 1 % (plus a V2 pair), so any router can trade them; check() names the row that would stop a trade before it is sent.
11
+ */
12
+ export type StickyRow = {
13
+ /** 0 based; the site and errors say "rule i + 1" */
14
+ i: number;
15
+ /** the template's name, "Pot", or "Custom row" */
16
+ name: string;
17
+ /** the row as a sentence */
18
+ text: string;
19
+ template: string | null;
20
+ /** true when the rule moves with the coins */
21
+ sticky: boolean;
22
+ lock: boolean;
23
+ drop: boolean;
24
+ /** the creator lifted it for good */
25
+ lifted: boolean;
26
+ /** the raw row (uint256) */
27
+ raw: bigint;
28
+ };
29
+ export type StickyCoin = {
30
+ token: Address;
31
+ name: string;
32
+ symbol: string;
33
+ /** the metadata link (JSON with image, description, links) */
34
+ metadata: string;
35
+ creator: Address;
36
+ /** the PancakeSwap V3 pool (1 %) and the V2 pair */
37
+ pool: Address;
38
+ pair: Address;
39
+ start: number;
40
+ /** seconds a LOCK row's coins take to unlock */
41
+ release: number;
42
+ rows: StickyRow[];
43
+ /** how scanners see the table: green nothing, yellow a warning, red a refused test sell at times */
44
+ scanner: "green" | "yellow" | "red";
45
+ holders: number;
46
+ buys: number;
47
+ sells: number;
48
+ lastBuy: number;
49
+ /** BNB volume (wei) */
50
+ volume: bigint;
51
+ /** coins in the pot (POT rows fill it, DROP rows pay it out) */
52
+ pot: bigint;
53
+ totalSupply: bigint;
54
+ /** BNB per coin at the V3 pool's price, and the market cap in BNB */
55
+ priceBnb: number;
56
+ mcapBnb: number;
57
+ };
58
+ export type StickyLot = {
59
+ amount: bigint;
60
+ locked: bigint;
61
+ since: number;
62
+ flags: number;
63
+ open: boolean;
64
+ };
65
+ export type StickyCheck = {
66
+ ok: true;
67
+ } | {
68
+ ok: false;
69
+ /** the row that stops it (0 based), or "locked": no row stops it but the coins are not unlocked yet */
70
+ row: number | "locked";
71
+ /** "Refused by rule 2: Sniper jail." and the row's sentence */
72
+ text: string;
73
+ rule: StickyRow | null;
74
+ };
75
+ export type StickyLaunch = {
76
+ name: string;
77
+ symbol: string;
78
+ /** a link to the coin's metadata JSON (name, symbol, description, image, website, twitter, telegram) */
79
+ metadata: string;
80
+ /** templates and their numbers (numbers left out take the template's defaults); or rows + release for a table built elsewhere */
81
+ picks?: (Omit<RulePick, "params"> & {
82
+ params?: RulePick["params"];
83
+ })[];
84
+ /**
85
+ * hook script: the creator's own rows, after the templates (the factory's custom switch must be on). Built like the
86
+ * site's editor: emptyEditRow(), VARS for the variables and their units, editToRow() for the row on chain.
87
+ */
88
+ script?: EditRow[];
89
+ /** hook script rows that lock shares: hours until they unlock (10 minutes to 30 days); the longer release wins */
90
+ scriptHours?: number;
91
+ rows?: bigint[];
92
+ release?: number;
93
+ /** the creator's first buy (BNB wei); the DEV mark and the dev lock apply to it */
94
+ devBuy?: bigint;
95
+ /** share of the creator side the creator keeps (default 10000); the rest buys back and burns $hooks */
96
+ keepBps?: number;
97
+ /** a fixed salt (bytes32); default random */
98
+ salt?: Hex;
99
+ /**
100
+ * sticky 2 only: rules (0 based) that switch, 2 to 4 drop rows; one of them is on at a time (the first at launch) and
101
+ * the switcher turns another on. Default switcher: the rule auction, where holders burn coins to pick the game.
102
+ */
103
+ switchRows?: number[];
104
+ switcher?: Address;
105
+ };
106
+ export type StickyTerms = {
107
+ seed: bigint;
108
+ creatorBps: number;
109
+ custom: boolean;
110
+ validator: Address;
111
+ startFdv: bigint;
112
+ platformWallet: Address;
113
+ locker: Address;
114
+ };
115
+ /** The rows of a coin as sentences, with the template each belongs to. */
116
+ export declare function describeRows(raw: readonly bigint[], release: number, off: number): StickyRow[];
117
+ /**
118
+ * The table a launch would send: the templates' rows, then the hook script rows (the site's order), one release time per
119
+ * coin (the longer one wins); or rows + release as given. Offline; throws the problems as sentences.
120
+ */
121
+ export declare function stickyTable(l: Pick<StickyLaunch, "picks" | "script" | "scriptHours" | "rows" | "release">): {
122
+ rows: bigint[];
123
+ release: number;
124
+ };
125
+ export type StickyTestRun = {
126
+ rows: bigint[];
127
+ release: number;
128
+ /** the run's numbers, as the launcher's test run shows them */
129
+ report: SimReport;
130
+ /** the run as sentences, one per line of the launcher's card */
131
+ text: string[];
132
+ };
133
+ /** A test run as sentences: the launcher's card line by line. `names` are the rows' names (rule i + 1). */
134
+ export declare function testRunText(r: SimReport, names: string[]): string[];
135
+ /**
136
+ * The launcher's test run, offline: the table on a fresh coin with random trades (the creator's first buy, three snipers
137
+ * in the first blocks, wallets that buy, hold and sell, bags split to fresh wallets). It runs the coin's own rule engine,
138
+ * checked against the contract trade by trade. The same seed gives the same run; the chain stays the truth.
139
+ */
140
+ export declare function stickyTestRun(l: Pick<StickyLaunch, "picks" | "script" | "scriptHours" | "rows" | "release"> & {
141
+ devBuyBnb?: number;
142
+ seed?: number;
143
+ trades?: number;
144
+ start?: number;
145
+ }): StickyTestRun;
146
+ /**
147
+ * The sticky module. `v2` points it at the sticky 2 factory (same coins, same rules, same calls; its coins also count
148
+ * the creator's sold coins and can carry switch rows, see ph.sticky2).
149
+ */
150
+ export declare function stickyModule(ctx: Ctx, v2?: boolean): {
151
+ factory: `0x${string}`;
152
+ terms: () => Promise<StickyTerms>;
153
+ validate: (rows: bigint[], release: number, custom?: boolean) => Promise<string | null>;
154
+ validateSwitch: (rows: bigint[], mask: number, validator?: Address) => Promise<string | null>;
155
+ compile: typeof compile;
156
+ table: typeof stickyTable;
157
+ testRun: typeof stickyTestRun;
158
+ describeRows: typeof describeRows;
159
+ prepareMetadata: (m: {
160
+ name: string;
161
+ symbol: string;
162
+ description?: string;
163
+ website?: string;
164
+ twitter?: string;
165
+ telegram?: string;
166
+ image: {
167
+ mime: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
168
+ bytes: Uint8Array;
169
+ };
170
+ }) => Promise<{
171
+ metadata: string;
172
+ image: string;
173
+ }>;
174
+ count: () => Promise<number>;
175
+ coins: (o?: {
176
+ limit?: number;
177
+ offset?: number;
178
+ }) => Promise<StickyCoin[]>;
179
+ coin: (token: Address) => Promise<StickyCoin | null>;
180
+ isCoin: (token: Address) => Promise<boolean>;
181
+ wallet: (token: Address, who: Address) => Promise<{
182
+ balance: bigint;
183
+ sellable: bigint;
184
+ lots: StickyLot[];
185
+ }>;
186
+ check: (c: {
187
+ token: Address;
188
+ side: "buy" | "sell" | "send";
189
+ wallet: Address;
190
+ amount: bigint;
191
+ to?: Address;
192
+ }) => Promise<StickyCheck>;
193
+ quote: (q: {
194
+ token: Address;
195
+ side: "buy" | "sell";
196
+ amount: bigint;
197
+ wallet?: Address;
198
+ }) => Promise<{
199
+ amountOut: bigint;
200
+ venue: Venue;
201
+ v3: bigint | null;
202
+ v2: bigint | null;
203
+ }>;
204
+ estimateBuy: (token: Address, bnbIn: bigint) => Promise<bigint>;
205
+ sellApproval: (owner: Address, token: Address, amount: bigint) => Promise<TxRequest | null>;
206
+ build: {
207
+ launch: (l: {
208
+ name: string;
209
+ symbol: string;
210
+ metadata: string;
211
+ rows: bigint[];
212
+ release: number;
213
+ salt?: Hex;
214
+ keepBps?: number;
215
+ minCreatorBps: number;
216
+ switcher?: Address;
217
+ switchMask?: number;
218
+ }, value: bigint) => TxRequest;
219
+ buy: (b: {
220
+ token: Address;
221
+ bnbIn: bigint;
222
+ minOut: bigint;
223
+ recipient: Address;
224
+ deadline?: bigint;
225
+ }) => TxRequest;
226
+ sell: (x: {
227
+ token: Address;
228
+ amount: bigint;
229
+ minOut: bigint;
230
+ recipient: Address;
231
+ deadline?: bigint;
232
+ }) => TxRequest;
233
+ lift: (token: Address, row: number) => TxRequest;
234
+ collect: (token: Address) => Promise<TxRequest>;
235
+ };
236
+ launch: (l: StickyLaunch, s?: SendOptions) => Promise<Sent & {
237
+ token: Address;
238
+ pool: Address;
239
+ pair: Address;
240
+ rows: bigint[];
241
+ release: number;
242
+ }>;
243
+ buy: (b: {
244
+ token: Address;
245
+ bnbIn: bigint;
246
+ slippageBps?: number;
247
+ minOut?: bigint;
248
+ deadline?: bigint;
249
+ venue?: Venue;
250
+ }, s?: SendOptions) => Promise<Sent & {
251
+ quoted: bigint;
252
+ minOut: bigint;
253
+ amountOut: bigint;
254
+ venue: Venue;
255
+ }>;
256
+ sell: (x: {
257
+ token: Address;
258
+ amount: bigint;
259
+ slippageBps?: number;
260
+ minOut?: bigint;
261
+ deadline?: bigint;
262
+ venue?: Venue;
263
+ }, s?: SendOptions) => Promise<Sent & {
264
+ quoted: bigint;
265
+ minOut: bigint;
266
+ venue: Venue;
267
+ }>;
268
+ lift: (token: Address, row: number, s?: SendOptions) => Promise<Sent>;
269
+ fees: (token: Address) => Promise<{
270
+ bnb: bigint;
271
+ burned: bigint;
272
+ toCreator: bigint;
273
+ creator: Address;
274
+ creatorBps: number;
275
+ keepBps: number;
276
+ pending: bigint;
277
+ }>;
278
+ collect: (token: Address, s?: SendOptions) => Promise<Sent & {
279
+ bnb: bigint;
280
+ toCreator: bigint;
281
+ burned: bigint;
282
+ }>;
283
+ /** the sender's address, for callers that check before they sign */
284
+ from: (s?: SendOptions) => Promise<`0x${string}` | undefined>;
285
+ };
286
+ export type StickyModule = ReturnType<typeof stickyModule>;