@ocap/tx-protocols 1.30.20 → 1.30.21
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.
|
@@ -109,20 +109,21 @@ runner.use(pipes.ExtractState({
|
|
|
109
109
|
status: "INVALID_TOKEN",
|
|
110
110
|
table: "token"
|
|
111
111
|
}));
|
|
112
|
-
runner.use((context, next) => {
|
|
113
|
-
const { tx: tx$1, inputTokens = [], tokenStates = [] } = context;
|
|
114
|
-
if (inputTokens.every((tokenAddress) => {
|
|
115
|
-
const tokenState = tokenStates.find((t) => t.address === tokenAddress);
|
|
116
|
-
return tokenState && tokenState.type === "CreditToken" && tokenState.issuer === tx$1.from;
|
|
117
|
-
})) return next();
|
|
118
|
-
return pipes.VerifyMultiSigV2({ signersKey: "senders" })(context, next);
|
|
119
|
-
});
|
|
120
112
|
runner.use(pipes.ExtractState({
|
|
121
113
|
from: "tx.from",
|
|
122
114
|
to: "senderState",
|
|
123
115
|
status: "OK",
|
|
124
116
|
table: "account"
|
|
125
117
|
}));
|
|
118
|
+
runner.use((context, next) => {
|
|
119
|
+
const { tx: tx$1, senderState, inputTokens = [], tokenStates = [] } = context;
|
|
120
|
+
const senderRelated = senderState ? getRelatedAddresses(senderState) : [tx$1.from];
|
|
121
|
+
if (inputTokens.every((tokenAddress) => {
|
|
122
|
+
const tokenState = tokenStates.find((t) => t.address === tokenAddress);
|
|
123
|
+
return tokenState && tokenState.type === "CreditToken" && senderRelated.includes(tokenState.issuer);
|
|
124
|
+
})) return next();
|
|
125
|
+
return pipes.VerifyMultiSigV2({ signersKey: "senders" })(context, next);
|
|
126
|
+
});
|
|
126
127
|
runner.use(pipes.ExtractState({
|
|
127
128
|
from: "senders",
|
|
128
129
|
to: "signerStates",
|
|
@@ -113,20 +113,21 @@ runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
|
113
113
|
status: "INVALID_TOKEN",
|
|
114
114
|
table: "token"
|
|
115
115
|
}));
|
|
116
|
-
runner.use((context, next) => {
|
|
117
|
-
const { tx, inputTokens = [], tokenStates = [] } = context;
|
|
118
|
-
if (inputTokens.every((tokenAddress) => {
|
|
119
|
-
const tokenState = tokenStates.find((t) => t.address === tokenAddress);
|
|
120
|
-
return tokenState && tokenState.type === "CreditToken" && tokenState.issuer === tx.from;
|
|
121
|
-
})) return next();
|
|
122
|
-
return _ocap_tx_pipeline.pipes.VerifyMultiSigV2({ signersKey: "senders" })(context, next);
|
|
123
|
-
});
|
|
124
116
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
125
117
|
from: "tx.from",
|
|
126
118
|
to: "senderState",
|
|
127
119
|
status: "OK",
|
|
128
120
|
table: "account"
|
|
129
121
|
}));
|
|
122
|
+
runner.use((context, next) => {
|
|
123
|
+
const { tx, senderState, inputTokens = [], tokenStates = [] } = context;
|
|
124
|
+
const senderRelated = senderState ? (0, _ocap_util_lib_get_related_addr.getRelatedAddresses)(senderState) : [tx.from];
|
|
125
|
+
if (inputTokens.every((tokenAddress) => {
|
|
126
|
+
const tokenState = tokenStates.find((t) => t.address === tokenAddress);
|
|
127
|
+
return tokenState && tokenState.type === "CreditToken" && senderRelated.includes(tokenState.issuer);
|
|
128
|
+
})) return next();
|
|
129
|
+
return _ocap_tx_pipeline.pipes.VerifyMultiSigV2({ signersKey: "senders" })(context, next);
|
|
130
|
+
});
|
|
130
131
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
131
132
|
from: "senders",
|
|
132
133
|
to: "signerStates",
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.30.
|
|
6
|
+
"version": "1.30.21",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -46,22 +46,22 @@
|
|
|
46
46
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@arcblock/did": "1.30.
|
|
50
|
-
"@arcblock/did-util": "1.30.
|
|
51
|
-
"@arcblock/jwt": "1.30.
|
|
52
|
-
"@arcblock/validator": "1.30.
|
|
53
|
-
"@arcblock/vc": "1.30.
|
|
49
|
+
"@arcblock/did": "1.30.21",
|
|
50
|
+
"@arcblock/did-util": "1.30.21",
|
|
51
|
+
"@arcblock/jwt": "1.30.21",
|
|
52
|
+
"@arcblock/validator": "1.30.21",
|
|
53
|
+
"@arcblock/vc": "1.30.21",
|
|
54
54
|
"@blocklet/xss": "^0.3.7",
|
|
55
|
-
"@ocap/asset": "1.30.
|
|
56
|
-
"@ocap/client": "1.30.
|
|
57
|
-
"@ocap/mcrypto": "1.30.
|
|
58
|
-
"@ocap/merkle-tree": "1.30.
|
|
59
|
-
"@ocap/message": "1.30.
|
|
60
|
-
"@ocap/state": "1.30.
|
|
61
|
-
"@ocap/tx-pipeline": "1.30.
|
|
62
|
-
"@ocap/types": "1.30.
|
|
63
|
-
"@ocap/util": "1.30.
|
|
64
|
-
"@ocap/wallet": "1.30.
|
|
55
|
+
"@ocap/asset": "1.30.21",
|
|
56
|
+
"@ocap/client": "1.30.21",
|
|
57
|
+
"@ocap/mcrypto": "1.30.21",
|
|
58
|
+
"@ocap/merkle-tree": "1.30.21",
|
|
59
|
+
"@ocap/message": "1.30.21",
|
|
60
|
+
"@ocap/state": "1.30.21",
|
|
61
|
+
"@ocap/tx-pipeline": "1.30.21",
|
|
62
|
+
"@ocap/types": "1.30.21",
|
|
63
|
+
"@ocap/util": "1.30.21",
|
|
64
|
+
"@ocap/wallet": "1.30.21",
|
|
65
65
|
"debug": "^4.4.3",
|
|
66
66
|
"deep-diff": "^1.0.2",
|
|
67
67
|
"lodash": "^4.17.23",
|