File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @chainsafe/webzjs-zcash-snap" ,
3
- "version" : " 0.2.1 " ,
3
+ "version" : " 0.2.2 " ,
4
4
"description" : " Zcash Metmamask Snap that utilizes WebZjs." ,
5
5
"repository" : {
6
6
"type" : " git" ,
Original file line number Diff line number Diff line change 1
1
{
2
- "version" : " 0.2.1 " ,
2
+ "version" : " 0.2.2 " ,
3
3
"description" : " WebZjs Snap for demo wallet" ,
4
4
"proposedName" : " WebZjs Snap" ,
5
5
"repository" : {
6
6
"type" : " git" ,
7
7
"url" : " https://github.com/ChainSafe/WebZjs.git"
8
8
},
9
9
"source" : {
10
- "shasum" : " qEgmDNiFc38+m/Ra1d5sOCSYmdAitT/Ghy6lVl21oDY =" ,
10
+ "shasum" : " YsNLaFFSeBvE+cukvWF2qkh2PhTrCmU+H9gaEpVUr74 =" ,
11
11
"location" : {
12
12
"npm" : {
13
13
"filePath" : " dist/bundle.js" ,
Original file line number Diff line number Diff line change @@ -5,12 +5,20 @@ export function setSyncBlockHeight(
5
5
userInputCreationBlock : string | null ,
6
6
latestBlock : number ,
7
7
) : number {
8
+ //In case input was empty, default to latestBlock
8
9
if ( userInputCreationBlock === null ) return latestBlock ;
9
10
11
+ // Check if input is a valid number
12
+ if ( ! / ^ \d + $ / . test ( userInputCreationBlock ) ) return latestBlock ;
13
+
10
14
const customBirthdayBlock = Number ( userInputCreationBlock ) ;
11
15
16
+ // Check if custom block is higher than latest block
17
+ if ( customBirthdayBlock > latestBlock ) return latestBlock ;
18
+
12
19
const latestAcceptableSyncBlock = NU5_ACTIVATION ;
13
20
21
+ //In case user entered older than acceptable block height
14
22
return customBirthdayBlock > latestAcceptableSyncBlock
15
23
? customBirthdayBlock
16
24
: latestAcceptableSyncBlock ;
You can’t perform that action at this time.
0 commit comments