@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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +309 -3
  3. package/dist/abis/any3.d.ts +2123 -0
  4. package/dist/abis/any3.js +3 -0
  5. package/dist/abis/anytax.d.ts +1786 -0
  6. package/dist/abis/anytax.js +3 -0
  7. package/dist/abis/calls.d.ts +2515 -0
  8. package/dist/abis/calls.js +4 -0
  9. package/dist/abis/common.d.ts +449 -0
  10. package/dist/abis/common.js +91 -0
  11. package/dist/abis/dips.d.ts +897 -0
  12. package/dist/abis/dips.js +2 -0
  13. package/dist/abis/index.d.ts +12 -0
  14. package/dist/abis/index.js +12 -0
  15. package/dist/abis/infra.d.ts +701 -0
  16. package/dist/abis/infra.js +4 -0
  17. package/dist/abis/lever.d.ts +1710 -0
  18. package/dist/abis/lever.js +5 -0
  19. package/dist/abis/lever2.d.ts +2710 -0
  20. package/dist/abis/lever2.js +5 -0
  21. package/dist/abis/pools.d.ts +1898 -0
  22. package/dist/abis/pools.js +4 -0
  23. package/dist/abis/sticky.d.ts +953 -0
  24. package/dist/abis/sticky.js +4 -0
  25. package/dist/abis/v1.d.ts +1627 -0
  26. package/dist/abis/v1.js +5 -0
  27. package/dist/abis/v2.d.ts +3264 -0
  28. package/dist/abis/v2.js +8 -0
  29. package/dist/addresses.d.ts +87 -0
  30. package/dist/addresses.js +62 -0
  31. package/dist/any.d.ts +447 -0
  32. package/dist/any.js +729 -0
  33. package/dist/api.d.ts +62 -0
  34. package/dist/api.js +30 -0
  35. package/dist/blocks.d.ts +107 -0
  36. package/dist/blocks.js +126 -0
  37. package/dist/coin-rules-config.d.ts +8 -0
  38. package/dist/coin-rules-config.js +13 -0
  39. package/dist/coin-rules.d.ts +383 -0
  40. package/dist/coin-rules.js +878 -0
  41. package/dist/coins.d.ts +217 -0
  42. package/dist/coins.js +520 -0
  43. package/dist/dips.d.ts +133 -0
  44. package/dist/dips.js +148 -0
  45. package/dist/errors.d.ts +35 -0
  46. package/dist/errors.js +347 -0
  47. package/dist/index.d.ts +73 -0
  48. package/dist/index.js +58 -0
  49. package/dist/infinity.d.ts +63 -0
  50. package/dist/infinity.js +96 -0
  51. package/dist/infra.d.ts +112 -0
  52. package/dist/infra.js +114 -0
  53. package/dist/lever.d.ts +391 -0
  54. package/dist/lever.js +419 -0
  55. package/dist/pools.d.ts +274 -0
  56. package/dist/pools.js +405 -0
  57. package/dist/sticky-rules.d.ts +179 -0
  58. package/dist/sticky-rules.js +580 -0
  59. package/dist/sticky.d.ts +216 -0
  60. package/dist/sticky.js +292 -0
  61. package/dist/tx.d.ts +70 -0
  62. package/dist/tx.js +69 -0
  63. package/dist/v3.d.ts +42 -0
  64. package/dist/v3.js +98 -0
  65. package/package.json +58 -4
