/**
 * Creates a new request, linking from the debtor to the creditor public key
 */
Creates a new request, linking from the debtor to the creditor public key
Creates a new request linking from the debtor to the creditor public key
pub fn create_request(
    request_data:CreateRequestInput
) -> ExternResult<EntryHash> {
    let agent_info = agent_info!()?;
    let now = sys_time!()?;
    let ts:Timestamp = Timestamp(now.as_secs(),now.as_nanos())
    let request = Request {
        status: RequestStatus::Pending,
        debtor_pub_key: agent_info.agent_latest_pubkey.clone(),
        creditor_pub_key: request_data.receiver,
        amount: request_data.amount,
        timestamp: ts
    };
    create_entry!(request.clone())?;
    let request_hash = hash_entry!(request.clone())?;
    let path = my_requests_path()?;
    path.ensure()?;
    create_link!(path.hash()?, request_hash.clone())?;
    let creditor_path = requests_path_for_agent(receiver.clone());
    creditor_path.ensure()?;
    create_link!(creditor_path.hash()?, request_hash.clone())?;
    Ok(request_hash)
}
pub fn create_request ( request_data : CreateRequestInput ) -> ExternResult < EntryHash > { let agent_info = agent_info ! ( ) ? ; let now = sys_time ! ( ) ? ; let ts : Timestamp = Timestamp ( now . as_secs ( ) , now . as_nanos ( ) ) let request = Request { status : RequestStatus :: Pending , debtor_pub_key : agent_info . agent_latest_pubkey . clone ( ) , creditor_pub_key : request_data . receiver , amount : request_data . amount , timestamp : ts } ; create_entry ! ( request clone ( ) ) ? ; let request_hash = hash_entry ! ( request clone ( ) ) ? ; let path = my_requests_path ( ) ? ; path . ensure ( ) ? ; create_link ! ( path hash ( ) request_hash clone ( ) ) ? ; let creditor_path = requests_path_for_agent ( receiver . clone ( ) ) ; creditor_path . ensure ( ) ? ; create_link ! ( creditor_path hash ( ) request_hash clone ( ) ) ? ; Ok ( request_hash ) }
Creates a new request, linking from the debtor to the creditor public key
Creates a new request linking from the debtor to the creditor public key
request_data
CreateRequestInput