|
13 | 13 | * See the License for the specific language governing permissions and
|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 |
| -import {SecretProofTransaction as SecretProofTransactionLibrary, VerifiableTransaction} from 'nem2-library'; |
17 |
| -import {PublicAccount} from '../account/PublicAccount'; |
18 |
| -import {NetworkType} from '../blockchain/NetworkType'; |
19 |
| -import {UInt64} from '../UInt64'; |
20 |
| -import {Deadline} from './Deadline'; |
21 |
| -import {HashType, HashTypeLengthValidator} from './HashType'; |
22 |
| -import {Transaction} from './Transaction'; |
23 |
| -import {TransactionInfo} from './TransactionInfo'; |
24 |
| -import {TransactionType} from './TransactionType'; |
| 16 | +import { SecretProofTransaction as SecretProofTransactionLibrary, VerifiableTransaction } from 'nem2-library'; |
| 17 | +import { PublicAccount } from '../account/PublicAccount'; |
| 18 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 19 | +import { UInt64 } from '../UInt64'; |
| 20 | +import { Deadline } from './Deadline'; |
| 21 | +import { HashType, HashTypeLengthValidator } from './HashType'; |
| 22 | +import { Transaction } from './Transaction'; |
| 23 | +import { TransactionInfo } from './TransactionInfo'; |
| 24 | +import { TransactionType } from './TransactionType'; |
25 | 25 |
|
26 | 26 | export class SecretProofTransaction extends Transaction {
|
27 | 27 |
|
@@ -95,4 +95,28 @@ export class SecretProofTransaction extends Transaction {
|
95 | 95 | .addProof(this.proof)
|
96 | 96 | .build();
|
97 | 97 | }
|
| 98 | + |
| 99 | + /** |
| 100 | + * @description re-aplly a given value to the transaction in an immutable way |
| 101 | + * @param {Deadline} deadline |
| 102 | + * @returns {Transaction} |
| 103 | + * @memberof Transaction |
| 104 | + */ |
| 105 | + public reaplygiven(newDeadline: Deadline): SecretProofTransaction { |
| 106 | + |
| 107 | + if (this.isUnannounced) { |
| 108 | + return new SecretProofTransaction( |
| 109 | + this.networkType, |
| 110 | + this.version, |
| 111 | + newDeadline, |
| 112 | + this.fee, |
| 113 | + this.hashType, |
| 114 | + this.secret, |
| 115 | + this.proof, |
| 116 | + this.signature, |
| 117 | + this.signer); |
| 118 | + } else { |
| 119 | + throw new Error('Should not modify an announced transaction'); |
| 120 | + } |
| 121 | + } |
98 | 122 | }
|
0 commit comments