@@ -44,58 +44,72 @@ pub enum StacksTransactionEvent {
4444}
4545
4646impl StacksTransactionEvent {
47- pub fn json_serialize ( & self , txid : & Txid , committed : bool ) -> serde_json:: Value {
47+ pub fn json_serialize (
48+ & self ,
49+ event_index : usize ,
50+ txid : & Txid ,
51+ committed : bool ,
52+ ) -> serde_json:: Value {
4853 match self {
4954 StacksTransactionEvent :: SmartContractEvent ( event_data) => json ! ( {
5055 "txid" : format!( "0x{:?}" , txid) ,
56+ "event_index" : event_index,
5157 "committed" : committed,
5258 "type" : "contract_event" ,
5359 "contract_event" : event_data. json_serialize( )
5460 } ) ,
5561 StacksTransactionEvent :: STXEvent ( STXEventType :: STXTransferEvent ( event_data) ) => json ! ( {
5662 "txid" : format!( "0x{:?}" , txid) ,
63+ "event_index" : event_index,
5764 "committed" : committed,
5865 "type" : "stx_transfer_event" ,
5966 "stx_transfer_event" : event_data. json_serialize( )
6067 } ) ,
6168 StacksTransactionEvent :: STXEvent ( STXEventType :: STXMintEvent ( event_data) ) => json ! ( {
6269 "txid" : format!( "0x{:?}" , txid) ,
70+ "event_index" : event_index,
6371 "committed" : committed,
6472 "type" : "stx_mint_event" ,
6573 "stx_mint_event" : event_data. json_serialize( )
6674 } ) ,
6775 StacksTransactionEvent :: STXEvent ( STXEventType :: STXBurnEvent ( event_data) ) => json ! ( {
6876 "txid" : format!( "0x{:?}" , txid) ,
77+ "event_index" : event_index,
6978 "committed" : committed,
7079 "type" : "stx_burn_event" ,
7180 "stx_burn_event" : event_data. json_serialize( )
7281 } ) ,
7382 StacksTransactionEvent :: STXEvent ( STXEventType :: STXLockEvent ( event_data) ) => json ! ( {
7483 "txid" : format!( "0x{:?}" , txid) ,
84+ "event_index" : event_index,
7585 "committed" : committed,
7686 "type" : "stx_lock_event" ,
7787 "stx_lock_event" : event_data. json_serialize( )
7888 } ) ,
7989 StacksTransactionEvent :: NFTEvent ( NFTEventType :: NFTTransferEvent ( event_data) ) => json ! ( {
8090 "txid" : format!( "0x{:?}" , txid) ,
91+ "event_index" : event_index,
8192 "committed" : committed,
8293 "type" : "nft_transfer_event" ,
8394 "nft_transfer_event" : event_data. json_serialize( )
8495 } ) ,
8596 StacksTransactionEvent :: NFTEvent ( NFTEventType :: NFTMintEvent ( event_data) ) => json ! ( {
8697 "txid" : format!( "0x{:?}" , txid) ,
98+ "event_index" : event_index,
8799 "committed" : committed,
88100 "type" : "nft_mint_event" ,
89101 "nft_mint_event" : event_data. json_serialize( )
90102 } ) ,
91103 StacksTransactionEvent :: FTEvent ( FTEventType :: FTTransferEvent ( event_data) ) => json ! ( {
92104 "txid" : format!( "0x{:?}" , txid) ,
105+ "event_index" : event_index,
93106 "committed" : committed,
94107 "type" : "ft_transfer_event" ,
95108 "ft_transfer_event" : event_data. json_serialize( )
96109 } ) ,
97110 StacksTransactionEvent :: FTEvent ( FTEventType :: FTMintEvent ( event_data) ) => json ! ( {
98111 "txid" : format!( "0x{:?}" , txid) ,
112+ "event_index" : event_index,
99113 "committed" : committed,
100114 "type" : "ft_mint_event" ,
101115 "ft_mint_event" : event_data. json_serialize( )
@@ -160,13 +174,15 @@ impl STXMintEventData {
160174pub struct STXLockEventData {
161175 pub locked_amount : u128 ,
162176 pub unlock_height : u64 ,
177+ pub locked_address : PrincipalData ,
163178}
164179
165180impl STXLockEventData {
166181 pub fn json_serialize ( & self ) -> serde_json:: Value {
167182 json ! ( {
168183 "locked_amount" : format!( "{}" , self . locked_amount) ,
169184 "unlock_height" : format!( "{}" , self . unlock_height) ,
185+ "locked_address" : format!( "{}" , self . locked_address) ,
170186 } )
171187 }
172188}
@@ -180,7 +196,7 @@ pub struct STXBurnEventData {
180196impl STXBurnEventData {
181197 pub fn json_serialize ( & self ) -> serde_json:: Value {
182198 json ! ( {
183- "sender" : format!( "{}" , self . sender) ,
199+ "sender" : format!( "{}" , self . sender) ,
184200 "amount" : format!( "{}" , self . amount) ,
185201 } )
186202 }
0 commit comments