Skip to content

Commit

Permalink
Update chainx types (paritytech#241)
Browse files Browse the repository at this point in the history
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
  • Loading branch information
koushiro committed Sep 21, 2020
1 parent 88669ee commit 9314669
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 104 deletions.
2 changes: 1 addition & 1 deletion scripts/chainx-js/chainx_rpc_manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AssetId, TotalAssetInfoForRpc>"
"type": "BTreeMap<AssetId, TotalAssetInfo>"
}
}
}
56 changes: 24 additions & 32 deletions scripts/chainx-js/chainx_types_manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"AmountOf": "Amount",
"CurrencyIdOf": "AssetId",
"CurrencyId": "AssetId",
"AssetInfoForRpc": {
"AssetInfo": {
"token": "String",
"token_name": "String",
"chain": "Chain",
Expand Down Expand Up @@ -51,22 +51,22 @@
"RpcOrder": {
"order_id": "OrderId",
"side": "Side",
"price": "RpcPrice",
"amount": "RpcBalance",
"price": "Price",
"amount": "Balance",
"pair_id": "TradingPairId",
"submitter": "AccountId",
"order_type": "OrderType",
"created_at": "BlockNumber",
"status": "OrderStatus",
"remaining": "RpcBalance",
"remaining": "Balance",
"executed_indices": "Vec<TradingHistoryIndex>",
"already_filled": "RpcBalance",
"reserved_balance": "RpcBalance",
"already_filled": "Balance",
"reserved_balance": "Balance",
"last_update_at": "BlockNumber"
},
"TotalAssetInfoForRpc": {
"info": "AssetInfoForRpc",
"balance": "BTreeMap<AssetType, String>",
"TotalAssetInfo": {
"info": "AssetInfo",
"balance": "BTreeMap<AssetType, Balance>",
"is_online": "bool",
"restrictions": "AssetRestrictions"
},
Expand Down Expand Up @@ -200,23 +200,23 @@
"registered_at": "BlockNumber",
"is_chilled": "bool",
"last_chilled": "Option<BlockNumber>",
"total": "RpcBalance",
"last_total_vote_weight": "RpcWeightType",
"total": "Balance",
"last_total_vote_weight": "WeightType",
"last_total_vote_weight_update": "BlockNumber",
"is_validating": "bool",
"self_bonded": "RpcBalance",
"self_bonded": "Balance",
"reward_pot_account": "AccountId",
"reward_pot_balance": "RpcBalance"
"reward_pot_balance": "Balance"
},
"FullPairInfo": {
"base_currency": "AssetId",
"highest_bid": "RpcPrice",
"highest_bid": "Price",
"id": "TradingPairId",
"latest_price": "RpcPrice",
"latest_price": "Price",
"latest_price_updated_at": "BlockNumber",
"lowest_ask": "RpcPrice",
"max_valid_bid": "RpcPrice",
"min_valid_ask": "RpcPrice",
"lowest_ask": "Price",
"max_valid_bid": "Price",
"min_valid_ask": "Price",
"pip_decimals": "u32",
"quote_currency": "AssetId",
"tick_decimals": "u32",
Expand All @@ -228,37 +228,29 @@
"last_vote_weight_update": "BlockNumber",
"unbonded_chunks": "Vec<Unbonded>"
},
"RpcNominatorLedger": {
"nomination": "RpcBalance",
"last_vote_weight": "RpcWeightType",
"last_vote_weight_update": "BlockNumber",
"unbonded_chunks": "Vec<RpcUnbonded>"
},
"MiningAssetInfo": {
"asset_id": "AssetId",
"mining_power": "FixedAssetPower",
"reward_pot": "AccountId",
"reward_pot_balance": "RpcBalance",
"last_total_mining_weight": "RpcWeightType",
"reward_pot_balance": "Balance",
"last_total_mining_weight": "WeightType",
"last_total_mining_weight_update": "BlockNumber"
},
"Unbonded": {
"value": "Balance",
"locked_until": "BlockNumber"
},
"Depth": {
"asks": "Vec<(RpcPrice, RpcBalance)>",
"bids": "Vec<(RpcPrice, RpcBalance)>"
"asks": "Vec<(Price, Balance)>",
"bids": "Vec<(Price, Balance)>"
},
"Page": {
"page_index": "u32",
"page_size": "u32",
"data": "Vec<RpcOrder>"
},
"String": "Text",
"RpcPrice": "String",
"RpcBalance": "String",
"RpcWeightType": "String",
"Balance": "u128",
"WeightType": "u128",
"MiningPower": "u128",
"MiningWeight": "u128",
Expand All @@ -272,7 +264,7 @@
"WithdrawalRecordForRpc": {
"asset_id": "AssetId",
"applicant": "AccountId",
"balance": "RpcBalance",
"balance": "Balance",
"addr": "String",
"ext": "String",
"height": "BlockNumber",
Expand Down
26 changes: 13 additions & 13 deletions scripts/chainx-js/res/chainx_rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AssetId, BTreeMap<AssetType, RpcBalance<Balance>>>"
"type": "BTreeMap<AssetId, BTreeMap<AssetType, Balance>>"
},
"getAssets": {
"description": "get all assets balance and infos",
Expand All @@ -24,7 +24,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AssetId, TotalAssetInfoForRpc>"
"type": "BTreeMap<AssetId, TotalAssetInfo>"
}
},
"xspot": {
Expand All @@ -37,7 +37,7 @@
"isOptional": true
}
],
"type": "Vec<FullPairInfo<RpcPrice, BlockNumber>>"
"type": "Vec<FullPairInfo<Price, BlockNumber>>"
},
"getOrdersByAccount": {
"description": "Get the orders of an account.",
Expand All @@ -60,7 +60,7 @@
"isOptional": true
}
],
"type": "Page<Vec<RpcOrder<TradingPairId, AccountId, RpcBalance, RpcPrice, BlockNumber>>>"
"type": "Page<Vec<RpcOrder<TradingPairId, AccountId, Balance, Price, BlockNumber>>>"
},
"getDepth": {
"description": "Get the depth of a trading pair.",
Expand All @@ -79,7 +79,7 @@
"isOptional": true
}
],
"type": "Option<Depth<RpcPrice, RpcBalance>>"
"type": "Option<Depth<Price, Balance>>"
}
},
"xgatewaycommon": {
Expand Down Expand Up @@ -111,7 +111,7 @@
"isOptional": true
}
],
"type": "WithdrawalLimit<RpcBalance>"
"type": "WithdrawalLimit<Balance>"
},
"verifyWithdrawal": {
"description": "Use the params to verify whether the withdrawal apply is valid. Notice those params is same as the params for call `XGatewayCommon::withdraw(...)`, including checking address is valid or something else. Front-end should use this rpc to check params first, than could create the extrinsic.",
Expand Down Expand Up @@ -245,7 +245,7 @@
"isOptional": true
}
],
"type": "Vec<MiningAssetInfo<AccountId, RpcBalance, BlockNumber>>"
"type": "Vec<MiningAssetInfo<AccountId, Balance, BlockNumber>>"
},
"getDividendByAccount": {
"description": "Get the asset mining dividends info given the asset miner AccountId.",
Expand All @@ -260,7 +260,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AssetId, RpcBalance>"
"type": "BTreeMap<AssetId, Balance>"
},
"getMinerLedgerByAccount": {
"description": "Get the mining ledger details given the asset miner AccountId.",
Expand All @@ -275,7 +275,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AssetId, RpcMinerLedger<BlockNumber>>"
"type": "BTreeMap<AssetId, MinerLedger<BlockNumber>>"
}
},
"xstaking": {
Expand All @@ -288,7 +288,7 @@
"isOptional": true
}
],
"type": "Vec<ValidatorInfo<AccountId, RpcBalance, BlockNumber>>"
"type": "Vec<ValidatorInfo<AccountId, Balance, BlockNumber>>"
},
"getValidatorByAccount": {
"description": "Get overall information given the validator AccountId.",
Expand All @@ -303,7 +303,7 @@
"isOptional": true
}
],
"type": "ValidatorInfo<AccountId, RpcBalance, BlockNumber>"
"type": "ValidatorInfo<AccountId, Balance, BlockNumber>"
},
"getDividendByAccount": {
"description": "Get the staking dividends info given the staker AccountId.",
Expand All @@ -318,7 +318,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AccountId, RpcBalance>"
"type": "BTreeMap<AccountId, Balance>"
},
"getNominationByAccount": {
"description": "Get the nomination details given the staker AccountId.",
Expand All @@ -333,7 +333,7 @@
"isOptional": true
}
],
"type": "BTreeMap<AccountId, RpcNominatorLedger<RpcBalance, BlockNumber>>"
"type": "BTreeMap<AccountId, NominatorLedger<Balance, BlockNumber>>"
},
"getNominatorByAccount": {
"description": "Get individual nominator information given the nominator AccountId.",
Expand Down
Loading

0 comments on commit 9314669

Please sign in to comment.