@leofcoin/workers 1.4.18 → 1.4.19
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/CHANGELOG.md +11 -0
- package/package.json +6 -6
- package/src/machine-worker.js +31 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @leofcoin/workers
|
|
2
2
|
|
|
3
|
+
## 1.4.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 78299bf: bump
|
|
8
|
+
- Updated dependencies [78299bf]
|
|
9
|
+
- @leofcoin/addresses@1.0.23
|
|
10
|
+
- @leofcoin/lib@1.2.43
|
|
11
|
+
- @leofcoin/messages@1.4.13
|
|
12
|
+
- @leofcoin/utils@1.1.18
|
|
13
|
+
|
|
3
14
|
## 1.4.18
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/workers",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.19",
|
|
4
4
|
"description": "Workers used in @leofcoin/chain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@leofcoin/addresses": "^1.0.
|
|
25
|
-
"@leofcoin/lib": "^1.2.
|
|
26
|
-
"@leofcoin/messages": "^1.4.
|
|
27
|
-
"@leofcoin/storage": "^3.5.
|
|
28
|
-
"@leofcoin/utils": "^1.1.
|
|
24
|
+
"@leofcoin/addresses": "^1.0.23",
|
|
25
|
+
"@leofcoin/lib": "^1.2.43",
|
|
26
|
+
"@leofcoin/messages": "^1.4.13",
|
|
27
|
+
"@leofcoin/storage": "^3.5.28",
|
|
28
|
+
"@leofcoin/utils": "^1.1.18",
|
|
29
29
|
"@vandeurenglenn/easy-worker": "^1.0.2"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/machine-worker.js
CHANGED
|
@@ -135,9 +135,18 @@ const _executeTransaction = async (transaction) => {
|
|
|
135
135
|
await _.execute({ contract: to, method, params })
|
|
136
136
|
if (to === nativeToken) {
|
|
137
137
|
nativeCalls += 1
|
|
138
|
-
if (method === 'burn')
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
if (method === 'burn') {
|
|
139
|
+
nativeBurns += 1
|
|
140
|
+
totalBurnAmount += params[0]
|
|
141
|
+
}
|
|
142
|
+
if (method === 'mint') {
|
|
143
|
+
nativeMints += 1
|
|
144
|
+
totalMintAmount += params[0]
|
|
145
|
+
}
|
|
146
|
+
if (method === 'transfer') {
|
|
147
|
+
nativeTransfers += 1
|
|
148
|
+
totalTransferAmount += params[0]
|
|
149
|
+
}
|
|
141
150
|
}
|
|
142
151
|
totalTransactions += 1
|
|
143
152
|
|
|
@@ -153,10 +162,19 @@ const _executeTransaction = async (transaction) => {
|
|
|
153
162
|
}
|
|
154
163
|
|
|
155
164
|
_.init = async (message) => {
|
|
156
|
-
let { peerid, fromState, state } = message
|
|
165
|
+
let { peerid, fromState, state, info } = message
|
|
157
166
|
globalThis.peerid = peerid
|
|
158
167
|
console.log({ fromState })
|
|
159
168
|
if (fromState) {
|
|
169
|
+
nativeCalls = info.nativeCalls
|
|
170
|
+
nativeBurns = info.nativeBurns
|
|
171
|
+
nativeMints = info.nativeMints
|
|
172
|
+
nativeTransfers = info.nativeTransfers
|
|
173
|
+
totalTransactions = info.totalTransactions
|
|
174
|
+
totalBurnAmount = info.totalBurnAmount
|
|
175
|
+
totalMintAmount = info.totalMintAmount
|
|
176
|
+
totalTransferAmount = info.totalTransferAmount
|
|
177
|
+
|
|
160
178
|
lastBlock = message.lastBlock
|
|
161
179
|
const setState = async (address, state) => {
|
|
162
180
|
const contractBytes = await resolveContract(address)
|
|
@@ -330,6 +348,15 @@ worker.onmessage(({ id, type, input }) => {
|
|
|
330
348
|
case 'nativeTransfers':
|
|
331
349
|
respond(id, nativeTransfers)
|
|
332
350
|
break
|
|
351
|
+
case 'totalBurnAmount':
|
|
352
|
+
respond(id, totalBurnAmount)
|
|
353
|
+
break
|
|
354
|
+
case 'totalMintAmount':
|
|
355
|
+
respond(id, totalMintAmount)
|
|
356
|
+
break
|
|
357
|
+
case 'totalTransferAmount':
|
|
358
|
+
respond(id, totalTransferAmount)
|
|
359
|
+
break
|
|
333
360
|
case 'totalTransfers':
|
|
334
361
|
respond(id, totalTransfers)
|
|
335
362
|
break
|