Skip to content

Commit

Permalink
Multicoin address decoding (#20)
Browse files Browse the repository at this point in the history
* Implement a bunch of chains

* Implement correct EIP-55 formatting

Co-Authored-By: Višen P. <visen@visen.dev>

* Cleanup & fix warnings

* Ripple and Polkadot decoding & EIP55/RSKIP60 patches

* Implement EIP55 formatting for address and resolver fields

* Implement BNB, Cardano & Tezos address decoding

* Implement SegWit address decoding

* Remove test test

* Update src/models/multicoin/decoding/cardano.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/models/multicoin/decoding/dogecoin.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/models/multicoin/decoding/monacoin.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/models/multicoin/decoding/segwit.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/models/multicoin/decoding/tezos.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/utils/eip55.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/utils/mod.rs

Co-authored-by: Luc <luc@lucemans.nl>

* Update src/models/multicoin/decoding/binance.rs

Co-authored-by: Luc <luc@lucemans.nl>

---------

Co-authored-by: Višen P. <visen@visen.dev>
Co-authored-by: Luc <luc@lucemans.nl>
  • Loading branch information
3 people authored Sep 11, 2023
1 parent 8ea1532 commit 70a6651
Show file tree
Hide file tree
Showing 31 changed files with 757 additions and 52 deletions.
180 changes: 174 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ digest = "0.10.7"
hex-literal = "0.4.1"
axum-macros = "0.3.8"
lazy_static = "1.4.0"

base32 = "0.4.0"
crc16 = "0.4.0"
blake2 = "0.10.6"
rustc-hex = "2.0.1"
serde_with = "3.3.0"
bech32 = "0.10.0-alpha"
crc32fast = "1.3.2"
ciborium = "0.2.1"

[build-dependencies]
chrono = "0.4.24"
2 changes: 2 additions & 0 deletions src/abi/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Technically the PublicResolver but it implements the Resolver spec
#[allow(non_snake_case)]
pub mod IResolver {
use ethers::prelude::abigen;

abigen!(Resolver, "./src/abi/resolver.json");
}

// Universal Resolver (0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62)
#[allow(non_snake_case)]
pub mod UResolver {
use ethers::prelude::abigen;

Expand Down
1 change: 1 addition & 0 deletions src/models/lookup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub enum ENSLookupError {
#[error("MulticoinDecoderError: {0}")]
MulticoinDecoder(#[from] MulticoinDecoderError),

#[allow(dead_code)]
#[error("Unsupported: {0}")]
Unsupported(String),

Expand Down
2 changes: 1 addition & 1 deletion src/models/lookup/multicoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ethers_core::{
};
use hex_literal::hex;

use crate::models::multicoin::cointype::{coins::CoinType, evm::ChainId, slip44::SLIP44};
use crate::models::multicoin::cointype::coins::CoinType;

use super::{ENSLookup, ENSLookupError};

Expand Down
7 changes: 1 addition & 6 deletions src/models/multicoin/cointype/coins.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
use std::fmt::Display;

use ethers_core::types::U256;

use crate::models::multicoin::decoding::{MulticoinDecoder, MulticoinDecoderError};

use super::{evm::ChainId, slip44::SLIP44};

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -32,9 +28,8 @@ impl ToString for CoinType {

#[cfg(test)]
mod tests {
use super::super::{evm::ChainId, slip44::SLIP44};

use super::*;
use super::super::{evm::ChainId, slip44::SLIP44};

#[test]
fn test_coin_type() {
Expand Down
Loading

0 comments on commit 70a6651

Please sign in to comment.