Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

[WIP] feat: SDK modernization, automated test cases, speed upgrades #178

Closed
wants to merge 13 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm install

- name: Run linters
uses: wearerequired/lint-action@a8497ddb33fb1205941fd40452ca9fff07e0770d
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm install

- name: Run tests
run: yarn test
run: npm run test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ jspm_packages/
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.pnp.*

#npm
package-lock.json
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

27 changes: 27 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// preset: 'ts-jest',
// testEnvironment: 'node',
preset: 'ts-jest',
testEnvironment: 'jsdom',
transform: {
// transform files with ts-jest
'^.+\\.(js|ts)$': [
'ts-jest',
{
tsconfig: {
// allow js in typescript
allowJs: true,
},
},
],
},
transformIgnorePatterns: [
// allow lit-html transformation
'node_modules/(?!lit-html)',
],
// for absolute imports
moduleNameMapper: {
'src/(.*)': '<rootDir>/src/$1',
},
}
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,32 @@
"uniswap",
"ethereum"
],
"module": "dist/v3-sdk.esm.js",
"scripts": {
"build": "tsdx build",
"start": "tsdx watch",
"test": "tsdx test",
"prepublishOnly": "tsdx build"
"build": "tsc",
"test": "jest",
"prepublishOnly": "tsc"
},
"dependencies": {
"@ethersproject/abi": "^5.0.12",
"@ethersproject/solidity": "^5.0.9",
"@uniswap/sdk-core": "^4",
"@uniswap/sdk-core": "npm:@koraykoska/uniswap-sdk-core@^3.2.6",
"@uniswap/swap-router-contracts": "^1.2.1",
"@uniswap/v3-periphery": "^1.1.1",
"@uniswap/v3-staker": "1.0.0",
"@uniswap/v3-staker": "1.0.2",
"tiny-invariant": "^1.1.0",
"tiny-warning": "^1.0.3"
},
"devDependencies": {
"@types/jest": "^24.0.25",
"@types/jest": "^24.9.1",
"@uniswap/v3-core": "1.0.0",
"tsdx": "^0.14.1"
"commander": "^11.0.0",
"ethers": "^5.7.2",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "^2.8.8",
"ts-jest": "^29.1.0",
"tslib": "^2.5.1",
"typescript": "^5.0.4"
},
"engines": {
"node": ">=10"
Expand Down
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/
222 changes: 222 additions & 0 deletions scripts/abis/erc20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
]
Loading