Skip to content

Retruning an Object instead of an Array on ContractStructOutput #4840

Open
@ix-hammer-turtle

Description

@ix-hammer-turtle

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions