Skip to content

Commit

Permalink
add ethereum chain_id and client_id in EthPropertyResp(fix #43) (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-zkp authored Oct 26, 2023
1 parent 1e576c1 commit ed7a506
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions provider/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,15 @@ pub struct ZkLinkTxHistory {
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EthPropertyResp {
pub chain_id: ChainId,
pub layer_one_chain_id: U256,
pub gateways: Vec<GateWayInfo>,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct GateWayInfo {
pub chain_id: ChainId,
pub l1_gateway_chain_id: u64,
pub l1_gateway_contract: ZkLinkAddress,
pub l2_gateway_contract: ZkLinkAddress,
pub tokens: Vec<TokenInfo>,
Expand All @@ -302,6 +303,7 @@ pub struct TokenInfo {
pub token_id: TokenId,
pub token_address: ZkLinkAddress,
pub decimal: u8,
pub fast_withdraw: bool,
}

#[cfg(test)]
Expand All @@ -311,40 +313,44 @@ mod test {
#[test]
fn test_rpc_response() {
let s = r#" {
"chainId": 4,
"layerOneChainId": "0x1",
"gateways": [
{
"chainId": 5,
"l1GatewayChainId": 43113,
"l1GatewayContract": "0xffffffffffffffffffffffffffffffffffffffff",
"l2GatewayContract": "0xffffffffffffffffffffffffffffffffffffffff",
"tokens": [
{
"tokenId": 1,
"tokenAddress":"0xffffffffffffffffffffffffffffffffffffffff",
"decimal": 6
"decimal": 6,
"fastWithdraw": true
},
{
"tokenId": 3,
"tokenAddress":"0xffffffffffffffffffffffffffffffffffffffff",
"decimal": 7
"decimal": 7,
"fastWithdraw": false
}
]
},
{
"chainId": 7,
"l1GatewayChainId": 1,
"l1GatewayContract": "0xffffffffffffffffffffffffffffffffffffffff",
"l2GatewayContract": "0xffffffffffffffffffffffffffffffffffffffff",
"tokens": [
{
"tokenId": 1,
"tokenAddress":"0xffffffffffffffffffffffffffffffffffffffff",
"decimal": 6
"decimal": 6,
"fastWithdraw": true
},
{
"tokenId": 3,
"tokenAddress":"0xffffffffffffffffffffffffffffffffffffffff",
"decimal": 6
"decimal": 6,
"fastWithdraw": false
}
]
}
Expand Down

0 comments on commit ed7a506

Please sign in to comment.