Skip to content

Commit e6c5171

Browse files
committed
Removed static version number
added versionDtoToHex()
1 parent 4916ab6 commit e6c5171

19 files changed

+172
-181
lines changed

src/infrastructure/builders/AccountLinkTransaction.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@
1818
* @module transactions/AccountLinkTransaction
1919
*/
2020
import { Convert as convert } from '../../core/format';
21+
import { TransactionType } from '../../model/transaction/TransactionType';
2122
import AccountLinkTransactionBufferPackage from '../buffers/AccountLinkTransactionBuffer';
2223
import AccountLinkTransactionSchema from '../schemas/AccountLinkTransactionSchema';
23-
import {
24-
VerifiableTransaction,
25-
} from './VerifiableTransaction';
24+
import {VerifiableTransaction} from './VerifiableTransaction';
2625

27-
const {
28-
flatbuffers,
29-
} = require('flatbuffers');
26+
import {flatbuffers} from 'flatbuffers';
3027

3128
const {
3229
AccountLinkTransactionBuffer,
@@ -40,20 +37,19 @@ export class AccountLinkTransaction extends VerifiableTransaction {
4037

4138
// tslint:disable-next-line:max-classes-per-file
4239
export class Builder {
43-
fee: any;
40+
maxFee: any;
4441
version: any;
4542
type: any;
4643
deadline: any;
4744
remoteAccountKey: any;
4845
linkAction: any;
4946
constructor() {
50-
this.fee = [0, 0];
51-
this.version = 36865;
52-
this.type = 0x414C;
47+
this.maxFee = [0, 0];
48+
this.type = TransactionType.LINK_ACCOUNT;
5349
}
5450

55-
addFee(fee) {
56-
this.fee = fee;
51+
addFee(maxFee) {
52+
this.maxFee = maxFee;
5753
return this;
5854
}
5955

@@ -89,7 +85,7 @@ export class Builder {
8985
.createSignatureVector(builder, Array(...Array(64)).map(Number.prototype.valueOf, 0));
9086
const signerVector = AccountLinkTransactionBuffer.createSignerVector(builder, Array(...Array(32)).map(Number.prototype.valueOf, 0));
9187
const deadlineVector = AccountLinkTransactionBuffer.createDeadlineVector(builder, this.deadline);
92-
const feeVector = AccountLinkTransactionBuffer.createFeeVector(builder, this.fee);
88+
const feeVector = AccountLinkTransactionBuffer.createFeeVector(builder, this.maxFee);
9389
const remoteAccountKeyVector = AccountLinkTransactionBuffer.createRemoteAccountKeyVector(builder, this.remoteAccountKey);
9490

9591
AccountLinkTransactionBuffer.startAccountLinkTransactionBuffer(builder);

src/infrastructure/builders/AccountPropertiesAddressTransaction.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @module transactions/AccountPropertiesAddressTransaction
1919
*/
2020
import { RawAddress as address } from '../../core/format';
21+
import { TransactionType } from '../../model/transaction/TransactionType';
2122
import AccountPropertiesAddressTransactionBufferPackage from '../buffers/AccountPropertiesAddressTransactionBuffer';
2223
import AccountPropertiesAddressModificationTransactionSchema from '../schemas/AccountPropertiesAddressModificationTransactionSchema';
2324
import { VerifiableTransaction } from './VerifiableTransaction';
@@ -26,9 +27,7 @@ const {
2627
PropertyAddressModificationBuffer,
2728
} = AccountPropertiesAddressTransactionBufferPackage.Buffers;
2829

29-
const {
30-
flatbuffers
31-
} = require('flatbuffers');
30+
import {flatbuffers} from 'flatbuffers';
3231

3332
export default class AccountPropertiesAddressTransaction extends VerifiableTransaction {
3433
constructor(bytes) {
@@ -38,20 +37,19 @@ export default class AccountPropertiesAddressTransaction extends VerifiableTrans
3837

3938
// tslint:disable-next-line:max-classes-per-file
4039
export class Builder {
41-
fee: any;
40+
maxFee: any;
4241
version: any;
4342
type: any;
4443
deadline: any;
4544
propertyType: any;
4645
modifications: any;
4746
constructor() {
48-
this.fee = [0, 0];
49-
this.version = 36865;
50-
this.type = 0x4150;
47+
this.maxFee = [0, 0];
48+
this.type = TransactionType.MODIFY_ACCOUNT_PROPERTY_ADDRESS;
5149
}
5250

53-
addFee(fee) {
54-
this.fee = fee;
51+
addFee(maxFee) {
52+
this.maxFee = maxFee;
5553
return this;
5654
}
5755

@@ -85,7 +83,7 @@ export class Builder {
8583

8684
// Create modifications
8785
const modificationsArray: any = [];
88-
this.modifications.forEach(modification => {
86+
this.modifications.forEach((modification) => {
8987
const addressModificationVector = PropertyAddressModificationBuffer
9088
.createValueVector(builder, address.stringToAddress(modification.value));
9189
PropertyAddressModificationBuffer.startPropertyAddressModificationBuffer(builder);
@@ -102,7 +100,7 @@ export class Builder {
102100
const deadlineVector = AccountPropertiesAddressTransactionBuffer
103101
.createDeadlineVector(builder, this.deadline);
104102
const feeVector = AccountPropertiesAddressTransactionBuffer
105-
.createFeeVector(builder, this.fee);
103+
.createFeeVector(builder, this.maxFee);
106104
const modificationVector = AccountPropertiesAddressTransactionBuffer
107105
.createModificationsVector(builder, modificationsArray);
108106

src/infrastructure/builders/AccountPropertiesEntityTypeTransaction.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/**
1818
* @module transactions/AccountPropertiesEntityTypeTransaction
1919
*/
20+
import { TransactionType } from '../../model/transaction/TransactionType';
2021
import AccountPropertiesEntityTypeTransactionBufferPackage from '../buffers/AccountPropertiesEntityTypeTransactionBuffer';
2122
import AccountPropertiesEntityTypeModificationTransactionSchema from '../schemas/AccountPropertiesEntityTypeModificationTransactionSchema';
2223
import { VerifiableTransaction } from './VerifiableTransaction';
@@ -26,9 +27,7 @@ const {
2627
PropertyEntityTypeModificationBuffer,
2728
} = AccountPropertiesEntityTypeTransactionBufferPackage.Buffers;
2829

29-
const {
30-
flatbuffers
31-
} = require('flatbuffers');
30+
import {flatbuffers} from 'flatbuffers';
3231

3332
export default class AccountPropertiesEntityTypeTransaction extends VerifiableTransaction {
3433
constructor(bytes) {
@@ -38,20 +37,19 @@ export default class AccountPropertiesEntityTypeTransaction extends VerifiableTr
3837

3938
// tslint:disable-next-line:max-classes-per-file
4039
export class Builder {
41-
fee: any;
40+
maxFee: any;
4241
version: any;
4342
type: any;
4443
deadline: any;
4544
propertyType: any;
4645
modifications: any;
4746
constructor() {
48-
this.fee = [0, 0];
49-
this.version = 36865;
50-
this.type = 0x4350;
47+
this.maxFee = [0, 0];
48+
this.type = TransactionType.MODIFY_ACCOUNT_PROPERTY_ENTITY_TYPE;
5149
}
5250

53-
addFee(fee) {
54-
this.fee = fee;
51+
addFee(maxFee) {
52+
this.maxFee = maxFee;
5553
return this;
5654
}
5755

@@ -85,7 +83,7 @@ export class Builder {
8583

8684
// Create modifications
8785
const modificationsArray: any = [];
88-
this.modifications.forEach(modification => {
86+
this.modifications.forEach((modification) => {
8987
PropertyEntityTypeModificationBuffer.startPropertyEntityTypeModificationBuffer(builder);
9088
PropertyEntityTypeModificationBuffer.addModificationType(builder, modification.type);
9189
PropertyEntityTypeModificationBuffer.addValue(builder, modification.value);
@@ -100,7 +98,7 @@ export class Builder {
10098
const deadlineVector = AccountPropertiesEntityTypeTransactionBuffer
10199
.createDeadlineVector(builder, this.deadline);
102100
const feeVector = AccountPropertiesEntityTypeTransactionBuffer
103-
.createFeeVector(builder, this.fee);
101+
.createFeeVector(builder, this.maxFee);
104102
const modificationVector = AccountPropertiesEntityTypeTransactionBuffer
105103
.createModificationsVector(builder, modificationsArray);
106104

src/infrastructure/builders/AccountPropertiesMosaicTransaction.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/**
1818
* @module transactions/AccountPropertiesMosaicTransaction
1919
*/
20+
import { TransactionType } from '../../model/transaction/TransactionType';
2021
import AccountPropertiesMosaicTransactionBufferPackage from '../buffers/AccountPropertiesMosaicTransactionBuffer';
2122
import AccountPropertiesMosaicModificationTransactionSchema from '../schemas/AccountPropertiesMosaicModificationTransactionSchema';
2223
import { VerifiableTransaction } from './VerifiableTransaction';
@@ -26,9 +27,7 @@ const {
2627
PropertyMosaicModificationBuffer,
2728
} = AccountPropertiesMosaicTransactionBufferPackage.Buffers;
2829

29-
const {
30-
flatbuffers,
31-
} = require('flatbuffers');
30+
import {flatbuffers} from 'flatbuffers';
3231

3332
export default class AccountPropertiesMosaicTransaction extends VerifiableTransaction {
3433
constructor(bytes) {
@@ -38,20 +37,19 @@ export default class AccountPropertiesMosaicTransaction extends VerifiableTransa
3837

3938
// tslint:disable-next-line:max-classes-per-file
4039
export class Builder {
41-
fee: any;
40+
maxFee: any;
4241
version: any;
4342
type: any;
4443
deadline: any;
4544
propertyType: any;
4645
modifications: any;
4746
constructor() {
48-
this.fee = [0, 0];
49-
this.version = 36865;
50-
this.type = 0x4250;
47+
this.maxFee = [0, 0];
48+
this.type = TransactionType.MODIFY_ACCOUNT_PROPERTY_MOSAIC;
5149
}
5250

53-
addFee(fee) {
54-
this.fee = fee;
51+
addFee(maxFee) {
52+
this.maxFee = maxFee;
5553
return this;
5654
}
5755

@@ -85,7 +83,7 @@ export class Builder {
8583

8684
// Create modifications
8785
const modificationsArray: any = [];
88-
this.modifications.forEach(modification => {
86+
this.modifications.forEach((modification) => {
8987
const addressModificationVector = PropertyMosaicModificationBuffer
9088
.createValueVector(builder, modification.value);
9189
PropertyMosaicModificationBuffer.startPropertyMosaicModificationBuffer(builder);
@@ -102,7 +100,7 @@ export class Builder {
102100
const deadlineVector = AccountPropertiesMosaicTransactionBuffer
103101
.createDeadlineVector(builder, this.deadline);
104102
const feeVector = AccountPropertiesMosaicTransactionBuffer
105-
.createFeeVector(builder, this.fee);
103+
.createFeeVector(builder, this.maxFee);
106104
const modificationVector = AccountPropertiesMosaicTransactionBuffer
107105
.createModificationsVector(builder, modificationsArray);
108106

src/infrastructure/builders/AddressAliasTransaction.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
import { RawAddress as addressLibrary } from '../../core/format';
17+
import { TransactionType } from '../../model/transaction/TransactionType';
1718
import AddressAliasTransactionBufferPackage from '../buffers/AddressAliasTransactionBuffer';
1819
import AddressAliasTransactionSchema from '../schemas/AddressAliasTransactionSchema';
1920
import { VerifiableTransaction } from './VerifiableTransaction';
@@ -22,9 +23,7 @@ const {
2223
AddressAliasTransactionBuffer,
2324
} = AddressAliasTransactionBufferPackage.Buffers;
2425

25-
const {
26-
flatbuffers,
27-
} = require('flatbuffers');
26+
import {flatbuffers} from 'flatbuffers';
2827

2928
/**
3029
* @module transactions/AddressAliasTransaction
@@ -36,21 +35,20 @@ export class AddressAliasTransaction extends VerifiableTransaction {
3635
}
3736
// tslint:disable-next-line:max-classes-per-file
3837
export class Builder {
39-
fee: any;
38+
maxFee: any;
4039
version: any;
4140
type: any;
4241
deadline: any;
4342
address: any;
4443
namespaceId: any;
4544
actionType: any;
4645
constructor() {
47-
this.fee = [0, 0];
48-
this.version = 36865;
49-
this.type = 0x424E;
46+
this.maxFee = [0, 0];
47+
this.type = TransactionType.ADDRESS_ALIAS;
5048
}
5149

52-
addFee(fee) {
53-
this.fee = fee;
50+
addFee(maxFee) {
51+
this.maxFee = maxFee;
5452
return this;
5553
}
5654

@@ -95,7 +93,7 @@ export class Builder {
9593
const deadlineVector = AddressAliasTransactionBuffer
9694
.createDeadlineVector(builder, this.deadline);
9795
const feeVector = AddressAliasTransactionBuffer
98-
.createFeeVector(builder, this.fee);
96+
.createFeeVector(builder, this.maxFee);
9997
const namespaceIdVector = AddressAliasTransactionBuffer
10098
.createNamespaceIdVector(builder, this.namespaceId);
10199
const addressVector = AddressAliasTransactionBuffer

src/infrastructure/builders/AggregateTransaction.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
* @module transactions/AggregateTransaction
1919
*/
2020
import { SignSchema } from '../../core/crypto';
21+
import { TransactionType } from '../../model/transaction/TransactionType';
2122
import AggregateTransactionBufferPackage from '../buffers/AggregateTransactionBuffer';
2223
import AggregateTransactionSchema from '../schemas/AggregateTransactionSchema';
2324
import { CosignatureTransaction} from './CosignatureTransaction';
2425
import { VerifiableTransaction } from './VerifiableTransaction';
2526

26-
const {
27-
flatbuffers,
28-
} = require('flatbuffers');
27+
import {flatbuffers} from 'flatbuffers';
2928

3029
const {
3130
AggregateTransactionBuffer,
@@ -77,19 +76,18 @@ export class AggregateTransaction extends VerifiableTransaction {
7776
}
7877
// tslint:disable-next-line:max-classes-per-file
7978
export class Builder {
80-
fee: any;
79+
maxFee: any;
8180
version: any;
8281
type: any;
8382
deadline: any;
8483
transactions: any;
8584
constructor() {
86-
this.fee = [0, 0];
87-
this.version = 36865;
88-
this.type = 0x4141;
85+
this.maxFee = [0, 0];
86+
this.type = TransactionType.AGGREGATE_COMPLETE;
8987
}
9088

91-
addFee(fee) {
92-
this.fee = fee;
89+
addFee(maxFee) {
90+
this.maxFee = maxFee;
9391
return this;
9492
}
9593

@@ -129,7 +127,7 @@ export class Builder {
129127
.createSignerVector(builder, Array(...Array(32))
130128
.map(Number.prototype.valueOf, 0));
131129
const deadlineVector = AggregateTransactionBuffer.createDeadlineVector(builder, this.deadline);
132-
const feeVector = AggregateTransactionBuffer.createFeeVector(builder, this.fee);
130+
const feeVector = AggregateTransactionBuffer.createFeeVector(builder, this.maxFee);
133131
const modificationsVector = AggregateTransactionBuffer.createTransactionsVector(builder, this.transactions);
134132

135133
AggregateTransactionBuffer.startAggregateTransactionBuffer(builder);

src/infrastructure/builders/HashLockTransaction.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ import { Convert as convert } from '../../core/format';
2121
import * as HashLockTransactionBufferPackage from '../buffers/HashLockTransactionBuffer';
2222
import HashLockTransactionSchema from '../schemas/HashLockTransactionSchema';
2323
import { VerifiableTransaction } from './VerifiableTransaction';
24+
import { TransactionType } from '../../model/transaction/TransactionType';
2425

25-
const {
26-
flatbuffers,
27-
} = require('flatbuffers');
26+
import {flatbuffers} from 'flatbuffers';
2827

2928
const {
3029
HashLockTransactionBuffer,
@@ -38,7 +37,7 @@ export default class HashLockTransaction extends VerifiableTransaction {
3837

3938
// tslint:disable-next-line:max-classes-per-file
4039
export class Builder {
41-
fee: any;
40+
maxFee: any;
4241
version: any;
4342
type: any;
4443
deadline: any;
@@ -47,13 +46,12 @@ export class Builder {
4746
duration: any;
4847
hash: any;
4948
constructor() {
50-
this.fee = [0, 0];
51-
this.version = 36865;
52-
this.type = 0x414C;
49+
this.maxFee = [0, 0];
50+
this.type = TransactionType.LOCK;
5351
}
5452

55-
addFee(fee) {
56-
this.fee = fee;
53+
addFee(maxFee) {
54+
this.maxFee = maxFee;
5755
return this;
5856
}
5957

@@ -100,7 +98,7 @@ export class Builder {
10098
.createSignatureVector(builder, Array(...Array(64)).map(Number.prototype.valueOf, 0));
10199
const signerVector = HashLockTransactionBuffer.createSignerVector(builder, Array(...Array(32)).map(Number.prototype.valueOf, 0));
102100
const deadlineVector = HashLockTransactionBuffer.createDeadlineVector(builder, this.deadline);
103-
const feeVector = HashLockTransactionBuffer.createFeeVector(builder, this.fee);
101+
const feeVector = HashLockTransactionBuffer.createFeeVector(builder, this.maxFee);
104102
const mosaicIdVector = HashLockTransactionBuffer.createMosaicIdVector(builder, this.mosaicId);
105103
const mosaicAmountVector = HashLockTransactionBuffer.createMosaicAmountVector(builder, this.mosaicAmount);
106104
const durationVector = HashLockTransactionBuffer.createDurationVector(builder, this.duration);

0 commit comments

Comments
 (0)