@ocap/resolver 1.18.155 → 1.18.157
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 +21 -15
- package/lib/token-flow.js +3 -5
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -210,10 +210,7 @@ module.exports = class OCAPResolver {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
async sendTx({ tx: txBase64 }, ctx = {}) {
|
|
213
|
-
|
|
214
|
-
txBase64,
|
|
215
|
-
request: ctx.request,
|
|
216
|
-
});
|
|
213
|
+
debug('sendTx', { txBase64, request: ctx.request });
|
|
217
214
|
|
|
218
215
|
if (process.env.CHAIN_MODE === 'readonly') {
|
|
219
216
|
throw new CustomError('FORBIDDEN', 'This chain node is running in readonly mode');
|
|
@@ -990,8 +987,14 @@ module.exports = class OCAPResolver {
|
|
|
990
987
|
}
|
|
991
988
|
}
|
|
992
989
|
|
|
993
|
-
|
|
994
|
-
|
|
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
|
+
) {
|
|
995
998
|
tx.receipts = getTxReceipts(tx, { config: this.config });
|
|
996
999
|
}
|
|
997
1000
|
|
|
@@ -1020,27 +1023,30 @@ module.exports = class OCAPResolver {
|
|
|
1020
1023
|
}
|
|
1021
1024
|
|
|
1022
1025
|
async _getAllResults(dataKey, fn, limit) {
|
|
1023
|
-
const results = [];
|
|
1024
1026
|
const pageSize = 100;
|
|
1025
|
-
|
|
1026
1027
|
const { paging, [dataKey]: firstPage } = await fn({ size: pageSize });
|
|
1027
1028
|
|
|
1028
1029
|
// Skip if total exceeds limit cause we cannot query full data
|
|
1029
1030
|
if (limit && paging.total > limit) {
|
|
1030
1031
|
throw new CustomError('EXCEED_LIMIT', `Total exceeds limit ${limit}`);
|
|
1031
1032
|
}
|
|
1032
|
-
|
|
1033
1033
|
if (paging.total < pageSize) {
|
|
1034
1034
|
return firstPage;
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
|
-
|
|
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;
|
|
1038
1041
|
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
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());
|
|
1044
1050
|
}
|
|
1045
1051
|
|
|
1046
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.157",
|
|
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.157",
|
|
26
|
+
"@arcblock/did-util": "1.18.157",
|
|
27
|
+
"@arcblock/validator": "1.18.157",
|
|
28
|
+
"@ocap/config": "1.18.157",
|
|
29
|
+
"@ocap/indexdb": "1.18.157",
|
|
30
|
+
"@ocap/mcrypto": "1.18.157",
|
|
31
|
+
"@ocap/message": "1.18.157",
|
|
32
|
+
"@ocap/state": "1.18.157",
|
|
33
|
+
"@ocap/tx-protocols": "1.18.157",
|
|
34
|
+
"@ocap/util": "1.18.157",
|
|
35
35
|
"debug": "^4.3.6",
|
|
36
36
|
"lodash": "^4.17.21"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "df2103bb05ee43fdb6b530e05ce608c574fdd5d6"
|
|
39
39
|
}
|