File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ export class Baby extends CosmosCoin {
3939
4040 /** @inheritDoc **/
4141 isValidAddress ( address : string ) : boolean {
42- return utils . isValidAddress ( address ) || utils . isValidValidatorAddress ( address ) ;
42+ const isValidFinalAddress = utils . isValidHexString ( address ) && address . length === 64 ;
43+ return utils . isValidAddress ( address ) || utils . isValidValidatorAddress ( address ) || isValidFinalAddress ;
4344 }
4445
4546 /** @inheritDoc **/
Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ export const address = {
174174 invalidMemoIdAddress : 'bbn1274ep8pnrlej5vgmtwppysynzcd4fhxc3ku0t3?memoId=-1' ,
175175 invalidMemoIdAddress2 : 'bbn1274ep8pnrlej5vgmtwppysynzcd4fhxc3ku0t3?memoId=1.23' ,
176176 multipleMemoIdAddress : 'bbn1274ep8pnrlej5vgmtwppysynzcd4fhxc3ku0t3?memoId=3&memoId=12' ,
177+ finalityProviderAddress : 'e4889630fa8695dae630c41cd9b85ef165ccc2dc5e5935d5a24393a9defee9ef' ,
177178} ;
178179
179180export const blockHash = {
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ describe('Babylon', function () {
9090 should . equal ( utils . isValidAddress ( address . validMemoIdAddress2 ) , true ) ;
9191 should . equal ( utils . isValidAddress ( address . multipleMemoIdAddress ) , false ) ;
9292 } ) ;
93+
9394 it ( 'should validate validator addresses correctly' , ( ) => {
9495 should . equal ( utils . isValidValidatorAddress ( address . validatorAddress1 ) , true ) ;
9596 should . equal ( utils . isValidValidatorAddress ( address . validatorAddress2 ) , true ) ;
@@ -99,6 +100,11 @@ describe('Babylon', function () {
99100 should . equal ( utils . isValidValidatorAddress ( undefined as unknown as string ) , false ) ;
100101 should . equal ( utils . isValidValidatorAddress ( '' ) , false ) ;
101102 } ) ;
103+
104+ it ( 'should finality provider addresses correctly' , ( ) => {
105+ should . equal ( basecoin . isValidAddress ( address . finalityProviderAddress ) , true ) ;
106+ should . equal ( basecoin . isValidAddress ( 'dfjk35y' ) , false ) ;
107+ } ) ;
102108 } ) ;
103109
104110 describe ( 'Verify transaction: ' , ( ) => {
You can’t perform that action at this time.
0 commit comments