Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fix): hm #240

Merged
merged 1 commit into from
Oct 10, 2023
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
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