diff --git a/Cargo.lock b/Cargo.lock index 1da8453b..65402259 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2171,7 +2171,7 @@ dependencies = [ [[package]] name = "kit" -version = "0.7.0" +version = "0.7.1" dependencies = [ "alloy", "alloy-sol-macro", diff --git a/Cargo.toml b/Cargo.toml index 138849a9..26601c6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kit" -version = "0.7.0" +version = "0.7.1" edition = "2021" [build-dependencies] @@ -35,7 +35,7 @@ color-eyre = { version = "0.6", features = ["capture-spantrace"] } dirs = "5.0" fs-err = "2.11" hex = "0.4" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", rev = "7eb3a04" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", tag = "v0.9.0" } nix = { version = "0.27", features = ["process", "signal", "term"] } regex = "1" reqwest = { version = "0.12", features = ["json"] } diff --git a/src/build/mod.rs b/src/build/mod.rs index f4cfcb67..918f79db 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -1276,32 +1276,8 @@ pub async fn execute( } } else { if no_ui { - return compile_package( - package_dir, - skip_deps_check, - features, - url, - default_world, - download_from, - local_dependencies, - add_paths_to_api, - force, - verbose, - ignore_deps, - ) - .await; - } - - let deps = check_js_deps()?; - get_deps(deps, verbose)?; - let valid_node = get_newest_valid_node_version(None, None)?; - - if ui_only { - compile_and_copy_ui(package_dir, valid_node, verbose).await?; - } else { - compile_package_and_ui( + compile_package( package_dir, - valid_node, skip_deps_check, features, url, @@ -1314,6 +1290,30 @@ pub async fn execute( ignore_deps, ) .await?; + } else { + let deps = check_js_deps()?; + get_deps(deps, verbose)?; + let valid_node = get_newest_valid_node_version(None, None)?; + + if ui_only { + compile_and_copy_ui(package_dir, valid_node, verbose).await?; + } else { + compile_package_and_ui( + package_dir, + valid_node, + skip_deps_check, + features, + url, + default_world, + download_from, + local_dependencies, + add_paths_to_api, + force, + verbose, + ignore_deps, + ) + .await?; + } } } diff --git a/src/publish/mod.rs b/src/publish/mod.rs index 15d2e992..e31522df 100644 --- a/src/publish/mod.rs +++ b/src/publish/mod.rs @@ -68,12 +68,19 @@ sol! { } const FAKE_KIMAP_ADDRESS: &str = "0xEce71a05B36CA55B895427cD9a440eEF7Cf3669D"; +const REAL_KIMAP_ADDRESS: &str = "0xcA92476B2483aBD5D82AEBF0b56701Bb2e9be658"; + +const FAKE_KINO_ACCOUNT_IMPL: &str = "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"; +const REAL_KINO_ACCOUNT_IMPL: &str = "0x38766C70a4FB2f23137D9251a1aA12b1143fC716"; + +const REAL_CHAIN_ID: u64 = 10; const FAKE_CHAIN_ID: u64 = 31337; -const REAL_KIMAP_ADDRESS: &str = "0xcA92476B2483aBD5D82AEBF0b56701Bb2e9be658"; const MULTICALL_ADDRESS: &str = "0xcA11bde05977b3631167028862bE2a173976CA11"; -const KINO_ACCOUNT_IMPL: &str = "0x38766C70a4FB2f23137D9251a1aA12b1143fC716"; -const REAL_CHAIN_ID: u64 = 10; + +fn is_valid_kimap_package_name(s: &str) -> bool { + s.chars().all(|c| c.is_ascii_lowercase() || c == '-' || c.is_ascii_digit()) +} #[instrument(level = "trace", skip_all)] fn calculate_metadata_hash(package_dir: &Path) -> Result { @@ -205,11 +212,11 @@ fn make_multicall( let calls = vec![ Call { target: kimap, - callData: metadata_uri_call.into(), + callData: metadata_hash_call.into(), }, Call { target: kimap, - callData: metadata_hash_call.into(), + callData: metadata_uri_call.into(), }, ]; @@ -338,12 +345,16 @@ pub async fn execute( let metadata = read_metadata(package_dir)?; - let metadata_hash = check_remote_metadata(&metadata, metadata_uri, package_dir).await?; - check_pkg_hash(&metadata, package_dir, metadata_uri)?; - let name = metadata.name.clone().unwrap(); let publisher = metadata.properties.publisher.clone(); + if !is_valid_kimap_package_name(&name) { + return Err(eyre!("The App Store requires package names have only lowercase letters, digits, and `-`s")); + } + + let metadata_hash = check_remote_metadata(&metadata, metadata_uri, package_dir).await?; + check_pkg_hash(&metadata, package_dir, metadata_uri)?; + let ws = WsConnect::new(rpc_uri); let provider: RootProvider = ProviderBuilder::default().on_ws(ws).await?; @@ -355,7 +366,13 @@ pub async fn execute( } )?; let multicall_address = Address::from_str(MULTICALL_ADDRESS)?; - let kino_account_impl = Address::from_str(KINO_ACCOUNT_IMPL)?; + let kino_account_impl = Address::from_str( + if *real { + REAL_KINO_ACCOUNT_IMPL + } else { + FAKE_KINO_ACCOUNT_IMPL + } + )?; let (to, call) = if *unpublish { let app_node = format!("{}.{}", name, publisher); @@ -386,21 +403,24 @@ pub async fn execute( }; let nonce = provider.get_transaction_count(wallet_address).await?; - let gas_price = provider.get_gas_price().await?; + let estimate = provider.estimate_eip1559_fees(None).await?; + + let suggested_max_fee_per_gas = estimate.max_fee_per_gas; + let suggested_max_priority_fee_per_gas = estimate.max_priority_fee_per_gas; + let tx = TransactionRequest::default() .to(to) .input(TransactionInput::new(call.into())) .nonce(nonce) .with_chain_id(chain_id) .with_gas_limit(gas_limit) - .with_max_priority_fee_per_gas(max_priority_fee_per_gas.unwrap_or_else(|| gas_price)) - .with_max_fee_per_gas(max_fee_per_gas.unwrap_or_else(|| gas_price)); + .with_max_priority_fee_per_gas(max_priority_fee_per_gas.unwrap_or_else(|| suggested_max_priority_fee_per_gas)) + .with_max_fee_per_gas(max_fee_per_gas.unwrap_or_else(|| suggested_max_fee_per_gas)); let tx_envelope = tx.build(&wallet).await?; let tx_encoded = tx_envelope.encoded_2718(); let tx = provider.send_raw_transaction(&tx_encoded).await?; - let tx_hash = format!("{:?}", tx.tx_hash()); let link = format!( "\x1B]8;;https://optimistic.etherscan.io/tx/{}\x1B\\{}\x1B]8;;\x1B\\",