|
| 1 | +/* |
| 2 | + * Copyright 2019 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 | + * Account restriction type |
| 19 | + * 0x01 Account restriction type is an address. |
| 20 | + * 0x02 Account restriction type is a mosaic id. |
| 21 | + * 0x04 Account restriction type is a transaction type. |
| 22 | + * 0x05 restriction type sentinel. |
| 23 | + * 0x40 Account restriction is interpreted as outgoing restriction. |
| 24 | + * 0x80 Account restriction is interpreted as blocking operation. |
| 25 | + */ |
| 26 | + |
| 27 | + // !!This enum will be deprecated once catbuffer code applied. |
| 28 | +enum AccountRestrictionTypeEnum { |
| 29 | + Address = 0x01, |
| 30 | + Mosaic = 0x02, |
| 31 | + TransactionType = 0x04, |
| 32 | + Sentinel = 0x05, |
| 33 | + Outgoing = 0x40, |
| 34 | + Block = 0x80, |
| 35 | +} |
| 36 | + |
| 37 | +export enum AccountRestrictionType { |
| 38 | + /** |
| 39 | + * Allow only incoming transactions from a given address. |
| 40 | + */ |
| 41 | + AllowIncomingAddress = AccountRestrictionTypeEnum.Address, |
| 42 | + |
| 43 | + /** |
| 44 | + * Allow only incoming transactions containing a a given mosaic identifier. |
| 45 | + */ |
| 46 | + AllowMosaic = AccountRestrictionTypeEnum.Mosaic, |
| 47 | + |
| 48 | + /** |
| 49 | + * Allow only outgoing transactions with a given transaction type. |
| 50 | + */ |
| 51 | + AllowIncomingTransactionType = AccountRestrictionTypeEnum.TransactionType, |
| 52 | + |
| 53 | + /** |
| 54 | + * Allow only outgoing transactions to a given address. |
| 55 | + */ |
| 56 | + AllowOutgoingAddress = (AccountRestrictionTypeEnum.Address + AccountRestrictionTypeEnum.Outgoing), |
| 57 | + |
| 58 | + /** |
| 59 | + * Allow only outgoing transactions with a given transaction type. |
| 60 | + */ |
| 61 | + AllowOutgoingTransactionType = (AccountRestrictionTypeEnum.TransactionType + |
| 62 | + AccountRestrictionTypeEnum.Outgoing), |
| 63 | + |
| 64 | + /** |
| 65 | + * Block incoming transactions from a given address. |
| 66 | + */ |
| 67 | + BlockIncomingAddress = (AccountRestrictionTypeEnum.Address + AccountRestrictionTypeEnum.Block), |
| 68 | + |
| 69 | + /** |
| 70 | + * Block incoming transactions containing a given mosaic identifier. |
| 71 | + */ |
| 72 | + BlockMosaic = (AccountRestrictionTypeEnum.Mosaic + AccountRestrictionTypeEnum.Block), |
| 73 | + |
| 74 | + /** |
| 75 | + * Block incoming transactions with a given transaction type. |
| 76 | + */ |
| 77 | + BlockIncomingTransactionType = (AccountRestrictionTypeEnum.TransactionType + |
| 78 | + AccountRestrictionTypeEnum.Block), |
| 79 | + |
| 80 | + /** |
| 81 | + * Block outgoing transactions from a given address. |
| 82 | + */ |
| 83 | + BlockOutgoingAddress = (AccountRestrictionTypeEnum.Address + |
| 84 | + AccountRestrictionTypeEnum.Block + |
| 85 | + AccountRestrictionTypeEnum.Outgoing), |
| 86 | + /** |
| 87 | + * Block outgoing transactions with a given transaction type. |
| 88 | + */ |
| 89 | + BlockOutgoingTransactionType = (AccountRestrictionTypeEnum.TransactionType + |
| 90 | + AccountRestrictionTypeEnum.Block + |
| 91 | + AccountRestrictionTypeEnum.Outgoing), |
| 92 | + |
| 93 | + /** |
| 94 | + * Account restriction sentinel. |
| 95 | + */ |
| 96 | + Sentinel = AccountRestrictionTypeEnum.Sentinel, |
| 97 | +} |
0 commit comments