Skip to content

Commit f4c9cbb

Browse files
rg911Greg S
authored andcommitted
initlal checkin. Added maFee to transaction models
1 parent cfb1773 commit f4c9cbb

File tree

8 files changed

+55
-38
lines changed

8 files changed

+55
-38
lines changed

src/model/transaction/AddressAliasTransaction.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@ export class AddressAliasTransaction extends Transaction {
3636
/**
3737
* Create a mosaic supply change transaction object
3838
* @param deadline - The deadline to include the transaction.
39+
* @param maxFee - Max fee defined by the sender
3940
* @param actionType - The namespace id.
4041
* @param namespaceId - The namespace id.
4142
* @param mosaicId - The mosaic id.
4243
* @param networkType - The network type.
4344
* @returns {AddressAliasTransaction}
4445
*/
4546
public static create(deadline: Deadline,
47+
maxFee: UInt64,
4648
actionType: AliasActionType,
4749
namespaceId: NamespaceId,
4850
address: Address,
4951
networkType: NetworkType): AddressAliasTransaction {
5052
return new AddressAliasTransaction(networkType,
5153
TransactionVersion.ADDRESS_ALIAS,
5254
deadline,
53-
new UInt64([0, 0]),
55+
maxFee,
5456
actionType,
5557
namespaceId,
5658
address,
@@ -61,7 +63,7 @@ export class AddressAliasTransaction extends Transaction {
6163
* @param networkType
6264
* @param version
6365
* @param deadline
64-
* @param fee
66+
* @param maxFee
6567
* @param actionType
6668
* @param namespaceId
6769
* @param address
@@ -72,7 +74,7 @@ export class AddressAliasTransaction extends Transaction {
7274
constructor(networkType: NetworkType,
7375
version: number,
7476
deadline: Deadline,
75-
fee: UInt64,
77+
maxFee: UInt64,
7678
/**
7779
* The alias action type.
7880
*/
@@ -98,7 +100,7 @@ export class AddressAliasTransaction extends Transaction {
98100
protected buildTransaction(): VerifiableTransaction {
99101
return new AddressAliasTransactionLibrary.Builder()
100102
.addDeadline(this.deadline.toDTO())
101-
.addFee(this.fee.toDTO())
103+
.addFee(this.maxFee.toDTO())
102104
.addVersion(this.versionToDTO())
103105
.addActionType(this.actionType)
104106
.addNamespaceId(this.namespaceId.id.toDTO())

src/model/transaction/AggregateTransaction.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class AggregateTransaction extends Transaction {
3838
* @param type
3939
* @param version
4040
* @param deadline
41-
* @param fee
41+
* @param maxFee
4242
* @param innerTransactions
4343
* @param cosignatures
4444
* @param signature
@@ -49,7 +49,7 @@ export class AggregateTransaction extends Transaction {
4949
type: number,
5050
version: number,
5151
deadline: Deadline,
52-
fee: UInt64,
52+
maxFee: UInt64,
5353
/**
5454
* The array of innerTransactions included in the aggregate transaction.
5555
*/
@@ -61,26 +61,28 @@ export class AggregateTransaction extends Transaction {
6161
signature?: string,
6262
signer?: PublicAccount,
6363
transactionInfo?: TransactionInfo) {
64-
super(type, networkType, version, deadline, fee, signature, signer, transactionInfo);
64+
super(type, networkType, version, deadline, maxFee, signature, signer, transactionInfo);
6565
}
6666

6767
/**
6868
* Create an aggregate complete transaction object
6969
* @param deadline - The deadline to include the transaction.
70+
* @param {maxFee} maxFee
7071
* @param innerTransactions - The array of inner innerTransactions.
7172
* @param networkType - The network type.
7273
* @param cosignatures
7374
* @returns {AggregateTransaction}
7475
*/
7576
public static createComplete(deadline: Deadline,
77+
maxFee: UInt64,
7678
innerTransactions: InnerTransaction[],
7779
networkType: NetworkType,
7880
cosignatures: AggregateTransactionCosignature[]): AggregateTransaction {
7981
return new AggregateTransaction(networkType,
8082
TransactionType.AGGREGATE_COMPLETE,
8183
TransactionVersion.AGGREGATE_COMPLETE,
8284
deadline,
83-
new UInt64([0, 0]),
85+
maxFee,
8486
innerTransactions,
8587
cosignatures,
8688
);
@@ -89,20 +91,22 @@ export class AggregateTransaction extends Transaction {
8991
/**
9092
* Create an aggregate bonded transaction object
9193
* @param {Deadline} deadline
94+
* @param {maxFee} maxFee
9295
* @param {InnerTransaction[]} innerTransactions
9396
* @param {NetworkType} networkType
9497
* @param {AggregateTransactionCosignature[]} cosignatures
9598
* @return {AggregateTransaction}
9699
*/
97100
public static createBonded(deadline: Deadline,
101+
maxFee: UInt64,
98102
innerTransactions: InnerTransaction[],
99103
networkType: NetworkType,
100104
cosignatures: AggregateTransactionCosignature[] = []): AggregateTransaction {
101105
return new AggregateTransaction(networkType,
102106
TransactionType.AGGREGATE_BONDED,
103107
TransactionVersion.AGGREGATE_BONDED,
104108
deadline,
105-
new UInt64([0, 0]),
109+
maxFee,
106110
innerTransactions,
107111
cosignatures,
108112
);
@@ -116,7 +120,7 @@ export class AggregateTransaction extends Transaction {
116120
return new AggregateTransactionLibrary.Builder()
117121
.addDeadline(this.deadline.toDTO())
118122
.addType(this.type)
119-
.addFee(this.fee.toDTO())
123+
.addFee(this.maxFee.toDTO())
120124
.addVersion(this.versionToDTO())
121125
.addTransactions(this.innerTransactions.map((transaction) => {
122126
return transaction.aggregateTransaction();

src/model/transaction/AliasTransaction.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,39 @@ export abstract class AliasTransaction extends Transaction {
3535
/**
3636
* Create an address alias transaction object
3737
* @param deadline - The deadline to include the transaction.
38+
* @param maxFee - Max fee defined by the sender
3839
* @param aliasAction - The namespace id.
3940
* @param namespaceId - The namespace id.
4041
* @param address - The address.
4142
* @param networkType - The network type.
4243
* @returns {AddressAliasTransaction}
4344
*/
4445
public static createForAddress(deadline: Deadline,
46+
maxFee: UInt64,
4547
aliasAction: AliasActionType,
4648
namespaceId: NamespaceId,
4749
address: Address,
4850
networkType: NetworkType): AliasTransaction {
49-
return AddressAliasTransaction.create(deadline, aliasAction, namespaceId, address, networkType);
51+
return AddressAliasTransaction.create(deadline, maxFee, aliasAction, namespaceId, address, networkType);
5052
}
5153

5254
/**
5355
* Create a mosaic alias transaction object
5456
* @param deadline - The deadline to include the transaction.
57+
* @param maxFee - Max fee defined by the sender
5558
* @param aliasAction - The namespace id.
5659
* @param namespaceId - The namespace id.
5760
* @param mosaicId - The mosaic id.
5861
* @param networkType - The network type.
5962
* @returns {MosaicAliasTransaction}
6063
*/
6164
public static createForMosaic(deadline: Deadline,
65+
maxFee: UInt64,
6266
aliasAction: AliasActionType,
6367
namespaceId: NamespaceId,
6468
mosaicId: MosaicId,
6569
networkType: NetworkType): AliasTransaction {
66-
return MosaicAliasTransaction.create(deadline, aliasAction, namespaceId, mosaicId, networkType);
70+
return MosaicAliasTransaction.create(deadline, maxFee, aliasAction, namespaceId, mosaicId, networkType);
6771
}
6872

6973
}

src/model/transaction/LockFundsTransaction.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@ export class LockFundsTransaction extends Transaction {
4242
/**
4343
* Create a Lock funds transaction object
4444
* @param deadline - The deadline to include the transaction.
45+
* @param maxFee - Max fee defined by the sender
4546
* @param mosaic - The locked mosaic.
4647
* @param duration - The funds lock duration.
4748
* @param signedTransaction - The signed transaction for which funds are locked.
4849
* @param networkType - The network type.
4950
*/
5051
public static create(deadline: Deadline,
52+
maxFee: UInt64,
5153
mosaic: Mosaic,
5254
duration: UInt64,
5355
signedTransaction: SignedTransaction,
@@ -56,7 +58,7 @@ export class LockFundsTransaction extends Transaction {
5658
networkType,
5759
TransactionVersion.LOCK,
5860
deadline,
59-
UInt64.fromUint(0),
61+
maxFee,
6062
mosaic,
6163
duration,
6264
signedTransaction,
@@ -67,7 +69,7 @@ export class LockFundsTransaction extends Transaction {
6769
* @param networkType
6870
* @param version
6971
* @param deadline
70-
* @param fee
72+
* @param maxFee
7173
* @param mosaic
7274
* @param duration
7375
* @param signedTransaction
@@ -78,7 +80,7 @@ export class LockFundsTransaction extends Transaction {
7880
constructor(networkType: NetworkType,
7981
version: number,
8082
deadline: Deadline,
81-
fee: UInt64,
83+
maxFee: UInt64,
8284
/**
8385
* The locked mosaic.
8486
*/
@@ -91,7 +93,7 @@ export class LockFundsTransaction extends Transaction {
9193
signature?: string,
9294
signer?: PublicAccount,
9395
transactionInfo?: TransactionInfo) {
94-
super(TransactionType.LOCK, networkType, version, deadline, fee, signature, signer, transactionInfo);
96+
super(TransactionType.LOCK, networkType, version, deadline, maxFee, signature, signer, transactionInfo);
9597
this.hash = signedTransaction.hash;
9698
if (signedTransaction.type !== TransactionType.AGGREGATE_BONDED) {
9799
throw new Error('Signed transaction must be Aggregate Bonded Transaction');
@@ -106,7 +108,7 @@ export class LockFundsTransaction extends Transaction {
106108
return new HashLockTransaction.Builder()
107109
.addDeadline(this.deadline.toDTO())
108110
.addType(this.type)
109-
.addFee(this.fee.toDTO())
111+
.addFee(this.maxFee.toDTO())
110112
.addVersion(this.versionToDTO())
111113
.addMosaicId(this.mosaic.id.id.toDTO())
112114
.addMosaicAmount(this.mosaic.amount.toDTO())

src/model/transaction/ModifyMultisigAccountTransaction.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@ export class ModifyMultisigAccountTransaction extends Transaction {
3636
/**
3737
* Create a modify multisig account transaction object
3838
* @param deadline - The deadline to include the transaction.
39+
* @param maxFee - Max fee defined by the sender
3940
* @param minApprovalDelta - The min approval relative change.
4041
* @param minRemovalDelta - The min removal relative change.
4142
* @param modifications - The array of modifications.
4243
* @param networkType - The network type.
4344
* @returns {ModifyMultisigAccountTransaction}
4445
*/
4546
public static create(deadline: Deadline,
47+
maxFee: UInt64,
4648
minApprovalDelta: number,
4749
minRemovalDelta: number,
4850
modifications: MultisigCosignatoryModification[],
4951
networkType: NetworkType): ModifyMultisigAccountTransaction {
5052
return new ModifyMultisigAccountTransaction(networkType,
5153
TransactionVersion.MODIFY_MULTISIG_ACCOUNT,
5254
deadline,
53-
new UInt64([0, 0]),
55+
maxFee,
5456
minApprovalDelta,
5557
minRemovalDelta,
5658
modifications);
@@ -60,7 +62,7 @@ export class ModifyMultisigAccountTransaction extends Transaction {
6062
* @param networkType
6163
* @param version
6264
* @param deadline
63-
* @param fee
65+
* @param maxFee
6466
* @param minApprovalDelta
6567
* @param minRemovalDelta
6668
* @param modifications
@@ -71,7 +73,7 @@ export class ModifyMultisigAccountTransaction extends Transaction {
7173
constructor(networkType: NetworkType,
7274
version: number,
7375
deadline: Deadline,
74-
fee: UInt64,
76+
maxFee: UInt64,
7577
/**
7678
* The number of signatures needed to approve a transaction.
7779
* If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories.
@@ -89,7 +91,7 @@ export class ModifyMultisigAccountTransaction extends Transaction {
8991
signature?: string,
9092
signer?: PublicAccount,
9193
transactionInfo?: TransactionInfo) {
92-
super(TransactionType.MODIFY_MULTISIG_ACCOUNT, networkType, version, deadline, fee, signature, signer, transactionInfo);
94+
super(TransactionType.MODIFY_MULTISIG_ACCOUNT, networkType, version, deadline, maxFee, signature, signer, transactionInfo);
9395
}
9496

9597
/**
@@ -99,7 +101,7 @@ export class ModifyMultisigAccountTransaction extends Transaction {
99101
protected buildTransaction(): VerifiableTransaction {
100102
return new ModifyMultisigAccountTransactionLibrary.Builder()
101103
.addDeadline(this.deadline.toDTO())
102-
.addFee(this.fee.toDTO())
104+
.addFee(this.maxFee.toDTO())
103105
.addVersion(this.versionToDTO())
104106
.addMinApprovalDelta(this.minApprovalDelta)
105107
.addMinRemovalDelta(this.minRemovalDelta)

src/model/transaction/MosaicAliasTransaction.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@ export class MosaicAliasTransaction extends Transaction {
3636
/**
3737
* Create a mosaic supply change transaction object
3838
* @param deadline - The deadline to include the transaction.
39+
* @param maxFee - Max fee defined by the sender
3940
* @param actionType - The namespace id.
4041
* @param namespaceId - The namespace id.
4142
* @param mosaicId - The mosaic id.
4243
* @param networkType - The network type.
4344
* @returns {MosaicAliasTransaction}
4445
*/
4546
public static create(deadline: Deadline,
47+
maxFee: UInt64,
4648
actionType: AliasActionType,
4749
namespaceId: NamespaceId,
4850
mosaicId: MosaicId,
4951
networkType: NetworkType): MosaicAliasTransaction {
5052
return new MosaicAliasTransaction(networkType,
5153
TransactionVersion.MOSAIC_ALIAS,
5254
deadline,
53-
new UInt64([0, 0]),
55+
maxFee,
5456
actionType,
5557
namespaceId,
5658
mosaicId,
@@ -61,7 +63,7 @@ export class MosaicAliasTransaction extends Transaction {
6163
* @param networkType
6264
* @param version
6365
* @param deadline
64-
* @param fee
66+
* @param maxFee
6567
* @param actionType
6668
* @param namespaceId
6769
* @param mosaicId
@@ -72,7 +74,7 @@ export class MosaicAliasTransaction extends Transaction {
7274
constructor(networkType: NetworkType,
7375
version: number,
7476
deadline: Deadline,
75-
fee: UInt64,
77+
maxFee: UInt64,
7678
/**
7779
* The alias action type.
7880
*/
@@ -88,7 +90,7 @@ export class MosaicAliasTransaction extends Transaction {
8890
signature?: string,
8991
signer?: PublicAccount,
9092
transactionInfo?: TransactionInfo) {
91-
super(TransactionType.MOSAIC_ALIAS, networkType, version, deadline, fee, signature, signer, transactionInfo);
93+
super(TransactionType.MOSAIC_ALIAS, networkType, version, deadline, maxFee, signature, signer, transactionInfo);
9294
}
9395

9496
/**
@@ -98,7 +100,7 @@ export class MosaicAliasTransaction extends Transaction {
98100
protected buildTransaction(): VerifiableTransaction {
99101
return new MosaicAliasTransactionLibrary.Builder()
100102
.addDeadline(this.deadline.toDTO())
101-
.addFee(this.fee.toDTO())
103+
.addFee(this.maxFee.toDTO())
102104
.addVersion(this.versionToDTO())
103105
.addActionType(this.actionType)
104106
.addNamespaceId(this.namespaceId.id.toDTO())

0 commit comments

Comments
 (0)