@ocap/tx-pipeline 1.18.65 → 1.18.66
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.
@@ -6,9 +6,10 @@ const isEmpty = require('empty-value');
|
|
6
6
|
const { CustomError: Error } = require('@ocap/util/lib/error');
|
7
7
|
const { getListField } = require('@ocap/util/lib/get-list-field');
|
8
8
|
const { toDelegateAddress } = require('@arcblock/did-util');
|
9
|
+
const { getRelatedAddresses } = require('@ocap/util/lib/get-related-addr');
|
9
10
|
|
10
11
|
// eslint-disable-next-line global-require
|
11
|
-
const debug = require('debug')(`${require('../../package.json').name}:pipe:verify-delegation`);
|
12
|
+
// const debug = require('debug')(`${require('../../package.json').name}:pipe:verify-delegation`);
|
12
13
|
|
13
14
|
// Must be piped after `extract-state` or `extract-signer` pipe
|
14
15
|
module.exports = function CreateVerifyDelegationPipe({
|
@@ -20,11 +21,22 @@ module.exports = function CreateVerifyDelegationPipe({
|
|
20
21
|
return async function VerifyDelegation(context, next) {
|
21
22
|
const { tx, txType, statedb } = context;
|
22
23
|
|
23
|
-
const getDelegationState = (signerState, delegatorState) => {
|
24
|
+
const getDelegationState = async (signerState, delegatorState) => {
|
24
25
|
if (delegatorState) {
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
// Delegator should be interpreted as delegatee here, we should check if there are any delegation on the migration chain
|
27
|
+
const related = getRelatedAddresses(delegatorState);
|
28
|
+
const delegateStates = await Promise.all(
|
29
|
+
related.map(async (x) => {
|
30
|
+
const delegation = await statedb.delegation.get(toDelegateAddress(signerState.address, x), context);
|
31
|
+
if (delegation) {
|
32
|
+
delegation.to = x;
|
33
|
+
}
|
34
|
+
|
35
|
+
return delegation;
|
36
|
+
})
|
37
|
+
);
|
38
|
+
|
39
|
+
return delegateStates.find((x) => x);
|
28
40
|
}
|
29
41
|
|
30
42
|
return null;
|
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.66",
|
7
7
|
"description": "Pipeline runner and common pipelines to process transactions",
|
8
8
|
"main": "lib/index.js",
|
9
9
|
"files": [
|
@@ -29,16 +29,16 @@
|
|
29
29
|
"elliptic": "6.5.3"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@arcblock/did": "1.18.
|
33
|
-
"@arcblock/did-util": "1.18.
|
34
|
-
"@ocap/mcrypto": "1.18.
|
35
|
-
"@ocap/message": "1.18.
|
36
|
-
"@ocap/state": "1.18.
|
37
|
-
"@ocap/util": "1.18.
|
38
|
-
"@ocap/wallet": "1.18.
|
32
|
+
"@arcblock/did": "1.18.66",
|
33
|
+
"@arcblock/did-util": "1.18.66",
|
34
|
+
"@ocap/mcrypto": "1.18.66",
|
35
|
+
"@ocap/message": "1.18.66",
|
36
|
+
"@ocap/state": "1.18.66",
|
37
|
+
"@ocap/util": "1.18.66",
|
38
|
+
"@ocap/wallet": "1.18.66",
|
39
39
|
"debug": "^4.3.4",
|
40
40
|
"empty-value": "^1.0.1",
|
41
41
|
"lodash": "^4.17.21"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "c58f71969c58af63eb88cb9f0e0e9e92e4826617"
|
44
44
|
}
|