Skip to content

Commit

Permalink
Handle null replies
Browse files Browse the repository at this point in the history
  • Loading branch information
d0rich committed Jul 5, 2024
1 parent 9e0c8e4 commit fb20e8d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/parser/parseStackItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ export function parseStackItem(s: StackItem): TupleItem {
return { type: 'slice', cell: Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] };
} else if (s[0] === 'builder') {
return { type: 'builder', cell: Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] };
} else if (s[0] === 'tuple' || s[0] === 'list') {
} else if (s[0] === 'tuple') {
return { type: 'tuple', items: s[1].elements.map(parseTvmValue) };
} else if (s[0] === 'list') {
// Empty list is a null value
if (s[1].elements.length === 0) {
return { type: 'null' };
}
// FIXME: possibly it is not used
return { type: 'tuple', items: s[1].elements.map(parseTvmValue) };
} else {
throw Error('Unsupported stack item type: ' + s[0])
}
Expand Down

0 comments on commit fb20e8d

Please sign in to comment.