File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,11 @@ export class Utils implements BaseUtils {
1515 isValidAddress ( address : string ) : boolean {
1616 if ( ! address || address . trim ( ) === '' ) return false ;
1717 const [ partyHint , fingerprint ] = address . trim ( ) . split ( '::' ) ;
18- if ( ! partyHint || ! fingerprint ) return false ;
19- return this . isValidCantonHex ( fingerprint ) ;
18+ if ( ! fingerprint ) return false ;
19+ // all memoIds are considered valid as long as strings are passed
20+ const [ fingerprintPart ] = fingerprint . trim ( ) . split ( '?memoId=' ) ;
21+ if ( ! partyHint || ! fingerprintPart ) return false ;
22+ return this . isValidCantonHex ( fingerprintPart ) ;
2023 }
2124
2225 /** @inheritdoc */
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ export const CANTON_ADDRESSES = {
8484 INVALID_FINGERPRINT : '12205::12205b4e3537a95126d9060459234gd8ad3c3ddccda4f79901954280ee19c576714d' ,
8585 MISSING_PARTY_HINT : '::12205b4e3537a95126d9060459234gd8ad3c3ddccda4f79901954280ee19c576714d' ,
8686 MISSING_FINGERPRINT : '12205::' ,
87+ VALID_MEMO_ID : '1220a::1220a43d89dc7d8f85316116aac093667f769fce55411aef6846ccb933b2e1a3b598?memoId=1' ,
8788} ;
8889
8990export const CANTON_BLOCK_HEIGHT = {
Original file line number Diff line number Diff line change @@ -137,6 +137,12 @@ describe('Canton Util', function () {
137137 should . exist ( isValid ) ;
138138 assert . strictEqual ( isValid , false ) ;
139139 } ) ;
140+
141+ it ( 'should return true when memo id is valid' , function ( ) {
142+ const isValid = utils . isValidAddress ( CANTON_ADDRESSES . VALID_MEMO_ID ) ;
143+ should . exist ( isValid ) ;
144+ assert . strictEqual ( isValid , true ) ;
145+ } ) ;
140146 } ) ;
141147
142148 describe ( 'Check if block hash is valid' , function ( ) {
You can’t perform that action at this time.
0 commit comments