Skip to content

Commit

Permalink
Fix bugs in makeGetCall
Browse files Browse the repository at this point in the history
  • Loading branch information
hrmon committed Jul 9, 2023
1 parent 012a558 commit a4d7049
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/lib/makeGetCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function _prepareParams(params: any[] = []) {
const paramsTuple = new TupleBuilder();
params.forEach((p) => {
if (p instanceof Cell) {
paramsTuple.writeCell(p);
paramsTuple.writeSlice(p);
} else if (typeof p === "bigint") {
paramsTuple.writeNumber(p);
}
Expand All @@ -29,18 +29,25 @@ function _parseGetMethodCall(stack: TupleReader): GetResponseValue[] {
while (stack.remaining) {
const item = stack.pop();
switch (item.type) {
case "int":
case "int": {
parsedItems.push((item as TupleItemInt).value);
case "cell":
break;
}
case "cell": {
parsedItems.push((item as TupleItemCell).cell);
case "tuple":
break;
}
case "tuple": {
if ((item as Tuple).items.length === 0) {
parsedItems.push(null);
} else {
throw new Error("list parsing not supported");
}
default:
break;
}
default: {
throw new Error(`unknown type: ${item.type}`);
}
}
}
return parsedItems;
Expand Down

0 comments on commit a4d7049

Please sign in to comment.