File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
packages/sdk/src/transactions/Transaction Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -126,25 +126,32 @@ export function deserializeBlockItem(buffer: ArrayBuffer): Upward<BlockItem> {
126126 const cursor = Cursor . fromBuffer ( buffer ) ;
127127
128128 const blockItemKind = deserializeUint8 ( cursor ) ;
129+ let blockItem : BlockItem ;
129130 switch ( blockItemKind ) {
130131 case BlockItemKind . AccountTransactionKind :
131- return {
132+ blockItem = {
132133 kind : BlockItemKind . AccountTransactionKind ,
133134 transaction : AccountTransactionV0 . deserialize ( cursor ) ,
134135 } ;
136+ break ;
135137 case BlockItemKind . CredentialDeploymentKind :
136- return {
138+ blockItem = {
137139 kind : BlockItemKind . CredentialDeploymentKind ,
138140 transaction : deserializeCredentialDeployment ( cursor ) ,
139141 } ;
142+ break ;
140143 case BlockItemKind . UpdateInstructionKind :
141144 throw new Error ( 'deserialization of UpdateInstructions is not supported' ) ;
142145 case BlockItemKind . AccountTransactionV1Kind :
143- return {
146+ blockItem = {
144147 kind : BlockItemKind . AccountTransactionV1Kind ,
145148 transaction : AccountTransactionV1 . deserialize ( cursor ) ,
146149 } ;
150+ break ;
147151 default :
148152 return null ;
149153 }
154+
155+ if ( cursor . remainingBytes . length !== 0 ) throw new Error ( 'Deserializing the transaction did not exhaust the buffer' ) ;
156+ return blockItem ;
150157}
You can’t perform that action at this time.
0 commit comments