diff --git a/e2e/infrastructure/transaction/CreateTransactionFromDTO.spec.ts b/e2e/infrastructure/transaction/CreateTransactionFromDTO.spec.ts index 5dc958a606..36271517fc 100644 --- a/e2e/infrastructure/transaction/CreateTransactionFromDTO.spec.ts +++ b/e2e/infrastructure/transaction/CreateTransactionFromDTO.spec.ts @@ -71,6 +71,53 @@ describe('CreateTransactionFromDTO', () => { ValidateTransaction.validateStandaloneTx(transferTransaction, transferTransactionDTO); }); + it('standalone without message', () => { + const transferTransactionDTO = { + meta: { + hash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219', + height: [ + 1, + 0, + ], + id: '59FDA0733F17CF0001772CA7', + index: 19, + merkleComponentHash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219', + }, + transaction: { + deadline: [ + 10000, + 0, + ], + fee: [ + 0, + 0, + ], + mosaics: [ + { + amount: [ + 3863990592, + 95248, + ], + id: [ + 3646934825, + 3576016193, + ], + }, + ], + recipient: '9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142', + signature: '553E696EB4A54E43A11D180EBA57E4B89D0048C9DD2604A9E0608120018B9E0' + + '2F6EE63025FEEBCED3293B622AF8581334D0BDAB7541A9E7411E7EE4EF0BC5D0E', + signer: 'B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF', + type: 16724, + version: 36867, + }, + }; + + const transferTransaction = CreateTransactionFromDTO(transferTransactionDTO); + + ValidateTransaction.validateStandaloneTx(transferTransaction, transferTransactionDTO); + }); + it('aggregate', () => { const aggregateTransferTransactionDTO = { meta: { diff --git a/src/infrastructure/QueryParams.ts b/src/infrastructure/QueryParams.ts index 62f6e08290..b1644cf2b3 100644 --- a/src/infrastructure/QueryParams.ts +++ b/src/infrastructure/QueryParams.ts @@ -14,6 +14,15 @@ * limitations under the License. */ + /** + * @since 0.11.3 + */ +export enum Order { + ASC = 'id', + DESC = '-id', +} + + /** * The query params structure describes pagination params for requests. * @@ -34,7 +43,14 @@ export class QueryParams { /** * Id after which we want objects to be returned */ - public readonly id?: string) { + public readonly id?: string, + /** + * Order of transactions. + * DESC. Newer to older. + * ASC. Older to newer. + */ + public readonly order: Order = Order.DESC, + ) { this.pageSize = (pageSize >= 10 && pageSize <= 100) ? pageSize : 10; this.id = id; } diff --git a/src/infrastructure/transaction/CreateTransactionFromDTO.ts b/src/infrastructure/transaction/CreateTransactionFromDTO.ts index 0c0543ad26..415d82d649 100644 --- a/src/infrastructure/transaction/CreateTransactionFromDTO.ts +++ b/src/infrastructure/transaction/CreateTransactionFromDTO.ts @@ -125,7 +125,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo): Tr UInt64.fromUint(transactionDTO.maxFee || 0), extractRecipient(transactionDTO.recipient), extractMosaics(transactionDTO.mosaics), - extractMessage(transactionDTO.message.payload), + extractMessage(transactionDTO.message !== undefined ? transactionDTO.message.payload : undefined), transactionDTO.signature, transactionDTO.signer ? PublicAccount.createFromPublicKey(transactionDTO.signer, extractNetworkType(transactionDTO.version)) : undefined,