Skip to content

Commit

Permalink
fix(fix): hm (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilbe27 authored Oct 10, 2023
1 parent 4bc4fb2 commit 4a31757
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/indexer-nibi/src/batchHandlers/queryBatchHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { doGqlQuery } from "../gql"

export const queryBatchHandler = async (
queryQueryString: string[],
queryQueryStrings: string[],
endpt: string
) => doGqlQuery(`{ ${queryQueryString.join("\n")} }`, endpt)
) => doGqlQuery(`{ ${queryQueryStrings.join("\n")} }`, endpt)
14 changes: 9 additions & 5 deletions packages/indexer-nibi/src/heart-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export interface IHeartMonitor {
AsyncIterableIterator<ExecutionResult<GqlOutPerpPositions>> | undefined
>

readonly queryBatchHandler: (queryQueryString: string[]) => Promise<any>
readonly queryBatchHandler: (queryQueryStrings: string[]) => Promise<any>

readonly redelegations: (
args: QueryRedelegationsArgs,
Expand Down Expand Up @@ -227,7 +227,11 @@ export class HeartMonitor implements IHeartMonitor {
defaultGqlEndpt = "https://hm-graphql.devnet-2.nibiru.fi/query"
subscriptionClient: Client | undefined

constructor(gqlEndpt?: string | { endptTm: string }, webSocketUrl?: string) {
constructor(
gqlEndpt?: string | { endptTm: string },
webSocketUrl?: string,
webSocketImpl?: WebSocket
) {
const chain = gqlEndpt as { endptTm: string }
if (!gqlEndpt) {
this.gqlEndpt = this.defaultGqlEndpt
Expand All @@ -243,7 +247,7 @@ export class HeartMonitor implements IHeartMonitor {
if (webSocketUrl) {
this.subscriptionClient = createClient({
url: webSocketUrl,
...(WebSocket ? { webSocketImpl: WebSocket } : {}),
webSocketImpl: webSocketImpl ?? WebSocket,
})
}
}
Expand Down Expand Up @@ -299,8 +303,8 @@ export class HeartMonitor implements IHeartMonitor {
fields?: Partial<PerpPosition>
) => perpPositionsSubscription(args, this.subscriptionClient, fields)

queryBatchHandler = async (queryQueryString: string[]) =>
queryBatchHandler(queryQueryString, this.gqlEndpt)
queryBatchHandler = async (queryQueryStrings: string[]) =>
queryBatchHandler(queryQueryStrings, this.gqlEndpt)

redelegations = async (
args: QueryRedelegationsArgs,
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-nibi/src/query/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export const statsQueryString = (
statsQuery.push(
gqlQuery(
"volume",
args?.volume ?? {},
args.volume ?? {},
convertObjectToPropertiesString(defaultVolume),
true
)
Expand Down
2 changes: 1 addition & 1 deletion packages/nibijs/docs/classes/StableSwap.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ y()
Calculate x[j] if one makes x[i] = x

Done by solving quadratic equation iteratively.
x*1**2 + x1 * (sum' - (A*n**n - 1) * D / (A _ n**n)) = D ** (n+1)/(n \*\* (2 _ n) \_ prod' \* A)
x*1\*\*2 + x1 * (sum' - (A*n\*\*n - 1) * D / (A _ n**n)) = D ** (n+1)/(n \*\* (2 _ n) \_ prod' \* A)
x_1\*\*2 + b\*x_1 = c

x_1 = (x_1\**2 + c) / (2*x_1 + b)
Expand Down

0 comments on commit 4a31757

Please sign in to comment.