Commit 65b78dd 1 parent 1198b31 commit 65b78dd Copy full SHA for 65b78dd
File tree 4 files changed +25
-27
lines changed
src/provider/utils/rpc-mapper/methods/eth_estimateGas
tests/provider/rpc-mapper/methods/eth_estimateGas
4 files changed +25
-27
lines changed Original file line number Diff line number Diff line change 1
1
/** @type {import('ts-jest').JestConfigWithTsJest } */
2
2
// Coverage threshold would apply to yarn test, not yarn test:unit
3
- const isUnitTest = process . env . UNIT ;
3
+ const applyCodeCoverageLimits = process . env . APPLYCODECOVLIMITS ;
4
4
5
5
module . exports = {
6
6
preset : 'ts-jest' ,
@@ -10,7 +10,7 @@ module.exports = {
10
10
reporters : [ 'default' , 'jest-junit' ] ,
11
11
workerThreads : true ,
12
12
coverageThreshold :
13
- isUnitTest ! == 'true'
13
+ applyCodeCoverageLimits == 'true'
14
14
? {
15
15
global : {
16
16
branches : 98 ,
Original file line number Diff line number Diff line change 32
32
"format" : " prettier --write src/**/*.ts tests/**/*.ts solo-seeding/**/*.ts" ,
33
33
"start-thor-solo" : " echo 'Starting thor solo node ...' && docker compose -f ../../docker-compose.thor.yml up -d --wait && echo '\n Thor solo node started ...'" ,
34
34
"stop-thor-solo" : " echo 'Stopping thor solo node ...' && docker compose -f ../../docker-compose.thor.yml down && echo 'Thor solo node stopped ...'" ,
35
- "test:unit" : " rm -rf ./coverageUnit && UNIT =true jest --coverage --coverageDirectory=coverageUnit --group=unit" ,
36
- "test:integration" : " rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration" ,
37
- "test:integration:solo" : " ( yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo) || yarn stop-thor-solo" ,
35
+ "test:unit" : " rm -rf ./coverageUnit && APPLYCODECOVLIMITS =true jest --coverage --coverageDirectory=coverageUnit --group=unit" ,
36
+ "test:integration" : " rm -rf ./coverageIntegration && APPLYCODECOVLIMITS=false jest --coverage --coverageDirectory=coverageIntegration --group=integration" ,
37
+ "test:integration:solo" : " APPLYCODECOVLIMITS=false yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo || yarn stop-thor-solo" ,
38
38
"test:browser" : " rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js" ,
39
- "test" : " rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit" ,
39
+ "test" : " rm -rf ./coverage && APPLYCODECOVLIMITS=true jest --coverage --coverageDirectory=coverage --group=integration --group=unit" ,
40
40
"test:solo" : " (yarn start-thor-solo && yarn test && yarn stop-thor-solo) || yarn stop-thor-solo" ,
41
41
"test:browser:solo" : " (yarn start-thor-solo && yarn test:browser && yarn stop-thor-solo) || yarn stop-thor-solo"
42
42
},
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const ethEstimateGas = async (
52
52
{
53
53
to : inputOptions . to ?? null ,
54
54
value : inputOptions . value ?? '0x0' ,
55
- data : inputOptions . data ?? '0x0 '
55
+ data : inputOptions . data ?? '0x '
56
56
} satisfies SimulateTransactionClause
57
57
] ,
58
58
inputOptions . from ,
@@ -62,7 +62,7 @@ const ethEstimateGas = async (
62
62
) ;
63
63
64
64
// Convert intrinsic gas to hex string and return
65
- return await Promise . resolve ( '0x' + estimatedGas . totalGas . toString ( 16 ) ) ;
65
+ return '0x' + estimatedGas . totalGas . toString ( 16 ) ;
66
66
} catch ( e ) {
67
67
throw new JSONRPCInternalError (
68
68
'eth_estimateGas()' ,
Original file line number Diff line number Diff line change 1
- import { Address , Clause , VET } from '@vechain/sdk-core' ;
2
- import {
3
- JSONRPCInternalError ,
4
- JSONRPCInvalidParams
5
- } from '@vechain/sdk-errors' ;
1
+ import { JSONRPCInvalidParams } from '@vechain/sdk-errors' ;
6
2
7
3
/**
8
4
* Fixtures for positive cases
@@ -11,10 +7,11 @@ const positiveCasesFixtures = [
11
7
{
12
8
description : 'Simple transfer.' ,
13
9
input : [
14
- Clause . transferVET (
15
- Address . of ( '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' ) ,
16
- VET . of ( 1000 )
17
- ) ,
10
+ {
11
+ from : '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' ,
12
+ to : '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' ,
13
+ value : '0x1000'
14
+ } ,
18
15
'latest'
19
16
] ,
20
17
expected : '0x5208'
@@ -30,6 +27,17 @@ const positiveCasesFixtures = [
30
27
'latest'
31
28
] ,
32
29
expected : '0x45015'
30
+ } ,
31
+ {
32
+ description : 'Missing from parameter' ,
33
+ input : [
34
+ {
35
+ to : '0x7487d912d03ab9de786278f679592b3730bdd540' ,
36
+ value : '0x1000'
37
+ } ,
38
+ 'latest'
39
+ ] ,
40
+ expected : '0x5208'
33
41
}
34
42
] ;
35
43
@@ -42,16 +50,6 @@ const negativeCasesFixtures = [
42
50
input : [ ] ,
43
51
expected : JSONRPCInvalidParams
44
52
} ,
45
- {
46
- description : 'Missing parameters' ,
47
- input : [
48
- {
49
- to : '0x7487d912d03ab9de786278f679592b3730bdd540'
50
- } ,
51
- 'latest'
52
- ] ,
53
- expected : JSONRPCInternalError
54
- } ,
55
53
{
56
54
description : 'Missing block reference' ,
57
55
input : [
You can’t perform that action at this time.
0 commit comments