@ocap/resolver 1.18.156 → 1.18.158
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/lib/index.js +20 -11
- package/lib/token-flow.js +3 -5
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -987,8 +987,14 @@ module.exports = class OCAPResolver {
|
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
-
|
|
991
|
-
|
|
990
|
+
if (
|
|
991
|
+
[
|
|
992
|
+
// https://github.com/blocklet/abt-wallet/issues/681
|
|
993
|
+
'fg:t:deposit_token',
|
|
994
|
+
'fg:t:withdraw_token',
|
|
995
|
+
'fg:t:revoke_swap',
|
|
996
|
+
].includes(typeUrl)
|
|
997
|
+
) {
|
|
992
998
|
tx.receipts = getTxReceipts(tx, { config: this.config });
|
|
993
999
|
}
|
|
994
1000
|
|
|
@@ -1017,27 +1023,30 @@ module.exports = class OCAPResolver {
|
|
|
1017
1023
|
}
|
|
1018
1024
|
|
|
1019
1025
|
async _getAllResults(dataKey, fn, limit) {
|
|
1020
|
-
const results = [];
|
|
1021
1026
|
const pageSize = 100;
|
|
1022
|
-
|
|
1023
1027
|
const { paging, [dataKey]: firstPage } = await fn({ size: pageSize });
|
|
1024
1028
|
|
|
1025
1029
|
// Skip if total exceeds limit cause we cannot query full data
|
|
1026
1030
|
if (limit && paging.total > limit) {
|
|
1027
1031
|
throw new CustomError('EXCEED_LIMIT', `Total exceeds limit ${limit}`);
|
|
1028
1032
|
}
|
|
1029
|
-
|
|
1030
1033
|
if (paging.total < pageSize) {
|
|
1031
1034
|
return firstPage;
|
|
1032
1035
|
}
|
|
1033
1036
|
|
|
1034
|
-
|
|
1037
|
+
const totalPage = Math.floor(paging.total / pageSize);
|
|
1038
|
+
const cursors = new Array(totalPage).fill(true).map((_, i) => (i + 1) * pageSize);
|
|
1039
|
+
const step = 3;
|
|
1040
|
+
let results = firstPage;
|
|
1035
1041
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1042
|
+
for (let i = 0; i < cursors.length; i += step) {
|
|
1043
|
+
const batchResults = await Promise.all(
|
|
1044
|
+
cursors.slice(i, i + step).map(async (cursor) => {
|
|
1045
|
+
const { [dataKey]: list } = await fn({ size: pageSize, cursor });
|
|
1046
|
+
return list;
|
|
1047
|
+
})
|
|
1048
|
+
);
|
|
1049
|
+
results = results.concat(batchResults.flat());
|
|
1041
1050
|
}
|
|
1042
1051
|
|
|
1043
1052
|
return results;
|
package/lib/token-flow.js
CHANGED
|
@@ -198,7 +198,7 @@ const verifyAccountRisk = async (
|
|
|
198
198
|
throw e;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
const accountState = await resolver.getAccountState({ address, traceMigration: false }, ctx);
|
|
201
|
+
const accountState = await resolver.getAccountState({ address, traceMigration: false, expandContext: false }, ctx);
|
|
202
202
|
if (!accountState) {
|
|
203
203
|
throw new CustomError('INVALID_REQUEST', `Invalid address ${address}`);
|
|
204
204
|
}
|
|
@@ -209,12 +209,10 @@ const verifyAccountRisk = async (
|
|
|
209
209
|
|
|
210
210
|
// Parse txs to get transfer amounts
|
|
211
211
|
for (const tx of transactions) {
|
|
212
|
-
// fix migrate receipts
|
|
213
|
-
await fixMigrateReceipts(tx, resolver, ctx);
|
|
214
|
-
|
|
215
212
|
// cache tx
|
|
216
213
|
if (!checkedTx.has(tx.hash)) {
|
|
217
|
-
|
|
214
|
+
await fixMigrateReceipts(tx, resolver, ctx);
|
|
215
|
+
checkedTx.set(tx.hash, getTransferList(tx, tokenAddress));
|
|
218
216
|
}
|
|
219
217
|
const { transferInList, transferOutList } = checkedTx.get(tx.hash);
|
|
220
218
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.18.
|
|
6
|
+
"version": "1.18.158",
|
|
7
7
|
"description": "GraphQL resolver built upon ocap statedb and GQL layer",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"jest": "^29.7.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@arcblock/did": "1.18.
|
|
26
|
-
"@arcblock/did-util": "1.18.
|
|
27
|
-
"@arcblock/validator": "1.18.
|
|
28
|
-
"@ocap/config": "1.18.
|
|
29
|
-
"@ocap/indexdb": "1.18.
|
|
30
|
-
"@ocap/mcrypto": "1.18.
|
|
31
|
-
"@ocap/message": "1.18.
|
|
32
|
-
"@ocap/state": "1.18.
|
|
33
|
-
"@ocap/tx-protocols": "1.18.
|
|
34
|
-
"@ocap/util": "1.18.
|
|
25
|
+
"@arcblock/did": "1.18.158",
|
|
26
|
+
"@arcblock/did-util": "1.18.158",
|
|
27
|
+
"@arcblock/validator": "1.18.158",
|
|
28
|
+
"@ocap/config": "1.18.158",
|
|
29
|
+
"@ocap/indexdb": "1.18.158",
|
|
30
|
+
"@ocap/mcrypto": "1.18.158",
|
|
31
|
+
"@ocap/message": "1.18.158",
|
|
32
|
+
"@ocap/state": "1.18.158",
|
|
33
|
+
"@ocap/tx-protocols": "1.18.158",
|
|
34
|
+
"@ocap/util": "1.18.158",
|
|
35
35
|
"debug": "^4.3.6",
|
|
36
36
|
"lodash": "^4.17.21"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "d2f482feb27fe3973849834cb6845a031bbe16fc"
|
|
39
39
|
}
|