@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,179 @@
1
+ /**
2
+ * sticky rules: the rule table of a sticky coin, the same encoding as src/sticky/StickyRules.sol.
3
+ * A row is one uint256: on (bits 0..7), act (8..15), arg (16..31), then four conditions of 56 bits (var, op, value).
4
+ * The launcher offers templates; each template is one or two rows. The chain is the truth: the validator checks every
5
+ * table at launch and the coin checks every transfer. POT rows fill the coin's pot from buys, DROP rows pay it out to
6
+ * buyers (at most the coins of the buy, never to the creator).
7
+ */
8
+ export declare const ON: {
9
+ readonly BUY: 1;
10
+ readonly SELL: 2;
11
+ readonly SEND: 4;
12
+ };
13
+ export declare const ACT: {
14
+ readonly DENY: 1;
15
+ readonly FLAG: 2;
16
+ readonly LOCK: 3;
17
+ readonly BURN: 4;
18
+ readonly POT: 5;
19
+ readonly DROP: 6;
20
+ };
21
+ export declare const VAR: {
22
+ readonly AGE: 1;
23
+ readonly LAUNCH: 2;
24
+ readonly BLOCKS: 3;
25
+ readonly AMOUNT: 4;
26
+ readonly BALANCE: 5;
27
+ readonly PRICE: 6;
28
+ readonly DIP: 7;
29
+ readonly SOLD: 8;
30
+ readonly HOUR: 9;
31
+ readonly WEEKDAY: 10;
32
+ readonly FLAGS: 11;
33
+ readonly BUYS: 12;
34
+ readonly HOLDERS: 13;
35
+ readonly IDLE: 14;
36
+ readonly POTSIZE: 15;
37
+ };
38
+ export declare const OP: {
39
+ readonly LT: 1;
40
+ readonly GE: 2;
41
+ readonly HAS: 3;
42
+ readonly NOT: 4;
43
+ readonly MODLT: 5;
44
+ readonly MODGE: 6;
45
+ };
46
+ export declare const FLAG: {
47
+ readonly SNIPER: 1;
48
+ readonly MARK: 2;
49
+ readonly DEV: 4;
50
+ };
51
+ /** answers of token.check(): allowed, and "no row stops it but the coins are still locked" */
52
+ export declare const NONE = 255;
53
+ export declare const LOCKED = 254;
54
+ export declare const STICKY_LIMITS: {
55
+ readonly maxRows: 8;
56
+ readonly maxLots: 8;
57
+ readonly exitDays: 30;
58
+ readonly maxBurnPct: 10;
59
+ /** burn and pot together, per buy */
60
+ readonly maxTakePct: 10;
61
+ readonly maxHoldDays: 7;
62
+ readonly minReleaseMinutes: 10;
63
+ readonly maxReleaseDays: 30;
64
+ };
65
+ export type Cond = {
66
+ v: number;
67
+ op: number;
68
+ val: bigint;
69
+ };
70
+ export type Row = {
71
+ on: number;
72
+ act: number;
73
+ arg: number;
74
+ conds: Cond[];
75
+ };
76
+ export declare function encodeRow(r: Row): bigint;
77
+ export declare function decodeRow(x: bigint): Row;
78
+ export type TemplateId = "hold" | "sniper" | "devlock" | "drip" | "maxbuy" | "maxwallet" | "window" | "hours" | "burn" | "dipdrop" | "lucky" | "wakeup";
79
+ export type Param = {
80
+ key: string;
81
+ label: string;
82
+ unit: string;
83
+ min: number;
84
+ max: number;
85
+ step: number;
86
+ def: number;
87
+ hint: string;
88
+ };
89
+ export type Template = {
90
+ id: TemplateId;
91
+ name: string;
92
+ line: string;
93
+ /** true when the rule moves with the coins (the point of sticky rules) */
94
+ sticky: boolean;
95
+ /** true when the rule gives buyers something (the pot templates) */
96
+ gives?: boolean;
97
+ /** how scanners see it: green nothing, yellow a warning, red a refused test sell at times */
98
+ scanner: "green" | "yellow" | "red";
99
+ scannerNote?: string;
100
+ params: Param[];
101
+ rows: (p: Record<string, number>) => Row[];
102
+ /** the coin's release time in seconds when this template locks coins */
103
+ release?: (p: Record<string, number>) => number;
104
+ };
105
+ /** every n-th buy: the buys before it are n-1, 2n-1, ... (buys % n >= n - 1) */
106
+ export declare const every: (n: number) => bigint;
107
+ export declare const TEMPLATES: Template[];
108
+ export declare const TEMPLATE_BY_ID: Map<TemplateId, Template>;
109
+ export declare function defaults(t: Template): Record<string, number>;
110
+ /** Problems of a template's numbers, as sentences (the validator has the same bounds). */
111
+ export declare function paramProblems(t: Template, p: Record<string, number>): string[];
112
+ export type Pick = {
113
+ id: TemplateId;
114
+ params: Record<string, number>;
115
+ };
116
+ /** The rows and release time of the picked templates (and the creator's own rows after them), and the problems that
117
+ * keep the table from launching. The own rows' single checks are rowProblems; the table checks run over everything. */
118
+ export declare function compile(picks: Pick[], own?: Row[]): {
119
+ rows: bigint[];
120
+ release: number;
121
+ problems: string[];
122
+ };
123
+ /** How the editor shows a variable: its unit and how a typed number becomes the on chain value. */
124
+ export type VarDef = {
125
+ v: number;
126
+ label: string;
127
+ unit: string;
128
+ toChain: (x: number) => number;
129
+ fromChain: (x: number) => number;
130
+ lotOnly?: boolean;
131
+ };
132
+ export declare const VARS: VarDef[];
133
+ export declare const VAR_BY_ID: Map<number, VarDef>;
134
+ /** One condition as the editor holds it: numbers in the editor's units. A window holds its period and open time. */
135
+ export type EditCond = {
136
+ v: number;
137
+ op: number;
138
+ x: number;
139
+ period?: number;
140
+ };
141
+ export type EditRow = {
142
+ on: number;
143
+ act: number;
144
+ arg: number;
145
+ conds: EditCond[];
146
+ };
147
+ export declare function emptyEditRow(): EditRow;
148
+ /** The editor's row as an on chain row. A window (MODLT / MODGE on the launch time) packs period << 20 | minutes. */
149
+ export declare function editToRow(e: EditRow): Row;
150
+ /** How long a row can refuse, the validator's way: it lets go by itself (ends), or it closes only by the clock. */
151
+ export type Hold = {
152
+ ends: boolean;
153
+ window: boolean;
154
+ hasHour: boolean;
155
+ hours: number;
156
+ hasDay: boolean;
157
+ days: number;
158
+ };
159
+ export declare const HOLD_LIMITS: {
160
+ readonly maxAgeDays: 7;
161
+ readonly maxHoldBlocks: 1000000;
162
+ readonly minSellCapPpm: 500;
163
+ };
164
+ /**
165
+ * A drop row that pays on every buy: no condition, or only ones every buy meets (the coins of a buy are 0 seconds old,
166
+ * a stranger's coins are not the creator's). Bots then buy small again and again and empty the pot.
167
+ */
168
+ export declare function dropOnEveryBuy(r: Row): boolean;
169
+ export declare function holdOf(r: Row): Hold;
170
+ /** The validator's checks for one row, as sentences (the chain checks again at launch). */
171
+ export declare function rowProblems(r: Row): string[];
172
+ /** Checks of the whole table that no single row shows: burn and pot together, a pot without a drop. */
173
+ export declare function tableProblems(rows: Row[]): string[];
174
+ /** One row as a sentence, for the coin page and the API. */
175
+ export declare function rowText(r: Row, release: number): string;
176
+ /** Which template a row belongs to, by its shape (null for a custom row). */
177
+ export declare function templateOf(r: Row): TemplateId | null;
178
+ /** Scanner color of a whole table: the worst of its templates. */
179
+ export declare function scannerOf(rows: Row[]): "green" | "yellow" | "red";