@mainsail/crypto-block 0.0.1-alpha.2 → 0.0.1-alpha.20
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 +19 -0
- package/distribution/block.js +1 -5
- package/distribution/block.js.map +1 -1
- package/distribution/deserializer.d.ts +1 -1
- package/distribution/deserializer.d.ts.map +1 -1
- package/distribution/deserializer.js +20 -19
- package/distribution/deserializer.js.map +1 -1
- package/distribution/factory.d.ts +2 -2
- package/distribution/factory.d.ts.map +1 -1
- package/distribution/factory.js +30 -29
- package/distribution/factory.js.map +1 -1
- package/distribution/id.factory.js +7 -10
- package/distribution/id.factory.js.map +1 -1
- package/distribution/index.d.ts +6 -7
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +22 -43
- package/distribution/index.js.map +1 -1
- package/distribution/schemas.js +1 -4
- package/distribution/schemas.js.map +1 -1
- package/distribution/serializer.d.ts +1 -1
- package/distribution/serializer.js +10 -13
- package/distribution/serializer.js.map +1 -1
- package/distribution/verifier.js +11 -14
- package/distribution/verifier.js.map +1 -1
- package/package.json +23 -13
package/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Mainsail - Crypto block
|
2
|
+
|
3
|
+

|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
You can find installation instructions and detailed instructions on how to use this package at the [dedicated documentation site](https://ark.dev/docs/mainsail).
|
8
|
+
|
9
|
+
## Security
|
10
|
+
|
11
|
+
If you discover a security vulnerability within this package, please send an e-mail to [security@ark.io](mailto:security@ark.io). All security vulnerabilities will be promptly addressed.
|
12
|
+
|
13
|
+
## Credits
|
14
|
+
|
15
|
+
This project exists thanks to all the people who [contribute](https://github.com/ArkEcosystem/mainsail/graphs/contributors).
|
16
|
+
|
17
|
+
## License
|
18
|
+
|
19
|
+
[GPL-3.0-only](https://github.com/ArkEcosystem/mainsail/blob/main/LICENSE) © [ARK Ecosystem](https://ark.io)
|
package/distribution/block.js
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sealBlock = void 0;
|
4
|
-
const sealBlock = ({ data, serialized, transactions }) => Object.seal({
|
1
|
+
export const sealBlock = ({ data, serialized, transactions }) => Object.seal({
|
5
2
|
data,
|
6
3
|
header: data,
|
7
4
|
serialized,
|
@@ -10,5 +7,4 @@ const sealBlock = ({ data, serialized, transactions }) => Object.seal({
|
|
10
7
|
return transaction;
|
11
8
|
}),
|
12
9
|
});
|
13
|
-
exports.sealBlock = sealBlock;
|
14
10
|
//# sourceMappingURL=block.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../source/block.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAkB,EAA0B,EAAE,CACvG,MAAM,CAAC,IAAI,CAAC;IACX,IAAI;IACJ,MAAM,EAAE,IAAI;IACZ,UAAU;IACV,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QACrD,WAAW,CAAC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAClC,OAAO,WAAW,CAAC;IACpB,CAAC,CAAC;CACF,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAsB,MAAM,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AAOpE,qBACa,YAAa,YAAW,SAAS,CAAC,MAAM,CAAC,iBAAiB;;IAEtE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IAGvC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;IAGzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAG9D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoC;IAEvD,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAU5E,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC;CAmG7G"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -14,26 +13,25 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
14
13
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
15
14
|
};
|
16
15
|
var _Deserializer_instances, _Deserializer_deserializeBufferHeader, _Deserializer_deserializeTransactions;
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.Deserializer = void 0;
|
19
16
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
import { inject, injectable } from "@mainsail/container";
|
18
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
19
|
+
import { TransactionFactory } from "@mainsail/crypto-transaction";
|
20
|
+
import { Utils as AppUtils } from "@mainsail/kernel";
|
21
|
+
import { ByteBuffer } from "@mainsail/utils";
|
22
|
+
import { IDFactory } from "./id.factory.js";
|
25
23
|
let Deserializer = class Deserializer {
|
26
24
|
constructor() {
|
27
25
|
_Deserializer_instances.add(this);
|
28
26
|
}
|
29
27
|
async deserializeHeader(serialized) {
|
30
|
-
const buffer =
|
28
|
+
const buffer = ByteBuffer.fromBuffer(serialized);
|
31
29
|
const header = await __classPrivateFieldGet(this, _Deserializer_instances, "m", _Deserializer_deserializeBufferHeader).call(this, buffer);
|
32
30
|
header.id = await this.idFactory.make(header);
|
33
31
|
return header;
|
34
32
|
}
|
35
33
|
async deserializeWithTransactions(serialized) {
|
36
|
-
const buffer =
|
34
|
+
const buffer = ByteBuffer.fromBuffer(serialized);
|
37
35
|
const block = await __classPrivateFieldGet(this, _Deserializer_instances, "m", _Deserializer_deserializeBufferHeader).call(this, buffer);
|
38
36
|
let transactions = [];
|
39
37
|
if (buffer.getRemainderLength() > 0) {
|
@@ -43,7 +41,6 @@ let Deserializer = class Deserializer {
|
|
43
41
|
return { data: block, transactions };
|
44
42
|
}
|
45
43
|
};
|
46
|
-
exports.Deserializer = Deserializer;
|
47
44
|
_Deserializer_instances = new WeakSet();
|
48
45
|
_Deserializer_deserializeBufferHeader = async function _Deserializer_deserializeBufferHeader(buffer) {
|
49
46
|
const block = {};
|
@@ -107,6 +104,9 @@ _Deserializer_deserializeTransactions = async function _Deserializer_deserialize
|
|
107
104
|
*/
|
108
105
|
const transactions = [];
|
109
106
|
for (let index = 0; index < block.transactions.length; index++) {
|
107
|
+
if (index % 20 === 0) {
|
108
|
+
await AppUtils.sleep(0);
|
109
|
+
}
|
110
110
|
const transaction = await this.transactionFactory.fromBytes(block.transactions[index]);
|
111
111
|
transactions.push(transaction);
|
112
112
|
block.transactions[index] = transaction.data;
|
@@ -114,22 +114,23 @@ _Deserializer_deserializeTransactions = async function _Deserializer_deserialize
|
|
114
114
|
return transactions;
|
115
115
|
};
|
116
116
|
__decorate([
|
117
|
-
|
118
|
-
__metadata("design:type",
|
117
|
+
inject(Identifiers.Cryptography.Block.IDFactory),
|
118
|
+
__metadata("design:type", IDFactory)
|
119
119
|
], Deserializer.prototype, "idFactory", void 0);
|
120
120
|
__decorate([
|
121
|
-
|
122
|
-
__metadata("design:type",
|
121
|
+
inject(Identifiers.Cryptography.Transaction.Factory),
|
122
|
+
__metadata("design:type", TransactionFactory)
|
123
123
|
], Deserializer.prototype, "transactionFactory", void 0);
|
124
124
|
__decorate([
|
125
|
-
|
125
|
+
inject(Identifiers.Cryptography.Serializer),
|
126
126
|
__metadata("design:type", Object)
|
127
127
|
], Deserializer.prototype, "serializer", void 0);
|
128
128
|
__decorate([
|
129
|
-
|
129
|
+
inject(Identifiers.Cryptography.Block.Serializer),
|
130
130
|
__metadata("design:type", Object)
|
131
131
|
], Deserializer.prototype, "blockSerializer", void 0);
|
132
|
-
|
133
|
-
|
132
|
+
Deserializer = __decorate([
|
133
|
+
injectable()
|
134
134
|
], Deserializer);
|
135
|
+
export { Deserializer };
|
135
136
|
//# sourceMappingURL=deserializer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../source/deserializer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAS,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGrC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;;IA0HP,CAAC;IA7GO,KAAK,CAAC,iBAAiB,CAAC,U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AAW,CAAC,IAAI,CAAC;IAC9C,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAvHgB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC;8BACpB,SAAS;+CAAC;AAGtB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;8BACf,kBAAkB;wDAAC;AAGxC;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC;;gDACkB;AAG7C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;qDACkB;AAXxD,YAAY;IADxB,UAAU,EAAE;GACA,YAAY,CA0HxB"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/// <reference types="node" />
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
2
2
|
import { Contracts, Utils } from "@mainsail/contracts";
|
3
3
|
export declare class BlockFactory implements Contracts.Crypto.BlockFactory {
|
4
4
|
#private;
|
@@ -6,7 +6,7 @@ export declare class BlockFactory implements Contracts.Crypto.BlockFactory {
|
|
6
6
|
private readonly deserializer;
|
7
7
|
private readonly idFactory;
|
8
8
|
private readonly validator;
|
9
|
-
make(data: Utils.Mutable<Contracts.Crypto.BlockDataSerializable
|
9
|
+
make(data: Utils.Mutable<Contracts.Crypto.BlockDataSerializable>, transactions: Contracts.Crypto.Transaction[]): Promise<Contracts.Crypto.Block>;
|
10
10
|
fromHex(hex: string): Promise<Contracts.Crypto.Block>;
|
11
11
|
fromBytes(buff: Buffer): Promise<Contracts.Crypto.Block>;
|
12
12
|
fromJson(json: Contracts.Crypto.BlockJson): Promise<Contracts.Crypto.Block>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAA2B,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAMhF,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K,CAAC;CA8DxF"}
|
package/distribution/factory.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -14,21 +13,23 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
14
13
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
15
14
|
};
|
16
15
|
var _BlockFactory_instances, _BlockFactory_fromSerialized, _BlockFactory_applySchema;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
const block_1 = require("./block");
|
23
|
-
const id_factory_1 = require("./id.factory");
|
16
|
+
import { inject, injectable } from "@mainsail/container";
|
17
|
+
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";
|
18
|
+
import { BigNumber } from "@mainsail/utils";
|
19
|
+
import { sealBlock } from "./block.js";
|
20
|
+
import { IDFactory } from "./id.factory.js";
|
24
21
|
let BlockFactory = class BlockFactory {
|
25
22
|
constructor() {
|
26
23
|
_BlockFactory_instances.add(this);
|
27
24
|
}
|
28
|
-
async make(data) {
|
29
|
-
const block = data;
|
30
|
-
|
31
|
-
return
|
25
|
+
async make(data, transactions) {
|
26
|
+
const block = { ...data, id: await this.idFactory.make(data) };
|
27
|
+
const serialized = await this.serializer.serializeWithTransactions(data);
|
28
|
+
return sealBlock({
|
29
|
+
data: block,
|
30
|
+
serialized: serialized.toString("hex"),
|
31
|
+
transactions,
|
32
|
+
});
|
32
33
|
}
|
33
34
|
async fromHex(hex) {
|
34
35
|
return __classPrivateFieldGet(this, _BlockFactory_instances, "m", _BlockFactory_fromSerialized).call(this, Buffer.from(hex, "hex"));
|
@@ -39,14 +40,14 @@ let BlockFactory = class BlockFactory {
|
|
39
40
|
async fromJson(json) {
|
40
41
|
// @ts-ignore
|
41
42
|
const data = { ...json };
|
42
|
-
data.totalAmount =
|
43
|
-
data.totalFee =
|
44
|
-
data.reward =
|
43
|
+
data.totalAmount = BigNumber.make(data.totalAmount);
|
44
|
+
data.totalFee = BigNumber.make(data.totalFee);
|
45
|
+
data.reward = BigNumber.make(data.reward);
|
45
46
|
if (data.transactions) {
|
46
47
|
for (const transaction of data.transactions) {
|
47
|
-
transaction.amount =
|
48
|
-
transaction.fee =
|
49
|
-
transaction.nonce =
|
48
|
+
transaction.amount = BigNumber.make(transaction.amount);
|
49
|
+
transaction.fee = BigNumber.make(transaction.fee);
|
50
|
+
transaction.nonce = BigNumber.make(transaction.nonce);
|
50
51
|
}
|
51
52
|
}
|
52
53
|
return this.fromData(data);
|
@@ -54,13 +55,12 @@ let BlockFactory = class BlockFactory {
|
|
54
55
|
async fromData(data) {
|
55
56
|
await __classPrivateFieldGet(this, _BlockFactory_instances, "m", _BlockFactory_applySchema).call(this, data);
|
56
57
|
const serialized = await this.serializer.serializeWithTransactions(data);
|
57
|
-
return
|
58
|
+
return sealBlock({
|
58
59
|
...(await this.deserializer.deserializeWithTransactions(serialized)),
|
59
60
|
serialized: serialized.toString("hex"),
|
60
61
|
});
|
61
62
|
}
|
62
63
|
};
|
63
|
-
exports.BlockFactory = BlockFactory;
|
64
64
|
_BlockFactory_instances = new WeakSet();
|
65
65
|
_BlockFactory_fromSerialized = async function _BlockFactory_fromSerialized(serialized) {
|
66
66
|
const deserialized = await this.deserializer.deserializeWithTransactions(serialized);
|
@@ -68,7 +68,7 @@ _BlockFactory_fromSerialized = async function _BlockFactory_fromSerialized(seria
|
|
68
68
|
if (validated) {
|
69
69
|
deserialized.data = validated;
|
70
70
|
}
|
71
|
-
return
|
71
|
+
return sealBlock({
|
72
72
|
...deserialized,
|
73
73
|
serialized: serialized.toString("hex"),
|
74
74
|
});
|
@@ -94,29 +94,30 @@ _BlockFactory_applySchema = async function _BlockFactory_applySchema(data) {
|
|
94
94
|
}
|
95
95
|
}
|
96
96
|
if (fatal) {
|
97
|
-
throw new
|
97
|
+
throw new Exceptions.BlockSchemaError(data.height, `Invalid data${error.instancePath ? " at " + error.instancePath : ""}: ` +
|
98
98
|
`${error.message}: ${JSON.stringify(error.data)}`);
|
99
99
|
}
|
100
100
|
}
|
101
101
|
return result.value;
|
102
102
|
};
|
103
103
|
__decorate([
|
104
|
-
|
104
|
+
inject(Identifiers.Cryptography.Block.Serializer),
|
105
105
|
__metadata("design:type", Object)
|
106
106
|
], BlockFactory.prototype, "serializer", void 0);
|
107
107
|
__decorate([
|
108
|
-
|
108
|
+
inject(Identifiers.Cryptography.Block.Deserializer),
|
109
109
|
__metadata("design:type", Object)
|
110
110
|
], BlockFactory.prototype, "deserializer", void 0);
|
111
111
|
__decorate([
|
112
|
-
|
113
|
-
__metadata("design:type",
|
112
|
+
inject(Identifiers.Cryptography.Block.IDFactory),
|
113
|
+
__metadata("design:type", IDFactory)
|
114
114
|
], BlockFactory.prototype, "idFactory", void 0);
|
115
115
|
__decorate([
|
116
|
-
|
116
|
+
inject(Identifiers.Cryptography.Validator),
|
117
117
|
__metadata("design:type", Object)
|
118
118
|
], BlockFactory.prototype, "validator", void 0);
|
119
|
-
|
120
|
-
|
119
|
+
BlockFactory = __decorate([
|
120
|
+
injectable()
|
121
121
|
], BlockFactory);
|
122
|
+
export { BlockFactory };
|
122
123
|
//# sourceMappingURL=factory.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAS,MAAM,qB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AAC;AACrB,CAAC;AAjHgB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;gDACa;AAG9C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC;;kDACe;AAGlD;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC;8BACpB,SAAS;+CAAC;AAGtB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC;;+CACa;AAX5C,YAAY;IADxB,UAAU,EAAE;GACA,YAAY,CAoHxB"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -8,25 +7,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const container_1 = require("@mainsail/container");
|
14
|
-
const contracts_1 = require("@mainsail/contracts");
|
10
|
+
import { inject, injectable } from "@mainsail/container";
|
11
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
15
12
|
let IDFactory = class IDFactory {
|
16
13
|
async make(data) {
|
17
14
|
return (await this.hashFactory.sha256(await this.serializer.serializeHeader(data))).toString("hex");
|
18
15
|
}
|
19
16
|
};
|
20
|
-
exports.IDFactory = IDFactory;
|
21
17
|
__decorate([
|
22
|
-
|
18
|
+
inject(Identifiers.Cryptography.Hash.Factory),
|
23
19
|
__metadata("design:type", Object)
|
24
20
|
], IDFactory.prototype, "hashFactory", void 0);
|
25
21
|
__decorate([
|
26
|
-
|
22
|
+
inject(Identifiers.Cryptography.Block.Serializer),
|
27
23
|
__metadata("design:type", Object)
|
28
24
|
], IDFactory.prototype, "serializer", void 0);
|
29
|
-
|
30
|
-
|
25
|
+
IDFactory = __decorate([
|
26
|
+
injectable()
|
31
27
|
], IDFactory);
|
28
|
+
export { IDFactory };
|
32
29
|
//# sourceMappingURL=id.factory.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"id.factory.js","sourceRoot":"","sources":["../source/id.factory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"id.factory.js","sourceRoot":"","sources":["../source/id.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,SAAS,GAAf,MAAM,SAAS;IAOd,KAAK,CAAC,IAAI,CAAC,IAA4C;QAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrG,CAAC;CACD,CAAA;AARiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;8CACc;AAG3C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;6CACa;AALnD,SAAS;IADrB,UAAU,EAAE;GACA,SAAS,CAUrB"}
|
package/distribution/index.d.ts
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import { Providers } from "@mainsail/kernel";
|
2
|
-
export * from "./deserializer";
|
3
|
-
export * from "./factory";
|
4
|
-
export * from "./id.factory";
|
5
|
-
export * from "./schemas";
|
6
|
-
export * from "./serializer";
|
7
|
-
export * from "./verifier";
|
2
|
+
export * from "./deserializer.js";
|
3
|
+
export * from "./factory.js";
|
4
|
+
export * from "./id.factory.js";
|
5
|
+
export * from "./schemas.js";
|
6
|
+
export * from "./serializer.js";
|
7
|
+
export * from "./verifier.js";
|
8
8
|
export declare class ServiceProvider extends Providers.ServiceProvider {
|
9
9
|
register(): Promise<void>;
|
10
|
-
requiredByWorker(): boolean;
|
11
10
|
}
|
12
11
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAS7C,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAS7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAWtC"}
|
package/distribution/index.js
CHANGED
@@ -1,48 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.ServiceProvider = void 0;
|
18
|
-
const contracts_1 = require("@mainsail/contracts");
|
19
|
-
const kernel_1 = require("@mainsail/kernel");
|
20
|
-
const deserializer_1 = require("./deserializer");
|
21
|
-
const factory_1 = require("./factory");
|
22
|
-
const id_factory_1 = require("./id.factory");
|
23
|
-
const schemas_1 = require("./schemas");
|
24
|
-
const serializer_1 = require("./serializer");
|
25
|
-
const verifier_1 = require("./verifier");
|
26
|
-
__exportStar(require("./deserializer"), exports);
|
27
|
-
__exportStar(require("./factory"), exports);
|
28
|
-
__exportStar(require("./id.factory"), exports);
|
29
|
-
__exportStar(require("./schemas"), exports);
|
30
|
-
__exportStar(require("./serializer"), exports);
|
31
|
-
__exportStar(require("./verifier"), exports);
|
32
|
-
class ServiceProvider extends kernel_1.Providers.ServiceProvider {
|
1
|
+
import { Identifiers } from "@mainsail/contracts";
|
2
|
+
import { Providers } from "@mainsail/kernel";
|
3
|
+
import { Deserializer } from "./deserializer.js";
|
4
|
+
import { BlockFactory } from "./factory.js";
|
5
|
+
import { IDFactory } from "./id.factory.js";
|
6
|
+
import { schemas } from "./schemas.js";
|
7
|
+
import { Serializer } from "./serializer.js";
|
8
|
+
import { Verifier } from "./verifier.js";
|
9
|
+
export * from "./deserializer.js";
|
10
|
+
export * from "./factory.js";
|
11
|
+
export * from "./id.factory.js";
|
12
|
+
export * from "./schemas.js";
|
13
|
+
export * from "./serializer.js";
|
14
|
+
export * from "./verifier.js";
|
15
|
+
export class ServiceProvider extends Providers.ServiceProvider {
|
33
16
|
async register() {
|
34
|
-
this.app.bind(
|
35
|
-
this.app.bind(
|
36
|
-
this.app.bind(
|
37
|
-
this.app.bind(
|
38
|
-
this.app.bind(
|
39
|
-
for (const schema of Object.values(
|
40
|
-
this.app.get(
|
17
|
+
this.app.bind(Identifiers.Cryptography.Block.Deserializer).to(Deserializer).inSingletonScope();
|
18
|
+
this.app.bind(Identifiers.Cryptography.Block.Factory).to(BlockFactory).inSingletonScope();
|
19
|
+
this.app.bind(Identifiers.Cryptography.Block.IDFactory).to(IDFactory).inSingletonScope();
|
20
|
+
this.app.bind(Identifiers.Cryptography.Block.Serializer).to(Serializer).inSingletonScope();
|
21
|
+
this.app.bind(Identifiers.Cryptography.Block.Verifier).to(Verifier).inSingletonScope();
|
22
|
+
for (const schema of Object.values(schemas)) {
|
23
|
+
this.app.get(Identifiers.Cryptography.Validator).addSchema(schema);
|
41
24
|
}
|
42
25
|
}
|
43
|
-
requiredByWorker() {
|
44
|
-
return true;
|
45
|
-
}
|
46
26
|
}
|
47
|
-
exports.ServiceProvider = ServiceProvider;
|
48
27
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,MAAM,OAAO,eAAgB,SAAQ,SAAS,CAAC,eAAe;IACtD,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC/F,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC1F,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACzF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC3F,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAEvF,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAA6B,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChG,CAAC;IACF,CAAC;CACD"}
|
package/distribution/schemas.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAiE;IACpF,KAAK,EAAE;QACN,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE;YACX,YAAY,EAAE;gBACb,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE;gBAC7C,QAAQ,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE;gBAC7C,IAAI,EAAE,O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Q;KACd;CACD,CAAC"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -8,11 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
9
|
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.Serializer = void 0;
|
13
10
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
14
|
-
|
15
|
-
|
11
|
+
import { inject, injectable, tagged } from "@mainsail/container";
|
12
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
16
13
|
let Serializer = class Serializer {
|
17
14
|
headerSize() {
|
18
15
|
return (1 + // version
|
@@ -123,22 +120,22 @@ let Serializer = class Serializer {
|
|
123
120
|
});
|
124
121
|
}
|
125
122
|
};
|
126
|
-
exports.Serializer = Serializer;
|
127
123
|
__decorate([
|
128
|
-
|
129
|
-
|
124
|
+
inject(Identifiers.Cryptography.Serializer),
|
125
|
+
tagged("type", "wallet"),
|
130
126
|
__metadata("design:type", Object)
|
131
127
|
], Serializer.prototype, "serializer", void 0);
|
132
128
|
__decorate([
|
133
|
-
|
129
|
+
inject(Identifiers.Cryptography.Hash.Size.SHA256),
|
134
130
|
__metadata("design:type", Number)
|
135
131
|
], Serializer.prototype, "hashByteLength", void 0);
|
136
132
|
__decorate([
|
137
|
-
|
138
|
-
|
133
|
+
inject(Identifiers.Cryptography.Identity.PublicKey.Size),
|
134
|
+
tagged("type", "wallet"),
|
139
135
|
__metadata("design:type", Number)
|
140
136
|
], Serializer.prototype, "generatorPublicKeyByteLength", void 0);
|
141
|
-
|
142
|
-
|
137
|
+
Serializer = __decorate([
|
138
|
+
injectable()
|
143
139
|
], Serializer);
|
140
|
+
export { Serializer };
|
144
141
|
//# sourceMappingURL=serializer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,UAAU,GAAhB,MAAM,UAAU;IAYf,UAAU;QAChB,OAAO,CACN,CAAC,GAAG,UAAU;YACd,CAAC,GAAG,YAAY;YAChB,CAAC,GAAG,SAAS;YACb,CAAC,GAAG,QAAQ;YACZ,IAAI,CAAC,cAAc,GAAG,gBAAgB;YACtC,CAAC,GAAG,uBAAuB;YAC3B,CAAC,GAAG,cAAc;YAClB,CAAC,GAAG,WAAW;YACf,CAAC,GAAG,SAAS;YACb,CAAC,GAAG,gBAAgB;YACpB,IAAI,CAAC,cAAc,GAAG,cAAc;YACpC,IAAI,CAAC,4BAA4B,CACjC,CAAC;IACH,CAAC;IAEM,SAAS,CAAC,KAA6C;QAC7D,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,aAAa,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,KAA6C;QACzE,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAyC,KAAK,EAAE;YAC/E,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE;YACzB,IAAI,EAAE,CAAC;YACP,MAAM,EAAE;gBACP,OAAO,EAAE;oBACR,IAAI,EAAE,OAAO;iBACb;gBACD,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D,aAAa,EAAE;oBACd,IAAI,EAAE,QAAQ;iBACd;gBACD,WAAW,EAAE;oBACZ,IAAI,EAAE,MAAM;iBACZ;gBACD,kBAAkB,EAAE;oBACnB,IAAI,EAAE,WAAW;iBACjB;gBACD,YAAY,EAAE;oBACb,IAAI,EAAE,cAAc;iBACpB;aACD;SACD,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA1HiB;IAFhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC;IAC3C,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;;8CACqC;AAG7C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;;kDACT;AAIxB;IAFhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;;gEAC8B;AAV3C,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CA6HtB"}
|
package/distribution/verifier.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -8,11 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const contracts_1 = require("@mainsail/contracts");
|
15
|
-
const utils_1 = require("@mainsail/utils");
|
10
|
+
import { inject, injectable } from "@mainsail/container";
|
11
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
12
|
+
import { BigNumber } from "@mainsail/utils";
|
16
13
|
let Verifier = class Verifier {
|
17
14
|
async verify(block) {
|
18
15
|
const blockData = block.data;
|
@@ -48,8 +45,8 @@ let Verifier = class Verifier {
|
|
48
45
|
}
|
49
46
|
// Checking if transactions of the block adds up to block values.
|
50
47
|
const appliedTransactions = {};
|
51
|
-
let totalAmount =
|
52
|
-
let totalFee =
|
48
|
+
let totalAmount = BigNumber.ZERO;
|
49
|
+
let totalFee = BigNumber.ZERO;
|
53
50
|
// The initial payload length takes the overhead for each serialized transaction into account
|
54
51
|
// which is a uint32 per transaction to store the individual length.
|
55
52
|
let totalPayloadLength = 4 * block.transactions.length;
|
@@ -93,20 +90,20 @@ let Verifier = class Verifier {
|
|
93
90
|
return result;
|
94
91
|
}
|
95
92
|
};
|
96
|
-
exports.Verifier = Verifier;
|
97
93
|
__decorate([
|
98
|
-
|
94
|
+
inject(Identifiers.Cryptography.Configuration),
|
99
95
|
__metadata("design:type", Object)
|
100
96
|
], Verifier.prototype, "configuration", void 0);
|
101
97
|
__decorate([
|
102
|
-
|
98
|
+
inject(Identifiers.Cryptography.Block.Serializer),
|
103
99
|
__metadata("design:type", Object)
|
104
100
|
], Verifier.prototype, "serializer", void 0);
|
105
101
|
__decorate([
|
106
|
-
|
102
|
+
inject(Identifiers.Cryptography.Hash.Factory),
|
107
103
|
__metadata("design:type", Object)
|
108
104
|
], Verifier.prototype, "hashFactory", void 0);
|
109
|
-
|
110
|
-
|
105
|
+
Verifier = __decorate([
|
106
|
+
injectable()
|
111
107
|
], Verifier);
|
108
|
+
export { Verifier };
|
112
109
|
//# sourceMappingURL=verifier.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../source/verifier.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../source/verifier.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MA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IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,WAAW,EAAE,CAAC;gBAC/F,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAC5C,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAED,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;QAE7C,OAAO,MAAM,CAAC;IACf,CAAC;CACD,CAAA;AAnHiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;+CACiB;AAG/C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;;4CACa;AAG9C;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;6CACc;AARhD,QAAQ;IADpB,UAAU,EAAE;GACA,QAAQ,CAqHpB"}
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mainsail/crypto-block",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.20",
|
4
4
|
"description": "Block utilities for the Mainsail blockchain",
|
5
5
|
"license": "GPL-3.0-only",
|
6
6
|
"contributors": [],
|
7
|
+
"type": "module",
|
7
8
|
"main": "distribution/index.js",
|
8
9
|
"types": "distribution/index.d.ts",
|
9
10
|
"files": [
|
@@ -11,21 +12,29 @@
|
|
11
12
|
],
|
12
13
|
"dependencies": {
|
13
14
|
"ajv": "8.12.0",
|
14
|
-
"@mainsail/container": "0.0.1-alpha.
|
15
|
-
"@mainsail/contracts": "0.0.1-alpha.
|
16
|
-
"@mainsail/crypto-
|
17
|
-
"@mainsail/
|
18
|
-
"@mainsail/kernel": "0.0.1-alpha.
|
19
|
-
"@mainsail/utils": "0.0.1-alpha.2",
|
20
|
-
"@mainsail/validation": "0.0.1-alpha.2"
|
15
|
+
"@mainsail/container": "0.0.1-alpha.20",
|
16
|
+
"@mainsail/contracts": "0.0.1-alpha.20",
|
17
|
+
"@mainsail/crypto-transaction": "0.0.1-alpha.20",
|
18
|
+
"@mainsail/utils": "0.0.1-alpha.20",
|
19
|
+
"@mainsail/kernel": "0.0.1-alpha.20"
|
21
20
|
},
|
22
21
|
"devDependencies": {
|
23
22
|
"@types/lodash.clone": "^4.5.9",
|
24
23
|
"lodash.clone": "^4.5.0",
|
25
24
|
"uvu": "^0.5.6",
|
26
|
-
"@mainsail/crypto-
|
27
|
-
"@mainsail/crypto-
|
28
|
-
"@mainsail/crypto-
|
25
|
+
"@mainsail/crypto-config": "0.0.1-alpha.20",
|
26
|
+
"@mainsail/crypto-consensus-bls12-381": "0.0.1-alpha.20",
|
27
|
+
"@mainsail/crypto-address-bech32m": "0.0.1-alpha.20",
|
28
|
+
"@mainsail/crypto-key-pair-schnorr": "0.0.1-alpha.20",
|
29
|
+
"@mainsail/crypto-hash-bcrypto": "0.0.1-alpha.20",
|
30
|
+
"@mainsail/crypto-signature-schnorr": "0.0.1-alpha.20",
|
31
|
+
"@mainsail/crypto-validation": "0.0.1-alpha.20",
|
32
|
+
"@mainsail/crypto-wif": "0.0.1-alpha.20",
|
33
|
+
"@mainsail/fees-static": "0.0.1-alpha.20",
|
34
|
+
"@mainsail/fees": "0.0.1-alpha.20",
|
35
|
+
"@mainsail/serializer": "0.0.1-alpha.20",
|
36
|
+
"@mainsail/crypto-transaction-transfer": "0.0.1-alpha.20",
|
37
|
+
"@mainsail/validation": "0.0.1-alpha.20"
|
29
38
|
},
|
30
39
|
"engines": {
|
31
40
|
"node": ">=20.x"
|
@@ -35,9 +44,10 @@
|
|
35
44
|
"build:watch": "pnpm run clean && tsc -w",
|
36
45
|
"clean": "del distribution",
|
37
46
|
"release": "pnpm publish --access public",
|
38
|
-
"test": "
|
47
|
+
"test": "pnpm run uvu source .test.ts",
|
39
48
|
"test:coverage": "c8 pnpm run test",
|
40
49
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
41
|
-
"test:file": "
|
50
|
+
"test:file": "pnpm run uvu source",
|
51
|
+
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|
42
52
|
}
|
43
53
|
}
|