Skip to content

Keep parameters order in anchor client #51

Description

@julianzamt

Is your enhancement request related to a problem? Please describe.
In Anchor client, fn parameters are arbitrarily changed from the order specified in the CIDL. This can be annoying when passing arguments in fn calls

Describe the solution you'd like
To keep the order for explicit inputs, and define a fixed parameter order for inputs inferred by the generator, to facilitate the work-loop.

In the CIDL the method is defined like

- name: instruction9
    summary: Test `init` using Non-PDA account that has one field
    inputs:
      - name: account
        type: NonPDAAccountWithOneField
        solana:
          attributes: [ init ]
      - name: input_1
        type: u8

But in the generated client the fn is defined as
image

However, in this other method

- name: instruction10
    summary: Test `init` using PDA account that has one static seed and one field
    inputs:
      - name: account
        type: PDAAccountWithOneStaticSeedAndOneField
        solana:
          attributes: [ init ]
      - name: input_1
        type: u8

The generated signature is:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis is an item that causes unwanted behaviorDoneThis has been merged to develop

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions