diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c74027378..25f40c7cb 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -26,6 +26,17 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo test --features skip-zero-root-validation + test-katana: + if: ${{ !startsWith(github.head_ref, 'dependabot/') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cd .. && git clone https://github.com/dojoengine/dojo + - run: cd ../dojo && git reset --hard v1.0.0-alpha.7 && cargo run --bin katana -- --host 127.0.0.1 -p 5050 --disable-fee & + - run: sleep 500 && cargo test -- --ignored + check: if: startsWith(github.head_ref, 'dependabot/') runs-on: ubuntu-latest diff --git a/tests/account_declaration.rs b/tests/account_declaration.rs new file mode 100644 index 000000000..56d912839 --- /dev/null +++ b/tests/account_declaration.rs @@ -0,0 +1,33 @@ +use beerus::gen::{client::Client, Address, BlockId, BlockTag, Felt, Rpc}; + +mod common; + +#[ignore] +#[tokio::test] +async fn declare_account() { + let url = "http://127.0.0.1:5050"; + let client = Client::new(url); + + let res_chain_id = client.chainId().await; + assert!(res_chain_id.is_ok()); + assert_eq!(res_chain_id.unwrap().as_ref(), "0x4b4154414e41"); + + let block_id = BlockId::BlockTag(BlockTag::Pending); + let class_hash = Felt::try_new( + "0x6b46f84b1bbb779e588a9c5f577907c3dfb66e6b13cf4c4f480d4fb1677c2ba", + ) + .unwrap(); + let res_class = client.getClass(block_id.clone(), class_hash).await; + assert!(res_class.is_err()); + assert!(res_class.unwrap_err().message.contains("Class hash not found")); + + let contract_address = Address( + Felt::try_new( + "0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03", + ) + .unwrap(), + ); + let res_nonce = client.getNonce(block_id, contract_address).await; + assert!(res_nonce.is_ok()); + assert_eq!(res_nonce.unwrap().as_ref(), "0x0"); +}