@xyo-network/xl1-protocol-sdk 1.20.2 → 1.20.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-protocol-sdk",
|
|
4
|
-
"version": "1.20.
|
|
4
|
+
"version": "1.20.4",
|
|
5
5
|
"description": "XYO Layer One SDK Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@xyo-network/payload-model": "~5.3.2",
|
|
52
52
|
"@xyo-network/wallet": "~5.3.2",
|
|
53
53
|
"@xyo-network/wallet-model": "~5.3.2",
|
|
54
|
-
"@xyo-network/xl1-protocol": "~1.20.
|
|
54
|
+
"@xyo-network/xl1-protocol": "~1.20.4",
|
|
55
55
|
"async-mutex": "~0.5.0",
|
|
56
56
|
"ethers": "^6.16.0",
|
|
57
57
|
"lru-cache": "^11.2.5"
|
|
@@ -52,17 +52,17 @@ export async function withContextCacheResponse<T extends {} | string | number |
|
|
|
52
52
|
func: () => Promise<T extends {} | string | number | bigint ? T : never>,
|
|
53
53
|
{ max = 10_000 }: withContextCacheResponseOptions = {},
|
|
54
54
|
): Promise<T> {
|
|
55
|
-
const cache = contextCache<T
|
|
55
|
+
const cache = contextCache<Promise<T>>(
|
|
56
56
|
context,
|
|
57
57
|
name,
|
|
58
|
-
() => new LruCacheMap<string, T
|
|
58
|
+
() => new LruCacheMap<string, Promise<T>>({ max }),
|
|
59
59
|
)
|
|
60
60
|
const { timeBudgetLimit = 0 } = context
|
|
61
61
|
const cacheResult = await cache.get(key)
|
|
62
62
|
if (isDefined(cacheResult)) {
|
|
63
63
|
return cacheResult
|
|
64
64
|
}
|
|
65
|
-
const result = timeBudgetLimit > 0 ?
|
|
65
|
+
const result = timeBudgetLimit > 0 ? timeBudget(name, context.logger, func, timeBudgetLimit) : func()
|
|
66
66
|
await cache.set(key, result)
|
|
67
67
|
return result
|
|
68
68
|
}
|