Skip to content

Improve user experience when handling nested tuples #538

Description

@PaulRBerg

Given an event with nested tuples, like so:

struct CreateEventCommon {
  address funder;
  address sender;
  address recipient;
  Lockup.CreateAmounts amounts;
  IERC20 token;
  bool cancelable;
  bool transferable;
  Lockup.Timestamps timestamps;
  string shape;
  address broker;
}

event CreateLockupTranchedStream(
  uint256 indexed streamId, Lockup.CreateEventCommon commonParams, LockupTranched.Tranche[] tranches
);

Envio will generate the following types:

export type SablierLockup_v2_0_CreateLockupTranchedStream_eventArgs = {
  readonly streamId: bigint;
  readonly commonParams: [
    Address_t,
    Address_t,
    Address_t,
    [bigint, bigint],
    Address_t,
    boolean,
    boolean,
    [bigint, bigint],
    string,
    Address_t,
  ];
  readonly tranches: Array<[bigint, bigint]>;
};

As you can see, commonParams is an array.

Whereas I was expecting it to be an object with named fields (funder, sender).

The lack of named fields impairs the user experience because the developer has to constantly double check the Solidity interface. And this makes the implementation error-prone when the fields have the same type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions