Skip to content

Commit

Permalink
Add mod to name and price
Browse files Browse the repository at this point in the history
  • Loading branch information
gemcoder21 committed Aug 3, 2023
1 parent f1bb738 commit a9fcbf3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 3 additions & 1 deletion primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// lib.rs

pub mod chain;
pub mod chain;
pub mod name;
pub mod price;
24 changes: 23 additions & 1 deletion primitives/src/name.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
use typeshare::typeshare;
use crate::chain::Chain;
use serde::Serialize;

#[typeshare(swift="Codable")]
#[allow(dead_code)]
struct NameRecord {
name: String,
chain: Chain,
address: String
address: String,
provider: NameProvider,
}

#[derive(Debug, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum NameProvider {
Ud,
Ens,
}

impl NameProvider {
pub fn as_str(&self) -> &'static str {
match self {
Self::Ud => "ud",
Self::Ens => "ens",
}
}
}
4 changes: 4 additions & 0 deletions primitives/src/price.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
use serde::{Serialize, Deserialize};
use typeshare::typeshare;

#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[typeshare(swift = "Equatable, Codable, Hashable")]
struct Price {
price: f64,
Expand Down

0 comments on commit a9fcbf3

Please sign in to comment.