Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove transation outcome and fix changes #539

Merged
merged 19 commits into from
Nov 25, 2024

Conversation

danielailie
Copy link
Contributor

No description provided.

@danielailie danielailie self-assigned this Nov 22, 2024

export class SmartContractResult {
sender: string;
receiver: string;
raw: Record<string, any>;
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 this class should have been moved as well, It's fine if it's planned for a future PR.

data: Buffer.from(
"QDZmNmJAMDAwMDAwMDAwMDAwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMGZmZmZmZg==",
"base64",
),
logs: scResultLog,
});

const txOutcome = new TransactionOutcome({ smartContractResults: [scResult], logs: logs });
const txOutcome = new TransactionOnNetwork({ smartContractResults: [scResult], logs: logs });
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be renamed.

@@ -48,7 +33,7 @@ export class DelegationTransactionsOutcomeParser {
return "";
}
const address = Buffer.from(event.topics[0]);
return Address.fromBuffer(address).bech32();
return new Address(address).bech32();
Copy link
Contributor

Choose a reason for hiding this comment

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

toBech32 could have been used.

Copy link
Contributor

Choose a reason for hiding this comment

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

this could have been named transactionOnNetwork.ts.

Copy link
Contributor

Choose a reason for hiding this comment

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

are these classes still used somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove them in the next pr when I remove the result parsers

@@ -441,7 +390,7 @@ export class TokenManagementTransactionsOutcomeParser {
return "";
}
const address = Buffer.from(event.topics[3]);
return Address.fromBuffer(address).bech32();
return new Address(address).bech32();
Copy link
Contributor

Choose a reason for hiding this comment

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

use toBech32 here, as well.

@@ -38,12 +37,12 @@ export class TokenManagementController {
return transaction;
}

async awaitCompletedIssueFungible(txHash: string): Promise<IESDTIssueOutcome[]> {
async awaitCompletedIssueFungible(txHash: string): Promise<{ tokenIdentifier: string }[]> {
Copy link
Contributor

Choose a reason for hiding this comment

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

So for output objects we don't define types / resources, only for inputs? 💭

@@ -1,688 +0,0 @@
import { assert } from "chai";
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a future task to re-write these system tests for the new factories / controllers (nice to have).

@@ -178,21 +177,21 @@ export class Transaction {
/**
* Legacy method, use the "sender" property instead.
*/
getSender(): IAddress {
getSender(): Address {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a task to add the deprecation marker for these legacy functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

private readonly firstTopicIsIdentifier: boolean;

constructor(options: { abi: IAbi; firstTopicIsIdentifier?: boolean }) {
constructor(options: { abi: AbiRegistry; firstTopicIsIdentifier?: boolean }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a task to create an alias in v14, so that we have the same name as in PY: Abi. Or to completely rename it.

Comment on lines +8 to +9
data: Uint8Array = new Uint8Array();
additionalData: Uint8Array[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Object.assign(this, init);
}

static fromHttpResponse(responsePart: {
Copy link
Contributor

Choose a reason for hiding this comment

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

In sdk-py, this conversion is defined somewhere else (network providers module).

let result = new TransactionEvent();
result.address = new Address(responsePart.address);
result.identifier = responsePart.identifier || "";
result.topics = (responsePart.topics || []).map((topic) => Buffer.from(topic));
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +34 to +40
findFirstOrNoneTopic(predicate: (topic: Uint8Array) => boolean): Uint8Array | undefined {
return this.topics.filter((topic) => predicate(topic))[0];
}

getLastTopic(): Uint8Array {
return this.topics[this.topics.length - 1];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If they aren't used anymore, can be dropped (sorry if I'm mistaken, I didn't double check).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove them in the pr where I remove result parser

@danielailie danielailie merged commit e948755 into feat/next Nov 25, 2024
4 checks passed
@danielailie danielailie deleted the TOOL-368-remove-transaction-outcome branch November 25, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants