1414 * limitations under the License.
1515 */
1616
17+ import { Observable } from 'rxjs/internal/Observable' ;
18+ import { of } from 'rxjs/internal/observable/of' ;
19+ import { map } from 'rxjs/internal/operators/map' ;
20+ import { mergeMap } from 'rxjs/internal/operators/mergeMap' ;
1721import { Convert } from '../../core/format' ;
1822import { AmountDto } from '../../infrastructure/catbuffer/AmountDto' ;
1923import { BlockDurationDto } from '../../infrastructure/catbuffer/BlockDurationDto' ;
@@ -25,10 +29,12 @@ import { SignatureDto } from '../../infrastructure/catbuffer/SignatureDto';
2529import { TimestampDto } from '../../infrastructure/catbuffer/TimestampDto' ;
2630import { UnresolvedMosaicBuilder } from '../../infrastructure/catbuffer/UnresolvedMosaicBuilder' ;
2731import { UnresolvedMosaicIdDto } from '../../infrastructure/catbuffer/UnresolvedMosaicIdDto' ;
32+ import { NamespaceHttp } from '../../infrastructure/NamespaceHttp' ;
2833import { PublicAccount } from '../account/PublicAccount' ;
2934import { NetworkType } from '../blockchain/NetworkType' ;
3035import { Mosaic } from '../mosaic/Mosaic' ;
3136import { MosaicId } from '../mosaic/MosaicId' ;
37+ import { NamespaceId } from '../namespace/NamespaceId' ;
3238import { UInt64 } from '../UInt64' ;
3339import { Deadline } from './Deadline' ;
3440import { InnerTransaction } from './InnerTransaction' ;
@@ -50,6 +56,7 @@ export class LockFundsTransaction extends Transaction {
5056 * Aggregate bonded hash.
5157 */
5258 public readonly hash : string ;
59+ signedTransaction : SignedTransaction ;
5360
5461 /**
5562 * Create a Lock funds transaction object
@@ -108,6 +115,7 @@ export class LockFundsTransaction extends Transaction {
108115 transactionInfo ?: TransactionInfo ) {
109116 super ( TransactionType . LOCK , networkType , version , deadline , maxFee , signature , signer , transactionInfo ) ;
110117 this . hash = signedTransaction . hash ;
118+ this . signedTransaction = signedTransaction ;
111119 if ( signedTransaction . type !== TransactionType . AGGREGATE_BONDED ) {
112120 throw new Error ( 'Signed transaction must be Aggregate Bonded Transaction' ) ;
113121 }
@@ -200,4 +208,42 @@ export class LockFundsTransaction extends Transaction {
200208 ) ;
201209 return transactionBuilder . serialize ( ) ;
202210 }
211+
212+ /**
213+ * @internal
214+ * @param namespaceHttp NamespaceHttp
215+ * @returns {LockFundsTransaction }
216+ */
217+ resolveAliases ( namespaceHttp : NamespaceHttp ) : Observable < LockFundsTransaction > {
218+ return of ( this . mosaic ) . pipe (
219+ mergeMap ( ( mosaic ) => mosaic . id instanceof NamespaceId ?
220+ namespaceHttp . getLinkedMosaicId ( mosaic . id ) . pipe (
221+ map ( ( mosaicId ) => new LockFundsTransaction (
222+ this . networkType ,
223+ this . version ,
224+ this . deadline ,
225+ this . maxFee ,
226+ new Mosaic ( mosaicId , mosaic . amount ) ,
227+ this . duration ,
228+ this . signedTransaction ,
229+ this . signature ,
230+ this . signer ,
231+ this . transactionInfo ,
232+ ) ) ,
233+ ) :
234+ of ( new LockFundsTransaction (
235+ this . networkType ,
236+ this . version ,
237+ this . deadline ,
238+ this . maxFee ,
239+ mosaic ,
240+ this . duration ,
241+ this . signedTransaction ,
242+ this . signature ,
243+ this . signer ,
244+ this . transactionInfo ,
245+ ) ) ,
246+ ) ,
247+ ) ;
248+ }
203249}
0 commit comments