-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add liquidity for mintable assets on docs
- Loading branch information
1 parent
f93d646
commit 86c0df8
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import axios from 'axios'; | ||
|
||
const AssetBridgeLiquidityData = () => { | ||
const [data, setData] = useState([]); | ||
|
||
useEffect(() => { | ||
fetchData(); | ||
}, []); | ||
|
||
const fetchData = async () => { | ||
try { | ||
const result = await axios.get("https://api.poap-nft.routerprotocol.com/liquidity/asset-bridge"); | ||
console.log(result) | ||
const resultArray = Object.keys(result.data).map(chainId => { | ||
return { chainId, ...result.data[chainId] }; | ||
}); | ||
console.log() | ||
setData(resultArray); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th style={{ fontWeight: 'bold' }}>Chain ID</th> | ||
<th style={{ fontWeight: 'bold' }}>Chain Name</th> | ||
<th style={{ fontWeight: 'bold' }}>Token</th> | ||
<th style={{ fontWeight: 'bold' }}>Token Balance</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{data.filter((item) => parseFloat(item.balance) > 0) | ||
.map((item) => ( | ||
<tr key={item.chainId}> | ||
<td>{item.chainId}</td> | ||
<td>{item.chain}</td> | ||
<td>{item.tokenSymbol}</td> | ||
<td>{parseFloat(item.balance) / Math.pow(10, item.tokenDecimal)}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AssetBridgeLiquidityData; |