@opendollar/svg-generator
v1.7.4
Published
<p align="center"> <svg width="60" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M8.26508 16C12.6833 16 16.2651 12.4183 16.2651 8.00001C16.2651 3.58173 12.6833 1.52588e-05 8.26508 1.52588e-05V16Z" fill="#43C7FF"/> <path d=
Downloads
10
Readme
Usage
See a complete example in our app
import { generateSvg } from '@opendollar/svg-generator'
const statsForSVG = {
vaultID: singleSafe?.id,
stabilityFee:
Math.floor(
Number(
getRatePercentage(
singleSafe?.totalAnnualizedStabilityFee ? singleSafe?.totalAnnualizedStabilityFee : '0',
2
)
)
).toString() + '%',
debtAmount: formatWithCommas(totalDebt) + ' OD',
collateralAmount: formatWithCommas(collateral) + ' ' + collateralName,
collateralizationRatio: Number(singleSafe?.collateralRatio),
safetyRatio: Number(safeState.liquidationData!.collateralLiquidationData[collateralName].safetyCRatio),
liqRatio: Number(safeState.liquidationData!.collateralLiquidationData[collateralName].liquidationCRatio),
}
const svgHtml = generateSvg(statsForSVG)
return (
<div>
<div
style={{
maxWidth: '100%',
height: 'auto',
border: '1px solid #00374E',
borderRadius: '0px',
}}
dangerouslySetInnerHTML={{ __html: svgHtml }}
></div>
</div>
)
Test
Generate example SVGs in /test
node test
Validation
Validate the on-chain SVG renderer by querying the first few vaults:
node tasks/pullFromContracts.js