@calp-pro/dex-db 1.0.2 → 1.0.3
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/dex_db.js +4 -4
- package/package.json +1 -1
package/dex_db.js
CHANGED
|
@@ -52,7 +52,7 @@ function dex_db(pairs = []) {
|
|
|
52
52
|
if (it1 == -1) {
|
|
53
53
|
it1 = T.length
|
|
54
54
|
T[it1] = token1
|
|
55
|
-
|
|
55
|
+
set(token1, it1, trie.tokens)
|
|
56
56
|
}
|
|
57
57
|
p2tt[ip] ??= []
|
|
58
58
|
p2tt[ip][0] = it0
|
|
@@ -71,15 +71,15 @@ function dex_db(pairs = []) {
|
|
|
71
71
|
|
|
72
72
|
const find_pairs_with_token = token => {
|
|
73
73
|
const it = get(token, trie.tokens)
|
|
74
|
-
if (it == -1) return
|
|
74
|
+
if (it == -1) return []
|
|
75
75
|
return t2pt[it].map(pt => P[pt[0]])
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
const find_pairs_with_tokens = (token0, token1) => {
|
|
79
79
|
const it0 = get(token0, trie.tokens)
|
|
80
|
-
if (it0 == -1) return
|
|
80
|
+
if (it0 == -1) return []
|
|
81
81
|
const it1 = get(token1, trie.tokens)
|
|
82
|
-
if (it1 == -1) return
|
|
82
|
+
if (it1 == -1) return []
|
|
83
83
|
return t2pt[it0].filter(pt => pt[1] == it1).map(pt => P[pt[0]])
|
|
84
84
|
}
|
|
85
85
|
|