1+ import { ethers } from 'ethers'
2+ import { env } from '../common/env'
13import { testProviders } from '../common/const'
24import { createLockupContract } from '../../ethereum/lockup'
35import { getLockupContract } from './common'
@@ -16,7 +18,8 @@ describe('common.ts', () => {
1618 testProviders . homestead
1719 ) ( addresses . eth [ 'main' ] . registry ) . lockup ( )
1820 const expected = await expectedLockup ( lockupAddress )
19- const result = await getLockupContract ( testProviders . homestead )
21+ const wallet = new ethers . Wallet ( env . mnemonic , testProviders . homestead )
22+ const result = await getLockupContract ( wallet )
2023 expect ( JSON . stringify ( result ) ) . toEqual ( JSON . stringify ( expected ) )
2124 } )
2225 it ( 'provider is ropsten' , async ( ) => {
@@ -25,21 +28,24 @@ describe('common.ts', () => {
2528 addresses . eth [ 'ropsten' ] . registry
2629 ) . lockup ( )
2730 const expected = await expectedLockup ( lockupAddress )
28- const result = await getLockupContract ( testProviders . ropsten )
31+ const wallet = new ethers . Wallet ( env . mnemonic , testProviders . ropsten )
32+ const result = await getLockupContract ( wallet )
2933 expect ( JSON . stringify ( result ) ) . toEqual ( JSON . stringify ( expected ) )
3034 } )
3135 it ( 'provider is arbitrum one' , async ( ) => {
3236 const expectedLockup = await createLockupContractL2 ( testProviders . arbOne )
3337 const expected = await expectedLockup ( arbitrumOneLockup )
34- const result = await getLockupContract ( testProviders . arbOne )
38+ const wallet = new ethers . Wallet ( env . mnemonic , testProviders . arbOne )
39+ const result = await getLockupContract ( wallet )
3540 expect ( JSON . stringify ( result ) ) . toEqual ( JSON . stringify ( expected ) )
3641 } )
3742 it ( 'provider is arbitrum rinkeby' , async ( ) => {
3843 const expectedLockup = await createLockupContractL2 (
3944 testProviders . arbRinkeby
4045 )
4146 const expected = await expectedLockup ( arbitrumRinkebyLockup )
42- const result = await getLockupContract ( testProviders . arbRinkeby )
47+ const wallet = new ethers . Wallet ( env . mnemonic , testProviders . arbRinkeby )
48+ const result = await getLockupContract ( wallet )
4349 expect ( JSON . stringify ( result ) ) . toEqual ( JSON . stringify ( expected ) )
4450 } )
4551 it ( 'use cache' , async ( ) => {
@@ -48,14 +54,16 @@ describe('common.ts', () => {
4854 addresses . eth [ 'ropsten' ] . registry
4955 ) . lockup ( )
5056 const expected = await expectedLockup ( lockupAddress )
51- const result1 = await getLockupContract ( testProviders . ropsten )
52- const result2 = await getLockupContract ( testProviders . ropsten )
57+ const wallet = new ethers . Wallet ( env . mnemonic , testProviders . ropsten )
58+ const result1 = await getLockupContract ( wallet )
59+ const result2 = await getLockupContract ( wallet )
5360 expect ( JSON . stringify ( result1 ) ) . toEqual ( JSON . stringify ( expected ) )
5461 expect ( JSON . stringify ( result2 ) ) . toEqual ( JSON . stringify ( expected ) )
5562 } )
5663 it ( 'provider is unknown' , async ( ) => {
5764 const expected = undefined
58- const result = await getLockupContract ( testProviders . polyMumbai )
65+ const wallet = new ethers . Wallet ( env . mnemonic , testProviders . polyMumbai )
66+ const result = await getLockupContract ( wallet )
5967 expect ( result ) . toEqual ( expected )
6068 } )
6169 } )
0 commit comments