@@ -8,7 +8,7 @@ import { define } from '@aggre/ullr'
8
8
import { html , render } from 'lit'
9
9
import { rpcEndpoints , waitForUpdated } from '../lib/test'
10
10
import { filter } from 'rxjs'
11
- import { type Provider } from 'ethers'
11
+ import type { Signer , Provider , ContractRunner } from 'ethers'
12
12
13
13
define ( Connection )
14
14
@@ -176,7 +176,7 @@ describe('dev-connection', () => {
176
176
it ( 'when setEip1193Provider is called, listen disconnect event and update signer stream' , async ( ) => {
177
177
const el = connection ( )
178
178
const signer = new ethers . VoidSigner ( ethers . ZeroAddress )
179
- el . signer . next ( signer )
179
+ el . signer . next ( signer as unknown as Signer )
180
180
await waitForUpdated ( el . signer . pipe ( filter ( ( x ) => x !== undefined ) ) )
181
181
expect ( el . signer . getValue ( ) ) . to . be . equal ( signer )
182
182
@@ -192,7 +192,7 @@ describe('dev-connection', () => {
192
192
it ( 'when setEip1193Provider is called, remove disconnect listener for previous provider' , async ( ) => {
193
193
const el = connection ( )
194
194
const signer = new ethers . VoidSigner ( ethers . ZeroAddress )
195
- el . signer . next ( signer )
195
+ el . signer . next ( signer as unknown as Signer )
196
196
await waitForUpdated ( el . signer )
197
197
expect ( el . signer . getValue ( ) ) . to . be . equal ( signer )
198
198
@@ -207,7 +207,7 @@ describe('dev-connection', () => {
207
207
await waitForUpdated ( el . signer )
208
208
expect ( el . signer . getValue ( ) ) . to . be . equal ( undefined )
209
209
210
- el . signer . next ( signer )
210
+ el . signer . next ( signer as unknown as Signer )
211
211
212
212
await waitForUpdated ( el . signer )
213
213
expect ( el . signer . getValue ( ) ) . to . be . equal ( signer )
@@ -235,7 +235,7 @@ describe('dev-connection', () => {
235
235
const mock = ethers . Wallet . createRandom ( ) . connect (
236
236
new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] ) ,
237
237
)
238
- el . signer . next ( mock )
238
+ el . signer . next ( mock as unknown as Signer )
239
239
240
240
expect ( el . signer . getValue ( ) ) . to . be . equal ( mock )
241
241
expect ( _count ) . to . be . equal ( 2 )
@@ -247,7 +247,7 @@ describe('dev-connection', () => {
247
247
const mock = ethers . Wallet . createRandom ( ) . connect (
248
248
new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] ) ,
249
249
)
250
- el . signer . next ( mock )
250
+ el . signer . next ( mock as unknown as Signer )
251
251
252
252
await waitForUpdated ( el . account )
253
253
expect ( el . account . getValue ( ) ) . to . be . equal ( await mock . getAddress ( ) )
@@ -258,7 +258,7 @@ describe('dev-connection', () => {
258
258
const mock = ethers . Wallet . createRandom ( ) . connect (
259
259
new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] ) ,
260
260
)
261
- el . signer . next ( mock )
261
+ el . signer . next ( mock as unknown as Signer )
262
262
await waitForUpdated ( el . account )
263
263
264
264
el . signer . next ( undefined )
@@ -272,7 +272,7 @@ describe('dev-connection', () => {
272
272
const mock = ethers . Wallet . createRandom ( ) . connect (
273
273
new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] ) ,
274
274
)
275
- el . signer . next ( mock )
275
+ el . signer . next ( mock as unknown as Signer )
276
276
expect ( el . provider . getValue ( ) ) . to . be . equal ( mock . provider )
277
277
278
278
el . signer . next ( undefined )
@@ -286,14 +286,14 @@ describe('dev-connection', () => {
286
286
const mock = ethers . Wallet . createRandom ( ) . connect (
287
287
new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] ) ,
288
288
)
289
- el . signer . next ( mock )
289
+ el . signer . next ( mock as unknown as Signer )
290
290
291
291
expect ( el . provider . getValue ( ) ) . to . be . equal ( mock . provider )
292
292
} )
293
293
it ( 'when signer is changed and the provider is not set, provider will update to undefined' , async ( ) => {
294
294
const el = connection ( )
295
295
const d = new ethers . JsonRpcProvider ( rpcEndpoints [ 1 ] )
296
- el . provider . next ( d )
296
+ el . provider . next ( d as unknown as ContractRunner )
297
297
expect ( el . provider . getValue ( ) ) . to . be . equal ( d )
298
298
299
299
const _mock = ethers . Wallet . createRandom ( ) . connect (
@@ -322,7 +322,7 @@ describe('dev-connection', () => {
322
322
expect ( el . provider . getValue ( ) ) . to . be . equal ( undefined )
323
323
324
324
const mock = new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] )
325
- el . provider . next ( mock )
325
+ el . provider . next ( mock as unknown as ContractRunner )
326
326
327
327
expect ( el . provider . getValue ( ) ) . to . be . equal ( mock )
328
328
expect ( _count ) . to . be . equal ( 2 )
@@ -332,15 +332,15 @@ describe('dev-connection', () => {
332
332
expect ( el . chain . getValue ( ) ) . to . be . equal ( undefined )
333
333
334
334
const mock = new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] )
335
- el . provider . next ( mock )
335
+ el . provider . next ( mock as unknown as ContractRunner )
336
336
337
337
await waitForUpdated ( el . chain . pipe ( filter ( ( x ) => x !== undefined ) ) )
338
338
expect ( el . chain . getValue ( ) ) . to . be . equal ( 42161 )
339
339
} )
340
340
it ( 'when provider is changed to undefined, chain will update to undefined' , async ( ) => {
341
341
const el = connection ( )
342
342
const mock = new ethers . JsonRpcProvider ( rpcEndpoints [ 0 ] )
343
- el . provider . next ( mock )
343
+ el . provider . next ( mock as unknown as ContractRunner )
344
344
345
345
await waitForUpdated ( el . chain . pipe ( filter ( ( x ) => x !== undefined ) ) )
346
346
expect ( el . chain . getValue ( ) ) . to . be . equal ( 42161 )
0 commit comments