Skip to content

Commit 411f874

Browse files
authored
Update to starknet-devnet 0.6.0 (#3749)
## Introduced changes - Update Devnet to 0.6.0 - This skips version 0.5.1 - Update `mint_token` to use RPC - Let me know if there are similar places that require attention. - Fix expected type of deployment receipt. ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [ ] Added changes to `CHANGELOG.md`
1 parent d342f2b commit 411f874

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
scarb 2.12.1 2.10.1
2-
starknet-devnet 0.5.0
2+
starknet-devnet 0.6.0

crates/sncast/tests/e2e/deploy.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use snapbox::cmd::cargo_bin;
1616
use sncast::AccountType;
1717
use sncast::helpers::constants::OZ_CLASS_HASH;
1818
use sncast::helpers::fee::FeeArgs;
19-
use starknet::core::types::TransactionReceipt::Deploy;
19+
use starknet::core::types::TransactionReceipt::Invoke;
2020
use starknet::core::types::{InvokeTransaction, Transaction, TransactionExecutionStatus};
2121
use starknet_types_core::felt::{Felt, NonZeroFelt};
2222
use test_case::test_case;
@@ -92,7 +92,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
9292
let hash = get_transaction_hash(&snapbox.assert().success().get_output().stdout.clone());
9393
let receipt = get_transaction_receipt(hash).await;
9494

95-
assert!(matches!(receipt, Deploy(_)));
95+
assert!(matches!(receipt, Invoke(_)));
9696
}
9797

9898
#[test_case(FeeArgs{
@@ -170,8 +170,8 @@ async fn test_happy_case_different_fees(fee_args: FeeArgs) {
170170
let output = snapbox.assert().success().get_output().stdout.clone();
171171

172172
let hash = get_transaction_hash(&output);
173-
let Deploy(receipt) = get_transaction_receipt(hash).await else {
174-
panic!("Should be Deploy receipt");
173+
let Invoke(receipt) = get_transaction_receipt(hash).await else {
174+
panic!("Should be Invoke receipt");
175175
};
176176
assert_eq!(
177177
receipt.execution_result.status(),
@@ -210,7 +210,7 @@ async fn test_happy_case_with_constructor() {
210210
let hash = get_transaction_hash(&output);
211211
let receipt = get_transaction_receipt(hash).await;
212212

213-
assert!(matches!(receipt, Deploy(_)));
213+
assert!(matches!(receipt, Invoke(_)));
214214
}
215215

216216
#[tokio::test]
@@ -239,7 +239,7 @@ async fn test_happy_case_with_constructor_cairo_expression_calldata() {
239239
let hash = get_transaction_hash(&output);
240240
let receipt = get_transaction_receipt(hash).await;
241241

242-
assert!(matches!(receipt, Deploy(_)));
242+
assert!(matches!(receipt, Invoke(_)));
243243
}
244244

245245
#[test]

crates/sncast/tests/helpers/fixtures.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,26 @@ pub async fn invoke_contract(
243243

244244
pub async fn mint_token(recipient: &str, amount: u128) {
245245
let client = reqwest::Client::new();
246-
let json = json!(
247-
{
246+
let json = json!({
247+
"jsonrpc": "2.0",
248+
"method": "devnet_mint",
249+
"params": {
248250
"address": recipient,
249251
"amount": amount,
250252
"unit": "FRI",
251-
}
252-
);
253-
client
254-
.post("http://127.0.0.1:5055/mint")
253+
},
254+
"id": 0,
255+
});
256+
let resp = client
257+
.post("http://127.0.0.1:5055/rpc")
255258
.header("Content-Type", "application/json")
256259
.body(json.to_string())
257260
.send()
258261
.await
259262
.expect("Error occurred while minting tokens");
263+
264+
let resp_body: serde_json::Value = resp.json().await.expect("No JSON in response");
265+
assert!(resp_body["result"].is_object());
260266
}
261267

262268
#[must_use]

0 commit comments

Comments
 (0)