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

Upgrade dependencies #249

Merged
merged 7 commits into from
Dec 1, 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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
compileRewardersList.mjs
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = {
extends: ["@saberhq"],
parserOptions: {
tsconfigRootDir: __dirname,
project: "tsconfig.json",
},
};
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
name: Check
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v3.0.11
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -28,6 +28,6 @@ jobs:
- run: yarn install
- run: yarn compile-rewarders-list
- name: Typecheck
run: yarn typecheck
run: yarn build
- name: Lint
run: yarn lint
7 changes: 4 additions & 3 deletions .github/workflows/refresh-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
name: Refresh Registry from chain

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Yarn Cache
uses: actions/cache@v3.0.11
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -30,6 +30,7 @@ jobs:
- run: mkdir -p data/
- run: cp -R static/* data/
- run: yarn compile-rewarders-list
- run: yarn build
- run: yarn fetch-all-rewarders
env:
NETWORK: mainnet-beta
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
data/
.tmp.*
src/config/rewarder-list.json

dist/
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"eslint.nodePath": ".yarn/sdks",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"prettier.prettierPath": ".yarn/sdks/prettier/index.js"
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs"
}
811 changes: 0 additions & 811 deletions .yarn/releases/yarn-4.0.0-rc.26.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/lib/unsupported-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/use-at-your-own-risk
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/use-at-your-own-risk your application uses
module.exports = absRequire(`eslint/use-at-your-own-risk`);
12 changes: 10 additions & 2 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"name": "eslint",
"version": "8.26.0-sdk",
"version": "8.54.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
},
"exports": {
"./package.json": "./package.json",
".": "./lib/api.js",
"./use-at-your-own-risk": "./lib/unsupported-api.js"
}
}
20 changes: 20 additions & 0 deletions .yarn/sdks/prettier/bin/prettier.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/bin/prettier.cjs
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);
6 changes: 3 additions & 3 deletions .yarn/sdks/prettier/index.js → .yarn/sdks/prettier/index.cjs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/index.js
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
7 changes: 4 additions & 3 deletions .yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "prettier",
"version": "2.7.1-sdk",
"main": "./index.js",
"type": "commonjs"
"version": "3.1.0-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}
2 changes: 2 additions & 0 deletions .yarn/sdks/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const moduleWrapper = tsserver => {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}

Expand Down
2 changes: 2 additions & 0 deletions .yarn/sdks/typescript/lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const moduleWrapper = tsserver => {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}

Expand Down
6 changes: 3 additions & 3 deletions .yarn/sdks/typescript/lib/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/typescript.js
// Setup the environment to be able to require typescript
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/lib/typescript.js your application uses
module.exports = absRequire(`typescript/lib/typescript.js`);
// Defer to the real typescript your application uses
module.exports = absRequire(`typescript`);
8 changes: 6 additions & 2 deletions .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "typescript",
"version": "4.8.4-sdk",
"version": "5.3.2-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
"type": "commonjs",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
}
}
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: pnp

yarnPath: .yarn/releases/yarn-4.0.0-rc.26.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
File renamed without changes.
23 changes: 23 additions & 0 deletions compileRewardersList.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as fs from "fs/promises";
import * as toml from "toml";

import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const main = async () => {
const raw = await fs.readFile(`${__dirname}/Rewarders.toml`);
const data = toml.parse(raw.toString());
await fs.mkdir(`${__dirname}/src/config`, { recursive: true });
await fs.writeFile(
`${__dirname}/src/config/rewarder-list.json`,
JSON.stringify(data, null, 2),
);
};

main().catch((err) => {
console.error(err);
process.exit(1);
});
59 changes: 29 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,49 @@
"repository": "[email protected]:quarryprotocol/rewarder-list.git",
"author": "Larry Jarry <[email protected]>",
"license": "AGPL-3.0",
"packageManager": "[email protected].0-rc.26",
"packageManager": "[email protected].2",
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
"@saberhq/eslint-config": "^2.1.0",
"@saberhq/tsconfig": "^2.1.0",
"@types/bn.js": "^5.1.1",
"@types/eslint": "^8.4.8",
"@types/lodash": "^4.14.186",
"@types/node": "^18.11.7",
"@types/prettier": "^2.7.1",
"eslint": "^8.26.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-plugin-import": "^2.26.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"@rushstack/eslint-patch": "^1.6.0",
"@saberhq/eslint-config": "^3.2.0",
"@saberhq/tsconfig": "^3.2.0",
"@types/bn.js": "^5.1.5",
"@types/eslint": "^8.44.8",
"@types/lodash": "^4.14.202",
"@types/node": "^17.0.45",
"@types/prettier": "^3.0.0",
"eslint": "^8.54.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-plugin-import": "^2.29.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
"typescript": "^5.3.2"
},
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@project-serum/anchor": "^0.23.0",
"@quarryprotocol/quarry-sdk": "^5.3.0",
"@saberhq/anchor-contrib": "^1.14.9",
"@saberhq/solana-contrib": "^1.14.9",
"@saberhq/token-utils": "^1.14.9",
"@solana/web3.js": "^1.66.2",
"axios": "^0.27.2",
"@saberhq/anchor-contrib": "^1.15.0",
"@saberhq/solana-contrib": "^1.15.0",
"@saberhq/token-utils": "^1.15.0",
"@solana/web3.js": "^1.87.6",
"axios": "^1.6.2",
"bn.js": "^5.2.1",
"fast-json-stable-stringify": "^2.1.0",
"jsbi": "^4.3.0",
"lodash": "^4.17.21",
"superstruct": "^0.16.6",
"tiny-invariant": "^1.3.1",
"toml": "^3.0.0",
"tslib": "^2.4.0"
"tslib": "^2.6.2"
},
"scripts": {
"typecheck": "tsc",
"build": "tsc",
"lint": "eslint . --cache",
"compile-rewarders-list": "ts-node src/scripts/compileRewardersList.ts",
"build-token-list": "ts-node src/scripts/buildTokenList.ts",
"build-tvl-list": "ts-node src/scripts/buildTVLList.ts",
"fetch-all-rewarders": "ts-node src/scripts/fetchAllRewarders.ts",
"decorate-rewarders": "ts-node src/scripts/decorateRewarders.ts",
"compile-rewarders-list": "node compileRewardersList.mjs",
"build-token-list": "node dist/scripts/buildTokenList.js",
"build-tvl-list": "node dist/scripts/buildTVLList.js",
"fetch-all-rewarders": "node dist/scripts/fetchAllRewarders.js",
"decorate-rewarders": "node dist/scripts/decorateRewarders.js",
"prepare": "husky install"
},
"lint-staged": {
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/tokenList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { TokenInfo, TokenList } from "@saberhq/token-utils";
import { networkToChainId } from "@saberhq/token-utils";
import axios from "axios";

import { TOKEN_LIST_URLS } from "../constants";
import { TOKEN_LIST_URLS } from "../constants.js";

export const fetchAllTokenLists = async () => {
return await Promise.all(
Expand All @@ -15,12 +15,12 @@ export const fetchAllTokenLists = async () => {
console.error(`Error fetching ${url}`, e);
throw e;
}
})
}),
);
};

export const fetchAllTokens = async (
network: Network
network: Network,
): Promise<{
tokens: Record<string, TokenInfo>;
tokenLists: readonly TokenList[];
Expand All @@ -32,7 +32,7 @@ export const fetchAllTokens = async (
.forEach((token) => {
if (
!tokens[token.address] &&
token.chainId === networkToChainId(network)
token.chainId === (networkToChainId(network) as number)
) {
tokens[token.address] = token;
}
Expand Down
16 changes: 8 additions & 8 deletions src/scripts/buildTVLList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import type { TokenList } from "@saberhq/token-utils";
import * as fs from "fs/promises";
import { groupBy, mapValues } from "lodash";

import type { RewarderMeta } from "../types";
import { stringify } from "../utils";
import type { RewarderMeta } from "../types.js";
import { stringify } from "../utils.js";

export const buildTVLList = async (network: Network): Promise<void> => {
const dir = `${__dirname}/../../data/${network}/`;
await fs.mkdir(dir, { recursive: true });

const rewarderMetas = JSON.parse(
(await fs.readFile(`${dir}/all-rewarders.json`)).toString()
(await fs.readFile(`${dir}/all-rewarders.json`)).toString(),
) as Record<string, RewarderMeta>;

const quarriesByStakedMint = mapValues(
Expand All @@ -20,15 +20,15 @@ export const buildTVLList = async (network: Network): Promise<void> => {
rew.quarries.map((q) => ({
address: q.stakedToken.mint,
quarry: q.quarry,
}))
})),
),
(q) => q.address
(q) => q.address,
),
(v) => v.map((q) => q.quarry)
(v) => v.map((q) => q.quarry),
);

const tokenList = JSON.parse(
(await fs.readFile(`${dir}/token-list.json`)).toString()
(await fs.readFile(`${dir}/token-list.json`)).toString(),
) as TokenList;

const coingeckoIDs = Object.keys(quarriesByStakedMint).reduce(
Expand All @@ -40,7 +40,7 @@ export const buildTVLList = async (network: Network): Promise<void> => {
}
return acc;
},
{}
{},
);

const tvl = { quarriesByStakedMint, coingeckoIDs };
Expand Down
Loading
Loading