Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
refactor : changed program_vec to program_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Jangra authored and Arun Jangra committed Jun 19, 2024
1 parent f68fd03 commit 0fb2574
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
6 changes: 3 additions & 3 deletions crates/client/rpc-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ pub struct DeclareV0Result {
///
/// **declare_transaction** : DeclareTransactionV0V1 struct constructed before calling.
///
/// **program_vec** : Program vector is program from `ClassInfo` struct converted into Vector.
/// **program_bytes** : Program bytes is program from `ClassInfo` struct converted into Vector.
///
/// **entrypoints** : Entrypoints are taken from `ClassInfo` struct.
///
/// **abi_length** : ABI length calculated from abi in `LegacyContractClass`.
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
#[derive(Serialize, Deserialize, Debug)]
pub struct CustomDeclareV0Transaction {
pub declare_transaction: DeclareTransactionV0V1,
pub program_vec: Vec<u8>,
pub program_bytes: Vec<u8>,
pub entrypoints: IndexMap<EntryPointType, Vec<EntryPoint>>,
pub abi_length: usize,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ where
async fn declare_v0_contract(&self, params: mc_rpc_core::CustomDeclareV0Transaction) -> RpcResult<DeclareV0Result> {
let txn_hash: TransactionHash = self.get_txn_hash(params.declare_transaction.clone());

let program_decoded = Program::decode_all(&mut params.program_vec.as_slice()).map_err(|e| {
let program_decoded = Program::decode_all(&mut params.program_bytes.as_slice()).map_err(|e| {
log::debug!("error: {:?}", e);
StarknetRpcApiError::InternalServerError
})?;
Expand Down
22 changes: 0 additions & 22 deletions crates/client/rpc/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use std::num::ParseIntError;
use std::{fmt, u64};

use indexmap::IndexMap;
use mp_felt::Felt252Wrapper;
use serde::{Deserialize, Serialize};
use starknet_api::deprecated_contract_class::{EntryPoint, EntryPointType};
use starknet_api::transaction::DeclareTransactionV0V1;
use starknet_ff::FieldElement;

pub struct RpcEventFilter {
Expand All @@ -29,24 +25,6 @@ pub enum ParseTokenError {
ParseFailed(ParseIntError),
}

/// CustomDeclareV0Transaction
/// This will be given as an input to the rpc body
///
/// **declare_transaction** : DeclareTransactionV0V1 struct constructed before calling.
///
/// **program_vec** : Program vector is program from `ClassInfo` struct converted into Vector.
///
/// **entrypoints** : Entrypoints are taken from `ClassInfo` struct.
///
/// **abi_length** : ABI length calculated from abi in `LegacyContractClass`.
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct CustomDeclareV0Transaction {
pub declare_transaction: DeclareTransactionV0V1,
pub program_vec: Vec<u8>,
pub entrypoints: IndexMap<EntryPointType, Vec<EntryPoint>>,
pub abi_length: usize,
}

impl fmt::Display for ContinuationToken {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:x},{:x}", self.block_n, self.event_n)
Expand Down

0 comments on commit 0fb2574

Please sign in to comment.