1
- import { UtxoSeed } from '../db/entities/utxo '
1
+ import { BorkType , BorkTxData , UtxoId , NewUtxo } from 'borker-rs-node '
2
2
3
- export enum TransactionType {
4
- setName = 'set_name' ,
5
- setBio = 'set_bio' ,
6
- setAvatar = 'set_avatar' ,
7
- bork = 'bork' ,
8
- comment = 'comment' ,
9
- rebork = 'rebork' ,
10
- extension = 'extension' ,
11
- delete = 'delete' ,
12
- like = 'like' ,
13
- unlike = 'unlike' ,
14
- flag = 'flag' ,
15
- unflag = 'unflag' ,
16
- follow = 'follow' ,
17
- unfollow = 'unfollow' ,
18
- block = 'block' ,
19
- unblock = 'unblock' ,
3
+ export function getMockBorkerTxs ( blockHeight : number ) {
4
+ if ( blockHeight === 17903 ) {
5
+ return mockTxs1
6
+ } else if ( blockHeight === 17904 ) {
7
+ return mockTxs2
8
+ } else if ( blockHeight === 17905 ) {
9
+ return mockTxs3
10
+ } else if ( blockHeight === 17906 ) {
11
+ return mockTxs4
12
+ } else {
13
+ return [ ]
14
+ }
20
15
}
21
16
22
- export interface BorkerTx {
23
- time : number
24
- txid : string
25
- type : TransactionType
26
- nonce : number | null
27
- index : number | null
28
- content : string | null
29
- referenceId : string | null
30
- senderAddress : string
31
- recipientAddress : string | null
32
- mentions : string [ ]
17
+ export function getMockCreated ( blockHeight : number ) {
18
+ if ( blockHeight === 17903 ) {
19
+ return mockCreated1
20
+ } else if ( blockHeight === 17904 ) {
21
+ return mockCreated2
22
+ } else if ( blockHeight === 17905 ) {
23
+ return mockCreated3
24
+ } else if ( blockHeight === 17906 ) {
25
+ return mockCreated4
26
+ } else {
27
+ return [ ]
28
+ }
33
29
}
34
30
35
- export interface Spent {
36
- txid : string
37
- index : number
31
+ export function getMockSpent ( blockHeight : number ) {
32
+ if ( blockHeight === 17903 ) {
33
+ return mockSpent1
34
+ } else if ( blockHeight === 17904 ) {
35
+ return mockSpent2
36
+ } else if ( blockHeight === 17905 ) {
37
+ return mockSpent3
38
+ } else if ( blockHeight === 17906 ) {
39
+ return mockSpent4
40
+ } else {
41
+ return [ ]
42
+ }
38
43
}
39
44
40
- export const mockTxs1 : BorkerTx [ ] = [
45
+ export const mockTxs1 : BorkTxData [ ] = [
41
46
{
42
- time : 1412177231000 ,
47
+ time : '2019-05-28T00:51:39Z' ,
43
48
txid : '39128e8edacce1ada4e1df9aa5fc91431302ef951df06a78e13f4fbc3759e752' ,
44
- type : TransactionType . setName ,
49
+ type : BorkType . SetName ,
45
50
nonce : null ,
46
51
index : null ,
47
52
content : 'MattHill' ,
@@ -51,9 +56,9 @@ export const mockTxs1: BorkerTx[] = [
51
56
mentions : [ ] ,
52
57
} ,
53
58
{
54
- time : 1422182926000 ,
59
+ time : '2019-05-28T00:51:39Z' ,
55
60
txid : '8b5ab18a8593ba3f1abae61c07bf02169487c58b0e244922b6c4578eaf6e0d35' ,
56
- type : TransactionType . bork ,
61
+ type : BorkType . Bork ,
57
62
nonce : 14 ,
58
63
index : 0 ,
59
64
content : 'I like to bork. I like to bork' ,
@@ -63,9 +68,9 @@ export const mockTxs1: BorkerTx[] = [
63
68
mentions : [ ] ,
64
69
} ,
65
70
{
66
- time : 1422184977000 ,
71
+ time : '2019-05-28T00:51:39Z' ,
67
72
txid : '774bef2197e6394112e1ee18246f1a0137ddb19a4d2d4464c1e25217977a0460' ,
68
- type : TransactionType . rebork ,
73
+ type : BorkType . Rebork ,
69
74
nonce : 10 ,
70
75
index : 0 ,
71
76
content : null ,
@@ -75,9 +80,9 @@ export const mockTxs1: BorkerTx[] = [
75
80
mentions : [ ] ,
76
81
} ,
77
82
{
78
- time : 1423181711000 ,
83
+ time : '2019-05-28T00:51:39Z' ,
79
84
txid : '43873bcc83d6d811df6bff1909a5cd3fc98eb84bbaded5a44443fc86f9ef0e3b' ,
80
- type : TransactionType . bork ,
85
+ type : BorkType . Bork ,
81
86
nonce : 0 ,
82
87
index : 0 ,
83
88
content : 'Bork some more. Bork some more. #Tomorrow' ,
@@ -88,9 +93,9 @@ export const mockTxs1: BorkerTx[] = [
88
93
} ,
89
94
// this extension will be orphaned and then cleaned up later
90
95
{
91
- time : 1424967192200 ,
96
+ time : '2019-05-28T00:51:39Z' ,
92
97
txid : '89520b2306424bb8704ac63adbb03311f5d3fd4bd2deb72dbe40bfbfc219a5ba' ,
93
- type : TransactionType . extension ,
98
+ type : BorkType . Extension ,
94
99
nonce : 156 ,
95
100
index : 1 ,
96
101
content : 'extension that was orphaned for a while' ,
@@ -101,11 +106,11 @@ export const mockTxs1: BorkerTx[] = [
101
106
} ,
102
107
]
103
108
104
- export const mockTxs2 : BorkerTx [ ] = [
109
+ export const mockTxs2 : BorkTxData [ ] = [
105
110
{
106
- time : 1424167335000 ,
111
+ time : '2019-05-28T00:51:39Z' ,
107
112
txid : '069aa2f138cbdc6ebd379b1e6d1cb7f86c8770ad58be27006671d528a75ba0e3' ,
108
- type : TransactionType . bork ,
113
+ type : BorkType . Bork ,
109
114
nonce : 222 ,
110
115
index : 0 ,
111
116
content : 'Borking like there aint no #tomorrow' ,
@@ -115,9 +120,9 @@ export const mockTxs2: BorkerTx[] = [
115
120
mentions : [ ] ,
116
121
} ,
117
122
{
118
- time : 1424169440000 ,
123
+ time : '2019-05-28T00:51:39Z' ,
119
124
txid : '41266e19b39dbba35128f3af72299b4636cb9250d81741b5db1987716043a7af' ,
120
- type : TransactionType . rebork ,
125
+ type : BorkType . Rebork ,
121
126
nonce : 25 ,
122
127
index : 0 ,
123
128
content : 'This is a rebork with a comment...' ,
@@ -127,9 +132,9 @@ export const mockTxs2: BorkerTx[] = [
127
132
mentions : [ ] ,
128
133
} ,
129
134
{
130
- time : 1424561124000 ,
135
+ time : '2019-05-28T00:51:39Z' ,
131
136
txid : '99f14aa1ac661f932113cbb92cfa7ee1cfc649cbc416f7c6aa43b13ce301d3a4' ,
132
- type : TransactionType . comment ,
137
+ type : BorkType . Comment ,
133
138
nonce : 100 ,
134
139
index : 0 ,
135
140
content : 'And some more!' ,
@@ -139,9 +144,9 @@ export const mockTxs2: BorkerTx[] = [
139
144
mentions : [ ] ,
140
145
} ,
141
146
{
142
- time : 1424967992000 ,
147
+ time : '2019-05-28T00:51:39Z' ,
143
148
txid : '164af924f859c9936f3bda737a986a1a85b3708c9b2fd150b36b964b11c858a6' ,
144
- type : TransactionType . bork ,
149
+ type : BorkType . Bork ,
145
150
nonce : 211 ,
146
151
index : 0 ,
147
152
content : 'This is a long bork that will take up two whole transactions. I will write' ,
@@ -151,9 +156,9 @@ export const mockTxs2: BorkerTx[] = [
151
156
mentions : [ ] ,
152
157
} ,
153
158
{
154
- time : 1424967992200 ,
159
+ time : '2019-05-28T00:51:39Z' ,
155
160
txid : 'e3b3a8bf7e3796d908b731c0d16baba0f1e161b97d917e00cde81ff0f1452fd1' ,
156
- type : TransactionType . extension ,
161
+ type : BorkType . Extension ,
157
162
nonce : 211 ,
158
163
index : 1 ,
159
164
content : 'just a little more. See, I told you. Bork on.' ,
@@ -163,9 +168,9 @@ export const mockTxs2: BorkerTx[] = [
163
168
mentions : [ 'DSJdZogGLmREMZTyJGSzSs2RL9UJjeqKd7' ] ,
164
169
} ,
165
170
{
166
- time : 1425188584000 ,
171
+ time : '2019-05-28T00:51:39Z' ,
167
172
txid : '3ffa42642f6dfd718562b8a6d04c403b20b59fe873eadd1960e402769cee1318' ,
168
- type : TransactionType . follow ,
173
+ type : BorkType . Follow ,
169
174
nonce : null ,
170
175
index : null ,
171
176
content : 'DSJdZogGLmREMZTyJGSzSs2RL9UJjeqKd7' ,
@@ -176,11 +181,11 @@ export const mockTxs2: BorkerTx[] = [
176
181
} ,
177
182
]
178
183
179
- export const mockTxs3 : BorkerTx [ ] = [
184
+ export const mockTxs3 : BorkTxData [ ] = [
180
185
{
181
- time : 1425287522000 ,
186
+ time : '2019-05-28T00:51:39Z' ,
182
187
txid : '4cb6f18366e4a32ff69e681d192aec89a4d8721af544725fe6a02ecde4311605' ,
183
- type : TransactionType . setName ,
188
+ type : BorkType . SetName ,
184
189
nonce : null ,
185
190
index : null ,
186
191
content : 'aiden_mcclelland' ,
@@ -190,9 +195,9 @@ export const mockTxs3: BorkerTx[] = [
190
195
mentions : [ ] ,
191
196
} ,
192
197
{
193
- time : 1424967392200 ,
198
+ time : '2019-05-28T00:51:39Z' ,
194
199
txid : 'a21f4c7f2aa418aea0a72e34aa753d5aa0bd77918053da3fe06ecb54145657f2' ,
195
- type : TransactionType . comment ,
200
+ type : BorkType . Comment ,
196
201
nonce : 156 ,
197
202
index : 0 ,
198
203
content : 'Wow that was so borking cool. Now I will create an' ,
@@ -202,9 +207,9 @@ export const mockTxs3: BorkerTx[] = [
202
207
mentions : [ ] ,
203
208
} ,
204
209
{
205
- time : 1425399510000 ,
210
+ time : '2019-05-28T00:51:39Z' ,
206
211
txid : '8a3e0fe9ebc5e2fec31b12e7880f0dc184b56fd2d0541fcc3e6c0a1530826913' ,
207
- type : TransactionType . setBio ,
212
+ type : BorkType . SetBio ,
208
213
nonce : null ,
209
214
index : null ,
210
215
content : 'I am a Bork Master' ,
@@ -214,9 +219,9 @@ export const mockTxs3: BorkerTx[] = [
214
219
mentions : [ ] ,
215
220
} ,
216
221
{
217
- time : 1426287533000 ,
222
+ time : '2019-05-28T00:51:39Z' ,
218
223
txid : 'c7c4e2977cc67cc16ee8fec757a61219deddcc8edfb6e20ab818af29f4be9373' ,
219
- type : TransactionType . follow ,
224
+ type : BorkType . Follow ,
220
225
nonce : null ,
221
226
index : null ,
222
227
content : 'D65dwxsVdaCFHUGqAVWKgdddsa9ADxXcGk' ,
@@ -227,11 +232,11 @@ export const mockTxs3: BorkerTx[] = [
227
232
} ,
228
233
]
229
234
230
- export const mockTxs4 : BorkerTx [ ] = [
235
+ export const mockTxs4 : BorkTxData [ ] = [
231
236
{
232
- time : 1425287522000 ,
237
+ time : '2019-05-28T00:51:39Z' ,
233
238
txid : '0b692b4e683a3ea47f0b3b6a6f30e8cca6efcc78f1c2eb6e35430af9b9415eb5' ,
234
- type : TransactionType . setBio ,
239
+ type : BorkType . SetBio ,
235
240
nonce : null ,
236
241
index : null ,
237
242
content : 'I am the unknown Borker who shall someday be known' ,
@@ -241,9 +246,9 @@ export const mockTxs4: BorkerTx[] = [
241
246
mentions : [ ] ,
242
247
} ,
243
248
{
244
- time : 1426287533000 ,
249
+ time : '2019-05-28T00:51:39Z' ,
245
250
txid : '3a7f46861703322b75fed4594cd94eb9c04c5a6edb0c1e4ecd1eb91ba2fc4304' ,
246
- type : TransactionType . block ,
251
+ type : BorkType . Block ,
247
252
nonce : null ,
248
253
index : null ,
249
254
content : 'DG7z89QMNB7xJr7Z44TwZPd8BUFSBoamW7' ,
@@ -253,9 +258,9 @@ export const mockTxs4: BorkerTx[] = [
253
258
mentions : [ ] ,
254
259
} ,
255
260
{
256
- time : 1425399510000 ,
261
+ time : '2019-05-28T00:51:39Z' ,
257
262
txid : '20d721480d0450a1b9666618ee618bfbacde74a4bade40908063c6c344bc7214' ,
258
- type : TransactionType . unfollow ,
263
+ type : BorkType . Unfollow ,
259
264
nonce : null ,
260
265
index : null ,
261
266
content : 'D65dwxsVdaCFHUGqAVWKgdddsa9ADxXcGk' ,
@@ -265,9 +270,9 @@ export const mockTxs4: BorkerTx[] = [
265
270
mentions : [ ] ,
266
271
} ,
267
272
{
268
- time : 1426287533000 ,
273
+ time : '2019-05-28T00:51:39Z' ,
269
274
txid : '2d9509c33a8e93152a42f2aa048404b304ba858dc0ad8f305ba16223781d46fc' ,
270
- type : TransactionType . like ,
275
+ type : BorkType . Like ,
271
276
nonce : null ,
272
277
index : null ,
273
278
content : null ,
@@ -277,9 +282,9 @@ export const mockTxs4: BorkerTx[] = [
277
282
mentions : [ ] ,
278
283
} ,
279
284
{
280
- time : 1426287533000 ,
285
+ time : '2019-05-28T00:51:39Z' ,
281
286
txid : 'f93162e896c44fae41c75b66f2c1aa2eeb6e7de54a21b89075f99a90f582434e' ,
282
- type : TransactionType . like ,
287
+ type : BorkType . Like ,
283
288
nonce : null ,
284
289
index : null ,
285
290
content : null ,
@@ -290,9 +295,9 @@ export const mockTxs4: BorkerTx[] = [
290
295
} ,
291
296
// this comment will be left orphaned
292
297
{
293
- time : 1426287533000 ,
298
+ time : '2019-05-28T00:51:39Z' ,
294
299
txid : '2312757481a28100402f71e788d2922f9aae766af10dda0b28dfd7dd858e15a1' ,
295
- type : TransactionType . comment ,
300
+ type : BorkType . Comment ,
296
301
nonce : 14 ,
297
302
index : 0 ,
298
303
content : 'a poor orphaned comment' ,
@@ -302,9 +307,9 @@ export const mockTxs4: BorkerTx[] = [
302
307
mentions : [ ] ,
303
308
} ,
304
309
{
305
- time : 1426287677000 ,
310
+ time : '2019-05-28T00:51:39Z' ,
306
311
txid : '59a6a9cd14fb864a048b87ef006d168c345943edc1bc54e462694ac42c90cd04' ,
307
- type : TransactionType . flag ,
312
+ type : BorkType . Flag ,
308
313
nonce : null ,
309
314
index : null ,
310
315
content : 'a21f4c7f2aa418aea0a72e34aa753d5aa0bd77918053da3fe06ecb54145657f2' ,
@@ -315,9 +320,9 @@ export const mockTxs4: BorkerTx[] = [
315
320
} ,
316
321
// this flag will not save because sender is blocked
317
322
{
318
- time : 1426287677000 ,
323
+ time : '2019-05-28T00:51:39Z' ,
319
324
txid : '59a6a9cd14fb864a048b87ef006d168c345943edc1bc54e462694ac42c90cd04' ,
320
- type : TransactionType . flag ,
325
+ type : BorkType . Flag ,
321
326
nonce : null ,
322
327
index : null ,
323
328
content : 'a21f4c7f2aa418aea0a72e34aa753d5aa0bd77918053da3fe06ecb54145657f2' ,
@@ -328,7 +333,7 @@ export const mockTxs4: BorkerTx[] = [
328
333
} ,
329
334
]
330
335
331
- export const mockCreated1 : UtxoSeed [ ] = [
336
+ export const mockCreated1 : NewUtxo [ ] = [
332
337
{
333
338
txid : '89da78a5802eb72ba3ae4e12654b10b0223221f7f76ac915f5636394a8c463e7' ,
334
339
address : 'D65dwxsVdaCFHUGqAVWKgdddsa9ADxXcGk' ,
@@ -360,7 +365,7 @@ export const mockCreated1: UtxoSeed[] = [
360
365
} ,
361
366
]
362
367
363
- export const mockCreated2 : UtxoSeed [ ] = [
368
+ export const mockCreated2 : NewUtxo [ ] = [
364
369
{
365
370
txid : '41266e19b39dbba35128f3af72299b4636cb9250d81741b5db1987716043a7af' ,
366
371
address : 'DSJdZogGLmREMZTyJGSzSs2RL9UJjeqKd7' ,
@@ -385,7 +390,7 @@ export const mockCreated2: UtxoSeed[] = [
385
390
} ,
386
391
]
387
392
388
- export const mockCreated3 : UtxoSeed [ ] = [
393
+ export const mockCreated3 : NewUtxo [ ] = [
389
394
{
390
395
txid : 'a21f4c7f2aa418aea0a72e34aa753d5aa0bd77918053da3fe06ecb54145657f2' ,
391
396
address : 'D65dwxsVdaCFHUGqAVWKgdddsa9ADxXcGk' ,
@@ -395,7 +400,7 @@ export const mockCreated3: UtxoSeed[] = [
395
400
} ,
396
401
]
397
402
398
- export const mockCreated4 : UtxoSeed [ ] = [
403
+ export const mockCreated4 : NewUtxo [ ] = [
399
404
{
400
405
txid : '2d9509c33a8e93152a42f2aa048404b304ba858dc0ad8f305ba16223781d46fc' ,
401
406
address : 'D65dwxsVdaCFHUGqAVWKgdddsa9ADxXcGk' ,
@@ -412,16 +417,16 @@ export const mockCreated4: UtxoSeed[] = [
412
417
} ,
413
418
]
414
419
415
- export const mockSpent1 : Spent [ ] = [ ]
420
+ export const mockSpent1 : UtxoId [ ] = [ ]
416
421
417
- export const mockSpent2 : Spent [ ] = [
422
+ export const mockSpent2 : UtxoId [ ] = [
418
423
{
419
424
txid : '89da78a5802eb72ba3ae4e12654b10b0223221f7f76ac915f5636394a8c463e7' ,
420
425
index : 0 ,
421
426
} ,
422
427
]
423
428
424
- export const mockSpent3 : Spent [ ] = [
429
+ export const mockSpent3 : UtxoId [ ] = [
425
430
{
426
431
txid : '774bef2197e6394112e1ee18246f1a0137ddb19a4d2d4464c1e25217977a0460' ,
427
432
index : 1 ,
@@ -436,7 +441,7 @@ export const mockSpent3: Spent[] = [
436
441
} ,
437
442
]
438
443
439
- export const mockSpent4 : Spent [ ] = [
444
+ export const mockSpent4 : UtxoId [ ] = [
440
445
{
441
446
txid : '' ,
442
447
index : 0 ,
0 commit comments