This repository was archived by the owner on Dec 18, 2023. It is now read-only.
File tree 2 files changed +11
-13
lines changed
2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @mean-dao/msp" ,
3
- "version" : " 2.6.0-alpha.3 " ,
3
+ "version" : " 2.6.0-alpha.4 " ,
4
4
"description" : " MSP Typescript SDK" ,
5
5
"private" : false ,
6
6
"main" : " lib/index.js" ,
Original file line number Diff line number Diff line change @@ -621,6 +621,9 @@ const parseStreamItemData = (
621
621
622
622
let idl_legacy_after_1645224519 : any = null ;
623
623
let idl_legacy_before_1645224519 : any = null ;
624
+ const idlPaths : string [ ] = [
625
+ './msp_idl_001' ,
626
+ ]
624
627
const idls : { [ fileVersion : number ] : any } = { } ;
625
628
626
629
async function parseStreamInstructionAfter1645224519 (
@@ -819,23 +822,18 @@ async function parseVersionedStreamInstruction(
819
822
return null ;
820
823
}
821
824
822
- if ( idlFileVersion <= 0 || idlFileVersion > 255 ) {
825
+ if ( idlFileVersion <= 0 || idlFileVersion > LATEST_IDL_FILE_VERSION ) {
823
826
return null ;
824
827
}
825
828
826
- let idlFileVersionStr = idlFileVersion . toString ( ) ;
827
- if ( idlFileVersion < 10 ) {
828
- idlFileVersionStr = '00' + idlFileVersionStr ;
829
- } else if ( idlFileVersion < 200 ) {
830
- idlFileVersionStr = '0' + idlFileVersionStr ;
831
- }
832
-
833
- const idlFileName = `msp_idl_${ idlFileVersionStr } ` ;
834
-
835
829
try {
836
830
if ( ! idls [ idlFileVersion ] ) {
837
- const importedIdl = await import ( `./${ idlFileName } ` ) ;
838
- idls [ idlFileVersion ] = importedIdl . IDL ;
831
+ if ( idlFileVersion === 1 ) { // TODO: to avoid this if else, find a way to do dynamic imports passign concatenated paths
832
+ const importedIdl = await import ( './msp_idl_001' ) ;
833
+ idls [ idlFileVersion ] = importedIdl . IDL ;
834
+ } else {
835
+ return null ;
836
+ }
839
837
}
840
838
841
839
const coder = new BorshInstructionCoder ( idls [ idlFileVersion ] as Idl ) ;
You can’t perform that action at this time.
0 commit comments