@tychosdk/disasm 0.1.0 → 0.1.2

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 CHANGED
@@ -26,6 +26,65 @@ const code = Cell.fromBase64("te6ccgEBAgEACwABCvgAgHuIAQABYA==");
26
26
  const parsed = await disasmStructured(code);
27
27
  ```
28
28
 
29
+ ### Example output
30
+
31
+ ```json
32
+ {
33
+ "root": 0,
34
+ "items": [
35
+ {
36
+ "id": 0,
37
+ "type": "code",
38
+ "cellHash": "4c22ee65d587da45ad571a90740ea5a50ba58ee88e75769fbc9ac47eef693e68",
39
+ "isInline": false,
40
+ "offsetBits": 0,
41
+ "offsetRefs": 0,
42
+ "bits": 40,
43
+ "refs": 1,
44
+ "opcodes": [
45
+ {
46
+ "bits": 16,
47
+ "name": "ACCEPT",
48
+ "gas": 26
49
+ },
50
+ {
51
+ "bits": 16,
52
+ "name": "PUSHINT",
53
+ "args": [
54
+ {
55
+ "type": "int",
56
+ "value": "123"
57
+ }
58
+ ],
59
+ "gas": 26
60
+ },
61
+ {
62
+ "bits": 8,
63
+ "refs": 1,
64
+ "name": "PUSHREF",
65
+ "args": [
66
+ {
67
+ "type": "cell",
68
+ "id": 1
69
+ }
70
+ ],
71
+ "gas": 18
72
+ }
73
+ ],
74
+ "tail": null
75
+ },
76
+ {
77
+ "id": 1,
78
+ "type": "data",
79
+ "data": {
80
+ "type": "cell",
81
+ "boc": "te6ccgEBAQEAAwAAAWA="
82
+ }
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
29
88
  ## Development
30
89
 
31
90
  ### @tychosdk/disasm
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export type { Code, CodeBlock, CodeBlockTail, Data, DataBlock, Item, ItemId, JumpTable, Library, Link, LinkType, Opcode, } from "./env";
1
+ export type { Code, CodeBlock, CodeBlockTail, Data, DataBlock, Item, ItemId, JumpTable, Library, Opcode, OpcodeArg, } from "./env";
2
2
  import type { Code } from "./env";
3
- export declare function disasmStructured(code: string): Promise<Code>;
3
+ import { Cell } from "@ton/core";
4
+ export declare function disasmStructured(code: Cell | string): Promise<Code>;
package/dist/index.js CHANGED
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.disasmStructured = disasmStructured;
4
+ const core_1 = require("@ton/core");
4
5
  const env_1 = require("./env");
5
6
  async function disasmStructured(code) {
6
7
  await (0, env_1.wasmLoaded)();
7
- const res = env_1.wasm.disasm_structured(code);
8
+ let boc;
9
+ if (code instanceof core_1.Cell) {
10
+ boc = code.toBoc({ idx: false }).toString("base64");
11
+ }
12
+ else {
13
+ boc = code;
14
+ }
15
+ const res = env_1.wasm.disasm_structured(boc);
8
16
  return JSON.parse(res);
9
17
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tychosdk/disasm",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Tycho TVM disasm",
5
5
  "main": "dist/index.js",
6
6
  "browser": {
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@ton/core": "^0.60.1",
20
+ "@ton/crypto": "^3.3.0",
20
21
  "@types/jest": "^29.5.14",
21
22
  "@types/node": "^18.15.11",
22
23
  "jest": "^29.7.0",