Skip to content

Commit

Permalink
[ECO-2286] Fix the incorrect chart bar times (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
xbtmatt authored Oct 11, 2024
1 parent d46820d commit c7dd163
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/typescript/frontend/src/lib/server-env.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "server-only";
import { APTOS_NETWORK, IS_ALLOWLIST_ENABLED } from "./env";
import { Network } from "@aptos-labs/ts-sdk";
import { EMOJICOIN_INDEXER_URL } from "@sdk/server-env";
import { EMOJICOIN_INDEXER_URL } from "@sdk/server/env";

if (typeof process.env.REVALIDATION_TIME === "undefined") {
if (process.env.NODE) throw new Error("Environment variable REVALIDATION_TIME is undefined.");
Expand Down
2 changes: 1 addition & 1 deletion src/typescript/frontend/src/lib/store/event/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const handleLatestBarForSwapEvent = (
throw new Error("This should never occur. It is a type guard/hint.");
} else if (event.market.marketNonce >= data.latestBar.marketNonce) {
const price = q64ToBig(event.swap.avgExecutionPriceQ64).toNumber();
data.latestBar.time = Number(getPeriodStartTimeFromTime(event.market.time, period));
data.latestBar.time = Number(getPeriodStartTimeFromTime(event.market.time, period) / 1000n);
data.latestBar.close = price;
data.latestBar.high = Math.max(data.latestBar.high, price);
data.latestBar.low = Math.min(data.latestBar.low, price);
Expand Down
2 changes: 1 addition & 1 deletion src/typescript/sdk/src/indexer-v2/queries/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "server-only";
import { PostgrestClient } from "@supabase/postgrest-js";
import { parseJSONWithBigInts, stringifyJSONWithBigInts } from "../json-bigint";
import { type TableName } from "../types/json-types";
import { EMOJICOIN_INDEXER_URL, FETCH_DEBUG, FETCH_DEBUG_VERBOSE } from "../../server-env";
import { EMOJICOIN_INDEXER_URL, FETCH_DEBUG, FETCH_DEBUG_VERBOSE } from "../../server/env";

/**
* Fetch with BigInt support. This is necessary because the JSON returned by the indexer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "server-only";

if (typeof process.env.EMOJICOIN_INDEXER_URL === "undefined") {
throw new Error("The indexer processor url must be defined.");
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sleep } from "../../../../src";
import { getLatestProcessedEmojicoinVersion, postgrest } from "../../../../src/indexer-v2/queries";
import { TableName } from "../../../../src/indexer-v2/types/json-types";
import { EMOJICOIN_INDEXER_URL } from "../../../../src/server-env";
import { EMOJICOIN_INDEXER_URL } from "../../../../src/server/env";

const API_KEY = process.env.EMOJICOIN_INDEXER_API_KEY!;

Expand Down
2 changes: 1 addition & 1 deletion src/typescript/sdk/tests/e2e/schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EMOJICOIN_INDEXER_URL } from "../../src/server-env";
import { EMOJICOIN_INDEXER_URL } from "../../src/server/env";
import { type AnyColumnName, TableName } from "../../src/indexer-v2/types/json-types";
import {
floatColumns,
Expand Down

0 comments on commit c7dd163

Please sign in to comment.