-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make node, price, tokenlist, chain_type, asset_type public
- Loading branch information
1 parent
1a39856
commit ad1c11e
Showing
7 changed files
with
97 additions
and
53 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#[typeshare] | ||
use typeshare::typeshare; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
#[typeshare(swift = "Equatable, Codable, CaseIterable")] | ||
#[serde(rename_all = "lowercase")] | ||
pub enum BlockchainType { | ||
ethereum, | ||
bitcoin, | ||
binance, | ||
solana, | ||
cosmos, | ||
ton, | ||
tron, | ||
Ethereum, | ||
Bitcoin, | ||
Binance, | ||
Solana, | ||
Cosmos, | ||
Ton, | ||
Tron, | ||
} |
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 |
---|---|---|
@@ -1,31 +1,40 @@ | ||
use typeshare::typeshare; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare(swift="Codable")] | ||
struct Node { | ||
url: String, | ||
status: NodeStatus, | ||
priority: i32, | ||
pub struct Node { | ||
pub url: String, | ||
pub status: NodeStatus, | ||
pub priority: i32, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare(swift="Codable")] | ||
struct ChainNode { | ||
chain: String, | ||
node: Node | ||
pub struct ChainNode { | ||
pub chain: String, | ||
pub node: Node | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare(swift="Codable")] | ||
struct ChainNodes { | ||
chain: String, | ||
nodes: Vec<Node> | ||
pub struct ChainNodes { | ||
pub chain: String, | ||
pub nodes: Vec<Node> | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare(swift="Codable")] | ||
#[serde(rename_all = "camelCase")] | ||
struct NodesResponse { | ||
version: i32, | ||
nodes: Vec<ChainNodes> | ||
pub struct NodesResponse { | ||
pub version: i32, | ||
pub nodes: Vec<ChainNodes> | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare(swift = "Equatable, Codable, CaseIterable")] | ||
#[serde(rename_all = "lowercase")] | ||
pub enum NodeStatus { | ||
active, | ||
inactive, | ||
Active, | ||
Inactive, | ||
} |
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 |
---|---|---|
@@ -1,23 +1,31 @@ | ||
use typeshare::typeshare; | ||
use crate::chain::Chain; | ||
use crate::asset_type::AssetType; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare] | ||
struct TokenList { | ||
version: i32, | ||
assets: Vec<TokenListAsset>, | ||
pub struct TokenList { | ||
pub version: i32, | ||
pub assets: Vec<TokenListAsset>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare] | ||
struct TokenListAsset { | ||
chain: Chain, | ||
pub struct TokenListAsset { | ||
pub chain: Chain, | ||
#[serde(rename = "tokenId")] | ||
token_id: String, | ||
name: String, | ||
symbol: String, | ||
pub token_id: String, | ||
pub name: String, | ||
pub symbol: String, | ||
#[serde(rename = "type")] | ||
asset_type: AssetType, | ||
decimals: i32, | ||
pub asset_type: AssetType, | ||
pub decimals: i32, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[typeshare] | ||
struct TokenListChainVersion { | ||
chain: String, | ||
version: i32, | ||
pub struct TokenListChainVersion { | ||
pub chain: String, | ||
pub version: i32, | ||
} |