Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bde728b
Fixed #390 Spread operator does not assign super class methods
rg911 Dec 18, 2019
e251e4c
Merge branch 'master' into task/g390_max_fee
rg911 Dec 18, 2019
faaef7f
Fixed #393 applied catbuffer generator on aggregate
rg911 Dec 20, 2019
2c7de1f
Fixed missing semicolon
rg911 Dec 20, 2019
fd775e8
Merge branch 'master' into task/g393_reapply_catbuffer
rg911 Dec 22, 2019
3f68b80
Fixed #393 applied catbuffer generator on aggregate
rg911 Dec 20, 2019
cb0c6b1
Fixed missing semicolon
rg911 Dec 20, 2019
a999695
Merge branch 'task/g393_reapply_catbuffer' of github.com:NEMStudios/n…
rg911 Dec 22, 2019
8ef45a0
Applied catbuffer on receipt
rg911 Dec 22, 2019
250b5c2
Merge branch 'master' into task/g390_max_fee
rg911 Dec 22, 2019
38ba4d6
Merge branch 'master' into task/g393_reapply_catbuffer
rg911 Dec 22, 2019
6d8c421
Moved object assgin to a static method in MappingDto
rg911 Dec 22, 2019
4c656b2
Fixed #390 Spread operator does not assign super class methods
rg911 Dec 18, 2019
a21ba91
Moved object assgin to a static method in MappingDto
rg911 Dec 22, 2019
d65d9eb
Merge branch 'task/g390_max_fee' of github.com:NEMStudios/nem2-sdk-ty…
rg911 Dec 22, 2019
fc8410b
Fixed #393 applied catbuffer generator on aggregate
rg911 Dec 20, 2019
62629a0
Fixed missing semicolon
rg911 Dec 20, 2019
127124d
Applied catbuffer on receipt
rg911 Dec 22, 2019
0d06c22
Merge branch 'task/g393_reapply_catbuffer' of github.com:NEMStudios/n…
rg911 Dec 22, 2019
57ac6c3
Fixed semicolom in import
rg911 Dec 22, 2019
e6ff787
Fixed #397
rg911 Dec 22, 2019
7867c9f
Merge pull request #391 from NEMStudios/task/g390_max_fee
rg911 Dec 23, 2019
7314c62
Fixed #397
rg911 Dec 22, 2019
0212268
Merge branch 'task/g397_apply_open_api' of github.com:NEMStudios/nem2…
rg911 Dec 23, 2019
ab5a537
Fixed #393 applied catbuffer generator on aggregate
rg911 Dec 20, 2019
fc99749
Fixed missing semicolon
rg911 Dec 20, 2019
04831f8
Applied catbuffer on receipt
rg911 Dec 22, 2019
84e5f6c
Fixed semicolom in import
rg911 Dec 22, 2019
01370fd
Merge branch 'task/g393_reapply_catbuffer' of github.com:NEMStudios/n…
rg911 Dec 23, 2019
70f3ab9
Removed redundant switch case
rg911 Dec 23, 2019
e9ed91c
Merge pull request #394 from NEMStudios/task/g393_reapply_catbuffer
rg911 Dec 23, 2019
5efa1bd
Fixed #397
rg911 Dec 22, 2019
10a6228
Merge branch 'task/g397_apply_open_api' of github.com:NEMStudios/nem2…
rg911 Dec 23, 2019
97ffec1
fixed jsdoc missing param
rg911 Dec 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions e2e/infrastructure/AccountHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('AccountHttp', () => {
[NetworkCurrencyMosaic.createAbsolute(1)],
PlainMessage.create('test-message'),
networkType,
helper.maxFee
helper.maxFee,
);

const signedTransaction = transferTransaction.signWith(account, generationHash);
Expand All @@ -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);
Expand Down Expand Up @@ -265,7 +265,7 @@ describe('AccountHttp', () => {
namespaceId,
account.address,
networkType,
helper.maxFee
helper.maxFee,
);
const signedTransaction = addressAliasTransaction.signWith(account, generationHash);
return helper.announce(signedTransaction);
Expand All @@ -282,7 +282,7 @@ describe('AccountHttp', () => {
[cosignAccount1.publicAccount,
],
networkType,
helper.maxFee
helper.maxFee,
);
const removeCosigner2 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Expand All @@ -293,7 +293,7 @@ describe('AccountHttp', () => {
cosignAccount2.publicAccount,
],
networkType,
helper.maxFee
helper.maxFee,
);

const removeCosigner3 = MultisigAccountModificationTransaction.create(
Expand All @@ -305,7 +305,7 @@ describe('AccountHttp', () => {
cosignAccount3.publicAccount,
],
networkType,
helper.maxFee
helper.maxFee,
);

const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),
Expand Down
13 changes: 6 additions & 7 deletions e2e/infrastructure/BlockHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
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';
import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic';
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;
Expand Down Expand Up @@ -68,18 +68,17 @@ describe('BlockHttp', () => {

describe('Setup Test Data', () => {


it('Announce TransferTransaction', (done) => {
const transferTransaction = TransferTransaction.create(
Deadline.create(),
account2.address,
[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;
});
Expand Down
7 changes: 3 additions & 4 deletions e2e/infrastructure/ChainHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
7 changes: 3 additions & 4 deletions e2e/infrastructure/DiagnosticHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
55 changes: 28 additions & 27 deletions e2e/infrastructure/IntegrationTestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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]);
Expand All @@ -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);
Expand All @@ -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);
}
},
);
};
}
}
Loading