Skip to content
Merged
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
12 changes: 11 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.

### lucide-react (ISC)

ISC License

Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ version="0.4.10"
# update the toml files
sed -i '0,/^version = ".*"/s//version = "'${version}'"/' seedelf-contracts/aiken.toml
sed -i '0,/^version = ".*"/s//version = "'${version}'"/' seedelf-platform/Cargo.toml
sed -i '0,/^seedelf-cli = ".*"/s//seedelf-cli = "'${version}'"/' seedelf-platform/Cargo.toml
sed -i '0,/^seedelf-core = ".*"/s//seedelf-core = "'${version}'"/' seedelf-platform/Cargo.toml
sed -i '0,/^seedelf-crypto = ".*"/s//seedelf-crypto = "'${version}'"/' seedelf-platform/Cargo.toml
sed -i '0,/^seedelf-display = ".*"/s//seedelf-display = "'${version}'"/' seedelf-platform/Cargo.toml
sed -i '0,/^seedelf-koios = ".*"/s//seedelf-koios = "'${version}'"/' seedelf-platform/Cargo.toml
sed -i "s/\"version\": \".*\"/\"version\": \"${version}\"/" seedelf-platform/seedelf-gui/package.json
# add, commit, and tag out
git add .
git commit -m "chore: tagging ${version} release"
Expand Down
4 changes: 2 additions & 2 deletions seedelf-platform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ members = [


[workspace.dependencies]
seedelf-core = "0.4.10"
seedelf-cli = "0.4.10"
seedelf-core = "0.4.10"
seedelf-crypto = "0.4.10"
seedelf-display = "0.4.10"
seedelf-koios = "0.4.10"


[patch.crates-io]
seedelf-core = { path = "seedelf-core" }
seedelf-cli = { path = "seedelf-cli" }
seedelf-core = { path = "seedelf-core" }
seedelf-crypto = { path = "seedelf-crypto" }
seedelf-display = { path = "seedelf-display" }
seedelf-koios = { path = "seedelf-koios" }
Expand Down
11 changes: 8 additions & 3 deletions seedelf-platform/seedelf-cli/src/commands/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@ pub async fn run(network_flag: bool, variant: u64) -> Result<()> {
std::process::exit(1);
});

