pub fn create_voucher(
    payment_channel_address: String,
    time_lock_min: i64,
    time_lock_max: i64,
    amount: String,
    lane: u64,
    nonce: u64,
    min_settle_height: i64,
) -> Result<String, SignerError> {
    let pch = fvm_shared::address::Address::from_str(&payment_channel_address)?;
    let amount = match fvm_shared::bigint::BigInt::parse_bytes(amount.as_bytes(), 10) {
        Some(value) => value,
        None => {
            return Err(SignerError::GenericString(
                "`amount` couldn't be parsed.".to_string(),
            ));
        }
    };

    let voucher = paych::SignedVoucher {
        channel_addr: pch,
        time_lock_min,
        time_lock_max,
        secret_pre_image: Vec::new(),
        extra: None,
        lane,
        nonce,
        amount,
        min_settle_height,
        merges: Vec::new(),
        signature: None,
    };

    let cbor_voucher = base64::encode(to_vec(&voucher)?);

    Ok(cbor_voucher)
}
/// Create a voucher for payment channel
///
/// # Arguments
///
/// * `payment_channel_address` - The payment channel address;
/// * `time_lock_min` - Time lock min;
/// * `time_lock_maax` - Time lock max;
/// * `amount` - Amount in the voucher;
/// * `lane` - Lane of the voucher;
/// * `nonce` - Next nonce of the voucher;
///
Create a voucher for payment channel
Create a voucher for payment channel
pub fn create_voucher(
    payment_channel_address: String,
    time_lock_min: i64,
    time_lock_max: i64,
    amount: String,
    lane: u64,
    nonce: u64,
    min_settle_height: i64,
) -> Result<String, SignerError> {
    let pch = fvm_shared::address::Address::from_str(&payment_channel_address)?;
    let amount = match fvm_shared::bigint::BigInt::parse_bytes(amount.as_bytes(), 10) {
        Some(value) => value,
        None => {
            return Err(SignerError::GenericString(
                "`amount` couldn't be parsed.".to_string(),
            ));
        }
    };
    let voucher = paych::SignedVoucher {
        channel_addr: pch,
        time_lock_min,
        time_lock_max,
        secret_pre_image: Vec::new(),
        extra: None,
        lane,
        nonce,
        amount,
        min_settle_height,
        merges: Vec::new(),
        signature: None,
    };
    let cbor_voucher = base64::encode(to_vec(&voucher)?);
    Ok(cbor_voucher)
}
pub fn create_voucher ( payment_channel_address : String , time_lock_min : i64 , time_lock_max : i64 , amount : String , lane : u64 , nonce : u64 , min_settle_height : i64 , ) -> Result < String , SignerError > { let pch = fvm_shared :: address :: Address :: from_str ( & payment_channel_address ) ? ; let amount = match fvm_shared :: bigint :: BigInt :: parse_bytes ( amount . as_bytes ( ) , 10 ) { Some ( value ) => value , None => { return Err ( SignerError :: GenericString ( " " . to_string ( ) , ) ) ; } } ; let voucher = paych :: SignedVoucher { channel_addr : pch , time_lock_min , time_lock_max , secret_pre_image : Vec :: new ( ) , extra : None , lane , nonce , amount , min_settle_height , merges : Vec :: new ( ) , signature : None , } ; let cbor_voucher = base64 :: encode ( to_vec ( & voucher ) ? ) ; Ok ( cbor_voucher ) }
Create a voucher for payment channel
Create a voucher for payment channel
payment_channel_address
String
time_lock_min
i64
time_lock_max
i64
amount
String
lane
u64
nonce
u64
min_settle_height
i64
payment_channel_address
String
time_lock_min
i64
time_lock_max
i64
amount
String
lane
u64
nonce
u64
min_settle_height
i64