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

feat: inflation rewards | remove spot, perp, and marketing #346

Merged
merged 8 commits into from
Apr 22, 2024
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
8 changes: 4 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const config: Config = {
coverageReporters: ["json-summary", "text", "html", "lcov"],
coverageThreshold: {
global: {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
globals: {
Expand Down
149 changes: 12 additions & 137 deletions src/gql/heart-monitor/heart-monitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,9 @@ import {
defaultInflationDistribution,
GQLFeatureFlags,
defaultFeatureFlags,
defaultTwitterUser,
defaultTweet,
defaultLike,
defaultTask,
QueryMarketingArgs,
MarketingFields,
QueryMarketingMutationArgs,
GQLMarketingMutationFields,
defaultAccountLinksInfo,
defaultProxy,
GQLProxies,
defaultInflationReward,
} from ".."

const nibiruUrl = "testnet-1"
Expand Down Expand Up @@ -230,7 +222,7 @@ const testGovernance = async (
}
}

test("governance", async () => {
test.skip("governance", async () => {
await testGovernance({
govDeposits: {
limit: 1,
Expand Down Expand Up @@ -330,7 +322,10 @@ const testInflation = async (
if (resp.inflation) {
const { inflation } = resp

checkFields([inflation], ["distributions", "inflations"])
checkFields(
[inflation],
["distributions", "inflations", ...(fields?.rewards ? ["rewards"] : [])]
)
}
}

Expand All @@ -348,6 +343,7 @@ test("inflation", async () => {
{
inflations: defaultInflationInfo,
distributions: defaultInflationDistribution,
rewards: defaultInflationReward,
}
)
})
Expand Down Expand Up @@ -380,12 +376,12 @@ const testMarkPriceCandles = async (
}
}

test("markPriceCandles", async () => {
test.skip("markPriceCandles", async () => {
await testMarkPriceCandles({ limit: 1 })
await testMarkPriceCandles({}, defaultMarkPriceCandles)
})

test("markPriceCandlesSubscription undefined client", async () => {
test.skip("markPriceCandlesSubscription undefined client", async () => {
const hm = new HeartMonitor(`https://hm-graphql.${nibiruUrl}.nibiru.fi/query`)
const resp = await hm.markPriceCandlesSubscription({
where: {
Expand Down Expand Up @@ -418,7 +414,7 @@ const testMarkPriceCandlesSubscription = async (
}
}

test("markPriceCandlesSubscription", async () => {
test.skip("markPriceCandlesSubscription", async () => {
await testMarkPriceCandlesSubscription({
limit: 1,
where: {
Expand All @@ -438,127 +434,6 @@ test("markPriceCandlesSubscription", async () => {
)
})

const testMarketingMutation = async (
args: QueryMarketingMutationArgs,
fields?: GQLMarketingMutationFields
) => {
const resp = await heartMonitor.marketingMutation(args, {}, fields)
expect(resp).toHaveProperty("marketing")

if (resp.marketing) {
const { marketing } = resp

checkFields([marketing], ["updateTwitterUser", "linkAccounts"])
}
}

// Create JIT JWT for this test
test.skip("marketingMutation", async () => {
await testMarketingMutation({
updateTwitterUser: {
input: {
userId: "800528778854182912",
nibiAddress: "nibi1p6luzkxeufy29reymgjqnl5mv6a6gae07cphed",
displayName: "WildFyre",
username: "wildfyreapp",
},
},
linkAccounts: {
input: {
nibiAddress: "nibi1p6luzkxeufy29reymgjqnl5mv6a6gae07cphed",
twitterUser: {
displayName: "WildFyre",
username: "wildfyreapp",
},
},
},
})
})

const testMarketingQuery = async (
args: QueryMarketingArgs,
fields?: MarketingFields
) => {
const resp = await heartMonitor.marketingQuery(args, fields)
expect(resp).toHaveProperty("marketing")

if (resp.marketing) {
const { marketing } = resp

checkFields(
[marketing],
[
"likes",
"retweets",
"tasks",
"tweets",
"twitterUser",
"accountLinksInfo",
"lastUpdatedTimestamp",
]
)
}
}

// TODO: Re-enable
test.skip("marketingQuery", async () => {
await testMarketingQuery({
twitterUser: {
where: { id: "1516130689028087815" },
},
tweets: {
where: { userId: "1516130689028087815" },
},
likes: {
where: { userId: "1516130689028087815" },
},
accountLinksInfo: {
where: {
nibiAddress: "nibi1p6luzkxeufy29reymgjqnl5mv6a6gae07cphed",
twitterId: "800528778854182912",
},
},
})
await testMarketingQuery(
{
twitterUser: {
where: { id: "" },
},
tweets: {
where: { userId: "" },
},
likes: {
where: { userId: "" },
},
accountLinksInfo: {
where: {
nibiAddress: "",
twitterId: "",
},
},
},
{
accountLinksInfo: defaultAccountLinksInfo,
twitterUser: defaultTwitterUser,
tweets: defaultTweet,
likes: defaultLike,
tasks: defaultTask,
lastUpdatedTimestamp: "",
}
)
await testMarketingQuery(
{},
{
accountLinksInfo: defaultAccountLinksInfo,
twitterUser: defaultTwitterUser,
tweets: defaultTweet,
likes: defaultLike,
tasks: defaultTask,
lastUpdatedTimestamp: "",
}
)
})

test("oracle", async () => {
await testOracle({
oraclePrices: {
Expand Down Expand Up @@ -652,7 +527,7 @@ const testPerp = async (args: QueryPerpArgs, fields?: GQLPerpFields) => {
}
}

test("perp", async () => {
test.skip("perp", async () => {
await testPerp({
leaderboard: {
limit: 1,
Expand Down Expand Up @@ -846,7 +721,7 @@ const testPerpPositionsSubscription = async (
}
}

test("perpPositionsSubscription", async () => {
test.skip("perpPositionsSubscription", async () => {
await testPerpPositionsSubscription({
where: {
pair: "ubtc:unusd",
Expand Down
30 changes: 0 additions & 30 deletions src/gql/heart-monitor/heart-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,7 @@ import {
GQLFeatureFlags,
GqlOutFeatureFlags,
inflation,
GqlOutMarketingQuery,
MarketingFields,
QueryMarketingArgs,
marketingQuery,
marketingMutation,
GqlOutMarketingMutation,
DeepPartial,
QueryMarketingMutationArgs,
GQLMarketingMutationFields,
GQLProxies,
GqlOutProxies,
proxies,
Expand Down Expand Up @@ -156,17 +148,6 @@ export interface IHeartMonitor {
fields?: DeepPartial<InflationFields>
) => Promise<GqlOutInflation>

readonly marketingMutation: (
args: QueryMarketingMutationArgs,
headers: HeadersInit,
fields?: DeepPartial<GQLMarketingMutationFields>
) => Promise<GqlOutMarketingMutation>

readonly marketingQuery: (
args: QueryMarketingArgs,
fields?: DeepPartial<MarketingFields>
) => Promise<GqlOutMarketingQuery>

readonly markPriceCandles: (
args: GQLQueryGqlMarkPriceCandlesArgs,
fields?: DeepPartial<GQLMarkPriceCandle>
Expand Down Expand Up @@ -337,17 +318,6 @@ export class HeartMonitor implements IHeartMonitor {
fields?: DeepPartial<InflationFields>
) => inflation(args, this.gqlEndpt, fields)

marketingQuery = async (
args: QueryMarketingArgs,
fields?: DeepPartial<MarketingFields>
) => marketingQuery(args, this.gqlEndpt, fields)

marketingMutation = async (
args: QueryMarketingMutationArgs,
headers: HeadersInit,
fields?: DeepPartial<GQLMarketingMutationFields>
) => marketingMutation(args, this.gqlEndpt, headers, fields)

markPriceCandles = async (
args: GQLQueryGqlMarkPriceCandlesArgs,
fields?: DeepPartial<GQLMarkPriceCandle>
Expand Down
1 change: 0 additions & 1 deletion src/gql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

export * from "./heart-monitor/index"
export * from "./mutation/index"
export * from "./query/index"
export * from "./subscription/index"
export * from "./utils/index"
5 changes: 0 additions & 5 deletions src/gql/mutation/index.ts

This file was deleted.

94 changes: 0 additions & 94 deletions src/gql/mutation/marketing.ts

This file was deleted.

Loading
Loading