@@ -64,6 +64,7 @@ import {
6464import { ORDER_MAPPING_CHANNEL } from '~@/constant/channel' ;
6565import { Order } from '~@/shared/types/channel/order' ;
6666import { sleep } from '../shared/helpers/time' ;
67+ import { TRANSACTION_TIME_TO_LIVE } from '~@/config/constant.config' ;
6768
6869@Injectable ( )
6970export class ChannelService {
@@ -82,7 +83,7 @@ export class ChannelService {
8283 channelOpenInitOperator ,
8384 constructedAddress ,
8485 ) ;
85- const validToTime = Date . now ( ) + 2e4 ;
86+ const validToTime = Date . now ( ) + TRANSACTION_TIME_TO_LIVE ;
8687 const validToSlot = unixTimeToSlot ( this . lucidService . lucid . config ( ) . network , Number ( validToTime ) ) ;
8788 const currentSlot = this . lucidService . lucid . currentSlot ( ) ;
8889 if ( currentSlot > validToSlot ) {
@@ -126,7 +127,7 @@ export class ChannelService {
126127 channelOpenTryOperator ,
127128 constructedAddress ,
128129 ) ;
129- const validToTime = Date . now ( ) + 2e4 ;
130+ const validToTime = Date . now ( ) + TRANSACTION_TIME_TO_LIVE ;
130131 const unsignedChannelOpenTryTxValidTo : TxBuilder = unsignedChannelOpenTryTx . validTo ( validToTime ) ;
131132 // TODO: signing should be done by the relayer in the future
132133 const signedChannelOpenTryTxCompleted = await ( await unsignedChannelOpenTryTxValidTo . complete ( ) ) . sign
@@ -160,7 +161,7 @@ export class ChannelService {
160161 channelOpenAckOperator ,
161162 constructedAddress ,
162163 ) ;
163- const validToTime = Date . now ( ) + 2e4 ;
164+ const validToTime = Date . now ( ) + TRANSACTION_TIME_TO_LIVE ;
164165 const validToSlot = unixTimeToSlot ( this . lucidService . lucid . config ( ) . network , Number ( validToTime ) ) ;
165166 const currentSlot = this . lucidService . lucid . currentSlot ( ) ;
166167 if ( currentSlot > validToSlot ) {
@@ -201,7 +202,7 @@ export class ChannelService {
201202 channelOpenConfirmOperator ,
202203 constructedAddress ,
203204 ) ;
204- const validToTime = Date . now ( ) + 2e4 ;
205+ const validToTime = Date . now ( ) + TRANSACTION_TIME_TO_LIVE ;
205206 const unsignedChannelConfirmInitTxValidTo : TxBuilder = unsignedChannelConfirmInitTx . validTo ( validToTime ) ;
206207
207208 // TODO: signing should be done by the relayer in the future
@@ -243,7 +244,7 @@ export class ChannelService {
243244 channelCloseInitOperator ,
244245 constructedAddress ,
245246 ) ;
246- const validToTime = Date . now ( ) + 2e4 ;
247+ const validToTime = Date . now ( ) + TRANSACTION_TIME_TO_LIVE ;
247248 const unsignedChannelCloseInitTxValidTo : TxBuilder = unsignedChannelCloseInitTx . validTo ( validToTime ) ;
248249
249250 // TODO: signing should be done by the relayer in the future
0 commit comments