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

Update subgraph url #106

Merged
merged 2 commits into from
Feb 20, 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
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
jobs:
check-all:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,8 @@
"main"
]
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"engines": {
"node": ">=20"
}
}
8 changes: 8 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## SDK

### Fixed

- Mainnet subgraph ID now points to updated, L2 based subgraph

# 3.1.0

## SDK

### Added

- `viem` version up to `2.0.6`
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const jestConfig: JestConfigWithTsJest = {
// fix for leftover handles when running locally on macos
forceExit: true,
preset: 'ts-jest',
verbose: true,
verbose: false,
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand All @@ -23,7 +23,7 @@ const jestConfig: JestConfigWithTsJest = {
maxWorkers: 1,
globalSetup: '<rootDir>/tests/global-setup.cjs',
globalTeardown: '<rootDir>/tests/global-teardown.cjs',
testTimeout: 300_000,
testTimeout: 60_000,
};

export default jestConfig;
9 changes: 2 additions & 7 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@
"access": "public",
"provenance": true
},
"engines": {
"node": ">=20"
},
"scripts": {
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
"types": "tsc --noEmit",
Expand All @@ -154,14 +151,12 @@
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/fs-extra": "^11.0.1",
"@types/node-fetch": "^2.6.7",
"dotenv": "^16.3.1",
"fs-extra": "^11.1.1",
"ganache": "^7.9.1",
"ganache": "^7.9.2",
"jest": "^29.7.0",
"node-fetch": "^2.6.7",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"ts-jest": "^29.1.2",
"typescript": "5.1.6"
}
}
2 changes: 1 addition & 1 deletion packages/sdk/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const LIDO_LOCATOR_BY_CHAIN: {
export const SUBRGRAPH_ID_BY_CHAIN: {
[key in CHAINS]: string | null;
} = {
[CHAINS.Mainnet]: 'HXfMc1jPHfFQoccWd7VMv66km75FoxVHDMvsJj5vG5vf',
[CHAINS.Mainnet]: 'Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ',
[CHAINS.Goerli]: 'QmeDfGTuNbSoZ71zi3Ch4WNRbzALfiFPnJMYUFPinLiFNa',
[CHAINS.Holesky]: null,
};
Expand Down
39 changes: 28 additions & 11 deletions packages/sdk/tests/global-setup.cjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
const path = require('path');
const fetch = require('node-fetch');
const dotenv = require('dotenv');
const ganache = require('ganache');

module.exports = async function () {
if (!globalThis.fetch) {
const g = globalThis;
g.fetch = fetch.default;
g.Headers = fetch.Headers;
g.Request = fetch.Request;
g.Response = fetch.Response;
}

dotenv.config({
path: path.resolve(process.cwd(), '.env'),
});
Expand All @@ -22,12 +13,38 @@ module.exports = async function () {
const ganacheProvider = ganache.provider({
fork: { url: rpcUrl },
logging: { quiet: true },
chain: { chainId, asyncRequestProcessing: false },
chain: { chainId, asyncRequestProcessing: true },
});

console.debug('\nInitializing ganache provider...');
await ganacheProvider.initialize();
console.debug('Initialized ganache provider');
console.debug('Initialized ganache provider OK');

console.debug('Testing direct RPC provider...');
const { result } = await fetch(rpcUrl, {
method: 'POST',
body: JSON.stringify({
method: 'eth_chainId',
params: [],
}),
headers: {
'Content-Type': 'application/json',
},
}).then((response) => response.json());
if (Number(result) !== chainId) {
throw new Error(`Invalid direct RPC provider response: ${result}`);
}
console.debug('Direct RPC provider OK');

console.debug('Testing ganache fork RPC provider...');
const testRequest = await ganacheProvider.request({
method: 'eth_chainId',
params: [],
});
if (Number(testRequest) !== chainId) {
throw new Error(`Invalid ganache response: ${testRequest}`);
}
console.debug('Ganache fork RPC provider OK');

globalThis.__ganache_provider__ = ganacheProvider;
};
2 changes: 1 addition & 1 deletion packages/sdk/tests/utils/test-spending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTestsEnvs } from './fixtures/use-test-envs.js';

const { skipSpendingTests } = useTestsEnvs();

export const SPENDING_TIMEOUT = 1000 * 60 * 5;
export const SPENDING_TIMEOUT = 120_000;

// Pollute test.skip with missing fields so that it can be stand in for test
(test.skip as any).concurrent = xtest;
Expand Down
Loading
Loading