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

3.1.1 #105

Merged
merged 9 commits into from
Feb 21, 2024
Merged

3.1.1 #105

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
3 changes: 2 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ on:
jobs:
check-all:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'yarn'

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'yarn'
- name: Setup Pages
id: config_pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'yarn'

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Lido
Copyright (c) 2024 Lido

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
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
2 changes: 1 addition & 1 deletion packages/sdk/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Lido
Copyright (c) 2024 Lido

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 2 additions & 3 deletions packages/sdk/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ const jestConfig: JestConfigWithTsJest = {
displayName: 'LidoSDK tests',
testEnvironment: 'node',
// fix for leftover handles when running locally on macos
detectOpenHandles: true,
forceExit: true,
preset: 'ts-jest',
verbose: true,
verbose: false,
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand All @@ -24,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: 4 additions & 5 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
"access": "public",
"provenance": true
},
"scripts": {
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
Expand All @@ -150,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
1 change: 0 additions & 1 deletion playground/components/back-argument-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const BackArgumentInput = ({
onChange={(updatedType) =>
onChange({ [updatedType]: value[type] } as BackArgumentType)
}
themeOverride="light"
value={type}
>
<Option value={'blocks'}>Blocks</Option>
Expand Down
1 change: 0 additions & 1 deletion playground/components/block-argument-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const BlockArgumentInput = ({
onChange={(updatedType) =>
onChange({ [updatedType]: value[type] } as BlockArgumentType)
}
themeOverride="light"
value={type}
>
<Option value={'block'}>Block</Option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const CustomRpcInput = () => {
useEffect(() => {
const customUrl = customRpc[chainId] ?? '';
setUrl(customUrl);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [chainId]);

return (
Expand Down
1 change: 1 addition & 0 deletions playground/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @next/next/no-sync-scripts */
import Document, {
Head,
Html,
Expand Down
Loading