@@ -26,20 +26,20 @@ pub struct TxEvent {
26
26
#[ serde( skip_serializing_if = "Option::is_none" ) ]
27
27
pub space : Option < String > ,
28
28
#[ serde( skip_serializing_if = "Option::is_none" ) ]
29
- pub foreign_input : Option < OutPoint > ,
29
+ pub previous_spaceout : Option < OutPoint > ,
30
30
#[ serde( skip_serializing_if = "Option::is_none" , flatten) ]
31
31
pub details : Option < serde_json:: Value > ,
32
32
}
33
33
34
34
#[ derive( Debug , Serialize , Deserialize ) ]
35
35
pub struct BidEventDetails {
36
- pub bid_current : Amount ,
37
- pub bid_previous : Amount ,
36
+ pub current_bid : Amount ,
37
+ pub previous_bid : Amount ,
38
38
}
39
39
40
40
#[ derive( Debug , Serialize , Deserialize ) ]
41
41
pub struct TransferEventDetails {
42
- pub to : ScriptBuf ,
42
+ pub script_pubkey : ScriptBuf ,
43
43
}
44
44
45
45
#[ derive( Debug , Serialize , Deserialize ) ]
@@ -50,21 +50,21 @@ pub struct BidoutEventDetails {
50
50
#[ derive( Debug , Serialize , Deserialize ) ]
51
51
pub struct SendEventDetails {
52
52
#[ serde( skip_serializing_if = "Option::is_none" ) ]
53
- pub to_space : Option < String > ,
54
- pub script_pubkey : ScriptBuf ,
53
+ pub recipient_space : Option < String > ,
54
+ pub recipient_script_pubkey : ScriptBuf ,
55
55
pub amount : Amount ,
56
56
}
57
57
58
58
#[ derive( Debug , Serialize , Deserialize ) ]
59
59
pub struct OpenEventDetails {
60
- pub bid_initial : Amount ,
60
+ pub initial_bid : Amount ,
61
61
}
62
62
63
63
#[ derive( Debug , Serialize , Deserialize ) ]
64
64
pub struct CommitEventDetails {
65
- pub commit_script_pubkey : protocol:: Bytes ,
65
+ pub script_pubkey : protocol:: Bytes ,
66
66
/// [SpaceScriptSigningInfo] in raw format
67
- pub commit_signing_info : protocol:: Bytes ,
67
+ pub signing_info : protocol:: Bytes ,
68
68
}
69
69
70
70
#[ derive( Debug , Serialize , Deserialize ) ]
@@ -100,7 +100,7 @@ impl TxEvent {
100
100
txid TEXT NOT NULL, \
101
101
type TEXT NOT NULL, \
102
102
space TEXT, \
103
- foreign_input TEXT, \
103
+ previous_spaceout TEXT, \
104
104
details TEXT, \
105
105
created_at INTEGER NOT NULL DEFAULT (strftime('%s','now'))
106
106
) STRICT;" ,
@@ -112,7 +112,7 @@ impl TxEvent {
112
112
113
113
pub fn all ( db_tx : & rusqlite:: Transaction , txid : Txid ) -> rusqlite:: Result < Vec < Self > > {
114
114
let stmt = db_tx. prepare ( & format ! (
115
- "SELECT type, space, foreign_input , details
115
+ "SELECT type, space, previous_spaceout , details
116
116
FROM {} WHERE txid = ?1" ,
117
117
Self :: TX_EVENTS_TABLE_NAME ,
118
118
) ) ?;
@@ -121,7 +121,7 @@ impl TxEvent {
121
121
122
122
pub fn bids ( db_tx : & rusqlite:: Transaction , space : String ) -> rusqlite:: Result < Vec < Self > > {
123
123
let stmt = db_tx. prepare ( & format ! (
124
- "SELECT type, space, foreign_input , details
124
+ "SELECT type, space, previous_spaceout , details
125
125
FROM {} WHERE type = 'bid' AND space = ?1" ,
126
126
Self :: TX_EVENTS_TABLE_NAME ,
127
127
) ) ?;
@@ -138,9 +138,9 @@ impl TxEvent {
138
138
let query_placeholders = txids. iter ( ) . map ( |_| "?" ) . collect :: < Vec < _ > > ( ) . join ( "," ) ;
139
139
140
140
let mut stmt = db_tx. prepare ( & format ! (
141
- "SELECT txid, foreign_input
141
+ "SELECT txid, previous_spaceout
142
142
FROM {}
143
- WHERE foreign_input IS NOT NULL AND type = 'bid' AND txid IN ({})" ,
143
+ WHERE previous_spaceout IS NOT NULL AND type = 'bid' AND txid IN ({})" ,
144
144
Self :: TX_EVENTS_TABLE_NAME ,
145
145
query_placeholders
146
146
) ) ?;
@@ -149,8 +149,8 @@ impl TxEvent {
149
149
rusqlite:: params_from_iter ( txids. into_iter ( ) . map ( |t| Impl ( t) ) ) ,
150
150
|row| {
151
151
let txid: Impl < Txid > = row. get ( 0 ) ?;
152
- let foreign_input : Option < Impl < OutPoint > > = row. get ( 1 ) ?;
153
- Ok ( ( txid, foreign_input . map ( |x| x. 0 ) . unwrap ( ) ) )
152
+ let previous_spaceout : Option < Impl < OutPoint > > = row. get ( 1 ) ?;
153
+ Ok ( ( txid, previous_spaceout . map ( |x| x. 0 ) . unwrap ( ) ) )
154
154
} ,
155
155
) ?;
156
156
let mut results = Vec :: new ( ) ;
@@ -164,7 +164,7 @@ impl TxEvent {
164
164
165
165
pub fn all_bid_txs ( db_tx : & rusqlite:: Transaction , txid : Txid ) -> rusqlite:: Result < Option < Self > > {
166
166
let stmt = db_tx. prepare ( & format ! (
167
- "SELECT type, space, foreign_input , details
167
+ "SELECT type, space, previous_spaceout , details
168
168
FROM {} WHERE type = 'bid' AND txid = ?1" ,
169
169
Self :: TX_EVENTS_TABLE_NAME ,
170
170
) ) ?;
@@ -174,7 +174,7 @@ impl TxEvent {
174
174
175
175
pub fn get_signing_info ( db_tx : & rusqlite:: Transaction , txid : Txid , script_pubkey : & ScriptBuf ) -> rusqlite:: Result < Option < SpaceScriptSigningInfo > > {
176
176
let stmt = db_tx. prepare ( & format ! (
177
- "SELECT type, space, foreign_input , details
177
+ "SELECT type, space, previous_spaceout , details
178
178
FROM {} WHERE type = 'commit' AND txid = ?1" ,
179
179
Self :: TX_EVENTS_TABLE_NAME ,
180
180
) ) ?;
@@ -185,8 +185,8 @@ impl TxEvent {
185
185
let details = result. details . expect ( "signing details in tx event" ) ;
186
186
let details: CommitEventDetails = serde_json:: from_value ( details)
187
187
. expect ( "signing details" ) ;
188
- if details. commit_script_pubkey . as_slice ( ) == script_pubkey. as_bytes ( ) {
189
- let raw = details. commit_signing_info . to_vec ( ) ;
188
+ if details. script_pubkey . as_slice ( ) == script_pubkey. as_bytes ( ) {
189
+ let raw = details. signing_info . to_vec ( ) ;
190
190
let info =
191
191
SpaceScriptSigningInfo :: from_slice ( raw. as_slice ( ) ) . expect ( "valid signing info" ) ;
192
192
return Ok ( Some ( info) )
@@ -200,7 +200,7 @@ impl TxEvent {
200
200
db_tx : & rusqlite:: Transaction ,
201
201
) -> rusqlite:: Result < Vec < ( Txid , TxEvent ) > > {
202
202
let query = format ! (
203
- "SELECT txid, type, space, foreign_input , details
203
+ "SELECT txid, type, space, previous_spaceout , details
204
204
FROM {table}
205
205
WHERE id IN (
206
206
SELECT MAX(id)
@@ -221,7 +221,7 @@ impl TxEvent {
221
221
TxEvent {
222
222
kind : row. get ( "type" ) ?,
223
223
space : row. get ( "space" ) ?,
224
- foreign_input : row. get :: < _ , Option < Impl < OutPoint > > > ( "foreign_input " ) ?. map ( |x| x. 0 ) ,
224
+ previous_spaceout : row. get :: < _ , Option < Impl < OutPoint > > > ( "previous_spaceout " ) ?. map ( |x| x. 0 ) ,
225
225
details : row. get :: < _ , Option < Impl < serde_json:: Value > > > ( "details" ) ?. map ( |x| x. 0 ) ,
226
226
} ,
227
227
) )
@@ -243,18 +243,18 @@ impl TxEvent {
243
243
Ok ( (
244
244
row. get :: < _ , TxEventKind > ( "type" ) ?,
245
245
row. get :: < _ , Option < String > > ( "space" ) ?,
246
- row. get :: < _ , Option < Impl < OutPoint > > > ( "foreign_input " ) ?,
246
+ row. get :: < _ , Option < Impl < OutPoint > > > ( "previous_spaceout " ) ?,
247
247
row. get :: < _ , Option < Impl < serde_json:: Value > > > ( "details" ) ?,
248
248
) )
249
249
} ) ?;
250
250
251
251
let mut events = Vec :: new ( ) ;
252
252
for row in row_iter {
253
- let ( event_type, space, foreign_input , details) = row?;
253
+ let ( event_type, space, previous_spaceout , details) = row?;
254
254
events. push ( TxEvent {
255
255
kind : event_type,
256
256
space,
257
- foreign_input : foreign_input . map ( |x| x. 0 ) ,
257
+ previous_spaceout : previous_spaceout . map ( |x| x. 0 ) ,
258
258
details : details. map ( |x| x. 0 ) ,
259
259
} )
260
260
}
@@ -267,11 +267,11 @@ impl TxEvent {
267
267
txid : Txid ,
268
268
kind : TxEventKind ,
269
269
space : Option < String > ,
270
- foreign_input : Option < OutPoint > ,
270
+ previous_spaceout : Option < OutPoint > ,
271
271
details : Option < serde_json:: Value > ,
272
272
) -> rusqlite:: Result < usize > {
273
273
let query = format ! (
274
- "INSERT INTO {} (txid, type, space, foreign_input , details)
274
+ "INSERT INTO {} (txid, type, space, previous_spaceout , details)
275
275
VALUES (?1, ?2, ?3, ?4, ?5)" ,
276
276
Self :: TX_EVENTS_TABLE_NAME ,
277
277
) ;
@@ -282,7 +282,7 @@ impl TxEvent {
282
282
txid. to_string( ) ,
283
283
kind,
284
284
space,
285
- foreign_input . map( |b| b. to_string( ) ) ,
285
+ previous_spaceout . map( |b| b. to_string( ) ) ,
286
286
details. map( |d| d. to_string( ) )
287
287
] ,
288
288
) ?;
@@ -309,7 +309,7 @@ impl TxRecord {
309
309
self . events . push ( TxEvent {
310
310
kind : TxEventKind :: FeeBump ,
311
311
space : None ,
312
- foreign_input : None ,
312
+ previous_spaceout : None ,
313
313
details : None ,
314
314
} ) ;
315
315
}
@@ -318,25 +318,25 @@ impl TxRecord {
318
318
self . events . push ( TxEvent {
319
319
kind : TxEventKind :: Transfer ,
320
320
space : Some ( space) ,
321
- foreign_input : None ,
322
- details : Some ( serde_json:: to_value ( TransferEventDetails { to } ) . expect ( "json value" ) ) ,
321
+ previous_spaceout : None ,
322
+ details : Some ( serde_json:: to_value ( TransferEventDetails { script_pubkey : to } ) . expect ( "json value" ) ) ,
323
323
} ) ;
324
324
}
325
325
326
326
pub fn add_renew ( & mut self , space : String , to : ScriptBuf ) {
327
327
self . events . push ( TxEvent {
328
328
kind : TxEventKind :: Renew ,
329
329
space : Some ( space) ,
330
- foreign_input : None ,
331
- details : Some ( serde_json:: to_value ( TransferEventDetails { to } ) . expect ( "json value" ) ) ,
330
+ previous_spaceout : None ,
331
+ details : Some ( serde_json:: to_value ( TransferEventDetails { script_pubkey : to } ) . expect ( "json value" ) ) ,
332
332
} ) ;
333
333
}
334
334
335
335
pub fn add_bidout ( & mut self , count : usize ) {
336
336
self . events . push ( TxEvent {
337
337
kind : TxEventKind :: Bidout ,
338
338
space : None ,
339
- foreign_input : None ,
339
+ previous_spaceout : None ,
340
340
details : Some ( serde_json:: to_value ( BidoutEventDetails { count } ) . expect ( "json value" ) ) ,
341
341
} ) ;
342
342
}
@@ -350,11 +350,11 @@ impl TxRecord {
350
350
self . events . push ( TxEvent {
351
351
kind : TxEventKind :: Send ,
352
352
space : None ,
353
- foreign_input : None ,
353
+ previous_spaceout : None ,
354
354
details : Some (
355
355
serde_json:: to_value ( SendEventDetails {
356
- to_space,
357
- script_pubkey : resolved_address,
356
+ recipient_space : to_space,
357
+ recipient_script_pubkey : resolved_address,
358
358
amount,
359
359
} )
360
360
. expect ( "json value" ) ,
@@ -372,11 +372,11 @@ impl TxRecord {
372
372
self . events . push ( TxEvent {
373
373
kind : TxEventKind :: Commit ,
374
374
space : Some ( space) ,
375
- foreign_input : None ,
375
+ previous_spaceout : None ,
376
376
details : Some (
377
377
serde_json:: to_value ( CommitEventDetails {
378
- commit_script_pubkey : protocol:: Bytes :: new ( reveal_address. to_bytes ( ) ) ,
379
- commit_signing_info : protocol:: Bytes :: new ( signing_info) ,
378
+ script_pubkey : protocol:: Bytes :: new ( reveal_address. to_bytes ( ) ) ,
379
+ signing_info : protocol:: Bytes :: new ( signing_info) ,
380
380
} )
381
381
. expect ( "json value" ) ,
382
382
) ,
@@ -387,10 +387,10 @@ impl TxRecord {
387
387
self . events . push ( TxEvent {
388
388
kind : TxEventKind :: Open ,
389
389
space : Some ( space) ,
390
- foreign_input : None ,
390
+ previous_spaceout : None ,
391
391
details : Some (
392
392
serde_json:: to_value ( OpenEventDetails {
393
- bid_initial : initial_bid,
393
+ initial_bid : initial_bid,
394
394
} )
395
395
. expect ( "json value" ) ,
396
396
) ,
@@ -402,7 +402,7 @@ impl TxRecord {
402
402
self . events . push ( TxEvent {
403
403
kind : TxEventKind :: Script ,
404
404
space : Some ( space) ,
405
- foreign_input : None ,
405
+ previous_spaceout : None ,
406
406
details : Some (
407
407
serde_json:: to_value ( ExecuteEventDetails {
408
408
n : reveal_input_index,
@@ -418,12 +418,12 @@ impl TxRecord {
418
418
Covenant :: Bid { total_burned, .. } => total_burned,
419
419
_ => panic ! ( "expected a bid" ) ,
420
420
} ;
421
- let foreign_input = match wallet. is_mine ( previous. spaceout . script_pubkey . clone ( ) ) {
421
+ let previous_spaceout = match wallet. is_mine ( previous. spaceout . script_pubkey . clone ( ) ) {
422
422
false => Some ( previous. outpoint ( ) ) ,
423
423
true => None
424
424
} ;
425
425
426
- if foreign_input . is_some ( ) {
426
+ if previous_spaceout . is_some ( ) {
427
427
self . txouts . push ( ( previous. outpoint ( ) , TxOut {
428
428
value : previous. spaceout . value ,
429
429
script_pubkey : previous. spaceout . script_pubkey . clone ( ) ,
@@ -433,11 +433,11 @@ impl TxRecord {
433
433
self . events . push ( TxEvent {
434
434
kind : TxEventKind :: Bid ,
435
435
space : Some ( space. name . to_string ( ) ) ,
436
- foreign_input ,
436
+ previous_spaceout : previous_spaceout ,
437
437
details : Some (
438
438
serde_json:: to_value ( BidEventDetails {
439
- bid_current : amount,
440
- bid_previous : previous_bid,
439
+ current_bid : amount,
440
+ previous_bid : previous_bid,
441
441
} )
442
442
. expect ( "json value" ) ,
443
443
) ,
0 commit comments