|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -import { |
18 |
| - NamespaceCreationTransaction as RegisterNamespaceTransactionLibrary, |
19 |
| - subnamespaceNamespaceId, |
20 |
| - subnamespaceParentId, |
21 |
| - VerifiableTransaction, |
22 |
| -} from 'nem2-library'; |
23 |
| -import {PublicAccount} from '../account/PublicAccount'; |
24 |
| -import {NetworkType} from '../blockchain/NetworkType'; |
25 |
| -import {NamespaceId} from '../namespace/NamespaceId'; |
26 |
| -import {NamespaceType} from '../namespace/NamespaceType'; |
27 |
| -import {UInt64} from '../UInt64'; |
28 |
| -import {Deadline} from './Deadline'; |
29 |
| -import {Transaction} from './Transaction'; |
30 |
| -import {TransactionInfo} from './TransactionInfo'; |
31 |
| -import {TransactionType} from './TransactionType'; |
| 17 | +import { NamespaceCreationTransaction as RegisterNamespaceTransactionLibrary, subnamespaceNamespaceId, subnamespaceParentId, VerifiableTransaction } from 'nem2-library'; |
| 18 | +import { PublicAccount } from '../account/PublicAccount'; |
| 19 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 20 | +import { NamespaceId } from '../namespace/NamespaceId'; |
| 21 | +import { NamespaceType } from '../namespace/NamespaceType'; |
| 22 | +import { UInt64 } from '../UInt64'; |
| 23 | +import { Deadline } from './Deadline'; |
| 24 | +import { Transaction } from './Transaction'; |
| 25 | +import { TransactionInfo } from './TransactionInfo'; |
| 26 | +import { TransactionType } from './TransactionType'; |
32 | 27 |
|
33 | 28 | /**
|
34 | 29 | * Accounts can rent a namespace for an amount of blocks and after a this renew the contract.
|
@@ -155,4 +150,30 @@ export class RegisterNamespaceTransaction extends Transaction {
|
155 | 150 |
|
156 | 151 | return registerNamespacetransaction.build();
|
157 | 152 | }
|
| 153 | + |
| 154 | + /** |
| 155 | + * @description re-aplly a given value to the transaction in an immutable way |
| 156 | + * @param {Deadline} deadline |
| 157 | + * @returns {Transaction} |
| 158 | + * @memberof Transaction |
| 159 | + */ |
| 160 | + public reaplygiven(newDeadline: Deadline): RegisterNamespaceTransaction { |
| 161 | + |
| 162 | + if (this.isUnannounced) { |
| 163 | + return new RegisterNamespaceTransaction( |
| 164 | + this.networkType, |
| 165 | + this.version, |
| 166 | + newDeadline, |
| 167 | + this.fee, |
| 168 | + this.namespaceType, |
| 169 | + this.namespaceName, |
| 170 | + this.namespaceId, |
| 171 | + this.duration, |
| 172 | + this.parentId, |
| 173 | + this.signature, |
| 174 | + this.signer); |
| 175 | + } else { |
| 176 | + throw new Error('Should not modify an announced transaction'); |
| 177 | + } |
| 178 | + } |
158 | 179 | }
|
0 commit comments