File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
common/changes/@subsquid/solana-typegen
solana/solana-typegen/src/program/anchor Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "changes" : [
3+ {
4+ "packageName" : " @subsquid/solana-typegen" ,
5+ "comment" : " add support for Shank tuple types" ,
6+ "type" : " minor"
7+ }
8+ ],
9+ "packageName" : " @subsquid/solana-typegen"
10+ }
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ export type IdlType =
149149 | IdlTypeCOption
150150 | IdlTypeVec
151151 | IdlTypeArray
152+ | IdlTypeTuple
152153 | IdlTypeHashMap
153154 | IdlTypeHashSet
154155
@@ -173,6 +174,10 @@ export type IdlTypeArray = {
173174 array : [ idlType : IdlType , size : number ]
174175}
175176
177+ export type IdlTypeTuple = {
178+ tuple : IdlType [ ]
179+ }
180+
176181export type IdlTypeHashMap = {
177182 hashMap : [ idlType : IdlType , idlType : IdlType ]
178183}
@@ -365,6 +370,11 @@ function fromType(type: IdlType): Type {
365370 kind : TypeKind . Array ,
366371 type : fromType ( type . vec ) ,
367372 }
373+ } else if ( 'tuple' in type ) {
374+ return {
375+ kind : TypeKind . Tuple ,
376+ tuple : type . tuple . map ( t => fromType ( t as IdlType ) ) ,
377+ }
368378 } else if ( 'hashMap' in type ) {
369379 return {
370380 kind : TypeKind . HashMap ,
Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ export type IdlType =
238238 | IdlTypeCOption
239239 | IdlTypeVec
240240 | IdlTypeArray
241+ | IdlTypeTuple
241242 | IdlTypeHashMap
242243 | IdlTypeHashSet
243244 | IdlTypeDefined
@@ -260,6 +261,10 @@ export type IdlTypeArray = {
260261 array : [ idlType : IdlType , size : IdlArrayLen ]
261262}
262263
264+ export type IdlTypeTuple = {
265+ tuple : IdlType [ ]
266+ }
267+
263268export type IdlTypeHashMap = {
264269 hashMap : [ idlType : IdlType , idlType : IdlType ]
265270}
@@ -405,6 +410,11 @@ function fromType(type: IdlType): Type {
405410 kind : TypeKind . Array ,
406411 type : fromType ( type . vec ) ,
407412 }
413+ } else if ( 'tuple' in type ) {
414+ return {
415+ kind : TypeKind . Tuple ,
416+ tuple : type . tuple . map ( t => fromType ( t as IdlType ) )
417+ }
408418 } else if ( 'hashMap' in type ) {
409419 return {
410420 kind : TypeKind . HashMap ,
You can’t perform that action at this time.
0 commit comments