@mainsail/transactions 0.0.1-evm.2 → 0.0.1-evm.21
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-registry.d.ts +2 -4
- package/distribution/handlers/handler-registry.d.ts.map +1 -1
- package/distribution/handlers/handler-registry.js +8 -33
- package/distribution/handlers/handler-registry.js.map +1 -1
- package/distribution/handlers/index.d.ts +0 -1
- package/distribution/handlers/index.d.ts.map +1 -1
- package/distribution/handlers/index.js +0 -1
- package/distribution/handlers/index.js.map +1 -1
- package/distribution/handlers/transaction.d.ts +5 -16
- package/distribution/handlers/transaction.d.ts.map +1 -1
- package/distribution/handlers/transaction.js +29 -112
- package/distribution/handlers/transaction.js.map +1 -1
- package/distribution/index.d.ts +0 -1
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +0 -1
- package/distribution/index.js.map +1 -1
- package/distribution/service-provider.d.ts +0 -3
- package/distribution/service-provider.d.ts.map +1 -1
- package/distribution/service-provider.js +14 -25
- package/distribution/service-provider.js.map +1 -1
- package/distribution/transaction-validator.d.ts +1 -4
- package/distribution/transaction-validator.d.ts.map +1 -1
- package/distribution/transaction-validator.js +9 -49
- package/distribution/transaction-validator.js.map +1 -1
- package/package.json +7 -10
- package/distribution/handlers/handler-provider.d.ts +0 -10
- package/distribution/handlers/handler-provider.d.ts.map +0 -1
- package/distribution/handlers/handler-provider.js +0 -107
- package/distribution/handlers/handler-provider.js.map +0 -1
- package/distribution/utils.d.ts +0 -3
- package/distribution/utils.d.ts.map +0 -1
- package/distribution/utils.js +0 -2
- package/distribution/utils.js.map +0 -1
@@ -1,13 +1,11 @@
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
2
2
|
import { TransactionHandler } from "./transaction.js";
|
3
3
|
export declare class TransactionHandlerRegistry implements Contracts.Transactions.TransactionHandlerRegistry {
|
4
|
-
private readonly provider;
|
5
4
|
private readonly handlers;
|
6
|
-
initialize(): void;
|
7
5
|
getRegisteredHandlers(): TransactionHandler[];
|
8
|
-
getRegisteredHandlerByType(internalType:
|
6
|
+
getRegisteredHandlerByType(internalType: number, version?: number): TransactionHandler;
|
9
7
|
getActivatedHandlers(): Promise<TransactionHandler[]>;
|
10
|
-
getActivatedHandlerByType(internalType:
|
8
|
+
getActivatedHandlerByType(internalType: number, version?: number): Promise<TransactionHandler>;
|
11
9
|
getActivatedHandlerForData(transactionData: Contracts.Crypto.TransactionData): Promise<TransactionHandler>;
|
12
10
|
}
|
13
11
|
//# sourceMappingURL=handler-registry.d.ts.map
|
@@ -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;
|
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;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBACa,0BAA2B,YAAW,SAAS,CAAC,YAAY,CAAC,0BAA0B;IAEnG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IAE1C,qBAAqB,IAAI,kBAAkB,EAAE;IAI7C,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,kBAAkB;IAM3E,oBAAoB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IASrD,yBAAyB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQzF,0BAA0B,CACtC,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,eAAe,GAC/C,OAAO,CAAC,kBAAkB,CAAC;CAG9B"}
|
@@ -7,31 +7,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
9
|
};
|
10
|
-
import {
|
10
|
+
import { injectable, multiInject } from "@mainsail/container";
|
11
11
|
import { Exceptions, Identifiers } from "@mainsail/contracts";
|
12
|
-
import {
|
13
|
-
import { Utils } from "@mainsail/kernel";
|
14
|
-
import { TransactionHandlerProvider } from "./handler-provider.js";
|
12
|
+
import { assert } from "@mainsail/utils";
|
15
13
|
let TransactionHandlerRegistry = class TransactionHandlerRegistry {
|
16
|
-
initialize() {
|
17
|
-
if (this.provider.isRegistrationRequired()) {
|
18
|
-
this.provider.registerHandlers();
|
19
|
-
}
|
20
|
-
}
|
21
14
|
getRegisteredHandlers() {
|
22
15
|
return this.handlers;
|
23
16
|
}
|
24
|
-
getRegisteredHandlerByType(internalType, version =
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Utils.assert.defined(transactionConstructor.typeGroup);
|
29
|
-
const handlerInternalType = InternalTransactionType.from(transactionConstructor.type, transactionConstructor.typeGroup);
|
30
|
-
if (handlerInternalType === internalType && transactionConstructor.version === version) {
|
31
|
-
return handler;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
throw new Exceptions.InvalidTransactionTypeError(internalType);
|
17
|
+
getRegisteredHandlerByType(internalType, version = 0) {
|
18
|
+
const [handler] = this.handlers;
|
19
|
+
assert.defined(handler);
|
20
|
+
return handler;
|
35
21
|
}
|
36
22
|
async getActivatedHandlers() {
|
37
23
|
const promises = this.handlers.map(async (handler) => [handler, await handler.isActivated()]);
|
@@ -39,7 +25,7 @@ let TransactionHandlerRegistry = class TransactionHandlerRegistry {
|
|
39
25
|
const activated = results.filter(([_, activated]) => activated);
|
40
26
|
return activated.map(([handler, _]) => handler);
|
41
27
|
}
|
42
|
-
async getActivatedHandlerByType(internalType, version =
|
28
|
+
async getActivatedHandlerByType(internalType, version = 0) {
|
43
29
|
const handler = this.getRegisteredHandlerByType(internalType, version);
|
44
30
|
if (await handler.isActivated()) {
|
45
31
|
return handler;
|
@@ -47,24 +33,13 @@ let TransactionHandlerRegistry = class TransactionHandlerRegistry {
|
|
47
33
|
throw new Exceptions.DeactivatedTransactionHandlerError(internalType);
|
48
34
|
}
|
49
35
|
async getActivatedHandlerForData(transactionData) {
|
50
|
-
|
51
|
-
return this.getActivatedHandlerByType(internalType, transactionData.version);
|
36
|
+
return this.getActivatedHandlerByType(0, 0);
|
52
37
|
}
|
53
38
|
};
|
54
|
-
__decorate([
|
55
|
-
inject(Identifiers.Transaction.Handler.Provider),
|
56
|
-
__metadata("design:type", TransactionHandlerProvider)
|
57
|
-
], TransactionHandlerRegistry.prototype, "provider", void 0);
|
58
39
|
__decorate([
|
59
40
|
multiInject(Identifiers.Transaction.Handler.Instances),
|
60
41
|
__metadata("design:type", Array)
|
61
42
|
], TransactionHandlerRegistry.prototype, "handlers", void 0);
|
62
|
-
__decorate([
|
63
|
-
postConstruct(),
|
64
|
-
__metadata("design:type", Function),
|
65
|
-
__metadata("design:paramtypes", []),
|
66
|
-
__metadata("design:returntype", void 0)
|
67
|
-
], TransactionHandlerRegistry.prototype, "initialize", null);
|
68
43
|
TransactionHandlerRegistry = __decorate([
|
69
44
|
injectable()
|
70
45
|
], TransactionHandlerRegistry);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler-registry.js","sourceRoot":"","sources":["../../source/handlers/handler-registry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"handler-registry.js","sourceRoot":"","sources":["../../source/handlers/handler-registry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAa,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKlC,IAAM,0BAA0B,G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AAlCiB;IADhB,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;;4DACN;AAFrC,0BAA0B;IADtC,UAAU,EAAE;GACA,0BAA0B,CAoCtC"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
export { TransactionHandlerProvider } from "./handler-provider.js";
|
2
1
|
export { TransactionHandlerRegistry as Registry } from "./handler-registry.js";
|
3
2
|
export type { TransactionHandlerConstructor } from "./transaction.js";
|
4
3
|
export { TransactionHandler } from "./transaction.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,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 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
@@ -1,27 +1,16 @@
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
2
2
|
export declare abstract class TransactionHandler implements Contracts.Transactions.TransactionHandler {
|
3
|
-
#private;
|
4
3
|
protected readonly app: Contracts.Kernel.Application;
|
5
4
|
protected readonly logger: Contracts.Kernel.Logger;
|
6
5
|
protected readonly configuration: Contracts.Crypto.Configuration;
|
7
6
|
protected readonly verifier: Contracts.Crypto.TransactionVerifier;
|
8
|
-
protected readonly
|
7
|
+
protected readonly feeCalculator: Contracts.BlockchainUtils.FeeCalculator;
|
9
8
|
protected readonly eventDispatcher: Contracts.Kernel.EventDispatcher;
|
10
|
-
verify(
|
11
|
-
throwIfCannotBeApplied(
|
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>;
|
9
|
+
verify(transaction: Contracts.Crypto.Transaction): Promise<boolean>;
|
10
|
+
throwIfCannotBeApplied(transaction: Contracts.Crypto.Transaction, sender: Contracts.State.Wallet, evm: Contracts.Evm.Instance): Promise<void>;
|
15
11
|
emitEvents(transaction: Contracts.Crypto.Transaction): void;
|
16
|
-
|
17
|
-
|
18
|
-
type: Contracts.State.AttributeType;
|
19
|
-
}>;
|
20
|
-
throwIfCannotEnterPool(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<void>;
|
21
|
-
verifySignatures(wallet: Contracts.State.Wallet, transaction: Contracts.Crypto.TransactionData, multiSignature?: Contracts.Crypto.MultiSignatureAsset): Promise<boolean>;
|
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;
|
12
|
+
verifySignatures(wallet: Contracts.State.Wallet, transaction: Contracts.Crypto.TransactionData, multiSignature: Contracts.Crypto.MultiSignatureAsset): Promise<boolean>;
|
13
|
+
abstract apply(context: Contracts.Transactions.TransactionHandlerContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Evm.TransactionReceipt>;
|
25
14
|
abstract getConstructor(): Contracts.Crypto.TransactionConstructor;
|
26
15
|
abstract dependencies(): ReadonlyArray<TransactionHandlerConstructor>;
|
27
16
|
abstract isActivated(): Promise<boolean>;
|
@@ -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;AAGzE,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;IAGlE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAG,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAGnE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAG,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC;IAG3E,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAG,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC;IAEzD,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnE,sBAAsB,CAClC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EACzC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,MAAM,EAC9B,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,GACzB,OAAO,CAAC,IAAI,CAAC;IA+BT,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI;IAErD,gBAAgB,CAC5B,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,MAAM,EAC9B,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,eAAe,EAC7C,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,mBAAmB,GAClD,OAAO,CAAC,OAAO,CAAC;aAIH,KAAK,CACpB,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,yBAAyB,EACzD,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,GACvC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC;aAE5B,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"}
|
@@ -7,128 +7,45 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
9
|
};
|
10
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
12
|
-
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");
|
13
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
14
|
-
};
|
15
|
-
var _TransactionHandler_instances, _TransactionHandler_verifyTransactionNonceApply;
|
16
10
|
import { inject, injectable } from "@mainsail/container";
|
17
11
|
import { Contracts, Exceptions, Identifiers } from "@mainsail/contracts";
|
18
|
-
import {
|
19
|
-
import { BigNumber } from "@mainsail/utils";
|
12
|
+
import { assert } from "@mainsail/utils";
|
20
13
|
let TransactionHandler = class TransactionHandler {
|
21
|
-
|
22
|
-
|
23
|
-
}
|
24
|
-
async verify({ walletRepository }, transaction) {
|
25
|
-
AppUtils.assert.defined(transaction.data.senderPublicKey);
|
26
|
-
const senderWallet = await walletRepository.findByPublicKey(transaction.data.senderPublicKey);
|
27
|
-
if (senderWallet.hasMultiSignature()) {
|
28
|
-
return this.verifySignatures(senderWallet, transaction.data);
|
29
|
-
}
|
14
|
+
async verify(transaction) {
|
15
|
+
assert.string(transaction.data.from);
|
30
16
|
return this.verifier.verifyHash(transaction.data);
|
31
17
|
}
|
32
|
-
async throwIfCannotBeApplied(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if (!walletRepository.hasByPublicKey(sender.getPublicKey()) && senderWallet.getBalance().isZero()) {
|
37
|
-
throw new Exceptions.ColdWalletError();
|
38
|
-
}
|
39
|
-
// @TODO: enforce fees here to support dynamic cases
|
40
|
-
__classPrivateFieldGet(this, _TransactionHandler_instances, "m", _TransactionHandler_verifyTransactionNonceApply).call(this, sender, transaction);
|
41
|
-
this.verifyTransactionFee(context, transaction, sender);
|
42
|
-
if (sender.getBalance().minus(transaction.data.amount).minus(transaction.data.fee).isNegative() &&
|
43
|
-
this.configuration.getHeight() > 0) {
|
44
|
-
throw new Exceptions.InsufficientBalanceError();
|
45
|
-
}
|
46
|
-
if (transaction.data.senderPublicKey !== sender.getPublicKey()) {
|
47
|
-
throw new Exceptions.SenderWalletMismatchError();
|
18
|
+
async throwIfCannotBeApplied(transaction, sender, evm) {
|
19
|
+
// Legacy
|
20
|
+
if (sender.hasLegacySecondPublicKey()) {
|
21
|
+
await this.verifier.verifyLegacySecondSignature(transaction.data, sender.legacySecondPublicKey());
|
48
22
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
if (sender.hasMultiSignature()) {
|
53
|
-
AppUtils.assert.defined(transaction.data.senderPublicKey);
|
54
|
-
// Ensure the database wallet already has a multi signature, in case we checked a pool wallet.
|
55
|
-
const databaseSender = await walletRepository.findByPublicKey(transaction.data.senderPublicKey);
|
56
|
-
if (!databaseSender.hasMultiSignature()) {
|
57
|
-
throw new Exceptions.MissingMultiSignatureOnSenderError();
|
58
|
-
}
|
59
|
-
if (databaseSender.hasAttribute("multiSignature.legacy")) {
|
60
|
-
throw new Exceptions.LegacyMultiSignatureError();
|
61
|
-
}
|
62
|
-
if (!(await this.verifySignatures(databaseSender, transaction.data, databaseSender.getAttribute("multiSignature")))) {
|
63
|
-
throw new Exceptions.InvalidMultiSignaturesError();
|
23
|
+
else {
|
24
|
+
if (transaction.data.legacySecondSignature) {
|
25
|
+
throw new Exceptions.UnexpectedLegacySecondSignatureError();
|
64
26
|
}
|
65
27
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
const data = transaction.data;
|
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);
|
28
|
+
const milestone = this.configuration.getMilestone();
|
29
|
+
const preverified = await evm.preverifyTransaction({
|
30
|
+
blockGasLimit: BigInt(milestone.block.maxGasLimit),
|
31
|
+
data: Buffer.from(transaction.data.data, "hex"),
|
32
|
+
from: transaction.data.from,
|
33
|
+
gasLimit: BigInt(transaction.data.gas),
|
34
|
+
gasPrice: BigInt(transaction.data.gasPrice),
|
35
|
+
legacyAddress: transaction.data.senderLegacyAddress,
|
36
|
+
nonce: transaction.data.nonce.toBigInt(),
|
37
|
+
specId: milestone.evmSpec,
|
38
|
+
to: transaction.data.to,
|
39
|
+
txHash: transaction.data.hash,
|
40
|
+
value: transaction.data.value.toBigInt(),
|
41
|
+
});
|
42
|
+
if (!preverified.success) {
|
43
|
+
throw new Exceptions.TransactionFailedToPreverifyError(transaction, new Error(preverified.error));
|
96
44
|
}
|
97
|
-
return { gasUsed };
|
98
|
-
}
|
99
|
-
async applyToRecipient(context, transaction) {
|
100
|
-
return { gasUsed: 0 };
|
101
45
|
}
|
102
46
|
emitEvents(transaction) { }
|
103
|
-
walletAttributes() {
|
104
|
-
return [];
|
105
|
-
}
|
106
|
-
async throwIfCannotEnterPool(context, transaction) { }
|
107
47
|
async verifySignatures(wallet, transaction, multiSignature) {
|
108
|
-
return this.verifier.verifySignatures(transaction, multiSignature
|
109
|
-
}
|
110
|
-
allTransactions(transactions) {
|
111
|
-
return transactions
|
112
|
-
.filter(({ data }) => data.type === this.getConstructor().type && data.typeGroup === this.getConstructor().typeGroup)
|
113
|
-
.map(({ data }) => data);
|
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
|
-
}
|
126
|
-
};
|
127
|
-
_TransactionHandler_instances = new WeakSet();
|
128
|
-
_TransactionHandler_verifyTransactionNonceApply = function _TransactionHandler_verifyTransactionNonceApply(wallet, transaction) {
|
129
|
-
const nonce = transaction.data.nonce || BigNumber.ZERO;
|
130
|
-
if (!wallet.getNonce().plus(1).isEqualTo(nonce)) {
|
131
|
-
throw new Exceptions.UnexpectedNonceError(nonce, wallet, false);
|
48
|
+
return this.verifier.verifySignatures(transaction, multiSignature);
|
132
49
|
}
|
133
50
|
};
|
134
51
|
__decorate([
|
@@ -148,9 +65,9 @@ __decorate([
|
|
148
65
|
__metadata("design:type", Object)
|
149
66
|
], TransactionHandler.prototype, "verifier", void 0);
|
150
67
|
__decorate([
|
151
|
-
inject(Identifiers.
|
68
|
+
inject(Identifiers.BlockchainUtils.FeeCalculator),
|
152
69
|
__metadata("design:type", Object)
|
153
|
-
], TransactionHandler.prototype, "
|
70
|
+
], TransactionHandler.prototype, "feeCalculator", void 0);
|
154
71
|
__decorate([
|
155
72
|
inject(Identifiers.Services.EventDispatcher.Service),
|
156
73
|
__metadata("design:type", Object)
|
@@ -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,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGlC,IAAe,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"AAAA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,
|
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,MAAM,MAAM,qBAAqB,CAAC"}
|
package/distribution/index.js
CHANGED
@@ -1 +1 @@
|
|
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,
|
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,MAAM,MAAM,qBAAqB,CAAC"}
|
@@ -1,8 +1,5 @@
|
|
1
|
-
import { interfaces } from "@mainsail/container";
|
2
1
|
import { Providers } from "@mainsail/kernel";
|
3
|
-
import { TransactionHandlerConstructor } from "./handlers/index.js";
|
4
2
|
export declare class ServiceProvider extends Providers.ServiceProvider {
|
5
|
-
static getTransactionHandlerConstructorsBinding(): (context: interfaces.Context) => TransactionHandlerConstructor[];
|
6
3
|
register(): Promise<void>;
|
7
4
|
required(): Promise<boolean>;
|
8
5
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,qBACa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAYzB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;CAGzC"}
|
@@ -1,39 +1,28 @@
|
|
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
|
+
import { injectable } from "@mainsail/container";
|
1
8
|
import { Identifiers } from "@mainsail/contracts";
|
2
9
|
import { Providers } from "@mainsail/kernel";
|
3
10
|
import { TransactionHandlerRegistry } from "./handlers/handler-registry.js";
|
4
|
-
import { TransactionHandlerProvider } from "./handlers/index.js";
|
5
11
|
import { TransactionValidator } from "./transaction-validator.js";
|
6
|
-
|
7
|
-
static getTransactionHandlerConstructorsBinding() {
|
8
|
-
return (context) => {
|
9
|
-
const handlerConstructors = [];
|
10
|
-
let container = context.container;
|
11
|
-
do {
|
12
|
-
const bindingDictionary = container["_bindingDictionary"];
|
13
|
-
const handlerBindings = bindingDictionary.getMap().get(Identifiers.Transaction.Handler.Instances) ?? [];
|
14
|
-
for (const handlerBinding of handlerBindings) {
|
15
|
-
if (handlerBinding.implementationType) {
|
16
|
-
handlerConstructors.push(handlerBinding.implementationType);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
container = container.parent;
|
20
|
-
} while (container);
|
21
|
-
return handlerConstructors;
|
22
|
-
};
|
23
|
-
}
|
12
|
+
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
24
13
|
async register() {
|
25
|
-
this.app.bind(Identifiers.Transaction.Handler.Provider).to(TransactionHandlerProvider).inSingletonScope();
|
26
|
-
this.app
|
27
|
-
.bind(Identifiers.Transaction.Handler.Constructors)
|
28
|
-
.toDynamicValue(ServiceProvider.getTransactionHandlerConstructorsBinding());
|
29
14
|
this.app.bind(Identifiers.Transaction.Handler.Registry).to(TransactionHandlerRegistry);
|
30
15
|
this.app.bind(Identifiers.Transaction.Validator.Instance).to(TransactionValidator);
|
31
16
|
this.app
|
32
17
|
.bind(Identifiers.Transaction.Validator.Factory)
|
33
|
-
.
|
18
|
+
.toFactory((context) => () => context.get(Identifiers.Transaction.Validator.Instance));
|
34
19
|
}
|
35
20
|
async required() {
|
36
21
|
return true;
|
37
22
|
}
|
38
|
-
}
|
23
|
+
};
|
24
|
+
ServiceProvider = __decorate([
|
25
|
+
injectable()
|
26
|
+
], ServiceProvider);
|
27
|
+
export { ServiceProvider };
|
39
28
|
//# 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":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAa,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAG3D,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,SAAS,CAAC,eAAe;IACtD,KAAK,CAAC,QAAQ;QACpB,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,CAA6B,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC;aAC3E,SAAS,CACT,CAAC,OAAqD,EAAE,EAAE,CAAC,GAAG,EAAE,CAC/D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CACxD,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,QAAQ;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAA;AAhBY,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAgB3B"}
|
@@ -1,12 +1,9 @@
|
|
1
1
|
import { Contracts } from "@mainsail/contracts";
|
2
2
|
export declare class TransactionValidator implements Contracts.Transactions.TransactionValidator {
|
3
|
-
#private;
|
4
3
|
private readonly evm;
|
5
4
|
private readonly handlerRegistry;
|
6
|
-
private readonly stateService;
|
7
5
|
private readonly transactionFactory;
|
8
|
-
initialize(): void;
|
9
6
|
getEvm(): Contracts.Evm.Instance;
|
10
|
-
validate(context: Contracts.Transactions.TransactionValidatorContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.
|
7
|
+
validate(context: Contracts.Transactions.TransactionValidatorContext, transaction: Contracts.Crypto.Transaction): Promise<Contracts.Evm.TransactionReceipt>;
|
11
8
|
}
|
12
9
|
//# sourceMappingURL=transaction-validator.d.ts.map
|
@@ -1 +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
|
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,kBAAkB,CAAuC;IAEnE,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,GAAG,CAAC,kBAAkB,CAAC;CA4B5C"}
|
@@ -7,87 +7,47 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
9
|
};
|
10
|
-
|
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";
|
10
|
+
import { inject, injectable, tagged } from "@mainsail/container";
|
23
11
|
import { Contracts, Identifiers } from "@mainsail/contracts";
|
24
|
-
import {
|
12
|
+
import { assert } from "@mainsail/utils";
|
25
13
|
import { strictEqual } from "assert";
|
26
14
|
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
15
|
getEvm() {
|
35
16
|
return this.evm;
|
36
17
|
}
|
37
18
|
async validate(context, transaction) {
|
38
19
|
const deserialized = await this.transactionFactory.fromBytes(transaction.serialized);
|
39
|
-
strictEqual(transaction.
|
40
|
-
const { commitKey, gasLimit, timestamp,
|
20
|
+
strictEqual(transaction.hash, deserialized.hash);
|
21
|
+
const { commitKey, gasLimit, timestamp, generatorAddress } = context;
|
41
22
|
const handler = await this.handlerRegistry.getActivatedHandlerForData(transaction.data);
|
42
|
-
const
|
23
|
+
const receipt = await handler.apply({
|
43
24
|
evm: {
|
44
25
|
blockContext: {
|
45
26
|
commitKey,
|
46
27
|
gasLimit: BigInt(gasLimit),
|
47
28
|
timestamp: BigInt(timestamp),
|
48
|
-
validatorAddress:
|
29
|
+
validatorAddress: generatorAddress,
|
49
30
|
},
|
50
31
|
instance: this.evm,
|
51
32
|
},
|
52
|
-
walletRepository: __classPrivateFieldGet(this, _TransactionValidator_walletRepository, "f"),
|
53
33
|
}, transaction);
|
54
|
-
|
55
|
-
|
56
|
-
return { gasUsed: result.gasUsed };
|
34
|
+
assert.string(transaction.data.from);
|
35
|
+
return receipt;
|
57
36
|
}
|
58
37
|
};
|
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
38
|
__decorate([
|
69
39
|
inject(Identifiers.Evm.Instance),
|
70
|
-
tagged("instance", "
|
40
|
+
tagged("instance", "validator"),
|
71
41
|
__metadata("design:type", Object)
|
72
42
|
], TransactionValidator.prototype, "evm", void 0);
|
73
43
|
__decorate([
|
74
44
|
inject(Identifiers.Transaction.Handler.Registry),
|
75
45
|
__metadata("design:type", Object)
|
76
46
|
], TransactionValidator.prototype, "handlerRegistry", void 0);
|
77
|
-
__decorate([
|
78
|
-
inject(Identifiers.State.Service),
|
79
|
-
__metadata("design:type", Object)
|
80
|
-
], TransactionValidator.prototype, "stateService", void 0);
|
81
47
|
__decorate([
|
82
48
|
inject(Identifiers.Cryptography.Transaction.Factory),
|
83
49
|
__metadata("design:type", Object)
|
84
50
|
], 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
51
|
TransactionValidator = __decorate([
|
92
52
|
injectable()
|
93
53
|
], TransactionValidator);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../source/transaction-validator.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../source/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE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ACc;AAG7B;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;6DACoC;AAGpE;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;;gEACqB;AAT9D,oBAAoB;IADhC,UAAU,EAAE;GACA,oBAAoB,CA8ChC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mainsail/transactions",
|
3
|
-
"version": "0.0.1-evm.
|
3
|
+
"version": "0.0.1-evm.21",
|
4
4
|
"description": "Transaction Services for Mainsail blockchain",
|
5
5
|
"license": "GPL-3.0-only",
|
6
6
|
"contributors": [],
|
@@ -11,16 +11,13 @@
|
|
11
11
|
"/distribution"
|
12
12
|
],
|
13
13
|
"dependencies": {
|
14
|
-
"@mainsail/container": "0.0.1-evm.
|
15
|
-
"@mainsail/
|
16
|
-
"@mainsail/
|
17
|
-
"@mainsail/utils": "0.0.1-evm.
|
18
|
-
"@mainsail/kernel": "0.0.1-evm.2"
|
14
|
+
"@mainsail/container": "0.0.1-evm.21",
|
15
|
+
"@mainsail/kernel": "0.0.1-evm.21",
|
16
|
+
"@mainsail/contracts": "0.0.1-evm.21",
|
17
|
+
"@mainsail/utils": "0.0.1-evm.21"
|
19
18
|
},
|
20
19
|
"devDependencies": {
|
21
|
-
"
|
22
|
-
"uvu": "^0.5.6",
|
23
|
-
"@mainsail/crypto-config": "0.0.1-evm.2"
|
20
|
+
"uvu": "0.5.6"
|
24
21
|
},
|
25
22
|
"engines": {
|
26
23
|
"node": ">=20.x"
|
@@ -31,7 +28,7 @@
|
|
31
28
|
"clean": "del distribution",
|
32
29
|
"release": "pnpm publish --access public",
|
33
30
|
"test": "pnpm run uvu source .test.ts",
|
34
|
-
"test:coverage": "c8 pnpm run test",
|
31
|
+
"test:coverage": "c8 -r=text -r=lcov --all pnpm run test",
|
35
32
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
36
33
|
"test:file": "pnpm run uvu source",
|
37
34
|
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { Contracts } from "@mainsail/contracts";
|
2
|
-
export declare class TransactionHandlerProvider implements Contracts.Transactions.TransactionHandlerProvider {
|
3
|
-
#private;
|
4
|
-
private readonly attributeRepository;
|
5
|
-
private readonly handlerConstructors;
|
6
|
-
private readonly transactionRegistry;
|
7
|
-
isRegistrationRequired(): boolean;
|
8
|
-
registerHandlers(): void;
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=handler-provider.d.ts.map
|
@@ -1 +0,0 @@
|
|
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,107 +0,0 @@
|
|
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 __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
12
|
-
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");
|
13
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
14
|
-
};
|
15
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
16
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
17
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
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");
|
19
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
20
|
-
};
|
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";
|
26
|
-
let TransactionHandlerProvider = class TransactionHandlerProvider {
|
27
|
-
constructor() {
|
28
|
-
_TransactionHandlerProvider_instances.add(this);
|
29
|
-
_TransactionHandlerProvider_registered.set(this, false);
|
30
|
-
_TransactionHandlerProvider_handlerDependencyLookup.set(this, new Set());
|
31
|
-
}
|
32
|
-
isRegistrationRequired() {
|
33
|
-
return __classPrivateFieldGet(this, _TransactionHandlerProvider_registered, "f") === false;
|
34
|
-
}
|
35
|
-
registerHandlers() {
|
36
|
-
for (const handlerConstructor of this.handlerConstructors) {
|
37
|
-
__classPrivateFieldGet(this, _TransactionHandlerProvider_instances, "m", _TransactionHandlerProvider_registerHandler).call(this, handlerConstructor);
|
38
|
-
}
|
39
|
-
__classPrivateFieldSet(this, _TransactionHandlerProvider_registered, true, "f");
|
40
|
-
}
|
41
|
-
};
|
42
|
-
_TransactionHandlerProvider_registered = new WeakMap();
|
43
|
-
_TransactionHandlerProvider_handlerDependencyLookup = new WeakMap();
|
44
|
-
_TransactionHandlerProvider_instances = new WeakSet();
|
45
|
-
_TransactionHandlerProvider_registerHandler = function _TransactionHandlerProvider_registerHandler(handlerConstructor) {
|
46
|
-
const handler = new handlerConstructor();
|
47
|
-
const transactionConstructor = handler.getConstructor();
|
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);
|
52
|
-
if (__classPrivateFieldGet(this, _TransactionHandlerProvider_instances, "m", _TransactionHandlerProvider_hasOtherHandlerHandling).call(this, handlerConstructor, internalType, transactionConstructor.version)) {
|
53
|
-
throw new Exceptions.AlreadyRegisteredError(internalType);
|
54
|
-
}
|
55
|
-
for (const dependency of handler.dependencies()) {
|
56
|
-
if (__classPrivateFieldGet(this, _TransactionHandlerProvider_instances, "m", _TransactionHandlerProvider_hasOtherHandler).call(this, dependency) === false) {
|
57
|
-
throw new Exceptions.UnsatisfiedDependencyError(internalType);
|
58
|
-
}
|
59
|
-
}
|
60
|
-
for (const attribute of handler.walletAttributes()) {
|
61
|
-
if (!this.attributeRepository.has(attribute.name)) {
|
62
|
-
this.attributeRepository.set(attribute.name, attribute.type);
|
63
|
-
}
|
64
|
-
}
|
65
|
-
if (transactionConstructor.typeGroup !== Contracts.Crypto.TransactionTypeGroup.Core) {
|
66
|
-
this.transactionRegistry.registerTransactionType(transactionConstructor);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
_TransactionHandlerProvider_hasOtherHandlerHandling = function _TransactionHandlerProvider_hasOtherHandlerHandling(handlerConstructor, internalType, version) {
|
70
|
-
for (const otherHandlerConstructor of this.handlerConstructors) {
|
71
|
-
if (otherHandlerConstructor === handlerConstructor) {
|
72
|
-
continue;
|
73
|
-
}
|
74
|
-
const otherHandler = new otherHandlerConstructor();
|
75
|
-
const otherTransactionConstructor = otherHandler.getConstructor();
|
76
|
-
Utils.assert.defined(otherTransactionConstructor.type);
|
77
|
-
Utils.assert.defined(otherTransactionConstructor.typeGroup);
|
78
|
-
const otherInternalType = InternalTransactionType.from(otherTransactionConstructor.type, otherTransactionConstructor.typeGroup);
|
79
|
-
if (otherInternalType === internalType && otherTransactionConstructor.version === version) {
|
80
|
-
return true;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
return false;
|
84
|
-
};
|
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);
|
90
|
-
};
|
91
|
-
__decorate([
|
92
|
-
inject(Identifiers.State.Wallet.Attributes),
|
93
|
-
__metadata("design:type", Object)
|
94
|
-
], TransactionHandlerProvider.prototype, "attributeRepository", void 0);
|
95
|
-
__decorate([
|
96
|
-
inject(Identifiers.Transaction.Handler.Constructors),
|
97
|
-
__metadata("design:type", Array)
|
98
|
-
], TransactionHandlerProvider.prototype, "handlerConstructors", void 0);
|
99
|
-
__decorate([
|
100
|
-
inject(Identifiers.Cryptography.Transaction.Registry),
|
101
|
-
__metadata("design:type", Object)
|
102
|
-
], TransactionHandlerProvider.prototype, "transactionRegistry", void 0);
|
103
|
-
TransactionHandlerProvider = __decorate([
|
104
|
-
injectable()
|
105
|
-
], TransactionHandlerProvider);
|
106
|
-
export { TransactionHandlerProvider };
|
107
|
-
//# sourceMappingURL=handler-provider.js.map
|
@@ -1 +0,0 @@
|
|
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,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKlC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAAhC;;QAUN,iDAAc,KAAK,EAAC;QACpB,8DAA2B,IAAI,GAAG,EAA0B,EAAC;IAwF9D,CAAC;IAtFO,sBAAsB;QAC5B,OAAO,uBAAA,IAAI,8CAAY,KAAK,KAAK,CAAC;IACnC,CAAC;IAEM,gBAAgB;QACtB,KAAK,MAAM,kBAAkB,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3D,uBAAA,IAAI,0FAAiB,MAArB,IAAI,EAAkB,kBAAkB,CAAC,CAAC;QAC3C,CAAC;QAED,uBAAA,IAAI,0CAAe,IAAI,MAAA,CAAC;IACzB,CAAC;CA4ED,CAAA;;;;mGA1EiB,kBAAiD;IACjE,MAAM,OAAO,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACzC,MAAM,sBAAsB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAExD,uBAAA,IAAI,2DAAyB,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAE1D,KA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;AARhE,0BAA0B;IADtC,UAAU,EAAE;GACA,0BAA0B,CAmGtC"}
|
package/distribution/utils.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../source/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,eAAO,MAAM,0BAA0B,gBACzB,MAAM,8BAEJ,UAAU,MAAM,CAAC,aAAa,KAC3C,OAAmG,CAAC"}
|
package/distribution/utils.js
DELETED
@@ -1 +0,0 @@
|
|
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"}
|