File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 3737 "cli:run-listener" : " ts-node --project tsconfig.cli.json cli/run-listener.ts" ,
3838 "cli:metadata" : " ts-node --project tsconfig.cli.json cli/metadata.ts" ,
3939 "test" : " jest --silent" ,
40+ "test:watch" : " jest --watch --silent" ,
4041 "test:coverage" : " jest --coverage --coverageDirectory='coverage'" ,
4142 "prepublishOnly" : " yarn build"
4243 },
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export class NFT {
104104 }
105105 return `${ PREFIX } ::${
106106 OP_TYPES . SEND
107- } ::${ VERSION } ::${ this . getId ( ) } ::${ recipient } `;
107+ } ::${ VERSION } ::${ this . getId ( ) } ::${ recipient . replace ( / \\ s / g , "" ) } `;
108108 }
109109
110110 // @todo build this out, maybe data type?
Original file line number Diff line number Diff line change @@ -145,6 +145,11 @@ export const validateSend = (remark: string): any => {
145145
146146 try {
147147 validateBase ( remark , OP_TYPES . SEND ) ;
148+ if ( / \s / g. test ( recipient ) ) {
149+ throw new Error (
150+ "Invalid remark - No whitespaces are allowed in recipient"
151+ ) ;
152+ }
148153 return assert ( { id, recipient } , SENDStruct ) ;
149154 } catch ( error ) {
150155 throw new Error (
Original file line number Diff line number Diff line change 1+ import { validateNFT , validateSend } from "../../src/tools/validate-remark" ;
2+
3+ describe ( "validation: validateSend" , ( ) => {
4+ it ( "should be valid send" , ( ) => {
5+ const remark =
6+ "RMRK::SEND::1.0.0::6802213-24d573f4dfa1d7fd33-KAN-KANS-0000000000000001::dfsfsd dfsfd" ;
7+
8+ expect ( ( ) => validateSend ( remark ) ) . toThrowError (
9+ "Invalid remark - No whitespaces are allowed in recipient"
10+ ) ;
11+
12+ expect ( ( ) => validateSend ( remark . replace ( / \s / g, "" ) ) ) . not . toThrow ( ) ;
13+ } ) ;
14+ } ) ;
You can’t perform that action at this time.
0 commit comments