governance-ui icon indicating copy to clipboard operation
governance-ui copied to clipboard

Allow proposing any anchor instruction

Open mschneider opened this issue 3 years ago • 6 comments

User supplies program id, governance automatically detects idl and generates remaining form based on it.

mschneider avatar Feb 17 '22 14:02 mschneider

Could you clarify what would be generated? My understanding is that the current workflow is to go to the place below (screenshot). These options seem pretty specific to a DAO.

image

RaymondDashWu avatar Feb 22 '22 01:02 RaymondDashWu

the above form is to create a new governance. governances can execute arbitrary solana instructions, anchor's idl is a way to describe those instructions so that clients can be generated. it is stored deterministic on-chain so that providing the program id is enough to select the client

Once example could be to initialize an escrow: https://github.com/project-serum/anchor/blob/master/tests/escrow/programs/escrow/src/lib.rs#L30

In this case the form would provide inputs to specify:

  1. the program id, once added, idl is downloaded and parsed and more fields appear.
  2. deposit_token_account a token account under the realms' governances
  3. receive_token_account another token account under the realms' governances
  4. initializer_amount & taker_amount as number inputs

mschneider avatar Feb 22 '22 22:02 mschneider

Thanks for the example. I'll need to do research into other types of use cases. However, for now, I wanted to know if there was a way to fetch idls with the current dependencies. I tried querying random verified and unverified programs on anchor's api. All of them gave me this: image

RaymondDashWu avatar Feb 23 '22 17:02 RaymondDashWu

The IDL is stored in a buffer on-chain.

mschneider avatar Feb 23 '22 18:02 mschneider

After talking with Sebastian, this is the idea we came up with since IDL isn't strictly necessary for users. An extra option to "Execute IDL instructions" that will auto populate. What are your thoughts?

image

Potential blockers for me will be auto populating these instructions with all the details (ex: show accounts but without labels) based off the IDL image

RaymondDashWu avatar Feb 24 '22 18:02 RaymondDashWu

anchor has a new spec for deriving PDAs from idls, that should take care of most of the account issues

mschneider avatar Feb 25 '22 17:02 mschneider