@ocap/resolver 1.18.99 → 1.18.101
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 +31 -1
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -466,7 +466,20 @@ module.exports = class OCAPResolver {
|
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
getDelegateState({ address }, ctx) {
|
|
469
|
-
return this._getState({
|
|
469
|
+
return this._getState({
|
|
470
|
+
table: 'delegation',
|
|
471
|
+
id: address,
|
|
472
|
+
dataKey: 'data',
|
|
473
|
+
onRead: async (state) => {
|
|
474
|
+
if (state) {
|
|
475
|
+
formatDelegationOps(state);
|
|
476
|
+
await this.formatDelegateState(state);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return state;
|
|
480
|
+
},
|
|
481
|
+
ctx,
|
|
482
|
+
});
|
|
470
483
|
}
|
|
471
484
|
|
|
472
485
|
async getAccountTokens({ address, token }, ctx) {
|
|
@@ -897,6 +910,9 @@ module.exports = class OCAPResolver {
|
|
|
897
910
|
if (listKey === 'transactions') {
|
|
898
911
|
tx = await this.formatTx(tx, ctx);
|
|
899
912
|
}
|
|
913
|
+
if (listKey === 'delegations') {
|
|
914
|
+
tx = await this.formatDelegateState(tx);
|
|
915
|
+
}
|
|
900
916
|
|
|
901
917
|
return tx;
|
|
902
918
|
})
|
|
@@ -1057,6 +1073,20 @@ module.exports = class OCAPResolver {
|
|
|
1057
1073
|
|
|
1058
1074
|
return ctx;
|
|
1059
1075
|
}
|
|
1076
|
+
|
|
1077
|
+
async formatDelegateState(state) {
|
|
1078
|
+
if (Array.isArray(state.ops) && state.ops.length > 0) {
|
|
1079
|
+
await Promise.all(
|
|
1080
|
+
state.ops.map(async (op) => {
|
|
1081
|
+
if (op.value.limit && Array.isArray(op.value.limit.tokens)) {
|
|
1082
|
+
op.value.limit.tokens = await this.formatTokenArray(op.value.limit.tokens || []);
|
|
1083
|
+
}
|
|
1084
|
+
})
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
return state;
|
|
1089
|
+
}
|
|
1060
1090
|
};
|
|
1061
1091
|
|
|
1062
1092
|
module.exports.formatData = formatData;
|
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.101",
|
|
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": "^27.5.1"
|
|
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.101",
|
|
26
|
+
"@arcblock/did-util": "1.18.101",
|
|
27
|
+
"@arcblock/validator": "1.18.101",
|
|
28
|
+
"@ocap/config": "1.18.101",
|
|
29
|
+
"@ocap/indexdb": "1.18.101",
|
|
30
|
+
"@ocap/mcrypto": "1.18.101",
|
|
31
|
+
"@ocap/message": "1.18.101",
|
|
32
|
+
"@ocap/state": "1.18.101",
|
|
33
|
+
"@ocap/tx-protocols": "1.18.101",
|
|
34
|
+
"@ocap/util": "1.18.101",
|
|
35
35
|
"debug": "^4.3.4",
|
|
36
36
|
"lodash": "^4.17.21"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "a7d110c4b5060c02f6a456d7b8984594aa69c00c"
|
|
39
39
|
}
|