Skip to content

Commit 2383706

Browse files
committed
Applied new swagger code gen template
Updated infrastructure codes
1 parent 07c50f3 commit 2383706

File tree

81 files changed

+7122
-5253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+7122
-5253
lines changed

e2e/infrastructure/MosaicHttp.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ describe('MosaicHttp', () => {
7070
it('Announce MosaicDefinitionTransaction', (done) => {
7171
const nonce = MosaicNonce.createRandom();
7272
mosaicId = MosaicId.createFromNonce(nonce, account.publicAccount);
73-
console.log(mosaicId.toHex());
7473
const mosaicDefinitionTransaction = MosaicDefinitionTransaction.create(
7574
Deadline.create(),
7675
nonce,

src/infrastructure/AccountHttp.ts

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ import {AggregateTransaction} from '../model/transaction/AggregateTransaction';
3232
import {Transaction} from '../model/transaction/Transaction';
3333
import {UInt64} from '../model/UInt64';
3434
import {AccountRepository} from './AccountRepository';
35-
import * as api from './ApiClient';
35+
import { AccountInfoDTO,
36+
AccountNamesDTO,
37+
AccountPropertiesDTO,
38+
AccountPropertiesInfoDTO,
39+
AccountRoutesApi,
40+
MosaicDTO,
41+
MultisigAccountGraphInfoDTO,
42+
MultisigAccountInfoDTO,
43+
TransactionInfoDTO } from './api';
3644
import {Http} from './Http';
3745
import {NetworkHttp} from './NetworkHttp';
3846
import {QueryParams} from './QueryParams';
@@ -48,7 +56,7 @@ export class AccountHttp extends Http implements AccountRepository {
4856
* @internal
4957
* Nem2 Library account routes api
5058
*/
51-
private accountRoutesApi: api.AccountRoutesApi;
59+
private accountRoutesApi: AccountRoutesApi;
5260

5361
/**
5462
* Constructor
@@ -58,7 +66,7 @@ export class AccountHttp extends Http implements AccountRepository {
5866
constructor(url: string, networkHttp?: NetworkHttp) {
5967
networkHttp = networkHttp == null ? new NetworkHttp(url) : networkHttp;
6068
super(networkHttp);
61-
this.accountRoutesApi = new api.AccountRoutesApi(url);
69+
this.accountRoutesApi = new AccountRoutesApi(url);
6270
}
6371

6472
/**
@@ -67,7 +75,7 @@ export class AccountHttp extends Http implements AccountRepository {
6775
* @returns Observable<AccountInfo>
6876
*/
6977
public getAccountInfo(address: Address): Observable<AccountInfo> {
70-
return observableFrom(this.accountRoutesApi.getAccountInfo(address.plain())).pipe(map((accountInfoDTO: api.AccountInfoDTO) => {
78+
return observableFrom(this.accountRoutesApi.getAccountInfo(address.plain())).pipe(map((accountInfoDTO: AccountInfoDTO) => {
7179
return new AccountInfo(
7280
accountInfoDTO.meta,
7381
Address.createFromEncoded(accountInfoDTO.account.address),
@@ -91,7 +99,7 @@ export class AccountHttp extends Http implements AccountRepository {
9199
*/
92100
public getAccountProperties(address: Address): Observable<AccountPropertiesInfo> {
93101
return observableFrom(this.accountRoutesApi.getAccountProperties(address.plain()))
94-
.pipe(map((accountProperties: api.AccountPropertiesInfoDTO) => {
102+
.pipe(map((accountProperties: AccountPropertiesInfoDTO) => {
95103
return DtoMapping.extractAccountPropertyFromDto(accountProperties);
96104
}));
97105
}
@@ -107,7 +115,7 @@ export class AccountHttp extends Http implements AccountRepository {
107115
};
108116
return observableFrom(
109117
this.accountRoutesApi.getAccountPropertiesFromAccounts(accountIds))
110-
.pipe(map((accountProperties: api.AccountPropertiesDTO[]) => {
118+
.pipe(map((accountProperties: AccountPropertiesDTO[]) => {
111119
return accountProperties.map((property) => {
112120
return DtoMapping.extractAccountPropertyFromDto(property);
113121
});
@@ -124,15 +132,15 @@ export class AccountHttp extends Http implements AccountRepository {
124132
addresses: addresses.map((address) => address.plain()),
125133
};
126134
return observableFrom(
127-
this.accountRoutesApi.getAccountsInfo(accountIdsBody)).pipe(map((accountsInfoMetaDataDTO: api.AccountInfoDTO[]) => {
128-
return accountsInfoMetaDataDTO.map((accountInfoDTO: api.AccountInfoDTO) => {
135+
this.accountRoutesApi.getAccountsInfo(accountIdsBody)).pipe(map((accountsInfoMetaDataDTO: AccountInfoDTO[]) => {
136+
return accountsInfoMetaDataDTO.map((accountInfoDTO: AccountInfoDTO) => {
129137
return new AccountInfo(
130138
accountInfoDTO.meta,
131139
Address.createFromEncoded(accountInfoDTO.account.address),
132140
new UInt64(accountInfoDTO.account.addressHeight),
133141
accountInfoDTO.account.publicKey,
134142
new UInt64(accountInfoDTO.account.publicKeyHeight),
135-
accountInfoDTO.account.mosaics.map((mosaicDTO: api.MosaicDTO) =>
143+
accountInfoDTO.account.mosaics.map((mosaicDTO: MosaicDTO) =>
136144
new Mosaic(new MosaicId(mosaicDTO.id), new UInt64(mosaicDTO.amount))),
137145
new UInt64(accountInfoDTO.account.importance),
138146
new UInt64(accountInfoDTO.account.importanceHeight),
@@ -146,7 +154,7 @@ export class AccountHttp extends Http implements AccountRepository {
146154
addresses: addresses.map((address) => address.plain()),
147155
};
148156
return observableFrom(
149-
this.accountRoutesApi.getAccountsNames(accountIdsBody)).pipe(map((accountNames: api.AccountNamesDTO[]) => {
157+
this.accountRoutesApi.getAccountsNames(accountIdsBody)).pipe(map((accountNames: AccountNamesDTO[]) => {
150158
return accountNames.map((accountName) => {
151159
return new AccountNames(
152160
Address.createFromEncoded(accountName.address),
@@ -166,7 +174,7 @@ export class AccountHttp extends Http implements AccountRepository {
166174
return this.getNetworkTypeObservable().pipe(
167175
mergeMap((networkType) => observableFrom(
168176
this.accountRoutesApi.getAccountMultisig(address.plain()))
169-
.pipe(map((multisigAccountInfoDTO: api.MultisigAccountInfoDTO) => {
177+
.pipe(map((multisigAccountInfoDTO: MultisigAccountInfoDTO) => {
170178
return new MultisigAccountInfo(
171179
PublicAccount.createFromPublicKey(multisigAccountInfoDTO.multisig.account, networkType),
172180
multisigAccountInfoDTO.multisig.minApproval,
@@ -188,7 +196,7 @@ export class AccountHttp extends Http implements AccountRepository {
188196
return this.getNetworkTypeObservable().pipe(
189197
mergeMap((networkType) => observableFrom(
190198
this.accountRoutesApi.getAccountMultisigGraph(address.plain()))
191-
.pipe(map((multisigAccountGraphInfosDTO: api.MultisigAccountGraphInfoDTO[]) => {
199+
.pipe(map((multisigAccountGraphInfosDTO: MultisigAccountGraphInfoDTO[]) => {
192200
const multisigAccounts = new Map<number, MultisigAccountInfo[]>();
193201
multisigAccountGraphInfosDTO.map((multisigAccountGraphInfoDTO) => {
194202
multisigAccounts.set(multisigAccountGraphInfoDTO.level,
@@ -220,7 +228,7 @@ export class AccountHttp extends Http implements AccountRepository {
220228
this.queryParams(queryParams).pageSize,
221229
this.queryParams(queryParams).id,
222230
this.queryParams(queryParams).order)).pipe(
223-
map((transactionsDTO: api.TransactionInfoDTO[]) => {
231+
map((transactionsDTO: TransactionInfoDTO[]) => {
224232
return transactionsDTO.map((transactionDTO) => {
225233
return CreateTransactionFromDTO(transactionDTO);
226234
});
@@ -240,7 +248,7 @@ export class AccountHttp extends Http implements AccountRepository {
240248
this.queryParams(queryParams).pageSize,
241249
this.queryParams(queryParams).id,
242250
this.queryParams(queryParams).order)).pipe(
243-
map((transactionsDTO: api.TransactionInfoDTO[]) => {
251+
map((transactionsDTO: TransactionInfoDTO[]) => {
244252
return transactionsDTO.map((transactionDTO) => {
245253
return CreateTransactionFromDTO(transactionDTO);
246254
});
@@ -260,7 +268,7 @@ export class AccountHttp extends Http implements AccountRepository {
260268
this.queryParams(queryParams).pageSize,
261269
this.queryParams(queryParams).id,
262270
this.queryParams(queryParams).order)).pipe(
263-
map((transactionsDTO: api.TransactionInfoDTO[]) => {
271+
map((transactionsDTO: TransactionInfoDTO[]) => {
264272
return transactionsDTO.map((transactionDTO) => {
265273
return CreateTransactionFromDTO(transactionDTO);
266274
});
@@ -281,7 +289,7 @@ export class AccountHttp extends Http implements AccountRepository {
281289
this.queryParams(queryParams).pageSize,
282290
this.queryParams(queryParams).id,
283291
this.queryParams(queryParams).order)).pipe(
284-
map((transactionsDTO: api.TransactionInfoDTO[]) => {
292+
map((transactionsDTO: TransactionInfoDTO[]) => {
285293
return transactionsDTO.map((transactionDTO) => {
286294
return CreateTransactionFromDTO(transactionDTO);
287295
});
@@ -301,7 +309,7 @@ export class AccountHttp extends Http implements AccountRepository {
301309
this.queryParams(queryParams).pageSize,
302310
this.queryParams(queryParams).id,
303311
this.queryParams(queryParams).order)).pipe(
304-
map((transactionsDTO: api.TransactionInfoDTO[]) => {
312+
map((transactionsDTO: TransactionInfoDTO[]) => {
305313
return transactionsDTO.map((transactionDTO) => {
306314
return CreateTransactionFromDTO(transactionDTO) as AggregateTransaction;
307315
});

0 commit comments

Comments
 (0)