Skip to content

Commit 9bfadaa

Browse files
authored
fix some typing issues, get res rules showing up for sportsbook (#1421)
1 parent ee1d975 commit 9bfadaa

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

packages/comps/src/utils/fetcher-crypto.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ export const fetchContractData = async (config: MarketFactory, provider: Web3Pro
4343
);
4444

4545
if (isDataTooOld(timestamp.toNumber())) {
46-
console.error("node returned data too old", provider.connection.url);
46+
console.error(
47+
"node returned data too old",
48+
"timestamp",
49+
new Date(timestamp.toNumber() * 1000).toString(),
50+
provider.connection.url
51+
);
4752
throw new Error("contract data too old");
4853
}
4954

packages/comps/src/utils/fetcher-grouped.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ export const fetchContractData = async (config: MarketFactory, provider: Web3Pro
4545
);
4646

4747
if (isDataTooOld(timestamp.toNumber())) {
48-
console.error("node returned data too old", provider.connection.url);
48+
console.error(
49+
"node returned data too old",
50+
"timestamp",
51+
new Date(timestamp.toNumber() * 1000).toString(),
52+
provider.connection.url
53+
);
4954
throw new Error("contract data too old");
5055
}
5156

packages/comps/src/utils/fetcher-sport.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ export const fetchContractData = async (config: MarketFactory, provider: Web3Pro
4343
);
4444

4545
if (isDataTooOld(timestamp.toNumber())) {
46-
console.error("node returned data too old", provider.connection.url);
46+
console.error(
47+
"node returned data too old",
48+
"timestamp",
49+
new Date(timestamp.toNumber() * 1000).toString(),
50+
provider.connection.url
51+
);
4752
throw new Error("contract data too old");
4853
}
4954

packages/sport/src/modules/market/market-view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const MarketView = ({ defaultMarket = null }) => {
191191
<SportsCardOutcomes {...{ ...market }} />
192192
);
193193

194-
const details = getResolutionRules(market.sportsMarketType);
194+
const details = getResolutionRules(market);
195195
const { startTimestamp, winner, description: marketDescription } = market;
196196
const { description } = marketEvent || { description: marketDescription };
197197
const winningOutcome = market.amm?.ammOutcomes?.find((o) => o.id === winner);

packages/sport/src/modules/utils/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const getBuyAmount = (amm: AmmExchange, id: number, amount: string): BuyA
4646

4747
export const estimatedCashOut = (amm: AmmExchange, size: string, outcomeId: number): string => {
4848
if (!amm?.hasLiquidity || !size || outcomeId === undefined) return null;
49-
const est = estimateSellTrade(amm, size, outcomeId, []);
49+
const est = estimateSellTrade(amm, size, outcomeId, { outcomeSharesRaw: [] });
5050
// can sell all position or none
5151
return est.maxSellAmount !== "0" ? null : String(est.outputValue);
5252
};
@@ -61,7 +61,7 @@ const makeCashOut = async (
6161
const { cash } = amm;
6262
const shareAmount = bet.size;
6363
const defaultSlippage = "1";
64-
const est = estimateSellTrade(amm, shareAmount, bet.outcomeId, []);
64+
const est = estimateSellTrade(amm, shareAmount, bet.outcomeId, { outcomeSharesRaw: [] });
6565
// can sell all position or none
6666
if (est.maxSellAmount !== "0") return null;
6767
const response = await doTrade(

0 commit comments

Comments
 (0)