uniswap-v2-loader 5.0.3 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test.yml +17 -1
- package/README.md +8 -8
- package/index.js +1 -1
- package/index.mjs +3 -0
- package/loader.js +3 -3
- package/package.json +10 -2
- package/test-esm.mjs +18 -0
|
@@ -24,5 +24,21 @@ jobs:
|
|
|
24
24
|
- name: Global install package CLI version
|
|
25
25
|
run: npm i -g .
|
|
26
26
|
|
|
27
|
-
- name: Load first 4 pairs from Uniswap V2 using 2 workers
|
|
27
|
+
- name: CLI Load first 4 pairs from Uniswap V2 using 2 workers
|
|
28
28
|
run: uniswap-v2-loader --to=4 --multicall_size=2 --workers=2
|
|
29
|
+
|
|
30
|
+
- name: Run ESM tests
|
|
31
|
+
run: npm run test-esm
|
|
32
|
+
|
|
33
|
+
- name: Run tests with coverage
|
|
34
|
+
run: |
|
|
35
|
+
node --experimental-test-coverage \
|
|
36
|
+
--test-reporter=spec --test-reporter-destination=stdout \
|
|
37
|
+
--test-reporter=lcov --test-reporter-destination=lcov.info \
|
|
38
|
+
test.js
|
|
39
|
+
|
|
40
|
+
- name: Upload to Coveralls
|
|
41
|
+
uses: coverallsapp/github-action@v2
|
|
42
|
+
with:
|
|
43
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
44
|
+
file: lcov.info
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/uniswap-v2-loader@5.0.1/logo-dark.svg"><img alt="calp.pro icon" src="https://cdn.jsdelivr.net/npm/uniswap-v2-loader@5.0.1/logo-light.svg" height="32" align="absmiddle"></picture> uniswap-v2-loader
|
|
1
|
+
# <picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/uniswap-v2-loader@5.0.1/logo-dark.svg"><img alt="calp.pro icon" src="https://cdn.jsdelivr.net/npm/uniswap-v2-loader@5.0.1/logo-light.svg" height="32" align="absmiddle"></picture> uniswap-v2-loader [](https://coveralls.io/github/calp-pro/uniswap-v2-loader)
|
|
2
2
|
|
|
3
3
|
<br>
|
|
4
4
|
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
## Uniswap V2 based protocols
|
|
8
8
|
| Protocol | Factory Address |
|
|
9
9
|
| :--- | :--- |
|
|
10
|
-
| **Uniswap V2** | `
|
|
11
|
-
| **SushiSwap** | `
|
|
12
|
-
| **PancakeSwap** | `
|
|
13
|
-
| **ShibaSwap** | `
|
|
14
|
-
| **DefiSwap** | `
|
|
15
|
-
| **EtherVista** | `
|
|
16
|
-
| **Balancer V2** | `
|
|
10
|
+
| **Uniswap V2** | `0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f` |
|
|
11
|
+
| **SushiSwap** | `0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac` |
|
|
12
|
+
| **PancakeSwap** | `0x1097053fd2ea711dad45caccc45eff7548fcb362` |
|
|
13
|
+
| **ShibaSwap** | `0x115934131916c8b277dd010ee02de363c09d037c` |
|
|
14
|
+
| **DefiSwap** | `0x9deb29c9a4c7a88a3c0257393b7f3335338d9a9d` |
|
|
15
|
+
| **EtherVista** | `0x9a27cb5ae0b2cee0bb71f9a85c0d60f3920757b4` |
|
|
16
|
+
| **Balancer V2** | `0xba12222222228d8ba445958a75a0704d566bf2c8` |
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
## CLI
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const path = require('path')
|
|
|
5
5
|
const default_cache_filename = require('./default_cache_filename')
|
|
6
6
|
const max_workers = os.cpus().length - 1
|
|
7
7
|
const debug_key = process.env.KEY || 'FZBvlPrOxtgaKBBkry3SH0W1IqH4Y5tu'
|
|
8
|
-
const uniswap_v2_factory = '
|
|
8
|
+
const uniswap_v2_factory = '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f'
|
|
9
9
|
|
|
10
10
|
const load = (params = {}) => {
|
|
11
11
|
var {
|
package/index.mjs
ADDED
package/loader.js
CHANGED
|
@@ -15,7 +15,7 @@ const get_pairs_addresses = (key, factory, ids) => ids.length == 0
|
|
|
15
15
|
const failed_ids = []
|
|
16
16
|
for (var i = 0; i < responds.length; i++)
|
|
17
17
|
responds[i].result
|
|
18
|
-
? addresses.push('0x' + responds[i].result.slice(-40))
|
|
18
|
+
? addresses.push('0x' + responds[i].result.slice(-40).toLowerCase())
|
|
19
19
|
: failed_ids.push(ids[i])
|
|
20
20
|
|
|
21
21
|
return failed_ids.length == 0
|
|
@@ -53,8 +53,8 @@ const get_tokens = (key, addresses) => addresses.length == 0
|
|
|
53
53
|
|
|
54
54
|
if (token0_respond.result && token1_respond.result)
|
|
55
55
|
tokens[addresses[i]] = [
|
|
56
|
-
'0x' + token0_respond.result.slice(-40),
|
|
57
|
-
'0x' + token1_respond.result.slice(-40)
|
|
56
|
+
'0x' + token0_respond.result.slice(-40).toLowerCase(),
|
|
57
|
+
'0x' + token1_respond.result.slice(-40).toLowerCase()
|
|
58
58
|
]
|
|
59
59
|
else
|
|
60
60
|
failed_addresses.push(addresses[i])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniswap-v2-loader",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Uniswap v2 protocol loader",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"uniswap-v2",
|
|
@@ -27,9 +27,17 @@
|
|
|
27
27
|
"author": "Vladimir Spirin (spirin.vladimir@gmail.com)",
|
|
28
28
|
"type": "commonjs",
|
|
29
29
|
"main": "index.js",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"import": "./index.mjs",
|
|
33
|
+
"require": "./index.js",
|
|
34
|
+
"types": "./index.d.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
30
37
|
"types": "index.d.ts",
|
|
31
38
|
"scripts": {
|
|
32
|
-
"test": "node --test test.js"
|
|
39
|
+
"test": "node --test test.js",
|
|
40
|
+
"test-esm": "node --test test-esm.mjs"
|
|
33
41
|
},
|
|
34
42
|
"bin": {
|
|
35
43
|
"uniswap-v2-loader": "./bin/uniswap-v2-loader"
|
package/test-esm.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { load, subscribe } from './index.mjs'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import { describe, it } from 'node:test'
|
|
4
|
+
|
|
5
|
+
describe('ESM Support', () => {
|
|
6
|
+
it('should import load and subscribe', () => {
|
|
7
|
+
assert.equal(typeof load, 'function')
|
|
8
|
+
assert.equal(typeof subscribe, 'function')
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('should load first pair', () =>
|
|
12
|
+
load({ to: 1 })
|
|
13
|
+
.then(pairs => {
|
|
14
|
+
assert.equal(pairs.length, 1)
|
|
15
|
+
assert.equal(pairs[0].id, 0)
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
})
|