From 35ca97454678ab5e91aa31b53f372ddc914b88de Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 24 May 2024 17:50:52 +0200 Subject: [PATCH] Katana and ArgentX wallet (#1958) * fix: path to Argent account compiled contracts in declare script * fix: allow some headers in CORS layer of Katana to work with ArgentX wallet * refactor: clean forgotten logs in declare-argent-account.sh script and remove unnecessary var * fix: remove vec in favor of array --------- Co-authored-by: glihm --- crates/katana/rpc/rpc/src/lib.rs | 2 +- crates/katana/scripts/declare-argent-account.sh | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/katana/rpc/rpc/src/lib.rs b/crates/katana/rpc/rpc/src/lib.rs index edc855f0a3..a3ee286fca 100644 --- a/crates/katana/rpc/rpc/src/lib.rs +++ b/crates/katana/rpc/rpc/src/lib.rs @@ -65,7 +65,7 @@ pub async fn spawn( let cors = CorsLayer::new() // Allow `POST` when accessing the resource .allow_methods([Method::POST, Method::GET]) - .allow_headers([hyper::header::CONTENT_TYPE]); + .allow_headers([hyper::header::CONTENT_TYPE, "argent-client".parse().unwrap(), "argent-version".parse().unwrap()]); let cors = config.allowed_origins.clone().map(|allowed_origins| match allowed_origins.as_slice() { diff --git a/crates/katana/scripts/declare-argent-account.sh b/crates/katana/scripts/declare-argent-account.sh index ae11f3be80..ca04d2ccab 100755 --- a/crates/katana/scripts/declare-argent-account.sh +++ b/crates/katana/scripts/declare-argent-account.sh @@ -1,15 +1,14 @@ #! /bin/bash STD_ARGENT_ACCOUNT_0_3_0_CLASS_HASH="0x01a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003" -STD_ARGENT_ACCOUNT_0_3_0_COMPILED_FILE="../primitives/contracts/compiled/argent_ArgentAccount_0.3.0.json" +STD_ARGENT_ACCOUNT_0_3_0_COMPILED_FILE="../contracts/compiled/argent_ArgentAccount_0.3.0.json" STD_ARGENT_ACCOUNT_0_3_1_CLASS_HASH="0x29927c8af6bccf3f6fda035981e765a7bdbf18a2dc0d630494f8758aa908e2b" -STD_ARGENT_ACCOUNT_0_3_1_COMPILED_FILE="../primitives/contracts/compiled/argent_ArgentAccount_0.3.1.json" +STD_ARGENT_ACCOUNT_0_3_1_COMPILED_FILE="../contracts/compiled/argent_ArgentAccount_0.3.1.json" TEMP_ACCOUNT_FILE="temp-account.json" -TEMP_KEYSTORE_FILE="temp-keystore.json" -trap "rm -f $TEMP_ACCOUNT_FILE $TEMP_KEYSTORE_FILE" EXIT +trap "rm -f $TEMP_ACCOUNT_FILE" EXIT # This is helper script is for declaring the standard Argent account to Katana as it doesn't come as a default. # Argent account contract source code: https://github.com/argentlabs/argent-contracts-starknet/blob/53d01c0d6dce4fd30db955c3d698f658cdda1796/contracts/account/src/argent_account.cairo @@ -57,7 +56,6 @@ else exit 1 fi - starkli account fetch $ACCOUNT_ADDRESS --rpc $RPC_URL --output $TEMP_ACCOUNT_FILE &> /dev/null for file in "${CLASS_TO_DECLARE[@]}"; do