|
1 | 1 | import { Types } from 'cafe-utility' |
2 | 2 | import { BeeRequestOptions, ChainState, ReserveState, WalletBalance } from '../../types' |
| 3 | +import { GetChainStateResponse } from '../../types/schema' |
3 | 4 | import { http } from '../../utils/http' |
4 | 5 | import { BZZ, DAI } from '../../utils/tokens' |
5 | 6 | import { asNumberString } from '../../utils/type' |
@@ -44,13 +45,14 @@ export async function getChainState(requestOptions: BeeRequestOptions): Promise< |
44 | 45 | responseType: 'json', |
45 | 46 | }) |
46 | 47 |
|
47 | | - const body = Types.asObject(response.data, { name: 'response.data' }) |
| 48 | + const body = GetChainStateResponse.parse(response.data) |
48 | 49 |
|
49 | 50 | return { |
50 | | - block: Types.asNumber(body.block, { name: 'block' }), |
51 | | - chainTip: Types.asNumber(body.chainTip, { name: 'chainTip' }), |
52 | | - totalAmount: asNumberString(body.totalAmount, { name: 'totalAmount' }), |
53 | | - currentPrice: normalizeCurrentPrice(Types.asNumber(body.currentPrice, { name: 'currentPrice' })), |
| 51 | + block: body.block, |
| 52 | + chainTip: body.chainTip, |
| 53 | + totalAmount: body.totalAmount, |
| 54 | + currentPrice: normalizeCurrentPrice(body.currentPrice), |
| 55 | + minimumValidityBlocks: body.minimumValidityBlocks, |
54 | 56 | } |
55 | 57 | } |
56 | 58 |
|
|
0 commit comments