Function name in contract calling functions
@@ -146,14 +146,14 @@ impl Contract {
Ok(Box::new(map))
}
- pub fn call<TIn, TOut>(id: AccountId, input: TIn, key_pair: Option<&Keypair>)
+ pub fn call<TIn, TOut>(id: AccountId, func: String, input: TIn, key_pair: Option<&Keypair>)
-> SdkResult<Box<dyn Stream<Item = ContractCallState, Error = SdkError>>>
where
TIn: ABIInParameter + ABITypeSignature,
TOut: ABIInParameter + ABITypeSignature {
// pack params into bag of cells via ABI
- let msg_body = Self::create_message_body::<TIn, TOut>(input, key_pair);
+ let msg_body = Self::create_message_body::<TIn, TOut>(func, input, key_pair);
let msg = Self::create_message(id.clone(), msg_body)?;
@@ -174,14 +174,14 @@ impl Contract {
Self::subscribe_updates(msg_id)
}
- pub fn construct_call_message<TIn, TOut>(id: AccountId, input: TIn, key_pair: Option<&Keypair>)
+ pub fn construct_call_message<TIn, TOut>(id: AccountId, func: String, input: TIn, key_pair: Option<&Keypair>)
-> SdkResult<(Vec<u8>, MessageId)>
where
TIn: ABIInParameter + ABITypeSignature,
TOut: ABIInParameter + ABITypeSignature {
// pack params into bag of cells via ABI
- let msg_body = Self::create_message_body::<TIn, TOut>(input, key_pair);
+ let msg_body = Self::create_message_body::<TIn, TOut>(func, input, key_pair);
let msg = Self::create_message(id.clone(), msg_body)?;
@@ -222,7 +222,7 @@ impl Contract {
// The message contains StateInit struct with code, public key and lib
// and body with parameters for contract special method - constructor.
- let msg_body = Self::create_message_body::<TIn, TOut>(input, key_pair);
+ let msg_body = Self::create_message_body::<TIn, TOut>(CONSTRUCTOR_METHOD_NAME.to_string(), input, key_pair);
let msg = Self::create_deploy_message(Some(msg_body), image)?;
@@ -237,7 +237,7 @@ impl Contract {
TIn: ABIInParameter + ABITypeSignature,
TOut: ABIInParameter + ABITypeSignature {
- let msg_body = Self::create_message_body::<TIn, TOut>(input, key_pair);
+ let msg_body = Self::create_message_body::<TIn, TOut>(CONSTRUCTOR_METHOD_NAME.to_string(), input, key_pair);
let msg = Self::create_deploy_message(Some(msg_body), image)?;
@@ -291,7 +291,7 @@ impl Contract {
Ok(msg)
}
- fn create_message_body<TIn, TOut>(input: TIn, key_pair: Option<&Keypair>) -> Arc<CellData>
+ fn create_message_body<TIn, TOut>(func: String, input: TIn, key_pair: Option<&Keypair>) -> Arc<CellData>
where
TIn: ABIInParameter + ABITypeSignature,
TOut: ABIInParameter + ABITypeSignature {
@@ -299,11 +299,11 @@ impl Contract {
match key_pair {
Some(p) => {
ABICall::<TIn, TOut>::encode_signed_function_call_into_slice(
- CONSTRUCTOR_METHOD_NAME, input, p).into()
+ func, input, p).into()
}
_ => {
ABICall::<TIn, TOut>::encode_function_call_into_slice(
- CONSTRUCTOR_METHOD_NAME, input).into()
+ func, input).into()
}
}
}
