@@ -11,23 +11,24 @@ interface EvmE2eI {
11
11
estimateGas ?: any
12
12
}
13
13
skipEstimateGas ?: boolean
14
+ url ?: string
14
15
}
15
16
16
17
export const EvmE2eUtils = {
17
- initTatum : async < T extends BaseEvm > ( network : Network , apiKey ?: string ) =>
18
- TatumSDK . init < T > ( e2eUtil . initConfig ( network , apiKey ) ) ,
18
+ initTatum : async < T extends BaseEvm > ( network : Network , apiKey ?: string , url ?: string ) =>
19
+ TatumSDK . init < T > ( e2eUtil . initConfig ( network , apiKey , url ) ) ,
19
20
e2e : ( evmE2eI : EvmE2eI ) => {
20
- const { network, data, skipEstimateGas, apiKey } = evmE2eI
21
+ const { network, data, skipEstimateGas, apiKey, url } = evmE2eI
21
22
it ( 'eth_blockNumber' , async ( ) => {
22
- const tatum = await EvmE2eUtils . initTatum ( network , apiKey )
23
+ const tatum = await EvmE2eUtils . initTatum ( network , apiKey , url )
23
24
const { result } = await tatum . rpc . blockNumber ( )
24
25
25
26
await tatum . destroy ( )
26
27
expect ( result ?. toNumber ( ) ) . toBeGreaterThan ( 0 )
27
28
} )
28
29
29
30
it ( 'eth_chainId' , async ( ) => {
30
- const tatum = await EvmE2eUtils . initTatum ( network , apiKey )
31
+ const tatum = await EvmE2eUtils . initTatum ( network , apiKey , url )
31
32
const { result } = await tatum . rpc . chainId ( )
32
33
33
34
tatum . rpc . destroy ( )
@@ -36,7 +37,7 @@ export const EvmE2eUtils = {
36
37
37
38
if ( ! skipEstimateGas ) {
38
39
it ( 'eth_estimateGas' , async ( ) => {
39
- const tatum = await EvmE2eUtils . initTatum ( network , apiKey )
40
+ const tatum = await EvmE2eUtils . initTatum ( network , apiKey , url )
40
41
const estimateGas = data ?. estimateGas ?? {
41
42
from : '0xb4c9E4617a16Be36B92689b9e07e9F64757c1792' ,
42
43
to : '0x4675C7e5BaAFBFFbca748158bEcBA61ef3b0a263' ,
@@ -49,23 +50,23 @@ export const EvmE2eUtils = {
49
50
}
50
51
51
52
it ( 'eth_gasPrice' , async ( ) => {
52
- const tatum = await EvmE2eUtils . initTatum ( network , apiKey )
53
+ const tatum = await EvmE2eUtils . initTatum ( network , apiKey , url )
53
54
const { result } = await tatum . rpc . gasPrice ( )
54
55
55
56
await tatum . destroy ( )
56
57
expect ( result ?. toNumber ( ) ) . toBeGreaterThan ( 0 )
57
58
} )
58
59
59
60
it ( 'web3_clientVersion' , async ( ) => {
60
- const tatum = await EvmE2eUtils . initTatum ( network , apiKey )
61
+ const tatum = await EvmE2eUtils . initTatum ( network , apiKey , url )
61
62
const { result } = await tatum . rpc . clientVersion ( )
62
63
63
64
await tatum . destroy ( )
64
65
expect ( result ) . toBeTruthy ( )
65
66
} )
66
67
67
68
it ( 'eth_getBlockByNumber' , async ( ) => {
68
- const tatum = await EvmE2eUtils . initTatum ( network , apiKey )
69
+ const tatum = await EvmE2eUtils . initTatum ( network , apiKey , url )
69
70
const { result } = await tatum . rpc . blockNumber ( )
70
71
const { result : block } = await tatum . rpc . getBlockByNumber ( ( result as BigNumber ) . toNumber ( ) - 1000 )
71
72
await tatum . destroy ( )
0 commit comments