diff --git a/src/helpers/config.ts b/src/helpers/config.ts
index bc42899..2a4c263 100644
--- a/src/helpers/config.ts
+++ b/src/helpers/config.ts
@@ -52,8 +52,7 @@ import { SelectOptionType, WalletEnum } from './types';
export const AO = {
module: 'Pq2Zftrqut0hdisH_MC2pDOT6S4eQFoxGsFUzR6r350',
scheduler: '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA',
- ucm: 'U3TjJAZWJjlWBB4KAXSHKzuky81jtyh0zqH8rUL4Wd0', // Prod
- // ucm: 'fToLfaxMZzjmPIiJd7cNlRlzryhSMnU04SELFyJ06j4', // Test
+ ucm: 'U3TjJAZWJjlWBB4KAXSHKzuky81jtyh0zqH8rUL4Wd0',
defaultToken: 'xU9zFkq3X2ZQ6olwNVvr1vUWIjc3kXTWr7xKQD6dh10',
pixl: 'DM3FoZUq_yebASPhgd8pEIRIzDW6muXEhxz5-JwbZwo',
collectionsRegistry: 'TFWDmf8a3_nw43GCm_CuYlYoylHAjCcFGbgHfDaGcsg',
diff --git a/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx b/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx
index 73cea3c..ca240cc 100644
--- a/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx
+++ b/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx
@@ -162,7 +162,7 @@ export default function AssetActionMarketOrders(props: IProps) {
} else {
let orderAmount = getTotalOrderAmount();
if (denomination) {
- orderAmount = orderAmount / denomination;
+ orderAmount = BigInt(orderAmount) / BigInt(denomination);
}
setInsufficientBalance(Number(getTotalTokenBalance(arProvider.tokenBalances[AO.defaultToken])) < orderAmount);
}
@@ -208,16 +208,16 @@ export default function AssetActionMarketOrders(props: IProps) {
let transferQuantity: string | number = currentOrderQuantity;
switch (props.type) {
- case 'sell':
- case 'transfer':
+ case 'buy':
+ transferQuantity = getTotalOrderAmount().toString();
if (denomination) {
- transferQuantity = Number(currentOrderQuantity) * denomination;
+ transferQuantity = (BigInt(transferQuantity) / BigInt(denomination)).toString();
}
break;
- case 'buy':
- transferQuantity = getTotalOrderAmount();
+ case 'sell':
+ case 'transfer':
if (denomination) {
- transferQuantity = transferQuantity / denomination;
+ transferQuantity = Number(currentOrderQuantity) * denomination;
}
break;
}
@@ -446,28 +446,33 @@ export default function AssetActionMarketOrders(props: IProps) {
(a: AssetOrderType, b: AssetOrderType) => Number(a.price) - Number(b.price)
);
- let totalQuantity = 0;
- let totalPrice = 0;
+ let totalQuantity: bigint = BigInt(0);
+ let totalPrice: bigint = BigInt(0);
for (let i = 0; i < sortedOrders.length; i++) {
- const quantity = Number(sortedOrders[i].quantity);
- const price = Number(sortedOrders[i].price);
+ const quantity = BigInt(sortedOrders[i].quantity);
+ const price = BigInt(sortedOrders[i].price);
- let inputQuantity = Number(currentOrderQuantity);
- if (denomination) inputQuantity = Number(currentOrderQuantity) * denomination;
+ let inputQuantity;
+ try {
+ inputQuantity = BigInt(currentOrderQuantity);
+ if (denomination) inputQuantity = BigInt(currentOrderQuantity) * BigInt(denomination);
- if (quantity >= inputQuantity - totalQuantity) {
- const remainingQty = inputQuantity - totalQuantity;
+ if (quantity >= inputQuantity - totalQuantity) {
+ const remainingQty = inputQuantity - totalQuantity;
- totalQuantity += remainingQty;
- totalPrice += remainingQty * price;
- break;
- } else {
- totalQuantity += quantity;
- totalPrice += quantity * price;
+ totalQuantity += remainingQty;
+ totalPrice += remainingQty * price;
+ break;
+ } else {
+ totalQuantity += quantity;
+ totalPrice += quantity * price;
+ }
+ } catch (e: any) {
+ console.error(e);
+ inputQuantity = BigInt(0);
}
}
-
return totalPrice;
} else return 0;
} else {
@@ -575,10 +580,10 @@ export default function AssetActionMarketOrders(props: IProps) {
function getTotalPriceDisplay() {
let amount = getTotalOrderAmount();
- if (props.type === 'buy' && denomination) amount = amount / denomination;
+ if (props.type === 'buy' && denomination) amount = BigInt(amount) / BigInt(denomination);
const orderCurrency =
props.asset.orders && props.asset.orders.length ? props.asset.orders[0].currency : AO.defaultToken;
- return ;
+ return ;
}
function getOrderDetails() {