Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/new-blk-parser/src/blockchain/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ impl Coin for PepecoinTestnet {
};
}

pub struct Trumpow;
impl Coin for Trumpow {
const NAME: &'static str = "Trumpow";
const CONFIG: EncoderConfig = EncoderConfig {
pubkey_address: 65,
script_address: 28,
bech32: "trm",
};
}

pub struct TrumpowTestnet;
impl Coin for TrumpowTestnet {
const NAME: &'static str = "Trumpow Testnet";
const CONFIG: EncoderConfig = EncoderConfig {
pubkey_address: 113,
script_address: 196,
bech32: "ttrm",
};
}

#[derive(Clone, Copy)]
// Holds the selected coin type information
pub struct CoinType {
Expand Down Expand Up @@ -157,6 +177,8 @@ impl FromStr for CoinType {
"bellscoin-testnet" => Ok(CoinType::from(BellscoinTestnet)),
"pepecoin" => Ok(CoinType::from(Pepecoin)),
"pepecoin-testnet" => Ok(CoinType::from(PepecoinTestnet)),
"trumpow" => Ok(CoinType::from(Trumpow)),
"trumpow-testnet" => Ok(CoinType::from(TrumpowTestnet)),
n => anyhow::bail!("There is no implementation for `{}`!", n),
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub enum Blockchain {
Dogecoin,
Bellscoin,
Pepecoin,
Trumpow,
}

#[derive(Debug, thiserror::Error)]
Expand All @@ -21,6 +22,7 @@ impl FromStr for Blockchain {
"dogecoin" | "doge" => Ok(Blockchain::Dogecoin),
"bellscoin" | "bells" => Ok(Blockchain::Bellscoin),
"pepecoin" | "pepe" => Ok(Blockchain::Pepecoin),
"trumpow" | "trmp" => Ok(Blockchain::Trumpow),
_ => Err(BlockchainParseError::UnknownBlockchain),
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/db/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,10 @@ impl From<TransferProtoDB> for TransferProto {
TransferProto::Bel20(MintProtoWrapper { tick: v.tick, amt: v.amt })
} else if *BLOCKCHAIN == Blockchain::Dogecoin {
TransferProto::Drc20(MintProtoWrapper { tick: v.tick, amt: v.amt })
} else {
} else if *BLOCKCHAIN == Blockchain::Pepecoin {
TransferProto::Prc20(MintProtoWrapper { tick: v.tick, amt: v.amt })
} else {
TransferProto::Trm20(MintProtoWrapper { tick: v.tick, amt: v.amt })
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ impl Server {
(Blockchain::Dogecoin, Network::Testnet) => "dogecoin-testnet",
(Blockchain::Pepecoin, Network::Bellscoin) => "pepecoin",
(Blockchain::Pepecoin, Network::Testnet) => "pepecoin-testnet",
(Blockchain::Trumpow, Network::Bellscoin) => "trumpow",
(Blockchain::Trumpow, Network::Testnet) => "trumpow-testnet",
_ => "bellscoin",
}
.to_string();
Expand Down
9 changes: 9 additions & 0 deletions src/tokens/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ pub enum MintProto {
Drc20(MintProtoWrapper),
#[serde(rename = "prc-20")]
Prc20(MintProtoWrapper),
#[serde(rename = "trm-20")]
Trm20(MintProtoWrapper),
}

impl MintProto {
Expand All @@ -104,6 +106,7 @@ impl MintProto {
MintProto::Bel20(v) if *BLOCKCHAIN == Blockchain::Bellscoin => Ok(*v),
MintProto::Drc20(v) if *BLOCKCHAIN == Blockchain::Dogecoin => Ok(*v),
MintProto::Prc20(v) if *BLOCKCHAIN == Blockchain::Pepecoin => Ok(*v),
MintProto::Trm20(v) if *BLOCKCHAIN == Blockchain::Trumpow => Ok(*v),
_ => anyhow::bail!("Unsupported type"),
}
}
Expand Down Expand Up @@ -132,6 +135,8 @@ pub enum DeployProto {
Drc20(DeployProtoWrapper),
#[serde(rename = "prc-20")]
Prc20(DeployProtoWrapper),
#[serde(rename = "trm-20")]
Trm20(DeployProtoWrapper),
}

impl DeployProto {
Expand All @@ -140,6 +145,7 @@ impl DeployProto {
DeployProto::Bel20(v) if *BLOCKCHAIN == Blockchain::Bellscoin => Ok(*v),
DeployProto::Drc20(v) if *BLOCKCHAIN == Blockchain::Dogecoin => Ok(*v),
DeployProto::Prc20(v) if *BLOCKCHAIN == Blockchain::Pepecoin => Ok(*v),
DeployProto::Trm20(v) if *BLOCKCHAIN == Blockchain::Trumpow => Ok(*v),
_ => anyhow::bail!("Unsupported type"),
}
}
Expand All @@ -163,6 +169,8 @@ pub enum TransferProto {
Drc20(MintProtoWrapper),
#[serde(rename = "prc-20")]
Prc20(MintProtoWrapper),
#[serde(rename = "trm-20")]
Trm20(MintProtoWrapper),
}

impl TransferProto {
Expand All @@ -171,6 +179,7 @@ impl TransferProto {
TransferProto::Bel20(v) if *BLOCKCHAIN == Blockchain::Bellscoin => Ok(*v),
TransferProto::Drc20(v) if *BLOCKCHAIN == Blockchain::Dogecoin => Ok(*v),
TransferProto::Prc20(v) if *BLOCKCHAIN == Blockchain::Pepecoin => Ok(*v),
TransferProto::Trm20(v) if *BLOCKCHAIN == Blockchain::Trumpow => Ok(*v),
_ => anyhow::bail!("Unsupported type"),
}
}
Expand Down