Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions e2e/service/MosaicRestrictionTransactionService.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, expect } from 'chai';
import { KeyGenerator } from '../../src/core/format/KeyGenerator';
import { Listener } from '../../src/infrastructure/Listener';
import { RestrictionHttp } from '../../src/infrastructure/RestrictionHttp';
import { TransactionHttp } from '../../src/infrastructure/TransactionHttp';
Expand All @@ -19,7 +20,7 @@ import { MosaicRestrictionTransactionService } from '../../src/service/MosaicRes

describe('MosaicRestrictionTransactionService', () => {
const deadline = Deadline.create();
const key = '9876543';
const key = KeyGenerator.generateUInt64Key('TestKey');
let targetAccount: Account;
let account: Account;
let restrictionHttp: RestrictionHttp;
Expand Down Expand Up @@ -98,7 +99,7 @@ describe('MosaicRestrictionTransactionService', () => {
const mosaicGlobalRestrictionTransaction = MosaicGlobalRestrictionTransaction.create(
Deadline.create(),
mosaicId,
UInt64.fromNumericString(key),
key,
UInt64.fromUint(0),
MosaicRestrictionType.NONE,
UInt64.fromUint(0),
Expand Down Expand Up @@ -132,7 +133,7 @@ describe('MosaicRestrictionTransactionService', () => {
const mosaicAddressRestrictionTransaction = MosaicAddressRestrictionTransaction.create(
Deadline.create(),
mosaicId,
UInt64.fromNumericString(key),
key,
targetAccount.address,
UInt64.fromUint(2),
NetworkType.MIJIN_TEST,
Expand Down Expand Up @@ -177,7 +178,7 @@ describe('MosaicRestrictionTransactionService', () => {
expect(transaction.previousRestrictionType).to.be.equal(MosaicRestrictionType.GE);
expect(transaction.newRestrictionValue.toString()).to.be.equal('1');
expect(transaction.newRestrictionType).to.be.equal(MosaicRestrictionType.GE);
expect(transaction.restrictionKey.toString()).to.be.equal(key);
expect(transaction.restrictionKey.toHex()).to.be.equal(key.toHex());
done();
});
});
Expand All @@ -196,7 +197,7 @@ describe('MosaicRestrictionTransactionService', () => {
expect(transaction.previousRestrictionValue.toString()).to.be.equal('2');
expect(transaction.newRestrictionValue.toString()).to.be.equal('3');
expect(transaction.targetAddress.plain()).to.be.equal(targetAccount.address.plain());
expect(transaction.restrictionKey.toString()).to.be.equal(key);
expect(transaction.restrictionKey.toHex()).to.be.equal(key.toHex());
done();
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/infrastructure/NamespaceHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ export class NamespaceHttp extends Http implements NamespaceRepository {
*/
private extractAlias(namespace: any): Alias {
if (namespace.alias && namespace.alias.type === AliasType.Mosaic) {
return new MosaicAlias(namespace.alias.mosaicId);
return new MosaicAlias(new MosaicId(namespace.alias.mosaicId));
} else if (namespace.alias && namespace.alias.type === AliasType.Address) {
return new AddressAlias(namespace.alias.address);
return new AddressAlias(Address.createFromEncoded(namespace.alias.address));
}

return new EmptyAlias();
Expand Down
8 changes: 4 additions & 4 deletions src/infrastructure/RestrictionHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class RestrictionHttp extends Http implements RestrictionRepository {
});
return new MosaicAddressRestriction(
payload.compositeHash,
payload.entryType,
payload.entryType.valueOf(),
new MosaicId(payload.mosaicId),
Address.createFromEncoded(payload.targetAddress),
restirctionItems,
Expand Down Expand Up @@ -140,7 +140,7 @@ export class RestrictionHttp extends Http implements RestrictionRepository {
});
return new MosaicAddressRestriction(
payload.mosaicRestrictionEntry.compositeHash,
payload.mosaicRestrictionEntry.entryType,
payload.mosaicRestrictionEntry.entryType.valueOf(),
new MosaicId(payload.mosaicRestrictionEntry.mosaicId),
Address.createFromEncoded(payload.mosaicRestrictionEntry.targetAddress),
restirctionItems,
Expand Down Expand Up @@ -168,7 +168,7 @@ export class RestrictionHttp extends Http implements RestrictionRepository {
new MosaicGlobalRestrictionItem(
new MosaicId(restriction.restriction.referenceMosaicId),
restriction.restriction.restrictionValue,
restriction.restriction.restrictionType,
restriction.restriction.restrictionType.valueOf(),
)));
return new MosaicGlobalRestriction(
payload.compositeHash,
Expand Down Expand Up @@ -202,7 +202,7 @@ export class RestrictionHttp extends Http implements RestrictionRepository {
new MosaicGlobalRestrictionItem(
new MosaicId(restriction.restriction.referenceMosaicId),
restriction.restriction.restrictionValue,
restriction.restriction.restrictionType,
restriction.restriction.restrictionType.valueOf(),
)));
return new MosaicGlobalRestriction(
payload.mosaicRestrictionEntry.compositeHash,
Expand Down
4 changes: 1 addition & 3 deletions src/infrastructure/api/accountRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -262,8 +262,6 @@ export class AccountRoutesApi {
statusMessage: response.statusMessage,
}, body: response.body });
}

reject();
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/blockRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/chainRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/diagnosticRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/metadataRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
126 changes: 125 additions & 1 deletion src/infrastructure/api/mosaicRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand All @@ -29,6 +29,7 @@ import localVarRequest = require('request');
import http = require('http');

/* tslint:disable:no-unused-locals */
import { AccountIds } from '../model/accountIds';
import { ModelError } from '../model/modelError';
import { MosaicIds } from '../model/mosaicIds';
import { MosaicInfoDTO } from '../model/mosaicInfoDTO';
Expand Down Expand Up @@ -205,6 +206,129 @@ export class MosaicRoutesApi {
});
});
}
/**
* Gets an array of mosaics created for a given account address.
* @summary Get mosaics created by an account
* @param accountId Account public key or address.
* @param pageSize Number of transactions to return for each request.
* @param id Mosaic identifier up to which transactions are returned.
*/
public async getMosaicsFromAccount (accountId: string, pageSize?: number, id?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<MosaicInfoDTO>; }> {
const localVarPath = this.basePath + '/account/{accountId}/mosaics'
.replace('{' + 'accountId' + '}', encodeURIComponent(String(accountId)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};

// 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 getMosaicsFromAccount.');
}

if (pageSize !== undefined) {
localVarQueryParameters['pageSize'] = ObjectSerializer.serialize(pageSize, "number");
}

if (id !== undefined) {
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string");
}

(<any>Object).assign(localVarHeaderParams, options.headers);

let localVarUseFormData = false;

let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};

let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
return authenticationPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: Array<MosaicInfoDTO>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<MosaicInfoDTO>");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: {
statusCode: response.statusCode,
statusMessage: response.statusMessage,
}, body: response.body });
}
}
});
});
});
}
/**
* Gets mosaics created for a given array of addresses.
* @summary Get mosaics created for given array of addresses
* @param accountIds
*/
public async getMosaicsFromAccounts (accountIds?: AccountIds, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<MosaicInfoDTO>; }> {
const localVarPath = this.basePath + '/account/mosaics';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};

(<any>Object).assign(localVarHeaderParams, options.headers);

let localVarUseFormData = false;

let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(accountIds, "AccountIds")
};

let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
return authenticationPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body: Array<MosaicInfoDTO>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<MosaicInfoDTO>");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: {
statusCode: response.statusCode,
statusMessage: response.statusMessage,
}, body: response.body });
}
}
});
});
});
}
/**
* Returns friendly names for mosaics.
* @summary Get readable names for a set of mosaics
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/namespaceRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/networkRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/nodeRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/restrictionRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/api/transactionRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/model/accountDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/model/accountIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Catapult REST Endpoints
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.7.18
* The version of the OpenAPI document: 0.7.19
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Loading