Skip to content

Commit 3b682f1

Browse files
authored
feat: deprecate pre-v3 transactions (#688)
1 parent 96bc685 commit 3b682f1

11 files changed

+24
-11
lines changed

examples/declare_cairo1_contract.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async fn main() {
4848
let flattened_class = contract_artifact.flatten().unwrap();
4949

5050
let result = account
51-
.declare_v2(Arc::new(flattened_class), compiled_class_hash)
51+
.declare_v3(Arc::new(flattened_class), compiled_class_hash)
5252
.send()
5353
.await
5454
.unwrap();

examples/deploy_account_with_ledger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async fn main() {
3434
.await
3535
.unwrap();
3636

37-
let deployment = factory.deploy_v1(salt);
37+
let deployment = factory.deploy_v3(salt);
3838

3939
let est_fee = deployment.estimate_fee().await.unwrap();
4040

examples/deploy_argent_account.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async fn main() {
2929
.await
3030
.unwrap();
3131

32-
let deployment = factory.deploy_v1(salt);
32+
let deployment = factory.deploy_v3(salt);
3333

3434
let est_fee = deployment.estimate_fee().await.unwrap();
3535

examples/deploy_contract.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async fn main() {
4949

5050
let contract_factory = ContractFactory::new(class_hash, account);
5151
contract_factory
52-
.deploy_v1(vec![felt!("123456")], felt!("1122"), false)
52+
.deploy_v3(vec![felt!("123456")], felt!("1122"), false)
5353
.send()
5454
.await
5555
.expect("Unable to deploy contract");

examples/mint_tokens.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async fn main() {
3838
account.set_block_id(BlockId::Tag(BlockTag::Pending));
3939

4040
let result = account
41-
.execute_v1(vec![Call {
41+
.execute_v3(vec![Call {
4242
to: tst_token_address,
4343
selector: get_selector_from_name("mint").unwrap(),
4444
calldata: vec![

examples/transfer_with_ledger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async fn main() {
4444
account.set_block_id(BlockId::Tag(BlockTag::Pending));
4545

4646
let result = account
47-
.execute_v1(vec![Call {
47+
.execute_v3(vec![Call {
4848
to: eth_token_address,
4949
selector: get_selector_from_name("transfer").unwrap(),
5050
calldata: vec![felt!("0x1234"), felt!("100"), Felt::ZERO],

starknet-accounts/src/account/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ pub trait Account: ExecutionEncoder + Sized {
9292

9393
/// Generates an instance of [`ExecutionV1`] for sending `INVOKE` v1 transactions. Pays
9494
/// transaction fees in `ETH`.
95+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `execute_v3` instead"]
9596
fn execute_v1(&self, calls: Vec<Call>) -> ExecutionV1<'_, Self> {
9697
ExecutionV1::new(calls, self)
9798
}
@@ -104,8 +105,9 @@ pub trait Account: ExecutionEncoder + Sized {
104105

105106
/// Generates an instance of [`ExecutionV1`] for sending `INVOKE` v1 transactions. Pays
106107
/// transaction fees in `ETH`.
107-
#[deprecated = "use version specific variants (`execute_v1` & `execute_v3`) instead"]
108+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `execute_v3` instead"]
108109
fn execute(&self, calls: Vec<Call>) -> ExecutionV1<'_, Self> {
110+
#[allow(deprecated)]
109111
self.execute_v1(calls)
110112
}
111113

@@ -124,6 +126,7 @@ pub trait Account: ExecutionEncoder + Sized {
124126
///
125127
/// This method is only used for declaring Sierra (Cairo 1) classes. To declare legacy (Cairo 0)
126128
/// classes use [`declare_legacy`](fn.declare_legacy) instead.
129+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `declare_v3` instead"]
127130
fn declare_v2(
128131
&self,
129132
contract_class: Arc<FlattenedSierraClass>,
@@ -170,12 +173,13 @@ pub trait Account: ExecutionEncoder + Sized {
170173
///
171174
/// This method is only used for declaring Sierra (Cairo 1) classes. To declare legacy (Cairo 0)
172175
/// classes use [`declare_legacy`](fn.declare_legacy) instead.
173-
#[deprecated = "use version specific variants (`declare_v2` & `declare_v3`) instead"]
176+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `declare_v3` instead"]
174177
fn declare(
175178
&self,
176179
contract_class: Arc<FlattenedSierraClass>,
177180
compiled_class_hash: Felt,
178181
) -> DeclarationV2<'_, Self> {
182+
#[allow(deprecated)]
179183
self.declare_v2(contract_class, compiled_class_hash)
180184
}
181185

starknet-accounts/src/factory/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub trait AccountFactory: Sized {
117117

118118
/// Generates an instance of [`AccountDeploymentV1`] for sending `DEPLOY_ACCOUNT` v1
119119
/// transactions. Pays transaction fees in `ETH`.
120+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `deploy_v3` instead"]
120121
fn deploy_v1(&self, salt: Felt) -> AccountDeploymentV1<'_, Self> {
121122
AccountDeploymentV1::new(salt, self)
122123
}
@@ -129,8 +130,9 @@ pub trait AccountFactory: Sized {
129130

130131
/// Generates an instance of [`AccountDeploymentV1`] for sending `DEPLOY_ACCOUNT` v1
131132
/// transactions. Pays transaction fees in `ETH`.
132-
#[deprecated = "use version specific variants (`deploy_v1` & `deploy_v3`) instead"]
133+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `deploy_v3` instead"]
133134
fn deploy(&self, salt: Felt) -> AccountDeploymentV1<'_, Self> {
135+
#[allow(deprecated)]
134136
self.deploy_v1(salt)
135137
}
136138
}

starknet-accounts/tests/single_owner_account.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ async fn can_get_nonce_inner<P: Provider + Send + Sync>(provider: P, address: &s
202202
assert_ne!(account.get_nonce().await.unwrap(), Felt::ZERO);
203203
}
204204

205+
#[allow(deprecated)]
205206
async fn can_estimate_invoke_v1_fee_inner<P: Provider + Send + Sync>(provider: P, address: &str) {
206207
let signer = LocalWallet::from(SigningKey::from_secret_scalar(
207208
Felt::from_hex("00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(),
@@ -268,7 +269,7 @@ async fn can_parse_fee_estimation_error_inner<P: Provider + Send + Sync>(
268269
account.set_block_id(BlockId::Tag(BlockTag::Pending));
269270

270271
match account
271-
.execute_v1(vec![Call {
272+
.execute_v3(vec![Call {
272273
to: eth_token_address,
273274
selector: get_selector_from_name("transfer").unwrap(),
274275
calldata: vec![
@@ -290,6 +291,7 @@ async fn can_parse_fee_estimation_error_inner<P: Provider + Send + Sync>(
290291
}
291292
}
292293

294+
#[allow(deprecated)]
293295
async fn can_execute_eth_transfer_invoke_v1_inner<P: Provider + Send + Sync>(
294296
provider: P,
295297
address: &str,
@@ -400,6 +402,7 @@ async fn can_execute_eth_transfer_invoke_v3_with_manual_gas_inner<P: Provider +
400402
assert!(result.transaction_hash > Felt::ZERO);
401403
}
402404

405+
#[allow(deprecated)]
403406
async fn can_declare_cairo1_contract_v2_inner<P: Provider + Send + Sync>(
404407
provider: P,
405408
address: &str,

starknet-contract/src/factory.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ where
8888
{
8989
/// Generates an instance of [`DeploymentV1`] for sending `INVOKE` v1 transactions for the
9090
/// contract deployment. Pays transaction fees in `ETH`.
91+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `deploy_v3` instead"]
9192
pub const fn deploy_v1(
9293
&self,
9394
constructor_calldata: Vec<Felt>,
@@ -128,13 +129,14 @@ where
128129

129130
/// Generates an instance of [`DeploymentV1`] for sending `INVOKE` v1 transactions for the
130131
/// contract deployment. Pays transaction fees in `ETH`.
131-
#[deprecated = "use version specific variants (`deploy_v1` & `deploy_v3`) instead"]
132+
#[deprecated = "pre-v3 transactions are deprecated and will be disabled on Starknet soon; use `deploy_v3` instead"]
132133
pub const fn deploy(
133134
&self,
134135
constructor_calldata: Vec<Felt>,
135136
salt: Felt,
136137
unique: bool,
137138
) -> DeploymentV1<'_, A> {
139+
#[allow(deprecated)]
138140
self.deploy_v1(constructor_calldata, salt, unique)
139141
}
140142
}
@@ -399,6 +401,7 @@ mod tests {
399401

400402
use super::*;
401403

404+
#[allow(deprecated)]
402405
#[test]
403406
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
404407
fn test_deployed_address_unique() {

starknet-contract/tests/contract_deployment.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const CHAIN_ID: Felt = Felt::from_raw([
1414
1555806712078248243,
1515
]);
1616

17+
#[allow(deprecated)]
1718
#[tokio::test]
1819
async fn can_deploy_contract_to_alpha_sepolia_with_invoke_v1() {
1920
let rpc_url = std::env::var("STARKNET_RPC")

0 commit comments

Comments
 (0)