@mainsail/transactions 0.0.1-alpha.8 → 0.0.1-evm.1
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/distribution/handlers/handler-provider.d.ts.map +1 -1
- package/distribution/handlers/handler-provider.js +29 -27
- package/distribution/handlers/handler-provider.js.map +1 -1
- package/distribution/handlers/handler-registry.d.ts +1 -1
- package/distribution/handlers/handler-registry.d.ts.map +1 -1
- package/distribution/handlers/handler-registry.js +18 -21
- package/distribution/handlers/handler-registry.js.map +1 -1
- package/distribution/handlers/index.d.ts +4 -3
- package/distribution/handlers/index.d.ts.map +1 -1
- package/distribution/handlers/index.js +3 -9
- package/distribution/handlers/index.js.map +1 -1
- package/distribution/handlers/transaction.d.ts +11 -7
- package/distribution/handlers/transaction.d.ts.map +1 -1
- package/distribution/handlers/transaction.js +79 -50
- package/distribution/handlers/transaction.js.map +1 -1
- package/distribution/index.d.ts +3 -3
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +4 -33
- package/distribution/index.js.map +1 -1
- package/distribution/service-provider.d.ts +1 -1
- package/distribution/service-provider.d.ts.map +1 -1
- package/distribution/service-provider.js +14 -13
- package/distribution/service-provider.js.map +1 -1
- package/distribution/transaction-validator.d.ts +12 -0
- package/distribution/transaction-validator.d.ts.map +1 -0
- package/distribution/transaction-validator.js +95 -0
- package/distribution/transaction-validator.js.map +1 -0
- package/distribution/utils.js +1 -5
- package/distribution/utils.js.map +1 -1
- package/package.json +12 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler-provider.d.ts","sourceRoot":"","sources":["../../source/handlers/handler-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAMzE,qBACa,0BAA2B,YAAW,SAAS,CAAC,YAAY,CAAC,0BAA0B;;IAEnG,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAuC;IAG3E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAmC;IAGvE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAwC;
|
1
|
+
{"version":3,"file":"handler-provider.d.ts","sourceRoot":"","sources":["../../source/handlers/handler-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAMzE,qBACa,0BAA2B,YAAW,SAAS,CAAC,YAAY,CAAC,0BAA0B;;IAEnG,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAuC;IAG3E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAmC;IAGvE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAwC;IAKrE,sBAAsB,IAAI,OAAO;IAIjC,gBAAgB,IAAI,IAAI;CAkF/B"}
|
@@ -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);
|
@@ -19,17 +18,16 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
19
18
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
20
19
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
21
20
|
};
|
22
|
-
var _TransactionHandlerProvider_instances, _TransactionHandlerProvider_registered, _TransactionHandlerProvider_registerHandler, _TransactionHandlerProvider_hasOtherHandlerHandling, _TransactionHandlerProvider_hasOtherHandler;
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
const crypto_transaction_1 = require("@mainsail/crypto-transaction");
|
28
|
-
const kernel_1 = require("@mainsail/kernel");
|
21
|
+
var _TransactionHandlerProvider_instances, _TransactionHandlerProvider_registered, _TransactionHandlerProvider_handlerDependencyLookup, _TransactionHandlerProvider_registerHandler, _TransactionHandlerProvider_hasOtherHandlerHandling, _TransactionHandlerProvider_hasOtherHandler;
|
22
|
+
import { inject, injectable } from "@mainsail/container";
|
23
|
+
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";
|
24
|
+
import { InternalTransactionType } from "@mainsail/crypto-transaction";
|
25
|
+
import { Utils } from "@mainsail/kernel";
|
29
26
|
let TransactionHandlerProvider = class TransactionHandlerProvider {
|
30
27
|
constructor() {
|
31
28
|
_TransactionHandlerProvider_instances.add(this);
|
32
29
|
_TransactionHandlerProvider_registered.set(this, false);
|
30
|
+
_TransactionHandlerProvider_handlerDependencyLookup.set(this, new Set());
|
33
31
|
}
|
34
32
|
isRegistrationRequired() {
|
35
33
|
return __classPrivateFieldGet(this, _TransactionHandlerProvider_registered, "f") === false;
|
@@ -41,21 +39,22 @@ let TransactionHandlerProvider = class TransactionHandlerProvider {
|
|
41
39
|
__classPrivateFieldSet(this, _TransactionHandlerProvider_registered, true, "f");
|
42
40
|
}
|
43
41
|
};
|
44
|
-
exports.TransactionHandlerProvider = TransactionHandlerProvider;
|
45
42
|
_TransactionHandlerProvider_registered = new WeakMap();
|
43
|
+
_TransactionHandlerProvider_handlerDependencyLookup = new WeakMap();
|
46
44
|
_TransactionHandlerProvider_instances = new WeakSet();
|
47
45
|
_TransactionHandlerProvider_registerHandler = function _TransactionHandlerProvider_registerHandler(handlerConstructor) {
|
48
46
|
const handler = new handlerConstructor();
|
49
47
|
const transactionConstructor = handler.getConstructor();
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
__classPrivateFieldGet(this, _TransactionHandlerProvider_handlerDependencyLookup, "f").add(transactionConstructor);
|
49
|
+
Utils.assert.defined(transactionConstructor.type);
|
50
|
+
Utils.assert.defined(transactionConstructor.typeGroup);
|
51
|
+
const internalType = InternalTransactionType.from(transactionConstructor.type, transactionConstructor.typeGroup);
|
53
52
|
if (__classPrivateFieldGet(this, _TransactionHandlerProvider_instances, "m", _TransactionHandlerProvider_hasOtherHandlerHandling).call(this, handlerConstructor, internalType, transactionConstructor.version)) {
|
54
|
-
throw new
|
53
|
+
throw new Exceptions.AlreadyRegisteredError(internalType);
|
55
54
|
}
|
56
55
|
for (const dependency of handler.dependencies()) {
|
57
|
-
if (__classPrivateFieldGet(this, _TransactionHandlerProvider_instances, "m", _TransactionHandlerProvider_hasOtherHandler).call(this,
|
58
|
-
throw new
|
56
|
+
if (__classPrivateFieldGet(this, _TransactionHandlerProvider_instances, "m", _TransactionHandlerProvider_hasOtherHandler).call(this, dependency) === false) {
|
57
|
+
throw new Exceptions.UnsatisfiedDependencyError(internalType);
|
59
58
|
}
|
60
59
|
}
|
61
60
|
for (const attribute of handler.walletAttributes()) {
|
@@ -63,7 +62,7 @@ _TransactionHandlerProvider_registerHandler = function _TransactionHandlerProvid
|
|
63
62
|
this.attributeRepository.set(attribute.name, attribute.type);
|
64
63
|
}
|
65
64
|
}
|
66
|
-
if (transactionConstructor.typeGroup !==
|
65
|
+
if (transactionConstructor.typeGroup !== Contracts.Crypto.TransactionTypeGroup.Core) {
|
67
66
|
this.transactionRegistry.registerTransactionType(transactionConstructor);
|
68
67
|
}
|
69
68
|
};
|
@@ -74,32 +73,35 @@ _TransactionHandlerProvider_hasOtherHandlerHandling = function _TransactionHandl
|
|
74
73
|
}
|
75
74
|
const otherHandler = new otherHandlerConstructor();
|
76
75
|
const otherTransactionConstructor = otherHandler.getConstructor();
|
77
|
-
|
78
|
-
|
79
|
-
const otherInternalType =
|
76
|
+
Utils.assert.defined(otherTransactionConstructor.type);
|
77
|
+
Utils.assert.defined(otherTransactionConstructor.typeGroup);
|
78
|
+
const otherInternalType = InternalTransactionType.from(otherTransactionConstructor.type, otherTransactionConstructor.typeGroup);
|
80
79
|
if (otherInternalType === internalType && otherTransactionConstructor.version === version) {
|
81
80
|
return true;
|
82
81
|
}
|
83
82
|
}
|
84
83
|
return false;
|
85
84
|
};
|
86
|
-
_TransactionHandlerProvider_hasOtherHandler = function _TransactionHandlerProvider_hasOtherHandler(
|
87
|
-
|
88
|
-
|
85
|
+
_TransactionHandlerProvider_hasOtherHandler = function _TransactionHandlerProvider_hasOtherHandler(dependencyConstructor) {
|
86
|
+
const dependency = new dependencyConstructor().getConstructor();
|
87
|
+
return [...__classPrivateFieldGet(this, _TransactionHandlerProvider_handlerDependencyLookup, "f")].some((handler) => handler.type === dependency.type &&
|
88
|
+
handler.typeGroup === dependency.typeGroup &&
|
89
|
+
handler.version === dependency.version);
|
89
90
|
};
|
90
91
|
__decorate([
|
91
|
-
|
92
|
+
inject(Identifiers.State.Wallet.Attributes),
|
92
93
|
__metadata("design:type", Object)
|
93
94
|
], TransactionHandlerProvider.prototype, "attributeRepository", void 0);
|
94
95
|
__decorate([
|
95
|
-
|
96
|
+
inject(Identifiers.Transaction.Handler.Constructors),
|
96
97
|
__metadata("design:type", Array)
|
97
98
|
], TransactionHandlerProvider.prototype, "handlerConstructors", void 0);
|
98
99
|
__decorate([
|
99
|
-
|
100
|
+
inject(Identifiers.Cryptography.Transaction.Registry),
|
100
101
|
__metadata("design:type", Object)
|
101
102
|
], TransactionHandlerProvider.prototype, "transactionRegistry", void 0);
|
102
|
-
|
103
|
-
|
103
|
+
TransactionHandlerProvider = __decorate([
|
104
|
+
injectable()
|
104
105
|
], TransactionHandlerProvider);
|
106
|
+
export { TransactionHandlerProvider };
|
105
107
|
//# sourceMappingURL=handler-provider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler-provider.js","sourceRoot":"","sources":["../../source/handlers/handler-provider.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"handler-provider.js","sourceRoot":"","sources":["../../source/handlers/handler-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAA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,CACrC,CAAC;QAEF,IAAI,iBAAiB,KAAK,YAAY,IAAI,2BAA2B,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YAC3F,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC;mGAEgB,qBAAoD;IACpE,MAAM,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC,cAAc,EAAE,CAAC;IAEhE,OAAO,CAAC,GAAG,uBAAA,IAAI,2DAAyB,CAAC,CAAC,IAAI,CAC7C,CAAC,OAAO,EAAE,EAAE,CACX,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;QAChC,OAAO,CAAC,SAAS,KAAK,UAAU,CAAC,SAAS;QAC1C,OAAO,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,CACvC,CAAC;AACH,CAAC;AAhGgB;IADhB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;;uEAC+B;AAG1D;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;;uEACkB;AAGtD;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC;;uEACsB;AARhE,0BAA0B;IADtC,UAAU,EAAE;GACA,0BAA0B,CAmGtC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
2
|
-
import { TransactionHandler } from "./transaction";
|
2
|
+
import { TransactionHandler } from "./transaction.js";
|
3
3
|
export declare class TransactionHandlerRegistry implements Contracts.Transactions.TransactionHandlerRegistry {
|
4
4
|
private readonly provider;
|
5
5
|
private readonly handlers;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler-registry.d.ts","sourceRoot":"","sources":["../../source/handlers/handler-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAKzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"handler-registry.d.ts","sourceRoot":"","sources":["../../source/handlers/handler-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAKzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBACa,0BAA2B,YAAW,SAAS,CAAC,YAAY,CAAC,0BAA0B;IAEnG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IAGvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IAG1C,UAAU,IAAI,IAAI;IAMlB,qBAAqB,IAAI,kBAAkB,EAAE;IAI7C,0BAA0B,CAChC,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,uBAAuB,EAC5D,OAAO,SAAI,GACT,kBAAkB;IAiBR,oBAAoB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IASrD,yBAAyB,CACrC,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,uBAAuB,EAC5D,OAAO,SAAI,GACT,OAAO,CAAC,kBAAkB,CAAC;IAQjB,0BAA0B,CACtC,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,eAAe,GAC/C,OAAO,CAAC,kBAAkB,CAAC;CAI9B"}
|
@@ -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,13 +7,11 @@ 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
|
-
|
15
|
-
|
16
|
-
const kernel_1 = require("@mainsail/kernel");
|
17
|
-
const handler_provider_1 = require("./handler-provider");
|
10
|
+
import { inject, injectable, multiInject, postConstruct } from "@mainsail/container";
|
11
|
+
import { Exceptions, Identifiers } from "@mainsail/contracts";
|
12
|
+
import { InternalTransactionType } from "@mainsail/crypto-transaction";
|
13
|
+
import { Utils } from "@mainsail/kernel";
|
14
|
+
import { TransactionHandlerProvider } from "./handler-provider.js";
|
18
15
|
let TransactionHandlerRegistry = class TransactionHandlerRegistry {
|
19
16
|
initialize() {
|
20
17
|
if (this.provider.isRegistrationRequired()) {
|
@@ -27,14 +24,14 @@ let TransactionHandlerRegistry = class TransactionHandlerRegistry {
|
|
27
24
|
getRegisteredHandlerByType(internalType, version = 1) {
|
28
25
|
for (const handler of this.handlers) {
|
29
26
|
const transactionConstructor = handler.getConstructor();
|
30
|
-
|
31
|
-
|
32
|
-
const handlerInternalType =
|
27
|
+
Utils.assert.defined(transactionConstructor.type);
|
28
|
+
Utils.assert.defined(transactionConstructor.typeGroup);
|
29
|
+
const handlerInternalType = InternalTransactionType.from(transactionConstructor.type, transactionConstructor.typeGroup);
|
33
30
|
if (handlerInternalType === internalType && transactionConstructor.version === version) {
|
34
31
|
return handler;
|
35
32
|
}
|
36
33
|
}
|
37
|
-
throw new
|
34
|
+
throw new Exceptions.InvalidTransactionTypeError(internalType);
|
38
35
|
}
|
39
36
|
async getActivatedHandlers() {
|
40
37
|
const promises = this.handlers.map(async (handler) => [handler, await handler.isActivated()]);
|
@@ -47,29 +44,29 @@ let TransactionHandlerRegistry = class TransactionHandlerRegistry {
|
|
47
44
|
if (await handler.isActivated()) {
|
48
45
|
return handler;
|
49
46
|
}
|
50
|
-
throw new
|
47
|
+
throw new Exceptions.DeactivatedTransactionHandlerError(internalType);
|
51
48
|
}
|
52
49
|
async getActivatedHandlerForData(transactionData) {
|
53
|
-
const internalType =
|
50
|
+
const internalType = InternalTransactionType.from(transactionData.type, transactionData.typeGroup);
|
54
51
|
return this.getActivatedHandlerByType(internalType, transactionData.version);
|
55
52
|
}
|
56
53
|
};
|
57
|
-
exports.TransactionHandlerRegistry = TransactionHandlerRegistry;
|
58
54
|
__decorate([
|
59
|
-
|
60
|
-
__metadata("design:type",
|
55
|
+
inject(Identifiers.Transaction.Handler.Provider),
|
56
|
+
__metadata("design:type", TransactionHandlerProvider)
|
61
57
|
], TransactionHandlerRegistry.prototype, "provider", void 0);
|
62
58
|
__decorate([
|
63
|
-
|
59
|
+
multiInject(Identifiers.Transaction.Handler.Instances),
|
64
60
|
__metadata("design:type", Array)
|
65
61
|
], TransactionHandlerRegistry.prototype, "handlers", void 0);
|
66
62
|
__decorate([
|
67
|
-
|
63
|
+
postConstruct(),
|
68
64
|
__metadata("design:type", Function),
|
69
65
|
__metadata("design:paramtypes", []),
|
70
66
|
__metadata("design:returntype", void 0)
|
71
67
|
], TransactionHandlerRegistry.prototype, "initialize", null);
|
72
|
-
|
73
|
-
|
68
|
+
TransactionHandlerRegistry = __decorate([
|
69
|
+
injectable()
|
74
70
|
], TransactionHandlerRegistry);
|
71
|
+
export { TransactionHandlerRegistry };
|
75
72
|
//# sourceMappingURL=handler-registry.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler-registry.js","sourceRoot":"","sources":["../../source/handlers/handler-registry.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"handler-registry.js","sourceRoot":"","sources":["../../source/handlers/handler-registry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAa,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,0BAA0B,EAAE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AAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;QAChE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,yBAAyB,CACrC,YAA4D,EAC5D,OAAO,GAAG,CAAC;QAEX,MAAM,OAAO,GAAG,IAAI,CAAC,0BAA0B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACvE,IAAI,MAAM,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,UAAU,CAAC,kCAAkC,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,0BAA0B,CACtC,eAAiD;QAEjD,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;QACnG,OAAO,IAAI,CAAC,yBAAyB,CAAC,YAAY,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9E,CAAC;CACD,CAAA;AA9DiB;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;8BACrB,0BAA0B;4DAAC;AAGtC;IADhB,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;;4DACN;AAG1C;IADN,aAAa,EAAE;;;;4DAKf;AAZW,0BAA0B;IADtC,UAAU,EAAE;GACA,0BAA0B,CAgEtC"}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
export { TransactionHandlerProvider } from "./handler-provider";
|
2
|
-
export { TransactionHandlerRegistry as Registry } from "./handler-registry";
|
3
|
-
export {
|
1
|
+
export { TransactionHandlerProvider } from "./handler-provider.js";
|
2
|
+
export { TransactionHandlerRegistry as Registry } from "./handler-registry.js";
|
3
|
+
export type { TransactionHandlerConstructor } from "./transaction.js";
|
4
|
+
export { TransactionHandler } from "./transaction.js";
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,0BAA0B,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC/E,YAAY,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var handler_provider_1 = require("./handler-provider");
|
5
|
-
Object.defineProperty(exports, "TransactionHandlerProvider", { enumerable: true, get: function () { return handler_provider_1.TransactionHandlerProvider; } });
|
6
|
-
var handler_registry_1 = require("./handler-registry");
|
7
|
-
Object.defineProperty(exports, "Registry", { enumerable: true, get: function () { return handler_registry_1.TransactionHandlerRegistry; } });
|
8
|
-
var transaction_1 = require("./transaction");
|
9
|
-
Object.defineProperty(exports, "TransactionHandler", { enumerable: true, get: function () { return transaction_1.TransactionHandler; } });
|
1
|
+
export { TransactionHandlerProvider } from "./handler-provider.js";
|
2
|
+
export { TransactionHandlerRegistry as Registry } from "./handler-registry.js";
|
3
|
+
export { TransactionHandler } from "./transaction.js";
|
10
4
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,0BAA0B,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
@@ -5,22 +5,26 @@ export declare abstract class TransactionHandler implements Contracts.Transactio
|
|
5
5
|
protected readonly logger: Contracts.Kernel.Logger;
|
6
6
|
protected readonly configuration: Contracts.Crypto.Configuration;
|
7
7
|
protected readonly verifier: Contracts.Crypto.TransactionVerifier;
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
protected readonly gasLimits: Contracts.Evm.GasLimits;
|
9
|
+
protected readonly eventDispatcher: Contracts.Kernel.EventDispatcher;
|
10
|
+
verify({ walletRepository }: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<boolean>;
|
11
|
+
throwIfCannotBeApplied(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction, sender: Contracts.State.Wallet): Promise<void>;
|
12
|
+
apply(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Transactions.TransactionApplyResult>;
|
13
|
+
applyToSender(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Transactions.TransactionApplyResult>;
|
14
|
+
applyToRecipient(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Transactions.TransactionApplyResult>;
|
15
|
+
emitEvents(transaction: Contracts.Crypto.Transaction): void;
|
13
16
|
walletAttributes(): ReadonlyArray<{
|
14
17
|
name: string;
|
15
18
|
type: Contracts.State.AttributeType;
|
16
19
|
}>;
|
17
|
-
throwIfCannotEnterPool(
|
20
|
+
throwIfCannotEnterPool(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<void>;
|
18
21
|
verifySignatures(wallet: Contracts.State.Wallet, transaction: Contracts.Crypto.TransactionData, multiSignature?: Contracts.Crypto.MultiSignatureAsset): Promise<boolean>;
|
19
22
|
protected allTransactions(transactions: Contracts.Crypto.Transaction[]): Contracts.Crypto.TransactionData[];
|
23
|
+
protected verifyTransactionFee({ walletRepository }: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction, sender: Contracts.State.Wallet): void;
|
24
|
+
protected applyFeeToSender(transaction: Contracts.Crypto.Transaction, sender: Contracts.State.Wallet): void;
|
20
25
|
abstract getConstructor(): Contracts.Crypto.TransactionConstructor;
|
21
26
|
abstract dependencies(): ReadonlyArray<TransactionHandlerConstructor>;
|
22
27
|
abstract isActivated(): Promise<boolean>;
|
23
|
-
abstract applyToRecipient(walletRepository: Contracts.State.WalletRepository, transaction: Contracts.Crypto.Transaction): Promise<void>;
|
24
28
|
}
|
25
29
|
export type TransactionHandlerConstructor = new () => TransactionHandler;
|
26
30
|
//# sourceMappingURL=transaction.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../source/handlers/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../source/handlers/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA2B,MAAM,qBAAqB,CAAC;AAIzE,8BACsB,kBAAmB,YAAW,SAAS,CAAC,YAAY,CAAC,kBAAkB;;IAE5F,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;IAGpD,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAG,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;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AM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,aAAa,CAAA;KAAE,CAAC;IAIlF,sBAAsB,CAClC,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,yBAAyB,EACzD,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,GACvC,OAAO,CAAC,IAAI,CAAC;IAEH,gBAAgB,CAC5B,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,MAAM,EAC9B,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,eAAe,EAC7C,cAAc,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,mBAAmB,GACnD,OAAO,CAAC,OAAO,CAAC;IAYnB,SAAS,CAAC,eAAe,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE;IAS3G,SAAS,CAAC,oBAAoB,CAC7B,EAAE,gBAAgB,EAAE,EAAE,SAAS,CAAC,YAAY,CAAC,yBAAyB,EACtE,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EACzC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,MAAM,GAC5B,IAAI;IASP,SAAS,CAAC,gBAAgB,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI;aAO3F,cAAc,IAAI,SAAS,CAAC,MAAM,CAAC,sBAAsB;aAEzD,YAAY,IAAI,aAAa,CAAC,6BAA6B,CAAC;aAE5D,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAC/C;AAED,MAAM,MAAM,6BAA6B,GAAG,UAAU,kBAAkB,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);
|
@@ -14,86 +13,97 @@ 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 _TransactionHandler_instances, _TransactionHandler_verifyTransactionNonceApply;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const kernel_1 = require("@mainsail/kernel");
|
22
|
-
const utils_1 = require("@mainsail/utils");
|
23
|
-
// @TODO revisit the implementation, container usage and arguments after database rework
|
16
|
+
import { inject, injectable } from "@mainsail/container";
|
17
|
+
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";
|
18
|
+
import { Utils as AppUtils } from "@mainsail/kernel";
|
19
|
+
import { BigNumber } from "@mainsail/utils";
|
24
20
|
let TransactionHandler = class TransactionHandler {
|
25
21
|
constructor() {
|
26
22
|
_TransactionHandler_instances.add(this);
|
27
23
|
}
|
28
|
-
async verify(walletRepository, transaction) {
|
29
|
-
|
24
|
+
async verify({ walletRepository }, transaction) {
|
25
|
+
AppUtils.assert.defined(transaction.data.senderPublicKey);
|
30
26
|
const senderWallet = await walletRepository.findByPublicKey(transaction.data.senderPublicKey);
|
31
27
|
if (senderWallet.hasMultiSignature()) {
|
32
28
|
return this.verifySignatures(senderWallet, transaction.data);
|
33
29
|
}
|
34
30
|
return this.verifier.verifyHash(transaction.data);
|
35
31
|
}
|
36
|
-
async throwIfCannotBeApplied(
|
32
|
+
async throwIfCannotBeApplied(context, transaction, sender) {
|
33
|
+
const { walletRepository } = context;
|
37
34
|
const senderWallet = walletRepository.findByAddress(sender.getAddress());
|
38
|
-
|
35
|
+
AppUtils.assert.defined(sender.getPublicKey());
|
39
36
|
if (!walletRepository.hasByPublicKey(sender.getPublicKey()) && senderWallet.getBalance().isZero()) {
|
40
|
-
throw new
|
37
|
+
throw new Exceptions.ColdWalletError();
|
41
38
|
}
|
42
39
|
// @TODO: enforce fees here to support dynamic cases
|
43
40
|
__classPrivateFieldGet(this, _TransactionHandler_instances, "m", _TransactionHandler_verifyTransactionNonceApply).call(this, sender, transaction);
|
41
|
+
this.verifyTransactionFee(context, transaction, sender);
|
44
42
|
if (sender.getBalance().minus(transaction.data.amount).minus(transaction.data.fee).isNegative() &&
|
45
43
|
this.configuration.getHeight() > 0) {
|
46
|
-
throw new
|
44
|
+
throw new Exceptions.InsufficientBalanceError();
|
47
45
|
}
|
48
46
|
if (transaction.data.senderPublicKey !== sender.getPublicKey()) {
|
49
|
-
throw new
|
47
|
+
throw new Exceptions.SenderWalletMismatchError();
|
50
48
|
}
|
51
49
|
// Prevent legacy multi signatures from being used
|
52
|
-
const isMultiSignatureRegistration = transaction.type ===
|
53
|
-
transaction.typeGroup ===
|
50
|
+
const isMultiSignatureRegistration = transaction.type === Contracts.Crypto.TransactionType.MultiSignature &&
|
51
|
+
transaction.typeGroup === Contracts.Crypto.TransactionTypeGroup.Core;
|
54
52
|
if (sender.hasMultiSignature()) {
|
55
|
-
|
53
|
+
AppUtils.assert.defined(transaction.data.senderPublicKey);
|
56
54
|
// Ensure the database wallet already has a multi signature, in case we checked a pool wallet.
|
57
55
|
const databaseSender = await walletRepository.findByPublicKey(transaction.data.senderPublicKey);
|
58
56
|
if (!databaseSender.hasMultiSignature()) {
|
59
|
-
throw new
|
57
|
+
throw new Exceptions.MissingMultiSignatureOnSenderError();
|
60
58
|
}
|
61
59
|
if (databaseSender.hasAttribute("multiSignature.legacy")) {
|
62
|
-
throw new
|
60
|
+
throw new Exceptions.LegacyMultiSignatureError();
|
63
61
|
}
|
64
|
-
if (!this.verifySignatures(databaseSender, transaction.data, databaseSender.getAttribute("multiSignature"))) {
|
65
|
-
throw new
|
62
|
+
if (!(await this.verifySignatures(databaseSender, transaction.data, databaseSender.getAttribute("multiSignature")))) {
|
63
|
+
throw new Exceptions.InvalidMultiSignaturesError();
|
66
64
|
}
|
67
65
|
}
|
68
66
|
else if (transaction.data.signatures && !isMultiSignatureRegistration) {
|
69
|
-
throw new
|
67
|
+
throw new Exceptions.UnsupportedMultiSignatureRegistrationTransactionError();
|
70
68
|
}
|
71
69
|
}
|
72
|
-
async apply(
|
73
|
-
await this.applyToSender(
|
74
|
-
await this.applyToRecipient(
|
70
|
+
async apply(context, transaction) {
|
71
|
+
const senderResult = await this.applyToSender(context, transaction);
|
72
|
+
const recipientResult = await this.applyToRecipient(context, transaction);
|
73
|
+
// Merge results; effectively only one is ever set depending on the transaction type.
|
74
|
+
return {
|
75
|
+
gasUsed: senderResult.gasUsed + recipientResult.gasUsed,
|
76
|
+
receipt: recipientResult.receipt,
|
77
|
+
};
|
75
78
|
}
|
76
|
-
async applyToSender(
|
77
|
-
|
78
|
-
const sender = await walletRepository.findByPublicKey(transaction.data.senderPublicKey);
|
79
|
+
async applyToSender(context, transaction) {
|
80
|
+
AppUtils.assert.defined(transaction.data.senderPublicKey);
|
81
|
+
const sender = await context.walletRepository.findByPublicKey(transaction.data.senderPublicKey);
|
79
82
|
const data = transaction.data;
|
80
|
-
await this.throwIfCannotBeApplied(
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
await this.throwIfCannotBeApplied(context, transaction, sender);
|
84
|
+
__classPrivateFieldGet(this, _TransactionHandler_instances, "m", _TransactionHandler_verifyTransactionNonceApply).call(this, sender, transaction);
|
85
|
+
AppUtils.assert.defined(data.nonce);
|
86
|
+
sender.setNonce(data.nonce);
|
87
|
+
// Subtract fee
|
88
|
+
this.applyFeeToSender(transaction, sender);
|
89
|
+
// Native gas usage
|
90
|
+
let gasUsed = 0;
|
91
|
+
const isEvmCall = transaction.type === Contracts.Crypto.TransactionType.EvmCall &&
|
92
|
+
transaction.typeGroup === Contracts.Crypto.TransactionTypeGroup.Core;
|
93
|
+
if (!isEvmCall) {
|
94
|
+
// TODO: calculate accurate amount (follow-up)
|
95
|
+
gasUsed = this.gasLimits.of(transaction);
|
88
96
|
}
|
89
|
-
|
90
|
-
|
97
|
+
return { gasUsed };
|
98
|
+
}
|
99
|
+
async applyToRecipient(context, transaction) {
|
100
|
+
return { gasUsed: 0 };
|
91
101
|
}
|
92
|
-
emitEvents(transaction
|
102
|
+
emitEvents(transaction) { }
|
93
103
|
walletAttributes() {
|
94
104
|
return [];
|
95
105
|
}
|
96
|
-
async throwIfCannotEnterPool(
|
106
|
+
async throwIfCannotEnterPool(context, transaction) { }
|
97
107
|
async verifySignatures(wallet, transaction, multiSignature) {
|
98
108
|
return this.verifier.verifySignatures(transaction, multiSignature || wallet.getAttribute("multiSignature"));
|
99
109
|
}
|
@@ -102,32 +112,51 @@ let TransactionHandler = class TransactionHandler {
|
|
102
112
|
.filter(({ data }) => data.type === this.getConstructor().type && data.typeGroup === this.getConstructor().typeGroup)
|
103
113
|
.map(({ data }) => data);
|
104
114
|
}
|
115
|
+
verifyTransactionFee({ walletRepository }, transaction, sender) {
|
116
|
+
if (sender.getBalance().minus(transaction.data.amount).minus(transaction.data.fee).isNegative() &&
|
117
|
+
this.configuration.getHeight() > 0) {
|
118
|
+
throw new Exceptions.InsufficientBalanceError();
|
119
|
+
}
|
120
|
+
}
|
121
|
+
applyFeeToSender(transaction, sender) {
|
122
|
+
const data = transaction.data;
|
123
|
+
const newBalance = sender.getBalance().minus(data.fee);
|
124
|
+
sender.setBalance(newBalance);
|
125
|
+
}
|
105
126
|
};
|
106
|
-
exports.TransactionHandler = TransactionHandler;
|
107
127
|
_TransactionHandler_instances = new WeakSet();
|
108
128
|
_TransactionHandler_verifyTransactionNonceApply = function _TransactionHandler_verifyTransactionNonceApply(wallet, transaction) {
|
109
|
-
const nonce = transaction.data.nonce ||
|
129
|
+
const nonce = transaction.data.nonce || BigNumber.ZERO;
|
110
130
|
if (!wallet.getNonce().plus(1).isEqualTo(nonce)) {
|
111
|
-
throw new
|
131
|
+
throw new Exceptions.UnexpectedNonceError(nonce, wallet, false);
|
112
132
|
}
|
113
133
|
};
|
114
134
|
__decorate([
|
115
|
-
|
135
|
+
inject(Identifiers.Application.Instance),
|
116
136
|
__metadata("design:type", Object)
|
117
137
|
], TransactionHandler.prototype, "app", void 0);
|
118
138
|
__decorate([
|
119
|
-
|
139
|
+
inject(Identifiers.Services.Log.Service),
|
120
140
|
__metadata("design:type", Object)
|
121
141
|
], TransactionHandler.prototype, "logger", void 0);
|
122
142
|
__decorate([
|
123
|
-
|
143
|
+
inject(Identifiers.Cryptography.Configuration),
|
124
144
|
__metadata("design:type", Object)
|
125
145
|
], TransactionHandler.prototype, "configuration", void 0);
|
126
146
|
__decorate([
|
127
|
-
|
147
|
+
inject(Identifiers.Cryptography.Transaction.Verifier),
|
128
148
|
__metadata("design:type", Object)
|
129
149
|
], TransactionHandler.prototype, "verifier", void 0);
|
130
|
-
|
131
|
-
(
|
150
|
+
__decorate([
|
151
|
+
inject(Identifiers.Evm.Gas.Limits),
|
152
|
+
__metadata("design:type", Object)
|
153
|
+
], TransactionHandler.prototype, "gasLimits", void 0);
|
154
|
+
__decorate([
|
155
|
+
inject(Identifiers.Services.EventDispatcher.Service),
|
156
|
+
__metadata("design:type", Object)
|
157
|
+
], TransactionHandler.prototype, "eventDispatcher", void 0);
|
158
|
+
TransactionHandler = __decorate([
|
159
|
+
injectable()
|
132
160
|
], TransactionHandler);
|
161
|
+
export { TransactionHandler };
|
133
162
|
//# sourceMappingURL=transaction.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../source/handlers/transaction.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../source/handlers/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAA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,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;;kDACW;AAGjC;IADlB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;yDACmB;AAG/C;IADlB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC;;oDACa;AAGhD;IADlB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;;qDACoB;AAGpC;IADlB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC;;2DACiB;AAjBjD,kBAAkB;IADvC,UAAU,EAAE;GACS,kBAAkB,CA2NvC"}
|
package/distribution/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export * as Handlers from "./handlers";
|
2
|
-
export * from "./service-provider";
|
3
|
-
export * as Utils from "./utils";
|
1
|
+
export * as Handlers from "./handlers/index.js";
|
2
|
+
export * from "./service-provider.js";
|
3
|
+
export * as Utils from "./utils.js";
|
4
4
|
export * as Errors from "@mainsail/contracts";
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC"}
|
package/distribution/index.js
CHANGED
@@ -1,34 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.Errors = exports.Utils = exports.Handlers = void 0;
|
30
|
-
exports.Handlers = __importStar(require("./handlers"));
|
31
|
-
__exportStar(require("./service-provider"), exports);
|
32
|
-
exports.Utils = __importStar(require("./utils"));
|
33
|
-
exports.Errors = __importStar(require("@mainsail/contracts"));
|
1
|
+
export * as Handlers from "./handlers/index.js";
|
2
|
+
export * from "./service-provider.js";
|
3
|
+
export * as Utils from "./utils.js";
|
4
|
+
export * as Errors from "@mainsail/contracts";
|
34
5
|
//# 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,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { interfaces } from "@mainsail/container";
|
2
2
|
import { Providers } from "@mainsail/kernel";
|
3
|
-
import { TransactionHandlerConstructor } from "./handlers";
|
3
|
+
import { TransactionHandlerConstructor } from "./handlers/index.js";
|
4
4
|
export declare class ServiceProvider extends Providers.ServiceProvider {
|
5
5
|
static getTransactionHandlerConstructorsBinding(): (context: interfaces.Context) => TransactionHandlerConstructor[];
|
6
6
|
register(): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,6BAA6B,EAA8B,MAAM,qBAAqB,CAAC;AAGhG,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;WAC/C,wCAAwC,IAAI,CACzD,OAAO,EAAE,UAAU,CAAC,OAAO,KACvB,6BAA6B,EAAE;IAuBvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAezB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;CAGzC"}
|
@@ -1,18 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const handler_registry_1 = require("./handlers/handler-registry");
|
8
|
-
class ServiceProvider extends kernel_1.Providers.ServiceProvider {
|
1
|
+
import { Identifiers } from "@mainsail/contracts";
|
2
|
+
import { Providers } from "@mainsail/kernel";
|
3
|
+
import { TransactionHandlerRegistry } from "./handlers/handler-registry.js";
|
4
|
+
import { TransactionHandlerProvider } from "./handlers/index.js";
|
5
|
+
import { TransactionValidator } from "./transaction-validator.js";
|
6
|
+
export class ServiceProvider extends Providers.ServiceProvider {
|
9
7
|
static getTransactionHandlerConstructorsBinding() {
|
10
8
|
return (context) => {
|
11
9
|
const handlerConstructors = [];
|
12
10
|
let container = context.container;
|
13
11
|
do {
|
14
12
|
const bindingDictionary = container["_bindingDictionary"];
|
15
|
-
const handlerBindings = bindingDictionary.getMap().get(
|
13
|
+
const handlerBindings = bindingDictionary.getMap().get(Identifiers.Transaction.Handler.Instances) ?? [];
|
16
14
|
for (const handlerBinding of handlerBindings) {
|
17
15
|
if (handlerBinding.implementationType) {
|
18
16
|
handlerConstructors.push(handlerBinding.implementationType);
|
@@ -24,15 +22,18 @@ class ServiceProvider extends kernel_1.Providers.ServiceProvider {
|
|
24
22
|
};
|
25
23
|
}
|
26
24
|
async register() {
|
27
|
-
this.app.bind(
|
25
|
+
this.app.bind(Identifiers.Transaction.Handler.Provider).to(TransactionHandlerProvider).inSingletonScope();
|
28
26
|
this.app
|
29
|
-
.bind(
|
27
|
+
.bind(Identifiers.Transaction.Handler.Constructors)
|
30
28
|
.toDynamicValue(ServiceProvider.getTransactionHandlerConstructorsBinding());
|
31
|
-
this.app.bind(
|
29
|
+
this.app.bind(Identifiers.Transaction.Handler.Registry).to(TransactionHandlerRegistry);
|
30
|
+
this.app.bind(Identifiers.Transaction.Validator.Instance).to(TransactionValidator);
|
31
|
+
this.app
|
32
|
+
.bind(Identifiers.Transaction.Validator.Factory)
|
33
|
+
.toAutoFactory(Identifiers.Transaction.Validator.Instance);
|
32
34
|
}
|
33
35
|
async required() {
|
34
36
|
return true;
|
35
37
|
}
|
36
38
|
}
|
37
|
-
exports.ServiceProvider = ServiceProvider;
|
38
39
|
//# sourceMappingURL=service-provider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAiC,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,OAAO,eAAgB,SAAQ,SAAS,CAAC,eAAe;IACtD,MAAM,CAAC,wCAAwC;QAGrD,OAAO,CAAC,OAA2B,EAAE,EAAE;YAEtC,MAAM,mBAAmB,GAAoC,EAAE,CAAC;YAChE,IAAI,SAAS,GAAgC,OAAO,CAAC,SAAS,CAAC;YAE/D,GAAG,CAAC;gBACH,MAAM,iBAAiB,GAAG,SAAS,CAAC,oBAAoB,CAAsB,CAAC;gBAC/E,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;gBAExG,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;oBAC9C,IAAI,cAAc,CAAC,kBAAkB,EAAE,CAAC;wBACvC,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,kBAAmD,CAAC,CAAC;oBAC9F,CAAC;gBACF,CAAC;gBAED,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;YAC9B,CAAC,QAAQ,SAAS,EAAE;YAEpB,OAAO,mBAAmB,CAAC;QAC5B,CAAC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAE1G,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;aAClD,cAAc,CAAC,eAAe,CAAC,wCAAwC,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC;QAEvF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC;QACnF,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC;aAC/C,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,QAAQ;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Contracts } from "@mainsail/contracts";
|
2
|
+
export declare class TransactionValidator implements Contracts.Transactions.TransactionValidator {
|
3
|
+
#private;
|
4
|
+
private readonly evm;
|
5
|
+
private readonly handlerRegistry;
|
6
|
+
private readonly stateService;
|
7
|
+
private readonly transactionFactory;
|
8
|
+
initialize(): void;
|
9
|
+
getEvm(): Contracts.Evm.Instance;
|
10
|
+
validate(context: Contracts.Transactions.TransactionValidatorContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Transactions.TransactionValidatorResult>;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=transaction-validator.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"transaction-validator.d.ts","sourceRoot":"","sources":["../source/transaction-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAI7D,qBACa,oBAAqB,YAAW,SAAS,CAAC,YAAY,CAAC,oBAAoB;;IAGvF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAG9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqD;IAGrF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IAGxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuC;IAKnE,UAAU,IAAI,IAAI;IAIlB,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ;IAI1B,QAAQ,CACpB,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,2BAA2B,EAC3D,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,GACvC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,0BAA0B,CAAC;CA4C7D"}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
15
|
+
};
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
20
|
+
};
|
21
|
+
var _TransactionValidator_instances, _TransactionValidator_walletRepository, _TransactionValidator_updateEvmAccountInfoHost;
|
22
|
+
import { inject, injectable, postConstruct, tagged } from "@mainsail/container";
|
23
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
24
|
+
import { Utils as AppUtils } from "@mainsail/kernel";
|
25
|
+
import { strictEqual } from "assert";
|
26
|
+
let TransactionValidator = class TransactionValidator {
|
27
|
+
constructor() {
|
28
|
+
_TransactionValidator_instances.add(this);
|
29
|
+
_TransactionValidator_walletRepository.set(this, void 0);
|
30
|
+
}
|
31
|
+
initialize() {
|
32
|
+
__classPrivateFieldSet(this, _TransactionValidator_walletRepository, this.stateService.createStoreClone().walletRepository, "f");
|
33
|
+
}
|
34
|
+
getEvm() {
|
35
|
+
return this.evm;
|
36
|
+
}
|
37
|
+
async validate(context, transaction) {
|
38
|
+
const deserialized = await this.transactionFactory.fromBytes(transaction.serialized);
|
39
|
+
strictEqual(transaction.id, deserialized.id);
|
40
|
+
const { commitKey, gasLimit, timestamp, generatorPublicKey } = context;
|
41
|
+
const handler = await this.handlerRegistry.getActivatedHandlerForData(transaction.data);
|
42
|
+
const result = await handler.apply({
|
43
|
+
evm: {
|
44
|
+
blockContext: {
|
45
|
+
commitKey,
|
46
|
+
gasLimit: BigInt(gasLimit),
|
47
|
+
timestamp: BigInt(timestamp),
|
48
|
+
validatorAddress: (await __classPrivateFieldGet(this, _TransactionValidator_walletRepository, "f").findByPublicKey(generatorPublicKey)).getAddress(),
|
49
|
+
},
|
50
|
+
instance: this.evm,
|
51
|
+
},
|
52
|
+
walletRepository: __classPrivateFieldGet(this, _TransactionValidator_walletRepository, "f"),
|
53
|
+
}, transaction);
|
54
|
+
AppUtils.assert.defined(transaction.data.senderPublicKey);
|
55
|
+
await __classPrivateFieldGet(this, _TransactionValidator_instances, "m", _TransactionValidator_updateEvmAccountInfoHost).call(this, commitKey, await __classPrivateFieldGet(this, _TransactionValidator_walletRepository, "f").findByPublicKey(transaction.data.senderPublicKey));
|
56
|
+
return { gasUsed: result.gasUsed };
|
57
|
+
}
|
58
|
+
};
|
59
|
+
_TransactionValidator_walletRepository = new WeakMap();
|
60
|
+
_TransactionValidator_instances = new WeakSet();
|
61
|
+
_TransactionValidator_updateEvmAccountInfoHost = async function _TransactionValidator_updateEvmAccountInfoHost(commitKey, sender) {
|
62
|
+
await this.evm.updateAccountInfo({
|
63
|
+
account: sender.getAddress(),
|
64
|
+
commitKey,
|
65
|
+
nonce: sender.getNonce().toBigInt(),
|
66
|
+
});
|
67
|
+
};
|
68
|
+
__decorate([
|
69
|
+
inject(Identifiers.Evm.Instance),
|
70
|
+
tagged("instance", "ephemeral"),
|
71
|
+
__metadata("design:type", Object)
|
72
|
+
], TransactionValidator.prototype, "evm", void 0);
|
73
|
+
__decorate([
|
74
|
+
inject(Identifiers.Transaction.Handler.Registry),
|
75
|
+
__metadata("design:type", Object)
|
76
|
+
], TransactionValidator.prototype, "handlerRegistry", void 0);
|
77
|
+
__decorate([
|
78
|
+
inject(Identifiers.State.Service),
|
79
|
+
__metadata("design:type", Object)
|
80
|
+
], TransactionValidator.prototype, "stateService", void 0);
|
81
|
+
__decorate([
|
82
|
+
inject(Identifiers.Cryptography.Transaction.Factory),
|
83
|
+
__metadata("design:type", Object)
|
84
|
+
], TransactionValidator.prototype, "transactionFactory", void 0);
|
85
|
+
__decorate([
|
86
|
+
postConstruct(),
|
87
|
+
__metadata("design:type", Function),
|
88
|
+
__metadata("design:paramtypes", []),
|
89
|
+
__metadata("design:returntype", void 0)
|
90
|
+
], TransactionValidator.prototype, "initialize", null);
|
91
|
+
TransactionValidator = __decorate([
|
92
|
+
injectable()
|
93
|
+
], TransactionValidator);
|
94
|
+
export { TransactionValidator };
|
95
|
+
//# sourceMappingURL=transaction-validator.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../source/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG9B,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;;QAcN,yDAAqD;IA0DtD,CAAC;IAvDO,UAAU;QAChB,uBAAA,IAAI,0CAAqB,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC,gBAAgB,MAAA,CAAC;IAChF,CAAC;IAEM,MAAM;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,QAAQ,CACpB,OAA2D,EAC3D,WAAyC;QAEzC,MAAM,YAAY,GAAiC,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CACzF,WAAW,CAAC,UAAU,CACtB,CAAC;QACF,WAAW,CAAC,WAAW,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;QAE7C,MAAM,EAAE,SAA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CAAC,UAAU,EAAE,WAAW,CAAC;;iDACc;AAG7B;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;6DACoC;AAGpE;IADhB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC;;0DACsB;AAGvC;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;;gEACqB;AAKnE;IADN,aAAa,EAAE;;;;sDAGf;AAnBW,oBAAoB;IADhC,UAAU,EAAE;GACA,oBAAoB,CAwEhC"}
|
package/distribution/utils.js
CHANGED
@@ -1,6 +1,2 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isRecipientOnActiveNetwork = void 0;
|
4
|
-
const isRecipientOnActiveNetwork = (recipientId, base58, configuration) => base58.decodeCheck(recipientId).readUInt8(0) === configuration.get("network.pubKeyHash");
|
5
|
-
exports.isRecipientOnActiveNetwork = isRecipientOnActiveNetwork;
|
1
|
+
export const isRecipientOnActiveNetwork = (recipientId, base58, configuration) => base58.decodeCheck(recipientId).readUInt8(0) === configuration.get("network.pubKeyHash");
|
6
2
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../source/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../source/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACzC,WAAmB,EACnB,MAAM,EACN,aAA6C,EACnC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mainsail/transactions",
|
3
|
-
"version": "0.0.1-
|
3
|
+
"version": "0.0.1-evm.1",
|
4
4
|
"description": "Transaction Services for 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": [
|
10
11
|
"/distribution"
|
11
12
|
],
|
12
13
|
"dependencies": {
|
13
|
-
"@mainsail/container": "0.0.1-
|
14
|
-
"@mainsail/
|
15
|
-
"@mainsail/
|
16
|
-
"@mainsail/kernel": "0.0.1-
|
17
|
-
"@mainsail/utils": "0.0.1-
|
14
|
+
"@mainsail/container": "0.0.1-evm.1",
|
15
|
+
"@mainsail/crypto-transaction": "0.0.1-evm.1",
|
16
|
+
"@mainsail/contracts": "0.0.1-evm.1",
|
17
|
+
"@mainsail/kernel": "0.0.1-evm.1",
|
18
|
+
"@mainsail/utils": "0.0.1-evm.1"
|
18
19
|
},
|
19
20
|
"devDependencies": {
|
20
21
|
"dayjs": "1.11.10",
|
21
|
-
"uvu": "^0.5.6"
|
22
|
+
"uvu": "^0.5.6",
|
23
|
+
"@mainsail/crypto-config": "0.0.1-evm.1"
|
22
24
|
},
|
23
25
|
"engines": {
|
24
26
|
"node": ">=20.x"
|
@@ -28,9 +30,10 @@
|
|
28
30
|
"build:watch": "pnpm run clean && tsc -w",
|
29
31
|
"clean": "del distribution",
|
30
32
|
"release": "pnpm publish --access public",
|
31
|
-
"test": "
|
33
|
+
"test": "pnpm run uvu source .test.ts",
|
32
34
|
"test:coverage": "c8 pnpm run test",
|
33
35
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
34
|
-
"test:file": "
|
36
|
+
"test:file": "pnpm run uvu source",
|
37
|
+
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|
35
38
|
}
|
36
39
|
}
|