pub fn update_pymtchan(
    pch_address: String,
    from_address: String,
    signed_voucher: String,
    nonce: u64,
    gas_limit: i64,
    gas_fee_cap: String,
    gas_premium: String,
) -> Result<Message, SignerError> {
    let sv_cbor = base64::decode(signed_voucher)?;

    let sv: paych::SignedVoucher = RawBytes::deserialize(&RawBytes::new(sv_cbor))?;

    let update_payment_channel_params = paych::UpdateChannelStateParams { sv, secret: vec![] };

    let serialized_params = RawBytes::serialize(update_payment_channel_params)
        .map_err(|err| SignerError::GenericString(err.to_string()))?;

    // TODO:  don't hardcode gas limit and gas price; use a gas estimator!
    let pch_update_message_api = Message {
        version: 0,
        to: fvm_shared::address::Address::from_str(&pch_address)?, // INIT_ACTOR_ADDR
        from: fvm_shared::address::Address::from_str(&from_address)?,
        sequence: nonce,
        value: fvm_shared::econ::TokenAmount::from_str("0")?,
        gas_limit,
        gas_fee_cap: fvm_shared::econ::TokenAmount::from_str(&gas_fee_cap)?,
        gas_premium: fvm_shared::econ::TokenAmount::from_str(&gas_premium)?,
        method_num: paych::Method::UpdateChannelState as u64,
        params: serialized_params,
    };

    Ok(pch_update_message_api)
}
/// Utility function to update the state of a payment channel.  Returns unsigned message.
///
/// # Arguments
///
/// * `pch_address` - A string address
/// * `from_address` - A string address
/// * `signed_voucher` - A SignedVoucher to be associated with the payment channel
/// * `nonce` - Nonce of the message; should be from_address's MpoolGetNonce() value
///
Utility function to update the state of a payment channel.  Returns unsigned message.
Utility function to update the state of a payment channel . Returns unsigned message .
pub fn update_pymtchan(
    pch_address: String,
    from_address: String,
    signed_voucher: String,
    nonce: u64,
    gas_limit: i64,
    gas_fee_cap: String,
    gas_premium: String,
) -> Result<Message, SignerError> {
    let sv_cbor = base64::decode(signed_voucher)?;
    let sv: paych::SignedVoucher = RawBytes::deserialize(&RawBytes::new(sv_cbor))?;
    let update_payment_channel_params = paych::UpdateChannelStateParams { sv, secret: vec![] };
    let serialized_params = RawBytes::serialize(update_payment_channel_params)
        .map_err(|err| SignerError::GenericString(err.to_string()))?;
    // TODO:  don't hardcode gas limit and gas price; use a gas estimator!
    let pch_update_message_api = Message {
        version: 0,
        to: fvm_shared::address::Address::from_str(&pch_address)?, // INIT_ACTOR_ADDR
        from: fvm_shared::address::Address::from_str(&from_address)?,
        sequence: nonce,
        value: fvm_shared::econ::TokenAmount::from_str("0")?,
        gas_limit,
        gas_fee_cap: fvm_shared::econ::TokenAmount::from_str(&gas_fee_cap)?,
        gas_premium: fvm_shared::econ::TokenAmount::from_str(&gas_premium)?,
        method_num: paych::Method::UpdateChannelState as u64,
        params: serialized_params,
    };
    Ok(pch_update_message_api)
}
pub fn update_pymtchan ( pch_address : String , from_address : String , signed_voucher : String , nonce : u64 , gas_limit : i64 , gas_fee_cap : String , gas_premium : String , ) -> Result < Message , SignerError > { let sv_cbor = base64 :: decode ( signed_voucher ) ? ; let sv : paych :: SignedVoucher = RawBytes :: deserialize ( & RawBytes :: new ( sv_cbor ) ) ? ; let update_payment_channel_params = paych :: UpdateChannelStateParams { sv , secret : vec ! [ ] } ; let serialized_params = RawBytes :: serialize ( update_payment_channel_params ) . map_err ( | err | SignerError :: GenericString ( err . to_string ( ) ) ) ? ; // TODO:  don't hardcode gas limit and gas price; use a gas estimator! let pch_update_message_api = Message { version : 0 , to : fvm_shared :: address :: Address :: from_str ( & pch_address ) ? , // INIT_ACTOR_ADDR from : fvm_shared :: address :: Address :: from_str ( & from_address ) ? , sequence : nonce , value : fvm_shared :: econ :: TokenAmount :: from_str ( " " ) ? , gas_limit , gas_fee_cap : fvm_shared :: econ :: TokenAmount :: from_str ( & gas_fee_cap ) ? , gas_premium : fvm_shared :: econ :: TokenAmount :: from_str ( & gas_premium ) ? , method_num : paych :: Method :: UpdateChannelState as u64 , params : serialized_params , } ; Ok ( pch_update_message_api ) }
Utility function to update the state of a payment channel.
Utility function to update the state of a payment channel .
pch_address
String
from_address
String
signed_voucher
String
nonce
u64
gas_limit
i64
gas_fee_cap
String
gas_premium
String
pch_address
String
from_address
String
signed_voucher
String
nonce
u64
gas_limit
i64
gas_fee_cap
String
gas_premium
String