@@ -92,14 +92,14 @@ export class XdrSchemaDecoder {
9292 */
9393 private readEnum ( schema : XdrEnumSchema ) : string | number {
9494 const value = this . decoder . readEnum ( ) ;
95-
95+
9696 // Find the enum name for this value
9797 for ( const [ name , enumValue ] of Object . entries ( schema . values ) ) {
9898 if ( enumValue === value ) {
9999 return name ;
100100 }
101101 }
102-
102+
103103 // If no matching name found, return the numeric value
104104 return value ;
105105 }
@@ -116,12 +116,12 @@ export class XdrSchemaDecoder {
116116 */
117117 private readVarlenOpaque ( schema : XdrVarlenOpaqueSchema ) : Uint8Array {
118118 const data = this . decoder . readVarlenOpaque ( ) ;
119-
119+
120120 // Check size constraint if specified
121121 if ( schema . size !== undefined && data . length > schema . size ) {
122122 throw new Error ( `Variable-length opaque data size ${ data . length } exceeds maximum ${ schema . size } ` ) ;
123123 }
124-
124+
125125 return data ;
126126 }
127127
@@ -130,12 +130,12 @@ export class XdrSchemaDecoder {
130130 */
131131 private readString ( schema : XdrStringSchema ) : string {
132132 const str = this . decoder . readString ( ) ;
133-
133+
134134 // Check size constraint if specified
135135 if ( schema . size !== undefined && str . length > schema . size ) {
136136 throw new Error ( `String length ${ str . length } exceeds maximum ${ schema . size } ` ) ;
137137 }
138-
138+
139139 return str ;
140140 }
141141
@@ -151,12 +151,12 @@ export class XdrSchemaDecoder {
151151 */
152152 private readVarlenArray ( schema : XdrVarlenArraySchema ) : unknown [ ] {
153153 const array = this . decoder . readVarlenArray ( ( ) => this . readValue ( schema . elements ) ) ;
154-
154+
155155 // Check size constraint if specified
156156 if ( schema . size !== undefined && array . length > schema . size ) {
157157 throw new Error ( `Variable-length array size ${ array . length } exceeds maximum ${ schema . size } ` ) ;
158158 }
159-
159+
160160 return array ;
161161 }
162162
@@ -165,11 +165,11 @@ export class XdrSchemaDecoder {
165165 */
166166 private readStruct ( schema : XdrStructSchema ) : Record < string , unknown > {
167167 const struct : Record < string , unknown > = { } ;
168-
168+
169169 for ( const [ fieldSchema , fieldName ] of schema . fields ) {
170170 struct [ fieldName ] = this . readValue ( fieldSchema ) ;
171171 }
172-
172+
173173 return struct ;
174174 }
175175
@@ -179,21 +179,21 @@ export class XdrSchemaDecoder {
179179 private readUnion ( schema : XdrUnionSchema ) : XdrUnion {
180180 // Read discriminant
181181 const discriminant = this . decoder . readInt ( ) ;
182-
182+
183183 // Find matching arm
184184 for ( const [ armDiscriminant , armSchema ] of schema . arms ) {
185185 if ( armDiscriminant === discriminant ) {
186186 const value = this . readValue ( armSchema ) ;
187187 return new XdrUnion ( discriminant , value ) ;
188188 }
189189 }
190-
190+
191191 // If no matching arm found, try default
192192 if ( schema . default ) {
193193 const value = this . readValue ( schema . default ) ;
194194 return new XdrUnion ( discriminant , value ) ;
195195 }
196-
196+
197197 throw new Error ( `No matching union arm for discriminant: ${ discriminant } ` ) ;
198198 }
199- }
199+ }
0 commit comments