Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(katana): modify DevApi trait with new endpoints #2490

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5347bc3
Modify DevApi trait with new endpoints
fabrobles92 Oct 1, 2024
75155c0
Implementation of account_balance method
fabrobles92 Oct 3, 2024
e2612e3
clippy.sh and rust_fmt.sh
fabrobles92 Oct 3, 2024
9902cfe
Replace RPC call with querying the storage directly
fabrobles92 Oct 11, 2024
b2e3ad4
-Re implement proxy_get_request.rs
fabrobles92 Oct 22, 2024
3947795
cargo fmt
fabrobles92 Oct 22, 2024
c23d9eb
Merge branch 'main' into feat/expose_dev_endpoints
fabrobles92 Oct 23, 2024
5a3865c
update cargo.lock
fabrobles92 Oct 30, 2024
8c4a8b8
Merge branch 'main' into feat/expose_dev_endpoints
fabrobles92 Oct 30, 2024
8e08862
Keep ProxyGetRequestLayer for / (health) endpoint
fabrobles92 Oct 30, 2024
e4666bc
Enable query param contract_address for endpoint account_balance
fabrobles92 Oct 31, 2024
0bf530d
Merge branch 'main' into feat/expose_dev_endpoints
fabrobles92 Oct 31, 2024
3ec9a5e
cargo fmt
fabrobles92 Oct 31, 2024
378ae06
Remove unused files
fabrobles92 Dec 7, 2024
9411eb5
Update cargo
fabrobles92 Dec 7, 2024
23cd841
Merge branch 'main' into feat/expose_dev_endpoints
fabrobles92 Dec 7, 2024
8e61aa4
- Accepting unit param
fabrobles92 Dec 13, 2024
0f2380d
Merge branch 'main' into feat/expose_dev_endpoints
fabrobles92 Dec 13, 2024
01f69c2
Fix cargo, removing duplicates
fabrobles92 Dec 13, 2024
78c2180
Implement Devnet Proxy Layer in new implementation
fabrobles92 Dec 13, 2024
1aafb25
Merge branch 'main' into feat/expose_dev_endpoints
fabrobles92 Jan 3, 2025
c8d2444
Clean unused code
fabrobles92 Jan 3, 2025
2cb90f1
clippy.sh
fabrobles92 Jan 3, 2025
0c14c03
rust_fmt.sh
fabrobles92 Jan 4, 2025
3d73532
Fix default case in match and early return when invalid route provided
fabrobles92 Jan 4, 2025
17a53b5
Fix error when returning response when route is not known in DevnetPr…
fabrobles92 Jan 4, 2025
5c6981b
Apply code rabbit suggestions
fabrobles92 Jan 9, 2025
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
Prev Previous commit
Next Next commit
clippy.sh and rust_fmt.sh
  • Loading branch information
fabrobles92 committed Oct 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e2612e30192e60031b3ebd5aab60095cfca4bb66
2 changes: 1 addition & 1 deletion crates/katana/rpc/rpc-api/src/dev.rs
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ pub trait DevApi {

#[method(name = "setStorageAt")]
async fn set_storage_at(&self, contract_address: Felt, key: Felt, value: Felt)
-> RpcResult<()>;
-> RpcResult<()>;

#[method(name = "predeployedAccounts")]
async fn predeployed_accounts(&self) -> RpcResult<Vec<Account>>;
4 changes: 2 additions & 2 deletions crates/katana/rpc/rpc/src/dev.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
use katana_core::service::block_producer::{BlockProducer, BlockProducerMode, PendingExecutor};
use katana_executor::ExecutorFactory;
use katana_primitives::genesis::constant::DEFAULT_FEE_TOKEN_ADDRESS;
use katana_primitives::{address, ContractAddress, Felt};
use katana_primitives::{ContractAddress, Felt};
use katana_rpc_api::dev::DevApiServer;
use katana_rpc_types::account::Account;
use katana_rpc_types::error::dev::DevApiError;
@@ -98,36 +98,36 @@
}

#[allow(deprecated)]
async fn account_balance(&self, account_address: &str) -> Result<u128, Error> {
// let account_address =
// address!("0x6b86e40118f29ebe393a75469b4d926c7a44c2e2681b6d319520b7c1156d114");
let account_address = Felt::from_dec_str(&account_address).unwrap();
let account_address = Felt::from_dec_str(account_address).unwrap();
let account_address = ContractAddress::from(account_address);
let url = Url::parse("http://localhost:5050").unwrap();
let provider = Arc::new(JsonRpcClient::new(HttpTransport::new(url)));
let res = provider
.call(
FunctionCall {
contract_address: DEFAULT_FEE_TOKEN_ADDRESS.into(),
entry_point_selector: selector!("balanceOf"),
calldata: vec![account_address.into()],
},
BlockId::Tag(BlockTag::Latest),
)
.await;

let balance: u128 = res.unwrap()[0].to_string().parse().unwrap();

Ok(balance)
}

Check warning on line 122 in crates/katana/rpc/rpc/src/dev.rs

Codecov / codecov/patch

crates/katana/rpc/rpc/src/dev.rs#L101-L122

Added lines #L101 - L122 were not covered by tests

async fn fee_token(&self) -> Result<u64, Error> {
Ok(1)
}

Check warning on line 126 in crates/katana/rpc/rpc/src/dev.rs

Codecov / codecov/patch

crates/katana/rpc/rpc/src/dev.rs#L124-L126

Added lines #L124 - L126 were not covered by tests

async fn mint(&self) -> Result<(), Error> {
Ok(())
}

Check warning on line 130 in crates/katana/rpc/rpc/src/dev.rs

Codecov / codecov/patch

crates/katana/rpc/rpc/src/dev.rs#L128-L130

Added lines #L128 - L130 were not covered by tests

#[allow(deprecated)]
async fn predeployed_accounts(&self) -> Result<Vec<Account>, Error> {
Loading