Skip to content

Commit

Permalink
fix bug with ` symbol in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich committed Mar 26, 2024
1 parent 2692dac commit 9e0e879
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/bindings/writeTypescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ export function writeTypescript(abi: ContractABI, init?: {
w.inIndent(() => {
if (abi.errors) {
for (const k in abi.errors) {
w.append(`${k}: { message: \`${abi.errors[parseInt(k, 10)].message}\` },`);
w.append(
`${k}: { message: \`${abi.errors[
parseInt(k, 10)
].message.replaceAll('`', '\\`')}\` },`
);
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/test/__snapshots__/bugs.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ exports[`bugs should deploy contract correctly 1`] = `
"$type": "received",
"message": {
"body": {
"cell": "x{178D45190000000000000000502540BE400801D98D6D0FE85B55D6D58229C8ED55470B1C744D6BEEAD475C27236E9908A993110016E3A425A4E75B646191AC9A34FE5D050BD101A5C490F87D01C66D885D09BC1082_}",
"cell": "x{178D45190000000000000000502540BE400800A8651ACEAB81220DBBF8AA566E0CBE7FC77A30EADF32B457F1CF4DE9575E5A210016E3A425A4E75B646191AC9A34FE5D050BD101A5C490F87D01C66D885D09BC1082_}",
"type": "cell",
},
"bounce": false,
"from": "kQDsxraH9C2q62rBFOR2qqOFjjomtfdWo64TkbdMhFTJiLsN",
"to": "kQBGSDIgoUMAjGBNBXjsdBRlfPtqK5rKgQOD5N7yKFfIXeuh",
"from": "kQBUMo1nVcCRBt38VSs3Bl8_470YdW-ZWiv456b0q68tEE5x",
"to": "kQCzGu8bropdv4KCT6jpaDeRXU1coEBo8pjeCjMAt-xYDAXm",
"type": "internal",
"value": "9.95885",
},
Expand All @@ -38,7 +38,7 @@ exports[`bugs should deploy contract correctly 1`] = `
},
},
"bounce": false,
"from": "kQBGSDIgoUMAjGBNBXjsdBRlfPtqK5rKgQOD5N7yKFfIXeuh",
"from": "kQCzGu8bropdv4KCT6jpaDeRXU1coEBo8pjeCjMAt-xYDAXm",
"to": "@treasure(treasure)",
"type": "internal",
"value": "9.914852826",
Expand Down
2 changes: 2 additions & 0 deletions src/test/bugs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ describe('bugs', () => {
await contract.send(treasure, { value: toNano('10') }, { $$type: 'Mint', receiver: treasure.address, amount: toNano('10') });
await system.run();

expect(contract.abi.errors!['31733'].message).toStrictEqual('condition can`t be...')

expect(tracker.collect()).toMatchSnapshot();
});
});

0 comments on commit 9e0e879

Please sign in to comment.