mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-04 03:58:00 +03:00
feat: update ethers@6
fix: bigint errors fix: TS errors fix: gasLimit fetch fix: review comments fix: contracts errors chore: bump rc version fix: revert wrong fix fix: ts config fix: ts config fix: ts config feat: update signer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Exchange } from '@orionprotocol/contracts/lib/ethers-v5/index.js';
|
||||
import { ERC20__factory } from '@orionprotocol/contracts/lib/ethers-v5/index.js';
|
||||
import type { Exchange } from '@orionprotocol/contracts/lib/ethers-v6';
|
||||
import { ERC20__factory } from '@orionprotocol/contracts/lib/ethers-v6';
|
||||
import type { BigNumber } from 'bignumber.js';
|
||||
import { ethers } from 'ethers';
|
||||
import { INTERNAL_PROTOCOL_PRECISION, NATIVE_CURRENCY_PRECISION } from '../constants/index.js';
|
||||
@@ -12,11 +12,11 @@ export default async function getBalance(
|
||||
assetAddress: string,
|
||||
walletAddress: string,
|
||||
exchangeContract: Exchange,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: ethers.Provider,
|
||||
) {
|
||||
const assetIsNativeCryptocurrency = assetAddress === ethers.constants.AddressZero;
|
||||
const assetIsNativeCryptocurrency = assetAddress === ethers.ZeroAddress;
|
||||
|
||||
let assetWalletBalance: ethers.BigNumber | undefined;
|
||||
let assetWalletBalance: bigint | undefined;
|
||||
|
||||
let denormalizedAssetInWalletBalance: BigNumber | undefined;
|
||||
|
||||
@@ -28,10 +28,10 @@ export default async function getBalance(
|
||||
denormalizedAssetInWalletBalance = denormalizeNumber(assetWalletBalance, assetDecimals);
|
||||
} else {
|
||||
assetWalletBalance = await provider.getBalance(walletAddress);
|
||||
denormalizedAssetInWalletBalance = denormalizeNumber(assetWalletBalance, NATIVE_CURRENCY_PRECISION);
|
||||
denormalizedAssetInWalletBalance = denormalizeNumber(assetWalletBalance, BigInt(NATIVE_CURRENCY_PRECISION));
|
||||
}
|
||||
const assetContractBalance = await exchangeContract.getBalance(assetAddress, walletAddress);
|
||||
const denormalizedAssetInContractBalance = denormalizeNumber(assetContractBalance, INTERNAL_PROTOCOL_PRECISION);
|
||||
const denormalizedAssetInContractBalance = denormalizeNumber(assetContractBalance, BigInt(INTERNAL_PROTOCOL_PRECISION));
|
||||
const denormalizedAssetLockedBalanceResult = await aggregator.getLockedBalance(walletAddress, assetName);
|
||||
if (denormalizedAssetLockedBalanceResult.isErr()) {
|
||||
throw new Error(denormalizedAssetLockedBalanceResult.error.message);
|
||||
|
||||
Reference in New Issue
Block a user