@autonomys/auto-consensus 0.6.7 → 0.6.8
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/dist/info.d.ts +4 -2
- package/dist/info.d.ts.map +1 -1
- package/dist/info.js +10 -2
- package/dist/types/block.d.ts +16 -0
- package/dist/types/block.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/info.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AnyTuple, Api, Codec, StorageKey } from '@autonomys/auto-utils';
|
|
1
|
+
import type { AnyTuple, Api, Codec, StorageKey } from '@autonomys/auto-utils';
|
|
2
|
+
import type { RawBlock, RawBlockHeader } from './types/block';
|
|
2
3
|
export declare const rpc: <T>(api: Api, methodPath: string, params?: any[]) => Promise<T>;
|
|
3
4
|
export declare const query: <T>(api: Api, methodPath: string, params?: any[]) => Promise<T>;
|
|
4
|
-
export declare const block:
|
|
5
|
+
export declare const block: (api: Api) => Promise<RawBlock>;
|
|
6
|
+
export declare const header: (api: Api) => Promise<RawBlockHeader>;
|
|
5
7
|
export declare const blockNumber: (api: Api) => Promise<number>;
|
|
6
8
|
export declare const blockHash: (api: Api) => Promise<string>;
|
|
7
9
|
export declare const networkTimestamp: (api: Api) => Promise<Codec>;
|
package/dist/info.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAc,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAK7D,eAAO,MAAM,GAAG,GAAU,CAAC,OAAO,GAAG,cAAc,MAAM,WAAU,GAAG,EAAE,KAAQ,OAAO,CAAC,CAAC,CAC7B,CAAA;AAE5D,eAAO,MAAM,KAAK,GAAU,CAAC,OAAO,GAAG,cAAc,MAAM,WAAU,GAAG,EAAE,KAAQ,OAAO,CAAC,CAAC,CAC7B,CAAA;AAE9D,eAAO,MAAM,KAAK,QAAe,GAAG,sBAAmD,CAAA;AAEvF,eAAO,MAAM,MAAM,QAAe,GAAG,4BAA0D,CAAA;AAE/F,eAAO,MAAM,WAAW,QAAe,GAAG,KAAG,OAAO,CAAC,MAAM,CAK1D,CAAA;AAED,eAAO,MAAM,SAAS,QAAe,GAAG,oBAGvC,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAe,GAAG,mBAAiD,CAAA;AAEhG,eAAO,MAAM,cAAc,QAAe,GAAG;;;;;EAc5C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAe,GAAG,KAAG,OAAO,CAAC,OAAO,CACL,CAAA;AAErE,eAAO,MAAM,iBAAiB,QAAe,GAAG,6CAM/C,CAAA;AAED,eAAO,MAAM,eAAe,QAAS,GAAG,KAAG,CAAC,MAAM,EAAE,MAAM,CACa,CAAA;AAEvE,eAAO,MAAM,iBAAiB,QAAS,GAAG,KAAG,MAC0B,CAAA;AAEvE,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,CAUR;AAED,eAAO,MAAM,WAAW,QAAe,GAAG,KAAG,OAAO,CAAC,MAAM,CAa1D,CAAA;AAED,eAAO,MAAM,cAAc,QAAe,GAAG,KAAG,OAAO,CAAC,MAAM,CAM7D,CAAA"}
|
package/dist/info.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.blockchainSize = exports.spacePledge = exports.maxPiecesInSector = exports.slotProbability = exports.segmentCommitment = exports.shouldAdjustSolutionRange = exports.solutionRanges = exports.networkTimestamp = exports.blockHash = exports.blockNumber = exports.block = exports.query = exports.rpc = void 0;
|
|
13
|
+
exports.blockchainSize = exports.spacePledge = exports.maxPiecesInSector = exports.slotProbability = exports.segmentCommitment = exports.shouldAdjustSolutionRange = exports.solutionRanges = exports.networkTimestamp = exports.blockHash = exports.blockNumber = exports.header = exports.block = exports.query = exports.rpc = void 0;
|
|
14
14
|
exports.solutionRangeToPieces = solutionRangeToPieces;
|
|
15
15
|
const query_1 = require("./utils/query");
|
|
16
16
|
const PIECE_SIZE = BigInt(1048576);
|
|
@@ -20,6 +20,8 @@ const query = (api_1, methodPath_1, ...args_1) => __awaiter(void 0, [api_1, meth
|
|
|
20
20
|
exports.query = query;
|
|
21
21
|
const block = (api) => __awaiter(void 0, void 0, void 0, function* () { return yield (0, exports.rpc)(api, 'chain.getBlock', []); });
|
|
22
22
|
exports.block = block;
|
|
23
|
+
const header = (api) => __awaiter(void 0, void 0, void 0, function* () { return yield (0, exports.rpc)(api, 'chain.getHeader', []); });
|
|
24
|
+
exports.header = header;
|
|
23
25
|
const blockNumber = (api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
26
|
// Get the block
|
|
25
27
|
const _block = yield (0, exports.block)(api);
|
|
@@ -46,7 +48,13 @@ const solutionRanges = (api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
46
48
|
exports.solutionRanges = solutionRanges;
|
|
47
49
|
const shouldAdjustSolutionRange = (api) => __awaiter(void 0, void 0, void 0, function* () { return yield (0, exports.query)(api, 'subspace.shouldAdjustSolutionRange', []); });
|
|
48
50
|
exports.shouldAdjustSolutionRange = shouldAdjustSolutionRange;
|
|
49
|
-
const segmentCommitment = (api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const segmentCommitment = (api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
if (api.at) {
|
|
53
|
+
const { parentHash } = yield (0, exports.header)(api);
|
|
54
|
+
api = yield api.at(parentHash);
|
|
55
|
+
}
|
|
56
|
+
return yield (0, exports.query)(api, 'subspace.segmentCommitment.entries', []);
|
|
57
|
+
});
|
|
50
58
|
exports.segmentCommitment = segmentCommitment;
|
|
51
59
|
const slotProbability = (api) => api.consts.subspace.slotProbability.toPrimitive();
|
|
52
60
|
exports.slotProbability = slotProbability;
|
package/dist/types/block.d.ts
CHANGED
|
@@ -12,6 +12,21 @@ export type RawBlock = {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
+
type DigestLog = {
|
|
16
|
+
preRuntime?: string[];
|
|
17
|
+
consensus?: string[];
|
|
18
|
+
other?: string;
|
|
19
|
+
seal?: string[];
|
|
20
|
+
};
|
|
21
|
+
export type RawBlockHeader = {
|
|
22
|
+
parentHash: string;
|
|
23
|
+
number: number;
|
|
24
|
+
stateRoot: string;
|
|
25
|
+
extrinsicsRoot: string;
|
|
26
|
+
digest: {
|
|
27
|
+
logs: DigestLog[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
15
30
|
export type Block = {
|
|
16
31
|
block: {
|
|
17
32
|
header: {
|
|
@@ -25,4 +40,5 @@ export type Block = {
|
|
|
25
40
|
};
|
|
26
41
|
};
|
|
27
42
|
};
|
|
43
|
+
export {};
|
|
28
44
|
//# sourceMappingURL=block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/types/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAA;AAE/C,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE;QACL,MAAM,EAAE;YACN,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,EAAE,CAAA;YACV,SAAS,EAAE,MAAM,CAAA;YACjB,cAAc,EAAE,MAAM,CAAA;YACtB,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,EAAE,CAAA;aACf,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE;QACL,MAAM,EAAE;YACN,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,MAAM,CAAA;YACd,SAAS,EAAE,MAAM,CAAA;YACjB,cAAc,EAAE,MAAM,CAAA;YACtB,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,EAAE,CAAA;aACf,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/types/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAA;AAE/C,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE;QACL,MAAM,EAAE;YACN,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,EAAE,CAAA;YACV,SAAS,EAAE,MAAM,CAAA;YACjB,cAAc,EAAE,MAAM,CAAA;YACtB,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,EAAE,CAAA;aACf,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AAED,KAAK,SAAS,GAAG;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE;QACN,IAAI,EAAE,SAAS,EAAE,CAAA;KAClB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE;QACL,MAAM,EAAE;YACN,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,MAAM,CAAA;YACd,SAAS,EAAE,MAAM,CAAA;YACjB,cAAc,EAAE,MAAM,CAAA;YACtB,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,EAAE,CAAA;aACf,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomys/auto-consensus",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "https://www.autonomys.net"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@autonomys/auto-utils": "^0.6.
|
|
25
|
+
"@autonomys/auto-utils": "^0.6.8"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/jest": "^29.5.12",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"ts-jest": "^29.1.4",
|
|
33
33
|
"typescript": "^5.4.5"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "509bb6d337ca6c0f4da389cd342f1b58be57cb7e"
|
|
36
36
|
}
|