apps icon indicating copy to clipboard operation
apps copied to clipboard

Support fellowshipTreasury

Open xlc opened this issue 1 year ago • 7 comments

On the polkadot collective chain, a fellowshipTreasury is introduced with https://github.com/polkadot-fellows/runtimes/pull/109

We should be able to config pjs apps somehwere to enable the Treasury page for it.

xlc avatar Mar 02 '24 05:03 xlc

Taking this one

ryanleecode avatar Mar 11 '24 17:03 ryanleecode

I can confirm the FellowshipTreasury pallet does exist on collectives and can be queried

import { getScProvider, WellKnownChain } from "@polkadot-api/sc-provider"
import { getChain } from "@polkadot-api/node-polkadot-provider"
import { createClient } from "@polkadot-api/client"
import { polkadot_collectives } from "@substrate/connect-known-chains"

import Collectives from "./descriptors/collectives"
const scProvider = getScProvider()

const collectivesChain = getChain({
  provider: scProvider(WellKnownChain.polkadot).addParachain(polkadot_collectives),
  keyring: [],
})

const relayChain = createClient(collectivesChain)

const collectives = relayChain.getTypedApi(Collectives)

console.log("aaa", await collectives.query.FellowshipTreasury.Proposals.getEntries())

Result:

aaa []

In polkadot JS whats stopping the treasury page from being shown is the needs API dependency on tx.treasury.proposeSpend. and it is missing when i print out the derive object

image

ryanleecode avatar Mar 13 '24 23:03 ryanleecode

Actually yeah, there is just no treasury pallet on collectives

ryanleecode avatar Mar 13 '24 23:03 ryanleecode

Thanks for looking into this. Couple things:

  • tx.treasury.proposeSpend wont be under the derives. The derives are not generated at runtime based on the chain the api is connected to, they are static functions that contain more complex logic. Usually they connect a bunch of storage calls to simplify the aggregating or calculating of data.

  • An easy way to see if the api has a certain storage calls or to check if a pallet exists you can:

    1. Head to the developer tabs and go to javascript here.
    2. You can see what the api generated at runtime based on the chain you are connected too:
    console.log(Object.keys(api.tx)) // This will show all the available pallets for `tx`
    console.log(Object.keys(api.query)) // This will show all the available pallets for `query` (storage queries)
    console.log(Object.keys(api.tx.fellowshipTreasury)) // This will show that `proposeSend` exists for `fellowshipTreasury`
    
  • Looks like we can create a new page-fellowshipTreasury and a new apps-routing that says if api.query.fellowshipTreasury exists we that page should show up. Then we can set it in the governance tab.

TarikGul avatar Mar 14 '24 00:03 TarikGul

I believe pjs apps supports to pallet name alias. For example, for the Council page, it works for council in Polkadot, and generalCouncil in Acala. So most likely just need to reuse whatever feature used there and have some configs.

xlc avatar Mar 14 '24 01:03 xlc

the fellowshipTreasury pallet is completely different from the current treasury pallet. the latter seems dated.

two questions

  1. can you add some proposals & approvals on westend
  2. how do i join the fellowship on westend for testing?

ryanleecode avatar Mar 14 '24 23:03 ryanleecode

the pallet are the same one just with maybe different versions. the treasury page have to support all the versions of the treasury pallet.

for development and testing purpose, just use chopsticks to fork mainnet and you can then make Alice as a member and do whatever you want. let me know if you need some details instructions on how to do it

xlc avatar Mar 14 '24 23:03 xlc