@talismn/balances 0.0.0-pr967-20230725031503 → 0.0.0-pr971-20230727204438

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/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @talismn/balances
2
2
 
3
- ## 0.0.0-pr967-20230725031503
3
+ ## 0.0.0-pr971-20230727204438
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - f6ebf976: docs: added @talismn/balances readme
7
+ - a916db00: docs: added @talismn/balances readme
8
8
 
9
9
  ## 0.6.0
10
10
 
@@ -69,7 +69,7 @@ const db = new TalismanBalancesDatabase();
69
69
 
70
70
  var packageJson = {
71
71
  name: "@talismn/balances",
72
- version: "0.0.0-pr967-20230725031503",
72
+ version: "0.0.0-pr971-20230727204438",
73
73
  author: "Talisman",
74
74
  homepage: "https://talisman.xyz",
75
75
  license: "GPL-3.0-or-later",
@@ -150,9 +150,8 @@ async function balances(balanceModule, addressesByToken, callback) {
150
150
  const createTypeRegistryCache = () => {
151
151
  const typeRegistryCache = new Map();
152
152
  const getOrCreateTypeRegistry = (chainId, metadataRpc) => {
153
- // TODO: Delete cache when metadataRpc is different from last time
154
153
  const cached = typeRegistryCache.get(chainId);
155
- if (cached) return cached;
154
+ if (cached && cached.metadataRpc === metadataRpc) return cached.typeRegistry;
156
155
  const typeRegistry = new types.TypeRegistry();
157
156
  if (typeof metadataRpc === "string") {
158
157
  try {
@@ -164,7 +163,10 @@ const createTypeRegistryCache = () => {
164
163
  }), cause);
165
164
  }
166
165
  }
167
- typeRegistryCache.set(chainId, typeRegistry);
166
+ typeRegistryCache.set(chainId, {
167
+ metadataRpc,
168
+ typeRegistry
169
+ });
168
170
  return typeRegistry;
169
171
  };
170
172
  return {
@@ -69,7 +69,7 @@ const db = new TalismanBalancesDatabase();
69
69
 
70
70
  var packageJson = {
71
71
  name: "@talismn/balances",
72
- version: "0.0.0-pr967-20230725031503",
72
+ version: "0.0.0-pr971-20230727204438",
73
73
  author: "Talisman",
74
74
  homepage: "https://talisman.xyz",
75
75
  license: "GPL-3.0-or-later",
@@ -150,9 +150,8 @@ async function balances(balanceModule, addressesByToken, callback) {
150
150
  const createTypeRegistryCache = () => {
151
151
  const typeRegistryCache = new Map();
152
152
  const getOrCreateTypeRegistry = (chainId, metadataRpc) => {
153
- // TODO: Delete cache when metadataRpc is different from last time
154
153
  const cached = typeRegistryCache.get(chainId);
155
- if (cached) return cached;
154
+ if (cached && cached.metadataRpc === metadataRpc) return cached.typeRegistry;
156
155
  const typeRegistry = new types.TypeRegistry();
157
156
  if (typeof metadataRpc === "string") {
158
157
  try {
@@ -164,7 +163,10 @@ const createTypeRegistryCache = () => {
164
163
  }), cause);
165
164
  }
166
165
  }
167
- typeRegistryCache.set(chainId, typeRegistry);
166
+ typeRegistryCache.set(chainId, {
167
+ metadataRpc,
168
+ typeRegistry
169
+ });
168
170
  return typeRegistry;
169
171
  };
170
172
  return {
@@ -60,7 +60,7 @@ const db = new TalismanBalancesDatabase();
60
60
 
61
61
  var packageJson = {
62
62
  name: "@talismn/balances",
63
- version: "0.0.0-pr967-20230725031503",
63
+ version: "0.0.0-pr971-20230727204438",
64
64
  author: "Talisman",
65
65
  homepage: "https://talisman.xyz",
66
66
  license: "GPL-3.0-or-later",
@@ -141,9 +141,8 @@ async function balances(balanceModule, addressesByToken, callback) {
141
141
  const createTypeRegistryCache = () => {
142
142
  const typeRegistryCache = new Map();
143
143
  const getOrCreateTypeRegistry = (chainId, metadataRpc) => {
144
- // TODO: Delete cache when metadataRpc is different from last time
145
144
  const cached = typeRegistryCache.get(chainId);
146
- if (cached) return cached;
145
+ if (cached && cached.metadataRpc === metadataRpc) return cached.typeRegistry;
147
146
  const typeRegistry = new TypeRegistry();
148
147
  if (typeof metadataRpc === "string") {
149
148
  try {
@@ -155,7 +154,10 @@ const createTypeRegistryCache = () => {
155
154
  }), cause);
156
155
  }
157
156
  }
158
- typeRegistryCache.set(chainId, typeRegistry);
157
+ typeRegistryCache.set(chainId, {
158
+ metadataRpc,
159
+ typeRegistry
160
+ });
159
161
  return typeRegistry;
160
162
  };
161
163
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr967-20230725031503",
3
+ "version": "0.0.0-pr971-20230727204438",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",