apps
apps copied to clipboard
Support fellowshipTreasury
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.
Taking this one
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
Actually yeah, there is just no treasury pallet on collectives
Thanks for looking into this. Couple things:
-
tx.treasury.proposeSpendwont 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:
- Head to the developer tabs and go to javascript here.
- 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-fellowshipTreasuryand a new apps-routing that says ifapi.query.fellowshipTreasuryexists we that page should show up. Then we can set it in the governance tab.
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.
the fellowshipTreasury pallet is completely different from the current treasury pallet. the latter seems dated.
two questions
- can you add some proposals & approvals on westend
- how do i join the fellowship on westend for testing?
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