@ocap/tx-protocols 1.13.68 → 1.13.69
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.
|
@@ -82,7 +82,7 @@ runner.use(
|
|
|
82
82
|
);
|
|
83
83
|
|
|
84
84
|
// 5. verify sender & signer & owner
|
|
85
|
-
runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: '
|
|
85
|
+
runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'OK', table: 'account' })); // prettier-ignore
|
|
86
86
|
runner.use(pipes.ExtractState({ from: 'senders', to: 'signerStates', status: 'INVALID_SIGNER_STATE', table: 'account' })); // prettier-ignore
|
|
87
87
|
runner.use(pipes.ExtractState({ from: 'itx.owner', to: 'ownerState', status: 'OK', table: 'account' }));
|
|
88
88
|
runner.use(pipes.VerifyAccountMigration({ signerKey: 'signerStates', senderKey: 'senderState' }));
|
|
@@ -152,7 +152,7 @@ runner.use(
|
|
|
152
152
|
);
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
const isAlsoSigner = !!signerUpdates[
|
|
155
|
+
const isAlsoSigner = !!signerUpdates[tx.from];
|
|
156
156
|
const owner = ownerState ? ownerState.address : itx.owner;
|
|
157
157
|
|
|
158
158
|
// Factory updates
|
|
@@ -166,12 +166,12 @@ runner.use(
|
|
|
166
166
|
|
|
167
167
|
const [newSenderState, newReceiverState, assetState, newSignerStates, newFactoryState, newAssetStates] =
|
|
168
168
|
await Promise.all([
|
|
169
|
-
//
|
|
170
|
-
statedb.account.
|
|
171
|
-
senderState
|
|
172
|
-
account.
|
|
169
|
+
// update sender
|
|
170
|
+
statedb.account.updateOrCreate(
|
|
171
|
+
senderState,
|
|
172
|
+
account.updateOrCreate(
|
|
173
173
|
senderState,
|
|
174
|
-
Object.assign({ nonce: tx.nonce, pk: tx.pk }, signerUpdates[
|
|
174
|
+
Object.assign({ address: tx.from, nonce: tx.nonce, pk: tx.pk }, signerUpdates[tx.from] || {}),
|
|
175
175
|
context
|
|
176
176
|
),
|
|
177
177
|
context
|
|
@@ -192,7 +192,7 @@ runner.use(
|
|
|
192
192
|
// Update signer state
|
|
193
193
|
Promise.all(
|
|
194
194
|
signerStates
|
|
195
|
-
.filter((x) => x.address !==
|
|
195
|
+
.filter((x) => x.address !== tx.from)
|
|
196
196
|
.map((x) =>
|
|
197
197
|
statedb.account.update(x.address, account.update(x, signerUpdates[x.address], context), context)
|
|
198
198
|
)
|
|
@@ -64,9 +64,9 @@ runner.use(pipes.VerifyMultiSigV2({ signersKey: 'senders' }));
|
|
|
64
64
|
runner.use(pipes.ExtractState({ from: 'itx.address', to: 'stakeState', status: 'OK', table: 'stake' }));
|
|
65
65
|
|
|
66
66
|
// 5. verify sender & signer & receiver
|
|
67
|
-
runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: '
|
|
68
|
-
runner.use(pipes.ExtractState({ from: 'senders', to: 'signerStates', status: 'INVALID_SIGNER_STATE' }));
|
|
69
|
-
runner.use(pipes.ExtractState({ from: 'itx.receiver', to: 'receiverState', status: 'INVALID_RECEIVER_STATE' }));
|
|
67
|
+
runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'OK', table: 'account' }));
|
|
68
|
+
runner.use(pipes.ExtractState({ from: 'senders', to: 'signerStates', status: 'INVALID_SIGNER_STATE', table: 'account' })); // prettier-ignore
|
|
69
|
+
runner.use(pipes.ExtractState({ from: 'itx.receiver', to: 'receiverState', status: 'INVALID_RECEIVER_STATE' })); // can by any type
|
|
70
70
|
runner.use(pipes.VerifyAccountMigration({ signerKey: 'signerStates', senderKey: 'senderState' }));
|
|
71
71
|
|
|
72
72
|
// 6. verify token state and balance
|
|
@@ -115,15 +115,15 @@ runner.use(
|
|
|
115
115
|
stakeUpdates.assets.push(...assetsList);
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
const isAlsoSigner = !!signerUpdates[
|
|
118
|
+
const isAlsoSigner = !!signerUpdates[tx.from];
|
|
119
119
|
|
|
120
120
|
const [newSenderState, newSignerStates, newStakeState, newAssetStates] = await Promise.all([
|
|
121
121
|
// Update sender state
|
|
122
|
-
statedb.account.
|
|
123
|
-
senderState
|
|
124
|
-
account.
|
|
122
|
+
statedb.account.updateOrCreate(
|
|
123
|
+
senderState,
|
|
124
|
+
account.updateOrCreate(
|
|
125
125
|
senderState,
|
|
126
|
-
Object.assign({ nonce: tx.nonce, pk: tx.pk }, signerUpdates[
|
|
126
|
+
Object.assign({ address: tx.from, nonce: tx.nonce, pk: tx.pk }, signerUpdates[tx.from] || {}),
|
|
127
127
|
context
|
|
128
128
|
),
|
|
129
129
|
context
|
|
@@ -132,7 +132,7 @@ runner.use(
|
|
|
132
132
|
// Update signer state
|
|
133
133
|
Promise.all(
|
|
134
134
|
signerStates
|
|
135
|
-
.filter((x) => x.address !==
|
|
135
|
+
.filter((x) => x.address !== tx.from)
|
|
136
136
|
.map((x) => statedb.account.update(x.address, account.update(x, signerUpdates[x.address], context), context))
|
|
137
137
|
),
|
|
138
138
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.13.
|
|
6
|
+
"version": "1.13.69",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcblock/did": "1.13.
|
|
23
|
-
"@arcblock/did-util": "1.13.
|
|
24
|
-
"@ocap/asset": "1.13.
|
|
25
|
-
"@ocap/mcrypto": "1.13.
|
|
26
|
-
"@ocap/merkle-tree": "1.13.
|
|
27
|
-
"@ocap/message": "1.13.
|
|
28
|
-
"@ocap/state": "1.13.
|
|
29
|
-
"@ocap/tx-pipeline": "1.13.
|
|
30
|
-
"@ocap/util": "1.13.
|
|
31
|
-
"@ocap/validator": "1.13.
|
|
32
|
-
"@ocap/wallet": "1.13.
|
|
22
|
+
"@arcblock/did": "1.13.69",
|
|
23
|
+
"@arcblock/did-util": "1.13.69",
|
|
24
|
+
"@ocap/asset": "1.13.69",
|
|
25
|
+
"@ocap/mcrypto": "1.13.69",
|
|
26
|
+
"@ocap/merkle-tree": "1.13.69",
|
|
27
|
+
"@ocap/message": "1.13.69",
|
|
28
|
+
"@ocap/state": "1.13.69",
|
|
29
|
+
"@ocap/tx-pipeline": "1.13.69",
|
|
30
|
+
"@ocap/util": "1.13.69",
|
|
31
|
+
"@ocap/validator": "1.13.69",
|
|
32
|
+
"@ocap/wallet": "1.13.69",
|
|
33
33
|
"debug": "^4.3.2",
|
|
34
34
|
"empty-value": "^1.0.1",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"jest": "^27.3.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "7520d994d592dc4fe50612a665c94d7fa4d5b143"
|
|
46
46
|
}
|