@tychosdk/disasm 0.1.2 → 0.1.3
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 +0 -2
- package/dist/index.d.ts +108 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,110 @@
|
|
|
1
|
-
export type { Code, CodeBlock, CodeBlockTail, Data, DataBlock, Item, ItemId, JumpTable, Library, Opcode, OpcodeArg, } from "./env";
|
|
2
|
-
import type { Code } from "./env";
|
|
3
1
|
import { Cell } from "@ton/core";
|
|
2
|
+
/**
|
|
3
|
+
* All code parts are referenced by a numberic ID.
|
|
4
|
+
*/
|
|
5
|
+
export type ItemId = number;
|
|
6
|
+
/**
|
|
7
|
+
* Code is a group of parsed parts and an index from which to start.
|
|
8
|
+
*/
|
|
9
|
+
export type Code = {
|
|
10
|
+
root: ItemId;
|
|
11
|
+
items: Item[];
|
|
12
|
+
};
|
|
13
|
+
export type Item = ({
|
|
14
|
+
id: number;
|
|
15
|
+
type: "jumpTable";
|
|
16
|
+
} & JumpTable) | ({
|
|
17
|
+
id: number;
|
|
18
|
+
type: "code";
|
|
19
|
+
} & CodeBlock) | ({
|
|
20
|
+
id: number;
|
|
21
|
+
type: "dataBlock";
|
|
22
|
+
} & DataBlock) | ({
|
|
23
|
+
id: number;
|
|
24
|
+
type: "library";
|
|
25
|
+
} & Library);
|
|
26
|
+
export type ItemType = Item["type"];
|
|
27
|
+
/**
|
|
28
|
+
* Jump table is a dictionary which maps int to some continuations.
|
|
29
|
+
*/
|
|
30
|
+
export type JumpTable = {
|
|
31
|
+
cellHash: string;
|
|
32
|
+
keyBits: number;
|
|
33
|
+
items: Record<string, ItemId>;
|
|
34
|
+
isFullCode: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parsed continuation.
|
|
38
|
+
*/
|
|
39
|
+
export type CodeBlock = {
|
|
40
|
+
cellHash: string;
|
|
41
|
+
isInline: boolean;
|
|
42
|
+
offsetBits: number;
|
|
43
|
+
offsetRefs: number;
|
|
44
|
+
bits: number;
|
|
45
|
+
refs: number;
|
|
46
|
+
opcodes: Opcode[];
|
|
47
|
+
tail?: CodeBlockTail;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* What follows the continuation.
|
|
51
|
+
*/
|
|
52
|
+
export type CodeBlockTail = {
|
|
53
|
+
type: "incomplete";
|
|
54
|
+
} | {
|
|
55
|
+
type: "child";
|
|
56
|
+
id: ItemId;
|
|
57
|
+
};
|
|
58
|
+
export type CodeBlockTailType = CodeBlockTail["type"];
|
|
59
|
+
/**
|
|
60
|
+
* Parsed opcode.
|
|
61
|
+
*/
|
|
62
|
+
export type Opcode = {
|
|
63
|
+
bits: number;
|
|
64
|
+
refs?: number;
|
|
65
|
+
name: string;
|
|
66
|
+
args: OpcodeArg[];
|
|
67
|
+
gas: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Parsed opcode argument.
|
|
71
|
+
*/
|
|
72
|
+
export type OpcodeArg = {
|
|
73
|
+
type: "int";
|
|
74
|
+
value: string;
|
|
75
|
+
} | {
|
|
76
|
+
type: "stack";
|
|
77
|
+
idx: number;
|
|
78
|
+
} | {
|
|
79
|
+
type: "reg";
|
|
80
|
+
idx: number;
|
|
81
|
+
} | {
|
|
82
|
+
type: "cell";
|
|
83
|
+
id: ItemId;
|
|
84
|
+
} | {
|
|
85
|
+
type: "slice";
|
|
86
|
+
id: ItemId;
|
|
87
|
+
};
|
|
88
|
+
export type OpcodeArgType = OpcodeArg["type"];
|
|
89
|
+
/**
|
|
90
|
+
* Cell tree parts that are treated as data.
|
|
91
|
+
*/
|
|
92
|
+
export type DataBlock = {
|
|
93
|
+
data: Data;
|
|
94
|
+
};
|
|
95
|
+
export type Data = {
|
|
96
|
+
type: "slice";
|
|
97
|
+
offsetBits: number;
|
|
98
|
+
offsetRefs: number;
|
|
99
|
+
bits: number;
|
|
100
|
+
refs: number;
|
|
101
|
+
boc: string;
|
|
102
|
+
} | {
|
|
103
|
+
type: "cell";
|
|
104
|
+
boc: string;
|
|
105
|
+
};
|
|
106
|
+
export type DataType = Data["type"];
|
|
107
|
+
export type Library = {
|
|
108
|
+
hash: string;
|
|
109
|
+
};
|
|
4
110
|
export declare function disasmStructured(code: Cell | string): Promise<Code>;
|
package/dist/index.js
CHANGED