Skip to content

Commit 8dc12f3

Browse files
committed
- Refactored mosaic property
- Changed account transactions to use Address - Fixed tests
1 parent 6b8c7b3 commit 8dc12f3

Some content is hidden

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

42 files changed

+429
-468
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('AccountHttp', () => {
134134
const registerNamespaceTransaction = NamespaceRegistrationTransaction.createRootNamespace(
135135
Deadline.create(),
136136
namespaceName,
137-
UInt64.fromUint(5),
137+
UInt64.fromUint(9),
138138
NetworkType.MIJIN_TEST,
139139
);
140140
namespaceId = new NamespaceId(namespaceName);
@@ -306,7 +306,7 @@ describe('AccountHttp', () => {
306306
describe('getMultisigAccountGraphInfo', () => {
307307
it('should call getMultisigAccountGraphInfo successfully', (done) => {
308308
setTimeout(() => {
309-
accountHttp.getMultisigAccountGraphInfo(multisigAccount.publicAccount).subscribe((multisigAccountGraphInfo) => {
309+
accountHttp.getMultisigAccountGraphInfo(multisigAccount.publicAccount.address).subscribe((multisigAccountGraphInfo) => {
310310
expect(multisigAccountGraphInfo.multisigAccounts.get(0)![0].
311311
account.publicKey).to.be.equal(multisigAccount.publicKey);
312312
done();
@@ -317,7 +317,7 @@ describe('AccountHttp', () => {
317317
describe('getMultisigAccountInfo', () => {
318318
it('should call getMultisigAccountInfo successfully', (done) => {
319319
setTimeout(() => {
320-
accountHttp.getMultisigAccountInfo(multisigAccount.publicAccount).subscribe((multisigAccountInfo) => {
320+
accountHttp.getMultisigAccountInfo(multisigAccount.publicAccount.address).subscribe((multisigAccountInfo) => {
321321
expect(multisigAccountInfo.account.publicKey).to.be.equal(multisigAccount.publicKey);
322322
done();
323323
});
@@ -327,7 +327,7 @@ describe('AccountHttp', () => {
327327

328328
describe('outgoingTransactions', () => {
329329
it('should call outgoingTransactions successfully', (done) => {
330-
accountHttp.outgoingTransactions(publicAccount).subscribe((transactions) => {
330+
accountHttp.outgoingTransactions(publicAccount.address).subscribe((transactions) => {
331331
expect(transactions.length).to.be.greaterThan(0);
332332
done();
333333
});
@@ -336,7 +336,7 @@ describe('AccountHttp', () => {
336336

337337
describe('aggregateBondedTransactions', () => {
338338
it('should call aggregateBondedTransactions successfully', (done) => {
339-
accountHttp.aggregateBondedTransactions(publicAccount).subscribe(() => {
339+
accountHttp.aggregateBondedTransactions(publicAccount.address).subscribe(() => {
340340
done();
341341
}, (error) => {
342342
console.log('Error:', error);
@@ -347,7 +347,7 @@ describe('AccountHttp', () => {
347347

348348
describe('transactions', () => {
349349
it('should call transactions successfully', (done) => {
350-
accountHttp.transactions(publicAccount).subscribe((transactions) => {
350+
accountHttp.transactions(publicAccount.address).subscribe((transactions) => {
351351
expect(transactions.length).to.be.greaterThan(0);
352352
done();
353353
});
@@ -356,7 +356,7 @@ describe('AccountHttp', () => {
356356

357357
describe('unconfirmedTransactions', () => {
358358
it('should call unconfirmedTransactions successfully', (done) => {
359-
accountHttp.unconfirmedTransactions(publicAccount).subscribe((transactions) => {
359+
accountHttp.unconfirmedTransactions(publicAccount.address).subscribe((transactions) => {
360360
expect(transactions.length).to.be.equal(0);
361361
done();
362362
});

e2e/infrastructure/Listener.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ describe('Listener', () => {
281281
});
282282
it('aggregateBondedTransactionsRemoved', (done) => {
283283
listener.confirmed(cosignAccount1.address).subscribe((res) => {
284-
listener.aggregateBondedRemoved(cosignAccount1.address).subscribe((res) => {
284+
listener.aggregateBondedRemoved(cosignAccount1.address).subscribe(() => {
285285
done();
286286
});
287-
listener.aggregateBondedAdded(cosignAccount1.address).subscribe((res) => {
288-
accountHttp.aggregateBondedTransactions(cosignAccount1.publicAccount).subscribe((transactions) => {
287+
listener.aggregateBondedAdded(cosignAccount1.address).subscribe(() => {
288+
accountHttp.aggregateBondedTransactions(cosignAccount1.publicAccount.address).subscribe((transactions) => {
289289
const transactionToCosign = transactions[0];
290290
TransactionUtils.cosignTransaction(transactionToCosign, cosignAccount2, transactionHttp);
291291
});
@@ -321,11 +321,11 @@ describe('Listener', () => {
321321
return listener.close();
322322
});
323323
it('cosignatureAdded', (done) => {
324-
listener.cosignatureAdded(cosignAccount1.address).subscribe((res) => {
324+
listener.cosignatureAdded(cosignAccount1.address).subscribe(() => {
325325
done();
326326
});
327-
listener.aggregateBondedAdded(cosignAccount1.address).subscribe((res) => {
328-
accountHttp.aggregateBondedTransactions(cosignAccount1.publicAccount).subscribe((transactions) => {
327+
listener.aggregateBondedAdded(cosignAccount1.address).subscribe(() => {
328+
accountHttp.aggregateBondedTransactions(cosignAccount1.publicAccount.address).subscribe((transactions) => {
329329
const transactionToCosign = transactions[0];
330330
TransactionUtils.cosignTransaction(transactionToCosign, cosignAccount2, transactionHttp);
331331
});

e2e/infrastructure/MosaicHttp.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('MosaicHttp', () => {
7878
supplyMutable: true,
7979
transferable: true,
8080
divisibility: 3,
81+
duration: UInt64.fromUint(0),
8182
}),
8283
NetworkType.MIJIN_TEST,
8384
);

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import { NamespaceHttp } from '../../src/infrastructure/infrastructure';
2525
import {Listener} from '../../src/infrastructure/Listener';
2626
import {TransactionHttp} from '../../src/infrastructure/TransactionHttp';
2727
import {Account} from '../../src/model/account/Account';
28-
import { AccountRestrictionType } from '../../src/model/account/AccountRestrictionType';
2928
import { AccountRestrictionModificationAction } from '../../src/model/account/AccountRestrictionModificationAction';
29+
import { AccountRestrictionType } from '../../src/model/account/AccountRestrictionType';
3030
import {NetworkType} from '../../src/model/blockchain/NetworkType';
3131
import { Mosaic } from '../../src/model/mosaic/Mosaic';
3232
import {MosaicId} from '../../src/model/mosaic/MosaicId';
@@ -190,6 +190,7 @@ describe('TransactionHttp', () => {
190190
supplyMutable: true,
191191
transferable: true,
192192
divisibility: 3,
193+
duration: UInt64.fromUint(0),
193194
restrictable: true,
194195
}),
195196
NetworkType.MIJIN_TEST,
@@ -2118,7 +2119,7 @@ describe('TransactionHttp', () => {
21182119

21192120
describe('transactions', () => {
21202121
it('should call transactions successfully', (done) => {
2121-
accountHttp.transactions(account.publicAccount).subscribe((transactions) => {
2122+
accountHttp.transactions(account.publicAccount.address).subscribe((transactions) => {
21222123
const transaction = transactions[0];
21232124
transactionId = transaction.transactionInfo!.id;
21242125
transactionHash = transaction.transactionInfo!.hash;

e2e/infrastructure/transaction/ValidateTransaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ const ValidateTransaction = {
136136
expect(registerNamespaceTransaction.namespaceName)
137137
.to.be.equal(registerNamespaceTransactionDTO.transaction.name);
138138
deepEqual(registerNamespaceTransaction.namespaceId,
139-
new NamespaceId(registerNamespaceTransactionDTO.transaction.namespaceId));
139+
new NamespaceId(UInt64.fromHex(registerNamespaceTransactionDTO.transaction.namespaceId).toDTO()));
140140

141141
if (registerNamespaceTransaction.namespaceType === 0) {
142142
deepEqual(registerNamespaceTransaction.duration,
143143
new UInt64(registerNamespaceTransactionDTO.transaction.duration));
144144
} else {
145145
deepEqual(registerNamespaceTransaction.parentId,
146-
new NamespaceId(registerNamespaceTransactionDTO.transaction.parentId));
146+
new NamespaceId(UInt64.fromHex(registerNamespaceTransactionDTO.transaction.parentId).toDTO()));
147147
}
148148
},
149149
validateTransferTx: (transferTransaction, transferTransactionDTO) => {

src/infrastructure/AccountHttp.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ export class AccountHttp extends Http implements AccountRepository {
207207
}
208208
/**
209209
* Gets a MultisigAccountInfo for an account.
210-
* @param publicAccount - User public account
210+
* @param address - * Address can be created rawAddress or publicKey
211211
* @returns Observable<MultisigAccountInfo>
212212
*/
213-
public getMultisigAccountInfo(publicAccount: PublicAccount): Observable<MultisigAccountInfo> {
213+
public getMultisigAccountInfo(address: Address): Observable<MultisigAccountInfo> {
214214
return this.getNetworkTypeObservable().pipe(
215215
mergeMap((networkType) => observableFrom(
216-
this.accountRoutesApi.getAccountMultisig(publicAccount.publicKey))
216+
this.accountRoutesApi.getAccountMultisig(address.plain()))
217217
.pipe(map((response: { response: ClientResponse; body: MultisigAccountInfoDTO; }) => {
218218
const multisigAccountInfoDTO = response.body;
219219
return new MultisigAccountInfo(
@@ -232,13 +232,13 @@ export class AccountHttp extends Http implements AccountRepository {
232232

233233
/**
234234
* Gets a MultisigAccountGraphInfo for an account.
235-
* @param publicAccount - User publicAccount
235+
* @param address - * Address can be created rawAddress or publicKey
236236
* @returns Observable<MultisigAccountGraphInfo>
237237
*/
238-
public getMultisigAccountGraphInfo(publicAccount: PublicAccount): Observable<MultisigAccountGraphInfo> {
238+
public getMultisigAccountGraphInfo(address: Address): Observable<MultisigAccountGraphInfo> {
239239
return this.getNetworkTypeObservable().pipe(
240240
mergeMap((networkType) => observableFrom(
241-
this.accountRoutesApi.getAccountMultisigGraph(publicAccount.publicKey))
241+
this.accountRoutesApi.getAccountMultisigGraph(address.plain()))
242242
.pipe(map((response: { response: ClientResponse; body: MultisigAccountGraphInfoDTO[]; }) => {
243243
const multisigAccountGraphInfosDTO = response.body;
244244
const multisigAccounts = new Map<number, MultisigAccountInfo[]>();
@@ -265,13 +265,13 @@ export class AccountHttp extends Http implements AccountRepository {
265265

266266
/**
267267
* Gets an array of confirmed transactions for which an account is signer or receiver.
268-
* @param publicAccount - User public account
268+
* @param address - * Address can be created rawAddress or publicKey
269269
* @param queryParams - (Optional) Query params
270270
* @returns Observable<Transaction[]>
271271
*/
272-
public transactions(publicAccount: PublicAccount, queryParams?: QueryParams): Observable<Transaction[]> {
272+
public transactions(address: Address, queryParams?: QueryParams): Observable<Transaction[]> {
273273
return observableFrom(
274-
this.accountRoutesApi.transactions(publicAccount.publicKey,
274+
this.accountRoutesApi.transactions(address.plain(),
275275
this.queryParams(queryParams).pageSize,
276276
this.queryParams(queryParams).id,
277277
this.queryParams(queryParams).order)).pipe(
@@ -288,13 +288,13 @@ export class AccountHttp extends Http implements AccountRepository {
288288
/**
289289
* Gets an array of transactions for which an account is the recipient of a transaction.
290290
* A transaction is said to be incoming with respect to an account if the account is the recipient of a transaction.
291-
* @param publicAccount - User public account
291+
* @param address - * Address can be created rawAddress or publicKey
292292
* @param queryParams - (Optional) Query params
293293
* @returns Observable<Transaction[]>
294294
*/
295-
public incomingTransactions(publicAccount: PublicAccount, queryParams?: QueryParams): Observable <Transaction[]> {
295+
public incomingTransactions(address: Address, queryParams?: QueryParams): Observable <Transaction[]> {
296296
return observableFrom(
297-
this.accountRoutesApi.incomingTransactions(publicAccount.publicKey,
297+
this.accountRoutesApi.incomingTransactions(address.plain(),
298298
this.queryParams(queryParams).pageSize,
299299
this.queryParams(queryParams).id,
300300
this.queryParams(queryParams).order)).pipe(
@@ -311,13 +311,13 @@ export class AccountHttp extends Http implements AccountRepository {
311311
/**
312312
* Gets an array of transactions for which an account is the sender a transaction.
313313
* A transaction is said to be outgoing with respect to an account if the account is the sender of a transaction.
314-
* @param publicAccount - User public account
314+
* @param address - * Address can be created rawAddress or publicKey
315315
* @param queryParams - (Optional) Query params
316316
* @returns Observable<Transaction[]>
317317
*/
318-
public outgoingTransactions(publicAccount: PublicAccount, queryParams?: QueryParams): Observable <Transaction[]> {
318+
public outgoingTransactions(address: Address, queryParams?: QueryParams): Observable <Transaction[]> {
319319
return observableFrom(
320-
this.accountRoutesApi.outgoingTransactions(publicAccount.publicKey,
320+
this.accountRoutesApi.outgoingTransactions(address.plain(),
321321
this.queryParams(queryParams).pageSize,
322322
this.queryParams(queryParams).id,
323323
this.queryParams(queryParams).order)).pipe(
@@ -335,13 +335,13 @@ export class AccountHttp extends Http implements AccountRepository {
335335
* Gets the array of transactions for which an account is the sender or receiver and which have not yet been included in a block.
336336
* Unconfirmed transactions are those transactions that have not yet been included in a block.
337337
* Unconfirmed transactions are not guaranteed to be included in any block.
338-
* @param publicAccount - User public account
338+
* @param address - * Address can be created rawAddress or publicKey
339339
* @param queryParams - (Optional) Query params
340340
* @returns Observable<Transaction[]>
341341
*/
342-
public unconfirmedTransactions(publicAccount: PublicAccount, queryParams?: QueryParams): Observable <Transaction[]> {
342+
public unconfirmedTransactions(address: Address, queryParams?: QueryParams): Observable <Transaction[]> {
343343
return observableFrom(
344-
this.accountRoutesApi.unconfirmedTransactions(publicAccount.publicKey,
344+
this.accountRoutesApi.unconfirmedTransactions(address.plain(),
345345
this.queryParams(queryParams).pageSize,
346346
this.queryParams(queryParams).id,
347347
this.queryParams(queryParams).order)).pipe(
@@ -358,13 +358,13 @@ export class AccountHttp extends Http implements AccountRepository {
358358
/**
359359
* Gets an array of transactions for which an account is the sender or has sign the transaction.
360360
* A transaction is said to be aggregate bonded with respect to an account if there are missing signatures.
361-
* @param publicAccount - User public account
361+
* @param address - * Address can be created rawAddress or publicKey
362362
* @param queryParams - (Optional) Query params
363363
* @returns Observable<AggregateTransaction[]>
364364
*/
365-
public aggregateBondedTransactions(publicAccount: PublicAccount, queryParams?: QueryParams): Observable <AggregateTransaction[]> {
365+
public aggregateBondedTransactions(address: Address, queryParams?: QueryParams): Observable <AggregateTransaction[]> {
366366
return observableFrom(
367-
this.accountRoutesApi.partialTransactions(publicAccount.publicKey,
367+
this.accountRoutesApi.partialTransactions(address.plain(),
368368
this.queryParams(queryParams).pageSize,
369369
this.queryParams(queryParams).id,
370370
this.queryParams(queryParams).order)).pipe(

0 commit comments

Comments
 (0)