Skip to content

Commit be9a36d

Browse files
authored
Merge pull request #369 from NEMStudios/task/g353_max_fee
Task/g353 max fee
2 parents cbdb3c1 + 6570db3 commit be9a36d

29 files changed

+635
-160
lines changed

src/model/transaction/AccountAddressRestrictionTransaction.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,13 @@ export class AccountAddressRestrictionTransaction extends Transaction {
199199
*/
200200
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountAddressRestrictionTransaction {
201201
const transactionInfo = this.checkTransactionHeightAndIndex();
202-
return new AccountAddressRestrictionTransaction(
203-
this.networkType,
204-
this.version,
205-
this.deadline,
206-
this.maxFee,
207-
this.restrictionFlags,
208-
this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(),
209-
transactionInfo.index, aggregateTransactionIndex)),
210-
this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(),
211-
transactionInfo.index, aggregateTransactionIndex)),
212-
this.signature,
213-
this.signer,
214-
this.transactionInfo,
215-
);
202+
return {...Object.getPrototypeOf(this),
203+
restrictionAdditions:
204+
this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(),
205+
transactionInfo.index, aggregateTransactionIndex)),
206+
restrictionDeletions:
207+
this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(),
208+
transactionInfo.index, aggregateTransactionIndex)),
209+
};
216210
}
217211
}

src/model/transaction/AccountMosaicRestrictionTransaction.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,13 @@ export class AccountMosaicRestrictionTransaction extends Transaction {
199199
*/
200200
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountMosaicRestrictionTransaction {
201201
const transactionInfo = this.checkTransactionHeightAndIndex();
202-
return new AccountMosaicRestrictionTransaction(
203-
this.networkType,
204-
this.version,
205-
this.deadline,
206-
this.maxFee,
207-
this.restrictionFlags,
208-
this.restrictionAdditions.map((addition) => statement.resolveMosaicId(addition, transactionInfo.height.toString(),
209-
transactionInfo.index, aggregateTransactionIndex)),
210-
this.restrictionDeletions.map((deletion) => statement.resolveMosaicId(deletion, transactionInfo.height.toString(),
211-
transactionInfo.index, aggregateTransactionIndex)),
212-
this.signature,
213-
this.signer,
214-
this.transactionInfo,
215-
);
202+
return {...Object.getPrototypeOf(this),
203+
restrictionAdditions:
204+
this.restrictionAdditions.map((addition) => statement.resolveMosaicId(addition, transactionInfo.height.toString(),
205+
transactionInfo.index, aggregateTransactionIndex)),
206+
restrictionDeletions:
207+
this.restrictionDeletions.map((deletion) => statement.resolveMosaicId(deletion, transactionInfo.height.toString(),
208+
transactionInfo.index, aggregateTransactionIndex)),
209+
};
216210
}
217211
}

src/model/transaction/AggregateTransaction.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -407,18 +407,8 @@ export class AggregateTransaction extends Transaction {
407407
*/
408408
resolveAliases(statement: Statement): AggregateTransaction {
409409
const transactionInfo = this.checkTransactionHeightAndIndex();
410-
return new AggregateTransaction(
411-
this.networkType,
412-
this.type,
413-
this.version,
414-
this.deadline,
415-
this.maxFee,
416-
this.innerTransactions.map((tx) => tx.resolveAliases(statement, transactionInfo.index))
417-
.sort((a, b) => a.transactionInfo!.index - b.transactionInfo!.index),
418-
this.cosignatures,
419-
this.signature,
420-
this.signer,
421-
this.transactionInfo,
422-
);
410+
return Object.assign({__proto__: Object.getPrototypeOf(this)}, this,
411+
{innerTransactions: this.innerTransactions.map((tx) => tx.resolveAliases(statement, transactionInfo.index))
412+
.sort((a, b) => a.transactionInfo!.index - b.transactionInfo!.index)});
423413
}
424414
}

src/model/transaction/LockFundsTransaction.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,8 @@ export class LockFundsTransaction extends Transaction {
212212
*/
213213
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): LockFundsTransaction {
214214
const transactionInfo = this.checkTransactionHeightAndIndex();
215-
return new LockFundsTransaction(
216-
this.networkType,
217-
this.version,
218-
this.deadline,
219-
this.maxFee,
220-
statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(),
221-
transactionInfo.index, aggregateTransactionIndex),
222-
this.duration,
223-
this.signedTransaction,
224-
this.signature,
225-
this.signer,
226-
this.transactionInfo,
227-
);
215+
return {...Object.getPrototypeOf(this),
216+
mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(),
217+
transactionInfo.index, aggregateTransactionIndex)};
228218
}
229219
}

src/model/transaction/MosaicAddressRestrictionTransaction.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction {
243243
*/
244244
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicAddressRestrictionTransaction {
245245
const transactionInfo = this.checkTransactionHeightAndIndex();
246-
return new MosaicAddressRestrictionTransaction(
247-
this.networkType,
248-
this.version,
249-
this.deadline,
250-
this.maxFee,
251-
statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(),
246+
return {...Object.getPrototypeOf(this),
247+
mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(),
252248
transactionInfo.index, aggregateTransactionIndex),
253-
this.restrictionKey,
254-
statement.resolveAddress(this.targetAddress,
255-
transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex),
256-
this.previousRestrictionValue,
257-
this.newRestrictionValue,
258-
this.signature,
259-
this.signer,
260-
this.transactionInfo,
261-
);
249+
targetAddress: statement.resolveAddress(this.targetAddress,
250+
transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)};
262251
}
263252
}

