From bde728b6929857becfdbfd3a088dfc831714a90c Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Wed, 18 Dec 2019 11:56:34 +0000 Subject: [PATCH 01/22] Fixed #390 Spread operator does not assign super class methods --- .../transaction/AccountAddressRestrictionTransaction.ts | 4 ++-- .../transaction/AccountMosaicRestrictionTransaction.ts | 4 ++-- src/model/transaction/LockFundsTransaction.ts | 4 ++-- .../transaction/MosaicAddressRestrictionTransaction.ts | 4 ++-- .../transaction/MosaicGlobalRestrictionTransaction.ts | 4 ++-- src/model/transaction/MosaicMetadataTransaction.ts | 4 ++-- src/model/transaction/MosaicSupplyChangeTransaction.ts | 4 ++-- src/model/transaction/SecretLockTransaction.ts | 4 ++-- src/model/transaction/SecretProofTransaction.ts | 4 ++-- src/model/transaction/Transaction.ts | 2 +- src/model/transaction/TransferTransaction.ts | 7 ++++--- test/model/transaction/AccountLinkTransaction.spec.ts | 3 +++ test/model/transaction/AccountMetadataTransaction.spec.ts | 3 +++ test/model/transaction/AggregateTransaction.spec.ts | 6 ++++++ test/model/transaction/LockFundsTransaction.spec.ts | 6 ++++++ .../MosaicAddressRestrictionTransaction.spec.ts | 6 ++++++ test/model/transaction/MosaicAliasTransaction.spec.ts | 3 +++ test/model/transaction/MosaicDefinitionTransaction.spec.ts | 3 +++ .../transaction/MosaicGlobalRestrictionTransaction.spec.ts | 6 ++++++ test/model/transaction/MosaicMetadataTransaction.spec.ts | 6 ++++++ .../transaction/MosaicSupplyChangeTransaction.spec.ts | 5 +++++ .../MultisigAccountModificationTransaction.spec.ts | 3 +++ .../model/transaction/NamespaceMetadataTransaction.spec.ts | 3 +++ .../transaction/NamespaceRegistrationTransaction.spec.ts | 3 +++ test/model/transaction/SecretLockTransaction.spec.ts | 5 +++++ test/model/transaction/SecretProofTransaction.spec.ts | 5 +++++ test/model/transaction/TransferTransaction.spec.ts | 6 ++++++ 27 files changed, 95 insertions(+), 22 deletions(-) diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 66f2b2fafd..5aff4bee0e 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -199,13 +199,13 @@ export class AccountAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { restrictionAdditions: this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), restrictionDeletions: this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), - }; + }); } } diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index c739b574b8..b6428e83c7 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -199,13 +199,13 @@ export class AccountMosaicRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountMosaicRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { restrictionAdditions: this.restrictionAdditions.map((addition) => statement.resolveMosaicId(addition, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), restrictionDeletions: this.restrictionDeletions.map((deletion) => statement.resolveMosaicId(deletion, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), - }; + }); } } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 3bab2f98aa..c4154e9fda 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -212,8 +212,8 @@ export class LockFundsTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): LockFundsTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 7323856186..44b9ce1682 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -243,10 +243,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), targetAddress: statement.resolveAddress(this.targetAddress, - transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index 35ff2de88e..a172d6da29 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -253,10 +253,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicGlobalRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), referenceMosaicId: statement.resolveMosaicId(this.referenceMosaicId, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index ce5b5135cf..b161f8766d 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -219,8 +219,8 @@ export class MosaicMetadataTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicMetadataTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { targetMosaicId: statement.resolveMosaicId(this.targetMosaicId, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 3e6b2685cb..69eae71d37 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -193,8 +193,8 @@ export class MosaicSupplyChangeTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicSupplyChangeTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 3606ede7e7..6dc523b95e 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -240,10 +240,10 @@ export class SecretLockTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretLockTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index 2c3a9de798..9ecca5ae92 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -223,8 +223,8 @@ export class SecretProofTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretProofTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { recipientAddress: statement.resolveAddress(this.recipientAddress, - transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index f42edc8415..8e7010c4d1 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -200,7 +200,7 @@ export abstract class Transaction { * @returns {TransferTransaction} */ public setMaxFee(feeMultiplier: number): Transaction { - return {...Object.getPrototypeOf(this), maxFee: UInt64.fromUint(this.size * feeMultiplier)}; + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {maxFee: UInt64.fromUint(this.size * feeMultiplier)}); } /** diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index d858927b9e..923a5b4b04 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -282,9 +282,10 @@ export class TransferTransaction extends Transaction { */ public resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): TransferTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), recipientAddress: statement.resolveAddress(this.recipientAddress, - transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, + {recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex), mosaics: this.mosaics.map((mosaic) => statement.resolveMosaic(mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex))}; + transactionInfo.index, aggregateTransactionIndex))}); } } diff --git a/test/model/transaction/AccountLinkTransaction.spec.ts b/test/model/transaction/AccountLinkTransaction.spec.ts index aed6cb72c6..f197c25f37 100644 --- a/test/model/transaction/AccountLinkTransaction.spec.ts +++ b/test/model/transaction/AccountLinkTransaction.spec.ts @@ -116,5 +116,8 @@ describe('AccountLinkTransaction', () => { ).setMaxFee(2); ​ expect(accountLinkTransaction.maxFee.compact()).to.be.equal(322); + + const signedTransaction = accountLinkTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/AccountMetadataTransaction.spec.ts b/test/model/transaction/AccountMetadataTransaction.spec.ts index ecf15db7be..0ceecdffff 100644 --- a/test/model/transaction/AccountMetadataTransaction.spec.ts +++ b/test/model/transaction/AccountMetadataTransaction.spec.ts @@ -103,6 +103,9 @@ describe('AccountMetadataTransaction', () => { expect(Convert.hexToUint8(accountMetadataTransaction.serialize()).length).to.be.equal(accountMetadataTransaction.size); expect(accountMetadataTransaction.size).to.be.equal(182); + + const signedTransaction = accountMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); }); diff --git a/test/model/transaction/AggregateTransaction.spec.ts b/test/model/transaction/AggregateTransaction.spec.ts index 5ae0e31825..d7eb524dec 100644 --- a/test/model/transaction/AggregateTransaction.spec.ts +++ b/test/model/transaction/AggregateTransaction.spec.ts @@ -582,6 +582,9 @@ describe('AggregateTransaction', () => { ).setMaxFee(2); ​ expect(aggregateTransaction.maxFee.compact()).to.be.equal(560); + + const signedTransaction = aggregateTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -614,5 +617,8 @@ describe('AggregateTransaction', () => { expect(innerTransaction.mosaics[0].id instanceof MosaicId).to.be.true; expect((innerTransaction.recipientAddress as Address).equals(account.address)).to.be.true; expect((innerTransaction.mosaics[0].id as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = aggregateTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/LockFundsTransaction.spec.ts b/test/model/transaction/LockFundsTransaction.spec.ts index ddcf970822..b5016e198d 100644 --- a/test/model/transaction/LockFundsTransaction.spec.ts +++ b/test/model/transaction/LockFundsTransaction.spec.ts @@ -181,6 +181,9 @@ describe('LockFundsTransaction', () => { ).setMaxFee(2); ​ expect(lockFundsTransaction.maxFee.compact()).to.be.equal(368); + + const signedTransactionTest = lockFundsTransaction.signWith(account, generationHash); + expect(signedTransactionTest.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -205,5 +208,8 @@ describe('LockFundsTransaction', () => { ​ expect(transaction.mosaic.id instanceof MosaicId).to.be.true; expect((transaction.mosaic.id as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransactionTest = transaction.signWith(account, generationHash); + expect(signedTransactionTest.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts b/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts index 3783e40f9e..53bbbe7a96 100644 --- a/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts +++ b/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts @@ -164,6 +164,9 @@ describe('MosaicAddressRestrictionTransaction', () => { ).setMaxFee(2); ​ expect(transaction.maxFee.compact()).to.be.equal(370); + + const signedTransaction = transaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -185,5 +188,8 @@ describe('MosaicAddressRestrictionTransaction', () => { expect(transaction.mosaicId instanceof MosaicId).to.be.true; expect((transaction.targetAddress as Address).equals(account.address)).to.be.true; expect((transaction.mosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = transaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicAliasTransaction.spec.ts b/test/model/transaction/MosaicAliasTransaction.spec.ts index a9c9f698a3..3e9f775b44 100644 --- a/test/model/transaction/MosaicAliasTransaction.spec.ts +++ b/test/model/transaction/MosaicAliasTransaction.spec.ts @@ -118,5 +118,8 @@ describe('MosaicAliasTransaction', () => { ).setMaxFee(2); ​ expect(mosaicAliasTransaction.maxFee.compact()).to.be.equal(290); + + const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicDefinitionTransaction.spec.ts b/test/model/transaction/MosaicDefinitionTransaction.spec.ts index 0de595a09a..9be5cb72b5 100644 --- a/test/model/transaction/MosaicDefinitionTransaction.spec.ts +++ b/test/model/transaction/MosaicDefinitionTransaction.spec.ts @@ -172,5 +172,8 @@ describe('MosaicDefinitionTransaction', () => { ).setMaxFee(2); ​ expect(mosaicDefinitionTransaction.maxFee.compact()).to.be.equal(300); + + const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts b/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts index a4b387dcd5..846f631733 100644 --- a/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts +++ b/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts @@ -162,6 +162,9 @@ describe('MosaicGlobalRestrictionTransaction', () => { ).setMaxFee(2); ​ expect(mosaicGlobalRestrictionTransaction.maxFee.compact()).to.be.equal(340); + + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -185,5 +188,8 @@ describe('MosaicGlobalRestrictionTransaction', () => { expect((mosaicGlobalRestrictionTransaction.mosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; expect(mosaicGlobalRestrictionTransaction.referenceMosaicId instanceof MosaicId).to.be.true; expect((mosaicGlobalRestrictionTransaction.referenceMosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicMetadataTransaction.spec.ts b/test/model/transaction/MosaicMetadataTransaction.spec.ts index bea46583b2..c55ad3efed 100644 --- a/test/model/transaction/MosaicMetadataTransaction.spec.ts +++ b/test/model/transaction/MosaicMetadataTransaction.spec.ts @@ -161,6 +161,9 @@ describe('MosaicMetadataTransaction', () => { ).setMaxFee(2); ​ expect(mosaicMetadataTransaction.maxFee.compact()).to.be.equal(380); + + const signedTransaction = mosaicMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -180,5 +183,8 @@ describe('MosaicMetadataTransaction', () => { ​ expect(mosaicMetadataTransaction.targetMosaicId instanceof MosaicId).to.be.true; expect((mosaicMetadataTransaction.targetMosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = mosaicMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts b/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts index 805a1f592c..77f2fdaa90 100644 --- a/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts +++ b/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts @@ -127,6 +127,8 @@ describe('MosaicSupplyChangeTransaction', () => { ).setMaxFee(2); ​ expect(mosaicSupplyChangeTransaction.maxFee.compact()).to.be.equal(290); + const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -144,5 +146,8 @@ describe('MosaicSupplyChangeTransaction', () => { ​ expect(mosaicSupplyChangeTransaction.mosaicId instanceof MosaicId).to.be.true; expect((mosaicSupplyChangeTransaction.mosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MultisigAccountModificationTransaction.spec.ts b/test/model/transaction/MultisigAccountModificationTransaction.spec.ts index 1b1f4e3707..ff5a2ae193 100644 --- a/test/model/transaction/MultisigAccountModificationTransaction.spec.ts +++ b/test/model/transaction/MultisigAccountModificationTransaction.spec.ts @@ -134,5 +134,8 @@ describe('MultisigAccountModificationTransaction', () => { ).setMaxFee(2); ​ expect(modifyMultisigAccountTransaction.maxFee.compact()).to.be.equal(336); + + const signedTransaction = modifyMultisigAccountTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/NamespaceMetadataTransaction.spec.ts b/test/model/transaction/NamespaceMetadataTransaction.spec.ts index cd881f49b3..27688408c5 100644 --- a/test/model/transaction/NamespaceMetadataTransaction.spec.ts +++ b/test/model/transaction/NamespaceMetadataTransaction.spec.ts @@ -124,5 +124,8 @@ describe('NamespaceMetadataTransaction', () => { ).setMaxFee(2); ​ expect(namespaceMetadataTransaction.maxFee.compact()).to.be.equal(380); + + const signedTransaction = namespaceMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/NamespaceRegistrationTransaction.spec.ts b/test/model/transaction/NamespaceRegistrationTransaction.spec.ts index c24ebfe45b..921a3bd457 100644 --- a/test/model/transaction/NamespaceRegistrationTransaction.spec.ts +++ b/test/model/transaction/NamespaceRegistrationTransaction.spec.ts @@ -131,5 +131,8 @@ describe('NamespaceRegistrationTransaction', () => { ).setMaxFee(2); ​ expect(registerNamespaceTransaction.maxFee.compact()).to.be.equal(330); + + const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/SecretLockTransaction.spec.ts b/test/model/transaction/SecretLockTransaction.spec.ts index 9cb2c2c33c..612b1ef7b8 100644 --- a/test/model/transaction/SecretLockTransaction.spec.ts +++ b/test/model/transaction/SecretLockTransaction.spec.ts @@ -300,6 +300,8 @@ describe('SecretLockTransaction', () => { ).setMaxFee(2); ​ expect(secretLockTransaction.maxFee.compact()).to.be.equal(420); + const signedTransaction = secretLockTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -322,5 +324,8 @@ describe('SecretLockTransaction', () => { expect(secretLockTransaction.mosaic.id instanceof MosaicId).to.be.true; expect((secretLockTransaction.recipientAddress as Address).equals(account.address)).to.be.true; expect((secretLockTransaction.mosaic.id as MosaicId).equals(mosaicId)).to.be.true; + + const signedTransaction = secretLockTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/SecretProofTransaction.spec.ts b/test/model/transaction/SecretProofTransaction.spec.ts index 7092f966e7..f6c2eece9e 100644 --- a/test/model/transaction/SecretProofTransaction.spec.ts +++ b/test/model/transaction/SecretProofTransaction.spec.ts @@ -257,6 +257,8 @@ describe('SecretProofTransaction', () => { ).setMaxFee(2); ​ expect(secretProofTransaction.maxFee.compact()).to.be.equal(440); + const signedTransaction = secretProofTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -276,5 +278,8 @@ describe('SecretProofTransaction', () => { ​ expect(transferTransaction.recipientAddress instanceof Address).to.be.true; expect((transferTransaction.recipientAddress as Address).equals(account.address)).to.be.true; + + const signedTransaction = transferTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/TransferTransaction.spec.ts b/test/model/transaction/TransferTransaction.spec.ts index 6626d55eaf..83e3d09d9b 100644 --- a/test/model/transaction/TransferTransaction.spec.ts +++ b/test/model/transaction/TransferTransaction.spec.ts @@ -407,6 +407,9 @@ describe('TransferTransaction', () => { ).setMaxFee(2); ​ expect(transferTransaction.maxFee.compact()).to.be.equal(378); + + const signedTransaction = transferTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -426,5 +429,8 @@ describe('TransferTransaction', () => { expect(transferTransaction.mosaics[0].id instanceof MosaicId).to.be.true; expect((transferTransaction.recipientAddress as Address).equals(account.address)).to.be.true; expect((transferTransaction.mosaics[0].id as MosaicId).equals(mosaicId)).to.be.true; + + const signedTransaction = transferTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); From faaef7f83661b459972e7b473fea30ee66649231 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:27:50 +0000 Subject: [PATCH 02/22] Fixed #393 applied catbuffer generator on aggregate --- .../AggregateBondedTransactionBuilder.ts | 8 +- .../AggregateCompleteTransactionBuilder.ts | 8 +- .../AggregateTransactionBodyBuilder.ts | 52 ++- .../catbuffer/BalanceChangeReceiptBuilder.ts | 111 +++++ .../BalanceTransferReceiptBuilder.ts | 132 ++++++ .../catbuffer/BlockHeaderBuilder.ts | 387 ++++++++++++++++++ .../catbuffer/EmbeddedTransactionHelper.ts | 181 ++++++++ src/infrastructure/catbuffer/EntityTypeDto.ts | 40 ++ .../catbuffer/GeneratorUtils.ts | 9 + .../catbuffer/InflationReceiptBuilder.ts | 92 +++++ .../catbuffer/MosaicExpiryReceiptBuilder.ts | 92 +++++ .../NamespaceExpiryReceiptBuilder.ts | 92 +++++ .../catbuffer/ReceiptBuilder.ts | 108 +++++ .../catbuffer/ReceiptTypeDto.ts | 27 ++ .../AccountAddressRestrictionTransaction.ts | 8 +- .../transaction/AccountLinkTransaction.ts | 8 +- .../transaction/AccountMetadataTransaction.ts | 8 +- .../AccountMosaicRestrictionTransaction.ts | 8 +- .../AccountOperationRestrictionTransaction.ts | 8 +- .../transaction/AddressAliasTransaction.ts | 8 +- src/model/transaction/AggregateTransaction.ts | 58 +-- src/model/transaction/LockFundsTransaction.ts | 8 +- .../MosaicAddressRestrictionTransaction.ts | 8 +- .../transaction/MosaicAliasTransaction.ts | 8 +- .../MosaicDefinitionTransaction.ts | 8 +- .../MosaicGlobalRestrictionTransaction.ts | 8 +- .../transaction/MosaicMetadataTransaction.ts | 8 +- .../MosaicSupplyChangeTransaction.ts | 8 +- .../MultisigAccountModificationTransaction.ts | 8 +- .../NamespaceMetadataTransaction.ts | 8 +- .../NamespaceRegistrationTransaction.ts | 30 +- .../transaction/SecretLockTransaction.ts | 8 +- .../transaction/SecretProofTransaction.ts | 8 +- src/model/transaction/Transaction.ts | 8 +- src/model/transaction/TransferTransaction.ts | 8 +- test/model/transaction/Transaction.spec.ts | 3 +- 36 files changed, 1431 insertions(+), 151 deletions(-) create mode 100644 src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BlockHeaderBuilder.ts create mode 100644 src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts create mode 100644 src/infrastructure/catbuffer/InflationReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptTypeDto.ts diff --git a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts index 56f42da250..ba3b56b75f 100644 --- a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts index 6dd372648f..f6b6e0983e 100644 --- a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts index b4de916720..5dd2492e47 100644 --- a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts @@ -19,6 +19,9 @@ *** along with Catapult. If not, see . **/ +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from './EmbeddedTransactionHelper'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -29,9 +32,9 @@ export class AggregateTransactionBodyBuilder { /** Reserved padding to align end of AggregateTransactionHeader on 8-byte boundary. */ aggregateTransactionHeader_Reserved1: number; /** Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - transactions: Uint8Array; + transactions: EmbeddedTransactionBuilder[]; /** Cosignatures data (fills remaining body space after transactions). */ - cosignatures: Uint8Array; + cosignatures: CosignatureBuilder[]; /** * Constructor. @@ -40,7 +43,8 @@ export class AggregateTransactionBodyBuilder { * @param transactions Sub-transaction data (transactions are variable sized and payload size is in bytes). * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ - public constructor(transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + // tslint:disable-next-line: max-line-length + public constructor(transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { this.transactionsHash = transactionsHash; this.aggregateTransactionHeader_Reserved1 = 0; this.transactions = transactions; @@ -62,9 +66,24 @@ export class AggregateTransactionBodyBuilder { // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); byteArray.splice(0, 4); - const transactions = GeneratorUtils.getBytes(Uint8Array.from(byteArray), payloadSize); - byteArray.splice(0, payloadSize); - const cosignatures = Uint8Array.from(byteArray); + let transactionsByteSize = payloadSize; + const transactions: EmbeddedTransactionBuilder[] = []; + while (transactionsByteSize > 0) { + const item = EmbeddedTransactionHelper.loadFromBinary(Uint8Array.from(byteArray)); + transactions.push(item); + const itemSize = item.getSize() + GeneratorUtils.getTransactionPaddingSize(item.getSize(), 8); + transactionsByteSize -= itemSize; + byteArray.splice(0, itemSize); + } + let cosignaturesByteSize = byteArray.length; + const cosignatures: CosignatureBuilder[] = []; + while (cosignaturesByteSize > 0) { + const item = CosignatureBuilder.loadFromBinary(Uint8Array.from(byteArray)); + cosignatures.push(item); + const itemSize = item.getSize(); + cosignaturesByteSize -= itemSize; + byteArray.splice(0, itemSize); + } return new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -91,7 +110,7 @@ export class AggregateTransactionBodyBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.transactions; } @@ -100,7 +119,7 @@ export class AggregateTransactionBodyBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.cosignatures; } @@ -114,8 +133,8 @@ export class AggregateTransactionBodyBuilder { size += this.transactionsHash.getSize(); size += 4; // payloadSize size += 4; // aggregateTransactionHeader_Reserved1 - size += this.transactions.length; - size += this.cosignatures.length; + this.transactions.forEach((o) => size += EmbeddedTransactionHelper.serialize(o).length); + this.cosignatures.forEach((o) => size += o.getSize()); return size; } @@ -128,13 +147,20 @@ export class AggregateTransactionBodyBuilder { let newArray = Uint8Array.from([]); const transactionsHashBytes = this.transactionsHash.serialize(); newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); - const payloadSizeBytes = GeneratorUtils.uintToBuffer(this.transactions.length, 4); + // tslint:disable-next-line: max-line-length + const payloadSizeBytes = GeneratorUtils.uintToBuffer(EmbeddedTransactionHelper.getEmbeddedTransactionSize(this.transactions), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, payloadSizeBytes); // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getAggregateTransactionHeader_Reserved1(), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, aggregateTransactionHeader_Reserved1Bytes); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.transactions); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.cosignatures); + this.transactions.forEach((item) => { + const transactionsBytes = EmbeddedTransactionHelper.serialize(item); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsBytes); + }); + this.cosignatures.forEach((item) => { + const cosignaturesBytes = item.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, cosignaturesBytes); + }); return newArray; } } diff --git a/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts new file mode 100644 index 0000000000..7670f20e0f --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts @@ -0,0 +1,111 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance change receipt. */ +export class BalanceChangeReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Account public key. */ + targetPublicKey: KeyDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param targetPublicKey Account public key. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, targetPublicKey: KeyDto) { + super(version, type); + this.mosaic = mosaic; + this.targetPublicKey = targetPublicKey; + } + + /** + * Creates an instance of BalanceChangeReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceChangeReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceChangeReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const targetPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, targetPublicKey.getSize()); + return new BalanceChangeReceiptBuilder(superObject.version, superObject.type, mosaic, targetPublicKey); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets account public key. + * + * @return Account public key. + */ + public getTargetPublicKey(): KeyDto { + return this.targetPublicKey; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.targetPublicKey.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const targetPublicKeyBytes = this.targetPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, targetPublicKeyBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts new file mode 100644 index 0000000000..89215dc6c1 --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts @@ -0,0 +1,132 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { AddressDto } from './AddressDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance transfer receipt. */ +export class BalanceTransferReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Mosaic sender public key. */ + senderPublicKey: KeyDto; + /** Mosaic recipient address. */ + recipientAddress: AddressDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param senderPublicKey Mosaic sender public key. + * @param recipientAddress Mosaic recipient address. + */ + // tslint:disable-next-line: max-line-length + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, senderPublicKey: KeyDto, recipientAddress: AddressDto) { + super(version, type); + this.mosaic = mosaic; + this.senderPublicKey = senderPublicKey; + this.recipientAddress = recipientAddress; + } + + /** + * Creates an instance of BalanceTransferReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceTransferReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceTransferReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const senderPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, senderPublicKey.getSize()); + const recipientAddress = AddressDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, recipientAddress.getSize()); + // tslint:disable-next-line: max-line-length + return new BalanceTransferReceiptBuilder(superObject.version, superObject.type, mosaic, senderPublicKey, recipientAddress); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets mosaic sender public key. + * + * @return Mosaic sender public key. + */ + public getSenderPublicKey(): KeyDto { + return this.senderPublicKey; + } + + /** + * Gets mosaic recipient address. + * + * @return Mosaic recipient address. + */ + public getRecipientAddress(): AddressDto { + return this.recipientAddress; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.senderPublicKey.getSize(); + size += this.recipientAddress.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const senderPublicKeyBytes = this.senderPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, senderPublicKeyBytes); + const recipientAddressBytes = this.recipientAddress.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, recipientAddressBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BlockHeaderBuilder.ts b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts new file mode 100644 index 0000000000..eb693aa3fa --- /dev/null +++ b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts @@ -0,0 +1,387 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { BlockFeeMultiplierDto } from './BlockFeeMultiplierDto'; +import { DifficultyDto } from './DifficultyDto'; +import { EntityTypeDto } from './EntityTypeDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { Hash256Dto } from './Hash256Dto'; +import { HeightDto } from './HeightDto'; +import { KeyDto } from './KeyDto'; +import { NetworkTypeDto } from './NetworkTypeDto'; +import { SignatureDto } from './SignatureDto'; +import { TimestampDto } from './TimestampDto'; + +/** Binary layout for a block header. */ +export class BlockHeaderBuilder { + /** Entity size. */ + size = 0; + /** Reserved padding to align Signature on 8-byte boundary. */ + verifiableEntityHeader_Reserved1: number; + /** Entity signature. */ + signature: SignatureDto; + /** Entity signer's public key. */ + signerPublicKey: KeyDto; + /** Reserved padding to align end of EntityBody on 8-byte boundary. */ + entityBody_Reserved1: number; + /** Entity version. */ + version: number; + /** Entity network. */ + network: NetworkTypeDto; + /** Entity type. */ + type: EntityTypeDto; + /** Block height. */ + height: HeightDto; + /** Number of milliseconds elapsed since creation of nemesis block. */ + timestamp: TimestampDto; + /** Block difficulty. */ + difficulty: DifficultyDto; + /** Previous block hash. */ + previousBlockHash: Hash256Dto; + /** Hash of the transactions in this block. */ + transactionsHash: Hash256Dto; + /** Hash of the receipts generated by this block. */ + receiptsHash: Hash256Dto; + /** Hash of the global chain state at this block. */ + stateHash: Hash256Dto; + /** Beneficiary public key designated by harvester. */ + beneficiaryPublicKey: KeyDto; + /** Fee multiplier applied to block transactions. */ + feeMultiplier: BlockFeeMultiplierDto; + /** Reserved padding to align end of BlockHeader on 8-byte boundary. */ + blockHeader_Reserved1: number; + + /** + * Constructor. + * + * @param signature Entity signature. + * @param signerPublicKey Entity signer's public key. + * @param version Entity version. + * @param network Entity network. + * @param type Entity type. + * @param height Block height. + * @param timestamp Number of milliseconds elapsed since creation of nemesis block. + * @param difficulty Block difficulty. + * @param previousBlockHash Previous block hash. + * @param transactionsHash Hash of the transactions in this block. + * @param receiptsHash Hash of the receipts generated by this block. + * @param stateHash Hash of the global chain state at this block. + * @param beneficiaryPublicKey Beneficiary public key designated by harvester. + * @param feeMultiplier Fee multiplier applied to block transactions. + */ + // tslint:disable-next-line: max-line-length + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, height: HeightDto, timestamp: TimestampDto, difficulty: DifficultyDto, previousBlockHash: Hash256Dto, transactionsHash: Hash256Dto, receiptsHash: Hash256Dto, stateHash: Hash256Dto, beneficiaryPublicKey: KeyDto, feeMultiplier: BlockFeeMultiplierDto) { + this.verifiableEntityHeader_Reserved1 = 0; + this.signature = signature; + this.signerPublicKey = signerPublicKey; + this.entityBody_Reserved1 = 0; + this.version = version; + this.network = network; + this.type = type; + this.height = height; + this.timestamp = timestamp; + this.difficulty = difficulty; + this.previousBlockHash = previousBlockHash; + this.transactionsHash = transactionsHash; + this.receiptsHash = receiptsHash; + this.stateHash = stateHash; + this.beneficiaryPublicKey = beneficiaryPublicKey; + this.feeMultiplier = feeMultiplier; + this.blockHeader_Reserved1 = 0; + } + + /** + * Creates an instance of BlockHeaderBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BlockHeaderBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BlockHeaderBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const signature = SignatureDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signature.getSize()); + const signerPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signerPublicKey.getSize()); + const entityBody_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const network = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const height = HeightDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, height.getSize()); + const timestamp = TimestampDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, timestamp.getSize()); + const difficulty = DifficultyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, difficulty.getSize()); + const previousBlockHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, previousBlockHash.getSize()); + const transactionsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, transactionsHash.getSize()); + const receiptsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, receiptsHash.getSize()); + const stateHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, stateHash.getSize()); + const beneficiaryPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, beneficiaryPublicKey.getSize()); + const feeMultiplier = BlockFeeMultiplierDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, feeMultiplier.getSize()); + const blockHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + return new BlockHeaderBuilder(signature, signerPublicKey, version, network, type, height, timestamp, difficulty, previousBlockHash, transactionsHash, receiptsHash, stateHash, beneficiaryPublicKey, feeMultiplier); + } + + /** + * Gets reserved padding to align Signature on 8-byte boundary. + * + * @return Reserved padding to align Signature on 8-byte boundary. + */ + public getVerifiableEntityHeader_Reserved1(): number { + return this.verifiableEntityHeader_Reserved1; + } + + /** + * Gets entity signature. + * + * @return Entity signature. + */ + public getSignature(): SignatureDto { + return this.signature; + } + + /** + * Gets entity signer's public key. + * + * @return Entity signer's public key. + */ + public getSignerPublicKey(): KeyDto { + return this.signerPublicKey; + } + + /** + * Gets reserved padding to align end of EntityBody on 8-byte boundary. + * + * @return Reserved padding to align end of EntityBody on 8-byte boundary. + */ + public getEntityBody_Reserved1(): number { + return this.entityBody_Reserved1; + } + + /** + * Gets entity version. + * + * @return Entity version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets entity network. + * + * @return Entity network. + */ + public getNetwork(): NetworkTypeDto { + return this.network; + } + + /** + * Gets entity type. + * + * @return Entity type. + */ + public getType(): EntityTypeDto { + return this.type; + } + + /** + * Gets block height. + * + * @return Block height. + */ + public getHeight(): HeightDto { + return this.height; + } + + /** + * Gets number of milliseconds elapsed since creation of nemesis block. + * + * @return Number of milliseconds elapsed since creation of nemesis block. + */ + public getTimestamp(): TimestampDto { + return this.timestamp; + } + + /** + * Gets block difficulty. + * + * @return Block difficulty. + */ + public getDifficulty(): DifficultyDto { + return this.difficulty; + } + + /** + * Gets previous block hash. + * + * @return Previous block hash. + */ + public getPreviousBlockHash(): Hash256Dto { + return this.previousBlockHash; + } + + /** + * Gets hash of the transactions in this block. + * + * @return Hash of the transactions in this block. + */ + public getTransactionsHash(): Hash256Dto { + return this.transactionsHash; + } + + /** + * Gets hash of the receipts generated by this block. + * + * @return Hash of the receipts generated by this block. + */ + public getReceiptsHash(): Hash256Dto { + return this.receiptsHash; + } + + /** + * Gets hash of the global chain state at this block. + * + * @return Hash of the global chain state at this block. + */ + public getStateHash(): Hash256Dto { + return this.stateHash; + } + + /** + * Gets beneficiary public key designated by harvester. + * + * @return Beneficiary public key designated by harvester. + */ + public getBeneficiaryPublicKey(): KeyDto { + return this.beneficiaryPublicKey; + } + + /** + * Gets fee multiplier applied to block transactions. + * + * @return Fee multiplier applied to block transactions. + */ + public getFeeMultiplier(): BlockFeeMultiplierDto { + return this.feeMultiplier; + } + + /** + * Gets reserved padding to align end of BlockHeader on 8-byte boundary. + * + * @return Reserved padding to align end of BlockHeader on 8-byte boundary. + */ + public getBlockHeader_Reserved1(): number { + return this.blockHeader_Reserved1; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 4; // verifiableEntityHeader_Reserved1 + size += this.signature.getSize(); + size += this.signerPublicKey.getSize(); + size += 4; // entityBody_Reserved1 + size += 1; // version + size += 1; // network + size += 2; // type + size += this.height.getSize(); + size += this.timestamp.getSize(); + size += this.difficulty.getSize(); + size += this.previousBlockHash.getSize(); + size += this.transactionsHash.getSize(); + size += this.receiptsHash.getSize(); + size += this.stateHash.getSize(); + size += this.beneficiaryPublicKey.getSize(); + size += this.feeMultiplier.getSize(); + size += 4; // blockHeader_Reserved1 + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getVerifiableEntityHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, verifiableEntityHeader_Reserved1Bytes); + const signatureBytes = this.signature.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signatureBytes); + const signerPublicKeyBytes = this.signerPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signerPublicKeyBytes); + const entityBody_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getEntityBody_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, entityBody_Reserved1Bytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const networkBytes = GeneratorUtils.uintToBuffer(this.network, 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, networkBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + const heightBytes = this.height.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, heightBytes); + const timestampBytes = this.timestamp.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, timestampBytes); + const difficultyBytes = this.difficulty.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, difficultyBytes); + const previousBlockHashBytes = this.previousBlockHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, previousBlockHashBytes); + const transactionsHashBytes = this.transactionsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); + const receiptsHashBytes = this.receiptsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, receiptsHashBytes); + const stateHashBytes = this.stateHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, stateHashBytes); + const beneficiaryPublicKeyBytes = this.beneficiaryPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, beneficiaryPublicKeyBytes); + const feeMultiplierBytes = this.feeMultiplier.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, feeMultiplierBytes); + const blockHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getBlockHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, blockHeader_Reserved1Bytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts new file mode 100644 index 0000000000..ad436cfc30 --- /dev/null +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -0,0 +1,181 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { EntityTypeDto } from './EntityTypeDto' +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder' +import { GeneratorUtils } from './GeneratorUtils' +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder' +import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder' +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder' +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder' +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder' +import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder' +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder' +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder' +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder' +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder' +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder' +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder' +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder' +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder' +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder' +import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder' +import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder' +import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder' +import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder' + +export class EmbeddedTransactionHelper { + + public static serialize(transaction: EmbeddedTransactionBuilder): Uint8Array { + let byte: Uint8Array; + let padding: Uint8Array; + switch (transaction.type) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedTransferTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountLinkTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedHashLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretProofTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicDefinitionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicSupplyChangeTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMultisigAccountModificationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAddressAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceRegistrationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMosaicRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountOperationRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicGlobalRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + default: + throw new Error(`Transaction type: ${transaction.type} not recognized.`) + } + } + + public static loadFromBinary(bytes: Uint8Array):EmbeddedTransactionBuilder { + const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); + switch (header.getType()) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + default: + throw new Error(`Transaction type: ${header.getType()} not recognized.`) + } + } + + public static getEmbeddedTransactionSize(transactions: EmbeddedTransactionBuilder[]): number { + return transactions.map((o) => EmbeddedTransactionHelper.serialize(o).length).reduce((a, b) => a + b, 0); + } +} diff --git a/src/infrastructure/catbuffer/EntityTypeDto.ts b/src/infrastructure/catbuffer/EntityTypeDto.ts index cbbf804d10..4399620a5c 100644 --- a/src/infrastructure/catbuffer/EntityTypeDto.ts +++ b/src/infrastructure/catbuffer/EntityTypeDto.ts @@ -26,4 +26,44 @@ export enum EntityTypeDto { RESERVED = 0, /** Transfer transaction builder. */ TRANSFER_TRANSACTION_BUILDER = 16724, + /** Account link transaction builder. */ + ACCOUNT_LINK_TRANSACTION_BUILDER = 16716, + /** Hash lock transaction builder. */ + HASH_LOCK_TRANSACTION_BUILDER = 16712, + /** Secret lock transaction builder. */ + SECRET_LOCK_TRANSACTION_BUILDER = 16722, + /** Secret proof transaction builder. */ + SECRET_PROOF_TRANSACTION_BUILDER = 16978, + /** Account metadata transaction builder. */ + ACCOUNT_METADATA_TRANSACTION_BUILDER = 16708, + /** Mosaic metadata transaction builder. */ + MOSAIC_METADATA_TRANSACTION_BUILDER = 16964, + /** Namespace metadata transaction builder. */ + NAMESPACE_METADATA_TRANSACTION_BUILDER = 17220, + /** Mosaic definition transaction builder. */ + MOSAIC_DEFINITION_TRANSACTION_BUILDER = 16717, + /** Mosaic supply change transaction builder. */ + MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER = 16973, + /** Multisig account modification transaction builder. */ + MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER = 16725, + /** Address alias transaction builder. */ + ADDRESS_ALIAS_TRANSACTION_BUILDER = 16974, + /** Mosaic alias transaction builder. */ + MOSAIC_ALIAS_TRANSACTION_BUILDER = 17230, + /** Namespace registration transaction builder. */ + NAMESPACE_REGISTRATION_TRANSACTION_BUILDER = 16718, + /** Account address restriction transaction builder. */ + ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16720, + /** Account mosaic restriction transaction builder. */ + ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER = 16976, + /** Account operation restriction transaction builder. */ + ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER = 17232, + /** Mosaic address restriction transaction builder. */ + MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16977, + /** Mosaic global restriction transaction builder. */ + MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER = 16721, + /** Aggregate complete transaction builder. */ + AGGREGATE_COMPLETE_TRANSACTION_BUILDER = 16705, + /** Aggregate bonded transaction builder. */ + AGGREGATE_BONDED_TRANSACTION_BUILDER = 16961, } diff --git a/src/infrastructure/catbuffer/GeneratorUtils.ts b/src/infrastructure/catbuffer/GeneratorUtils.ts index d1c6eb5d9b..74399315e0 100644 --- a/src/infrastructure/catbuffer/GeneratorUtils.ts +++ b/src/infrastructure/catbuffer/GeneratorUtils.ts @@ -145,4 +145,13 @@ export class GeneratorUtils { const bytes = binary.slice(0, size); return bytes; } + + /** + * Gets the padding size that rounds up \a size to the next multiple of \a alignment. + * @param size Inner transaction size + * @param alignment Next multiple alignment + */ + public static getTransactionPaddingSize(size: number, alignment: number): number { + return 0 === size % alignment ? 0 : alignment - (size % alignment); + } } diff --git a/src/infrastructure/catbuffer/InflationReceiptBuilder.ts b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts new file mode 100644 index 0000000000..d9d12527ec --- /dev/null +++ b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for an inflation receipt. */ +export class InflationReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder) { + super(version, type); + this.mosaic = mosaic; + } + + /** + * Creates an instance of InflationReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of InflationReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): InflationReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + return new InflationReceiptBuilder(superObject.version, superObject.type, mosaic); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..3940e509e5 --- /dev/null +++ b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicIdDto } from './MosaicIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a mosaic expiry receipt. */ +export class MosaicExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring mosaic id. */ + artifactId: MosaicIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring mosaic id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: MosaicIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of MosaicExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of MosaicExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): MosaicExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = MosaicIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new MosaicExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring mosaic id. + * + * @return Expiring mosaic id. + */ + public getArtifactId(): MosaicIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..2573d688a9 --- /dev/null +++ b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { NamespaceIdDto } from './NamespaceIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a namespace expiry receipt. */ +export class NamespaceExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring namespace id. */ + artifactId: NamespaceIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring namespace id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: NamespaceIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of NamespaceExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of NamespaceExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): NamespaceExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = NamespaceIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new NamespaceExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring namespace id. + * + * @return Expiring namespace id. + */ + public getArtifactId(): NamespaceIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts new file mode 100644 index 0000000000..524bf945df --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -0,0 +1,108 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a receipt entity. */ +export class ReceiptBuilder { + /** Entity size. */ + size = 0; + /** Receipt version. */ + version: number; + /** Receipt type. */ + type: ReceiptTypeDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + */ + public constructor(version: number, type: ReceiptTypeDto) { + this.version = version; + this.type = type; + } + + /** + * Creates an instance of ReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of ReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): ReceiptBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + return new ReceiptBuilder(version, type); + } + + /** + * Gets receipt version. + * + * @return Receipt version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets receipt type. + * + * @return Receipt type. + */ + public getType(): ReceiptTypeDto { + return this.type; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 2; // version + size += 2; // type + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptTypeDto.ts b/src/infrastructure/catbuffer/ReceiptTypeDto.ts new file mode 100644 index 0000000000..f2d4bdc10f --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptTypeDto.ts @@ -0,0 +1,27 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + + +/** Enumeration of receipt types. */ +export enum ReceiptTypeDto { + /** Reserved receipt type. */ + RESERVED = 0, +} diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 66f2b2fafd..d7814ea1dc 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -172,10 +173,10 @@ export class AccountAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -188,7 +189,6 @@ export class AccountAddressRestrictionTransaction extends Transaction { return new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(deletion, this.networkType)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountLinkTransaction.ts b/src/model/transaction/AccountLinkTransaction.ts index 9e6e813de3..2374266254 100644 --- a/src/model/transaction/AccountLinkTransaction.ts +++ b/src/model/transaction/AccountLinkTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/AccountLinkTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountLinkTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -150,10 +151,10 @@ export class AccountLinkTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountLinkTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountLinkTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -161,7 +162,6 @@ export class AccountLinkTransaction extends Transaction { new KeyDto(Convert.hexToUint8(this.remotePublicKey)), this.linkAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMetadataTransaction.ts b/src/model/transaction/AccountMetadataTransaction.ts index 78b2009887..d01429d3af 100644 --- a/src/model/transaction/AccountMetadataTransaction.ts +++ b/src/model/transaction/AccountMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/AccountMetadataTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -178,10 +179,10 @@ export class AccountMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -191,7 +192,6 @@ export class AccountMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index c739b574b8..b8a3f542a5 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMosaicRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountMosaicRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -172,10 +173,10 @@ export class AccountMosaicRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMosaicRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMosaicRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -188,7 +189,6 @@ export class AccountMosaicRestrictionTransaction extends Transaction { return new UnresolvedMosaicIdDto(deletion.id.toDTO()); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountOperationRestrictionTransaction.ts b/src/model/transaction/AccountOperationRestrictionTransaction.ts index 899602794f..1dc508e493 100644 --- a/src/model/transaction/AccountOperationRestrictionTransaction.ts +++ b/src/model/transaction/AccountOperationRestrictionTransaction.ts @@ -22,6 +22,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountOperationRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -160,10 +161,10 @@ export class AccountOperationRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountOperationRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountOperationRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -172,7 +173,6 @@ export class AccountOperationRestrictionTransaction extends Transaction { this.restrictionAdditions, this.restrictionDeletions, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AddressAliasTransaction.ts b/src/model/transaction/AddressAliasTransaction.ts index 8f58f5d2a4..c94cd8492c 100644 --- a/src/model/transaction/AddressAliasTransaction.ts +++ b/src/model/transaction/AddressAliasTransaction.ts @@ -21,6 +21,7 @@ import { AddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/A import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -172,10 +173,10 @@ export class AddressAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAddressAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAddressAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -184,7 +185,6 @@ export class AddressAliasTransaction extends Transaction { new AddressDto(RawAddress.stringToAddress(this.address.plain())), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AggregateTransaction.ts b/src/model/transaction/AggregateTransaction.ts index a92792e4b5..82680242a5 100644 --- a/src/model/transaction/AggregateTransaction.ts +++ b/src/model/transaction/AggregateTransaction.ts @@ -20,6 +20,8 @@ import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/ import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; import {CosignatureBuilder} from '../../infrastructure/catbuffer/CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -139,36 +141,19 @@ export class AggregateTransaction extends Transaction { const builder = type === TransactionType.AGGREGATE_COMPLETE ? AggregateCompleteTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)) : AggregateBondedTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)); - const innerTransactionHex = Convert.uint8ToHex(builder.getTransactions()); + const innerTransactions = builder.getTransactions().map((t) => Convert.uint8ToHex(EmbeddedTransactionHelper.serialize(t))); const networkType = builder.getNetwork().valueOf(); - const consignaturesHex = Convert.uint8ToHex(builder.getCosignatures()); - - /** - * Get inner transactions array - */ - const embeddedTransactionArray: string[] = []; - let innerBinary = innerTransactionHex; - while (innerBinary.length) { - const payloadSize = parseInt(Convert.uint8ToHex(Convert.hexToUint8(innerBinary.substring(0, 8)).reverse()), 16) * 2; - const innerTransaction = innerBinary.substring(0, payloadSize); - embeddedTransactionArray.push(innerTransaction); - innerBinary = innerBinary.substring(payloadSize).replace(/\b0+/g, ''); - } - - /** - * Get cosignatures - */ - const consignatureArray = consignaturesHex.match(/.{1,192}/g); - const consignatures = consignatureArray ? consignatureArray.map((cosignature) => - new AggregateTransactionCosignature( - cosignature.substring(64, 192), - PublicAccount.createFromPublicKey(cosignature.substring(0, 64), networkType), - )) : []; + const consignatures = builder.getCosignatures().map((cosig) => { + return new AggregateTransactionCosignature( + Convert.uint8ToHex(cosig.signature.signature), + PublicAccount.createFromPublicKey(Convert.uint8ToHex(cosig.signerPublicKey.key), networkType), + ); + }); return type === TransactionType.AGGREGATE_COMPLETE ? AggregateTransaction.createComplete( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -176,7 +161,7 @@ export class AggregateTransaction extends Transaction { new UInt64(builder.fee.amount), ) : AggregateTransaction.createBonded( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -312,23 +297,14 @@ export class AggregateTransaction extends Transaction { protected generateBytes(): Uint8Array { const signerBuffer = new Uint8Array(32); const signatureBuffer = new Uint8Array(64); - let transactions = Uint8Array.from([]); - this.innerTransactions.forEach((transaction) => { - const transactionByte = transaction.toAggregateTransactionBytes(); - const innerTransactionPadding = new Uint8Array(this.getInnerTransactionPaddingSize(transactionByte.length, 8)); - const paddedTransactionByte = GeneratorUtils.concatTypedArrays(transactionByte, innerTransactionPadding); - transactions = GeneratorUtils.concatTypedArrays(transactions, paddedTransactionByte); - }); - - let cosignatures = Uint8Array.from([]); - this.cosignatures.forEach((cosignature) => { + const transactions = this.innerTransactions.map((transaction) => (transaction as Transaction).toEmbeddedTransaction()); + const cosignatures = this.cosignatures.map((cosignature) => { const signerBytes = Convert.hexToUint8(cosignature.signer.publicKey); const signatureBytes = Convert.hexToUint8(cosignature.signature); - const cosignatureBytes = new CosignatureBuilder( + return new CosignatureBuilder( new KeyDto(signerBytes), new SignatureDto(signatureBytes), - ).serialize(); - cosignatures = GeneratorUtils.concatTypedArrays(cosignatures, cosignatureBytes); + ); }); const transactionBuilder = this.type === TransactionType.AGGREGATE_COMPLETE ? @@ -361,9 +337,9 @@ export class AggregateTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Method not implemented'); } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 3bab2f98aa..a8bd009e0d 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedHashLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedHashLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { HashLockTransactionBuilder } from '../../infrastructure/catbuffer/HashLockTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; @@ -188,10 +189,10 @@ export class LockFundsTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedHashLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedHashLockTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -201,7 +202,6 @@ export class LockFundsTransaction extends Transaction { new BlockDurationDto(this.duration.toDTO()), new Hash256Dto(Convert.hexToUint8(this.hash)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 7323856186..c2240472cd 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -20,6 +20,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAddressRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAddressRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -218,10 +219,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -232,7 +233,6 @@ export class MosaicAddressRestrictionTransaction extends Transaction { this.newRestrictionValue.toDTO(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.targetAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAliasTransaction.ts b/src/model/transaction/MosaicAliasTransaction.ts index f259c5af13..238e8b1fbd 100644 --- a/src/model/transaction/MosaicAliasTransaction.ts +++ b/src/model/transaction/MosaicAliasTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAliasTransactionBuilder'; import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; @@ -164,10 +165,10 @@ export class MosaicAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -176,7 +177,6 @@ export class MosaicAliasTransaction extends Transaction { new MosaicIdDto(this.mosaicId.id.toDTO()), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicDefinitionTransaction.ts b/src/model/transaction/MosaicDefinitionTransaction.ts index a43a733825..5b3fe0754b 100644 --- a/src/model/transaction/MosaicDefinitionTransaction.ts +++ b/src/model/transaction/MosaicDefinitionTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedMosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicDefinitionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicDefinitionTransactionBuilder'; @@ -205,10 +206,10 @@ export class MosaicDefinitionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicDefinitionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicDefinitionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -219,7 +220,6 @@ export class MosaicDefinitionTransaction extends Transaction { this.flags.getValue(), this.divisibility, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index 35ff2de88e..7985c2947c 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -20,6 +20,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicGlobalRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicGlobalRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicGlobalRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicGlobalRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -226,10 +227,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicGlobalRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicGlobalRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -242,7 +243,6 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { this.previousRestrictionType.valueOf(), this.newRestrictionType.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index ce5b5135cf..c491717997 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/MosaicMetadataTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -194,10 +195,10 @@ export class MosaicMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -208,7 +209,6 @@ export class MosaicMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 3e6b2685cb..ca7e404242 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/MosaicSupplyChangeTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -170,10 +171,10 @@ export class MosaicSupplyChangeTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicSupplyChangeTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicSupplyChangeTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -182,7 +183,6 @@ export class MosaicSupplyChangeTransaction extends Transaction { new AmountDto(this.delta.toDTO()), this.action.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MultisigAccountModificationTransaction.ts b/src/model/transaction/MultisigAccountModificationTransaction.ts index d8a4dc1d77..fcaefd7fcf 100644 --- a/src/model/transaction/MultisigAccountModificationTransaction.ts +++ b/src/model/transaction/MultisigAccountModificationTransaction.ts @@ -19,6 +19,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import {MultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/MultisigAccountModificationTransactionBuilder'; @@ -193,10 +194,10 @@ export class MultisigAccountModificationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMultisigAccountModificationTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMultisigAccountModificationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -210,7 +211,6 @@ export class MultisigAccountModificationTransaction extends Transaction { return new KeyDto(Convert.hexToUint8(deletion.publicKey)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceMetadataTransaction.ts b/src/model/transaction/NamespaceMetadataTransaction.ts index f58453c268..36e80f13e3 100644 --- a/src/model/transaction/NamespaceMetadataTransaction.ts +++ b/src/model/transaction/NamespaceMetadataTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedNamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceMetadataTransactionBuilder'; @@ -192,10 +193,10 @@ export class NamespaceMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedNamespaceMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedNamespaceMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -206,7 +207,6 @@ export class NamespaceMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceRegistrationTransaction.ts b/src/model/transaction/NamespaceRegistrationTransaction.ts index 935ee02bc7..cad026814e 100644 --- a/src/model/transaction/NamespaceRegistrationTransaction.ts +++ b/src/model/transaction/NamespaceRegistrationTransaction.ts @@ -20,6 +20,7 @@ import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDt import { EmbeddedNamespaceRegistrationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceRegistrationTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceRegistrationTransactionBuilder'; @@ -244,12 +245,11 @@ export class NamespaceRegistrationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - let transactionBuilder: EmbeddedNamespaceRegistrationTransactionBuilder; + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { if (this.registrationType === NamespaceRegistrationType.RootNamespace) { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( + return new EmbeddedNamespaceRegistrationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -259,19 +259,17 @@ export class NamespaceRegistrationTransaction extends Transaction { new BlockDurationDto(this.duration!.toDTO()), undefined, ); - } else { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( - new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), - this.versionToDTO(), - this.networkType.valueOf(), - TransactionType.REGISTER_NAMESPACE.valueOf(), - new NamespaceIdDto(this.namespaceId.id.toDTO()), - Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), - undefined, - new NamespaceIdDto(this.parentId!.id.toDTO()), - ); } - return transactionBuilder.serialize(); + return new EmbeddedNamespaceRegistrationTransactionBuilder( + new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), + this.versionToDTO(), + this.networkType.valueOf(), + TransactionType.REGISTER_NAMESPACE.valueOf(), + new NamespaceIdDto(this.namespaceId.id.toDTO()), + Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), + undefined, + new NamespaceIdDto(this.parentId!.id.toDTO()), + ); } /** diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 3606ede7e7..df3ee1c863 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -18,6 +18,7 @@ import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedSecretLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretLockTransactionBuilder } from '../../infrastructure/catbuffer/SecretLockTransactionBuilder'; @@ -214,10 +215,10 @@ export class SecretLockTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretLockTransactionBuilder( new KeyDto(convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -229,7 +230,6 @@ export class SecretLockTransaction extends Transaction { this.hashType.valueOf(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index 2c3a9de798..793d2a012d 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -21,6 +21,7 @@ import { Convert, Convert as convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedSecretProofTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretProofTransactionBuilder } from '../../infrastructure/catbuffer/SecretProofTransactionBuilder'; @@ -199,10 +200,10 @@ export class SecretProofTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretProofTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretProofTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -212,7 +213,6 @@ export class SecretProofTransaction extends Transaction { new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), this.getProofByte(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index f42edc8415..4830838648 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -16,6 +16,8 @@ import { KeyPair, SHA3Hasher, SignSchema } from '../../core/crypto'; import { Convert } from '../../core/format'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import { SerializeTransactionToJSON } from '../../infrastructure/transaction/SerializeTransactionToJSON'; import { Account } from '../account/Account'; import { PublicAccount } from '../account/PublicAccount'; @@ -184,7 +186,7 @@ export abstract class Transaction { /** * @internal */ - protected abstract generateEmbeddedBytes(): Uint8Array; + public abstract toEmbeddedTransaction(): EmbeddedTransactionBuilder; /** * @internal @@ -286,7 +288,9 @@ export abstract class Transaction { * @return transaction with signer serialized to be part of an aggregate transaction */ public toAggregateTransactionBytes() { - return this.generateEmbeddedBytes(); + return EmbeddedTransactionHelper.serialize( + this.toEmbeddedTransaction(), + ); } /** diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index d858927b9e..4e99bb1d96 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -18,6 +18,7 @@ import * as Long from 'long'; import {Convert} from '../../core/format'; import {UnresolvedMapping} from '../../core/utils/UnresolvedMapping'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import {EmbeddedTransferTransactionBuilder} from '../../infrastructure/catbuffer/EmbeddedTransferTransactionBuilder'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -256,10 +257,10 @@ export class TransferTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedTransferTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedTransferTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -271,7 +272,6 @@ export class TransferTransaction extends Transaction { }), this.getMessageBuffer(), ); - return transactionBuilder.serialize(); } /** diff --git a/test/model/transaction/Transaction.spec.ts b/test/model/transaction/Transaction.spec.ts index 0b3eb881b4..04fb2e28b3 100644 --- a/test/model/transaction/Transaction.spec.ts +++ b/test/model/transaction/Transaction.spec.ts @@ -17,6 +17,7 @@ import { expect } from 'chai'; import { Observable } from 'rxjs/internal/Observable'; import { Convert } from '../../../src/core/format/Convert'; +import { EmbeddedTransactionBuilder } from '../../../src/infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; @@ -400,7 +401,7 @@ class FakeTransaction extends Transaction { throw new Error('Not implemented'); } - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Not implemented'); } resolveAliases(): TransferTransaction { From 2c7de1fc0c48549d4001049d26690fa5acfba81b Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:51:06 +0000 Subject: [PATCH 03/22] Fixed missing semicolon --- .../catbuffer/EmbeddedTransactionHelper.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index ad436cfc30..9a9c16712f 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -125,7 +125,7 @@ export class EmbeddedTransactionHelper { padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); return GeneratorUtils.concatTypedArrays(byte, padding); default: - throw new Error(`Transaction type: ${transaction.type} not recognized.`) + throw new Error(`Transaction type: ${transaction.type} not recognized.`); } } @@ -133,45 +133,45 @@ export class EmbeddedTransactionHelper { const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); switch (header.getType()) { case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: - return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: - return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: - return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: - return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: - return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: - return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: - return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: - return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: - return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: - return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: - return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: - return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: - return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: - return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes); default: - throw new Error(`Transaction type: ${header.getType()} not recognized.`) + throw new Error(`Transaction type: ${header.getType()} not recognized.`); } } From 3f68b80f3ae45419b27831eac6349405b10d51ad Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:27:50 +0000 Subject: [PATCH 04/22] Fixed #393 applied catbuffer generator on aggregate --- .../AggregateBondedTransactionBuilder.ts | 8 +- .../AggregateCompleteTransactionBuilder.ts | 8 +- .../AggregateTransactionBodyBuilder.ts | 52 ++- .../catbuffer/BalanceChangeReceiptBuilder.ts | 111 +++++ .../BalanceTransferReceiptBuilder.ts | 132 ++++++ .../catbuffer/BlockHeaderBuilder.ts | 387 ++++++++++++++++++ .../catbuffer/EmbeddedTransactionHelper.ts | 181 ++++++++ src/infrastructure/catbuffer/EntityTypeDto.ts | 40 ++ .../catbuffer/GeneratorUtils.ts | 9 + .../catbuffer/InflationReceiptBuilder.ts | 92 +++++ .../catbuffer/MosaicExpiryReceiptBuilder.ts | 92 +++++ .../NamespaceExpiryReceiptBuilder.ts | 92 +++++ .../catbuffer/ReceiptBuilder.ts | 108 +++++ .../catbuffer/ReceiptTypeDto.ts | 27 ++ .../AccountAddressRestrictionTransaction.ts | 8 +- .../transaction/AccountLinkTransaction.ts | 8 +- .../transaction/AccountMetadataTransaction.ts | 8 +- .../AccountMosaicRestrictionTransaction.ts | 8 +- .../AccountOperationRestrictionTransaction.ts | 8 +- .../transaction/AddressAliasTransaction.ts | 8 +- src/model/transaction/AggregateTransaction.ts | 58 +-- src/model/transaction/LockFundsTransaction.ts | 8 +- .../MosaicAddressRestrictionTransaction.ts | 8 +- .../transaction/MosaicAliasTransaction.ts | 8 +- .../MosaicDefinitionTransaction.ts | 8 +- .../MosaicGlobalRestrictionTransaction.ts | 8 +- .../transaction/MosaicMetadataTransaction.ts | 8 +- .../MosaicSupplyChangeTransaction.ts | 8 +- .../MultisigAccountModificationTransaction.ts | 8 +- .../NamespaceMetadataTransaction.ts | 8 +- .../NamespaceRegistrationTransaction.ts | 30 +- .../transaction/SecretLockTransaction.ts | 8 +- .../transaction/SecretProofTransaction.ts | 8 +- src/model/transaction/Transaction.ts | 8 +- src/model/transaction/TransferTransaction.ts | 8 +- test/model/transaction/Transaction.spec.ts | 3 +- 36 files changed, 1431 insertions(+), 151 deletions(-) create mode 100644 src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BlockHeaderBuilder.ts create mode 100644 src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts create mode 100644 src/infrastructure/catbuffer/InflationReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptTypeDto.ts diff --git a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts index 56f42da250..ba3b56b75f 100644 --- a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts index 6dd372648f..f6b6e0983e 100644 --- a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts index b4de916720..5dd2492e47 100644 --- a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts @@ -19,6 +19,9 @@ *** along with Catapult. If not, see . **/ +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from './EmbeddedTransactionHelper'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -29,9 +32,9 @@ export class AggregateTransactionBodyBuilder { /** Reserved padding to align end of AggregateTransactionHeader on 8-byte boundary. */ aggregateTransactionHeader_Reserved1: number; /** Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - transactions: Uint8Array; + transactions: EmbeddedTransactionBuilder[]; /** Cosignatures data (fills remaining body space after transactions). */ - cosignatures: Uint8Array; + cosignatures: CosignatureBuilder[]; /** * Constructor. @@ -40,7 +43,8 @@ export class AggregateTransactionBodyBuilder { * @param transactions Sub-transaction data (transactions are variable sized and payload size is in bytes). * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ - public constructor(transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + // tslint:disable-next-line: max-line-length + public constructor(transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { this.transactionsHash = transactionsHash; this.aggregateTransactionHeader_Reserved1 = 0; this.transactions = transactions; @@ -62,9 +66,24 @@ export class AggregateTransactionBodyBuilder { // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); byteArray.splice(0, 4); - const transactions = GeneratorUtils.getBytes(Uint8Array.from(byteArray), payloadSize); - byteArray.splice(0, payloadSize); - const cosignatures = Uint8Array.from(byteArray); + let transactionsByteSize = payloadSize; + const transactions: EmbeddedTransactionBuilder[] = []; + while (transactionsByteSize > 0) { + const item = EmbeddedTransactionHelper.loadFromBinary(Uint8Array.from(byteArray)); + transactions.push(item); + const itemSize = item.getSize() + GeneratorUtils.getTransactionPaddingSize(item.getSize(), 8); + transactionsByteSize -= itemSize; + byteArray.splice(0, itemSize); + } + let cosignaturesByteSize = byteArray.length; + const cosignatures: CosignatureBuilder[] = []; + while (cosignaturesByteSize > 0) { + const item = CosignatureBuilder.loadFromBinary(Uint8Array.from(byteArray)); + cosignatures.push(item); + const itemSize = item.getSize(); + cosignaturesByteSize -= itemSize; + byteArray.splice(0, itemSize); + } return new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -91,7 +110,7 @@ export class AggregateTransactionBodyBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.transactions; } @@ -100,7 +119,7 @@ export class AggregateTransactionBodyBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.cosignatures; } @@ -114,8 +133,8 @@ export class AggregateTransactionBodyBuilder { size += this.transactionsHash.getSize(); size += 4; // payloadSize size += 4; // aggregateTransactionHeader_Reserved1 - size += this.transactions.length; - size += this.cosignatures.length; + this.transactions.forEach((o) => size += EmbeddedTransactionHelper.serialize(o).length); + this.cosignatures.forEach((o) => size += o.getSize()); return size; } @@ -128,13 +147,20 @@ export class AggregateTransactionBodyBuilder { let newArray = Uint8Array.from([]); const transactionsHashBytes = this.transactionsHash.serialize(); newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); - const payloadSizeBytes = GeneratorUtils.uintToBuffer(this.transactions.length, 4); + // tslint:disable-next-line: max-line-length + const payloadSizeBytes = GeneratorUtils.uintToBuffer(EmbeddedTransactionHelper.getEmbeddedTransactionSize(this.transactions), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, payloadSizeBytes); // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getAggregateTransactionHeader_Reserved1(), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, aggregateTransactionHeader_Reserved1Bytes); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.transactions); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.cosignatures); + this.transactions.forEach((item) => { + const transactionsBytes = EmbeddedTransactionHelper.serialize(item); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsBytes); + }); + this.cosignatures.forEach((item) => { + const cosignaturesBytes = item.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, cosignaturesBytes); + }); return newArray; } } diff --git a/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts new file mode 100644 index 0000000000..7670f20e0f --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts @@ -0,0 +1,111 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance change receipt. */ +export class BalanceChangeReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Account public key. */ + targetPublicKey: KeyDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param targetPublicKey Account public key. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, targetPublicKey: KeyDto) { + super(version, type); + this.mosaic = mosaic; + this.targetPublicKey = targetPublicKey; + } + + /** + * Creates an instance of BalanceChangeReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceChangeReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceChangeReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const targetPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, targetPublicKey.getSize()); + return new BalanceChangeReceiptBuilder(superObject.version, superObject.type, mosaic, targetPublicKey); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets account public key. + * + * @return Account public key. + */ + public getTargetPublicKey(): KeyDto { + return this.targetPublicKey; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.targetPublicKey.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const targetPublicKeyBytes = this.targetPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, targetPublicKeyBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts new file mode 100644 index 0000000000..89215dc6c1 --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts @@ -0,0 +1,132 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { AddressDto } from './AddressDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance transfer receipt. */ +export class BalanceTransferReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Mosaic sender public key. */ + senderPublicKey: KeyDto; + /** Mosaic recipient address. */ + recipientAddress: AddressDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param senderPublicKey Mosaic sender public key. + * @param recipientAddress Mosaic recipient address. + */ + // tslint:disable-next-line: max-line-length + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, senderPublicKey: KeyDto, recipientAddress: AddressDto) { + super(version, type); + this.mosaic = mosaic; + this.senderPublicKey = senderPublicKey; + this.recipientAddress = recipientAddress; + } + + /** + * Creates an instance of BalanceTransferReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceTransferReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceTransferReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const senderPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, senderPublicKey.getSize()); + const recipientAddress = AddressDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, recipientAddress.getSize()); + // tslint:disable-next-line: max-line-length + return new BalanceTransferReceiptBuilder(superObject.version, superObject.type, mosaic, senderPublicKey, recipientAddress); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets mosaic sender public key. + * + * @return Mosaic sender public key. + */ + public getSenderPublicKey(): KeyDto { + return this.senderPublicKey; + } + + /** + * Gets mosaic recipient address. + * + * @return Mosaic recipient address. + */ + public getRecipientAddress(): AddressDto { + return this.recipientAddress; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.senderPublicKey.getSize(); + size += this.recipientAddress.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const senderPublicKeyBytes = this.senderPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, senderPublicKeyBytes); + const recipientAddressBytes = this.recipientAddress.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, recipientAddressBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BlockHeaderBuilder.ts b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts new file mode 100644 index 0000000000..eb693aa3fa --- /dev/null +++ b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts @@ -0,0 +1,387 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { BlockFeeMultiplierDto } from './BlockFeeMultiplierDto'; +import { DifficultyDto } from './DifficultyDto'; +import { EntityTypeDto } from './EntityTypeDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { Hash256Dto } from './Hash256Dto'; +import { HeightDto } from './HeightDto'; +import { KeyDto } from './KeyDto'; +import { NetworkTypeDto } from './NetworkTypeDto'; +import { SignatureDto } from './SignatureDto'; +import { TimestampDto } from './TimestampDto'; + +/** Binary layout for a block header. */ +export class BlockHeaderBuilder { + /** Entity size. */ + size = 0; + /** Reserved padding to align Signature on 8-byte boundary. */ + verifiableEntityHeader_Reserved1: number; + /** Entity signature. */ + signature: SignatureDto; + /** Entity signer's public key. */ + signerPublicKey: KeyDto; + /** Reserved padding to align end of EntityBody on 8-byte boundary. */ + entityBody_Reserved1: number; + /** Entity version. */ + version: number; + /** Entity network. */ + network: NetworkTypeDto; + /** Entity type. */ + type: EntityTypeDto; + /** Block height. */ + height: HeightDto; + /** Number of milliseconds elapsed since creation of nemesis block. */ + timestamp: TimestampDto; + /** Block difficulty. */ + difficulty: DifficultyDto; + /** Previous block hash. */ + previousBlockHash: Hash256Dto; + /** Hash of the transactions in this block. */ + transactionsHash: Hash256Dto; + /** Hash of the receipts generated by this block. */ + receiptsHash: Hash256Dto; + /** Hash of the global chain state at this block. */ + stateHash: Hash256Dto; + /** Beneficiary public key designated by harvester. */ + beneficiaryPublicKey: KeyDto; + /** Fee multiplier applied to block transactions. */ + feeMultiplier: BlockFeeMultiplierDto; + /** Reserved padding to align end of BlockHeader on 8-byte boundary. */ + blockHeader_Reserved1: number; + + /** + * Constructor. + * + * @param signature Entity signature. + * @param signerPublicKey Entity signer's public key. + * @param version Entity version. + * @param network Entity network. + * @param type Entity type. + * @param height Block height. + * @param timestamp Number of milliseconds elapsed since creation of nemesis block. + * @param difficulty Block difficulty. + * @param previousBlockHash Previous block hash. + * @param transactionsHash Hash of the transactions in this block. + * @param receiptsHash Hash of the receipts generated by this block. + * @param stateHash Hash of the global chain state at this block. + * @param beneficiaryPublicKey Beneficiary public key designated by harvester. + * @param feeMultiplier Fee multiplier applied to block transactions. + */ + // tslint:disable-next-line: max-line-length + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, height: HeightDto, timestamp: TimestampDto, difficulty: DifficultyDto, previousBlockHash: Hash256Dto, transactionsHash: Hash256Dto, receiptsHash: Hash256Dto, stateHash: Hash256Dto, beneficiaryPublicKey: KeyDto, feeMultiplier: BlockFeeMultiplierDto) { + this.verifiableEntityHeader_Reserved1 = 0; + this.signature = signature; + this.signerPublicKey = signerPublicKey; + this.entityBody_Reserved1 = 0; + this.version = version; + this.network = network; + this.type = type; + this.height = height; + this.timestamp = timestamp; + this.difficulty = difficulty; + this.previousBlockHash = previousBlockHash; + this.transactionsHash = transactionsHash; + this.receiptsHash = receiptsHash; + this.stateHash = stateHash; + this.beneficiaryPublicKey = beneficiaryPublicKey; + this.feeMultiplier = feeMultiplier; + this.blockHeader_Reserved1 = 0; + } + + /** + * Creates an instance of BlockHeaderBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BlockHeaderBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BlockHeaderBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const signature = SignatureDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signature.getSize()); + const signerPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signerPublicKey.getSize()); + const entityBody_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const network = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const height = HeightDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, height.getSize()); + const timestamp = TimestampDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, timestamp.getSize()); + const difficulty = DifficultyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, difficulty.getSize()); + const previousBlockHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, previousBlockHash.getSize()); + const transactionsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, transactionsHash.getSize()); + const receiptsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, receiptsHash.getSize()); + const stateHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, stateHash.getSize()); + const beneficiaryPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, beneficiaryPublicKey.getSize()); + const feeMultiplier = BlockFeeMultiplierDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, feeMultiplier.getSize()); + const blockHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + return new BlockHeaderBuilder(signature, signerPublicKey, version, network, type, height, timestamp, difficulty, previousBlockHash, transactionsHash, receiptsHash, stateHash, beneficiaryPublicKey, feeMultiplier); + } + + /** + * Gets reserved padding to align Signature on 8-byte boundary. + * + * @return Reserved padding to align Signature on 8-byte boundary. + */ + public getVerifiableEntityHeader_Reserved1(): number { + return this.verifiableEntityHeader_Reserved1; + } + + /** + * Gets entity signature. + * + * @return Entity signature. + */ + public getSignature(): SignatureDto { + return this.signature; + } + + /** + * Gets entity signer's public key. + * + * @return Entity signer's public key. + */ + public getSignerPublicKey(): KeyDto { + return this.signerPublicKey; + } + + /** + * Gets reserved padding to align end of EntityBody on 8-byte boundary. + * + * @return Reserved padding to align end of EntityBody on 8-byte boundary. + */ + public getEntityBody_Reserved1(): number { + return this.entityBody_Reserved1; + } + + /** + * Gets entity version. + * + * @return Entity version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets entity network. + * + * @return Entity network. + */ + public getNetwork(): NetworkTypeDto { + return this.network; + } + + /** + * Gets entity type. + * + * @return Entity type. + */ + public getType(): EntityTypeDto { + return this.type; + } + + /** + * Gets block height. + * + * @return Block height. + */ + public getHeight(): HeightDto { + return this.height; + } + + /** + * Gets number of milliseconds elapsed since creation of nemesis block. + * + * @return Number of milliseconds elapsed since creation of nemesis block. + */ + public getTimestamp(): TimestampDto { + return this.timestamp; + } + + /** + * Gets block difficulty. + * + * @return Block difficulty. + */ + public getDifficulty(): DifficultyDto { + return this.difficulty; + } + + /** + * Gets previous block hash. + * + * @return Previous block hash. + */ + public getPreviousBlockHash(): Hash256Dto { + return this.previousBlockHash; + } + + /** + * Gets hash of the transactions in this block. + * + * @return Hash of the transactions in this block. + */ + public getTransactionsHash(): Hash256Dto { + return this.transactionsHash; + } + + /** + * Gets hash of the receipts generated by this block. + * + * @return Hash of the receipts generated by this block. + */ + public getReceiptsHash(): Hash256Dto { + return this.receiptsHash; + } + + /** + * Gets hash of the global chain state at this block. + * + * @return Hash of the global chain state at this block. + */ + public getStateHash(): Hash256Dto { + return this.stateHash; + } + + /** + * Gets beneficiary public key designated by harvester. + * + * @return Beneficiary public key designated by harvester. + */ + public getBeneficiaryPublicKey(): KeyDto { + return this.beneficiaryPublicKey; + } + + /** + * Gets fee multiplier applied to block transactions. + * + * @return Fee multiplier applied to block transactions. + */ + public getFeeMultiplier(): BlockFeeMultiplierDto { + return this.feeMultiplier; + } + + /** + * Gets reserved padding to align end of BlockHeader on 8-byte boundary. + * + * @return Reserved padding to align end of BlockHeader on 8-byte boundary. + */ + public getBlockHeader_Reserved1(): number { + return this.blockHeader_Reserved1; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 4; // verifiableEntityHeader_Reserved1 + size += this.signature.getSize(); + size += this.signerPublicKey.getSize(); + size += 4; // entityBody_Reserved1 + size += 1; // version + size += 1; // network + size += 2; // type + size += this.height.getSize(); + size += this.timestamp.getSize(); + size += this.difficulty.getSize(); + size += this.previousBlockHash.getSize(); + size += this.transactionsHash.getSize(); + size += this.receiptsHash.getSize(); + size += this.stateHash.getSize(); + size += this.beneficiaryPublicKey.getSize(); + size += this.feeMultiplier.getSize(); + size += 4; // blockHeader_Reserved1 + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getVerifiableEntityHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, verifiableEntityHeader_Reserved1Bytes); + const signatureBytes = this.signature.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signatureBytes); + const signerPublicKeyBytes = this.signerPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signerPublicKeyBytes); + const entityBody_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getEntityBody_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, entityBody_Reserved1Bytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const networkBytes = GeneratorUtils.uintToBuffer(this.network, 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, networkBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + const heightBytes = this.height.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, heightBytes); + const timestampBytes = this.timestamp.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, timestampBytes); + const difficultyBytes = this.difficulty.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, difficultyBytes); + const previousBlockHashBytes = this.previousBlockHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, previousBlockHashBytes); + const transactionsHashBytes = this.transactionsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); + const receiptsHashBytes = this.receiptsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, receiptsHashBytes); + const stateHashBytes = this.stateHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, stateHashBytes); + const beneficiaryPublicKeyBytes = this.beneficiaryPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, beneficiaryPublicKeyBytes); + const feeMultiplierBytes = this.feeMultiplier.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, feeMultiplierBytes); + const blockHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getBlockHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, blockHeader_Reserved1Bytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts new file mode 100644 index 0000000000..ad436cfc30 --- /dev/null +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -0,0 +1,181 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { EntityTypeDto } from './EntityTypeDto' +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder' +import { GeneratorUtils } from './GeneratorUtils' +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder' +import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder' +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder' +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder' +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder' +import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder' +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder' +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder' +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder' +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder' +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder' +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder' +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder' +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder' +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder' +import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder' +import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder' +import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder' +import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder' + +export class EmbeddedTransactionHelper { + + public static serialize(transaction: EmbeddedTransactionBuilder): Uint8Array { + let byte: Uint8Array; + let padding: Uint8Array; + switch (transaction.type) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedTransferTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountLinkTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedHashLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretProofTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicDefinitionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicSupplyChangeTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMultisigAccountModificationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAddressAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceRegistrationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMosaicRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountOperationRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicGlobalRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + default: + throw new Error(`Transaction type: ${transaction.type} not recognized.`) + } + } + + public static loadFromBinary(bytes: Uint8Array):EmbeddedTransactionBuilder { + const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); + switch (header.getType()) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + default: + throw new Error(`Transaction type: ${header.getType()} not recognized.`) + } + } + + public static getEmbeddedTransactionSize(transactions: EmbeddedTransactionBuilder[]): number { + return transactions.map((o) => EmbeddedTransactionHelper.serialize(o).length).reduce((a, b) => a + b, 0); + } +} diff --git a/src/infrastructure/catbuffer/EntityTypeDto.ts b/src/infrastructure/catbuffer/EntityTypeDto.ts index cbbf804d10..4399620a5c 100644 --- a/src/infrastructure/catbuffer/EntityTypeDto.ts +++ b/src/infrastructure/catbuffer/EntityTypeDto.ts @@ -26,4 +26,44 @@ export enum EntityTypeDto { RESERVED = 0, /** Transfer transaction builder. */ TRANSFER_TRANSACTION_BUILDER = 16724, + /** Account link transaction builder. */ + ACCOUNT_LINK_TRANSACTION_BUILDER = 16716, + /** Hash lock transaction builder. */ + HASH_LOCK_TRANSACTION_BUILDER = 16712, + /** Secret lock transaction builder. */ + SECRET_LOCK_TRANSACTION_BUILDER = 16722, + /** Secret proof transaction builder. */ + SECRET_PROOF_TRANSACTION_BUILDER = 16978, + /** Account metadata transaction builder. */ + ACCOUNT_METADATA_TRANSACTION_BUILDER = 16708, + /** Mosaic metadata transaction builder. */ + MOSAIC_METADATA_TRANSACTION_BUILDER = 16964, + /** Namespace metadata transaction builder. */ + NAMESPACE_METADATA_TRANSACTION_BUILDER = 17220, + /** Mosaic definition transaction builder. */ + MOSAIC_DEFINITION_TRANSACTION_BUILDER = 16717, + /** Mosaic supply change transaction builder. */ + MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER = 16973, + /** Multisig account modification transaction builder. */ + MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER = 16725, + /** Address alias transaction builder. */ + ADDRESS_ALIAS_TRANSACTION_BUILDER = 16974, + /** Mosaic alias transaction builder. */ + MOSAIC_ALIAS_TRANSACTION_BUILDER = 17230, + /** Namespace registration transaction builder. */ + NAMESPACE_REGISTRATION_TRANSACTION_BUILDER = 16718, + /** Account address restriction transaction builder. */ + ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16720, + /** Account mosaic restriction transaction builder. */ + ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER = 16976, + /** Account operation restriction transaction builder. */ + ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER = 17232, + /** Mosaic address restriction transaction builder. */ + MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16977, + /** Mosaic global restriction transaction builder. */ + MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER = 16721, + /** Aggregate complete transaction builder. */ + AGGREGATE_COMPLETE_TRANSACTION_BUILDER = 16705, + /** Aggregate bonded transaction builder. */ + AGGREGATE_BONDED_TRANSACTION_BUILDER = 16961, } diff --git a/src/infrastructure/catbuffer/GeneratorUtils.ts b/src/infrastructure/catbuffer/GeneratorUtils.ts index d1c6eb5d9b..74399315e0 100644 --- a/src/infrastructure/catbuffer/GeneratorUtils.ts +++ b/src/infrastructure/catbuffer/GeneratorUtils.ts @@ -145,4 +145,13 @@ export class GeneratorUtils { const bytes = binary.slice(0, size); return bytes; } + + /** + * Gets the padding size that rounds up \a size to the next multiple of \a alignment. + * @param size Inner transaction size + * @param alignment Next multiple alignment + */ + public static getTransactionPaddingSize(size: number, alignment: number): number { + return 0 === size % alignment ? 0 : alignment - (size % alignment); + } } diff --git a/src/infrastructure/catbuffer/InflationReceiptBuilder.ts b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts new file mode 100644 index 0000000000..d9d12527ec --- /dev/null +++ b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for an inflation receipt. */ +export class InflationReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder) { + super(version, type); + this.mosaic = mosaic; + } + + /** + * Creates an instance of InflationReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of InflationReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): InflationReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + return new InflationReceiptBuilder(superObject.version, superObject.type, mosaic); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..3940e509e5 --- /dev/null +++ b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicIdDto } from './MosaicIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a mosaic expiry receipt. */ +export class MosaicExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring mosaic id. */ + artifactId: MosaicIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring mosaic id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: MosaicIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of MosaicExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of MosaicExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): MosaicExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = MosaicIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new MosaicExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring mosaic id. + * + * @return Expiring mosaic id. + */ + public getArtifactId(): MosaicIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..2573d688a9 --- /dev/null +++ b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { NamespaceIdDto } from './NamespaceIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a namespace expiry receipt. */ +export class NamespaceExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring namespace id. */ + artifactId: NamespaceIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring namespace id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: NamespaceIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of NamespaceExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of NamespaceExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): NamespaceExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = NamespaceIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new NamespaceExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring namespace id. + * + * @return Expiring namespace id. + */ + public getArtifactId(): NamespaceIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts new file mode 100644 index 0000000000..524bf945df --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -0,0 +1,108 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a receipt entity. */ +export class ReceiptBuilder { + /** Entity size. */ + size = 0; + /** Receipt version. */ + version: number; + /** Receipt type. */ + type: ReceiptTypeDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + */ + public constructor(version: number, type: ReceiptTypeDto) { + this.version = version; + this.type = type; + } + + /** + * Creates an instance of ReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of ReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): ReceiptBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + return new ReceiptBuilder(version, type); + } + + /** + * Gets receipt version. + * + * @return Receipt version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets receipt type. + * + * @return Receipt type. + */ + public getType(): ReceiptTypeDto { + return this.type; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 2; // version + size += 2; // type + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptTypeDto.ts b/src/infrastructure/catbuffer/ReceiptTypeDto.ts new file mode 100644 index 0000000000..f2d4bdc10f --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptTypeDto.ts @@ -0,0 +1,27 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + + +/** Enumeration of receipt types. */ +export enum ReceiptTypeDto { + /** Reserved receipt type. */ + RESERVED = 0, +} diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 66f2b2fafd..d7814ea1dc 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -172,10 +173,10 @@ export class AccountAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -188,7 +189,6 @@ export class AccountAddressRestrictionTransaction extends Transaction { return new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(deletion, this.networkType)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountLinkTransaction.ts b/src/model/transaction/AccountLinkTransaction.ts index 9e6e813de3..2374266254 100644 --- a/src/model/transaction/AccountLinkTransaction.ts +++ b/src/model/transaction/AccountLinkTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/AccountLinkTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountLinkTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -150,10 +151,10 @@ export class AccountLinkTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountLinkTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountLinkTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -161,7 +162,6 @@ export class AccountLinkTransaction extends Transaction { new KeyDto(Convert.hexToUint8(this.remotePublicKey)), this.linkAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMetadataTransaction.ts b/src/model/transaction/AccountMetadataTransaction.ts index 78b2009887..d01429d3af 100644 --- a/src/model/transaction/AccountMetadataTransaction.ts +++ b/src/model/transaction/AccountMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/AccountMetadataTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -178,10 +179,10 @@ export class AccountMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -191,7 +192,6 @@ export class AccountMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index c739b574b8..b8a3f542a5 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMosaicRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountMosaicRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -172,10 +173,10 @@ export class AccountMosaicRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMosaicRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMosaicRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -188,7 +189,6 @@ export class AccountMosaicRestrictionTransaction extends Transaction { return new UnresolvedMosaicIdDto(deletion.id.toDTO()); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountOperationRestrictionTransaction.ts b/src/model/transaction/AccountOperationRestrictionTransaction.ts index 899602794f..1dc508e493 100644 --- a/src/model/transaction/AccountOperationRestrictionTransaction.ts +++ b/src/model/transaction/AccountOperationRestrictionTransaction.ts @@ -22,6 +22,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountOperationRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -160,10 +161,10 @@ export class AccountOperationRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountOperationRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountOperationRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -172,7 +173,6 @@ export class AccountOperationRestrictionTransaction extends Transaction { this.restrictionAdditions, this.restrictionDeletions, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AddressAliasTransaction.ts b/src/model/transaction/AddressAliasTransaction.ts index 8f58f5d2a4..c94cd8492c 100644 --- a/src/model/transaction/AddressAliasTransaction.ts +++ b/src/model/transaction/AddressAliasTransaction.ts @@ -21,6 +21,7 @@ import { AddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/A import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -172,10 +173,10 @@ export class AddressAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAddressAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAddressAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -184,7 +185,6 @@ export class AddressAliasTransaction extends Transaction { new AddressDto(RawAddress.stringToAddress(this.address.plain())), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AggregateTransaction.ts b/src/model/transaction/AggregateTransaction.ts index a92792e4b5..82680242a5 100644 --- a/src/model/transaction/AggregateTransaction.ts +++ b/src/model/transaction/AggregateTransaction.ts @@ -20,6 +20,8 @@ import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/ import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; import {CosignatureBuilder} from '../../infrastructure/catbuffer/CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -139,36 +141,19 @@ export class AggregateTransaction extends Transaction { const builder = type === TransactionType.AGGREGATE_COMPLETE ? AggregateCompleteTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)) : AggregateBondedTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)); - const innerTransactionHex = Convert.uint8ToHex(builder.getTransactions()); + const innerTransactions = builder.getTransactions().map((t) => Convert.uint8ToHex(EmbeddedTransactionHelper.serialize(t))); const networkType = builder.getNetwork().valueOf(); - const consignaturesHex = Convert.uint8ToHex(builder.getCosignatures()); - - /** - * Get inner transactions array - */ - const embeddedTransactionArray: string[] = []; - let innerBinary = innerTransactionHex; - while (innerBinary.length) { - const payloadSize = parseInt(Convert.uint8ToHex(Convert.hexToUint8(innerBinary.substring(0, 8)).reverse()), 16) * 2; - const innerTransaction = innerBinary.substring(0, payloadSize); - embeddedTransactionArray.push(innerTransaction); - innerBinary = innerBinary.substring(payloadSize).replace(/\b0+/g, ''); - } - - /** - * Get cosignatures - */ - const consignatureArray = consignaturesHex.match(/.{1,192}/g); - const consignatures = consignatureArray ? consignatureArray.map((cosignature) => - new AggregateTransactionCosignature( - cosignature.substring(64, 192), - PublicAccount.createFromPublicKey(cosignature.substring(0, 64), networkType), - )) : []; + const consignatures = builder.getCosignatures().map((cosig) => { + return new AggregateTransactionCosignature( + Convert.uint8ToHex(cosig.signature.signature), + PublicAccount.createFromPublicKey(Convert.uint8ToHex(cosig.signerPublicKey.key), networkType), + ); + }); return type === TransactionType.AGGREGATE_COMPLETE ? AggregateTransaction.createComplete( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -176,7 +161,7 @@ export class AggregateTransaction extends Transaction { new UInt64(builder.fee.amount), ) : AggregateTransaction.createBonded( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -312,23 +297,14 @@ export class AggregateTransaction extends Transaction { protected generateBytes(): Uint8Array { const signerBuffer = new Uint8Array(32); const signatureBuffer = new Uint8Array(64); - let transactions = Uint8Array.from([]); - this.innerTransactions.forEach((transaction) => { - const transactionByte = transaction.toAggregateTransactionBytes(); - const innerTransactionPadding = new Uint8Array(this.getInnerTransactionPaddingSize(transactionByte.length, 8)); - const paddedTransactionByte = GeneratorUtils.concatTypedArrays(transactionByte, innerTransactionPadding); - transactions = GeneratorUtils.concatTypedArrays(transactions, paddedTransactionByte); - }); - - let cosignatures = Uint8Array.from([]); - this.cosignatures.forEach((cosignature) => { + const transactions = this.innerTransactions.map((transaction) => (transaction as Transaction).toEmbeddedTransaction()); + const cosignatures = this.cosignatures.map((cosignature) => { const signerBytes = Convert.hexToUint8(cosignature.signer.publicKey); const signatureBytes = Convert.hexToUint8(cosignature.signature); - const cosignatureBytes = new CosignatureBuilder( + return new CosignatureBuilder( new KeyDto(signerBytes), new SignatureDto(signatureBytes), - ).serialize(); - cosignatures = GeneratorUtils.concatTypedArrays(cosignatures, cosignatureBytes); + ); }); const transactionBuilder = this.type === TransactionType.AGGREGATE_COMPLETE ? @@ -361,9 +337,9 @@ export class AggregateTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Method not implemented'); } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 3bab2f98aa..a8bd009e0d 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedHashLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedHashLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { HashLockTransactionBuilder } from '../../infrastructure/catbuffer/HashLockTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; @@ -188,10 +189,10 @@ export class LockFundsTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedHashLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedHashLockTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -201,7 +202,6 @@ export class LockFundsTransaction extends Transaction { new BlockDurationDto(this.duration.toDTO()), new Hash256Dto(Convert.hexToUint8(this.hash)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 7323856186..c2240472cd 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -20,6 +20,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAddressRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAddressRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -218,10 +219,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -232,7 +233,6 @@ export class MosaicAddressRestrictionTransaction extends Transaction { this.newRestrictionValue.toDTO(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.targetAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAliasTransaction.ts b/src/model/transaction/MosaicAliasTransaction.ts index f259c5af13..238e8b1fbd 100644 --- a/src/model/transaction/MosaicAliasTransaction.ts +++ b/src/model/transaction/MosaicAliasTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAliasTransactionBuilder'; import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; @@ -164,10 +165,10 @@ export class MosaicAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -176,7 +177,6 @@ export class MosaicAliasTransaction extends Transaction { new MosaicIdDto(this.mosaicId.id.toDTO()), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicDefinitionTransaction.ts b/src/model/transaction/MosaicDefinitionTransaction.ts index a43a733825..5b3fe0754b 100644 --- a/src/model/transaction/MosaicDefinitionTransaction.ts +++ b/src/model/transaction/MosaicDefinitionTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedMosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicDefinitionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicDefinitionTransactionBuilder'; @@ -205,10 +206,10 @@ export class MosaicDefinitionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicDefinitionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicDefinitionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -219,7 +220,6 @@ export class MosaicDefinitionTransaction extends Transaction { this.flags.getValue(), this.divisibility, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index 35ff2de88e..7985c2947c 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -20,6 +20,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicGlobalRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicGlobalRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicGlobalRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicGlobalRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -226,10 +227,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicGlobalRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicGlobalRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -242,7 +243,6 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { this.previousRestrictionType.valueOf(), this.newRestrictionType.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index ce5b5135cf..c491717997 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/MosaicMetadataTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -194,10 +195,10 @@ export class MosaicMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -208,7 +209,6 @@ export class MosaicMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 3e6b2685cb..ca7e404242 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/MosaicSupplyChangeTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -170,10 +171,10 @@ export class MosaicSupplyChangeTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicSupplyChangeTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicSupplyChangeTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -182,7 +183,6 @@ export class MosaicSupplyChangeTransaction extends Transaction { new AmountDto(this.delta.toDTO()), this.action.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MultisigAccountModificationTransaction.ts b/src/model/transaction/MultisigAccountModificationTransaction.ts index d8a4dc1d77..fcaefd7fcf 100644 --- a/src/model/transaction/MultisigAccountModificationTransaction.ts +++ b/src/model/transaction/MultisigAccountModificationTransaction.ts @@ -19,6 +19,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import {MultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/MultisigAccountModificationTransactionBuilder'; @@ -193,10 +194,10 @@ export class MultisigAccountModificationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMultisigAccountModificationTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMultisigAccountModificationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -210,7 +211,6 @@ export class MultisigAccountModificationTransaction extends Transaction { return new KeyDto(Convert.hexToUint8(deletion.publicKey)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceMetadataTransaction.ts b/src/model/transaction/NamespaceMetadataTransaction.ts index f58453c268..36e80f13e3 100644 --- a/src/model/transaction/NamespaceMetadataTransaction.ts +++ b/src/model/transaction/NamespaceMetadataTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedNamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceMetadataTransactionBuilder'; @@ -192,10 +193,10 @@ export class NamespaceMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedNamespaceMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedNamespaceMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -206,7 +207,6 @@ export class NamespaceMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceRegistrationTransaction.ts b/src/model/transaction/NamespaceRegistrationTransaction.ts index 935ee02bc7..cad026814e 100644 --- a/src/model/transaction/NamespaceRegistrationTransaction.ts +++ b/src/model/transaction/NamespaceRegistrationTransaction.ts @@ -20,6 +20,7 @@ import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDt import { EmbeddedNamespaceRegistrationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceRegistrationTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceRegistrationTransactionBuilder'; @@ -244,12 +245,11 @@ export class NamespaceRegistrationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - let transactionBuilder: EmbeddedNamespaceRegistrationTransactionBuilder; + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { if (this.registrationType === NamespaceRegistrationType.RootNamespace) { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( + return new EmbeddedNamespaceRegistrationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -259,19 +259,17 @@ export class NamespaceRegistrationTransaction extends Transaction { new BlockDurationDto(this.duration!.toDTO()), undefined, ); - } else { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( - new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), - this.versionToDTO(), - this.networkType.valueOf(), - TransactionType.REGISTER_NAMESPACE.valueOf(), - new NamespaceIdDto(this.namespaceId.id.toDTO()), - Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), - undefined, - new NamespaceIdDto(this.parentId!.id.toDTO()), - ); } - return transactionBuilder.serialize(); + return new EmbeddedNamespaceRegistrationTransactionBuilder( + new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), + this.versionToDTO(), + this.networkType.valueOf(), + TransactionType.REGISTER_NAMESPACE.valueOf(), + new NamespaceIdDto(this.namespaceId.id.toDTO()), + Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), + undefined, + new NamespaceIdDto(this.parentId!.id.toDTO()), + ); } /** diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 3606ede7e7..df3ee1c863 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -18,6 +18,7 @@ import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedSecretLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretLockTransactionBuilder } from '../../infrastructure/catbuffer/SecretLockTransactionBuilder'; @@ -214,10 +215,10 @@ export class SecretLockTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretLockTransactionBuilder( new KeyDto(convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -229,7 +230,6 @@ export class SecretLockTransaction extends Transaction { this.hashType.valueOf(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index 2c3a9de798..793d2a012d 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -21,6 +21,7 @@ import { Convert, Convert as convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedSecretProofTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretProofTransactionBuilder } from '../../infrastructure/catbuffer/SecretProofTransactionBuilder'; @@ -199,10 +200,10 @@ export class SecretProofTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretProofTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretProofTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -212,7 +213,6 @@ export class SecretProofTransaction extends Transaction { new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), this.getProofByte(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index f42edc8415..4830838648 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -16,6 +16,8 @@ import { KeyPair, SHA3Hasher, SignSchema } from '../../core/crypto'; import { Convert } from '../../core/format'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import { SerializeTransactionToJSON } from '../../infrastructure/transaction/SerializeTransactionToJSON'; import { Account } from '../account/Account'; import { PublicAccount } from '../account/PublicAccount'; @@ -184,7 +186,7 @@ export abstract class Transaction { /** * @internal */ - protected abstract generateEmbeddedBytes(): Uint8Array; + public abstract toEmbeddedTransaction(): EmbeddedTransactionBuilder; /** * @internal @@ -286,7 +288,9 @@ export abstract class Transaction { * @return transaction with signer serialized to be part of an aggregate transaction */ public toAggregateTransactionBytes() { - return this.generateEmbeddedBytes(); + return EmbeddedTransactionHelper.serialize( + this.toEmbeddedTransaction(), + ); } /** diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index d858927b9e..4e99bb1d96 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -18,6 +18,7 @@ import * as Long from 'long'; import {Convert} from '../../core/format'; import {UnresolvedMapping} from '../../core/utils/UnresolvedMapping'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import {EmbeddedTransferTransactionBuilder} from '../../infrastructure/catbuffer/EmbeddedTransferTransactionBuilder'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -256,10 +257,10 @@ export class TransferTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedTransferTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedTransferTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -271,7 +272,6 @@ export class TransferTransaction extends Transaction { }), this.getMessageBuffer(), ); - return transactionBuilder.serialize(); } /** diff --git a/test/model/transaction/Transaction.spec.ts b/test/model/transaction/Transaction.spec.ts index 0b3eb881b4..04fb2e28b3 100644 --- a/test/model/transaction/Transaction.spec.ts +++ b/test/model/transaction/Transaction.spec.ts @@ -17,6 +17,7 @@ import { expect } from 'chai'; import { Observable } from 'rxjs/internal/Observable'; import { Convert } from '../../../src/core/format/Convert'; +import { EmbeddedTransactionBuilder } from '../../../src/infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; @@ -400,7 +401,7 @@ class FakeTransaction extends Transaction { throw new Error('Not implemented'); } - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Not implemented'); } resolveAliases(): TransferTransaction { From cb0c6b17e3fc838160656f777689122f8f116b72 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:51:06 +0000 Subject: [PATCH 05/22] Fixed missing semicolon --- .../catbuffer/EmbeddedTransactionHelper.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index ad436cfc30..9a9c16712f 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -125,7 +125,7 @@ export class EmbeddedTransactionHelper { padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); return GeneratorUtils.concatTypedArrays(byte, padding); default: - throw new Error(`Transaction type: ${transaction.type} not recognized.`) + throw new Error(`Transaction type: ${transaction.type} not recognized.`); } } @@ -133,45 +133,45 @@ export class EmbeddedTransactionHelper { const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); switch (header.getType()) { case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: - return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: - return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: - return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: - return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: - return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: - return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: - return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: - return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: - return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: - return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: - return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: - return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: - return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: - return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes); default: - throw new Error(`Transaction type: ${header.getType()} not recognized.`) + throw new Error(`Transaction type: ${header.getType()} not recognized.`); } } From 8ef45a0f10b30ddde56c048c948ad0e57f6fa516 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 14:50:41 +0000 Subject: [PATCH 06/22] Applied catbuffer on receipt --- .../catbuffer/ReceiptBuilder.ts | 2 -- src/model/receipt/ArtifactExpiryReceipt.ts | 18 ++++++++------- src/model/receipt/BalanceChangeReceipt.ts | 17 +++++++------- src/model/receipt/BalanceTransferReceipt.ts | 23 ++++++++++--------- src/model/receipt/InflationReceipt.ts | 16 ++++++------- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts index 524bf945df..ffe39705cb 100644 --- a/src/infrastructure/catbuffer/ReceiptBuilder.ts +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -97,8 +97,6 @@ export class ReceiptBuilder { */ public serialize(): Uint8Array { let newArray = Uint8Array.from([]); - const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); - newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); diff --git a/src/model/receipt/ArtifactExpiryReceipt.ts b/src/model/receipt/ArtifactExpiryReceipt.ts index 8df5aab72a..a8a14178e4 100644 --- a/src/model/receipt/ArtifactExpiryReceipt.ts +++ b/src/model/receipt/ArtifactExpiryReceipt.ts @@ -14,11 +14,12 @@ * limitations under the License. */ -import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { MosaicExpiryReceiptBuilder } from '../../infrastructure/catbuffer/MosaicExpiryReceiptBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; +import { NamespaceExpiryReceiptBuilder } from '../../infrastructure/catbuffer/NamespaceExpiryReceiptBuilder'; +import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { MosaicId } from '../mosaic/MosaicId'; import { NamespaceId } from '../namespace/NamespaceId'; -import { UInt64 } from '../UInt64'; import { Receipt } from './Receipt'; import { ReceiptType } from './ReceiptType'; import { ReceiptVersion } from './ReceiptVersion'; @@ -48,10 +49,11 @@ export class ArtifactExpiryReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(12); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.ARTIFACT_EXPIRY, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.artifactId.toHex()).toDTO()), 4); - return buffer; + if (this.artifactId instanceof MosaicId) { + return new MosaicExpiryReceiptBuilder(ReceiptVersion.ARTIFACT_EXPIRY, this.type.valueOf(), + new MosaicIdDto(this.artifactId.toDTO())).serialize(); + } + return new NamespaceExpiryReceiptBuilder(ReceiptVersion.ARTIFACT_EXPIRY, this.type.valueOf(), + new NamespaceIdDto(this.artifactId.id.toDTO())).serialize(); } } diff --git a/src/model/receipt/BalanceChangeReceipt.ts b/src/model/receipt/BalanceChangeReceipt.ts index 83159b621c..7c11b72690 100644 --- a/src/model/receipt/BalanceChangeReceipt.ts +++ b/src/model/receipt/BalanceChangeReceipt.ts @@ -15,7 +15,11 @@ */ import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { BalanceChangeReceiptBuilder } from '../../infrastructure/catbuffer/BalanceChangeReceiptBuilder'; +import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { PublicAccount } from '../account/PublicAccount'; import { MosaicId } from '../mosaic/MosaicId'; import { UInt64 } from '../UInt64'; @@ -62,12 +66,9 @@ export class BalanceChangeReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(52); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.BALANCE_CHANGE, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - buffer.set(Convert.hexToUint8(this.targetPublicAccount.publicKey), 20); - return buffer; + return new BalanceChangeReceiptBuilder(ReceiptVersion.BALANCE_CHANGE, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + new KeyDto(Convert.hexToUint8(this.targetPublicAccount.publicKey)), + ).serialize(); } } diff --git a/src/model/receipt/BalanceTransferReceipt.ts b/src/model/receipt/BalanceTransferReceipt.ts index 1442fe3e82..4b11cc53f0 100644 --- a/src/model/receipt/BalanceTransferReceipt.ts +++ b/src/model/receipt/BalanceTransferReceipt.ts @@ -15,8 +15,13 @@ */ import { Convert } from '../../core/format/Convert'; -import { UnresolvedMapping } from "../../core/utils/UnresolvedMapping"; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; +import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { BalanceTransferReceiptBuilder } from '../../infrastructure/catbuffer/BalanceTransferReceiptBuilder'; +import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; import { MosaicId } from '../mosaic/MosaicId'; @@ -70,15 +75,11 @@ export class BalanceTransferReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const recipient = this.getRecipientBytes(); - const buffer = new Uint8Array(52 + recipient.length); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.BALANCE_TRANSFER, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - buffer.set(Convert.hexToUint8(this.sender.publicKey), 20); - buffer.set(recipient, 52); - return buffer; + return new BalanceTransferReceiptBuilder(ReceiptVersion.BALANCE_TRANSFER, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + new KeyDto(Convert.hexToUint8(this.sender.publicKey)), + new AddressDto(this.getRecipientBytes()), + ).serialize(); } /** diff --git a/src/model/receipt/InflationReceipt.ts b/src/model/receipt/InflationReceipt.ts index 4007cd2200..f9e217043d 100644 --- a/src/model/receipt/InflationReceipt.ts +++ b/src/model/receipt/InflationReceipt.ts @@ -14,8 +14,10 @@ * limitations under the License. */ -import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { InflationReceiptBuilder } from '../../infrastructure/catbuffer/InflationReceiptBuilder'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { MosaicId } from '../mosaic/MosaicId'; import { UInt64 } from '../UInt64'; import { Receipt } from './Receipt'; @@ -56,11 +58,9 @@ export class InflationReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(20); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.INFLATION_RECEIPT, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - return buffer; + return new InflationReceiptBuilder( + ReceiptVersion.INFLATION_RECEIPT, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + ).serialize(); } } From 6d8c4213c116a5116a94303aa28b227b79d0caaa Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 15:17:27 +0000 Subject: [PATCH 07/22] Moved object assgin to a static method in MappingDto --- src/core/utils/DtoMapping.ts | 11 ++++ .../AccountAddressRestrictionTransaction.ts | 17 +++--- .../AccountMosaicRestrictionTransaction.ts | 3 +- src/model/transaction/AggregateTransaction.ts | 9 +-- src/model/transaction/LockFundsTransaction.ts | 3 +- .../MosaicAddressRestrictionTransaction.ts | 3 +- .../MosaicGlobalRestrictionTransaction.ts | 3 +- .../transaction/MosaicMetadataTransaction.ts | 3 +- .../MosaicSupplyChangeTransaction.ts | 3 +- .../transaction/SecretLockTransaction.ts | 3 +- .../transaction/SecretProofTransaction.ts | 3 +- src/model/transaction/Transaction.ts | 7 ++- src/model/transaction/TransferTransaction.ts | 10 ++-- test/infrastructure/RepositoryFactory.spec.ts | 55 +++++++++---------- 14 files changed, 77 insertions(+), 56 deletions(-) diff --git a/src/core/utils/DtoMapping.ts b/src/core/utils/DtoMapping.ts index 576cd49d63..6c62abc026 100644 --- a/src/core/utils/DtoMapping.ts +++ b/src/core/utils/DtoMapping.ts @@ -54,4 +54,15 @@ export class DtoMapping { } }))); } + + /** + * Creates a copy of the first object adding the attributes of the second object. + * @param object the object to be cloned + * @param attributes the extra attributes to be added to the object. + * @returns a copy of the first object with the new attributes added. + */ + public static assign(object: T, attributes: any): T { + return Object.assign({__proto__: Object.getPrototypeOf(object)}, object, attributes); + } + } diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 5aff4bee0e..d730adc931 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AccountAddressRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/AccountAddressRestrictionTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; @@ -199,13 +200,13 @@ export class AccountAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { - restrictionAdditions: - this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)), - restrictionDeletions: - this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)), - }); + return DtoMapping.assign(this, { + restrictionAdditions: + this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex)), + restrictionDeletions: + this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex)), + }); } } diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index b6428e83c7..4037d9e687 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AccountMosaicRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/AccountMosaicRestrictionTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; @@ -199,7 +200,7 @@ export class AccountMosaicRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountMosaicRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { restrictionAdditions: this.restrictionAdditions.map((addition) => statement.resolveMosaicId(addition, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), diff --git a/src/model/transaction/AggregateTransaction.ts b/src/model/transaction/AggregateTransaction.ts index a92792e4b5..cfefb0a4e9 100644 --- a/src/model/transaction/AggregateTransaction.ts +++ b/src/model/transaction/AggregateTransaction.ts @@ -16,6 +16,7 @@ import {KeyPair, MerkleHashBuilder, SHA3Hasher, SignSchema} from '../../core/crypto'; import {Convert} from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/AggregateBondedTransactionBuilder'; import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; @@ -193,7 +194,7 @@ export class AggregateTransaction extends Transaction { */ public addTransactions(transactions: InnerTransaction[]): AggregateTransaction { const innerTransactions = this.innerTransactions.concat(transactions); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {innerTransactions}); + return DtoMapping.assign(this, {innerTransactions}); } /** @@ -204,7 +205,7 @@ export class AggregateTransaction extends Transaction { */ public addCosignatures(cosigs: AggregateTransactionCosignature[]): AggregateTransaction { const cosignatures = this.cosignatures.concat(cosigs); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {cosignatures}); + return DtoMapping.assign(this, {cosignatures}); } /** @@ -407,8 +408,8 @@ export class AggregateTransaction extends Transaction { */ resolveAliases(statement: Statement): AggregateTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, - {innerTransactions: this.innerTransactions.map((tx) => tx.resolveAliases(statement, transactionInfo.index)) + return DtoMapping.assign(this, + {innerTransactions: this.innerTransactions.map((tx) => tx.resolveAliases(statement, transactionInfo.index)) .sort((a, b) => a.transactionInfo!.index - b.transactionInfo!.index)}); } } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 300c871d11..9b6fc2bb35 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedHashLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedHashLockTransactionBuilder'; @@ -211,7 +212,7 @@ export class LockFundsTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): LockFundsTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 44b9ce1682..fa16011421 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { @@ -243,7 +244,7 @@ export class MosaicAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), targetAddress: statement.resolveAddress(this.targetAddress, diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index a172d6da29..e1d654f2d1 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { @@ -253,7 +254,7 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicGlobalRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), referenceMosaicId: statement.resolveMosaicId(this.referenceMosaicId, transactionInfo.height.toString(), diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index b161f8766d..345db15e51 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicMetadataTransactionBuilder'; @@ -219,7 +220,7 @@ export class MosaicMetadataTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicMetadataTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { targetMosaicId: statement.resolveMosaicId(this.targetMosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 69eae71d37..6ef580240f 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicSupplyChangeTransactionBuilder'; @@ -193,7 +194,7 @@ export class MosaicSupplyChangeTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicSupplyChangeTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 6dc523b95e..3b10e31c5c 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -14,6 +14,7 @@ * limitations under the License. */ import { Convert, Convert as convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; @@ -240,7 +241,7 @@ export class SecretLockTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretLockTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index b0fd539718..8e1855c841 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert, Convert as convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedSecretProofTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretProofTransactionBuilder'; @@ -217,7 +218,7 @@ export class SecretProofTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretProofTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index 8e7010c4d1..3ffa2a2891 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -16,6 +16,7 @@ import { KeyPair, SHA3Hasher, SignSchema } from '../../core/crypto'; import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { SerializeTransactionToJSON } from '../../infrastructure/transaction/SerializeTransactionToJSON'; import { Account } from '../account/Account'; import { PublicAccount } from '../account/PublicAccount'; @@ -200,7 +201,7 @@ export abstract class Transaction { * @returns {TransferTransaction} */ public setMaxFee(feeMultiplier: number): Transaction { - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {maxFee: UInt64.fromUint(this.size * feeMultiplier)}); + return DtoMapping.assign(this, {maxFee: UInt64.fromUint(this.size * feeMultiplier)}); } /** @@ -277,7 +278,7 @@ export abstract class Transaction { if (this.type === TransactionType.AGGREGATE_BONDED || this.type === TransactionType.AGGREGATE_COMPLETE) { throw new Error('Inner transaction cannot be an aggregated transaction.'); } - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {signer}); + return DtoMapping.assign(this, {signer}); } /** @@ -345,7 +346,7 @@ export abstract class Transaction { */ public reapplyGiven(deadline: Deadline = Deadline.create()): Transaction { if (this.isUnannounced()) { - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {deadline}); + return DtoMapping.assign(this, {deadline}); } throw new Error('an Announced transaction can\'t be modified'); } diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index 923a5b4b04..7f213f989d 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -44,6 +44,7 @@ import {Transaction} from './Transaction'; import {TransactionInfo} from './TransactionInfo'; import {TransactionType} from './TransactionType'; import {TransactionVersion} from './TransactionVersion'; +import { DtoMapping } from '../../core/utils/DtoMapping'; /** * Transfer transactions contain data about transfers of mosaics and message to another account. @@ -282,10 +283,9 @@ export class TransferTransaction extends Transaction { */ public resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): TransferTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, - {recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex), - mosaics: this.mosaics.map((mosaic) => statement.resolveMosaic(mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex))}); + return DtoMapping.assign(this, {recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex), + mosaics: this.mosaics.map((mosaic) => statement.resolveMosaic(mosaic, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex))}); } } diff --git a/test/infrastructure/RepositoryFactory.spec.ts b/test/infrastructure/RepositoryFactory.spec.ts index 6199559a27..3ee35f30b4 100644 --- a/test/infrastructure/RepositoryFactory.spec.ts +++ b/test/infrastructure/RepositoryFactory.spec.ts @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { expect } from "chai"; -import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp"; -import { BlockRepository } from "../../src/infrastructure/BlockRepository"; -import { instance, mock, when } from "ts-mockito"; -import { BlockInfo } from "../../src/model/blockchain/BlockInfo"; +import { expect } from 'chai'; import { of as observableOf } from 'rxjs'; -import { map } from "rxjs/operators"; -import { NetworkRepository } from "../../src/infrastructure/NetworkRepository"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; +import { map } from 'rxjs/operators'; +import { instance, mock, when } from 'ts-mockito'; +import { BlockRepository } from '../../src/infrastructure/BlockRepository'; +import { NetworkRepository } from '../../src/infrastructure/NetworkRepository'; +import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp'; +import { BlockInfo } from '../../src/model/blockchain/BlockInfo'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; describe('RepositoryFactory', () => { it('Should create repositories', () => { - const repositoryFactory = new RepositoryFactoryHttp("http://localhost:3000"); + const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000'); expect(repositoryFactory.createBlockRepository()).to.be.not.null; expect(repositoryFactory.createNetworkRepository()).to.be.not.null; @@ -50,7 +50,7 @@ describe('RepositoryFactory', () => { const repositoryMock: BlockRepository = mock(); - const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map(v => { + const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map((v) => { counter++; return v; })); @@ -63,10 +63,10 @@ describe('RepositoryFactory', () => { createBlockRepository(): BlockRepository { return instance(repositoryMock); } - })("http://localhost:3000"); + })('http://localhost:3000'); expect(counter).to.be.equals(0); - repositoryFactory.getGenerationHash().subscribe(gh => { + repositoryFactory.getGenerationHash().subscribe((gh) => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); repositoryFactory.getGenerationHash().subscribe(gh => { @@ -76,9 +76,9 @@ describe('RepositoryFactory', () => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); done(); - }) - }) - }) + }); + }); + }); }); @@ -88,8 +88,8 @@ describe('RepositoryFactory', () => { const repositoryMock: NetworkRepository = mock(); - let expectedNetworkType = NetworkType.MIJIN_TEST; - const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map(v => { + const expectedNetworkType = NetworkType.MIJIN_TEST; + const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; return v; })); @@ -98,22 +98,21 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { - createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })("http://localhost:3000"); + })('http://localhost:3000'); expect(counter).to.be.equals(0); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); repositoryFactory.getNetworkType().subscribe(networkType => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); done(); - }) - }) + }); + }); }); @@ -123,8 +122,8 @@ describe('RepositoryFactory', () => { const repositoryMock: NetworkRepository = mock(); - let expectedNetworkType = NetworkType.MIJIN_TEST; - const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map(v => { + const expectedNetworkType = NetworkType.MIJIN_TEST; + const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; return v; })); @@ -137,18 +136,18 @@ describe('RepositoryFactory', () => { createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })("http://localhost:3000", expectedNetworkType); + })('http://localhost:3000', expectedNetworkType); expect(counter).to.be.equals(0); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); repositoryFactory.getNetworkType().subscribe(networkType => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); done(); - }) - }) + }); + }); }); From 4c656b22469035b68f94b1253b11f8fa77e9d767 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Wed, 18 Dec 2019 11:56:34 +0000 Subject: [PATCH 08/22] Fixed #390 Spread operator does not assign super class methods --- .../transaction/AccountAddressRestrictionTransaction.ts | 4 ++-- .../transaction/AccountMosaicRestrictionTransaction.ts | 4 ++-- src/model/transaction/LockFundsTransaction.ts | 4 ++-- .../transaction/MosaicAddressRestrictionTransaction.ts | 4 ++-- .../transaction/MosaicGlobalRestrictionTransaction.ts | 4 ++-- src/model/transaction/MosaicMetadataTransaction.ts | 4 ++-- src/model/transaction/MosaicSupplyChangeTransaction.ts | 4 ++-- src/model/transaction/SecretLockTransaction.ts | 4 ++-- src/model/transaction/SecretProofTransaction.ts | 4 ++-- src/model/transaction/Transaction.ts | 2 +- src/model/transaction/TransferTransaction.ts | 7 ++++--- test/model/transaction/AccountLinkTransaction.spec.ts | 3 +++ test/model/transaction/AccountMetadataTransaction.spec.ts | 3 +++ test/model/transaction/AggregateTransaction.spec.ts | 6 ++++++ test/model/transaction/LockFundsTransaction.spec.ts | 6 ++++++ .../MosaicAddressRestrictionTransaction.spec.ts | 6 ++++++ test/model/transaction/MosaicAliasTransaction.spec.ts | 3 +++ test/model/transaction/MosaicDefinitionTransaction.spec.ts | 3 +++ .../transaction/MosaicGlobalRestrictionTransaction.spec.ts | 6 ++++++ test/model/transaction/MosaicMetadataTransaction.spec.ts | 6 ++++++ .../transaction/MosaicSupplyChangeTransaction.spec.ts | 5 +++++ .../MultisigAccountModificationTransaction.spec.ts | 3 +++ .../model/transaction/NamespaceMetadataTransaction.spec.ts | 3 +++ .../transaction/NamespaceRegistrationTransaction.spec.ts | 3 +++ test/model/transaction/SecretLockTransaction.spec.ts | 5 +++++ test/model/transaction/SecretProofTransaction.spec.ts | 5 +++++ test/model/transaction/TransferTransaction.spec.ts | 6 ++++++ 27 files changed, 95 insertions(+), 22 deletions(-) diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 66f2b2fafd..5aff4bee0e 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -199,13 +199,13 @@ export class AccountAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { restrictionAdditions: this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), restrictionDeletions: this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), - }; + }); } } diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index c739b574b8..b6428e83c7 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -199,13 +199,13 @@ export class AccountMosaicRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountMosaicRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { restrictionAdditions: this.restrictionAdditions.map((addition) => statement.resolveMosaicId(addition, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), restrictionDeletions: this.restrictionDeletions.map((deletion) => statement.resolveMosaicId(deletion, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), - }; + }); } } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 4d31fa9d3b..300c871d11 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -211,8 +211,8 @@ export class LockFundsTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): LockFundsTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 7323856186..44b9ce1682 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -243,10 +243,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), targetAddress: statement.resolveAddress(this.targetAddress, - transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index 35ff2de88e..a172d6da29 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -253,10 +253,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicGlobalRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), referenceMosaicId: statement.resolveMosaicId(this.referenceMosaicId, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index ce5b5135cf..b161f8766d 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -219,8 +219,8 @@ export class MosaicMetadataTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicMetadataTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { targetMosaicId: statement.resolveMosaicId(this.targetMosaicId, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 3e6b2685cb..69eae71d37 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -193,8 +193,8 @@ export class MosaicSupplyChangeTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicSupplyChangeTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 3606ede7e7..6dc523b95e 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -240,10 +240,10 @@ export class SecretLockTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretLockTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index db890c7ca4..b0fd539718 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -217,8 +217,8 @@ export class SecretProofTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretProofTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { recipientAddress: statement.resolveAddress(this.recipientAddress, - transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}; + transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } } diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index f42edc8415..8e7010c4d1 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -200,7 +200,7 @@ export abstract class Transaction { * @returns {TransferTransaction} */ public setMaxFee(feeMultiplier: number): Transaction { - return {...Object.getPrototypeOf(this), maxFee: UInt64.fromUint(this.size * feeMultiplier)}; + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {maxFee: UInt64.fromUint(this.size * feeMultiplier)}); } /** diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index d858927b9e..923a5b4b04 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -282,9 +282,10 @@ export class TransferTransaction extends Transaction { */ public resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): TransferTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return {...Object.getPrototypeOf(this), recipientAddress: statement.resolveAddress(this.recipientAddress, - transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, + {recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex), mosaics: this.mosaics.map((mosaic) => statement.resolveMosaic(mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex))}; + transactionInfo.index, aggregateTransactionIndex))}); } } diff --git a/test/model/transaction/AccountLinkTransaction.spec.ts b/test/model/transaction/AccountLinkTransaction.spec.ts index aed6cb72c6..f197c25f37 100644 --- a/test/model/transaction/AccountLinkTransaction.spec.ts +++ b/test/model/transaction/AccountLinkTransaction.spec.ts @@ -116,5 +116,8 @@ describe('AccountLinkTransaction', () => { ).setMaxFee(2); ​ expect(accountLinkTransaction.maxFee.compact()).to.be.equal(322); + + const signedTransaction = accountLinkTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/AccountMetadataTransaction.spec.ts b/test/model/transaction/AccountMetadataTransaction.spec.ts index ecf15db7be..0ceecdffff 100644 --- a/test/model/transaction/AccountMetadataTransaction.spec.ts +++ b/test/model/transaction/AccountMetadataTransaction.spec.ts @@ -103,6 +103,9 @@ describe('AccountMetadataTransaction', () => { expect(Convert.hexToUint8(accountMetadataTransaction.serialize()).length).to.be.equal(accountMetadataTransaction.size); expect(accountMetadataTransaction.size).to.be.equal(182); + + const signedTransaction = accountMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); }); diff --git a/test/model/transaction/AggregateTransaction.spec.ts b/test/model/transaction/AggregateTransaction.spec.ts index 5ae0e31825..d7eb524dec 100644 --- a/test/model/transaction/AggregateTransaction.spec.ts +++ b/test/model/transaction/AggregateTransaction.spec.ts @@ -582,6 +582,9 @@ describe('AggregateTransaction', () => { ).setMaxFee(2); ​ expect(aggregateTransaction.maxFee.compact()).to.be.equal(560); + + const signedTransaction = aggregateTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -614,5 +617,8 @@ describe('AggregateTransaction', () => { expect(innerTransaction.mosaics[0].id instanceof MosaicId).to.be.true; expect((innerTransaction.recipientAddress as Address).equals(account.address)).to.be.true; expect((innerTransaction.mosaics[0].id as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = aggregateTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/LockFundsTransaction.spec.ts b/test/model/transaction/LockFundsTransaction.spec.ts index ddcf970822..b5016e198d 100644 --- a/test/model/transaction/LockFundsTransaction.spec.ts +++ b/test/model/transaction/LockFundsTransaction.spec.ts @@ -181,6 +181,9 @@ describe('LockFundsTransaction', () => { ).setMaxFee(2); ​ expect(lockFundsTransaction.maxFee.compact()).to.be.equal(368); + + const signedTransactionTest = lockFundsTransaction.signWith(account, generationHash); + expect(signedTransactionTest.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -205,5 +208,8 @@ describe('LockFundsTransaction', () => { ​ expect(transaction.mosaic.id instanceof MosaicId).to.be.true; expect((transaction.mosaic.id as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransactionTest = transaction.signWith(account, generationHash); + expect(signedTransactionTest.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts b/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts index 3783e40f9e..53bbbe7a96 100644 --- a/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts +++ b/test/model/transaction/MosaicAddressRestrictionTransaction.spec.ts @@ -164,6 +164,9 @@ describe('MosaicAddressRestrictionTransaction', () => { ).setMaxFee(2); ​ expect(transaction.maxFee.compact()).to.be.equal(370); + + const signedTransaction = transaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -185,5 +188,8 @@ describe('MosaicAddressRestrictionTransaction', () => { expect(transaction.mosaicId instanceof MosaicId).to.be.true; expect((transaction.targetAddress as Address).equals(account.address)).to.be.true; expect((transaction.mosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = transaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicAliasTransaction.spec.ts b/test/model/transaction/MosaicAliasTransaction.spec.ts index a9c9f698a3..3e9f775b44 100644 --- a/test/model/transaction/MosaicAliasTransaction.spec.ts +++ b/test/model/transaction/MosaicAliasTransaction.spec.ts @@ -118,5 +118,8 @@ describe('MosaicAliasTransaction', () => { ).setMaxFee(2); ​ expect(mosaicAliasTransaction.maxFee.compact()).to.be.equal(290); + + const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicDefinitionTransaction.spec.ts b/test/model/transaction/MosaicDefinitionTransaction.spec.ts index 0de595a09a..9be5cb72b5 100644 --- a/test/model/transaction/MosaicDefinitionTransaction.spec.ts +++ b/test/model/transaction/MosaicDefinitionTransaction.spec.ts @@ -172,5 +172,8 @@ describe('MosaicDefinitionTransaction', () => { ).setMaxFee(2); ​ expect(mosaicDefinitionTransaction.maxFee.compact()).to.be.equal(300); + + const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts b/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts index a4b387dcd5..846f631733 100644 --- a/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts +++ b/test/model/transaction/MosaicGlobalRestrictionTransaction.spec.ts @@ -162,6 +162,9 @@ describe('MosaicGlobalRestrictionTransaction', () => { ).setMaxFee(2); ​ expect(mosaicGlobalRestrictionTransaction.maxFee.compact()).to.be.equal(340); + + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -185,5 +188,8 @@ describe('MosaicGlobalRestrictionTransaction', () => { expect((mosaicGlobalRestrictionTransaction.mosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; expect(mosaicGlobalRestrictionTransaction.referenceMosaicId instanceof MosaicId).to.be.true; expect((mosaicGlobalRestrictionTransaction.referenceMosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicMetadataTransaction.spec.ts b/test/model/transaction/MosaicMetadataTransaction.spec.ts index bea46583b2..c55ad3efed 100644 --- a/test/model/transaction/MosaicMetadataTransaction.spec.ts +++ b/test/model/transaction/MosaicMetadataTransaction.spec.ts @@ -161,6 +161,9 @@ describe('MosaicMetadataTransaction', () => { ).setMaxFee(2); ​ expect(mosaicMetadataTransaction.maxFee.compact()).to.be.equal(380); + + const signedTransaction = mosaicMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -180,5 +183,8 @@ describe('MosaicMetadataTransaction', () => { ​ expect(mosaicMetadataTransaction.targetMosaicId instanceof MosaicId).to.be.true; expect((mosaicMetadataTransaction.targetMosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = mosaicMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts b/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts index 805a1f592c..77f2fdaa90 100644 --- a/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts +++ b/test/model/transaction/MosaicSupplyChangeTransaction.spec.ts @@ -127,6 +127,8 @@ describe('MosaicSupplyChangeTransaction', () => { ).setMaxFee(2); ​ expect(mosaicSupplyChangeTransaction.maxFee.compact()).to.be.equal(290); + const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -144,5 +146,8 @@ describe('MosaicSupplyChangeTransaction', () => { ​ expect(mosaicSupplyChangeTransaction.mosaicId instanceof MosaicId).to.be.true; expect((mosaicSupplyChangeTransaction.mosaicId as MosaicId).equals(resolvedMosaicId)).to.be.true; + + const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/MultisigAccountModificationTransaction.spec.ts b/test/model/transaction/MultisigAccountModificationTransaction.spec.ts index 1b1f4e3707..ff5a2ae193 100644 --- a/test/model/transaction/MultisigAccountModificationTransaction.spec.ts +++ b/test/model/transaction/MultisigAccountModificationTransaction.spec.ts @@ -134,5 +134,8 @@ describe('MultisigAccountModificationTransaction', () => { ).setMaxFee(2); ​ expect(modifyMultisigAccountTransaction.maxFee.compact()).to.be.equal(336); + + const signedTransaction = modifyMultisigAccountTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/NamespaceMetadataTransaction.spec.ts b/test/model/transaction/NamespaceMetadataTransaction.spec.ts index cd881f49b3..27688408c5 100644 --- a/test/model/transaction/NamespaceMetadataTransaction.spec.ts +++ b/test/model/transaction/NamespaceMetadataTransaction.spec.ts @@ -124,5 +124,8 @@ describe('NamespaceMetadataTransaction', () => { ).setMaxFee(2); ​ expect(namespaceMetadataTransaction.maxFee.compact()).to.be.equal(380); + + const signedTransaction = namespaceMetadataTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/NamespaceRegistrationTransaction.spec.ts b/test/model/transaction/NamespaceRegistrationTransaction.spec.ts index c24ebfe45b..921a3bd457 100644 --- a/test/model/transaction/NamespaceRegistrationTransaction.spec.ts +++ b/test/model/transaction/NamespaceRegistrationTransaction.spec.ts @@ -131,5 +131,8 @@ describe('NamespaceRegistrationTransaction', () => { ).setMaxFee(2); ​ expect(registerNamespaceTransaction.maxFee.compact()).to.be.equal(330); + + const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/SecretLockTransaction.spec.ts b/test/model/transaction/SecretLockTransaction.spec.ts index 9cb2c2c33c..612b1ef7b8 100644 --- a/test/model/transaction/SecretLockTransaction.spec.ts +++ b/test/model/transaction/SecretLockTransaction.spec.ts @@ -300,6 +300,8 @@ describe('SecretLockTransaction', () => { ).setMaxFee(2); ​ expect(secretLockTransaction.maxFee.compact()).to.be.equal(420); + const signedTransaction = secretLockTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -322,5 +324,8 @@ describe('SecretLockTransaction', () => { expect(secretLockTransaction.mosaic.id instanceof MosaicId).to.be.true; expect((secretLockTransaction.recipientAddress as Address).equals(account.address)).to.be.true; expect((secretLockTransaction.mosaic.id as MosaicId).equals(mosaicId)).to.be.true; + + const signedTransaction = secretLockTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/SecretProofTransaction.spec.ts b/test/model/transaction/SecretProofTransaction.spec.ts index 7092f966e7..f6c2eece9e 100644 --- a/test/model/transaction/SecretProofTransaction.spec.ts +++ b/test/model/transaction/SecretProofTransaction.spec.ts @@ -257,6 +257,8 @@ describe('SecretProofTransaction', () => { ).setMaxFee(2); ​ expect(secretProofTransaction.maxFee.compact()).to.be.equal(440); + const signedTransaction = secretProofTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -276,5 +278,8 @@ describe('SecretProofTransaction', () => { ​ expect(transferTransaction.recipientAddress instanceof Address).to.be.true; expect((transferTransaction.recipientAddress as Address).equals(account.address)).to.be.true; + + const signedTransaction = transferTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); diff --git a/test/model/transaction/TransferTransaction.spec.ts b/test/model/transaction/TransferTransaction.spec.ts index 6626d55eaf..83e3d09d9b 100644 --- a/test/model/transaction/TransferTransaction.spec.ts +++ b/test/model/transaction/TransferTransaction.spec.ts @@ -407,6 +407,9 @@ describe('TransferTransaction', () => { ).setMaxFee(2); ​ expect(transferTransaction.maxFee.compact()).to.be.equal(378); + + const signedTransaction = transferTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); it('Test resolveAlias can resolve', () => { @@ -426,5 +429,8 @@ describe('TransferTransaction', () => { expect(transferTransaction.mosaics[0].id instanceof MosaicId).to.be.true; expect((transferTransaction.recipientAddress as Address).equals(account.address)).to.be.true; expect((transferTransaction.mosaics[0].id as MosaicId).equals(mosaicId)).to.be.true; + + const signedTransaction = transferTransaction.signWith(account, generationHash); + expect(signedTransaction.hash).not.to.be.undefined; }); }); From a21ba912d3a871d4712540082bb4b1c134eba29a Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 15:17:27 +0000 Subject: [PATCH 09/22] Moved object assgin to a static method in MappingDto --- src/core/utils/DtoMapping.ts | 11 ++++ .../AccountAddressRestrictionTransaction.ts | 17 +++--- .../AccountMosaicRestrictionTransaction.ts | 3 +- src/model/transaction/AggregateTransaction.ts | 9 +-- src/model/transaction/LockFundsTransaction.ts | 3 +- .../MosaicAddressRestrictionTransaction.ts | 3 +- .../MosaicGlobalRestrictionTransaction.ts | 3 +- .../transaction/MosaicMetadataTransaction.ts | 3 +- .../MosaicSupplyChangeTransaction.ts | 3 +- .../transaction/SecretLockTransaction.ts | 3 +- .../transaction/SecretProofTransaction.ts | 3 +- src/model/transaction/Transaction.ts | 7 ++- src/model/transaction/TransferTransaction.ts | 10 ++-- test/infrastructure/RepositoryFactory.spec.ts | 55 +++++++++---------- 14 files changed, 77 insertions(+), 56 deletions(-) diff --git a/src/core/utils/DtoMapping.ts b/src/core/utils/DtoMapping.ts index 576cd49d63..6c62abc026 100644 --- a/src/core/utils/DtoMapping.ts +++ b/src/core/utils/DtoMapping.ts @@ -54,4 +54,15 @@ export class DtoMapping { } }))); } + + /** + * Creates a copy of the first object adding the attributes of the second object. + * @param object the object to be cloned + * @param attributes the extra attributes to be added to the object. + * @returns a copy of the first object with the new attributes added. + */ + public static assign(object: T, attributes: any): T { + return Object.assign({__proto__: Object.getPrototypeOf(object)}, object, attributes); + } + } diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 5aff4bee0e..d730adc931 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AccountAddressRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/AccountAddressRestrictionTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; @@ -199,13 +200,13 @@ export class AccountAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { - restrictionAdditions: - this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)), - restrictionDeletions: - this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex)), - }); + return DtoMapping.assign(this, { + restrictionAdditions: + this.restrictionAdditions.map((addition) => statement.resolveAddress(addition, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex)), + restrictionDeletions: + this.restrictionDeletions.map((deletion) => statement.resolveAddress(deletion, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex)), + }); } } diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index b6428e83c7..4037d9e687 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AccountMosaicRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/AccountMosaicRestrictionTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; @@ -199,7 +200,7 @@ export class AccountMosaicRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): AccountMosaicRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { restrictionAdditions: this.restrictionAdditions.map((addition) => statement.resolveMosaicId(addition, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)), diff --git a/src/model/transaction/AggregateTransaction.ts b/src/model/transaction/AggregateTransaction.ts index a92792e4b5..cfefb0a4e9 100644 --- a/src/model/transaction/AggregateTransaction.ts +++ b/src/model/transaction/AggregateTransaction.ts @@ -16,6 +16,7 @@ import {KeyPair, MerkleHashBuilder, SHA3Hasher, SignSchema} from '../../core/crypto'; import {Convert} from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/AggregateBondedTransactionBuilder'; import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; @@ -193,7 +194,7 @@ export class AggregateTransaction extends Transaction { */ public addTransactions(transactions: InnerTransaction[]): AggregateTransaction { const innerTransactions = this.innerTransactions.concat(transactions); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {innerTransactions}); + return DtoMapping.assign(this, {innerTransactions}); } /** @@ -204,7 +205,7 @@ export class AggregateTransaction extends Transaction { */ public addCosignatures(cosigs: AggregateTransactionCosignature[]): AggregateTransaction { const cosignatures = this.cosignatures.concat(cosigs); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {cosignatures}); + return DtoMapping.assign(this, {cosignatures}); } /** @@ -407,8 +408,8 @@ export class AggregateTransaction extends Transaction { */ resolveAliases(statement: Statement): AggregateTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, - {innerTransactions: this.innerTransactions.map((tx) => tx.resolveAliases(statement, transactionInfo.index)) + return DtoMapping.assign(this, + {innerTransactions: this.innerTransactions.map((tx) => tx.resolveAliases(statement, transactionInfo.index)) .sort((a, b) => a.transactionInfo!.index - b.transactionInfo!.index)}); } } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 300c871d11..9b6fc2bb35 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedHashLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedHashLockTransactionBuilder'; @@ -211,7 +212,7 @@ export class LockFundsTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): LockFundsTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 44b9ce1682..fa16011421 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { @@ -243,7 +244,7 @@ export class MosaicAddressRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicAddressRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), targetAddress: statement.resolveAddress(this.targetAddress, diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index a172d6da29..e1d654f2d1 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { @@ -253,7 +254,7 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicGlobalRestrictionTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), referenceMosaicId: statement.resolveMosaicId(this.referenceMosaicId, transactionInfo.height.toString(), diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index b161f8766d..345db15e51 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicMetadataTransactionBuilder'; @@ -219,7 +220,7 @@ export class MosaicMetadataTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicMetadataTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { targetMosaicId: statement.resolveMosaicId(this.targetMosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 69eae71d37..6ef580240f 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicSupplyChangeTransactionBuilder'; @@ -193,7 +194,7 @@ export class MosaicSupplyChangeTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): MosaicSupplyChangeTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { mosaicId: statement.resolveMosaicId(this.mosaicId, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 6dc523b95e..3b10e31c5c 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -14,6 +14,7 @@ * limitations under the License. */ import { Convert, Convert as convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; @@ -240,7 +241,7 @@ export class SecretLockTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretLockTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex), mosaic: statement.resolveMosaic(this.mosaic, transactionInfo.height.toString(), diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index b0fd539718..8e1855c841 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -15,6 +15,7 @@ */ import { Convert, Convert as convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedSecretProofTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretProofTransactionBuilder'; @@ -217,7 +218,7 @@ export class SecretProofTransaction extends Transaction { */ resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): SecretProofTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, { + return DtoMapping.assign(this, { recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), transactionInfo.index, aggregateTransactionIndex)}); } diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index 8e7010c4d1..3ffa2a2891 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -16,6 +16,7 @@ import { KeyPair, SHA3Hasher, SignSchema } from '../../core/crypto'; import { Convert } from '../../core/format'; +import { DtoMapping } from '../../core/utils/DtoMapping'; import { SerializeTransactionToJSON } from '../../infrastructure/transaction/SerializeTransactionToJSON'; import { Account } from '../account/Account'; import { PublicAccount } from '../account/PublicAccount'; @@ -200,7 +201,7 @@ export abstract class Transaction { * @returns {TransferTransaction} */ public setMaxFee(feeMultiplier: number): Transaction { - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {maxFee: UInt64.fromUint(this.size * feeMultiplier)}); + return DtoMapping.assign(this, {maxFee: UInt64.fromUint(this.size * feeMultiplier)}); } /** @@ -277,7 +278,7 @@ export abstract class Transaction { if (this.type === TransactionType.AGGREGATE_BONDED || this.type === TransactionType.AGGREGATE_COMPLETE) { throw new Error('Inner transaction cannot be an aggregated transaction.'); } - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {signer}); + return DtoMapping.assign(this, {signer}); } /** @@ -345,7 +346,7 @@ export abstract class Transaction { */ public reapplyGiven(deadline: Deadline = Deadline.create()): Transaction { if (this.isUnannounced()) { - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {deadline}); + return DtoMapping.assign(this, {deadline}); } throw new Error('an Announced transaction can\'t be modified'); } diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index 923a5b4b04..7f213f989d 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -44,6 +44,7 @@ import {Transaction} from './Transaction'; import {TransactionInfo} from './TransactionInfo'; import {TransactionType} from './TransactionType'; import {TransactionVersion} from './TransactionVersion'; +import { DtoMapping } from '../../core/utils/DtoMapping'; /** * Transfer transactions contain data about transfers of mosaics and message to another account. @@ -282,10 +283,9 @@ export class TransferTransaction extends Transaction { */ public resolveAliases(statement: Statement, aggregateTransactionIndex: number = 0): TransferTransaction { const transactionInfo = this.checkTransactionHeightAndIndex(); - return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, - {recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex), - mosaics: this.mosaics.map((mosaic) => statement.resolveMosaic(mosaic, transactionInfo.height.toString(), - transactionInfo.index, aggregateTransactionIndex))}); + return DtoMapping.assign(this, {recipientAddress: statement.resolveAddress(this.recipientAddress, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex), + mosaics: this.mosaics.map((mosaic) => statement.resolveMosaic(mosaic, transactionInfo.height.toString(), + transactionInfo.index, aggregateTransactionIndex))}); } } diff --git a/test/infrastructure/RepositoryFactory.spec.ts b/test/infrastructure/RepositoryFactory.spec.ts index 6199559a27..3ee35f30b4 100644 --- a/test/infrastructure/RepositoryFactory.spec.ts +++ b/test/infrastructure/RepositoryFactory.spec.ts @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { expect } from "chai"; -import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp"; -import { BlockRepository } from "../../src/infrastructure/BlockRepository"; -import { instance, mock, when } from "ts-mockito"; -import { BlockInfo } from "../../src/model/blockchain/BlockInfo"; +import { expect } from 'chai'; import { of as observableOf } from 'rxjs'; -import { map } from "rxjs/operators"; -import { NetworkRepository } from "../../src/infrastructure/NetworkRepository"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; +import { map } from 'rxjs/operators'; +import { instance, mock, when } from 'ts-mockito'; +import { BlockRepository } from '../../src/infrastructure/BlockRepository'; +import { NetworkRepository } from '../../src/infrastructure/NetworkRepository'; +import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp'; +import { BlockInfo } from '../../src/model/blockchain/BlockInfo'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; describe('RepositoryFactory', () => { it('Should create repositories', () => { - const repositoryFactory = new RepositoryFactoryHttp("http://localhost:3000"); + const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000'); expect(repositoryFactory.createBlockRepository()).to.be.not.null; expect(repositoryFactory.createNetworkRepository()).to.be.not.null; @@ -50,7 +50,7 @@ describe('RepositoryFactory', () => { const repositoryMock: BlockRepository = mock(); - const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map(v => { + const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map((v) => { counter++; return v; })); @@ -63,10 +63,10 @@ describe('RepositoryFactory', () => { createBlockRepository(): BlockRepository { return instance(repositoryMock); } - })("http://localhost:3000"); + })('http://localhost:3000'); expect(counter).to.be.equals(0); - repositoryFactory.getGenerationHash().subscribe(gh => { + repositoryFactory.getGenerationHash().subscribe((gh) => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); repositoryFactory.getGenerationHash().subscribe(gh => { @@ -76,9 +76,9 @@ describe('RepositoryFactory', () => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); done(); - }) - }) - }) + }); + }); + }); }); @@ -88,8 +88,8 @@ describe('RepositoryFactory', () => { const repositoryMock: NetworkRepository = mock(); - let expectedNetworkType = NetworkType.MIJIN_TEST; - const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map(v => { + const expectedNetworkType = NetworkType.MIJIN_TEST; + const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; return v; })); @@ -98,22 +98,21 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { - createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })("http://localhost:3000"); + })('http://localhost:3000'); expect(counter).to.be.equals(0); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); repositoryFactory.getNetworkType().subscribe(networkType => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); done(); - }) - }) + }); + }); }); @@ -123,8 +122,8 @@ describe('RepositoryFactory', () => { const repositoryMock: NetworkRepository = mock(); - let expectedNetworkType = NetworkType.MIJIN_TEST; - const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map(v => { + const expectedNetworkType = NetworkType.MIJIN_TEST; + const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; return v; })); @@ -137,18 +136,18 @@ describe('RepositoryFactory', () => { createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })("http://localhost:3000", expectedNetworkType); + })('http://localhost:3000', expectedNetworkType); expect(counter).to.be.equals(0); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); repositoryFactory.getNetworkType().subscribe(networkType => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); done(); - }) - }) + }); + }); }); From fc8410b7c2642c0b65a3321864aadc2ccf432dfb Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:27:50 +0000 Subject: [PATCH 10/22] Fixed #393 applied catbuffer generator on aggregate --- .../AggregateBondedTransactionBuilder.ts | 8 +- .../AggregateCompleteTransactionBuilder.ts | 8 +- .../AggregateTransactionBodyBuilder.ts | 52 ++- .../catbuffer/BalanceChangeReceiptBuilder.ts | 111 +++++ .../BalanceTransferReceiptBuilder.ts | 132 ++++++ .../catbuffer/BlockHeaderBuilder.ts | 387 ++++++++++++++++++ .../catbuffer/EmbeddedTransactionHelper.ts | 181 ++++++++ src/infrastructure/catbuffer/EntityTypeDto.ts | 40 ++ .../catbuffer/GeneratorUtils.ts | 9 + .../catbuffer/InflationReceiptBuilder.ts | 92 +++++ .../catbuffer/MosaicExpiryReceiptBuilder.ts | 92 +++++ .../NamespaceExpiryReceiptBuilder.ts | 92 +++++ .../catbuffer/ReceiptBuilder.ts | 108 +++++ .../catbuffer/ReceiptTypeDto.ts | 27 ++ .../AccountAddressRestrictionTransaction.ts | 8 +- .../transaction/AccountLinkTransaction.ts | 8 +- .../transaction/AccountMetadataTransaction.ts | 8 +- .../AccountMosaicRestrictionTransaction.ts | 8 +- .../AccountOperationRestrictionTransaction.ts | 8 +- .../transaction/AddressAliasTransaction.ts | 8 +- src/model/transaction/AggregateTransaction.ts | 58 +-- src/model/transaction/LockFundsTransaction.ts | 8 +- .../MosaicAddressRestrictionTransaction.ts | 8 +- .../transaction/MosaicAliasTransaction.ts | 8 +- .../MosaicDefinitionTransaction.ts | 8 +- .../MosaicGlobalRestrictionTransaction.ts | 8 +- .../transaction/MosaicMetadataTransaction.ts | 8 +- .../MosaicSupplyChangeTransaction.ts | 8 +- .../MultisigAccountModificationTransaction.ts | 8 +- .../NamespaceMetadataTransaction.ts | 8 +- .../NamespaceRegistrationTransaction.ts | 30 +- .../transaction/SecretLockTransaction.ts | 8 +- .../transaction/SecretProofTransaction.ts | 8 +- src/model/transaction/Transaction.ts | 8 +- src/model/transaction/TransferTransaction.ts | 8 +- test/model/transaction/Transaction.spec.ts | 3 +- 36 files changed, 1431 insertions(+), 151 deletions(-) create mode 100644 src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BlockHeaderBuilder.ts create mode 100644 src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts create mode 100644 src/infrastructure/catbuffer/InflationReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptTypeDto.ts diff --git a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts index 56f42da250..ba3b56b75f 100644 --- a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts index 6dd372648f..f6b6e0983e 100644 --- a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts index b4de916720..5dd2492e47 100644 --- a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts @@ -19,6 +19,9 @@ *** along with Catapult. If not, see . **/ +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from './EmbeddedTransactionHelper'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -29,9 +32,9 @@ export class AggregateTransactionBodyBuilder { /** Reserved padding to align end of AggregateTransactionHeader on 8-byte boundary. */ aggregateTransactionHeader_Reserved1: number; /** Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - transactions: Uint8Array; + transactions: EmbeddedTransactionBuilder[]; /** Cosignatures data (fills remaining body space after transactions). */ - cosignatures: Uint8Array; + cosignatures: CosignatureBuilder[]; /** * Constructor. @@ -40,7 +43,8 @@ export class AggregateTransactionBodyBuilder { * @param transactions Sub-transaction data (transactions are variable sized and payload size is in bytes). * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ - public constructor(transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + // tslint:disable-next-line: max-line-length + public constructor(transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { this.transactionsHash = transactionsHash; this.aggregateTransactionHeader_Reserved1 = 0; this.transactions = transactions; @@ -62,9 +66,24 @@ export class AggregateTransactionBodyBuilder { // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); byteArray.splice(0, 4); - const transactions = GeneratorUtils.getBytes(Uint8Array.from(byteArray), payloadSize); - byteArray.splice(0, payloadSize); - const cosignatures = Uint8Array.from(byteArray); + let transactionsByteSize = payloadSize; + const transactions: EmbeddedTransactionBuilder[] = []; + while (transactionsByteSize > 0) { + const item = EmbeddedTransactionHelper.loadFromBinary(Uint8Array.from(byteArray)); + transactions.push(item); + const itemSize = item.getSize() + GeneratorUtils.getTransactionPaddingSize(item.getSize(), 8); + transactionsByteSize -= itemSize; + byteArray.splice(0, itemSize); + } + let cosignaturesByteSize = byteArray.length; + const cosignatures: CosignatureBuilder[] = []; + while (cosignaturesByteSize > 0) { + const item = CosignatureBuilder.loadFromBinary(Uint8Array.from(byteArray)); + cosignatures.push(item); + const itemSize = item.getSize(); + cosignaturesByteSize -= itemSize; + byteArray.splice(0, itemSize); + } return new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -91,7 +110,7 @@ export class AggregateTransactionBodyBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.transactions; } @@ -100,7 +119,7 @@ export class AggregateTransactionBodyBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.cosignatures; } @@ -114,8 +133,8 @@ export class AggregateTransactionBodyBuilder { size += this.transactionsHash.getSize(); size += 4; // payloadSize size += 4; // aggregateTransactionHeader_Reserved1 - size += this.transactions.length; - size += this.cosignatures.length; + this.transactions.forEach((o) => size += EmbeddedTransactionHelper.serialize(o).length); + this.cosignatures.forEach((o) => size += o.getSize()); return size; } @@ -128,13 +147,20 @@ export class AggregateTransactionBodyBuilder { let newArray = Uint8Array.from([]); const transactionsHashBytes = this.transactionsHash.serialize(); newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); - const payloadSizeBytes = GeneratorUtils.uintToBuffer(this.transactions.length, 4); + // tslint:disable-next-line: max-line-length + const payloadSizeBytes = GeneratorUtils.uintToBuffer(EmbeddedTransactionHelper.getEmbeddedTransactionSize(this.transactions), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, payloadSizeBytes); // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getAggregateTransactionHeader_Reserved1(), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, aggregateTransactionHeader_Reserved1Bytes); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.transactions); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.cosignatures); + this.transactions.forEach((item) => { + const transactionsBytes = EmbeddedTransactionHelper.serialize(item); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsBytes); + }); + this.cosignatures.forEach((item) => { + const cosignaturesBytes = item.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, cosignaturesBytes); + }); return newArray; } } diff --git a/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts new file mode 100644 index 0000000000..7670f20e0f --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts @@ -0,0 +1,111 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance change receipt. */ +export class BalanceChangeReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Account public key. */ + targetPublicKey: KeyDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param targetPublicKey Account public key. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, targetPublicKey: KeyDto) { + super(version, type); + this.mosaic = mosaic; + this.targetPublicKey = targetPublicKey; + } + + /** + * Creates an instance of BalanceChangeReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceChangeReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceChangeReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const targetPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, targetPublicKey.getSize()); + return new BalanceChangeReceiptBuilder(superObject.version, superObject.type, mosaic, targetPublicKey); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets account public key. + * + * @return Account public key. + */ + public getTargetPublicKey(): KeyDto { + return this.targetPublicKey; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.targetPublicKey.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const targetPublicKeyBytes = this.targetPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, targetPublicKeyBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts new file mode 100644 index 0000000000..89215dc6c1 --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts @@ -0,0 +1,132 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { AddressDto } from './AddressDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance transfer receipt. */ +export class BalanceTransferReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Mosaic sender public key. */ + senderPublicKey: KeyDto; + /** Mosaic recipient address. */ + recipientAddress: AddressDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param senderPublicKey Mosaic sender public key. + * @param recipientAddress Mosaic recipient address. + */ + // tslint:disable-next-line: max-line-length + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, senderPublicKey: KeyDto, recipientAddress: AddressDto) { + super(version, type); + this.mosaic = mosaic; + this.senderPublicKey = senderPublicKey; + this.recipientAddress = recipientAddress; + } + + /** + * Creates an instance of BalanceTransferReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceTransferReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceTransferReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const senderPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, senderPublicKey.getSize()); + const recipientAddress = AddressDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, recipientAddress.getSize()); + // tslint:disable-next-line: max-line-length + return new BalanceTransferReceiptBuilder(superObject.version, superObject.type, mosaic, senderPublicKey, recipientAddress); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets mosaic sender public key. + * + * @return Mosaic sender public key. + */ + public getSenderPublicKey(): KeyDto { + return this.senderPublicKey; + } + + /** + * Gets mosaic recipient address. + * + * @return Mosaic recipient address. + */ + public getRecipientAddress(): AddressDto { + return this.recipientAddress; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.senderPublicKey.getSize(); + size += this.recipientAddress.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const senderPublicKeyBytes = this.senderPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, senderPublicKeyBytes); + const recipientAddressBytes = this.recipientAddress.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, recipientAddressBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BlockHeaderBuilder.ts b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts new file mode 100644 index 0000000000..eb693aa3fa --- /dev/null +++ b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts @@ -0,0 +1,387 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { BlockFeeMultiplierDto } from './BlockFeeMultiplierDto'; +import { DifficultyDto } from './DifficultyDto'; +import { EntityTypeDto } from './EntityTypeDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { Hash256Dto } from './Hash256Dto'; +import { HeightDto } from './HeightDto'; +import { KeyDto } from './KeyDto'; +import { NetworkTypeDto } from './NetworkTypeDto'; +import { SignatureDto } from './SignatureDto'; +import { TimestampDto } from './TimestampDto'; + +/** Binary layout for a block header. */ +export class BlockHeaderBuilder { + /** Entity size. */ + size = 0; + /** Reserved padding to align Signature on 8-byte boundary. */ + verifiableEntityHeader_Reserved1: number; + /** Entity signature. */ + signature: SignatureDto; + /** Entity signer's public key. */ + signerPublicKey: KeyDto; + /** Reserved padding to align end of EntityBody on 8-byte boundary. */ + entityBody_Reserved1: number; + /** Entity version. */ + version: number; + /** Entity network. */ + network: NetworkTypeDto; + /** Entity type. */ + type: EntityTypeDto; + /** Block height. */ + height: HeightDto; + /** Number of milliseconds elapsed since creation of nemesis block. */ + timestamp: TimestampDto; + /** Block difficulty. */ + difficulty: DifficultyDto; + /** Previous block hash. */ + previousBlockHash: Hash256Dto; + /** Hash of the transactions in this block. */ + transactionsHash: Hash256Dto; + /** Hash of the receipts generated by this block. */ + receiptsHash: Hash256Dto; + /** Hash of the global chain state at this block. */ + stateHash: Hash256Dto; + /** Beneficiary public key designated by harvester. */ + beneficiaryPublicKey: KeyDto; + /** Fee multiplier applied to block transactions. */ + feeMultiplier: BlockFeeMultiplierDto; + /** Reserved padding to align end of BlockHeader on 8-byte boundary. */ + blockHeader_Reserved1: number; + + /** + * Constructor. + * + * @param signature Entity signature. + * @param signerPublicKey Entity signer's public key. + * @param version Entity version. + * @param network Entity network. + * @param type Entity type. + * @param height Block height. + * @param timestamp Number of milliseconds elapsed since creation of nemesis block. + * @param difficulty Block difficulty. + * @param previousBlockHash Previous block hash. + * @param transactionsHash Hash of the transactions in this block. + * @param receiptsHash Hash of the receipts generated by this block. + * @param stateHash Hash of the global chain state at this block. + * @param beneficiaryPublicKey Beneficiary public key designated by harvester. + * @param feeMultiplier Fee multiplier applied to block transactions. + */ + // tslint:disable-next-line: max-line-length + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, height: HeightDto, timestamp: TimestampDto, difficulty: DifficultyDto, previousBlockHash: Hash256Dto, transactionsHash: Hash256Dto, receiptsHash: Hash256Dto, stateHash: Hash256Dto, beneficiaryPublicKey: KeyDto, feeMultiplier: BlockFeeMultiplierDto) { + this.verifiableEntityHeader_Reserved1 = 0; + this.signature = signature; + this.signerPublicKey = signerPublicKey; + this.entityBody_Reserved1 = 0; + this.version = version; + this.network = network; + this.type = type; + this.height = height; + this.timestamp = timestamp; + this.difficulty = difficulty; + this.previousBlockHash = previousBlockHash; + this.transactionsHash = transactionsHash; + this.receiptsHash = receiptsHash; + this.stateHash = stateHash; + this.beneficiaryPublicKey = beneficiaryPublicKey; + this.feeMultiplier = feeMultiplier; + this.blockHeader_Reserved1 = 0; + } + + /** + * Creates an instance of BlockHeaderBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BlockHeaderBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BlockHeaderBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const signature = SignatureDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signature.getSize()); + const signerPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signerPublicKey.getSize()); + const entityBody_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const network = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const height = HeightDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, height.getSize()); + const timestamp = TimestampDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, timestamp.getSize()); + const difficulty = DifficultyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, difficulty.getSize()); + const previousBlockHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, previousBlockHash.getSize()); + const transactionsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, transactionsHash.getSize()); + const receiptsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, receiptsHash.getSize()); + const stateHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, stateHash.getSize()); + const beneficiaryPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, beneficiaryPublicKey.getSize()); + const feeMultiplier = BlockFeeMultiplierDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, feeMultiplier.getSize()); + const blockHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + return new BlockHeaderBuilder(signature, signerPublicKey, version, network, type, height, timestamp, difficulty, previousBlockHash, transactionsHash, receiptsHash, stateHash, beneficiaryPublicKey, feeMultiplier); + } + + /** + * Gets reserved padding to align Signature on 8-byte boundary. + * + * @return Reserved padding to align Signature on 8-byte boundary. + */ + public getVerifiableEntityHeader_Reserved1(): number { + return this.verifiableEntityHeader_Reserved1; + } + + /** + * Gets entity signature. + * + * @return Entity signature. + */ + public getSignature(): SignatureDto { + return this.signature; + } + + /** + * Gets entity signer's public key. + * + * @return Entity signer's public key. + */ + public getSignerPublicKey(): KeyDto { + return this.signerPublicKey; + } + + /** + * Gets reserved padding to align end of EntityBody on 8-byte boundary. + * + * @return Reserved padding to align end of EntityBody on 8-byte boundary. + */ + public getEntityBody_Reserved1(): number { + return this.entityBody_Reserved1; + } + + /** + * Gets entity version. + * + * @return Entity version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets entity network. + * + * @return Entity network. + */ + public getNetwork(): NetworkTypeDto { + return this.network; + } + + /** + * Gets entity type. + * + * @return Entity type. + */ + public getType(): EntityTypeDto { + return this.type; + } + + /** + * Gets block height. + * + * @return Block height. + */ + public getHeight(): HeightDto { + return this.height; + } + + /** + * Gets number of milliseconds elapsed since creation of nemesis block. + * + * @return Number of milliseconds elapsed since creation of nemesis block. + */ + public getTimestamp(): TimestampDto { + return this.timestamp; + } + + /** + * Gets block difficulty. + * + * @return Block difficulty. + */ + public getDifficulty(): DifficultyDto { + return this.difficulty; + } + + /** + * Gets previous block hash. + * + * @return Previous block hash. + */ + public getPreviousBlockHash(): Hash256Dto { + return this.previousBlockHash; + } + + /** + * Gets hash of the transactions in this block. + * + * @return Hash of the transactions in this block. + */ + public getTransactionsHash(): Hash256Dto { + return this.transactionsHash; + } + + /** + * Gets hash of the receipts generated by this block. + * + * @return Hash of the receipts generated by this block. + */ + public getReceiptsHash(): Hash256Dto { + return this.receiptsHash; + } + + /** + * Gets hash of the global chain state at this block. + * + * @return Hash of the global chain state at this block. + */ + public getStateHash(): Hash256Dto { + return this.stateHash; + } + + /** + * Gets beneficiary public key designated by harvester. + * + * @return Beneficiary public key designated by harvester. + */ + public getBeneficiaryPublicKey(): KeyDto { + return this.beneficiaryPublicKey; + } + + /** + * Gets fee multiplier applied to block transactions. + * + * @return Fee multiplier applied to block transactions. + */ + public getFeeMultiplier(): BlockFeeMultiplierDto { + return this.feeMultiplier; + } + + /** + * Gets reserved padding to align end of BlockHeader on 8-byte boundary. + * + * @return Reserved padding to align end of BlockHeader on 8-byte boundary. + */ + public getBlockHeader_Reserved1(): number { + return this.blockHeader_Reserved1; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 4; // verifiableEntityHeader_Reserved1 + size += this.signature.getSize(); + size += this.signerPublicKey.getSize(); + size += 4; // entityBody_Reserved1 + size += 1; // version + size += 1; // network + size += 2; // type + size += this.height.getSize(); + size += this.timestamp.getSize(); + size += this.difficulty.getSize(); + size += this.previousBlockHash.getSize(); + size += this.transactionsHash.getSize(); + size += this.receiptsHash.getSize(); + size += this.stateHash.getSize(); + size += this.beneficiaryPublicKey.getSize(); + size += this.feeMultiplier.getSize(); + size += 4; // blockHeader_Reserved1 + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getVerifiableEntityHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, verifiableEntityHeader_Reserved1Bytes); + const signatureBytes = this.signature.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signatureBytes); + const signerPublicKeyBytes = this.signerPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signerPublicKeyBytes); + const entityBody_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getEntityBody_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, entityBody_Reserved1Bytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const networkBytes = GeneratorUtils.uintToBuffer(this.network, 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, networkBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + const heightBytes = this.height.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, heightBytes); + const timestampBytes = this.timestamp.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, timestampBytes); + const difficultyBytes = this.difficulty.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, difficultyBytes); + const previousBlockHashBytes = this.previousBlockHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, previousBlockHashBytes); + const transactionsHashBytes = this.transactionsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); + const receiptsHashBytes = this.receiptsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, receiptsHashBytes); + const stateHashBytes = this.stateHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, stateHashBytes); + const beneficiaryPublicKeyBytes = this.beneficiaryPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, beneficiaryPublicKeyBytes); + const feeMultiplierBytes = this.feeMultiplier.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, feeMultiplierBytes); + const blockHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getBlockHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, blockHeader_Reserved1Bytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts new file mode 100644 index 0000000000..ad436cfc30 --- /dev/null +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -0,0 +1,181 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { EntityTypeDto } from './EntityTypeDto' +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder' +import { GeneratorUtils } from './GeneratorUtils' +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder' +import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder' +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder' +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder' +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder' +import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder' +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder' +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder' +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder' +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder' +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder' +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder' +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder' +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder' +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder' +import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder' +import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder' +import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder' +import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder' + +export class EmbeddedTransactionHelper { + + public static serialize(transaction: EmbeddedTransactionBuilder): Uint8Array { + let byte: Uint8Array; + let padding: Uint8Array; + switch (transaction.type) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedTransferTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountLinkTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedHashLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretProofTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicDefinitionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicSupplyChangeTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMultisigAccountModificationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAddressAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceRegistrationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMosaicRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountOperationRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicGlobalRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + default: + throw new Error(`Transaction type: ${transaction.type} not recognized.`) + } + } + + public static loadFromBinary(bytes: Uint8Array):EmbeddedTransactionBuilder { + const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); + switch (header.getType()) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + default: + throw new Error(`Transaction type: ${header.getType()} not recognized.`) + } + } + + public static getEmbeddedTransactionSize(transactions: EmbeddedTransactionBuilder[]): number { + return transactions.map((o) => EmbeddedTransactionHelper.serialize(o).length).reduce((a, b) => a + b, 0); + } +} diff --git a/src/infrastructure/catbuffer/EntityTypeDto.ts b/src/infrastructure/catbuffer/EntityTypeDto.ts index cbbf804d10..4399620a5c 100644 --- a/src/infrastructure/catbuffer/EntityTypeDto.ts +++ b/src/infrastructure/catbuffer/EntityTypeDto.ts @@ -26,4 +26,44 @@ export enum EntityTypeDto { RESERVED = 0, /** Transfer transaction builder. */ TRANSFER_TRANSACTION_BUILDER = 16724, + /** Account link transaction builder. */ + ACCOUNT_LINK_TRANSACTION_BUILDER = 16716, + /** Hash lock transaction builder. */ + HASH_LOCK_TRANSACTION_BUILDER = 16712, + /** Secret lock transaction builder. */ + SECRET_LOCK_TRANSACTION_BUILDER = 16722, + /** Secret proof transaction builder. */ + SECRET_PROOF_TRANSACTION_BUILDER = 16978, + /** Account metadata transaction builder. */ + ACCOUNT_METADATA_TRANSACTION_BUILDER = 16708, + /** Mosaic metadata transaction builder. */ + MOSAIC_METADATA_TRANSACTION_BUILDER = 16964, + /** Namespace metadata transaction builder. */ + NAMESPACE_METADATA_TRANSACTION_BUILDER = 17220, + /** Mosaic definition transaction builder. */ + MOSAIC_DEFINITION_TRANSACTION_BUILDER = 16717, + /** Mosaic supply change transaction builder. */ + MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER = 16973, + /** Multisig account modification transaction builder. */ + MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER = 16725, + /** Address alias transaction builder. */ + ADDRESS_ALIAS_TRANSACTION_BUILDER = 16974, + /** Mosaic alias transaction builder. */ + MOSAIC_ALIAS_TRANSACTION_BUILDER = 17230, + /** Namespace registration transaction builder. */ + NAMESPACE_REGISTRATION_TRANSACTION_BUILDER = 16718, + /** Account address restriction transaction builder. */ + ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16720, + /** Account mosaic restriction transaction builder. */ + ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER = 16976, + /** Account operation restriction transaction builder. */ + ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER = 17232, + /** Mosaic address restriction transaction builder. */ + MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16977, + /** Mosaic global restriction transaction builder. */ + MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER = 16721, + /** Aggregate complete transaction builder. */ + AGGREGATE_COMPLETE_TRANSACTION_BUILDER = 16705, + /** Aggregate bonded transaction builder. */ + AGGREGATE_BONDED_TRANSACTION_BUILDER = 16961, } diff --git a/src/infrastructure/catbuffer/GeneratorUtils.ts b/src/infrastructure/catbuffer/GeneratorUtils.ts index d1c6eb5d9b..74399315e0 100644 --- a/src/infrastructure/catbuffer/GeneratorUtils.ts +++ b/src/infrastructure/catbuffer/GeneratorUtils.ts @@ -145,4 +145,13 @@ export class GeneratorUtils { const bytes = binary.slice(0, size); return bytes; } + + /** + * Gets the padding size that rounds up \a size to the next multiple of \a alignment. + * @param size Inner transaction size + * @param alignment Next multiple alignment + */ + public static getTransactionPaddingSize(size: number, alignment: number): number { + return 0 === size % alignment ? 0 : alignment - (size % alignment); + } } diff --git a/src/infrastructure/catbuffer/InflationReceiptBuilder.ts b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts new file mode 100644 index 0000000000..d9d12527ec --- /dev/null +++ b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for an inflation receipt. */ +export class InflationReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder) { + super(version, type); + this.mosaic = mosaic; + } + + /** + * Creates an instance of InflationReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of InflationReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): InflationReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + return new InflationReceiptBuilder(superObject.version, superObject.type, mosaic); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..3940e509e5 --- /dev/null +++ b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicIdDto } from './MosaicIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a mosaic expiry receipt. */ +export class MosaicExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring mosaic id. */ + artifactId: MosaicIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring mosaic id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: MosaicIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of MosaicExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of MosaicExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): MosaicExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = MosaicIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new MosaicExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring mosaic id. + * + * @return Expiring mosaic id. + */ + public getArtifactId(): MosaicIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..2573d688a9 --- /dev/null +++ b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { NamespaceIdDto } from './NamespaceIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a namespace expiry receipt. */ +export class NamespaceExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring namespace id. */ + artifactId: NamespaceIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring namespace id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: NamespaceIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of NamespaceExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of NamespaceExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): NamespaceExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = NamespaceIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new NamespaceExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring namespace id. + * + * @return Expiring namespace id. + */ + public getArtifactId(): NamespaceIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts new file mode 100644 index 0000000000..524bf945df --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -0,0 +1,108 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a receipt entity. */ +export class ReceiptBuilder { + /** Entity size. */ + size = 0; + /** Receipt version. */ + version: number; + /** Receipt type. */ + type: ReceiptTypeDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + */ + public constructor(version: number, type: ReceiptTypeDto) { + this.version = version; + this.type = type; + } + + /** + * Creates an instance of ReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of ReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): ReceiptBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + return new ReceiptBuilder(version, type); + } + + /** + * Gets receipt version. + * + * @return Receipt version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets receipt type. + * + * @return Receipt type. + */ + public getType(): ReceiptTypeDto { + return this.type; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 2; // version + size += 2; // type + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptTypeDto.ts b/src/infrastructure/catbuffer/ReceiptTypeDto.ts new file mode 100644 index 0000000000..f2d4bdc10f --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptTypeDto.ts @@ -0,0 +1,27 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + + +/** Enumeration of receipt types. */ +export enum ReceiptTypeDto { + /** Reserved receipt type. */ + RESERVED = 0, +} diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index 66f2b2fafd..d7814ea1dc 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -172,10 +173,10 @@ export class AccountAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -188,7 +189,6 @@ export class AccountAddressRestrictionTransaction extends Transaction { return new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(deletion, this.networkType)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountLinkTransaction.ts b/src/model/transaction/AccountLinkTransaction.ts index 9e6e813de3..2374266254 100644 --- a/src/model/transaction/AccountLinkTransaction.ts +++ b/src/model/transaction/AccountLinkTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/AccountLinkTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountLinkTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -150,10 +151,10 @@ export class AccountLinkTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountLinkTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountLinkTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -161,7 +162,6 @@ export class AccountLinkTransaction extends Transaction { new KeyDto(Convert.hexToUint8(this.remotePublicKey)), this.linkAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMetadataTransaction.ts b/src/model/transaction/AccountMetadataTransaction.ts index 78b2009887..d01429d3af 100644 --- a/src/model/transaction/AccountMetadataTransaction.ts +++ b/src/model/transaction/AccountMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/AccountMetadataTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -178,10 +179,10 @@ export class AccountMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -191,7 +192,6 @@ export class AccountMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index c739b574b8..b8a3f542a5 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMosaicRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountMosaicRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -172,10 +173,10 @@ export class AccountMosaicRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMosaicRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMosaicRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -188,7 +189,6 @@ export class AccountMosaicRestrictionTransaction extends Transaction { return new UnresolvedMosaicIdDto(deletion.id.toDTO()); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountOperationRestrictionTransaction.ts b/src/model/transaction/AccountOperationRestrictionTransaction.ts index 899602794f..1dc508e493 100644 --- a/src/model/transaction/AccountOperationRestrictionTransaction.ts +++ b/src/model/transaction/AccountOperationRestrictionTransaction.ts @@ -22,6 +22,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountOperationRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -160,10 +161,10 @@ export class AccountOperationRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountOperationRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountOperationRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -172,7 +173,6 @@ export class AccountOperationRestrictionTransaction extends Transaction { this.restrictionAdditions, this.restrictionDeletions, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AddressAliasTransaction.ts b/src/model/transaction/AddressAliasTransaction.ts index 863c1cbae8..2ee1a238ac 100644 --- a/src/model/transaction/AddressAliasTransaction.ts +++ b/src/model/transaction/AddressAliasTransaction.ts @@ -19,6 +19,7 @@ import { AddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/A import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -169,10 +170,10 @@ export class AddressAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAddressAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAddressAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -181,7 +182,6 @@ export class AddressAliasTransaction extends Transaction { new AddressDto(RawAddress.stringToAddress(this.address.plain())), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AggregateTransaction.ts b/src/model/transaction/AggregateTransaction.ts index a92792e4b5..82680242a5 100644 --- a/src/model/transaction/AggregateTransaction.ts +++ b/src/model/transaction/AggregateTransaction.ts @@ -20,6 +20,8 @@ import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/ import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; import {CosignatureBuilder} from '../../infrastructure/catbuffer/CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -139,36 +141,19 @@ export class AggregateTransaction extends Transaction { const builder = type === TransactionType.AGGREGATE_COMPLETE ? AggregateCompleteTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)) : AggregateBondedTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)); - const innerTransactionHex = Convert.uint8ToHex(builder.getTransactions()); + const innerTransactions = builder.getTransactions().map((t) => Convert.uint8ToHex(EmbeddedTransactionHelper.serialize(t))); const networkType = builder.getNetwork().valueOf(); - const consignaturesHex = Convert.uint8ToHex(builder.getCosignatures()); - - /** - * Get inner transactions array - */ - const embeddedTransactionArray: string[] = []; - let innerBinary = innerTransactionHex; - while (innerBinary.length) { - const payloadSize = parseInt(Convert.uint8ToHex(Convert.hexToUint8(innerBinary.substring(0, 8)).reverse()), 16) * 2; - const innerTransaction = innerBinary.substring(0, payloadSize); - embeddedTransactionArray.push(innerTransaction); - innerBinary = innerBinary.substring(payloadSize).replace(/\b0+/g, ''); - } - - /** - * Get cosignatures - */ - const consignatureArray = consignaturesHex.match(/.{1,192}/g); - const consignatures = consignatureArray ? consignatureArray.map((cosignature) => - new AggregateTransactionCosignature( - cosignature.substring(64, 192), - PublicAccount.createFromPublicKey(cosignature.substring(0, 64), networkType), - )) : []; + const consignatures = builder.getCosignatures().map((cosig) => { + return new AggregateTransactionCosignature( + Convert.uint8ToHex(cosig.signature.signature), + PublicAccount.createFromPublicKey(Convert.uint8ToHex(cosig.signerPublicKey.key), networkType), + ); + }); return type === TransactionType.AGGREGATE_COMPLETE ? AggregateTransaction.createComplete( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -176,7 +161,7 @@ export class AggregateTransaction extends Transaction { new UInt64(builder.fee.amount), ) : AggregateTransaction.createBonded( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -312,23 +297,14 @@ export class AggregateTransaction extends Transaction { protected generateBytes(): Uint8Array { const signerBuffer = new Uint8Array(32); const signatureBuffer = new Uint8Array(64); - let transactions = Uint8Array.from([]); - this.innerTransactions.forEach((transaction) => { - const transactionByte = transaction.toAggregateTransactionBytes(); - const innerTransactionPadding = new Uint8Array(this.getInnerTransactionPaddingSize(transactionByte.length, 8)); - const paddedTransactionByte = GeneratorUtils.concatTypedArrays(transactionByte, innerTransactionPadding); - transactions = GeneratorUtils.concatTypedArrays(transactions, paddedTransactionByte); - }); - - let cosignatures = Uint8Array.from([]); - this.cosignatures.forEach((cosignature) => { + const transactions = this.innerTransactions.map((transaction) => (transaction as Transaction).toEmbeddedTransaction()); + const cosignatures = this.cosignatures.map((cosignature) => { const signerBytes = Convert.hexToUint8(cosignature.signer.publicKey); const signatureBytes = Convert.hexToUint8(cosignature.signature); - const cosignatureBytes = new CosignatureBuilder( + return new CosignatureBuilder( new KeyDto(signerBytes), new SignatureDto(signatureBytes), - ).serialize(); - cosignatures = GeneratorUtils.concatTypedArrays(cosignatures, cosignatureBytes); + ); }); const transactionBuilder = this.type === TransactionType.AGGREGATE_COMPLETE ? @@ -361,9 +337,9 @@ export class AggregateTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Method not implemented'); } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 4d31fa9d3b..caa200681e 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedHashLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedHashLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { HashLockTransactionBuilder } from '../../infrastructure/catbuffer/HashLockTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; @@ -187,10 +188,10 @@ export class LockFundsTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedHashLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedHashLockTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -200,7 +201,6 @@ export class LockFundsTransaction extends Transaction { new BlockDurationDto(this.duration.toDTO()), new Hash256Dto(Convert.hexToUint8(this.hash)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index 7323856186..c2240472cd 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -20,6 +20,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAddressRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAddressRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -218,10 +219,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -232,7 +233,6 @@ export class MosaicAddressRestrictionTransaction extends Transaction { this.newRestrictionValue.toDTO(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.targetAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAliasTransaction.ts b/src/model/transaction/MosaicAliasTransaction.ts index f259c5af13..238e8b1fbd 100644 --- a/src/model/transaction/MosaicAliasTransaction.ts +++ b/src/model/transaction/MosaicAliasTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAliasTransactionBuilder'; import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; @@ -164,10 +165,10 @@ export class MosaicAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -176,7 +177,6 @@ export class MosaicAliasTransaction extends Transaction { new MosaicIdDto(this.mosaicId.id.toDTO()), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicDefinitionTransaction.ts b/src/model/transaction/MosaicDefinitionTransaction.ts index a43a733825..5b3fe0754b 100644 --- a/src/model/transaction/MosaicDefinitionTransaction.ts +++ b/src/model/transaction/MosaicDefinitionTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedMosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicDefinitionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicDefinitionTransactionBuilder'; @@ -205,10 +206,10 @@ export class MosaicDefinitionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicDefinitionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicDefinitionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -219,7 +220,6 @@ export class MosaicDefinitionTransaction extends Transaction { this.flags.getValue(), this.divisibility, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index 35ff2de88e..7985c2947c 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -20,6 +20,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicGlobalRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicGlobalRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicGlobalRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicGlobalRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -226,10 +227,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicGlobalRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicGlobalRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -242,7 +243,6 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { this.previousRestrictionType.valueOf(), this.newRestrictionType.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index ce5b5135cf..c491717997 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/MosaicMetadataTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -194,10 +195,10 @@ export class MosaicMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -208,7 +209,6 @@ export class MosaicMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 3e6b2685cb..ca7e404242 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/MosaicSupplyChangeTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -170,10 +171,10 @@ export class MosaicSupplyChangeTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicSupplyChangeTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicSupplyChangeTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -182,7 +183,6 @@ export class MosaicSupplyChangeTransaction extends Transaction { new AmountDto(this.delta.toDTO()), this.action.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MultisigAccountModificationTransaction.ts b/src/model/transaction/MultisigAccountModificationTransaction.ts index d8a4dc1d77..fcaefd7fcf 100644 --- a/src/model/transaction/MultisigAccountModificationTransaction.ts +++ b/src/model/transaction/MultisigAccountModificationTransaction.ts @@ -19,6 +19,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import {MultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/MultisigAccountModificationTransactionBuilder'; @@ -193,10 +194,10 @@ export class MultisigAccountModificationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMultisigAccountModificationTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMultisigAccountModificationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -210,7 +211,6 @@ export class MultisigAccountModificationTransaction extends Transaction { return new KeyDto(Convert.hexToUint8(deletion.publicKey)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceMetadataTransaction.ts b/src/model/transaction/NamespaceMetadataTransaction.ts index f58453c268..36e80f13e3 100644 --- a/src/model/transaction/NamespaceMetadataTransaction.ts +++ b/src/model/transaction/NamespaceMetadataTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedNamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceMetadataTransactionBuilder'; @@ -192,10 +193,10 @@ export class NamespaceMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedNamespaceMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedNamespaceMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -206,7 +207,6 @@ export class NamespaceMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceRegistrationTransaction.ts b/src/model/transaction/NamespaceRegistrationTransaction.ts index 935ee02bc7..cad026814e 100644 --- a/src/model/transaction/NamespaceRegistrationTransaction.ts +++ b/src/model/transaction/NamespaceRegistrationTransaction.ts @@ -20,6 +20,7 @@ import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDt import { EmbeddedNamespaceRegistrationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceRegistrationTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceRegistrationTransactionBuilder'; @@ -244,12 +245,11 @@ export class NamespaceRegistrationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - let transactionBuilder: EmbeddedNamespaceRegistrationTransactionBuilder; + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { if (this.registrationType === NamespaceRegistrationType.RootNamespace) { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( + return new EmbeddedNamespaceRegistrationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -259,19 +259,17 @@ export class NamespaceRegistrationTransaction extends Transaction { new BlockDurationDto(this.duration!.toDTO()), undefined, ); - } else { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( - new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), - this.versionToDTO(), - this.networkType.valueOf(), - TransactionType.REGISTER_NAMESPACE.valueOf(), - new NamespaceIdDto(this.namespaceId.id.toDTO()), - Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), - undefined, - new NamespaceIdDto(this.parentId!.id.toDTO()), - ); } - return transactionBuilder.serialize(); + return new EmbeddedNamespaceRegistrationTransactionBuilder( + new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), + this.versionToDTO(), + this.networkType.valueOf(), + TransactionType.REGISTER_NAMESPACE.valueOf(), + new NamespaceIdDto(this.namespaceId.id.toDTO()), + Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), + undefined, + new NamespaceIdDto(this.parentId!.id.toDTO()), + ); } /** diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 3606ede7e7..df3ee1c863 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -18,6 +18,7 @@ import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedSecretLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretLockTransactionBuilder } from '../../infrastructure/catbuffer/SecretLockTransactionBuilder'; @@ -214,10 +215,10 @@ export class SecretLockTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretLockTransactionBuilder( new KeyDto(convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -229,7 +230,6 @@ export class SecretLockTransaction extends Transaction { this.hashType.valueOf(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index db890c7ca4..43c00c16c9 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -18,6 +18,7 @@ import { Convert, Convert as convert } from '../../core/format'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedSecretProofTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretProofTransactionBuilder } from '../../infrastructure/catbuffer/SecretProofTransactionBuilder'; @@ -193,10 +194,10 @@ export class SecretProofTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretProofTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretProofTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -206,7 +207,6 @@ export class SecretProofTransaction extends Transaction { new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), this.getProofByte(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index f42edc8415..4830838648 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -16,6 +16,8 @@ import { KeyPair, SHA3Hasher, SignSchema } from '../../core/crypto'; import { Convert } from '../../core/format'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import { SerializeTransactionToJSON } from '../../infrastructure/transaction/SerializeTransactionToJSON'; import { Account } from '../account/Account'; import { PublicAccount } from '../account/PublicAccount'; @@ -184,7 +186,7 @@ export abstract class Transaction { /** * @internal */ - protected abstract generateEmbeddedBytes(): Uint8Array; + public abstract toEmbeddedTransaction(): EmbeddedTransactionBuilder; /** * @internal @@ -286,7 +288,9 @@ export abstract class Transaction { * @return transaction with signer serialized to be part of an aggregate transaction */ public toAggregateTransactionBytes() { - return this.generateEmbeddedBytes(); + return EmbeddedTransactionHelper.serialize( + this.toEmbeddedTransaction(), + ); } /** diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index d858927b9e..4e99bb1d96 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -18,6 +18,7 @@ import * as Long from 'long'; import {Convert} from '../../core/format'; import {UnresolvedMapping} from '../../core/utils/UnresolvedMapping'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import {EmbeddedTransferTransactionBuilder} from '../../infrastructure/catbuffer/EmbeddedTransferTransactionBuilder'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -256,10 +257,10 @@ export class TransferTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedTransferTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedTransferTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -271,7 +272,6 @@ export class TransferTransaction extends Transaction { }), this.getMessageBuffer(), ); - return transactionBuilder.serialize(); } /** diff --git a/test/model/transaction/Transaction.spec.ts b/test/model/transaction/Transaction.spec.ts index 0b3eb881b4..04fb2e28b3 100644 --- a/test/model/transaction/Transaction.spec.ts +++ b/test/model/transaction/Transaction.spec.ts @@ -17,6 +17,7 @@ import { expect } from 'chai'; import { Observable } from 'rxjs/internal/Observable'; import { Convert } from '../../../src/core/format/Convert'; +import { EmbeddedTransactionBuilder } from '../../../src/infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; @@ -400,7 +401,7 @@ class FakeTransaction extends Transaction { throw new Error('Not implemented'); } - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Not implemented'); } resolveAliases(): TransferTransaction { From 62629a0ac40e59e9c66b37da45d8de981bcf2d5e Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:51:06 +0000 Subject: [PATCH 11/22] Fixed missing semicolon --- .../catbuffer/EmbeddedTransactionHelper.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index ad436cfc30..9a9c16712f 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -125,7 +125,7 @@ export class EmbeddedTransactionHelper { padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); return GeneratorUtils.concatTypedArrays(byte, padding); default: - throw new Error(`Transaction type: ${transaction.type} not recognized.`) + throw new Error(`Transaction type: ${transaction.type} not recognized.`); } } @@ -133,45 +133,45 @@ export class EmbeddedTransactionHelper { const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); switch (header.getType()) { case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: - return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: - return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: - return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: - return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: - return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: - return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: - return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: - return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: - return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: - return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: - return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: - return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: - return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: - return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes); default: - throw new Error(`Transaction type: ${header.getType()} not recognized.`) + throw new Error(`Transaction type: ${header.getType()} not recognized.`); } } From 127124d776e4242aa7362e6346f7b0659fb66bd3 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 14:50:41 +0000 Subject: [PATCH 12/22] Applied catbuffer on receipt --- .../catbuffer/ReceiptBuilder.ts | 2 -- src/model/receipt/ArtifactExpiryReceipt.ts | 18 ++++++++------- src/model/receipt/BalanceChangeReceipt.ts | 17 +++++++------- src/model/receipt/BalanceTransferReceipt.ts | 23 ++++++++++--------- src/model/receipt/InflationReceipt.ts | 16 ++++++------- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts index 524bf945df..ffe39705cb 100644 --- a/src/infrastructure/catbuffer/ReceiptBuilder.ts +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -97,8 +97,6 @@ export class ReceiptBuilder { */ public serialize(): Uint8Array { let newArray = Uint8Array.from([]); - const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); - newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); diff --git a/src/model/receipt/ArtifactExpiryReceipt.ts b/src/model/receipt/ArtifactExpiryReceipt.ts index 8df5aab72a..a8a14178e4 100644 --- a/src/model/receipt/ArtifactExpiryReceipt.ts +++ b/src/model/receipt/ArtifactExpiryReceipt.ts @@ -14,11 +14,12 @@ * limitations under the License. */ -import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { MosaicExpiryReceiptBuilder } from '../../infrastructure/catbuffer/MosaicExpiryReceiptBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; +import { NamespaceExpiryReceiptBuilder } from '../../infrastructure/catbuffer/NamespaceExpiryReceiptBuilder'; +import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { MosaicId } from '../mosaic/MosaicId'; import { NamespaceId } from '../namespace/NamespaceId'; -import { UInt64 } from '../UInt64'; import { Receipt } from './Receipt'; import { ReceiptType } from './ReceiptType'; import { ReceiptVersion } from './ReceiptVersion'; @@ -48,10 +49,11 @@ export class ArtifactExpiryReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(12); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.ARTIFACT_EXPIRY, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.artifactId.toHex()).toDTO()), 4); - return buffer; + if (this.artifactId instanceof MosaicId) { + return new MosaicExpiryReceiptBuilder(ReceiptVersion.ARTIFACT_EXPIRY, this.type.valueOf(), + new MosaicIdDto(this.artifactId.toDTO())).serialize(); + } + return new NamespaceExpiryReceiptBuilder(ReceiptVersion.ARTIFACT_EXPIRY, this.type.valueOf(), + new NamespaceIdDto(this.artifactId.id.toDTO())).serialize(); } } diff --git a/src/model/receipt/BalanceChangeReceipt.ts b/src/model/receipt/BalanceChangeReceipt.ts index 83159b621c..7c11b72690 100644 --- a/src/model/receipt/BalanceChangeReceipt.ts +++ b/src/model/receipt/BalanceChangeReceipt.ts @@ -15,7 +15,11 @@ */ import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { BalanceChangeReceiptBuilder } from '../../infrastructure/catbuffer/BalanceChangeReceiptBuilder'; +import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { PublicAccount } from '../account/PublicAccount'; import { MosaicId } from '../mosaic/MosaicId'; import { UInt64 } from '../UInt64'; @@ -62,12 +66,9 @@ export class BalanceChangeReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(52); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.BALANCE_CHANGE, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - buffer.set(Convert.hexToUint8(this.targetPublicAccount.publicKey), 20); - return buffer; + return new BalanceChangeReceiptBuilder(ReceiptVersion.BALANCE_CHANGE, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + new KeyDto(Convert.hexToUint8(this.targetPublicAccount.publicKey)), + ).serialize(); } } diff --git a/src/model/receipt/BalanceTransferReceipt.ts b/src/model/receipt/BalanceTransferReceipt.ts index 1442fe3e82..4b11cc53f0 100644 --- a/src/model/receipt/BalanceTransferReceipt.ts +++ b/src/model/receipt/BalanceTransferReceipt.ts @@ -15,8 +15,13 @@ */ import { Convert } from '../../core/format/Convert'; -import { UnresolvedMapping } from "../../core/utils/UnresolvedMapping"; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; +import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { BalanceTransferReceiptBuilder } from '../../infrastructure/catbuffer/BalanceTransferReceiptBuilder'; +import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; import { MosaicId } from '../mosaic/MosaicId'; @@ -70,15 +75,11 @@ export class BalanceTransferReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const recipient = this.getRecipientBytes(); - const buffer = new Uint8Array(52 + recipient.length); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.BALANCE_TRANSFER, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - buffer.set(Convert.hexToUint8(this.sender.publicKey), 20); - buffer.set(recipient, 52); - return buffer; + return new BalanceTransferReceiptBuilder(ReceiptVersion.BALANCE_TRANSFER, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + new KeyDto(Convert.hexToUint8(this.sender.publicKey)), + new AddressDto(this.getRecipientBytes()), + ).serialize(); } /** diff --git a/src/model/receipt/InflationReceipt.ts b/src/model/receipt/InflationReceipt.ts index 4007cd2200..f9e217043d 100644 --- a/src/model/receipt/InflationReceipt.ts +++ b/src/model/receipt/InflationReceipt.ts @@ -14,8 +14,10 @@ * limitations under the License. */ -import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { InflationReceiptBuilder } from '../../infrastructure/catbuffer/InflationReceiptBuilder'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { MosaicId } from '../mosaic/MosaicId'; import { UInt64 } from '../UInt64'; import { Receipt } from './Receipt'; @@ -56,11 +58,9 @@ export class InflationReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(20); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.INFLATION_RECEIPT, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - return buffer; + return new InflationReceiptBuilder( + ReceiptVersion.INFLATION_RECEIPT, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + ).serialize(); } } From 57ac6c3f8ab28e99da9288852462a6a75181765a Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 15:35:36 +0000 Subject: [PATCH 13/22] Fixed semicolom in import --- .../catbuffer/EmbeddedTransactionHelper.ts | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index 9a9c16712f..f6c2bab694 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -19,28 +19,28 @@ *** along with Catapult. If not, see . **/ -import { EntityTypeDto } from './EntityTypeDto' -import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder' -import { GeneratorUtils } from './GeneratorUtils' -import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder' -import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder' -import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder' -import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder' -import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder' -import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder' -import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder' -import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder' -import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder' -import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder' -import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder' -import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder' -import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder' -import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder' -import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder' -import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder' -import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder' -import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder' -import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder' +import { EntityTypeDto } from './EntityTypeDto'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { GeneratorUtils } from './GeneratorUtils'; +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder'; +import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder'; +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder'; +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder'; +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder'; +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder'; +import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder'; +import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder'; export class EmbeddedTransactionHelper { From e6ff7874d8ed195f399286c74e3a8baf73211c3f Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 21:44:13 +0000 Subject: [PATCH 14/22] Fixed #397 - Applied openAPI 0.7.20.6 --- e2e/infrastructure/AccountHttp.spec.ts | 16 +- e2e/infrastructure/BlockHttp.spec.ts | 13 +- e2e/infrastructure/ChainHttp.spec.ts | 7 +- e2e/infrastructure/DiagnosticHttp.spec.ts | 7 +- e2e/infrastructure/IntegrationTestHelper.ts | 55 ++--- e2e/infrastructure/Listener.spec.ts | 84 ++++---- e2e/infrastructure/MetadataHttp.spec.ts | 21 +- e2e/infrastructure/MosaicHttp.spec.ts | 15 +- e2e/infrastructure/NamespaceHttp.spec.ts | 11 +- e2e/infrastructure/NetworkHttp.spec.ts | 4 +- e2e/infrastructure/NodeHttp.spec.ts | 4 +- e2e/infrastructure/RestrictionHttp.spec.ts | 8 +- e2e/infrastructure/TransactionHttp.spec.ts | 188 +++++++++--------- e2e/infrastructure/UnresolvedMapping.spec.ts | 9 +- .../MetadataTransactionService.spec.ts | 25 ++- ...osaicRestrictionTransactionService.spec.ts | 26 +-- e2e/service/MosaicService.spec.ts | 6 +- e2e/service/TransactionService.spec.ts | 39 ++-- ...TransactionService_AggregateBonded.spec.ts | 37 ++-- package-lock.json | 172 +++++++--------- package.json | 12 +- src/infrastructure/AccountHttp.ts | 21 +- src/infrastructure/BlockHttp.ts | 22 +- src/infrastructure/Http.ts | 5 +- src/infrastructure/Listener.ts | 16 +- src/infrastructure/MetadataHttp.ts | 9 +- src/infrastructure/QueryParams.ts | 7 +- src/infrastructure/RepositoryFactory.ts | 37 ++-- src/infrastructure/RepositoryFactoryHttp.ts | 78 ++++---- src/infrastructure/RestrictionMosaicHttp.ts | 4 +- src/infrastructure/TransactionHttp.ts | 21 +- src/infrastructure/api.ts | 2 +- src/infrastructure/api/accountRoutesApi.ts | 118 ++++++----- src/infrastructure/api/apis.ts | 2 +- src/infrastructure/api/blockRoutesApi.ts | 14 +- src/infrastructure/api/chainRoutesApi.ts | 2 +- src/infrastructure/api/diagnosticRoutesApi.ts | 2 +- src/infrastructure/api/metadataRoutesApi.ts | 2 +- src/infrastructure/api/mosaicRoutesApi.ts | 2 +- src/infrastructure/api/multisigRoutesApi.ts | 2 +- src/infrastructure/api/namespaceRoutesApi.ts | 2 +- src/infrastructure/api/networkRoutesApi.ts | 2 +- src/infrastructure/api/nodeRoutesApi.ts | 2 +- src/infrastructure/api/receiptRoutesApi.ts | 6 +- .../api/restrictionAccountRoutesApi.ts | 2 +- .../api/restrictionMosaicRoutesApi.ts | 2 +- .../api/transactionRoutesApi.ts | 2 +- ...untAddressRestrictionTransactionBodyDTO.ts | 2 +- ...accountAddressRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/accountDTO.ts | 2 +- src/infrastructure/model/accountIds.ts | 2 +- src/infrastructure/model/accountInfoDTO.ts | 2 +- .../model/accountLinkActionEnum.ts | 13 +- .../model/accountLinkTransactionBodyDTO.ts | 2 +- .../model/accountLinkTransactionDTO.ts | 2 +- .../accountMetadataTransactionBodyDTO.ts | 2 +- .../model/accountMetadataTransactionDTO.ts | 2 +- ...ountMosaicRestrictionTransactionBodyDTO.ts | 2 +- .../accountMosaicRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/accountNamesDTO.ts | 2 +- ...tOperationRestrictionTransactionBodyDTO.ts | 2 +- ...countOperationRestrictionTransactionDTO.ts | 2 +- .../model/accountRestrictionDTO.ts | 2 +- .../model/accountRestrictionFlagsEnum.ts | 33 +-- .../model/accountRestrictionsDTO.ts | 2 +- .../model/accountRestrictionsInfoDTO.ts | 2 +- src/infrastructure/model/accountTypeEnum.ts | 20 +- src/infrastructure/model/accountsNamesDTO.ts | 2 +- src/infrastructure/model/activityBucketDTO.ts | 2 +- .../model/addressAliasTransactionBodyDTO.ts | 2 +- .../model/addressAliasTransactionDTO.ts | 2 +- .../model/aggregateTransactionBodyDTO.ts | 2 +- .../model/aggregateTransactionDTO.ts | 2 +- src/infrastructure/model/aliasActionEnum.ts | 12 +- src/infrastructure/model/aliasDTO.ts | 2 +- src/infrastructure/model/aliasTypeEnum.ts | 15 +- .../model/announceTransactionInfoDTO.ts | 2 +- .../model/artifactExpiryReceiptDTO.ts | 65 ------ .../model/balanceChangeReceiptDTO.ts | 2 +- .../model/balanceChangeReceiptDTOAllOf.ts | 2 +- .../model/balanceTransferReceiptDTO.ts | 2 +- .../model/balanceTransferReceiptDTOAllOf.ts | 2 +- src/infrastructure/model/blockDTO.ts | 2 +- src/infrastructure/model/blockDTOAllOf.ts | 2 +- src/infrastructure/model/blockInfoDTO.ts | 2 +- src/infrastructure/model/blockMetaDTO.ts | 2 +- src/infrastructure/model/chainScoreDTO.ts | 2 +- .../model/communicationTimestampsDTO.ts | 2 +- src/infrastructure/model/cosignature.ts | 2 +- src/infrastructure/model/cosignatureDTO.ts | 2 +- .../model/cosignatureDTOAllOf.ts | 2 +- ...AccountAddressRestrictionTransactionDTO.ts | 2 +- .../embeddedAccountLinkTransactionDTO.ts | 2 +- .../embeddedAccountMetadataTransactionDTO.ts | 2 +- ...dAccountMosaicRestrictionTransactionDTO.ts | 2 +- ...countOperationRestrictionTransactionDTO.ts | 2 +- .../embeddedAddressAliasTransactionDTO.ts | 2 +- .../model/embeddedHashLockTransactionDTO.ts | 2 +- ...dMosaicAddressRestrictionTransactionDTO.ts | 2 +- .../embeddedMosaicAliasTransactionDTO.ts | 2 +- .../embeddedMosaicDefinitionTransactionDTO.ts | 2 +- ...edMosaicGlobalRestrictionTransactionDTO.ts | 2 +- .../embeddedMosaicMetadataTransactionDTO.ts | 2 +- ...mbeddedMosaicSupplyChangeTransactionDTO.ts | 2 +- ...ltisigAccountModificationTransactionDTO.ts | 2 +- ...embeddedNamespaceMetadataTransactionDTO.ts | 2 +- ...ddedNamespaceRegistrationTransactionDTO.ts | 2 +- .../model/embeddedSecretLockTransactionDTO.ts | 2 +- .../embeddedSecretProofTransactionDTO.ts | 2 +- .../model/embeddedTransactionDTO.ts | 2 +- .../model/embeddedTransactionInfoDTO.ts | 2 +- .../model/embeddedTransactionMetaDTO.ts | 2 +- .../model/embeddedTransferTransactionDTO.ts | 2 +- src/infrastructure/model/entityDTO.ts | 2 +- .../model/hashLockTransactionBodyDTO.ts | 2 +- .../model/hashLockTransactionDTO.ts | 2 +- src/infrastructure/model/heightInfoDTO.ts | 2 +- .../model/inflationReceiptDTO.ts | 2 +- .../model/inflationReceiptDTOAllOf.ts | 2 +- .../model/lockHashAlgorithmEnum.ts | 20 +- src/infrastructure/model/merklePathItemDTO.ts | 2 +- .../model/merkleProofInfoDTO.ts | 2 +- src/infrastructure/model/messageDTO.ts | 2 +- src/infrastructure/model/messageTypeEnum.ts | 14 +- src/infrastructure/model/metadataDTO.ts | 2 +- .../model/metadataEntriesDTO.ts | 2 +- src/infrastructure/model/metadataEntryDTO.ts | 2 +- src/infrastructure/model/metadataTypeEnum.ts | 15 +- src/infrastructure/model/modelError.ts | 2 +- src/infrastructure/model/models.ts | 6 + src/infrastructure/model/mosaic.ts | 2 +- .../model/mosaicAddressRestrictionDTO.ts | 2 +- .../model/mosaicAddressRestrictionEntryDTO.ts | 2 +- ...mosaicAddressRestrictionEntryWrapperDTO.ts | 2 +- ...aicAddressRestrictionTransactionBodyDTO.ts | 2 +- .../mosaicAddressRestrictionTransactionDTO.ts | 2 +- .../model/mosaicAliasTransactionBodyDTO.ts | 2 +- .../model/mosaicAliasTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicDTO.ts | 2 +- .../mosaicDefinitionTransactionBodyDTO.ts | 2 +- .../model/mosaicDefinitionTransactionDTO.ts | 2 +- .../model/mosaicExpiryReceiptDTO.ts | 2 +- .../model/mosaicExpiryReceiptDTOAllOf.ts | 2 +- .../model/mosaicGlobalRestrictionDTO.ts | 2 +- .../model/mosaicGlobalRestrictionEntryDTO.ts | 2 +- ...aicGlobalRestrictionEntryRestrictionDTO.ts | 2 +- .../mosaicGlobalRestrictionEntryWrapperDTO.ts | 2 +- ...saicGlobalRestrictionTransactionBodyDTO.ts | 2 +- .../mosaicGlobalRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicIds.ts | 2 +- src/infrastructure/model/mosaicInfoDTO.ts | 2 +- .../model/mosaicMetadataTransactionBodyDTO.ts | 2 +- .../model/mosaicMetadataTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicNamesDTO.ts | 2 +- .../model/mosaicRestrictionEntryTypeEnum.ts | 13 +- .../model/mosaicRestrictionTypeEnum.ts | 29 +-- .../model/mosaicSupplyChangeActionEnum.ts | 12 +- .../mosaicSupplyChangeTransactionBodyDTO.ts | 2 +- .../model/mosaicSupplyChangeTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicsInfoDTO.ts | 2 +- src/infrastructure/model/mosaicsNamesDTO.ts | 2 +- .../model/multisigAccountGraphInfoDTO.ts | 2 +- .../model/multisigAccountInfoDTO.ts | 2 +- ...igAccountModificationTransactionBodyDTO.ts | 2 +- ...ltisigAccountModificationTransactionDTO.ts | 2 +- src/infrastructure/model/multisigDTO.ts | 2 +- src/infrastructure/model/namespaceDTO.ts | 2 +- .../model/namespaceExpiryReceiptDTO.ts | 2 +- .../model/namespaceExpiryReceiptDTOAllOf.ts | 2 +- src/infrastructure/model/namespaceIds.ts | 2 +- src/infrastructure/model/namespaceInfoDTO.ts | 2 +- src/infrastructure/model/namespaceMetaDTO.ts | 2 +- .../namespaceMetadataTransactionBodyDTO.ts | 2 +- .../model/namespaceMetadataTransactionDTO.ts | 2 +- src/infrastructure/model/namespaceNameDTO.ts | 2 +- ...namespaceRegistrationTransactionBodyDTO.ts | 2 +- .../namespaceRegistrationTransactionDTO.ts | 2 +- .../model/namespaceRegistrationTypeEnum.ts | 12 +- src/infrastructure/model/namespacesInfoDTO.ts | 2 +- src/infrastructure/model/networkTypeDTO.ts | 2 +- src/infrastructure/model/networkTypeEnum.ts | 19 +- src/infrastructure/model/nodeInfoDTO.ts | 2 +- src/infrastructure/model/nodeTimeDTO.ts | 2 +- src/infrastructure/model/receiptDTO.ts | 2 +- src/infrastructure/model/receiptTypeEnum.ts | 55 +++-- .../model/resolutionEntryDTO.ts | 2 +- .../model/resolutionStatementBodyDTO.ts | 2 +- .../model/resolutionStatementDTO.ts | 2 +- src/infrastructure/model/rolesTypeEnum.ts | 16 +- .../model/secretLockTransactionBodyDTO.ts | 2 +- .../model/secretLockTransactionDTO.ts | 2 +- .../model/secretProofTransactionBodyDTO.ts | 2 +- .../model/secretProofTransactionDTO.ts | 2 +- src/infrastructure/model/serverDTO.ts | 2 +- src/infrastructure/model/serverInfoDTO.ts | 2 +- src/infrastructure/model/sourceDTO.ts | 2 +- src/infrastructure/model/statementsDTO.ts | 2 +- src/infrastructure/model/storageInfoDTO.ts | 2 +- .../model/transactionBodyDTO.ts | 2 +- src/infrastructure/model/transactionDTO.ts | 2 +- src/infrastructure/model/transactionHashes.ts | 2 +- src/infrastructure/model/transactionIds.ts | 2 +- .../model/transactionInfoDTO.ts | 2 +- .../model/transactionMetaDTO.ts | 2 +- .../model/transactionPayload.ts | 2 +- .../model/transactionStateTypeEnum.ts | 35 ++++ .../model/transactionStatementBodyDTO.ts | 2 +- .../model/transactionStatementDTO.ts | 2 +- .../model/transactionStatusDTO.ts | 20 +- .../model/transactionStatusTypeEnum.ts | 179 +++++++++++++++++ .../model/transactionTypeEnum.ts | 70 ++++--- .../model/transferTransactionBodyDTO.ts | 2 +- .../model/transferTransactionDTO.ts | 2 +- src/infrastructure/model/unresolvedMosaic.ts | 2 +- .../model/verifiableEntityDTO.ts | 2 +- .../receipt/CreateReceiptFromDTO.ts | 164 +++++++-------- .../templates/api-single.mustache | 4 +- src/infrastructure/templates/model.mustache | 2 +- src/model/blockchain/MerkleProofInfo.ts | 2 +- src/model/receipt/BalanceTransferReceipt.ts | 2 +- src/model/transaction/SignedTransaction.ts | 2 +- src/model/transaction/TransactionStatus.ts | 16 +- .../transaction/TransactionStatusError.ts | 2 +- src/service/AggregateTransactionService.ts | 2 +- src/service/MetadataTransactionService.ts | 4 +- .../MosaicRestrictionTransactionService.ts | 7 +- src/service/MosaicService.ts | 8 +- src/service/NamespaceService.ts | 2 +- src/service/TransactionService.ts | 4 +- test/core/utils/UnresolvedMapping.spec.ts | 2 +- test/infrastructure/Listener.spec.ts | 24 +-- test/infrastructure/RepositoryFactory.spec.ts | 80 ++++---- .../receipt/CreateReceiptFromDTO.spec.ts | 2 - test/model/account/Address.spec.ts | 30 +-- .../transaction/HashLockTransaction.spec.ts | 2 +- .../transaction/TransactionStatus.spec.ts | 7 +- .../TransactionStatusError.spec.ts | 4 +- test/service/MosaicService.spec.ts | 11 +- 238 files changed, 1306 insertions(+), 1187 deletions(-) delete mode 100644 src/infrastructure/model/artifactExpiryReceiptDTO.ts create mode 100644 src/infrastructure/model/transactionStateTypeEnum.ts create mode 100644 src/infrastructure/model/transactionStatusTypeEnum.ts diff --git a/e2e/infrastructure/AccountHttp.spec.ts b/e2e/infrastructure/AccountHttp.spec.ts index 4d666e63ae..2335d2bab2 100644 --- a/e2e/infrastructure/AccountHttp.spec.ts +++ b/e2e/infrastructure/AccountHttp.spec.ts @@ -33,10 +33,10 @@ import { MultisigAccountModificationTransaction } from '../../src/model/transact import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('AccountHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -93,7 +93,7 @@ describe('AccountHttp', () => { [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -109,7 +109,7 @@ describe('AccountHttp', () => { namespaceName, UInt64.fromUint(9), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -265,7 +265,7 @@ describe('AccountHttp', () => { namespaceId, account.address, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -282,7 +282,7 @@ describe('AccountHttp', () => { [cosignAccount1.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const removeCosigner2 = MultisigAccountModificationTransaction.create( Deadline.create(), @@ -293,7 +293,7 @@ describe('AccountHttp', () => { cosignAccount2.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const removeCosigner3 = MultisigAccountModificationTransaction.create( @@ -305,7 +305,7 @@ describe('AccountHttp', () => { cosignAccount3.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), diff --git a/e2e/infrastructure/BlockHttp.spec.ts b/e2e/infrastructure/BlockHttp.spec.ts index 30e7e192ea..73356ba2a7 100644 --- a/e2e/infrastructure/BlockHttp.spec.ts +++ b/e2e/infrastructure/BlockHttp.spec.ts @@ -17,7 +17,9 @@ import { expect } from 'chai'; import { mergeMap } from 'rxjs/operators'; import { BlockHttp } from '../../src/infrastructure/BlockHttp'; +import { BlockRepository } from '../../src/infrastructure/BlockRepository'; import { QueryParams } from '../../src/infrastructure/QueryParams'; +import { ReceiptRepository } from '../../src/infrastructure/ReceiptRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; @@ -25,12 +27,10 @@ import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMos import { Deadline } from '../../src/model/transaction/Deadline'; import { TransactionInfo } from '../../src/model/transaction/TransactionInfo'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { BlockRepository } from "../../src/infrastructure/BlockRepository"; -import { ReceiptRepository } from "../../src/infrastructure/ReceiptRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('BlockHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let blockRepository: BlockRepository; @@ -68,7 +68,6 @@ describe('BlockHttp', () => { describe('Setup Test Data', () => { - it('Announce TransferTransaction', (done) => { const transferTransaction = TransferTransaction.create( Deadline.create(), @@ -76,10 +75,10 @@ describe('BlockHttp', () => { [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); - helper.announce(signedTransaction).then(transaction => { + helper.announce(signedTransaction).then((transaction) => { chainHeight = transaction.transactionInfo!.height.toString(); return transaction; }); diff --git a/e2e/infrastructure/ChainHttp.spec.ts b/e2e/infrastructure/ChainHttp.spec.ts index 53c3171900..59eb1984cd 100644 --- a/e2e/infrastructure/ChainHttp.spec.ts +++ b/e2e/infrastructure/ChainHttp.spec.ts @@ -15,12 +15,11 @@ */ import { expect } from 'chai'; -import { ChainHttp } from '../../src/infrastructure/ChainHttp'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { ChainRepository } from "../../src/infrastructure/ChainRepository"; +import { ChainRepository } from '../../src/infrastructure/ChainRepository'; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('ChainHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let chainRepository: ChainRepository; before(() => { diff --git a/e2e/infrastructure/DiagnosticHttp.spec.ts b/e2e/infrastructure/DiagnosticHttp.spec.ts index 419dbe29db..70e9dff83b 100644 --- a/e2e/infrastructure/DiagnosticHttp.spec.ts +++ b/e2e/infrastructure/DiagnosticHttp.spec.ts @@ -15,12 +15,11 @@ */ import { expect } from 'chai'; -import { DiagnosticHttp } from '../../src/infrastructure/DiagnosticHttp'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { DiagnosticRepository } from "../../src/infrastructure/DiagnosticRepository"; +import { DiagnosticRepository } from '../../src/infrastructure/DiagnosticRepository'; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('DiagnosticHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let diagnosticRepository: DiagnosticRepository; before(() => { diff --git a/e2e/infrastructure/IntegrationTestHelper.ts b/e2e/infrastructure/IntegrationTestHelper.ts index 8fc76c17fa..2e158f3bd4 100644 --- a/e2e/infrastructure/IntegrationTestHelper.ts +++ b/e2e/infrastructure/IntegrationTestHelper.ts @@ -13,21 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Account } from "../../src/model/account/Account"; -import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp"; -import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; -import { combineLatest } from "rxjs"; -import { IListener } from "../../src/infrastructure/IListener"; -import { SignedTransaction } from "../../src/model/transaction/SignedTransaction"; -import { filter } from "rxjs/operators"; -import { Transaction } from "../../src/model/transaction/Transaction"; -import { UInt64 } from "../../src/model/UInt64"; - -const yaml = require('js-yaml'); +import { combineLatest } from 'rxjs'; +import { filter } from 'rxjs/operators'; +import { IListener } from '../../src/infrastructure/IListener'; +import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory'; +import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp'; +import { Account } from '../../src/model/account/Account'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; +import { SignedTransaction } from '../../src/model/transaction/SignedTransaction'; +import { Transaction } from '../../src/model/transaction/Transaction'; +import { UInt64 } from '../../src/model/UInt64'; export class IntegrationTestHelper { - + public readonly yaml = require('js-yaml'); public apiUrl: string; public repositoryFactory: RepositoryFactory; public account: Account; @@ -57,7 +55,8 @@ export class IntegrationTestHelper { console.log(`Running tests against: ${json.apiUrl}`); this.apiUrl = json.apiUrl; this.repositoryFactory = new RepositoryFactoryHttp(json.apiUrl); - combineLatest(this.repositoryFactory.getGenerationHash(), this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => { + combineLatest(this.repositoryFactory.getGenerationHash(), + this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => { this.networkType = networkType; this.generationHash = generationHash; this.account = this.createAccount(json.testAccount); @@ -71,15 +70,18 @@ export class IntegrationTestHelper { this.harvestingAccount = this.createAccount(json.harvestingAccount); this.listener = this.repositoryFactory.createListener(); - this.maxFee = UInt64.fromUint(1000000); //What would be the best maxFee? In the future we will load the fee multiplier from rest. - + // What would be the best maxFee? In the future we will load the fee multiplier from rest. + this.maxFee = UInt64.fromUint(1000000); - require('fs').readFile(path.resolve(__dirname, '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), (err, yamlData) => { - if (err) { - console.log(`catapult-service-bootstrap generated address could not be loaded. Ignoring and using accounts from network.conf. Error: ${err}`); + require('fs').readFile(path.resolve(__dirname, + '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), + (error: any, yamlData: any) => { + if (error) { + console.log(`catapult-service-bootstrap generated address could not be loaded. + Ignoring and using accounts from network.conf. Error: ${error}`); return resolve(this); } else { - const parsedYaml = yaml.safeLoad(yamlData); + const parsedYaml = this.yaml.safeLoad(yamlData); this.account = this.createAccount(parsedYaml.nemesis_addresses[0]); this.account2 = this.createAccount(parsedYaml.nemesis_addresses[1]); this.account3 = this.createAccount(parsedYaml.nemesis_addresses[2]); @@ -91,15 +93,14 @@ export class IntegrationTestHelper { } }); }, (error) => { - console.log("There has been an error loading the configuration. ", error) + console.log('There has been an error loading the configuration. ', error); return reject(error); }); }); - - } + }, ); - }; + } createAccount(data): Account { return Account.createFromPrivateKey(data.privateKey ? data.privateKey : data.private, this.networkType); @@ -114,12 +115,12 @@ export class IntegrationTestHelper { console.log(`Transaction ${signedTransaction.type} confirmed`); resolve(transaction); }); - this.listener.status(address).pipe(filter(status => status.hash === signedTransaction.hash)).subscribe((error) => { + this.listener.status(address).pipe(filter((status) => status.hash === signedTransaction.hash)).subscribe((error) => { console.log(`Error processing transaction ${signedTransaction.type}`, error); reject(error); }); this.repositoryFactory.createTransactionRepository().announce(signedTransaction); - } + }, ); - }; + } } diff --git a/e2e/infrastructure/Listener.spec.ts b/e2e/infrastructure/Listener.spec.ts index 8a2f418aa7..5114b35817 100644 --- a/e2e/infrastructure/Listener.spec.ts +++ b/e2e/infrastructure/Listener.spec.ts @@ -14,7 +14,10 @@ * limitations under the License. */ import { assert, expect } from 'chai'; +import { ChronoUnit } from 'js-joda'; +import { filter } from 'rxjs/operators'; import { AccountRepository } from '../../src/infrastructure/AccountRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { TransactionRepository } from '../../src/infrastructure/TransactionRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; @@ -25,7 +28,7 @@ import { LockFundsTransaction, Mosaic, SignedTransaction, - UInt64 + UInt64, } from '../../src/model/model'; import { MosaicId } from '../../src/model/mosaic/MosaicId'; import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic'; @@ -34,14 +37,11 @@ import { AggregateTransaction } from '../../src/model/transaction/AggregateTrans import { Deadline } from '../../src/model/transaction/Deadline'; import { MultisigAccountModificationTransaction } from '../../src/model/transaction/MultisigAccountModificationTransaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; -import { filter } from "rxjs/operators"; -import { ChronoUnit } from "js-joda"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('Listener', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -82,36 +82,35 @@ describe('Listener', () => { setTimeout(done, 200); }); - - let createSignedAggregatedBondTransaction = (aggregatedTo: Account, - signer: Account, - recipient: Address): SignedTransaction => { + const createSignedAggregatedBondTransaction = (aggregatedTo: Account, + signer: Account, + recipient: Address): SignedTransaction => { const transferTransaction = TransferTransaction.create( Deadline.create(), recipient, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), [transferTransaction.toAggregate(aggregatedTo.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); return signer.sign(aggregateTransaction, generationHash); }; - let createHashLockTransactionAndAnnounce = (signedAggregatedTransaction: SignedTransaction, - signer: Account, - mosaicId: MosaicId) => { + const createHashLockTransactionAndAnnounce = (signedAggregatedTransaction: SignedTransaction, + signer: Account, + mosaicId: MosaicId) => { const lockFundsTransaction = LockFundsTransaction.create( Deadline.create(), new Mosaic(mosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = signer.sign(lockFundsTransaction, generationHash); transactionRepository.announce(signedLockFundsTransaction); @@ -125,7 +124,7 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); return helper.announce(signedTransaction); @@ -141,7 +140,7 @@ describe('Listener', () => { recipientAddress, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); return helper.announce(signedTransaction); @@ -157,10 +156,11 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); - helper.listener.unconfirmedAdded(account.address).pipe(filter((_) => _.transactionInfo!.hash === signedTransaction.hash)).subscribe(() => { + helper.listener.unconfirmedAdded(account.address).pipe( + filter((_) => _.transactionInfo!.hash === signedTransaction.hash)).subscribe(() => { done(); }); helper.announce(signedTransaction); @@ -173,10 +173,10 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); - helper.listener.unconfirmedRemoved(account.address).pipe(filter(hash => hash === signedTransaction.hash)).subscribe(() => { + helper.listener.unconfirmedRemoved(account.address).pipe(filter((hash) => hash === signedTransaction.hash)).subscribe(() => { done(); }); helper.announce(signedTransaction); @@ -198,7 +198,7 @@ describe('Listener', () => { cosignAccount1.address, [new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY)))], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -218,7 +218,7 @@ describe('Listener', () => { cosignAccount3.publicAccount, ], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -228,7 +228,6 @@ describe('Listener', () => { const signedTransaction = aggregateTransaction .signTransactionWithCosignatories(multisigAccount, [cosignAccount1, cosignAccount2, cosignAccount3], generationHash); - return helper.announce(signedTransaction); }); }); @@ -236,24 +235,27 @@ describe('Listener', () => { describe('Aggregate Bonded Transactions', () => { it('aggregateBondedTransactionsAdded', (done) => { + const signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, account, account2.address); + createHashLockTransactionAndAnnounce(signedAggregatedTx, account, networkCurrencyMosaicId); helper.listener.aggregateBondedAdded(account.address).subscribe(() => { done(); }); helper.listener.confirmed(account.address).subscribe(() => { - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(account.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, account, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, account, networkCurrencyMosaicId); }); }); describe('Aggregate Bonded Transactions', () => { it('aggregateBondedTransactionsRemoved', (done) => { + const signedAggregatedTx = + createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); + + createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); helper.listener.confirmed(cosignAccount1.address).subscribe(() => { helper.listener.aggregateBondedRemoved(cosignAccount1.address).subscribe(() => { done(); @@ -272,23 +274,23 @@ describe('Listener', () => { assert(false); done(); }); - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(cosignAccount1.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = - createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); }); }); describe('Aggregate Bonded Transactions', () => { it('cosignatureAdded', (done) => { + const signedAggregatedTx = + createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); + + createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); helper.listener.cosignatureAdded(cosignAccount1.address).subscribe(() => { done(); }); @@ -301,17 +303,13 @@ describe('Listener', () => { }); }); helper.listener.confirmed(cosignAccount1.address).subscribe(() => { - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(cosignAccount1.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = - createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); }); }); @@ -365,12 +363,12 @@ describe('Listener', () => { account2.address, mosaics, PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(transferTransaction.signWith(account, generationHash)).then(() => { - throw new Error("Transaction should have failed!!"); - }, error => { + throw new Error('Transaction should have failed!!'); + }, (error) => { expect(error.status).to.be.equal('Failure_Core_Insufficient_Balance'); }); }); @@ -387,7 +385,7 @@ describe('Listener', () => { account2.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); helper.announce(transferTransaction.signWith(account, generationHash)); diff --git a/e2e/infrastructure/MetadataHttp.spec.ts b/e2e/infrastructure/MetadataHttp.spec.ts index e28d0f4405..5b8a9062e6 100644 --- a/e2e/infrastructure/MetadataHttp.spec.ts +++ b/e2e/infrastructure/MetadataHttp.spec.ts @@ -15,7 +15,7 @@ */ import { expect } from 'chai'; -import { MetadataHttp } from '../../src/infrastructure/MetadataHttp'; +import { MetadataRepository } from '../../src/infrastructure/MetadataRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; @@ -31,12 +31,11 @@ import { MosaicMetadataTransaction } from '../../src/model/transaction/MosaicMet import { NamespaceMetadataTransaction } from '../../src/model/transaction/NamespaceMetadataTransaction'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { MetadataRepository } from "../../src/infrastructure/MetadataRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('MetadataHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let accountAddress: Address; let mosaicId: MosaicId; @@ -82,7 +81,7 @@ describe('MetadataHttp', () => { 3, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -98,7 +97,7 @@ describe('MetadataHttp', () => { namespaceName, UInt64.fromUint(9), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -115,7 +114,7 @@ describe('MetadataHttp', () => { 23, `Test account meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -138,14 +137,14 @@ describe('MetadataHttp', () => { 22, `Test mosaic meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -163,14 +162,14 @@ describe('MetadataHttp', () => { 25, `Test namespace meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [namespaceMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/MosaicHttp.spec.ts b/e2e/infrastructure/MosaicHttp.spec.ts index 3ca7a0d325..63656756a5 100644 --- a/e2e/infrastructure/MosaicHttp.spec.ts +++ b/e2e/infrastructure/MosaicHttp.spec.ts @@ -15,6 +15,7 @@ */ import { expect } from 'chai'; import { MosaicRepository } from '../../src/infrastructure/MosaicRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags'; @@ -27,8 +28,7 @@ import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasT import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('MosaicHttp', () => { @@ -38,7 +38,7 @@ describe('MosaicHttp', () => { let namespaceId: NamespaceId; let namespaceRepository: NamespaceRepository; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { @@ -76,7 +76,7 @@ describe('MosaicHttp', () => { 3, UInt64.fromUint(0), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); @@ -93,7 +93,7 @@ describe('MosaicHttp', () => { namespaceName, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -110,7 +110,7 @@ describe('MosaicHttp', () => { namespaceId, mosaicId, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -184,7 +184,6 @@ describe('MosaicHttp', () => { */ describe('Remove test MosaicAlias', () => { - it('Announce MosaicAliasTransaction', () => { const mosaicAliasTransaction = MosaicAliasTransaction.create( Deadline.create(), @@ -192,7 +191,7 @@ describe('MosaicHttp', () => { namespaceId, mosaicId, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/NamespaceHttp.spec.ts b/e2e/infrastructure/NamespaceHttp.spec.ts index d2e36d6065..4f02b927af 100644 --- a/e2e/infrastructure/NamespaceHttp.spec.ts +++ b/e2e/infrastructure/NamespaceHttp.spec.ts @@ -17,6 +17,7 @@ import { deepEqual } from 'assert'; import { expect } from 'chai'; import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic'; import { AliasAction } from '../../src/model/namespace/AliasAction'; import { NamespaceId } from '../../src/model/namespace/NamespaceId'; @@ -24,8 +25,7 @@ import { AddressAliasTransaction } from '../../src/model/transaction/AddressAlia import { Deadline } from '../../src/model/transaction/Deadline'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { Address } from "../../src/model/account/Address"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NamespaceHttp', () => { const defaultNamespaceId = NetworkCurrencyMosaic.NAMESPACE_ID; @@ -33,7 +33,7 @@ describe('NamespaceHttp', () => { let namespaceRepository: NamespaceRepository; let account: Account; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); before(() => { return helper.start().then(() => { @@ -60,7 +60,7 @@ describe('NamespaceHttp', () => { namespaceName, UInt64.fromUint(1000), helper.networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -69,7 +69,6 @@ describe('NamespaceHttp', () => { }); describe('AddressAliasTransaction', () => { - it('standalone', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), @@ -77,7 +76,7 @@ describe('NamespaceHttp', () => { namespaceId, account.address, helper.networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); diff --git a/e2e/infrastructure/NetworkHttp.spec.ts b/e2e/infrastructure/NetworkHttp.spec.ts index 376d5317ee..1e4e74c8db 100644 --- a/e2e/infrastructure/NetworkHttp.spec.ts +++ b/e2e/infrastructure/NetworkHttp.spec.ts @@ -16,11 +16,11 @@ import { expect } from 'chai'; import { NetworkRepository } from '../../src/infrastructure/NetworkRepository'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NetworkHttp', () => { let networkRepository: NetworkRepository; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { diff --git a/e2e/infrastructure/NodeHttp.spec.ts b/e2e/infrastructure/NodeHttp.spec.ts index 60b64dbcef..4d6cfd427b 100644 --- a/e2e/infrastructure/NodeHttp.spec.ts +++ b/e2e/infrastructure/NodeHttp.spec.ts @@ -16,11 +16,11 @@ import { expect } from 'chai'; import { NodeRepository } from '../../src/infrastructure/NodeRepository'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NodeHttp', () => { let nodeRepository: NodeRepository; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); before(() => { return helper.start().then(() => { diff --git a/e2e/infrastructure/RestrictionHttp.spec.ts b/e2e/infrastructure/RestrictionHttp.spec.ts index 7110e8a5a2..35464fa883 100644 --- a/e2e/infrastructure/RestrictionHttp.spec.ts +++ b/e2e/infrastructure/RestrictionHttp.spec.ts @@ -16,6 +16,7 @@ import { deepEqual } from 'assert'; import { expect } from 'chai'; +import { RestrictionAccountRepository } from '../../src/infrastructure/RestrictionAccountRespository'; import { RestrictionMosaicRepository } from '../../src/infrastructure/RestrictionMosaicRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; @@ -33,11 +34,10 @@ import { MosaicAddressRestrictionTransaction } from '../../src/model/transaction import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction'; import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/MosaicGlobalRestrictionTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { RestrictionAccountRepository } from "../../src/infrastructure/RestrictionAccountRespository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('RestrictionHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account3: Account; let accountAddress: Address; @@ -177,7 +177,7 @@ describe('RestrictionHttp', () => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/TransactionHttp.spec.ts b/e2e/infrastructure/TransactionHttp.spec.ts index 3c0b266764..1df25ff961 100644 --- a/e2e/infrastructure/TransactionHttp.spec.ts +++ b/e2e/infrastructure/TransactionHttp.spec.ts @@ -21,7 +21,13 @@ import { Crypto } from '../../src/core/crypto'; import { Convert, Convert as convert } from '../../src/core/format'; import { TransactionMapping } from '../../src/core/utils/TransactionMapping'; import { AccountRepository } from '../../src/infrastructure/AccountRepository'; +import { MultisigRepository } from '../../src/infrastructure/MultisigRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; +import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory'; +import { TransactionRepository } from '../../src/infrastructure/TransactionRepository'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; +import { PublicAccount } from '../../src/model/account/PublicAccount'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; import { Mosaic } from '../../src/model/mosaic/Mosaic'; @@ -64,19 +70,13 @@ import { SecretProofTransaction } from '../../src/model/transaction/SecretProofT import { TransactionType } from '../../src/model/transaction/TransactionType'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { Address } from "../../src/model/account/Address"; -import { PublicAccount } from "../../src/model/account/PublicAccount"; -import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory"; -import { MultisigRepository } from "../../src/infrastructure/MultisigRepository"; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { TransactionRepository } from "../../src/infrastructure/TransactionRepository"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('TransactionHttp', () => { let transactionHash; let transactionId; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let account3: Account; @@ -154,7 +154,7 @@ describe('TransactionHttp', () => { 3, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); @@ -182,7 +182,7 @@ describe('TransactionHttp', () => { 3, UInt64.fromUint(0), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicDefinitionTransaction.toAggregate(account.publicAccount)], @@ -203,14 +203,14 @@ describe('TransactionHttp', () => { 10, Convert.uint8ToUtf8(new Uint8Array(10)), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [accountMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); @@ -235,13 +235,13 @@ describe('TransactionHttp', () => { mosaicId, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: AggregateTransaction) => { @@ -264,7 +264,7 @@ describe('TransactionHttp', () => { Deadline.create(), namespaceName, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -283,7 +283,7 @@ describe('TransactionHttp', () => { Deadline.create(), 'root-test-namespace-' + Math.floor(Math.random() * 10000), UInt64.fromUint(5), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [registerNamespaceTransaction.toAggregate(account.publicAccount)], @@ -303,13 +303,13 @@ describe('TransactionHttp', () => { namespaceId, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [namespaceMetadataTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: AggregateTransaction) => { @@ -334,7 +334,7 @@ describe('TransactionHttp', () => { MosaicRestrictionType.NONE, UInt64.fromUint(0), MosaicRestrictionType.GE, - networkType, undefined, helper.maxFee + networkType, undefined, helper.maxFee, ); const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -350,12 +350,12 @@ describe('TransactionHttp', () => { MosaicRestrictionType.GE, UInt64.fromUint(1), MosaicRestrictionType.GE, - networkType, undefined, helper.maxFee + networkType, undefined, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicGlobalRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -371,12 +371,12 @@ describe('TransactionHttp', () => { UInt64.fromUint(60641), account3.address, UInt64.fromUint(2), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -390,7 +390,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -403,12 +403,12 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transferTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -421,7 +421,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingAddress, [account3.address], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); @@ -439,15 +439,15 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingAddress, [], [account3.address], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); @@ -459,10 +459,10 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingAddress, [account3.address], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); describe('AccountRestrictionTransaction - Incoming Address', () => { @@ -472,12 +472,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingAddress, [], [account3.address], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -485,7 +485,6 @@ describe('TransactionHttp', () => { }); describe('AccountRestrictionTransaction - Mosaic', () => { - it('standalone', () => { AccountRestrictionModification.createForMosaic( AccountRestrictionModificationAction.Add, @@ -496,7 +495,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockMosaic, [mosaicId], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); @@ -515,12 +514,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockMosaic, [], [mosaicId], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -534,7 +533,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingTransactionType, [TransactionType.LINK_ACCOUNT], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account3, generationHash); @@ -553,21 +552,20 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingTransactionType, [], [TransactionType.LINK_ACCOUNT], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account3.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account3, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); describe('AccountRestrictionTransaction - Outgoing Operation', () => { - it('standalone', () => { AccountRestrictionModification.createForOperation( AccountRestrictionModificationAction.Add, @@ -578,7 +576,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingTransactionType, [TransactionType.LINK_ACCOUNT], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account3, generationHash); @@ -598,12 +596,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingTransactionType, [], [TransactionType.LINK_ACCOUNT], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account3.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account3, generationHash); return helper.announce(signedTransaction); @@ -613,13 +611,12 @@ describe('TransactionHttp', () => { describe('AccountLinkTransaction', () => { - it('standalone', (done) => { const accountLinkTransaction = AccountLinkTransaction.create( Deadline.create(), harvestingAccount.publicKey, LinkAction.Link, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = accountLinkTransaction.signWith(account, generationHash); @@ -638,12 +635,12 @@ describe('TransactionHttp', () => { Deadline.create(), harvestingAccount.publicKey, LinkAction.Unlink, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [accountLinkTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -652,14 +649,13 @@ describe('TransactionHttp', () => { describe('AddressAliasTransaction', () => { - it('standalone', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), AliasAction.Link, namespaceId, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); @@ -674,14 +670,13 @@ describe('TransactionHttp', () => { describe('Transfer Transaction using address alias', () => { - it('Announce TransferTransaction', () => { const transferTransaction = TransferTransaction.create( Deadline.create(), namespaceId, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -697,12 +692,12 @@ describe('TransactionHttp', () => { AliasAction.Unlink, namespaceId, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressAliasTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -717,7 +712,7 @@ describe('TransactionHttp', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: MosaicSupplyChangeTransaction) => { @@ -736,7 +731,7 @@ describe('TransactionHttp', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicSupplyChangeTransaction.toAggregate(account.publicAccount)], @@ -750,14 +745,13 @@ describe('TransactionHttp', () => { describe('MosaicAliasTransaction', () => { - it('standalone', () => { const mosaicAliasTransaction = MosaicAliasTransaction.create( Deadline.create(), AliasAction.Link, namespaceId, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); @@ -776,7 +770,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const hashLockTransaction = HashLockTransaction.create(Deadline.create(), @@ -797,12 +791,12 @@ describe('TransactionHttp', () => { AliasAction.Unlink, namespaceId, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAliasTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -816,7 +810,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(), @@ -835,7 +829,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(), @@ -859,7 +853,7 @@ describe('TransactionHttp', () => { account2.address, [], PlainMessage.create('Hi'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggTx = AggregateTransaction.createComplete( Deadline.create(), @@ -867,7 +861,7 @@ describe('TransactionHttp', () => { tx.toAggregate(account.publicAccount), ], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggTx, generationHash); return helper.announce(signedTransaction); @@ -884,7 +878,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = secretLockTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: SecretLockTransaction) => { @@ -898,7 +892,6 @@ describe('TransactionHttp', () => { }); describe('HashType: Op_Sha3_256', () => { - it('aggregate', () => { const secretLockTransaction = SecretLockTransaction.create( Deadline.create(), @@ -907,7 +900,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -926,7 +919,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -941,7 +934,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -962,7 +955,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -979,7 +972,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -998,7 +991,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -1013,7 +1006,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -1037,7 +1030,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedSecretLockTx = secretLockTransaction.signWith(account, generationHash); @@ -1049,7 +1042,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTx = secretProofTransaction.signWith(account2, generationHash); return helper.announce(signedTx).then((transaction: SecretProofTransaction) => { @@ -1058,8 +1051,7 @@ describe('TransactionHttp', () => { expect(transaction.hashType, 'HashType').not.to.be.undefined; expect(transaction.proof, 'Proof').not.to.be.undefined; }); - }) - + }); }); }); @@ -1076,7 +1068,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1086,13 +1078,13 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], networkType, [], helper.maxFee); return helper.announce(aggregateSecretProofTransaction.signWith(account2, generationHash)); - }) + }); }); }); @@ -1109,7 +1101,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1119,7 +1111,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretProofTransaction.signWith(account2, generationHash)); }); @@ -1138,7 +1130,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { const secretProofTransaction = SecretProofTransaction.create( @@ -1147,7 +1139,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1172,7 +1164,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1182,7 +1174,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTx = secretProofTransaction.signWith(account2, generationHash); return helper.announce(signedTx); @@ -1204,7 +1196,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( Deadline.create(), @@ -1212,7 +1204,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1238,7 +1230,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( @@ -1247,7 +1239,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => @@ -1269,7 +1261,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( Deadline.create(), @@ -1277,7 +1269,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1314,7 +1306,7 @@ describe('TransactionHttp', () => { bobTransferTransaction.toAggregate(account2.publicAccount), ], networkType, - [], helper.maxFee + [], helper.maxFee, ); const aliceSignedTransaction = aggregateTransaction.signWith(account, generationHash); @@ -1416,7 +1408,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionRepository.announce(signedTransaction) @@ -1435,7 +1427,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createRelative(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), diff --git a/e2e/infrastructure/UnresolvedMapping.spec.ts b/e2e/infrastructure/UnresolvedMapping.spec.ts index bf8e54dd6d..696aa12541 100644 --- a/e2e/infrastructure/UnresolvedMapping.spec.ts +++ b/e2e/infrastructure/UnresolvedMapping.spec.ts @@ -15,8 +15,10 @@ */ import { expect } from 'chai'; import { Convert } from '../../src/core/format'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { TransactionHttp } from '../../src/infrastructure/TransactionHttp'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags'; @@ -38,12 +40,10 @@ import { NamespaceRegistrationTransaction } from '../../src/model/transaction/Na import { Transaction } from '../../src/model/transaction/Transaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { Address } from "../../src/model/account/Address"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('TransactionHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let namespaceRepository: NamespaceRepository; @@ -291,7 +291,6 @@ describe('TransactionHttp', () => { ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); - return helper.announce(signedTransaction).then((transaction: AddressAliasTransaction) => { expect(transaction.namespaceId, 'NamespaceId').not.to.be.undefined; expect(transaction.aliasAction, 'AliasAction').not.to.be.undefined; diff --git a/e2e/service/MetadataTransactionService.spec.ts b/e2e/service/MetadataTransactionService.spec.ts index df66835650..5489391285 100644 --- a/e2e/service/MetadataTransactionService.spec.ts +++ b/e2e/service/MetadataTransactionService.spec.ts @@ -17,14 +17,14 @@ import { NamespaceRegistrationTransaction } from '../../src/model/transaction/Na import { TransactionType } from '../../src/model/transaction/TransactionType'; import { UInt64 } from '../../src/model/UInt64'; import { MetadataTransactionService } from '../../src/service/MetadataTransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MetadataTransactionService', () => { const deadline = Deadline.create(); const key = UInt64.fromUint(123); const newValue = 'new test value'; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; let targetAccount: Account; @@ -33,7 +33,6 @@ describe('MetadataTransactionService', () => { let namespaceId: NamespaceId; let generationHash: string; - before(() => { return helper.start().then(() => { targetAccount = helper.account; @@ -69,7 +68,7 @@ describe('MetadataTransactionService', () => { MosaicFlags.create(true, true, true), 3, UInt64.fromUint(1000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(targetAccount, generationHash); return helper.announce(signedTransaction); @@ -84,7 +83,7 @@ describe('MetadataTransactionService', () => { Deadline.create(), namespaceName, UInt64.fromUint(9), - networkType, helper.maxFee + networkType, helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(targetAccount, generationHash); @@ -104,14 +103,14 @@ describe('MetadataTransactionService', () => { newValue.length, newValue, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); @@ -136,7 +135,7 @@ describe('MetadataTransactionService', () => { [namespaceMetadataTransaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); return helper.announce(signedTransaction); @@ -228,13 +227,13 @@ describe('MetadataTransactionService', () => { newValue + 'delta', targetAccount.publicAccount, mosaicId, - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicMetadataTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { @@ -262,13 +261,13 @@ describe('MetadataTransactionService', () => { newValue + 'delta' + 'extra delta', targetAccount.publicAccount, mosaicId, - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicMetadataTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { @@ -301,7 +300,7 @@ describe('MetadataTransactionService', () => { [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { diff --git a/e2e/service/MosaicRestrictionTransactionService.spec.ts b/e2e/service/MosaicRestrictionTransactionService.spec.ts index 482178aa9e..facbe26d12 100644 --- a/e2e/service/MosaicRestrictionTransactionService.spec.ts +++ b/e2e/service/MosaicRestrictionTransactionService.spec.ts @@ -15,7 +15,7 @@ import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/ import { TransactionType } from '../../src/model/transaction/TransactionType'; import { UInt64 } from '../../src/model/UInt64'; import { MosaicRestrictionTransactionService } from '../../src/service/MosaicRestrictionTransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MosaicRestrictionTransactionService', () => { const deadline = Deadline.create(); @@ -24,7 +24,7 @@ describe('MosaicRestrictionTransactionService', () => { let restrictionRepository: RestrictionMosaicRepository; let mosaicId: MosaicId; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { @@ -62,7 +62,7 @@ describe('MosaicRestrictionTransactionService', () => { MosaicFlags.create(true, true, true), 3, UInt64.fromUint(1000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -82,9 +82,9 @@ describe('MosaicRestrictionTransactionService', () => { MosaicRestrictionType.GE, networkType, undefined, - helper.maxFee + helper.maxFee, ); - const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash) + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); }); }); @@ -99,12 +99,12 @@ describe('MosaicRestrictionTransactionService', () => { account.address, UInt64.fromUint(2), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -126,7 +126,7 @@ describe('MosaicRestrictionTransactionService', () => { mosaicId, key, '1', - MosaicRestrictionType.GE, undefined, helper.maxFee + MosaicRestrictionType.GE, undefined, helper.maxFee, ).subscribe((transaction: MosaicGlobalRestrictionTransaction) => { expect(transaction.type).to.be.equal(TransactionType.MOSAIC_GLOBAL_RESTRICTION); expect(transaction.previousRestrictionValue.toString()).to.be.equal('0'); @@ -147,7 +147,7 @@ describe('MosaicRestrictionTransactionService', () => { key, account.address, '3', - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicAddressRestrictionTransaction) => { expect(transaction.type).to.be.equal(TransactionType.MOSAIC_ADDRESS_RESTRICTION); expect(transaction.previousRestrictionValue.toString()).to.be.equal('2'); @@ -169,13 +169,13 @@ describe('MosaicRestrictionTransactionService', () => { mosaicId, key, '1', - MosaicRestrictionType.GE, undefined, helper.maxFee + MosaicRestrictionType.GE, undefined, helper.maxFee, ).subscribe((transaction: MosaicGlobalRestrictionTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); helper.announce(signedTransaction).then(() => { @@ -197,13 +197,13 @@ describe('MosaicRestrictionTransactionService', () => { key, account.address, '3', - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicAddressRestrictionTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); helper.announce(signedTransaction).then(() => { diff --git a/e2e/service/MosaicService.spec.ts b/e2e/service/MosaicService.spec.ts index 95036cfda8..0429d88e77 100644 --- a/e2e/service/MosaicService.spec.ts +++ b/e2e/service/MosaicService.spec.ts @@ -17,16 +17,16 @@ import { AccountRepository } from '../../src/infrastructure/AccountRepository'; import { MosaicRepository } from '../../src/infrastructure/MosaicRepository'; import { Address } from '../../src/model/account/Address'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { MosaicService } from '../../src/service/MosaicService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MosaicService', () => { let accountAddress: Address; let accountRepository: AccountRepository; let mosaicRepository: MosaicRepository; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { diff --git a/e2e/service/TransactionService.spec.ts b/e2e/service/TransactionService.spec.ts index 5dfb643743..e183f27fe9 100644 --- a/e2e/service/TransactionService.spec.ts +++ b/e2e/service/TransactionService.spec.ts @@ -41,10 +41,10 @@ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; import { TransactionService } from '../../src/service/TransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('TransactionService', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let generationHash: string; let addressAlias: NamespaceId; let mosaicAlias: NamespaceId; @@ -96,7 +96,7 @@ describe('TransactionService', () => { namespaceName, UInt64.fromUint(20), networkType, - helper.maxFee + helper.maxFee, ); addressAlias = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -113,7 +113,7 @@ describe('TransactionService', () => { Deadline.create(), namespaceName, UInt64.fromUint(50), - networkType, helper.maxFee + networkType, helper.maxFee, ); mosaicAlias = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -124,14 +124,13 @@ describe('TransactionService', () => { describe('Setup test AddressAlias', () => { - it('Announce addressAliasTransaction', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), AliasAction.Link, addressAlias, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -152,7 +151,7 @@ describe('TransactionService', () => { MosaicFlags.create(true, true, false), 3, UInt64.fromUint(50), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -169,7 +168,7 @@ describe('TransactionService', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(200000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -185,7 +184,7 @@ describe('TransactionService', () => { AliasAction.Link, mosaicAlias, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -203,7 +202,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -236,7 +235,6 @@ describe('TransactionService', () => { describe('Transfer mosaic to account 3', () => { - it('Announce TransferTransaction', () => { const transferTransaction = TransferTransaction.create( Deadline.create(), @@ -245,7 +243,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(200)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -255,7 +253,6 @@ describe('TransactionService', () => { describe('Create multiple transfers with alias', () => { - it('Announce TransferTransaction', (done) => { const transactions: SignedTransaction[] = []; // 1. Transfer A -> B @@ -266,7 +263,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); transactions.push(transaction1.signWith(account, generationHash)); @@ -278,7 +275,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); transactions.push(transaction2.signWith(account3, generationHash)); @@ -360,7 +357,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); // Unlink MosaicAlias const mosaicAliasTransactionUnlink = MosaicAliasTransaction.create( @@ -368,7 +365,7 @@ describe('TransactionService', () => { AliasAction.Unlink, mosaicAlias, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); // Create a new Mosaic @@ -381,7 +378,7 @@ describe('TransactionService', () => { MosaicFlags.create(true, true, false), 3, UInt64.fromUint(0), - networkType, helper.maxFee + networkType, helper.maxFee, ); // Link namespace with new MosaicId @@ -390,7 +387,7 @@ describe('TransactionService', () => { AliasAction.Link, mosaicAlias, newMosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); // Use new mosaicAlias in metadata @@ -401,7 +398,7 @@ describe('TransactionService', () => { mosaicAlias, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); return AggregateTransaction.createComplete(Deadline.create(), [ @@ -413,7 +410,7 @@ describe('TransactionService', () => { ], networkType, - [], helper.maxFee + [], helper.maxFee, ); } diff --git a/e2e/service/TransactionService_AggregateBonded.spec.ts b/e2e/service/TransactionService_AggregateBonded.spec.ts index d347b5e860..d85b5fa368 100644 --- a/e2e/service/TransactionService_AggregateBonded.spec.ts +++ b/e2e/service/TransactionService_AggregateBonded.spec.ts @@ -15,6 +15,7 @@ */ import { expect } from 'chai'; +import { ChronoUnit } from 'js-joda'; import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; @@ -28,17 +29,16 @@ import { AggregateTransaction } from '../../src/model/transaction/AggregateTrans import { Deadline } from '../../src/model/transaction/Deadline'; import { LockFundsTransaction } from '../../src/model/transaction/LockFundsTransaction'; import { MultisigAccountModificationTransaction } from '../../src/model/transaction/MultisigAccountModificationTransaction'; +import { SignedTransaction } from '../../src/model/transaction/SignedTransaction'; import { TransactionType } from '../../src/model/transaction/TransactionType'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; import { TransactionService } from '../../src/service/TransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; -import { SignedTransaction } from "../../src/model/transaction/SignedTransaction"; -import { ChronoUnit } from "js-joda"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('TransactionService', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -62,7 +62,8 @@ describe('TransactionService', () => { generationHash = helper.generationHash; networkType = helper.networkType; namespaceRepository = helper.repositoryFactory.createNamespaceRepository(); - transactionService = new TransactionService(helper.repositoryFactory.createTransactionRepository(), helper.repositoryFactory.createReceiptRepository()); + transactionService = new TransactionService(helper.repositoryFactory.createTransactionRepository(), + helper.repositoryFactory.createReceiptRepository()); }); }); before(() => { @@ -73,21 +74,20 @@ describe('TransactionService', () => { helper.listener.close(); }); - - let createSignedAggregatedBondTransaction = (aggregatedTo: Account, - signer: Account, - recipient: Address): SignedTransaction => { + const createSignedAggregatedBondTransaction = (aggregatedTo: Account, + signer: Account, + recipient: Address): SignedTransaction => { const transferTransaction = TransferTransaction.create( Deadline.create(), recipient, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), [transferTransaction.toAggregate(aggregatedTo.publicAccount)], - networkType, [], helper.maxFee + networkType, [], helper.maxFee, ); return signer.sign(aggregateTransaction, generationHash); }; @@ -119,7 +119,7 @@ describe('TransactionService', () => { cosignAccount3.publicAccount, ], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -148,7 +148,7 @@ describe('TransactionService', () => { NetworkCurrencyMosaic.createAbsolute(1), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionService.announce(signedTransaction, helper.listener).subscribe((tx: TransferTransaction) => { @@ -169,7 +169,7 @@ describe('TransactionService', () => { new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = lockFundsTransaction.signWith(account, generationHash); transactionService @@ -181,7 +181,6 @@ describe('TransactionService', () => { }); }); - describe('should announce aggregate bonded transaction', () => { it('announce', (done) => { @@ -191,7 +190,7 @@ describe('TransactionService', () => { new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = lockFundsTransaction.signWith(account, generationHash); transactionService.announce(signedLockFundsTransaction, helper.listener).subscribe(() => { @@ -220,7 +219,7 @@ describe('TransactionService', () => { [], [cosignAccount1.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const removeCosigner2 = MultisigAccountModificationTransaction.create( Deadline.create(), @@ -230,7 +229,7 @@ describe('TransactionService', () => { [ cosignAccount2.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const removeCosigner3 = MultisigAccountModificationTransaction.create( @@ -241,7 +240,7 @@ describe('TransactionService', () => { [ cosignAccount3.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), diff --git a/package-lock.json b/package-lock.json index 4c4efe546f..851e965bc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -282,10 +282,13 @@ "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "ansi-wrap": { "version": "0.1.0", @@ -542,17 +545,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -774,16 +766,14 @@ } }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "check-error": { @@ -940,9 +930,9 @@ } }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "commondir": { @@ -2605,15 +2595,6 @@ "har-schema": "^2.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", @@ -3082,12 +3063,6 @@ "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, "js-yaml": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", @@ -3741,7 +3716,7 @@ }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "", + "resolved": false, "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, @@ -3779,7 +3754,7 @@ }, "which-module": { "version": "2.0.0", - "resolved": "", + "resolved": false, "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, @@ -4534,17 +4509,17 @@ } }, "rxjs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", - "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", "requires": { "tslib": "^1.9.0" } }, "rxjs-compat": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.2.1.tgz", - "integrity": "sha512-Pst0lkAwVodBbBOIZic9aM1vY9asJ2u8GfKN115+goIH83PAlizJDyvixuxPAuQ1UtkmBuro7+0PqKQ3PSkhEg==" + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.3.tgz", + "integrity": "sha512-BIJX2yovz3TBpjJoAZyls2QYuU6ZiCaZ+U96SmxQpuSP/qDUfiXPKOVLbThBB2WZijNHkdTTJXKRwvv5Y48H7g==" }, "safe-buffer": { "version": "5.1.1", @@ -4922,10 +4897,21 @@ } }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + } + } }, "sver-compat": { "version": "1.5.0", @@ -5233,66 +5219,38 @@ "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==" }, "tslint": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.9.1.tgz", - "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^3.2.0", + "diff": "^4.0.1", "glob": "^7.1.1", - "js-yaml": "^3.7.0", + "js-yaml": "^3.13.1", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.12.1" + "tsutils": "^2.29.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", - "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "dev": true - }, - "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } } } }, "tsutils": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.22.2.tgz", - "integrity": "sha512-u06FUSulCJ+Y8a2ftuqZN6kIGqdP2yJjUPEngXqmdPND4UQfb04igcotH+dw+IFr417yP6muCLE8/5/Qlfnx0w==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -5325,18 +5283,26 @@ "dev": true }, "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", "dev": true }, "typescript-require": { - "version": "0.2.9-1", - "resolved": "https://registry.npmjs.org/typescript-require/-/typescript-require-0.2.9-1.tgz", - "integrity": "sha1-ZiTBr5HXbyVhPQ9cZn0gQ6bs7cQ=", + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/typescript-require/-/typescript-require-0.2.10.tgz", + "integrity": "sha1-jI7iqnXzUwtWC4ScKSfNNpfrpo4=", "dev": true, "requires": { - "typescript": ">= 0.8.2" + "typescript": "^1.5.3" + }, + "dependencies": { + "typescript": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz", + "integrity": "sha1-tHXW4N/wv1DyluXKbvn7tccyDx4=", + "dev": true + } } }, "uglify-js": { diff --git a/package.json b/package.json index e0ed8f638c..e67edd7593 100644 --- a/package.json +++ b/package.json @@ -52,9 +52,9 @@ "secure-random": "^1.1.1", "ts-mockito": "^2.4.0", "ts-node": "^5.0.1", - "tslint": "^5.8.0", - "typescript": "^2.5.3", - "typescript-require": "^0.2.9-1" + "tslint": "^5.20.1", + "typescript": "^2.9.2", + "typescript-require": "^0.2.10" }, "dependencies": { "bluebird": "^3.5.5", @@ -67,15 +67,15 @@ "request": "^2.88.0", "request-promise-native": "^1.0.5", "ripemd160": "^2.0.2", - "rxjs": "^6.2.1", - "rxjs-compat": "^6.2.1", + "rxjs": "^6.5.3", + "rxjs-compat": "^6.5.3", "utf8": "^2.1.2", "ws": "^5.2.0" }, "peerDependencies": { "js-joda": "^1.6.2", "utf8": "^2.1.2", - "rxjs": "^6.2.1" + "rxjs": "^6.5.3" }, "nyc": { "exclude-after-remap": false, diff --git a/src/infrastructure/AccountHttp.ts b/src/infrastructure/AccountHttp.ts index 8ecba07c48..5c9dc737af 100644 --- a/src/infrastructure/AccountHttp.ts +++ b/src/infrastructure/AccountHttp.ts @@ -78,7 +78,6 @@ export class AccountHttp extends Http implements AccountRepository { ); } - /** * This method maps a AccountInfoDTO from rest to the SDK's AccountInfo model object. * @@ -86,7 +85,7 @@ export class AccountHttp extends Http implements AccountRepository { * @param {AccountInfoDTO} dto AccountInfoDTO the dto object from rest. * @returns AccountInfo model */ - private toAccountInfo(dto: AccountInfoDTO):AccountInfo { + private toAccountInfo(dto: AccountInfoDTO): AccountInfo { return new AccountInfo( Address.createFromEncoded(dto.account.address), UInt64.fromNumericString(dto.account.addressHeight), @@ -111,7 +110,6 @@ export class AccountHttp extends Http implements AccountRepository { ); } - /** * Gets an array of confirmed transactions for which an account is signer or receiver. * @param address - * Address can be created rawAddress or publicKey @@ -120,10 +118,11 @@ export class AccountHttp extends Http implements AccountRepository { */ public getAccountTransactions(address: Address, queryParams?: QueryParams): Observable { return observableFrom( - this.accountRoutesApi.getAccountTransactions(address.plain(), + this.accountRoutesApi.getAccountConfirmedTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order, + this.queryParams(queryParams).transactionType)).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -143,7 +142,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountIncomingTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -163,7 +163,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountOutgoingTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -184,7 +185,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountUnconfirmedTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -204,7 +206,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountPartialTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO) as AggregateTransaction; })), diff --git a/src/infrastructure/BlockHttp.ts b/src/infrastructure/BlockHttp.ts index 14bf2f5143..26175a966d 100644 --- a/src/infrastructure/BlockHttp.ts +++ b/src/infrastructure/BlockHttp.ts @@ -28,24 +28,9 @@ import { Http } from './Http'; import { QueryParams } from './QueryParams'; import { CreateTransactionFromDTO, - extractBeneficiary + extractBeneficiary, } from './transaction/CreateTransactionFromDTO'; -/** - * Blocks returned limits: - * N_25: 25 blocks. - * N_50: 50 blocks. - * N_75: 75 blocks. - * N_100: 100 blocks. - */ -export enum LimitType { - N_25 = 25, - N_50 = 50, - N_75 = 75, - N_100 = 100, - -} - /** * Blockchain http repository. * @@ -102,10 +87,10 @@ export class BlockHttp extends Http implements BlockRepository { /** * Gets array of BlockInfo for a block height with limit * @param height - Block height from which will be the first block in the array - * @param limit - Number of blocks returned. Limit value only available in 25, 50. 75 and 100. (default 25) + * @param limit - Number of blocks returned. * @returns Observable */ - public getBlocksByHeightWithLimit(height: string, limit: LimitType = LimitType.N_25): Observable { + public getBlocksByHeightWithLimit(height: string, limit: number): Observable { return observableFrom( this.blockRoutesApi.getBlocksByHeightWithLimit(height, limit)).pipe( map(({body}) => body.map((blockDTO) => this.toBlockInfo(blockDTO))), @@ -113,7 +98,6 @@ export class BlockHttp extends Http implements BlockRepository { ); } - /** * This method maps a BlockInfoDTO from rest to the SDK's BlockInfo model object. * diff --git a/src/infrastructure/Http.ts b/src/infrastructure/Http.ts index eb44afb07d..861e294d9e 100644 --- a/src/infrastructure/Http.ts +++ b/src/infrastructure/Http.ts @@ -16,10 +16,10 @@ // tslint:disable-next-line: ordered-imports import { from as observableFrom, Observable, of as observableOf, throwError } from 'rxjs'; +import { catchError, map, shareReplay } from 'rxjs/operators'; import { NetworkType } from '../model/blockchain/NetworkType'; +import { NodeRoutesApi } from './api/nodeRoutesApi'; import { QueryParams } from './QueryParams'; -import { NodeRoutesApi } from "./api/nodeRoutesApi"; -import { catchError, map, share, shareReplay } from 'rxjs/operators'; /** * Http extended by all http services @@ -53,6 +53,7 @@ export abstract class Http { pageSize: queryParams ? queryParams.pageSize : undefined, id: queryParams ? queryParams.id : undefined, order: queryParams ? queryParams.order : undefined, + transactionType: queryParams ? queryParams.transactionType : undefined, }; } diff --git a/src/infrastructure/Listener.ts b/src/infrastructure/Listener.ts index 8112a0cc8c..09a368969e 100644 --- a/src/infrastructure/Listener.ts +++ b/src/infrastructure/Listener.ts @@ -23,21 +23,19 @@ import { BlockInfo } from '../model/blockchain/BlockInfo'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; import { AggregateTransactionCosignature } from '../model/transaction/AggregateTransactionCosignature'; -import { CosignatoryModificationAction } from '../model/transaction/CosignatoryModificationAction'; import { CosignatureSignedTransaction } from '../model/transaction/CosignatureSignedTransaction'; import { Deadline } from '../model/transaction/Deadline'; import { InnerTransaction } from '../model/transaction/InnerTransaction'; import { MultisigAccountModificationTransaction } from '../model/transaction/MultisigAccountModificationTransaction'; -import { MultisigCosignatoryModification } from '../model/transaction/MultisigCosignatoryModification'; import { Transaction } from '../model/transaction/Transaction'; import { TransactionStatusError } from '../model/transaction/TransactionStatusError'; import { TransferTransaction } from '../model/transaction/TransferTransaction'; import { UInt64 } from '../model/UInt64'; +import { IListener } from './IListener'; import { CreateTransactionFromDTO, extractBeneficiary, } from './transaction/CreateTransactionFromDTO'; -import { IListener } from "./IListener"; enum ListenerChannelName { block = 'block', @@ -356,18 +354,6 @@ export class Listener implements IListener { this.webSocket.send(JSON.stringify(subscriptionMessage)); } - /** - * @internal - * @param channel - Channel to unsubscribe - */ - private unsubscribeTo(channel: string) { - const unsubscribeMessage = { - uid: this.uid, - unsubscribe: channel, - }; - this.webSocket.send(JSON.stringify(unsubscribeMessage)); - } - /** * @internal * Filters if a transaction has been initiated or signed by an address diff --git a/src/infrastructure/MetadataHttp.ts b/src/infrastructure/MetadataHttp.ts index 3f193db43c..f7f93ad807 100644 --- a/src/infrastructure/MetadataHttp.ts +++ b/src/infrastructure/MetadataHttp.ts @@ -41,20 +41,15 @@ export class MetadataHttp extends Http implements MetadataRepository { * Nem2 Library metadata routes api */ private readonly metadataRoutesApi: MetadataRoutesApi; - /** - * @internal - * network type for the mappings. - */ - private readonly networkTypeObservable: Observable; + /** * Constructor * @param url * @param networkType */ - constructor(url: string, networkType?: NetworkType | Observable) { + constructor(url: string) { super(url); this.metadataRoutesApi = new MetadataRoutesApi(url); - this.networkTypeObservable = this.createNetworkTypeObservable(networkType); } /** diff --git a/src/infrastructure/QueryParams.ts b/src/infrastructure/QueryParams.ts index ee41206d80..fa3fc36b73 100644 --- a/src/infrastructure/QueryParams.ts +++ b/src/infrastructure/QueryParams.ts @@ -1,3 +1,5 @@ +import { TransactionType } from '../model/transaction/TransactionType'; + /* * Copyright 2018 NEM * @@ -49,8 +51,11 @@ export class QueryParams { * ASC. Older to newer. */ public readonly order: Order = Order.DESC, + /** + * Transaction type filter + */ + public readonly transactionType?: TransactionType, ) { this.pageSize = (pageSize >= 10 && pageSize <= 100) ? pageSize : 10; - this.id = id; } } diff --git a/src/infrastructure/RepositoryFactory.ts b/src/infrastructure/RepositoryFactory.ts index f343854697..e57a4fa31e 100644 --- a/src/infrastructure/RepositoryFactory.ts +++ b/src/infrastructure/RepositoryFactory.ts @@ -14,24 +14,23 @@ * limitations under the License. */ -import { Observable } from "rxjs"; -import { NetworkType } from "../model/blockchain/NetworkType"; -import { AccountRepository } from "./AccountRepository"; -import { MultisigRepository } from "./MultisigRepository"; -import { ReceiptRepository } from "./ReceiptRepository"; -import { BlockRepository } from "./BlockRepository"; -import { ChainRepository } from "./ChainRepository"; -import { DiagnosticRepository } from "./DiagnosticRepository"; -import { MosaicRepository } from "./MosaicRepository"; -import { NamespaceRepository } from "./NamespaceRepository"; -import { NetworkRepository } from "./NetworkRepository"; -import { NodeRepository } from "./NodeRepository"; -import { TransactionRepository } from "./TransactionRepository"; -import { MetadataRepository } from "./MetadataRepository"; -import { RestrictionAccountRepository } from "./RestrictionAccountRespository"; -import { RestrictionMosaicRepository } from "./RestrictionMosaicRepository"; -import { Listener } from "./Listener"; -import { IListener } from "./IListener"; +import { Observable } from 'rxjs'; +import { NetworkType } from '../model/blockchain/NetworkType'; +import { AccountRepository } from './AccountRepository'; +import { BlockRepository } from './BlockRepository'; +import { ChainRepository } from './ChainRepository'; +import { DiagnosticRepository } from './DiagnosticRepository'; +import { IListener } from './IListener'; +import { MetadataRepository } from './MetadataRepository'; +import { MosaicRepository } from './MosaicRepository'; +import { MultisigRepository } from './MultisigRepository'; +import { NamespaceRepository } from './NamespaceRepository'; +import { NetworkRepository } from './NetworkRepository'; +import { NodeRepository } from './NodeRepository'; +import { ReceiptRepository } from './ReceiptRepository'; +import { RestrictionAccountRepository } from './RestrictionAccountRespository'; +import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; +import { TransactionRepository } from './TransactionRepository'; /** * A repository factory allows clients to create repositories to access NEM Server without knowing @@ -127,4 +126,4 @@ export interface RepositoryFactory { */ createListener(): IListener; -} \ No newline at end of file +} diff --git a/src/infrastructure/RepositoryFactoryHttp.ts b/src/infrastructure/RepositoryFactoryHttp.ts index 4f68950f2c..f89a41f555 100644 --- a/src/infrastructure/RepositoryFactoryHttp.ts +++ b/src/infrastructure/RepositoryFactoryHttp.ts @@ -14,40 +14,40 @@ * limitations under the License. */ -import { Observable, of as observableOf } from "rxjs"; -import { NetworkType } from "../model/blockchain/NetworkType"; -import { AccountRepository } from "./AccountRepository"; -import { MultisigRepository } from "./MultisigRepository"; -import { ReceiptRepository } from "./ReceiptRepository"; -import { BlockRepository } from "./BlockRepository"; -import { ChainRepository } from "./ChainRepository"; -import { DiagnosticRepository } from "./DiagnosticRepository"; -import { MosaicRepository } from "./MosaicRepository"; -import { NamespaceRepository } from "./NamespaceRepository"; -import { NetworkRepository } from "./NetworkRepository"; -import { NodeRepository } from "./NodeRepository"; -import { TransactionRepository } from "./TransactionRepository"; -import { MetadataRepository } from "./MetadataRepository"; -import { RestrictionAccountRepository } from "./RestrictionAccountRespository"; -import { RestrictionMosaicRepository } from "./RestrictionMosaicRepository"; -import { RepositoryFactory } from "./RepositoryFactory"; -import { AccountHttp } from "./AccountHttp"; -import { BlockHttp } from "./BlockHttp"; -import { ChainHttp } from "./ChainHttp"; -import { DiagnosticHttp } from "./DiagnosticHttp"; -import { MetadataHttp } from "./MetadataHttp"; -import { MosaicHttp } from "./MosaicHttp"; -import { MultisigHttp } from "./MultisigHttp"; -import { NamespaceHttp } from "./NamespaceHttp"; -import { NetworkHttp } from "./NetworkHttp"; -import { NodeHttp } from "./NodeHttp"; -import { ReceiptHttp } from "./ReceiptHttp"; -import { RestrictionAccountHttp } from "./RestrictionAccountHttp"; -import { RestrictionMosaicHttp } from "./RestrictionMosaicHttp"; -import { TransactionHttp } from "./TransactionHttp"; -import { share, map, shareReplay } from "rxjs/operators"; -import { Listener } from "./Listener"; -import { IListener } from "./IListener"; +import { Observable, of as observableOf } from 'rxjs'; +import { map, share, shareReplay } from 'rxjs/operators'; +import { NetworkType } from '../model/blockchain/NetworkType'; +import { AccountHttp } from './AccountHttp'; +import { AccountRepository } from './AccountRepository'; +import { BlockHttp } from './BlockHttp'; +import { BlockRepository } from './BlockRepository'; +import { ChainHttp } from './ChainHttp'; +import { ChainRepository } from './ChainRepository'; +import { DiagnosticHttp } from './DiagnosticHttp'; +import { DiagnosticRepository } from './DiagnosticRepository'; +import { IListener } from './IListener'; +import { Listener } from './Listener'; +import { MetadataHttp } from './MetadataHttp'; +import { MetadataRepository } from './MetadataRepository'; +import { MosaicHttp } from './MosaicHttp'; +import { MosaicRepository } from './MosaicRepository'; +import { MultisigHttp } from './MultisigHttp'; +import { MultisigRepository } from './MultisigRepository'; +import { NamespaceHttp } from './NamespaceHttp'; +import { NamespaceRepository } from './NamespaceRepository'; +import { NetworkHttp } from './NetworkHttp'; +import { NetworkRepository } from './NetworkRepository'; +import { NodeHttp } from './NodeHttp'; +import { NodeRepository } from './NodeRepository'; +import { ReceiptHttp } from './ReceiptHttp'; +import { ReceiptRepository } from './ReceiptRepository'; +import { RepositoryFactory } from './RepositoryFactory'; +import { RestrictionAccountHttp } from './RestrictionAccountHttp'; +import { RestrictionAccountRepository } from './RestrictionAccountRespository'; +import { RestrictionMosaicHttp } from './RestrictionMosaicHttp'; +import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; +import { TransactionHttp } from './TransactionHttp'; +import { TransactionRepository } from './TransactionRepository'; /** * Receipt http repository. @@ -64,10 +64,11 @@ export class RepositoryFactoryHttp implements RepositoryFactory { * @param url the server url. * @param networkType optional network type if you don't want to load it from the server. */ - constructor(url: string, networkType?: NetworkType) { + constructor(url: string, networkType?: NetworkType, generationHash?: string) { this.url = url; this.networkType = networkType ? observableOf(networkType) : this.createNetworkRepository().getNetworkType().pipe(shareReplay(1)); - this.generationHash = this.createBlockRepository().getBlockByHeight('1').pipe(map(b => b.generationHash)).pipe(shareReplay(1)); + this.generationHash = generationHash ? observableOf(generationHash) : + this.createBlockRepository().getBlockByHeight('1').pipe(map((b) => b.generationHash)).pipe(shareReplay(1)); } createAccountRepository(): AccountRepository { @@ -111,7 +112,7 @@ export class RepositoryFactoryHttp implements RepositoryFactory { } createReceiptRepository(): ReceiptRepository { - return new ReceiptHttp(this.url); + return new ReceiptHttp(this.url, this.networkType); } createRestrictionAccountRepository(): RestrictionAccountRepository { @@ -137,5 +138,4 @@ export class RepositoryFactoryHttp implements RepositoryFactory { createListener(): IListener { return new Listener(this.url); } - -} \ No newline at end of file +} diff --git a/src/infrastructure/RestrictionMosaicHttp.ts b/src/infrastructure/RestrictionMosaicHttp.ts index 36c59ab8e2..d455f87aed 100644 --- a/src/infrastructure/RestrictionMosaicHttp.ts +++ b/src/infrastructure/RestrictionMosaicHttp.ts @@ -24,9 +24,9 @@ import { MosaicGlobalRestriction } from '../model/restriction/MosaicGlobalRestri import { MosaicGlobalRestrictionItem } from '../model/restriction/MosaicGlobalRestrictionItem'; import { RestrictionMosaicRoutesApi } from './api/restrictionMosaicRoutesApi'; import {Http} from './Http'; +import { MosaicAddressRestrictionDTO } from './model/mosaicAddressRestrictionDTO'; +import { MosaicGlobalRestrictionDTO } from './model/mosaicGlobalRestrictionDTO'; import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; -import { MosaicAddressRestrictionDTO } from "./model/mosaicAddressRestrictionDTO"; -import { MosaicGlobalRestrictionDTO } from "./model/mosaicGlobalRestrictionDTO"; /** * RestrictionMosaic http repository. diff --git a/src/infrastructure/TransactionHttp.ts b/src/infrastructure/TransactionHttp.ts index 611e66e389..b72b468fa0 100644 --- a/src/infrastructure/TransactionHttp.ts +++ b/src/infrastructure/TransactionHttp.ts @@ -32,7 +32,7 @@ import {TransactionType} from '../model/transaction/TransactionType'; import {UInt64} from '../model/UInt64'; import { BlockInfoDTO, BlockRoutesApi, - TransactionRoutesApi, TransactionStatusDTO + TransactionRoutesApi, TransactionStatusDTO, } from './api'; import {Http} from './Http'; import {CreateTransactionFromDTO} from './transaction/CreateTransactionFromDTO'; @@ -56,23 +56,15 @@ export class TransactionHttp extends Http implements TransactionRepository { */ private blockRoutesApi: BlockRoutesApi; - - /** - * @internal - * network type for the mappings. - */ - private readonly networkTypeObservable: Observable; - /** * Constructor * @param url * @param networkType */ - constructor(url: string, networkType?: NetworkType | Observable) { + constructor(url: string) { super(url); this.transactionRoutesApi = new TransactionRoutesApi(url); this.blockRoutesApi = new BlockRoutesApi(url); - this.networkTypeObservable = this.createNetworkTypeObservable(networkType); } /** @@ -142,11 +134,10 @@ export class TransactionHttp extends Http implements TransactionRepository { */ private toTransactionStatus(dto: TransactionStatusDTO): TransactionStatus { return new TransactionStatus( - dto.status, - dto.group, + dto.group.valueOf(), dto.hash, - dto.deadline ? - Deadline.createFromDTO(UInt64.fromNumericString(dto.deadline).toDTO()) : undefined, + Deadline.createFromDTO(UInt64.fromNumericString(dto.deadline).toDTO()), + dto.code ? dto.code.valueOf() : '', dto.height ? UInt64.fromNumericString(dto.height) : undefined); } @@ -207,9 +198,9 @@ export class TransactionHttp extends Http implements TransactionRepository { if (response.status !== undefined) { throw new TransactionStatus( 'failed', - response.status, response.hash, Deadline.createFromDTO(response.deadline), + response.code, UInt64.fromUint(0)); } else { return CreateTransactionFromDTO(response); diff --git a/src/infrastructure/api.ts b/src/infrastructure/api.ts index 95e4f0d5b9..b74074dfee 100644 --- a/src/infrastructure/api.ts +++ b/src/infrastructure/api.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/accountRoutesApi.ts b/src/infrastructure/api/accountRoutesApi.ts index 6030accaf0..0bac8e4bfe 100644 --- a/src/infrastructure/api/accountRoutesApi.ts +++ b/src/infrastructure/api/accountRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,6 +33,7 @@ import { AccountIds } from '../model/accountIds'; import { AccountInfoDTO } from '../model/accountInfoDTO'; import { ModelError } from '../model/modelError'; import { TransactionInfoDTO } from '../model/transactionInfoDTO'; +import { TransactionTypeEnum } from '../model/transactionTypeEnum'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; @@ -88,15 +89,16 @@ export class AccountRoutesApi { } /** - * Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. - * @summary Get incoming transactions + * Gets an array of transactions for which an account is the sender or receiver. + * @summary Get confirmed transactions * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountIncomingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/incoming' + public async getAccountConfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -104,7 +106,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountIncomingTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountConfirmedTransactions.'); } if (pageSize !== undefined) { @@ -119,6 +121,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -162,12 +168,16 @@ export class AccountRoutesApi { }); } /** - * Returns the account information. - * @summary Get account information + * Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. + * @summary Get incoming transactions * @param accountId Account public key or address. + * @param pageSize Number of transactions to return for each request. + * @param id Transaction identifier up to which transactions are returned. + * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountInfo (accountId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }> { - const localVarPath = this.basePath + '/account/{accountId}' + public async getAccountIncomingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/incoming' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -175,7 +185,23 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountInfo.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountIncomingTransactions.'); + } + + if (pageSize !== undefined) { + localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number"); + } + + if (id !== undefined) { + localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); + } + + if (ordering !== undefined) { + localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); + } + + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); } (Object).assign(localVarHeaderParams, options.headers); @@ -201,12 +227,12 @@ export class AccountRoutesApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }>((resolve, reject) => { + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, "AccountInfoDTO"); + body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -221,15 +247,12 @@ export class AccountRoutesApi { }); } /** - * Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. - * @summary Get outgoing transactions + * Returns the account information. + * @summary Get account information * @param accountId Account public key or address. - * @param pageSize Number of transactions to return for each request. - * @param id Transaction identifier up to which transactions are returned. - * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. */ - public async getAccountOutgoingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/outgoing' + public async getAccountInfo (accountId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }> { + const localVarPath = this.basePath + '/account/{accountId}' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -237,19 +260,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountOutgoingTransactions.'); - } - - if (pageSize !== undefined) { - localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number"); - } - - if (id !== undefined) { - localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); - } - - if (ordering !== undefined) { - localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); + throw new Error('Required parameter accountId was null or undefined when calling getAccountInfo.'); } (Object).assign(localVarHeaderParams, options.headers); @@ -275,12 +286,12 @@ export class AccountRoutesApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + return new Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, "Array"); + body = ObjectSerializer.deserialize(body, "AccountInfoDTO"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -295,15 +306,16 @@ export class AccountRoutesApi { }); } /** - * Gets an array of aggregate bonded transactions where the account is the sender or requires to cosign the transaction. - * @summary Get aggregate bonded transactions information + * Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. + * @summary Get outgoing transactions * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountPartialTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/partial' + public async getAccountOutgoingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/outgoing' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -311,7 +323,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountPartialTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountOutgoingTransactions.'); } if (pageSize !== undefined) { @@ -326,6 +338,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -369,15 +385,16 @@ export class AccountRoutesApi { }); } /** - * Gets an array of transactions for which an account is the sender or receiver. - * @summary Get confirmed transactions + * Gets an array of aggregate bonded transactions where the account is the sender or requires to cosign the transaction. + * @summary Get aggregate bonded transactions information * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions' + public async getAccountPartialTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/partial' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -385,7 +402,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountPartialTransactions.'); } if (pageSize !== undefined) { @@ -400,6 +417,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -449,8 +470,9 @@ export class AccountRoutesApi { * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountUnconfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + public async getAccountUnconfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/account/{accountId}/transactions/unconfirmed' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; @@ -474,6 +496,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; diff --git a/src/infrastructure/api/apis.ts b/src/infrastructure/api/apis.ts index b219325aa8..fdad3f87cc 100644 --- a/src/infrastructure/api/apis.ts +++ b/src/infrastructure/api/apis.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/blockRoutesApi.ts b/src/infrastructure/api/blockRoutesApi.ts index 0cce81b26b..dc639177aa 100644 --- a/src/infrastructure/api/blockRoutesApi.ts +++ b/src/infrastructure/api/blockRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -90,7 +90,7 @@ export class BlockRoutesApi { /** * Gets a block from the chain that has the given height. * @summary Get block information - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. */ public async getBlockByHeight (height: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: BlockInfoDTO; }> { const localVarPath = this.basePath + '/block/{height}' @@ -149,7 +149,7 @@ export class BlockRoutesApi { /** * Returns an array of transactions included in a block for a given block height. * @summary Get transactions from a block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. @@ -223,10 +223,10 @@ export class BlockRoutesApi { /** * Gets up to limit number of blocks after given block height. * @summary Get blocks information - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. - * @param limit Number of elements to be returned. + * @param height Block height. + * @param limit Number of elements to be returned. The limit should be greater than or equal to \"db.pageSizeMin\" and not higher than \"db.pageSizeMax\". The settings are adjustable via a configuration file (rest/resources/rest.json) per REST instance. */ - public async getBlocksByHeightWithLimit (height: string, limit: 25 | 50 | 75 | 100, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + public async getBlocksByHeightWithLimit (height: string, limit: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/blocks/{height}/limit/{limit}' .replace('{' + 'height' + '}', encodeURIComponent(String(height))) .replace('{' + 'limit' + '}', encodeURIComponent(String(limit))); @@ -289,7 +289,7 @@ export class BlockRoutesApi { /** * Returns the merkle path for a transaction included in a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the transaction was included in the block. * @summary Get the merkle path for a given a transaction and block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param hash Transaction hash. */ public async getMerkleTransaction (height: string, hash: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: MerkleProofInfoDTO; }> { diff --git a/src/infrastructure/api/chainRoutesApi.ts b/src/infrastructure/api/chainRoutesApi.ts index 1f3c749bba..bf74f453cf 100644 --- a/src/infrastructure/api/chainRoutesApi.ts +++ b/src/infrastructure/api/chainRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/diagnosticRoutesApi.ts b/src/infrastructure/api/diagnosticRoutesApi.ts index b71abfb7c8..1267df8666 100644 --- a/src/infrastructure/api/diagnosticRoutesApi.ts +++ b/src/infrastructure/api/diagnosticRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/metadataRoutesApi.ts b/src/infrastructure/api/metadataRoutesApi.ts index dc303735b7..54a307f38f 100644 --- a/src/infrastructure/api/metadataRoutesApi.ts +++ b/src/infrastructure/api/metadataRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/mosaicRoutesApi.ts b/src/infrastructure/api/mosaicRoutesApi.ts index 7e46da3b3a..8d6566b60f 100644 --- a/src/infrastructure/api/mosaicRoutesApi.ts +++ b/src/infrastructure/api/mosaicRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/multisigRoutesApi.ts b/src/infrastructure/api/multisigRoutesApi.ts index 77b36b550c..8c58cfe12c 100644 --- a/src/infrastructure/api/multisigRoutesApi.ts +++ b/src/infrastructure/api/multisigRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/namespaceRoutesApi.ts b/src/infrastructure/api/namespaceRoutesApi.ts index 5c112f7074..43f2fed06d 100644 --- a/src/infrastructure/api/namespaceRoutesApi.ts +++ b/src/infrastructure/api/namespaceRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/networkRoutesApi.ts b/src/infrastructure/api/networkRoutesApi.ts index 9c2fa6fd8b..aef29a0a6c 100644 --- a/src/infrastructure/api/networkRoutesApi.ts +++ b/src/infrastructure/api/networkRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/nodeRoutesApi.ts b/src/infrastructure/api/nodeRoutesApi.ts index 67d86791ee..1bc892a4d4 100644 --- a/src/infrastructure/api/nodeRoutesApi.ts +++ b/src/infrastructure/api/nodeRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/receiptRoutesApi.ts b/src/infrastructure/api/receiptRoutesApi.ts index 49338943b6..f72ceb8844 100644 --- a/src/infrastructure/api/receiptRoutesApi.ts +++ b/src/infrastructure/api/receiptRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -89,7 +89,7 @@ export class ReceiptRoutesApi { /** * Returns the receipts linked to a block. * @summary Get receipts from a block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. */ public async getBlockReceipts (height: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: StatementsDTO; }> { const localVarPath = this.basePath + '/block/{height}/receipts' @@ -148,7 +148,7 @@ export class ReceiptRoutesApi { /** * Returns the merkle path for a receipt statement or resolution linked to a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the receipt was linked with the block. * @summary Get the merkle path for a given a receipt statement hash and block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param hash Receipt hash. */ public async getMerkleReceipts (height: string, hash: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: MerkleProofInfoDTO; }> { diff --git a/src/infrastructure/api/restrictionAccountRoutesApi.ts b/src/infrastructure/api/restrictionAccountRoutesApi.ts index 57656b2c35..755faccfc1 100644 --- a/src/infrastructure/api/restrictionAccountRoutesApi.ts +++ b/src/infrastructure/api/restrictionAccountRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/restrictionMosaicRoutesApi.ts b/src/infrastructure/api/restrictionMosaicRoutesApi.ts index ad6f09dc02..42294d4eed 100644 --- a/src/infrastructure/api/restrictionMosaicRoutesApi.ts +++ b/src/infrastructure/api/restrictionMosaicRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/transactionRoutesApi.ts b/src/infrastructure/api/transactionRoutesApi.ts index 9375a20c7a..f5065be845 100644 --- a/src/infrastructure/api/transactionRoutesApi.ts +++ b/src/infrastructure/api/transactionRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts index fcafef8bc4..1d19b7fe88 100644 --- a/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts index f3285d711b..98136bc9c5 100644 --- a/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountDTO.ts b/src/infrastructure/model/accountDTO.ts index 0fb7c46261..f15d4e876c 100644 --- a/src/infrastructure/model/accountDTO.ts +++ b/src/infrastructure/model/accountDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountIds.ts b/src/infrastructure/model/accountIds.ts index 9680d11689..0e89bca6a5 100644 --- a/src/infrastructure/model/accountIds.ts +++ b/src/infrastructure/model/accountIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountInfoDTO.ts b/src/infrastructure/model/accountInfoDTO.ts index cba670bbc2..9215220687 100644 --- a/src/infrastructure/model/accountInfoDTO.ts +++ b/src/infrastructure/model/accountInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountLinkActionEnum.ts b/src/infrastructure/model/accountLinkActionEnum.ts index ebfc4ac3fb..bc5c18ea41 100644 --- a/src/infrastructure/model/accountLinkActionEnum.ts +++ b/src/infrastructure/model/accountLinkActionEnum.ts @@ -17,19 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of action: * 0 - Unlink. * 1 - Link. -*/ + * Type of action: * 0 - Unlink. * 1 - Link. + */ export enum AccountLinkActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/accountLinkTransactionBodyDTO.ts b/src/infrastructure/model/accountLinkTransactionBodyDTO.ts index cf46f3cd32..c67ed1d29e 100644 --- a/src/infrastructure/model/accountLinkTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountLinkTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountLinkTransactionDTO.ts b/src/infrastructure/model/accountLinkTransactionDTO.ts index c254544001..94be101e30 100644 --- a/src/infrastructure/model/accountLinkTransactionDTO.ts +++ b/src/infrastructure/model/accountLinkTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts b/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts index e63034f10b..a77d63d3fd 100644 --- a/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMetadataTransactionDTO.ts b/src/infrastructure/model/accountMetadataTransactionDTO.ts index 00506fbb19..ca2f474e86 100644 --- a/src/infrastructure/model/accountMetadataTransactionDTO.ts +++ b/src/infrastructure/model/accountMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts index 2f9d5b67f0..047419cf04 100644 --- a/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts b/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts index 1ea90730e1..49982796e3 100644 --- a/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountNamesDTO.ts b/src/infrastructure/model/accountNamesDTO.ts index c36c6cdf76..a538bd2c96 100644 --- a/src/infrastructure/model/accountNamesDTO.ts +++ b/src/infrastructure/model/accountNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts index e49771bdbb..4fd1fa22a1 100644 --- a/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts b/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts index f4afb105e8..82d28aa17e 100644 --- a/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionDTO.ts b/src/infrastructure/model/accountRestrictionDTO.ts index c52fe7a7ee..d7f47c4a62 100644 --- a/src/infrastructure/model/accountRestrictionDTO.ts +++ b/src/infrastructure/model/accountRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionFlagsEnum.ts b/src/infrastructure/model/accountRestrictionFlagsEnum.ts index 4b2746e02f..76813ed067 100644 --- a/src/infrastructure/model/accountRestrictionFlagsEnum.ts +++ b/src/infrastructure/model/accountRestrictionFlagsEnum.ts @@ -17,25 +17,32 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of account restriction: * 0x0001 (1 decimal) - Allow only incoming transactions from a given address. * 0x0002 (2 decimal) - Allow only incoming transactions containing a given mosaic identifier. * 0x4001 (16385 decimal) - Allow only outgoing transactions to a given address. * 0x4004 (16388 decimal) - Allow only outgoing transactions with a given transaction type. * 0x8001 (32769 decimal) - Block incoming transactions from a given address. * 0x8002 (32770 decimal) - Block incoming transactions containing a given mosaic identifier. * 0xC001 (49153 decimal) - Block outgoing transactions to a given address. * 0xC004 (49156 decimal) - Block outgoing transactions with a given transaction type. -*/ + * Type of account restriction: + * 0x0001 (1 decimal) - Allow only incoming transactions from a given address. + * 0x0002 (2 decimal) - Allow only incoming transactions containing a given mosaic identifier. + * 0x4001 (16385 decimal) - Allow only outgoing transactions to a given address. + * 0x4004 (16388 decimal) - Allow only outgoing transactions with a given transaction type. + * 0x8001 (32769 decimal) - Block incoming transactions from a given address. + * 0x8002 (32770 decimal) - Block incoming transactions containing a given mosaic identifier. + * 0xC001 (49153 decimal) - Block outgoing transactions to a given address. + * 0xC004 (49156 decimal) - Block outgoing transactions with a given transaction type. + */ export enum AccountRestrictionFlagsEnum { - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_16385 = 16385, - NUMBER_16388 = 16388, - NUMBER_32769 = 32769, - NUMBER_32770 = 32770, - NUMBER_49153 = 49153, - NUMBER_49156 = 49156 + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_16385 = 16385, + NUMBER_16388 = 16388, + NUMBER_32769 = 32769, + NUMBER_32770 = 32770, + NUMBER_49153 = 49153, + NUMBER_49156 = 49156, } diff --git a/src/infrastructure/model/accountRestrictionsDTO.ts b/src/infrastructure/model/accountRestrictionsDTO.ts index 208a11c535..505fef3f9f 100644 --- a/src/infrastructure/model/accountRestrictionsDTO.ts +++ b/src/infrastructure/model/accountRestrictionsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionsInfoDTO.ts b/src/infrastructure/model/accountRestrictionsInfoDTO.ts index 07e957d9a0..ec41841645 100644 --- a/src/infrastructure/model/accountRestrictionsInfoDTO.ts +++ b/src/infrastructure/model/accountRestrictionsInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountTypeEnum.ts b/src/infrastructure/model/accountTypeEnum.ts index 94ebbb1ce5..3fb939d8ff 100644 --- a/src/infrastructure/model/accountTypeEnum.ts +++ b/src/infrastructure/model/accountTypeEnum.ts @@ -17,21 +17,23 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* * 0 - Unlinked. * 1 - Balance-holding account that is linked to a remote harvester account. * 2 - Remote harvester account that is linked to a balance-holding account. * 3 - Remote harvester eligible account that is unlinked. -*/ + * 0 - Unlinked. + * 1 - Balance-holding account that is linked to a remote harvester account. + * 2 - Remote harvester account that is linked to a balance-holding account. + * 3 - Remote harvester eligible account that is unlinked. + */ export enum AccountTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, } diff --git a/src/infrastructure/model/accountsNamesDTO.ts b/src/infrastructure/model/accountsNamesDTO.ts index 1b6ef91181..2572bceab4 100644 --- a/src/infrastructure/model/accountsNamesDTO.ts +++ b/src/infrastructure/model/accountsNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/activityBucketDTO.ts b/src/infrastructure/model/activityBucketDTO.ts index 451da2d066..e41035a61c 100644 --- a/src/infrastructure/model/activityBucketDTO.ts +++ b/src/infrastructure/model/activityBucketDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/addressAliasTransactionBodyDTO.ts b/src/infrastructure/model/addressAliasTransactionBodyDTO.ts index 1b84a678cc..77a11f1e5e 100644 --- a/src/infrastructure/model/addressAliasTransactionBodyDTO.ts +++ b/src/infrastructure/model/addressAliasTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/addressAliasTransactionDTO.ts b/src/infrastructure/model/addressAliasTransactionDTO.ts index a574c941a5..efc8ba40b8 100644 --- a/src/infrastructure/model/addressAliasTransactionDTO.ts +++ b/src/infrastructure/model/addressAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aggregateTransactionBodyDTO.ts b/src/infrastructure/model/aggregateTransactionBodyDTO.ts index c40ae75439..ff8c5d27c3 100644 --- a/src/infrastructure/model/aggregateTransactionBodyDTO.ts +++ b/src/infrastructure/model/aggregateTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aggregateTransactionDTO.ts b/src/infrastructure/model/aggregateTransactionDTO.ts index b84ab10fe9..7841b14320 100644 --- a/src/infrastructure/model/aggregateTransactionDTO.ts +++ b/src/infrastructure/model/aggregateTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aliasActionEnum.ts b/src/infrastructure/model/aliasActionEnum.ts index d90ad550ef..23b09f0206 100644 --- a/src/infrastructure/model/aliasActionEnum.ts +++ b/src/infrastructure/model/aliasActionEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Alias action: * 0 - Unlink alias. * 1 - Link alias. -*/ + * Alias action: * 0 - Unlink alias. * 1 - Link alias. + */ export enum AliasActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/aliasDTO.ts b/src/infrastructure/model/aliasDTO.ts index 70ded6bdd8..c97666d056 100644 --- a/src/infrastructure/model/aliasDTO.ts +++ b/src/infrastructure/model/aliasDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aliasTypeEnum.ts b/src/infrastructure/model/aliasTypeEnum.ts index 173ef1af5f..55527784ca 100644 --- a/src/infrastructure/model/aliasTypeEnum.ts +++ b/src/infrastructure/model/aliasTypeEnum.ts @@ -17,20 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of alias: * 0 - No alias. * 1 - Mosaic id alias. * 2 - Addres alias. -*/ + * Type of alias: * 0 - No alias. * 1 - Mosaic id alias. * 2 - Addres alias. + */ export enum AliasTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/announceTransactionInfoDTO.ts b/src/infrastructure/model/announceTransactionInfoDTO.ts index 32b4c7937b..125acb4b05 100644 --- a/src/infrastructure/model/announceTransactionInfoDTO.ts +++ b/src/infrastructure/model/announceTransactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/artifactExpiryReceiptDTO.ts b/src/infrastructure/model/artifactExpiryReceiptDTO.ts deleted file mode 100644 index ed9a4fd5b0..0000000000 --- a/src/infrastructure/model/artifactExpiryReceiptDTO.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2019 NEM - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Catapult REST Endpoints - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.7.19 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ReceiptDTO } from './receiptDTO'; -import { ReceiptTypeEnum } from './receiptTypeEnum'; - -/** -* An artifact namespace or mosaic expired. -*/ -export class ArtifactExpiryReceiptDTO { - /** - * Version of the receipt. - */ - 'version': number; - 'type': ReceiptTypeEnum; - 'artifactId': any; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "version", - "baseName": "version", - "type": "number" - }, - { - "name": "type", - "baseName": "type", - "type": "ReceiptTypeEnum" - }, - { - "name": "artifactId", - "baseName": "artifactId", - "type": "any" - } ]; - - static getAttributeTypeMap() { - return ArtifactExpiryReceiptDTO.attributeTypeMap; - } -} - diff --git a/src/infrastructure/model/balanceChangeReceiptDTO.ts b/src/infrastructure/model/balanceChangeReceiptDTO.ts index 135b48cea3..52f48100b3 100644 --- a/src/infrastructure/model/balanceChangeReceiptDTO.ts +++ b/src/infrastructure/model/balanceChangeReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts b/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts index 5b88af9977..97c09d4a09 100644 --- a/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts +++ b/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceTransferReceiptDTO.ts b/src/infrastructure/model/balanceTransferReceiptDTO.ts index 213ba3d7ff..30fdecc5f1 100644 --- a/src/infrastructure/model/balanceTransferReceiptDTO.ts +++ b/src/infrastructure/model/balanceTransferReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts b/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts index 1678cbd309..0dfa371aab 100644 --- a/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts +++ b/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockDTO.ts b/src/infrastructure/model/blockDTO.ts index c115b1f73c..c36b9c4669 100644 --- a/src/infrastructure/model/blockDTO.ts +++ b/src/infrastructure/model/blockDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockDTOAllOf.ts b/src/infrastructure/model/blockDTOAllOf.ts index 259f240a76..7d3e4edac6 100644 --- a/src/infrastructure/model/blockDTOAllOf.ts +++ b/src/infrastructure/model/blockDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockInfoDTO.ts b/src/infrastructure/model/blockInfoDTO.ts index 6cf0f67fb6..892e229dad 100644 --- a/src/infrastructure/model/blockInfoDTO.ts +++ b/src/infrastructure/model/blockInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockMetaDTO.ts b/src/infrastructure/model/blockMetaDTO.ts index 43fd5364a5..415c1f9be9 100644 --- a/src/infrastructure/model/blockMetaDTO.ts +++ b/src/infrastructure/model/blockMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/chainScoreDTO.ts b/src/infrastructure/model/chainScoreDTO.ts index 6272f5251b..fd7d1e249f 100644 --- a/src/infrastructure/model/chainScoreDTO.ts +++ b/src/infrastructure/model/chainScoreDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/communicationTimestampsDTO.ts b/src/infrastructure/model/communicationTimestampsDTO.ts index ae0b5302c7..205c4793e7 100644 --- a/src/infrastructure/model/communicationTimestampsDTO.ts +++ b/src/infrastructure/model/communicationTimestampsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignature.ts b/src/infrastructure/model/cosignature.ts index 2e84137071..608031e70f 100644 --- a/src/infrastructure/model/cosignature.ts +++ b/src/infrastructure/model/cosignature.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignatureDTO.ts b/src/infrastructure/model/cosignatureDTO.ts index 1c15f6e43f..650d0ff7ef 100644 --- a/src/infrastructure/model/cosignatureDTO.ts +++ b/src/infrastructure/model/cosignatureDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignatureDTOAllOf.ts b/src/infrastructure/model/cosignatureDTOAllOf.ts index 0333c1144d..b7fe3a2318 100644 --- a/src/infrastructure/model/cosignatureDTOAllOf.ts +++ b/src/infrastructure/model/cosignatureDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts index dddd5619e8..cd969cb1e3 100644 --- a/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts b/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts index 84afb3916a..a25b7e625d 100644 --- a/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts index 49c7be06e9..cb2cc4eaf2 100644 --- a/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts index 2d698aa879..3ff8950e2b 100644 --- a/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts index f04016f1d9..a813ed4a5b 100644 --- a/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts b/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts index dd6c82be9b..e03011afab 100644 --- a/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedHashLockTransactionDTO.ts b/src/infrastructure/model/embeddedHashLockTransactionDTO.ts index b3a807632d..d6ae1aa02f 100644 --- a/src/infrastructure/model/embeddedHashLockTransactionDTO.ts +++ b/src/infrastructure/model/embeddedHashLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts index 515a9f2f74..f48fc94f2c 100644 --- a/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts index 387ad18e77..c7d3cddc07 100644 --- a/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts index 81a024e269..840168d0e9 100644 --- a/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts index 2f5168ba85..8c25f184e4 100644 --- a/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts index 995bb04bb5..bd007e71c5 100644 --- a/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts index 7dbe3aec59..efa17f1b92 100644 --- a/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts b/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts index d6684d7c0e..adc94975e7 100644 --- a/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts index a23ff2a12b..611e2093ba 100644 --- a/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts b/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts index 54dc9f2e58..dd2ca4c10e 100644 --- a/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts +++ b/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts b/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts index a3a77113e3..6aaa6120fc 100644 --- a/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts +++ b/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts b/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts index 7038ffeb1e..3ab27abda2 100644 --- a/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts +++ b/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionDTO.ts b/src/infrastructure/model/embeddedTransactionDTO.ts index 26ece2f6bb..b992dd9c91 100644 --- a/src/infrastructure/model/embeddedTransactionDTO.ts +++ b/src/infrastructure/model/embeddedTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionInfoDTO.ts b/src/infrastructure/model/embeddedTransactionInfoDTO.ts index 6c6a0206ce..dc1a0ea7da 100644 --- a/src/infrastructure/model/embeddedTransactionInfoDTO.ts +++ b/src/infrastructure/model/embeddedTransactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionMetaDTO.ts b/src/infrastructure/model/embeddedTransactionMetaDTO.ts index 9f672ba5ae..c0815291b9 100644 --- a/src/infrastructure/model/embeddedTransactionMetaDTO.ts +++ b/src/infrastructure/model/embeddedTransactionMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransferTransactionDTO.ts b/src/infrastructure/model/embeddedTransferTransactionDTO.ts index d9b649facd..a669a34ced 100644 --- a/src/infrastructure/model/embeddedTransferTransactionDTO.ts +++ b/src/infrastructure/model/embeddedTransferTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/entityDTO.ts b/src/infrastructure/model/entityDTO.ts index 8cefca1574..07083301a7 100644 --- a/src/infrastructure/model/entityDTO.ts +++ b/src/infrastructure/model/entityDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/hashLockTransactionBodyDTO.ts b/src/infrastructure/model/hashLockTransactionBodyDTO.ts index 126231f5bb..a3d01e9b93 100644 --- a/src/infrastructure/model/hashLockTransactionBodyDTO.ts +++ b/src/infrastructure/model/hashLockTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/hashLockTransactionDTO.ts b/src/infrastructure/model/hashLockTransactionDTO.ts index 00ddb00a54..780e07bf71 100644 --- a/src/infrastructure/model/hashLockTransactionDTO.ts +++ b/src/infrastructure/model/hashLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/heightInfoDTO.ts b/src/infrastructure/model/heightInfoDTO.ts index ebe421025c..6ff5e02393 100644 --- a/src/infrastructure/model/heightInfoDTO.ts +++ b/src/infrastructure/model/heightInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/inflationReceiptDTO.ts b/src/infrastructure/model/inflationReceiptDTO.ts index d5501e5018..99bb825331 100644 --- a/src/infrastructure/model/inflationReceiptDTO.ts +++ b/src/infrastructure/model/inflationReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/inflationReceiptDTOAllOf.ts b/src/infrastructure/model/inflationReceiptDTOAllOf.ts index 264071b89f..c0e0708fd9 100644 --- a/src/infrastructure/model/inflationReceiptDTOAllOf.ts +++ b/src/infrastructure/model/inflationReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/lockHashAlgorithmEnum.ts b/src/infrastructure/model/lockHashAlgorithmEnum.ts index 799a937d0f..af8578e3c6 100644 --- a/src/infrastructure/model/lockHashAlgorithmEnum.ts +++ b/src/infrastructure/model/lockHashAlgorithmEnum.ts @@ -17,21 +17,23 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Algorithm used to hash te proof: * 0 (Op_Sha3_256) - Proof is hashed using sha3 256. * 1 (Op_Keccak_256) - Proof is hashed using Keccak (ETH compatibility). * 2 (Op_Hash_160) - Proof is hashed twice: first with Sha-256 and then with RIPEMD-160 (bitcoin’s OP_HASH160). * 3 (Op_Hash_256) - Proof is hashed twice with Sha-256 (bitcoin’s OP_HASH256). -*/ + * Algorithm used to hash te proof: * 0 (Op_Sha3_256) - Proof is hashed using SHA3-256. + * 1 (Op_Keccak_256) - Proof is hashed using Keccak (ETH compatibility). + * 2 (Op_Hash_160) - Proof is hashed twice: first with SHA-256 and then with RIPEMD-160 (bitcoin\'s OP_HASH160). + * 3 (Op_Hash_256) - Proof is hashed twice with SHA3-256 (bitcoin\'s OP_HASH256). + */ export enum LockHashAlgorithmEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, } diff --git a/src/infrastructure/model/merklePathItemDTO.ts b/src/infrastructure/model/merklePathItemDTO.ts index 0a4613da50..43c3a6b4e6 100644 --- a/src/infrastructure/model/merklePathItemDTO.ts +++ b/src/infrastructure/model/merklePathItemDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/merkleProofInfoDTO.ts b/src/infrastructure/model/merkleProofInfoDTO.ts index c3b92fd0ac..9c7bb7f03d 100644 --- a/src/infrastructure/model/merkleProofInfoDTO.ts +++ b/src/infrastructure/model/merkleProofInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/messageDTO.ts b/src/infrastructure/model/messageDTO.ts index 8106729475..9d3f9059ac 100644 --- a/src/infrastructure/model/messageDTO.ts +++ b/src/infrastructure/model/messageDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/messageTypeEnum.ts b/src/infrastructure/model/messageTypeEnum.ts index ec36e86e14..b5d794dbb6 100644 --- a/src/infrastructure/model/messageTypeEnum.ts +++ b/src/infrastructure/model/messageTypeEnum.ts @@ -17,20 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of message: * 0 - Regular message. * 1 - Encrypted message. * 254 - Persistent harvesting delegation. -*/ + * Type of message: * 0 - Regular message. * 1 - Encrypted message. * 254 - Persistent harvesting delegation. + */ export enum MessageTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_254 = 254 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_254 = 254, } diff --git a/src/infrastructure/model/metadataDTO.ts b/src/infrastructure/model/metadataDTO.ts index c52043c3ec..3b9056dab5 100644 --- a/src/infrastructure/model/metadataDTO.ts +++ b/src/infrastructure/model/metadataDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataEntriesDTO.ts b/src/infrastructure/model/metadataEntriesDTO.ts index 36c5e53d1e..77cea364ec 100644 --- a/src/infrastructure/model/metadataEntriesDTO.ts +++ b/src/infrastructure/model/metadataEntriesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataEntryDTO.ts b/src/infrastructure/model/metadataEntryDTO.ts index df5c97f324..9424232573 100644 --- a/src/infrastructure/model/metadataEntryDTO.ts +++ b/src/infrastructure/model/metadataEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataTypeEnum.ts b/src/infrastructure/model/metadataTypeEnum.ts index 7657910dba..6a9b3f8170 100644 --- a/src/infrastructure/model/metadataTypeEnum.ts +++ b/src/infrastructure/model/metadataTypeEnum.ts @@ -17,20 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Metadata type: * 0 - Account. * 1 - Mosaic. * 2 - Namespace. -*/ + * Metadata type: * 0 - Account. * 1 - Mosaic. * 2 - Namespace. + */ export enum MetadataTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/modelError.ts b/src/infrastructure/model/modelError.ts index 5a11639063..5e8ce3ae24 100644 --- a/src/infrastructure/model/modelError.ts +++ b/src/infrastructure/model/modelError.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/models.ts b/src/infrastructure/model/models.ts index 4a9f3a4bc2..3371f08090 100644 --- a/src/infrastructure/model/models.ts +++ b/src/infrastructure/model/models.ts @@ -154,9 +154,11 @@ export * from './transactionIds'; export * from './transactionInfoDTO'; export * from './transactionMetaDTO'; export * from './transactionPayload'; +export * from './transactionStateTypeEnum'; export * from './transactionStatementBodyDTO'; export * from './transactionStatementDTO'; export * from './transactionStatusDTO'; +export * from './transactionStatusTypeEnum'; export * from './transactionTypeEnum'; export * from './transferTransactionBodyDTO'; export * from './transferTransactionDTO'; @@ -321,9 +323,11 @@ import { TransactionIds } from './transactionIds'; import { TransactionInfoDTO } from './transactionInfoDTO'; import { TransactionMetaDTO } from './transactionMetaDTO'; import { TransactionPayload } from './transactionPayload'; +import { TransactionStateTypeEnum } from './transactionStateTypeEnum'; import { TransactionStatementBodyDTO } from './transactionStatementBodyDTO'; import { TransactionStatementDTO } from './transactionStatementDTO'; import { TransactionStatusDTO } from './transactionStatusDTO'; +import { TransactionStatusTypeEnum } from './transactionStatusTypeEnum'; import { TransactionTypeEnum } from './transactionTypeEnum'; import { TransferTransactionBodyDTO } from './transferTransactionBodyDTO'; import { TransferTransactionDTO } from './transferTransactionDTO'; @@ -358,6 +362,8 @@ let enumsMap: {[index: string]: any} = { "NetworkTypeEnum": NetworkTypeEnum, "ReceiptTypeEnum": ReceiptTypeEnum, "RolesTypeEnum": RolesTypeEnum, + "TransactionStateTypeEnum": TransactionStateTypeEnum, + "TransactionStatusTypeEnum": TransactionStatusTypeEnum, "TransactionTypeEnum": TransactionTypeEnum, } diff --git a/src/infrastructure/model/mosaic.ts b/src/infrastructure/model/mosaic.ts index 371e1d027c..6db1f11529 100644 --- a/src/infrastructure/model/mosaic.ts +++ b/src/infrastructure/model/mosaic.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionDTO.ts index c2ad85cef3..7cb6467d91 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts index 1eba898d83..ff74700521 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts index 86545936e9..00ff94dc6c 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts index 90730ff900..1a33e8439f 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts index 03e8ccb245..4055562e4c 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts b/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts index 97f40e06a8..70b6d8a21b 100644 --- a/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAliasTransactionDTO.ts b/src/infrastructure/model/mosaicAliasTransactionDTO.ts index 407ab63626..84e6e1dd79 100644 --- a/src/infrastructure/model/mosaicAliasTransactionDTO.ts +++ b/src/infrastructure/model/mosaicAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDTO.ts b/src/infrastructure/model/mosaicDTO.ts index a0961b6223..bf6fe85621 100644 --- a/src/infrastructure/model/mosaicDTO.ts +++ b/src/infrastructure/model/mosaicDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts index bb844a2f57..c03aea9030 100644 --- a/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts b/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts index e4818dcf04..9fe95e13f9 100644 --- a/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicExpiryReceiptDTO.ts b/src/infrastructure/model/mosaicExpiryReceiptDTO.ts index 89b12750ca..629da6bea6 100644 --- a/src/infrastructure/model/mosaicExpiryReceiptDTO.ts +++ b/src/infrastructure/model/mosaicExpiryReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts b/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts index 5ccc8d3185..9fe6458924 100644 --- a/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts +++ b/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts index 9ce5a5c337..1f50ead7e0 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts index ccc1825520..8766cca2aa 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts index 242c1c18ab..6d04808629 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts index b06a0333dd..514341c74a 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts index 592fc32962..7084b54183 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts index 2f7e4b99d4..07e65280a4 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicIds.ts b/src/infrastructure/model/mosaicIds.ts index 77c2bee587..b8303e1981 100644 --- a/src/infrastructure/model/mosaicIds.ts +++ b/src/infrastructure/model/mosaicIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicInfoDTO.ts b/src/infrastructure/model/mosaicInfoDTO.ts index 1c445e9ef6..3fe0f7520c 100644 --- a/src/infrastructure/model/mosaicInfoDTO.ts +++ b/src/infrastructure/model/mosaicInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts b/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts index 06ff11e3ea..65e54278bf 100644 --- a/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicMetadataTransactionDTO.ts b/src/infrastructure/model/mosaicMetadataTransactionDTO.ts index 04a9ecac79..6630b519c3 100644 --- a/src/infrastructure/model/mosaicMetadataTransactionDTO.ts +++ b/src/infrastructure/model/mosaicMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicNamesDTO.ts b/src/infrastructure/model/mosaicNamesDTO.ts index 8de4656020..bdbfb7677c 100644 --- a/src/infrastructure/model/mosaicNamesDTO.ts +++ b/src/infrastructure/model/mosaicNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts b/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts index 652043daec..3311bef1ce 100644 --- a/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts +++ b/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts @@ -17,19 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* - 0 - Mosaic address restriction. - 1 - Mosaic global restriction. -*/ + * - 0 - Mosaic address restriction. - 1 - Mosaic global restriction. + */ export enum MosaicRestrictionEntryTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/mosaicRestrictionTypeEnum.ts b/src/infrastructure/model/mosaicRestrictionTypeEnum.ts index 4dee8157e0..8ac3b4c99b 100644 --- a/src/infrastructure/model/mosaicRestrictionTypeEnum.ts +++ b/src/infrastructure/model/mosaicRestrictionTypeEnum.ts @@ -17,24 +17,29 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of mosaic restriction. * 0 - Uninitialized value indicating no restriction. * 1 (EQ) - Allow if equal. * 2 (NE) - Allow if not equal. * 3 (LT) - Allow if less than. * 4 (LE) - Allow if less than or equal. * 5 (GT) - Allow if greater than. * 6 (GE) - Allow if greater than or equal. -*/ + * Type of mosaic restriction. + * 0 - Uninitialized value indicating no restriction. + * 1 (EQ) - Allow if equal. + * 2 (NE) - Allow if not equal. + * 3 (LT) - Allow if less than. + * 4 (LE) - Allow if less than or equal. + * 5 (GT) - Allow if greater than. + * 6 (GE) - Allow if greater than or equal. + */ export enum MosaicRestrictionTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3, - NUMBER_4 = 4, - NUMBER_5 = 5, - NUMBER_6 = 6 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, + NUMBER_4 = 4, + NUMBER_5 = 5, + NUMBER_6 = 6, } diff --git a/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts b/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts index 3700e44ab6..86abd9d8db 100644 --- a/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts +++ b/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Direction of the supply change: * 0 - Decrease. * 1 - Increase. -*/ + * Direction of the supply change: * 0 - Decrease. * 1 - Increase. + */ export enum MosaicSupplyChangeActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts b/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts index 14fa267837..4298461d20 100644 --- a/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts b/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts index 63ccbafd28..9d61095843 100644 --- a/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts +++ b/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicsInfoDTO.ts b/src/infrastructure/model/mosaicsInfoDTO.ts index 4c09ec428f..4f306bfb7d 100644 --- a/src/infrastructure/model/mosaicsInfoDTO.ts +++ b/src/infrastructure/model/mosaicsInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicsNamesDTO.ts b/src/infrastructure/model/mosaicsNamesDTO.ts index eb97e2816f..2772252883 100644 --- a/src/infrastructure/model/mosaicsNamesDTO.ts +++ b/src/infrastructure/model/mosaicsNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountGraphInfoDTO.ts b/src/infrastructure/model/multisigAccountGraphInfoDTO.ts index f719ef68d0..4301593431 100644 --- a/src/infrastructure/model/multisigAccountGraphInfoDTO.ts +++ b/src/infrastructure/model/multisigAccountGraphInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountInfoDTO.ts b/src/infrastructure/model/multisigAccountInfoDTO.ts index b0f14dadc4..1e741a8ebe 100644 --- a/src/infrastructure/model/multisigAccountInfoDTO.ts +++ b/src/infrastructure/model/multisigAccountInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts b/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts index a52908497a..4911620324 100644 --- a/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts +++ b/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts b/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts index c062ef94f9..3bf5923735 100644 --- a/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts +++ b/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigDTO.ts b/src/infrastructure/model/multisigDTO.ts index b5abb4436f..2b7b4d071e 100644 --- a/src/infrastructure/model/multisigDTO.ts +++ b/src/infrastructure/model/multisigDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceDTO.ts b/src/infrastructure/model/namespaceDTO.ts index 42d674f4a3..164f1df917 100644 --- a/src/infrastructure/model/namespaceDTO.ts +++ b/src/infrastructure/model/namespaceDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceExpiryReceiptDTO.ts b/src/infrastructure/model/namespaceExpiryReceiptDTO.ts index 317c3f7499..fdce28dccc 100644 --- a/src/infrastructure/model/namespaceExpiryReceiptDTO.ts +++ b/src/infrastructure/model/namespaceExpiryReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts b/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts index 3b474aad73..b20c1d4aa4 100644 --- a/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts +++ b/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceIds.ts b/src/infrastructure/model/namespaceIds.ts index 30c8c48de4..90363b451e 100644 --- a/src/infrastructure/model/namespaceIds.ts +++ b/src/infrastructure/model/namespaceIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceInfoDTO.ts b/src/infrastructure/model/namespaceInfoDTO.ts index 8b35598321..65c7e716dc 100644 --- a/src/infrastructure/model/namespaceInfoDTO.ts +++ b/src/infrastructure/model/namespaceInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetaDTO.ts b/src/infrastructure/model/namespaceMetaDTO.ts index 39ae9b5d2d..a78c0a7a44 100644 --- a/src/infrastructure/model/namespaceMetaDTO.ts +++ b/src/infrastructure/model/namespaceMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts b/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts index 775a4596e4..31ee663b94 100644 --- a/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetadataTransactionDTO.ts b/src/infrastructure/model/namespaceMetadataTransactionDTO.ts index 928fb9f1ff..c0bd315a5d 100644 --- a/src/infrastructure/model/namespaceMetadataTransactionDTO.ts +++ b/src/infrastructure/model/namespaceMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceNameDTO.ts b/src/infrastructure/model/namespaceNameDTO.ts index 0199052754..d49fa98d64 100644 --- a/src/infrastructure/model/namespaceNameDTO.ts +++ b/src/infrastructure/model/namespaceNameDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts b/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts index b84513060a..77fa426bf8 100644 --- a/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts +++ b/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts b/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts index 0df8c35dd9..57839849c5 100644 --- a/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts +++ b/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTypeEnum.ts b/src/infrastructure/model/namespaceRegistrationTypeEnum.ts index 5296396a68..6cf4dfc855 100644 --- a/src/infrastructure/model/namespaceRegistrationTypeEnum.ts +++ b/src/infrastructure/model/namespaceRegistrationTypeEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of namespace: * 0 - Root namespace. * 1 - Subnamespace. -*/ + * Type of namespace: * 0 - Root namespace. * 1 - Subnamespace. + */ export enum NamespaceRegistrationTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/namespacesInfoDTO.ts b/src/infrastructure/model/namespacesInfoDTO.ts index f218660106..cf6fe04eeb 100644 --- a/src/infrastructure/model/namespacesInfoDTO.ts +++ b/src/infrastructure/model/namespacesInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/networkTypeDTO.ts b/src/infrastructure/model/networkTypeDTO.ts index 32d0cdf811..676e101293 100644 --- a/src/infrastructure/model/networkTypeDTO.ts +++ b/src/infrastructure/model/networkTypeDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/networkTypeEnum.ts b/src/infrastructure/model/networkTypeEnum.ts index 74cf7fe28b..38c5a82126 100644 --- a/src/infrastructure/model/networkTypeEnum.ts +++ b/src/infrastructure/model/networkTypeEnum.ts @@ -17,21 +17,22 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Network type: * 0x60 (96 decimal) - Private network. * 0x90 (144 decimal) - Private test network. * 0x68 (104 decimal) - Public main network. * 0x98 (152 decimal) - Public test network. -*/ + * Network type: + * 0x60 (96 decimal) - Private network. + * 0x90 (144 decimal) - Private test network. + * 0x68 (104 decimal) - Public main network. * 0x98 (152 decimal) - Public test network. + */ export enum NetworkTypeEnum { - NUMBER_104 = 104, - NUMBER_152 = 152, - NUMBER_96 = 96, - NUMBER_144 = 144 + NUMBER_104 = 104, + NUMBER_152 = 152, + NUMBER_96 = 96, + NUMBER_144 = 144, } diff --git a/src/infrastructure/model/nodeInfoDTO.ts b/src/infrastructure/model/nodeInfoDTO.ts index e0bf5b9033..42a6a33556 100644 --- a/src/infrastructure/model/nodeInfoDTO.ts +++ b/src/infrastructure/model/nodeInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/nodeTimeDTO.ts b/src/infrastructure/model/nodeTimeDTO.ts index dceba2da20..a670a833c4 100644 --- a/src/infrastructure/model/nodeTimeDTO.ts +++ b/src/infrastructure/model/nodeTimeDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/receiptDTO.ts b/src/infrastructure/model/receiptDTO.ts index 5bacbc7a40..1729ef3970 100644 --- a/src/infrastructure/model/receiptDTO.ts +++ b/src/infrastructure/model/receiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/receiptTypeEnum.ts b/src/infrastructure/model/receiptTypeEnum.ts index 44cf31eb87..4ca1c7712d 100644 --- a/src/infrastructure/model/receiptTypeEnum.ts +++ b/src/infrastructure/model/receiptTypeEnum.ts @@ -17,33 +17,46 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of receipt: * 0x124D (4685 decimal) - Mosaic_Rental_Fee. * 0x134E (4942 decimal) - Namespace_Rental_Fee. * 0x2143 (8515 decimal) - Harvest_Fee. * 0x2248 (8776 decimal) - LockHash_Completed. * 0x2348 (9032 decimal) - LockHash_Expired. * 0x2252 (8786 decimal) - LockSecret_Completed. * 0x2352 (9042 decimal) - LockSecret_Expired. * 0x3148 (12616 decimal) - LockHash_Created. * 0x3152 (12626 decimal) - LockSecret_Created. * 0x414D (16717 decimal) - Mosaic_Expired. * 0x414E (16718 decimal) - Namespace_Expired. * 0x424E (16974 decimal) - Namespace_Deleted. * 0x5143 (20803 decimal) - Inflation. * 0xE143 (57667 decimal) - Transaction_Group. * 0xF143 (61763 decimal) - Address_Alias_Resolution. * 0xF243 (62019 decimal) - Mosaic_Alias_Resolution. -*/ + * Type of receipt: * 0x124D (4685 decimal) - Mosaic_Rental_Fee. + * 0x134E (4942 decimal) - Namespace_Rental_Fee. + * 0x2143 (8515 decimal) - Harvest_Fee. + * 0x2248 (8776 decimal) - LockHash_Completed. + * 0x2348 (9032 decimal) - LockHash_Expired. + * 0x2252 (8786 decimal) - LockSecret_Completed. + * 0x2352 (9042 decimal) - LockSecret_Expired. + * 0x3148 (12616 decimal) - LockHash_Created. + * 0x3152 (12626 decimal) - LockSecret_Created. + * 0x414D (16717 decimal) - Mosaic_Expired. + * 0x414E (16718 decimal) - Namespace_Expired. + * 0x424E (16974 decimal) - Namespace_Deleted. + * 0x5143 (20803 decimal) - Inflation. + * 0xE143 (57667 decimal) - Transaction_Group. + * 0xF143 (61763 decimal) - Address_Alias_Resolution. + * 0xF243 (62019 decimal) - Mosaic_Alias_Resolution. + */ export enum ReceiptTypeEnum { - NUMBER_4685 = 4685, - NUMBER_4942 = 4942, - NUMBER_8515 = 8515, - NUMBER_8776 = 8776, - NUMBER_9032 = 9032, - NUMBER_8786 = 8786, - NUMBER_9042 = 9042, - NUMBER_12616 = 12616, - NUMBER_12626 = 12626, - NUMBER_16717 = 16717, - NUMBER_16718 = 16718, - NUMBER_16974 = 16974, - NUMBER_20803 = 20803, - NUMBER_57667 = 57667, - NUMBER_61763 = 61763, - NUMBER_62019 = 62019 + NUMBER_4685 = 4685, + NUMBER_4942 = 4942, + NUMBER_8515 = 8515, + NUMBER_8776 = 8776, + NUMBER_9032 = 9032, + NUMBER_8786 = 8786, + NUMBER_9042 = 9042, + NUMBER_12616 = 12616, + NUMBER_12626 = 12626, + NUMBER_16717 = 16717, + NUMBER_16718 = 16718, + NUMBER_16974 = 16974, + NUMBER_20803 = 20803, + NUMBER_57667 = 57667, + NUMBER_61763 = 61763, + NUMBER_62019 = 62019, } diff --git a/src/infrastructure/model/resolutionEntryDTO.ts b/src/infrastructure/model/resolutionEntryDTO.ts index 56a1368d26..31abf00af3 100644 --- a/src/infrastructure/model/resolutionEntryDTO.ts +++ b/src/infrastructure/model/resolutionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/resolutionStatementBodyDTO.ts b/src/infrastructure/model/resolutionStatementBodyDTO.ts index 831445357c..ea75554e83 100644 --- a/src/infrastructure/model/resolutionStatementBodyDTO.ts +++ b/src/infrastructure/model/resolutionStatementBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/resolutionStatementDTO.ts b/src/infrastructure/model/resolutionStatementDTO.ts index 5e1706cf1a..a7ff96990a 100644 --- a/src/infrastructure/model/resolutionStatementDTO.ts +++ b/src/infrastructure/model/resolutionStatementDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/rolesTypeEnum.ts b/src/infrastructure/model/rolesTypeEnum.ts index 4aac6137da..c01edb55ba 100644 --- a/src/infrastructure/model/rolesTypeEnum.ts +++ b/src/infrastructure/model/rolesTypeEnum.ts @@ -17,19 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - - /** -* Role of the node: * 1 - Peer node. * 2 - Api node. -*/ + * Role of the node: + * 1 - Peer node. + * 2 - Api node. + */ export enum RolesTypeEnum { - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/secretLockTransactionBodyDTO.ts b/src/infrastructure/model/secretLockTransactionBodyDTO.ts index ad1b29fd92..a8f0f62b11 100644 --- a/src/infrastructure/model/secretLockTransactionBodyDTO.ts +++ b/src/infrastructure/model/secretLockTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretLockTransactionDTO.ts b/src/infrastructure/model/secretLockTransactionDTO.ts index 0e1adb4175..bfdabed743 100644 --- a/src/infrastructure/model/secretLockTransactionDTO.ts +++ b/src/infrastructure/model/secretLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretProofTransactionBodyDTO.ts b/src/infrastructure/model/secretProofTransactionBodyDTO.ts index 89c727fb16..36b5aad14b 100644 --- a/src/infrastructure/model/secretProofTransactionBodyDTO.ts +++ b/src/infrastructure/model/secretProofTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretProofTransactionDTO.ts b/src/infrastructure/model/secretProofTransactionDTO.ts index 0e4a43bb1d..82e786ffe4 100644 --- a/src/infrastructure/model/secretProofTransactionDTO.ts +++ b/src/infrastructure/model/secretProofTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/serverDTO.ts b/src/infrastructure/model/serverDTO.ts index 26001233ad..7f9a23bafe 100644 --- a/src/infrastructure/model/serverDTO.ts +++ b/src/infrastructure/model/serverDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/serverInfoDTO.ts b/src/infrastructure/model/serverInfoDTO.ts index e36d184b4b..cd70601484 100644 --- a/src/infrastructure/model/serverInfoDTO.ts +++ b/src/infrastructure/model/serverInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/sourceDTO.ts b/src/infrastructure/model/sourceDTO.ts index d9cc6fa741..c2d78a8e14 100644 --- a/src/infrastructure/model/sourceDTO.ts +++ b/src/infrastructure/model/sourceDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/statementsDTO.ts b/src/infrastructure/model/statementsDTO.ts index ef5c82fc34..c2e2d38f54 100644 --- a/src/infrastructure/model/statementsDTO.ts +++ b/src/infrastructure/model/statementsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/storageInfoDTO.ts b/src/infrastructure/model/storageInfoDTO.ts index 342f15c8f3..2413f47e8c 100644 --- a/src/infrastructure/model/storageInfoDTO.ts +++ b/src/infrastructure/model/storageInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionBodyDTO.ts b/src/infrastructure/model/transactionBodyDTO.ts index 9719359902..eaad75fd6a 100644 --- a/src/infrastructure/model/transactionBodyDTO.ts +++ b/src/infrastructure/model/transactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionDTO.ts b/src/infrastructure/model/transactionDTO.ts index 60fffdc811..d6717a7074 100644 --- a/src/infrastructure/model/transactionDTO.ts +++ b/src/infrastructure/model/transactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionHashes.ts b/src/infrastructure/model/transactionHashes.ts index fa2a5781cb..e487513bbf 100644 --- a/src/infrastructure/model/transactionHashes.ts +++ b/src/infrastructure/model/transactionHashes.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionIds.ts b/src/infrastructure/model/transactionIds.ts index 8e3f939a37..20128c834f 100644 --- a/src/infrastructure/model/transactionIds.ts +++ b/src/infrastructure/model/transactionIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionInfoDTO.ts b/src/infrastructure/model/transactionInfoDTO.ts index 97755b450a..d97b3df3d3 100644 --- a/src/infrastructure/model/transactionInfoDTO.ts +++ b/src/infrastructure/model/transactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionMetaDTO.ts b/src/infrastructure/model/transactionMetaDTO.ts index 2b94185fd7..4c4690f0a7 100644 --- a/src/infrastructure/model/transactionMetaDTO.ts +++ b/src/infrastructure/model/transactionMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionPayload.ts b/src/infrastructure/model/transactionPayload.ts index f48e39f7e4..88dc032b2d 100644 --- a/src/infrastructure/model/transactionPayload.ts +++ b/src/infrastructure/model/transactionPayload.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStateTypeEnum.ts b/src/infrastructure/model/transactionStateTypeEnum.ts new file mode 100644 index 0000000000..47a39c62dc --- /dev/null +++ b/src/infrastructure/model/transactionStateTypeEnum.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2019 NEM + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Catapult REST Endpoints + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.7.20.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * State of the transaction. + */ +export enum TransactionStateTypeEnum { + Confirmed = 'confirmed', + Unconfirmed = 'unconfirmed', + Failed = 'failed', +} diff --git a/src/infrastructure/model/transactionStatementBodyDTO.ts b/src/infrastructure/model/transactionStatementBodyDTO.ts index 5a27ffa22c..aaa68613b8 100644 --- a/src/infrastructure/model/transactionStatementBodyDTO.ts +++ b/src/infrastructure/model/transactionStatementBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStatementDTO.ts b/src/infrastructure/model/transactionStatementDTO.ts index ac293c02b9..1d72f557ed 100644 --- a/src/infrastructure/model/transactionStatementDTO.ts +++ b/src/infrastructure/model/transactionStatementDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStatusDTO.ts b/src/infrastructure/model/transactionStatusDTO.ts index 04b1f3eba7..e91a9de572 100644 --- a/src/infrastructure/model/transactionStatusDTO.ts +++ b/src/infrastructure/model/transactionStatusDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -25,15 +25,17 @@ * Do not edit the class manually. */ +import { TransactionStateTypeEnum } from './transactionStateTypeEnum'; +import { TransactionStatusTypeEnum } from './transactionStatusTypeEnum'; export class TransactionStatusDTO { - 'group'?: string; - 'status': string; - 'hash'?: string; + 'group': TransactionStateTypeEnum; + 'code'?: TransactionStatusTypeEnum; + 'hash': string; /** * Duration expressed in number of blocks. */ - 'deadline'?: string; + 'deadline': string; /** * Height of the blockchain. */ @@ -45,12 +47,12 @@ export class TransactionStatusDTO { { "name": "group", "baseName": "group", - "type": "string" + "type": "TransactionStateTypeEnum" }, { - "name": "status", - "baseName": "status", - "type": "string" + "name": "code", + "baseName": "code", + "type": "TransactionStatusTypeEnum" }, { "name": "hash", diff --git a/src/infrastructure/model/transactionStatusTypeEnum.ts b/src/infrastructure/model/transactionStatusTypeEnum.ts new file mode 100644 index 0000000000..d5d3e8b712 --- /dev/null +++ b/src/infrastructure/model/transactionStatusTypeEnum.ts @@ -0,0 +1,179 @@ +/* + * Copyright 2019 NEM + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Catapult REST Endpoints + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.7.20.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export enum TransactionStatusTypeEnum { + Success = 'Success', + Neutral = 'Neutral', + Failure = 'Failure', + FailureCorePastDeadline = 'Failure_Core_Past_Deadline', + FailureCoreFutureDeadline = 'Failure_Core_Future_Deadline', + FailureCoreInsufficientBalance = 'Failure_Core_Insufficient_Balance', + FailureCoreTooManyTransactions = 'Failure_Core_Too_Many_Transactions', + FailureCoreNemesisAccountSignedAfterNemesisBlock = 'Failure_Core_Nemesis_Account_Signed_After_Nemesis_Block', + FailureCoreWrongNetwork = 'Failure_Core_Wrong_Network', + FailureCoreInvalidAddress = 'Failure_Core_Invalid_Address', + FailureCoreInvalidVersion = 'Failure_Core_Invalid_Version', + FailureCoreInvalidTransactionFee = 'Failure_Core_Invalid_Transaction_Fee', + FailureCoreBlockHarvesterIneligible = 'Failure_Core_Block_Harvester_Ineligible', + FailureCoreZeroAddress = 'Failure_Core_Zero_Address', + FailureCoreZeroPublicKey = 'Failure_Core_Zero_Public_Key', + FailureCoreNonzeroInternalPadding = 'Failure_Core_Nonzero_Internal_Padding', + FailureHashAlreadyExists = 'Failure_Hash_Already_Exists', + FailureSignatureNotVerifiable = 'Failure_Signature_Not_Verifiable', + FailureAccountLinkInvalidAction = 'Failure_AccountLink_Invalid_Action', + FailureAccountLinkLinkAlreadyExists = 'Failure_AccountLink_Link_Already_Exists', + FailureAccountLinkUnknownLink = 'Failure_AccountLink_Unknown_Link', + FailureAccountLinkInconsistentUnlinkData = 'Failure_AccountLink_Inconsistent_Unlink_Data', + FailureAccountLinkRemoteAccountIneligible = 'Failure_AccountLink_Remote_Account_Ineligible', + FailureAccountLinkRemoteAccountSignerProhibited = 'Failure_AccountLink_Remote_Account_Signer_Prohibited', + FailureAccountLinkRemoteAccountParticipantProhibited = 'Failure_AccountLink_Remote_Account_Participant_Prohibited', + FailureAggregateTooManyTransactions = 'Failure_Aggregate_Too_Many_Transactions', + FailureAggregateNoTransactions = 'Failure_Aggregate_No_Transactions', + FailureAggregateTooManyCosignatures = 'Failure_Aggregate_Too_Many_Cosignatures', + FailureAggregateRedundantCosignatures = 'Failure_Aggregate_Redundant_Cosignatures', + FailureAggregateIneligibleCosignatories = 'Failure_Aggregate_Ineligible_Cosignatories', + FailureAggregateMissingCosignatures = 'Failure_Aggregate_Missing_Cosignatures', + FailureAggregateTransactionsHashMismatch = 'Failure_Aggregate_Transactions_Hash_Mismatch', + FailureLockHashInvalidMosaicId = 'Failure_LockHash_Invalid_Mosaic_Id', + FailureLockHashInvalidMosaicAmount = 'Failure_LockHash_Invalid_Mosaic_Amount', + FailureLockHashHashAlreadyExists = 'Failure_LockHash_Hash_Already_Exists', + FailureLockHashUnknownHash = 'Failure_LockHash_Unknown_Hash', + FailureLockHashInactiveHash = 'Failure_LockHash_Inactive_Hash', + FailureLockHashInvalidDuration = 'Failure_LockHash_Invalid_Duration', + FailureLockSecretInvalidHashAlgorithm = 'Failure_LockSecret_Invalid_Hash_Algorithm', + FailureLockSecretHashAlreadyExists = 'Failure_LockSecret_Hash_Already_Exists', + FailureLockSecretProofSizeOutOfBounds = 'Failure_LockSecret_Proof_Size_Out_Of_Bounds', + FailureLockSecretSecretMismatch = 'Failure_LockSecret_Secret_Mismatch', + FailureLockSecretUnknownCompositeKey = 'Failure_LockSecret_Unknown_Composite_Key', + FailureLockSecretInactiveSecret = 'Failure_LockSecret_Inactive_Secret', + FailureLockSecretHashAlgorithmMismatch = 'Failure_LockSecret_Hash_Algorithm_Mismatch', + FailureLockSecretInvalidDuration = 'Failure_LockSecret_Invalid_Duration', + FailureMetadataValueTooSmall = 'Failure_Metadata_Value_Too_Small', + FailureMetadataValueTooLarge = 'Failure_Metadata_Value_Too_Large', + FailureMetadataValueSizeDeltaTooLarge = 'Failure_Metadata_Value_Size_Delta_Too_Large', + FailureMetadataValueSizeDeltaMismatch = 'Failure_Metadata_Value_Size_Delta_Mismatch', + FailureMetadataValueChangeIrreversible = 'Failure_Metadata_Value_Change_Irreversible', + FailureMosaicInvalidDuration = 'Failure_Mosaic_Invalid_Duration', + FailureMosaicInvalidName = 'Failure_Mosaic_Invalid_Name', + FailureMosaicNameIdMismatch = 'Failure_Mosaic_Name_Id_Mismatch', + FailureMosaicExpired = 'Failure_Mosaic_Expired', + FailureMosaicOwnerConflict = 'Failure_Mosaic_Owner_Conflict', + FailureMosaicIdMismatch = 'Failure_Mosaic_Id_Mismatch', + FailureMosaicParentIdConflict = 'Failure_Mosaic_Parent_Id_Conflict', + FailureMosaicInvalidProperty = 'Failure_Mosaic_Invalid_Property', + FailureMosaicInvalidFlags = 'Failure_Mosaic_Invalid_Flags', + FailureMosaicInvalidDivisibility = 'Failure_Mosaic_Invalid_Divisibility', + FailureMosaicInvalidSupplyChangeAction = 'Failure_Mosaic_Invalid_Supply_Change_Action', + FailureMosaicInvalidSupplyChangeAmount = 'Failure_Mosaic_Invalid_Supply_Change_Amount', + FailureMosaicInvalidId = 'Failure_Mosaic_Invalid_Id', + FailureMosaicModificationDisallowed = 'Failure_Mosaic_Modification_Disallowed', + FailureMosaicModificationNoChanges = 'Failure_Mosaic_Modification_No_Changes', + FailureMosaicSupplyImmutable = 'Failure_Mosaic_Supply_Immutable', + FailureMosaicSupplyNegative = 'Failure_Mosaic_Supply_Negative', + FailureMosaicSupplyExceeded = 'Failure_Mosaic_Supply_Exceeded', + FailureMosaicNonTransferable = 'Failure_Mosaic_Non_Transferable', + FailureMosaicMaxMosaicsExceeded = 'Failure_Mosaic_Max_Mosaics_Exceeded', + FailureMosaicRequiredPropertyFlagUnset = 'Failure_Mosaic_Required_Property_Flag_Unset', + FailureMultisigAccountInBothSets = 'Failure_Multisig_Account_In_Both_Sets', + FailureMultisigMultipleDeletes = 'Failure_Multisig_Multiple_Deletes', + FailureMultisigRedundantModification = 'Failure_Multisig_Redundant_Modification', + FailureMultisigUnknownMultisigAccount = 'Failure_Multisig_Unknown_Multisig_Account', + FailureMultisigNotACosignatory = 'Failure_Multisig_Not_A_Cosignatory', + FailureMultisigAlreadyACosignatory = 'Failure_Multisig_Already_A_Cosignatory', + FailureMultisigMinSettingOutOfRange = 'Failure_Multisig_Min_Setting_Out_Of_Range', + FailureMultisigMinSettingLargerThanNumCosignatories = 'Failure_Multisig_Min_Setting_Larger_Than_Num_Cosignatories', + FailureMultisigInvalidModificationAction = 'Failure_Multisig_Invalid_Modification_Action', + FailureMultisigMaxCosignedAccounts = 'Failure_Multisig_Max_Cosigned_Accounts', + FailureMultisigMaxCosignatories = 'Failure_Multisig_Max_Cosignatories', + FailureMultisigLoop = 'Failure_Multisig_Loop', + FailureMultisigMaxMultisigDepth = 'Failure_Multisig_Max_Multisig_Depth', + FailureMultisigOperationProhibitedByAccount = 'Failure_Multisig_Operation_Prohibited_By_Account', + FailureNamespaceInvalidDuration = 'Failure_Namespace_Invalid_Duration', + FailureNamespaceInvalidName = 'Failure_Namespace_Invalid_Name', + FailureNamespaceNameIdMismatch = 'Failure_Namespace_Name_Id_Mismatch', + FailureNamespaceExpired = 'Failure_Namespace_Expired', + FailureNamespaceOwnerConflict = 'Failure_Namespace_Owner_Conflict', + FailureNamespaceIdMismatch = 'Failure_Namespace_Id_Mismatch', + FailureNamespaceInvalidRegistrationType = 'Failure_Namespace_Invalid_Registration_Type', + FailureNamespaceRootNameReserved = 'Failure_Namespace_Root_Name_Reserved', + FailureNamespaceTooDeep = 'Failure_Namespace_Too_Deep', + FailureNamespaceUnknownParent = 'Failure_Namespace_Unknown_Parent', + FailureNamespaceAlreadyExists = 'Failure_Namespace_Already_Exists', + FailureNamespaceAlreadyActive = 'Failure_Namespace_Already_Active', + FailureNamespaceEternalAfterNemesisBlock = 'Failure_Namespace_Eternal_After_Nemesis_Block', + FailureNamespaceMaxChildrenExceeded = 'Failure_Namespace_Max_Children_Exceeded', + FailureNamespaceAliasInvalidAction = 'Failure_Namespace_Alias_Invalid_Action', + FailureNamespaceUnknown = 'Failure_Namespace_Unknown', + FailureNamespaceAliasAlreadyExists = 'Failure_Namespace_Alias_Already_Exists', + FailureNamespaceUnknownAlias = 'Failure_Namespace_Unknown_Alias', + FailureNamespaceAliasInconsistentUnlinkType = 'Failure_Namespace_Alias_Inconsistent_Unlink_Type', + FailureNamespaceAliasInconsistentUnlinkData = 'Failure_Namespace_Alias_Inconsistent_Unlink_Data', + FailureNamespaceAliasInvalidAddress = 'Failure_Namespace_Alias_Invalid_Address', + FailureRestrictionAccountInvalidRestrictionFlags = 'Failure_RestrictionAccount_Invalid_Restriction_Flags', + FailureRestrictionAccountInvalidModificationAction = 'Failure_RestrictionAccount_Invalid_Modification_Action', + FailureRestrictionAccountInvalidModificationAddress = 'Failure_RestrictionAccount_Invalid_Modification_Address', + FailureRestrictionAccountModificationOperationTypeIncompatible = 'Failure_RestrictionAccount_Modification_Operation_Type_Incompatible', + FailureRestrictionAccountRedundantModification = 'Failure_RestrictionAccount_Redundant_Modification', + FailureRestrictionAccountInvalidModification = 'Failure_RestrictionAccount_Invalid_Modification', + FailureRestrictionAccountModificationCountExceeded = 'Failure_RestrictionAccount_Modification_Count_Exceeded', + FailureRestrictionAccountNoModifications = 'Failure_RestrictionAccount_No_Modifications', + FailureRestrictionAccountValuesCountExceeded = 'Failure_RestrictionAccount_Values_Count_Exceeded', + FailureRestrictionAccountInvalidValue = 'Failure_RestrictionAccount_Invalid_Value', + FailureRestrictionAccountAddressInteractionProhibited = 'Failure_RestrictionAccount_Address_Interaction_Prohibited', + FailureRestrictionAccountMosaicTransferProhibited = 'Failure_RestrictionAccount_Mosaic_Transfer_Prohibited', + FailureRestrictionAccountOperationTypeProhibited = 'Failure_RestrictionAccount_Operation_Type_Prohibited', + FailureRestrictionMosaicInvalidRestrictionType = 'Failure_RestrictionMosaic_Invalid_Restriction_Type', + FailureRestrictionMosaicPreviousValueMismatch = 'Failure_RestrictionMosaic_Previous_Value_Mismatch', + FailureRestrictionMosaicPreviousValueMustBeZero = 'Failure_RestrictionMosaic_Previous_Value_Must_Be_Zero', + FailureRestrictionMosaicMaxRestrictionsExceeded = 'Failure_RestrictionMosaic_Max_Restrictions_Exceeded', + FailureRestrictionMosaicCannotDeleteNonexistentRestriction = 'Failure_RestrictionMosaic_Cannot_Delete_Nonexistent_Restriction', + FailureRestrictionMosaicUnknownGlobalRestriction = 'Failure_RestrictionMosaic_Unknown_Global_Restriction', + FailureRestrictionMosaicInvalidGlobalRestriction = 'Failure_RestrictionMosaic_Invalid_Global_Restriction', + FailureRestrictionMosaicAccountUnauthorized = 'Failure_RestrictionMosaic_Account_Unauthorized', + FailureTransferMessageTooLarge = 'Failure_Transfer_Message_Too_Large', + FailureTransferOutOfOrderMosaics = 'Failure_Transfer_Out_Of_Order_Mosaics', + FailureChainUnlinked = 'Failure_Chain_Unlinked', + FailureChainBlockNotHit = 'Failure_Chain_Block_Not_Hit', + FailureChainBlockInconsistentStateHash = 'Failure_Chain_Block_Inconsistent_State_Hash', + FailureChainBlockInconsistentReceiptsHash = 'Failure_Chain_Block_Inconsistent_Receipts_Hash', + FailureChainUnconfirmedCacheTooFull = 'Failure_Chain_Unconfirmed_Cache_Too_Full', + FailureConsumerEmptyInput = 'Failure_Consumer_Empty_Input', + FailureConsumerBlockTransactionsHashMismatch = 'Failure_Consumer_Block_Transactions_Hash_Mismatch', + NeutralConsumerHashInRecencyCache = 'Neutral_Consumer_Hash_In_Recency_Cache', + FailureConsumerRemoteChainTooManyBlocks = 'Failure_Consumer_Remote_Chain_Too_Many_Blocks', + FailureConsumerRemoteChainImproperLink = 'Failure_Consumer_Remote_Chain_Improper_Link', + FailureConsumerRemoteChainDuplicateTransactions = 'Failure_Consumer_Remote_Chain_Duplicate_Transactions', + FailureConsumerRemoteChainUnlinked = 'Failure_Consumer_Remote_Chain_Unlinked', + FailureConsumerRemoteChainDifficultiesMismatch = 'Failure_Consumer_Remote_Chain_Difficulties_Mismatch', + FailureConsumerRemoteChainScoreNotBetter = 'Failure_Consumer_Remote_Chain_Score_Not_Better', + FailureConsumerRemoteChainTooFarBehind = 'Failure_Consumer_Remote_Chain_Too_Far_Behind', + FailureConsumerRemoteChainTooFarInFuture = 'Failure_Consumer_Remote_Chain_Too_Far_In_Future', + FailureConsumerBatchSignatureNotVerifiable = 'Failure_Consumer_Batch_Signature_Not_Verifiable', + FailureExtensionPartialTransactionCachePrune = 'Failure_Extension_Partial_Transaction_Cache_Prune', + FailureExtensionPartialTransactionDependencyRemoved = 'Failure_Extension_Partial_Transaction_Dependency_Removed', + FailureExtensionReadRateLimitExceeded = 'Failure_Extension_Read_Rate_Limit_Exceeded', +} diff --git a/src/infrastructure/model/transactionTypeEnum.ts b/src/infrastructure/model/transactionTypeEnum.ts index 2a49d78b67..ae023bc034 100644 --- a/src/infrastructure/model/transactionTypeEnum.ts +++ b/src/infrastructure/model/transactionTypeEnum.ts @@ -17,38 +17,56 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of transaction: * 0x414C (16716 decimal) - AccountLinkTransaction. * 0x4141 (16705 decimal) - AggregateCompleteTransaction. * 0x4241 (16961 decimal) - AggregateBondedTransaction. * 0x414D (16717 decimal) - MosaicDefinitionTransaction. * 0x424D (16973 decimal) - MosaicSupplyChangeTransaction. * 0x414E (16718 decimal) - NamespaceRegistrationTransaction. * 0x424E (16974 decimal) - AddressAliasTransaction. * 0x434E (17230 decimal) - MosaicAliasTransaction. * 0x4144 (16708 decimal) - AccountMetadataTransaction. * 0x4244 (16964 decimal) - MosaicMetadataTransaction. * 0x4344 (17220 decimal) - NamespaceMetadataTransaction. * 0x4155 (16725 decimal) - MultisigAccountModificationTransaction. * 0x4148 (16712 decimal) - HashLockTransaction. * 0x4152 (16722 decimal) - SecretLockTransaction. * 0x4252 (16978 decimal) - SecretProofTransaction. * 0x4150 (16720 decimal) - AccountAddressRestrictionTransaction. * 0x4250 (16976 decimal) - AccountMosaicRestrictionTransaction. * 0x4350 (17232 decimal) - AccountOperationRestrictionTransaction. * 0x4151 (16721 decimal) - MosaicGlobalRestrictionTransaction. * 0x4251 (16977 decimal) - MosaicAddressRestrictionTransaction. * 0x4154 (16724 decimal) - TransferTransaction. -*/ + * Type of transaction: * 0x414C (16716 decimal) - AccountLinkTransaction. * 0x4141 (16705 decimal) -AggregateCompleteTransaction. + * 0x4241 (16961 decimal) - AggregateBondedTransaction. + * 0x414D (16717 decimal) - MosaicDefinitionTransaction. + * 0x424D (16973 decimal) - MosaicSupplyChangeTransaction. + * 0x414E (16718 decimal) - NamespaceRegistrationTransaction. + * 0x424E (16974 decimal) - AddressAliasTransaction. + * 0x434E (17230 decimal) - MosaicAliasTransaction. + * 0x4144 (16708 decimal) - AccountMetadataTransaction. + * 0x4244 (16964 decimal) - MosaicMetadataTransaction. + * 0x4344 (17220 decimal) - NamespaceMetadataTransaction. + * 0x4155 (16725 decimal) - MultisigAccountModificationTransaction. + * 0x4148 (16712 decimal) - HashLockTransaction. + * 0x4152 (16722 decimal) - SecretLockTransaction. + * 0x4252 (16978 decimal) - SecretProofTransaction. + * 0x4150 (16720 decimal) - AccountAddressRestrictionTransaction. + * 0x4250 (16976 decimal) - AccountMosaicRestrictionTransaction. + * 0x4350 (17232 decimal) - AccountOperationRestrictionTransaction. + * 0x4151 (16721 decimal) - MosaicGlobalRestrictionTransaction. + * 0x4251 (16977 decimal) - MosaicAddressRestrictionTransaction. + * 0x4154 (16724 decimal) - TransferTransaction. + */ export enum TransactionTypeEnum { - NUMBER_16716 = 16716, - NUMBER_16705 = 16705, - NUMBER_16961 = 16961, - NUMBER_16717 = 16717, - NUMBER_16973 = 16973, - NUMBER_16718 = 16718, - NUMBER_16974 = 16974, - NUMBER_17230 = 17230, - NUMBER_16708 = 16708, - NUMBER_16964 = 16964, - NUMBER_17220 = 17220, - NUMBER_16725 = 16725, - NUMBER_16712 = 16712, - NUMBER_16722 = 16722, - NUMBER_16978 = 16978, - NUMBER_16720 = 16720, - NUMBER_16976 = 16976, - NUMBER_17232 = 17232, - NUMBER_16721 = 16721, - NUMBER_16977 = 16977, - NUMBER_16724 = 16724 + NUMBER_16716 = 16716, + NUMBER_16705 = 16705, + NUMBER_16961 = 16961, + NUMBER_16717 = 16717, + NUMBER_16973 = 16973, + NUMBER_16718 = 16718, + NUMBER_16974 = 16974, + NUMBER_17230 = 17230, + NUMBER_16708 = 16708, + NUMBER_16964 = 16964, + NUMBER_17220 = 17220, + NUMBER_16725 = 16725, + NUMBER_16712 = 16712, + NUMBER_16722 = 16722, + NUMBER_16978 = 16978, + NUMBER_16720 = 16720, + NUMBER_16976 = 16976, + NUMBER_17232 = 17232, + NUMBER_16721 = 16721, + NUMBER_16977 = 16977, + NUMBER_16724 = 16724, } diff --git a/src/infrastructure/model/transferTransactionBodyDTO.ts b/src/infrastructure/model/transferTransactionBodyDTO.ts index 91ee668752..38d99a09fe 100644 --- a/src/infrastructure/model/transferTransactionBodyDTO.ts +++ b/src/infrastructure/model/transferTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transferTransactionDTO.ts b/src/infrastructure/model/transferTransactionDTO.ts index fd1ed28761..287211e77a 100644 --- a/src/infrastructure/model/transferTransactionDTO.ts +++ b/src/infrastructure/model/transferTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/unresolvedMosaic.ts b/src/infrastructure/model/unresolvedMosaic.ts index cce9479c2b..9aa1b06cd6 100644 --- a/src/infrastructure/model/unresolvedMosaic.ts +++ b/src/infrastructure/model/unresolvedMosaic.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/verifiableEntityDTO.ts b/src/infrastructure/model/verifiableEntityDTO.ts index 240e6f35b2..7eee4865b2 100644 --- a/src/infrastructure/model/verifiableEntityDTO.ts +++ b/src/infrastructure/model/verifiableEntityDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/receipt/CreateReceiptFromDTO.ts b/src/infrastructure/receipt/CreateReceiptFromDTO.ts index 8eff4c9c87..6c564bbbac 100644 --- a/src/infrastructure/receipt/CreateReceiptFromDTO.ts +++ b/src/infrastructure/receipt/CreateReceiptFromDTO.ts @@ -34,50 +34,21 @@ import { TransactionStatement } from '../../model/receipt/TransactionStatement'; import {UInt64} from '../../model/UInt64'; /** - * @param receiptDTO - * @param networkType - * @returns {Statement} - * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.h - * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.cpp - * @constructor - */ -export const CreateStatementFromDTO = (receiptDTO, networkType): Statement => { - return new Statement( - receiptDTO.transactionStatements.map((statement) => createTransactionStatement(statement.statement, networkType)), - receiptDTO.addressResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Address)), - receiptDTO.mosaicResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Mosaic)), - ); -}; - -/** - * @param receiptDTO - * @param networkType - * @returns {Receipt} - * @constructor + * @interal + * @param unresolvedAddress unresolved address + * @returns {Address | NamespaceId} */ -export const CreateReceiptFromDTO = (receiptDTO, networkType): Receipt => { - switch (receiptDTO.type) { - case ReceiptType.Harvest_Fee: - case ReceiptType.LockHash_Created: - case ReceiptType.LockHash_Completed: - case ReceiptType.LockHash_Expired: - case ReceiptType.LockSecret_Created: - case ReceiptType.LockSecret_Completed: - case ReceiptType.LockSecret_Expired: - return createBalanceChangeReceipt(receiptDTO, networkType); - case ReceiptType.Mosaic_Levy: - case ReceiptType.Mosaic_Rental_Fee: - case ReceiptType.Namespace_Rental_Fee: - return createBalanceTransferReceipt(receiptDTO, networkType); - case ReceiptType.Mosaic_Expired: - case ReceiptType.Namespace_Expired: - case ReceiptType.Namespace_Deleted: - return createArtifactExpiryReceipt(receiptDTO); - case ReceiptType.Inflation: - return createInflationReceipt(receiptDTO); - default: - throw new Error(`Receipt type: ${receiptDTO.type} not recognized.`); +const extractUnresolvedAddress = (unresolvedAddress: any): Address | NamespaceId => { + if (typeof unresolvedAddress === 'string') { + return UnresolvedMapping.toUnresolvedAddress(unresolvedAddress); + } else if (typeof unresolvedAddress === 'object') { // Is JSON object + if (unresolvedAddress.hasOwnProperty('address')) { + return Address.createFromRawAddress(unresolvedAddress.address); + } else if (unresolvedAddress.hasOwnProperty('id')) { + return NamespaceId.createFromEncoded(unresolvedAddress.id); + } } + throw new Error(`UnresolvedAddress: ${unresolvedAddress} type is not recognised`); }; /** @@ -114,23 +85,6 @@ const createResolutionStatement = (statementDTO, resolutionType): ResolutionStat } }; -/** - * @internal - * @param statementDTO - * @param networkType - * @returns {TransactionStatement} - * @constructor - */ -const createTransactionStatement = (statementDTO, networkType): TransactionStatement => { - return new TransactionStatement( - UInt64.fromNumericString(statementDTO.height), - new ReceiptSource(statementDTO.source.primaryId, statementDTO.source.secondaryId), - statementDTO.receipts.map((receipt) => { - return CreateReceiptFromDTO(receipt, networkType); - }), - ); -}; - /** * @internal * @param receiptDTO @@ -166,6 +120,24 @@ const createBalanceTransferReceipt = (receiptDTO, networkType): Receipt => { ); }; +/** + * @internal + * @param receiptType receipt type + * @param id Artifact id + * @returns {MosaicId | NamespaceId} + */ +const extractArtifactId = (receiptType: ReceiptType, id: string): MosaicId | NamespaceId => { + switch (receiptType) { + case ReceiptType.Mosaic_Expired: + return new MosaicId(id); + case ReceiptType.Namespace_Expired: + case ReceiptType.Namespace_Deleted: + return NamespaceId.createFromEncoded(id); + default: + throw new Error('Receipt type is not supported.'); + } +}; + /** * @internal * @param receiptDTO @@ -196,37 +168,65 @@ const createInflationReceipt = (receiptDTO): Receipt => { }; /** - * @internal - * @param receiptType receipt type - * @param id Artifact id - * @returns {MosaicId | NamespaceId} + * @param receiptDTO + * @param networkType + * @returns {Receipt} + * @constructor */ -const extractArtifactId = (receiptType: ReceiptType, id: string): MosaicId | NamespaceId => { - switch (receiptType) { +export const CreateReceiptFromDTO = (receiptDTO, networkType): Receipt => { + switch (receiptDTO.type) { + case ReceiptType.Harvest_Fee: + case ReceiptType.LockHash_Created: + case ReceiptType.LockHash_Completed: + case ReceiptType.LockHash_Expired: + case ReceiptType.LockSecret_Created: + case ReceiptType.LockSecret_Completed: + case ReceiptType.LockSecret_Expired: + return createBalanceChangeReceipt(receiptDTO, networkType); + case ReceiptType.Mosaic_Levy: + case ReceiptType.Mosaic_Rental_Fee: + case ReceiptType.Namespace_Rental_Fee: + return createBalanceTransferReceipt(receiptDTO, networkType); case ReceiptType.Mosaic_Expired: - return new MosaicId(id); case ReceiptType.Namespace_Expired: case ReceiptType.Namespace_Deleted: - return NamespaceId.createFromEncoded(id); + return createArtifactExpiryReceipt(receiptDTO); + case ReceiptType.Inflation: + return createInflationReceipt(receiptDTO); default: - throw new Error('Receipt type is not supported.'); + throw new Error(`Receipt type: ${receiptDTO.type} not recognized.`); } }; /** - * @interal - * @param unresolvedAddress unresolved address - * @returns {Address | NamespaceId} + * @internal + * @param statementDTO + * @param networkType + * @returns {TransactionStatement} + * @constructor */ -const extractUnresolvedAddress = (unresolvedAddress: any): Address | NamespaceId => { - if (typeof unresolvedAddress === 'string') { - return UnresolvedMapping.toUnresolvedAddress(unresolvedAddress); - } else if (typeof unresolvedAddress === 'object') { // Is JSON object - if (unresolvedAddress.hasOwnProperty('address')) { - return Address.createFromRawAddress(unresolvedAddress.address); - } else if (unresolvedAddress.hasOwnProperty('id')) { - return NamespaceId.createFromEncoded(unresolvedAddress.id); - } - } - throw new Error(`UnresolvedAddress: ${unresolvedAddress} type is not recognised`); +const createTransactionStatement = (statementDTO, networkType): TransactionStatement => { + return new TransactionStatement( + UInt64.fromNumericString(statementDTO.height), + new ReceiptSource(statementDTO.source.primaryId, statementDTO.source.secondaryId), + statementDTO.receipts.map((receipt) => { + return CreateReceiptFromDTO(receipt, networkType); + }), + ); +}; + +/** + * @param receiptDTO + * @param networkType + * @returns {Statement} + * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.h + * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.cpp + * @constructor + */ +export const CreateStatementFromDTO = (receiptDTO, networkType): Statement => { + return new Statement( + receiptDTO.transactionStatements.map((statement) => createTransactionStatement(statement.statement, networkType)), + receiptDTO.addressResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Address)), + receiptDTO.mosaicResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Mosaic)), + ); }; diff --git a/src/infrastructure/templates/api-single.mustache b/src/infrastructure/templates/api-single.mustache index 8588e38bc8..3894c241dc 100755 --- a/src/infrastructure/templates/api-single.mustache +++ b/src/infrastructure/templates/api-single.mustache @@ -31,8 +31,8 @@ let defaultBasePath = '{{{basePath}}}'; {{#operations}} {{#description}} /** -* {{&description}} -*/ + * {{&description}} + */ {{/description}} export enum {{classname}}ApiKeys { {{#authMethods}} diff --git a/src/infrastructure/templates/model.mustache b/src/infrastructure/templates/model.mustache index 0b3ca75891..3a3a1a3918 100755 --- a/src/infrastructure/templates/model.mustache +++ b/src/infrastructure/templates/model.mustache @@ -57,7 +57,7 @@ export namespace {{classname}} { export enum {{enumName}} { {{#allowableValues}} {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} {{/enumVars}} {{/allowableValues}} } diff --git a/src/model/blockchain/MerkleProofInfo.ts b/src/model/blockchain/MerkleProofInfo.ts index 18314665d8..86df7da991 100644 --- a/src/model/blockchain/MerkleProofInfo.ts +++ b/src/model/blockchain/MerkleProofInfo.ts @@ -1,4 +1,4 @@ -import { MerklePathItem } from "./MerklePathItem"; +import { MerklePathItem } from './MerklePathItem'; /* * Copyright 2019 NEM diff --git a/src/model/receipt/BalanceTransferReceipt.ts b/src/model/receipt/BalanceTransferReceipt.ts index 1442fe3e82..a1e2416028 100644 --- a/src/model/receipt/BalanceTransferReceipt.ts +++ b/src/model/receipt/BalanceTransferReceipt.ts @@ -15,7 +15,7 @@ */ import { Convert } from '../../core/format/Convert'; -import { UnresolvedMapping } from "../../core/utils/UnresolvedMapping"; +import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; diff --git a/src/model/transaction/SignedTransaction.ts b/src/model/transaction/SignedTransaction.ts index aade32582c..e8a9010d8d 100644 --- a/src/model/transaction/SignedTransaction.ts +++ b/src/model/transaction/SignedTransaction.ts @@ -17,7 +17,7 @@ import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; import {NetworkType} from '../blockchain/NetworkType'; -import { TransactionType } from "./TransactionType"; +import { TransactionType } from './TransactionType'; /** * SignedTransaction object is used to transfer the transaction data and the signature to the server diff --git a/src/model/transaction/TransactionStatus.ts b/src/model/transaction/TransactionStatus.ts index d96569d544..d09689ad2f 100644 --- a/src/model/transaction/TransactionStatus.ts +++ b/src/model/transaction/TransactionStatus.ts @@ -24,28 +24,28 @@ export class TransactionStatus { /** * @param group - * @param status + * @param code * @param hash * @param deadline * @param height */ constructor( - /** - * The transaction status being the error name in case of failure and success otherwise. - */ - public readonly status: string, /** * The transaction status group "failed", "unconfirmed", "confirmed", etc... */ - public readonly group?: string, + public readonly group: string, /** * The transaction hash. */ - public readonly hash?: string, + public readonly hash: string, /** * The transaction deadline. */ - public readonly deadline?: Deadline, + public readonly deadline: Deadline, + /** + * The transaction status code being the error name in case of failure and success otherwise. + */ + public readonly code?: string, /** * The height of the block at which it was confirmed or rejected. */ diff --git a/src/model/transaction/TransactionStatusError.ts b/src/model/transaction/TransactionStatusError.ts index b94f7e735c..313695bd4f 100644 --- a/src/model/transaction/TransactionStatusError.ts +++ b/src/model/transaction/TransactionStatusError.ts @@ -14,8 +14,8 @@ * limitations under the License. */ +import {Address} from '../account/Address'; import {Deadline} from './Deadline'; -import {Address} from "../account/Address"; /** * Transaction status error model returned by listeners diff --git a/src/service/AggregateTransactionService.ts b/src/service/AggregateTransactionService.ts index 4b278f54ef..0993ab6a1c 100644 --- a/src/service/AggregateTransactionService.ts +++ b/src/service/AggregateTransactionService.ts @@ -17,13 +17,13 @@ import { from as observableFrom, Observable, of as observableOf } from 'rxjs'; import { flatMap, map, mergeMap, toArray } from 'rxjs/operators'; import { TransactionMapping } from '../core/utils/TransactionMapping'; +import { MultisigRepository } from '../infrastructure/MultisigRepository'; import { MultisigAccountGraphInfo } from '../model/account/MultisigAccountGraphInfo'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; import { InnerTransaction } from '../model/transaction/InnerTransaction'; import { MultisigAccountModificationTransaction } from '../model/transaction/MultisigAccountModificationTransaction'; import { SignedTransaction } from '../model/transaction/SignedTransaction'; import { TransactionType } from '../model/transaction/TransactionType'; -import { MultisigRepository } from "../infrastructure/MultisigRepository"; /** * Aggregated Transaction service diff --git a/src/service/MetadataTransactionService.ts b/src/service/MetadataTransactionService.ts index 17b9da7d35..dc4d1acf5c 100644 --- a/src/service/MetadataTransactionService.ts +++ b/src/service/MetadataTransactionService.ts @@ -17,7 +17,7 @@ import { Observable, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { Convert } from '../core/format/Convert'; -import { MetadataHttp } from '../infrastructure/MetadataHttp'; +import { MetadataRepository } from '../infrastructure/MetadataRepository'; import { Address } from '../model/account/Address'; import { PublicAccount } from '../model/account/PublicAccount'; import { NetworkType } from '../model/blockchain/NetworkType'; @@ -29,9 +29,7 @@ import { AccountMetadataTransaction } from '../model/transaction/AccountMetadata import { Deadline } from '../model/transaction/Deadline'; import { MosaicMetadataTransaction } from '../model/transaction/MosaicMetadataTransaction'; import { NamespaceMetadataTransaction } from '../model/transaction/NamespaceMetadataTransaction'; -import { Transaction } from '../model/transaction/Transaction'; import { UInt64 } from '../model/UInt64'; -import { MetadataRepository } from "../infrastructure/MetadataRepository"; /** * MetadataTransaction service diff --git a/src/service/MosaicRestrictionTransactionService.ts b/src/service/MosaicRestrictionTransactionService.ts index fc3e48e45d..028f1aad6f 100644 --- a/src/service/MosaicRestrictionTransactionService.ts +++ b/src/service/MosaicRestrictionTransactionService.ts @@ -16,9 +16,11 @@ import { Observable, of } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs/operators'; +import { RestrictionMosaicRepository } from '../infrastructure/RestrictionMosaicRepository'; import { Address } from '../model/account/Address'; import { NetworkType } from '../model/blockchain/NetworkType'; import { MosaicId } from '../model/mosaic/MosaicId'; +import { NamespaceId } from '../model/namespace/NamespaceId'; import { MosaicGlobalRestriction } from '../model/restriction/MosaicGlobalRestriction'; import { MosaicGlobalRestrictionItem } from '../model/restriction/MosaicGlobalRestrictionItem'; import { MosaicRestrictionType } from '../model/restriction/MosaicRestrictionType'; @@ -27,8 +29,6 @@ import { MosaicAddressRestrictionTransaction } from '../model/transaction/Mosaic import { MosaicGlobalRestrictionTransaction } from '../model/transaction/MosaicGlobalRestrictionTransaction'; import { Transaction } from '../model/transaction/Transaction'; import { UInt64 } from '../model/UInt64'; -import { RestrictionMosaicRepository } from "../infrastructure/RestrictionMosaicRepository"; -import { NamespaceId } from "../model/namespace/NamespaceId"; /** * MosaicRestrictionTransactionService service @@ -114,7 +114,8 @@ export class MosaicRestrictionTransactionService { } return this.getAddressRestrictionEntry(mosaicId, restrictionKey, targetAddress).pipe( map((optionalValue) => { - const currentValue = optionalValue ? UInt64.fromNumericString(optionalValue) : this.defaultMosaicAddressRestrictionValue; + const currentValue = optionalValue ? + UInt64.fromNumericString(optionalValue) : this.defaultMosaicAddressRestrictionValue; return MosaicAddressRestrictionTransaction.create( deadline, mosaicId, diff --git a/src/service/MosaicService.ts b/src/service/MosaicService.ts index 745e07b64b..9ef23510f5 100644 --- a/src/service/MosaicService.ts +++ b/src/service/MosaicService.ts @@ -16,16 +16,14 @@ import { Observable, of as observableOf } from 'rxjs'; import { map, mergeMap, toArray } from 'rxjs/operators'; -import { AccountHttp } from '../infrastructure/AccountHttp'; -import { MosaicHttp } from '../infrastructure/MosaicHttp'; +import { AccountRepository } from '../infrastructure/AccountRepository'; +import { MosaicRepository } from '../infrastructure/MosaicRepository'; import { Address } from '../model/account/Address'; import { MosaicInfo } from '../model/model'; import { Mosaic } from '../model/mosaic/Mosaic'; import { MosaicId } from '../model/mosaic/MosaicId'; import { MosaicAmountView } from './MosaicAmountView'; import { MosaicView } from './MosaicView'; -import { AccountRepository } from "../infrastructure/AccountRepository"; -import { MosaicRepository } from "../infrastructure/MosaicRepository"; /** * Mosaic service @@ -50,7 +48,7 @@ export class MosaicService { mosaicsView(mosaicIds: MosaicId[]): Observable { return observableOf(mosaicIds).pipe( mergeMap((_) => this.mosaicRepository.getMosaics(mosaicIds).pipe( - mergeMap((_) => _), + mergeMap((info) => info), map((mosaicInfo: MosaicInfo) => { return new MosaicView(mosaicInfo); }), diff --git a/src/service/NamespaceService.ts b/src/service/NamespaceService.ts index 66337732ae..c7f18bc1fa 100644 --- a/src/service/NamespaceService.ts +++ b/src/service/NamespaceService.ts @@ -16,11 +16,11 @@ import { Observable } from 'rxjs'; import { map, mergeMap } from 'rxjs/operators'; +import { NamespaceRepository } from '../infrastructure/NamespaceRepository'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { NamespaceInfo } from '../model/namespace/NamespaceInfo'; import { NamespaceName } from '../model/namespace/NamespaceName'; import { Namespace } from './Namespace'; -import { NamespaceRepository } from "../infrastructure/NamespaceRepository"; /** * Namespace service diff --git a/src/service/TransactionService.ts b/src/service/TransactionService.ts index b3ece0259a..b443e01ffb 100644 --- a/src/service/TransactionService.ts +++ b/src/service/TransactionService.ts @@ -17,6 +17,8 @@ import { Observable, of } from 'rxjs'; import { flatMap, map, mergeMap, toArray } from 'rxjs/operators'; import { IListener } from '../infrastructure/IListener'; +import { ReceiptRepository } from '../infrastructure/ReceiptRepository'; +import { TransactionRepository } from '../infrastructure/TransactionRepository'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { AccountAddressRestrictionTransaction } from '../model/transaction/AccountAddressRestrictionTransaction'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; @@ -32,8 +34,6 @@ import { Transaction } from '../model/transaction/Transaction'; import { TransactionType } from '../model/transaction/TransactionType'; import { TransferTransaction } from '../model/transaction/TransferTransaction'; import { ITransactionService } from './interfaces/ITransactionService'; -import { TransactionRepository } from "../infrastructure/TransactionRepository"; -import { ReceiptRepository } from "../infrastructure/ReceiptRepository"; /** * Transaction Service diff --git a/test/core/utils/UnresolvedMapping.spec.ts b/test/core/utils/UnresolvedMapping.spec.ts index 19b64d1373..d8df75651f 100644 --- a/test/core/utils/UnresolvedMapping.spec.ts +++ b/test/core/utils/UnresolvedMapping.spec.ts @@ -17,7 +17,7 @@ import { expect } from 'chai'; import { Convert, RawAddress } from '../../../src/core/format'; import { UnresolvedMapping } from '../../../src/core/utils/UnresolvedMapping'; import { Address } from '../../../src/model/account/Address'; -import { NetworkType } from "../../../src/model/blockchain/NetworkType"; +import { NetworkType } from '../../../src/model/blockchain/NetworkType'; import { MosaicId } from '../../../src/model/mosaic/MosaicId'; import { NamespaceId } from '../../../src/model/namespace/NamespaceId'; diff --git a/test/infrastructure/Listener.spec.ts b/test/infrastructure/Listener.spec.ts index f6aa178479..0d0ba57b08 100644 --- a/test/infrastructure/Listener.spec.ts +++ b/test/infrastructure/Listener.spec.ts @@ -14,13 +14,12 @@ * limitations under the License. */ +import { deepEqual } from 'assert'; import { expect } from 'chai'; import { Listener } from '../../src/infrastructure/Listener'; -import { Address } from "../../src/model/account/Address"; -import { deepEqual } from "assert"; -import { UInt64 } from "../../src/model/UInt64"; -import { timeout } from "rxjs/operators"; -import { TransactionStatusError } from "../../src/model/transaction/TransactionStatusError"; +import { Address } from '../../src/model/account/Address'; +import { TransactionStatusError } from '../../src/model/transaction/TransactionStatusError'; +import { UInt64 } from '../../src/model/UInt64'; describe('Listener', () => { it('should createComplete a WebSocket instance given url parameter', () => { @@ -40,7 +39,6 @@ describe('Listener', () => { describe('onStatusWhenAddressIsTheSame', () => { it('Should forward status', () => { - const errorEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96860EB'; const errorAddress = Address.createFromEncoded(errorEncodedAddress); @@ -67,8 +65,8 @@ describe('Listener', () => { const reportedStatus = new Array(); - listener.status(errorAddress).subscribe((transactionStatusError) => { - reportedStatus.push(transactionStatusError); + listener.status(errorAddress).subscribe((error) => { + reportedStatus.push(error); }); listener.handleMessage(statusInfoErrorDTO, null); @@ -80,24 +78,21 @@ describe('Listener', () => { expect(transactionStatusError.status).to.be.equal(statusInfoErrorDTO.status); deepEqual(transactionStatusError.deadline.toDTO(), UInt64.fromNumericString(statusInfoErrorDTO.deadline).toDTO()); - }); }); describe('onStatusWhenAddressIsDifferentAddress', () => { it('Should not forward status', () => { - const errorEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96860EB'; const subscribedEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96AAAAA'; const subscribedAddress = Address.createFromEncoded(subscribedEncodedAddress); + // tslint:disable-next-line: max-classes-per-file class WebSocketMock { - constructor(public readonly url: string) { } - send(payload: string) { expect(payload).to.be.eq(`{"subscribe":"status/${subscribedAddress.plain()}"}`); } @@ -121,9 +116,8 @@ describe('Listener', () => { }); listener.handleMessage(statusInfoErrorDTO, null); - - expect(reportedStatus.length).to.be.equal(0); + expect(reportedStatus.length).to.be.equal(0); }); }); @@ -132,7 +126,7 @@ describe('Listener', () => { it('should reject because of wrong server url', async () => { const listener = new Listener('https://notcorrecturl:0000'); await listener.open() - .then((result) => { + .then(() => { throw new Error('This should not be called when expecting error'); }) .catch((error) => { diff --git a/test/infrastructure/RepositoryFactory.spec.ts b/test/infrastructure/RepositoryFactory.spec.ts index 6199559a27..84abc86afe 100644 --- a/test/infrastructure/RepositoryFactory.spec.ts +++ b/test/infrastructure/RepositoryFactory.spec.ts @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { expect } from "chai"; -import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp"; -import { BlockRepository } from "../../src/infrastructure/BlockRepository"; -import { instance, mock, when } from "ts-mockito"; -import { BlockInfo } from "../../src/model/blockchain/BlockInfo"; +import { expect } from 'chai'; import { of as observableOf } from 'rxjs'; -import { map } from "rxjs/operators"; -import { NetworkRepository } from "../../src/infrastructure/NetworkRepository"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; +import { map } from 'rxjs/operators'; +import { instance, mock, when } from 'ts-mockito'; +import { BlockRepository } from '../../src/infrastructure/BlockRepository'; +import { NetworkRepository } from '../../src/infrastructure/NetworkRepository'; +import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp'; +import { BlockInfo } from '../../src/model/blockchain/BlockInfo'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; describe('RepositoryFactory', () => { it('Should create repositories', () => { - const repositoryFactory = new RepositoryFactoryHttp("http://localhost:3000"); + const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000', NetworkType.MIJIN_TEST, 'testHash'); expect(repositoryFactory.createBlockRepository()).to.be.not.null; expect(repositoryFactory.createNetworkRepository()).to.be.not.null; @@ -47,49 +47,42 @@ describe('RepositoryFactory', () => { it('Should get GenerationHash from cache', (done) => { let counter = 0; - const repositoryMock: BlockRepository = mock(); - - const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map(v => { + const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map((v) => { counter++; return v; })); when(repositoryMock.getBlockByHeight('1')).thenReturn(observableOfBlockInfo); - expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); - const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { createBlockRepository(): BlockRepository { return instance(repositoryMock); } - })("http://localhost:3000"); + })('http://localhost:3000', NetworkType.MIJIN_TEST); expect(counter).to.be.equals(0); - repositoryFactory.getGenerationHash().subscribe(gh => { + repositoryFactory.getGenerationHash().subscribe((gh) => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); - repositoryFactory.getGenerationHash().subscribe(gh => { + repositoryFactory.getGenerationHash().subscribe((g) => { expect(counter).to.be.equals(1); - expect(gh).to.be.equals('aaaa'); - repositoryFactory.getGenerationHash().subscribe(gh => { + expect(g).to.be.equals('aaaa'); + repositoryFactory.getGenerationHash().subscribe((h) => { expect(counter).to.be.equals(1); - expect(gh).to.be.equals('aaaa'); + expect(h).to.be.equals('aaaa'); done(); - }) - }) - }) - + }); + }); + }); }); it('Should get NetworkType from cache', (done) => { let counter = 0; - const repositoryMock: NetworkRepository = mock(); - - let expectedNetworkType = NetworkType.MIJIN_TEST; - const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map(v => { + const expectedNetworkType = NetworkType.MIJIN_TEST; + const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; return v; })); @@ -97,23 +90,24 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); + // tslint:disable-next-line: max-classes-per-file const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })("http://localhost:3000"); + })('http://localhost:3000', undefined, 'testHash'); expect(counter).to.be.equals(0); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((network) => { expect(counter).to.be.equals(1); - expect(networkType).to.be.equals(expectedNetworkType); + expect(network).to.be.equals(expectedNetworkType); done(); - }) - }) + }); + }); }); @@ -123,8 +117,8 @@ describe('RepositoryFactory', () => { const repositoryMock: NetworkRepository = mock(); - let expectedNetworkType = NetworkType.MIJIN_TEST; - const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map(v => { + const expectedNetworkType = NetworkType.MIJIN_TEST; + const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; return v; })); @@ -132,23 +126,23 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); + // tslint:disable-next-line: max-classes-per-file const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { - createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })("http://localhost:3000", expectedNetworkType); + })('http://localhost:3000', expectedNetworkType, 'testHash'); expect(counter).to.be.equals(0); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((network) => { expect(counter).to.be.equals(0); - expect(networkType).to.be.equals(expectedNetworkType); + expect(network).to.be.equals(expectedNetworkType); done(); - }) - }) + }); + }); }); diff --git a/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts b/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts index 8c38aa5651..9d84277290 100644 --- a/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts +++ b/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts @@ -21,8 +21,6 @@ import {Account} from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; import { MosaicId } from '../../../src/model/mosaic/MosaicId'; -import { AddressAlias } from '../../../src/model/namespace/AddressAlias'; -import { MosaicAlias } from '../../../src/model/namespace/MosaicAlias'; import { NamespaceId } from '../../../src/model/namespace/NamespaceId'; import { ReceiptType } from '../../../src/model/receipt/ReceiptType'; import { UInt64 } from '../../../src/model/UInt64'; diff --git a/test/model/account/Address.spec.ts b/test/model/account/Address.spec.ts index fffe493f28..6bec2ff4d5 100644 --- a/test/model/account/Address.spec.ts +++ b/test/model/account/Address.spec.ts @@ -15,10 +15,9 @@ */ import { expect } from 'chai'; +import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; -import { Convert as convert, RawAddress } from "../../../src/core/format"; -import { Account } from "../../../src/model/account/Account"; const Address_Decoded_Size = 25; @@ -128,20 +127,23 @@ describe('Address', () => { }); it('It creates the address from an encoded value', () => { - let encoded = '917E7E29A01014C2F300000000000000000000000000000000'; + const encoded = '917E7E29A01014C2F300000000000000000000000000000000'; const address = Address.createFromEncoded(encoded); expect(address.encoded()).to.be.equal(encoded); }); describe('isValidRawAddress', () => { - it('returns true for valid address when generated', () => { // Assert: - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MIJIN_TEST).address.plain(), NetworkType.MIJIN_TEST)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MAIN_NET).address.plain(), NetworkType.MAIN_NET)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MIJIN).address.plain(), NetworkType.MIJIN)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.TEST_NET).address.plain(), NetworkType.TEST_NET)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MIJIN_TEST).address.plain(), NetworkType.MIJIN_TEST)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MAIN_NET).address.plain(), NetworkType.MAIN_NET)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MIJIN).address.plain(), NetworkType.MIJIN)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.TEST_NET).address.plain(), NetworkType.TEST_NET)).to.equal(true); }); it('returns true for valid address', () => { @@ -181,10 +183,14 @@ describe('Address', () => { it('returns true for valid address when generated', () => { // Assert: - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MIJIN_TEST).address.encoded(), NetworkType.MIJIN_TEST)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MAIN_NET).address.encoded(), NetworkType.MAIN_NET)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MIJIN).address.encoded(), NetworkType.MIJIN)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.TEST_NET).address.encoded(), NetworkType.TEST_NET)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MIJIN_TEST).address.encoded(), NetworkType.MIJIN_TEST)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MAIN_NET).address.encoded(), NetworkType.MAIN_NET)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MIJIN).address.encoded(), NetworkType.MIJIN)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.TEST_NET).address.encoded(), NetworkType.TEST_NET)).to.equal(true); }); it('returns true for valid encoded address', () => { diff --git a/test/model/transaction/HashLockTransaction.spec.ts b/test/model/transaction/HashLockTransaction.spec.ts index 03bcf563fe..70df873a44 100644 --- a/test/model/transaction/HashLockTransaction.spec.ts +++ b/test/model/transaction/HashLockTransaction.spec.ts @@ -14,6 +14,7 @@ * limitations under the License. */ import {expect} from 'chai'; +import {Convert} from '../../../src/core/format'; import {NetworkType} from '../../../src/model/blockchain/NetworkType'; import { NetworkCurrencyMosaic } from '../../../src/model/mosaic/NetworkCurrencyMosaic'; import {AggregateTransaction} from '../../../src/model/transaction/AggregateTransaction'; @@ -21,7 +22,6 @@ import {Deadline} from '../../../src/model/transaction/Deadline'; import {HashLockTransaction} from '../../../src/model/transaction/HashLockTransaction'; import {UInt64} from '../../../src/model/UInt64'; import {TestingAccount} from '../../conf/conf.spec'; -import {Convert} from "../../../src/core/format"; describe('HashLockTransaction', () => { const account = TestingAccount; diff --git a/test/model/transaction/TransactionStatus.spec.ts b/test/model/transaction/TransactionStatus.spec.ts index f0ac87f8a6..55a2b31464 100644 --- a/test/model/transaction/TransactionStatus.spec.ts +++ b/test/model/transaction/TransactionStatus.spec.ts @@ -16,6 +16,7 @@ import {deepEqual} from 'assert'; import {expect} from 'chai'; +import { TransactionStatusTypeEnum } from '../../../src/infrastructure/model/transactionStatusTypeEnum'; import {Deadline} from '../../../src/model/transaction/Deadline'; import {TransactionStatus} from '../../../src/model/transaction/TransactionStatus'; import {UInt64} from '../../../src/model/UInt64'; @@ -27,19 +28,19 @@ describe('TransactionStatus', () => { group: 'confirmed', hash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219', height: new UInt64([ 1, 0 ]), - status: 'Success', + code: TransactionStatusTypeEnum.Success, }; const transactionStatus = new TransactionStatus( - transactionStatusDTO.status, transactionStatusDTO.group, transactionStatusDTO.hash, transactionStatusDTO.deadline, + transactionStatusDTO.code, transactionStatusDTO.height, ); expect(transactionStatus.group).to.be.equal(transactionStatusDTO.group); - expect(transactionStatus.status).to.be.equal(transactionStatusDTO.status); + expect(transactionStatus.code).to.be.equal(transactionStatusDTO.code); expect(transactionStatus.hash).to.be.equal(transactionStatusDTO.hash); deepEqual(transactionStatus.deadline, transactionStatusDTO.deadline); deepEqual(transactionStatus.height, transactionStatusDTO.height); diff --git a/test/model/transaction/TransactionStatusError.spec.ts b/test/model/transaction/TransactionStatusError.spec.ts index 156c3f902b..b7fcc61867 100644 --- a/test/model/transaction/TransactionStatusError.spec.ts +++ b/test/model/transaction/TransactionStatusError.spec.ts @@ -16,10 +16,10 @@ import {deepEqual} from 'assert'; import {expect} from 'chai'; -import {TransactionStatusError} from '../../../src/model/transaction/TransactionStatusError'; +import {Address} from '../../../src/model/account/Address'; import {Deadline} from '../../../src/model/transaction/Deadline'; +import {TransactionStatusError} from '../../../src/model/transaction/TransactionStatusError'; import { UInt64 } from '../../../src/model/UInt64'; -import {Address} from "../../../src/model/account/Address"; describe('TransactionStatusError', () => { diff --git a/test/service/MosaicService.spec.ts b/test/service/MosaicService.spec.ts index 6508e006e5..d1fa62292d 100644 --- a/test/service/MosaicService.spec.ts +++ b/test/service/MosaicService.spec.ts @@ -18,6 +18,7 @@ import {expect} from 'chai'; import {AccountHttp} from '../../src/infrastructure/AccountHttp'; import {MosaicHttp} from '../../src/infrastructure/MosaicHttp'; import {Address} from '../../src/model/account/Address'; +import { NetworkType } from '../../src/model/model'; import {Mosaic} from '../../src/model/mosaic/Mosaic'; import {MosaicId} from '../../src/model/mosaic/MosaicId'; import {MosaicInfo} from '../../src/model/mosaic/MosaicInfo'; @@ -31,7 +32,7 @@ describe('MosaicService', () => { it('mosaicsView', () => { const mosaicId = new MosaicId([3294802500, 2243684972]); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsView([mosaicId]).subscribe((mosaicsView: MosaicView[]) => { const mosaicView = mosaicsView[0]; expect(mosaicView.mosaicInfo).to.be.an.instanceof(MosaicInfo); @@ -41,7 +42,7 @@ describe('MosaicService', () => { it('mosaicsView of no existing mosaicId', () => { const mosaicId = new MosaicId([1234, 1234]); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsView([mosaicId]).subscribe((mosaicsView: MosaicView[]) => { expect(mosaicsView.length).to.be.equal(0); }); @@ -49,7 +50,7 @@ describe('MosaicService', () => { it('mosaicsAmountView', () => { const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountViewFromAddress(Address.createFromRawAddress('SARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJETM3ZSP')) .subscribe((mosaicsAmountView: MosaicAmountView[]) => { const mosaicAmountView = mosaicsAmountView[0]; @@ -59,7 +60,7 @@ describe('MosaicService', () => { it('mosaicsAmountView of no existing account', () => { const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountViewFromAddress(Address.createFromRawAddress('SCKBZAMIQ6F46QMZUANE6E33KA63KA7KEQ5X6WJW')) .subscribe((mosaicsAmountView: MosaicAmountView[]) => { expect(mosaicsAmountView.length).to.be.equal(0); @@ -69,7 +70,7 @@ describe('MosaicService', () => { it('mosaicsAmountView', () => { const mosaic = new Mosaic(new MosaicId([3646934825, 3576016193]), UInt64.fromUint(1000)); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountView([mosaic]).subscribe((mosaicsAmountView: MosaicAmountView[]) => { const mosaicAmountView = mosaicsAmountView[0]; expect(mosaicAmountView.mosaicInfo).to.be.an.instanceof(MosaicInfo); From 7314c6216ee43eff0c1d37b7a2dc39b546002c57 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 21:44:13 +0000 Subject: [PATCH 15/22] Fixed #397 - Applied openAPI 0.7.20.6 --- e2e/infrastructure/AccountHttp.spec.ts | 16 +- e2e/infrastructure/BlockHttp.spec.ts | 13 +- e2e/infrastructure/ChainHttp.spec.ts | 7 +- e2e/infrastructure/DiagnosticHttp.spec.ts | 7 +- e2e/infrastructure/IntegrationTestHelper.ts | 55 ++--- e2e/infrastructure/Listener.spec.ts | 84 ++++---- e2e/infrastructure/MetadataHttp.spec.ts | 21 +- e2e/infrastructure/MosaicHttp.spec.ts | 15 +- e2e/infrastructure/NamespaceHttp.spec.ts | 11 +- e2e/infrastructure/NetworkHttp.spec.ts | 4 +- e2e/infrastructure/NodeHttp.spec.ts | 4 +- e2e/infrastructure/RestrictionHttp.spec.ts | 8 +- e2e/infrastructure/TransactionHttp.spec.ts | 188 +++++++++--------- e2e/infrastructure/UnresolvedMapping.spec.ts | 9 +- .../MetadataTransactionService.spec.ts | 25 ++- ...osaicRestrictionTransactionService.spec.ts | 26 +-- e2e/service/MosaicService.spec.ts | 6 +- e2e/service/TransactionService.spec.ts | 39 ++-- ...TransactionService_AggregateBonded.spec.ts | 37 ++-- package-lock.json | 172 +++++++--------- package.json | 12 +- src/infrastructure/AccountHttp.ts | 21 +- src/infrastructure/BlockHttp.ts | 22 +- src/infrastructure/Http.ts | 5 +- src/infrastructure/Listener.ts | 16 +- src/infrastructure/MetadataHttp.ts | 9 +- src/infrastructure/QueryParams.ts | 7 +- src/infrastructure/RepositoryFactory.ts | 37 ++-- src/infrastructure/RepositoryFactoryHttp.ts | 78 ++++---- src/infrastructure/RestrictionMosaicHttp.ts | 4 +- src/infrastructure/TransactionHttp.ts | 21 +- src/infrastructure/api.ts | 2 +- src/infrastructure/api/accountRoutesApi.ts | 118 ++++++----- src/infrastructure/api/apis.ts | 2 +- src/infrastructure/api/blockRoutesApi.ts | 14 +- src/infrastructure/api/chainRoutesApi.ts | 2 +- src/infrastructure/api/diagnosticRoutesApi.ts | 2 +- src/infrastructure/api/metadataRoutesApi.ts | 2 +- src/infrastructure/api/mosaicRoutesApi.ts | 2 +- src/infrastructure/api/multisigRoutesApi.ts | 2 +- src/infrastructure/api/namespaceRoutesApi.ts | 2 +- src/infrastructure/api/networkRoutesApi.ts | 2 +- src/infrastructure/api/nodeRoutesApi.ts | 2 +- src/infrastructure/api/receiptRoutesApi.ts | 6 +- .../api/restrictionAccountRoutesApi.ts | 2 +- .../api/restrictionMosaicRoutesApi.ts | 2 +- .../api/transactionRoutesApi.ts | 2 +- ...untAddressRestrictionTransactionBodyDTO.ts | 2 +- ...accountAddressRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/accountDTO.ts | 2 +- src/infrastructure/model/accountIds.ts | 2 +- src/infrastructure/model/accountInfoDTO.ts | 2 +- .../model/accountLinkActionEnum.ts | 13 +- .../model/accountLinkTransactionBodyDTO.ts | 2 +- .../model/accountLinkTransactionDTO.ts | 2 +- .../accountMetadataTransactionBodyDTO.ts | 2 +- .../model/accountMetadataTransactionDTO.ts | 2 +- ...ountMosaicRestrictionTransactionBodyDTO.ts | 2 +- .../accountMosaicRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/accountNamesDTO.ts | 2 +- ...tOperationRestrictionTransactionBodyDTO.ts | 2 +- ...countOperationRestrictionTransactionDTO.ts | 2 +- .../model/accountRestrictionDTO.ts | 2 +- .../model/accountRestrictionFlagsEnum.ts | 33 +-- .../model/accountRestrictionsDTO.ts | 2 +- .../model/accountRestrictionsInfoDTO.ts | 2 +- src/infrastructure/model/accountTypeEnum.ts | 20 +- src/infrastructure/model/accountsNamesDTO.ts | 2 +- src/infrastructure/model/activityBucketDTO.ts | 2 +- .../model/addressAliasTransactionBodyDTO.ts | 2 +- .../model/addressAliasTransactionDTO.ts | 2 +- .../model/aggregateTransactionBodyDTO.ts | 2 +- .../model/aggregateTransactionDTO.ts | 2 +- src/infrastructure/model/aliasActionEnum.ts | 12 +- src/infrastructure/model/aliasDTO.ts | 2 +- src/infrastructure/model/aliasTypeEnum.ts | 15 +- .../model/announceTransactionInfoDTO.ts | 2 +- .../model/artifactExpiryReceiptDTO.ts | 65 ------ .../model/balanceChangeReceiptDTO.ts | 2 +- .../model/balanceChangeReceiptDTOAllOf.ts | 2 +- .../model/balanceTransferReceiptDTO.ts | 2 +- .../model/balanceTransferReceiptDTOAllOf.ts | 2 +- src/infrastructure/model/blockDTO.ts | 2 +- src/infrastructure/model/blockDTOAllOf.ts | 2 +- src/infrastructure/model/blockInfoDTO.ts | 2 +- src/infrastructure/model/blockMetaDTO.ts | 2 +- src/infrastructure/model/chainScoreDTO.ts | 2 +- .../model/communicationTimestampsDTO.ts | 2 +- src/infrastructure/model/cosignature.ts | 2 +- src/infrastructure/model/cosignatureDTO.ts | 2 +- .../model/cosignatureDTOAllOf.ts | 2 +- ...AccountAddressRestrictionTransactionDTO.ts | 2 +- .../embeddedAccountLinkTransactionDTO.ts | 2 +- .../embeddedAccountMetadataTransactionDTO.ts | 2 +- ...dAccountMosaicRestrictionTransactionDTO.ts | 2 +- ...countOperationRestrictionTransactionDTO.ts | 2 +- .../embeddedAddressAliasTransactionDTO.ts | 2 +- .../model/embeddedHashLockTransactionDTO.ts | 2 +- ...dMosaicAddressRestrictionTransactionDTO.ts | 2 +- .../embeddedMosaicAliasTransactionDTO.ts | 2 +- .../embeddedMosaicDefinitionTransactionDTO.ts | 2 +- ...edMosaicGlobalRestrictionTransactionDTO.ts | 2 +- .../embeddedMosaicMetadataTransactionDTO.ts | 2 +- ...mbeddedMosaicSupplyChangeTransactionDTO.ts | 2 +- ...ltisigAccountModificationTransactionDTO.ts | 2 +- ...embeddedNamespaceMetadataTransactionDTO.ts | 2 +- ...ddedNamespaceRegistrationTransactionDTO.ts | 2 +- .../model/embeddedSecretLockTransactionDTO.ts | 2 +- .../embeddedSecretProofTransactionDTO.ts | 2 +- .../model/embeddedTransactionDTO.ts | 2 +- .../model/embeddedTransactionInfoDTO.ts | 2 +- .../model/embeddedTransactionMetaDTO.ts | 2 +- .../model/embeddedTransferTransactionDTO.ts | 2 +- src/infrastructure/model/entityDTO.ts | 2 +- .../model/hashLockTransactionBodyDTO.ts | 2 +- .../model/hashLockTransactionDTO.ts | 2 +- src/infrastructure/model/heightInfoDTO.ts | 2 +- .../model/inflationReceiptDTO.ts | 2 +- .../model/inflationReceiptDTOAllOf.ts | 2 +- .../model/lockHashAlgorithmEnum.ts | 20 +- src/infrastructure/model/merklePathItemDTO.ts | 2 +- .../model/merkleProofInfoDTO.ts | 2 +- src/infrastructure/model/messageDTO.ts | 2 +- src/infrastructure/model/messageTypeEnum.ts | 14 +- src/infrastructure/model/metadataDTO.ts | 2 +- .../model/metadataEntriesDTO.ts | 2 +- src/infrastructure/model/metadataEntryDTO.ts | 2 +- src/infrastructure/model/metadataTypeEnum.ts | 15 +- src/infrastructure/model/modelError.ts | 2 +- src/infrastructure/model/models.ts | 6 + src/infrastructure/model/mosaic.ts | 2 +- .../model/mosaicAddressRestrictionDTO.ts | 2 +- .../model/mosaicAddressRestrictionEntryDTO.ts | 2 +- ...mosaicAddressRestrictionEntryWrapperDTO.ts | 2 +- ...aicAddressRestrictionTransactionBodyDTO.ts | 2 +- .../mosaicAddressRestrictionTransactionDTO.ts | 2 +- .../model/mosaicAliasTransactionBodyDTO.ts | 2 +- .../model/mosaicAliasTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicDTO.ts | 2 +- .../mosaicDefinitionTransactionBodyDTO.ts | 2 +- .../model/mosaicDefinitionTransactionDTO.ts | 2 +- .../model/mosaicExpiryReceiptDTO.ts | 2 +- .../model/mosaicExpiryReceiptDTOAllOf.ts | 2 +- .../model/mosaicGlobalRestrictionDTO.ts | 2 +- .../model/mosaicGlobalRestrictionEntryDTO.ts | 2 +- ...aicGlobalRestrictionEntryRestrictionDTO.ts | 2 +- .../mosaicGlobalRestrictionEntryWrapperDTO.ts | 2 +- ...saicGlobalRestrictionTransactionBodyDTO.ts | 2 +- .../mosaicGlobalRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicIds.ts | 2 +- src/infrastructure/model/mosaicInfoDTO.ts | 2 +- .../model/mosaicMetadataTransactionBodyDTO.ts | 2 +- .../model/mosaicMetadataTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicNamesDTO.ts | 2 +- .../model/mosaicRestrictionEntryTypeEnum.ts | 13 +- .../model/mosaicRestrictionTypeEnum.ts | 29 +-- .../model/mosaicSupplyChangeActionEnum.ts | 12 +- .../mosaicSupplyChangeTransactionBodyDTO.ts | 2 +- .../model/mosaicSupplyChangeTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicsInfoDTO.ts | 2 +- src/infrastructure/model/mosaicsNamesDTO.ts | 2 +- .../model/multisigAccountGraphInfoDTO.ts | 2 +- .../model/multisigAccountInfoDTO.ts | 2 +- ...igAccountModificationTransactionBodyDTO.ts | 2 +- ...ltisigAccountModificationTransactionDTO.ts | 2 +- src/infrastructure/model/multisigDTO.ts | 2 +- src/infrastructure/model/namespaceDTO.ts | 2 +- .../model/namespaceExpiryReceiptDTO.ts | 2 +- .../model/namespaceExpiryReceiptDTOAllOf.ts | 2 +- src/infrastructure/model/namespaceIds.ts | 2 +- src/infrastructure/model/namespaceInfoDTO.ts | 2 +- src/infrastructure/model/namespaceMetaDTO.ts | 2 +- .../namespaceMetadataTransactionBodyDTO.ts | 2 +- .../model/namespaceMetadataTransactionDTO.ts | 2 +- src/infrastructure/model/namespaceNameDTO.ts | 2 +- ...namespaceRegistrationTransactionBodyDTO.ts | 2 +- .../namespaceRegistrationTransactionDTO.ts | 2 +- .../model/namespaceRegistrationTypeEnum.ts | 12 +- src/infrastructure/model/namespacesInfoDTO.ts | 2 +- src/infrastructure/model/networkTypeDTO.ts | 2 +- src/infrastructure/model/networkTypeEnum.ts | 19 +- src/infrastructure/model/nodeInfoDTO.ts | 2 +- src/infrastructure/model/nodeTimeDTO.ts | 2 +- src/infrastructure/model/receiptDTO.ts | 2 +- src/infrastructure/model/receiptTypeEnum.ts | 55 +++-- .../model/resolutionEntryDTO.ts | 2 +- .../model/resolutionStatementBodyDTO.ts | 2 +- .../model/resolutionStatementDTO.ts | 2 +- src/infrastructure/model/rolesTypeEnum.ts | 16 +- .../model/secretLockTransactionBodyDTO.ts | 2 +- .../model/secretLockTransactionDTO.ts | 2 +- .../model/secretProofTransactionBodyDTO.ts | 2 +- .../model/secretProofTransactionDTO.ts | 2 +- src/infrastructure/model/serverDTO.ts | 2 +- src/infrastructure/model/serverInfoDTO.ts | 2 +- src/infrastructure/model/sourceDTO.ts | 2 +- src/infrastructure/model/statementsDTO.ts | 2 +- src/infrastructure/model/storageInfoDTO.ts | 2 +- .../model/transactionBodyDTO.ts | 2 +- src/infrastructure/model/transactionDTO.ts | 2 +- src/infrastructure/model/transactionHashes.ts | 2 +- src/infrastructure/model/transactionIds.ts | 2 +- .../model/transactionInfoDTO.ts | 2 +- .../model/transactionMetaDTO.ts | 2 +- .../model/transactionPayload.ts | 2 +- .../model/transactionStateTypeEnum.ts | 35 ++++ .../model/transactionStatementBodyDTO.ts | 2 +- .../model/transactionStatementDTO.ts | 2 +- .../model/transactionStatusDTO.ts | 20 +- .../model/transactionStatusTypeEnum.ts | 179 +++++++++++++++++ .../model/transactionTypeEnum.ts | 70 ++++--- .../model/transferTransactionBodyDTO.ts | 2 +- .../model/transferTransactionDTO.ts | 2 +- src/infrastructure/model/unresolvedMosaic.ts | 2 +- .../model/verifiableEntityDTO.ts | 2 +- .../receipt/CreateReceiptFromDTO.ts | 164 +++++++-------- .../templates/api-single.mustache | 4 +- src/infrastructure/templates/model.mustache | 2 +- src/model/blockchain/MerkleProofInfo.ts | 2 +- src/model/receipt/BalanceTransferReceipt.ts | 2 +- src/model/transaction/SignedTransaction.ts | 2 +- src/model/transaction/TransactionStatus.ts | 16 +- .../transaction/TransactionStatusError.ts | 2 +- src/service/AggregateTransactionService.ts | 2 +- src/service/MetadataTransactionService.ts | 4 +- .../MosaicRestrictionTransactionService.ts | 7 +- src/service/MosaicService.ts | 8 +- src/service/NamespaceService.ts | 2 +- src/service/TransactionService.ts | 4 +- test/core/utils/UnresolvedMapping.spec.ts | 2 +- test/infrastructure/Listener.spec.ts | 24 +-- test/infrastructure/RepositoryFactory.spec.ts | 34 ++-- .../receipt/CreateReceiptFromDTO.spec.ts | 2 - test/model/account/Address.spec.ts | 30 +-- .../transaction/HashLockTransaction.spec.ts | 2 +- .../transaction/TransactionStatus.spec.ts | 7 +- .../TransactionStatusError.spec.ts | 4 +- test/service/MosaicService.spec.ts | 11 +- 238 files changed, 1283 insertions(+), 1164 deletions(-) delete mode 100644 src/infrastructure/model/artifactExpiryReceiptDTO.ts create mode 100644 src/infrastructure/model/transactionStateTypeEnum.ts create mode 100644 src/infrastructure/model/transactionStatusTypeEnum.ts diff --git a/e2e/infrastructure/AccountHttp.spec.ts b/e2e/infrastructure/AccountHttp.spec.ts index 4d666e63ae..2335d2bab2 100644 --- a/e2e/infrastructure/AccountHttp.spec.ts +++ b/e2e/infrastructure/AccountHttp.spec.ts @@ -33,10 +33,10 @@ import { MultisigAccountModificationTransaction } from '../../src/model/transact import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('AccountHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -93,7 +93,7 @@ describe('AccountHttp', () => { [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -109,7 +109,7 @@ describe('AccountHttp', () => { namespaceName, UInt64.fromUint(9), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -265,7 +265,7 @@ describe('AccountHttp', () => { namespaceId, account.address, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -282,7 +282,7 @@ describe('AccountHttp', () => { [cosignAccount1.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const removeCosigner2 = MultisigAccountModificationTransaction.create( Deadline.create(), @@ -293,7 +293,7 @@ describe('AccountHttp', () => { cosignAccount2.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const removeCosigner3 = MultisigAccountModificationTransaction.create( @@ -305,7 +305,7 @@ describe('AccountHttp', () => { cosignAccount3.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), diff --git a/e2e/infrastructure/BlockHttp.spec.ts b/e2e/infrastructure/BlockHttp.spec.ts index 30e7e192ea..73356ba2a7 100644 --- a/e2e/infrastructure/BlockHttp.spec.ts +++ b/e2e/infrastructure/BlockHttp.spec.ts @@ -17,7 +17,9 @@ import { expect } from 'chai'; import { mergeMap } from 'rxjs/operators'; import { BlockHttp } from '../../src/infrastructure/BlockHttp'; +import { BlockRepository } from '../../src/infrastructure/BlockRepository'; import { QueryParams } from '../../src/infrastructure/QueryParams'; +import { ReceiptRepository } from '../../src/infrastructure/ReceiptRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; @@ -25,12 +27,10 @@ import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMos import { Deadline } from '../../src/model/transaction/Deadline'; import { TransactionInfo } from '../../src/model/transaction/TransactionInfo'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { BlockRepository } from "../../src/infrastructure/BlockRepository"; -import { ReceiptRepository } from "../../src/infrastructure/ReceiptRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('BlockHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let blockRepository: BlockRepository; @@ -68,7 +68,6 @@ describe('BlockHttp', () => { describe('Setup Test Data', () => { - it('Announce TransferTransaction', (done) => { const transferTransaction = TransferTransaction.create( Deadline.create(), @@ -76,10 +75,10 @@ describe('BlockHttp', () => { [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); - helper.announce(signedTransaction).then(transaction => { + helper.announce(signedTransaction).then((transaction) => { chainHeight = transaction.transactionInfo!.height.toString(); return transaction; }); diff --git a/e2e/infrastructure/ChainHttp.spec.ts b/e2e/infrastructure/ChainHttp.spec.ts index 53c3171900..59eb1984cd 100644 --- a/e2e/infrastructure/ChainHttp.spec.ts +++ b/e2e/infrastructure/ChainHttp.spec.ts @@ -15,12 +15,11 @@ */ import { expect } from 'chai'; -import { ChainHttp } from '../../src/infrastructure/ChainHttp'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { ChainRepository } from "../../src/infrastructure/ChainRepository"; +import { ChainRepository } from '../../src/infrastructure/ChainRepository'; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('ChainHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let chainRepository: ChainRepository; before(() => { diff --git a/e2e/infrastructure/DiagnosticHttp.spec.ts b/e2e/infrastructure/DiagnosticHttp.spec.ts index 419dbe29db..70e9dff83b 100644 --- a/e2e/infrastructure/DiagnosticHttp.spec.ts +++ b/e2e/infrastructure/DiagnosticHttp.spec.ts @@ -15,12 +15,11 @@ */ import { expect } from 'chai'; -import { DiagnosticHttp } from '../../src/infrastructure/DiagnosticHttp'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { DiagnosticRepository } from "../../src/infrastructure/DiagnosticRepository"; +import { DiagnosticRepository } from '../../src/infrastructure/DiagnosticRepository'; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('DiagnosticHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let diagnosticRepository: DiagnosticRepository; before(() => { diff --git a/e2e/infrastructure/IntegrationTestHelper.ts b/e2e/infrastructure/IntegrationTestHelper.ts index 8fc76c17fa..2e158f3bd4 100644 --- a/e2e/infrastructure/IntegrationTestHelper.ts +++ b/e2e/infrastructure/IntegrationTestHelper.ts @@ -13,21 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Account } from "../../src/model/account/Account"; -import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp"; -import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; -import { combineLatest } from "rxjs"; -import { IListener } from "../../src/infrastructure/IListener"; -import { SignedTransaction } from "../../src/model/transaction/SignedTransaction"; -import { filter } from "rxjs/operators"; -import { Transaction } from "../../src/model/transaction/Transaction"; -import { UInt64 } from "../../src/model/UInt64"; - -const yaml = require('js-yaml'); +import { combineLatest } from 'rxjs'; +import { filter } from 'rxjs/operators'; +import { IListener } from '../../src/infrastructure/IListener'; +import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory'; +import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp'; +import { Account } from '../../src/model/account/Account'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; +import { SignedTransaction } from '../../src/model/transaction/SignedTransaction'; +import { Transaction } from '../../src/model/transaction/Transaction'; +import { UInt64 } from '../../src/model/UInt64'; export class IntegrationTestHelper { - + public readonly yaml = require('js-yaml'); public apiUrl: string; public repositoryFactory: RepositoryFactory; public account: Account; @@ -57,7 +55,8 @@ export class IntegrationTestHelper { console.log(`Running tests against: ${json.apiUrl}`); this.apiUrl = json.apiUrl; this.repositoryFactory = new RepositoryFactoryHttp(json.apiUrl); - combineLatest(this.repositoryFactory.getGenerationHash(), this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => { + combineLatest(this.repositoryFactory.getGenerationHash(), + this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => { this.networkType = networkType; this.generationHash = generationHash; this.account = this.createAccount(json.testAccount); @@ -71,15 +70,18 @@ export class IntegrationTestHelper { this.harvestingAccount = this.createAccount(json.harvestingAccount); this.listener = this.repositoryFactory.createListener(); - this.maxFee = UInt64.fromUint(1000000); //What would be the best maxFee? In the future we will load the fee multiplier from rest. - + // What would be the best maxFee? In the future we will load the fee multiplier from rest. + this.maxFee = UInt64.fromUint(1000000); - require('fs').readFile(path.resolve(__dirname, '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), (err, yamlData) => { - if (err) { - console.log(`catapult-service-bootstrap generated address could not be loaded. Ignoring and using accounts from network.conf. Error: ${err}`); + require('fs').readFile(path.resolve(__dirname, + '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), + (error: any, yamlData: any) => { + if (error) { + console.log(`catapult-service-bootstrap generated address could not be loaded. + Ignoring and using accounts from network.conf. Error: ${error}`); return resolve(this); } else { - const parsedYaml = yaml.safeLoad(yamlData); + const parsedYaml = this.yaml.safeLoad(yamlData); this.account = this.createAccount(parsedYaml.nemesis_addresses[0]); this.account2 = this.createAccount(parsedYaml.nemesis_addresses[1]); this.account3 = this.createAccount(parsedYaml.nemesis_addresses[2]); @@ -91,15 +93,14 @@ export class IntegrationTestHelper { } }); }, (error) => { - console.log("There has been an error loading the configuration. ", error) + console.log('There has been an error loading the configuration. ', error); return reject(error); }); }); - - } + }, ); - }; + } createAccount(data): Account { return Account.createFromPrivateKey(data.privateKey ? data.privateKey : data.private, this.networkType); @@ -114,12 +115,12 @@ export class IntegrationTestHelper { console.log(`Transaction ${signedTransaction.type} confirmed`); resolve(transaction); }); - this.listener.status(address).pipe(filter(status => status.hash === signedTransaction.hash)).subscribe((error) => { + this.listener.status(address).pipe(filter((status) => status.hash === signedTransaction.hash)).subscribe((error) => { console.log(`Error processing transaction ${signedTransaction.type}`, error); reject(error); }); this.repositoryFactory.createTransactionRepository().announce(signedTransaction); - } + }, ); - }; + } } diff --git a/e2e/infrastructure/Listener.spec.ts b/e2e/infrastructure/Listener.spec.ts index 8a2f418aa7..5114b35817 100644 --- a/e2e/infrastructure/Listener.spec.ts +++ b/e2e/infrastructure/Listener.spec.ts @@ -14,7 +14,10 @@ * limitations under the License. */ import { assert, expect } from 'chai'; +import { ChronoUnit } from 'js-joda'; +import { filter } from 'rxjs/operators'; import { AccountRepository } from '../../src/infrastructure/AccountRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { TransactionRepository } from '../../src/infrastructure/TransactionRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; @@ -25,7 +28,7 @@ import { LockFundsTransaction, Mosaic, SignedTransaction, - UInt64 + UInt64, } from '../../src/model/model'; import { MosaicId } from '../../src/model/mosaic/MosaicId'; import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic'; @@ -34,14 +37,11 @@ import { AggregateTransaction } from '../../src/model/transaction/AggregateTrans import { Deadline } from '../../src/model/transaction/Deadline'; import { MultisigAccountModificationTransaction } from '../../src/model/transaction/MultisigAccountModificationTransaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; -import { filter } from "rxjs/operators"; -import { ChronoUnit } from "js-joda"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('Listener', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -82,36 +82,35 @@ describe('Listener', () => { setTimeout(done, 200); }); - - let createSignedAggregatedBondTransaction = (aggregatedTo: Account, - signer: Account, - recipient: Address): SignedTransaction => { + const createSignedAggregatedBondTransaction = (aggregatedTo: Account, + signer: Account, + recipient: Address): SignedTransaction => { const transferTransaction = TransferTransaction.create( Deadline.create(), recipient, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), [transferTransaction.toAggregate(aggregatedTo.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); return signer.sign(aggregateTransaction, generationHash); }; - let createHashLockTransactionAndAnnounce = (signedAggregatedTransaction: SignedTransaction, - signer: Account, - mosaicId: MosaicId) => { + const createHashLockTransactionAndAnnounce = (signedAggregatedTransaction: SignedTransaction, + signer: Account, + mosaicId: MosaicId) => { const lockFundsTransaction = LockFundsTransaction.create( Deadline.create(), new Mosaic(mosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = signer.sign(lockFundsTransaction, generationHash); transactionRepository.announce(signedLockFundsTransaction); @@ -125,7 +124,7 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); return helper.announce(signedTransaction); @@ -141,7 +140,7 @@ describe('Listener', () => { recipientAddress, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); return helper.announce(signedTransaction); @@ -157,10 +156,11 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); - helper.listener.unconfirmedAdded(account.address).pipe(filter((_) => _.transactionInfo!.hash === signedTransaction.hash)).subscribe(() => { + helper.listener.unconfirmedAdded(account.address).pipe( + filter((_) => _.transactionInfo!.hash === signedTransaction.hash)).subscribe(() => { done(); }); helper.announce(signedTransaction); @@ -173,10 +173,10 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); - helper.listener.unconfirmedRemoved(account.address).pipe(filter(hash => hash === signedTransaction.hash)).subscribe(() => { + helper.listener.unconfirmedRemoved(account.address).pipe(filter((hash) => hash === signedTransaction.hash)).subscribe(() => { done(); }); helper.announce(signedTransaction); @@ -198,7 +198,7 @@ describe('Listener', () => { cosignAccount1.address, [new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY)))], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -218,7 +218,7 @@ describe('Listener', () => { cosignAccount3.publicAccount, ], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -228,7 +228,6 @@ describe('Listener', () => { const signedTransaction = aggregateTransaction .signTransactionWithCosignatories(multisigAccount, [cosignAccount1, cosignAccount2, cosignAccount3], generationHash); - return helper.announce(signedTransaction); }); }); @@ -236,24 +235,27 @@ describe('Listener', () => { describe('Aggregate Bonded Transactions', () => { it('aggregateBondedTransactionsAdded', (done) => { + const signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, account, account2.address); + createHashLockTransactionAndAnnounce(signedAggregatedTx, account, networkCurrencyMosaicId); helper.listener.aggregateBondedAdded(account.address).subscribe(() => { done(); }); helper.listener.confirmed(account.address).subscribe(() => { - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(account.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, account, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, account, networkCurrencyMosaicId); }); }); describe('Aggregate Bonded Transactions', () => { it('aggregateBondedTransactionsRemoved', (done) => { + const signedAggregatedTx = + createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); + + createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); helper.listener.confirmed(cosignAccount1.address).subscribe(() => { helper.listener.aggregateBondedRemoved(cosignAccount1.address).subscribe(() => { done(); @@ -272,23 +274,23 @@ describe('Listener', () => { assert(false); done(); }); - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(cosignAccount1.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = - createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); }); }); describe('Aggregate Bonded Transactions', () => { it('cosignatureAdded', (done) => { + const signedAggregatedTx = + createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); + + createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); helper.listener.cosignatureAdded(cosignAccount1.address).subscribe(() => { done(); }); @@ -301,17 +303,13 @@ describe('Listener', () => { }); }); helper.listener.confirmed(cosignAccount1.address).subscribe(() => { - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(cosignAccount1.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = - createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); }); }); @@ -365,12 +363,12 @@ describe('Listener', () => { account2.address, mosaics, PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(transferTransaction.signWith(account, generationHash)).then(() => { - throw new Error("Transaction should have failed!!"); - }, error => { + throw new Error('Transaction should have failed!!'); + }, (error) => { expect(error.status).to.be.equal('Failure_Core_Insufficient_Balance'); }); }); @@ -387,7 +385,7 @@ describe('Listener', () => { account2.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); helper.announce(transferTransaction.signWith(account, generationHash)); diff --git a/e2e/infrastructure/MetadataHttp.spec.ts b/e2e/infrastructure/MetadataHttp.spec.ts index e28d0f4405..5b8a9062e6 100644 --- a/e2e/infrastructure/MetadataHttp.spec.ts +++ b/e2e/infrastructure/MetadataHttp.spec.ts @@ -15,7 +15,7 @@ */ import { expect } from 'chai'; -import { MetadataHttp } from '../../src/infrastructure/MetadataHttp'; +import { MetadataRepository } from '../../src/infrastructure/MetadataRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; @@ -31,12 +31,11 @@ import { MosaicMetadataTransaction } from '../../src/model/transaction/MosaicMet import { NamespaceMetadataTransaction } from '../../src/model/transaction/NamespaceMetadataTransaction'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { MetadataRepository } from "../../src/infrastructure/MetadataRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('MetadataHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let accountAddress: Address; let mosaicId: MosaicId; @@ -82,7 +81,7 @@ describe('MetadataHttp', () => { 3, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -98,7 +97,7 @@ describe('MetadataHttp', () => { namespaceName, UInt64.fromUint(9), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -115,7 +114,7 @@ describe('MetadataHttp', () => { 23, `Test account meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -138,14 +137,14 @@ describe('MetadataHttp', () => { 22, `Test mosaic meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -163,14 +162,14 @@ describe('MetadataHttp', () => { 25, `Test namespace meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [namespaceMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/MosaicHttp.spec.ts b/e2e/infrastructure/MosaicHttp.spec.ts index 3ca7a0d325..63656756a5 100644 --- a/e2e/infrastructure/MosaicHttp.spec.ts +++ b/e2e/infrastructure/MosaicHttp.spec.ts @@ -15,6 +15,7 @@ */ import { expect } from 'chai'; import { MosaicRepository } from '../../src/infrastructure/MosaicRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags'; @@ -27,8 +28,7 @@ import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasT import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('MosaicHttp', () => { @@ -38,7 +38,7 @@ describe('MosaicHttp', () => { let namespaceId: NamespaceId; let namespaceRepository: NamespaceRepository; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { @@ -76,7 +76,7 @@ describe('MosaicHttp', () => { 3, UInt64.fromUint(0), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); @@ -93,7 +93,7 @@ describe('MosaicHttp', () => { namespaceName, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -110,7 +110,7 @@ describe('MosaicHttp', () => { namespaceId, mosaicId, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -184,7 +184,6 @@ describe('MosaicHttp', () => { */ describe('Remove test MosaicAlias', () => { - it('Announce MosaicAliasTransaction', () => { const mosaicAliasTransaction = MosaicAliasTransaction.create( Deadline.create(), @@ -192,7 +191,7 @@ describe('MosaicHttp', () => { namespaceId, mosaicId, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/NamespaceHttp.spec.ts b/e2e/infrastructure/NamespaceHttp.spec.ts index d2e36d6065..4f02b927af 100644 --- a/e2e/infrastructure/NamespaceHttp.spec.ts +++ b/e2e/infrastructure/NamespaceHttp.spec.ts @@ -17,6 +17,7 @@ import { deepEqual } from 'assert'; import { expect } from 'chai'; import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic'; import { AliasAction } from '../../src/model/namespace/AliasAction'; import { NamespaceId } from '../../src/model/namespace/NamespaceId'; @@ -24,8 +25,7 @@ import { AddressAliasTransaction } from '../../src/model/transaction/AddressAlia import { Deadline } from '../../src/model/transaction/Deadline'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { Address } from "../../src/model/account/Address"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NamespaceHttp', () => { const defaultNamespaceId = NetworkCurrencyMosaic.NAMESPACE_ID; @@ -33,7 +33,7 @@ describe('NamespaceHttp', () => { let namespaceRepository: NamespaceRepository; let account: Account; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); before(() => { return helper.start().then(() => { @@ -60,7 +60,7 @@ describe('NamespaceHttp', () => { namespaceName, UInt64.fromUint(1000), helper.networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -69,7 +69,6 @@ describe('NamespaceHttp', () => { }); describe('AddressAliasTransaction', () => { - it('standalone', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), @@ -77,7 +76,7 @@ describe('NamespaceHttp', () => { namespaceId, account.address, helper.networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); diff --git a/e2e/infrastructure/NetworkHttp.spec.ts b/e2e/infrastructure/NetworkHttp.spec.ts index 376d5317ee..1e4e74c8db 100644 --- a/e2e/infrastructure/NetworkHttp.spec.ts +++ b/e2e/infrastructure/NetworkHttp.spec.ts @@ -16,11 +16,11 @@ import { expect } from 'chai'; import { NetworkRepository } from '../../src/infrastructure/NetworkRepository'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NetworkHttp', () => { let networkRepository: NetworkRepository; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { diff --git a/e2e/infrastructure/NodeHttp.spec.ts b/e2e/infrastructure/NodeHttp.spec.ts index 60b64dbcef..4d6cfd427b 100644 --- a/e2e/infrastructure/NodeHttp.spec.ts +++ b/e2e/infrastructure/NodeHttp.spec.ts @@ -16,11 +16,11 @@ import { expect } from 'chai'; import { NodeRepository } from '../../src/infrastructure/NodeRepository'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NodeHttp', () => { let nodeRepository: NodeRepository; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); before(() => { return helper.start().then(() => { diff --git a/e2e/infrastructure/RestrictionHttp.spec.ts b/e2e/infrastructure/RestrictionHttp.spec.ts index 7110e8a5a2..35464fa883 100644 --- a/e2e/infrastructure/RestrictionHttp.spec.ts +++ b/e2e/infrastructure/RestrictionHttp.spec.ts @@ -16,6 +16,7 @@ import { deepEqual } from 'assert'; import { expect } from 'chai'; +import { RestrictionAccountRepository } from '../../src/infrastructure/RestrictionAccountRespository'; import { RestrictionMosaicRepository } from '../../src/infrastructure/RestrictionMosaicRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; @@ -33,11 +34,10 @@ import { MosaicAddressRestrictionTransaction } from '../../src/model/transaction import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction'; import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/MosaicGlobalRestrictionTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { RestrictionAccountRepository } from "../../src/infrastructure/RestrictionAccountRespository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('RestrictionHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account3: Account; let accountAddress: Address; @@ -177,7 +177,7 @@ describe('RestrictionHttp', () => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/TransactionHttp.spec.ts b/e2e/infrastructure/TransactionHttp.spec.ts index 3c0b266764..1df25ff961 100644 --- a/e2e/infrastructure/TransactionHttp.spec.ts +++ b/e2e/infrastructure/TransactionHttp.spec.ts @@ -21,7 +21,13 @@ import { Crypto } from '../../src/core/crypto'; import { Convert, Convert as convert } from '../../src/core/format'; import { TransactionMapping } from '../../src/core/utils/TransactionMapping'; import { AccountRepository } from '../../src/infrastructure/AccountRepository'; +import { MultisigRepository } from '../../src/infrastructure/MultisigRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; +import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory'; +import { TransactionRepository } from '../../src/infrastructure/TransactionRepository'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; +import { PublicAccount } from '../../src/model/account/PublicAccount'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; import { Mosaic } from '../../src/model/mosaic/Mosaic'; @@ -64,19 +70,13 @@ import { SecretProofTransaction } from '../../src/model/transaction/SecretProofT import { TransactionType } from '../../src/model/transaction/TransactionType'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { Address } from "../../src/model/account/Address"; -import { PublicAccount } from "../../src/model/account/PublicAccount"; -import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory"; -import { MultisigRepository } from "../../src/infrastructure/MultisigRepository"; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { TransactionRepository } from "../../src/infrastructure/TransactionRepository"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('TransactionHttp', () => { let transactionHash; let transactionId; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let account3: Account; @@ -154,7 +154,7 @@ describe('TransactionHttp', () => { 3, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); @@ -182,7 +182,7 @@ describe('TransactionHttp', () => { 3, UInt64.fromUint(0), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicDefinitionTransaction.toAggregate(account.publicAccount)], @@ -203,14 +203,14 @@ describe('TransactionHttp', () => { 10, Convert.uint8ToUtf8(new Uint8Array(10)), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [accountMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); @@ -235,13 +235,13 @@ describe('TransactionHttp', () => { mosaicId, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: AggregateTransaction) => { @@ -264,7 +264,7 @@ describe('TransactionHttp', () => { Deadline.create(), namespaceName, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -283,7 +283,7 @@ describe('TransactionHttp', () => { Deadline.create(), 'root-test-namespace-' + Math.floor(Math.random() * 10000), UInt64.fromUint(5), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [registerNamespaceTransaction.toAggregate(account.publicAccount)], @@ -303,13 +303,13 @@ describe('TransactionHttp', () => { namespaceId, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [namespaceMetadataTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: AggregateTransaction) => { @@ -334,7 +334,7 @@ describe('TransactionHttp', () => { MosaicRestrictionType.NONE, UInt64.fromUint(0), MosaicRestrictionType.GE, - networkType, undefined, helper.maxFee + networkType, undefined, helper.maxFee, ); const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -350,12 +350,12 @@ describe('TransactionHttp', () => { MosaicRestrictionType.GE, UInt64.fromUint(1), MosaicRestrictionType.GE, - networkType, undefined, helper.maxFee + networkType, undefined, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicGlobalRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -371,12 +371,12 @@ describe('TransactionHttp', () => { UInt64.fromUint(60641), account3.address, UInt64.fromUint(2), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -390,7 +390,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -403,12 +403,12 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transferTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -421,7 +421,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingAddress, [account3.address], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); @@ -439,15 +439,15 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingAddress, [], [account3.address], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); @@ -459,10 +459,10 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingAddress, [account3.address], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); describe('AccountRestrictionTransaction - Incoming Address', () => { @@ -472,12 +472,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingAddress, [], [account3.address], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -485,7 +485,6 @@ describe('TransactionHttp', () => { }); describe('AccountRestrictionTransaction - Mosaic', () => { - it('standalone', () => { AccountRestrictionModification.createForMosaic( AccountRestrictionModificationAction.Add, @@ -496,7 +495,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockMosaic, [mosaicId], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); @@ -515,12 +514,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockMosaic, [], [mosaicId], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -534,7 +533,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingTransactionType, [TransactionType.LINK_ACCOUNT], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account3, generationHash); @@ -553,21 +552,20 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingTransactionType, [], [TransactionType.LINK_ACCOUNT], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account3.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account3, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); describe('AccountRestrictionTransaction - Outgoing Operation', () => { - it('standalone', () => { AccountRestrictionModification.createForOperation( AccountRestrictionModificationAction.Add, @@ -578,7 +576,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingTransactionType, [TransactionType.LINK_ACCOUNT], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account3, generationHash); @@ -598,12 +596,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingTransactionType, [], [TransactionType.LINK_ACCOUNT], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account3.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account3, generationHash); return helper.announce(signedTransaction); @@ -613,13 +611,12 @@ describe('TransactionHttp', () => { describe('AccountLinkTransaction', () => { - it('standalone', (done) => { const accountLinkTransaction = AccountLinkTransaction.create( Deadline.create(), harvestingAccount.publicKey, LinkAction.Link, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = accountLinkTransaction.signWith(account, generationHash); @@ -638,12 +635,12 @@ describe('TransactionHttp', () => { Deadline.create(), harvestingAccount.publicKey, LinkAction.Unlink, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [accountLinkTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -652,14 +649,13 @@ describe('TransactionHttp', () => { describe('AddressAliasTransaction', () => { - it('standalone', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), AliasAction.Link, namespaceId, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); @@ -674,14 +670,13 @@ describe('TransactionHttp', () => { describe('Transfer Transaction using address alias', () => { - it('Announce TransferTransaction', () => { const transferTransaction = TransferTransaction.create( Deadline.create(), namespaceId, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -697,12 +692,12 @@ describe('TransactionHttp', () => { AliasAction.Unlink, namespaceId, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressAliasTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -717,7 +712,7 @@ describe('TransactionHttp', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: MosaicSupplyChangeTransaction) => { @@ -736,7 +731,7 @@ describe('TransactionHttp', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicSupplyChangeTransaction.toAggregate(account.publicAccount)], @@ -750,14 +745,13 @@ describe('TransactionHttp', () => { describe('MosaicAliasTransaction', () => { - it('standalone', () => { const mosaicAliasTransaction = MosaicAliasTransaction.create( Deadline.create(), AliasAction.Link, namespaceId, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); @@ -776,7 +770,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const hashLockTransaction = HashLockTransaction.create(Deadline.create(), @@ -797,12 +791,12 @@ describe('TransactionHttp', () => { AliasAction.Unlink, namespaceId, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAliasTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -816,7 +810,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(), @@ -835,7 +829,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(), @@ -859,7 +853,7 @@ describe('TransactionHttp', () => { account2.address, [], PlainMessage.create('Hi'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggTx = AggregateTransaction.createComplete( Deadline.create(), @@ -867,7 +861,7 @@ describe('TransactionHttp', () => { tx.toAggregate(account.publicAccount), ], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggTx, generationHash); return helper.announce(signedTransaction); @@ -884,7 +878,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = secretLockTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: SecretLockTransaction) => { @@ -898,7 +892,6 @@ describe('TransactionHttp', () => { }); describe('HashType: Op_Sha3_256', () => { - it('aggregate', () => { const secretLockTransaction = SecretLockTransaction.create( Deadline.create(), @@ -907,7 +900,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -926,7 +919,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -941,7 +934,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -962,7 +955,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -979,7 +972,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -998,7 +991,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -1013,7 +1006,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -1037,7 +1030,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedSecretLockTx = secretLockTransaction.signWith(account, generationHash); @@ -1049,7 +1042,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTx = secretProofTransaction.signWith(account2, generationHash); return helper.announce(signedTx).then((transaction: SecretProofTransaction) => { @@ -1058,8 +1051,7 @@ describe('TransactionHttp', () => { expect(transaction.hashType, 'HashType').not.to.be.undefined; expect(transaction.proof, 'Proof').not.to.be.undefined; }); - }) - + }); }); }); @@ -1076,7 +1068,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1086,13 +1078,13 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], networkType, [], helper.maxFee); return helper.announce(aggregateSecretProofTransaction.signWith(account2, generationHash)); - }) + }); }); }); @@ -1109,7 +1101,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1119,7 +1111,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretProofTransaction.signWith(account2, generationHash)); }); @@ -1138,7 +1130,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { const secretProofTransaction = SecretProofTransaction.create( @@ -1147,7 +1139,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1172,7 +1164,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1182,7 +1174,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTx = secretProofTransaction.signWith(account2, generationHash); return helper.announce(signedTx); @@ -1204,7 +1196,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( Deadline.create(), @@ -1212,7 +1204,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1238,7 +1230,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( @@ -1247,7 +1239,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => @@ -1269,7 +1261,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( Deadline.create(), @@ -1277,7 +1269,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1314,7 +1306,7 @@ describe('TransactionHttp', () => { bobTransferTransaction.toAggregate(account2.publicAccount), ], networkType, - [], helper.maxFee + [], helper.maxFee, ); const aliceSignedTransaction = aggregateTransaction.signWith(account, generationHash); @@ -1416,7 +1408,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionRepository.announce(signedTransaction) @@ -1435,7 +1427,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createRelative(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), diff --git a/e2e/infrastructure/UnresolvedMapping.spec.ts b/e2e/infrastructure/UnresolvedMapping.spec.ts index bf8e54dd6d..696aa12541 100644 --- a/e2e/infrastructure/UnresolvedMapping.spec.ts +++ b/e2e/infrastructure/UnresolvedMapping.spec.ts @@ -15,8 +15,10 @@ */ import { expect } from 'chai'; import { Convert } from '../../src/core/format'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { TransactionHttp } from '../../src/infrastructure/TransactionHttp'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags'; @@ -38,12 +40,10 @@ import { NamespaceRegistrationTransaction } from '../../src/model/transaction/Na import { Transaction } from '../../src/model/transaction/Transaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { Address } from "../../src/model/account/Address"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('TransactionHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let namespaceRepository: NamespaceRepository; @@ -291,7 +291,6 @@ describe('TransactionHttp', () => { ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); - return helper.announce(signedTransaction).then((transaction: AddressAliasTransaction) => { expect(transaction.namespaceId, 'NamespaceId').not.to.be.undefined; expect(transaction.aliasAction, 'AliasAction').not.to.be.undefined; diff --git a/e2e/service/MetadataTransactionService.spec.ts b/e2e/service/MetadataTransactionService.spec.ts index df66835650..5489391285 100644 --- a/e2e/service/MetadataTransactionService.spec.ts +++ b/e2e/service/MetadataTransactionService.spec.ts @@ -17,14 +17,14 @@ import { NamespaceRegistrationTransaction } from '../../src/model/transaction/Na import { TransactionType } from '../../src/model/transaction/TransactionType'; import { UInt64 } from '../../src/model/UInt64'; import { MetadataTransactionService } from '../../src/service/MetadataTransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MetadataTransactionService', () => { const deadline = Deadline.create(); const key = UInt64.fromUint(123); const newValue = 'new test value'; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; let targetAccount: Account; @@ -33,7 +33,6 @@ describe('MetadataTransactionService', () => { let namespaceId: NamespaceId; let generationHash: string; - before(() => { return helper.start().then(() => { targetAccount = helper.account; @@ -69,7 +68,7 @@ describe('MetadataTransactionService', () => { MosaicFlags.create(true, true, true), 3, UInt64.fromUint(1000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(targetAccount, generationHash); return helper.announce(signedTransaction); @@ -84,7 +83,7 @@ describe('MetadataTransactionService', () => { Deadline.create(), namespaceName, UInt64.fromUint(9), - networkType, helper.maxFee + networkType, helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(targetAccount, generationHash); @@ -104,14 +103,14 @@ describe('MetadataTransactionService', () => { newValue.length, newValue, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); @@ -136,7 +135,7 @@ describe('MetadataTransactionService', () => { [namespaceMetadataTransaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); return helper.announce(signedTransaction); @@ -228,13 +227,13 @@ describe('MetadataTransactionService', () => { newValue + 'delta', targetAccount.publicAccount, mosaicId, - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicMetadataTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { @@ -262,13 +261,13 @@ describe('MetadataTransactionService', () => { newValue + 'delta' + 'extra delta', targetAccount.publicAccount, mosaicId, - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicMetadataTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { @@ -301,7 +300,7 @@ describe('MetadataTransactionService', () => { [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { diff --git a/e2e/service/MosaicRestrictionTransactionService.spec.ts b/e2e/service/MosaicRestrictionTransactionService.spec.ts index 482178aa9e..facbe26d12 100644 --- a/e2e/service/MosaicRestrictionTransactionService.spec.ts +++ b/e2e/service/MosaicRestrictionTransactionService.spec.ts @@ -15,7 +15,7 @@ import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/ import { TransactionType } from '../../src/model/transaction/TransactionType'; import { UInt64 } from '../../src/model/UInt64'; import { MosaicRestrictionTransactionService } from '../../src/service/MosaicRestrictionTransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MosaicRestrictionTransactionService', () => { const deadline = Deadline.create(); @@ -24,7 +24,7 @@ describe('MosaicRestrictionTransactionService', () => { let restrictionRepository: RestrictionMosaicRepository; let mosaicId: MosaicId; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { @@ -62,7 +62,7 @@ describe('MosaicRestrictionTransactionService', () => { MosaicFlags.create(true, true, true), 3, UInt64.fromUint(1000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -82,9 +82,9 @@ describe('MosaicRestrictionTransactionService', () => { MosaicRestrictionType.GE, networkType, undefined, - helper.maxFee + helper.maxFee, ); - const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash) + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); }); }); @@ -99,12 +99,12 @@ describe('MosaicRestrictionTransactionService', () => { account.address, UInt64.fromUint(2), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -126,7 +126,7 @@ describe('MosaicRestrictionTransactionService', () => { mosaicId, key, '1', - MosaicRestrictionType.GE, undefined, helper.maxFee + MosaicRestrictionType.GE, undefined, helper.maxFee, ).subscribe((transaction: MosaicGlobalRestrictionTransaction) => { expect(transaction.type).to.be.equal(TransactionType.MOSAIC_GLOBAL_RESTRICTION); expect(transaction.previousRestrictionValue.toString()).to.be.equal('0'); @@ -147,7 +147,7 @@ describe('MosaicRestrictionTransactionService', () => { key, account.address, '3', - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicAddressRestrictionTransaction) => { expect(transaction.type).to.be.equal(TransactionType.MOSAIC_ADDRESS_RESTRICTION); expect(transaction.previousRestrictionValue.toString()).to.be.equal('2'); @@ -169,13 +169,13 @@ describe('MosaicRestrictionTransactionService', () => { mosaicId, key, '1', - MosaicRestrictionType.GE, undefined, helper.maxFee + MosaicRestrictionType.GE, undefined, helper.maxFee, ).subscribe((transaction: MosaicGlobalRestrictionTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); helper.announce(signedTransaction).then(() => { @@ -197,13 +197,13 @@ describe('MosaicRestrictionTransactionService', () => { key, account.address, '3', - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicAddressRestrictionTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); helper.announce(signedTransaction).then(() => { diff --git a/e2e/service/MosaicService.spec.ts b/e2e/service/MosaicService.spec.ts index 95036cfda8..0429d88e77 100644 --- a/e2e/service/MosaicService.spec.ts +++ b/e2e/service/MosaicService.spec.ts @@ -17,16 +17,16 @@ import { AccountRepository } from '../../src/infrastructure/AccountRepository'; import { MosaicRepository } from '../../src/infrastructure/MosaicRepository'; import { Address } from '../../src/model/account/Address'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { MosaicService } from '../../src/service/MosaicService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MosaicService', () => { let accountAddress: Address; let accountRepository: AccountRepository; let mosaicRepository: MosaicRepository; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { diff --git a/e2e/service/TransactionService.spec.ts b/e2e/service/TransactionService.spec.ts index 5dfb643743..e183f27fe9 100644 --- a/e2e/service/TransactionService.spec.ts +++ b/e2e/service/TransactionService.spec.ts @@ -41,10 +41,10 @@ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; import { TransactionService } from '../../src/service/TransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('TransactionService', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let generationHash: string; let addressAlias: NamespaceId; let mosaicAlias: NamespaceId; @@ -96,7 +96,7 @@ describe('TransactionService', () => { namespaceName, UInt64.fromUint(20), networkType, - helper.maxFee + helper.maxFee, ); addressAlias = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -113,7 +113,7 @@ describe('TransactionService', () => { Deadline.create(), namespaceName, UInt64.fromUint(50), - networkType, helper.maxFee + networkType, helper.maxFee, ); mosaicAlias = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -124,14 +124,13 @@ describe('TransactionService', () => { describe('Setup test AddressAlias', () => { - it('Announce addressAliasTransaction', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), AliasAction.Link, addressAlias, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -152,7 +151,7 @@ describe('TransactionService', () => { MosaicFlags.create(true, true, false), 3, UInt64.fromUint(50), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -169,7 +168,7 @@ describe('TransactionService', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(200000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -185,7 +184,7 @@ describe('TransactionService', () => { AliasAction.Link, mosaicAlias, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -203,7 +202,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -236,7 +235,6 @@ describe('TransactionService', () => { describe('Transfer mosaic to account 3', () => { - it('Announce TransferTransaction', () => { const transferTransaction = TransferTransaction.create( Deadline.create(), @@ -245,7 +243,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(200)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -255,7 +253,6 @@ describe('TransactionService', () => { describe('Create multiple transfers with alias', () => { - it('Announce TransferTransaction', (done) => { const transactions: SignedTransaction[] = []; // 1. Transfer A -> B @@ -266,7 +263,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); transactions.push(transaction1.signWith(account, generationHash)); @@ -278,7 +275,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); transactions.push(transaction2.signWith(account3, generationHash)); @@ -360,7 +357,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); // Unlink MosaicAlias const mosaicAliasTransactionUnlink = MosaicAliasTransaction.create( @@ -368,7 +365,7 @@ describe('TransactionService', () => { AliasAction.Unlink, mosaicAlias, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); // Create a new Mosaic @@ -381,7 +378,7 @@ describe('TransactionService', () => { MosaicFlags.create(true, true, false), 3, UInt64.fromUint(0), - networkType, helper.maxFee + networkType, helper.maxFee, ); // Link namespace with new MosaicId @@ -390,7 +387,7 @@ describe('TransactionService', () => { AliasAction.Link, mosaicAlias, newMosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); // Use new mosaicAlias in metadata @@ -401,7 +398,7 @@ describe('TransactionService', () => { mosaicAlias, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); return AggregateTransaction.createComplete(Deadline.create(), [ @@ -413,7 +410,7 @@ describe('TransactionService', () => { ], networkType, - [], helper.maxFee + [], helper.maxFee, ); } diff --git a/e2e/service/TransactionService_AggregateBonded.spec.ts b/e2e/service/TransactionService_AggregateBonded.spec.ts index d347b5e860..d85b5fa368 100644 --- a/e2e/service/TransactionService_AggregateBonded.spec.ts +++ b/e2e/service/TransactionService_AggregateBonded.spec.ts @@ -15,6 +15,7 @@ */ import { expect } from 'chai'; +import { ChronoUnit } from 'js-joda'; import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; @@ -28,17 +29,16 @@ import { AggregateTransaction } from '../../src/model/transaction/AggregateTrans import { Deadline } from '../../src/model/transaction/Deadline'; import { LockFundsTransaction } from '../../src/model/transaction/LockFundsTransaction'; import { MultisigAccountModificationTransaction } from '../../src/model/transaction/MultisigAccountModificationTransaction'; +import { SignedTransaction } from '../../src/model/transaction/SignedTransaction'; import { TransactionType } from '../../src/model/transaction/TransactionType'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; import { TransactionService } from '../../src/service/TransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; -import { SignedTransaction } from "../../src/model/transaction/SignedTransaction"; -import { ChronoUnit } from "js-joda"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('TransactionService', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -62,7 +62,8 @@ describe('TransactionService', () => { generationHash = helper.generationHash; networkType = helper.networkType; namespaceRepository = helper.repositoryFactory.createNamespaceRepository(); - transactionService = new TransactionService(helper.repositoryFactory.createTransactionRepository(), helper.repositoryFactory.createReceiptRepository()); + transactionService = new TransactionService(helper.repositoryFactory.createTransactionRepository(), + helper.repositoryFactory.createReceiptRepository()); }); }); before(() => { @@ -73,21 +74,20 @@ describe('TransactionService', () => { helper.listener.close(); }); - - let createSignedAggregatedBondTransaction = (aggregatedTo: Account, - signer: Account, - recipient: Address): SignedTransaction => { + const createSignedAggregatedBondTransaction = (aggregatedTo: Account, + signer: Account, + recipient: Address): SignedTransaction => { const transferTransaction = TransferTransaction.create( Deadline.create(), recipient, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), [transferTransaction.toAggregate(aggregatedTo.publicAccount)], - networkType, [], helper.maxFee + networkType, [], helper.maxFee, ); return signer.sign(aggregateTransaction, generationHash); }; @@ -119,7 +119,7 @@ describe('TransactionService', () => { cosignAccount3.publicAccount, ], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -148,7 +148,7 @@ describe('TransactionService', () => { NetworkCurrencyMosaic.createAbsolute(1), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionService.announce(signedTransaction, helper.listener).subscribe((tx: TransferTransaction) => { @@ -169,7 +169,7 @@ describe('TransactionService', () => { new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = lockFundsTransaction.signWith(account, generationHash); transactionService @@ -181,7 +181,6 @@ describe('TransactionService', () => { }); }); - describe('should announce aggregate bonded transaction', () => { it('announce', (done) => { @@ -191,7 +190,7 @@ describe('TransactionService', () => { new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = lockFundsTransaction.signWith(account, generationHash); transactionService.announce(signedLockFundsTransaction, helper.listener).subscribe(() => { @@ -220,7 +219,7 @@ describe('TransactionService', () => { [], [cosignAccount1.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const removeCosigner2 = MultisigAccountModificationTransaction.create( Deadline.create(), @@ -230,7 +229,7 @@ describe('TransactionService', () => { [ cosignAccount2.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const removeCosigner3 = MultisigAccountModificationTransaction.create( @@ -241,7 +240,7 @@ describe('TransactionService', () => { [ cosignAccount3.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), diff --git a/package-lock.json b/package-lock.json index 4c4efe546f..851e965bc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -282,10 +282,13 @@ "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "ansi-wrap": { "version": "0.1.0", @@ -542,17 +545,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -774,16 +766,14 @@ } }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "check-error": { @@ -940,9 +930,9 @@ } }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "commondir": { @@ -2605,15 +2595,6 @@ "har-schema": "^2.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", @@ -3082,12 +3063,6 @@ "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, "js-yaml": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", @@ -3741,7 +3716,7 @@ }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "", + "resolved": false, "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, @@ -3779,7 +3754,7 @@ }, "which-module": { "version": "2.0.0", - "resolved": "", + "resolved": false, "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, @@ -4534,17 +4509,17 @@ } }, "rxjs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", - "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", "requires": { "tslib": "^1.9.0" } }, "rxjs-compat": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.2.1.tgz", - "integrity": "sha512-Pst0lkAwVodBbBOIZic9aM1vY9asJ2u8GfKN115+goIH83PAlizJDyvixuxPAuQ1UtkmBuro7+0PqKQ3PSkhEg==" + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.3.tgz", + "integrity": "sha512-BIJX2yovz3TBpjJoAZyls2QYuU6ZiCaZ+U96SmxQpuSP/qDUfiXPKOVLbThBB2WZijNHkdTTJXKRwvv5Y48H7g==" }, "safe-buffer": { "version": "5.1.1", @@ -4922,10 +4897,21 @@ } }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + } + } }, "sver-compat": { "version": "1.5.0", @@ -5233,66 +5219,38 @@ "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==" }, "tslint": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.9.1.tgz", - "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^3.2.0", + "diff": "^4.0.1", "glob": "^7.1.1", - "js-yaml": "^3.7.0", + "js-yaml": "^3.13.1", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.12.1" + "tsutils": "^2.29.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", - "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "dev": true - }, - "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } } } }, "tsutils": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.22.2.tgz", - "integrity": "sha512-u06FUSulCJ+Y8a2ftuqZN6kIGqdP2yJjUPEngXqmdPND4UQfb04igcotH+dw+IFr417yP6muCLE8/5/Qlfnx0w==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -5325,18 +5283,26 @@ "dev": true }, "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", "dev": true }, "typescript-require": { - "version": "0.2.9-1", - "resolved": "https://registry.npmjs.org/typescript-require/-/typescript-require-0.2.9-1.tgz", - "integrity": "sha1-ZiTBr5HXbyVhPQ9cZn0gQ6bs7cQ=", + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/typescript-require/-/typescript-require-0.2.10.tgz", + "integrity": "sha1-jI7iqnXzUwtWC4ScKSfNNpfrpo4=", "dev": true, "requires": { - "typescript": ">= 0.8.2" + "typescript": "^1.5.3" + }, + "dependencies": { + "typescript": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz", + "integrity": "sha1-tHXW4N/wv1DyluXKbvn7tccyDx4=", + "dev": true + } } }, "uglify-js": { diff --git a/package.json b/package.json index e0ed8f638c..e67edd7593 100644 --- a/package.json +++ b/package.json @@ -52,9 +52,9 @@ "secure-random": "^1.1.1", "ts-mockito": "^2.4.0", "ts-node": "^5.0.1", - "tslint": "^5.8.0", - "typescript": "^2.5.3", - "typescript-require": "^0.2.9-1" + "tslint": "^5.20.1", + "typescript": "^2.9.2", + "typescript-require": "^0.2.10" }, "dependencies": { "bluebird": "^3.5.5", @@ -67,15 +67,15 @@ "request": "^2.88.0", "request-promise-native": "^1.0.5", "ripemd160": "^2.0.2", - "rxjs": "^6.2.1", - "rxjs-compat": "^6.2.1", + "rxjs": "^6.5.3", + "rxjs-compat": "^6.5.3", "utf8": "^2.1.2", "ws": "^5.2.0" }, "peerDependencies": { "js-joda": "^1.6.2", "utf8": "^2.1.2", - "rxjs": "^6.2.1" + "rxjs": "^6.5.3" }, "nyc": { "exclude-after-remap": false, diff --git a/src/infrastructure/AccountHttp.ts b/src/infrastructure/AccountHttp.ts index 8ecba07c48..5c9dc737af 100644 --- a/src/infrastructure/AccountHttp.ts +++ b/src/infrastructure/AccountHttp.ts @@ -78,7 +78,6 @@ export class AccountHttp extends Http implements AccountRepository { ); } - /** * This method maps a AccountInfoDTO from rest to the SDK's AccountInfo model object. * @@ -86,7 +85,7 @@ export class AccountHttp extends Http implements AccountRepository { * @param {AccountInfoDTO} dto AccountInfoDTO the dto object from rest. * @returns AccountInfo model */ - private toAccountInfo(dto: AccountInfoDTO):AccountInfo { + private toAccountInfo(dto: AccountInfoDTO): AccountInfo { return new AccountInfo( Address.createFromEncoded(dto.account.address), UInt64.fromNumericString(dto.account.addressHeight), @@ -111,7 +110,6 @@ export class AccountHttp extends Http implements AccountRepository { ); } - /** * Gets an array of confirmed transactions for which an account is signer or receiver. * @param address - * Address can be created rawAddress or publicKey @@ -120,10 +118,11 @@ export class AccountHttp extends Http implements AccountRepository { */ public getAccountTransactions(address: Address, queryParams?: QueryParams): Observable { return observableFrom( - this.accountRoutesApi.getAccountTransactions(address.plain(), + this.accountRoutesApi.getAccountConfirmedTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order, + this.queryParams(queryParams).transactionType)).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -143,7 +142,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountIncomingTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -163,7 +163,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountOutgoingTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -184,7 +185,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountUnconfirmedTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -204,7 +206,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountPartialTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO) as AggregateTransaction; })), diff --git a/src/infrastructure/BlockHttp.ts b/src/infrastructure/BlockHttp.ts index 14bf2f5143..26175a966d 100644 --- a/src/infrastructure/BlockHttp.ts +++ b/src/infrastructure/BlockHttp.ts @@ -28,24 +28,9 @@ import { Http } from './Http'; import { QueryParams } from './QueryParams'; import { CreateTransactionFromDTO, - extractBeneficiary + extractBeneficiary, } from './transaction/CreateTransactionFromDTO'; -/** - * Blocks returned limits: - * N_25: 25 blocks. - * N_50: 50 blocks. - * N_75: 75 blocks. - * N_100: 100 blocks. - */ -export enum LimitType { - N_25 = 25, - N_50 = 50, - N_75 = 75, - N_100 = 100, - -} - /** * Blockchain http repository. * @@ -102,10 +87,10 @@ export class BlockHttp extends Http implements BlockRepository { /** * Gets array of BlockInfo for a block height with limit * @param height - Block height from which will be the first block in the array - * @param limit - Number of blocks returned. Limit value only available in 25, 50. 75 and 100. (default 25) + * @param limit - Number of blocks returned. * @returns Observable */ - public getBlocksByHeightWithLimit(height: string, limit: LimitType = LimitType.N_25): Observable { + public getBlocksByHeightWithLimit(height: string, limit: number): Observable { return observableFrom( this.blockRoutesApi.getBlocksByHeightWithLimit(height, limit)).pipe( map(({body}) => body.map((blockDTO) => this.toBlockInfo(blockDTO))), @@ -113,7 +98,6 @@ export class BlockHttp extends Http implements BlockRepository { ); } - /** * This method maps a BlockInfoDTO from rest to the SDK's BlockInfo model object. * diff --git a/src/infrastructure/Http.ts b/src/infrastructure/Http.ts index eb44afb07d..861e294d9e 100644 --- a/src/infrastructure/Http.ts +++ b/src/infrastructure/Http.ts @@ -16,10 +16,10 @@ // tslint:disable-next-line: ordered-imports import { from as observableFrom, Observable, of as observableOf, throwError } from 'rxjs'; +import { catchError, map, shareReplay } from 'rxjs/operators'; import { NetworkType } from '../model/blockchain/NetworkType'; +import { NodeRoutesApi } from './api/nodeRoutesApi'; import { QueryParams } from './QueryParams'; -import { NodeRoutesApi } from "./api/nodeRoutesApi"; -import { catchError, map, share, shareReplay } from 'rxjs/operators'; /** * Http extended by all http services @@ -53,6 +53,7 @@ export abstract class Http { pageSize: queryParams ? queryParams.pageSize : undefined, id: queryParams ? queryParams.id : undefined, order: queryParams ? queryParams.order : undefined, + transactionType: queryParams ? queryParams.transactionType : undefined, }; } diff --git a/src/infrastructure/Listener.ts b/src/infrastructure/Listener.ts index 8112a0cc8c..09a368969e 100644 --- a/src/infrastructure/Listener.ts +++ b/src/infrastructure/Listener.ts @@ -23,21 +23,19 @@ import { BlockInfo } from '../model/blockchain/BlockInfo'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; import { AggregateTransactionCosignature } from '../model/transaction/AggregateTransactionCosignature'; -import { CosignatoryModificationAction } from '../model/transaction/CosignatoryModificationAction'; import { CosignatureSignedTransaction } from '../model/transaction/CosignatureSignedTransaction'; import { Deadline } from '../model/transaction/Deadline'; import { InnerTransaction } from '../model/transaction/InnerTransaction'; import { MultisigAccountModificationTransaction } from '../model/transaction/MultisigAccountModificationTransaction'; -import { MultisigCosignatoryModification } from '../model/transaction/MultisigCosignatoryModification'; import { Transaction } from '../model/transaction/Transaction'; import { TransactionStatusError } from '../model/transaction/TransactionStatusError'; import { TransferTransaction } from '../model/transaction/TransferTransaction'; import { UInt64 } from '../model/UInt64'; +import { IListener } from './IListener'; import { CreateTransactionFromDTO, extractBeneficiary, } from './transaction/CreateTransactionFromDTO'; -import { IListener } from "./IListener"; enum ListenerChannelName { block = 'block', @@ -356,18 +354,6 @@ export class Listener implements IListener { this.webSocket.send(JSON.stringify(subscriptionMessage)); } - /** - * @internal - * @param channel - Channel to unsubscribe - */ - private unsubscribeTo(channel: string) { - const unsubscribeMessage = { - uid: this.uid, - unsubscribe: channel, - }; - this.webSocket.send(JSON.stringify(unsubscribeMessage)); - } - /** * @internal * Filters if a transaction has been initiated or signed by an address diff --git a/src/infrastructure/MetadataHttp.ts b/src/infrastructure/MetadataHttp.ts index 3f193db43c..f7f93ad807 100644 --- a/src/infrastructure/MetadataHttp.ts +++ b/src/infrastructure/MetadataHttp.ts @@ -41,20 +41,15 @@ export class MetadataHttp extends Http implements MetadataRepository { * Nem2 Library metadata routes api */ private readonly metadataRoutesApi: MetadataRoutesApi; - /** - * @internal - * network type for the mappings. - */ - private readonly networkTypeObservable: Observable; + /** * Constructor * @param url * @param networkType */ - constructor(url: string, networkType?: NetworkType | Observable) { + constructor(url: string) { super(url); this.metadataRoutesApi = new MetadataRoutesApi(url); - this.networkTypeObservable = this.createNetworkTypeObservable(networkType); } /** diff --git a/src/infrastructure/QueryParams.ts b/src/infrastructure/QueryParams.ts index ee41206d80..fa3fc36b73 100644 --- a/src/infrastructure/QueryParams.ts +++ b/src/infrastructure/QueryParams.ts @@ -1,3 +1,5 @@ +import { TransactionType } from '../model/transaction/TransactionType'; + /* * Copyright 2018 NEM * @@ -49,8 +51,11 @@ export class QueryParams { * ASC. Older to newer. */ public readonly order: Order = Order.DESC, + /** + * Transaction type filter + */ + public readonly transactionType?: TransactionType, ) { this.pageSize = (pageSize >= 10 && pageSize <= 100) ? pageSize : 10; - this.id = id; } } diff --git a/src/infrastructure/RepositoryFactory.ts b/src/infrastructure/RepositoryFactory.ts index f343854697..e57a4fa31e 100644 --- a/src/infrastructure/RepositoryFactory.ts +++ b/src/infrastructure/RepositoryFactory.ts @@ -14,24 +14,23 @@ * limitations under the License. */ -import { Observable } from "rxjs"; -import { NetworkType } from "../model/blockchain/NetworkType"; -import { AccountRepository } from "./AccountRepository"; -import { MultisigRepository } from "./MultisigRepository"; -import { ReceiptRepository } from "./ReceiptRepository"; -import { BlockRepository } from "./BlockRepository"; -import { ChainRepository } from "./ChainRepository"; -import { DiagnosticRepository } from "./DiagnosticRepository"; -import { MosaicRepository } from "./MosaicRepository"; -import { NamespaceRepository } from "./NamespaceRepository"; -import { NetworkRepository } from "./NetworkRepository"; -import { NodeRepository } from "./NodeRepository"; -import { TransactionRepository } from "./TransactionRepository"; -import { MetadataRepository } from "./MetadataRepository"; -import { RestrictionAccountRepository } from "./RestrictionAccountRespository"; -import { RestrictionMosaicRepository } from "./RestrictionMosaicRepository"; -import { Listener } from "./Listener"; -import { IListener } from "./IListener"; +import { Observable } from 'rxjs'; +import { NetworkType } from '../model/blockchain/NetworkType'; +import { AccountRepository } from './AccountRepository'; +import { BlockRepository } from './BlockRepository'; +import { ChainRepository } from './ChainRepository'; +import { DiagnosticRepository } from './DiagnosticRepository'; +import { IListener } from './IListener'; +import { MetadataRepository } from './MetadataRepository'; +import { MosaicRepository } from './MosaicRepository'; +import { MultisigRepository } from './MultisigRepository'; +import { NamespaceRepository } from './NamespaceRepository'; +import { NetworkRepository } from './NetworkRepository'; +import { NodeRepository } from './NodeRepository'; +import { ReceiptRepository } from './ReceiptRepository'; +import { RestrictionAccountRepository } from './RestrictionAccountRespository'; +import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; +import { TransactionRepository } from './TransactionRepository'; /** * A repository factory allows clients to create repositories to access NEM Server without knowing @@ -127,4 +126,4 @@ export interface RepositoryFactory { */ createListener(): IListener; -} \ No newline at end of file +} diff --git a/src/infrastructure/RepositoryFactoryHttp.ts b/src/infrastructure/RepositoryFactoryHttp.ts index 4f68950f2c..f89a41f555 100644 --- a/src/infrastructure/RepositoryFactoryHttp.ts +++ b/src/infrastructure/RepositoryFactoryHttp.ts @@ -14,40 +14,40 @@ * limitations under the License. */ -import { Observable, of as observableOf } from "rxjs"; -import { NetworkType } from "../model/blockchain/NetworkType"; -import { AccountRepository } from "./AccountRepository"; -import { MultisigRepository } from "./MultisigRepository"; -import { ReceiptRepository } from "./ReceiptRepository"; -import { BlockRepository } from "./BlockRepository"; -import { ChainRepository } from "./ChainRepository"; -import { DiagnosticRepository } from "./DiagnosticRepository"; -import { MosaicRepository } from "./MosaicRepository"; -import { NamespaceRepository } from "./NamespaceRepository"; -import { NetworkRepository } from "./NetworkRepository"; -import { NodeRepository } from "./NodeRepository"; -import { TransactionRepository } from "./TransactionRepository"; -import { MetadataRepository } from "./MetadataRepository"; -import { RestrictionAccountRepository } from "./RestrictionAccountRespository"; -import { RestrictionMosaicRepository } from "./RestrictionMosaicRepository"; -import { RepositoryFactory } from "./RepositoryFactory"; -import { AccountHttp } from "./AccountHttp"; -import { BlockHttp } from "./BlockHttp"; -import { ChainHttp } from "./ChainHttp"; -import { DiagnosticHttp } from "./DiagnosticHttp"; -import { MetadataHttp } from "./MetadataHttp"; -import { MosaicHttp } from "./MosaicHttp"; -import { MultisigHttp } from "./MultisigHttp"; -import { NamespaceHttp } from "./NamespaceHttp"; -import { NetworkHttp } from "./NetworkHttp"; -import { NodeHttp } from "./NodeHttp"; -import { ReceiptHttp } from "./ReceiptHttp"; -import { RestrictionAccountHttp } from "./RestrictionAccountHttp"; -import { RestrictionMosaicHttp } from "./RestrictionMosaicHttp"; -import { TransactionHttp } from "./TransactionHttp"; -import { share, map, shareReplay } from "rxjs/operators"; -import { Listener } from "./Listener"; -import { IListener } from "./IListener"; +import { Observable, of as observableOf } from 'rxjs'; +import { map, share, shareReplay } from 'rxjs/operators'; +import { NetworkType } from '../model/blockchain/NetworkType'; +import { AccountHttp } from './AccountHttp'; +import { AccountRepository } from './AccountRepository'; +import { BlockHttp } from './BlockHttp'; +import { BlockRepository } from './BlockRepository'; +import { ChainHttp } from './ChainHttp'; +import { ChainRepository } from './ChainRepository'; +import { DiagnosticHttp } from './DiagnosticHttp'; +import { DiagnosticRepository } from './DiagnosticRepository'; +import { IListener } from './IListener'; +import { Listener } from './Listener'; +import { MetadataHttp } from './MetadataHttp'; +import { MetadataRepository } from './MetadataRepository'; +import { MosaicHttp } from './MosaicHttp'; +import { MosaicRepository } from './MosaicRepository'; +import { MultisigHttp } from './MultisigHttp'; +import { MultisigRepository } from './MultisigRepository'; +import { NamespaceHttp } from './NamespaceHttp'; +import { NamespaceRepository } from './NamespaceRepository'; +import { NetworkHttp } from './NetworkHttp'; +import { NetworkRepository } from './NetworkRepository'; +import { NodeHttp } from './NodeHttp'; +import { NodeRepository } from './NodeRepository'; +import { ReceiptHttp } from './ReceiptHttp'; +import { ReceiptRepository } from './ReceiptRepository'; +import { RepositoryFactory } from './RepositoryFactory'; +import { RestrictionAccountHttp } from './RestrictionAccountHttp'; +import { RestrictionAccountRepository } from './RestrictionAccountRespository'; +import { RestrictionMosaicHttp } from './RestrictionMosaicHttp'; +import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; +import { TransactionHttp } from './TransactionHttp'; +import { TransactionRepository } from './TransactionRepository'; /** * Receipt http repository. @@ -64,10 +64,11 @@ export class RepositoryFactoryHttp implements RepositoryFactory { * @param url the server url. * @param networkType optional network type if you don't want to load it from the server. */ - constructor(url: string, networkType?: NetworkType) { + constructor(url: string, networkType?: NetworkType, generationHash?: string) { this.url = url; this.networkType = networkType ? observableOf(networkType) : this.createNetworkRepository().getNetworkType().pipe(shareReplay(1)); - this.generationHash = this.createBlockRepository().getBlockByHeight('1').pipe(map(b => b.generationHash)).pipe(shareReplay(1)); + this.generationHash = generationHash ? observableOf(generationHash) : + this.createBlockRepository().getBlockByHeight('1').pipe(map((b) => b.generationHash)).pipe(shareReplay(1)); } createAccountRepository(): AccountRepository { @@ -111,7 +112,7 @@ export class RepositoryFactoryHttp implements RepositoryFactory { } createReceiptRepository(): ReceiptRepository { - return new ReceiptHttp(this.url); + return new ReceiptHttp(this.url, this.networkType); } createRestrictionAccountRepository(): RestrictionAccountRepository { @@ -137,5 +138,4 @@ export class RepositoryFactoryHttp implements RepositoryFactory { createListener(): IListener { return new Listener(this.url); } - -} \ No newline at end of file +} diff --git a/src/infrastructure/RestrictionMosaicHttp.ts b/src/infrastructure/RestrictionMosaicHttp.ts index 36c59ab8e2..d455f87aed 100644 --- a/src/infrastructure/RestrictionMosaicHttp.ts +++ b/src/infrastructure/RestrictionMosaicHttp.ts @@ -24,9 +24,9 @@ import { MosaicGlobalRestriction } from '../model/restriction/MosaicGlobalRestri import { MosaicGlobalRestrictionItem } from '../model/restriction/MosaicGlobalRestrictionItem'; import { RestrictionMosaicRoutesApi } from './api/restrictionMosaicRoutesApi'; import {Http} from './Http'; +import { MosaicAddressRestrictionDTO } from './model/mosaicAddressRestrictionDTO'; +import { MosaicGlobalRestrictionDTO } from './model/mosaicGlobalRestrictionDTO'; import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; -import { MosaicAddressRestrictionDTO } from "./model/mosaicAddressRestrictionDTO"; -import { MosaicGlobalRestrictionDTO } from "./model/mosaicGlobalRestrictionDTO"; /** * RestrictionMosaic http repository. diff --git a/src/infrastructure/TransactionHttp.ts b/src/infrastructure/TransactionHttp.ts index 611e66e389..b72b468fa0 100644 --- a/src/infrastructure/TransactionHttp.ts +++ b/src/infrastructure/TransactionHttp.ts @@ -32,7 +32,7 @@ import {TransactionType} from '../model/transaction/TransactionType'; import {UInt64} from '../model/UInt64'; import { BlockInfoDTO, BlockRoutesApi, - TransactionRoutesApi, TransactionStatusDTO + TransactionRoutesApi, TransactionStatusDTO, } from './api'; import {Http} from './Http'; import {CreateTransactionFromDTO} from './transaction/CreateTransactionFromDTO'; @@ -56,23 +56,15 @@ export class TransactionHttp extends Http implements TransactionRepository { */ private blockRoutesApi: BlockRoutesApi; - - /** - * @internal - * network type for the mappings. - */ - private readonly networkTypeObservable: Observable; - /** * Constructor * @param url * @param networkType */ - constructor(url: string, networkType?: NetworkType | Observable) { + constructor(url: string) { super(url); this.transactionRoutesApi = new TransactionRoutesApi(url); this.blockRoutesApi = new BlockRoutesApi(url); - this.networkTypeObservable = this.createNetworkTypeObservable(networkType); } /** @@ -142,11 +134,10 @@ export class TransactionHttp extends Http implements TransactionRepository { */ private toTransactionStatus(dto: TransactionStatusDTO): TransactionStatus { return new TransactionStatus( - dto.status, - dto.group, + dto.group.valueOf(), dto.hash, - dto.deadline ? - Deadline.createFromDTO(UInt64.fromNumericString(dto.deadline).toDTO()) : undefined, + Deadline.createFromDTO(UInt64.fromNumericString(dto.deadline).toDTO()), + dto.code ? dto.code.valueOf() : '', dto.height ? UInt64.fromNumericString(dto.height) : undefined); } @@ -207,9 +198,9 @@ export class TransactionHttp extends Http implements TransactionRepository { if (response.status !== undefined) { throw new TransactionStatus( 'failed', - response.status, response.hash, Deadline.createFromDTO(response.deadline), + response.code, UInt64.fromUint(0)); } else { return CreateTransactionFromDTO(response); diff --git a/src/infrastructure/api.ts b/src/infrastructure/api.ts index 95e4f0d5b9..b74074dfee 100644 --- a/src/infrastructure/api.ts +++ b/src/infrastructure/api.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/accountRoutesApi.ts b/src/infrastructure/api/accountRoutesApi.ts index 6030accaf0..0bac8e4bfe 100644 --- a/src/infrastructure/api/accountRoutesApi.ts +++ b/src/infrastructure/api/accountRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,6 +33,7 @@ import { AccountIds } from '../model/accountIds'; import { AccountInfoDTO } from '../model/accountInfoDTO'; import { ModelError } from '../model/modelError'; import { TransactionInfoDTO } from '../model/transactionInfoDTO'; +import { TransactionTypeEnum } from '../model/transactionTypeEnum'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; @@ -88,15 +89,16 @@ export class AccountRoutesApi { } /** - * Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. - * @summary Get incoming transactions + * Gets an array of transactions for which an account is the sender or receiver. + * @summary Get confirmed transactions * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountIncomingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/incoming' + public async getAccountConfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -104,7 +106,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountIncomingTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountConfirmedTransactions.'); } if (pageSize !== undefined) { @@ -119,6 +121,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -162,12 +168,16 @@ export class AccountRoutesApi { }); } /** - * Returns the account information. - * @summary Get account information + * Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. + * @summary Get incoming transactions * @param accountId Account public key or address. + * @param pageSize Number of transactions to return for each request. + * @param id Transaction identifier up to which transactions are returned. + * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountInfo (accountId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }> { - const localVarPath = this.basePath + '/account/{accountId}' + public async getAccountIncomingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/incoming' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -175,7 +185,23 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountInfo.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountIncomingTransactions.'); + } + + if (pageSize !== undefined) { + localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number"); + } + + if (id !== undefined) { + localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); + } + + if (ordering !== undefined) { + localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); + } + + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); } (Object).assign(localVarHeaderParams, options.headers); @@ -201,12 +227,12 @@ export class AccountRoutesApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }>((resolve, reject) => { + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, "AccountInfoDTO"); + body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -221,15 +247,12 @@ export class AccountRoutesApi { }); } /** - * Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. - * @summary Get outgoing transactions + * Returns the account information. + * @summary Get account information * @param accountId Account public key or address. - * @param pageSize Number of transactions to return for each request. - * @param id Transaction identifier up to which transactions are returned. - * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. */ - public async getAccountOutgoingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/outgoing' + public async getAccountInfo (accountId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }> { + const localVarPath = this.basePath + '/account/{accountId}' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -237,19 +260,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountOutgoingTransactions.'); - } - - if (pageSize !== undefined) { - localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number"); - } - - if (id !== undefined) { - localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); - } - - if (ordering !== undefined) { - localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); + throw new Error('Required parameter accountId was null or undefined when calling getAccountInfo.'); } (Object).assign(localVarHeaderParams, options.headers); @@ -275,12 +286,12 @@ export class AccountRoutesApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + return new Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, "Array"); + body = ObjectSerializer.deserialize(body, "AccountInfoDTO"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -295,15 +306,16 @@ export class AccountRoutesApi { }); } /** - * Gets an array of aggregate bonded transactions where the account is the sender or requires to cosign the transaction. - * @summary Get aggregate bonded transactions information + * Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. + * @summary Get outgoing transactions * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountPartialTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/partial' + public async getAccountOutgoingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/outgoing' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -311,7 +323,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountPartialTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountOutgoingTransactions.'); } if (pageSize !== undefined) { @@ -326,6 +338,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -369,15 +385,16 @@ export class AccountRoutesApi { }); } /** - * Gets an array of transactions for which an account is the sender or receiver. - * @summary Get confirmed transactions + * Gets an array of aggregate bonded transactions where the account is the sender or requires to cosign the transaction. + * @summary Get aggregate bonded transactions information * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions' + public async getAccountPartialTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/partial' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -385,7 +402,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountPartialTransactions.'); } if (pageSize !== undefined) { @@ -400,6 +417,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -449,8 +470,9 @@ export class AccountRoutesApi { * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountUnconfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + public async getAccountUnconfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/account/{accountId}/transactions/unconfirmed' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; @@ -474,6 +496,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; diff --git a/src/infrastructure/api/apis.ts b/src/infrastructure/api/apis.ts index b219325aa8..fdad3f87cc 100644 --- a/src/infrastructure/api/apis.ts +++ b/src/infrastructure/api/apis.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/blockRoutesApi.ts b/src/infrastructure/api/blockRoutesApi.ts index 0cce81b26b..dc639177aa 100644 --- a/src/infrastructure/api/blockRoutesApi.ts +++ b/src/infrastructure/api/blockRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -90,7 +90,7 @@ export class BlockRoutesApi { /** * Gets a block from the chain that has the given height. * @summary Get block information - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. */ public async getBlockByHeight (height: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: BlockInfoDTO; }> { const localVarPath = this.basePath + '/block/{height}' @@ -149,7 +149,7 @@ export class BlockRoutesApi { /** * Returns an array of transactions included in a block for a given block height. * @summary Get transactions from a block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. @@ -223,10 +223,10 @@ export class BlockRoutesApi { /** * Gets up to limit number of blocks after given block height. * @summary Get blocks information - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. - * @param limit Number of elements to be returned. + * @param height Block height. + * @param limit Number of elements to be returned. The limit should be greater than or equal to \"db.pageSizeMin\" and not higher than \"db.pageSizeMax\". The settings are adjustable via a configuration file (rest/resources/rest.json) per REST instance. */ - public async getBlocksByHeightWithLimit (height: string, limit: 25 | 50 | 75 | 100, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + public async getBlocksByHeightWithLimit (height: string, limit: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/blocks/{height}/limit/{limit}' .replace('{' + 'height' + '}', encodeURIComponent(String(height))) .replace('{' + 'limit' + '}', encodeURIComponent(String(limit))); @@ -289,7 +289,7 @@ export class BlockRoutesApi { /** * Returns the merkle path for a transaction included in a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the transaction was included in the block. * @summary Get the merkle path for a given a transaction and block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param hash Transaction hash. */ public async getMerkleTransaction (height: string, hash: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: MerkleProofInfoDTO; }> { diff --git a/src/infrastructure/api/chainRoutesApi.ts b/src/infrastructure/api/chainRoutesApi.ts index 1f3c749bba..bf74f453cf 100644 --- a/src/infrastructure/api/chainRoutesApi.ts +++ b/src/infrastructure/api/chainRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/diagnosticRoutesApi.ts b/src/infrastructure/api/diagnosticRoutesApi.ts index b71abfb7c8..1267df8666 100644 --- a/src/infrastructure/api/diagnosticRoutesApi.ts +++ b/src/infrastructure/api/diagnosticRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/metadataRoutesApi.ts b/src/infrastructure/api/metadataRoutesApi.ts index dc303735b7..54a307f38f 100644 --- a/src/infrastructure/api/metadataRoutesApi.ts +++ b/src/infrastructure/api/metadataRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/mosaicRoutesApi.ts b/src/infrastructure/api/mosaicRoutesApi.ts index 7e46da3b3a..8d6566b60f 100644 --- a/src/infrastructure/api/mosaicRoutesApi.ts +++ b/src/infrastructure/api/mosaicRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/multisigRoutesApi.ts b/src/infrastructure/api/multisigRoutesApi.ts index 77b36b550c..8c58cfe12c 100644 --- a/src/infrastructure/api/multisigRoutesApi.ts +++ b/src/infrastructure/api/multisigRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/namespaceRoutesApi.ts b/src/infrastructure/api/namespaceRoutesApi.ts index 5c112f7074..43f2fed06d 100644 --- a/src/infrastructure/api/namespaceRoutesApi.ts +++ b/src/infrastructure/api/namespaceRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/networkRoutesApi.ts b/src/infrastructure/api/networkRoutesApi.ts index 9c2fa6fd8b..aef29a0a6c 100644 --- a/src/infrastructure/api/networkRoutesApi.ts +++ b/src/infrastructure/api/networkRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/nodeRoutesApi.ts b/src/infrastructure/api/nodeRoutesApi.ts index 67d86791ee..1bc892a4d4 100644 --- a/src/infrastructure/api/nodeRoutesApi.ts +++ b/src/infrastructure/api/nodeRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/receiptRoutesApi.ts b/src/infrastructure/api/receiptRoutesApi.ts index 49338943b6..f72ceb8844 100644 --- a/src/infrastructure/api/receiptRoutesApi.ts +++ b/src/infrastructure/api/receiptRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -89,7 +89,7 @@ export class ReceiptRoutesApi { /** * Returns the receipts linked to a block. * @summary Get receipts from a block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. */ public async getBlockReceipts (height: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: StatementsDTO; }> { const localVarPath = this.basePath + '/block/{height}/receipts' @@ -148,7 +148,7 @@ export class ReceiptRoutesApi { /** * Returns the merkle path for a receipt statement or resolution linked to a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the receipt was linked with the block. * @summary Get the merkle path for a given a receipt statement hash and block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param hash Receipt hash. */ public async getMerkleReceipts (height: string, hash: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: MerkleProofInfoDTO; }> { diff --git a/src/infrastructure/api/restrictionAccountRoutesApi.ts b/src/infrastructure/api/restrictionAccountRoutesApi.ts index 57656b2c35..755faccfc1 100644 --- a/src/infrastructure/api/restrictionAccountRoutesApi.ts +++ b/src/infrastructure/api/restrictionAccountRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/restrictionMosaicRoutesApi.ts b/src/infrastructure/api/restrictionMosaicRoutesApi.ts index ad6f09dc02..42294d4eed 100644 --- a/src/infrastructure/api/restrictionMosaicRoutesApi.ts +++ b/src/infrastructure/api/restrictionMosaicRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/transactionRoutesApi.ts b/src/infrastructure/api/transactionRoutesApi.ts index 9375a20c7a..f5065be845 100644 --- a/src/infrastructure/api/transactionRoutesApi.ts +++ b/src/infrastructure/api/transactionRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts index fcafef8bc4..1d19b7fe88 100644 --- a/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts index f3285d711b..98136bc9c5 100644 --- a/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountDTO.ts b/src/infrastructure/model/accountDTO.ts index 0fb7c46261..f15d4e876c 100644 --- a/src/infrastructure/model/accountDTO.ts +++ b/src/infrastructure/model/accountDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountIds.ts b/src/infrastructure/model/accountIds.ts index 9680d11689..0e89bca6a5 100644 --- a/src/infrastructure/model/accountIds.ts +++ b/src/infrastructure/model/accountIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountInfoDTO.ts b/src/infrastructure/model/accountInfoDTO.ts index cba670bbc2..9215220687 100644 --- a/src/infrastructure/model/accountInfoDTO.ts +++ b/src/infrastructure/model/accountInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountLinkActionEnum.ts b/src/infrastructure/model/accountLinkActionEnum.ts index ebfc4ac3fb..bc5c18ea41 100644 --- a/src/infrastructure/model/accountLinkActionEnum.ts +++ b/src/infrastructure/model/accountLinkActionEnum.ts @@ -17,19 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of action: * 0 - Unlink. * 1 - Link. -*/ + * Type of action: * 0 - Unlink. * 1 - Link. + */ export enum AccountLinkActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/accountLinkTransactionBodyDTO.ts b/src/infrastructure/model/accountLinkTransactionBodyDTO.ts index cf46f3cd32..c67ed1d29e 100644 --- a/src/infrastructure/model/accountLinkTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountLinkTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountLinkTransactionDTO.ts b/src/infrastructure/model/accountLinkTransactionDTO.ts index c254544001..94be101e30 100644 --- a/src/infrastructure/model/accountLinkTransactionDTO.ts +++ b/src/infrastructure/model/accountLinkTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts b/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts index e63034f10b..a77d63d3fd 100644 --- a/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMetadataTransactionDTO.ts b/src/infrastructure/model/accountMetadataTransactionDTO.ts index 00506fbb19..ca2f474e86 100644 --- a/src/infrastructure/model/accountMetadataTransactionDTO.ts +++ b/src/infrastructure/model/accountMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts index 2f9d5b67f0..047419cf04 100644 --- a/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts b/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts index 1ea90730e1..49982796e3 100644 --- a/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountNamesDTO.ts b/src/infrastructure/model/accountNamesDTO.ts index c36c6cdf76..a538bd2c96 100644 --- a/src/infrastructure/model/accountNamesDTO.ts +++ b/src/infrastructure/model/accountNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts index e49771bdbb..4fd1fa22a1 100644 --- a/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts b/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts index f4afb105e8..82d28aa17e 100644 --- a/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionDTO.ts b/src/infrastructure/model/accountRestrictionDTO.ts index c52fe7a7ee..d7f47c4a62 100644 --- a/src/infrastructure/model/accountRestrictionDTO.ts +++ b/src/infrastructure/model/accountRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionFlagsEnum.ts b/src/infrastructure/model/accountRestrictionFlagsEnum.ts index 4b2746e02f..76813ed067 100644 --- a/src/infrastructure/model/accountRestrictionFlagsEnum.ts +++ b/src/infrastructure/model/accountRestrictionFlagsEnum.ts @@ -17,25 +17,32 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of account restriction: * 0x0001 (1 decimal) - Allow only incoming transactions from a given address. * 0x0002 (2 decimal) - Allow only incoming transactions containing a given mosaic identifier. * 0x4001 (16385 decimal) - Allow only outgoing transactions to a given address. * 0x4004 (16388 decimal) - Allow only outgoing transactions with a given transaction type. * 0x8001 (32769 decimal) - Block incoming transactions from a given address. * 0x8002 (32770 decimal) - Block incoming transactions containing a given mosaic identifier. * 0xC001 (49153 decimal) - Block outgoing transactions to a given address. * 0xC004 (49156 decimal) - Block outgoing transactions with a given transaction type. -*/ + * Type of account restriction: + * 0x0001 (1 decimal) - Allow only incoming transactions from a given address. + * 0x0002 (2 decimal) - Allow only incoming transactions containing a given mosaic identifier. + * 0x4001 (16385 decimal) - Allow only outgoing transactions to a given address. + * 0x4004 (16388 decimal) - Allow only outgoing transactions with a given transaction type. + * 0x8001 (32769 decimal) - Block incoming transactions from a given address. + * 0x8002 (32770 decimal) - Block incoming transactions containing a given mosaic identifier. + * 0xC001 (49153 decimal) - Block outgoing transactions to a given address. + * 0xC004 (49156 decimal) - Block outgoing transactions with a given transaction type. + */ export enum AccountRestrictionFlagsEnum { - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_16385 = 16385, - NUMBER_16388 = 16388, - NUMBER_32769 = 32769, - NUMBER_32770 = 32770, - NUMBER_49153 = 49153, - NUMBER_49156 = 49156 + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_16385 = 16385, + NUMBER_16388 = 16388, + NUMBER_32769 = 32769, + NUMBER_32770 = 32770, + NUMBER_49153 = 49153, + NUMBER_49156 = 49156, } diff --git a/src/infrastructure/model/accountRestrictionsDTO.ts b/src/infrastructure/model/accountRestrictionsDTO.ts index 208a11c535..505fef3f9f 100644 --- a/src/infrastructure/model/accountRestrictionsDTO.ts +++ b/src/infrastructure/model/accountRestrictionsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionsInfoDTO.ts b/src/infrastructure/model/accountRestrictionsInfoDTO.ts index 07e957d9a0..ec41841645 100644 --- a/src/infrastructure/model/accountRestrictionsInfoDTO.ts +++ b/src/infrastructure/model/accountRestrictionsInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountTypeEnum.ts b/src/infrastructure/model/accountTypeEnum.ts index 94ebbb1ce5..3fb939d8ff 100644 --- a/src/infrastructure/model/accountTypeEnum.ts +++ b/src/infrastructure/model/accountTypeEnum.ts @@ -17,21 +17,23 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* * 0 - Unlinked. * 1 - Balance-holding account that is linked to a remote harvester account. * 2 - Remote harvester account that is linked to a balance-holding account. * 3 - Remote harvester eligible account that is unlinked. -*/ + * 0 - Unlinked. + * 1 - Balance-holding account that is linked to a remote harvester account. + * 2 - Remote harvester account that is linked to a balance-holding account. + * 3 - Remote harvester eligible account that is unlinked. + */ export enum AccountTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, } diff --git a/src/infrastructure/model/accountsNamesDTO.ts b/src/infrastructure/model/accountsNamesDTO.ts index 1b6ef91181..2572bceab4 100644 --- a/src/infrastructure/model/accountsNamesDTO.ts +++ b/src/infrastructure/model/accountsNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/activityBucketDTO.ts b/src/infrastructure/model/activityBucketDTO.ts index 451da2d066..e41035a61c 100644 --- a/src/infrastructure/model/activityBucketDTO.ts +++ b/src/infrastructure/model/activityBucketDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/addressAliasTransactionBodyDTO.ts b/src/infrastructure/model/addressAliasTransactionBodyDTO.ts index 1b84a678cc..77a11f1e5e 100644 --- a/src/infrastructure/model/addressAliasTransactionBodyDTO.ts +++ b/src/infrastructure/model/addressAliasTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/addressAliasTransactionDTO.ts b/src/infrastructure/model/addressAliasTransactionDTO.ts index a574c941a5..efc8ba40b8 100644 --- a/src/infrastructure/model/addressAliasTransactionDTO.ts +++ b/src/infrastructure/model/addressAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aggregateTransactionBodyDTO.ts b/src/infrastructure/model/aggregateTransactionBodyDTO.ts index c40ae75439..ff8c5d27c3 100644 --- a/src/infrastructure/model/aggregateTransactionBodyDTO.ts +++ b/src/infrastructure/model/aggregateTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aggregateTransactionDTO.ts b/src/infrastructure/model/aggregateTransactionDTO.ts index b84ab10fe9..7841b14320 100644 --- a/src/infrastructure/model/aggregateTransactionDTO.ts +++ b/src/infrastructure/model/aggregateTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aliasActionEnum.ts b/src/infrastructure/model/aliasActionEnum.ts index d90ad550ef..23b09f0206 100644 --- a/src/infrastructure/model/aliasActionEnum.ts +++ b/src/infrastructure/model/aliasActionEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Alias action: * 0 - Unlink alias. * 1 - Link alias. -*/ + * Alias action: * 0 - Unlink alias. * 1 - Link alias. + */ export enum AliasActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/aliasDTO.ts b/src/infrastructure/model/aliasDTO.ts index 70ded6bdd8..c97666d056 100644 --- a/src/infrastructure/model/aliasDTO.ts +++ b/src/infrastructure/model/aliasDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aliasTypeEnum.ts b/src/infrastructure/model/aliasTypeEnum.ts index 173ef1af5f..55527784ca 100644 --- a/src/infrastructure/model/aliasTypeEnum.ts +++ b/src/infrastructure/model/aliasTypeEnum.ts @@ -17,20 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of alias: * 0 - No alias. * 1 - Mosaic id alias. * 2 - Addres alias. -*/ + * Type of alias: * 0 - No alias. * 1 - Mosaic id alias. * 2 - Addres alias. + */ export enum AliasTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/announceTransactionInfoDTO.ts b/src/infrastructure/model/announceTransactionInfoDTO.ts index 32b4c7937b..125acb4b05 100644 --- a/src/infrastructure/model/announceTransactionInfoDTO.ts +++ b/src/infrastructure/model/announceTransactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/artifactExpiryReceiptDTO.ts b/src/infrastructure/model/artifactExpiryReceiptDTO.ts deleted file mode 100644 index ed9a4fd5b0..0000000000 --- a/src/infrastructure/model/artifactExpiryReceiptDTO.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2019 NEM - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Catapult REST Endpoints - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.7.19 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ReceiptDTO } from './receiptDTO'; -import { ReceiptTypeEnum } from './receiptTypeEnum'; - -/** -* An artifact namespace or mosaic expired. -*/ -export class ArtifactExpiryReceiptDTO { - /** - * Version of the receipt. - */ - 'version': number; - 'type': ReceiptTypeEnum; - 'artifactId': any; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "version", - "baseName": "version", - "type": "number" - }, - { - "name": "type", - "baseName": "type", - "type": "ReceiptTypeEnum" - }, - { - "name": "artifactId", - "baseName": "artifactId", - "type": "any" - } ]; - - static getAttributeTypeMap() { - return ArtifactExpiryReceiptDTO.attributeTypeMap; - } -} - diff --git a/src/infrastructure/model/balanceChangeReceiptDTO.ts b/src/infrastructure/model/balanceChangeReceiptDTO.ts index 135b48cea3..52f48100b3 100644 --- a/src/infrastructure/model/balanceChangeReceiptDTO.ts +++ b/src/infrastructure/model/balanceChangeReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts b/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts index 5b88af9977..97c09d4a09 100644 --- a/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts +++ b/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceTransferReceiptDTO.ts b/src/infrastructure/model/balanceTransferReceiptDTO.ts index 213ba3d7ff..30fdecc5f1 100644 --- a/src/infrastructure/model/balanceTransferReceiptDTO.ts +++ b/src/infrastructure/model/balanceTransferReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts b/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts index 1678cbd309..0dfa371aab 100644 --- a/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts +++ b/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockDTO.ts b/src/infrastructure/model/blockDTO.ts index c115b1f73c..c36b9c4669 100644 --- a/src/infrastructure/model/blockDTO.ts +++ b/src/infrastructure/model/blockDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockDTOAllOf.ts b/src/infrastructure/model/blockDTOAllOf.ts index 259f240a76..7d3e4edac6 100644 --- a/src/infrastructure/model/blockDTOAllOf.ts +++ b/src/infrastructure/model/blockDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockInfoDTO.ts b/src/infrastructure/model/blockInfoDTO.ts index 6cf0f67fb6..892e229dad 100644 --- a/src/infrastructure/model/blockInfoDTO.ts +++ b/src/infrastructure/model/blockInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockMetaDTO.ts b/src/infrastructure/model/blockMetaDTO.ts index 43fd5364a5..415c1f9be9 100644 --- a/src/infrastructure/model/blockMetaDTO.ts +++ b/src/infrastructure/model/blockMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/chainScoreDTO.ts b/src/infrastructure/model/chainScoreDTO.ts index 6272f5251b..fd7d1e249f 100644 --- a/src/infrastructure/model/chainScoreDTO.ts +++ b/src/infrastructure/model/chainScoreDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/communicationTimestampsDTO.ts b/src/infrastructure/model/communicationTimestampsDTO.ts index ae0b5302c7..205c4793e7 100644 --- a/src/infrastructure/model/communicationTimestampsDTO.ts +++ b/src/infrastructure/model/communicationTimestampsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignature.ts b/src/infrastructure/model/cosignature.ts index 2e84137071..608031e70f 100644 --- a/src/infrastructure/model/cosignature.ts +++ b/src/infrastructure/model/cosignature.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignatureDTO.ts b/src/infrastructure/model/cosignatureDTO.ts index 1c15f6e43f..650d0ff7ef 100644 --- a/src/infrastructure/model/cosignatureDTO.ts +++ b/src/infrastructure/model/cosignatureDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignatureDTOAllOf.ts b/src/infrastructure/model/cosignatureDTOAllOf.ts index 0333c1144d..b7fe3a2318 100644 --- a/src/infrastructure/model/cosignatureDTOAllOf.ts +++ b/src/infrastructure/model/cosignatureDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts index dddd5619e8..cd969cb1e3 100644 --- a/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts b/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts index 84afb3916a..a25b7e625d 100644 --- a/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts index 49c7be06e9..cb2cc4eaf2 100644 --- a/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts index 2d698aa879..3ff8950e2b 100644 --- a/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts index f04016f1d9..a813ed4a5b 100644 --- a/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts b/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts index dd6c82be9b..e03011afab 100644 --- a/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedHashLockTransactionDTO.ts b/src/infrastructure/model/embeddedHashLockTransactionDTO.ts index b3a807632d..d6ae1aa02f 100644 --- a/src/infrastructure/model/embeddedHashLockTransactionDTO.ts +++ b/src/infrastructure/model/embeddedHashLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts index 515a9f2f74..f48fc94f2c 100644 --- a/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts index 387ad18e77..c7d3cddc07 100644 --- a/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts index 81a024e269..840168d0e9 100644 --- a/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts index 2f5168ba85..8c25f184e4 100644 --- a/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts index 995bb04bb5..bd007e71c5 100644 --- a/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts index 7dbe3aec59..efa17f1b92 100644 --- a/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts b/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts index d6684d7c0e..adc94975e7 100644 --- a/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts index a23ff2a12b..611e2093ba 100644 --- a/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts b/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts index 54dc9f2e58..dd2ca4c10e 100644 --- a/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts +++ b/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts b/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts index a3a77113e3..6aaa6120fc 100644 --- a/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts +++ b/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts b/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts index 7038ffeb1e..3ab27abda2 100644 --- a/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts +++ b/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionDTO.ts b/src/infrastructure/model/embeddedTransactionDTO.ts index 26ece2f6bb..b992dd9c91 100644 --- a/src/infrastructure/model/embeddedTransactionDTO.ts +++ b/src/infrastructure/model/embeddedTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionInfoDTO.ts b/src/infrastructure/model/embeddedTransactionInfoDTO.ts index 6c6a0206ce..dc1a0ea7da 100644 --- a/src/infrastructure/model/embeddedTransactionInfoDTO.ts +++ b/src/infrastructure/model/embeddedTransactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionMetaDTO.ts b/src/infrastructure/model/embeddedTransactionMetaDTO.ts index 9f672ba5ae..c0815291b9 100644 --- a/src/infrastructure/model/embeddedTransactionMetaDTO.ts +++ b/src/infrastructure/model/embeddedTransactionMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransferTransactionDTO.ts b/src/infrastructure/model/embeddedTransferTransactionDTO.ts index d9b649facd..a669a34ced 100644 --- a/src/infrastructure/model/embeddedTransferTransactionDTO.ts +++ b/src/infrastructure/model/embeddedTransferTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/entityDTO.ts b/src/infrastructure/model/entityDTO.ts index 8cefca1574..07083301a7 100644 --- a/src/infrastructure/model/entityDTO.ts +++ b/src/infrastructure/model/entityDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/hashLockTransactionBodyDTO.ts b/src/infrastructure/model/hashLockTransactionBodyDTO.ts index 126231f5bb..a3d01e9b93 100644 --- a/src/infrastructure/model/hashLockTransactionBodyDTO.ts +++ b/src/infrastructure/model/hashLockTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/hashLockTransactionDTO.ts b/src/infrastructure/model/hashLockTransactionDTO.ts index 00ddb00a54..780e07bf71 100644 --- a/src/infrastructure/model/hashLockTransactionDTO.ts +++ b/src/infrastructure/model/hashLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/heightInfoDTO.ts b/src/infrastructure/model/heightInfoDTO.ts index ebe421025c..6ff5e02393 100644 --- a/src/infrastructure/model/heightInfoDTO.ts +++ b/src/infrastructure/model/heightInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/inflationReceiptDTO.ts b/src/infrastructure/model/inflationReceiptDTO.ts index d5501e5018..99bb825331 100644 --- a/src/infrastructure/model/inflationReceiptDTO.ts +++ b/src/infrastructure/model/inflationReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/inflationReceiptDTOAllOf.ts b/src/infrastructure/model/inflationReceiptDTOAllOf.ts index 264071b89f..c0e0708fd9 100644 --- a/src/infrastructure/model/inflationReceiptDTOAllOf.ts +++ b/src/infrastructure/model/inflationReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/lockHashAlgorithmEnum.ts b/src/infrastructure/model/lockHashAlgorithmEnum.ts index 799a937d0f..af8578e3c6 100644 --- a/src/infrastructure/model/lockHashAlgorithmEnum.ts +++ b/src/infrastructure/model/lockHashAlgorithmEnum.ts @@ -17,21 +17,23 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Algorithm used to hash te proof: * 0 (Op_Sha3_256) - Proof is hashed using sha3 256. * 1 (Op_Keccak_256) - Proof is hashed using Keccak (ETH compatibility). * 2 (Op_Hash_160) - Proof is hashed twice: first with Sha-256 and then with RIPEMD-160 (bitcoin’s OP_HASH160). * 3 (Op_Hash_256) - Proof is hashed twice with Sha-256 (bitcoin’s OP_HASH256). -*/ + * Algorithm used to hash te proof: * 0 (Op_Sha3_256) - Proof is hashed using SHA3-256. + * 1 (Op_Keccak_256) - Proof is hashed using Keccak (ETH compatibility). + * 2 (Op_Hash_160) - Proof is hashed twice: first with SHA-256 and then with RIPEMD-160 (bitcoin\'s OP_HASH160). + * 3 (Op_Hash_256) - Proof is hashed twice with SHA3-256 (bitcoin\'s OP_HASH256). + */ export enum LockHashAlgorithmEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, } diff --git a/src/infrastructure/model/merklePathItemDTO.ts b/src/infrastructure/model/merklePathItemDTO.ts index 0a4613da50..43c3a6b4e6 100644 --- a/src/infrastructure/model/merklePathItemDTO.ts +++ b/src/infrastructure/model/merklePathItemDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/merkleProofInfoDTO.ts b/src/infrastructure/model/merkleProofInfoDTO.ts index c3b92fd0ac..9c7bb7f03d 100644 --- a/src/infrastructure/model/merkleProofInfoDTO.ts +++ b/src/infrastructure/model/merkleProofInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/messageDTO.ts b/src/infrastructure/model/messageDTO.ts index 8106729475..9d3f9059ac 100644 --- a/src/infrastructure/model/messageDTO.ts +++ b/src/infrastructure/model/messageDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/messageTypeEnum.ts b/src/infrastructure/model/messageTypeEnum.ts index ec36e86e14..b5d794dbb6 100644 --- a/src/infrastructure/model/messageTypeEnum.ts +++ b/src/infrastructure/model/messageTypeEnum.ts @@ -17,20 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of message: * 0 - Regular message. * 1 - Encrypted message. * 254 - Persistent harvesting delegation. -*/ + * Type of message: * 0 - Regular message. * 1 - Encrypted message. * 254 - Persistent harvesting delegation. + */ export enum MessageTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_254 = 254 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_254 = 254, } diff --git a/src/infrastructure/model/metadataDTO.ts b/src/infrastructure/model/metadataDTO.ts index c52043c3ec..3b9056dab5 100644 --- a/src/infrastructure/model/metadataDTO.ts +++ b/src/infrastructure/model/metadataDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataEntriesDTO.ts b/src/infrastructure/model/metadataEntriesDTO.ts index 36c5e53d1e..77cea364ec 100644 --- a/src/infrastructure/model/metadataEntriesDTO.ts +++ b/src/infrastructure/model/metadataEntriesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataEntryDTO.ts b/src/infrastructure/model/metadataEntryDTO.ts index df5c97f324..9424232573 100644 --- a/src/infrastructure/model/metadataEntryDTO.ts +++ b/src/infrastructure/model/metadataEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataTypeEnum.ts b/src/infrastructure/model/metadataTypeEnum.ts index 7657910dba..6a9b3f8170 100644 --- a/src/infrastructure/model/metadataTypeEnum.ts +++ b/src/infrastructure/model/metadataTypeEnum.ts @@ -17,20 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Metadata type: * 0 - Account. * 1 - Mosaic. * 2 - Namespace. -*/ + * Metadata type: * 0 - Account. * 1 - Mosaic. * 2 - Namespace. + */ export enum MetadataTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/modelError.ts b/src/infrastructure/model/modelError.ts index 5a11639063..5e8ce3ae24 100644 --- a/src/infrastructure/model/modelError.ts +++ b/src/infrastructure/model/modelError.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/models.ts b/src/infrastructure/model/models.ts index 4a9f3a4bc2..3371f08090 100644 --- a/src/infrastructure/model/models.ts +++ b/src/infrastructure/model/models.ts @@ -154,9 +154,11 @@ export * from './transactionIds'; export * from './transactionInfoDTO'; export * from './transactionMetaDTO'; export * from './transactionPayload'; +export * from './transactionStateTypeEnum'; export * from './transactionStatementBodyDTO'; export * from './transactionStatementDTO'; export * from './transactionStatusDTO'; +export * from './transactionStatusTypeEnum'; export * from './transactionTypeEnum'; export * from './transferTransactionBodyDTO'; export * from './transferTransactionDTO'; @@ -321,9 +323,11 @@ import { TransactionIds } from './transactionIds'; import { TransactionInfoDTO } from './transactionInfoDTO'; import { TransactionMetaDTO } from './transactionMetaDTO'; import { TransactionPayload } from './transactionPayload'; +import { TransactionStateTypeEnum } from './transactionStateTypeEnum'; import { TransactionStatementBodyDTO } from './transactionStatementBodyDTO'; import { TransactionStatementDTO } from './transactionStatementDTO'; import { TransactionStatusDTO } from './transactionStatusDTO'; +import { TransactionStatusTypeEnum } from './transactionStatusTypeEnum'; import { TransactionTypeEnum } from './transactionTypeEnum'; import { TransferTransactionBodyDTO } from './transferTransactionBodyDTO'; import { TransferTransactionDTO } from './transferTransactionDTO'; @@ -358,6 +362,8 @@ let enumsMap: {[index: string]: any} = { "NetworkTypeEnum": NetworkTypeEnum, "ReceiptTypeEnum": ReceiptTypeEnum, "RolesTypeEnum": RolesTypeEnum, + "TransactionStateTypeEnum": TransactionStateTypeEnum, + "TransactionStatusTypeEnum": TransactionStatusTypeEnum, "TransactionTypeEnum": TransactionTypeEnum, } diff --git a/src/infrastructure/model/mosaic.ts b/src/infrastructure/model/mosaic.ts index 371e1d027c..6db1f11529 100644 --- a/src/infrastructure/model/mosaic.ts +++ b/src/infrastructure/model/mosaic.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionDTO.ts index c2ad85cef3..7cb6467d91 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts index 1eba898d83..ff74700521 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts index 86545936e9..00ff94dc6c 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts index 90730ff900..1a33e8439f 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts index 03e8ccb245..4055562e4c 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts b/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts index 97f40e06a8..70b6d8a21b 100644 --- a/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAliasTransactionDTO.ts b/src/infrastructure/model/mosaicAliasTransactionDTO.ts index 407ab63626..84e6e1dd79 100644 --- a/src/infrastructure/model/mosaicAliasTransactionDTO.ts +++ b/src/infrastructure/model/mosaicAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDTO.ts b/src/infrastructure/model/mosaicDTO.ts index a0961b6223..bf6fe85621 100644 --- a/src/infrastructure/model/mosaicDTO.ts +++ b/src/infrastructure/model/mosaicDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts index bb844a2f57..c03aea9030 100644 --- a/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts b/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts index e4818dcf04..9fe95e13f9 100644 --- a/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicExpiryReceiptDTO.ts b/src/infrastructure/model/mosaicExpiryReceiptDTO.ts index 89b12750ca..629da6bea6 100644 --- a/src/infrastructure/model/mosaicExpiryReceiptDTO.ts +++ b/src/infrastructure/model/mosaicExpiryReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts b/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts index 5ccc8d3185..9fe6458924 100644 --- a/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts +++ b/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts index 9ce5a5c337..1f50ead7e0 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts index ccc1825520..8766cca2aa 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts index 242c1c18ab..6d04808629 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts index b06a0333dd..514341c74a 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts index 592fc32962..7084b54183 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts index 2f7e4b99d4..07e65280a4 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicIds.ts b/src/infrastructure/model/mosaicIds.ts index 77c2bee587..b8303e1981 100644 --- a/src/infrastructure/model/mosaicIds.ts +++ b/src/infrastructure/model/mosaicIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicInfoDTO.ts b/src/infrastructure/model/mosaicInfoDTO.ts index 1c445e9ef6..3fe0f7520c 100644 --- a/src/infrastructure/model/mosaicInfoDTO.ts +++ b/src/infrastructure/model/mosaicInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts b/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts index 06ff11e3ea..65e54278bf 100644 --- a/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicMetadataTransactionDTO.ts b/src/infrastructure/model/mosaicMetadataTransactionDTO.ts index 04a9ecac79..6630b519c3 100644 --- a/src/infrastructure/model/mosaicMetadataTransactionDTO.ts +++ b/src/infrastructure/model/mosaicMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicNamesDTO.ts b/src/infrastructure/model/mosaicNamesDTO.ts index 8de4656020..bdbfb7677c 100644 --- a/src/infrastructure/model/mosaicNamesDTO.ts +++ b/src/infrastructure/model/mosaicNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts b/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts index 652043daec..3311bef1ce 100644 --- a/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts +++ b/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts @@ -17,19 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* - 0 - Mosaic address restriction. - 1 - Mosaic global restriction. -*/ + * - 0 - Mosaic address restriction. - 1 - Mosaic global restriction. + */ export enum MosaicRestrictionEntryTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/mosaicRestrictionTypeEnum.ts b/src/infrastructure/model/mosaicRestrictionTypeEnum.ts index 4dee8157e0..8ac3b4c99b 100644 --- a/src/infrastructure/model/mosaicRestrictionTypeEnum.ts +++ b/src/infrastructure/model/mosaicRestrictionTypeEnum.ts @@ -17,24 +17,29 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of mosaic restriction. * 0 - Uninitialized value indicating no restriction. * 1 (EQ) - Allow if equal. * 2 (NE) - Allow if not equal. * 3 (LT) - Allow if less than. * 4 (LE) - Allow if less than or equal. * 5 (GT) - Allow if greater than. * 6 (GE) - Allow if greater than or equal. -*/ + * Type of mosaic restriction. + * 0 - Uninitialized value indicating no restriction. + * 1 (EQ) - Allow if equal. + * 2 (NE) - Allow if not equal. + * 3 (LT) - Allow if less than. + * 4 (LE) - Allow if less than or equal. + * 5 (GT) - Allow if greater than. + * 6 (GE) - Allow if greater than or equal. + */ export enum MosaicRestrictionTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3, - NUMBER_4 = 4, - NUMBER_5 = 5, - NUMBER_6 = 6 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, + NUMBER_4 = 4, + NUMBER_5 = 5, + NUMBER_6 = 6, } diff --git a/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts b/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts index 3700e44ab6..86abd9d8db 100644 --- a/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts +++ b/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Direction of the supply change: * 0 - Decrease. * 1 - Increase. -*/ + * Direction of the supply change: * 0 - Decrease. * 1 - Increase. + */ export enum MosaicSupplyChangeActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts b/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts index 14fa267837..4298461d20 100644 --- a/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts b/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts index 63ccbafd28..9d61095843 100644 --- a/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts +++ b/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicsInfoDTO.ts b/src/infrastructure/model/mosaicsInfoDTO.ts index 4c09ec428f..4f306bfb7d 100644 --- a/src/infrastructure/model/mosaicsInfoDTO.ts +++ b/src/infrastructure/model/mosaicsInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicsNamesDTO.ts b/src/infrastructure/model/mosaicsNamesDTO.ts index eb97e2816f..2772252883 100644 --- a/src/infrastructure/model/mosaicsNamesDTO.ts +++ b/src/infrastructure/model/mosaicsNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountGraphInfoDTO.ts b/src/infrastructure/model/multisigAccountGraphInfoDTO.ts index f719ef68d0..4301593431 100644 --- a/src/infrastructure/model/multisigAccountGraphInfoDTO.ts +++ b/src/infrastructure/model/multisigAccountGraphInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountInfoDTO.ts b/src/infrastructure/model/multisigAccountInfoDTO.ts index b0f14dadc4..1e741a8ebe 100644 --- a/src/infrastructure/model/multisigAccountInfoDTO.ts +++ b/src/infrastructure/model/multisigAccountInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts b/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts index a52908497a..4911620324 100644 --- a/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts +++ b/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts b/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts index c062ef94f9..3bf5923735 100644 --- a/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts +++ b/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigDTO.ts b/src/infrastructure/model/multisigDTO.ts index b5abb4436f..2b7b4d071e 100644 --- a/src/infrastructure/model/multisigDTO.ts +++ b/src/infrastructure/model/multisigDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceDTO.ts b/src/infrastructure/model/namespaceDTO.ts index 42d674f4a3..164f1df917 100644 --- a/src/infrastructure/model/namespaceDTO.ts +++ b/src/infrastructure/model/namespaceDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceExpiryReceiptDTO.ts b/src/infrastructure/model/namespaceExpiryReceiptDTO.ts index 317c3f7499..fdce28dccc 100644 --- a/src/infrastructure/model/namespaceExpiryReceiptDTO.ts +++ b/src/infrastructure/model/namespaceExpiryReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts b/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts index 3b474aad73..b20c1d4aa4 100644 --- a/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts +++ b/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceIds.ts b/src/infrastructure/model/namespaceIds.ts index 30c8c48de4..90363b451e 100644 --- a/src/infrastructure/model/namespaceIds.ts +++ b/src/infrastructure/model/namespaceIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceInfoDTO.ts b/src/infrastructure/model/namespaceInfoDTO.ts index 8b35598321..65c7e716dc 100644 --- a/src/infrastructure/model/namespaceInfoDTO.ts +++ b/src/infrastructure/model/namespaceInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetaDTO.ts b/src/infrastructure/model/namespaceMetaDTO.ts index 39ae9b5d2d..a78c0a7a44 100644 --- a/src/infrastructure/model/namespaceMetaDTO.ts +++ b/src/infrastructure/model/namespaceMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts b/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts index 775a4596e4..31ee663b94 100644 --- a/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetadataTransactionDTO.ts b/src/infrastructure/model/namespaceMetadataTransactionDTO.ts index 928fb9f1ff..c0bd315a5d 100644 --- a/src/infrastructure/model/namespaceMetadataTransactionDTO.ts +++ b/src/infrastructure/model/namespaceMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceNameDTO.ts b/src/infrastructure/model/namespaceNameDTO.ts index 0199052754..d49fa98d64 100644 --- a/src/infrastructure/model/namespaceNameDTO.ts +++ b/src/infrastructure/model/namespaceNameDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts b/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts index b84513060a..77fa426bf8 100644 --- a/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts +++ b/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts b/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts index 0df8c35dd9..57839849c5 100644 --- a/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts +++ b/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTypeEnum.ts b/src/infrastructure/model/namespaceRegistrationTypeEnum.ts index 5296396a68..6cf4dfc855 100644 --- a/src/infrastructure/model/namespaceRegistrationTypeEnum.ts +++ b/src/infrastructure/model/namespaceRegistrationTypeEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of namespace: * 0 - Root namespace. * 1 - Subnamespace. -*/ + * Type of namespace: * 0 - Root namespace. * 1 - Subnamespace. + */ export enum NamespaceRegistrationTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/namespacesInfoDTO.ts b/src/infrastructure/model/namespacesInfoDTO.ts index f218660106..cf6fe04eeb 100644 --- a/src/infrastructure/model/namespacesInfoDTO.ts +++ b/src/infrastructure/model/namespacesInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/networkTypeDTO.ts b/src/infrastructure/model/networkTypeDTO.ts index 32d0cdf811..676e101293 100644 --- a/src/infrastructure/model/networkTypeDTO.ts +++ b/src/infrastructure/model/networkTypeDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/networkTypeEnum.ts b/src/infrastructure/model/networkTypeEnum.ts index 74cf7fe28b..38c5a82126 100644 --- a/src/infrastructure/model/networkTypeEnum.ts +++ b/src/infrastructure/model/networkTypeEnum.ts @@ -17,21 +17,22 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Network type: * 0x60 (96 decimal) - Private network. * 0x90 (144 decimal) - Private test network. * 0x68 (104 decimal) - Public main network. * 0x98 (152 decimal) - Public test network. -*/ + * Network type: + * 0x60 (96 decimal) - Private network. + * 0x90 (144 decimal) - Private test network. + * 0x68 (104 decimal) - Public main network. * 0x98 (152 decimal) - Public test network. + */ export enum NetworkTypeEnum { - NUMBER_104 = 104, - NUMBER_152 = 152, - NUMBER_96 = 96, - NUMBER_144 = 144 + NUMBER_104 = 104, + NUMBER_152 = 152, + NUMBER_96 = 96, + NUMBER_144 = 144, } diff --git a/src/infrastructure/model/nodeInfoDTO.ts b/src/infrastructure/model/nodeInfoDTO.ts index e0bf5b9033..42a6a33556 100644 --- a/src/infrastructure/model/nodeInfoDTO.ts +++ b/src/infrastructure/model/nodeInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/nodeTimeDTO.ts b/src/infrastructure/model/nodeTimeDTO.ts index dceba2da20..a670a833c4 100644 --- a/src/infrastructure/model/nodeTimeDTO.ts +++ b/src/infrastructure/model/nodeTimeDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/receiptDTO.ts b/src/infrastructure/model/receiptDTO.ts index 5bacbc7a40..1729ef3970 100644 --- a/src/infrastructure/model/receiptDTO.ts +++ b/src/infrastructure/model/receiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/receiptTypeEnum.ts b/src/infrastructure/model/receiptTypeEnum.ts index 44cf31eb87..4ca1c7712d 100644 --- a/src/infrastructure/model/receiptTypeEnum.ts +++ b/src/infrastructure/model/receiptTypeEnum.ts @@ -17,33 +17,46 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of receipt: * 0x124D (4685 decimal) - Mosaic_Rental_Fee. * 0x134E (4942 decimal) - Namespace_Rental_Fee. * 0x2143 (8515 decimal) - Harvest_Fee. * 0x2248 (8776 decimal) - LockHash_Completed. * 0x2348 (9032 decimal) - LockHash_Expired. * 0x2252 (8786 decimal) - LockSecret_Completed. * 0x2352 (9042 decimal) - LockSecret_Expired. * 0x3148 (12616 decimal) - LockHash_Created. * 0x3152 (12626 decimal) - LockSecret_Created. * 0x414D (16717 decimal) - Mosaic_Expired. * 0x414E (16718 decimal) - Namespace_Expired. * 0x424E (16974 decimal) - Namespace_Deleted. * 0x5143 (20803 decimal) - Inflation. * 0xE143 (57667 decimal) - Transaction_Group. * 0xF143 (61763 decimal) - Address_Alias_Resolution. * 0xF243 (62019 decimal) - Mosaic_Alias_Resolution. -*/ + * Type of receipt: * 0x124D (4685 decimal) - Mosaic_Rental_Fee. + * 0x134E (4942 decimal) - Namespace_Rental_Fee. + * 0x2143 (8515 decimal) - Harvest_Fee. + * 0x2248 (8776 decimal) - LockHash_Completed. + * 0x2348 (9032 decimal) - LockHash_Expired. + * 0x2252 (8786 decimal) - LockSecret_Completed. + * 0x2352 (9042 decimal) - LockSecret_Expired. + * 0x3148 (12616 decimal) - LockHash_Created. + * 0x3152 (12626 decimal) - LockSecret_Created. + * 0x414D (16717 decimal) - Mosaic_Expired. + * 0x414E (16718 decimal) - Namespace_Expired. + * 0x424E (16974 decimal) - Namespace_Deleted. + * 0x5143 (20803 decimal) - Inflation. + * 0xE143 (57667 decimal) - Transaction_Group. + * 0xF143 (61763 decimal) - Address_Alias_Resolution. + * 0xF243 (62019 decimal) - Mosaic_Alias_Resolution. + */ export enum ReceiptTypeEnum { - NUMBER_4685 = 4685, - NUMBER_4942 = 4942, - NUMBER_8515 = 8515, - NUMBER_8776 = 8776, - NUMBER_9032 = 9032, - NUMBER_8786 = 8786, - NUMBER_9042 = 9042, - NUMBER_12616 = 12616, - NUMBER_12626 = 12626, - NUMBER_16717 = 16717, - NUMBER_16718 = 16718, - NUMBER_16974 = 16974, - NUMBER_20803 = 20803, - NUMBER_57667 = 57667, - NUMBER_61763 = 61763, - NUMBER_62019 = 62019 + NUMBER_4685 = 4685, + NUMBER_4942 = 4942, + NUMBER_8515 = 8515, + NUMBER_8776 = 8776, + NUMBER_9032 = 9032, + NUMBER_8786 = 8786, + NUMBER_9042 = 9042, + NUMBER_12616 = 12616, + NUMBER_12626 = 12626, + NUMBER_16717 = 16717, + NUMBER_16718 = 16718, + NUMBER_16974 = 16974, + NUMBER_20803 = 20803, + NUMBER_57667 = 57667, + NUMBER_61763 = 61763, + NUMBER_62019 = 62019, } diff --git a/src/infrastructure/model/resolutionEntryDTO.ts b/src/infrastructure/model/resolutionEntryDTO.ts index 56a1368d26..31abf00af3 100644 --- a/src/infrastructure/model/resolutionEntryDTO.ts +++ b/src/infrastructure/model/resolutionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/resolutionStatementBodyDTO.ts b/src/infrastructure/model/resolutionStatementBodyDTO.ts index 831445357c..ea75554e83 100644 --- a/src/infrastructure/model/resolutionStatementBodyDTO.ts +++ b/src/infrastructure/model/resolutionStatementBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/resolutionStatementDTO.ts b/src/infrastructure/model/resolutionStatementDTO.ts index 5e1706cf1a..a7ff96990a 100644 --- a/src/infrastructure/model/resolutionStatementDTO.ts +++ b/src/infrastructure/model/resolutionStatementDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/rolesTypeEnum.ts b/src/infrastructure/model/rolesTypeEnum.ts index 4aac6137da..c01edb55ba 100644 --- a/src/infrastructure/model/rolesTypeEnum.ts +++ b/src/infrastructure/model/rolesTypeEnum.ts @@ -17,19 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - - /** -* Role of the node: * 1 - Peer node. * 2 - Api node. -*/ + * Role of the node: + * 1 - Peer node. + * 2 - Api node. + */ export enum RolesTypeEnum { - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/secretLockTransactionBodyDTO.ts b/src/infrastructure/model/secretLockTransactionBodyDTO.ts index ad1b29fd92..a8f0f62b11 100644 --- a/src/infrastructure/model/secretLockTransactionBodyDTO.ts +++ b/src/infrastructure/model/secretLockTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretLockTransactionDTO.ts b/src/infrastructure/model/secretLockTransactionDTO.ts index 0e1adb4175..bfdabed743 100644 --- a/src/infrastructure/model/secretLockTransactionDTO.ts +++ b/src/infrastructure/model/secretLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretProofTransactionBodyDTO.ts b/src/infrastructure/model/secretProofTransactionBodyDTO.ts index 89c727fb16..36b5aad14b 100644 --- a/src/infrastructure/model/secretProofTransactionBodyDTO.ts +++ b/src/infrastructure/model/secretProofTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretProofTransactionDTO.ts b/src/infrastructure/model/secretProofTransactionDTO.ts index 0e4a43bb1d..82e786ffe4 100644 --- a/src/infrastructure/model/secretProofTransactionDTO.ts +++ b/src/infrastructure/model/secretProofTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/serverDTO.ts b/src/infrastructure/model/serverDTO.ts index 26001233ad..7f9a23bafe 100644 --- a/src/infrastructure/model/serverDTO.ts +++ b/src/infrastructure/model/serverDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/serverInfoDTO.ts b/src/infrastructure/model/serverInfoDTO.ts index e36d184b4b..cd70601484 100644 --- a/src/infrastructure/model/serverInfoDTO.ts +++ b/src/infrastructure/model/serverInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/sourceDTO.ts b/src/infrastructure/model/sourceDTO.ts index d9cc6fa741..c2d78a8e14 100644 --- a/src/infrastructure/model/sourceDTO.ts +++ b/src/infrastructure/model/sourceDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/statementsDTO.ts b/src/infrastructure/model/statementsDTO.ts index ef5c82fc34..c2e2d38f54 100644 --- a/src/infrastructure/model/statementsDTO.ts +++ b/src/infrastructure/model/statementsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/storageInfoDTO.ts b/src/infrastructure/model/storageInfoDTO.ts index 342f15c8f3..2413f47e8c 100644 --- a/src/infrastructure/model/storageInfoDTO.ts +++ b/src/infrastructure/model/storageInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionBodyDTO.ts b/src/infrastructure/model/transactionBodyDTO.ts index 9719359902..eaad75fd6a 100644 --- a/src/infrastructure/model/transactionBodyDTO.ts +++ b/src/infrastructure/model/transactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionDTO.ts b/src/infrastructure/model/transactionDTO.ts index 60fffdc811..d6717a7074 100644 --- a/src/infrastructure/model/transactionDTO.ts +++ b/src/infrastructure/model/transactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionHashes.ts b/src/infrastructure/model/transactionHashes.ts index fa2a5781cb..e487513bbf 100644 --- a/src/infrastructure/model/transactionHashes.ts +++ b/src/infrastructure/model/transactionHashes.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionIds.ts b/src/infrastructure/model/transactionIds.ts index 8e3f939a37..20128c834f 100644 --- a/src/infrastructure/model/transactionIds.ts +++ b/src/infrastructure/model/transactionIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionInfoDTO.ts b/src/infrastructure/model/transactionInfoDTO.ts index 97755b450a..d97b3df3d3 100644 --- a/src/infrastructure/model/transactionInfoDTO.ts +++ b/src/infrastructure/model/transactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionMetaDTO.ts b/src/infrastructure/model/transactionMetaDTO.ts index 2b94185fd7..4c4690f0a7 100644 --- a/src/infrastructure/model/transactionMetaDTO.ts +++ b/src/infrastructure/model/transactionMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionPayload.ts b/src/infrastructure/model/transactionPayload.ts index f48e39f7e4..88dc032b2d 100644 --- a/src/infrastructure/model/transactionPayload.ts +++ b/src/infrastructure/model/transactionPayload.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStateTypeEnum.ts b/src/infrastructure/model/transactionStateTypeEnum.ts new file mode 100644 index 0000000000..47a39c62dc --- /dev/null +++ b/src/infrastructure/model/transactionStateTypeEnum.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2019 NEM + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Catapult REST Endpoints + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.7.20.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * State of the transaction. + */ +export enum TransactionStateTypeEnum { + Confirmed = 'confirmed', + Unconfirmed = 'unconfirmed', + Failed = 'failed', +} diff --git a/src/infrastructure/model/transactionStatementBodyDTO.ts b/src/infrastructure/model/transactionStatementBodyDTO.ts index 5a27ffa22c..aaa68613b8 100644 --- a/src/infrastructure/model/transactionStatementBodyDTO.ts +++ b/src/infrastructure/model/transactionStatementBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStatementDTO.ts b/src/infrastructure/model/transactionStatementDTO.ts index ac293c02b9..1d72f557ed 100644 --- a/src/infrastructure/model/transactionStatementDTO.ts +++ b/src/infrastructure/model/transactionStatementDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStatusDTO.ts b/src/infrastructure/model/transactionStatusDTO.ts index 04b1f3eba7..e91a9de572 100644 --- a/src/infrastructure/model/transactionStatusDTO.ts +++ b/src/infrastructure/model/transactionStatusDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -25,15 +25,17 @@ * Do not edit the class manually. */ +import { TransactionStateTypeEnum } from './transactionStateTypeEnum'; +import { TransactionStatusTypeEnum } from './transactionStatusTypeEnum'; export class TransactionStatusDTO { - 'group'?: string; - 'status': string; - 'hash'?: string; + 'group': TransactionStateTypeEnum; + 'code'?: TransactionStatusTypeEnum; + 'hash': string; /** * Duration expressed in number of blocks. */ - 'deadline'?: string; + 'deadline': string; /** * Height of the blockchain. */ @@ -45,12 +47,12 @@ export class TransactionStatusDTO { { "name": "group", "baseName": "group", - "type": "string" + "type": "TransactionStateTypeEnum" }, { - "name": "status", - "baseName": "status", - "type": "string" + "name": "code", + "baseName": "code", + "type": "TransactionStatusTypeEnum" }, { "name": "hash", diff --git a/src/infrastructure/model/transactionStatusTypeEnum.ts b/src/infrastructure/model/transactionStatusTypeEnum.ts new file mode 100644 index 0000000000..d5d3e8b712 --- /dev/null +++ b/src/infrastructure/model/transactionStatusTypeEnum.ts @@ -0,0 +1,179 @@ +/* + * Copyright 2019 NEM + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Catapult REST Endpoints + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.7.20.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export enum TransactionStatusTypeEnum { + Success = 'Success', + Neutral = 'Neutral', + Failure = 'Failure', + FailureCorePastDeadline = 'Failure_Core_Past_Deadline', + FailureCoreFutureDeadline = 'Failure_Core_Future_Deadline', + FailureCoreInsufficientBalance = 'Failure_Core_Insufficient_Balance', + FailureCoreTooManyTransactions = 'Failure_Core_Too_Many_Transactions', + FailureCoreNemesisAccountSignedAfterNemesisBlock = 'Failure_Core_Nemesis_Account_Signed_After_Nemesis_Block', + FailureCoreWrongNetwork = 'Failure_Core_Wrong_Network', + FailureCoreInvalidAddress = 'Failure_Core_Invalid_Address', + FailureCoreInvalidVersion = 'Failure_Core_Invalid_Version', + FailureCoreInvalidTransactionFee = 'Failure_Core_Invalid_Transaction_Fee', + FailureCoreBlockHarvesterIneligible = 'Failure_Core_Block_Harvester_Ineligible', + FailureCoreZeroAddress = 'Failure_Core_Zero_Address', + FailureCoreZeroPublicKey = 'Failure_Core_Zero_Public_Key', + FailureCoreNonzeroInternalPadding = 'Failure_Core_Nonzero_Internal_Padding', + FailureHashAlreadyExists = 'Failure_Hash_Already_Exists', + FailureSignatureNotVerifiable = 'Failure_Signature_Not_Verifiable', + FailureAccountLinkInvalidAction = 'Failure_AccountLink_Invalid_Action', + FailureAccountLinkLinkAlreadyExists = 'Failure_AccountLink_Link_Already_Exists', + FailureAccountLinkUnknownLink = 'Failure_AccountLink_Unknown_Link', + FailureAccountLinkInconsistentUnlinkData = 'Failure_AccountLink_Inconsistent_Unlink_Data', + FailureAccountLinkRemoteAccountIneligible = 'Failure_AccountLink_Remote_Account_Ineligible', + FailureAccountLinkRemoteAccountSignerProhibited = 'Failure_AccountLink_Remote_Account_Signer_Prohibited', + FailureAccountLinkRemoteAccountParticipantProhibited = 'Failure_AccountLink_Remote_Account_Participant_Prohibited', + FailureAggregateTooManyTransactions = 'Failure_Aggregate_Too_Many_Transactions', + FailureAggregateNoTransactions = 'Failure_Aggregate_No_Transactions', + FailureAggregateTooManyCosignatures = 'Failure_Aggregate_Too_Many_Cosignatures', + FailureAggregateRedundantCosignatures = 'Failure_Aggregate_Redundant_Cosignatures', + FailureAggregateIneligibleCosignatories = 'Failure_Aggregate_Ineligible_Cosignatories', + FailureAggregateMissingCosignatures = 'Failure_Aggregate_Missing_Cosignatures', + FailureAggregateTransactionsHashMismatch = 'Failure_Aggregate_Transactions_Hash_Mismatch', + FailureLockHashInvalidMosaicId = 'Failure_LockHash_Invalid_Mosaic_Id', + FailureLockHashInvalidMosaicAmount = 'Failure_LockHash_Invalid_Mosaic_Amount', + FailureLockHashHashAlreadyExists = 'Failure_LockHash_Hash_Already_Exists', + FailureLockHashUnknownHash = 'Failure_LockHash_Unknown_Hash', + FailureLockHashInactiveHash = 'Failure_LockHash_Inactive_Hash', + FailureLockHashInvalidDuration = 'Failure_LockHash_Invalid_Duration', + FailureLockSecretInvalidHashAlgorithm = 'Failure_LockSecret_Invalid_Hash_Algorithm', + FailureLockSecretHashAlreadyExists = 'Failure_LockSecret_Hash_Already_Exists', + FailureLockSecretProofSizeOutOfBounds = 'Failure_LockSecret_Proof_Size_Out_Of_Bounds', + FailureLockSecretSecretMismatch = 'Failure_LockSecret_Secret_Mismatch', + FailureLockSecretUnknownCompositeKey = 'Failure_LockSecret_Unknown_Composite_Key', + FailureLockSecretInactiveSecret = 'Failure_LockSecret_Inactive_Secret', + FailureLockSecretHashAlgorithmMismatch = 'Failure_LockSecret_Hash_Algorithm_Mismatch', + FailureLockSecretInvalidDuration = 'Failure_LockSecret_Invalid_Duration', + FailureMetadataValueTooSmall = 'Failure_Metadata_Value_Too_Small', + FailureMetadataValueTooLarge = 'Failure_Metadata_Value_Too_Large', + FailureMetadataValueSizeDeltaTooLarge = 'Failure_Metadata_Value_Size_Delta_Too_Large', + FailureMetadataValueSizeDeltaMismatch = 'Failure_Metadata_Value_Size_Delta_Mismatch', + FailureMetadataValueChangeIrreversible = 'Failure_Metadata_Value_Change_Irreversible', + FailureMosaicInvalidDuration = 'Failure_Mosaic_Invalid_Duration', + FailureMosaicInvalidName = 'Failure_Mosaic_Invalid_Name', + FailureMosaicNameIdMismatch = 'Failure_Mosaic_Name_Id_Mismatch', + FailureMosaicExpired = 'Failure_Mosaic_Expired', + FailureMosaicOwnerConflict = 'Failure_Mosaic_Owner_Conflict', + FailureMosaicIdMismatch = 'Failure_Mosaic_Id_Mismatch', + FailureMosaicParentIdConflict = 'Failure_Mosaic_Parent_Id_Conflict', + FailureMosaicInvalidProperty = 'Failure_Mosaic_Invalid_Property', + FailureMosaicInvalidFlags = 'Failure_Mosaic_Invalid_Flags', + FailureMosaicInvalidDivisibility = 'Failure_Mosaic_Invalid_Divisibility', + FailureMosaicInvalidSupplyChangeAction = 'Failure_Mosaic_Invalid_Supply_Change_Action', + FailureMosaicInvalidSupplyChangeAmount = 'Failure_Mosaic_Invalid_Supply_Change_Amount', + FailureMosaicInvalidId = 'Failure_Mosaic_Invalid_Id', + FailureMosaicModificationDisallowed = 'Failure_Mosaic_Modification_Disallowed', + FailureMosaicModificationNoChanges = 'Failure_Mosaic_Modification_No_Changes', + FailureMosaicSupplyImmutable = 'Failure_Mosaic_Supply_Immutable', + FailureMosaicSupplyNegative = 'Failure_Mosaic_Supply_Negative', + FailureMosaicSupplyExceeded = 'Failure_Mosaic_Supply_Exceeded', + FailureMosaicNonTransferable = 'Failure_Mosaic_Non_Transferable', + FailureMosaicMaxMosaicsExceeded = 'Failure_Mosaic_Max_Mosaics_Exceeded', + FailureMosaicRequiredPropertyFlagUnset = 'Failure_Mosaic_Required_Property_Flag_Unset', + FailureMultisigAccountInBothSets = 'Failure_Multisig_Account_In_Both_Sets', + FailureMultisigMultipleDeletes = 'Failure_Multisig_Multiple_Deletes', + FailureMultisigRedundantModification = 'Failure_Multisig_Redundant_Modification', + FailureMultisigUnknownMultisigAccount = 'Failure_Multisig_Unknown_Multisig_Account', + FailureMultisigNotACosignatory = 'Failure_Multisig_Not_A_Cosignatory', + FailureMultisigAlreadyACosignatory = 'Failure_Multisig_Already_A_Cosignatory', + FailureMultisigMinSettingOutOfRange = 'Failure_Multisig_Min_Setting_Out_Of_Range', + FailureMultisigMinSettingLargerThanNumCosignatories = 'Failure_Multisig_Min_Setting_Larger_Than_Num_Cosignatories', + FailureMultisigInvalidModificationAction = 'Failure_Multisig_Invalid_Modification_Action', + FailureMultisigMaxCosignedAccounts = 'Failure_Multisig_Max_Cosigned_Accounts', + FailureMultisigMaxCosignatories = 'Failure_Multisig_Max_Cosignatories', + FailureMultisigLoop = 'Failure_Multisig_Loop', + FailureMultisigMaxMultisigDepth = 'Failure_Multisig_Max_Multisig_Depth', + FailureMultisigOperationProhibitedByAccount = 'Failure_Multisig_Operation_Prohibited_By_Account', + FailureNamespaceInvalidDuration = 'Failure_Namespace_Invalid_Duration', + FailureNamespaceInvalidName = 'Failure_Namespace_Invalid_Name', + FailureNamespaceNameIdMismatch = 'Failure_Namespace_Name_Id_Mismatch', + FailureNamespaceExpired = 'Failure_Namespace_Expired', + FailureNamespaceOwnerConflict = 'Failure_Namespace_Owner_Conflict', + FailureNamespaceIdMismatch = 'Failure_Namespace_Id_Mismatch', + FailureNamespaceInvalidRegistrationType = 'Failure_Namespace_Invalid_Registration_Type', + FailureNamespaceRootNameReserved = 'Failure_Namespace_Root_Name_Reserved', + FailureNamespaceTooDeep = 'Failure_Namespace_Too_Deep', + FailureNamespaceUnknownParent = 'Failure_Namespace_Unknown_Parent', + FailureNamespaceAlreadyExists = 'Failure_Namespace_Already_Exists', + FailureNamespaceAlreadyActive = 'Failure_Namespace_Already_Active', + FailureNamespaceEternalAfterNemesisBlock = 'Failure_Namespace_Eternal_After_Nemesis_Block', + FailureNamespaceMaxChildrenExceeded = 'Failure_Namespace_Max_Children_Exceeded', + FailureNamespaceAliasInvalidAction = 'Failure_Namespace_Alias_Invalid_Action', + FailureNamespaceUnknown = 'Failure_Namespace_Unknown', + FailureNamespaceAliasAlreadyExists = 'Failure_Namespace_Alias_Already_Exists', + FailureNamespaceUnknownAlias = 'Failure_Namespace_Unknown_Alias', + FailureNamespaceAliasInconsistentUnlinkType = 'Failure_Namespace_Alias_Inconsistent_Unlink_Type', + FailureNamespaceAliasInconsistentUnlinkData = 'Failure_Namespace_Alias_Inconsistent_Unlink_Data', + FailureNamespaceAliasInvalidAddress = 'Failure_Namespace_Alias_Invalid_Address', + FailureRestrictionAccountInvalidRestrictionFlags = 'Failure_RestrictionAccount_Invalid_Restriction_Flags', + FailureRestrictionAccountInvalidModificationAction = 'Failure_RestrictionAccount_Invalid_Modification_Action', + FailureRestrictionAccountInvalidModificationAddress = 'Failure_RestrictionAccount_Invalid_Modification_Address', + FailureRestrictionAccountModificationOperationTypeIncompatible = 'Failure_RestrictionAccount_Modification_Operation_Type_Incompatible', + FailureRestrictionAccountRedundantModification = 'Failure_RestrictionAccount_Redundant_Modification', + FailureRestrictionAccountInvalidModification = 'Failure_RestrictionAccount_Invalid_Modification', + FailureRestrictionAccountModificationCountExceeded = 'Failure_RestrictionAccount_Modification_Count_Exceeded', + FailureRestrictionAccountNoModifications = 'Failure_RestrictionAccount_No_Modifications', + FailureRestrictionAccountValuesCountExceeded = 'Failure_RestrictionAccount_Values_Count_Exceeded', + FailureRestrictionAccountInvalidValue = 'Failure_RestrictionAccount_Invalid_Value', + FailureRestrictionAccountAddressInteractionProhibited = 'Failure_RestrictionAccount_Address_Interaction_Prohibited', + FailureRestrictionAccountMosaicTransferProhibited = 'Failure_RestrictionAccount_Mosaic_Transfer_Prohibited', + FailureRestrictionAccountOperationTypeProhibited = 'Failure_RestrictionAccount_Operation_Type_Prohibited', + FailureRestrictionMosaicInvalidRestrictionType = 'Failure_RestrictionMosaic_Invalid_Restriction_Type', + FailureRestrictionMosaicPreviousValueMismatch = 'Failure_RestrictionMosaic_Previous_Value_Mismatch', + FailureRestrictionMosaicPreviousValueMustBeZero = 'Failure_RestrictionMosaic_Previous_Value_Must_Be_Zero', + FailureRestrictionMosaicMaxRestrictionsExceeded = 'Failure_RestrictionMosaic_Max_Restrictions_Exceeded', + FailureRestrictionMosaicCannotDeleteNonexistentRestriction = 'Failure_RestrictionMosaic_Cannot_Delete_Nonexistent_Restriction', + FailureRestrictionMosaicUnknownGlobalRestriction = 'Failure_RestrictionMosaic_Unknown_Global_Restriction', + FailureRestrictionMosaicInvalidGlobalRestriction = 'Failure_RestrictionMosaic_Invalid_Global_Restriction', + FailureRestrictionMosaicAccountUnauthorized = 'Failure_RestrictionMosaic_Account_Unauthorized', + FailureTransferMessageTooLarge = 'Failure_Transfer_Message_Too_Large', + FailureTransferOutOfOrderMosaics = 'Failure_Transfer_Out_Of_Order_Mosaics', + FailureChainUnlinked = 'Failure_Chain_Unlinked', + FailureChainBlockNotHit = 'Failure_Chain_Block_Not_Hit', + FailureChainBlockInconsistentStateHash = 'Failure_Chain_Block_Inconsistent_State_Hash', + FailureChainBlockInconsistentReceiptsHash = 'Failure_Chain_Block_Inconsistent_Receipts_Hash', + FailureChainUnconfirmedCacheTooFull = 'Failure_Chain_Unconfirmed_Cache_Too_Full', + FailureConsumerEmptyInput = 'Failure_Consumer_Empty_Input', + FailureConsumerBlockTransactionsHashMismatch = 'Failure_Consumer_Block_Transactions_Hash_Mismatch', + NeutralConsumerHashInRecencyCache = 'Neutral_Consumer_Hash_In_Recency_Cache', + FailureConsumerRemoteChainTooManyBlocks = 'Failure_Consumer_Remote_Chain_Too_Many_Blocks', + FailureConsumerRemoteChainImproperLink = 'Failure_Consumer_Remote_Chain_Improper_Link', + FailureConsumerRemoteChainDuplicateTransactions = 'Failure_Consumer_Remote_Chain_Duplicate_Transactions', + FailureConsumerRemoteChainUnlinked = 'Failure_Consumer_Remote_Chain_Unlinked', + FailureConsumerRemoteChainDifficultiesMismatch = 'Failure_Consumer_Remote_Chain_Difficulties_Mismatch', + FailureConsumerRemoteChainScoreNotBetter = 'Failure_Consumer_Remote_Chain_Score_Not_Better', + FailureConsumerRemoteChainTooFarBehind = 'Failure_Consumer_Remote_Chain_Too_Far_Behind', + FailureConsumerRemoteChainTooFarInFuture = 'Failure_Consumer_Remote_Chain_Too_Far_In_Future', + FailureConsumerBatchSignatureNotVerifiable = 'Failure_Consumer_Batch_Signature_Not_Verifiable', + FailureExtensionPartialTransactionCachePrune = 'Failure_Extension_Partial_Transaction_Cache_Prune', + FailureExtensionPartialTransactionDependencyRemoved = 'Failure_Extension_Partial_Transaction_Dependency_Removed', + FailureExtensionReadRateLimitExceeded = 'Failure_Extension_Read_Rate_Limit_Exceeded', +} diff --git a/src/infrastructure/model/transactionTypeEnum.ts b/src/infrastructure/model/transactionTypeEnum.ts index 2a49d78b67..ae023bc034 100644 --- a/src/infrastructure/model/transactionTypeEnum.ts +++ b/src/infrastructure/model/transactionTypeEnum.ts @@ -17,38 +17,56 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of transaction: * 0x414C (16716 decimal) - AccountLinkTransaction. * 0x4141 (16705 decimal) - AggregateCompleteTransaction. * 0x4241 (16961 decimal) - AggregateBondedTransaction. * 0x414D (16717 decimal) - MosaicDefinitionTransaction. * 0x424D (16973 decimal) - MosaicSupplyChangeTransaction. * 0x414E (16718 decimal) - NamespaceRegistrationTransaction. * 0x424E (16974 decimal) - AddressAliasTransaction. * 0x434E (17230 decimal) - MosaicAliasTransaction. * 0x4144 (16708 decimal) - AccountMetadataTransaction. * 0x4244 (16964 decimal) - MosaicMetadataTransaction. * 0x4344 (17220 decimal) - NamespaceMetadataTransaction. * 0x4155 (16725 decimal) - MultisigAccountModificationTransaction. * 0x4148 (16712 decimal) - HashLockTransaction. * 0x4152 (16722 decimal) - SecretLockTransaction. * 0x4252 (16978 decimal) - SecretProofTransaction. * 0x4150 (16720 decimal) - AccountAddressRestrictionTransaction. * 0x4250 (16976 decimal) - AccountMosaicRestrictionTransaction. * 0x4350 (17232 decimal) - AccountOperationRestrictionTransaction. * 0x4151 (16721 decimal) - MosaicGlobalRestrictionTransaction. * 0x4251 (16977 decimal) - MosaicAddressRestrictionTransaction. * 0x4154 (16724 decimal) - TransferTransaction. -*/ + * Type of transaction: * 0x414C (16716 decimal) - AccountLinkTransaction. * 0x4141 (16705 decimal) -AggregateCompleteTransaction. + * 0x4241 (16961 decimal) - AggregateBondedTransaction. + * 0x414D (16717 decimal) - MosaicDefinitionTransaction. + * 0x424D (16973 decimal) - MosaicSupplyChangeTransaction. + * 0x414E (16718 decimal) - NamespaceRegistrationTransaction. + * 0x424E (16974 decimal) - AddressAliasTransaction. + * 0x434E (17230 decimal) - MosaicAliasTransaction. + * 0x4144 (16708 decimal) - AccountMetadataTransaction. + * 0x4244 (16964 decimal) - MosaicMetadataTransaction. + * 0x4344 (17220 decimal) - NamespaceMetadataTransaction. + * 0x4155 (16725 decimal) - MultisigAccountModificationTransaction. + * 0x4148 (16712 decimal) - HashLockTransaction. + * 0x4152 (16722 decimal) - SecretLockTransaction. + * 0x4252 (16978 decimal) - SecretProofTransaction. + * 0x4150 (16720 decimal) - AccountAddressRestrictionTransaction. + * 0x4250 (16976 decimal) - AccountMosaicRestrictionTransaction. + * 0x4350 (17232 decimal) - AccountOperationRestrictionTransaction. + * 0x4151 (16721 decimal) - MosaicGlobalRestrictionTransaction. + * 0x4251 (16977 decimal) - MosaicAddressRestrictionTransaction. + * 0x4154 (16724 decimal) - TransferTransaction. + */ export enum TransactionTypeEnum { - NUMBER_16716 = 16716, - NUMBER_16705 = 16705, - NUMBER_16961 = 16961, - NUMBER_16717 = 16717, - NUMBER_16973 = 16973, - NUMBER_16718 = 16718, - NUMBER_16974 = 16974, - NUMBER_17230 = 17230, - NUMBER_16708 = 16708, - NUMBER_16964 = 16964, - NUMBER_17220 = 17220, - NUMBER_16725 = 16725, - NUMBER_16712 = 16712, - NUMBER_16722 = 16722, - NUMBER_16978 = 16978, - NUMBER_16720 = 16720, - NUMBER_16976 = 16976, - NUMBER_17232 = 17232, - NUMBER_16721 = 16721, - NUMBER_16977 = 16977, - NUMBER_16724 = 16724 + NUMBER_16716 = 16716, + NUMBER_16705 = 16705, + NUMBER_16961 = 16961, + NUMBER_16717 = 16717, + NUMBER_16973 = 16973, + NUMBER_16718 = 16718, + NUMBER_16974 = 16974, + NUMBER_17230 = 17230, + NUMBER_16708 = 16708, + NUMBER_16964 = 16964, + NUMBER_17220 = 17220, + NUMBER_16725 = 16725, + NUMBER_16712 = 16712, + NUMBER_16722 = 16722, + NUMBER_16978 = 16978, + NUMBER_16720 = 16720, + NUMBER_16976 = 16976, + NUMBER_17232 = 17232, + NUMBER_16721 = 16721, + NUMBER_16977 = 16977, + NUMBER_16724 = 16724, } diff --git a/src/infrastructure/model/transferTransactionBodyDTO.ts b/src/infrastructure/model/transferTransactionBodyDTO.ts index 91ee668752..38d99a09fe 100644 --- a/src/infrastructure/model/transferTransactionBodyDTO.ts +++ b/src/infrastructure/model/transferTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transferTransactionDTO.ts b/src/infrastructure/model/transferTransactionDTO.ts index fd1ed28761..287211e77a 100644 --- a/src/infrastructure/model/transferTransactionDTO.ts +++ b/src/infrastructure/model/transferTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/unresolvedMosaic.ts b/src/infrastructure/model/unresolvedMosaic.ts index cce9479c2b..9aa1b06cd6 100644 --- a/src/infrastructure/model/unresolvedMosaic.ts +++ b/src/infrastructure/model/unresolvedMosaic.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/verifiableEntityDTO.ts b/src/infrastructure/model/verifiableEntityDTO.ts index 240e6f35b2..7eee4865b2 100644 --- a/src/infrastructure/model/verifiableEntityDTO.ts +++ b/src/infrastructure/model/verifiableEntityDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/receipt/CreateReceiptFromDTO.ts b/src/infrastructure/receipt/CreateReceiptFromDTO.ts index 8eff4c9c87..6c564bbbac 100644 --- a/src/infrastructure/receipt/CreateReceiptFromDTO.ts +++ b/src/infrastructure/receipt/CreateReceiptFromDTO.ts @@ -34,50 +34,21 @@ import { TransactionStatement } from '../../model/receipt/TransactionStatement'; import {UInt64} from '../../model/UInt64'; /** - * @param receiptDTO - * @param networkType - * @returns {Statement} - * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.h - * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.cpp - * @constructor - */ -export const CreateStatementFromDTO = (receiptDTO, networkType): Statement => { - return new Statement( - receiptDTO.transactionStatements.map((statement) => createTransactionStatement(statement.statement, networkType)), - receiptDTO.addressResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Address)), - receiptDTO.mosaicResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Mosaic)), - ); -}; - -/** - * @param receiptDTO - * @param networkType - * @returns {Receipt} - * @constructor + * @interal + * @param unresolvedAddress unresolved address + * @returns {Address | NamespaceId} */ -export const CreateReceiptFromDTO = (receiptDTO, networkType): Receipt => { - switch (receiptDTO.type) { - case ReceiptType.Harvest_Fee: - case ReceiptType.LockHash_Created: - case ReceiptType.LockHash_Completed: - case ReceiptType.LockHash_Expired: - case ReceiptType.LockSecret_Created: - case ReceiptType.LockSecret_Completed: - case ReceiptType.LockSecret_Expired: - return createBalanceChangeReceipt(receiptDTO, networkType); - case ReceiptType.Mosaic_Levy: - case ReceiptType.Mosaic_Rental_Fee: - case ReceiptType.Namespace_Rental_Fee: - return createBalanceTransferReceipt(receiptDTO, networkType); - case ReceiptType.Mosaic_Expired: - case ReceiptType.Namespace_Expired: - case ReceiptType.Namespace_Deleted: - return createArtifactExpiryReceipt(receiptDTO); - case ReceiptType.Inflation: - return createInflationReceipt(receiptDTO); - default: - throw new Error(`Receipt type: ${receiptDTO.type} not recognized.`); +const extractUnresolvedAddress = (unresolvedAddress: any): Address | NamespaceId => { + if (typeof unresolvedAddress === 'string') { + return UnresolvedMapping.toUnresolvedAddress(unresolvedAddress); + } else if (typeof unresolvedAddress === 'object') { // Is JSON object + if (unresolvedAddress.hasOwnProperty('address')) { + return Address.createFromRawAddress(unresolvedAddress.address); + } else if (unresolvedAddress.hasOwnProperty('id')) { + return NamespaceId.createFromEncoded(unresolvedAddress.id); + } } + throw new Error(`UnresolvedAddress: ${unresolvedAddress} type is not recognised`); }; /** @@ -114,23 +85,6 @@ const createResolutionStatement = (statementDTO, resolutionType): ResolutionStat } }; -/** - * @internal - * @param statementDTO - * @param networkType - * @returns {TransactionStatement} - * @constructor - */ -const createTransactionStatement = (statementDTO, networkType): TransactionStatement => { - return new TransactionStatement( - UInt64.fromNumericString(statementDTO.height), - new ReceiptSource(statementDTO.source.primaryId, statementDTO.source.secondaryId), - statementDTO.receipts.map((receipt) => { - return CreateReceiptFromDTO(receipt, networkType); - }), - ); -}; - /** * @internal * @param receiptDTO @@ -166,6 +120,24 @@ const createBalanceTransferReceipt = (receiptDTO, networkType): Receipt => { ); }; +/** + * @internal + * @param receiptType receipt type + * @param id Artifact id + * @returns {MosaicId | NamespaceId} + */ +const extractArtifactId = (receiptType: ReceiptType, id: string): MosaicId | NamespaceId => { + switch (receiptType) { + case ReceiptType.Mosaic_Expired: + return new MosaicId(id); + case ReceiptType.Namespace_Expired: + case ReceiptType.Namespace_Deleted: + return NamespaceId.createFromEncoded(id); + default: + throw new Error('Receipt type is not supported.'); + } +}; + /** * @internal * @param receiptDTO @@ -196,37 +168,65 @@ const createInflationReceipt = (receiptDTO): Receipt => { }; /** - * @internal - * @param receiptType receipt type - * @param id Artifact id - * @returns {MosaicId | NamespaceId} + * @param receiptDTO + * @param networkType + * @returns {Receipt} + * @constructor */ -const extractArtifactId = (receiptType: ReceiptType, id: string): MosaicId | NamespaceId => { - switch (receiptType) { +export const CreateReceiptFromDTO = (receiptDTO, networkType): Receipt => { + switch (receiptDTO.type) { + case ReceiptType.Harvest_Fee: + case ReceiptType.LockHash_Created: + case ReceiptType.LockHash_Completed: + case ReceiptType.LockHash_Expired: + case ReceiptType.LockSecret_Created: + case ReceiptType.LockSecret_Completed: + case ReceiptType.LockSecret_Expired: + return createBalanceChangeReceipt(receiptDTO, networkType); + case ReceiptType.Mosaic_Levy: + case ReceiptType.Mosaic_Rental_Fee: + case ReceiptType.Namespace_Rental_Fee: + return createBalanceTransferReceipt(receiptDTO, networkType); case ReceiptType.Mosaic_Expired: - return new MosaicId(id); case ReceiptType.Namespace_Expired: case ReceiptType.Namespace_Deleted: - return NamespaceId.createFromEncoded(id); + return createArtifactExpiryReceipt(receiptDTO); + case ReceiptType.Inflation: + return createInflationReceipt(receiptDTO); default: - throw new Error('Receipt type is not supported.'); + throw new Error(`Receipt type: ${receiptDTO.type} not recognized.`); } }; /** - * @interal - * @param unresolvedAddress unresolved address - * @returns {Address | NamespaceId} + * @internal + * @param statementDTO + * @param networkType + * @returns {TransactionStatement} + * @constructor */ -const extractUnresolvedAddress = (unresolvedAddress: any): Address | NamespaceId => { - if (typeof unresolvedAddress === 'string') { - return UnresolvedMapping.toUnresolvedAddress(unresolvedAddress); - } else if (typeof unresolvedAddress === 'object') { // Is JSON object - if (unresolvedAddress.hasOwnProperty('address')) { - return Address.createFromRawAddress(unresolvedAddress.address); - } else if (unresolvedAddress.hasOwnProperty('id')) { - return NamespaceId.createFromEncoded(unresolvedAddress.id); - } - } - throw new Error(`UnresolvedAddress: ${unresolvedAddress} type is not recognised`); +const createTransactionStatement = (statementDTO, networkType): TransactionStatement => { + return new TransactionStatement( + UInt64.fromNumericString(statementDTO.height), + new ReceiptSource(statementDTO.source.primaryId, statementDTO.source.secondaryId), + statementDTO.receipts.map((receipt) => { + return CreateReceiptFromDTO(receipt, networkType); + }), + ); +}; + +/** + * @param receiptDTO + * @param networkType + * @returns {Statement} + * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.h + * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.cpp + * @constructor + */ +export const CreateStatementFromDTO = (receiptDTO, networkType): Statement => { + return new Statement( + receiptDTO.transactionStatements.map((statement) => createTransactionStatement(statement.statement, networkType)), + receiptDTO.addressResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Address)), + receiptDTO.mosaicResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Mosaic)), + ); }; diff --git a/src/infrastructure/templates/api-single.mustache b/src/infrastructure/templates/api-single.mustache index 8588e38bc8..3894c241dc 100755 --- a/src/infrastructure/templates/api-single.mustache +++ b/src/infrastructure/templates/api-single.mustache @@ -31,8 +31,8 @@ let defaultBasePath = '{{{basePath}}}'; {{#operations}} {{#description}} /** -* {{&description}} -*/ + * {{&description}} + */ {{/description}} export enum {{classname}}ApiKeys { {{#authMethods}} diff --git a/src/infrastructure/templates/model.mustache b/src/infrastructure/templates/model.mustache index 0b3ca75891..3a3a1a3918 100755 --- a/src/infrastructure/templates/model.mustache +++ b/src/infrastructure/templates/model.mustache @@ -57,7 +57,7 @@ export namespace {{classname}} { export enum {{enumName}} { {{#allowableValues}} {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} {{/enumVars}} {{/allowableValues}} } diff --git a/src/model/blockchain/MerkleProofInfo.ts b/src/model/blockchain/MerkleProofInfo.ts index 18314665d8..86df7da991 100644 --- a/src/model/blockchain/MerkleProofInfo.ts +++ b/src/model/blockchain/MerkleProofInfo.ts @@ -1,4 +1,4 @@ -import { MerklePathItem } from "./MerklePathItem"; +import { MerklePathItem } from './MerklePathItem'; /* * Copyright 2019 NEM diff --git a/src/model/receipt/BalanceTransferReceipt.ts b/src/model/receipt/BalanceTransferReceipt.ts index 1442fe3e82..a1e2416028 100644 --- a/src/model/receipt/BalanceTransferReceipt.ts +++ b/src/model/receipt/BalanceTransferReceipt.ts @@ -15,7 +15,7 @@ */ import { Convert } from '../../core/format/Convert'; -import { UnresolvedMapping } from "../../core/utils/UnresolvedMapping"; +import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; diff --git a/src/model/transaction/SignedTransaction.ts b/src/model/transaction/SignedTransaction.ts index aade32582c..e8a9010d8d 100644 --- a/src/model/transaction/SignedTransaction.ts +++ b/src/model/transaction/SignedTransaction.ts @@ -17,7 +17,7 @@ import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; import {NetworkType} from '../blockchain/NetworkType'; -import { TransactionType } from "./TransactionType"; +import { TransactionType } from './TransactionType'; /** * SignedTransaction object is used to transfer the transaction data and the signature to the server diff --git a/src/model/transaction/TransactionStatus.ts b/src/model/transaction/TransactionStatus.ts index d96569d544..d09689ad2f 100644 --- a/src/model/transaction/TransactionStatus.ts +++ b/src/model/transaction/TransactionStatus.ts @@ -24,28 +24,28 @@ export class TransactionStatus { /** * @param group - * @param status + * @param code * @param hash * @param deadline * @param height */ constructor( - /** - * The transaction status being the error name in case of failure and success otherwise. - */ - public readonly status: string, /** * The transaction status group "failed", "unconfirmed", "confirmed", etc... */ - public readonly group?: string, + public readonly group: string, /** * The transaction hash. */ - public readonly hash?: string, + public readonly hash: string, /** * The transaction deadline. */ - public readonly deadline?: Deadline, + public readonly deadline: Deadline, + /** + * The transaction status code being the error name in case of failure and success otherwise. + */ + public readonly code?: string, /** * The height of the block at which it was confirmed or rejected. */ diff --git a/src/model/transaction/TransactionStatusError.ts b/src/model/transaction/TransactionStatusError.ts index b94f7e735c..313695bd4f 100644 --- a/src/model/transaction/TransactionStatusError.ts +++ b/src/model/transaction/TransactionStatusError.ts @@ -14,8 +14,8 @@ * limitations under the License. */ +import {Address} from '../account/Address'; import {Deadline} from './Deadline'; -import {Address} from "../account/Address"; /** * Transaction status error model returned by listeners diff --git a/src/service/AggregateTransactionService.ts b/src/service/AggregateTransactionService.ts index 4b278f54ef..0993ab6a1c 100644 --- a/src/service/AggregateTransactionService.ts +++ b/src/service/AggregateTransactionService.ts @@ -17,13 +17,13 @@ import { from as observableFrom, Observable, of as observableOf } from 'rxjs'; import { flatMap, map, mergeMap, toArray } from 'rxjs/operators'; import { TransactionMapping } from '../core/utils/TransactionMapping'; +import { MultisigRepository } from '../infrastructure/MultisigRepository'; import { MultisigAccountGraphInfo } from '../model/account/MultisigAccountGraphInfo'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; import { InnerTransaction } from '../model/transaction/InnerTransaction'; import { MultisigAccountModificationTransaction } from '../model/transaction/MultisigAccountModificationTransaction'; import { SignedTransaction } from '../model/transaction/SignedTransaction'; import { TransactionType } from '../model/transaction/TransactionType'; -import { MultisigRepository } from "../infrastructure/MultisigRepository"; /** * Aggregated Transaction service diff --git a/src/service/MetadataTransactionService.ts b/src/service/MetadataTransactionService.ts index 17b9da7d35..dc4d1acf5c 100644 --- a/src/service/MetadataTransactionService.ts +++ b/src/service/MetadataTransactionService.ts @@ -17,7 +17,7 @@ import { Observable, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { Convert } from '../core/format/Convert'; -import { MetadataHttp } from '../infrastructure/MetadataHttp'; +import { MetadataRepository } from '../infrastructure/MetadataRepository'; import { Address } from '../model/account/Address'; import { PublicAccount } from '../model/account/PublicAccount'; import { NetworkType } from '../model/blockchain/NetworkType'; @@ -29,9 +29,7 @@ import { AccountMetadataTransaction } from '../model/transaction/AccountMetadata import { Deadline } from '../model/transaction/Deadline'; import { MosaicMetadataTransaction } from '../model/transaction/MosaicMetadataTransaction'; import { NamespaceMetadataTransaction } from '../model/transaction/NamespaceMetadataTransaction'; -import { Transaction } from '../model/transaction/Transaction'; import { UInt64 } from '../model/UInt64'; -import { MetadataRepository } from "../infrastructure/MetadataRepository"; /** * MetadataTransaction service diff --git a/src/service/MosaicRestrictionTransactionService.ts b/src/service/MosaicRestrictionTransactionService.ts index fc3e48e45d..028f1aad6f 100644 --- a/src/service/MosaicRestrictionTransactionService.ts +++ b/src/service/MosaicRestrictionTransactionService.ts @@ -16,9 +16,11 @@ import { Observable, of } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs/operators'; +import { RestrictionMosaicRepository } from '../infrastructure/RestrictionMosaicRepository'; import { Address } from '../model/account/Address'; import { NetworkType } from '../model/blockchain/NetworkType'; import { MosaicId } from '../model/mosaic/MosaicId'; +import { NamespaceId } from '../model/namespace/NamespaceId'; import { MosaicGlobalRestriction } from '../model/restriction/MosaicGlobalRestriction'; import { MosaicGlobalRestrictionItem } from '../model/restriction/MosaicGlobalRestrictionItem'; import { MosaicRestrictionType } from '../model/restriction/MosaicRestrictionType'; @@ -27,8 +29,6 @@ import { MosaicAddressRestrictionTransaction } from '../model/transaction/Mosaic import { MosaicGlobalRestrictionTransaction } from '../model/transaction/MosaicGlobalRestrictionTransaction'; import { Transaction } from '../model/transaction/Transaction'; import { UInt64 } from '../model/UInt64'; -import { RestrictionMosaicRepository } from "../infrastructure/RestrictionMosaicRepository"; -import { NamespaceId } from "../model/namespace/NamespaceId"; /** * MosaicRestrictionTransactionService service @@ -114,7 +114,8 @@ export class MosaicRestrictionTransactionService { } return this.getAddressRestrictionEntry(mosaicId, restrictionKey, targetAddress).pipe( map((optionalValue) => { - const currentValue = optionalValue ? UInt64.fromNumericString(optionalValue) : this.defaultMosaicAddressRestrictionValue; + const currentValue = optionalValue ? + UInt64.fromNumericString(optionalValue) : this.defaultMosaicAddressRestrictionValue; return MosaicAddressRestrictionTransaction.create( deadline, mosaicId, diff --git a/src/service/MosaicService.ts b/src/service/MosaicService.ts index 745e07b64b..9ef23510f5 100644 --- a/src/service/MosaicService.ts +++ b/src/service/MosaicService.ts @@ -16,16 +16,14 @@ import { Observable, of as observableOf } from 'rxjs'; import { map, mergeMap, toArray } from 'rxjs/operators'; -import { AccountHttp } from '../infrastructure/AccountHttp'; -import { MosaicHttp } from '../infrastructure/MosaicHttp'; +import { AccountRepository } from '../infrastructure/AccountRepository'; +import { MosaicRepository } from '../infrastructure/MosaicRepository'; import { Address } from '../model/account/Address'; import { MosaicInfo } from '../model/model'; import { Mosaic } from '../model/mosaic/Mosaic'; import { MosaicId } from '../model/mosaic/MosaicId'; import { MosaicAmountView } from './MosaicAmountView'; import { MosaicView } from './MosaicView'; -import { AccountRepository } from "../infrastructure/AccountRepository"; -import { MosaicRepository } from "../infrastructure/MosaicRepository"; /** * Mosaic service @@ -50,7 +48,7 @@ export class MosaicService { mosaicsView(mosaicIds: MosaicId[]): Observable { return observableOf(mosaicIds).pipe( mergeMap((_) => this.mosaicRepository.getMosaics(mosaicIds).pipe( - mergeMap((_) => _), + mergeMap((info) => info), map((mosaicInfo: MosaicInfo) => { return new MosaicView(mosaicInfo); }), diff --git a/src/service/NamespaceService.ts b/src/service/NamespaceService.ts index 66337732ae..c7f18bc1fa 100644 --- a/src/service/NamespaceService.ts +++ b/src/service/NamespaceService.ts @@ -16,11 +16,11 @@ import { Observable } from 'rxjs'; import { map, mergeMap } from 'rxjs/operators'; +import { NamespaceRepository } from '../infrastructure/NamespaceRepository'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { NamespaceInfo } from '../model/namespace/NamespaceInfo'; import { NamespaceName } from '../model/namespace/NamespaceName'; import { Namespace } from './Namespace'; -import { NamespaceRepository } from "../infrastructure/NamespaceRepository"; /** * Namespace service diff --git a/src/service/TransactionService.ts b/src/service/TransactionService.ts index b3ece0259a..b443e01ffb 100644 --- a/src/service/TransactionService.ts +++ b/src/service/TransactionService.ts @@ -17,6 +17,8 @@ import { Observable, of } from 'rxjs'; import { flatMap, map, mergeMap, toArray } from 'rxjs/operators'; import { IListener } from '../infrastructure/IListener'; +import { ReceiptRepository } from '../infrastructure/ReceiptRepository'; +import { TransactionRepository } from '../infrastructure/TransactionRepository'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { AccountAddressRestrictionTransaction } from '../model/transaction/AccountAddressRestrictionTransaction'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; @@ -32,8 +34,6 @@ import { Transaction } from '../model/transaction/Transaction'; import { TransactionType } from '../model/transaction/TransactionType'; import { TransferTransaction } from '../model/transaction/TransferTransaction'; import { ITransactionService } from './interfaces/ITransactionService'; -import { TransactionRepository } from "../infrastructure/TransactionRepository"; -import { ReceiptRepository } from "../infrastructure/ReceiptRepository"; /** * Transaction Service diff --git a/test/core/utils/UnresolvedMapping.spec.ts b/test/core/utils/UnresolvedMapping.spec.ts index 19b64d1373..d8df75651f 100644 --- a/test/core/utils/UnresolvedMapping.spec.ts +++ b/test/core/utils/UnresolvedMapping.spec.ts @@ -17,7 +17,7 @@ import { expect } from 'chai'; import { Convert, RawAddress } from '../../../src/core/format'; import { UnresolvedMapping } from '../../../src/core/utils/UnresolvedMapping'; import { Address } from '../../../src/model/account/Address'; -import { NetworkType } from "../../../src/model/blockchain/NetworkType"; +import { NetworkType } from '../../../src/model/blockchain/NetworkType'; import { MosaicId } from '../../../src/model/mosaic/MosaicId'; import { NamespaceId } from '../../../src/model/namespace/NamespaceId'; diff --git a/test/infrastructure/Listener.spec.ts b/test/infrastructure/Listener.spec.ts index f6aa178479..0d0ba57b08 100644 --- a/test/infrastructure/Listener.spec.ts +++ b/test/infrastructure/Listener.spec.ts @@ -14,13 +14,12 @@ * limitations under the License. */ +import { deepEqual } from 'assert'; import { expect } from 'chai'; import { Listener } from '../../src/infrastructure/Listener'; -import { Address } from "../../src/model/account/Address"; -import { deepEqual } from "assert"; -import { UInt64 } from "../../src/model/UInt64"; -import { timeout } from "rxjs/operators"; -import { TransactionStatusError } from "../../src/model/transaction/TransactionStatusError"; +import { Address } from '../../src/model/account/Address'; +import { TransactionStatusError } from '../../src/model/transaction/TransactionStatusError'; +import { UInt64 } from '../../src/model/UInt64'; describe('Listener', () => { it('should createComplete a WebSocket instance given url parameter', () => { @@ -40,7 +39,6 @@ describe('Listener', () => { describe('onStatusWhenAddressIsTheSame', () => { it('Should forward status', () => { - const errorEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96860EB'; const errorAddress = Address.createFromEncoded(errorEncodedAddress); @@ -67,8 +65,8 @@ describe('Listener', () => { const reportedStatus = new Array(); - listener.status(errorAddress).subscribe((transactionStatusError) => { - reportedStatus.push(transactionStatusError); + listener.status(errorAddress).subscribe((error) => { + reportedStatus.push(error); }); listener.handleMessage(statusInfoErrorDTO, null); @@ -80,24 +78,21 @@ describe('Listener', () => { expect(transactionStatusError.status).to.be.equal(statusInfoErrorDTO.status); deepEqual(transactionStatusError.deadline.toDTO(), UInt64.fromNumericString(statusInfoErrorDTO.deadline).toDTO()); - }); }); describe('onStatusWhenAddressIsDifferentAddress', () => { it('Should not forward status', () => { - const errorEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96860EB'; const subscribedEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96AAAAA'; const subscribedAddress = Address.createFromEncoded(subscribedEncodedAddress); + // tslint:disable-next-line: max-classes-per-file class WebSocketMock { - constructor(public readonly url: string) { } - send(payload: string) { expect(payload).to.be.eq(`{"subscribe":"status/${subscribedAddress.plain()}"}`); } @@ -121,9 +116,8 @@ describe('Listener', () => { }); listener.handleMessage(statusInfoErrorDTO, null); - - expect(reportedStatus.length).to.be.equal(0); + expect(reportedStatus.length).to.be.equal(0); }); }); @@ -132,7 +126,7 @@ describe('Listener', () => { it('should reject because of wrong server url', async () => { const listener = new Listener('https://notcorrecturl:0000'); await listener.open() - .then((result) => { + .then(() => { throw new Error('This should not be called when expecting error'); }) .catch((error) => { diff --git a/test/infrastructure/RepositoryFactory.spec.ts b/test/infrastructure/RepositoryFactory.spec.ts index 3ee35f30b4..5dfcbcfd05 100644 --- a/test/infrastructure/RepositoryFactory.spec.ts +++ b/test/infrastructure/RepositoryFactory.spec.ts @@ -25,7 +25,7 @@ import { NetworkType } from '../../src/model/blockchain/NetworkType'; describe('RepositoryFactory', () => { it('Should create repositories', () => { - const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000'); + const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000', NetworkType.MIJIN_TEST, 'testHash'); expect(repositoryFactory.createBlockRepository()).to.be.not.null; expect(repositoryFactory.createNetworkRepository()).to.be.not.null; @@ -47,47 +47,40 @@ describe('RepositoryFactory', () => { it('Should get GenerationHash from cache', (done) => { let counter = 0; - const repositoryMock: BlockRepository = mock(); - const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map((v) => { counter++; return v; })); when(repositoryMock.getBlockByHeight('1')).thenReturn(observableOfBlockInfo); - expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); - const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { createBlockRepository(): BlockRepository { return instance(repositoryMock); } - })('http://localhost:3000'); + })('http://localhost:3000', NetworkType.MIJIN_TEST); expect(counter).to.be.equals(0); repositoryFactory.getGenerationHash().subscribe((gh) => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); - repositoryFactory.getGenerationHash().subscribe(gh => { + repositoryFactory.getGenerationHash().subscribe((g) => { expect(counter).to.be.equals(1); - expect(gh).to.be.equals('aaaa'); - repositoryFactory.getGenerationHash().subscribe(gh => { + expect(g).to.be.equals('aaaa'); + repositoryFactory.getGenerationHash().subscribe((h) => { expect(counter).to.be.equals(1); - expect(gh).to.be.equals('aaaa'); + expect(h).to.be.equals('aaaa'); done(); }); }); }); - }); it('Should get NetworkType from cache', (done) => { let counter = 0; - const repositoryMock: NetworkRepository = mock(); - const expectedNetworkType = NetworkType.MIJIN_TEST; const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; @@ -97,19 +90,20 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); + // tslint:disable-next-line: max-classes-per-file const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })('http://localhost:3000'); + })('http://localhost:3000', undefined, 'testHash'); expect(counter).to.be.equals(0); repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((network) => { expect(counter).to.be.equals(1); - expect(networkType).to.be.equals(expectedNetworkType); + expect(network).to.be.equals(expectedNetworkType); done(); }); }); @@ -131,20 +125,20 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); + // tslint:disable-next-line: max-classes-per-file const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { - createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })('http://localhost:3000', expectedNetworkType); + })('http://localhost:3000', expectedNetworkType, 'testHash'); expect(counter).to.be.equals(0); repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((network) => { expect(counter).to.be.equals(0); - expect(networkType).to.be.equals(expectedNetworkType); + expect(network).to.be.equals(expectedNetworkType); done(); }); }); diff --git a/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts b/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts index 8c38aa5651..9d84277290 100644 --- a/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts +++ b/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts @@ -21,8 +21,6 @@ import {Account} from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; import { MosaicId } from '../../../src/model/mosaic/MosaicId'; -import { AddressAlias } from '../../../src/model/namespace/AddressAlias'; -import { MosaicAlias } from '../../../src/model/namespace/MosaicAlias'; import { NamespaceId } from '../../../src/model/namespace/NamespaceId'; import { ReceiptType } from '../../../src/model/receipt/ReceiptType'; import { UInt64 } from '../../../src/model/UInt64'; diff --git a/test/model/account/Address.spec.ts b/test/model/account/Address.spec.ts index fffe493f28..6bec2ff4d5 100644 --- a/test/model/account/Address.spec.ts +++ b/test/model/account/Address.spec.ts @@ -15,10 +15,9 @@ */ import { expect } from 'chai'; +import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; -import { Convert as convert, RawAddress } from "../../../src/core/format"; -import { Account } from "../../../src/model/account/Account"; const Address_Decoded_Size = 25; @@ -128,20 +127,23 @@ describe('Address', () => { }); it('It creates the address from an encoded value', () => { - let encoded = '917E7E29A01014C2F300000000000000000000000000000000'; + const encoded = '917E7E29A01014C2F300000000000000000000000000000000'; const address = Address.createFromEncoded(encoded); expect(address.encoded()).to.be.equal(encoded); }); describe('isValidRawAddress', () => { - it('returns true for valid address when generated', () => { // Assert: - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MIJIN_TEST).address.plain(), NetworkType.MIJIN_TEST)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MAIN_NET).address.plain(), NetworkType.MAIN_NET)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MIJIN).address.plain(), NetworkType.MIJIN)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.TEST_NET).address.plain(), NetworkType.TEST_NET)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MIJIN_TEST).address.plain(), NetworkType.MIJIN_TEST)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MAIN_NET).address.plain(), NetworkType.MAIN_NET)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MIJIN).address.plain(), NetworkType.MIJIN)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.TEST_NET).address.plain(), NetworkType.TEST_NET)).to.equal(true); }); it('returns true for valid address', () => { @@ -181,10 +183,14 @@ describe('Address', () => { it('returns true for valid address when generated', () => { // Assert: - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MIJIN_TEST).address.encoded(), NetworkType.MIJIN_TEST)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MAIN_NET).address.encoded(), NetworkType.MAIN_NET)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MIJIN).address.encoded(), NetworkType.MIJIN)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.TEST_NET).address.encoded(), NetworkType.TEST_NET)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MIJIN_TEST).address.encoded(), NetworkType.MIJIN_TEST)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MAIN_NET).address.encoded(), NetworkType.MAIN_NET)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MIJIN).address.encoded(), NetworkType.MIJIN)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.TEST_NET).address.encoded(), NetworkType.TEST_NET)).to.equal(true); }); it('returns true for valid encoded address', () => { diff --git a/test/model/transaction/HashLockTransaction.spec.ts b/test/model/transaction/HashLockTransaction.spec.ts index 03bcf563fe..70df873a44 100644 --- a/test/model/transaction/HashLockTransaction.spec.ts +++ b/test/model/transaction/HashLockTransaction.spec.ts @@ -14,6 +14,7 @@ * limitations under the License. */ import {expect} from 'chai'; +import {Convert} from '../../../src/core/format'; import {NetworkType} from '../../../src/model/blockchain/NetworkType'; import { NetworkCurrencyMosaic } from '../../../src/model/mosaic/NetworkCurrencyMosaic'; import {AggregateTransaction} from '../../../src/model/transaction/AggregateTransaction'; @@ -21,7 +22,6 @@ import {Deadline} from '../../../src/model/transaction/Deadline'; import {HashLockTransaction} from '../../../src/model/transaction/HashLockTransaction'; import {UInt64} from '../../../src/model/UInt64'; import {TestingAccount} from '../../conf/conf.spec'; -import {Convert} from "../../../src/core/format"; describe('HashLockTransaction', () => { const account = TestingAccount; diff --git a/test/model/transaction/TransactionStatus.spec.ts b/test/model/transaction/TransactionStatus.spec.ts index f0ac87f8a6..55a2b31464 100644 --- a/test/model/transaction/TransactionStatus.spec.ts +++ b/test/model/transaction/TransactionStatus.spec.ts @@ -16,6 +16,7 @@ import {deepEqual} from 'assert'; import {expect} from 'chai'; +import { TransactionStatusTypeEnum } from '../../../src/infrastructure/model/transactionStatusTypeEnum'; import {Deadline} from '../../../src/model/transaction/Deadline'; import {TransactionStatus} from '../../../src/model/transaction/TransactionStatus'; import {UInt64} from '../../../src/model/UInt64'; @@ -27,19 +28,19 @@ describe('TransactionStatus', () => { group: 'confirmed', hash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219', height: new UInt64([ 1, 0 ]), - status: 'Success', + code: TransactionStatusTypeEnum.Success, }; const transactionStatus = new TransactionStatus( - transactionStatusDTO.status, transactionStatusDTO.group, transactionStatusDTO.hash, transactionStatusDTO.deadline, + transactionStatusDTO.code, transactionStatusDTO.height, ); expect(transactionStatus.group).to.be.equal(transactionStatusDTO.group); - expect(transactionStatus.status).to.be.equal(transactionStatusDTO.status); + expect(transactionStatus.code).to.be.equal(transactionStatusDTO.code); expect(transactionStatus.hash).to.be.equal(transactionStatusDTO.hash); deepEqual(transactionStatus.deadline, transactionStatusDTO.deadline); deepEqual(transactionStatus.height, transactionStatusDTO.height); diff --git a/test/model/transaction/TransactionStatusError.spec.ts b/test/model/transaction/TransactionStatusError.spec.ts index 156c3f902b..b7fcc61867 100644 --- a/test/model/transaction/TransactionStatusError.spec.ts +++ b/test/model/transaction/TransactionStatusError.spec.ts @@ -16,10 +16,10 @@ import {deepEqual} from 'assert'; import {expect} from 'chai'; -import {TransactionStatusError} from '../../../src/model/transaction/TransactionStatusError'; +import {Address} from '../../../src/model/account/Address'; import {Deadline} from '../../../src/model/transaction/Deadline'; +import {TransactionStatusError} from '../../../src/model/transaction/TransactionStatusError'; import { UInt64 } from '../../../src/model/UInt64'; -import {Address} from "../../../src/model/account/Address"; describe('TransactionStatusError', () => { diff --git a/test/service/MosaicService.spec.ts b/test/service/MosaicService.spec.ts index 6508e006e5..d1fa62292d 100644 --- a/test/service/MosaicService.spec.ts +++ b/test/service/MosaicService.spec.ts @@ -18,6 +18,7 @@ import {expect} from 'chai'; import {AccountHttp} from '../../src/infrastructure/AccountHttp'; import {MosaicHttp} from '../../src/infrastructure/MosaicHttp'; import {Address} from '../../src/model/account/Address'; +import { NetworkType } from '../../src/model/model'; import {Mosaic} from '../../src/model/mosaic/Mosaic'; import {MosaicId} from '../../src/model/mosaic/MosaicId'; import {MosaicInfo} from '../../src/model/mosaic/MosaicInfo'; @@ -31,7 +32,7 @@ describe('MosaicService', () => { it('mosaicsView', () => { const mosaicId = new MosaicId([3294802500, 2243684972]); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsView([mosaicId]).subscribe((mosaicsView: MosaicView[]) => { const mosaicView = mosaicsView[0]; expect(mosaicView.mosaicInfo).to.be.an.instanceof(MosaicInfo); @@ -41,7 +42,7 @@ describe('MosaicService', () => { it('mosaicsView of no existing mosaicId', () => { const mosaicId = new MosaicId([1234, 1234]); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsView([mosaicId]).subscribe((mosaicsView: MosaicView[]) => { expect(mosaicsView.length).to.be.equal(0); }); @@ -49,7 +50,7 @@ describe('MosaicService', () => { it('mosaicsAmountView', () => { const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountViewFromAddress(Address.createFromRawAddress('SARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJETM3ZSP')) .subscribe((mosaicsAmountView: MosaicAmountView[]) => { const mosaicAmountView = mosaicsAmountView[0]; @@ -59,7 +60,7 @@ describe('MosaicService', () => { it('mosaicsAmountView of no existing account', () => { const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountViewFromAddress(Address.createFromRawAddress('SCKBZAMIQ6F46QMZUANE6E33KA63KA7KEQ5X6WJW')) .subscribe((mosaicsAmountView: MosaicAmountView[]) => { expect(mosaicsAmountView.length).to.be.equal(0); @@ -69,7 +70,7 @@ describe('MosaicService', () => { it('mosaicsAmountView', () => { const mosaic = new Mosaic(new MosaicId([3646934825, 3576016193]), UInt64.fromUint(1000)); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountView([mosaic]).subscribe((mosaicsAmountView: MosaicAmountView[]) => { const mosaicAmountView = mosaicsAmountView[0]; expect(mosaicAmountView.mosaicInfo).to.be.an.instanceof(MosaicInfo); From ab5a537dff8664abfea92958971230d45eb04f6e Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:27:50 +0000 Subject: [PATCH 16/22] Fixed #393 applied catbuffer generator on aggregate --- .../AggregateBondedTransactionBuilder.ts | 8 +- .../AggregateCompleteTransactionBuilder.ts | 8 +- .../AggregateTransactionBodyBuilder.ts | 52 ++- .../catbuffer/BalanceChangeReceiptBuilder.ts | 111 +++++ .../BalanceTransferReceiptBuilder.ts | 132 ++++++ .../catbuffer/BlockHeaderBuilder.ts | 387 ++++++++++++++++++ .../catbuffer/EmbeddedTransactionHelper.ts | 181 ++++++++ src/infrastructure/catbuffer/EntityTypeDto.ts | 40 ++ .../catbuffer/GeneratorUtils.ts | 9 + .../catbuffer/InflationReceiptBuilder.ts | 92 +++++ .../catbuffer/MosaicExpiryReceiptBuilder.ts | 92 +++++ .../NamespaceExpiryReceiptBuilder.ts | 92 +++++ .../catbuffer/ReceiptBuilder.ts | 108 +++++ .../catbuffer/ReceiptTypeDto.ts | 27 ++ .../AccountAddressRestrictionTransaction.ts | 8 +- .../transaction/AccountLinkTransaction.ts | 8 +- .../transaction/AccountMetadataTransaction.ts | 8 +- .../AccountMosaicRestrictionTransaction.ts | 8 +- .../AccountOperationRestrictionTransaction.ts | 8 +- .../transaction/AddressAliasTransaction.ts | 8 +- src/model/transaction/AggregateTransaction.ts | 58 +-- src/model/transaction/LockFundsTransaction.ts | 8 +- .../MosaicAddressRestrictionTransaction.ts | 8 +- .../transaction/MosaicAliasTransaction.ts | 8 +- .../MosaicDefinitionTransaction.ts | 8 +- .../MosaicGlobalRestrictionTransaction.ts | 8 +- .../transaction/MosaicMetadataTransaction.ts | 8 +- .../MosaicSupplyChangeTransaction.ts | 8 +- .../MultisigAccountModificationTransaction.ts | 8 +- .../NamespaceMetadataTransaction.ts | 8 +- .../NamespaceRegistrationTransaction.ts | 30 +- .../transaction/SecretLockTransaction.ts | 8 +- .../transaction/SecretProofTransaction.ts | 8 +- src/model/transaction/Transaction.ts | 8 +- src/model/transaction/TransferTransaction.ts | 8 +- test/model/transaction/Transaction.spec.ts | 3 +- 36 files changed, 1431 insertions(+), 151 deletions(-) create mode 100644 src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/BlockHeaderBuilder.ts create mode 100644 src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts create mode 100644 src/infrastructure/catbuffer/InflationReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptBuilder.ts create mode 100644 src/infrastructure/catbuffer/ReceiptTypeDto.ts diff --git a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts index 56f42da250..ba3b56b75f 100644 --- a/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateBondedTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateBondedTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts index 6dd372648f..f6b6e0983e 100644 --- a/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateCompleteTransactionBuilder.ts @@ -21,6 +21,8 @@ import { AggregateTransactionBodyBuilder } from './AggregateTransactionBodyBuilder'; import { AmountDto } from './AmountDto'; +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; import { EntityTypeDto } from './EntityTypeDto'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -50,7 +52,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ // tslint:disable-next-line: max-line-length - public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, fee: AmountDto, deadline: TimestampDto, transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { super(signature, signerPublicKey, version, network, type, fee, deadline); this.aggregateTransactionBody = new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -94,7 +96,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.aggregateTransactionBody.getTransactions(); } @@ -103,7 +105,7 @@ export class AggregateCompleteTransactionBuilder extends TransactionBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.aggregateTransactionBody.getCosignatures(); } diff --git a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts index b4de916720..5dd2492e47 100644 --- a/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts +++ b/src/infrastructure/catbuffer/AggregateTransactionBodyBuilder.ts @@ -19,6 +19,9 @@ *** along with Catapult. If not, see . **/ +import { CosignatureBuilder } from './CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from './EmbeddedTransactionHelper'; import { GeneratorUtils } from './GeneratorUtils'; import { Hash256Dto } from './Hash256Dto'; @@ -29,9 +32,9 @@ export class AggregateTransactionBodyBuilder { /** Reserved padding to align end of AggregateTransactionHeader on 8-byte boundary. */ aggregateTransactionHeader_Reserved1: number; /** Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - transactions: Uint8Array; + transactions: EmbeddedTransactionBuilder[]; /** Cosignatures data (fills remaining body space after transactions). */ - cosignatures: Uint8Array; + cosignatures: CosignatureBuilder[]; /** * Constructor. @@ -40,7 +43,8 @@ export class AggregateTransactionBodyBuilder { * @param transactions Sub-transaction data (transactions are variable sized and payload size is in bytes). * @param cosignatures Cosignatures data (fills remaining body space after transactions). */ - public constructor(transactionsHash: Hash256Dto, transactions: Uint8Array, cosignatures: Uint8Array) { + // tslint:disable-next-line: max-line-length + public constructor(transactionsHash: Hash256Dto, transactions: EmbeddedTransactionBuilder[], cosignatures: CosignatureBuilder[]) { this.transactionsHash = transactionsHash; this.aggregateTransactionHeader_Reserved1 = 0; this.transactions = transactions; @@ -62,9 +66,24 @@ export class AggregateTransactionBodyBuilder { // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); byteArray.splice(0, 4); - const transactions = GeneratorUtils.getBytes(Uint8Array.from(byteArray), payloadSize); - byteArray.splice(0, payloadSize); - const cosignatures = Uint8Array.from(byteArray); + let transactionsByteSize = payloadSize; + const transactions: EmbeddedTransactionBuilder[] = []; + while (transactionsByteSize > 0) { + const item = EmbeddedTransactionHelper.loadFromBinary(Uint8Array.from(byteArray)); + transactions.push(item); + const itemSize = item.getSize() + GeneratorUtils.getTransactionPaddingSize(item.getSize(), 8); + transactionsByteSize -= itemSize; + byteArray.splice(0, itemSize); + } + let cosignaturesByteSize = byteArray.length; + const cosignatures: CosignatureBuilder[] = []; + while (cosignaturesByteSize > 0) { + const item = CosignatureBuilder.loadFromBinary(Uint8Array.from(byteArray)); + cosignatures.push(item); + const itemSize = item.getSize(); + cosignaturesByteSize -= itemSize; + byteArray.splice(0, itemSize); + } return new AggregateTransactionBodyBuilder(transactionsHash, transactions, cosignatures); } @@ -91,7 +110,7 @@ export class AggregateTransactionBodyBuilder { * * @return Sub-transaction data (transactions are variable sized and payload size is in bytes). */ - public getTransactions(): Uint8Array { + public getTransactions(): EmbeddedTransactionBuilder[] { return this.transactions; } @@ -100,7 +119,7 @@ export class AggregateTransactionBodyBuilder { * * @return Cosignatures data (fills remaining body space after transactions). */ - public getCosignatures(): Uint8Array { + public getCosignatures(): CosignatureBuilder[] { return this.cosignatures; } @@ -114,8 +133,8 @@ export class AggregateTransactionBodyBuilder { size += this.transactionsHash.getSize(); size += 4; // payloadSize size += 4; // aggregateTransactionHeader_Reserved1 - size += this.transactions.length; - size += this.cosignatures.length; + this.transactions.forEach((o) => size += EmbeddedTransactionHelper.serialize(o).length); + this.cosignatures.forEach((o) => size += o.getSize()); return size; } @@ -128,13 +147,20 @@ export class AggregateTransactionBodyBuilder { let newArray = Uint8Array.from([]); const transactionsHashBytes = this.transactionsHash.serialize(); newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); - const payloadSizeBytes = GeneratorUtils.uintToBuffer(this.transactions.length, 4); + // tslint:disable-next-line: max-line-length + const payloadSizeBytes = GeneratorUtils.uintToBuffer(EmbeddedTransactionHelper.getEmbeddedTransactionSize(this.transactions), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, payloadSizeBytes); // tslint:disable-next-line: max-line-length const aggregateTransactionHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getAggregateTransactionHeader_Reserved1(), 4); newArray = GeneratorUtils.concatTypedArrays(newArray, aggregateTransactionHeader_Reserved1Bytes); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.transactions); - newArray = GeneratorUtils.concatTypedArrays(newArray, this.cosignatures); + this.transactions.forEach((item) => { + const transactionsBytes = EmbeddedTransactionHelper.serialize(item); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsBytes); + }); + this.cosignatures.forEach((item) => { + const cosignaturesBytes = item.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, cosignaturesBytes); + }); return newArray; } } diff --git a/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts new file mode 100644 index 0000000000..7670f20e0f --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceChangeReceiptBuilder.ts @@ -0,0 +1,111 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance change receipt. */ +export class BalanceChangeReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Account public key. */ + targetPublicKey: KeyDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param targetPublicKey Account public key. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, targetPublicKey: KeyDto) { + super(version, type); + this.mosaic = mosaic; + this.targetPublicKey = targetPublicKey; + } + + /** + * Creates an instance of BalanceChangeReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceChangeReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceChangeReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const targetPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, targetPublicKey.getSize()); + return new BalanceChangeReceiptBuilder(superObject.version, superObject.type, mosaic, targetPublicKey); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets account public key. + * + * @return Account public key. + */ + public getTargetPublicKey(): KeyDto { + return this.targetPublicKey; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.targetPublicKey.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const targetPublicKeyBytes = this.targetPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, targetPublicKeyBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts new file mode 100644 index 0000000000..89215dc6c1 --- /dev/null +++ b/src/infrastructure/catbuffer/BalanceTransferReceiptBuilder.ts @@ -0,0 +1,132 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { AddressDto } from './AddressDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { KeyDto } from './KeyDto'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a balance transfer receipt. */ +export class BalanceTransferReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + /** Mosaic sender public key. */ + senderPublicKey: KeyDto; + /** Mosaic recipient address. */ + recipientAddress: AddressDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + * @param senderPublicKey Mosaic sender public key. + * @param recipientAddress Mosaic recipient address. + */ + // tslint:disable-next-line: max-line-length + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder, senderPublicKey: KeyDto, recipientAddress: AddressDto) { + super(version, type); + this.mosaic = mosaic; + this.senderPublicKey = senderPublicKey; + this.recipientAddress = recipientAddress; + } + + /** + * Creates an instance of BalanceTransferReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BalanceTransferReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BalanceTransferReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + const senderPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, senderPublicKey.getSize()); + const recipientAddress = AddressDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, recipientAddress.getSize()); + // tslint:disable-next-line: max-line-length + return new BalanceTransferReceiptBuilder(superObject.version, superObject.type, mosaic, senderPublicKey, recipientAddress); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets mosaic sender public key. + * + * @return Mosaic sender public key. + */ + public getSenderPublicKey(): KeyDto { + return this.senderPublicKey; + } + + /** + * Gets mosaic recipient address. + * + * @return Mosaic recipient address. + */ + public getRecipientAddress(): AddressDto { + return this.recipientAddress; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + size += this.senderPublicKey.getSize(); + size += this.recipientAddress.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + const senderPublicKeyBytes = this.senderPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, senderPublicKeyBytes); + const recipientAddressBytes = this.recipientAddress.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, recipientAddressBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/BlockHeaderBuilder.ts b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts new file mode 100644 index 0000000000..eb693aa3fa --- /dev/null +++ b/src/infrastructure/catbuffer/BlockHeaderBuilder.ts @@ -0,0 +1,387 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { BlockFeeMultiplierDto } from './BlockFeeMultiplierDto'; +import { DifficultyDto } from './DifficultyDto'; +import { EntityTypeDto } from './EntityTypeDto'; +import { GeneratorUtils } from './GeneratorUtils'; +import { Hash256Dto } from './Hash256Dto'; +import { HeightDto } from './HeightDto'; +import { KeyDto } from './KeyDto'; +import { NetworkTypeDto } from './NetworkTypeDto'; +import { SignatureDto } from './SignatureDto'; +import { TimestampDto } from './TimestampDto'; + +/** Binary layout for a block header. */ +export class BlockHeaderBuilder { + /** Entity size. */ + size = 0; + /** Reserved padding to align Signature on 8-byte boundary. */ + verifiableEntityHeader_Reserved1: number; + /** Entity signature. */ + signature: SignatureDto; + /** Entity signer's public key. */ + signerPublicKey: KeyDto; + /** Reserved padding to align end of EntityBody on 8-byte boundary. */ + entityBody_Reserved1: number; + /** Entity version. */ + version: number; + /** Entity network. */ + network: NetworkTypeDto; + /** Entity type. */ + type: EntityTypeDto; + /** Block height. */ + height: HeightDto; + /** Number of milliseconds elapsed since creation of nemesis block. */ + timestamp: TimestampDto; + /** Block difficulty. */ + difficulty: DifficultyDto; + /** Previous block hash. */ + previousBlockHash: Hash256Dto; + /** Hash of the transactions in this block. */ + transactionsHash: Hash256Dto; + /** Hash of the receipts generated by this block. */ + receiptsHash: Hash256Dto; + /** Hash of the global chain state at this block. */ + stateHash: Hash256Dto; + /** Beneficiary public key designated by harvester. */ + beneficiaryPublicKey: KeyDto; + /** Fee multiplier applied to block transactions. */ + feeMultiplier: BlockFeeMultiplierDto; + /** Reserved padding to align end of BlockHeader on 8-byte boundary. */ + blockHeader_Reserved1: number; + + /** + * Constructor. + * + * @param signature Entity signature. + * @param signerPublicKey Entity signer's public key. + * @param version Entity version. + * @param network Entity network. + * @param type Entity type. + * @param height Block height. + * @param timestamp Number of milliseconds elapsed since creation of nemesis block. + * @param difficulty Block difficulty. + * @param previousBlockHash Previous block hash. + * @param transactionsHash Hash of the transactions in this block. + * @param receiptsHash Hash of the receipts generated by this block. + * @param stateHash Hash of the global chain state at this block. + * @param beneficiaryPublicKey Beneficiary public key designated by harvester. + * @param feeMultiplier Fee multiplier applied to block transactions. + */ + // tslint:disable-next-line: max-line-length + public constructor(signature: SignatureDto, signerPublicKey: KeyDto, version: number, network: NetworkTypeDto, type: EntityTypeDto, height: HeightDto, timestamp: TimestampDto, difficulty: DifficultyDto, previousBlockHash: Hash256Dto, transactionsHash: Hash256Dto, receiptsHash: Hash256Dto, stateHash: Hash256Dto, beneficiaryPublicKey: KeyDto, feeMultiplier: BlockFeeMultiplierDto) { + this.verifiableEntityHeader_Reserved1 = 0; + this.signature = signature; + this.signerPublicKey = signerPublicKey; + this.entityBody_Reserved1 = 0; + this.version = version; + this.network = network; + this.type = type; + this.height = height; + this.timestamp = timestamp; + this.difficulty = difficulty; + this.previousBlockHash = previousBlockHash; + this.transactionsHash = transactionsHash; + this.receiptsHash = receiptsHash; + this.stateHash = stateHash; + this.beneficiaryPublicKey = beneficiaryPublicKey; + this.feeMultiplier = feeMultiplier; + this.blockHeader_Reserved1 = 0; + } + + /** + * Creates an instance of BlockHeaderBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of BlockHeaderBuilder. + */ + public static loadFromBinary(payload: Uint8Array): BlockHeaderBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const signature = SignatureDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signature.getSize()); + const signerPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, signerPublicKey.getSize()); + const entityBody_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const network = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 1)); + byteArray.splice(0, 1); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const height = HeightDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, height.getSize()); + const timestamp = TimestampDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, timestamp.getSize()); + const difficulty = DifficultyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, difficulty.getSize()); + const previousBlockHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, previousBlockHash.getSize()); + const transactionsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, transactionsHash.getSize()); + const receiptsHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, receiptsHash.getSize()); + const stateHash = Hash256Dto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, stateHash.getSize()); + const beneficiaryPublicKey = KeyDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, beneficiaryPublicKey.getSize()); + const feeMultiplier = BlockFeeMultiplierDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, feeMultiplier.getSize()); + const blockHeader_Reserved1 = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + // tslint:disable-next-line: max-line-length + return new BlockHeaderBuilder(signature, signerPublicKey, version, network, type, height, timestamp, difficulty, previousBlockHash, transactionsHash, receiptsHash, stateHash, beneficiaryPublicKey, feeMultiplier); + } + + /** + * Gets reserved padding to align Signature on 8-byte boundary. + * + * @return Reserved padding to align Signature on 8-byte boundary. + */ + public getVerifiableEntityHeader_Reserved1(): number { + return this.verifiableEntityHeader_Reserved1; + } + + /** + * Gets entity signature. + * + * @return Entity signature. + */ + public getSignature(): SignatureDto { + return this.signature; + } + + /** + * Gets entity signer's public key. + * + * @return Entity signer's public key. + */ + public getSignerPublicKey(): KeyDto { + return this.signerPublicKey; + } + + /** + * Gets reserved padding to align end of EntityBody on 8-byte boundary. + * + * @return Reserved padding to align end of EntityBody on 8-byte boundary. + */ + public getEntityBody_Reserved1(): number { + return this.entityBody_Reserved1; + } + + /** + * Gets entity version. + * + * @return Entity version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets entity network. + * + * @return Entity network. + */ + public getNetwork(): NetworkTypeDto { + return this.network; + } + + /** + * Gets entity type. + * + * @return Entity type. + */ + public getType(): EntityTypeDto { + return this.type; + } + + /** + * Gets block height. + * + * @return Block height. + */ + public getHeight(): HeightDto { + return this.height; + } + + /** + * Gets number of milliseconds elapsed since creation of nemesis block. + * + * @return Number of milliseconds elapsed since creation of nemesis block. + */ + public getTimestamp(): TimestampDto { + return this.timestamp; + } + + /** + * Gets block difficulty. + * + * @return Block difficulty. + */ + public getDifficulty(): DifficultyDto { + return this.difficulty; + } + + /** + * Gets previous block hash. + * + * @return Previous block hash. + */ + public getPreviousBlockHash(): Hash256Dto { + return this.previousBlockHash; + } + + /** + * Gets hash of the transactions in this block. + * + * @return Hash of the transactions in this block. + */ + public getTransactionsHash(): Hash256Dto { + return this.transactionsHash; + } + + /** + * Gets hash of the receipts generated by this block. + * + * @return Hash of the receipts generated by this block. + */ + public getReceiptsHash(): Hash256Dto { + return this.receiptsHash; + } + + /** + * Gets hash of the global chain state at this block. + * + * @return Hash of the global chain state at this block. + */ + public getStateHash(): Hash256Dto { + return this.stateHash; + } + + /** + * Gets beneficiary public key designated by harvester. + * + * @return Beneficiary public key designated by harvester. + */ + public getBeneficiaryPublicKey(): KeyDto { + return this.beneficiaryPublicKey; + } + + /** + * Gets fee multiplier applied to block transactions. + * + * @return Fee multiplier applied to block transactions. + */ + public getFeeMultiplier(): BlockFeeMultiplierDto { + return this.feeMultiplier; + } + + /** + * Gets reserved padding to align end of BlockHeader on 8-byte boundary. + * + * @return Reserved padding to align end of BlockHeader on 8-byte boundary. + */ + public getBlockHeader_Reserved1(): number { + return this.blockHeader_Reserved1; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 4; // verifiableEntityHeader_Reserved1 + size += this.signature.getSize(); + size += this.signerPublicKey.getSize(); + size += 4; // entityBody_Reserved1 + size += 1; // version + size += 1; // network + size += 2; // type + size += this.height.getSize(); + size += this.timestamp.getSize(); + size += this.difficulty.getSize(); + size += this.previousBlockHash.getSize(); + size += this.transactionsHash.getSize(); + size += this.receiptsHash.getSize(); + size += this.stateHash.getSize(); + size += this.beneficiaryPublicKey.getSize(); + size += this.feeMultiplier.getSize(); + size += 4; // blockHeader_Reserved1 + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + // tslint:disable-next-line: max-line-length + const verifiableEntityHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getVerifiableEntityHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, verifiableEntityHeader_Reserved1Bytes); + const signatureBytes = this.signature.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signatureBytes); + const signerPublicKeyBytes = this.signerPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, signerPublicKeyBytes); + const entityBody_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getEntityBody_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, entityBody_Reserved1Bytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const networkBytes = GeneratorUtils.uintToBuffer(this.network, 1); + newArray = GeneratorUtils.concatTypedArrays(newArray, networkBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + const heightBytes = this.height.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, heightBytes); + const timestampBytes = this.timestamp.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, timestampBytes); + const difficultyBytes = this.difficulty.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, difficultyBytes); + const previousBlockHashBytes = this.previousBlockHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, previousBlockHashBytes); + const transactionsHashBytes = this.transactionsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, transactionsHashBytes); + const receiptsHashBytes = this.receiptsHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, receiptsHashBytes); + const stateHashBytes = this.stateHash.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, stateHashBytes); + const beneficiaryPublicKeyBytes = this.beneficiaryPublicKey.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, beneficiaryPublicKeyBytes); + const feeMultiplierBytes = this.feeMultiplier.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, feeMultiplierBytes); + const blockHeader_Reserved1Bytes = GeneratorUtils.uintToBuffer(this.getBlockHeader_Reserved1(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, blockHeader_Reserved1Bytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts new file mode 100644 index 0000000000..ad436cfc30 --- /dev/null +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -0,0 +1,181 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { EntityTypeDto } from './EntityTypeDto' +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder' +import { GeneratorUtils } from './GeneratorUtils' +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder' +import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder' +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder' +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder' +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder' +import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder' +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder' +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder' +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder' +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder' +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder' +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder' +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder' +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder' +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder' +import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder' +import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder' +import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder' +import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder' + +export class EmbeddedTransactionHelper { + + public static serialize(transaction: EmbeddedTransactionBuilder): Uint8Array { + let byte: Uint8Array; + let padding: Uint8Array; + switch (transaction.type) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedTransferTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountLinkTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedHashLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretLockTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedSecretProofTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceMetadataTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicDefinitionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicSupplyChangeTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMultisigAccountModificationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAddressAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAliasTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedNamespaceRegistrationTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountMosaicRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedAccountOperationRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicAddressRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + byte = (transaction as EmbeddedMosaicGlobalRestrictionTransactionBuilder).serialize(); + padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); + default: + throw new Error(`Transaction type: ${transaction.type} not recognized.`) + } + } + + public static loadFromBinary(bytes: Uint8Array):EmbeddedTransactionBuilder { + const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); + switch (header.getType()) { + case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + default: + throw new Error(`Transaction type: ${header.getType()} not recognized.`) + } + } + + public static getEmbeddedTransactionSize(transactions: EmbeddedTransactionBuilder[]): number { + return transactions.map((o) => EmbeddedTransactionHelper.serialize(o).length).reduce((a, b) => a + b, 0); + } +} diff --git a/src/infrastructure/catbuffer/EntityTypeDto.ts b/src/infrastructure/catbuffer/EntityTypeDto.ts index cbbf804d10..4399620a5c 100644 --- a/src/infrastructure/catbuffer/EntityTypeDto.ts +++ b/src/infrastructure/catbuffer/EntityTypeDto.ts @@ -26,4 +26,44 @@ export enum EntityTypeDto { RESERVED = 0, /** Transfer transaction builder. */ TRANSFER_TRANSACTION_BUILDER = 16724, + /** Account link transaction builder. */ + ACCOUNT_LINK_TRANSACTION_BUILDER = 16716, + /** Hash lock transaction builder. */ + HASH_LOCK_TRANSACTION_BUILDER = 16712, + /** Secret lock transaction builder. */ + SECRET_LOCK_TRANSACTION_BUILDER = 16722, + /** Secret proof transaction builder. */ + SECRET_PROOF_TRANSACTION_BUILDER = 16978, + /** Account metadata transaction builder. */ + ACCOUNT_METADATA_TRANSACTION_BUILDER = 16708, + /** Mosaic metadata transaction builder. */ + MOSAIC_METADATA_TRANSACTION_BUILDER = 16964, + /** Namespace metadata transaction builder. */ + NAMESPACE_METADATA_TRANSACTION_BUILDER = 17220, + /** Mosaic definition transaction builder. */ + MOSAIC_DEFINITION_TRANSACTION_BUILDER = 16717, + /** Mosaic supply change transaction builder. */ + MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER = 16973, + /** Multisig account modification transaction builder. */ + MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER = 16725, + /** Address alias transaction builder. */ + ADDRESS_ALIAS_TRANSACTION_BUILDER = 16974, + /** Mosaic alias transaction builder. */ + MOSAIC_ALIAS_TRANSACTION_BUILDER = 17230, + /** Namespace registration transaction builder. */ + NAMESPACE_REGISTRATION_TRANSACTION_BUILDER = 16718, + /** Account address restriction transaction builder. */ + ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16720, + /** Account mosaic restriction transaction builder. */ + ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER = 16976, + /** Account operation restriction transaction builder. */ + ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER = 17232, + /** Mosaic address restriction transaction builder. */ + MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER = 16977, + /** Mosaic global restriction transaction builder. */ + MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER = 16721, + /** Aggregate complete transaction builder. */ + AGGREGATE_COMPLETE_TRANSACTION_BUILDER = 16705, + /** Aggregate bonded transaction builder. */ + AGGREGATE_BONDED_TRANSACTION_BUILDER = 16961, } diff --git a/src/infrastructure/catbuffer/GeneratorUtils.ts b/src/infrastructure/catbuffer/GeneratorUtils.ts index d1c6eb5d9b..74399315e0 100644 --- a/src/infrastructure/catbuffer/GeneratorUtils.ts +++ b/src/infrastructure/catbuffer/GeneratorUtils.ts @@ -145,4 +145,13 @@ export class GeneratorUtils { const bytes = binary.slice(0, size); return bytes; } + + /** + * Gets the padding size that rounds up \a size to the next multiple of \a alignment. + * @param size Inner transaction size + * @param alignment Next multiple alignment + */ + public static getTransactionPaddingSize(size: number, alignment: number): number { + return 0 === size % alignment ? 0 : alignment - (size % alignment); + } } diff --git a/src/infrastructure/catbuffer/InflationReceiptBuilder.ts b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts new file mode 100644 index 0000000000..d9d12527ec --- /dev/null +++ b/src/infrastructure/catbuffer/InflationReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicBuilder } from './MosaicBuilder'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for an inflation receipt. */ +export class InflationReceiptBuilder extends ReceiptBuilder { + /** Mosaic. */ + mosaic: MosaicBuilder; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param mosaic Mosaic. + */ + public constructor(version: number, type: ReceiptTypeDto, mosaic: MosaicBuilder) { + super(version, type); + this.mosaic = mosaic; + } + + /** + * Creates an instance of InflationReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of InflationReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): InflationReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const mosaic = MosaicBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, mosaic.getSize()); + return new InflationReceiptBuilder(superObject.version, superObject.type, mosaic); + } + + /** + * Gets mosaic. + * + * @return Mosaic. + */ + public getMosaic(): MosaicBuilder { + return this.mosaic; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.mosaic.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const mosaicBytes = this.mosaic.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, mosaicBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..3940e509e5 --- /dev/null +++ b/src/infrastructure/catbuffer/MosaicExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { MosaicIdDto } from './MosaicIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a mosaic expiry receipt. */ +export class MosaicExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring mosaic id. */ + artifactId: MosaicIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring mosaic id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: MosaicIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of MosaicExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of MosaicExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): MosaicExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = MosaicIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new MosaicExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring mosaic id. + * + * @return Expiring mosaic id. + */ + public getArtifactId(): MosaicIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts new file mode 100644 index 0000000000..2573d688a9 --- /dev/null +++ b/src/infrastructure/catbuffer/NamespaceExpiryReceiptBuilder.ts @@ -0,0 +1,92 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { NamespaceIdDto } from './NamespaceIdDto'; +import { ReceiptBuilder } from './ReceiptBuilder'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a namespace expiry receipt. */ +export class NamespaceExpiryReceiptBuilder extends ReceiptBuilder { + /** Expiring namespace id. */ + artifactId: NamespaceIdDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + * @param artifactId Expiring namespace id. + */ + public constructor(version: number, type: ReceiptTypeDto, artifactId: NamespaceIdDto) { + super(version, type); + this.artifactId = artifactId; + } + + /** + * Creates an instance of NamespaceExpiryReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of NamespaceExpiryReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): NamespaceExpiryReceiptBuilder { + const byteArray = Array.from(payload); + const superObject = ReceiptBuilder.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, superObject.getSize()); + const artifactId = NamespaceIdDto.loadFromBinary(Uint8Array.from(byteArray)); + byteArray.splice(0, artifactId.getSize()); + return new NamespaceExpiryReceiptBuilder(superObject.version, superObject.type, artifactId); + } + + /** + * Gets expiring namespace id. + * + * @return Expiring namespace id. + */ + public getArtifactId(): NamespaceIdDto { + return this.artifactId; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size: number = super.getSize(); + size += this.artifactId.getSize(); + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const superBytes = super.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, superBytes); + const artifactIdBytes = this.artifactId.serialize(); + newArray = GeneratorUtils.concatTypedArrays(newArray, artifactIdBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts new file mode 100644 index 0000000000..524bf945df --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -0,0 +1,108 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + +import { GeneratorUtils } from './GeneratorUtils'; +import { ReceiptTypeDto } from './ReceiptTypeDto'; + +/** Binary layout for a receipt entity. */ +export class ReceiptBuilder { + /** Entity size. */ + size = 0; + /** Receipt version. */ + version: number; + /** Receipt type. */ + type: ReceiptTypeDto; + + /** + * Constructor. + * + * @param version Receipt version. + * @param type Receipt type. + */ + public constructor(version: number, type: ReceiptTypeDto) { + this.version = version; + this.type = type; + } + + /** + * Creates an instance of ReceiptBuilder from binary payload. + * + * @param payload Byte payload to use to serialize the object. + * @return Instance of ReceiptBuilder. + */ + public static loadFromBinary(payload: Uint8Array): ReceiptBuilder { + const byteArray = Array.from(payload); + const size = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 4)); + byteArray.splice(0, 4); + const version = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + const type = GeneratorUtils.bufferToUint(GeneratorUtils.getBytes(Uint8Array.from(byteArray), 2)); + byteArray.splice(0, 2); + return new ReceiptBuilder(version, type); + } + + /** + * Gets receipt version. + * + * @return Receipt version. + */ + public getVersion(): number { + return this.version; + } + + /** + * Gets receipt type. + * + * @return Receipt type. + */ + public getType(): ReceiptTypeDto { + return this.type; + } + + /** + * Gets the size of the object. + * + * @return Size in bytes. + */ + public getSize(): number { + let size = 0; + size += 4; // size + size += 2; // version + size += 2; // type + return size; + } + + /** + * Serializes an object to bytes. + * + * @return Serialized bytes. + */ + public serialize(): Uint8Array { + let newArray = Uint8Array.from([]); + const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); + newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); + const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); + const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); + newArray = GeneratorUtils.concatTypedArrays(newArray, typeBytes); + return newArray; + } +} diff --git a/src/infrastructure/catbuffer/ReceiptTypeDto.ts b/src/infrastructure/catbuffer/ReceiptTypeDto.ts new file mode 100644 index 0000000000..f2d4bdc10f --- /dev/null +++ b/src/infrastructure/catbuffer/ReceiptTypeDto.ts @@ -0,0 +1,27 @@ +// tslint:disable: jsdoc-format +/** +*** Copyright (c) 2016-present, +*** Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved. +*** +*** This file is part of Catapult. +*** +*** Catapult is free software: you can redistribute it and/or modify +*** it under the terms of the GNU Lesser General Public License as published by +*** the Free Software Foundation, either version 3 of the License, or +*** (at your option) any later version. +*** +*** Catapult is distributed in the hope that it will be useful, +*** but WITHOUT ANY WARRANTY; without even the implied warranty of +*** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*** GNU Lesser General Public License for more details. +*** +*** You should have received a copy of the GNU Lesser General Public License +*** along with Catapult. If not, see . +**/ + + +/** Enumeration of receipt types. */ +export enum ReceiptTypeDto { + /** Reserved receipt type. */ + RESERVED = 0, +} diff --git a/src/model/transaction/AccountAddressRestrictionTransaction.ts b/src/model/transaction/AccountAddressRestrictionTransaction.ts index d730adc931..52cdf79951 100644 --- a/src/model/transaction/AccountAddressRestrictionTransaction.ts +++ b/src/model/transaction/AccountAddressRestrictionTransaction.ts @@ -22,6 +22,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -173,10 +174,10 @@ export class AccountAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -189,7 +190,6 @@ export class AccountAddressRestrictionTransaction extends Transaction { return new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(deletion, this.networkType)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountLinkTransaction.ts b/src/model/transaction/AccountLinkTransaction.ts index 9e6e813de3..2374266254 100644 --- a/src/model/transaction/AccountLinkTransaction.ts +++ b/src/model/transaction/AccountLinkTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/AccountLinkTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountLinkTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountLinkTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -150,10 +151,10 @@ export class AccountLinkTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountLinkTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountLinkTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -161,7 +162,6 @@ export class AccountLinkTransaction extends Transaction { new KeyDto(Convert.hexToUint8(this.remotePublicKey)), this.linkAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMetadataTransaction.ts b/src/model/transaction/AccountMetadataTransaction.ts index 78b2009887..d01429d3af 100644 --- a/src/model/transaction/AccountMetadataTransaction.ts +++ b/src/model/transaction/AccountMetadataTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/AccountMetadataTransactionBuilder'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAccountMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -178,10 +179,10 @@ export class AccountMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -191,7 +192,6 @@ export class AccountMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountMosaicRestrictionTransaction.ts b/src/model/transaction/AccountMosaicRestrictionTransaction.ts index 4037d9e687..d3b8902b53 100644 --- a/src/model/transaction/AccountMosaicRestrictionTransaction.ts +++ b/src/model/transaction/AccountMosaicRestrictionTransaction.ts @@ -22,6 +22,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountMosaicRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountMosaicRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -173,10 +174,10 @@ export class AccountMosaicRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountMosaicRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountMosaicRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -189,7 +190,6 @@ export class AccountMosaicRestrictionTransaction extends Transaction { return new UnresolvedMosaicIdDto(deletion.id.toDTO()); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AccountOperationRestrictionTransaction.ts b/src/model/transaction/AccountOperationRestrictionTransaction.ts index 899602794f..1dc508e493 100644 --- a/src/model/transaction/AccountOperationRestrictionTransaction.ts +++ b/src/model/transaction/AccountOperationRestrictionTransaction.ts @@ -22,6 +22,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAccountOperationRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto'; @@ -160,10 +161,10 @@ export class AccountOperationRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAccountOperationRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAccountOperationRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -172,7 +173,6 @@ export class AccountOperationRestrictionTransaction extends Transaction { this.restrictionAdditions, this.restrictionDeletions, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AddressAliasTransaction.ts b/src/model/transaction/AddressAliasTransaction.ts index 863c1cbae8..2ee1a238ac 100644 --- a/src/model/transaction/AddressAliasTransaction.ts +++ b/src/model/transaction/AddressAliasTransaction.ts @@ -19,6 +19,7 @@ import { AddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/A import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedAddressAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -169,10 +170,10 @@ export class AddressAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedAddressAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedAddressAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -181,7 +182,6 @@ export class AddressAliasTransaction extends Transaction { new AddressDto(RawAddress.stringToAddress(this.address.plain())), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/AggregateTransaction.ts b/src/model/transaction/AggregateTransaction.ts index cfefb0a4e9..073f85ada0 100644 --- a/src/model/transaction/AggregateTransaction.ts +++ b/src/model/transaction/AggregateTransaction.ts @@ -21,6 +21,8 @@ import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/ import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; import {CosignatureBuilder} from '../../infrastructure/catbuffer/CosignatureBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -140,36 +142,19 @@ export class AggregateTransaction extends Transaction { const builder = type === TransactionType.AGGREGATE_COMPLETE ? AggregateCompleteTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)) : AggregateBondedTransactionBuilder.loadFromBinary(Convert.hexToUint8(payload)); - const innerTransactionHex = Convert.uint8ToHex(builder.getTransactions()); + const innerTransactions = builder.getTransactions().map((t) => Convert.uint8ToHex(EmbeddedTransactionHelper.serialize(t))); const networkType = builder.getNetwork().valueOf(); - const consignaturesHex = Convert.uint8ToHex(builder.getCosignatures()); - - /** - * Get inner transactions array - */ - const embeddedTransactionArray: string[] = []; - let innerBinary = innerTransactionHex; - while (innerBinary.length) { - const payloadSize = parseInt(Convert.uint8ToHex(Convert.hexToUint8(innerBinary.substring(0, 8)).reverse()), 16) * 2; - const innerTransaction = innerBinary.substring(0, payloadSize); - embeddedTransactionArray.push(innerTransaction); - innerBinary = innerBinary.substring(payloadSize).replace(/\b0+/g, ''); - } - - /** - * Get cosignatures - */ - const consignatureArray = consignaturesHex.match(/.{1,192}/g); - const consignatures = consignatureArray ? consignatureArray.map((cosignature) => - new AggregateTransactionCosignature( - cosignature.substring(64, 192), - PublicAccount.createFromPublicKey(cosignature.substring(0, 64), networkType), - )) : []; + const consignatures = builder.getCosignatures().map((cosig) => { + return new AggregateTransactionCosignature( + Convert.uint8ToHex(cosig.signature.signature), + PublicAccount.createFromPublicKey(Convert.uint8ToHex(cosig.signerPublicKey.key), networkType), + ); + }); return type === TransactionType.AGGREGATE_COMPLETE ? AggregateTransaction.createComplete( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -177,7 +162,7 @@ export class AggregateTransaction extends Transaction { new UInt64(builder.fee.amount), ) : AggregateTransaction.createBonded( Deadline.createFromDTO(builder.deadline.timestamp), - embeddedTransactionArray.map((transactionRaw) => { + innerTransactions.map((transactionRaw) => { return CreateTransactionFromPayload(transactionRaw, true) as InnerTransaction; }), networkType, @@ -313,23 +298,14 @@ export class AggregateTransaction extends Transaction { protected generateBytes(): Uint8Array { const signerBuffer = new Uint8Array(32); const signatureBuffer = new Uint8Array(64); - let transactions = Uint8Array.from([]); - this.innerTransactions.forEach((transaction) => { - const transactionByte = transaction.toAggregateTransactionBytes(); - const innerTransactionPadding = new Uint8Array(this.getInnerTransactionPaddingSize(transactionByte.length, 8)); - const paddedTransactionByte = GeneratorUtils.concatTypedArrays(transactionByte, innerTransactionPadding); - transactions = GeneratorUtils.concatTypedArrays(transactions, paddedTransactionByte); - }); - - let cosignatures = Uint8Array.from([]); - this.cosignatures.forEach((cosignature) => { + const transactions = this.innerTransactions.map((transaction) => (transaction as Transaction).toEmbeddedTransaction()); + const cosignatures = this.cosignatures.map((cosignature) => { const signerBytes = Convert.hexToUint8(cosignature.signer.publicKey); const signatureBytes = Convert.hexToUint8(cosignature.signature); - const cosignatureBytes = new CosignatureBuilder( + return new CosignatureBuilder( new KeyDto(signerBytes), new SignatureDto(signatureBytes), - ).serialize(); - cosignatures = GeneratorUtils.concatTypedArrays(cosignatures, cosignatureBytes); + ); }); const transactionBuilder = this.type === TransactionType.AGGREGATE_COMPLETE ? @@ -362,9 +338,9 @@ export class AggregateTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Method not implemented'); } diff --git a/src/model/transaction/LockFundsTransaction.ts b/src/model/transaction/LockFundsTransaction.ts index 9b6fc2bb35..70ffdb661c 100644 --- a/src/model/transaction/LockFundsTransaction.ts +++ b/src/model/transaction/LockFundsTransaction.ts @@ -19,6 +19,7 @@ import { DtoMapping } from '../../core/utils/DtoMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedHashLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedHashLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { HashLockTransactionBuilder } from '../../infrastructure/catbuffer/HashLockTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; @@ -188,10 +189,10 @@ export class LockFundsTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedHashLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedHashLockTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -201,7 +202,6 @@ export class LockFundsTransaction extends Transaction { new BlockDurationDto(this.duration.toDTO()), new Hash256Dto(Convert.hexToUint8(this.hash)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAddressRestrictionTransaction.ts b/src/model/transaction/MosaicAddressRestrictionTransaction.ts index fa16011421..f5a36bfa76 100644 --- a/src/model/transaction/MosaicAddressRestrictionTransaction.ts +++ b/src/model/transaction/MosaicAddressRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAddressRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAddressRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAddressRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -219,10 +220,10 @@ export class MosaicAddressRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAddressRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAddressRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -233,7 +234,6 @@ export class MosaicAddressRestrictionTransaction extends Transaction { this.newRestrictionValue.toDTO(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.targetAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicAliasTransaction.ts b/src/model/transaction/MosaicAliasTransaction.ts index f259c5af13..238e8b1fbd 100644 --- a/src/model/transaction/MosaicAliasTransaction.ts +++ b/src/model/transaction/MosaicAliasTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicAliasTransactionBuilder } from '../../infrastructure/catbuffer/MosaicAliasTransactionBuilder'; import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; @@ -164,10 +165,10 @@ export class MosaicAliasTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicAliasTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicAliasTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -176,7 +177,6 @@ export class MosaicAliasTransaction extends Transaction { new MosaicIdDto(this.mosaicId.id.toDTO()), this.aliasAction.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicDefinitionTransaction.ts b/src/model/transaction/MosaicDefinitionTransaction.ts index a43a733825..5b3fe0754b 100644 --- a/src/model/transaction/MosaicDefinitionTransaction.ts +++ b/src/model/transaction/MosaicDefinitionTransaction.ts @@ -18,6 +18,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedMosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicDefinitionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicDefinitionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicDefinitionTransactionBuilder'; @@ -205,10 +206,10 @@ export class MosaicDefinitionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicDefinitionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicDefinitionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -219,7 +220,6 @@ export class MosaicDefinitionTransaction extends Transaction { this.flags.getValue(), this.divisibility, ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts index e1d654f2d1..f4b1969e3d 100644 --- a/src/model/transaction/MosaicGlobalRestrictionTransaction.ts +++ b/src/model/transaction/MosaicGlobalRestrictionTransaction.ts @@ -21,6 +21,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicGlobalRestrictionTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMosaicGlobalRestrictionTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicGlobalRestrictionTransactionBuilder } from '../../infrastructure/catbuffer/MosaicGlobalRestrictionTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -227,10 +228,10 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicGlobalRestrictionTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicGlobalRestrictionTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -243,7 +244,6 @@ export class MosaicGlobalRestrictionTransaction extends Transaction { this.previousRestrictionType.valueOf(), this.newRestrictionType.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicMetadataTransaction.ts b/src/model/transaction/MosaicMetadataTransaction.ts index 345db15e51..e48c636085 100644 --- a/src/model/transaction/MosaicMetadataTransaction.ts +++ b/src/model/transaction/MosaicMetadataTransaction.ts @@ -19,6 +19,7 @@ import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicMetadataTransactionBuilder } from '../../infrastructure/catbuffer/MosaicMetadataTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -195,10 +196,10 @@ export class MosaicMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -209,7 +210,6 @@ export class MosaicMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MosaicSupplyChangeTransaction.ts b/src/model/transaction/MosaicSupplyChangeTransaction.ts index 6ef580240f..93484992a9 100644 --- a/src/model/transaction/MosaicSupplyChangeTransaction.ts +++ b/src/model/transaction/MosaicSupplyChangeTransaction.ts @@ -19,6 +19,7 @@ import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { MosaicSupplyChangeTransactionBuilder } from '../../infrastructure/catbuffer/MosaicSupplyChangeTransactionBuilder'; import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto'; @@ -171,10 +172,10 @@ export class MosaicSupplyChangeTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMosaicSupplyChangeTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMosaicSupplyChangeTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -183,7 +184,6 @@ export class MosaicSupplyChangeTransaction extends Transaction { new AmountDto(this.delta.toDTO()), this.action.valueOf(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/MultisigAccountModificationTransaction.ts b/src/model/transaction/MultisigAccountModificationTransaction.ts index d8a4dc1d77..fcaefd7fcf 100644 --- a/src/model/transaction/MultisigAccountModificationTransaction.ts +++ b/src/model/transaction/MultisigAccountModificationTransaction.ts @@ -19,6 +19,7 @@ import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedMultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import {MultisigAccountModificationTransactionBuilder, } from '../../infrastructure/catbuffer/MultisigAccountModificationTransactionBuilder'; @@ -193,10 +194,10 @@ export class MultisigAccountModificationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedMultisigAccountModificationTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedMultisigAccountModificationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -210,7 +211,6 @@ export class MultisigAccountModificationTransaction extends Transaction { return new KeyDto(Convert.hexToUint8(deletion.publicKey)); }), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceMetadataTransaction.ts b/src/model/transaction/NamespaceMetadataTransaction.ts index f58453c268..36e80f13e3 100644 --- a/src/model/transaction/NamespaceMetadataTransaction.ts +++ b/src/model/transaction/NamespaceMetadataTransaction.ts @@ -17,6 +17,7 @@ import { Convert } from '../../core/format'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedNamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceMetadataTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceMetadataTransactionBuilder'; @@ -192,10 +193,10 @@ export class NamespaceMetadataTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedNamespaceMetadataTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedNamespaceMetadataTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -206,7 +207,6 @@ export class NamespaceMetadataTransaction extends Transaction { this.valueSizeDelta, Convert.utf8ToUint8(this.value), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/NamespaceRegistrationTransaction.ts b/src/model/transaction/NamespaceRegistrationTransaction.ts index 935ee02bc7..cad026814e 100644 --- a/src/model/transaction/NamespaceRegistrationTransaction.ts +++ b/src/model/transaction/NamespaceRegistrationTransaction.ts @@ -20,6 +20,7 @@ import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDt import { EmbeddedNamespaceRegistrationTransactionBuilder, } from '../../infrastructure/catbuffer/EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { NamespaceRegistrationTransactionBuilder } from '../../infrastructure/catbuffer/NamespaceRegistrationTransactionBuilder'; @@ -244,12 +245,11 @@ export class NamespaceRegistrationTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - let transactionBuilder: EmbeddedNamespaceRegistrationTransactionBuilder; + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { if (this.registrationType === NamespaceRegistrationType.RootNamespace) { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( + return new EmbeddedNamespaceRegistrationTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -259,19 +259,17 @@ export class NamespaceRegistrationTransaction extends Transaction { new BlockDurationDto(this.duration!.toDTO()), undefined, ); - } else { - transactionBuilder = new EmbeddedNamespaceRegistrationTransactionBuilder( - new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), - this.versionToDTO(), - this.networkType.valueOf(), - TransactionType.REGISTER_NAMESPACE.valueOf(), - new NamespaceIdDto(this.namespaceId.id.toDTO()), - Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), - undefined, - new NamespaceIdDto(this.parentId!.id.toDTO()), - ); } - return transactionBuilder.serialize(); + return new EmbeddedNamespaceRegistrationTransactionBuilder( + new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), + this.versionToDTO(), + this.networkType.valueOf(), + TransactionType.REGISTER_NAMESPACE.valueOf(), + new NamespaceIdDto(this.namespaceId.id.toDTO()), + Convert.hexToUint8(Convert.utf8ToHex(this.namespaceName)), + undefined, + new NamespaceIdDto(this.parentId!.id.toDTO()), + ); } /** diff --git a/src/model/transaction/SecretLockTransaction.ts b/src/model/transaction/SecretLockTransaction.ts index 3b10e31c5c..944c2d3039 100644 --- a/src/model/transaction/SecretLockTransaction.ts +++ b/src/model/transaction/SecretLockTransaction.ts @@ -19,6 +19,7 @@ import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto'; import { EmbeddedSecretLockTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretLockTransactionBuilder } from '../../infrastructure/catbuffer/SecretLockTransactionBuilder'; @@ -215,10 +216,10 @@ export class SecretLockTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretLockTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretLockTransactionBuilder( new KeyDto(convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -230,7 +231,6 @@ export class SecretLockTransaction extends Transaction { this.hashType.valueOf(), new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/SecretProofTransaction.ts b/src/model/transaction/SecretProofTransaction.ts index 8e1855c841..201e491f71 100644 --- a/src/model/transaction/SecretProofTransaction.ts +++ b/src/model/transaction/SecretProofTransaction.ts @@ -19,6 +19,7 @@ import { DtoMapping } from '../../core/utils/DtoMapping'; import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; import { EmbeddedSecretProofTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Hash256Dto } from '../../infrastructure/catbuffer/Hash256Dto'; import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; import { SecretProofTransactionBuilder } from '../../infrastructure/catbuffer/SecretProofTransactionBuilder'; @@ -194,10 +195,10 @@ export class SecretProofTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedSecretProofTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedSecretProofTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -207,7 +208,6 @@ export class SecretProofTransaction extends Transaction { new UnresolvedAddressDto(UnresolvedMapping.toUnresolvedAddressBytes(this.recipientAddress, this.networkType)), this.getProofByte(), ); - return transactionBuilder.serialize(); } /** diff --git a/src/model/transaction/Transaction.ts b/src/model/transaction/Transaction.ts index 3ffa2a2891..49db64de8e 100644 --- a/src/model/transaction/Transaction.ts +++ b/src/model/transaction/Transaction.ts @@ -17,6 +17,8 @@ import { KeyPair, SHA3Hasher, SignSchema } from '../../core/crypto'; import { Convert } from '../../core/format'; import { DtoMapping } from '../../core/utils/DtoMapping'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; +import { EmbeddedTransactionHelper } from '../../infrastructure/catbuffer/EmbeddedTransactionHelper'; import { SerializeTransactionToJSON } from '../../infrastructure/transaction/SerializeTransactionToJSON'; import { Account } from '../account/Account'; import { PublicAccount } from '../account/PublicAccount'; @@ -185,7 +187,7 @@ export abstract class Transaction { /** * @internal */ - protected abstract generateEmbeddedBytes(): Uint8Array; + public abstract toEmbeddedTransaction(): EmbeddedTransactionBuilder; /** * @internal @@ -287,7 +289,9 @@ export abstract class Transaction { * @return transaction with signer serialized to be part of an aggregate transaction */ public toAggregateTransactionBytes() { - return this.generateEmbeddedBytes(); + return EmbeddedTransactionHelper.serialize( + this.toEmbeddedTransaction(), + ); } /** diff --git a/src/model/transaction/TransferTransaction.ts b/src/model/transaction/TransferTransaction.ts index 7f213f989d..7ea9cb13db 100644 --- a/src/model/transaction/TransferTransaction.ts +++ b/src/model/transaction/TransferTransaction.ts @@ -18,6 +18,7 @@ import * as Long from 'long'; import {Convert} from '../../core/format'; import {UnresolvedMapping} from '../../core/utils/UnresolvedMapping'; import {AmountDto} from '../../infrastructure/catbuffer/AmountDto'; +import { EmbeddedTransactionBuilder } from '../../infrastructure/catbuffer/EmbeddedTransactionBuilder'; import {EmbeddedTransferTransactionBuilder} from '../../infrastructure/catbuffer/EmbeddedTransferTransactionBuilder'; import {GeneratorUtils} from '../../infrastructure/catbuffer/GeneratorUtils'; import {KeyDto} from '../../infrastructure/catbuffer/KeyDto'; @@ -257,10 +258,10 @@ export class TransferTransaction extends Transaction { /** * @internal - * @returns {Uint8Array} + * @returns {EmbeddedTransactionBuilder} */ - protected generateEmbeddedBytes(): Uint8Array { - const transactionBuilder = new EmbeddedTransferTransactionBuilder( + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { + return new EmbeddedTransferTransactionBuilder( new KeyDto(Convert.hexToUint8(this.signer!.publicKey)), this.versionToDTO(), this.networkType.valueOf(), @@ -272,7 +273,6 @@ export class TransferTransaction extends Transaction { }), this.getMessageBuffer(), ); - return transactionBuilder.serialize(); } /** diff --git a/test/model/transaction/Transaction.spec.ts b/test/model/transaction/Transaction.spec.ts index 0b3eb881b4..04fb2e28b3 100644 --- a/test/model/transaction/Transaction.spec.ts +++ b/test/model/transaction/Transaction.spec.ts @@ -17,6 +17,7 @@ import { expect } from 'chai'; import { Observable } from 'rxjs/internal/Observable'; import { Convert } from '../../../src/core/format/Convert'; +import { EmbeddedTransactionBuilder } from '../../../src/infrastructure/catbuffer/EmbeddedTransactionBuilder'; import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; @@ -400,7 +401,7 @@ class FakeTransaction extends Transaction { throw new Error('Not implemented'); } - protected generateEmbeddedBytes(): Uint8Array { + public toEmbeddedTransaction(): EmbeddedTransactionBuilder { throw new Error('Not implemented'); } resolveAliases(): TransferTransaction { From fc997491ec53120ff983b3e6c047c3e44af84053 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Fri, 20 Dec 2019 21:51:06 +0000 Subject: [PATCH 17/22] Fixed missing semicolon --- .../catbuffer/EmbeddedTransactionHelper.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index ad436cfc30..9a9c16712f 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -125,7 +125,7 @@ export class EmbeddedTransactionHelper { padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); return GeneratorUtils.concatTypedArrays(byte, padding); default: - throw new Error(`Transaction type: ${transaction.type} not recognized.`) + throw new Error(`Transaction type: ${transaction.type} not recognized.`); } } @@ -133,45 +133,45 @@ export class EmbeddedTransactionHelper { const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); switch (header.getType()) { case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: - return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes) + return EmbeddedTransferTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: - return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountLinkTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: - return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedHashLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: - return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretLockTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: - return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes) + return EmbeddedSecretProofTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: - return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: - return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: - return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceMetadataTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: - return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicDefinitionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: - return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicSupplyChangeTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: - return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMultisigAccountModificationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: - return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAddressAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: - return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAliasTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: - return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes) + return EmbeddedNamespaceRegistrationTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountMosaicRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedAccountOperationRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicAddressRestrictionTransactionBuilder.loadFromBinary(bytes); case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: - return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes) + return EmbeddedMosaicGlobalRestrictionTransactionBuilder.loadFromBinary(bytes); default: - throw new Error(`Transaction type: ${header.getType()} not recognized.`) + throw new Error(`Transaction type: ${header.getType()} not recognized.`); } } From 04831f80f8ff513eb7d36fd52d690275823d044e Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 14:50:41 +0000 Subject: [PATCH 18/22] Applied catbuffer on receipt --- .../catbuffer/ReceiptBuilder.ts | 2 -- src/model/receipt/ArtifactExpiryReceipt.ts | 18 ++++++++------- src/model/receipt/BalanceChangeReceipt.ts | 17 +++++++------- src/model/receipt/BalanceTransferReceipt.ts | 23 ++++++++++--------- src/model/receipt/InflationReceipt.ts | 16 ++++++------- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/infrastructure/catbuffer/ReceiptBuilder.ts b/src/infrastructure/catbuffer/ReceiptBuilder.ts index 524bf945df..ffe39705cb 100644 --- a/src/infrastructure/catbuffer/ReceiptBuilder.ts +++ b/src/infrastructure/catbuffer/ReceiptBuilder.ts @@ -97,8 +97,6 @@ export class ReceiptBuilder { */ public serialize(): Uint8Array { let newArray = Uint8Array.from([]); - const sizeBytes = GeneratorUtils.uintToBuffer(this.getSize(), 4); - newArray = GeneratorUtils.concatTypedArrays(newArray, sizeBytes); const versionBytes = GeneratorUtils.uintToBuffer(this.getVersion(), 2); newArray = GeneratorUtils.concatTypedArrays(newArray, versionBytes); const typeBytes = GeneratorUtils.uintToBuffer(this.type, 2); diff --git a/src/model/receipt/ArtifactExpiryReceipt.ts b/src/model/receipt/ArtifactExpiryReceipt.ts index 8df5aab72a..a8a14178e4 100644 --- a/src/model/receipt/ArtifactExpiryReceipt.ts +++ b/src/model/receipt/ArtifactExpiryReceipt.ts @@ -14,11 +14,12 @@ * limitations under the License. */ -import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { MosaicExpiryReceiptBuilder } from '../../infrastructure/catbuffer/MosaicExpiryReceiptBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; +import { NamespaceExpiryReceiptBuilder } from '../../infrastructure/catbuffer/NamespaceExpiryReceiptBuilder'; +import { NamespaceIdDto } from '../../infrastructure/catbuffer/NamespaceIdDto'; import { MosaicId } from '../mosaic/MosaicId'; import { NamespaceId } from '../namespace/NamespaceId'; -import { UInt64 } from '../UInt64'; import { Receipt } from './Receipt'; import { ReceiptType } from './ReceiptType'; import { ReceiptVersion } from './ReceiptVersion'; @@ -48,10 +49,11 @@ export class ArtifactExpiryReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(12); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.ARTIFACT_EXPIRY, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.artifactId.toHex()).toDTO()), 4); - return buffer; + if (this.artifactId instanceof MosaicId) { + return new MosaicExpiryReceiptBuilder(ReceiptVersion.ARTIFACT_EXPIRY, this.type.valueOf(), + new MosaicIdDto(this.artifactId.toDTO())).serialize(); + } + return new NamespaceExpiryReceiptBuilder(ReceiptVersion.ARTIFACT_EXPIRY, this.type.valueOf(), + new NamespaceIdDto(this.artifactId.id.toDTO())).serialize(); } } diff --git a/src/model/receipt/BalanceChangeReceipt.ts b/src/model/receipt/BalanceChangeReceipt.ts index 83159b621c..7c11b72690 100644 --- a/src/model/receipt/BalanceChangeReceipt.ts +++ b/src/model/receipt/BalanceChangeReceipt.ts @@ -15,7 +15,11 @@ */ import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { BalanceChangeReceiptBuilder } from '../../infrastructure/catbuffer/BalanceChangeReceiptBuilder'; +import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { PublicAccount } from '../account/PublicAccount'; import { MosaicId } from '../mosaic/MosaicId'; import { UInt64 } from '../UInt64'; @@ -62,12 +66,9 @@ export class BalanceChangeReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(52); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.BALANCE_CHANGE, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - buffer.set(Convert.hexToUint8(this.targetPublicAccount.publicKey), 20); - return buffer; + return new BalanceChangeReceiptBuilder(ReceiptVersion.BALANCE_CHANGE, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + new KeyDto(Convert.hexToUint8(this.targetPublicAccount.publicKey)), + ).serialize(); } } diff --git a/src/model/receipt/BalanceTransferReceipt.ts b/src/model/receipt/BalanceTransferReceipt.ts index 1442fe3e82..4b11cc53f0 100644 --- a/src/model/receipt/BalanceTransferReceipt.ts +++ b/src/model/receipt/BalanceTransferReceipt.ts @@ -15,8 +15,13 @@ */ import { Convert } from '../../core/format/Convert'; -import { UnresolvedMapping } from "../../core/utils/UnresolvedMapping"; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { UnresolvedMapping } from '../../core/utils/UnresolvedMapping'; +import { AddressDto } from '../../infrastructure/catbuffer/AddressDto'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { BalanceTransferReceiptBuilder } from '../../infrastructure/catbuffer/BalanceTransferReceiptBuilder'; +import { KeyDto } from '../../infrastructure/catbuffer/KeyDto'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; import { MosaicId } from '../mosaic/MosaicId'; @@ -70,15 +75,11 @@ export class BalanceTransferReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const recipient = this.getRecipientBytes(); - const buffer = new Uint8Array(52 + recipient.length); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.BALANCE_TRANSFER, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - buffer.set(Convert.hexToUint8(this.sender.publicKey), 20); - buffer.set(recipient, 52); - return buffer; + return new BalanceTransferReceiptBuilder(ReceiptVersion.BALANCE_TRANSFER, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + new KeyDto(Convert.hexToUint8(this.sender.publicKey)), + new AddressDto(this.getRecipientBytes()), + ).serialize(); } /** diff --git a/src/model/receipt/InflationReceipt.ts b/src/model/receipt/InflationReceipt.ts index 4007cd2200..f9e217043d 100644 --- a/src/model/receipt/InflationReceipt.ts +++ b/src/model/receipt/InflationReceipt.ts @@ -14,8 +14,10 @@ * limitations under the License. */ -import { Convert } from '../../core/format/Convert'; -import { GeneratorUtils } from '../../infrastructure/catbuffer/GeneratorUtils'; +import { AmountDto } from '../../infrastructure/catbuffer/AmountDto'; +import { InflationReceiptBuilder } from '../../infrastructure/catbuffer/InflationReceiptBuilder'; +import { MosaicBuilder } from '../../infrastructure/catbuffer/MosaicBuilder'; +import { MosaicIdDto } from '../../infrastructure/catbuffer/MosaicIdDto'; import { MosaicId } from '../mosaic/MosaicId'; import { UInt64 } from '../UInt64'; import { Receipt } from './Receipt'; @@ -56,11 +58,9 @@ export class InflationReceipt extends Receipt { * @return {Uint8Array} */ public serialize(): Uint8Array { - const buffer = new Uint8Array(20); - buffer.set(GeneratorUtils.uintToBuffer(ReceiptVersion.INFLATION_RECEIPT, 2)); - buffer.set(GeneratorUtils.uintToBuffer(this.type, 2), 2); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.mosaicId.toHex()).toDTO()), 4); - buffer.set(GeneratorUtils.uint64ToBuffer(UInt64.fromHex(this.amount.toHex()).toDTO()), 12); - return buffer; + return new InflationReceiptBuilder( + ReceiptVersion.INFLATION_RECEIPT, this.type.valueOf(), + new MosaicBuilder(new MosaicIdDto(this.mosaicId.toDTO()), new AmountDto(this.amount.toDTO())), + ).serialize(); } } From 84e5f6cfd4c6eeff28f6707d53771101e27fb99d Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 15:35:36 +0000 Subject: [PATCH 19/22] Fixed semicolom in import --- .../catbuffer/EmbeddedTransactionHelper.ts | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index 9a9c16712f..f6c2bab694 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -19,28 +19,28 @@ *** along with Catapult. If not, see . **/ -import { EntityTypeDto } from './EntityTypeDto' -import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder' -import { GeneratorUtils } from './GeneratorUtils' -import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder' -import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder' -import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder' -import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder' -import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder' -import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder' -import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder' -import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder' -import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder' -import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder' -import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder' -import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder' -import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder' -import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder' -import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder' -import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder' -import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder' -import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder' -import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder' +import { EntityTypeDto } from './EntityTypeDto'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { GeneratorUtils } from './GeneratorUtils'; +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder'; +import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder'; +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder'; +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder'; +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder'; +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder'; +import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder'; +import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder'; export class EmbeddedTransactionHelper { From 70f3ab998519f0b48a13e1a697cad38856dd3ac9 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Mon, 23 Dec 2019 13:51:51 +0000 Subject: [PATCH 20/22] Removed redundant switch case --- .../catbuffer/EmbeddedTransactionHelper.ts | 119 +++--------------- 1 file changed, 20 insertions(+), 99 deletions(-) diff --git a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts index f6c2bab694..196a0ae451 100644 --- a/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts +++ b/src/infrastructure/catbuffer/EmbeddedTransactionHelper.ts @@ -19,117 +19,38 @@ *** along with Catapult. If not, see . **/ -import { EntityTypeDto } from './EntityTypeDto'; -import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; -import { GeneratorUtils } from './GeneratorUtils'; -import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder'; +import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder'; import { EmbeddedAccountLinkTransactionBuilder } from './EmbeddedAccountLinkTransactionBuilder'; -import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder'; -import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder'; -import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder'; import { EmbeddedAccountMetadataTransactionBuilder } from './EmbeddedAccountMetadataTransactionBuilder'; -import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder'; -import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder'; -import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder'; -import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder'; -import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder'; -import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder'; -import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder'; -import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder'; -import { EmbeddedAccountAddressRestrictionTransactionBuilder } from './EmbeddedAccountAddressRestrictionTransactionBuilder'; import { EmbeddedAccountMosaicRestrictionTransactionBuilder } from './EmbeddedAccountMosaicRestrictionTransactionBuilder'; import { EmbeddedAccountOperationRestrictionTransactionBuilder } from './EmbeddedAccountOperationRestrictionTransactionBuilder'; +import { EmbeddedAddressAliasTransactionBuilder } from './EmbeddedAddressAliasTransactionBuilder'; +import { EmbeddedHashLockTransactionBuilder } from './EmbeddedHashLockTransactionBuilder'; import { EmbeddedMosaicAddressRestrictionTransactionBuilder } from './EmbeddedMosaicAddressRestrictionTransactionBuilder'; +import { EmbeddedMosaicAliasTransactionBuilder } from './EmbeddedMosaicAliasTransactionBuilder'; +import { EmbeddedMosaicDefinitionTransactionBuilder } from './EmbeddedMosaicDefinitionTransactionBuilder'; import { EmbeddedMosaicGlobalRestrictionTransactionBuilder } from './EmbeddedMosaicGlobalRestrictionTransactionBuilder'; +import { EmbeddedMosaicMetadataTransactionBuilder } from './EmbeddedMosaicMetadataTransactionBuilder'; +import { EmbeddedMosaicSupplyChangeTransactionBuilder } from './EmbeddedMosaicSupplyChangeTransactionBuilder'; +import { EmbeddedMultisigAccountModificationTransactionBuilder } from './EmbeddedMultisigAccountModificationTransactionBuilder'; +import { EmbeddedNamespaceMetadataTransactionBuilder } from './EmbeddedNamespaceMetadataTransactionBuilder'; +import { EmbeddedNamespaceRegistrationTransactionBuilder } from './EmbeddedNamespaceRegistrationTransactionBuilder'; +import { EmbeddedSecretLockTransactionBuilder } from './EmbeddedSecretLockTransactionBuilder'; +import { EmbeddedSecretProofTransactionBuilder } from './EmbeddedSecretProofTransactionBuilder'; +import { EmbeddedTransactionBuilder } from './EmbeddedTransactionBuilder'; +import { EmbeddedTransferTransactionBuilder } from './EmbeddedTransferTransactionBuilder'; +import { EntityTypeDto } from './EntityTypeDto'; +import { GeneratorUtils } from './GeneratorUtils'; export class EmbeddedTransactionHelper { public static serialize(transaction: EmbeddedTransactionBuilder): Uint8Array { - let byte: Uint8Array; - let padding: Uint8Array; - switch (transaction.type) { - case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedTransferTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.ACCOUNT_LINK_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedAccountLinkTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.HASH_LOCK_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedHashLockTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.SECRET_LOCK_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedSecretLockTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.SECRET_PROOF_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedSecretProofTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.ACCOUNT_METADATA_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedAccountMetadataTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MOSAIC_METADATA_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMosaicMetadataTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.NAMESPACE_METADATA_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedNamespaceMetadataTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MOSAIC_DEFINITION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMosaicDefinitionTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MOSAIC_SUPPLY_CHANGE_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMosaicSupplyChangeTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MULTISIG_ACCOUNT_MODIFICATION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMultisigAccountModificationTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.ADDRESS_ALIAS_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedAddressAliasTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MOSAIC_ALIAS_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMosaicAliasTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.NAMESPACE_REGISTRATION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedNamespaceRegistrationTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.ACCOUNT_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedAccountAddressRestrictionTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.ACCOUNT_MOSAIC_RESTRICTION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedAccountMosaicRestrictionTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.ACCOUNT_OPERATION_RESTRICTION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedAccountOperationRestrictionTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MOSAIC_ADDRESS_RESTRICTION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMosaicAddressRestrictionTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - case EntityTypeDto.MOSAIC_GLOBAL_RESTRICTION_TRANSACTION_BUILDER: - byte = (transaction as EmbeddedMosaicGlobalRestrictionTransactionBuilder).serialize(); - padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); - return GeneratorUtils.concatTypedArrays(byte, padding); - default: - throw new Error(`Transaction type: ${transaction.type} not recognized.`); - } + const byte = transaction.serialize(); + const padding = new Uint8Array(GeneratorUtils.getTransactionPaddingSize(byte.length, 8)); + return GeneratorUtils.concatTypedArrays(byte, padding); } - public static loadFromBinary(bytes: Uint8Array):EmbeddedTransactionBuilder { + public static loadFromBinary(bytes: Uint8Array): EmbeddedTransactionBuilder { const header = EmbeddedTransactionBuilder.loadFromBinary(bytes); switch (header.getType()) { case EntityTypeDto.TRANSFER_TRANSACTION_BUILDER: From 5efa1bd922c06a47223174cf93b2b86c8f6732d5 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Sun, 22 Dec 2019 21:44:13 +0000 Subject: [PATCH 21/22] Fixed #397 - Applied openAPI 0.7.20.6 --- e2e/infrastructure/AccountHttp.spec.ts | 16 +- e2e/infrastructure/BlockHttp.spec.ts | 13 +- e2e/infrastructure/ChainHttp.spec.ts | 7 +- e2e/infrastructure/DiagnosticHttp.spec.ts | 7 +- e2e/infrastructure/IntegrationTestHelper.ts | 55 ++--- e2e/infrastructure/Listener.spec.ts | 84 ++++---- e2e/infrastructure/MetadataHttp.spec.ts | 21 +- e2e/infrastructure/MosaicHttp.spec.ts | 15 +- e2e/infrastructure/NamespaceHttp.spec.ts | 11 +- e2e/infrastructure/NetworkHttp.spec.ts | 4 +- e2e/infrastructure/NodeHttp.spec.ts | 4 +- e2e/infrastructure/RestrictionHttp.spec.ts | 8 +- e2e/infrastructure/TransactionHttp.spec.ts | 188 +++++++++--------- e2e/infrastructure/UnresolvedMapping.spec.ts | 9 +- .../MetadataTransactionService.spec.ts | 25 ++- ...osaicRestrictionTransactionService.spec.ts | 26 +-- e2e/service/MosaicService.spec.ts | 6 +- e2e/service/TransactionService.spec.ts | 39 ++-- ...TransactionService_AggregateBonded.spec.ts | 37 ++-- package-lock.json | 172 +++++++--------- package.json | 12 +- src/infrastructure/AccountHttp.ts | 21 +- src/infrastructure/BlockHttp.ts | 22 +- src/infrastructure/Http.ts | 5 +- src/infrastructure/Listener.ts | 16 +- src/infrastructure/MetadataHttp.ts | 9 +- src/infrastructure/QueryParams.ts | 7 +- src/infrastructure/RepositoryFactory.ts | 37 ++-- src/infrastructure/RepositoryFactoryHttp.ts | 78 ++++---- src/infrastructure/RestrictionMosaicHttp.ts | 4 +- src/infrastructure/TransactionHttp.ts | 21 +- src/infrastructure/api.ts | 2 +- src/infrastructure/api/accountRoutesApi.ts | 118 ++++++----- src/infrastructure/api/apis.ts | 2 +- src/infrastructure/api/blockRoutesApi.ts | 14 +- src/infrastructure/api/chainRoutesApi.ts | 2 +- src/infrastructure/api/diagnosticRoutesApi.ts | 2 +- src/infrastructure/api/metadataRoutesApi.ts | 2 +- src/infrastructure/api/mosaicRoutesApi.ts | 2 +- src/infrastructure/api/multisigRoutesApi.ts | 2 +- src/infrastructure/api/namespaceRoutesApi.ts | 2 +- src/infrastructure/api/networkRoutesApi.ts | 2 +- src/infrastructure/api/nodeRoutesApi.ts | 2 +- src/infrastructure/api/receiptRoutesApi.ts | 6 +- .../api/restrictionAccountRoutesApi.ts | 2 +- .../api/restrictionMosaicRoutesApi.ts | 2 +- .../api/transactionRoutesApi.ts | 2 +- ...untAddressRestrictionTransactionBodyDTO.ts | 2 +- ...accountAddressRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/accountDTO.ts | 2 +- src/infrastructure/model/accountIds.ts | 2 +- src/infrastructure/model/accountInfoDTO.ts | 2 +- .../model/accountLinkActionEnum.ts | 13 +- .../model/accountLinkTransactionBodyDTO.ts | 2 +- .../model/accountLinkTransactionDTO.ts | 2 +- .../accountMetadataTransactionBodyDTO.ts | 2 +- .../model/accountMetadataTransactionDTO.ts | 2 +- ...ountMosaicRestrictionTransactionBodyDTO.ts | 2 +- .../accountMosaicRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/accountNamesDTO.ts | 2 +- ...tOperationRestrictionTransactionBodyDTO.ts | 2 +- ...countOperationRestrictionTransactionDTO.ts | 2 +- .../model/accountRestrictionDTO.ts | 2 +- .../model/accountRestrictionFlagsEnum.ts | 33 +-- .../model/accountRestrictionsDTO.ts | 2 +- .../model/accountRestrictionsInfoDTO.ts | 2 +- src/infrastructure/model/accountTypeEnum.ts | 20 +- src/infrastructure/model/accountsNamesDTO.ts | 2 +- src/infrastructure/model/activityBucketDTO.ts | 2 +- .../model/addressAliasTransactionBodyDTO.ts | 2 +- .../model/addressAliasTransactionDTO.ts | 2 +- .../model/aggregateTransactionBodyDTO.ts | 2 +- .../model/aggregateTransactionDTO.ts | 2 +- src/infrastructure/model/aliasActionEnum.ts | 12 +- src/infrastructure/model/aliasDTO.ts | 2 +- src/infrastructure/model/aliasTypeEnum.ts | 15 +- .../model/announceTransactionInfoDTO.ts | 2 +- .../model/artifactExpiryReceiptDTO.ts | 65 ------ .../model/balanceChangeReceiptDTO.ts | 2 +- .../model/balanceChangeReceiptDTOAllOf.ts | 2 +- .../model/balanceTransferReceiptDTO.ts | 2 +- .../model/balanceTransferReceiptDTOAllOf.ts | 2 +- src/infrastructure/model/blockDTO.ts | 2 +- src/infrastructure/model/blockDTOAllOf.ts | 2 +- src/infrastructure/model/blockInfoDTO.ts | 2 +- src/infrastructure/model/blockMetaDTO.ts | 2 +- src/infrastructure/model/chainScoreDTO.ts | 2 +- .../model/communicationTimestampsDTO.ts | 2 +- src/infrastructure/model/cosignature.ts | 2 +- src/infrastructure/model/cosignatureDTO.ts | 2 +- .../model/cosignatureDTOAllOf.ts | 2 +- ...AccountAddressRestrictionTransactionDTO.ts | 2 +- .../embeddedAccountLinkTransactionDTO.ts | 2 +- .../embeddedAccountMetadataTransactionDTO.ts | 2 +- ...dAccountMosaicRestrictionTransactionDTO.ts | 2 +- ...countOperationRestrictionTransactionDTO.ts | 2 +- .../embeddedAddressAliasTransactionDTO.ts | 2 +- .../model/embeddedHashLockTransactionDTO.ts | 2 +- ...dMosaicAddressRestrictionTransactionDTO.ts | 2 +- .../embeddedMosaicAliasTransactionDTO.ts | 2 +- .../embeddedMosaicDefinitionTransactionDTO.ts | 2 +- ...edMosaicGlobalRestrictionTransactionDTO.ts | 2 +- .../embeddedMosaicMetadataTransactionDTO.ts | 2 +- ...mbeddedMosaicSupplyChangeTransactionDTO.ts | 2 +- ...ltisigAccountModificationTransactionDTO.ts | 2 +- ...embeddedNamespaceMetadataTransactionDTO.ts | 2 +- ...ddedNamespaceRegistrationTransactionDTO.ts | 2 +- .../model/embeddedSecretLockTransactionDTO.ts | 2 +- .../embeddedSecretProofTransactionDTO.ts | 2 +- .../model/embeddedTransactionDTO.ts | 2 +- .../model/embeddedTransactionInfoDTO.ts | 2 +- .../model/embeddedTransactionMetaDTO.ts | 2 +- .../model/embeddedTransferTransactionDTO.ts | 2 +- src/infrastructure/model/entityDTO.ts | 2 +- .../model/hashLockTransactionBodyDTO.ts | 2 +- .../model/hashLockTransactionDTO.ts | 2 +- src/infrastructure/model/heightInfoDTO.ts | 2 +- .../model/inflationReceiptDTO.ts | 2 +- .../model/inflationReceiptDTOAllOf.ts | 2 +- .../model/lockHashAlgorithmEnum.ts | 20 +- src/infrastructure/model/merklePathItemDTO.ts | 2 +- .../model/merkleProofInfoDTO.ts | 2 +- src/infrastructure/model/messageDTO.ts | 2 +- src/infrastructure/model/messageTypeEnum.ts | 14 +- src/infrastructure/model/metadataDTO.ts | 2 +- .../model/metadataEntriesDTO.ts | 2 +- src/infrastructure/model/metadataEntryDTO.ts | 2 +- src/infrastructure/model/metadataTypeEnum.ts | 15 +- src/infrastructure/model/modelError.ts | 2 +- src/infrastructure/model/models.ts | 6 + src/infrastructure/model/mosaic.ts | 2 +- .../model/mosaicAddressRestrictionDTO.ts | 2 +- .../model/mosaicAddressRestrictionEntryDTO.ts | 2 +- ...mosaicAddressRestrictionEntryWrapperDTO.ts | 2 +- ...aicAddressRestrictionTransactionBodyDTO.ts | 2 +- .../mosaicAddressRestrictionTransactionDTO.ts | 2 +- .../model/mosaicAliasTransactionBodyDTO.ts | 2 +- .../model/mosaicAliasTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicDTO.ts | 2 +- .../mosaicDefinitionTransactionBodyDTO.ts | 2 +- .../model/mosaicDefinitionTransactionDTO.ts | 2 +- .../model/mosaicExpiryReceiptDTO.ts | 2 +- .../model/mosaicExpiryReceiptDTOAllOf.ts | 2 +- .../model/mosaicGlobalRestrictionDTO.ts | 2 +- .../model/mosaicGlobalRestrictionEntryDTO.ts | 2 +- ...aicGlobalRestrictionEntryRestrictionDTO.ts | 2 +- .../mosaicGlobalRestrictionEntryWrapperDTO.ts | 2 +- ...saicGlobalRestrictionTransactionBodyDTO.ts | 2 +- .../mosaicGlobalRestrictionTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicIds.ts | 2 +- src/infrastructure/model/mosaicInfoDTO.ts | 2 +- .../model/mosaicMetadataTransactionBodyDTO.ts | 2 +- .../model/mosaicMetadataTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicNamesDTO.ts | 2 +- .../model/mosaicRestrictionEntryTypeEnum.ts | 13 +- .../model/mosaicRestrictionTypeEnum.ts | 29 +-- .../model/mosaicSupplyChangeActionEnum.ts | 12 +- .../mosaicSupplyChangeTransactionBodyDTO.ts | 2 +- .../model/mosaicSupplyChangeTransactionDTO.ts | 2 +- src/infrastructure/model/mosaicsInfoDTO.ts | 2 +- src/infrastructure/model/mosaicsNamesDTO.ts | 2 +- .../model/multisigAccountGraphInfoDTO.ts | 2 +- .../model/multisigAccountInfoDTO.ts | 2 +- ...igAccountModificationTransactionBodyDTO.ts | 2 +- ...ltisigAccountModificationTransactionDTO.ts | 2 +- src/infrastructure/model/multisigDTO.ts | 2 +- src/infrastructure/model/namespaceDTO.ts | 2 +- .../model/namespaceExpiryReceiptDTO.ts | 2 +- .../model/namespaceExpiryReceiptDTOAllOf.ts | 2 +- src/infrastructure/model/namespaceIds.ts | 2 +- src/infrastructure/model/namespaceInfoDTO.ts | 2 +- src/infrastructure/model/namespaceMetaDTO.ts | 2 +- .../namespaceMetadataTransactionBodyDTO.ts | 2 +- .../model/namespaceMetadataTransactionDTO.ts | 2 +- src/infrastructure/model/namespaceNameDTO.ts | 2 +- ...namespaceRegistrationTransactionBodyDTO.ts | 2 +- .../namespaceRegistrationTransactionDTO.ts | 2 +- .../model/namespaceRegistrationTypeEnum.ts | 12 +- src/infrastructure/model/namespacesInfoDTO.ts | 2 +- src/infrastructure/model/networkTypeDTO.ts | 2 +- src/infrastructure/model/networkTypeEnum.ts | 19 +- src/infrastructure/model/nodeInfoDTO.ts | 2 +- src/infrastructure/model/nodeTimeDTO.ts | 2 +- src/infrastructure/model/receiptDTO.ts | 2 +- src/infrastructure/model/receiptTypeEnum.ts | 55 +++-- .../model/resolutionEntryDTO.ts | 2 +- .../model/resolutionStatementBodyDTO.ts | 2 +- .../model/resolutionStatementDTO.ts | 2 +- src/infrastructure/model/rolesTypeEnum.ts | 16 +- .../model/secretLockTransactionBodyDTO.ts | 2 +- .../model/secretLockTransactionDTO.ts | 2 +- .../model/secretProofTransactionBodyDTO.ts | 2 +- .../model/secretProofTransactionDTO.ts | 2 +- src/infrastructure/model/serverDTO.ts | 2 +- src/infrastructure/model/serverInfoDTO.ts | 2 +- src/infrastructure/model/sourceDTO.ts | 2 +- src/infrastructure/model/statementsDTO.ts | 2 +- src/infrastructure/model/storageInfoDTO.ts | 2 +- .../model/transactionBodyDTO.ts | 2 +- src/infrastructure/model/transactionDTO.ts | 2 +- src/infrastructure/model/transactionHashes.ts | 2 +- src/infrastructure/model/transactionIds.ts | 2 +- .../model/transactionInfoDTO.ts | 2 +- .../model/transactionMetaDTO.ts | 2 +- .../model/transactionPayload.ts | 2 +- .../model/transactionStateTypeEnum.ts | 35 ++++ .../model/transactionStatementBodyDTO.ts | 2 +- .../model/transactionStatementDTO.ts | 2 +- .../model/transactionStatusDTO.ts | 20 +- .../model/transactionStatusTypeEnum.ts | 179 +++++++++++++++++ .../model/transactionTypeEnum.ts | 70 ++++--- .../model/transferTransactionBodyDTO.ts | 2 +- .../model/transferTransactionDTO.ts | 2 +- src/infrastructure/model/unresolvedMosaic.ts | 2 +- .../model/verifiableEntityDTO.ts | 2 +- .../receipt/CreateReceiptFromDTO.ts | 164 +++++++-------- .../templates/api-single.mustache | 4 +- src/infrastructure/templates/model.mustache | 2 +- src/model/blockchain/MerkleProofInfo.ts | 2 +- src/model/transaction/SignedTransaction.ts | 2 +- src/model/transaction/TransactionStatus.ts | 16 +- .../transaction/TransactionStatusError.ts | 2 +- src/service/AggregateTransactionService.ts | 2 +- src/service/MetadataTransactionService.ts | 4 +- .../MosaicRestrictionTransactionService.ts | 7 +- src/service/MosaicService.ts | 8 +- src/service/NamespaceService.ts | 2 +- src/service/TransactionService.ts | 4 +- test/core/utils/UnresolvedMapping.spec.ts | 2 +- test/infrastructure/Listener.spec.ts | 24 +-- test/infrastructure/RepositoryFactory.spec.ts | 34 ++-- .../receipt/CreateReceiptFromDTO.spec.ts | 2 - test/model/account/Address.spec.ts | 30 +-- .../transaction/HashLockTransaction.spec.ts | 2 +- .../transaction/TransactionStatus.spec.ts | 7 +- .../TransactionStatusError.spec.ts | 4 +- test/service/MosaicService.spec.ts | 11 +- 237 files changed, 1282 insertions(+), 1163 deletions(-) delete mode 100644 src/infrastructure/model/artifactExpiryReceiptDTO.ts create mode 100644 src/infrastructure/model/transactionStateTypeEnum.ts create mode 100644 src/infrastructure/model/transactionStatusTypeEnum.ts diff --git a/e2e/infrastructure/AccountHttp.spec.ts b/e2e/infrastructure/AccountHttp.spec.ts index 4d666e63ae..2335d2bab2 100644 --- a/e2e/infrastructure/AccountHttp.spec.ts +++ b/e2e/infrastructure/AccountHttp.spec.ts @@ -33,10 +33,10 @@ import { MultisigAccountModificationTransaction } from '../../src/model/transact import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('AccountHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -93,7 +93,7 @@ describe('AccountHttp', () => { [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -109,7 +109,7 @@ describe('AccountHttp', () => { namespaceName, UInt64.fromUint(9), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -265,7 +265,7 @@ describe('AccountHttp', () => { namespaceId, account.address, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -282,7 +282,7 @@ describe('AccountHttp', () => { [cosignAccount1.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const removeCosigner2 = MultisigAccountModificationTransaction.create( Deadline.create(), @@ -293,7 +293,7 @@ describe('AccountHttp', () => { cosignAccount2.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const removeCosigner3 = MultisigAccountModificationTransaction.create( @@ -305,7 +305,7 @@ describe('AccountHttp', () => { cosignAccount3.publicAccount, ], networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), diff --git a/e2e/infrastructure/BlockHttp.spec.ts b/e2e/infrastructure/BlockHttp.spec.ts index 30e7e192ea..73356ba2a7 100644 --- a/e2e/infrastructure/BlockHttp.spec.ts +++ b/e2e/infrastructure/BlockHttp.spec.ts @@ -17,7 +17,9 @@ import { expect } from 'chai'; import { mergeMap } from 'rxjs/operators'; import { BlockHttp } from '../../src/infrastructure/BlockHttp'; +import { BlockRepository } from '../../src/infrastructure/BlockRepository'; import { QueryParams } from '../../src/infrastructure/QueryParams'; +import { ReceiptRepository } from '../../src/infrastructure/ReceiptRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; @@ -25,12 +27,10 @@ import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMos import { Deadline } from '../../src/model/transaction/Deadline'; import { TransactionInfo } from '../../src/model/transaction/TransactionInfo'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { BlockRepository } from "../../src/infrastructure/BlockRepository"; -import { ReceiptRepository } from "../../src/infrastructure/ReceiptRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('BlockHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let blockRepository: BlockRepository; @@ -68,7 +68,6 @@ describe('BlockHttp', () => { describe('Setup Test Data', () => { - it('Announce TransferTransaction', (done) => { const transferTransaction = TransferTransaction.create( Deadline.create(), @@ -76,10 +75,10 @@ describe('BlockHttp', () => { [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); - helper.announce(signedTransaction).then(transaction => { + helper.announce(signedTransaction).then((transaction) => { chainHeight = transaction.transactionInfo!.height.toString(); return transaction; }); diff --git a/e2e/infrastructure/ChainHttp.spec.ts b/e2e/infrastructure/ChainHttp.spec.ts index 53c3171900..59eb1984cd 100644 --- a/e2e/infrastructure/ChainHttp.spec.ts +++ b/e2e/infrastructure/ChainHttp.spec.ts @@ -15,12 +15,11 @@ */ import { expect } from 'chai'; -import { ChainHttp } from '../../src/infrastructure/ChainHttp'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { ChainRepository } from "../../src/infrastructure/ChainRepository"; +import { ChainRepository } from '../../src/infrastructure/ChainRepository'; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('ChainHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let chainRepository: ChainRepository; before(() => { diff --git a/e2e/infrastructure/DiagnosticHttp.spec.ts b/e2e/infrastructure/DiagnosticHttp.spec.ts index 419dbe29db..70e9dff83b 100644 --- a/e2e/infrastructure/DiagnosticHttp.spec.ts +++ b/e2e/infrastructure/DiagnosticHttp.spec.ts @@ -15,12 +15,11 @@ */ import { expect } from 'chai'; -import { DiagnosticHttp } from '../../src/infrastructure/DiagnosticHttp'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { DiagnosticRepository } from "../../src/infrastructure/DiagnosticRepository"; +import { DiagnosticRepository } from '../../src/infrastructure/DiagnosticRepository'; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('DiagnosticHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let diagnosticRepository: DiagnosticRepository; before(() => { diff --git a/e2e/infrastructure/IntegrationTestHelper.ts b/e2e/infrastructure/IntegrationTestHelper.ts index 8fc76c17fa..2e158f3bd4 100644 --- a/e2e/infrastructure/IntegrationTestHelper.ts +++ b/e2e/infrastructure/IntegrationTestHelper.ts @@ -13,21 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Account } from "../../src/model/account/Account"; -import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp"; -import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; -import { combineLatest } from "rxjs"; -import { IListener } from "../../src/infrastructure/IListener"; -import { SignedTransaction } from "../../src/model/transaction/SignedTransaction"; -import { filter } from "rxjs/operators"; -import { Transaction } from "../../src/model/transaction/Transaction"; -import { UInt64 } from "../../src/model/UInt64"; - -const yaml = require('js-yaml'); +import { combineLatest } from 'rxjs'; +import { filter } from 'rxjs/operators'; +import { IListener } from '../../src/infrastructure/IListener'; +import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory'; +import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp'; +import { Account } from '../../src/model/account/Account'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; +import { SignedTransaction } from '../../src/model/transaction/SignedTransaction'; +import { Transaction } from '../../src/model/transaction/Transaction'; +import { UInt64 } from '../../src/model/UInt64'; export class IntegrationTestHelper { - + public readonly yaml = require('js-yaml'); public apiUrl: string; public repositoryFactory: RepositoryFactory; public account: Account; @@ -57,7 +55,8 @@ export class IntegrationTestHelper { console.log(`Running tests against: ${json.apiUrl}`); this.apiUrl = json.apiUrl; this.repositoryFactory = new RepositoryFactoryHttp(json.apiUrl); - combineLatest(this.repositoryFactory.getGenerationHash(), this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => { + combineLatest(this.repositoryFactory.getGenerationHash(), + this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => { this.networkType = networkType; this.generationHash = generationHash; this.account = this.createAccount(json.testAccount); @@ -71,15 +70,18 @@ export class IntegrationTestHelper { this.harvestingAccount = this.createAccount(json.harvestingAccount); this.listener = this.repositoryFactory.createListener(); - this.maxFee = UInt64.fromUint(1000000); //What would be the best maxFee? In the future we will load the fee multiplier from rest. - + // What would be the best maxFee? In the future we will load the fee multiplier from rest. + this.maxFee = UInt64.fromUint(1000000); - require('fs').readFile(path.resolve(__dirname, '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), (err, yamlData) => { - if (err) { - console.log(`catapult-service-bootstrap generated address could not be loaded. Ignoring and using accounts from network.conf. Error: ${err}`); + require('fs').readFile(path.resolve(__dirname, + '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), + (error: any, yamlData: any) => { + if (error) { + console.log(`catapult-service-bootstrap generated address could not be loaded. + Ignoring and using accounts from network.conf. Error: ${error}`); return resolve(this); } else { - const parsedYaml = yaml.safeLoad(yamlData); + const parsedYaml = this.yaml.safeLoad(yamlData); this.account = this.createAccount(parsedYaml.nemesis_addresses[0]); this.account2 = this.createAccount(parsedYaml.nemesis_addresses[1]); this.account3 = this.createAccount(parsedYaml.nemesis_addresses[2]); @@ -91,15 +93,14 @@ export class IntegrationTestHelper { } }); }, (error) => { - console.log("There has been an error loading the configuration. ", error) + console.log('There has been an error loading the configuration. ', error); return reject(error); }); }); - - } + }, ); - }; + } createAccount(data): Account { return Account.createFromPrivateKey(data.privateKey ? data.privateKey : data.private, this.networkType); @@ -114,12 +115,12 @@ export class IntegrationTestHelper { console.log(`Transaction ${signedTransaction.type} confirmed`); resolve(transaction); }); - this.listener.status(address).pipe(filter(status => status.hash === signedTransaction.hash)).subscribe((error) => { + this.listener.status(address).pipe(filter((status) => status.hash === signedTransaction.hash)).subscribe((error) => { console.log(`Error processing transaction ${signedTransaction.type}`, error); reject(error); }); this.repositoryFactory.createTransactionRepository().announce(signedTransaction); - } + }, ); - }; + } } diff --git a/e2e/infrastructure/Listener.spec.ts b/e2e/infrastructure/Listener.spec.ts index 8a2f418aa7..5114b35817 100644 --- a/e2e/infrastructure/Listener.spec.ts +++ b/e2e/infrastructure/Listener.spec.ts @@ -14,7 +14,10 @@ * limitations under the License. */ import { assert, expect } from 'chai'; +import { ChronoUnit } from 'js-joda'; +import { filter } from 'rxjs/operators'; import { AccountRepository } from '../../src/infrastructure/AccountRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { TransactionRepository } from '../../src/infrastructure/TransactionRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; @@ -25,7 +28,7 @@ import { LockFundsTransaction, Mosaic, SignedTransaction, - UInt64 + UInt64, } from '../../src/model/model'; import { MosaicId } from '../../src/model/mosaic/MosaicId'; import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic'; @@ -34,14 +37,11 @@ import { AggregateTransaction } from '../../src/model/transaction/AggregateTrans import { Deadline } from '../../src/model/transaction/Deadline'; import { MultisigAccountModificationTransaction } from '../../src/model/transaction/MultisigAccountModificationTransaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; -import { filter } from "rxjs/operators"; -import { ChronoUnit } from "js-joda"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('Listener', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -82,36 +82,35 @@ describe('Listener', () => { setTimeout(done, 200); }); - - let createSignedAggregatedBondTransaction = (aggregatedTo: Account, - signer: Account, - recipient: Address): SignedTransaction => { + const createSignedAggregatedBondTransaction = (aggregatedTo: Account, + signer: Account, + recipient: Address): SignedTransaction => { const transferTransaction = TransferTransaction.create( Deadline.create(), recipient, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), [transferTransaction.toAggregate(aggregatedTo.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); return signer.sign(aggregateTransaction, generationHash); }; - let createHashLockTransactionAndAnnounce = (signedAggregatedTransaction: SignedTransaction, - signer: Account, - mosaicId: MosaicId) => { + const createHashLockTransactionAndAnnounce = (signedAggregatedTransaction: SignedTransaction, + signer: Account, + mosaicId: MosaicId) => { const lockFundsTransaction = LockFundsTransaction.create( Deadline.create(), new Mosaic(mosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = signer.sign(lockFundsTransaction, generationHash); transactionRepository.announce(signedLockFundsTransaction); @@ -125,7 +124,7 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); return helper.announce(signedTransaction); @@ -141,7 +140,7 @@ describe('Listener', () => { recipientAddress, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); return helper.announce(signedTransaction); @@ -157,10 +156,11 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); - helper.listener.unconfirmedAdded(account.address).pipe(filter((_) => _.transactionInfo!.hash === signedTransaction.hash)).subscribe(() => { + helper.listener.unconfirmedAdded(account.address).pipe( + filter((_) => _.transactionInfo!.hash === signedTransaction.hash)).subscribe(() => { done(); }); helper.announce(signedTransaction); @@ -173,10 +173,10 @@ describe('Listener', () => { account.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = account.sign(transferTransaction, generationHash); - helper.listener.unconfirmedRemoved(account.address).pipe(filter(hash => hash === signedTransaction.hash)).subscribe(() => { + helper.listener.unconfirmedRemoved(account.address).pipe(filter((hash) => hash === signedTransaction.hash)).subscribe(() => { done(); }); helper.announce(signedTransaction); @@ -198,7 +198,7 @@ describe('Listener', () => { cosignAccount1.address, [new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY)))], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -218,7 +218,7 @@ describe('Listener', () => { cosignAccount3.publicAccount, ], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -228,7 +228,6 @@ describe('Listener', () => { const signedTransaction = aggregateTransaction .signTransactionWithCosignatories(multisigAccount, [cosignAccount1, cosignAccount2, cosignAccount3], generationHash); - return helper.announce(signedTransaction); }); }); @@ -236,24 +235,27 @@ describe('Listener', () => { describe('Aggregate Bonded Transactions', () => { it('aggregateBondedTransactionsAdded', (done) => { + const signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, account, account2.address); + createHashLockTransactionAndAnnounce(signedAggregatedTx, account, networkCurrencyMosaicId); helper.listener.aggregateBondedAdded(account.address).subscribe(() => { done(); }); helper.listener.confirmed(account.address).subscribe(() => { - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(account.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, account, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, account, networkCurrencyMosaicId); }); }); describe('Aggregate Bonded Transactions', () => { it('aggregateBondedTransactionsRemoved', (done) => { + const signedAggregatedTx = + createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); + + createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); helper.listener.confirmed(cosignAccount1.address).subscribe(() => { helper.listener.aggregateBondedRemoved(cosignAccount1.address).subscribe(() => { done(); @@ -272,23 +274,23 @@ describe('Listener', () => { assert(false); done(); }); - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(cosignAccount1.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = - createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); }); }); describe('Aggregate Bonded Transactions', () => { it('cosignatureAdded', (done) => { + const signedAggregatedTx = + createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); + + createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); helper.listener.cosignatureAdded(cosignAccount1.address).subscribe(() => { done(); }); @@ -301,17 +303,13 @@ describe('Listener', () => { }); }); helper.listener.confirmed(cosignAccount1.address).subscribe(() => { - transactionRepository.announceAggregateBonded(signedAggregatedTx) + transactionRepository.announceAggregateBonded(signedAggregatedTx); }); helper.listener.status(cosignAccount1.address).subscribe((error) => { console.log('Error:', error); assert(false); done(); }); - const signedAggregatedTx = - createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.address); - - createHashLockTransactionAndAnnounce(signedAggregatedTx, cosignAccount1, networkCurrencyMosaicId); }); }); @@ -365,12 +363,12 @@ describe('Listener', () => { account2.address, mosaics, PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(transferTransaction.signWith(account, generationHash)).then(() => { - throw new Error("Transaction should have failed!!"); - }, error => { + throw new Error('Transaction should have failed!!'); + }, (error) => { expect(error.status).to.be.equal('Failure_Core_Insufficient_Balance'); }); }); @@ -387,7 +385,7 @@ describe('Listener', () => { account2.address, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); helper.announce(transferTransaction.signWith(account, generationHash)); diff --git a/e2e/infrastructure/MetadataHttp.spec.ts b/e2e/infrastructure/MetadataHttp.spec.ts index e28d0f4405..5b8a9062e6 100644 --- a/e2e/infrastructure/MetadataHttp.spec.ts +++ b/e2e/infrastructure/MetadataHttp.spec.ts @@ -15,7 +15,7 @@ */ import { expect } from 'chai'; -import { MetadataHttp } from '../../src/infrastructure/MetadataHttp'; +import { MetadataRepository } from '../../src/infrastructure/MetadataRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; @@ -31,12 +31,11 @@ import { MosaicMetadataTransaction } from '../../src/model/transaction/MosaicMet import { NamespaceMetadataTransaction } from '../../src/model/transaction/NamespaceMetadataTransaction'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { MetadataRepository } from "../../src/infrastructure/MetadataRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('MetadataHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let accountAddress: Address; let mosaicId: MosaicId; @@ -82,7 +81,7 @@ describe('MetadataHttp', () => { 3, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -98,7 +97,7 @@ describe('MetadataHttp', () => { namespaceName, UInt64.fromUint(9), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -115,7 +114,7 @@ describe('MetadataHttp', () => { 23, `Test account meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -138,14 +137,14 @@ describe('MetadataHttp', () => { 22, `Test mosaic meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -163,14 +162,14 @@ describe('MetadataHttp', () => { 25, `Test namespace meta value`, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [namespaceMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/MosaicHttp.spec.ts b/e2e/infrastructure/MosaicHttp.spec.ts index 3ca7a0d325..63656756a5 100644 --- a/e2e/infrastructure/MosaicHttp.spec.ts +++ b/e2e/infrastructure/MosaicHttp.spec.ts @@ -15,6 +15,7 @@ */ import { expect } from 'chai'; import { MosaicRepository } from '../../src/infrastructure/MosaicRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags'; @@ -27,8 +28,7 @@ import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasT import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('MosaicHttp', () => { @@ -38,7 +38,7 @@ describe('MosaicHttp', () => { let namespaceId: NamespaceId; let namespaceRepository: NamespaceRepository; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { @@ -76,7 +76,7 @@ describe('MosaicHttp', () => { 3, UInt64.fromUint(0), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); @@ -93,7 +93,7 @@ describe('MosaicHttp', () => { namespaceName, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -110,7 +110,7 @@ describe('MosaicHttp', () => { namespaceId, mosaicId, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -184,7 +184,6 @@ describe('MosaicHttp', () => { */ describe('Remove test MosaicAlias', () => { - it('Announce MosaicAliasTransaction', () => { const mosaicAliasTransaction = MosaicAliasTransaction.create( Deadline.create(), @@ -192,7 +191,7 @@ describe('MosaicHttp', () => { namespaceId, mosaicId, networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/NamespaceHttp.spec.ts b/e2e/infrastructure/NamespaceHttp.spec.ts index d2e36d6065..4f02b927af 100644 --- a/e2e/infrastructure/NamespaceHttp.spec.ts +++ b/e2e/infrastructure/NamespaceHttp.spec.ts @@ -17,6 +17,7 @@ import { deepEqual } from 'assert'; import { expect } from 'chai'; import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic'; import { AliasAction } from '../../src/model/namespace/AliasAction'; import { NamespaceId } from '../../src/model/namespace/NamespaceId'; @@ -24,8 +25,7 @@ import { AddressAliasTransaction } from '../../src/model/transaction/AddressAlia import { Deadline } from '../../src/model/transaction/Deadline'; import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { Address } from "../../src/model/account/Address"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NamespaceHttp', () => { const defaultNamespaceId = NetworkCurrencyMosaic.NAMESPACE_ID; @@ -33,7 +33,7 @@ describe('NamespaceHttp', () => { let namespaceRepository: NamespaceRepository; let account: Account; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); before(() => { return helper.start().then(() => { @@ -60,7 +60,7 @@ describe('NamespaceHttp', () => { namespaceName, UInt64.fromUint(1000), helper.networkType, - helper.maxFee + helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -69,7 +69,6 @@ describe('NamespaceHttp', () => { }); describe('AddressAliasTransaction', () => { - it('standalone', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), @@ -77,7 +76,7 @@ describe('NamespaceHttp', () => { namespaceId, account.address, helper.networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); diff --git a/e2e/infrastructure/NetworkHttp.spec.ts b/e2e/infrastructure/NetworkHttp.spec.ts index 376d5317ee..1e4e74c8db 100644 --- a/e2e/infrastructure/NetworkHttp.spec.ts +++ b/e2e/infrastructure/NetworkHttp.spec.ts @@ -16,11 +16,11 @@ import { expect } from 'chai'; import { NetworkRepository } from '../../src/infrastructure/NetworkRepository'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NetworkHttp', () => { let networkRepository: NetworkRepository; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { diff --git a/e2e/infrastructure/NodeHttp.spec.ts b/e2e/infrastructure/NodeHttp.spec.ts index 60b64dbcef..4d6cfd427b 100644 --- a/e2e/infrastructure/NodeHttp.spec.ts +++ b/e2e/infrastructure/NodeHttp.spec.ts @@ -16,11 +16,11 @@ import { expect } from 'chai'; import { NodeRepository } from '../../src/infrastructure/NodeRepository'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('NodeHttp', () => { let nodeRepository: NodeRepository; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); before(() => { return helper.start().then(() => { diff --git a/e2e/infrastructure/RestrictionHttp.spec.ts b/e2e/infrastructure/RestrictionHttp.spec.ts index 7110e8a5a2..35464fa883 100644 --- a/e2e/infrastructure/RestrictionHttp.spec.ts +++ b/e2e/infrastructure/RestrictionHttp.spec.ts @@ -16,6 +16,7 @@ import { deepEqual } from 'assert'; import { expect } from 'chai'; +import { RestrictionAccountRepository } from '../../src/infrastructure/RestrictionAccountRespository'; import { RestrictionMosaicRepository } from '../../src/infrastructure/RestrictionMosaicRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; @@ -33,11 +34,10 @@ import { MosaicAddressRestrictionTransaction } from '../../src/model/transaction import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction'; import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/MosaicGlobalRestrictionTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { RestrictionAccountRepository } from "../../src/infrastructure/RestrictionAccountRespository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('RestrictionHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account3: Account; let accountAddress: Address; @@ -177,7 +177,7 @@ describe('RestrictionHttp', () => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); diff --git a/e2e/infrastructure/TransactionHttp.spec.ts b/e2e/infrastructure/TransactionHttp.spec.ts index 3c0b266764..1df25ff961 100644 --- a/e2e/infrastructure/TransactionHttp.spec.ts +++ b/e2e/infrastructure/TransactionHttp.spec.ts @@ -21,7 +21,13 @@ import { Crypto } from '../../src/core/crypto'; import { Convert, Convert as convert } from '../../src/core/format'; import { TransactionMapping } from '../../src/core/utils/TransactionMapping'; import { AccountRepository } from '../../src/infrastructure/AccountRepository'; +import { MultisigRepository } from '../../src/infrastructure/MultisigRepository'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; +import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory'; +import { TransactionRepository } from '../../src/infrastructure/TransactionRepository'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; +import { PublicAccount } from '../../src/model/account/PublicAccount'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; import { Mosaic } from '../../src/model/mosaic/Mosaic'; @@ -64,19 +70,13 @@ import { SecretProofTransaction } from '../../src/model/transaction/SecretProofT import { TransactionType } from '../../src/model/transaction/TransactionType'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { Address } from "../../src/model/account/Address"; -import { PublicAccount } from "../../src/model/account/PublicAccount"; -import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory"; -import { MultisigRepository } from "../../src/infrastructure/MultisigRepository"; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { TransactionRepository } from "../../src/infrastructure/TransactionRepository"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('TransactionHttp', () => { let transactionHash; let transactionId; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let account3: Account; @@ -154,7 +154,7 @@ describe('TransactionHttp', () => { 3, UInt64.fromUint(1000), networkType, - helper.maxFee + helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); @@ -182,7 +182,7 @@ describe('TransactionHttp', () => { 3, UInt64.fromUint(0), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicDefinitionTransaction.toAggregate(account.publicAccount)], @@ -203,14 +203,14 @@ describe('TransactionHttp', () => { 10, Convert.uint8ToUtf8(new Uint8Array(10)), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [accountMetadataTransaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); @@ -235,13 +235,13 @@ describe('TransactionHttp', () => { mosaicId, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: AggregateTransaction) => { @@ -264,7 +264,7 @@ describe('TransactionHttp', () => { Deadline.create(), namespaceName, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -283,7 +283,7 @@ describe('TransactionHttp', () => { Deadline.create(), 'root-test-namespace-' + Math.floor(Math.random() * 10000), UInt64.fromUint(5), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [registerNamespaceTransaction.toAggregate(account.publicAccount)], @@ -303,13 +303,13 @@ describe('TransactionHttp', () => { namespaceId, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [namespaceMetadataTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: AggregateTransaction) => { @@ -334,7 +334,7 @@ describe('TransactionHttp', () => { MosaicRestrictionType.NONE, UInt64.fromUint(0), MosaicRestrictionType.GE, - networkType, undefined, helper.maxFee + networkType, undefined, helper.maxFee, ); const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -350,12 +350,12 @@ describe('TransactionHttp', () => { MosaicRestrictionType.GE, UInt64.fromUint(1), MosaicRestrictionType.GE, - networkType, undefined, helper.maxFee + networkType, undefined, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicGlobalRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -371,12 +371,12 @@ describe('TransactionHttp', () => { UInt64.fromUint(60641), account3.address, UInt64.fromUint(2), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -390,7 +390,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -403,12 +403,12 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transferTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -421,7 +421,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingAddress, [account3.address], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); @@ -439,15 +439,15 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingAddress, [], [account3.address], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); @@ -459,10 +459,10 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingAddress, [account3.address], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); describe('AccountRestrictionTransaction - Incoming Address', () => { @@ -472,12 +472,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingAddress, [], [account3.address], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -485,7 +485,6 @@ describe('TransactionHttp', () => { }); describe('AccountRestrictionTransaction - Mosaic', () => { - it('standalone', () => { AccountRestrictionModification.createForMosaic( AccountRestrictionModificationAction.Add, @@ -496,7 +495,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockMosaic, [mosaicId], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account, generationHash); @@ -515,12 +514,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockMosaic, [], [mosaicId], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -534,7 +533,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingTransactionType, [TransactionType.LINK_ACCOUNT], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account3, generationHash); @@ -553,21 +552,20 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockIncomingTransactionType, [], [TransactionType.LINK_ACCOUNT], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account3.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account3, generationHash); - return helper.announce(signedTransaction) + return helper.announce(signedTransaction); }); }); describe('AccountRestrictionTransaction - Outgoing Operation', () => { - it('standalone', () => { AccountRestrictionModification.createForOperation( AccountRestrictionModificationAction.Add, @@ -578,7 +576,7 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingTransactionType, [TransactionType.LINK_ACCOUNT], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressModification.signWith(account3, generationHash); @@ -598,12 +596,12 @@ describe('TransactionHttp', () => { AccountRestrictionFlags.BlockOutgoingTransactionType, [], [TransactionType.LINK_ACCOUNT], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressModification.toAggregate(account3.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account3, generationHash); return helper.announce(signedTransaction); @@ -613,13 +611,12 @@ describe('TransactionHttp', () => { describe('AccountLinkTransaction', () => { - it('standalone', (done) => { const accountLinkTransaction = AccountLinkTransaction.create( Deadline.create(), harvestingAccount.publicKey, LinkAction.Link, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = accountLinkTransaction.signWith(account, generationHash); @@ -638,12 +635,12 @@ describe('TransactionHttp', () => { Deadline.create(), harvestingAccount.publicKey, LinkAction.Unlink, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [accountLinkTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -652,14 +649,13 @@ describe('TransactionHttp', () => { describe('AddressAliasTransaction', () => { - it('standalone', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), AliasAction.Link, namespaceId, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); @@ -674,14 +670,13 @@ describe('TransactionHttp', () => { describe('Transfer Transaction using address alias', () => { - it('Announce TransferTransaction', () => { const transferTransaction = TransferTransaction.create( Deadline.create(), namespaceId, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -697,12 +692,12 @@ describe('TransactionHttp', () => { AliasAction.Unlink, namespaceId, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [addressAliasTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -717,7 +712,7 @@ describe('TransactionHttp', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: MosaicSupplyChangeTransaction) => { @@ -736,7 +731,7 @@ describe('TransactionHttp', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(10), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicSupplyChangeTransaction.toAggregate(account.publicAccount)], @@ -750,14 +745,13 @@ describe('TransactionHttp', () => { describe('MosaicAliasTransaction', () => { - it('standalone', () => { const mosaicAliasTransaction = MosaicAliasTransaction.create( Deadline.create(), AliasAction.Link, namespaceId, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); @@ -776,7 +770,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const hashLockTransaction = HashLockTransaction.create(Deadline.create(), @@ -797,12 +791,12 @@ describe('TransactionHttp', () => { AliasAction.Unlink, namespaceId, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAliasTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -816,7 +810,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(), @@ -835,7 +829,7 @@ describe('TransactionHttp', () => { Deadline.create(), [], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggregateTransaction, generationHash); const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(), @@ -859,7 +853,7 @@ describe('TransactionHttp', () => { account2.address, [], PlainMessage.create('Hi'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggTx = AggregateTransaction.createComplete( Deadline.create(), @@ -867,7 +861,7 @@ describe('TransactionHttp', () => { tx.toAggregate(account.publicAccount), ], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = account.sign(aggTx, generationHash); return helper.announce(signedTransaction); @@ -884,7 +878,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = secretLockTransaction.signWith(account, generationHash); return helper.announce(signedTransaction).then((transaction: SecretLockTransaction) => { @@ -898,7 +892,6 @@ describe('TransactionHttp', () => { }); describe('HashType: Op_Sha3_256', () => { - it('aggregate', () => { const secretLockTransaction = SecretLockTransaction.create( Deadline.create(), @@ -907,7 +900,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -926,7 +919,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -941,7 +934,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -962,7 +955,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -979,7 +972,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -998,7 +991,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)); }); @@ -1013,7 +1006,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, sha3_256.create().update(Crypto.randomBytes(20)).hex(), account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretLockTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretLockTransaction.toAggregate(account.publicAccount)], @@ -1037,7 +1030,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedSecretLockTx = secretLockTransaction.signWith(account, generationHash); @@ -1049,7 +1042,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTx = secretProofTransaction.signWith(account2, generationHash); return helper.announce(signedTx).then((transaction: SecretProofTransaction) => { @@ -1058,8 +1051,7 @@ describe('TransactionHttp', () => { expect(transaction.hashType, 'HashType').not.to.be.undefined; expect(transaction.proof, 'Proof').not.to.be.undefined; }); - }) - + }); }); }); @@ -1076,7 +1068,7 @@ describe('TransactionHttp', () => { HashType.Op_Sha3_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1086,13 +1078,13 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], networkType, [], helper.maxFee); return helper.announce(aggregateSecretProofTransaction.signWith(account2, generationHash)); - }) + }); }); }); @@ -1109,7 +1101,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1119,7 +1111,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretProofTransaction.signWith(account2, generationHash)); }); @@ -1138,7 +1130,7 @@ describe('TransactionHttp', () => { HashType.Op_Keccak_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { const secretProofTransaction = SecretProofTransaction.create( @@ -1147,7 +1139,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1172,7 +1164,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => { @@ -1182,7 +1174,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTx = secretProofTransaction.signWith(account2, generationHash); return helper.announce(signedTx); @@ -1204,7 +1196,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_160, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( Deadline.create(), @@ -1212,7 +1204,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1238,7 +1230,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( @@ -1247,7 +1239,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => @@ -1269,7 +1261,7 @@ describe('TransactionHttp', () => { HashType.Op_Hash_256, secret, account2.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const secretProofTransaction = SecretProofTransaction.create( Deadline.create(), @@ -1277,7 +1269,7 @@ describe('TransactionHttp', () => { secret, account2.address, proof, - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateSecretProofTransaction = AggregateTransaction.createComplete(Deadline.create(), [secretProofTransaction.toAggregate(account2.publicAccount)], @@ -1314,7 +1306,7 @@ describe('TransactionHttp', () => { bobTransferTransaction.toAggregate(account2.publicAccount), ], networkType, - [], helper.maxFee + [], helper.maxFee, ); const aliceSignedTransaction = aggregateTransaction.signWith(account, generationHash); @@ -1416,7 +1408,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createAbsolute(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionRepository.announce(signedTransaction) @@ -1435,7 +1427,7 @@ describe('TransactionHttp', () => { account2.address, [NetworkCurrencyMosaic.createRelative(1)], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), diff --git a/e2e/infrastructure/UnresolvedMapping.spec.ts b/e2e/infrastructure/UnresolvedMapping.spec.ts index bf8e54dd6d..696aa12541 100644 --- a/e2e/infrastructure/UnresolvedMapping.spec.ts +++ b/e2e/infrastructure/UnresolvedMapping.spec.ts @@ -15,8 +15,10 @@ */ import { expect } from 'chai'; import { Convert } from '../../src/core/format'; +import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { TransactionHttp } from '../../src/infrastructure/TransactionHttp'; import { Account } from '../../src/model/account/Account'; +import { Address } from '../../src/model/account/Address'; import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { PlainMessage } from '../../src/model/message/PlainMessage'; import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags'; @@ -38,12 +40,10 @@ import { NamespaceRegistrationTransaction } from '../../src/model/transaction/Na import { Transaction } from '../../src/model/transaction/Transaction'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; -import { IntegrationTestHelper } from "./IntegrationTestHelper"; -import { Address } from "../../src/model/account/Address"; -import { NamespaceRepository } from "../../src/infrastructure/NamespaceRepository"; +import { IntegrationTestHelper } from './IntegrationTestHelper'; describe('TransactionHttp', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let namespaceRepository: NamespaceRepository; @@ -291,7 +291,6 @@ describe('TransactionHttp', () => { ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); - return helper.announce(signedTransaction).then((transaction: AddressAliasTransaction) => { expect(transaction.namespaceId, 'NamespaceId').not.to.be.undefined; expect(transaction.aliasAction, 'AliasAction').not.to.be.undefined; diff --git a/e2e/service/MetadataTransactionService.spec.ts b/e2e/service/MetadataTransactionService.spec.ts index df66835650..5489391285 100644 --- a/e2e/service/MetadataTransactionService.spec.ts +++ b/e2e/service/MetadataTransactionService.spec.ts @@ -17,14 +17,14 @@ import { NamespaceRegistrationTransaction } from '../../src/model/transaction/Na import { TransactionType } from '../../src/model/transaction/TransactionType'; import { UInt64 } from '../../src/model/UInt64'; import { MetadataTransactionService } from '../../src/service/MetadataTransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MetadataTransactionService', () => { const deadline = Deadline.create(); const key = UInt64.fromUint(123); const newValue = 'new test value'; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; let targetAccount: Account; @@ -33,7 +33,6 @@ describe('MetadataTransactionService', () => { let namespaceId: NamespaceId; let generationHash: string; - before(() => { return helper.start().then(() => { targetAccount = helper.account; @@ -69,7 +68,7 @@ describe('MetadataTransactionService', () => { MosaicFlags.create(true, true, true), 3, UInt64.fromUint(1000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(targetAccount, generationHash); return helper.announce(signedTransaction); @@ -84,7 +83,7 @@ describe('MetadataTransactionService', () => { Deadline.create(), namespaceName, UInt64.fromUint(9), - networkType, helper.maxFee + networkType, helper.maxFee, ); namespaceId = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(targetAccount, generationHash); @@ -104,14 +103,14 @@ describe('MetadataTransactionService', () => { newValue.length, newValue, networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicMetadataTransaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); @@ -136,7 +135,7 @@ describe('MetadataTransactionService', () => { [namespaceMetadataTransaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); return helper.announce(signedTransaction); @@ -228,13 +227,13 @@ describe('MetadataTransactionService', () => { newValue + 'delta', targetAccount.publicAccount, mosaicId, - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicMetadataTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { @@ -262,13 +261,13 @@ describe('MetadataTransactionService', () => { newValue + 'delta' + 'extra delta', targetAccount.publicAccount, mosaicId, - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicMetadataTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { @@ -301,7 +300,7 @@ describe('MetadataTransactionService', () => { [transaction.toAggregate(targetAccount.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(targetAccount, generationHash); helper.announce(signedTransaction).then(() => { diff --git a/e2e/service/MosaicRestrictionTransactionService.spec.ts b/e2e/service/MosaicRestrictionTransactionService.spec.ts index 482178aa9e..facbe26d12 100644 --- a/e2e/service/MosaicRestrictionTransactionService.spec.ts +++ b/e2e/service/MosaicRestrictionTransactionService.spec.ts @@ -15,7 +15,7 @@ import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/ import { TransactionType } from '../../src/model/transaction/TransactionType'; import { UInt64 } from '../../src/model/UInt64'; import { MosaicRestrictionTransactionService } from '../../src/service/MosaicRestrictionTransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MosaicRestrictionTransactionService', () => { const deadline = Deadline.create(); @@ -24,7 +24,7 @@ describe('MosaicRestrictionTransactionService', () => { let restrictionRepository: RestrictionMosaicRepository; let mosaicId: MosaicId; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { @@ -62,7 +62,7 @@ describe('MosaicRestrictionTransactionService', () => { MosaicFlags.create(true, true, true), 3, UInt64.fromUint(1000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -82,9 +82,9 @@ describe('MosaicRestrictionTransactionService', () => { MosaicRestrictionType.GE, networkType, undefined, - helper.maxFee + helper.maxFee, ); - const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash) + const signedTransaction = mosaicGlobalRestrictionTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); }); }); @@ -99,12 +99,12 @@ describe('MosaicRestrictionTransactionService', () => { account.address, UInt64.fromUint(2), networkType, - helper.maxFee + helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [mosaicAddressRestrictionTransaction.toAggregate(account.publicAccount)], networkType, - [], helper.maxFee + [], helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); return helper.announce(signedTransaction); @@ -126,7 +126,7 @@ describe('MosaicRestrictionTransactionService', () => { mosaicId, key, '1', - MosaicRestrictionType.GE, undefined, helper.maxFee + MosaicRestrictionType.GE, undefined, helper.maxFee, ).subscribe((transaction: MosaicGlobalRestrictionTransaction) => { expect(transaction.type).to.be.equal(TransactionType.MOSAIC_GLOBAL_RESTRICTION); expect(transaction.previousRestrictionValue.toString()).to.be.equal('0'); @@ -147,7 +147,7 @@ describe('MosaicRestrictionTransactionService', () => { key, account.address, '3', - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicAddressRestrictionTransaction) => { expect(transaction.type).to.be.equal(TransactionType.MOSAIC_ADDRESS_RESTRICTION); expect(transaction.previousRestrictionValue.toString()).to.be.equal('2'); @@ -169,13 +169,13 @@ describe('MosaicRestrictionTransactionService', () => { mosaicId, key, '1', - MosaicRestrictionType.GE, undefined, helper.maxFee + MosaicRestrictionType.GE, undefined, helper.maxFee, ).subscribe((transaction: MosaicGlobalRestrictionTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); helper.announce(signedTransaction).then(() => { @@ -197,13 +197,13 @@ describe('MosaicRestrictionTransactionService', () => { key, account.address, '3', - helper.maxFee + helper.maxFee, ).subscribe((transaction: MosaicAddressRestrictionTransaction) => { const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), [transaction.toAggregate(account.publicAccount)], networkType, [], - helper.maxFee + helper.maxFee, ); const signedTransaction = aggregateTransaction.signWith(account, generationHash); helper.announce(signedTransaction).then(() => { diff --git a/e2e/service/MosaicService.spec.ts b/e2e/service/MosaicService.spec.ts index 95036cfda8..0429d88e77 100644 --- a/e2e/service/MosaicService.spec.ts +++ b/e2e/service/MosaicService.spec.ts @@ -17,16 +17,16 @@ import { AccountRepository } from '../../src/infrastructure/AccountRepository'; import { MosaicRepository } from '../../src/infrastructure/MosaicRepository'; import { Address } from '../../src/model/account/Address'; +import { NetworkType } from '../../src/model/blockchain/NetworkType'; import { MosaicService } from '../../src/service/MosaicService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; -import { NetworkType } from "../../src/model/blockchain/NetworkType"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('MosaicService', () => { let accountAddress: Address; let accountRepository: AccountRepository; let mosaicRepository: MosaicRepository; let generationHash: string; - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let networkType: NetworkType; before(() => { diff --git a/e2e/service/TransactionService.spec.ts b/e2e/service/TransactionService.spec.ts index 5dfb643743..e183f27fe9 100644 --- a/e2e/service/TransactionService.spec.ts +++ b/e2e/service/TransactionService.spec.ts @@ -41,10 +41,10 @@ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; import { TransactionService } from '../../src/service/TransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('TransactionService', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let generationHash: string; let addressAlias: NamespaceId; let mosaicAlias: NamespaceId; @@ -96,7 +96,7 @@ describe('TransactionService', () => { namespaceName, UInt64.fromUint(20), networkType, - helper.maxFee + helper.maxFee, ); addressAlias = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -113,7 +113,7 @@ describe('TransactionService', () => { Deadline.create(), namespaceName, UInt64.fromUint(50), - networkType, helper.maxFee + networkType, helper.maxFee, ); mosaicAlias = new NamespaceId(namespaceName); const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash); @@ -124,14 +124,13 @@ describe('TransactionService', () => { describe('Setup test AddressAlias', () => { - it('Announce addressAliasTransaction', () => { const addressAliasTransaction = AddressAliasTransaction.create( Deadline.create(), AliasAction.Link, addressAlias, account.address, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = addressAliasTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -152,7 +151,7 @@ describe('TransactionService', () => { MosaicFlags.create(true, true, false), 3, UInt64.fromUint(50), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -169,7 +168,7 @@ describe('TransactionService', () => { mosaicId, MosaicSupplyChangeAction.Increase, UInt64.fromUint(200000), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicSupplyChangeTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -185,7 +184,7 @@ describe('TransactionService', () => { AliasAction.Link, mosaicAlias, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = mosaicAliasTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -203,7 +202,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); @@ -236,7 +235,6 @@ describe('TransactionService', () => { describe('Transfer mosaic to account 3', () => { - it('Announce TransferTransaction', () => { const transferTransaction = TransferTransaction.create( Deadline.create(), @@ -245,7 +243,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(200)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionHashes.push(signedTransaction.hash); @@ -255,7 +253,6 @@ describe('TransactionService', () => { describe('Create multiple transfers with alias', () => { - it('Announce TransferTransaction', (done) => { const transactions: SignedTransaction[] = []; // 1. Transfer A -> B @@ -266,7 +263,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); transactions.push(transaction1.signWith(account, generationHash)); @@ -278,7 +275,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); transactions.push(transaction2.signWith(account3, generationHash)); @@ -360,7 +357,7 @@ describe('TransactionService', () => { new Mosaic(mosaicAlias, UInt64.fromUint(1)), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); // Unlink MosaicAlias const mosaicAliasTransactionUnlink = MosaicAliasTransaction.create( @@ -368,7 +365,7 @@ describe('TransactionService', () => { AliasAction.Unlink, mosaicAlias, mosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); // Create a new Mosaic @@ -381,7 +378,7 @@ describe('TransactionService', () => { MosaicFlags.create(true, true, false), 3, UInt64.fromUint(0), - networkType, helper.maxFee + networkType, helper.maxFee, ); // Link namespace with new MosaicId @@ -390,7 +387,7 @@ describe('TransactionService', () => { AliasAction.Link, mosaicAlias, newMosaicId, - networkType, helper.maxFee + networkType, helper.maxFee, ); // Use new mosaicAlias in metadata @@ -401,7 +398,7 @@ describe('TransactionService', () => { mosaicAlias, 10, Convert.uint8ToUtf8(new Uint8Array(10)), - networkType, helper.maxFee + networkType, helper.maxFee, ); return AggregateTransaction.createComplete(Deadline.create(), [ @@ -413,7 +410,7 @@ describe('TransactionService', () => { ], networkType, - [], helper.maxFee + [], helper.maxFee, ); } diff --git a/e2e/service/TransactionService_AggregateBonded.spec.ts b/e2e/service/TransactionService_AggregateBonded.spec.ts index d347b5e860..d85b5fa368 100644 --- a/e2e/service/TransactionService_AggregateBonded.spec.ts +++ b/e2e/service/TransactionService_AggregateBonded.spec.ts @@ -15,6 +15,7 @@ */ import { expect } from 'chai'; +import { ChronoUnit } from 'js-joda'; import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository'; import { Account } from '../../src/model/account/Account'; import { Address } from '../../src/model/account/Address'; @@ -28,17 +29,16 @@ import { AggregateTransaction } from '../../src/model/transaction/AggregateTrans import { Deadline } from '../../src/model/transaction/Deadline'; import { LockFundsTransaction } from '../../src/model/transaction/LockFundsTransaction'; import { MultisigAccountModificationTransaction } from '../../src/model/transaction/MultisigAccountModificationTransaction'; +import { SignedTransaction } from '../../src/model/transaction/SignedTransaction'; import { TransactionType } from '../../src/model/transaction/TransactionType'; import { TransferTransaction } from '../../src/model/transaction/TransferTransaction'; import { UInt64 } from '../../src/model/UInt64'; import { TransactionService } from '../../src/service/TransactionService'; -import { IntegrationTestHelper } from "../infrastructure/IntegrationTestHelper"; -import { SignedTransaction } from "../../src/model/transaction/SignedTransaction"; -import { ChronoUnit } from "js-joda"; +import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper'; describe('TransactionService', () => { - let helper = new IntegrationTestHelper(); + const helper = new IntegrationTestHelper(); let account: Account; let account2: Account; let multisigAccount: Account; @@ -62,7 +62,8 @@ describe('TransactionService', () => { generationHash = helper.generationHash; networkType = helper.networkType; namespaceRepository = helper.repositoryFactory.createNamespaceRepository(); - transactionService = new TransactionService(helper.repositoryFactory.createTransactionRepository(), helper.repositoryFactory.createReceiptRepository()); + transactionService = new TransactionService(helper.repositoryFactory.createTransactionRepository(), + helper.repositoryFactory.createReceiptRepository()); }); }); before(() => { @@ -73,21 +74,20 @@ describe('TransactionService', () => { helper.listener.close(); }); - - let createSignedAggregatedBondTransaction = (aggregatedTo: Account, - signer: Account, - recipient: Address): SignedTransaction => { + const createSignedAggregatedBondTransaction = (aggregatedTo: Account, + signer: Account, + recipient: Address): SignedTransaction => { const transferTransaction = TransferTransaction.create( Deadline.create(), recipient, [], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createBonded( Deadline.create(2, ChronoUnit.MINUTES), [transferTransaction.toAggregate(aggregatedTo.publicAccount)], - networkType, [], helper.maxFee + networkType, [], helper.maxFee, ); return signer.sign(aggregateTransaction, generationHash); }; @@ -119,7 +119,7 @@ describe('TransactionService', () => { cosignAccount3.publicAccount, ], [], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), @@ -148,7 +148,7 @@ describe('TransactionService', () => { NetworkCurrencyMosaic.createAbsolute(1), ], PlainMessage.create('test-message'), - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedTransaction = transferTransaction.signWith(account, generationHash); transactionService.announce(signedTransaction, helper.listener).subscribe((tx: TransferTransaction) => { @@ -169,7 +169,7 @@ describe('TransactionService', () => { new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = lockFundsTransaction.signWith(account, generationHash); transactionService @@ -181,7 +181,6 @@ describe('TransactionService', () => { }); }); - describe('should announce aggregate bonded transaction', () => { it('announce', (done) => { @@ -191,7 +190,7 @@ describe('TransactionService', () => { new Mosaic(networkCurrencyMosaicId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))), UInt64.fromUint(1000), signedAggregatedTransaction, - networkType, helper.maxFee + networkType, helper.maxFee, ); const signedLockFundsTransaction = lockFundsTransaction.signWith(account, generationHash); transactionService.announce(signedLockFundsTransaction, helper.listener).subscribe(() => { @@ -220,7 +219,7 @@ describe('TransactionService', () => { [], [cosignAccount1.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const removeCosigner2 = MultisigAccountModificationTransaction.create( Deadline.create(), @@ -230,7 +229,7 @@ describe('TransactionService', () => { [ cosignAccount2.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const removeCosigner3 = MultisigAccountModificationTransaction.create( @@ -241,7 +240,7 @@ describe('TransactionService', () => { [ cosignAccount3.publicAccount, ], - networkType, helper.maxFee + networkType, helper.maxFee, ); const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(), diff --git a/package-lock.json b/package-lock.json index 4c4efe546f..851e965bc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -282,10 +282,13 @@ "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "ansi-wrap": { "version": "0.1.0", @@ -542,17 +545,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -774,16 +766,14 @@ } }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "check-error": { @@ -940,9 +930,9 @@ } }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "commondir": { @@ -2605,15 +2595,6 @@ "har-schema": "^2.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", @@ -3082,12 +3063,6 @@ "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, "js-yaml": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", @@ -3741,7 +3716,7 @@ }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "", + "resolved": false, "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, @@ -3779,7 +3754,7 @@ }, "which-module": { "version": "2.0.0", - "resolved": "", + "resolved": false, "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, @@ -4534,17 +4509,17 @@ } }, "rxjs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", - "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", "requires": { "tslib": "^1.9.0" } }, "rxjs-compat": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.2.1.tgz", - "integrity": "sha512-Pst0lkAwVodBbBOIZic9aM1vY9asJ2u8GfKN115+goIH83PAlizJDyvixuxPAuQ1UtkmBuro7+0PqKQ3PSkhEg==" + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.3.tgz", + "integrity": "sha512-BIJX2yovz3TBpjJoAZyls2QYuU6ZiCaZ+U96SmxQpuSP/qDUfiXPKOVLbThBB2WZijNHkdTTJXKRwvv5Y48H7g==" }, "safe-buffer": { "version": "5.1.1", @@ -4922,10 +4897,21 @@ } }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + } + } }, "sver-compat": { "version": "1.5.0", @@ -5233,66 +5219,38 @@ "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==" }, "tslint": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.9.1.tgz", - "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^3.2.0", + "diff": "^4.0.1", "glob": "^7.1.1", - "js-yaml": "^3.7.0", + "js-yaml": "^3.13.1", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.12.1" + "tsutils": "^2.29.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", - "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "dev": true - }, - "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } } } }, "tsutils": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.22.2.tgz", - "integrity": "sha512-u06FUSulCJ+Y8a2ftuqZN6kIGqdP2yJjUPEngXqmdPND4UQfb04igcotH+dw+IFr417yP6muCLE8/5/Qlfnx0w==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -5325,18 +5283,26 @@ "dev": true }, "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", "dev": true }, "typescript-require": { - "version": "0.2.9-1", - "resolved": "https://registry.npmjs.org/typescript-require/-/typescript-require-0.2.9-1.tgz", - "integrity": "sha1-ZiTBr5HXbyVhPQ9cZn0gQ6bs7cQ=", + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/typescript-require/-/typescript-require-0.2.10.tgz", + "integrity": "sha1-jI7iqnXzUwtWC4ScKSfNNpfrpo4=", "dev": true, "requires": { - "typescript": ">= 0.8.2" + "typescript": "^1.5.3" + }, + "dependencies": { + "typescript": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz", + "integrity": "sha1-tHXW4N/wv1DyluXKbvn7tccyDx4=", + "dev": true + } } }, "uglify-js": { diff --git a/package.json b/package.json index e0ed8f638c..e67edd7593 100644 --- a/package.json +++ b/package.json @@ -52,9 +52,9 @@ "secure-random": "^1.1.1", "ts-mockito": "^2.4.0", "ts-node": "^5.0.1", - "tslint": "^5.8.0", - "typescript": "^2.5.3", - "typescript-require": "^0.2.9-1" + "tslint": "^5.20.1", + "typescript": "^2.9.2", + "typescript-require": "^0.2.10" }, "dependencies": { "bluebird": "^3.5.5", @@ -67,15 +67,15 @@ "request": "^2.88.0", "request-promise-native": "^1.0.5", "ripemd160": "^2.0.2", - "rxjs": "^6.2.1", - "rxjs-compat": "^6.2.1", + "rxjs": "^6.5.3", + "rxjs-compat": "^6.5.3", "utf8": "^2.1.2", "ws": "^5.2.0" }, "peerDependencies": { "js-joda": "^1.6.2", "utf8": "^2.1.2", - "rxjs": "^6.2.1" + "rxjs": "^6.5.3" }, "nyc": { "exclude-after-remap": false, diff --git a/src/infrastructure/AccountHttp.ts b/src/infrastructure/AccountHttp.ts index 8ecba07c48..5c9dc737af 100644 --- a/src/infrastructure/AccountHttp.ts +++ b/src/infrastructure/AccountHttp.ts @@ -78,7 +78,6 @@ export class AccountHttp extends Http implements AccountRepository { ); } - /** * This method maps a AccountInfoDTO from rest to the SDK's AccountInfo model object. * @@ -86,7 +85,7 @@ export class AccountHttp extends Http implements AccountRepository { * @param {AccountInfoDTO} dto AccountInfoDTO the dto object from rest. * @returns AccountInfo model */ - private toAccountInfo(dto: AccountInfoDTO):AccountInfo { + private toAccountInfo(dto: AccountInfoDTO): AccountInfo { return new AccountInfo( Address.createFromEncoded(dto.account.address), UInt64.fromNumericString(dto.account.addressHeight), @@ -111,7 +110,6 @@ export class AccountHttp extends Http implements AccountRepository { ); } - /** * Gets an array of confirmed transactions for which an account is signer or receiver. * @param address - * Address can be created rawAddress or publicKey @@ -120,10 +118,11 @@ export class AccountHttp extends Http implements AccountRepository { */ public getAccountTransactions(address: Address, queryParams?: QueryParams): Observable { return observableFrom( - this.accountRoutesApi.getAccountTransactions(address.plain(), + this.accountRoutesApi.getAccountConfirmedTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order, + this.queryParams(queryParams).transactionType)).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -143,7 +142,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountIncomingTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -163,7 +163,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountOutgoingTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -184,7 +185,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountUnconfirmedTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO); })), @@ -204,7 +206,8 @@ export class AccountHttp extends Http implements AccountRepository { this.accountRoutesApi.getAccountPartialTransactions(address.plain(), this.queryParams(queryParams).pageSize, this.queryParams(queryParams).id, - this.queryParams(queryParams).order)).pipe( + this.queryParams(queryParams).order), + this.queryParams(queryParams).transactionType).pipe( map(({body}) => body.map((transactionDTO) => { return CreateTransactionFromDTO(transactionDTO) as AggregateTransaction; })), diff --git a/src/infrastructure/BlockHttp.ts b/src/infrastructure/BlockHttp.ts index 14bf2f5143..26175a966d 100644 --- a/src/infrastructure/BlockHttp.ts +++ b/src/infrastructure/BlockHttp.ts @@ -28,24 +28,9 @@ import { Http } from './Http'; import { QueryParams } from './QueryParams'; import { CreateTransactionFromDTO, - extractBeneficiary + extractBeneficiary, } from './transaction/CreateTransactionFromDTO'; -/** - * Blocks returned limits: - * N_25: 25 blocks. - * N_50: 50 blocks. - * N_75: 75 blocks. - * N_100: 100 blocks. - */ -export enum LimitType { - N_25 = 25, - N_50 = 50, - N_75 = 75, - N_100 = 100, - -} - /** * Blockchain http repository. * @@ -102,10 +87,10 @@ export class BlockHttp extends Http implements BlockRepository { /** * Gets array of BlockInfo for a block height with limit * @param height - Block height from which will be the first block in the array - * @param limit - Number of blocks returned. Limit value only available in 25, 50. 75 and 100. (default 25) + * @param limit - Number of blocks returned. * @returns Observable */ - public getBlocksByHeightWithLimit(height: string, limit: LimitType = LimitType.N_25): Observable { + public getBlocksByHeightWithLimit(height: string, limit: number): Observable { return observableFrom( this.blockRoutesApi.getBlocksByHeightWithLimit(height, limit)).pipe( map(({body}) => body.map((blockDTO) => this.toBlockInfo(blockDTO))), @@ -113,7 +98,6 @@ export class BlockHttp extends Http implements BlockRepository { ); } - /** * This method maps a BlockInfoDTO from rest to the SDK's BlockInfo model object. * diff --git a/src/infrastructure/Http.ts b/src/infrastructure/Http.ts index eb44afb07d..861e294d9e 100644 --- a/src/infrastructure/Http.ts +++ b/src/infrastructure/Http.ts @@ -16,10 +16,10 @@ // tslint:disable-next-line: ordered-imports import { from as observableFrom, Observable, of as observableOf, throwError } from 'rxjs'; +import { catchError, map, shareReplay } from 'rxjs/operators'; import { NetworkType } from '../model/blockchain/NetworkType'; +import { NodeRoutesApi } from './api/nodeRoutesApi'; import { QueryParams } from './QueryParams'; -import { NodeRoutesApi } from "./api/nodeRoutesApi"; -import { catchError, map, share, shareReplay } from 'rxjs/operators'; /** * Http extended by all http services @@ -53,6 +53,7 @@ export abstract class Http { pageSize: queryParams ? queryParams.pageSize : undefined, id: queryParams ? queryParams.id : undefined, order: queryParams ? queryParams.order : undefined, + transactionType: queryParams ? queryParams.transactionType : undefined, }; } diff --git a/src/infrastructure/Listener.ts b/src/infrastructure/Listener.ts index 8112a0cc8c..09a368969e 100644 --- a/src/infrastructure/Listener.ts +++ b/src/infrastructure/Listener.ts @@ -23,21 +23,19 @@ import { BlockInfo } from '../model/blockchain/BlockInfo'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; import { AggregateTransactionCosignature } from '../model/transaction/AggregateTransactionCosignature'; -import { CosignatoryModificationAction } from '../model/transaction/CosignatoryModificationAction'; import { CosignatureSignedTransaction } from '../model/transaction/CosignatureSignedTransaction'; import { Deadline } from '../model/transaction/Deadline'; import { InnerTransaction } from '../model/transaction/InnerTransaction'; import { MultisigAccountModificationTransaction } from '../model/transaction/MultisigAccountModificationTransaction'; -import { MultisigCosignatoryModification } from '../model/transaction/MultisigCosignatoryModification'; import { Transaction } from '../model/transaction/Transaction'; import { TransactionStatusError } from '../model/transaction/TransactionStatusError'; import { TransferTransaction } from '../model/transaction/TransferTransaction'; import { UInt64 } from '../model/UInt64'; +import { IListener } from './IListener'; import { CreateTransactionFromDTO, extractBeneficiary, } from './transaction/CreateTransactionFromDTO'; -import { IListener } from "./IListener"; enum ListenerChannelName { block = 'block', @@ -356,18 +354,6 @@ export class Listener implements IListener { this.webSocket.send(JSON.stringify(subscriptionMessage)); } - /** - * @internal - * @param channel - Channel to unsubscribe - */ - private unsubscribeTo(channel: string) { - const unsubscribeMessage = { - uid: this.uid, - unsubscribe: channel, - }; - this.webSocket.send(JSON.stringify(unsubscribeMessage)); - } - /** * @internal * Filters if a transaction has been initiated or signed by an address diff --git a/src/infrastructure/MetadataHttp.ts b/src/infrastructure/MetadataHttp.ts index 3f193db43c..f7f93ad807 100644 --- a/src/infrastructure/MetadataHttp.ts +++ b/src/infrastructure/MetadataHttp.ts @@ -41,20 +41,15 @@ export class MetadataHttp extends Http implements MetadataRepository { * Nem2 Library metadata routes api */ private readonly metadataRoutesApi: MetadataRoutesApi; - /** - * @internal - * network type for the mappings. - */ - private readonly networkTypeObservable: Observable; + /** * Constructor * @param url * @param networkType */ - constructor(url: string, networkType?: NetworkType | Observable) { + constructor(url: string) { super(url); this.metadataRoutesApi = new MetadataRoutesApi(url); - this.networkTypeObservable = this.createNetworkTypeObservable(networkType); } /** diff --git a/src/infrastructure/QueryParams.ts b/src/infrastructure/QueryParams.ts index ee41206d80..fa3fc36b73 100644 --- a/src/infrastructure/QueryParams.ts +++ b/src/infrastructure/QueryParams.ts @@ -1,3 +1,5 @@ +import { TransactionType } from '../model/transaction/TransactionType'; + /* * Copyright 2018 NEM * @@ -49,8 +51,11 @@ export class QueryParams { * ASC. Older to newer. */ public readonly order: Order = Order.DESC, + /** + * Transaction type filter + */ + public readonly transactionType?: TransactionType, ) { this.pageSize = (pageSize >= 10 && pageSize <= 100) ? pageSize : 10; - this.id = id; } } diff --git a/src/infrastructure/RepositoryFactory.ts b/src/infrastructure/RepositoryFactory.ts index f343854697..e57a4fa31e 100644 --- a/src/infrastructure/RepositoryFactory.ts +++ b/src/infrastructure/RepositoryFactory.ts @@ -14,24 +14,23 @@ * limitations under the License. */ -import { Observable } from "rxjs"; -import { NetworkType } from "../model/blockchain/NetworkType"; -import { AccountRepository } from "./AccountRepository"; -import { MultisigRepository } from "./MultisigRepository"; -import { ReceiptRepository } from "./ReceiptRepository"; -import { BlockRepository } from "./BlockRepository"; -import { ChainRepository } from "./ChainRepository"; -import { DiagnosticRepository } from "./DiagnosticRepository"; -import { MosaicRepository } from "./MosaicRepository"; -import { NamespaceRepository } from "./NamespaceRepository"; -import { NetworkRepository } from "./NetworkRepository"; -import { NodeRepository } from "./NodeRepository"; -import { TransactionRepository } from "./TransactionRepository"; -import { MetadataRepository } from "./MetadataRepository"; -import { RestrictionAccountRepository } from "./RestrictionAccountRespository"; -import { RestrictionMosaicRepository } from "./RestrictionMosaicRepository"; -import { Listener } from "./Listener"; -import { IListener } from "./IListener"; +import { Observable } from 'rxjs'; +import { NetworkType } from '../model/blockchain/NetworkType'; +import { AccountRepository } from './AccountRepository'; +import { BlockRepository } from './BlockRepository'; +import { ChainRepository } from './ChainRepository'; +import { DiagnosticRepository } from './DiagnosticRepository'; +import { IListener } from './IListener'; +import { MetadataRepository } from './MetadataRepository'; +import { MosaicRepository } from './MosaicRepository'; +import { MultisigRepository } from './MultisigRepository'; +import { NamespaceRepository } from './NamespaceRepository'; +import { NetworkRepository } from './NetworkRepository'; +import { NodeRepository } from './NodeRepository'; +import { ReceiptRepository } from './ReceiptRepository'; +import { RestrictionAccountRepository } from './RestrictionAccountRespository'; +import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; +import { TransactionRepository } from './TransactionRepository'; /** * A repository factory allows clients to create repositories to access NEM Server without knowing @@ -127,4 +126,4 @@ export interface RepositoryFactory { */ createListener(): IListener; -} \ No newline at end of file +} diff --git a/src/infrastructure/RepositoryFactoryHttp.ts b/src/infrastructure/RepositoryFactoryHttp.ts index 4f68950f2c..f89a41f555 100644 --- a/src/infrastructure/RepositoryFactoryHttp.ts +++ b/src/infrastructure/RepositoryFactoryHttp.ts @@ -14,40 +14,40 @@ * limitations under the License. */ -import { Observable, of as observableOf } from "rxjs"; -import { NetworkType } from "../model/blockchain/NetworkType"; -import { AccountRepository } from "./AccountRepository"; -import { MultisigRepository } from "./MultisigRepository"; -import { ReceiptRepository } from "./ReceiptRepository"; -import { BlockRepository } from "./BlockRepository"; -import { ChainRepository } from "./ChainRepository"; -import { DiagnosticRepository } from "./DiagnosticRepository"; -import { MosaicRepository } from "./MosaicRepository"; -import { NamespaceRepository } from "./NamespaceRepository"; -import { NetworkRepository } from "./NetworkRepository"; -import { NodeRepository } from "./NodeRepository"; -import { TransactionRepository } from "./TransactionRepository"; -import { MetadataRepository } from "./MetadataRepository"; -import { RestrictionAccountRepository } from "./RestrictionAccountRespository"; -import { RestrictionMosaicRepository } from "./RestrictionMosaicRepository"; -import { RepositoryFactory } from "./RepositoryFactory"; -import { AccountHttp } from "./AccountHttp"; -import { BlockHttp } from "./BlockHttp"; -import { ChainHttp } from "./ChainHttp"; -import { DiagnosticHttp } from "./DiagnosticHttp"; -import { MetadataHttp } from "./MetadataHttp"; -import { MosaicHttp } from "./MosaicHttp"; -import { MultisigHttp } from "./MultisigHttp"; -import { NamespaceHttp } from "./NamespaceHttp"; -import { NetworkHttp } from "./NetworkHttp"; -import { NodeHttp } from "./NodeHttp"; -import { ReceiptHttp } from "./ReceiptHttp"; -import { RestrictionAccountHttp } from "./RestrictionAccountHttp"; -import { RestrictionMosaicHttp } from "./RestrictionMosaicHttp"; -import { TransactionHttp } from "./TransactionHttp"; -import { share, map, shareReplay } from "rxjs/operators"; -import { Listener } from "./Listener"; -import { IListener } from "./IListener"; +import { Observable, of as observableOf } from 'rxjs'; +import { map, share, shareReplay } from 'rxjs/operators'; +import { NetworkType } from '../model/blockchain/NetworkType'; +import { AccountHttp } from './AccountHttp'; +import { AccountRepository } from './AccountRepository'; +import { BlockHttp } from './BlockHttp'; +import { BlockRepository } from './BlockRepository'; +import { ChainHttp } from './ChainHttp'; +import { ChainRepository } from './ChainRepository'; +import { DiagnosticHttp } from './DiagnosticHttp'; +import { DiagnosticRepository } from './DiagnosticRepository'; +import { IListener } from './IListener'; +import { Listener } from './Listener'; +import { MetadataHttp } from './MetadataHttp'; +import { MetadataRepository } from './MetadataRepository'; +import { MosaicHttp } from './MosaicHttp'; +import { MosaicRepository } from './MosaicRepository'; +import { MultisigHttp } from './MultisigHttp'; +import { MultisigRepository } from './MultisigRepository'; +import { NamespaceHttp } from './NamespaceHttp'; +import { NamespaceRepository } from './NamespaceRepository'; +import { NetworkHttp } from './NetworkHttp'; +import { NetworkRepository } from './NetworkRepository'; +import { NodeHttp } from './NodeHttp'; +import { NodeRepository } from './NodeRepository'; +import { ReceiptHttp } from './ReceiptHttp'; +import { ReceiptRepository } from './ReceiptRepository'; +import { RepositoryFactory } from './RepositoryFactory'; +import { RestrictionAccountHttp } from './RestrictionAccountHttp'; +import { RestrictionAccountRepository } from './RestrictionAccountRespository'; +import { RestrictionMosaicHttp } from './RestrictionMosaicHttp'; +import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; +import { TransactionHttp } from './TransactionHttp'; +import { TransactionRepository } from './TransactionRepository'; /** * Receipt http repository. @@ -64,10 +64,11 @@ export class RepositoryFactoryHttp implements RepositoryFactory { * @param url the server url. * @param networkType optional network type if you don't want to load it from the server. */ - constructor(url: string, networkType?: NetworkType) { + constructor(url: string, networkType?: NetworkType, generationHash?: string) { this.url = url; this.networkType = networkType ? observableOf(networkType) : this.createNetworkRepository().getNetworkType().pipe(shareReplay(1)); - this.generationHash = this.createBlockRepository().getBlockByHeight('1').pipe(map(b => b.generationHash)).pipe(shareReplay(1)); + this.generationHash = generationHash ? observableOf(generationHash) : + this.createBlockRepository().getBlockByHeight('1').pipe(map((b) => b.generationHash)).pipe(shareReplay(1)); } createAccountRepository(): AccountRepository { @@ -111,7 +112,7 @@ export class RepositoryFactoryHttp implements RepositoryFactory { } createReceiptRepository(): ReceiptRepository { - return new ReceiptHttp(this.url); + return new ReceiptHttp(this.url, this.networkType); } createRestrictionAccountRepository(): RestrictionAccountRepository { @@ -137,5 +138,4 @@ export class RepositoryFactoryHttp implements RepositoryFactory { createListener(): IListener { return new Listener(this.url); } - -} \ No newline at end of file +} diff --git a/src/infrastructure/RestrictionMosaicHttp.ts b/src/infrastructure/RestrictionMosaicHttp.ts index 36c59ab8e2..d455f87aed 100644 --- a/src/infrastructure/RestrictionMosaicHttp.ts +++ b/src/infrastructure/RestrictionMosaicHttp.ts @@ -24,9 +24,9 @@ import { MosaicGlobalRestriction } from '../model/restriction/MosaicGlobalRestri import { MosaicGlobalRestrictionItem } from '../model/restriction/MosaicGlobalRestrictionItem'; import { RestrictionMosaicRoutesApi } from './api/restrictionMosaicRoutesApi'; import {Http} from './Http'; +import { MosaicAddressRestrictionDTO } from './model/mosaicAddressRestrictionDTO'; +import { MosaicGlobalRestrictionDTO } from './model/mosaicGlobalRestrictionDTO'; import { RestrictionMosaicRepository } from './RestrictionMosaicRepository'; -import { MosaicAddressRestrictionDTO } from "./model/mosaicAddressRestrictionDTO"; -import { MosaicGlobalRestrictionDTO } from "./model/mosaicGlobalRestrictionDTO"; /** * RestrictionMosaic http repository. diff --git a/src/infrastructure/TransactionHttp.ts b/src/infrastructure/TransactionHttp.ts index 611e66e389..b72b468fa0 100644 --- a/src/infrastructure/TransactionHttp.ts +++ b/src/infrastructure/TransactionHttp.ts @@ -32,7 +32,7 @@ import {TransactionType} from '../model/transaction/TransactionType'; import {UInt64} from '../model/UInt64'; import { BlockInfoDTO, BlockRoutesApi, - TransactionRoutesApi, TransactionStatusDTO + TransactionRoutesApi, TransactionStatusDTO, } from './api'; import {Http} from './Http'; import {CreateTransactionFromDTO} from './transaction/CreateTransactionFromDTO'; @@ -56,23 +56,15 @@ export class TransactionHttp extends Http implements TransactionRepository { */ private blockRoutesApi: BlockRoutesApi; - - /** - * @internal - * network type for the mappings. - */ - private readonly networkTypeObservable: Observable; - /** * Constructor * @param url * @param networkType */ - constructor(url: string, networkType?: NetworkType | Observable) { + constructor(url: string) { super(url); this.transactionRoutesApi = new TransactionRoutesApi(url); this.blockRoutesApi = new BlockRoutesApi(url); - this.networkTypeObservable = this.createNetworkTypeObservable(networkType); } /** @@ -142,11 +134,10 @@ export class TransactionHttp extends Http implements TransactionRepository { */ private toTransactionStatus(dto: TransactionStatusDTO): TransactionStatus { return new TransactionStatus( - dto.status, - dto.group, + dto.group.valueOf(), dto.hash, - dto.deadline ? - Deadline.createFromDTO(UInt64.fromNumericString(dto.deadline).toDTO()) : undefined, + Deadline.createFromDTO(UInt64.fromNumericString(dto.deadline).toDTO()), + dto.code ? dto.code.valueOf() : '', dto.height ? UInt64.fromNumericString(dto.height) : undefined); } @@ -207,9 +198,9 @@ export class TransactionHttp extends Http implements TransactionRepository { if (response.status !== undefined) { throw new TransactionStatus( 'failed', - response.status, response.hash, Deadline.createFromDTO(response.deadline), + response.code, UInt64.fromUint(0)); } else { return CreateTransactionFromDTO(response); diff --git a/src/infrastructure/api.ts b/src/infrastructure/api.ts index 95e4f0d5b9..b74074dfee 100644 --- a/src/infrastructure/api.ts +++ b/src/infrastructure/api.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/accountRoutesApi.ts b/src/infrastructure/api/accountRoutesApi.ts index 6030accaf0..0bac8e4bfe 100644 --- a/src/infrastructure/api/accountRoutesApi.ts +++ b/src/infrastructure/api/accountRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,6 +33,7 @@ import { AccountIds } from '../model/accountIds'; import { AccountInfoDTO } from '../model/accountInfoDTO'; import { ModelError } from '../model/modelError'; import { TransactionInfoDTO } from '../model/transactionInfoDTO'; +import { TransactionTypeEnum } from '../model/transactionTypeEnum'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; @@ -88,15 +89,16 @@ export class AccountRoutesApi { } /** - * Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. - * @summary Get incoming transactions + * Gets an array of transactions for which an account is the sender or receiver. + * @summary Get confirmed transactions * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountIncomingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/incoming' + public async getAccountConfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -104,7 +106,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountIncomingTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountConfirmedTransactions.'); } if (pageSize !== undefined) { @@ -119,6 +121,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -162,12 +168,16 @@ export class AccountRoutesApi { }); } /** - * Returns the account information. - * @summary Get account information + * Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. + * @summary Get incoming transactions * @param accountId Account public key or address. + * @param pageSize Number of transactions to return for each request. + * @param id Transaction identifier up to which transactions are returned. + * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountInfo (accountId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }> { - const localVarPath = this.basePath + '/account/{accountId}' + public async getAccountIncomingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/incoming' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -175,7 +185,23 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountInfo.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountIncomingTransactions.'); + } + + if (pageSize !== undefined) { + localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number"); + } + + if (id !== undefined) { + localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); + } + + if (ordering !== undefined) { + localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); + } + + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); } (Object).assign(localVarHeaderParams, options.headers); @@ -201,12 +227,12 @@ export class AccountRoutesApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }>((resolve, reject) => { + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, "AccountInfoDTO"); + body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -221,15 +247,12 @@ export class AccountRoutesApi { }); } /** - * Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. - * @summary Get outgoing transactions + * Returns the account information. + * @summary Get account information * @param accountId Account public key or address. - * @param pageSize Number of transactions to return for each request. - * @param id Transaction identifier up to which transactions are returned. - * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. */ - public async getAccountOutgoingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/outgoing' + public async getAccountInfo (accountId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }> { + const localVarPath = this.basePath + '/account/{accountId}' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -237,19 +260,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountOutgoingTransactions.'); - } - - if (pageSize !== undefined) { - localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number"); - } - - if (id !== undefined) { - localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); - } - - if (ordering !== undefined) { - localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); + throw new Error('Required parameter accountId was null or undefined when calling getAccountInfo.'); } (Object).assign(localVarHeaderParams, options.headers); @@ -275,12 +286,12 @@ export class AccountRoutesApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + return new Promise<{ response: http.ClientResponse; body: AccountInfoDTO; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, "Array"); + body = ObjectSerializer.deserialize(body, "AccountInfoDTO"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -295,15 +306,16 @@ export class AccountRoutesApi { }); } /** - * Gets an array of aggregate bonded transactions where the account is the sender or requires to cosign the transaction. - * @summary Get aggregate bonded transactions information + * Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. + * @summary Get outgoing transactions * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountPartialTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions/partial' + public async getAccountOutgoingTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/outgoing' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -311,7 +323,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountPartialTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountOutgoingTransactions.'); } if (pageSize !== undefined) { @@ -326,6 +338,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -369,15 +385,16 @@ export class AccountRoutesApi { }); } /** - * Gets an array of transactions for which an account is the sender or receiver. - * @summary Get confirmed transactions + * Gets an array of aggregate bonded transactions where the account is the sender or requires to cosign the transaction. + * @summary Get aggregate bonded transactions information * @param accountId Account public key or address. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/account/{accountId}/transactions' + public async getAccountPartialTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/account/{accountId}/transactions/partial' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -385,7 +402,7 @@ export class AccountRoutesApi { // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { - throw new Error('Required parameter accountId was null or undefined when calling getAccountTransactions.'); + throw new Error('Required parameter accountId was null or undefined when calling getAccountPartialTransactions.'); } if (pageSize !== undefined) { @@ -400,6 +417,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; @@ -449,8 +470,9 @@ export class AccountRoutesApi { * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. + * @param transactionType Transaction type to filter by. */ - public async getAccountUnconfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + public async getAccountUnconfirmedTransactions (accountId: string, pageSize?: number, id?: string, ordering?: string, transactionType?: TransactionTypeEnum, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/account/{accountId}/transactions/unconfirmed' .replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters: any = {}; @@ -474,6 +496,10 @@ export class AccountRoutesApi { localVarQueryParameters['ordering'] = ObjectSerializer.serialize(ordering, "string"); } + if (transactionType !== undefined) { + localVarQueryParameters['transactionType'] = ObjectSerializer.serialize(transactionType, "TransactionTypeEnum"); + } + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; diff --git a/src/infrastructure/api/apis.ts b/src/infrastructure/api/apis.ts index b219325aa8..fdad3f87cc 100644 --- a/src/infrastructure/api/apis.ts +++ b/src/infrastructure/api/apis.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/blockRoutesApi.ts b/src/infrastructure/api/blockRoutesApi.ts index 0cce81b26b..dc639177aa 100644 --- a/src/infrastructure/api/blockRoutesApi.ts +++ b/src/infrastructure/api/blockRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -90,7 +90,7 @@ export class BlockRoutesApi { /** * Gets a block from the chain that has the given height. * @summary Get block information - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. */ public async getBlockByHeight (height: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: BlockInfoDTO; }> { const localVarPath = this.basePath + '/block/{height}' @@ -149,7 +149,7 @@ export class BlockRoutesApi { /** * Returns an array of transactions included in a block for a given block height. * @summary Get transactions from a block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param pageSize Number of transactions to return for each request. * @param id Transaction identifier up to which transactions are returned. * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. @@ -223,10 +223,10 @@ export class BlockRoutesApi { /** * Gets up to limit number of blocks after given block height. * @summary Get blocks information - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. - * @param limit Number of elements to be returned. + * @param height Block height. + * @param limit Number of elements to be returned. The limit should be greater than or equal to \"db.pageSizeMin\" and not higher than \"db.pageSizeMax\". The settings are adjustable via a configuration file (rest/resources/rest.json) per REST instance. */ - public async getBlocksByHeightWithLimit (height: string, limit: 25 | 50 | 75 | 100, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { + public async getBlocksByHeightWithLimit (height: string, limit: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/blocks/{height}/limit/{limit}' .replace('{' + 'height' + '}', encodeURIComponent(String(height))) .replace('{' + 'limit' + '}', encodeURIComponent(String(limit))); @@ -289,7 +289,7 @@ export class BlockRoutesApi { /** * Returns the merkle path for a transaction included in a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the transaction was included in the block. * @summary Get the merkle path for a given a transaction and block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param hash Transaction hash. */ public async getMerkleTransaction (height: string, hash: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: MerkleProofInfoDTO; }> { diff --git a/src/infrastructure/api/chainRoutesApi.ts b/src/infrastructure/api/chainRoutesApi.ts index 1f3c749bba..bf74f453cf 100644 --- a/src/infrastructure/api/chainRoutesApi.ts +++ b/src/infrastructure/api/chainRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/diagnosticRoutesApi.ts b/src/infrastructure/api/diagnosticRoutesApi.ts index b71abfb7c8..1267df8666 100644 --- a/src/infrastructure/api/diagnosticRoutesApi.ts +++ b/src/infrastructure/api/diagnosticRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/metadataRoutesApi.ts b/src/infrastructure/api/metadataRoutesApi.ts index dc303735b7..54a307f38f 100644 --- a/src/infrastructure/api/metadataRoutesApi.ts +++ b/src/infrastructure/api/metadataRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/mosaicRoutesApi.ts b/src/infrastructure/api/mosaicRoutesApi.ts index 7e46da3b3a..8d6566b60f 100644 --- a/src/infrastructure/api/mosaicRoutesApi.ts +++ b/src/infrastructure/api/mosaicRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/multisigRoutesApi.ts b/src/infrastructure/api/multisigRoutesApi.ts index 77b36b550c..8c58cfe12c 100644 --- a/src/infrastructure/api/multisigRoutesApi.ts +++ b/src/infrastructure/api/multisigRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/namespaceRoutesApi.ts b/src/infrastructure/api/namespaceRoutesApi.ts index 5c112f7074..43f2fed06d 100644 --- a/src/infrastructure/api/namespaceRoutesApi.ts +++ b/src/infrastructure/api/namespaceRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/networkRoutesApi.ts b/src/infrastructure/api/networkRoutesApi.ts index 9c2fa6fd8b..aef29a0a6c 100644 --- a/src/infrastructure/api/networkRoutesApi.ts +++ b/src/infrastructure/api/networkRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/nodeRoutesApi.ts b/src/infrastructure/api/nodeRoutesApi.ts index 67d86791ee..1bc892a4d4 100644 --- a/src/infrastructure/api/nodeRoutesApi.ts +++ b/src/infrastructure/api/nodeRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/receiptRoutesApi.ts b/src/infrastructure/api/receiptRoutesApi.ts index 49338943b6..f72ceb8844 100644 --- a/src/infrastructure/api/receiptRoutesApi.ts +++ b/src/infrastructure/api/receiptRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -89,7 +89,7 @@ export class ReceiptRoutesApi { /** * Returns the receipts linked to a block. * @summary Get receipts from a block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. */ public async getBlockReceipts (height: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: StatementsDTO; }> { const localVarPath = this.basePath + '/block/{height}/receipts' @@ -148,7 +148,7 @@ export class ReceiptRoutesApi { /** * Returns the merkle path for a receipt statement or resolution linked to a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the receipt was linked with the block. * @summary Get the merkle path for a given a receipt statement hash and block - * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. + * @param height Block height. * @param hash Receipt hash. */ public async getMerkleReceipts (height: string, hash: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: MerkleProofInfoDTO; }> { diff --git a/src/infrastructure/api/restrictionAccountRoutesApi.ts b/src/infrastructure/api/restrictionAccountRoutesApi.ts index 57656b2c35..755faccfc1 100644 --- a/src/infrastructure/api/restrictionAccountRoutesApi.ts +++ b/src/infrastructure/api/restrictionAccountRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/restrictionMosaicRoutesApi.ts b/src/infrastructure/api/restrictionMosaicRoutesApi.ts index ad6f09dc02..42294d4eed 100644 --- a/src/infrastructure/api/restrictionMosaicRoutesApi.ts +++ b/src/infrastructure/api/restrictionMosaicRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/api/transactionRoutesApi.ts b/src/infrastructure/api/transactionRoutesApi.ts index 9375a20c7a..f5065be845 100644 --- a/src/infrastructure/api/transactionRoutesApi.ts +++ b/src/infrastructure/api/transactionRoutesApi.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts index fcafef8bc4..1d19b7fe88 100644 --- a/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountAddressRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts index f3285d711b..98136bc9c5 100644 --- a/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountDTO.ts b/src/infrastructure/model/accountDTO.ts index 0fb7c46261..f15d4e876c 100644 --- a/src/infrastructure/model/accountDTO.ts +++ b/src/infrastructure/model/accountDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountIds.ts b/src/infrastructure/model/accountIds.ts index 9680d11689..0e89bca6a5 100644 --- a/src/infrastructure/model/accountIds.ts +++ b/src/infrastructure/model/accountIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountInfoDTO.ts b/src/infrastructure/model/accountInfoDTO.ts index cba670bbc2..9215220687 100644 --- a/src/infrastructure/model/accountInfoDTO.ts +++ b/src/infrastructure/model/accountInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountLinkActionEnum.ts b/src/infrastructure/model/accountLinkActionEnum.ts index ebfc4ac3fb..bc5c18ea41 100644 --- a/src/infrastructure/model/accountLinkActionEnum.ts +++ b/src/infrastructure/model/accountLinkActionEnum.ts @@ -17,19 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of action: * 0 - Unlink. * 1 - Link. -*/ + * Type of action: * 0 - Unlink. * 1 - Link. + */ export enum AccountLinkActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/accountLinkTransactionBodyDTO.ts b/src/infrastructure/model/accountLinkTransactionBodyDTO.ts index cf46f3cd32..c67ed1d29e 100644 --- a/src/infrastructure/model/accountLinkTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountLinkTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountLinkTransactionDTO.ts b/src/infrastructure/model/accountLinkTransactionDTO.ts index c254544001..94be101e30 100644 --- a/src/infrastructure/model/accountLinkTransactionDTO.ts +++ b/src/infrastructure/model/accountLinkTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts b/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts index e63034f10b..a77d63d3fd 100644 --- a/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMetadataTransactionDTO.ts b/src/infrastructure/model/accountMetadataTransactionDTO.ts index 00506fbb19..ca2f474e86 100644 --- a/src/infrastructure/model/accountMetadataTransactionDTO.ts +++ b/src/infrastructure/model/accountMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts index 2f9d5b67f0..047419cf04 100644 --- a/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountMosaicRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts b/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts index 1ea90730e1..49982796e3 100644 --- a/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountMosaicRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountNamesDTO.ts b/src/infrastructure/model/accountNamesDTO.ts index c36c6cdf76..a538bd2c96 100644 --- a/src/infrastructure/model/accountNamesDTO.ts +++ b/src/infrastructure/model/accountNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts index e49771bdbb..4fd1fa22a1 100644 --- a/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/accountOperationRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts b/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts index f4afb105e8..82d28aa17e 100644 --- a/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/accountOperationRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionDTO.ts b/src/infrastructure/model/accountRestrictionDTO.ts index c52fe7a7ee..d7f47c4a62 100644 --- a/src/infrastructure/model/accountRestrictionDTO.ts +++ b/src/infrastructure/model/accountRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionFlagsEnum.ts b/src/infrastructure/model/accountRestrictionFlagsEnum.ts index 4b2746e02f..76813ed067 100644 --- a/src/infrastructure/model/accountRestrictionFlagsEnum.ts +++ b/src/infrastructure/model/accountRestrictionFlagsEnum.ts @@ -17,25 +17,32 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of account restriction: * 0x0001 (1 decimal) - Allow only incoming transactions from a given address. * 0x0002 (2 decimal) - Allow only incoming transactions containing a given mosaic identifier. * 0x4001 (16385 decimal) - Allow only outgoing transactions to a given address. * 0x4004 (16388 decimal) - Allow only outgoing transactions with a given transaction type. * 0x8001 (32769 decimal) - Block incoming transactions from a given address. * 0x8002 (32770 decimal) - Block incoming transactions containing a given mosaic identifier. * 0xC001 (49153 decimal) - Block outgoing transactions to a given address. * 0xC004 (49156 decimal) - Block outgoing transactions with a given transaction type. -*/ + * Type of account restriction: + * 0x0001 (1 decimal) - Allow only incoming transactions from a given address. + * 0x0002 (2 decimal) - Allow only incoming transactions containing a given mosaic identifier. + * 0x4001 (16385 decimal) - Allow only outgoing transactions to a given address. + * 0x4004 (16388 decimal) - Allow only outgoing transactions with a given transaction type. + * 0x8001 (32769 decimal) - Block incoming transactions from a given address. + * 0x8002 (32770 decimal) - Block incoming transactions containing a given mosaic identifier. + * 0xC001 (49153 decimal) - Block outgoing transactions to a given address. + * 0xC004 (49156 decimal) - Block outgoing transactions with a given transaction type. + */ export enum AccountRestrictionFlagsEnum { - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_16385 = 16385, - NUMBER_16388 = 16388, - NUMBER_32769 = 32769, - NUMBER_32770 = 32770, - NUMBER_49153 = 49153, - NUMBER_49156 = 49156 + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_16385 = 16385, + NUMBER_16388 = 16388, + NUMBER_32769 = 32769, + NUMBER_32770 = 32770, + NUMBER_49153 = 49153, + NUMBER_49156 = 49156, } diff --git a/src/infrastructure/model/accountRestrictionsDTO.ts b/src/infrastructure/model/accountRestrictionsDTO.ts index 208a11c535..505fef3f9f 100644 --- a/src/infrastructure/model/accountRestrictionsDTO.ts +++ b/src/infrastructure/model/accountRestrictionsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountRestrictionsInfoDTO.ts b/src/infrastructure/model/accountRestrictionsInfoDTO.ts index 07e957d9a0..ec41841645 100644 --- a/src/infrastructure/model/accountRestrictionsInfoDTO.ts +++ b/src/infrastructure/model/accountRestrictionsInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/accountTypeEnum.ts b/src/infrastructure/model/accountTypeEnum.ts index 94ebbb1ce5..3fb939d8ff 100644 --- a/src/infrastructure/model/accountTypeEnum.ts +++ b/src/infrastructure/model/accountTypeEnum.ts @@ -17,21 +17,23 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* * 0 - Unlinked. * 1 - Balance-holding account that is linked to a remote harvester account. * 2 - Remote harvester account that is linked to a balance-holding account. * 3 - Remote harvester eligible account that is unlinked. -*/ + * 0 - Unlinked. + * 1 - Balance-holding account that is linked to a remote harvester account. + * 2 - Remote harvester account that is linked to a balance-holding account. + * 3 - Remote harvester eligible account that is unlinked. + */ export enum AccountTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, } diff --git a/src/infrastructure/model/accountsNamesDTO.ts b/src/infrastructure/model/accountsNamesDTO.ts index 1b6ef91181..2572bceab4 100644 --- a/src/infrastructure/model/accountsNamesDTO.ts +++ b/src/infrastructure/model/accountsNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/activityBucketDTO.ts b/src/infrastructure/model/activityBucketDTO.ts index 451da2d066..e41035a61c 100644 --- a/src/infrastructure/model/activityBucketDTO.ts +++ b/src/infrastructure/model/activityBucketDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/addressAliasTransactionBodyDTO.ts b/src/infrastructure/model/addressAliasTransactionBodyDTO.ts index 1b84a678cc..77a11f1e5e 100644 --- a/src/infrastructure/model/addressAliasTransactionBodyDTO.ts +++ b/src/infrastructure/model/addressAliasTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/addressAliasTransactionDTO.ts b/src/infrastructure/model/addressAliasTransactionDTO.ts index a574c941a5..efc8ba40b8 100644 --- a/src/infrastructure/model/addressAliasTransactionDTO.ts +++ b/src/infrastructure/model/addressAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aggregateTransactionBodyDTO.ts b/src/infrastructure/model/aggregateTransactionBodyDTO.ts index c40ae75439..ff8c5d27c3 100644 --- a/src/infrastructure/model/aggregateTransactionBodyDTO.ts +++ b/src/infrastructure/model/aggregateTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aggregateTransactionDTO.ts b/src/infrastructure/model/aggregateTransactionDTO.ts index b84ab10fe9..7841b14320 100644 --- a/src/infrastructure/model/aggregateTransactionDTO.ts +++ b/src/infrastructure/model/aggregateTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aliasActionEnum.ts b/src/infrastructure/model/aliasActionEnum.ts index d90ad550ef..23b09f0206 100644 --- a/src/infrastructure/model/aliasActionEnum.ts +++ b/src/infrastructure/model/aliasActionEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Alias action: * 0 - Unlink alias. * 1 - Link alias. -*/ + * Alias action: * 0 - Unlink alias. * 1 - Link alias. + */ export enum AliasActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/aliasDTO.ts b/src/infrastructure/model/aliasDTO.ts index 70ded6bdd8..c97666d056 100644 --- a/src/infrastructure/model/aliasDTO.ts +++ b/src/infrastructure/model/aliasDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/aliasTypeEnum.ts b/src/infrastructure/model/aliasTypeEnum.ts index 173ef1af5f..55527784ca 100644 --- a/src/infrastructure/model/aliasTypeEnum.ts +++ b/src/infrastructure/model/aliasTypeEnum.ts @@ -17,20 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of alias: * 0 - No alias. * 1 - Mosaic id alias. * 2 - Addres alias. -*/ + * Type of alias: * 0 - No alias. * 1 - Mosaic id alias. * 2 - Addres alias. + */ export enum AliasTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/announceTransactionInfoDTO.ts b/src/infrastructure/model/announceTransactionInfoDTO.ts index 32b4c7937b..125acb4b05 100644 --- a/src/infrastructure/model/announceTransactionInfoDTO.ts +++ b/src/infrastructure/model/announceTransactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/artifactExpiryReceiptDTO.ts b/src/infrastructure/model/artifactExpiryReceiptDTO.ts deleted file mode 100644 index ed9a4fd5b0..0000000000 --- a/src/infrastructure/model/artifactExpiryReceiptDTO.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2019 NEM - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Catapult REST Endpoints - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.7.19 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ReceiptDTO } from './receiptDTO'; -import { ReceiptTypeEnum } from './receiptTypeEnum'; - -/** -* An artifact namespace or mosaic expired. -*/ -export class ArtifactExpiryReceiptDTO { - /** - * Version of the receipt. - */ - 'version': number; - 'type': ReceiptTypeEnum; - 'artifactId': any; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "version", - "baseName": "version", - "type": "number" - }, - { - "name": "type", - "baseName": "type", - "type": "ReceiptTypeEnum" - }, - { - "name": "artifactId", - "baseName": "artifactId", - "type": "any" - } ]; - - static getAttributeTypeMap() { - return ArtifactExpiryReceiptDTO.attributeTypeMap; - } -} - diff --git a/src/infrastructure/model/balanceChangeReceiptDTO.ts b/src/infrastructure/model/balanceChangeReceiptDTO.ts index 135b48cea3..52f48100b3 100644 --- a/src/infrastructure/model/balanceChangeReceiptDTO.ts +++ b/src/infrastructure/model/balanceChangeReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts b/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts index 5b88af9977..97c09d4a09 100644 --- a/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts +++ b/src/infrastructure/model/balanceChangeReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceTransferReceiptDTO.ts b/src/infrastructure/model/balanceTransferReceiptDTO.ts index 213ba3d7ff..30fdecc5f1 100644 --- a/src/infrastructure/model/balanceTransferReceiptDTO.ts +++ b/src/infrastructure/model/balanceTransferReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts b/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts index 1678cbd309..0dfa371aab 100644 --- a/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts +++ b/src/infrastructure/model/balanceTransferReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockDTO.ts b/src/infrastructure/model/blockDTO.ts index c115b1f73c..c36b9c4669 100644 --- a/src/infrastructure/model/blockDTO.ts +++ b/src/infrastructure/model/blockDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockDTOAllOf.ts b/src/infrastructure/model/blockDTOAllOf.ts index 259f240a76..7d3e4edac6 100644 --- a/src/infrastructure/model/blockDTOAllOf.ts +++ b/src/infrastructure/model/blockDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockInfoDTO.ts b/src/infrastructure/model/blockInfoDTO.ts index 6cf0f67fb6..892e229dad 100644 --- a/src/infrastructure/model/blockInfoDTO.ts +++ b/src/infrastructure/model/blockInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/blockMetaDTO.ts b/src/infrastructure/model/blockMetaDTO.ts index 43fd5364a5..415c1f9be9 100644 --- a/src/infrastructure/model/blockMetaDTO.ts +++ b/src/infrastructure/model/blockMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/chainScoreDTO.ts b/src/infrastructure/model/chainScoreDTO.ts index 6272f5251b..fd7d1e249f 100644 --- a/src/infrastructure/model/chainScoreDTO.ts +++ b/src/infrastructure/model/chainScoreDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/communicationTimestampsDTO.ts b/src/infrastructure/model/communicationTimestampsDTO.ts index ae0b5302c7..205c4793e7 100644 --- a/src/infrastructure/model/communicationTimestampsDTO.ts +++ b/src/infrastructure/model/communicationTimestampsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignature.ts b/src/infrastructure/model/cosignature.ts index 2e84137071..608031e70f 100644 --- a/src/infrastructure/model/cosignature.ts +++ b/src/infrastructure/model/cosignature.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignatureDTO.ts b/src/infrastructure/model/cosignatureDTO.ts index 1c15f6e43f..650d0ff7ef 100644 --- a/src/infrastructure/model/cosignatureDTO.ts +++ b/src/infrastructure/model/cosignatureDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/cosignatureDTOAllOf.ts b/src/infrastructure/model/cosignatureDTOAllOf.ts index 0333c1144d..b7fe3a2318 100644 --- a/src/infrastructure/model/cosignatureDTOAllOf.ts +++ b/src/infrastructure/model/cosignatureDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts index dddd5619e8..cd969cb1e3 100644 --- a/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts b/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts index 84afb3916a..a25b7e625d 100644 --- a/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountLinkTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts index 49c7be06e9..cb2cc4eaf2 100644 --- a/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts index 2d698aa879..3ff8950e2b 100644 --- a/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountMosaicRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts index f04016f1d9..a813ed4a5b 100644 --- a/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAccountOperationRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts b/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts index dd6c82be9b..e03011afab 100644 --- a/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts +++ b/src/infrastructure/model/embeddedAddressAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedHashLockTransactionDTO.ts b/src/infrastructure/model/embeddedHashLockTransactionDTO.ts index b3a807632d..d6ae1aa02f 100644 --- a/src/infrastructure/model/embeddedHashLockTransactionDTO.ts +++ b/src/infrastructure/model/embeddedHashLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts index 515a9f2f74..f48fc94f2c 100644 --- a/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts index 387ad18e77..c7d3cddc07 100644 --- a/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts index 81a024e269..840168d0e9 100644 --- a/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicDefinitionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts index 2f5168ba85..8c25f184e4 100644 --- a/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicGlobalRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts index 995bb04bb5..bd007e71c5 100644 --- a/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts b/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts index 7dbe3aec59..efa17f1b92 100644 --- a/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMosaicSupplyChangeTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts b/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts index d6684d7c0e..adc94975e7 100644 --- a/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts +++ b/src/infrastructure/model/embeddedMultisigAccountModificationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts b/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts index a23ff2a12b..611e2093ba 100644 --- a/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts +++ b/src/infrastructure/model/embeddedNamespaceMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts b/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts index 54dc9f2e58..dd2ca4c10e 100644 --- a/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts +++ b/src/infrastructure/model/embeddedNamespaceRegistrationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts b/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts index a3a77113e3..6aaa6120fc 100644 --- a/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts +++ b/src/infrastructure/model/embeddedSecretLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts b/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts index 7038ffeb1e..3ab27abda2 100644 --- a/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts +++ b/src/infrastructure/model/embeddedSecretProofTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionDTO.ts b/src/infrastructure/model/embeddedTransactionDTO.ts index 26ece2f6bb..b992dd9c91 100644 --- a/src/infrastructure/model/embeddedTransactionDTO.ts +++ b/src/infrastructure/model/embeddedTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionInfoDTO.ts b/src/infrastructure/model/embeddedTransactionInfoDTO.ts index 6c6a0206ce..dc1a0ea7da 100644 --- a/src/infrastructure/model/embeddedTransactionInfoDTO.ts +++ b/src/infrastructure/model/embeddedTransactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransactionMetaDTO.ts b/src/infrastructure/model/embeddedTransactionMetaDTO.ts index 9f672ba5ae..c0815291b9 100644 --- a/src/infrastructure/model/embeddedTransactionMetaDTO.ts +++ b/src/infrastructure/model/embeddedTransactionMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/embeddedTransferTransactionDTO.ts b/src/infrastructure/model/embeddedTransferTransactionDTO.ts index d9b649facd..a669a34ced 100644 --- a/src/infrastructure/model/embeddedTransferTransactionDTO.ts +++ b/src/infrastructure/model/embeddedTransferTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/entityDTO.ts b/src/infrastructure/model/entityDTO.ts index 8cefca1574..07083301a7 100644 --- a/src/infrastructure/model/entityDTO.ts +++ b/src/infrastructure/model/entityDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/hashLockTransactionBodyDTO.ts b/src/infrastructure/model/hashLockTransactionBodyDTO.ts index 126231f5bb..a3d01e9b93 100644 --- a/src/infrastructure/model/hashLockTransactionBodyDTO.ts +++ b/src/infrastructure/model/hashLockTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/hashLockTransactionDTO.ts b/src/infrastructure/model/hashLockTransactionDTO.ts index 00ddb00a54..780e07bf71 100644 --- a/src/infrastructure/model/hashLockTransactionDTO.ts +++ b/src/infrastructure/model/hashLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/heightInfoDTO.ts b/src/infrastructure/model/heightInfoDTO.ts index ebe421025c..6ff5e02393 100644 --- a/src/infrastructure/model/heightInfoDTO.ts +++ b/src/infrastructure/model/heightInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/inflationReceiptDTO.ts b/src/infrastructure/model/inflationReceiptDTO.ts index d5501e5018..99bb825331 100644 --- a/src/infrastructure/model/inflationReceiptDTO.ts +++ b/src/infrastructure/model/inflationReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/inflationReceiptDTOAllOf.ts b/src/infrastructure/model/inflationReceiptDTOAllOf.ts index 264071b89f..c0e0708fd9 100644 --- a/src/infrastructure/model/inflationReceiptDTOAllOf.ts +++ b/src/infrastructure/model/inflationReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/lockHashAlgorithmEnum.ts b/src/infrastructure/model/lockHashAlgorithmEnum.ts index 799a937d0f..af8578e3c6 100644 --- a/src/infrastructure/model/lockHashAlgorithmEnum.ts +++ b/src/infrastructure/model/lockHashAlgorithmEnum.ts @@ -17,21 +17,23 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Algorithm used to hash te proof: * 0 (Op_Sha3_256) - Proof is hashed using sha3 256. * 1 (Op_Keccak_256) - Proof is hashed using Keccak (ETH compatibility). * 2 (Op_Hash_160) - Proof is hashed twice: first with Sha-256 and then with RIPEMD-160 (bitcoin’s OP_HASH160). * 3 (Op_Hash_256) - Proof is hashed twice with Sha-256 (bitcoin’s OP_HASH256). -*/ + * Algorithm used to hash te proof: * 0 (Op_Sha3_256) - Proof is hashed using SHA3-256. + * 1 (Op_Keccak_256) - Proof is hashed using Keccak (ETH compatibility). + * 2 (Op_Hash_160) - Proof is hashed twice: first with SHA-256 and then with RIPEMD-160 (bitcoin\'s OP_HASH160). + * 3 (Op_Hash_256) - Proof is hashed twice with SHA3-256 (bitcoin\'s OP_HASH256). + */ export enum LockHashAlgorithmEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, } diff --git a/src/infrastructure/model/merklePathItemDTO.ts b/src/infrastructure/model/merklePathItemDTO.ts index 0a4613da50..43c3a6b4e6 100644 --- a/src/infrastructure/model/merklePathItemDTO.ts +++ b/src/infrastructure/model/merklePathItemDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/merkleProofInfoDTO.ts b/src/infrastructure/model/merkleProofInfoDTO.ts index c3b92fd0ac..9c7bb7f03d 100644 --- a/src/infrastructure/model/merkleProofInfoDTO.ts +++ b/src/infrastructure/model/merkleProofInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/messageDTO.ts b/src/infrastructure/model/messageDTO.ts index 8106729475..9d3f9059ac 100644 --- a/src/infrastructure/model/messageDTO.ts +++ b/src/infrastructure/model/messageDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/messageTypeEnum.ts b/src/infrastructure/model/messageTypeEnum.ts index ec36e86e14..b5d794dbb6 100644 --- a/src/infrastructure/model/messageTypeEnum.ts +++ b/src/infrastructure/model/messageTypeEnum.ts @@ -17,20 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of message: * 0 - Regular message. * 1 - Encrypted message. * 254 - Persistent harvesting delegation. -*/ + * Type of message: * 0 - Regular message. * 1 - Encrypted message. * 254 - Persistent harvesting delegation. + */ export enum MessageTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_254 = 254 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_254 = 254, } diff --git a/src/infrastructure/model/metadataDTO.ts b/src/infrastructure/model/metadataDTO.ts index c52043c3ec..3b9056dab5 100644 --- a/src/infrastructure/model/metadataDTO.ts +++ b/src/infrastructure/model/metadataDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataEntriesDTO.ts b/src/infrastructure/model/metadataEntriesDTO.ts index 36c5e53d1e..77cea364ec 100644 --- a/src/infrastructure/model/metadataEntriesDTO.ts +++ b/src/infrastructure/model/metadataEntriesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataEntryDTO.ts b/src/infrastructure/model/metadataEntryDTO.ts index df5c97f324..9424232573 100644 --- a/src/infrastructure/model/metadataEntryDTO.ts +++ b/src/infrastructure/model/metadataEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/metadataTypeEnum.ts b/src/infrastructure/model/metadataTypeEnum.ts index 7657910dba..6a9b3f8170 100644 --- a/src/infrastructure/model/metadataTypeEnum.ts +++ b/src/infrastructure/model/metadataTypeEnum.ts @@ -17,20 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Metadata type: * 0 - Account. * 1 - Mosaic. * 2 - Namespace. -*/ + * Metadata type: * 0 - Account. * 1 - Mosaic. * 2 - Namespace. + */ export enum MetadataTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/modelError.ts b/src/infrastructure/model/modelError.ts index 5a11639063..5e8ce3ae24 100644 --- a/src/infrastructure/model/modelError.ts +++ b/src/infrastructure/model/modelError.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/models.ts b/src/infrastructure/model/models.ts index 4a9f3a4bc2..3371f08090 100644 --- a/src/infrastructure/model/models.ts +++ b/src/infrastructure/model/models.ts @@ -154,9 +154,11 @@ export * from './transactionIds'; export * from './transactionInfoDTO'; export * from './transactionMetaDTO'; export * from './transactionPayload'; +export * from './transactionStateTypeEnum'; export * from './transactionStatementBodyDTO'; export * from './transactionStatementDTO'; export * from './transactionStatusDTO'; +export * from './transactionStatusTypeEnum'; export * from './transactionTypeEnum'; export * from './transferTransactionBodyDTO'; export * from './transferTransactionDTO'; @@ -321,9 +323,11 @@ import { TransactionIds } from './transactionIds'; import { TransactionInfoDTO } from './transactionInfoDTO'; import { TransactionMetaDTO } from './transactionMetaDTO'; import { TransactionPayload } from './transactionPayload'; +import { TransactionStateTypeEnum } from './transactionStateTypeEnum'; import { TransactionStatementBodyDTO } from './transactionStatementBodyDTO'; import { TransactionStatementDTO } from './transactionStatementDTO'; import { TransactionStatusDTO } from './transactionStatusDTO'; +import { TransactionStatusTypeEnum } from './transactionStatusTypeEnum'; import { TransactionTypeEnum } from './transactionTypeEnum'; import { TransferTransactionBodyDTO } from './transferTransactionBodyDTO'; import { TransferTransactionDTO } from './transferTransactionDTO'; @@ -358,6 +362,8 @@ let enumsMap: {[index: string]: any} = { "NetworkTypeEnum": NetworkTypeEnum, "ReceiptTypeEnum": ReceiptTypeEnum, "RolesTypeEnum": RolesTypeEnum, + "TransactionStateTypeEnum": TransactionStateTypeEnum, + "TransactionStatusTypeEnum": TransactionStatusTypeEnum, "TransactionTypeEnum": TransactionTypeEnum, } diff --git a/src/infrastructure/model/mosaic.ts b/src/infrastructure/model/mosaic.ts index 371e1d027c..6db1f11529 100644 --- a/src/infrastructure/model/mosaic.ts +++ b/src/infrastructure/model/mosaic.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionDTO.ts index c2ad85cef3..7cb6467d91 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts index 1eba898d83..ff74700521 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts index 86545936e9..00ff94dc6c 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionEntryWrapperDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts index 90730ff900..1a33e8439f 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts b/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts index 03e8ccb245..4055562e4c 100644 --- a/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicAddressRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts b/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts index 97f40e06a8..70b6d8a21b 100644 --- a/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicAliasTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicAliasTransactionDTO.ts b/src/infrastructure/model/mosaicAliasTransactionDTO.ts index 407ab63626..84e6e1dd79 100644 --- a/src/infrastructure/model/mosaicAliasTransactionDTO.ts +++ b/src/infrastructure/model/mosaicAliasTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDTO.ts b/src/infrastructure/model/mosaicDTO.ts index a0961b6223..bf6fe85621 100644 --- a/src/infrastructure/model/mosaicDTO.ts +++ b/src/infrastructure/model/mosaicDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts index bb844a2f57..c03aea9030 100644 --- a/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicDefinitionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts b/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts index e4818dcf04..9fe95e13f9 100644 --- a/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicDefinitionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicExpiryReceiptDTO.ts b/src/infrastructure/model/mosaicExpiryReceiptDTO.ts index 89b12750ca..629da6bea6 100644 --- a/src/infrastructure/model/mosaicExpiryReceiptDTO.ts +++ b/src/infrastructure/model/mosaicExpiryReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts b/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts index 5ccc8d3185..9fe6458924 100644 --- a/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts +++ b/src/infrastructure/model/mosaicExpiryReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts index 9ce5a5c337..1f50ead7e0 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts index ccc1825520..8766cca2aa 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts index 242c1c18ab..6d04808629 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryRestrictionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts index b06a0333dd..514341c74a 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionEntryWrapperDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts index 592fc32962..7084b54183 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts b/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts index 2f7e4b99d4..07e65280a4 100644 --- a/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts +++ b/src/infrastructure/model/mosaicGlobalRestrictionTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicIds.ts b/src/infrastructure/model/mosaicIds.ts index 77c2bee587..b8303e1981 100644 --- a/src/infrastructure/model/mosaicIds.ts +++ b/src/infrastructure/model/mosaicIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicInfoDTO.ts b/src/infrastructure/model/mosaicInfoDTO.ts index 1c445e9ef6..3fe0f7520c 100644 --- a/src/infrastructure/model/mosaicInfoDTO.ts +++ b/src/infrastructure/model/mosaicInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts b/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts index 06ff11e3ea..65e54278bf 100644 --- a/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicMetadataTransactionDTO.ts b/src/infrastructure/model/mosaicMetadataTransactionDTO.ts index 04a9ecac79..6630b519c3 100644 --- a/src/infrastructure/model/mosaicMetadataTransactionDTO.ts +++ b/src/infrastructure/model/mosaicMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicNamesDTO.ts b/src/infrastructure/model/mosaicNamesDTO.ts index 8de4656020..bdbfb7677c 100644 --- a/src/infrastructure/model/mosaicNamesDTO.ts +++ b/src/infrastructure/model/mosaicNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts b/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts index 652043daec..3311bef1ce 100644 --- a/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts +++ b/src/infrastructure/model/mosaicRestrictionEntryTypeEnum.ts @@ -17,19 +17,18 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* - 0 - Mosaic address restriction. - 1 - Mosaic global restriction. -*/ + * - 0 - Mosaic address restriction. - 1 - Mosaic global restriction. + */ export enum MosaicRestrictionEntryTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/mosaicRestrictionTypeEnum.ts b/src/infrastructure/model/mosaicRestrictionTypeEnum.ts index 4dee8157e0..8ac3b4c99b 100644 --- a/src/infrastructure/model/mosaicRestrictionTypeEnum.ts +++ b/src/infrastructure/model/mosaicRestrictionTypeEnum.ts @@ -17,24 +17,29 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of mosaic restriction. * 0 - Uninitialized value indicating no restriction. * 1 (EQ) - Allow if equal. * 2 (NE) - Allow if not equal. * 3 (LT) - Allow if less than. * 4 (LE) - Allow if less than or equal. * 5 (GT) - Allow if greater than. * 6 (GE) - Allow if greater than or equal. -*/ + * Type of mosaic restriction. + * 0 - Uninitialized value indicating no restriction. + * 1 (EQ) - Allow if equal. + * 2 (NE) - Allow if not equal. + * 3 (LT) - Allow if less than. + * 4 (LE) - Allow if less than or equal. + * 5 (GT) - Allow if greater than. + * 6 (GE) - Allow if greater than or equal. + */ export enum MosaicRestrictionTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1, - NUMBER_2 = 2, - NUMBER_3 = 3, - NUMBER_4 = 4, - NUMBER_5 = 5, - NUMBER_6 = 6 + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3, + NUMBER_4 = 4, + NUMBER_5 = 5, + NUMBER_6 = 6, } diff --git a/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts b/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts index 3700e44ab6..86abd9d8db 100644 --- a/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts +++ b/src/infrastructure/model/mosaicSupplyChangeActionEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Direction of the supply change: * 0 - Decrease. * 1 - Increase. -*/ + * Direction of the supply change: * 0 - Decrease. * 1 - Increase. + */ export enum MosaicSupplyChangeActionEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts b/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts index 14fa267837..4298461d20 100644 --- a/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts +++ b/src/infrastructure/model/mosaicSupplyChangeTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts b/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts index 63ccbafd28..9d61095843 100644 --- a/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts +++ b/src/infrastructure/model/mosaicSupplyChangeTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicsInfoDTO.ts b/src/infrastructure/model/mosaicsInfoDTO.ts index 4c09ec428f..4f306bfb7d 100644 --- a/src/infrastructure/model/mosaicsInfoDTO.ts +++ b/src/infrastructure/model/mosaicsInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/mosaicsNamesDTO.ts b/src/infrastructure/model/mosaicsNamesDTO.ts index eb97e2816f..2772252883 100644 --- a/src/infrastructure/model/mosaicsNamesDTO.ts +++ b/src/infrastructure/model/mosaicsNamesDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountGraphInfoDTO.ts b/src/infrastructure/model/multisigAccountGraphInfoDTO.ts index f719ef68d0..4301593431 100644 --- a/src/infrastructure/model/multisigAccountGraphInfoDTO.ts +++ b/src/infrastructure/model/multisigAccountGraphInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountInfoDTO.ts b/src/infrastructure/model/multisigAccountInfoDTO.ts index b0f14dadc4..1e741a8ebe 100644 --- a/src/infrastructure/model/multisigAccountInfoDTO.ts +++ b/src/infrastructure/model/multisigAccountInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts b/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts index a52908497a..4911620324 100644 --- a/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts +++ b/src/infrastructure/model/multisigAccountModificationTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts b/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts index c062ef94f9..3bf5923735 100644 --- a/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts +++ b/src/infrastructure/model/multisigAccountModificationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/multisigDTO.ts b/src/infrastructure/model/multisigDTO.ts index b5abb4436f..2b7b4d071e 100644 --- a/src/infrastructure/model/multisigDTO.ts +++ b/src/infrastructure/model/multisigDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceDTO.ts b/src/infrastructure/model/namespaceDTO.ts index 42d674f4a3..164f1df917 100644 --- a/src/infrastructure/model/namespaceDTO.ts +++ b/src/infrastructure/model/namespaceDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceExpiryReceiptDTO.ts b/src/infrastructure/model/namespaceExpiryReceiptDTO.ts index 317c3f7499..fdce28dccc 100644 --- a/src/infrastructure/model/namespaceExpiryReceiptDTO.ts +++ b/src/infrastructure/model/namespaceExpiryReceiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts b/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts index 3b474aad73..b20c1d4aa4 100644 --- a/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts +++ b/src/infrastructure/model/namespaceExpiryReceiptDTOAllOf.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceIds.ts b/src/infrastructure/model/namespaceIds.ts index 30c8c48de4..90363b451e 100644 --- a/src/infrastructure/model/namespaceIds.ts +++ b/src/infrastructure/model/namespaceIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceInfoDTO.ts b/src/infrastructure/model/namespaceInfoDTO.ts index 8b35598321..65c7e716dc 100644 --- a/src/infrastructure/model/namespaceInfoDTO.ts +++ b/src/infrastructure/model/namespaceInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetaDTO.ts b/src/infrastructure/model/namespaceMetaDTO.ts index 39ae9b5d2d..a78c0a7a44 100644 --- a/src/infrastructure/model/namespaceMetaDTO.ts +++ b/src/infrastructure/model/namespaceMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts b/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts index 775a4596e4..31ee663b94 100644 --- a/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts +++ b/src/infrastructure/model/namespaceMetadataTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceMetadataTransactionDTO.ts b/src/infrastructure/model/namespaceMetadataTransactionDTO.ts index 928fb9f1ff..c0bd315a5d 100644 --- a/src/infrastructure/model/namespaceMetadataTransactionDTO.ts +++ b/src/infrastructure/model/namespaceMetadataTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceNameDTO.ts b/src/infrastructure/model/namespaceNameDTO.ts index 0199052754..d49fa98d64 100644 --- a/src/infrastructure/model/namespaceNameDTO.ts +++ b/src/infrastructure/model/namespaceNameDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts b/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts index b84513060a..77fa426bf8 100644 --- a/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts +++ b/src/infrastructure/model/namespaceRegistrationTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts b/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts index 0df8c35dd9..57839849c5 100644 --- a/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts +++ b/src/infrastructure/model/namespaceRegistrationTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/namespaceRegistrationTypeEnum.ts b/src/infrastructure/model/namespaceRegistrationTypeEnum.ts index 5296396a68..6cf4dfc855 100644 --- a/src/infrastructure/model/namespaceRegistrationTypeEnum.ts +++ b/src/infrastructure/model/namespaceRegistrationTypeEnum.ts @@ -17,19 +17,17 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of namespace: * 0 - Root namespace. * 1 - Subnamespace. -*/ + * Type of namespace: * 0 - Root namespace. * 1 - Subnamespace. + */ export enum NamespaceRegistrationTypeEnum { - NUMBER_0 = 0, - NUMBER_1 = 1 + NUMBER_0 = 0, + NUMBER_1 = 1, } diff --git a/src/infrastructure/model/namespacesInfoDTO.ts b/src/infrastructure/model/namespacesInfoDTO.ts index f218660106..cf6fe04eeb 100644 --- a/src/infrastructure/model/namespacesInfoDTO.ts +++ b/src/infrastructure/model/namespacesInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/networkTypeDTO.ts b/src/infrastructure/model/networkTypeDTO.ts index 32d0cdf811..676e101293 100644 --- a/src/infrastructure/model/networkTypeDTO.ts +++ b/src/infrastructure/model/networkTypeDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/networkTypeEnum.ts b/src/infrastructure/model/networkTypeEnum.ts index 74cf7fe28b..38c5a82126 100644 --- a/src/infrastructure/model/networkTypeEnum.ts +++ b/src/infrastructure/model/networkTypeEnum.ts @@ -17,21 +17,22 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Network type: * 0x60 (96 decimal) - Private network. * 0x90 (144 decimal) - Private test network. * 0x68 (104 decimal) - Public main network. * 0x98 (152 decimal) - Public test network. -*/ + * Network type: + * 0x60 (96 decimal) - Private network. + * 0x90 (144 decimal) - Private test network. + * 0x68 (104 decimal) - Public main network. * 0x98 (152 decimal) - Public test network. + */ export enum NetworkTypeEnum { - NUMBER_104 = 104, - NUMBER_152 = 152, - NUMBER_96 = 96, - NUMBER_144 = 144 + NUMBER_104 = 104, + NUMBER_152 = 152, + NUMBER_96 = 96, + NUMBER_144 = 144, } diff --git a/src/infrastructure/model/nodeInfoDTO.ts b/src/infrastructure/model/nodeInfoDTO.ts index e0bf5b9033..42a6a33556 100644 --- a/src/infrastructure/model/nodeInfoDTO.ts +++ b/src/infrastructure/model/nodeInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/nodeTimeDTO.ts b/src/infrastructure/model/nodeTimeDTO.ts index dceba2da20..a670a833c4 100644 --- a/src/infrastructure/model/nodeTimeDTO.ts +++ b/src/infrastructure/model/nodeTimeDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/receiptDTO.ts b/src/infrastructure/model/receiptDTO.ts index 5bacbc7a40..1729ef3970 100644 --- a/src/infrastructure/model/receiptDTO.ts +++ b/src/infrastructure/model/receiptDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/receiptTypeEnum.ts b/src/infrastructure/model/receiptTypeEnum.ts index 44cf31eb87..4ca1c7712d 100644 --- a/src/infrastructure/model/receiptTypeEnum.ts +++ b/src/infrastructure/model/receiptTypeEnum.ts @@ -17,33 +17,46 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of receipt: * 0x124D (4685 decimal) - Mosaic_Rental_Fee. * 0x134E (4942 decimal) - Namespace_Rental_Fee. * 0x2143 (8515 decimal) - Harvest_Fee. * 0x2248 (8776 decimal) - LockHash_Completed. * 0x2348 (9032 decimal) - LockHash_Expired. * 0x2252 (8786 decimal) - LockSecret_Completed. * 0x2352 (9042 decimal) - LockSecret_Expired. * 0x3148 (12616 decimal) - LockHash_Created. * 0x3152 (12626 decimal) - LockSecret_Created. * 0x414D (16717 decimal) - Mosaic_Expired. * 0x414E (16718 decimal) - Namespace_Expired. * 0x424E (16974 decimal) - Namespace_Deleted. * 0x5143 (20803 decimal) - Inflation. * 0xE143 (57667 decimal) - Transaction_Group. * 0xF143 (61763 decimal) - Address_Alias_Resolution. * 0xF243 (62019 decimal) - Mosaic_Alias_Resolution. -*/ + * Type of receipt: * 0x124D (4685 decimal) - Mosaic_Rental_Fee. + * 0x134E (4942 decimal) - Namespace_Rental_Fee. + * 0x2143 (8515 decimal) - Harvest_Fee. + * 0x2248 (8776 decimal) - LockHash_Completed. + * 0x2348 (9032 decimal) - LockHash_Expired. + * 0x2252 (8786 decimal) - LockSecret_Completed. + * 0x2352 (9042 decimal) - LockSecret_Expired. + * 0x3148 (12616 decimal) - LockHash_Created. + * 0x3152 (12626 decimal) - LockSecret_Created. + * 0x414D (16717 decimal) - Mosaic_Expired. + * 0x414E (16718 decimal) - Namespace_Expired. + * 0x424E (16974 decimal) - Namespace_Deleted. + * 0x5143 (20803 decimal) - Inflation. + * 0xE143 (57667 decimal) - Transaction_Group. + * 0xF143 (61763 decimal) - Address_Alias_Resolution. + * 0xF243 (62019 decimal) - Mosaic_Alias_Resolution. + */ export enum ReceiptTypeEnum { - NUMBER_4685 = 4685, - NUMBER_4942 = 4942, - NUMBER_8515 = 8515, - NUMBER_8776 = 8776, - NUMBER_9032 = 9032, - NUMBER_8786 = 8786, - NUMBER_9042 = 9042, - NUMBER_12616 = 12616, - NUMBER_12626 = 12626, - NUMBER_16717 = 16717, - NUMBER_16718 = 16718, - NUMBER_16974 = 16974, - NUMBER_20803 = 20803, - NUMBER_57667 = 57667, - NUMBER_61763 = 61763, - NUMBER_62019 = 62019 + NUMBER_4685 = 4685, + NUMBER_4942 = 4942, + NUMBER_8515 = 8515, + NUMBER_8776 = 8776, + NUMBER_9032 = 9032, + NUMBER_8786 = 8786, + NUMBER_9042 = 9042, + NUMBER_12616 = 12616, + NUMBER_12626 = 12626, + NUMBER_16717 = 16717, + NUMBER_16718 = 16718, + NUMBER_16974 = 16974, + NUMBER_20803 = 20803, + NUMBER_57667 = 57667, + NUMBER_61763 = 61763, + NUMBER_62019 = 62019, } diff --git a/src/infrastructure/model/resolutionEntryDTO.ts b/src/infrastructure/model/resolutionEntryDTO.ts index 56a1368d26..31abf00af3 100644 --- a/src/infrastructure/model/resolutionEntryDTO.ts +++ b/src/infrastructure/model/resolutionEntryDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/resolutionStatementBodyDTO.ts b/src/infrastructure/model/resolutionStatementBodyDTO.ts index 831445357c..ea75554e83 100644 --- a/src/infrastructure/model/resolutionStatementBodyDTO.ts +++ b/src/infrastructure/model/resolutionStatementBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/resolutionStatementDTO.ts b/src/infrastructure/model/resolutionStatementDTO.ts index 5e1706cf1a..a7ff96990a 100644 --- a/src/infrastructure/model/resolutionStatementDTO.ts +++ b/src/infrastructure/model/resolutionStatementDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/rolesTypeEnum.ts b/src/infrastructure/model/rolesTypeEnum.ts index 4aac6137da..c01edb55ba 100644 --- a/src/infrastructure/model/rolesTypeEnum.ts +++ b/src/infrastructure/model/rolesTypeEnum.ts @@ -17,19 +17,19 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - - /** -* Role of the node: * 1 - Peer node. * 2 - Api node. -*/ + * Role of the node: + * 1 - Peer node. + * 2 - Api node. + */ export enum RolesTypeEnum { - NUMBER_1 = 1, - NUMBER_2 = 2 + NUMBER_1 = 1, + NUMBER_2 = 2, } diff --git a/src/infrastructure/model/secretLockTransactionBodyDTO.ts b/src/infrastructure/model/secretLockTransactionBodyDTO.ts index ad1b29fd92..a8f0f62b11 100644 --- a/src/infrastructure/model/secretLockTransactionBodyDTO.ts +++ b/src/infrastructure/model/secretLockTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretLockTransactionDTO.ts b/src/infrastructure/model/secretLockTransactionDTO.ts index 0e1adb4175..bfdabed743 100644 --- a/src/infrastructure/model/secretLockTransactionDTO.ts +++ b/src/infrastructure/model/secretLockTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretProofTransactionBodyDTO.ts b/src/infrastructure/model/secretProofTransactionBodyDTO.ts index 89c727fb16..36b5aad14b 100644 --- a/src/infrastructure/model/secretProofTransactionBodyDTO.ts +++ b/src/infrastructure/model/secretProofTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/secretProofTransactionDTO.ts b/src/infrastructure/model/secretProofTransactionDTO.ts index 0e4a43bb1d..82e786ffe4 100644 --- a/src/infrastructure/model/secretProofTransactionDTO.ts +++ b/src/infrastructure/model/secretProofTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/serverDTO.ts b/src/infrastructure/model/serverDTO.ts index 26001233ad..7f9a23bafe 100644 --- a/src/infrastructure/model/serverDTO.ts +++ b/src/infrastructure/model/serverDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/serverInfoDTO.ts b/src/infrastructure/model/serverInfoDTO.ts index e36d184b4b..cd70601484 100644 --- a/src/infrastructure/model/serverInfoDTO.ts +++ b/src/infrastructure/model/serverInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/sourceDTO.ts b/src/infrastructure/model/sourceDTO.ts index d9cc6fa741..c2d78a8e14 100644 --- a/src/infrastructure/model/sourceDTO.ts +++ b/src/infrastructure/model/sourceDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/statementsDTO.ts b/src/infrastructure/model/statementsDTO.ts index ef5c82fc34..c2e2d38f54 100644 --- a/src/infrastructure/model/statementsDTO.ts +++ b/src/infrastructure/model/statementsDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/storageInfoDTO.ts b/src/infrastructure/model/storageInfoDTO.ts index 342f15c8f3..2413f47e8c 100644 --- a/src/infrastructure/model/storageInfoDTO.ts +++ b/src/infrastructure/model/storageInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionBodyDTO.ts b/src/infrastructure/model/transactionBodyDTO.ts index 9719359902..eaad75fd6a 100644 --- a/src/infrastructure/model/transactionBodyDTO.ts +++ b/src/infrastructure/model/transactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionDTO.ts b/src/infrastructure/model/transactionDTO.ts index 60fffdc811..d6717a7074 100644 --- a/src/infrastructure/model/transactionDTO.ts +++ b/src/infrastructure/model/transactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionHashes.ts b/src/infrastructure/model/transactionHashes.ts index fa2a5781cb..e487513bbf 100644 --- a/src/infrastructure/model/transactionHashes.ts +++ b/src/infrastructure/model/transactionHashes.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionIds.ts b/src/infrastructure/model/transactionIds.ts index 8e3f939a37..20128c834f 100644 --- a/src/infrastructure/model/transactionIds.ts +++ b/src/infrastructure/model/transactionIds.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionInfoDTO.ts b/src/infrastructure/model/transactionInfoDTO.ts index 97755b450a..d97b3df3d3 100644 --- a/src/infrastructure/model/transactionInfoDTO.ts +++ b/src/infrastructure/model/transactionInfoDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionMetaDTO.ts b/src/infrastructure/model/transactionMetaDTO.ts index 2b94185fd7..4c4690f0a7 100644 --- a/src/infrastructure/model/transactionMetaDTO.ts +++ b/src/infrastructure/model/transactionMetaDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionPayload.ts b/src/infrastructure/model/transactionPayload.ts index f48e39f7e4..88dc032b2d 100644 --- a/src/infrastructure/model/transactionPayload.ts +++ b/src/infrastructure/model/transactionPayload.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStateTypeEnum.ts b/src/infrastructure/model/transactionStateTypeEnum.ts new file mode 100644 index 0000000000..47a39c62dc --- /dev/null +++ b/src/infrastructure/model/transactionStateTypeEnum.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2019 NEM + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Catapult REST Endpoints + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.7.20.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * State of the transaction. + */ +export enum TransactionStateTypeEnum { + Confirmed = 'confirmed', + Unconfirmed = 'unconfirmed', + Failed = 'failed', +} diff --git a/src/infrastructure/model/transactionStatementBodyDTO.ts b/src/infrastructure/model/transactionStatementBodyDTO.ts index 5a27ffa22c..aaa68613b8 100644 --- a/src/infrastructure/model/transactionStatementBodyDTO.ts +++ b/src/infrastructure/model/transactionStatementBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStatementDTO.ts b/src/infrastructure/model/transactionStatementDTO.ts index ac293c02b9..1d72f557ed 100644 --- a/src/infrastructure/model/transactionStatementDTO.ts +++ b/src/infrastructure/model/transactionStatementDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transactionStatusDTO.ts b/src/infrastructure/model/transactionStatusDTO.ts index 04b1f3eba7..e91a9de572 100644 --- a/src/infrastructure/model/transactionStatusDTO.ts +++ b/src/infrastructure/model/transactionStatusDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -25,15 +25,17 @@ * Do not edit the class manually. */ +import { TransactionStateTypeEnum } from './transactionStateTypeEnum'; +import { TransactionStatusTypeEnum } from './transactionStatusTypeEnum'; export class TransactionStatusDTO { - 'group'?: string; - 'status': string; - 'hash'?: string; + 'group': TransactionStateTypeEnum; + 'code'?: TransactionStatusTypeEnum; + 'hash': string; /** * Duration expressed in number of blocks. */ - 'deadline'?: string; + 'deadline': string; /** * Height of the blockchain. */ @@ -45,12 +47,12 @@ export class TransactionStatusDTO { { "name": "group", "baseName": "group", - "type": "string" + "type": "TransactionStateTypeEnum" }, { - "name": "status", - "baseName": "status", - "type": "string" + "name": "code", + "baseName": "code", + "type": "TransactionStatusTypeEnum" }, { "name": "hash", diff --git a/src/infrastructure/model/transactionStatusTypeEnum.ts b/src/infrastructure/model/transactionStatusTypeEnum.ts new file mode 100644 index 0000000000..d5d3e8b712 --- /dev/null +++ b/src/infrastructure/model/transactionStatusTypeEnum.ts @@ -0,0 +1,179 @@ +/* + * Copyright 2019 NEM + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Catapult REST Endpoints + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.7.20.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export enum TransactionStatusTypeEnum { + Success = 'Success', + Neutral = 'Neutral', + Failure = 'Failure', + FailureCorePastDeadline = 'Failure_Core_Past_Deadline', + FailureCoreFutureDeadline = 'Failure_Core_Future_Deadline', + FailureCoreInsufficientBalance = 'Failure_Core_Insufficient_Balance', + FailureCoreTooManyTransactions = 'Failure_Core_Too_Many_Transactions', + FailureCoreNemesisAccountSignedAfterNemesisBlock = 'Failure_Core_Nemesis_Account_Signed_After_Nemesis_Block', + FailureCoreWrongNetwork = 'Failure_Core_Wrong_Network', + FailureCoreInvalidAddress = 'Failure_Core_Invalid_Address', + FailureCoreInvalidVersion = 'Failure_Core_Invalid_Version', + FailureCoreInvalidTransactionFee = 'Failure_Core_Invalid_Transaction_Fee', + FailureCoreBlockHarvesterIneligible = 'Failure_Core_Block_Harvester_Ineligible', + FailureCoreZeroAddress = 'Failure_Core_Zero_Address', + FailureCoreZeroPublicKey = 'Failure_Core_Zero_Public_Key', + FailureCoreNonzeroInternalPadding = 'Failure_Core_Nonzero_Internal_Padding', + FailureHashAlreadyExists = 'Failure_Hash_Already_Exists', + FailureSignatureNotVerifiable = 'Failure_Signature_Not_Verifiable', + FailureAccountLinkInvalidAction = 'Failure_AccountLink_Invalid_Action', + FailureAccountLinkLinkAlreadyExists = 'Failure_AccountLink_Link_Already_Exists', + FailureAccountLinkUnknownLink = 'Failure_AccountLink_Unknown_Link', + FailureAccountLinkInconsistentUnlinkData = 'Failure_AccountLink_Inconsistent_Unlink_Data', + FailureAccountLinkRemoteAccountIneligible = 'Failure_AccountLink_Remote_Account_Ineligible', + FailureAccountLinkRemoteAccountSignerProhibited = 'Failure_AccountLink_Remote_Account_Signer_Prohibited', + FailureAccountLinkRemoteAccountParticipantProhibited = 'Failure_AccountLink_Remote_Account_Participant_Prohibited', + FailureAggregateTooManyTransactions = 'Failure_Aggregate_Too_Many_Transactions', + FailureAggregateNoTransactions = 'Failure_Aggregate_No_Transactions', + FailureAggregateTooManyCosignatures = 'Failure_Aggregate_Too_Many_Cosignatures', + FailureAggregateRedundantCosignatures = 'Failure_Aggregate_Redundant_Cosignatures', + FailureAggregateIneligibleCosignatories = 'Failure_Aggregate_Ineligible_Cosignatories', + FailureAggregateMissingCosignatures = 'Failure_Aggregate_Missing_Cosignatures', + FailureAggregateTransactionsHashMismatch = 'Failure_Aggregate_Transactions_Hash_Mismatch', + FailureLockHashInvalidMosaicId = 'Failure_LockHash_Invalid_Mosaic_Id', + FailureLockHashInvalidMosaicAmount = 'Failure_LockHash_Invalid_Mosaic_Amount', + FailureLockHashHashAlreadyExists = 'Failure_LockHash_Hash_Already_Exists', + FailureLockHashUnknownHash = 'Failure_LockHash_Unknown_Hash', + FailureLockHashInactiveHash = 'Failure_LockHash_Inactive_Hash', + FailureLockHashInvalidDuration = 'Failure_LockHash_Invalid_Duration', + FailureLockSecretInvalidHashAlgorithm = 'Failure_LockSecret_Invalid_Hash_Algorithm', + FailureLockSecretHashAlreadyExists = 'Failure_LockSecret_Hash_Already_Exists', + FailureLockSecretProofSizeOutOfBounds = 'Failure_LockSecret_Proof_Size_Out_Of_Bounds', + FailureLockSecretSecretMismatch = 'Failure_LockSecret_Secret_Mismatch', + FailureLockSecretUnknownCompositeKey = 'Failure_LockSecret_Unknown_Composite_Key', + FailureLockSecretInactiveSecret = 'Failure_LockSecret_Inactive_Secret', + FailureLockSecretHashAlgorithmMismatch = 'Failure_LockSecret_Hash_Algorithm_Mismatch', + FailureLockSecretInvalidDuration = 'Failure_LockSecret_Invalid_Duration', + FailureMetadataValueTooSmall = 'Failure_Metadata_Value_Too_Small', + FailureMetadataValueTooLarge = 'Failure_Metadata_Value_Too_Large', + FailureMetadataValueSizeDeltaTooLarge = 'Failure_Metadata_Value_Size_Delta_Too_Large', + FailureMetadataValueSizeDeltaMismatch = 'Failure_Metadata_Value_Size_Delta_Mismatch', + FailureMetadataValueChangeIrreversible = 'Failure_Metadata_Value_Change_Irreversible', + FailureMosaicInvalidDuration = 'Failure_Mosaic_Invalid_Duration', + FailureMosaicInvalidName = 'Failure_Mosaic_Invalid_Name', + FailureMosaicNameIdMismatch = 'Failure_Mosaic_Name_Id_Mismatch', + FailureMosaicExpired = 'Failure_Mosaic_Expired', + FailureMosaicOwnerConflict = 'Failure_Mosaic_Owner_Conflict', + FailureMosaicIdMismatch = 'Failure_Mosaic_Id_Mismatch', + FailureMosaicParentIdConflict = 'Failure_Mosaic_Parent_Id_Conflict', + FailureMosaicInvalidProperty = 'Failure_Mosaic_Invalid_Property', + FailureMosaicInvalidFlags = 'Failure_Mosaic_Invalid_Flags', + FailureMosaicInvalidDivisibility = 'Failure_Mosaic_Invalid_Divisibility', + FailureMosaicInvalidSupplyChangeAction = 'Failure_Mosaic_Invalid_Supply_Change_Action', + FailureMosaicInvalidSupplyChangeAmount = 'Failure_Mosaic_Invalid_Supply_Change_Amount', + FailureMosaicInvalidId = 'Failure_Mosaic_Invalid_Id', + FailureMosaicModificationDisallowed = 'Failure_Mosaic_Modification_Disallowed', + FailureMosaicModificationNoChanges = 'Failure_Mosaic_Modification_No_Changes', + FailureMosaicSupplyImmutable = 'Failure_Mosaic_Supply_Immutable', + FailureMosaicSupplyNegative = 'Failure_Mosaic_Supply_Negative', + FailureMosaicSupplyExceeded = 'Failure_Mosaic_Supply_Exceeded', + FailureMosaicNonTransferable = 'Failure_Mosaic_Non_Transferable', + FailureMosaicMaxMosaicsExceeded = 'Failure_Mosaic_Max_Mosaics_Exceeded', + FailureMosaicRequiredPropertyFlagUnset = 'Failure_Mosaic_Required_Property_Flag_Unset', + FailureMultisigAccountInBothSets = 'Failure_Multisig_Account_In_Both_Sets', + FailureMultisigMultipleDeletes = 'Failure_Multisig_Multiple_Deletes', + FailureMultisigRedundantModification = 'Failure_Multisig_Redundant_Modification', + FailureMultisigUnknownMultisigAccount = 'Failure_Multisig_Unknown_Multisig_Account', + FailureMultisigNotACosignatory = 'Failure_Multisig_Not_A_Cosignatory', + FailureMultisigAlreadyACosignatory = 'Failure_Multisig_Already_A_Cosignatory', + FailureMultisigMinSettingOutOfRange = 'Failure_Multisig_Min_Setting_Out_Of_Range', + FailureMultisigMinSettingLargerThanNumCosignatories = 'Failure_Multisig_Min_Setting_Larger_Than_Num_Cosignatories', + FailureMultisigInvalidModificationAction = 'Failure_Multisig_Invalid_Modification_Action', + FailureMultisigMaxCosignedAccounts = 'Failure_Multisig_Max_Cosigned_Accounts', + FailureMultisigMaxCosignatories = 'Failure_Multisig_Max_Cosignatories', + FailureMultisigLoop = 'Failure_Multisig_Loop', + FailureMultisigMaxMultisigDepth = 'Failure_Multisig_Max_Multisig_Depth', + FailureMultisigOperationProhibitedByAccount = 'Failure_Multisig_Operation_Prohibited_By_Account', + FailureNamespaceInvalidDuration = 'Failure_Namespace_Invalid_Duration', + FailureNamespaceInvalidName = 'Failure_Namespace_Invalid_Name', + FailureNamespaceNameIdMismatch = 'Failure_Namespace_Name_Id_Mismatch', + FailureNamespaceExpired = 'Failure_Namespace_Expired', + FailureNamespaceOwnerConflict = 'Failure_Namespace_Owner_Conflict', + FailureNamespaceIdMismatch = 'Failure_Namespace_Id_Mismatch', + FailureNamespaceInvalidRegistrationType = 'Failure_Namespace_Invalid_Registration_Type', + FailureNamespaceRootNameReserved = 'Failure_Namespace_Root_Name_Reserved', + FailureNamespaceTooDeep = 'Failure_Namespace_Too_Deep', + FailureNamespaceUnknownParent = 'Failure_Namespace_Unknown_Parent', + FailureNamespaceAlreadyExists = 'Failure_Namespace_Already_Exists', + FailureNamespaceAlreadyActive = 'Failure_Namespace_Already_Active', + FailureNamespaceEternalAfterNemesisBlock = 'Failure_Namespace_Eternal_After_Nemesis_Block', + FailureNamespaceMaxChildrenExceeded = 'Failure_Namespace_Max_Children_Exceeded', + FailureNamespaceAliasInvalidAction = 'Failure_Namespace_Alias_Invalid_Action', + FailureNamespaceUnknown = 'Failure_Namespace_Unknown', + FailureNamespaceAliasAlreadyExists = 'Failure_Namespace_Alias_Already_Exists', + FailureNamespaceUnknownAlias = 'Failure_Namespace_Unknown_Alias', + FailureNamespaceAliasInconsistentUnlinkType = 'Failure_Namespace_Alias_Inconsistent_Unlink_Type', + FailureNamespaceAliasInconsistentUnlinkData = 'Failure_Namespace_Alias_Inconsistent_Unlink_Data', + FailureNamespaceAliasInvalidAddress = 'Failure_Namespace_Alias_Invalid_Address', + FailureRestrictionAccountInvalidRestrictionFlags = 'Failure_RestrictionAccount_Invalid_Restriction_Flags', + FailureRestrictionAccountInvalidModificationAction = 'Failure_RestrictionAccount_Invalid_Modification_Action', + FailureRestrictionAccountInvalidModificationAddress = 'Failure_RestrictionAccount_Invalid_Modification_Address', + FailureRestrictionAccountModificationOperationTypeIncompatible = 'Failure_RestrictionAccount_Modification_Operation_Type_Incompatible', + FailureRestrictionAccountRedundantModification = 'Failure_RestrictionAccount_Redundant_Modification', + FailureRestrictionAccountInvalidModification = 'Failure_RestrictionAccount_Invalid_Modification', + FailureRestrictionAccountModificationCountExceeded = 'Failure_RestrictionAccount_Modification_Count_Exceeded', + FailureRestrictionAccountNoModifications = 'Failure_RestrictionAccount_No_Modifications', + FailureRestrictionAccountValuesCountExceeded = 'Failure_RestrictionAccount_Values_Count_Exceeded', + FailureRestrictionAccountInvalidValue = 'Failure_RestrictionAccount_Invalid_Value', + FailureRestrictionAccountAddressInteractionProhibited = 'Failure_RestrictionAccount_Address_Interaction_Prohibited', + FailureRestrictionAccountMosaicTransferProhibited = 'Failure_RestrictionAccount_Mosaic_Transfer_Prohibited', + FailureRestrictionAccountOperationTypeProhibited = 'Failure_RestrictionAccount_Operation_Type_Prohibited', + FailureRestrictionMosaicInvalidRestrictionType = 'Failure_RestrictionMosaic_Invalid_Restriction_Type', + FailureRestrictionMosaicPreviousValueMismatch = 'Failure_RestrictionMosaic_Previous_Value_Mismatch', + FailureRestrictionMosaicPreviousValueMustBeZero = 'Failure_RestrictionMosaic_Previous_Value_Must_Be_Zero', + FailureRestrictionMosaicMaxRestrictionsExceeded = 'Failure_RestrictionMosaic_Max_Restrictions_Exceeded', + FailureRestrictionMosaicCannotDeleteNonexistentRestriction = 'Failure_RestrictionMosaic_Cannot_Delete_Nonexistent_Restriction', + FailureRestrictionMosaicUnknownGlobalRestriction = 'Failure_RestrictionMosaic_Unknown_Global_Restriction', + FailureRestrictionMosaicInvalidGlobalRestriction = 'Failure_RestrictionMosaic_Invalid_Global_Restriction', + FailureRestrictionMosaicAccountUnauthorized = 'Failure_RestrictionMosaic_Account_Unauthorized', + FailureTransferMessageTooLarge = 'Failure_Transfer_Message_Too_Large', + FailureTransferOutOfOrderMosaics = 'Failure_Transfer_Out_Of_Order_Mosaics', + FailureChainUnlinked = 'Failure_Chain_Unlinked', + FailureChainBlockNotHit = 'Failure_Chain_Block_Not_Hit', + FailureChainBlockInconsistentStateHash = 'Failure_Chain_Block_Inconsistent_State_Hash', + FailureChainBlockInconsistentReceiptsHash = 'Failure_Chain_Block_Inconsistent_Receipts_Hash', + FailureChainUnconfirmedCacheTooFull = 'Failure_Chain_Unconfirmed_Cache_Too_Full', + FailureConsumerEmptyInput = 'Failure_Consumer_Empty_Input', + FailureConsumerBlockTransactionsHashMismatch = 'Failure_Consumer_Block_Transactions_Hash_Mismatch', + NeutralConsumerHashInRecencyCache = 'Neutral_Consumer_Hash_In_Recency_Cache', + FailureConsumerRemoteChainTooManyBlocks = 'Failure_Consumer_Remote_Chain_Too_Many_Blocks', + FailureConsumerRemoteChainImproperLink = 'Failure_Consumer_Remote_Chain_Improper_Link', + FailureConsumerRemoteChainDuplicateTransactions = 'Failure_Consumer_Remote_Chain_Duplicate_Transactions', + FailureConsumerRemoteChainUnlinked = 'Failure_Consumer_Remote_Chain_Unlinked', + FailureConsumerRemoteChainDifficultiesMismatch = 'Failure_Consumer_Remote_Chain_Difficulties_Mismatch', + FailureConsumerRemoteChainScoreNotBetter = 'Failure_Consumer_Remote_Chain_Score_Not_Better', + FailureConsumerRemoteChainTooFarBehind = 'Failure_Consumer_Remote_Chain_Too_Far_Behind', + FailureConsumerRemoteChainTooFarInFuture = 'Failure_Consumer_Remote_Chain_Too_Far_In_Future', + FailureConsumerBatchSignatureNotVerifiable = 'Failure_Consumer_Batch_Signature_Not_Verifiable', + FailureExtensionPartialTransactionCachePrune = 'Failure_Extension_Partial_Transaction_Cache_Prune', + FailureExtensionPartialTransactionDependencyRemoved = 'Failure_Extension_Partial_Transaction_Dependency_Removed', + FailureExtensionReadRateLimitExceeded = 'Failure_Extension_Read_Rate_Limit_Exceeded', +} diff --git a/src/infrastructure/model/transactionTypeEnum.ts b/src/infrastructure/model/transactionTypeEnum.ts index 2a49d78b67..ae023bc034 100644 --- a/src/infrastructure/model/transactionTypeEnum.ts +++ b/src/infrastructure/model/transactionTypeEnum.ts @@ -17,38 +17,56 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 - * + * The version of the OpenAPI document: 0.7.20.6 + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - /** -* Type of transaction: * 0x414C (16716 decimal) - AccountLinkTransaction. * 0x4141 (16705 decimal) - AggregateCompleteTransaction. * 0x4241 (16961 decimal) - AggregateBondedTransaction. * 0x414D (16717 decimal) - MosaicDefinitionTransaction. * 0x424D (16973 decimal) - MosaicSupplyChangeTransaction. * 0x414E (16718 decimal) - NamespaceRegistrationTransaction. * 0x424E (16974 decimal) - AddressAliasTransaction. * 0x434E (17230 decimal) - MosaicAliasTransaction. * 0x4144 (16708 decimal) - AccountMetadataTransaction. * 0x4244 (16964 decimal) - MosaicMetadataTransaction. * 0x4344 (17220 decimal) - NamespaceMetadataTransaction. * 0x4155 (16725 decimal) - MultisigAccountModificationTransaction. * 0x4148 (16712 decimal) - HashLockTransaction. * 0x4152 (16722 decimal) - SecretLockTransaction. * 0x4252 (16978 decimal) - SecretProofTransaction. * 0x4150 (16720 decimal) - AccountAddressRestrictionTransaction. * 0x4250 (16976 decimal) - AccountMosaicRestrictionTransaction. * 0x4350 (17232 decimal) - AccountOperationRestrictionTransaction. * 0x4151 (16721 decimal) - MosaicGlobalRestrictionTransaction. * 0x4251 (16977 decimal) - MosaicAddressRestrictionTransaction. * 0x4154 (16724 decimal) - TransferTransaction. -*/ + * Type of transaction: * 0x414C (16716 decimal) - AccountLinkTransaction. * 0x4141 (16705 decimal) -AggregateCompleteTransaction. + * 0x4241 (16961 decimal) - AggregateBondedTransaction. + * 0x414D (16717 decimal) - MosaicDefinitionTransaction. + * 0x424D (16973 decimal) - MosaicSupplyChangeTransaction. + * 0x414E (16718 decimal) - NamespaceRegistrationTransaction. + * 0x424E (16974 decimal) - AddressAliasTransaction. + * 0x434E (17230 decimal) - MosaicAliasTransaction. + * 0x4144 (16708 decimal) - AccountMetadataTransaction. + * 0x4244 (16964 decimal) - MosaicMetadataTransaction. + * 0x4344 (17220 decimal) - NamespaceMetadataTransaction. + * 0x4155 (16725 decimal) - MultisigAccountModificationTransaction. + * 0x4148 (16712 decimal) - HashLockTransaction. + * 0x4152 (16722 decimal) - SecretLockTransaction. + * 0x4252 (16978 decimal) - SecretProofTransaction. + * 0x4150 (16720 decimal) - AccountAddressRestrictionTransaction. + * 0x4250 (16976 decimal) - AccountMosaicRestrictionTransaction. + * 0x4350 (17232 decimal) - AccountOperationRestrictionTransaction. + * 0x4151 (16721 decimal) - MosaicGlobalRestrictionTransaction. + * 0x4251 (16977 decimal) - MosaicAddressRestrictionTransaction. + * 0x4154 (16724 decimal) - TransferTransaction. + */ export enum TransactionTypeEnum { - NUMBER_16716 = 16716, - NUMBER_16705 = 16705, - NUMBER_16961 = 16961, - NUMBER_16717 = 16717, - NUMBER_16973 = 16973, - NUMBER_16718 = 16718, - NUMBER_16974 = 16974, - NUMBER_17230 = 17230, - NUMBER_16708 = 16708, - NUMBER_16964 = 16964, - NUMBER_17220 = 17220, - NUMBER_16725 = 16725, - NUMBER_16712 = 16712, - NUMBER_16722 = 16722, - NUMBER_16978 = 16978, - NUMBER_16720 = 16720, - NUMBER_16976 = 16976, - NUMBER_17232 = 17232, - NUMBER_16721 = 16721, - NUMBER_16977 = 16977, - NUMBER_16724 = 16724 + NUMBER_16716 = 16716, + NUMBER_16705 = 16705, + NUMBER_16961 = 16961, + NUMBER_16717 = 16717, + NUMBER_16973 = 16973, + NUMBER_16718 = 16718, + NUMBER_16974 = 16974, + NUMBER_17230 = 17230, + NUMBER_16708 = 16708, + NUMBER_16964 = 16964, + NUMBER_17220 = 17220, + NUMBER_16725 = 16725, + NUMBER_16712 = 16712, + NUMBER_16722 = 16722, + NUMBER_16978 = 16978, + NUMBER_16720 = 16720, + NUMBER_16976 = 16976, + NUMBER_17232 = 17232, + NUMBER_16721 = 16721, + NUMBER_16977 = 16977, + NUMBER_16724 = 16724, } diff --git a/src/infrastructure/model/transferTransactionBodyDTO.ts b/src/infrastructure/model/transferTransactionBodyDTO.ts index 91ee668752..38d99a09fe 100644 --- a/src/infrastructure/model/transferTransactionBodyDTO.ts +++ b/src/infrastructure/model/transferTransactionBodyDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/transferTransactionDTO.ts b/src/infrastructure/model/transferTransactionDTO.ts index fd1ed28761..287211e77a 100644 --- a/src/infrastructure/model/transferTransactionDTO.ts +++ b/src/infrastructure/model/transferTransactionDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/unresolvedMosaic.ts b/src/infrastructure/model/unresolvedMosaic.ts index cce9479c2b..9aa1b06cd6 100644 --- a/src/infrastructure/model/unresolvedMosaic.ts +++ b/src/infrastructure/model/unresolvedMosaic.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/model/verifiableEntityDTO.ts b/src/infrastructure/model/verifiableEntityDTO.ts index 240e6f35b2..7eee4865b2 100644 --- a/src/infrastructure/model/verifiableEntityDTO.ts +++ b/src/infrastructure/model/verifiableEntityDTO.ts @@ -17,7 +17,7 @@ * Catapult REST Endpoints * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 0.7.21 + * The version of the OpenAPI document: 0.7.20.6 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/infrastructure/receipt/CreateReceiptFromDTO.ts b/src/infrastructure/receipt/CreateReceiptFromDTO.ts index 8eff4c9c87..6c564bbbac 100644 --- a/src/infrastructure/receipt/CreateReceiptFromDTO.ts +++ b/src/infrastructure/receipt/CreateReceiptFromDTO.ts @@ -34,50 +34,21 @@ import { TransactionStatement } from '../../model/receipt/TransactionStatement'; import {UInt64} from '../../model/UInt64'; /** - * @param receiptDTO - * @param networkType - * @returns {Statement} - * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.h - * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.cpp - * @constructor - */ -export const CreateStatementFromDTO = (receiptDTO, networkType): Statement => { - return new Statement( - receiptDTO.transactionStatements.map((statement) => createTransactionStatement(statement.statement, networkType)), - receiptDTO.addressResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Address)), - receiptDTO.mosaicResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Mosaic)), - ); -}; - -/** - * @param receiptDTO - * @param networkType - * @returns {Receipt} - * @constructor + * @interal + * @param unresolvedAddress unresolved address + * @returns {Address | NamespaceId} */ -export const CreateReceiptFromDTO = (receiptDTO, networkType): Receipt => { - switch (receiptDTO.type) { - case ReceiptType.Harvest_Fee: - case ReceiptType.LockHash_Created: - case ReceiptType.LockHash_Completed: - case ReceiptType.LockHash_Expired: - case ReceiptType.LockSecret_Created: - case ReceiptType.LockSecret_Completed: - case ReceiptType.LockSecret_Expired: - return createBalanceChangeReceipt(receiptDTO, networkType); - case ReceiptType.Mosaic_Levy: - case ReceiptType.Mosaic_Rental_Fee: - case ReceiptType.Namespace_Rental_Fee: - return createBalanceTransferReceipt(receiptDTO, networkType); - case ReceiptType.Mosaic_Expired: - case ReceiptType.Namespace_Expired: - case ReceiptType.Namespace_Deleted: - return createArtifactExpiryReceipt(receiptDTO); - case ReceiptType.Inflation: - return createInflationReceipt(receiptDTO); - default: - throw new Error(`Receipt type: ${receiptDTO.type} not recognized.`); +const extractUnresolvedAddress = (unresolvedAddress: any): Address | NamespaceId => { + if (typeof unresolvedAddress === 'string') { + return UnresolvedMapping.toUnresolvedAddress(unresolvedAddress); + } else if (typeof unresolvedAddress === 'object') { // Is JSON object + if (unresolvedAddress.hasOwnProperty('address')) { + return Address.createFromRawAddress(unresolvedAddress.address); + } else if (unresolvedAddress.hasOwnProperty('id')) { + return NamespaceId.createFromEncoded(unresolvedAddress.id); + } } + throw new Error(`UnresolvedAddress: ${unresolvedAddress} type is not recognised`); }; /** @@ -114,23 +85,6 @@ const createResolutionStatement = (statementDTO, resolutionType): ResolutionStat } }; -/** - * @internal - * @param statementDTO - * @param networkType - * @returns {TransactionStatement} - * @constructor - */ -const createTransactionStatement = (statementDTO, networkType): TransactionStatement => { - return new TransactionStatement( - UInt64.fromNumericString(statementDTO.height), - new ReceiptSource(statementDTO.source.primaryId, statementDTO.source.secondaryId), - statementDTO.receipts.map((receipt) => { - return CreateReceiptFromDTO(receipt, networkType); - }), - ); -}; - /** * @internal * @param receiptDTO @@ -166,6 +120,24 @@ const createBalanceTransferReceipt = (receiptDTO, networkType): Receipt => { ); }; +/** + * @internal + * @param receiptType receipt type + * @param id Artifact id + * @returns {MosaicId | NamespaceId} + */ +const extractArtifactId = (receiptType: ReceiptType, id: string): MosaicId | NamespaceId => { + switch (receiptType) { + case ReceiptType.Mosaic_Expired: + return new MosaicId(id); + case ReceiptType.Namespace_Expired: + case ReceiptType.Namespace_Deleted: + return NamespaceId.createFromEncoded(id); + default: + throw new Error('Receipt type is not supported.'); + } +}; + /** * @internal * @param receiptDTO @@ -196,37 +168,65 @@ const createInflationReceipt = (receiptDTO): Receipt => { }; /** - * @internal - * @param receiptType receipt type - * @param id Artifact id - * @returns {MosaicId | NamespaceId} + * @param receiptDTO + * @param networkType + * @returns {Receipt} + * @constructor */ -const extractArtifactId = (receiptType: ReceiptType, id: string): MosaicId | NamespaceId => { - switch (receiptType) { +export const CreateReceiptFromDTO = (receiptDTO, networkType): Receipt => { + switch (receiptDTO.type) { + case ReceiptType.Harvest_Fee: + case ReceiptType.LockHash_Created: + case ReceiptType.LockHash_Completed: + case ReceiptType.LockHash_Expired: + case ReceiptType.LockSecret_Created: + case ReceiptType.LockSecret_Completed: + case ReceiptType.LockSecret_Expired: + return createBalanceChangeReceipt(receiptDTO, networkType); + case ReceiptType.Mosaic_Levy: + case ReceiptType.Mosaic_Rental_Fee: + case ReceiptType.Namespace_Rental_Fee: + return createBalanceTransferReceipt(receiptDTO, networkType); case ReceiptType.Mosaic_Expired: - return new MosaicId(id); case ReceiptType.Namespace_Expired: case ReceiptType.Namespace_Deleted: - return NamespaceId.createFromEncoded(id); + return createArtifactExpiryReceipt(receiptDTO); + case ReceiptType.Inflation: + return createInflationReceipt(receiptDTO); default: - throw new Error('Receipt type is not supported.'); + throw new Error(`Receipt type: ${receiptDTO.type} not recognized.`); } }; /** - * @interal - * @param unresolvedAddress unresolved address - * @returns {Address | NamespaceId} + * @internal + * @param statementDTO + * @param networkType + * @returns {TransactionStatement} + * @constructor */ -const extractUnresolvedAddress = (unresolvedAddress: any): Address | NamespaceId => { - if (typeof unresolvedAddress === 'string') { - return UnresolvedMapping.toUnresolvedAddress(unresolvedAddress); - } else if (typeof unresolvedAddress === 'object') { // Is JSON object - if (unresolvedAddress.hasOwnProperty('address')) { - return Address.createFromRawAddress(unresolvedAddress.address); - } else if (unresolvedAddress.hasOwnProperty('id')) { - return NamespaceId.createFromEncoded(unresolvedAddress.id); - } - } - throw new Error(`UnresolvedAddress: ${unresolvedAddress} type is not recognised`); +const createTransactionStatement = (statementDTO, networkType): TransactionStatement => { + return new TransactionStatement( + UInt64.fromNumericString(statementDTO.height), + new ReceiptSource(statementDTO.source.primaryId, statementDTO.source.secondaryId), + statementDTO.receipts.map((receipt) => { + return CreateReceiptFromDTO(receipt, networkType); + }), + ); +}; + +/** + * @param receiptDTO + * @param networkType + * @returns {Statement} + * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.h + * @see https://github.com/nemtech/catapult-server/blob/master/src/catapult/model/ReceiptType.cpp + * @constructor + */ +export const CreateStatementFromDTO = (receiptDTO, networkType): Statement => { + return new Statement( + receiptDTO.transactionStatements.map((statement) => createTransactionStatement(statement.statement, networkType)), + receiptDTO.addressResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Address)), + receiptDTO.mosaicResolutionStatements.map((statement) => createResolutionStatement(statement.statement, ResolutionType.Mosaic)), + ); }; diff --git a/src/infrastructure/templates/api-single.mustache b/src/infrastructure/templates/api-single.mustache index 8588e38bc8..3894c241dc 100755 --- a/src/infrastructure/templates/api-single.mustache +++ b/src/infrastructure/templates/api-single.mustache @@ -31,8 +31,8 @@ let defaultBasePath = '{{{basePath}}}'; {{#operations}} {{#description}} /** -* {{&description}} -*/ + * {{&description}} + */ {{/description}} export enum {{classname}}ApiKeys { {{#authMethods}} diff --git a/src/infrastructure/templates/model.mustache b/src/infrastructure/templates/model.mustache index 0b3ca75891..3a3a1a3918 100755 --- a/src/infrastructure/templates/model.mustache +++ b/src/infrastructure/templates/model.mustache @@ -57,7 +57,7 @@ export namespace {{classname}} { export enum {{enumName}} { {{#allowableValues}} {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} {{/enumVars}} {{/allowableValues}} } diff --git a/src/model/blockchain/MerkleProofInfo.ts b/src/model/blockchain/MerkleProofInfo.ts index 18314665d8..86df7da991 100644 --- a/src/model/blockchain/MerkleProofInfo.ts +++ b/src/model/blockchain/MerkleProofInfo.ts @@ -1,4 +1,4 @@ -import { MerklePathItem } from "./MerklePathItem"; +import { MerklePathItem } from './MerklePathItem'; /* * Copyright 2019 NEM diff --git a/src/model/transaction/SignedTransaction.ts b/src/model/transaction/SignedTransaction.ts index aade32582c..e8a9010d8d 100644 --- a/src/model/transaction/SignedTransaction.ts +++ b/src/model/transaction/SignedTransaction.ts @@ -17,7 +17,7 @@ import { Address } from '../account/Address'; import { PublicAccount } from '../account/PublicAccount'; import {NetworkType} from '../blockchain/NetworkType'; -import { TransactionType } from "./TransactionType"; +import { TransactionType } from './TransactionType'; /** * SignedTransaction object is used to transfer the transaction data and the signature to the server diff --git a/src/model/transaction/TransactionStatus.ts b/src/model/transaction/TransactionStatus.ts index d96569d544..d09689ad2f 100644 --- a/src/model/transaction/TransactionStatus.ts +++ b/src/model/transaction/TransactionStatus.ts @@ -24,28 +24,28 @@ export class TransactionStatus { /** * @param group - * @param status + * @param code * @param hash * @param deadline * @param height */ constructor( - /** - * The transaction status being the error name in case of failure and success otherwise. - */ - public readonly status: string, /** * The transaction status group "failed", "unconfirmed", "confirmed", etc... */ - public readonly group?: string, + public readonly group: string, /** * The transaction hash. */ - public readonly hash?: string, + public readonly hash: string, /** * The transaction deadline. */ - public readonly deadline?: Deadline, + public readonly deadline: Deadline, + /** + * The transaction status code being the error name in case of failure and success otherwise. + */ + public readonly code?: string, /** * The height of the block at which it was confirmed or rejected. */ diff --git a/src/model/transaction/TransactionStatusError.ts b/src/model/transaction/TransactionStatusError.ts index b94f7e735c..313695bd4f 100644 --- a/src/model/transaction/TransactionStatusError.ts +++ b/src/model/transaction/TransactionStatusError.ts @@ -14,8 +14,8 @@ * limitations under the License. */ +import {Address} from '../account/Address'; import {Deadline} from './Deadline'; -import {Address} from "../account/Address"; /** * Transaction status error model returned by listeners diff --git a/src/service/AggregateTransactionService.ts b/src/service/AggregateTransactionService.ts index 4b278f54ef..0993ab6a1c 100644 --- a/src/service/AggregateTransactionService.ts +++ b/src/service/AggregateTransactionService.ts @@ -17,13 +17,13 @@ import { from as observableFrom, Observable, of as observableOf } from 'rxjs'; import { flatMap, map, mergeMap, toArray } from 'rxjs/operators'; import { TransactionMapping } from '../core/utils/TransactionMapping'; +import { MultisigRepository } from '../infrastructure/MultisigRepository'; import { MultisigAccountGraphInfo } from '../model/account/MultisigAccountGraphInfo'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; import { InnerTransaction } from '../model/transaction/InnerTransaction'; import { MultisigAccountModificationTransaction } from '../model/transaction/MultisigAccountModificationTransaction'; import { SignedTransaction } from '../model/transaction/SignedTransaction'; import { TransactionType } from '../model/transaction/TransactionType'; -import { MultisigRepository } from "../infrastructure/MultisigRepository"; /** * Aggregated Transaction service diff --git a/src/service/MetadataTransactionService.ts b/src/service/MetadataTransactionService.ts index 17b9da7d35..dc4d1acf5c 100644 --- a/src/service/MetadataTransactionService.ts +++ b/src/service/MetadataTransactionService.ts @@ -17,7 +17,7 @@ import { Observable, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { Convert } from '../core/format/Convert'; -import { MetadataHttp } from '../infrastructure/MetadataHttp'; +import { MetadataRepository } from '../infrastructure/MetadataRepository'; import { Address } from '../model/account/Address'; import { PublicAccount } from '../model/account/PublicAccount'; import { NetworkType } from '../model/blockchain/NetworkType'; @@ -29,9 +29,7 @@ import { AccountMetadataTransaction } from '../model/transaction/AccountMetadata import { Deadline } from '../model/transaction/Deadline'; import { MosaicMetadataTransaction } from '../model/transaction/MosaicMetadataTransaction'; import { NamespaceMetadataTransaction } from '../model/transaction/NamespaceMetadataTransaction'; -import { Transaction } from '../model/transaction/Transaction'; import { UInt64 } from '../model/UInt64'; -import { MetadataRepository } from "../infrastructure/MetadataRepository"; /** * MetadataTransaction service diff --git a/src/service/MosaicRestrictionTransactionService.ts b/src/service/MosaicRestrictionTransactionService.ts index fc3e48e45d..028f1aad6f 100644 --- a/src/service/MosaicRestrictionTransactionService.ts +++ b/src/service/MosaicRestrictionTransactionService.ts @@ -16,9 +16,11 @@ import { Observable, of } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs/operators'; +import { RestrictionMosaicRepository } from '../infrastructure/RestrictionMosaicRepository'; import { Address } from '../model/account/Address'; import { NetworkType } from '../model/blockchain/NetworkType'; import { MosaicId } from '../model/mosaic/MosaicId'; +import { NamespaceId } from '../model/namespace/NamespaceId'; import { MosaicGlobalRestriction } from '../model/restriction/MosaicGlobalRestriction'; import { MosaicGlobalRestrictionItem } from '../model/restriction/MosaicGlobalRestrictionItem'; import { MosaicRestrictionType } from '../model/restriction/MosaicRestrictionType'; @@ -27,8 +29,6 @@ import { MosaicAddressRestrictionTransaction } from '../model/transaction/Mosaic import { MosaicGlobalRestrictionTransaction } from '../model/transaction/MosaicGlobalRestrictionTransaction'; import { Transaction } from '../model/transaction/Transaction'; import { UInt64 } from '../model/UInt64'; -import { RestrictionMosaicRepository } from "../infrastructure/RestrictionMosaicRepository"; -import { NamespaceId } from "../model/namespace/NamespaceId"; /** * MosaicRestrictionTransactionService service @@ -114,7 +114,8 @@ export class MosaicRestrictionTransactionService { } return this.getAddressRestrictionEntry(mosaicId, restrictionKey, targetAddress).pipe( map((optionalValue) => { - const currentValue = optionalValue ? UInt64.fromNumericString(optionalValue) : this.defaultMosaicAddressRestrictionValue; + const currentValue = optionalValue ? + UInt64.fromNumericString(optionalValue) : this.defaultMosaicAddressRestrictionValue; return MosaicAddressRestrictionTransaction.create( deadline, mosaicId, diff --git a/src/service/MosaicService.ts b/src/service/MosaicService.ts index 745e07b64b..9ef23510f5 100644 --- a/src/service/MosaicService.ts +++ b/src/service/MosaicService.ts @@ -16,16 +16,14 @@ import { Observable, of as observableOf } from 'rxjs'; import { map, mergeMap, toArray } from 'rxjs/operators'; -import { AccountHttp } from '../infrastructure/AccountHttp'; -import { MosaicHttp } from '../infrastructure/MosaicHttp'; +import { AccountRepository } from '../infrastructure/AccountRepository'; +import { MosaicRepository } from '../infrastructure/MosaicRepository'; import { Address } from '../model/account/Address'; import { MosaicInfo } from '../model/model'; import { Mosaic } from '../model/mosaic/Mosaic'; import { MosaicId } from '../model/mosaic/MosaicId'; import { MosaicAmountView } from './MosaicAmountView'; import { MosaicView } from './MosaicView'; -import { AccountRepository } from "../infrastructure/AccountRepository"; -import { MosaicRepository } from "../infrastructure/MosaicRepository"; /** * Mosaic service @@ -50,7 +48,7 @@ export class MosaicService { mosaicsView(mosaicIds: MosaicId[]): Observable { return observableOf(mosaicIds).pipe( mergeMap((_) => this.mosaicRepository.getMosaics(mosaicIds).pipe( - mergeMap((_) => _), + mergeMap((info) => info), map((mosaicInfo: MosaicInfo) => { return new MosaicView(mosaicInfo); }), diff --git a/src/service/NamespaceService.ts b/src/service/NamespaceService.ts index 66337732ae..c7f18bc1fa 100644 --- a/src/service/NamespaceService.ts +++ b/src/service/NamespaceService.ts @@ -16,11 +16,11 @@ import { Observable } from 'rxjs'; import { map, mergeMap } from 'rxjs/operators'; +import { NamespaceRepository } from '../infrastructure/NamespaceRepository'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { NamespaceInfo } from '../model/namespace/NamespaceInfo'; import { NamespaceName } from '../model/namespace/NamespaceName'; import { Namespace } from './Namespace'; -import { NamespaceRepository } from "../infrastructure/NamespaceRepository"; /** * Namespace service diff --git a/src/service/TransactionService.ts b/src/service/TransactionService.ts index b3ece0259a..b443e01ffb 100644 --- a/src/service/TransactionService.ts +++ b/src/service/TransactionService.ts @@ -17,6 +17,8 @@ import { Observable, of } from 'rxjs'; import { flatMap, map, mergeMap, toArray } from 'rxjs/operators'; import { IListener } from '../infrastructure/IListener'; +import { ReceiptRepository } from '../infrastructure/ReceiptRepository'; +import { TransactionRepository } from '../infrastructure/TransactionRepository'; import { NamespaceId } from '../model/namespace/NamespaceId'; import { AccountAddressRestrictionTransaction } from '../model/transaction/AccountAddressRestrictionTransaction'; import { AggregateTransaction } from '../model/transaction/AggregateTransaction'; @@ -32,8 +34,6 @@ import { Transaction } from '../model/transaction/Transaction'; import { TransactionType } from '../model/transaction/TransactionType'; import { TransferTransaction } from '../model/transaction/TransferTransaction'; import { ITransactionService } from './interfaces/ITransactionService'; -import { TransactionRepository } from "../infrastructure/TransactionRepository"; -import { ReceiptRepository } from "../infrastructure/ReceiptRepository"; /** * Transaction Service diff --git a/test/core/utils/UnresolvedMapping.spec.ts b/test/core/utils/UnresolvedMapping.spec.ts index 19b64d1373..d8df75651f 100644 --- a/test/core/utils/UnresolvedMapping.spec.ts +++ b/test/core/utils/UnresolvedMapping.spec.ts @@ -17,7 +17,7 @@ import { expect } from 'chai'; import { Convert, RawAddress } from '../../../src/core/format'; import { UnresolvedMapping } from '../../../src/core/utils/UnresolvedMapping'; import { Address } from '../../../src/model/account/Address'; -import { NetworkType } from "../../../src/model/blockchain/NetworkType"; +import { NetworkType } from '../../../src/model/blockchain/NetworkType'; import { MosaicId } from '../../../src/model/mosaic/MosaicId'; import { NamespaceId } from '../../../src/model/namespace/NamespaceId'; diff --git a/test/infrastructure/Listener.spec.ts b/test/infrastructure/Listener.spec.ts index f6aa178479..0d0ba57b08 100644 --- a/test/infrastructure/Listener.spec.ts +++ b/test/infrastructure/Listener.spec.ts @@ -14,13 +14,12 @@ * limitations under the License. */ +import { deepEqual } from 'assert'; import { expect } from 'chai'; import { Listener } from '../../src/infrastructure/Listener'; -import { Address } from "../../src/model/account/Address"; -import { deepEqual } from "assert"; -import { UInt64 } from "../../src/model/UInt64"; -import { timeout } from "rxjs/operators"; -import { TransactionStatusError } from "../../src/model/transaction/TransactionStatusError"; +import { Address } from '../../src/model/account/Address'; +import { TransactionStatusError } from '../../src/model/transaction/TransactionStatusError'; +import { UInt64 } from '../../src/model/UInt64'; describe('Listener', () => { it('should createComplete a WebSocket instance given url parameter', () => { @@ -40,7 +39,6 @@ describe('Listener', () => { describe('onStatusWhenAddressIsTheSame', () => { it('Should forward status', () => { - const errorEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96860EB'; const errorAddress = Address.createFromEncoded(errorEncodedAddress); @@ -67,8 +65,8 @@ describe('Listener', () => { const reportedStatus = new Array(); - listener.status(errorAddress).subscribe((transactionStatusError) => { - reportedStatus.push(transactionStatusError); + listener.status(errorAddress).subscribe((error) => { + reportedStatus.push(error); }); listener.handleMessage(statusInfoErrorDTO, null); @@ -80,24 +78,21 @@ describe('Listener', () => { expect(transactionStatusError.status).to.be.equal(statusInfoErrorDTO.status); deepEqual(transactionStatusError.deadline.toDTO(), UInt64.fromNumericString(statusInfoErrorDTO.deadline).toDTO()); - }); }); describe('onStatusWhenAddressIsDifferentAddress', () => { it('Should not forward status', () => { - const errorEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96860EB'; const subscribedEncodedAddress = '906415867F121D037AF447E711B0F5E4D52EBBF066D96AAAAA'; const subscribedAddress = Address.createFromEncoded(subscribedEncodedAddress); + // tslint:disable-next-line: max-classes-per-file class WebSocketMock { - constructor(public readonly url: string) { } - send(payload: string) { expect(payload).to.be.eq(`{"subscribe":"status/${subscribedAddress.plain()}"}`); } @@ -121,9 +116,8 @@ describe('Listener', () => { }); listener.handleMessage(statusInfoErrorDTO, null); - - expect(reportedStatus.length).to.be.equal(0); + expect(reportedStatus.length).to.be.equal(0); }); }); @@ -132,7 +126,7 @@ describe('Listener', () => { it('should reject because of wrong server url', async () => { const listener = new Listener('https://notcorrecturl:0000'); await listener.open() - .then((result) => { + .then(() => { throw new Error('This should not be called when expecting error'); }) .catch((error) => { diff --git a/test/infrastructure/RepositoryFactory.spec.ts b/test/infrastructure/RepositoryFactory.spec.ts index 3ee35f30b4..5dfcbcfd05 100644 --- a/test/infrastructure/RepositoryFactory.spec.ts +++ b/test/infrastructure/RepositoryFactory.spec.ts @@ -25,7 +25,7 @@ import { NetworkType } from '../../src/model/blockchain/NetworkType'; describe('RepositoryFactory', () => { it('Should create repositories', () => { - const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000'); + const repositoryFactory = new RepositoryFactoryHttp('http://localhost:3000', NetworkType.MIJIN_TEST, 'testHash'); expect(repositoryFactory.createBlockRepository()).to.be.not.null; expect(repositoryFactory.createNetworkRepository()).to.be.not.null; @@ -47,47 +47,40 @@ describe('RepositoryFactory', () => { it('Should get GenerationHash from cache', (done) => { let counter = 0; - const repositoryMock: BlockRepository = mock(); - const observableOfBlockInfo = observableOf({generationHash: 'aaaa'} as BlockInfo).pipe(map((v) => { counter++; return v; })); when(repositoryMock.getBlockByHeight('1')).thenReturn(observableOfBlockInfo); - expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); - const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { createBlockRepository(): BlockRepository { return instance(repositoryMock); } - })('http://localhost:3000'); + })('http://localhost:3000', NetworkType.MIJIN_TEST); expect(counter).to.be.equals(0); repositoryFactory.getGenerationHash().subscribe((gh) => { expect(counter).to.be.equals(1); expect(gh).to.be.equals('aaaa'); - repositoryFactory.getGenerationHash().subscribe(gh => { + repositoryFactory.getGenerationHash().subscribe((g) => { expect(counter).to.be.equals(1); - expect(gh).to.be.equals('aaaa'); - repositoryFactory.getGenerationHash().subscribe(gh => { + expect(g).to.be.equals('aaaa'); + repositoryFactory.getGenerationHash().subscribe((h) => { expect(counter).to.be.equals(1); - expect(gh).to.be.equals('aaaa'); + expect(h).to.be.equals('aaaa'); done(); }); }); }); - }); it('Should get NetworkType from cache', (done) => { let counter = 0; - const repositoryMock: NetworkRepository = mock(); - const expectedNetworkType = NetworkType.MIJIN_TEST; const observableOfBlockInfo = observableOf(expectedNetworkType).pipe(map((v) => { counter++; @@ -97,19 +90,20 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); + // tslint:disable-next-line: max-classes-per-file const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })('http://localhost:3000'); + })('http://localhost:3000', undefined, 'testHash'); expect(counter).to.be.equals(0); repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(1); expect(networkType).to.be.equals(expectedNetworkType); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((network) => { expect(counter).to.be.equals(1); - expect(networkType).to.be.equals(expectedNetworkType); + expect(network).to.be.equals(expectedNetworkType); done(); }); }); @@ -131,20 +125,20 @@ describe('RepositoryFactory', () => { expect(observableOfBlockInfo).to.be.equals(observableOfBlockInfo); + // tslint:disable-next-line: max-classes-per-file const repositoryFactory = new (class RepositoryFactoryHttpForTest extends RepositoryFactoryHttp { - createNetworkRepository(): NetworkRepository { return instance(repositoryMock); } - })('http://localhost:3000', expectedNetworkType); + })('http://localhost:3000', expectedNetworkType, 'testHash'); expect(counter).to.be.equals(0); repositoryFactory.getNetworkType().subscribe((networkType) => { expect(counter).to.be.equals(0); expect(networkType).to.be.equals(expectedNetworkType); - repositoryFactory.getNetworkType().subscribe(networkType => { + repositoryFactory.getNetworkType().subscribe((network) => { expect(counter).to.be.equals(0); - expect(networkType).to.be.equals(expectedNetworkType); + expect(network).to.be.equals(expectedNetworkType); done(); }); }); diff --git a/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts b/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts index 8c38aa5651..9d84277290 100644 --- a/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts +++ b/test/infrastructure/receipt/CreateReceiptFromDTO.spec.ts @@ -21,8 +21,6 @@ import {Account} from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; import { MosaicId } from '../../../src/model/mosaic/MosaicId'; -import { AddressAlias } from '../../../src/model/namespace/AddressAlias'; -import { MosaicAlias } from '../../../src/model/namespace/MosaicAlias'; import { NamespaceId } from '../../../src/model/namespace/NamespaceId'; import { ReceiptType } from '../../../src/model/receipt/ReceiptType'; import { UInt64 } from '../../../src/model/UInt64'; diff --git a/test/model/account/Address.spec.ts b/test/model/account/Address.spec.ts index fffe493f28..6bec2ff4d5 100644 --- a/test/model/account/Address.spec.ts +++ b/test/model/account/Address.spec.ts @@ -15,10 +15,9 @@ */ import { expect } from 'chai'; +import { Account } from '../../../src/model/account/Account'; import { Address } from '../../../src/model/account/Address'; import { NetworkType } from '../../../src/model/blockchain/NetworkType'; -import { Convert as convert, RawAddress } from "../../../src/core/format"; -import { Account } from "../../../src/model/account/Account"; const Address_Decoded_Size = 25; @@ -128,20 +127,23 @@ describe('Address', () => { }); it('It creates the address from an encoded value', () => { - let encoded = '917E7E29A01014C2F300000000000000000000000000000000'; + const encoded = '917E7E29A01014C2F300000000000000000000000000000000'; const address = Address.createFromEncoded(encoded); expect(address.encoded()).to.be.equal(encoded); }); describe('isValidRawAddress', () => { - it('returns true for valid address when generated', () => { // Assert: - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MIJIN_TEST).address.plain(), NetworkType.MIJIN_TEST)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MAIN_NET).address.plain(), NetworkType.MAIN_NET)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.MIJIN).address.plain(), NetworkType.MIJIN)).to.equal(true); - expect(Address.isValidRawAddress(Account.generateNewAccount(NetworkType.TEST_NET).address.plain(), NetworkType.TEST_NET)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MIJIN_TEST).address.plain(), NetworkType.MIJIN_TEST)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MAIN_NET).address.plain(), NetworkType.MAIN_NET)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.MIJIN).address.plain(), NetworkType.MIJIN)).to.equal(true); + expect(Address.isValidRawAddress( + Account.generateNewAccount(NetworkType.TEST_NET).address.plain(), NetworkType.TEST_NET)).to.equal(true); }); it('returns true for valid address', () => { @@ -181,10 +183,14 @@ describe('Address', () => { it('returns true for valid address when generated', () => { // Assert: - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MIJIN_TEST).address.encoded(), NetworkType.MIJIN_TEST)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MAIN_NET).address.encoded(), NetworkType.MAIN_NET)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.MIJIN).address.encoded(), NetworkType.MIJIN)).to.equal(true); - expect(Address.isValidEncodedAddress(Account.generateNewAccount(NetworkType.TEST_NET).address.encoded(), NetworkType.TEST_NET)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MIJIN_TEST).address.encoded(), NetworkType.MIJIN_TEST)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MAIN_NET).address.encoded(), NetworkType.MAIN_NET)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.MIJIN).address.encoded(), NetworkType.MIJIN)).to.equal(true); + expect(Address.isValidEncodedAddress( + Account.generateNewAccount(NetworkType.TEST_NET).address.encoded(), NetworkType.TEST_NET)).to.equal(true); }); it('returns true for valid encoded address', () => { diff --git a/test/model/transaction/HashLockTransaction.spec.ts b/test/model/transaction/HashLockTransaction.spec.ts index 03bcf563fe..70df873a44 100644 --- a/test/model/transaction/HashLockTransaction.spec.ts +++ b/test/model/transaction/HashLockTransaction.spec.ts @@ -14,6 +14,7 @@ * limitations under the License. */ import {expect} from 'chai'; +import {Convert} from '../../../src/core/format'; import {NetworkType} from '../../../src/model/blockchain/NetworkType'; import { NetworkCurrencyMosaic } from '../../../src/model/mosaic/NetworkCurrencyMosaic'; import {AggregateTransaction} from '../../../src/model/transaction/AggregateTransaction'; @@ -21,7 +22,6 @@ import {Deadline} from '../../../src/model/transaction/Deadline'; import {HashLockTransaction} from '../../../src/model/transaction/HashLockTransaction'; import {UInt64} from '../../../src/model/UInt64'; import {TestingAccount} from '../../conf/conf.spec'; -import {Convert} from "../../../src/core/format"; describe('HashLockTransaction', () => { const account = TestingAccount; diff --git a/test/model/transaction/TransactionStatus.spec.ts b/test/model/transaction/TransactionStatus.spec.ts index f0ac87f8a6..55a2b31464 100644 --- a/test/model/transaction/TransactionStatus.spec.ts +++ b/test/model/transaction/TransactionStatus.spec.ts @@ -16,6 +16,7 @@ import {deepEqual} from 'assert'; import {expect} from 'chai'; +import { TransactionStatusTypeEnum } from '../../../src/infrastructure/model/transactionStatusTypeEnum'; import {Deadline} from '../../../src/model/transaction/Deadline'; import {TransactionStatus} from '../../../src/model/transaction/TransactionStatus'; import {UInt64} from '../../../src/model/UInt64'; @@ -27,19 +28,19 @@ describe('TransactionStatus', () => { group: 'confirmed', hash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219', height: new UInt64([ 1, 0 ]), - status: 'Success', + code: TransactionStatusTypeEnum.Success, }; const transactionStatus = new TransactionStatus( - transactionStatusDTO.status, transactionStatusDTO.group, transactionStatusDTO.hash, transactionStatusDTO.deadline, + transactionStatusDTO.code, transactionStatusDTO.height, ); expect(transactionStatus.group).to.be.equal(transactionStatusDTO.group); - expect(transactionStatus.status).to.be.equal(transactionStatusDTO.status); + expect(transactionStatus.code).to.be.equal(transactionStatusDTO.code); expect(transactionStatus.hash).to.be.equal(transactionStatusDTO.hash); deepEqual(transactionStatus.deadline, transactionStatusDTO.deadline); deepEqual(transactionStatus.height, transactionStatusDTO.height); diff --git a/test/model/transaction/TransactionStatusError.spec.ts b/test/model/transaction/TransactionStatusError.spec.ts index 156c3f902b..b7fcc61867 100644 --- a/test/model/transaction/TransactionStatusError.spec.ts +++ b/test/model/transaction/TransactionStatusError.spec.ts @@ -16,10 +16,10 @@ import {deepEqual} from 'assert'; import {expect} from 'chai'; -import {TransactionStatusError} from '../../../src/model/transaction/TransactionStatusError'; +import {Address} from '../../../src/model/account/Address'; import {Deadline} from '../../../src/model/transaction/Deadline'; +import {TransactionStatusError} from '../../../src/model/transaction/TransactionStatusError'; import { UInt64 } from '../../../src/model/UInt64'; -import {Address} from "../../../src/model/account/Address"; describe('TransactionStatusError', () => { diff --git a/test/service/MosaicService.spec.ts b/test/service/MosaicService.spec.ts index 6508e006e5..d1fa62292d 100644 --- a/test/service/MosaicService.spec.ts +++ b/test/service/MosaicService.spec.ts @@ -18,6 +18,7 @@ import {expect} from 'chai'; import {AccountHttp} from '../../src/infrastructure/AccountHttp'; import {MosaicHttp} from '../../src/infrastructure/MosaicHttp'; import {Address} from '../../src/model/account/Address'; +import { NetworkType } from '../../src/model/model'; import {Mosaic} from '../../src/model/mosaic/Mosaic'; import {MosaicId} from '../../src/model/mosaic/MosaicId'; import {MosaicInfo} from '../../src/model/mosaic/MosaicInfo'; @@ -31,7 +32,7 @@ describe('MosaicService', () => { it('mosaicsView', () => { const mosaicId = new MosaicId([3294802500, 2243684972]); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsView([mosaicId]).subscribe((mosaicsView: MosaicView[]) => { const mosaicView = mosaicsView[0]; expect(mosaicView.mosaicInfo).to.be.an.instanceof(MosaicInfo); @@ -41,7 +42,7 @@ describe('MosaicService', () => { it('mosaicsView of no existing mosaicId', () => { const mosaicId = new MosaicId([1234, 1234]); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsView([mosaicId]).subscribe((mosaicsView: MosaicView[]) => { expect(mosaicsView.length).to.be.equal(0); }); @@ -49,7 +50,7 @@ describe('MosaicService', () => { it('mosaicsAmountView', () => { const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountViewFromAddress(Address.createFromRawAddress('SARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJETM3ZSP')) .subscribe((mosaicsAmountView: MosaicAmountView[]) => { const mosaicAmountView = mosaicsAmountView[0]; @@ -59,7 +60,7 @@ describe('MosaicService', () => { it('mosaicsAmountView of no existing account', () => { const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountViewFromAddress(Address.createFromRawAddress('SCKBZAMIQ6F46QMZUANE6E33KA63KA7KEQ5X6WJW')) .subscribe((mosaicsAmountView: MosaicAmountView[]) => { expect(mosaicsAmountView.length).to.be.equal(0); @@ -69,7 +70,7 @@ describe('MosaicService', () => { it('mosaicsAmountView', () => { const mosaic = new Mosaic(new MosaicId([3646934825, 3576016193]), UInt64.fromUint(1000)); const mosaicService = new MosaicService( - new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL)); + new AccountHttp(conf.NIS2_URL), new MosaicHttp(conf.NIS2_URL, NetworkType.MIJIN_TEST)); return mosaicService.mosaicsAmountView([mosaic]).subscribe((mosaicsAmountView: MosaicAmountView[]) => { const mosaicAmountView = mosaicsAmountView[0]; expect(mosaicAmountView.mosaicInfo).to.be.an.instanceof(MosaicInfo); From 97ffec1532e85650719fea76cad4f437f763a610 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Mon, 23 Dec 2019 15:52:24 +0000 Subject: [PATCH 22/22] fixed jsdoc missing param --- src/infrastructure/RepositoryFactoryHttp.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/infrastructure/RepositoryFactoryHttp.ts b/src/infrastructure/RepositoryFactoryHttp.ts index f89a41f555..e3e86bea81 100644 --- a/src/infrastructure/RepositoryFactoryHttp.ts +++ b/src/infrastructure/RepositoryFactoryHttp.ts @@ -63,6 +63,7 @@ export class RepositoryFactoryHttp implements RepositoryFactory { * Constructor * @param url the server url. * @param networkType optional network type if you don't want to load it from the server. + * @param generationHash optional node generation hash if you don't want to load it from the server. */ constructor(url: string, networkType?: NetworkType, generationHash?: string) { this.url = url;