我在运行时模块中定义了以下数据类型
#[derive(Encode, Decode, Clone, PartialEq, Debug)]
pub enum AuctionStatus {
Ongoing,
Cancelled,
ToBeClaimed,
Closed
}
// This is necessary so that other structs depend on this enum can be encode/decode with default value.
impl Default for AuctionStatus {
fn default() -> Self { AuctionStatus::Ongoing }
}
#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)]
pub struct Auction<Hash, Balance, Moment, AuctionTx> {
id: Hash,
kitty_id: Hash,
base_price: Balance,
start_time: Moment,
end_time: Moment,
status: AuctionStatus,
tx: Option<AuctionTx>,
}
#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)]
pub struct AuctionTx<Hash, AccountId, Balance, Moment> {
auction_id: Hash,
tx_time: Moment,
buyer: AccountId,
tx_price: Balance,
}
现在在 polkadot UI 中,要导入的正确 JSON 类型定义应该是什么?
我尝试了以下但 polkadotUI 仍然说未知类型。
{
"AuctionStatus": "u32",
"AuctionTx": {
"auction_id": "Hash",
"tx_time": "Moment",
"buyer": "AccountId",
"tx_price": "Balance"
},
"Auction": {
"id": "Hash",
"kitty_id": "Hash",
"base_price": "Balance",
"start_time": "Moment",
"end_time": "Moment",
"status": "AuctionStatus",
"tx": "Option<AuctionTx>"
}
}
更新01:
以下是浏览器控制台错误消息:
第一条消息:
Unable to decode storage catAuction.auctions: createType(Auction):: Encoding for input doesn't match output, created 0xa9531feb7f4eb8a888e1eedf72e812e26e32a53a2e379ef79bb2e8f7d883f2462e1cd9ea24d53ce565292a9e56458943554c7c13b6aef70c00079076650bdd8f983a0000000000000000000000000000f6491c5d0000000060ce1e5d00000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 from 0xa9531feb7f4eb8a888e1eedf72e812e26e32a53a2e379ef79bb2e8f7d883f2462e1cd9ea24d53ce565292a9e56458943554c7c13b6aef70c00079076650bdd8f983a0000000000000000000000000000f6491c5d0000000060ce1e5d000000000000
第二条消息:
2019-07-03 14:24:40 RPC-CORE: subscribeStorage (keys: Vec<StorageKey>): StorageChangeSet:: createType(Auction):: Encoding for input doesn't match output, created 0xa9531feb7f4eb8a888e1eedf72e812e26e32a53a2e379ef79bb2e8f7d883f2462e1cd9ea24d53ce565292a9e56458943554c7c13b6aef70c00079076650bdd8f983a0000000000000000000000000000f6491c5d0000000060ce1e5d00000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 from 0xa9531feb7f4eb8a888e1eedf72e812e26e32a53a2e379ef79bb2e8f7d883f2462e1cd9ea24d53ce565292a9e56458943554c7c13b6aef70c00079076650bdd8f983a0000000000000000000000000000f6491c5d0000000060ce1e5d000000000000
不知道这是否有任何帮助......