Skip to content

Commit 23b0ee1

Browse files
authored
add getHumanAmount to SDK (#212)
* add function to getHumanAmount * fix
1 parent a7e56c8 commit 23b0ee1

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metadaoproject/futarchy",
3-
"version": "0.3.0-alpha.0",
3+
"version": "0.3.0-alpha.1",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"files": [

sdk/src/utils/priceMath.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export class PriceMath {
1515
return new BN(humanAmount * 10 ** decimals);
1616
}
1717

18+
public static getHumanAmount(chainAmount: BN, decimals: number): number {
19+
return chainAmount.toNumber() / 10 ** decimals
20+
}
21+
1822
public static getHumanPrice(
1923
ammPrice: BN,
2024
baseDecimals: number,

0 commit comments

Comments
 (0)