forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add dex spot rpc * Impl Spot RPC * Rename lowest_offer to lowest_ask * Pretty print BtcAddress * . * Pretty print bitcoin hot/cold keys * . * Nits * Use mutate * Integrate Spot RPC * Add LatestPrice info of trading pair * Remove => * Rename lowestOffer to lowestAsk in chainx_types.json * Request by page for xspot_getOrdersByAccount * Add money emoji * .
- Loading branch information
1 parent
066f436
commit 6fed8a7
Showing
23 changed files
with
704 additions
and
115 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "xpallet-dex-spot-rpc" | ||
version = "0.1.0" | ||
authors = ["ChainX community <https://www.chainx.org>"] | ||
edition = "2018" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "1.3.1" } | ||
serde = { version = "1.0.10", features = ["derive"] } | ||
sp-api = { git = "https://github.com/paritytech/substrate.git", tag = "v2.0.0-rc4" } | ||
sp-runtime = { git = "https://github.com/paritytech/substrate.git", tag = "v2.0.0-rc4" } | ||
sp-std = { git = "https://github.com/paritytech/substrate.git", tag = "v2.0.0-rc4" } | ||
sp-blockchain = { git = "https://github.com/paritytech/substrate.git", tag = "v2.0.0-rc4" } | ||
jsonrpc-core = "14.2.0" | ||
jsonrpc-derive = "14.2.1" | ||
jsonrpc-core-client = "14.2.0" | ||
xpallet-dex-spot = { path = "../" } | ||
xpallet-dex-spot-rpc-runtime-api = { path = "./runtime-api" } | ||
xpallet-support = { path = "../../../support" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "xpallet-dex-spot-rpc-runtime-api" | ||
version = "0.1.0" | ||
authors = ["ChainX community <https://www.chainx.org>"] | ||
edition = "2018" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } | ||
sp-api = { git = "https://github.com/paritytech/substrate.git", tag = "v2.0.0-rc4", default-features = false } | ||
sp-std = { git = "https://github.com/paritytech/substrate.git", tag = "v2.0.0-rc4", default-features = false } | ||
|
||
xpallet-dex-spot = { path = "../..", default-features = false } | ||
xpallet-support = { path = "../../../../support", default-features = false } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"codec/std", | ||
"sp-api/std", | ||
"sp-std/std", | ||
|
||
"xpallet-dex-spot/std", | ||
"xpallet-support/std", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Runtime API definition required by ChainX RPC extensions. | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
use codec::Codec; | ||
use sp_std::prelude::*; | ||
use xpallet_dex_spot::{Depth, FullPairInfo, RpcOrder, TradingPairId}; | ||
use xpallet_support::{RpcBalance, RpcPrice}; | ||
|
||
sp_api::decl_runtime_apis! { | ||
/// The API to query DEX Spot info. | ||
pub trait XSpotApi<AccountId, Balance, BlockNumber, Price> where | ||
AccountId: Codec, | ||
Balance: Codec, | ||
BlockNumber: Codec, | ||
Price: Codec, | ||
{ | ||
/// Get the overall info of all trading pairs. | ||
fn trading_pairs() -> Vec<FullPairInfo<RpcPrice<Price>, BlockNumber>>; | ||
|
||
/// Get the orders of an account. | ||
fn orders(who: AccountId, page_index: u32, page_size: u32) -> Vec<RpcOrder<TradingPairId, AccountId, RpcBalance<Balance>, RpcPrice<Price>, BlockNumber>>; | ||
|
||
/// Get the depth of a trading pair. | ||
fn depth(pair_id: TradingPairId, depth_size: u32) -> Option<Depth<RpcPrice<Price>, RpcBalance<Balance>>>; | ||
} | ||
} |
Oops, something went wrong.