display::all_seedelfs(
let seedelfs = display::all_seedelfs(
scalar,
network_flag,
hex::encode(config.contract.wallet_contract_hash).as_str(),
config.contract.seedelf_policy_id,
&config.contract.seedelf_policy_id,
)
.await;

if !seedelfs.is_empty() {
println!("{}", "\nCurrent Seedelf:\n".bright_green());
display::print_seedelfs(seedelfs);
}

let every_utxo: Vec<UtxoResponse> =
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let all_utxos: Vec<UtxoResponse> =
utxos::collect_all_wallet_utxos(scalar, config.contract.seedelf_policy_id, every_utxo)?;
utxos::collect_all_wallet_utxos(scalar, &config.contract.seedelf_policy_id, every_utxo)?;

let (total_lovelace, tokens) = utxos::assets_of(all_utxos.clone())?;

Expand Down
10 changes: 5 additions & 5 deletions seedelf-platform/seedelf-cli/src/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub async fn run(args: LabelArgs, network_flag: bool, variant: u64) -> Result<()
.set_inline_datum(datum_vector.clone())
.add_asset(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.unwrap()
.try_into()
.expect("Not Correct Length"),
Expand All @@ -180,7 +180,7 @@ pub async fn run(args: LabelArgs, network_flag: bool, variant: u64) -> Result<()
.fee(tmp_fee)
.mint_asset(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.unwrap()
.try_into()
.expect("Not Correct Length"),
Expand All @@ -194,7 +194,7 @@ pub async fn run(args: LabelArgs, network_flag: bool, variant: u64) -> Result<()
))
.add_mint_redeemer(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand All @@ -217,7 +217,7 @@ pub async fn run(args: LabelArgs, network_flag: bool, variant: u64) -> Result<()
.clear_collateral_output()
.remove_output(1)
.remove_mint_redeemer(pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down Expand Up @@ -316,7 +316,7 @@ pub async fn run(args: LabelArgs, network_flag: bool, variant: u64) -> Result<()
.fee(total_fee)
.add_mint_redeemer(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down
2 changes: 1 addition & 1 deletion seedelf-platform/seedelf-cli/src/commands/fund.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub async fn run(args: FundArgs, network_flag: bool, variant: u64) -> Result<()>
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let seedelf_utxo: UtxoResponse = utxos::find_seedelf_utxo(
args.seedelf.clone(),
config.contract.seedelf_policy_id,
&config.contract.seedelf_policy_id,
every_utxo,
)?
.ok_or("Seedelf Not Found".to_string())
Expand Down
10 changes: 5 additions & 5 deletions seedelf-platform/seedelf-cli/src/commands/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub async fn run(args: RemoveArgs, network_flag: bool, variant: u64) -> Result<(
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let seedelf_utxo: UtxoResponse = utxos::find_seedelf_utxo(
args.seedelf.clone(),
config.contract.seedelf_policy_id,
&config.contract.seedelf_policy_id,
every_utxo,
)?
.ok_or("Seedelf Not Found".to_string())
Expand Down Expand Up @@ -123,7 +123,7 @@ pub async fn run(args: RemoveArgs, network_flag: bool, variant: u64) -> Result<(
.fee(tmp_fee)
.mint_asset(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.unwrap()
.try_into()
.expect("Not Correct Length"),
Expand All @@ -148,7 +148,7 @@ pub async fn run(args: RemoveArgs, network_flag: bool, variant: u64) -> Result<(
)
.add_mint_redeemer(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down Expand Up @@ -179,7 +179,7 @@ pub async fn run(args: RemoveArgs, network_flag: bool, variant: u64) -> Result<(
.remove_output(0)
.remove_spend_redeemer(input_vector.clone().remove(0))
.remove_mint_redeemer(pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down Expand Up @@ -295,7 +295,7 @@ pub async fn run(args: RemoveArgs, network_flag: bool, variant: u64) -> Result<(
)
.add_mint_redeemer(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down
2 changes: 1 addition & 1 deletion seedelf-platform/seedelf-cli/src/commands/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub async fn run(args: SweepArgs, network_flag: bool, variant: u64) -> Result<()
let every_utxo: Vec<UtxoResponse> =
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let owned_utxos: Vec<UtxoResponse> =
utxos::collect_wallet_utxos(scalar, config.contract.seedelf_policy_id, every_utxo)?;
utxos::collect_wallet_utxos(scalar, &config.contract.seedelf_policy_id, every_utxo)?;
let usable_utxos: Vec<UtxoResponse> = if args.all {
owned_utxos
} else {
Expand Down
2 changes: 1 addition & 1 deletion seedelf-platform/seedelf-cli/src/commands/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub async fn run(args: TransforArgs, network_flag: bool, variant: u64) -> Result
let (seedelf_datum, usable_utxos) = utxos::find_seedelf_and_wallet_utxos(
scalar,
args.seedelf,
config.contract.seedelf_policy_id,
&config.contract.seedelf_policy_id,
every_utxo,
)?;
// the extra 2.5 ADA should account for the change and fee
Expand Down
2 changes: 1 addition & 1 deletion seedelf-platform/seedelf-cli/src/commands/util/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub async fn run(args: FindArgs, network_flag: bool, variant: u64) -> Result<()>
let every_utxo: Vec<UtxoResponse> =
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let all_seedelfs =
utxos::find_all_seedelfs(label, config.contract.seedelf_policy_id, every_utxo)?;
utxos::find_all_seedelfs(label, &config.contract.seedelf_policy_id, every_utxo)?;
display::print_seedelfs(all_seedelfs);
Ok(())
}
12 changes: 6 additions & 6 deletions seedelf-platform/seedelf-cli/src/commands/util/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub async fn run(args: MintArgs, network_flag: bool, variant: u64) -> Result<()>
let every_utxo: Vec<UtxoResponse> =
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let owned_utxos: Vec<UtxoResponse> =
utxos::collect_wallet_utxos(scalar, config.contract.seedelf_policy_id, every_utxo)?;
utxos::collect_wallet_utxos(scalar, &config.contract.seedelf_policy_id, every_utxo)?;

let usable_utxos: Vec<UtxoResponse> = if args.utxos.is_none() {
utxos::select(owned_utxos, lovelace_goal, Assets::default())?
Expand Down Expand Up @@ -172,7 +172,7 @@ pub async fn run(args: MintArgs, network_flag: bool, variant: u64) -> Result<()>
.set_inline_datum(datum_vector.clone())
.add_asset(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.unwrap()
.try_into()
.expect("Not Correct Length"),
Expand Down Expand Up @@ -200,7 +200,7 @@ pub async fn run(args: MintArgs, network_flag: bool, variant: u64) -> Result<()>
.fee(tmp_fee)
.mint_asset(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.unwrap()
.try_into()
.expect("Not Correct Length"),
Expand All @@ -212,7 +212,7 @@ pub async fn run(args: MintArgs, network_flag: bool, variant: u64) -> Result<()>
.reference_input(reference_utxo(config.reference.seedelf_reference_utxo))
.add_mint_redeemer(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down Expand Up @@ -300,7 +300,7 @@ pub async fn run(args: MintArgs, network_flag: bool, variant: u64) -> Result<()>
.clear_fee()
.clear_collateral_output()
.remove_mint_redeemer(pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down Expand Up @@ -454,7 +454,7 @@ pub async fn run(args: MintArgs, network_flag: bool, variant: u64) -> Result<()>

raw_tx = raw_tx.add_mint_redeemer(
pallas_crypto::hash::Hash::new(
hex::decode(config.contract.seedelf_policy_id)
hex::decode(&config.contract.seedelf_policy_id)
.expect("Invalid hex string")
.try_into()
.expect("Failed to convert to 32-byte array"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub async fn run(network_flag: bool, variant: u64) -> Result<()> {
let every_utxo: Vec<UtxoResponse> =
utxos::get_credential_utxos(config.contract.wallet_contract_hash, network_flag).await?;
let (total_utxos, total_lovelace, total_seedelfs) =
utxos::count_lovelace_and_utxos(config.contract.seedelf_policy_id, every_utxo)?;
utxos::count_lovelace_and_utxos(&config.contract.seedelf_policy_id, every_utxo)?;
show_lovelace_and_utxos_counts(total_utxos, total_lovelace, total_seedelfs);
// other things can go here
Ok(())
Expand Down
9 changes: 7 additions & 2 deletions seedelf-platform/seedelf-core/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
use hex_literal::hex;
use serde::{Deserialize, Serialize};

/// The current variant of Seedelf
pub const VARIANT: u64 = 1;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Contract {
pub wallet_contract_hash: [u8; 28],
pub seedelf_policy_id: &'static str,
pub seedelf_policy_id: String,
pub wallet_contract_size: u64,
pub seedelf_contract_size: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Reference {
pub wallet_reference_utxo: [u8; 32],
pub seedelf_reference_utxo: [u8; 32],
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config {
pub contract: Contract,
pub reference: Reference,
Expand Down Expand Up @@ -47,7 +51,8 @@ pub fn get_config(variant: u64, network: bool) -> Option<Config> {
wallet_contract_hash: hex!(
"94bca9c099e84ffd90d150316bb44c31a78702239076a0a80ea4a469"
),
seedelf_policy_id: "84967d911e1a10d5b4a38441879f374a07f340945bcf9e7697485255",
seedelf_policy_id: "84967d911e1a10d5b4a38441879f374a07f340945bcf9e7697485255"
.to_string(),
wallet_contract_size: 629,
seedelf_contract_size: 519,
};
Expand Down
72 changes: 35 additions & 37 deletions seedelf-platform/seedelf-display/src/display.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::version_control::{compare_versions, get_latest_version};
use blstrs::Scalar;
use colored::Colorize;
use seedelf_koios::koios::{contains_policy_id, credential_utxos, extract_bytes_with_logging, tip};
use seedelf_koios::koios::{
UtxoResponse, contains_policy_id, credential_utxos, extract_bytes_with_logging, tip,
};

pub async fn is_their_an_update() {
match get_latest_version().await {
Expand Down Expand Up @@ -50,49 +52,45 @@ pub fn preprod_text(network_flag: bool) {
}
}

pub async fn all_seedelfs(
pub fn extract_all_owned_seedelfs(
sk: Scalar,
network_flag: bool,
wallet_contract_hash: &str,
seedelf_policy_id: &str,
) {
utxos: Vec<UtxoResponse>,
) -> Vec<String> {
let mut seedelfs: Vec<String> = Vec::new();

match credential_utxos(wallet_contract_hash, network_flag).await {
Ok(utxos) => {
for utxo in utxos {
// Extract bytes
if let Some(inline_datum) = extract_bytes_with_logging(&utxo.inline_datum) {
// utxo must be owned by this secret scalar
if inline_datum.is_owned(sk).unwrap() {
// its owned but lets not count the seedelf in the balance
if contains_policy_id(&utxo.asset_list, seedelf_policy_id) {
let asset_name: &String = utxo
.asset_list
.as_ref()
.and_then(|vec| {
vec.iter()
.find(|asset| asset.policy_id == seedelf_policy_id)
.map(|asset| &asset.asset_name)
})
.unwrap();
seedelfs.push(asset_name.to_string());
}
}
for utxo in utxos {
// Extract bytes
if let Some(inline_datum) = extract_bytes_with_logging(&utxo.inline_datum) {
// utxo must be owned by this secret scalar
if inline_datum.is_owned(sk).unwrap() {
// its owned but lets not count the seedelf in the balance
if contains_policy_id(&utxo.asset_list, seedelf_policy_id) {
let asset_name: &String = utxo
.asset_list
.as_ref()
.and_then(|vec| {
vec.iter()
.find(|asset| asset.policy_id == seedelf_policy_id)
.map(|asset| &asset.asset_name)
})
.unwrap();
seedelfs.push(asset_name.to_string());
}
}
}
Err(err) => {
eprintln!("Failed to fetch UTxOs: {err}\nWait a few moments and try again.");
std::process::exit(1);
}
}
if !seedelfs.is_empty() {
println!("{}", "\nCurrent Seedelf:\n".bright_green());
for seedelf in seedelfs {
println!("\nSeedelf: {}", seedelf.white());
seedelf_label(seedelf);
}
seedelfs
}

pub async fn all_seedelfs(
sk: Scalar,
network_flag: bool,
wallet_contract_hash: &str,
seedelf_policy_id: &str,
) -> Vec<String> {
match credential_utxos(wallet_contract_hash, network_flag).await {
Ok(utxos) => extract_all_owned_seedelfs(sk, seedelf_policy_id, utxos),
Err(_) => Vec::new(),
}
}

Expand Down
Loading