File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export interface AssetIdParams {
1212}
1313
1414export class AssetId {
15- public static spec : IdentifierSpec = CAIP [ "19" ] . assetId ;
15+ public static spec : IdentifierSpec = CAIP [ "19" ] . blockNumberTag ;
1616
1717 public static parse ( id : string ) : AssetIdParams {
1818 if ( ! isValidId ( id , this . spec ) ) {
Original file line number Diff line number Diff line change @@ -87,28 +87,17 @@ const CAIP19AssetId: IdentifierSpec = {
8787 } ,
8888} ;
8989
90- const BlockNumberTag : IdentifierSpec = {
91- name : "blockNumberTag" ,
92- regex : "[0-9]{1,78}|latest" ,
93- parameters : {
94- delimiter : "" ,
95- values : {
96- 0 : {
97- name : "blockNumberTag" ,
98- regex : "[0-9]{1,78}|latest" ,
99- } ,
100- } ,
101- } ,
102- } ;
103-
10490const CAIP19BlockNumberTag : IdentifierSpec = {
10591 name : "blockNumberTag" ,
106- regex : ".* " ,
92+ regex : "[-:a-zA-Z0-9]{13,226} " ,
10793 parameters : {
10894 delimiter : "#" ,
10995 values : {
11096 0 : CAIP19AssetId ,
111- 2 : BlockNumberTag ,
97+ 1 : {
98+ name : "blockNumberTag" ,
99+ regex : "[0-9]{1,78}|latest" ,
100+ } ,
112101 } ,
113102 } ,
114103} ;
@@ -119,6 +108,7 @@ export const CAIP = {
119108 "19" : {
120109 assetName : AssetName ,
121110 assetType : CAIP19AssetType ,
122- assetId : CAIP19BlockNumberTag ,
111+ assetId : CAIP19AssetId ,
112+ blockNumberTag : CAIP19BlockNumberTag ,
123113 } ,
124114} ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ function assertInterface(result: AssetId) {
66 expect ( result . chainId . toString ( ) ) . toEqual ( data . CHAIN_ID_STRING ) ;
77 expect ( result . assetName . toString ( ) ) . toEqual ( data . ASSET_NAME_STRING ) ;
88 expect ( result . tokenId ) . toEqual ( data . TOKEN_ID ) ;
9+ expect ( result . blockNumberTag ) . toEqual ( data . BLOCK_NUMBER_TAG ) ;
910 expect ( result . toString ( ) ) . toEqual ( data . ASSET_ID_STRING ) ;
1011 expect ( result . toJSON ( ) ) . toEqual ( data . ASSET_ID_NESTED_PARAMS ) ;
1112}
You can’t perform that action at this time.
0 commit comments