File tree 3 files changed +17
-9
lines changed
3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ export namespace NTT {
268
268
pdas ?: Pdas
269
269
) {
270
270
// if the program is < major version 2.x.x, we don't need to initialize the LUT
271
- const [ major , , ] = parseVersion ( program . idl . version ) ;
271
+ const [ major , , , ] = parseVersion ( program . idl . version ) ;
272
272
if ( major < 2 ) return ;
273
273
274
274
pdas = pdas ?? NTT . pdas ( program . programId ) ;
@@ -997,7 +997,7 @@ export namespace NTT {
997
997
program : Program < NttBindings . NativeTokenTransfer < IdlVersion > > ,
998
998
pdas ?: Pdas
999
999
) : Promise < AddressLookupTableAccount | null > {
1000
- const [ major , , ] = parseVersion ( program . idl . version ) ;
1000
+ const [ major , , , ] = parseVersion ( program . idl . version ) ;
1001
1001
if ( major < 2 ) return null ;
1002
1002
1003
1003
pdas = pdas ?? NTT . pdas ( program . programId ) ;
Original file line number Diff line number Diff line change @@ -18,10 +18,20 @@ export function programDataAddress(programId: PublicKeyInitData) {
18
18
) [ 0 ] ;
19
19
}
20
20
21
- export function parseVersion ( version : string ) : [ number , number , number ] {
21
+ export function parseVersion (
22
+ version : string
23
+ ) : [ number , number , number , string ] {
22
24
const components = version . split ( "." ) ;
23
- if ( components . length !== 3 ) throw new Error ( "Invalid version string" ) ;
24
- return [ Number ( components [ 0 ] ) , Number ( components [ 1 ] ) , Number ( components [ 2 ] ) ] ;
25
+ if ( components . length < 3 ) throw new Error ( "Invalid version string" ) ;
26
+ const patchVersion = components [ 2 ] ! ;
27
+ const patchNumber = patchVersion . split ( / [ ^ 0 - 9 ] / ) [ 0 ] ! ;
28
+ const patchLabel = patchVersion . slice ( patchNumber . length ) ;
29
+ return [
30
+ Number ( components [ 0 ] ) ,
31
+ Number ( components [ 1 ] ) ,
32
+ Number ( patchNumber ) ,
33
+ patchLabel ,
34
+ ] ;
25
35
}
26
36
27
37
export const pubKeyConversion = {
Original file line number Diff line number Diff line change @@ -639,10 +639,8 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
639
639
useCache = true
640
640
) : Promise < AddressLookupTableAccount > {
641
641
if ( ! useCache || ! this . addressLookupTable ) {
642
- this . addressLookupTable = await NTT . getAddressLookupTable (
643
- this . program ,
644
- this . pdas
645
- ) ;
642
+ const alut = await NTT . getAddressLookupTable ( this . program , this . pdas ) ;
643
+ if ( alut ) this . addressLookupTable = alut ;
646
644
}
647
645
648
646
if ( ! this . addressLookupTable )
You can’t perform that action at this time.
0 commit comments