Skip to content

Commit

Permalink
feat: add chs_signature and indexer_signature
Browse files Browse the repository at this point in the history
  • Loading branch information
getong committed Sep 18, 2024
1 parent ef6bba9 commit a3581b3
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions apps/indexer-proxy/proxy/src/payg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,16 +741,30 @@ pub async fn extend_channel(

// send to coordinator
let expired_at = expired + expiration as i64;
let account = ACCOUNT.read().await;
let indexer_sign = extend_sign2(
channel_id,
indexer,
state_cache.agent,
new_price,
U256::from(expired),
U256::from(expiration),
&account.controller,
)
.await?;
drop(account);
let indexer_sign = convert_sign_to_string(&indexer_sign);
let mdata = format!(
r#"mutation {{
channelExtend(
id:"{:#X}",
expiration:{},
price:"{}",
)
indexerSign:{},
consumerSign:{}
{{ id, expiredAt }}
}}"#,
channel_id, expired_at, new_price,
channel_id, expired_at, new_price, indexer_sign, signature
);
let url = COMMAND.graphql_url();
let query = GraphQLQuery::query(&mdata);
Expand All @@ -763,20 +777,7 @@ pub async fn extend_channel(
return Err(Error::ServiceException(1202));
}

let account = ACCOUNT.read().await;
let indexer_sign = extend_sign2(
channel_id,
indexer,
state_cache.agent,
new_price,
U256::from(expired),
U256::from(expiration),
&account.controller,
)
.await?;
drop(account);

Ok(convert_sign_to_string(&indexer_sign))
Ok(indexer_sign)
}

pub async fn pay_channel(mut state: QueryState) -> Result<String> {
Expand Down

0 comments on commit a3581b3

Please sign in to comment.