Skip to content

Commit 90b3d8c

Browse files
committed
add MessageType
1 parent c513cc5 commit 90b3d8c

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

src/model/transaction/EncryptedMessage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import {crypto} from 'nem2-library';
1818
import {PublicAccount} from '../account/PublicAccount';
1919
import {Message} from './Message';
20+
import {MessageType} from './MessageType';
2021
import {PlainMessage} from './PlainMessage';
2122

2223
/**
@@ -28,7 +29,7 @@ export class EncryptedMessage extends Message {
2829

2930
constructor(payload: string,
3031
recipientPublicAccount?: PublicAccount){
31-
super(1,payload);
32+
super(MessageType.EncryptedMessage,payload);
3233
this.recipientPublicAccount = recipientPublicAccount;
3334
}
3435

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2018 NEM
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* The supply type. Supported supply types are:
19+
* 0: Increase in supply.
20+
* 1: Decrease in supply.
21+
*/
22+
export enum MessageType {
23+
PlainMessage = 0,
24+
EncryptedMessage = 1,
25+
}

src/model/transaction/PlainMessage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import {Message} from './Message';
18+
import {MessageType} from './MessageType';
1819

1920
/**
2021
* The plain message model defines a plain string. When sending it to the network we transform the payload to hex-string.
@@ -40,7 +41,7 @@ export class PlainMessage extends Message {
4041
* @param payload
4142
*/
4243
constructor(payload: string) {
43-
super(0, payload);
44+
super(MessageType.PlainMessage, payload);
4445
}
4546

4647
}

0 commit comments

Comments
 (0)