types.json
:
{
"WorkerId": {
"_enum": {
"Single": "Single",
"Double": "Double"
}
},
"Single": "u8",
"Double": "(u8, u8)",
}
基板代码:
#[pallet::storage]
#[pallet::getter(fn worker_infos)]
pub type WorkerInfos<T: Config> = StorageMap<_, Twox64Concat, WorkerId, WorkerInfo, ValueQuery>;
pub enum WorkerId {
Single(u8),
Double(u8, u8),
}
我想在 polkadot.js中查询worker_infos
:WorkerId
workerIds = [1,2]
api.query[wrpc][wcallable]
.multi(workerIds, (results) => {
...
})
.then((unsub) => {
...
})
.catch(console.error);
错误信息:
REGISTRY: Error: Unable to create Enum via index 2, in Single, Double
对此有什么想法吗?如何在 polkadot.js 中传递 workerIds(枚举类型)?