@explorins/pers-shared 2.1.23 → 2.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/shared-lib/dto/transaction/index.d.ts +0 -1
- package/dist/cjs/shared-lib/dto/transaction/index.d.ts.map +1 -1
- package/dist/cjs/shared-lib/dto/transaction/index.js +1 -1
- package/dist/cjs/shared-lib/dto/transaction/index.js.map +1 -1
- package/dist/cjs/shared-lib/dto/transaction/transaction.request.dto.d.ts.map +1 -1
- package/dist/cjs/shared-lib/dto/transaction/transaction.request.dto.js +0 -13
- package/dist/cjs/shared-lib/dto/transaction/transaction.request.dto.js.map +1 -1
- package/dist/cjs/shared-lib/dto/user.dto.d.ts +2 -2
- package/dist/cjs/shared-lib/dto/user.dto.d.ts.map +1 -1
- package/dist/cjs/shared-lib/dto/user.dto.js +1 -1
- package/dist/cjs/shared-lib/dto/user.dto.js.map +1 -1
- package/dist/cjs/shared-lib/dto/wallet.dto.d.ts +4 -2
- package/dist/cjs/shared-lib/dto/wallet.dto.d.ts.map +1 -1
- package/dist/cjs/shared-lib/dto/wallet.dto.js +25 -22
- package/dist/cjs/shared-lib/dto/wallet.dto.js.map +1 -1
- package/dist/cjs/shared-lib/types/index.d.ts +1 -0
- package/dist/cjs/shared-lib/types/index.d.ts.map +1 -1
- package/dist/cjs/shared-lib/types/index.js +1 -0
- package/dist/cjs/shared-lib/types/index.js.map +1 -1
- package/dist/esm/shared-lib/dto/transaction/index.d.ts +0 -1
- package/dist/esm/shared-lib/dto/transaction/index.d.ts.map +1 -1
- package/dist/esm/shared-lib/dto/transaction/index.js +1 -1
- package/dist/esm/shared-lib/dto/transaction/index.js.map +1 -1
- package/dist/esm/shared-lib/dto/transaction/transaction.request.dto.d.ts.map +1 -1
- package/dist/esm/shared-lib/dto/transaction/transaction.request.dto.js +0 -13
- package/dist/esm/shared-lib/dto/transaction/transaction.request.dto.js.map +1 -1
- package/dist/esm/shared-lib/dto/user.dto.d.ts +2 -2
- package/dist/esm/shared-lib/dto/user.dto.d.ts.map +1 -1
- package/dist/esm/shared-lib/dto/user.dto.js +2 -2
- package/dist/esm/shared-lib/dto/user.dto.js.map +1 -1
- package/dist/esm/shared-lib/dto/wallet.dto.d.ts +4 -2
- package/dist/esm/shared-lib/dto/wallet.dto.d.ts.map +1 -1
- package/dist/esm/shared-lib/dto/wallet.dto.js +21 -19
- package/dist/esm/shared-lib/dto/wallet.dto.js.map +1 -1
- package/dist/esm/shared-lib/types/index.d.ts +1 -0
- package/dist/esm/shared-lib/types/index.d.ts.map +1 -1
- package/dist/esm/shared-lib/types/index.js +1 -0
- package/dist/esm/shared-lib/types/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/shared-lib/dto/transaction/transaction-to-sign.dto.d.ts +0 -68
- package/dist/cjs/shared-lib/dto/transaction/transaction-to-sign.dto.d.ts.map +0 -1
- package/dist/cjs/shared-lib/dto/transaction/transaction-to-sign.dto.js +0 -243
- package/dist/cjs/shared-lib/dto/transaction/transaction-to-sign.dto.js.map +0 -1
- package/dist/esm/shared-lib/dto/transaction/transaction-to-sign.dto.d.ts +0 -68
- package/dist/esm/shared-lib/dto/transaction/transaction-to-sign.dto.d.ts.map +0 -1
- package/dist/esm/shared-lib/dto/transaction/transaction-to-sign.dto.js +0 -211
- package/dist/esm/shared-lib/dto/transaction/transaction-to-sign.dto.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared-lib/types/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared-lib/types/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { BaseTransaction, EIP1559Transaction, EIP2930Transaction, LegacyTransaction, TRANSACTION_FORMATS } from "@explorins/web3-ts/types";
|
|
2
|
-
/**
|
|
3
|
-
* Abstract base DTO for all transaction types
|
|
4
|
-
* Following PERS DDD principles with shared transaction properties
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class BaseTransactionDto implements BaseTransaction {
|
|
7
|
-
chainId: number;
|
|
8
|
-
from: string;
|
|
9
|
-
to: string;
|
|
10
|
-
value: string;
|
|
11
|
-
data: string;
|
|
12
|
-
gas: string;
|
|
13
|
-
nonce: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Legacy transaction DTO (Type 0)
|
|
17
|
-
* Following PERS DDD principles with proper discriminated union support
|
|
18
|
-
*/
|
|
19
|
-
export declare class UnsignedLegacyTransactionDataDto extends BaseTransactionDto implements LegacyTransaction {
|
|
20
|
-
format: typeof TRANSACTION_FORMATS.LEGACY;
|
|
21
|
-
gasPrice: string;
|
|
22
|
-
type?: 0;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* EIP-1559 Fee Market transaction DTO (Type 2)
|
|
26
|
-
* Recommended for PERS loyalty platform for predictable gas costs
|
|
27
|
-
*/
|
|
28
|
-
export declare class UnsignedEIP1559TransactionDataDto extends BaseTransactionDto implements EIP1559Transaction {
|
|
29
|
-
format: typeof TRANSACTION_FORMATS.EIP_1559;
|
|
30
|
-
maxFeePerGas: string;
|
|
31
|
-
maxPriorityFeePerGas: string;
|
|
32
|
-
type: 2;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* EIP-2930 Access List transaction DTO (Type 1)
|
|
36
|
-
* For specific gas optimization scenarios
|
|
37
|
-
*/
|
|
38
|
-
export declare class UnsignedEIP2930TransactionDataDto extends BaseTransactionDto implements EIP2930Transaction {
|
|
39
|
-
format: typeof TRANSACTION_FORMATS.EIP_2930;
|
|
40
|
-
gasPrice: string;
|
|
41
|
-
accessList: Array<{
|
|
42
|
-
address: string;
|
|
43
|
-
storageKeys: string[];
|
|
44
|
-
}>;
|
|
45
|
-
type: 1;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Discriminated union type for all unsigned transaction DTOs
|
|
49
|
-
* Enables type-safe handling across the PERS loyalty platform
|
|
50
|
-
*/
|
|
51
|
-
export type AnyUnsignedTransactionDataDto = UnsignedLegacyTransactionDataDto | UnsignedEIP1559TransactionDataDto | UnsignedEIP2930TransactionDataDto;
|
|
52
|
-
/**
|
|
53
|
-
* Type guard functions for transaction DTO type detection
|
|
54
|
-
* Following PERS type safety principles with runtime validation
|
|
55
|
-
*/
|
|
56
|
-
export declare function isLegacyTransactionDto(dto: AnyUnsignedTransactionDataDto): dto is UnsignedLegacyTransactionDataDto;
|
|
57
|
-
export declare function isEIP1559TransactionDto(dto: AnyUnsignedTransactionDataDto): dto is UnsignedEIP1559TransactionDataDto;
|
|
58
|
-
export declare function isEIP2930TransactionDto(dto: AnyUnsignedTransactionDataDto): dto is UnsignedEIP2930TransactionDataDto;
|
|
59
|
-
/**
|
|
60
|
-
* Exhaustive type checking for transaction DTOs
|
|
61
|
-
* Ensures all transaction formats are handled at compile time
|
|
62
|
-
*/
|
|
63
|
-
export declare function handleTransactionDtoByFormat<T>(dto: AnyUnsignedTransactionDataDto, handlers: {
|
|
64
|
-
legacy: (tx: UnsignedLegacyTransactionDataDto) => T;
|
|
65
|
-
eip1559: (tx: UnsignedEIP1559TransactionDataDto) => T;
|
|
66
|
-
eip2930: (tx: UnsignedEIP2930TransactionDataDto) => T;
|
|
67
|
-
}): T;
|
|
68
|
-
//# sourceMappingURL=transaction-to-sign.dto.d.ts.map
|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ACb;AAED;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GACrC,gCAAgC,GAChC,iCAAiC,GACjC,iCAAiC,CAAC;AAIpC;;;EAGC;AAEH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,6BAA6B,GAAG,GAAG,IAAI,gCAAgC,CAElH;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,6BAA6B,GAAG,GAAG,IAAI,iCAAiC,CAEpH;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,6BAA6B,GAAG,GAAG,IAAI,iCAAiC,CAEpH;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAC5C,GAAG,EAAE,6BAA6B,EAClC,QAAQ,EAAE;IACR,MAAM,EAAE,CAAC,EAAE,EAAE,gCAAgC,KAAK,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,EAAE,EAAE,iCAAiC,KAAK,CAAC,CAAC;IACtD,OAAO,EAAE,CAAC,EAAE,EAAE,iCAAiC,KAAK,CAAC,CAAC;CACvD,GACA,CAAC,CAaH"}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UnsignedEIP2930TransactionDataDto = exports.UnsignedEIP1559TransactionDataDto = exports.UnsignedLegacyTransactionDataDto = exports.BaseTransactionDto = void 0;
|
|
13
|
-
exports.isLegacyTransactionDto = isLegacyTransactionDto;
|
|
14
|
-
exports.isEIP1559TransactionDto = isEIP1559TransactionDto;
|
|
15
|
-
exports.isEIP2930TransactionDto = isEIP2930TransactionDto;
|
|
16
|
-
exports.handleTransactionDtoByFormat = handleTransactionDtoByFormat;
|
|
17
|
-
const types_1 = require("@explorins/web3-ts/types");
|
|
18
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
19
|
-
/**
|
|
20
|
-
* Abstract base DTO for all transaction types
|
|
21
|
-
* Following PERS DDD principles with shared transaction properties
|
|
22
|
-
*/
|
|
23
|
-
class BaseTransactionDto {
|
|
24
|
-
chainId = 0;
|
|
25
|
-
from = '';
|
|
26
|
-
to = '';
|
|
27
|
-
value = '';
|
|
28
|
-
data = '';
|
|
29
|
-
gas = '';
|
|
30
|
-
nonce = 0;
|
|
31
|
-
}
|
|
32
|
-
exports.BaseTransactionDto = BaseTransactionDto;
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, swagger_1.ApiProperty)({
|
|
35
|
-
description: 'Chain ID of the transaction',
|
|
36
|
-
example: 39123
|
|
37
|
-
}),
|
|
38
|
-
__metadata("design:type", Number)
|
|
39
|
-
], BaseTransactionDto.prototype, "chainId", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, swagger_1.ApiProperty)({
|
|
42
|
-
description: 'Transaction from address',
|
|
43
|
-
example: '0xa70ecdec5ff1b0577f6627a594f55d55fcaafb33'
|
|
44
|
-
}),
|
|
45
|
-
__metadata("design:type", String)
|
|
46
|
-
], BaseTransactionDto.prototype, "from", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, swagger_1.ApiProperty)({
|
|
49
|
-
description: 'Transaction to address (contract)',
|
|
50
|
-
example: '0x2661b159EA679eFD6Cc884a79A838FCabbDcA7F2'
|
|
51
|
-
}),
|
|
52
|
-
__metadata("design:type", String)
|
|
53
|
-
], BaseTransactionDto.prototype, "to", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
(0, swagger_1.ApiProperty)({
|
|
56
|
-
description: 'Transaction value in wei',
|
|
57
|
-
example: '0'
|
|
58
|
-
}),
|
|
59
|
-
__metadata("design:type", String)
|
|
60
|
-
], BaseTransactionDto.prototype, "value", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
(0, swagger_1.ApiProperty)({
|
|
63
|
-
description: 'Transaction data (hex encoded)',
|
|
64
|
-
example: '0x99ab696062659702d42d66ee5fade613c4370d498e5e5c119a5353089a3ce258'
|
|
65
|
-
}),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], BaseTransactionDto.prototype, "data", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, swagger_1.ApiProperty)({
|
|
70
|
-
description: 'Gas limit',
|
|
71
|
-
example: '157211'
|
|
72
|
-
}),
|
|
73
|
-
__metadata("design:type", String)
|
|
74
|
-
], BaseTransactionDto.prototype, "gas", void 0);
|
|
75
|
-
__decorate([
|
|
76
|
-
(0, swagger_1.ApiProperty)({
|
|
77
|
-
description: 'Transaction nonce',
|
|
78
|
-
example: 1
|
|
79
|
-
}),
|
|
80
|
-
__metadata("design:type", Number)
|
|
81
|
-
], BaseTransactionDto.prototype, "nonce", void 0);
|
|
82
|
-
/**
|
|
83
|
-
* Legacy transaction DTO (Type 0)
|
|
84
|
-
* Following PERS DDD principles with proper discriminated union support
|
|
85
|
-
*/
|
|
86
|
-
class UnsignedLegacyTransactionDataDto extends BaseTransactionDto {
|
|
87
|
-
format = types_1.TRANSACTION_FORMATS.LEGACY;
|
|
88
|
-
gasPrice = '';
|
|
89
|
-
type = 0;
|
|
90
|
-
}
|
|
91
|
-
exports.UnsignedLegacyTransactionDataDto = UnsignedLegacyTransactionDataDto;
|
|
92
|
-
__decorate([
|
|
93
|
-
(0, swagger_1.ApiProperty)({
|
|
94
|
-
description: types_1.TRANSACTION_FORMAT_DESCRIPTIONS[types_1.TRANSACTION_FORMATS.LEGACY],
|
|
95
|
-
enum: Object.values(types_1.TRANSACTION_FORMATS),
|
|
96
|
-
example: types_1.TRANSACTION_FORMATS.LEGACY,
|
|
97
|
-
default: types_1.TRANSACTION_FORMATS.LEGACY
|
|
98
|
-
}),
|
|
99
|
-
__metadata("design:type", Object)
|
|
100
|
-
], UnsignedLegacyTransactionDataDto.prototype, "format", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
(0, swagger_1.ApiProperty)({
|
|
103
|
-
description: 'Gas price in wei (legacy pricing mechanism)',
|
|
104
|
-
example: '20000000000'
|
|
105
|
-
}),
|
|
106
|
-
__metadata("design:type", String)
|
|
107
|
-
], UnsignedLegacyTransactionDataDto.prototype, "gasPrice", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
(0, swagger_1.ApiProperty)({
|
|
110
|
-
description: 'Transaction type (0 for legacy)',
|
|
111
|
-
example: 0,
|
|
112
|
-
default: 0,
|
|
113
|
-
required: false
|
|
114
|
-
}),
|
|
115
|
-
__metadata("design:type", Number)
|
|
116
|
-
], UnsignedLegacyTransactionDataDto.prototype, "type", void 0);
|
|
117
|
-
/**
|
|
118
|
-
* EIP-1559 Fee Market transaction DTO (Type 2)
|
|
119
|
-
* Recommended for PERS loyalty platform for predictable gas costs
|
|
120
|
-
*/
|
|
121
|
-
class UnsignedEIP1559TransactionDataDto extends BaseTransactionDto {
|
|
122
|
-
format = types_1.TRANSACTION_FORMATS.EIP_1559;
|
|
123
|
-
maxFeePerGas = '';
|
|
124
|
-
maxPriorityFeePerGas = '';
|
|
125
|
-
type = 2;
|
|
126
|
-
}
|
|
127
|
-
exports.UnsignedEIP1559TransactionDataDto = UnsignedEIP1559TransactionDataDto;
|
|
128
|
-
__decorate([
|
|
129
|
-
(0, swagger_1.ApiProperty)({
|
|
130
|
-
description: types_1.TRANSACTION_FORMAT_DESCRIPTIONS[types_1.TRANSACTION_FORMATS.EIP_1559],
|
|
131
|
-
enum: Object.values(types_1.TRANSACTION_FORMATS),
|
|
132
|
-
example: types_1.TRANSACTION_FORMATS.EIP_1559,
|
|
133
|
-
default: types_1.TRANSACTION_FORMATS.EIP_1559
|
|
134
|
-
}),
|
|
135
|
-
__metadata("design:type", Object)
|
|
136
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "format", void 0);
|
|
137
|
-
__decorate([
|
|
138
|
-
(0, swagger_1.ApiProperty)({
|
|
139
|
-
description: 'Maximum fee per gas willing to pay (EIP-1559)',
|
|
140
|
-
example: '20000000000'
|
|
141
|
-
}),
|
|
142
|
-
__metadata("design:type", String)
|
|
143
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "maxFeePerGas", void 0);
|
|
144
|
-
__decorate([
|
|
145
|
-
(0, swagger_1.ApiProperty)({
|
|
146
|
-
description: 'Maximum priority fee per gas (tip to miners)',
|
|
147
|
-
example: '2000000000'
|
|
148
|
-
}),
|
|
149
|
-
__metadata("design:type", String)
|
|
150
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "maxPriorityFeePerGas", void 0);
|
|
151
|
-
__decorate([
|
|
152
|
-
(0, swagger_1.ApiProperty)({
|
|
153
|
-
description: 'Transaction type (2 for EIP-1559)',
|
|
154
|
-
example: 2,
|
|
155
|
-
default: 2
|
|
156
|
-
}),
|
|
157
|
-
__metadata("design:type", Number)
|
|
158
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "type", void 0);
|
|
159
|
-
/**
|
|
160
|
-
* EIP-2930 Access List transaction DTO (Type 1)
|
|
161
|
-
* For specific gas optimization scenarios
|
|
162
|
-
*/
|
|
163
|
-
class UnsignedEIP2930TransactionDataDto extends BaseTransactionDto {
|
|
164
|
-
format = types_1.TRANSACTION_FORMATS.EIP_2930;
|
|
165
|
-
gasPrice = '';
|
|
166
|
-
accessList = [];
|
|
167
|
-
type = 1;
|
|
168
|
-
}
|
|
169
|
-
exports.UnsignedEIP2930TransactionDataDto = UnsignedEIP2930TransactionDataDto;
|
|
170
|
-
__decorate([
|
|
171
|
-
(0, swagger_1.ApiProperty)({
|
|
172
|
-
description: types_1.TRANSACTION_FORMAT_DESCRIPTIONS[types_1.TRANSACTION_FORMATS.EIP_2930],
|
|
173
|
-
enum: Object.values(types_1.TRANSACTION_FORMATS),
|
|
174
|
-
example: types_1.TRANSACTION_FORMATS.EIP_2930,
|
|
175
|
-
default: types_1.TRANSACTION_FORMATS.EIP_2930
|
|
176
|
-
}),
|
|
177
|
-
__metadata("design:type", Object)
|
|
178
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "format", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
(0, swagger_1.ApiProperty)({
|
|
181
|
-
description: 'Gas price in wei (legacy pricing for EIP-2930)',
|
|
182
|
-
example: '20000000000'
|
|
183
|
-
}),
|
|
184
|
-
__metadata("design:type", String)
|
|
185
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "gasPrice", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
(0, swagger_1.ApiProperty)({
|
|
188
|
-
description: 'Access list for storage slot pre-warming',
|
|
189
|
-
type: 'array',
|
|
190
|
-
items: {
|
|
191
|
-
type: 'object',
|
|
192
|
-
properties: {
|
|
193
|
-
address: { type: 'string', example: '0x2661b159EA679eFD6Cc884a79A838FCabbDcA7F2' },
|
|
194
|
-
storageKeys: {
|
|
195
|
-
type: 'array',
|
|
196
|
-
items: { type: 'string' },
|
|
197
|
-
example: ['0x0000000000000000000000000000000000000000000000000000000000000000']
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}),
|
|
202
|
-
__metadata("design:type", Array)
|
|
203
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "accessList", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
(0, swagger_1.ApiProperty)({
|
|
206
|
-
description: 'Transaction type (1 for EIP-2930)',
|
|
207
|
-
example: 1,
|
|
208
|
-
default: 1
|
|
209
|
-
}),
|
|
210
|
-
__metadata("design:type", Number)
|
|
211
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "type", void 0);
|
|
212
|
-
/**
|
|
213
|
-
* Type guard functions for transaction DTO type detection
|
|
214
|
-
* Following PERS type safety principles with runtime validation
|
|
215
|
-
*/
|
|
216
|
-
function isLegacyTransactionDto(dto) {
|
|
217
|
-
return dto.format === types_1.TRANSACTION_FORMATS.LEGACY;
|
|
218
|
-
}
|
|
219
|
-
function isEIP1559TransactionDto(dto) {
|
|
220
|
-
return dto.format === types_1.TRANSACTION_FORMATS.EIP_1559;
|
|
221
|
-
}
|
|
222
|
-
function isEIP2930TransactionDto(dto) {
|
|
223
|
-
return dto.format === types_1.TRANSACTION_FORMATS.EIP_2930;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Exhaustive type checking for transaction DTOs
|
|
227
|
-
* Ensures all transaction formats are handled at compile time
|
|
228
|
-
*/
|
|
229
|
-
function handleTransactionDtoByFormat(dto, handlers) {
|
|
230
|
-
switch (dto.format) {
|
|
231
|
-
case types_1.TRANSACTION_FORMATS.LEGACY:
|
|
232
|
-
return handlers.legacy(dto);
|
|
233
|
-
case types_1.TRANSACTION_FORMATS.EIP_1559:
|
|
234
|
-
return handlers.eip1559(dto);
|
|
235
|
-
case types_1.TRANSACTION_FORMATS.EIP_2930:
|
|
236
|
-
return handlers.eip2930(dto);
|
|
237
|
-
default:
|
|
238
|
-
// TypeScript will error if we miss a case
|
|
239
|
-
const exhaustiveCheck = dto;
|
|
240
|
-
throw new Error(`Unhandled transaction DTO format: ${exhaustiveCheck}`);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
//# sourceMappingURL=transaction-to-sign.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-to-sign.dto.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/transaction/transaction-to-sign.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAiLA,wD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K,2BAAmB,CAAC,MAAM,CAAC;AACnD,CAAC;AAED,SAAgB,uBAAuB,CAAC,GAAkC;IACxE,OAAO,GAAG,CAAC,MAAM,KAAK,2BAAmB,CAAC,QAAQ,CAAC;AACrD,CAAC;AAED,SAAgB,uBAAuB,CAAC,GAAkC;IACxE,OAAO,GAAG,CAAC,MAAM,KAAK,2BAAmB,CAAC,QAAQ,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,SAAgB,4BAA4B,CAC1C,GAAkC,EAClC,QAIC;IAED,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;QACnB,KAAK,2BAAmB,CAAC,MAAM;YAC7B,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,2BAAmB,CAAC,QAAQ;YAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,2BAAmB,CAAC,QAAQ;YAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B;YACE,0CAA0C;YAC1C,MAAM,eAAe,GAAU,GAAG,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,eAAe,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { BaseTransaction, EIP1559Transaction, EIP2930Transaction, LegacyTransaction, TRANSACTION_FORMATS } from "@explorins/web3-ts/types";
|
|
2
|
-
/**
|
|
3
|
-
* Abstract base DTO for all transaction types
|
|
4
|
-
* Following PERS DDD principles with shared transaction properties
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class BaseTransactionDto implements BaseTransaction {
|
|
7
|
-
chainId: number;
|
|
8
|
-
from: string;
|
|
9
|
-
to: string;
|
|
10
|
-
value: string;
|
|
11
|
-
data: string;
|
|
12
|
-
gas: string;
|
|
13
|
-
nonce: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Legacy transaction DTO (Type 0)
|
|
17
|
-
* Following PERS DDD principles with proper discriminated union support
|
|
18
|
-
*/
|
|
19
|
-
export declare class UnsignedLegacyTransactionDataDto extends BaseTransactionDto implements LegacyTransaction {
|
|
20
|
-
format: typeof TRANSACTION_FORMATS.LEGACY;
|
|
21
|
-
gasPrice: string;
|
|
22
|
-
type?: 0;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* EIP-1559 Fee Market transaction DTO (Type 2)
|
|
26
|
-
* Recommended for PERS loyalty platform for predictable gas costs
|
|
27
|
-
*/
|
|
28
|
-
export declare class UnsignedEIP1559TransactionDataDto extends BaseTransactionDto implements EIP1559Transaction {
|
|
29
|
-
format: typeof TRANSACTION_FORMATS.EIP_1559;
|
|
30
|
-
maxFeePerGas: string;
|
|
31
|
-
maxPriorityFeePerGas: string;
|
|
32
|
-
type: 2;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* EIP-2930 Access List transaction DTO (Type 1)
|
|
36
|
-
* For specific gas optimization scenarios
|
|
37
|
-
*/
|
|
38
|
-
export declare class UnsignedEIP2930TransactionDataDto extends BaseTransactionDto implements EIP2930Transaction {
|
|
39
|
-
format: typeof TRANSACTION_FORMATS.EIP_2930;
|
|
40
|
-
gasPrice: string;
|
|
41
|
-
accessList: Array<{
|
|
42
|
-
address: string;
|
|
43
|
-
storageKeys: string[];
|
|
44
|
-
}>;
|
|
45
|
-
type: 1;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Discriminated union type for all unsigned transaction DTOs
|
|
49
|
-
* Enables type-safe handling across the PERS loyalty platform
|
|
50
|
-
*/
|
|
51
|
-
export type AnyUnsignedTransactionDataDto = UnsignedLegacyTransactionDataDto | UnsignedEIP1559TransactionDataDto | UnsignedEIP2930TransactionDataDto;
|
|
52
|
-
/**
|
|
53
|
-
* Type guard functions for transaction DTO type detection
|
|
54
|
-
* Following PERS type safety principles with runtime validation
|
|
55
|
-
*/
|
|
56
|
-
export declare function isLegacyTransactionDto(dto: AnyUnsignedTransactionDataDto): dto is UnsignedLegacyTransactionDataDto;
|
|
57
|
-
export declare function isEIP1559TransactionDto(dto: AnyUnsignedTransactionDataDto): dto is UnsignedEIP1559TransactionDataDto;
|
|
58
|
-
export declare function isEIP2930TransactionDto(dto: AnyUnsignedTransactionDataDto): dto is UnsignedEIP2930TransactionDataDto;
|
|
59
|
-
/**
|
|
60
|
-
* Exhaustive type checking for transaction DTOs
|
|
61
|
-
* Ensures all transaction formats are handled at compile time
|
|
62
|
-
*/
|
|
63
|
-
export declare function handleTransactionDtoByFormat<T>(dto: AnyUnsignedTransactionDataDto, handlers: {
|
|
64
|
-
legacy: (tx: UnsignedLegacyTransactionDataDto) => T;
|
|
65
|
-
eip1559: (tx: UnsignedEIP1559TransactionDataDto) => T;
|
|
66
|
-
eip2930: (tx: UnsignedEIP2930TransactionDataDto) => T;
|
|
67
|
-
}): T;
|
|
68
|
-
//# sourceMappingURL=transaction-to-sign.dto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-to-sign.dto.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/transaction/transaction-to-sign.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAmC,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG5K;;;GAGG;AACH,8BAAsB,kBAAmB,YAAW,eAAe;IAKjE,OAAO,EAAE,MAAM,CAAK;IAMpB,IAAI,EAAE,MAAM,CAAM;IAMlB,EAAE,EAAE,MAAM,CAAM;IAMhB,KAAK,EAAE,MAAM,CAAM;IAMnB,IAAI,EAAE,MAAM,CAAM;IAMlB,GAAG,EAAE,MAAM,CAAM;IAMjB,KAAK,EAAE,MAAM,CAAK;CACnB;AAID;;;GAGG;AACH,qBAAa,gCAAiC,SAAQ,kBAAmB,YAAW,iBAAiB;IAOnG,MAAM,EAAE,OAAO,mBAAm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K,CAAC,CAAC;CACvD,GACA,CAAC,CAaH"}
|
|
@@ -1,211 +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
|
-
import { TRANSACTION_FORMAT_DESCRIPTIONS, TRANSACTION_FORMATS } from "@explorins/web3-ts/types";
|
|
8
|
-
import { ApiProperty } from "@nestjs/swagger";
|
|
9
|
-
/**
|
|
10
|
-
* Abstract base DTO for all transaction types
|
|
11
|
-
* Following PERS DDD principles with shared transaction properties
|
|
12
|
-
*/
|
|
13
|
-
export class BaseTransactionDto {
|
|
14
|
-
chainId = 0;
|
|
15
|
-
from = '';
|
|
16
|
-
to = '';
|
|
17
|
-
value = '';
|
|
18
|
-
data = '';
|
|
19
|
-
gas = '';
|
|
20
|
-
nonce = 0;
|
|
21
|
-
}
|
|
22
|
-
__decorate([
|
|
23
|
-
ApiProperty({
|
|
24
|
-
description: 'Chain ID of the transaction',
|
|
25
|
-
example: 39123
|
|
26
|
-
})
|
|
27
|
-
], BaseTransactionDto.prototype, "chainId", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
ApiProperty({
|
|
30
|
-
description: 'Transaction from address',
|
|
31
|
-
example: '0xa70ecdec5ff1b0577f6627a594f55d55fcaafb33'
|
|
32
|
-
})
|
|
33
|
-
], BaseTransactionDto.prototype, "from", void 0);
|
|
34
|
-
__decorate([
|
|
35
|
-
ApiProperty({
|
|
36
|
-
description: 'Transaction to address (contract)',
|
|
37
|
-
example: '0x2661b159EA679eFD6Cc884a79A838FCabbDcA7F2'
|
|
38
|
-
})
|
|
39
|
-
], BaseTransactionDto.prototype, "to", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
ApiProperty({
|
|
42
|
-
description: 'Transaction value in wei',
|
|
43
|
-
example: '0'
|
|
44
|
-
})
|
|
45
|
-
], BaseTransactionDto.prototype, "value", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
ApiProperty({
|
|
48
|
-
description: 'Transaction data (hex encoded)',
|
|
49
|
-
example: '0x99ab696062659702d42d66ee5fade613c4370d498e5e5c119a5353089a3ce258'
|
|
50
|
-
})
|
|
51
|
-
], BaseTransactionDto.prototype, "data", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
ApiProperty({
|
|
54
|
-
description: 'Gas limit',
|
|
55
|
-
example: '157211'
|
|
56
|
-
})
|
|
57
|
-
], BaseTransactionDto.prototype, "gas", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
ApiProperty({
|
|
60
|
-
description: 'Transaction nonce',
|
|
61
|
-
example: 1
|
|
62
|
-
})
|
|
63
|
-
], BaseTransactionDto.prototype, "nonce", void 0);
|
|
64
|
-
/**
|
|
65
|
-
* Legacy transaction DTO (Type 0)
|
|
66
|
-
* Following PERS DDD principles with proper discriminated union support
|
|
67
|
-
*/
|
|
68
|
-
export class UnsignedLegacyTransactionDataDto extends BaseTransactionDto {
|
|
69
|
-
format = TRANSACTION_FORMATS.LEGACY;
|
|
70
|
-
gasPrice = '';
|
|
71
|
-
type = 0;
|
|
72
|
-
}
|
|
73
|
-
__decorate([
|
|
74
|
-
ApiProperty({
|
|
75
|
-
description: TRANSACTION_FORMAT_DESCRIPTIONS[TRANSACTION_FORMATS.LEGACY],
|
|
76
|
-
enum: Object.values(TRANSACTION_FORMATS),
|
|
77
|
-
example: TRANSACTION_FORMATS.LEGACY,
|
|
78
|
-
default: TRANSACTION_FORMATS.LEGACY
|
|
79
|
-
})
|
|
80
|
-
], UnsignedLegacyTransactionDataDto.prototype, "format", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
ApiProperty({
|
|
83
|
-
description: 'Gas price in wei (legacy pricing mechanism)',
|
|
84
|
-
example: '20000000000'
|
|
85
|
-
})
|
|
86
|
-
], UnsignedLegacyTransactionDataDto.prototype, "gasPrice", void 0);
|
|
87
|
-
__decorate([
|
|
88
|
-
ApiProperty({
|
|
89
|
-
description: 'Transaction type (0 for legacy)',
|
|
90
|
-
example: 0,
|
|
91
|
-
default: 0,
|
|
92
|
-
required: false
|
|
93
|
-
})
|
|
94
|
-
], UnsignedLegacyTransactionDataDto.prototype, "type", void 0);
|
|
95
|
-
/**
|
|
96
|
-
* EIP-1559 Fee Market transaction DTO (Type 2)
|
|
97
|
-
* Recommended for PERS loyalty platform for predictable gas costs
|
|
98
|
-
*/
|
|
99
|
-
export class UnsignedEIP1559TransactionDataDto extends BaseTransactionDto {
|
|
100
|
-
format = TRANSACTION_FORMATS.EIP_1559;
|
|
101
|
-
maxFeePerGas = '';
|
|
102
|
-
maxPriorityFeePerGas = '';
|
|
103
|
-
type = 2;
|
|
104
|
-
}
|
|
105
|
-
__decorate([
|
|
106
|
-
ApiProperty({
|
|
107
|
-
description: TRANSACTION_FORMAT_DESCRIPTIONS[TRANSACTION_FORMATS.EIP_1559],
|
|
108
|
-
enum: Object.values(TRANSACTION_FORMATS),
|
|
109
|
-
example: TRANSACTION_FORMATS.EIP_1559,
|
|
110
|
-
default: TRANSACTION_FORMATS.EIP_1559
|
|
111
|
-
})
|
|
112
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "format", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
ApiProperty({
|
|
115
|
-
description: 'Maximum fee per gas willing to pay (EIP-1559)',
|
|
116
|
-
example: '20000000000'
|
|
117
|
-
})
|
|
118
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "maxFeePerGas", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
ApiProperty({
|
|
121
|
-
description: 'Maximum priority fee per gas (tip to miners)',
|
|
122
|
-
example: '2000000000'
|
|
123
|
-
})
|
|
124
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "maxPriorityFeePerGas", void 0);
|
|
125
|
-
__decorate([
|
|
126
|
-
ApiProperty({
|
|
127
|
-
description: 'Transaction type (2 for EIP-1559)',
|
|
128
|
-
example: 2,
|
|
129
|
-
default: 2
|
|
130
|
-
})
|
|
131
|
-
], UnsignedEIP1559TransactionDataDto.prototype, "type", void 0);
|
|
132
|
-
/**
|
|
133
|
-
* EIP-2930 Access List transaction DTO (Type 1)
|
|
134
|
-
* For specific gas optimization scenarios
|
|
135
|
-
*/
|
|
136
|
-
export class UnsignedEIP2930TransactionDataDto extends BaseTransactionDto {
|
|
137
|
-
format = TRANSACTION_FORMATS.EIP_2930;
|
|
138
|
-
gasPrice = '';
|
|
139
|
-
accessList = [];
|
|
140
|
-
type = 1;
|
|
141
|
-
}
|
|
142
|
-
__decorate([
|
|
143
|
-
ApiProperty({
|
|
144
|
-
description: TRANSACTION_FORMAT_DESCRIPTIONS[TRANSACTION_FORMATS.EIP_2930],
|
|
145
|
-
enum: Object.values(TRANSACTION_FORMATS),
|
|
146
|
-
example: TRANSACTION_FORMATS.EIP_2930,
|
|
147
|
-
default: TRANSACTION_FORMATS.EIP_2930
|
|
148
|
-
})
|
|
149
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "format", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
ApiProperty({
|
|
152
|
-
description: 'Gas price in wei (legacy pricing for EIP-2930)',
|
|
153
|
-
example: '20000000000'
|
|
154
|
-
})
|
|
155
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "gasPrice", void 0);
|
|
156
|
-
__decorate([
|
|
157
|
-
ApiProperty({
|
|
158
|
-
description: 'Access list for storage slot pre-warming',
|
|
159
|
-
type: 'array',
|
|
160
|
-
items: {
|
|
161
|
-
type: 'object',
|
|
162
|
-
properties: {
|
|
163
|
-
address: { type: 'string', example: '0x2661b159EA679eFD6Cc884a79A838FCabbDcA7F2' },
|
|
164
|
-
storageKeys: {
|
|
165
|
-
type: 'array',
|
|
166
|
-
items: { type: 'string' },
|
|
167
|
-
example: ['0x0000000000000000000000000000000000000000000000000000000000000000']
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
})
|
|
172
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "accessList", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
ApiProperty({
|
|
175
|
-
description: 'Transaction type (1 for EIP-2930)',
|
|
176
|
-
example: 1,
|
|
177
|
-
default: 1
|
|
178
|
-
})
|
|
179
|
-
], UnsignedEIP2930TransactionDataDto.prototype, "type", void 0);
|
|
180
|
-
/**
|
|
181
|
-
* Type guard functions for transaction DTO type detection
|
|
182
|
-
* Following PERS type safety principles with runtime validation
|
|
183
|
-
*/
|
|
184
|
-
export function isLegacyTransactionDto(dto) {
|
|
185
|
-
return dto.format === TRANSACTION_FORMATS.LEGACY;
|
|
186
|
-
}
|
|
187
|
-
export function isEIP1559TransactionDto(dto) {
|
|
188
|
-
return dto.format === TRANSACTION_FORMATS.EIP_1559;
|
|
189
|
-
}
|
|
190
|
-
export function isEIP2930TransactionDto(dto) {
|
|
191
|
-
return dto.format === TRANSACTION_FORMATS.EIP_2930;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Exhaustive type checking for transaction DTOs
|
|
195
|
-
* Ensures all transaction formats are handled at compile time
|
|
196
|
-
*/
|
|
197
|
-
export function handleTransactionDtoByFormat(dto, handlers) {
|
|
198
|
-
switch (dto.format) {
|
|
199
|
-
case TRANSACTION_FORMATS.LEGACY:
|
|
200
|
-
return handlers.legacy(dto);
|
|
201
|
-
case TRANSACTION_FORMATS.EIP_1559:
|
|
202
|
-
return handlers.eip1559(dto);
|
|
203
|
-
case TRANSACTION_FORMATS.EIP_2930:
|
|
204
|
-
return handlers.eip2930(dto);
|
|
205
|
-
default:
|
|
206
|
-
// TypeScript will error if we miss a case
|
|
207
|
-
const exhaustiveCheck = dto;
|
|
208
|
-
throw new Error(`Unhandled transaction DTO format: ${exhaustiveCheck}`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
//# sourceMappingURL=transaction-to-sign.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-to-sign.dto.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/transaction/transaction-to-sign.dto.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAA8E,+BAA+B,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC5K,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;GAGG;AACH,MAAM,OAAgB,kBAAkB;IAKtC,OAAO,GAAW,CAAC,CAAC;IAMpB,IAAI,GAAW,EAAE,CAAC;IAMlB,EAAE,GAAW,EAAE,CAAC;IAMhB,KAAK,GAAW,EAAE,CAAC;IAMnB,IAAI,GAAW,EAAE,CAAC;IAMlB,GAAG,GAAW,EAAE,CAAC;IAMjB,KAAK,GAAW,CAAC,CAAC;CACnB;AArCC;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,KAAK;KACf,CAAC;mDACkB;AAMpB;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,4CAA4C;KACtD,CAAC;gDACgB;AAMlB;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,4CAA4C;KACtD,CAAC;8CACc;AAMhB;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,GAAG;KACb,CAAC;iDACiB;AAMnB;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,oEAAoE;KAC9E,CAAC;gDACgB;AAMlB;IAJC,WAAW,CAAC;QACX,WAAW,EAAE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