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

Retruning an Object instead of an Array on ContractStructOutput #4840

Open
ix-hammer-turtle opened this issue Sep 20, 2024 · 1 comment
Open
Labels
enhancement New feature or improvement.

Comments

@ix-hammer-turtle
Copy link

ix-hammer-turtle commented Sep 20, 2024

Describe the Feature

Search Terms

tuple,object,array

Description

In version 6.12, the functionality is available for Result objects (#4681). However, it is still not operational with ContractStructObject. It would be beneficial to have this feature.

Code Example

const proposal = await this.proposalVoteContract.getProposal(projectId, proposalId);

const proposalObject: Proposal = {
  proposed: proposal.proposed,
  executed: proposal.executed,
  canceled: proposal.canceled,
  id: Number(proposal.id),
  proposalId: Number(proposal.proposalId),
  title: proposal.title,
  description: proposal.description,
  quorumPercent: Number(proposal.quorumPercent),
  snapshotAt: Number(proposal.snapshotAt),
  startAt: Number(proposal.startAt),
  endAt: Number(proposal.endAt),
  isExecutable: proposal.isExecutable,
  availableToExecuteAt: Number(proposal.availableToExecuteAt),
  erc20: proposal.erc20,
  from: proposal.from,
  to: proposal.to,
  amount: Number(proposal.amount),
  fundRaiser: proposal.fundRaiser,
};

// instead

const proposal = await this.proposalVoteContract.getProposal(projectId, proposalId);

const proposalObject = proposal.toObject()
@ix-hammer-turtle ix-hammer-turtle added the enhancement New feature or improvement. label Sep 20, 2024
@ricmoo
Copy link
Member

ricmoo commented Oct 16, 2024

Sorry, I don't quite understand the request... Can you provide examples of what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement.
Projects
None yet
Development

No branches or pull requests

2 participants