@@ -2,18 +2,12 @@ import { EventHandler } from '@libp2p/interfaces/events';
2
2
import { ZeroAddress } from 'ethers' ;
3
3
import { DateTime } from 'luxon' ;
4
4
import { RequestQuery , OfferOptions , contractConfig , serverAddress } from '../shared/index.js' ;
5
- import {
6
- createNode ,
7
- Node ,
8
- NodeOptions ,
9
- Queue ,
10
- OfferData ,
11
- createJobHandler ,
12
- } from '../../src/index.js' ;
5
+ import { createNode , Node , NodeOptions , Queue , createJobHandler } from '../../src/index.js' ;
6
+ import { OfferData } from '../../src/shared/types.js' ;
13
7
import { noncePeriod } from '../../src/constants.js' ;
14
8
import { memoryStorage } from '../../src/storage/index.js' ;
15
9
import { nowSec , parseSeconds } from '../../src/utils/time.js' ;
16
- import { supplierId as generateSupplierId , randomSalt , simpleUid } from '../../src/utils/uid.js' ;
10
+ import { supplierId as generateSupplierId , randomSalt } from '../../src/utils/uid.js' ;
17
11
import { generateMnemonic , deriveAccount } from '../../src/utils/wallet.js' ;
18
12
import { RequestEvent } from '../../src/node/requestManager.js' ;
19
13
import { createLogger } from '../../src/utils/logger.js' ;
@@ -94,7 +88,7 @@ const createRequestsHandler =
94
88
*/
95
89
payment : [
96
90
{
97
- id : simpleUid ( ) ,
91
+ id : randomSalt ( ) ,
98
92
price : '1' ,
99
93
asset : ZeroAddress ,
100
94
} ,
@@ -108,6 +102,7 @@ const createRequestsHandler =
108
102
] ,
109
103
/** Check-in time */
110
104
checkIn : nowSec ( ) + 1000 ,
105
+ checkOut : nowSec ( ) + 2000 ,
111
106
} ) ;
112
107
113
108
queue . addEventListener ( 'expired' , ( { detail : job } ) => {
@@ -119,7 +114,7 @@ const createRequestsHandler =
119
114
* So, we add a job for detection of deals
120
115
*/
121
116
queue . addJob ( 'deal' , offer , {
122
- expire : offer . expire ,
117
+ expire : Number ( offer . expire ) ,
123
118
every : 5000 , // 5 sec
124
119
} ) ;
125
120
} ;
@@ -145,7 +140,7 @@ const main = async (): Promise<void> => {
145
140
topics : [ 'hello' ] ,
146
141
contractConfig,
147
142
serverAddress,
148
- noncePeriod : parseSeconds ( noncePeriod ) ,
143
+ noncePeriod : Number ( parseSeconds ( noncePeriod ) ) ,
149
144
supplierId,
150
145
signerSeedPhrase : signerMnemonic ,
151
146
} ;
0 commit comments