@ckb-ccc/spore 1.1.1 → 1.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.
- package/CHANGELOG.md +11 -0
- package/dist/dob/api/decode.d.ts +2 -0
- package/dist/dob/api/decode.d.ts.map +1 -1
- package/dist/dob/api/decode.js +31 -12
- package/dist/dob/helper/index.d.ts +1 -0
- package/dist/dob/helper/index.d.ts.map +1 -1
- package/dist/dob/helper/index.js +1 -0
- package/dist.commonjs/dob/api/decode.d.ts +2 -0
- package/dist.commonjs/dob/api/decode.d.ts.map +1 -1
- package/dist.commonjs/dob/api/decode.js +33 -12
- package/dist.commonjs/dob/helper/index.d.ts +1 -0
- package/dist.commonjs/dob/helper/index.d.ts.map +1 -1
- package/dist.commonjs/dob/helper/index.js +1 -0
- package/package.json +2 -2
- package/src/dob/api/decode.ts +40 -12
- package/src/dob/helper/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ckb-ccc/spore
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#136](https://github.com/ckb-devrel/ccc/pull/136) [`a1d5626`](https://github.com/ckb-devrel/ccc/commit/a1d56266da68602495054ad6b627b998ef27f04d) Thanks [@ashuralyk](https://github.com/ashuralyk)! - feat(spore): support decoding rendered dob data from spore data and cluster data
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`3fdb2c4`](https://github.com/ckb-devrel/ccc/commit/3fdb2c477d0b2766b231e436b8f396f047b02634), [`f429087`](https://github.com/ckb-devrel/ccc/commit/f4290874dfab3fe58844e5169673c5d47bda64e3)]:
|
|
12
|
+
- @ckb-ccc/core@1.4.0
|
|
13
|
+
|
|
3
14
|
## 1.1.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/dob/api/decode.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import { RenderOutput } from "../helper/object.js";
|
|
3
|
+
export declare function extractDobFromDecoderResult(result: string): RenderOutput;
|
|
3
4
|
export declare function decodeDobBySporeId(sporeId: ccc.HexLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
4
5
|
export declare function decodeDobBySporeCell(sporeOutput: ccc.CellOutputLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
5
6
|
export declare function decodeDobBySporeOutpoint(client: ccc.Client, sporeOutpoint: ccc.OutPointLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
7
|
+
export declare function decodeDobByRawData(sporeCellData: ccc.HexLike, clusterCellData: ccc.HexLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
6
8
|
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/dob/api/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,GAAG,CAAC,OAAO,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/dob/api/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAaxE;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,GAAG,CAAC,OAAO,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAkBvB;AAED,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,GAAG,CAAC,cAAc,EAC/B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAMvB;AAED,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,aAAa,EAAE,GAAG,CAAC,YAAY,EAC/B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAMvB;AAED,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,GAAG,CAAC,OAAO,EAC1B,eAAe,EAAE,GAAG,CAAC,OAAO,EAC5B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAkBvB"}
|
package/dist/dob/api/decode.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import { Axios } from "axios";
|
|
3
3
|
import { getErrorByCode } from "../helper/error.js";
|
|
4
|
+
export function extractDobFromDecoderResult(result) {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
6
|
+
const decoderResult = JSON.parse(result);
|
|
7
|
+
if ("error" in decoderResult) {
|
|
8
|
+
const serverError = getErrorByCode(decoderResult.error.code);
|
|
9
|
+
throw new Error(`Decode DOB failed: ${serverError}`);
|
|
10
|
+
}
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
12
|
+
const renderResult = JSON.parse(decoderResult.result);
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
14
|
+
const renderOutput = JSON.parse(renderResult.render_output);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
16
|
+
return renderOutput;
|
|
17
|
+
}
|
|
4
18
|
export async function decodeDobBySporeId(sporeId, dobServerUrl) {
|
|
5
19
|
const axios = new Axios({
|
|
6
20
|
baseURL: dobServerUrl,
|
|
@@ -15,18 +29,7 @@ export async function decodeDobBySporeId(sporeId, dobServerUrl) {
|
|
|
15
29
|
method: "dob_decode",
|
|
16
30
|
params: [ccc.hexFrom(sporeId).replace(/^0x/, "")],
|
|
17
31
|
}));
|
|
18
|
-
|
|
19
|
-
const decoderResult = JSON.parse(result.data);
|
|
20
|
-
if ("error" in decoderResult) {
|
|
21
|
-
const serverError = getErrorByCode(decoderResult.error.code);
|
|
22
|
-
throw new Error(`Decode DOB failed: ${serverError}`);
|
|
23
|
-
}
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
25
|
-
const renderResult = JSON.parse(decoderResult.result);
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
27
|
-
const renderOutput = JSON.parse(renderResult.render_output);
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
29
|
-
return renderOutput;
|
|
32
|
+
return extractDobFromDecoderResult(result.data);
|
|
30
33
|
}
|
|
31
34
|
export async function decodeDobBySporeCell(sporeOutput, dobServerUrl) {
|
|
32
35
|
const sporeId = sporeOutput.type?.args;
|
|
@@ -42,3 +45,19 @@ export async function decodeDobBySporeOutpoint(client, sporeOutpoint, dobServerU
|
|
|
42
45
|
}
|
|
43
46
|
return decodeDobBySporeCell(liveCell.cellOutput, dobServerUrl);
|
|
44
47
|
}
|
|
48
|
+
export async function decodeDobByRawData(sporeCellData, clusterCellData, dobServerUrl) {
|
|
49
|
+
const axios = new Axios({
|
|
50
|
+
baseURL: dobServerUrl,
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: {
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const result = await axios.post("/", JSON.stringify({
|
|
57
|
+
id: 0,
|
|
58
|
+
jsonrpc: "2.0",
|
|
59
|
+
method: "dob_raw_decode",
|
|
60
|
+
params: [ccc.hexFrom(sporeCellData), ccc.hexFrom(clusterCellData)],
|
|
61
|
+
}));
|
|
62
|
+
return extractDobFromDecoderResult(result.data);
|
|
63
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dob/helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dob/helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
package/dist/dob/helper/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import { RenderOutput } from "../helper/object.js";
|
|
3
|
+
export declare function extractDobFromDecoderResult(result: string): RenderOutput;
|
|
3
4
|
export declare function decodeDobBySporeId(sporeId: ccc.HexLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
4
5
|
export declare function decodeDobBySporeCell(sporeOutput: ccc.CellOutputLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
5
6
|
export declare function decodeDobBySporeOutpoint(client: ccc.Client, sporeOutpoint: ccc.OutPointLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
7
|
+
export declare function decodeDobByRawData(sporeCellData: ccc.HexLike, clusterCellData: ccc.HexLike, dobServerUrl: string): Promise<RenderOutput>;
|
|
6
8
|
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/dob/api/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,GAAG,CAAC,OAAO,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/dob/api/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAaxE;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,GAAG,CAAC,OAAO,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAkBvB;AAED,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,GAAG,CAAC,cAAc,EAC/B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAMvB;AAED,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,aAAa,EAAE,GAAG,CAAC,YAAY,EAC/B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAMvB;AAED,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,GAAG,CAAC,OAAO,EAC1B,eAAe,EAAE,GAAG,CAAC,OAAO,EAC5B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC,CAkBvB"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractDobFromDecoderResult = extractDobFromDecoderResult;
|
|
3
4
|
exports.decodeDobBySporeId = decodeDobBySporeId;
|
|
4
5
|
exports.decodeDobBySporeCell = decodeDobBySporeCell;
|
|
5
6
|
exports.decodeDobBySporeOutpoint = decodeDobBySporeOutpoint;
|
|
7
|
+
exports.decodeDobByRawData = decodeDobByRawData;
|
|
6
8
|
const core_1 = require("@ckb-ccc/core");
|
|
7
9
|
const axios_1 = require("axios");
|
|
8
10
|
const error_js_1 = require("../helper/error.js");
|
|
11
|
+
function extractDobFromDecoderResult(result) {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
13
|
+
const decoderResult = JSON.parse(result);
|
|
14
|
+
if ("error" in decoderResult) {
|
|
15
|
+
const serverError = (0, error_js_1.getErrorByCode)(decoderResult.error.code);
|
|
16
|
+
throw new Error(`Decode DOB failed: ${serverError}`);
|
|
17
|
+
}
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
19
|
+
const renderResult = JSON.parse(decoderResult.result);
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
21
|
+
const renderOutput = JSON.parse(renderResult.render_output);
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
23
|
+
return renderOutput;
|
|
24
|
+
}
|
|
9
25
|
async function decodeDobBySporeId(sporeId, dobServerUrl) {
|
|
10
26
|
const axios = new axios_1.Axios({
|
|
11
27
|
baseURL: dobServerUrl,
|
|
@@ -20,18 +36,7 @@ async function decodeDobBySporeId(sporeId, dobServerUrl) {
|
|
|
20
36
|
method: "dob_decode",
|
|
21
37
|
params: [core_1.ccc.hexFrom(sporeId).replace(/^0x/, "")],
|
|
22
38
|
}));
|
|
23
|
-
|
|
24
|
-
const decoderResult = JSON.parse(result.data);
|
|
25
|
-
if ("error" in decoderResult) {
|
|
26
|
-
const serverError = (0, error_js_1.getErrorByCode)(decoderResult.error.code);
|
|
27
|
-
throw new Error(`Decode DOB failed: ${serverError}`);
|
|
28
|
-
}
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
30
|
-
const renderResult = JSON.parse(decoderResult.result);
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
32
|
-
const renderOutput = JSON.parse(renderResult.render_output);
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
34
|
-
return renderOutput;
|
|
39
|
+
return extractDobFromDecoderResult(result.data);
|
|
35
40
|
}
|
|
36
41
|
async function decodeDobBySporeCell(sporeOutput, dobServerUrl) {
|
|
37
42
|
const sporeId = sporeOutput.type?.args;
|
|
@@ -47,3 +52,19 @@ async function decodeDobBySporeOutpoint(client, sporeOutpoint, dobServerUrl) {
|
|
|
47
52
|
}
|
|
48
53
|
return decodeDobBySporeCell(liveCell.cellOutput, dobServerUrl);
|
|
49
54
|
}
|
|
55
|
+
async function decodeDobByRawData(sporeCellData, clusterCellData, dobServerUrl) {
|
|
56
|
+
const axios = new axios_1.Axios({
|
|
57
|
+
baseURL: dobServerUrl,
|
|
58
|
+
method: "POST",
|
|
59
|
+
headers: {
|
|
60
|
+
"Content-Type": "application/json",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const result = await axios.post("/", JSON.stringify({
|
|
64
|
+
id: 0,
|
|
65
|
+
jsonrpc: "2.0",
|
|
66
|
+
method: "dob_raw_decode",
|
|
67
|
+
params: [core_1.ccc.hexFrom(sporeCellData), core_1.ccc.hexFrom(clusterCellData)],
|
|
68
|
+
}));
|
|
69
|
+
return extractDobFromDecoderResult(result.data);
|
|
70
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dob/helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dob/helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./check.js"), exports);
|
|
18
|
+
__exportStar(require("./error.js"), exports);
|
|
18
19
|
__exportStar(require("./object.js"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/spore",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "CCC - CKBer's Codebase. Common Chains Connector's support for Spore protocol",
|
|
5
5
|
"author": "ashuralyk <ashuralyk@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"axios": "^1.7.7",
|
|
57
|
-
"@ckb-ccc/core": "1.
|
|
57
|
+
"@ckb-ccc/core": "1.4.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
|
package/src/dob/api/decode.ts
CHANGED
|
@@ -3,6 +3,21 @@ import { Axios } from "axios";
|
|
|
3
3
|
import { getErrorByCode } from "../helper/error.js";
|
|
4
4
|
import { RenderOutput } from "../helper/object.js";
|
|
5
5
|
|
|
6
|
+
export function extractDobFromDecoderResult(result: string): RenderOutput {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
8
|
+
const decoderResult = JSON.parse(result);
|
|
9
|
+
if ("error" in decoderResult) {
|
|
10
|
+
const serverError = getErrorByCode(decoderResult.error.code as number);
|
|
11
|
+
throw new Error(`Decode DOB failed: ${serverError}`);
|
|
12
|
+
}
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
14
|
+
const renderResult = JSON.parse(decoderResult.result);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
16
|
+
const renderOutput = JSON.parse(renderResult.render_output);
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18
|
+
return renderOutput;
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
export async function decodeDobBySporeId(
|
|
7
22
|
sporeId: ccc.HexLike,
|
|
8
23
|
dobServerUrl: string,
|
|
@@ -23,18 +38,7 @@ export async function decodeDobBySporeId(
|
|
|
23
38
|
params: [ccc.hexFrom(sporeId).replace(/^0x/, "")],
|
|
24
39
|
}),
|
|
25
40
|
);
|
|
26
|
-
|
|
27
|
-
const decoderResult = JSON.parse(result.data);
|
|
28
|
-
if ("error" in decoderResult) {
|
|
29
|
-
const serverError = getErrorByCode(decoderResult.error.code as number);
|
|
30
|
-
throw new Error(`Decode DOB failed: ${serverError}`);
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
33
|
-
const renderResult = JSON.parse(decoderResult.result);
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
35
|
-
const renderOutput = JSON.parse(renderResult.render_output);
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
37
|
-
return renderOutput;
|
|
41
|
+
return extractDobFromDecoderResult(result.data as string);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
export async function decodeDobBySporeCell(
|
|
@@ -59,3 +63,27 @@ export async function decodeDobBySporeOutpoint(
|
|
|
59
63
|
}
|
|
60
64
|
return decodeDobBySporeCell(liveCell.cellOutput, dobServerUrl);
|
|
61
65
|
}
|
|
66
|
+
|
|
67
|
+
export async function decodeDobByRawData(
|
|
68
|
+
sporeCellData: ccc.HexLike,
|
|
69
|
+
clusterCellData: ccc.HexLike,
|
|
70
|
+
dobServerUrl: string,
|
|
71
|
+
): Promise<RenderOutput> {
|
|
72
|
+
const axios = new Axios({
|
|
73
|
+
baseURL: dobServerUrl,
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: {
|
|
76
|
+
"Content-Type": "application/json",
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
const result = await axios.post(
|
|
80
|
+
"/",
|
|
81
|
+
JSON.stringify({
|
|
82
|
+
id: 0,
|
|
83
|
+
jsonrpc: "2.0",
|
|
84
|
+
method: "dob_raw_decode",
|
|
85
|
+
params: [ccc.hexFrom(sporeCellData), ccc.hexFrom(clusterCellData)],
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
return extractDobFromDecoderResult(result.data as string);
|
|
89
|
+
}
|
package/src/dob/helper/index.ts
CHANGED