@ocap/resolver 1.28.6 → 1.28.7
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/README.md +1 -1
- package/lib/hooks.js +3 -4
- package/lib/index.js +3 -8
- package/lib/migration-chain.js +0 -1
- package/lib/token-distribution.js +0 -3
- package/lib/token-flow.js +0 -4
- package/package.json +24 -25
- package/LICENSE +0 -13
package/README.md
CHANGED
package/lib/hooks.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
1
|
// Purpose of these hooks: update indexdb to speed up subsequent queries
|
|
3
2
|
// RULE: do not try to update statedb in these hooks
|
|
4
3
|
|
|
@@ -9,7 +8,7 @@ const { toStakeAddress } = require('@arcblock/did-util');
|
|
|
9
8
|
|
|
10
9
|
const debug = require('debug')(require('../package.json').name);
|
|
11
10
|
|
|
12
|
-
const onCreateRollup = (rollup,
|
|
11
|
+
const onCreateRollup = (rollup, _ctx, indexdb) => {
|
|
13
12
|
rollup.seedValidators.forEach(async (x) => {
|
|
14
13
|
const { pk, address, endpoint } = x;
|
|
15
14
|
try {
|
|
@@ -287,7 +286,7 @@ const onClaimStake = async (tx, ctx, indexdb) => {
|
|
|
287
286
|
}
|
|
288
287
|
};
|
|
289
288
|
|
|
290
|
-
const onAccountMigrate = async (
|
|
289
|
+
const onAccountMigrate = async (_tx, resolver) => {
|
|
291
290
|
try {
|
|
292
291
|
await resolver.buildMigrationChain();
|
|
293
292
|
} catch (e) {
|
|
@@ -295,7 +294,7 @@ const onAccountMigrate = async (tx, resolver) => {
|
|
|
295
294
|
}
|
|
296
295
|
};
|
|
297
296
|
|
|
298
|
-
const onUpdateToken = (tokenDoc,
|
|
297
|
+
const onUpdateToken = (tokenDoc, _ctx, _indexdb, resolver) => {
|
|
299
298
|
if (resolver.tokenCache) {
|
|
300
299
|
resolver.tokenCache.set(tokenDoc.address, tokenDoc);
|
|
301
300
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-loop-func */
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
|
-
/* eslint-disable newline-per-chained-call */
|
|
4
1
|
const get = require('lodash/get');
|
|
5
2
|
const set = require('lodash/set');
|
|
6
3
|
const uniq = require('lodash/uniq');
|
|
@@ -125,14 +122,14 @@ const formatData = (data) => {
|
|
|
125
122
|
JSON.parse(data.value);
|
|
126
123
|
data.type_url = data.typeUrl;
|
|
127
124
|
return data;
|
|
128
|
-
} catch (
|
|
125
|
+
} catch (_err) {
|
|
129
126
|
// Some legacy data contains escaped back slashes
|
|
130
127
|
try {
|
|
131
128
|
JSON.parse(data.value.replace(/\\"/g, '"'));
|
|
132
129
|
data.type_url = data.typeUrl;
|
|
133
130
|
data.value = data.value.replace(/\\"/g, '"');
|
|
134
131
|
return data;
|
|
135
|
-
} catch (
|
|
132
|
+
} catch (_e) {
|
|
136
133
|
// do nothing
|
|
137
134
|
}
|
|
138
135
|
}
|
|
@@ -147,7 +144,7 @@ const formatData = (data) => {
|
|
|
147
144
|
};
|
|
148
145
|
|
|
149
146
|
const formatDelegationOps = (state) => {
|
|
150
|
-
if (state
|
|
147
|
+
if (state?.ops && typeof state.ops === 'object') {
|
|
151
148
|
state.ops = Object.keys(state.ops).map((x) => ({ key: x, value: state.ops[x] }));
|
|
152
149
|
}
|
|
153
150
|
return state;
|
|
@@ -256,7 +253,6 @@ module.exports = class OCAPResolver {
|
|
|
256
253
|
},
|
|
257
254
|
};
|
|
258
255
|
|
|
259
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
260
256
|
return new Promise((resolve, reject) => {
|
|
261
257
|
const task = async () => {
|
|
262
258
|
try {
|
|
@@ -1350,7 +1346,6 @@ module.exports = class OCAPResolver {
|
|
|
1350
1346
|
|
|
1351
1347
|
// update indexdb
|
|
1352
1348
|
const updatedTx = await this.indexdb.tx.update(tx.hash, { accounts });
|
|
1353
|
-
// eslint-disable-next-line consistent-return
|
|
1354
1349
|
return updatedTx;
|
|
1355
1350
|
})
|
|
1356
1351
|
);
|
package/lib/migration-chain.js
CHANGED
package/lib/token-flow.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
|
-
|
|
4
1
|
const { BN, fromTokenToUnit, isSameDid } = require('@ocap/util');
|
|
5
2
|
const { schemas, Joi } = require('@arcblock/validator');
|
|
6
3
|
const { CustomError } = require('@ocap/util/lib/error');
|
|
@@ -114,7 +111,6 @@ const getTransferFlow = (tx, tokenAddress) => {
|
|
|
114
111
|
});
|
|
115
112
|
inItem.archived = true;
|
|
116
113
|
outItem.archived = true;
|
|
117
|
-
continue;
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
116
|
}
|
package/package.json
CHANGED
|
@@ -3,44 +3,43 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.28.
|
|
6
|
+
"version": "1.28.7",
|
|
7
7
|
"description": "GraphQL resolver built upon ocap statedb and GQL layer",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"lib"
|
|
11
11
|
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "biome check",
|
|
14
|
+
"lint:fix": "biome check --write",
|
|
15
|
+
"test": "bun test",
|
|
16
|
+
"coverage": "npm run test -- --coverage"
|
|
17
|
+
},
|
|
12
18
|
"keywords": [],
|
|
13
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
14
20
|
"license": "MIT",
|
|
15
21
|
"devDependencies": {
|
|
16
|
-
"
|
|
17
|
-
"@
|
|
18
|
-
"@ocap/
|
|
19
|
-
"@ocap/statedb-memory": "1.28.6"
|
|
22
|
+
"@arcblock/jwt": "1.28.7",
|
|
23
|
+
"@ocap/indexdb-memory": "1.28.7",
|
|
24
|
+
"@ocap/statedb-memory": "1.28.7"
|
|
20
25
|
},
|
|
21
26
|
"dependencies": {
|
|
27
|
+
"@arcblock/did": "1.28.7",
|
|
28
|
+
"@arcblock/did-ext": "1.28.7",
|
|
29
|
+
"@arcblock/did-util": "1.28.7",
|
|
22
30
|
"@arcblock/nft-display": "^3.2.3",
|
|
31
|
+
"@arcblock/validator": "1.28.7",
|
|
32
|
+
"@ocap/config": "1.28.7",
|
|
33
|
+
"@ocap/indexdb": "1.28.7",
|
|
34
|
+
"@ocap/mcrypto": "1.28.7",
|
|
35
|
+
"@ocap/message": "1.28.7",
|
|
36
|
+
"@ocap/state": "1.28.7",
|
|
37
|
+
"@ocap/tx-protocols": "1.28.7",
|
|
38
|
+
"@ocap/util": "1.28.7",
|
|
39
|
+
"@ocap/wallet": "1.28.7",
|
|
23
40
|
"debug": "^4.3.6",
|
|
24
41
|
"express": "^4.19.2",
|
|
25
42
|
"lodash": "^4.17.21",
|
|
26
|
-
"queue": "^6"
|
|
27
|
-
"@arcblock/did": "1.28.6",
|
|
28
|
-
"@arcblock/did-ext": "1.28.6",
|
|
29
|
-
"@arcblock/did-util": "1.28.6",
|
|
30
|
-
"@arcblock/validator": "1.28.6",
|
|
31
|
-
"@ocap/config": "1.28.6",
|
|
32
|
-
"@ocap/indexdb": "1.28.6",
|
|
33
|
-
"@ocap/mcrypto": "1.28.6",
|
|
34
|
-
"@ocap/message": "1.28.6",
|
|
35
|
-
"@ocap/state": "1.28.6",
|
|
36
|
-
"@ocap/tx-protocols": "1.28.6",
|
|
37
|
-
"@ocap/util": "1.28.6",
|
|
38
|
-
"@ocap/wallet": "1.28.6"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"lint": "eslint tests lib",
|
|
42
|
-
"lint:fix": "eslint --fix tests lib",
|
|
43
|
-
"test": "jest --forceExit --detectOpenHandles",
|
|
44
|
-
"coverage": "npm run test -- --coverage"
|
|
43
|
+
"queue": "^6"
|
|
45
44
|
}
|
|
46
|
-
}
|
|
45
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Copyright 2018-2025 ArcBlock
|
|
2
|
-
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
See the License for the specific language governing permissions and
|
|
13
|
-
limitations under the License.
|