Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/comps/src/utils/fetcher-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export const fetchContractData = async (config: MarketFactory, provider: Web3Pro
);

if (isDataTooOld(timestamp.toNumber())) {
console.error("node returned data too old", provider.connection.url);
console.error(
"node returned data too old",
"timestamp",
new Date(timestamp.toNumber() * 1000).toString(),
provider.connection.url
);
throw new Error("contract data too old");
}

Expand Down
7 changes: 6 additions & 1 deletion packages/comps/src/utils/fetcher-grouped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export const fetchContractData = async (config: MarketFactory, provider: Web3Pro
);

if (isDataTooOld(timestamp.toNumber())) {
console.error("node returned data too old", provider.connection.url);
console.error(
"node returned data too old",
"timestamp",
new Date(timestamp.toNumber() * 1000).toString(),
provider.connection.url
);
throw new Error("contract data too old");
}

Expand Down
7 changes: 6 additions & 1 deletion packages/comps/src/utils/fetcher-sport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export const fetchContractData = async (config: MarketFactory, provider: Web3Pro
);

if (isDataTooOld(timestamp.toNumber())) {
console.error("node returned data too old", provider.connection.url);
console.error(
"node returned data too old",
"timestamp",
new Date(timestamp.toNumber() * 1000).toString(),
provider.connection.url
);
throw new Error("contract data too old");
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sport/src/modules/market/market-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const MarketView = ({ defaultMarket = null }) => {
<SportsCardOutcomes {...{ ...market }} />
);

const details = getResolutionRules(market.sportsMarketType);
const details = getResolutionRules(market);
const { startTimestamp, winner, description: marketDescription } = market;
const { description } = marketEvent || { description: marketDescription };
const winningOutcome = market.amm?.ammOutcomes?.find((o) => o.id === winner);
Expand Down
4 changes: 2 additions & 2 deletions packages/sport/src/modules/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const getBuyAmount = (amm: AmmExchange, id: number, amount: string): BuyA

export const estimatedCashOut = (amm: AmmExchange, size: string, outcomeId: number): string => {
if (!amm?.hasLiquidity || !size || outcomeId === undefined) return null;
const est = estimateSellTrade(amm, size, outcomeId, []);
const est = estimateSellTrade(amm, size, outcomeId, { outcomeSharesRaw: [] });
// can sell all position or none
return est.maxSellAmount !== "0" ? null : String(est.outputValue);
};
Expand All @@ -61,7 +61,7 @@ const makeCashOut = async (
const { cash } = amm;
const shareAmount = bet.size;
const defaultSlippage = "1";
const est = estimateSellTrade(amm, shareAmount, bet.outcomeId, []);
const est = estimateSellTrade(amm, shareAmount, bet.outcomeId, { outcomeSharesRaw: [] });
// can sell all position or none
if (est.maxSellAmount !== "0") return null;
const response = await doTrade(
Expand Down