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:中通过WorkerId
查询worker_infos
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中传递workerId(枚举类型(
{单:1}或{双:[2,3]}