src/model/transaction/MosaicGlobalRestrictionTransaction.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction {
253253
*/
254254
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicGlobalRestrictionTransaction {
255255
const transactionInfo = this.checkTransactionHeightAndIndex();
256-
return new MosaicGlobalRestrictionTransaction(
257-
this.networkType,
258-
this.version,
259-
this.deadline,
260-
this.maxFee,
261-
statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(),
256+
return {...Object.getPrototypeOf(this),
257+
mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(),
262258
transactionInfo.index, aggregateTransactionIndex),
263-
statement.resolveMosaicId(this.referenceMosaicId, transactionInfo.height.toString(),
264-
transactionInfo.index, aggregateTransactionIndex),
265-
this.restrictionKey,
266-
this.previousRestrictionValue,
267-
this.previousRestrictionType,
268-
this.newRestrictionValue,
269-
this.newRestrictionType,
270-
this.signature,
271-
this.signer,
272-
this.transactionInfo,
273-
);
259+
referenceMosaicId: statement.resolveMosaicId(this.referenceMosaicId, transactionInfo.height.toString(),
260+
transactionInfo.index, aggregateTransactionIndex)};
274261
}
275262
}

src/model/transaction/MosaicMetadataTransaction.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,8 @@ export class MosaicMetadataTransaction extends Transaction {
219219
*/
220220
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicMetadataTransaction {
221221
const transactionInfo = this.checkTransactionHeightAndIndex();
222-
return new MosaicMetadataTransaction(
223-
this.networkType,
224-
this.version,
225-
this.deadline,
226-
this.maxFee,
227-
this.targetPublicKey,
228-
this.scopedMetadataKey,
229-
statement.resolveMosaicId(this.targetMosaicId, transactionInfo.height.toString(),
230-
transactionInfo.index, aggregateTransactionIndex),
231-
this.valueSizeDelta,
232-
this.value,
233-
this.signature,
234-
this.signer,
235-
this.transactionInfo,
236-
);
222+
return {...Object.getPrototypeOf(this),
223+
targetMosaicId: statement.resolveMosaicId(this.targetMosaicId, transactionInfo.height.toString(),
224+
transactionInfo.index, aggregateTransactionIndex)};
237225
}
238226
}

src/model/transaction/MosaicSupplyChangeTransaction.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,8 @@ export class MosaicSupplyChangeTransaction extends Transaction {
193193
*/
194194
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicSupplyChangeTransaction {
195195
const transactionInfo = this.checkTransactionHeightAndIndex();
196-
return new MosaicSupplyChangeTransaction(
197-
this.networkType,
198-
this.version,
199-
this.deadline,
200-
this.maxFee,
201-
statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(),
202-
transactionInfo.index, aggregateTransactionIndex),
203-
this.action,
204-
this.delta,
205-
this.signature,
206-
this.signer,
207-
this.transactionInfo,
208-
);
196+
return {...Object.getPrototypeOf(this),
197+
mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(),
198+
transactionInfo.index, aggregateTransactionIndex)};
209199
}
210200
}

src/model/transaction/SecretLockTransaction.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,10 @@ export class SecretLockTransaction extends Transaction {
240240
*/
241241
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretLockTransaction {
242242
const transactionInfo = this.checkTransactionHeightAndIndex();
243-
return new SecretLockTransaction(
244-
this.networkType,
245-
this.version,
246-
this.deadline,
247-
this.maxFee,
248-
statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(),
249-
transactionInfo.index, aggregateTransactionIndex),
250-
this.duration,
251-
this.hashType,
252-
this.secret,
253-
statement.resolveAddress(this.recipientAddress,
243+
return {...Object.getPrototypeOf(this),
244+
recipientAddress: statement.resolveAddress(this.recipientAddress,
254245
transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex),
255-
this.signature,
256-
this.signer,
257-
this.transactionInfo,
258-
);
246+
mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(),
247+
transactionInfo.index, aggregateTransactionIndex)};
259248
}
260249
}

src/model/transaction/SecretProofTransaction.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,8 @@ export class SecretProofTransaction extends Transaction {
223223
*/
224224
resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretProofTransaction {
225225
const transactionInfo = this.checkTransactionHeightAndIndex();
226-
return new SecretProofTransaction(
227-
this.networkType,
228-
this.version,
229-
this.deadline,
230-
this.maxFee,
231-
this.hashType,
232-
this.secret,
233-
statement.resolveAddress(this.recipientAddress,
234-
transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex),
235-
this.proof,
236-
this.signature,
237-
this.signer,
238-
this.transactionInfo,
239-
);
226+
return {...Object.getPrototypeOf(this),
227+
recipientAddress: statement.resolveAddress(this.recipientAddress,
228+
transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)};
240229
}
241230
}

0 commit comments

Comments
 (0)