Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions yarn-project/stdlib/src/abi/decoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,7 @@ describe('decoder', () => {
1n,
2n,
false,
// TODO(#14600): correctly decode the string as string instead of 3 bigints
// 'xyz',
[120n, 121n, 122n],
'xyz',
AztecAddress.fromBigInt(1n),
// eslint-disable-next-line camelcase
{ x: 1n, y: 2n, is_infinite: false },
Expand Down
9 changes: 5 additions & 4 deletions yarn-project/stdlib/src/abi/decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { isAztecAddressStruct, parseSignedInt } from './utils.js';
/**
* The type of our decoded ABI.
*/
export type AbiDecoded = bigint | boolean | AztecAddress | AbiDecoded[] | { [key: string]: AbiDecoded };
export type AbiDecoded = bigint | boolean | string | AztecAddress | AbiDecoded[] | { [key: string]: AbiDecoded };

/**
* Decodes values using a provided ABI.
Expand Down Expand Up @@ -58,11 +58,12 @@ class AbiDecoder {
return struct;
}
case 'string': {
const array = [];
let str = '';
for (let i = 0; i < abiType.length; i += 1) {
array.push(this.getNextField().toBigInt());
const charCode = Number(this.getNextField().toBigInt());
str += String.fromCharCode(charCode);
}
return array;
return str;
}
case 'tuple': {
const array = [];
Expand Down