Skip to content

Commit fa69d07

Browse files
author
Grégory Saive
authored
Merge pull request #121 from aleixmorgadas/master
Added Order to QueryParameters
2 parents 4a8daa3 + 9b497bb commit fa69d07

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

e2e/infrastructure/transaction/CreateTransactionFromDTO.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,53 @@ describe('CreateTransactionFromDTO', () => {
7171
ValidateTransaction.validateStandaloneTx(transferTransaction, transferTransactionDTO);
7272
});
7373

74+
it('standalone without message', () => {
75+
const transferTransactionDTO = {
76+
meta: {
77+
hash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219',
78+
height: [
79+
1,
80+
0,
81+
],
82+
id: '59FDA0733F17CF0001772CA7',
83+
index: 19,
84+
merkleComponentHash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219',
85+
},
86+
transaction: {
87+
deadline: [
88+
10000,
89+
0,
90+
],
91+
fee: [
92+
0,
93+
0,
94+
],
95+
mosaics: [
96+
{
97+
amount: [
98+
3863990592,
99+
95248,
100+
],
101+
id: [
102+
3646934825,
103+
3576016193,
104+
],
105+
},
106+
],
107+
recipient: '9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142',
108+
signature: '553E696EB4A54E43A11D180EBA57E4B89D0048C9DD2604A9E0608120018B9E0' +
109+
'2F6EE63025FEEBCED3293B622AF8581334D0BDAB7541A9E7411E7EE4EF0BC5D0E',
110+
signer: 'B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF',
111+
type: 16724,
112+
version: 36867,
113+
},
114+
};
115+
116+
const transferTransaction = CreateTransactionFromDTO(transferTransactionDTO);
117+
118+
ValidateTransaction.validateStandaloneTx(transferTransaction, transferTransactionDTO);
119+
});
120+
74121
it('aggregate', () => {
75122
const aggregateTransferTransactionDTO = {
76123
meta: {

src/infrastructure/QueryParams.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17+
/**
18+
* @since 0.11.3
19+
*/
20+
export enum Order {
21+
ASC = 'id',
22+
DESC = '-id',
23+
}
24+
25+
1726
/**
1827
* The query params structure describes pagination params for requests.
1928
*
@@ -34,7 +43,14 @@ export class QueryParams {
3443
/**
3544
* Id after which we want objects to be returned
3645
*/
37-
public readonly id?: string) {
46+
public readonly id?: string,
47+
/**
48+
* Order of transactions.
49+
* DESC. Newer to older.
50+
* ASC. Older to newer.
51+
*/
52+
public readonly order: Order = Order.DESC,
53+
) {
3854
this.pageSize = (pageSize >= 10 && pageSize <= 100) ? pageSize : 10;
3955
this.id = id;
4056
}

src/infrastructure/transaction/CreateTransactionFromDTO.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo): Tr
125125
UInt64.fromUint(transactionDTO.maxFee || 0),
126126
extractRecipient(transactionDTO.recipient),
127127
extractMosaics(transactionDTO.mosaics),
128-
extractMessage(transactionDTO.message.payload),
128+
extractMessage(transactionDTO.message !== undefined ? transactionDTO.message.payload : undefined),
129129
transactionDTO.signature,
130130
transactionDTO.signer ? PublicAccount.createFromPublicKey(transactionDTO.signer,
131131
extractNetworkType(transactionDTO.version)) : undefined,

0 commit comments

Comments
 (0)