mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-16 16:21:32 +03:00
New fetchWithValidation / introducing simpleFetch
This commit is contained in:
@@ -30,10 +30,13 @@ export default async function getBalance(
|
||||
}
|
||||
const assetContractBalance = await exchangeContract.getBalance(assetAddress, walletAddress);
|
||||
const denormalizedAssetInContractBalance = utils.denormalizeNumber(assetContractBalance, INTERNAL_ORION_PRECISION);
|
||||
const denormalizedAssetLockedBalance = await orionAggregator.getLockedBalance(walletAddress, asset);
|
||||
const denormalizedAssetLockedBalanceResult = await orionAggregator.getLockedBalance(walletAddress, asset);
|
||||
if (denormalizedAssetLockedBalanceResult.isErr()) {
|
||||
throw new Error(denormalizedAssetLockedBalanceResult.error.message);
|
||||
}
|
||||
|
||||
return {
|
||||
exchange: denormalizedAssetInContractBalance.minus(denormalizedAssetLockedBalance[asset] ?? 0),
|
||||
exchange: denormalizedAssetInContractBalance.minus(denormalizedAssetLockedBalanceResult.value[asset] ?? 0),
|
||||
wallet: denormalizedAssetInWalletBalance,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ export { default as normalizeNumber } from './normalizeNumber';
|
||||
export { default as getSwapPair } from './getSwapPair';
|
||||
export { default as getSwapSide } from './getSwapSide';
|
||||
|
||||
export { default as HttpError } from './httpError';
|
||||
// export { default as HttpError } from './httpError';
|
||||
|
||||
export * from './typeHelpers';
|
||||
|
||||
Reference in New Issue
Block a user