@@ -57,8 +57,8 @@ impl WasmInstanceHandle {
5757 value : & serde_json:: Value ,
5858 user_data : & store:: Value ,
5959 ) -> Result < BlockState , anyhow:: Error > {
60- let value = self . instance ( ) . asc_new ( value) ;
61- let user_data = self . instance ( ) . asc_new ( user_data) ;
60+ let value = self . instance_mut ( ) . asc_new ( value) ;
61+ let user_data = self . instance_mut ( ) . asc_new ( user_data) ;
6262
6363 // Invoke the callback
6464 let func = self
@@ -86,7 +86,7 @@ impl WasmInstanceHandle {
8686 // Decide on the destination type using the mapping
8787 // api version provided in the subgraph manifest
8888 let event = if self . instance ( ) . ctx . host_exports . api_version >= Version :: new ( 0 , 0 , 2 ) {
89- self . instance ( )
89+ self . instance_mut ( )
9090 . asc_new :: < AscEthereumEvent < AscEthereumTransaction_0_0_2 > , _ > ( & EthereumEventData {
9191 block : EthereumBlockData :: from ( block. as_ref ( ) ) ,
9292 transaction : EthereumTransactionData :: from ( transaction. deref ( ) ) ,
@@ -98,7 +98,7 @@ impl WasmInstanceHandle {
9898 } )
9999 . erase ( )
100100 } else {
101- self . instance ( )
101+ self . instance_mut ( )
102102 . asc_new :: < AscEthereumEvent < AscEthereumTransaction > , _ > ( & EthereumEventData {
103103 block : EthereumBlockData :: from ( block. as_ref ( ) ) ,
104104 transaction : EthereumTransactionData :: from ( transaction. deref ( ) ) ,
@@ -135,11 +135,13 @@ impl WasmInstanceHandle {
135135 outputs,
136136 } ;
137137 let arg = if self . instance ( ) . ctx . host_exports . api_version >= Version :: new ( 0 , 0 , 3 ) {
138- self . instance ( )
138+ self . instance_mut ( )
139139 . asc_new :: < AscEthereumCall_0_0_3 , _ > ( & call)
140140 . erase ( )
141141 } else {
142- self . instance ( ) . asc_new :: < AscEthereumCall , _ > ( & call) . erase ( )
142+ self . instance_mut ( )
143+ . asc_new :: < AscEthereumCall , _ > ( & call)
144+ . erase ( )
143145 } ;
144146
145147 self . invoke_handler ( handler_name, arg) ?;
@@ -154,23 +156,22 @@ impl WasmInstanceHandle {
154156 let block = EthereumBlockData :: from ( self . instance ( ) . ctx . block . as_ref ( ) ) ;
155157
156158 // Prepare an EthereumBlock for the WASM runtime
157- let arg = self . instance ( ) . asc_new ( & block) ;
159+ let arg = self . instance_mut ( ) . asc_new ( & block) ;
158160
159161 self . invoke_handler ( handler_name, arg) ?;
160162
161163 Ok ( self . take_instance ( ) . ctx . state )
162164 }
163165
164- pub ( crate ) fn instance ( & mut self ) -> RefMut < ' _ , WasmInstance > {
166+ pub ( crate ) fn instance_mut ( & mut self ) -> RefMut < ' _ , WasmInstance > {
165167 RefMut :: map ( self . instance . borrow_mut ( ) , |i| i. as_mut ( ) . unwrap ( ) )
166168 }
167169
168170 pub ( crate ) fn take_instance ( & mut self ) -> WasmInstance {
169171 self . instance . borrow_mut ( ) . take ( ) . unwrap ( )
170172 }
171173
172- #[ cfg( test) ]
173- pub ( crate ) fn borrow_instance ( & self ) -> std:: cell:: Ref < ' _ , WasmInstance > {
174+ pub ( crate ) fn instance ( & self ) -> std:: cell:: Ref < ' _ , WasmInstance > {
174175 std:: cell:: Ref :: map ( self . instance . borrow ( ) , |i| i. as_ref ( ) . unwrap ( ) )
175176 }
176177
0 commit comments