1+ import { expect } from "chai" ;
2+ import { step } from "mocha-steps" ;
3+
4+ import { createAndFinalizeBlock , customRequest , describeWithFrontier } from "./util" ;
5+
6+ describeWithFrontier ( "Frontier RPC (Subscription)" , `simple-specs.json` , ( context ) => {
7+
8+ let subscription ;
9+ let logs_generated = 0 ;
10+
11+ const GENESIS_ACCOUNT = "0x6be02d1d3665660d22ff9624b7be0551ee1ac91b" ;
12+ const GENESIS_ACCOUNT_PRIVATE_KEY = "0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E342" ;
13+
14+ const TEST_CONTRACT_BYTECODE =
15+ "0x608060405234801561001057600080fd5b50610041337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61004660201b60201c565b610291565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156100e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6101028160025461020960201b610c7c1790919060201c565b60028190555061015d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461020960201b610c7c1790919060201c565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015610287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b610e3a806102a06000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806370a082311161005b57806370a08231146101fd578063a457c2d714610255578063a9059cbb146102bb578063dd62ed3e1461032157610088565b8063095ea7b31461008d57806318160ddd146100f357806323b872dd146101115780633950935114610197575b600080fd5b6100d9600480360360408110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610399565b604051808215151515815260200191505060405180910390f35b6100fb6103b7565b6040518082815260200191505060405180910390f35b61017d6004803603606081101561012757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103c1565b604051808215151515815260200191505060405180910390f35b6101e3600480360360408110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049a565b604051808215151515815260200191505060405180910390f35b61023f6004803603602081101561021357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061054d565b6040518082815260200191505060405180910390f35b6102a16004803603604081101561026b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610595565b604051808215151515815260200191505060405180910390f35b610307600480360360408110156102d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610662565b604051808215151515815260200191505060405180910390f35b6103836004803603604081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610680565b6040518082815260200191505060405180910390f35b60006103ad6103a6610707565b848461070f565b6001905092915050565b6000600254905090565b60006103ce848484610906565b61048f846103da610707565b61048a85604051806060016040528060288152602001610d7060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610440610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b600190509392505050565b60006105436104a7610707565b8461053e85600160006104b8610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b61070f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006106586105a2610707565b8461065385604051806060016040528060258152602001610de160259139600160006105cc610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b6001905092915050565b600061067661066f610707565b8484610906565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610795576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610dbd6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561081b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610d286022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610d986025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610d056023913960400191505060405180910390fd5b610a7d81604051806060016040528060268152602001610d4a602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b10816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610c69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610c2e578082015181840152602081019050610c13565b50505050905090810190601f168015610c5b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610cfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820c7a5ffabf642bda14700b2de42f8c57b36621af020441df825de45fd2b3e1c5c64736f6c63430005100032" ;
16+
17+ async function sendTransaction ( context ) {
18+ const tx = await context . web3 . eth . accounts . signTransaction (
19+ {
20+ from : GENESIS_ACCOUNT ,
21+ data : TEST_CONTRACT_BYTECODE ,
22+ value : "0x00" ,
23+ gasPrice : "0x01" ,
24+ gas : "0x4F930" ,
25+ } ,
26+ GENESIS_ACCOUNT_PRIVATE_KEY
27+ ) ;
28+
29+ await customRequest ( context . web3 , "eth_sendRawTransaction" , [ tx . rawTransaction ] ) ;
30+ return tx ;
31+ }
32+
33+ step ( "should connect" , async function ( ) {
34+ await createAndFinalizeBlock ( context . web3 ) ;
35+ // @ts -ignore
36+ const connected = context . web3 . currentProvider . connected ;
37+ expect ( connected ) . to . equal ( true ) ;
38+ } ) ;
39+
40+ step ( "should subscribe" , async function ( ) {
41+ subscription = context . web3 . eth . subscribe ( "newBlockHeaders" , function ( error , result ) { } ) ;
42+
43+ let connected = false ;
44+ let subscriptionId = "" ;
45+ await new Promise ( ( resolve ) => {
46+ subscription . on ( "connected" , function ( d : any ) {
47+ connected = true ;
48+ subscriptionId = d ;
49+ resolve ( ) ;
50+ } ) ;
51+ } ) ;
52+
53+ expect ( connected ) . to . equal ( true ) ;
54+ expect ( subscriptionId ) . to . have . lengthOf ( 16 ) ;
55+ } ) ;
56+
57+ step ( "should get newHeads stream" , async function ( done ) {
58+ await createAndFinalizeBlock ( context . web3 ) ;
59+ let data = null ;
60+ await new Promise ( ( resolve ) => {
61+ subscription . on ( "data" , function ( d : any ) {
62+ data = d ;
63+ resolve ( ) ;
64+ } ) ;
65+ } ) ;
66+ expect ( data ) . to . include ( {
67+ author : '0x0000000000000000000000000000000000000000' ,
68+ difficulty : '0' ,
69+ extraData : '0x' ,
70+ logsBloom : '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' ,
71+ miner : '0x0000000000000000000000000000000000000000' ,
72+ number : 2 ,
73+ receiptsRoot : '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347' ,
74+ sha3Uncles : '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347' ,
75+ stateRoot : '0x0000000000000000000000000000000000000000000000000000000000000000' ,
76+ transactionsRoot : '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
77+ } ) ;
78+ expect ( ( data as any ) . sealFields ) . to . eql ( [
79+ "0x0000000000000000000000000000000000000000000000000000000000000000" ,
80+ "0x0000000000000000" ,
81+ ] ) ;
82+ setTimeout ( done , 10000 ) ;
83+ } ) . timeout ( 20000 ) ;
84+
85+ step ( "should get newPendingTransactions stream" , async function ( done ) {
86+ subscription = context . web3 . eth . subscribe ( "pendingTransactions" , function ( error , result ) { } ) ;
87+
88+ await new Promise ( ( resolve ) => {
89+ subscription . on ( "connected" , function ( d : any ) {
90+ resolve ( ) ;
91+ } ) ;
92+ } ) ;
93+
94+ const tx = await sendTransaction ( context ) ;
95+ let data = null ;
96+ await new Promise ( ( resolve ) => {
97+ createAndFinalizeBlock ( context . web3 ) ;
98+ subscription . on ( "data" , function ( d : any ) {
99+ data = d ;
100+ logs_generated += 1 ;
101+ resolve ( ) ;
102+ } ) ;
103+ } ) ;
104+ subscription . unsubscribe ( ) ;
105+
106+ expect ( data ) . to . be . not . null ;
107+ expect ( tx [ "transactionHash" ] ) . to . be . eq ( data ) ;
108+ setTimeout ( done , 10000 ) ;
109+ } ) . timeout ( 20000 ) ;
110+
111+ step ( "should subscribe to all logs" , async function ( done ) {
112+ subscription = context . web3 . eth . subscribe ( "logs" , { } , function ( error , result ) { } ) ;
113+
114+ await new Promise ( ( resolve ) => {
115+ subscription . on ( "connected" , function ( d : any ) {
116+ resolve ( ) ;
117+ } ) ;
118+ } ) ;
119+
120+ const tx = await sendTransaction ( context ) ;
121+ let data = null ;
122+ await new Promise ( ( resolve ) => {
123+ createAndFinalizeBlock ( context . web3 ) ;
124+ subscription . on ( "data" , function ( d : any ) {
125+ data = d ;
126+ logs_generated += 1 ;
127+ resolve ( ) ;
128+ } ) ;
129+ } ) ;
130+ subscription . unsubscribe ( ) ;
131+
132+ const block = await context . web3 . eth . getBlock ( "latest" ) ;
133+ expect ( data ) . to . include ( {
134+ blockHash : block . hash ,
135+ blockNumber : block . number ,
136+ data : '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' ,
137+ logIndex : 0 ,
138+ removed : false ,
139+ transactionHash : block . transactions [ 0 ] ,
140+ transactionIndex : 0 ,
141+ transactionLogIndex : '0x0'
142+ } ) ;
143+ setTimeout ( done , 10000 ) ;
144+ } ) . timeout ( 20000 ) ;
145+
146+ step ( "should subscribe to logs by address" , async function ( done ) {
147+ subscription = context . web3 . eth . subscribe ( "logs" , {
148+ address : "0x42e2EE7Ba8975c473157634Ac2AF4098190fc741"
149+ } , function ( error , result ) { } ) ;
150+
151+ await new Promise ( ( resolve ) => {
152+ subscription . on ( "connected" , function ( d : any ) {
153+ resolve ( ) ;
154+ } ) ;
155+ } ) ;
156+
157+ const tx = await sendTransaction ( context ) ;
158+ let data = null ;
159+ await new Promise ( ( resolve ) => {
160+ createAndFinalizeBlock ( context . web3 ) ;
161+ subscription . on ( "data" , function ( d : any ) {
162+ data = d ;
163+ logs_generated += 1 ;
164+ resolve ( ) ;
165+ } ) ;
166+ } ) ;
167+ subscription . unsubscribe ( ) ;
168+
169+ expect ( data ) . to . not . be . null ;
170+ setTimeout ( done , 10000 ) ;
171+ } ) . timeout ( 20000 ) ;
172+
173+ step ( "should subscribe to logs by topic" , async function ( done ) {
174+ subscription = context . web3 . eth . subscribe ( "logs" , {
175+ topics : [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ]
176+ } , function ( error , result ) { } ) ;
177+
178+ await new Promise ( ( resolve ) => {
179+ subscription . on ( "connected" , function ( d : any ) {
180+ resolve ( ) ;
181+ } ) ;
182+ } ) ;
183+
184+ const tx = await sendTransaction ( context ) ;
185+ let data = null ;
186+ await new Promise ( ( resolve ) => {
187+ createAndFinalizeBlock ( context . web3 ) ;
188+ subscription . on ( "data" , function ( d : any ) {
189+ data = d ;
190+ logs_generated += 1 ;
191+ resolve ( ) ;
192+ } ) ;
193+ } ) ;
194+ subscription . unsubscribe ( ) ;
195+
196+ expect ( data ) . to . not . be . null ;
197+ setTimeout ( done , 10000 ) ;
198+ } ) . timeout ( 20000 ) ;
199+
200+ step ( "should get past events on subscription" , async function ( done ) {
201+ subscription = context . web3 . eth . subscribe ( "logs" , {
202+ fromBlock : "0x0"
203+ } , function ( error , result ) { } ) ;
204+
205+ let data = [ ] ;
206+ await new Promise ( ( resolve ) => {
207+ subscription . on ( "data" , function ( d : any ) {
208+ data . push ( d ) ;
209+ if ( data . length == logs_generated ) {
210+ resolve ( ) ;
211+ }
212+ } ) ;
213+ } ) ;
214+
215+ expect ( data ) . to . not . be . empty ;
216+ setTimeout ( done , 10000 ) ;
217+ } ) . timeout ( 20000 ) ;
218+
219+ step ( "should support topic wildcards" , async function ( done ) {
220+ subscription = context . web3 . eth . subscribe ( "logs" , {
221+ topics : [
222+ null ,
223+ "0x0000000000000000000000000000000000000000000000000000000000000000"
224+ ]
225+ } , function ( error , result ) { } ) ;
226+
227+ await new Promise ( ( resolve ) => {
228+ subscription . on ( "connected" , function ( d : any ) {
229+ resolve ( ) ;
230+ } ) ;
231+ } ) ;
232+
233+ const tx = await sendTransaction ( context ) ;
234+ let data = null ;
235+ await new Promise ( ( resolve ) => {
236+ createAndFinalizeBlock ( context . web3 ) ;
237+ subscription . on ( "data" , function ( d : any ) {
238+ data = d ;
239+ logs_generated += 1 ;
240+ resolve ( ) ;
241+ } ) ;
242+ } ) ;
243+ subscription . unsubscribe ( ) ;
244+
245+ expect ( data ) . to . not . be . null ;
246+ setTimeout ( done , 10000 ) ;
247+ } ) . timeout ( 20000 ) ;
248+
249+ step ( "should support single values wrapped around a sequence" , async function ( done ) {
250+ subscription = context . web3 . eth . subscribe ( "logs" , {
251+ topics : [
252+ [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ] ,
253+ [ "0x0000000000000000000000000000000000000000000000000000000000000000" ]
254+ ]
255+ } , function ( error , result ) { } ) ;
256+
257+ await new Promise ( ( resolve ) => {
258+ subscription . on ( "connected" , function ( d : any ) {
259+ resolve ( ) ;
260+ } ) ;
261+ } ) ;
262+
263+ const tx = await sendTransaction ( context ) ;
264+ let data = null ;
265+ await new Promise ( ( resolve ) => {
266+ createAndFinalizeBlock ( context . web3 ) ;
267+ subscription . on ( "data" , function ( d : any ) {
268+ data = d ;
269+ logs_generated += 1 ;
270+ resolve ( ) ;
271+ } ) ;
272+ } ) ;
273+ subscription . unsubscribe ( ) ;
274+
275+ expect ( data ) . to . not . be . null ;
276+ setTimeout ( done , 10000 ) ;
277+ } ) . timeout ( 20000 ) ;
278+
279+ step ( "should support topic conditional parameters" , async function ( done ) {
280+ subscription = context . web3 . eth . subscribe ( "logs" , {
281+ topics : [
282+ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ,
283+ [
284+ "0x0000000000000000000000006be02d1d3665660d22ff9624b7be0551ee1ac91b" ,
285+ "0x0000000000000000000000000000000000000000000000000000000000000000"
286+ ]
287+ ]
288+ } , function ( error , result ) { } ) ;
289+
290+ await new Promise ( ( resolve ) => {
291+ subscription . on ( "connected" , function ( d : any ) {
292+ resolve ( ) ;
293+ } ) ;
294+ } ) ;
295+
296+ const tx = await sendTransaction ( context ) ;
297+ let data = null ;
298+ await new Promise ( ( resolve ) => {
299+ createAndFinalizeBlock ( context . web3 ) ;
300+ subscription . on ( "data" , function ( d : any ) {
301+ data = d ;
302+ logs_generated += 1 ;
303+ resolve ( ) ;
304+ } ) ;
305+ } ) ;
306+ subscription . unsubscribe ( ) ;
307+
308+ expect ( data ) . to . not . be . null ;
309+ setTimeout ( done , 10000 ) ;
310+ } ) . timeout ( 20000 ) ;
311+
312+ step ( "should support multiple topic conditional parameters" , async function ( done ) {
313+ subscription = context . web3 . eth . subscribe ( "logs" , {
314+ topics : [
315+ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ,
316+ [
317+ "0x0000000000000000000000000000000000000000000000000000000000000000" ,
318+ "0x0000000000000000000000006be02d1d3665660d22ff9624b7be0551ee1ac91b"
319+ ] ,
320+ [
321+ "0x0000000000000000000000006be02d1d3665660d22ff9624b7be0551ee1ac91b" ,
322+ "0x0000000000000000000000000000000000000000000000000000000000000000"
323+ ]
324+ ]
325+ } , function ( error , result ) { } ) ;
326+
327+ await new Promise ( ( resolve ) => {
328+ subscription . on ( "connected" , function ( d : any ) {
329+ resolve ( ) ;
330+ } ) ;
331+ } ) ;
332+
333+ const tx = await sendTransaction ( context ) ;
334+ let data = null ;
335+ await new Promise ( ( resolve ) => {
336+ createAndFinalizeBlock ( context . web3 ) ;
337+ subscription . on ( "data" , function ( d : any ) {
338+ data = d ;
339+ logs_generated += 1 ;
340+ resolve ( ) ;
341+ } ) ;
342+ } ) ;
343+ subscription . unsubscribe ( ) ;
344+
345+ expect ( data ) . to . not . be . null ;
346+ setTimeout ( done , 10000 ) ;
347+ } ) . timeout ( 20000 ) ;
348+
349+ step ( "should combine topic wildcards and conditional parameters" , async function ( done ) {
350+ subscription = context . web3 . eth . subscribe ( "logs" , {
351+ topics : [
352+ null ,
353+ [
354+ "0x0000000000000000000000006be02d1d3665660d22ff9624b7be0551ee1ac91b" ,
355+ "0x0000000000000000000000000000000000000000000000000000000000000000"
356+ ] ,
357+ null
358+ ]
359+ } , function ( error , result ) { } ) ;
360+
361+ await new Promise ( ( resolve ) => {
362+ subscription . on ( "connected" , function ( d : any ) {
363+ resolve ( ) ;
364+ } ) ;
365+ } ) ;
366+
367+ const tx = await sendTransaction ( context ) ;
368+ let data = null ;
369+ await new Promise ( ( resolve ) => {
370+ createAndFinalizeBlock ( context . web3 ) ;
371+ subscription . on ( "data" , function ( d : any ) {
372+ data = d ;
373+ logs_generated += 1 ;
374+ resolve ( ) ;
375+ } ) ;
376+ } ) ;
377+ subscription . unsubscribe ( ) ;
378+
379+ expect ( data ) . to . not . be . null ;
380+ setTimeout ( done , 10000 ) ;
381+ } ) . timeout ( 20000 ) ;
382+ } , "ws" ) ;
0 commit comments