#[encrypted_library]
mod arcis_library {
    pub struct SerializedSolanaPublicKey {
        pub lo: u128,
        pub hi: u128,
    }

    #[derive(PartialEq)]
    pub struct SolanaPublicKey {
        pub public_key_encoded: [u8; 32],
    }

    impl SolanaPublicKey {
        pub fn from_serialized(value: SerializedSolanaPublicKey) -> Self {
            let mut lo = value.lo;
            let mut hi = value.hi;
            let mut bytes = [0u8; 32];
            for i in 0..16 {
                bytes[i] = (lo % 256) as u8;
                bytes[i + 16] = (hi % 256) as u8;
                lo >>= 8;
                hi >>= 8;
            }
            Self {
                public_key_encoded: bytes,
            }
        }

        pub fn from_base58(s: &[u8]) -> Self {
            let arr = base58_to_32_uint8array(s);
            Self {
                public_key_encoded: arr,
            }
        }
    }
}
