Skip to content

Commit 380be82

Browse files
committed
reapply given for namespace
1 parent b804926 commit 380be82

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

src/model/transaction/RegisterNamespaceTransaction.ts

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

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';
3227

3328
/**
3429
* 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 {
155150

156151
return registerNamespacetransaction.build();
157152
}
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+
}
158179
}

0 commit comments

Comments
 (0)