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
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("test smart contract transactions outcome parser", () => {
const transactionOnNetwork = new TransactionOnNetwork({
nonce: 7n,
function: "getUltimateAnswer",
smartContractResults: [new SmartContractResult({ data: Buffer.from("@6f6b@2a") })],
smartContractResults: [new SmartContractResult({ data: Buffer.from("QDZmNmJAMmE=", "base64") })],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the inconsistencies between API and Proxy are not yet reconciled at the SDK level, thus a further fix is needed.

On proxy, it's an UTF-8 string (it's sub-components being hex-encoded):

On API, it's a base64-encoded string:

Good catch 🎉

We'll discuss this a bit internally, then come back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think we can approve this PR, since there's no change in the implementation with respect to this issue - there's only the fix in smartContractTransactionsOutcomeParser.ts. And we can handle the Proxy - API inconsistency in a separate PR.

});

const parsed = parser.parseExecute({ transactionOnNetwork });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class SmartContractTransactionsOutcomeParser {
const eligibleResults: SmartContractResult[] = [];

for (const result of transactionOnNetwork.smartContractResults) {
const matchesCriteriaOnData = result.data.toString().startsWith(ARGUMENTS_SEPARATOR);
const matchesCriteriaOnData = Buffer.from(result.data).toString("utf-8").startsWith(ARGUMENTS_SEPARATOR);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const matchesCriteriaOnReceiver = result.receiver.toBech32() === transactionOnNetwork.sender.toBech32();
const matchesCriteriaOnPreviousHash = result;

Expand Down
Loading