@@ -0,0 +1,217 @@
1
+ import { type Address, type Hex } from "viem";
2
+ import { type Picked, type R, type X } from "./coin-rules.js";
3
+ import { type Ctx, type SendOptions, type Sent, type TxRequest } from "./tx.js";
4
+ /**
5
+ * Coins with their rules in the coin (pickhooks' main launches): v1 (32 rules, factory 0xecED…54D8) and v2 (40 rules,
6
+ * factory 0x23cC…B24F, every launch since 04.10.2026, also find the dev and CZ mode coins). The coin checks its rules
7
+ * on every transfer; it trades in a PancakeSwap V3 pool of 1 % plus a V2 pair, so any router can trade it. check() runs
8
+ * the transfer of a trade in an eth_call and names the rule that would refuse it, before anyone signs.
9
+ */
10
+ export type RuleCoinVersion = 1 | 2;
11
+ export type CoinRule = {
12
+ kind: number;
13
+ name: string;
14
+ /** the rule with this coin's numbers, as a sentence */
15
+ text: string;
16
+ scanner: "green" | "yellow" | "red";
17
+ /** unix time the rule ends (0: never) */
18
+ until: number;
19
+ /** v2: bought off, voted off, or (sells at) reached its target, or past its end time */
20
+ ended: boolean;
21
+ };
22
+ export type RuleCoin = {
23
+ token: Address;
24
+ version: RuleCoinVersion;
25
+ name: string;
26
+ symbol: string;
27
+ metadata: string;
28
+ creator: Address;
29
+ /** the PancakeSwap V3 pool (1 %) and the V2 pair */
30
+ pool: Address;
31
+ pair: Address;
32
+ start: number;
33
+ rules: CoinRule[];
34
+ scanner: "green" | "yellow" | "red";
35
+ /** the token's Rules struct (and for v2 its Extras), for coin-rules' helpers */
36
+ raw: R;
37
+ extras: X | null;
38
+ holders: number;
39
+ buys: number;
40
+ sells: number;
41
+ /** share of the curve sold, basis points */
42
+ soldBps: number;
43
+ jackpotPot: bigint;
44
+ jackpotLast: Address;
45
+ jackpotTime: number;
46
+ rewardsPot: bigint;
47
+ /** BNB per coin at the V3 pool's price, and the market cap in BNB */
48
+ priceBnb: number;
49
+ mcapBnb: number;
50
+ chainNow: number;
51
+ };
52
+ export type RuleCheck = {
53
+ ok: true;
54
+ } | {
55
+ ok: false;
56
+ kind: number;
57
+ name: string;
58
+ text: string;
59
+ };
60
+ export type RuleLaunch = {
61
+ name: string;
62
+ symbol: string;
63
+ /** a link to the coin's metadata JSON (name, symbol, description, image, website, twitter, telegram) */
64
+ metadata: string;
65
+ /** up to eight rules of the catalog (coin-rules RULES): { id, values, endsAfter? } */
66
+ rules: Picked[];
67
+ /** the creator's first buy, BNB wei */
68
+ devBuy?: bigint;
69
+ /** share of the creator side the creator keeps (default 10000); the rest buys back and burns $hooks */
70
+ keepBps?: number;
71
+ /** hooks rules burn $hooks at launch: bought with BNB inside the launch (default), or the creator's own $hooks */
72
+ payBurnIn?: "bnb" | "hooks";
73
+ salt?: Hex;
74
+ };
75
+ /** A rule's sentence for a refusal: its name and the rule with the coin's numbers. */
76
+ export declare function ruleText(kind: number, rules?: R | null, extras?: X | null): {
77
+ name: string;
78
+ text: string;
79
+ };
80
+ export declare function coinsModule(ctx: Ctx): {
81
+ v1Factory: `0x${string}`;
82
+ v2Factory: `0x${string}`;
83
+ versionOf: (token: Address) => Promise<RuleCoinVersion | null>;
84
+ count: (version?: RuleCoinVersion) => Promise<number>;
85
+ coins: (o?: {
86
+ version?: RuleCoinVersion;
87
+ limit?: number;
88
+ offset?: number;
89
+ }) => Promise<RuleCoin[]>;
90
+ coin: (token: Address) => Promise<RuleCoin | null>;
91
+ terms: () => Promise<{
92
+ hooksBurn: bigint;
93
+ creatorBps: number;
94
+ seedBnb: bigint;
95
+ hooks: Address;
96
+ voteBox: Address;
97
+ arena: Address;
98
+ floorVault: Address;
99
+ payrollBox: Address;
100
+ locker: Address;
101
+ }>;
102
+ extrasOf: (token: Address, mask: bigint) => Promise<X>;
103
+ check: (c: {
104
+ token: Address;
105
+ side: "buy" | "sell" | "send";
106
+ wallet: Address;
107
+ amount: bigint;
108
+ to?: Address;
109
+ }) => Promise<RuleCheck>;
110
+ quote: (q: {
111
+ token: Address;
112
+ side: "buy" | "sell";
113
+ amount: bigint;
114
+ wallet?: Address;
115
+ }) => Promise<{
116
+ amountOut: bigint;
117
+ }>;
118
+ estimateBuy: (token: Address, bnbIn: bigint) => Promise<bigint>;
119
+ burnFor: (mask: bigint) => Promise<{
120
+ hooks: bigint;
121
+ bnb: bigint;
122
+ }>;
123
+ build: {
124
+ buy: (b: {
125
+ token: Address;
126
+ bnbIn: bigint;
127
+ minOut: bigint;
128
+ recipient: Address;
129
+ deadline?: bigint;
130
+ }) => TxRequest;
131
+ sell: (x: {
132
+ token: Address;
133
+ amount: bigint;
134
+ minOut: bigint;
135
+ recipient: Address;
136
+ deadline?: bigint;
137
+ }) => TxRequest;
138
+ /** jackpot wins and buyer rewards the coin owes the caller */
139
+ claim: (token: Address) => Promise<TxRequest>;
140
+ settleJackpot: (token: Address) => Promise<TxRequest>;
141
+ /** the creator takes back rewards it paid in and nobody earned */
142
+ withdrawRewards: (token: Address, wei: bigint) => Promise<TxRequest>;
143
+ /** anyone: collects the coin's trading fees from its locked position (creator, pot, platform; coins burned or into the pair) */
144
+ collect: (token: Address) => Promise<TxRequest>;
145
+ /** v2: buys a listed rule off (half to the creator, half burns $hooks); the price is the coin's buyoutPrice(kind) */
146
+ buyout: (token: Address, kind: number) => Promise<TxRequest>;
147
+ /** v2: moves the milestone level and sells at along without a trade (anyone) */
148
+ poke: (token: Address) => Promise<TxRequest>;
149
+ /** v2 dead man: the creator says it is still here; release: anyone burns the bag of a quiet creator */
150
+ alive: (token: Address) => Promise<TxRequest>;
151
+ release: (token: Address) => Promise<TxRequest>;
152
+ fundPayroll: (token: Address, wei: bigint) => Promise<TxRequest>;
153
+ payrollClaim: (token: Address) => Promise<TxRequest>;
154
+ payShift: (token: Address) => Promise<TxRequest>;
155
+ floorDefend: (token: Address) => Promise<TxRequest>;
156
+ duelClose: (id: bigint) => Promise<TxRequest>;
157
+ duelSettle: (id: bigint) => Promise<TxRequest>;
158
+ duelRefund: (id: bigint) => Promise<TxRequest>;
159
+ /** votes move coins into the vote box: approve the coin to the box first (terms().voteBox) */
160
+ voteStart: (token: Address, kind: number, amount: bigint) => Promise<TxRequest>;
161
+ voteCast: (token: Address, kind: number, amount: bigint, yes: boolean) => Promise<TxRequest>;
162
+ voteFinish: (token: Address, kind: number) => Promise<TxRequest>;
163
+ voteWithdraw: (token: Address, kind: number, round: bigint) => Promise<TxRequest>;
164
+ };
165
+ buy: (b: {
166
+ token: Address;
167
+ bnbIn: bigint;
168
+ slippageBps?: number;
169
+ minOut?: bigint;
170
+ deadline?: bigint;
171
+ }, s?: SendOptions) => Promise<Sent & {
172
+ quoted: bigint;
173
+ minOut: bigint;
174
+ amountOut: bigint;
175
+ }>;
176
+ sell: (x: {
177
+ token: Address;
178
+ amount: bigint;
179
+ slippageBps?: number;
180
+ minOut?: bigint;
181
+ deadline?: bigint;
182
+ }, s?: SendOptions) => Promise<Sent & {
183
+ quoted: bigint;
184
+ minOut: bigint;
185
+ }>;
186
+ launch: (l: RuleLaunch, s?: SendOptions) => Promise<Sent & {
187
+ token: Address;
188
+ burned: bigint;
189
+ pots: Sent[];
190
+ }>;
191
+ fundPot: (token: Address, pot: "jackpot" | "rewards", wei: bigint, s?: SendOptions) => Promise<Sent>;
192
+ /** a wallet's jackpot wins and buyer rewards in a coin, and its counters there */
193
+ wallet: (token: Address, who: Address) => Promise<{
194
+ balance: bigint;
195
+ owed: bigint;
196
+ buys: number;
197
+ lastBuy: number;
198
+ lastTrade: number;
199
+ jailUntil: number;
200
+ }>;
201
+ /** what collect() would book now: BNB fees and coins burned (simulated) */
202
+ pendingFees: (token: Address) => Promise<{
203
+ bnb: bigint;
204
+ burned: bigint;
205
+ }>;
206
+ claim: (token: Address, s?: SendOptions) => Promise<Sent>;
207
+ settleJackpot: (token: Address, s?: SendOptions) => Promise<Sent>;
208
+ withdrawRewards: (token: Address, wei: bigint, s?: SendOptions) => Promise<Sent>;
209
+ collect: (token: Address, s?: SendOptions) => Promise<Sent>;
210
+ buyout: (token: Address, kind: number, s?: SendOptions) => Promise<Sent>;
211
+ poke: (token: Address, s?: SendOptions) => Promise<Sent>;
212
+ alive: (token: Address, s?: SendOptions) => Promise<Sent>;
213
+ release: (token: Address, s?: SendOptions) => Promise<Sent>;
214
+ /** the coin's PancakeSwap V2 pair against WBNB */
215
+ pairOf: (token: Address) => Promise<`0x${string}`>;
216
+ };
217
+ export type CoinsModule = ReturnType<typeof coinsModule>;