@attocash/cli 0.2.3 → 0.3.1
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/README.md +148 -7
- package/dist/application/app.d.ts +34 -3
- package/dist/application/app.js +138 -126
- package/dist/application/operations.d.ts +3 -0
- package/dist/application/operations.js +30 -8
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +101 -13
- package/dist/cli/onboarding.d.ts +13 -0
- package/dist/cli/onboarding.js +99 -2
- package/dist/cli/output.js +18 -2
- package/dist/doctor/profile.js +2 -1
- package/dist/internal-marketplace.d.ts +25 -0
- package/dist/internal-marketplace.js +50 -0
- package/dist/marketplace/approval-files.d.ts +3 -0
- package/dist/marketplace/approval-files.js +97 -0
- package/dist/marketplace/approval-preview.d.ts +2 -0
- package/dist/marketplace/approval-preview.js +86 -0
- package/dist/marketplace/proof-approval.d.ts +82 -0
- package/dist/marketplace/proof-approval.js +671 -0
- package/dist/marketplace/topups.d.ts +82 -0
- package/dist/marketplace/topups.js +485 -0
- package/dist/network/batching.d.ts +2 -0
- package/dist/network/batching.js +23 -0
- package/dist/network/entry.d.ts +2 -0
- package/dist/network/entry.js +35 -0
- package/dist/network/reader.d.ts +2 -0
- package/dist/network/reader.js +125 -37
- package/dist/spending/approval.d.ts +5 -0
- package/dist/spending/approval.js +2 -0
- package/dist/spending/atto-x402.d.ts +31 -0
- package/dist/spending/atto-x402.js +174 -0
- package/dist/spending/ledger.d.ts +74 -2
- package/dist/spending/ledger.js +298 -7
- package/dist/spending/payments.d.ts +105 -5
- package/dist/spending/payments.js +795 -11
- package/dist/storage/recovery-seed.d.ts +13 -0
- package/dist/storage/recovery-seed.js +93 -0
- package/dist/storage/state.d.ts +4 -0
- package/dist/storage/state.js +32 -2
- package/dist/wallet/receive.d.ts +39 -0
- package/dist/wallet/receive.js +264 -0
- package/dist/wallet/signing.d.ts +1 -0
- package/dist/wallet/signing.js +37 -21
- package/dist/wallet/types.d.ts +1 -0
- package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +1922 -1918
- package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/README.md +9 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +10 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.mjs +2543 -2434
- package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +4695 -4227
- package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +60 -60
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +651 -631
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +2294 -2295
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-core/package.json +1 -1
- package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +1 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.mjs +873 -847
- package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -1
- package/node_modules/@attocash/commons-node/kotlin-logging.mjs +109 -109
- package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -1
- package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
- package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-node/package.json +3 -3
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +1 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +674 -640
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -1
- package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +109 -109
- package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -1
- package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -1
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -1
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-node-remote/package.json +4 -4
- package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +1 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +52 -51
- package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +13 -13
- package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +2639 -2608
- package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +411 -196
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +2115 -1976
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +7 -7
- package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +385 -384
- package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +1261 -1185
- package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +668 -656
- package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-openapi-schema.mjs +89 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-openapi-schema.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +9 -9
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +120 -128
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +46 -49
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +1041 -985
- package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +530 -455
- package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -1
- package/node_modules/@attocash/commons-transport/package.json +4 -4
- package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +1 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +230 -226
- package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +109 -109
- package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
- package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker/package.json +3 -3
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +1 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +91 -86
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +109 -109
- package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/node_modules/@attocash/commons-worker-remote/package.json +4 -4
- package/package.json +9 -5
|
@@ -3,22 +3,26 @@ import {
|
|
|
3
3
|
AutoCloseable1l5p57f9lp7kv as AutoCloseable,
|
|
4
4
|
initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
|
|
5
5
|
VOID3gxj6tk5isa35 as VOID,
|
|
6
|
-
|
|
6
|
+
Unit_instance3kz1zqli6gr1r as Unit_instance,
|
|
7
|
+
$3l5vvh8yg0ier as $,
|
|
7
8
|
Exceptiondt2hlxn7j7vw as Exception,
|
|
9
|
+
orPromise1iucc2to2udt2 as orPromise,
|
|
8
10
|
constructCallableReference23y65rf941mch as constructCallableReference,
|
|
9
11
|
HashMap1a0ld5kgwhmhv as HashMap,
|
|
10
12
|
initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
|
|
11
|
-
|
|
13
|
+
_UShort___get_data__impl__g02451raj6q6epxg1b as _UShort___get_data__impl__g0245,
|
|
12
14
|
protoOf180f3jzyo7rfj as protoOf,
|
|
13
15
|
toByte4i43936u611k as toByte,
|
|
14
16
|
fromInt2ii0rejb1w62w as fromInt,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
_ULong___init__impl__c78o9k1vasxel72m2l4 as _ULong___init__impl__c78o9k,
|
|
18
|
+
_ULong___get_data__impl__fggpzbbo8lz7f8fnfy as _ULong___get_data__impl__fggpzb,
|
|
17
19
|
multiply2k9eolhnz1bjv as multiply,
|
|
18
20
|
add2suhfggl4zvkk as add,
|
|
21
|
+
ULong3f9k7s38t3rfp as ULong,
|
|
22
|
+
equals2au1ep9vhcato as equals,
|
|
19
23
|
get_ONEazvfdh9ju3d4 as get_ONE,
|
|
20
24
|
ulongDivide3e52ct8hxp5n7 as ulongDivide,
|
|
21
|
-
|
|
25
|
+
LazyThreadSafetyMode_PUBLICATION_getInstance23f213579at67 as LazyThreadSafetyMode_PUBLICATION_getInstance,
|
|
22
26
|
lazy1261dae0bgscp as lazy,
|
|
23
27
|
THROW_CCE2g6jy02ryeudk as THROW_CCE,
|
|
24
28
|
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
@@ -27,31 +31,31 @@ import {
|
|
|
27
31
|
IllegalArgumentException2asla15b5jaob as IllegalArgumentException,
|
|
28
32
|
toString1pkumu07cwy4m as toString,
|
|
29
33
|
promisify1z0ncraq1ipzh as promisify,
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
await3n7kedgocftsv as await_0,
|
|
35
|
+
_UShort___init__impl__jigrne1e3nphhrejdd8 as _UShort___init__impl__jigrne,
|
|
32
36
|
} from '@attocash/commons-core/kotlin-kotlin-stdlib.mjs';
|
|
33
37
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
Companion_instance2enxrnk22gxoi as Companion_instance,
|
|
39
|
+
Companion_instancew7paw1z24vb2 as Companion_instance_0,
|
|
36
40
|
AttoWorkTarget3v4zqc5kfdpel as AttoWorkTarget,
|
|
37
41
|
AttoWorkrxvyu0kmlxrx as AttoWork,
|
|
38
42
|
toByteArray1xevcsrk0l409 as toByteArray,
|
|
39
43
|
values1ix93lj72gxe9 as values,
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
AttoInstantAsLongSerializer_getInstance22rctt7sygbd8 as AttoInstantAsLongSerializer_getInstance,
|
|
45
|
+
AttoWorkAsStringSerializer_getInstanceu9e83tntftv0 as AttoWorkAsStringSerializer_getInstance,
|
|
42
46
|
toHexcxaq2tti5e5x as toHex,
|
|
43
47
|
} from '@attocash/commons-core/commons-commons-core.mjs';
|
|
44
48
|
import {
|
|
45
|
-
|
|
49
|
+
Dispatchers_getInstance128lm494a5r5s as Dispatchers_getInstance,
|
|
46
50
|
asyncz02dsa2nb2zt as async,
|
|
47
51
|
SupervisorJobythnfxkr3jxc as SupervisorJob,
|
|
48
52
|
CoroutineScopelux7s7zphw7e as CoroutineScope,
|
|
49
53
|
Mutex16li1l0asjv17 as Mutex,
|
|
50
54
|
cancel36mj9lv3a0whl as cancel,
|
|
51
55
|
Job13y4jkazwjho0 as Job,
|
|
52
|
-
|
|
56
|
+
Key_instancepi2bbb0csu5f as Key_instance,
|
|
53
57
|
get_isActivehakov5bm97hw as get_isActive,
|
|
54
|
-
|
|
58
|
+
yield7e67oxleds6v as yield_0,
|
|
55
59
|
CompletableDeferred2lnqvsbvx74d3 as CompletableDeferred,
|
|
56
60
|
launch1c91vkjzdi9sd as launch,
|
|
57
61
|
} from '@attocash/commons-transport/kotlinx-coroutines-core.mjs';
|
|
@@ -59,7 +63,7 @@ import {
|
|
|
59
63
|
createSimpleEnumSerializer2guioz11kk1m0 as createSimpleEnumSerializer,
|
|
60
64
|
PluginGeneratedSerialDescriptorqdzeg5asqhfg as PluginGeneratedSerialDescriptor,
|
|
61
65
|
UnknownFieldExceptiona60e3a6v1xqo as UnknownFieldException,
|
|
62
|
-
|
|
66
|
+
StringSerializer_getInstance1p9zda6r6kb23 as StringSerializer_getInstance,
|
|
63
67
|
typeParametersSerializers2likxjr48tr7y as typeParametersSerializers,
|
|
64
68
|
GeneratedSerializer1f7t7hssdd2ws as GeneratedSerializer,
|
|
65
69
|
throwMissingFieldException2cmke0v3ynf14 as throwMissingFieldException,
|
|
@@ -70,149 +74,149 @@ var imul = Math.imul;
|
|
|
70
74
|
//endregion
|
|
71
75
|
//region block: pre-declaration
|
|
72
76
|
class Companion {
|
|
73
|
-
|
|
77
|
+
cpu_o7vd24_k$(parallelism) {
|
|
74
78
|
return new AttoWorkerCpu(parallelism);
|
|
75
79
|
}
|
|
76
|
-
|
|
80
|
+
cpu_246g_k$() {
|
|
77
81
|
return defaultCpuWorker();
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
class AttoWorker {}
|
|
81
85
|
function *work(network, timestamp, target, $completion) {
|
|
82
|
-
var threshold = Companion_instance.
|
|
83
|
-
return yield* this.
|
|
86
|
+
var threshold = Companion_instance.getThreshold_kx7vsl_k$(network, timestamp);
|
|
87
|
+
return yield* this.work_87s8mv_k$(threshold, target, $completion);
|
|
84
88
|
}
|
|
85
89
|
function *work_0(block, $completion) {
|
|
86
|
-
var target = block.
|
|
87
|
-
return yield* this.
|
|
90
|
+
var target = block.getTarget_dhambr_k$();
|
|
91
|
+
return yield* this.work_qtc4fi_k$(block.network, block.timestamp, target, $completion);
|
|
88
92
|
}
|
|
89
93
|
class AttoWorkerCache {
|
|
90
94
|
constructor(delegate, dispatcher) {
|
|
91
|
-
dispatcher = dispatcher === VOID ? Dispatchers_getInstance().
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
95
|
+
dispatcher = dispatcher === VOID ? Dispatchers_getInstance().Default_1 : dispatcher;
|
|
96
|
+
this.delegate_1 = delegate;
|
|
97
|
+
this.scope_1 = CoroutineScope(dispatcher.plus_s13ygv_k$(SupervisorJob()));
|
|
98
|
+
this.mutex_1 = Mutex();
|
|
99
|
+
this.cache_1 = HashMap.new_kotlin_collections_HashMap_2a5kxx_k$();
|
|
96
100
|
}
|
|
97
|
-
*
|
|
101
|
+
*work_87s8mv_k$(threshold, target, $completion) {
|
|
98
102
|
var deferred = yield* /*#__NOINLINE__*/delegateWork(this, target, AttoWorkerCache$work$slambda(this, threshold), $completion);
|
|
99
|
-
var work = yield* deferred.
|
|
103
|
+
var work = yield* deferred.await_4rdzbx_k$($completion);
|
|
100
104
|
// Inline function 'kotlinx.coroutines.sync.withLock' call
|
|
101
|
-
var this_0 = this.
|
|
102
|
-
yield* this_0.
|
|
105
|
+
var this_0 = this.mutex_1;
|
|
106
|
+
yield* this_0.lock_ugrcvf_k$(null, $completion);
|
|
103
107
|
var tmp;
|
|
104
108
|
try {
|
|
105
|
-
tmp = this.
|
|
109
|
+
tmp = this.cache_1.remove_gppy8k_k$(target);
|
|
106
110
|
}finally {
|
|
107
|
-
this_0.
|
|
111
|
+
this_0.unlock_ulcrcl_k$(null);
|
|
108
112
|
}
|
|
109
|
-
if (Companion_instance.
|
|
113
|
+
if (Companion_instance.isValid_6d979i_k$(threshold, target, work.value)) {
|
|
110
114
|
return work;
|
|
111
115
|
}
|
|
112
|
-
return yield* this.
|
|
116
|
+
return yield* this.work_87s8mv_k$(threshold, target, $completion);
|
|
113
117
|
}
|
|
114
|
-
*
|
|
118
|
+
*work_qtc4fi_k$(network, timestamp, target, $completion) {
|
|
115
119
|
var deferred = yield* /*#__NOINLINE__*/delegateWork(this, target, AttoWorkerCache$work$slambda_0(this, network, timestamp), $completion);
|
|
116
|
-
var work = yield* deferred.
|
|
120
|
+
var work = yield* deferred.await_4rdzbx_k$($completion);
|
|
117
121
|
// Inline function 'kotlinx.coroutines.sync.withLock' call
|
|
118
|
-
var this_0 = this.
|
|
119
|
-
yield* this_0.
|
|
122
|
+
var this_0 = this.mutex_1;
|
|
123
|
+
yield* this_0.lock_ugrcvf_k$(null, $completion);
|
|
120
124
|
var tmp;
|
|
121
125
|
try {
|
|
122
|
-
tmp = this.
|
|
126
|
+
tmp = this.cache_1.remove_gppy8k_k$(target);
|
|
123
127
|
}finally {
|
|
124
|
-
this_0.
|
|
128
|
+
this_0.unlock_ulcrcl_k$(null);
|
|
125
129
|
}
|
|
126
|
-
if (Companion_instance.
|
|
130
|
+
if (Companion_instance.isValid_bw4l0h_k$(network, timestamp, target, work.value)) {
|
|
127
131
|
return work;
|
|
128
132
|
}
|
|
129
|
-
return yield* this.
|
|
133
|
+
return yield* this.work_qtc4fi_k$(network, timestamp, target, $completion);
|
|
130
134
|
}
|
|
131
|
-
*
|
|
132
|
-
var tmp = block.
|
|
135
|
+
*work_uniq4r_k$(block, $completion) {
|
|
136
|
+
var tmp = block.getTarget_dhambr_k$();
|
|
133
137
|
var deferred = yield* /*#__NOINLINE__*/delegateWork(this, tmp, AttoWorkerCache$work$slambda_1(this, block), $completion);
|
|
134
|
-
var work = yield* deferred.
|
|
138
|
+
var work = yield* deferred.await_4rdzbx_k$($completion);
|
|
135
139
|
// Inline function 'kotlinx.coroutines.sync.withLock' call
|
|
136
|
-
var this_0 = this.
|
|
137
|
-
yield* this_0.
|
|
140
|
+
var this_0 = this.mutex_1;
|
|
141
|
+
yield* this_0.lock_ugrcvf_k$(null, $completion);
|
|
138
142
|
var tmp_0;
|
|
139
143
|
try {
|
|
140
|
-
tmp_0 = this.
|
|
144
|
+
tmp_0 = this.cache_1.remove_gppy8k_k$(block.getTarget_dhambr_k$());
|
|
141
145
|
}finally {
|
|
142
|
-
this_0.
|
|
146
|
+
this_0.unlock_ulcrcl_k$(null);
|
|
143
147
|
}
|
|
144
148
|
var nextTarget = new AttoWorkTarget(block.hash.value);
|
|
145
149
|
yield* /*#__NOINLINE__*/delegateWork(this, nextTarget, AttoWorkerCache$work$slambda_2(this, block), $completion);
|
|
146
150
|
if (work.isValid(block)) {
|
|
147
151
|
return work;
|
|
148
152
|
}
|
|
149
|
-
return yield* this.
|
|
153
|
+
return yield* this.work_uniq4r_k$(block, $completion);
|
|
150
154
|
}
|
|
151
|
-
|
|
152
|
-
this.
|
|
153
|
-
cancel(this.
|
|
154
|
-
this.
|
|
155
|
+
close_yn9xrc_k$() {
|
|
156
|
+
this.cache_1.clear_j9egeb_k$();
|
|
157
|
+
cancel(this.scope_1);
|
|
158
|
+
this.delegate_1.close_yn9xrc_k$();
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
class AttoWorkerCpu {
|
|
158
162
|
constructor(parallelism) {
|
|
159
|
-
this.
|
|
160
|
-
this.
|
|
163
|
+
this.parallelism_1 = parallelism;
|
|
164
|
+
this.supervisorJob_1 = SupervisorJob();
|
|
161
165
|
var tmp = this;
|
|
162
|
-
var tmp_0 = Dispatchers_getInstance().
|
|
166
|
+
var tmp_0 = Dispatchers_getInstance().Default_1;
|
|
163
167
|
// Inline function 'kotlin.UShort.toInt' call
|
|
164
|
-
var this_0 = this.
|
|
168
|
+
var this_0 = this.parallelism_1;
|
|
165
169
|
var tmp$ret$0 = _UShort___get_data__impl__g0245(this_0) & 65535;
|
|
166
|
-
tmp.
|
|
170
|
+
tmp.dispatcher_1 = tmp_0.limitedParallelism$default_fymcw7_k$(tmp$ret$0);
|
|
167
171
|
}
|
|
168
|
-
*
|
|
169
|
-
var workJob = Job(this.
|
|
172
|
+
*work_87s8mv_k$(threshold, target, $completion) {
|
|
173
|
+
var workJob = Job(this.supervisorJob_1);
|
|
170
174
|
// Inline function 'kotlin.js.getCoroutineContext' call
|
|
171
|
-
var tmp0_safe_receiver = $completion.
|
|
175
|
+
var tmp0_safe_receiver = $completion.get_context_h02k06_k$().get_y2st91_k$(Key_instance);
|
|
172
176
|
var tmp;
|
|
173
177
|
if (tmp0_safe_receiver == null) {
|
|
174
178
|
tmp = null;
|
|
175
179
|
} else {
|
|
176
|
-
tmp = tmp0_safe_receiver.
|
|
180
|
+
tmp = tmp0_safe_receiver.invokeOnCompletion_n6cffu_k$(AttoWorkerCpu$work$lambda(workJob));
|
|
177
181
|
}
|
|
178
182
|
var callerCancellation = tmp;
|
|
179
183
|
try {
|
|
180
|
-
var controller = new WorkerController(this.
|
|
181
|
-
return yield* controller.
|
|
184
|
+
var controller = new WorkerController(this.dispatcher_1.plus_s13ygv_k$(workJob), this.parallelism_1, threshold, target.value_1);
|
|
185
|
+
return yield* controller.calculate_v9m4ne_k$($completion);
|
|
182
186
|
}finally {
|
|
183
187
|
if (callerCancellation == null)
|
|
184
188
|
null;
|
|
185
189
|
else {
|
|
186
|
-
callerCancellation.
|
|
190
|
+
callerCancellation.dispose_3nnxhr_k$();
|
|
187
191
|
}
|
|
188
|
-
workJob.
|
|
192
|
+
workJob.cancel$default_8haxne_k$();
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
|
-
|
|
192
|
-
this.
|
|
195
|
+
close_yn9xrc_k$() {
|
|
196
|
+
this.supervisorJob_1.cancel$default_8haxne_k$();
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
class WorkerController {
|
|
196
200
|
constructor(context, parallelism, threshold, target) {
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
200
|
-
this.
|
|
201
|
+
this.parallelism_1 = parallelism;
|
|
202
|
+
this.threshold_1 = threshold;
|
|
203
|
+
this.target_1 = target;
|
|
204
|
+
this.scope_1 = CoroutineScope(context);
|
|
201
205
|
var tmp = this;
|
|
202
206
|
// Inline function 'kotlin.apply' call
|
|
203
207
|
var this_0 = CompletableDeferred();
|
|
204
|
-
this_0.
|
|
205
|
-
tmp.
|
|
208
|
+
this_0.invokeOnCompletion_n6cffu_k$(WorkerController$result$lambda(this));
|
|
209
|
+
tmp.result_1 = this_0;
|
|
206
210
|
}
|
|
207
|
-
*
|
|
211
|
+
*calculate_v9m4ne_k$($completion) {
|
|
208
212
|
var tmp0 = _ULong___init__impl__c78o9k(-1n);
|
|
209
213
|
// Inline function 'kotlin.UShort.toULong' call
|
|
210
|
-
var this_0 = this.
|
|
214
|
+
var this_0 = this.parallelism_1;
|
|
211
215
|
// Inline function 'kotlin.ULong.div' call
|
|
212
216
|
var other = _ULong___init__impl__c78o9k(fromInt(_UShort___get_data__impl__g0245(this_0)) & 65535n);
|
|
213
217
|
var rangeSize = ulongDivide(tmp0, other);
|
|
214
218
|
// Inline function 'kotlin.UShort.toInt' call
|
|
215
|
-
var this_1 = this.
|
|
219
|
+
var this_1 = this.parallelism_1;
|
|
216
220
|
// Inline function 'kotlin.repeat' call
|
|
217
221
|
var times = _UShort___get_data__impl__g0245(this_1) & 65535;
|
|
218
222
|
var inductionVariable = 0;
|
|
@@ -220,13 +224,13 @@ class WorkerController {
|
|
|
220
224
|
do {
|
|
221
225
|
var index = inductionVariable;
|
|
222
226
|
inductionVariable = inductionVariable + 1 | 0;
|
|
223
|
-
launch(this.
|
|
227
|
+
launch(this.scope_1, VOID, VOID, WorkerController$calculate$slambda(index, rangeSize, this));
|
|
224
228
|
}
|
|
225
229
|
while (inductionVariable < times);
|
|
226
230
|
try {
|
|
227
|
-
return yield* this.
|
|
231
|
+
return yield* this.result_1.await_4rdzbx_k$($completion);
|
|
228
232
|
}finally {
|
|
229
|
-
cancel(this.
|
|
233
|
+
cancel(this.scope_1);
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
236
|
}
|
|
@@ -238,81 +242,81 @@ class Companion_0 {
|
|
|
238
242
|
// Inline function 'kotlin.arrayOf' call
|
|
239
243
|
// Inline function 'kotlin.js.unsafeCast' call
|
|
240
244
|
// Inline function 'kotlin.js.asDynamic' call
|
|
241
|
-
tmp
|
|
245
|
+
tmp.$childSerializers_1 = [lazy(tmp_0, AttoWorkerOperations$Request$Companion$$childSerializers$_anonymous__k0cb7d), null, null];
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
248
|
class $serializer {
|
|
245
249
|
constructor() {
|
|
246
250
|
$serializer_instance = this;
|
|
247
251
|
var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('cash.atto.commons.worker.AttoWorkerOperations.Request', this, 3);
|
|
248
|
-
tmp0_serialDesc.
|
|
249
|
-
tmp0_serialDesc.
|
|
250
|
-
tmp0_serialDesc.
|
|
251
|
-
this.
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
var tmp0_desc = this.
|
|
255
|
-
var tmp1_output = encoder.
|
|
256
|
-
var tmp2_cached = Companion_getInstance_0()
|
|
257
|
-
tmp1_output.
|
|
258
|
-
tmp1_output.
|
|
259
|
-
tmp1_output.
|
|
260
|
-
tmp1_output.
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return this.
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
var tmp0_desc = this.
|
|
252
|
+
tmp0_serialDesc.addElement_5pzumi_k$('network', false);
|
|
253
|
+
tmp0_serialDesc.addElement_5pzumi_k$('timestamp', false);
|
|
254
|
+
tmp0_serialDesc.addElement_5pzumi_k$('target', false);
|
|
255
|
+
this.descriptor_1 = tmp0_serialDesc;
|
|
256
|
+
}
|
|
257
|
+
serialize_20rcyh_k$(encoder, value) {
|
|
258
|
+
var tmp0_desc = this.descriptor_1;
|
|
259
|
+
var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc);
|
|
260
|
+
var tmp2_cached = Companion_getInstance_0().$childSerializers_1;
|
|
261
|
+
tmp1_output.encodeSerializableElement_isqxcl_k$(tmp0_desc, 0, tmp2_cached[0].get_value_j01efc_k$(), value.network_1);
|
|
262
|
+
tmp1_output.encodeSerializableElement_isqxcl_k$(tmp0_desc, 1, AttoInstantAsLongSerializer_getInstance(), value.timestamp_1);
|
|
263
|
+
tmp1_output.encodeStringElement_1n5wu2_k$(tmp0_desc, 2, value.target_1);
|
|
264
|
+
tmp1_output.endStructure_1xqz0n_k$(tmp0_desc);
|
|
265
|
+
}
|
|
266
|
+
serialize_5ase3y_k$(encoder, value) {
|
|
267
|
+
return this.serialize_20rcyh_k$(encoder, value instanceof Request ? value : THROW_CCE());
|
|
268
|
+
}
|
|
269
|
+
deserialize_sy6x50_k$(decoder) {
|
|
270
|
+
var tmp0_desc = this.descriptor_1;
|
|
267
271
|
var tmp1_flag = true;
|
|
268
272
|
var tmp2_index = 0;
|
|
269
273
|
var tmp3_bitMask0 = 0;
|
|
270
274
|
var tmp4_local0 = null;
|
|
271
275
|
var tmp5_local1 = null;
|
|
272
276
|
var tmp6_local2 = null;
|
|
273
|
-
var tmp7_input = decoder.
|
|
274
|
-
var tmp8_cached = Companion_getInstance_0()
|
|
275
|
-
if (tmp7_input.
|
|
276
|
-
tmp4_local0 = tmp7_input.
|
|
277
|
+
var tmp7_input = decoder.beginStructure_yljocp_k$(tmp0_desc);
|
|
278
|
+
var tmp8_cached = Companion_getInstance_0().$childSerializers_1;
|
|
279
|
+
if (tmp7_input.decodeSequentially_xlblqy_k$()) {
|
|
280
|
+
tmp4_local0 = tmp7_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 0, tmp8_cached[0].get_value_j01efc_k$(), tmp4_local0);
|
|
277
281
|
tmp3_bitMask0 = tmp3_bitMask0 | 1;
|
|
278
|
-
tmp5_local1 = tmp7_input.
|
|
282
|
+
tmp5_local1 = tmp7_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 1, AttoInstantAsLongSerializer_getInstance(), tmp5_local1);
|
|
279
283
|
tmp3_bitMask0 = tmp3_bitMask0 | 2;
|
|
280
|
-
tmp6_local2 = tmp7_input.
|
|
284
|
+
tmp6_local2 = tmp7_input.decodeStringElement_3oenpg_k$(tmp0_desc, 2);
|
|
281
285
|
tmp3_bitMask0 = tmp3_bitMask0 | 4;
|
|
282
286
|
} else
|
|
283
287
|
while (tmp1_flag) {
|
|
284
|
-
tmp2_index = tmp7_input.
|
|
288
|
+
tmp2_index = tmp7_input.decodeElementIndex_bstkhp_k$(tmp0_desc);
|
|
285
289
|
switch (tmp2_index) {
|
|
286
290
|
case -1:
|
|
287
291
|
tmp1_flag = false;
|
|
288
292
|
break;
|
|
289
293
|
case 0:
|
|
290
|
-
tmp4_local0 = tmp7_input.
|
|
294
|
+
tmp4_local0 = tmp7_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 0, tmp8_cached[0].get_value_j01efc_k$(), tmp4_local0);
|
|
291
295
|
tmp3_bitMask0 = tmp3_bitMask0 | 1;
|
|
292
296
|
break;
|
|
293
297
|
case 1:
|
|
294
|
-
tmp5_local1 = tmp7_input.
|
|
298
|
+
tmp5_local1 = tmp7_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 1, AttoInstantAsLongSerializer_getInstance(), tmp5_local1);
|
|
295
299
|
tmp3_bitMask0 = tmp3_bitMask0 | 2;
|
|
296
300
|
break;
|
|
297
301
|
case 2:
|
|
298
|
-
tmp6_local2 = tmp7_input.
|
|
302
|
+
tmp6_local2 = tmp7_input.decodeStringElement_3oenpg_k$(tmp0_desc, 2);
|
|
299
303
|
tmp3_bitMask0 = tmp3_bitMask0 | 4;
|
|
300
304
|
break;
|
|
301
305
|
default:
|
|
302
|
-
throw UnknownFieldException.
|
|
306
|
+
throw UnknownFieldException.new_kotlinx_serialization_UnknownFieldException_ecrf7z_k$(tmp2_index);
|
|
303
307
|
}
|
|
304
308
|
}
|
|
305
|
-
tmp7_input.
|
|
306
|
-
return Request.
|
|
309
|
+
tmp7_input.endStructure_1xqz0n_k$(tmp0_desc);
|
|
310
|
+
return Request.new_cash_atto_commons_worker_AttoWorkerOperations_Request_65dob1_k$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, null);
|
|
307
311
|
}
|
|
308
|
-
|
|
309
|
-
return this.
|
|
312
|
+
get_descriptor_wjt6a0_k$() {
|
|
313
|
+
return this.descriptor_1;
|
|
310
314
|
}
|
|
311
|
-
|
|
315
|
+
childSerializers_5ghqw5_k$() {
|
|
312
316
|
// Inline function 'kotlin.arrayOf' call
|
|
313
317
|
// Inline function 'kotlin.js.unsafeCast' call
|
|
314
318
|
// Inline function 'kotlin.js.asDynamic' call
|
|
315
|
-
return [Companion_getInstance_0()
|
|
319
|
+
return [Companion_getInstance_0().$childSerializers_1[0].get_value_j01efc_k$(), AttoInstantAsLongSerializer_getInstance(), StringSerializer_getInstance()];
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
322
|
class Companion_1 {}
|
|
@@ -320,50 +324,50 @@ class $serializer_0 {
|
|
|
320
324
|
constructor() {
|
|
321
325
|
$serializer_instance_0 = this;
|
|
322
326
|
var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('cash.atto.commons.worker.AttoWorkerOperations.Response', this, 1);
|
|
323
|
-
tmp0_serialDesc.
|
|
324
|
-
this.
|
|
327
|
+
tmp0_serialDesc.addElement_5pzumi_k$('work', false);
|
|
328
|
+
this.descriptor_1 = tmp0_serialDesc;
|
|
325
329
|
}
|
|
326
|
-
|
|
327
|
-
var tmp0_desc = this.
|
|
328
|
-
var tmp1_output = encoder.
|
|
329
|
-
tmp1_output.
|
|
330
|
-
tmp1_output.
|
|
330
|
+
serialize_ytgqsx_k$(encoder, value) {
|
|
331
|
+
var tmp0_desc = this.descriptor_1;
|
|
332
|
+
var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc);
|
|
333
|
+
tmp1_output.encodeSerializableElement_isqxcl_k$(tmp0_desc, 0, AttoWorkAsStringSerializer_getInstance(), value.work_1);
|
|
334
|
+
tmp1_output.endStructure_1xqz0n_k$(tmp0_desc);
|
|
331
335
|
}
|
|
332
|
-
|
|
333
|
-
return this.
|
|
336
|
+
serialize_5ase3y_k$(encoder, value) {
|
|
337
|
+
return this.serialize_ytgqsx_k$(encoder, value instanceof Response ? value : THROW_CCE());
|
|
334
338
|
}
|
|
335
|
-
|
|
336
|
-
var tmp0_desc = this.
|
|
339
|
+
deserialize_sy6x50_k$(decoder) {
|
|
340
|
+
var tmp0_desc = this.descriptor_1;
|
|
337
341
|
var tmp1_flag = true;
|
|
338
342
|
var tmp2_index = 0;
|
|
339
343
|
var tmp3_bitMask0 = 0;
|
|
340
344
|
var tmp4_local0 = null;
|
|
341
|
-
var tmp5_input = decoder.
|
|
342
|
-
if (tmp5_input.
|
|
343
|
-
tmp4_local0 = tmp5_input.
|
|
345
|
+
var tmp5_input = decoder.beginStructure_yljocp_k$(tmp0_desc);
|
|
346
|
+
if (tmp5_input.decodeSequentially_xlblqy_k$()) {
|
|
347
|
+
tmp4_local0 = tmp5_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 0, AttoWorkAsStringSerializer_getInstance(), tmp4_local0);
|
|
344
348
|
tmp3_bitMask0 = tmp3_bitMask0 | 1;
|
|
345
349
|
} else
|
|
346
350
|
while (tmp1_flag) {
|
|
347
|
-
tmp2_index = tmp5_input.
|
|
351
|
+
tmp2_index = tmp5_input.decodeElementIndex_bstkhp_k$(tmp0_desc);
|
|
348
352
|
switch (tmp2_index) {
|
|
349
353
|
case -1:
|
|
350
354
|
tmp1_flag = false;
|
|
351
355
|
break;
|
|
352
356
|
case 0:
|
|
353
|
-
tmp4_local0 = tmp5_input.
|
|
357
|
+
tmp4_local0 = tmp5_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 0, AttoWorkAsStringSerializer_getInstance(), tmp4_local0);
|
|
354
358
|
tmp3_bitMask0 = tmp3_bitMask0 | 1;
|
|
355
359
|
break;
|
|
356
360
|
default:
|
|
357
|
-
throw UnknownFieldException.
|
|
361
|
+
throw UnknownFieldException.new_kotlinx_serialization_UnknownFieldException_ecrf7z_k$(tmp2_index);
|
|
358
362
|
}
|
|
359
363
|
}
|
|
360
|
-
tmp5_input.
|
|
361
|
-
return Response.
|
|
364
|
+
tmp5_input.endStructure_1xqz0n_k$(tmp0_desc);
|
|
365
|
+
return Response.new_cash_atto_commons_worker_AttoWorkerOperations_Response_z9gk0v_k$(tmp3_bitMask0, tmp4_local0, null);
|
|
362
366
|
}
|
|
363
|
-
|
|
364
|
-
return this.
|
|
367
|
+
get_descriptor_wjt6a0_k$() {
|
|
368
|
+
return this.descriptor_1;
|
|
365
369
|
}
|
|
366
|
-
|
|
370
|
+
childSerializers_5ghqw5_k$() {
|
|
367
371
|
// Inline function 'kotlin.arrayOf' call
|
|
368
372
|
// Inline function 'kotlin.js.unsafeCast' call
|
|
369
373
|
// Inline function 'kotlin.js.asDynamic' call
|
|
@@ -373,17 +377,17 @@ class $serializer_0 {
|
|
|
373
377
|
class Request {
|
|
374
378
|
constructor(network, timestamp, target) {
|
|
375
379
|
Companion_getInstance_0();
|
|
376
|
-
this.
|
|
377
|
-
this.
|
|
378
|
-
this.
|
|
380
|
+
this.network_1 = network;
|
|
381
|
+
this.timestamp_1 = timestamp;
|
|
382
|
+
this.target_1 = target;
|
|
379
383
|
}
|
|
380
384
|
toString() {
|
|
381
|
-
return 'Request(network=' + this.
|
|
385
|
+
return 'Request(network=' + this.network_1.toString() + ', timestamp=' + this.timestamp_1.toString() + ', target=' + this.target_1 + ')';
|
|
382
386
|
}
|
|
383
387
|
hashCode() {
|
|
384
|
-
var result = this.
|
|
385
|
-
result = imul(result, 31) + this.
|
|
386
|
-
result = imul(result, 31) + getStringHashCode(this.
|
|
388
|
+
var result = this.network_1.hashCode();
|
|
389
|
+
result = imul(result, 31) + this.timestamp_1.hashCode() | 0;
|
|
390
|
+
result = imul(result, 31) + getStringHashCode(this.target_1) | 0;
|
|
387
391
|
return result;
|
|
388
392
|
}
|
|
389
393
|
equals(other) {
|
|
@@ -391,63 +395,63 @@ class Request {
|
|
|
391
395
|
return true;
|
|
392
396
|
if (!(other instanceof Request))
|
|
393
397
|
return false;
|
|
394
|
-
if (!this.
|
|
398
|
+
if (!this.network_1.equals(other.network_1))
|
|
395
399
|
return false;
|
|
396
|
-
if (!this.
|
|
400
|
+
if (!this.timestamp_1.equals(other.timestamp_1))
|
|
397
401
|
return false;
|
|
398
|
-
if (!(this.
|
|
402
|
+
if (!(this.target_1 === other.target_1))
|
|
399
403
|
return false;
|
|
400
404
|
return true;
|
|
401
405
|
}
|
|
402
|
-
static
|
|
406
|
+
static new_cash_atto_commons_worker_AttoWorkerOperations_Request_65dob1_k$(seen0, network, timestamp, target, serializationConstructorMarker) {
|
|
403
407
|
Companion_getInstance_0();
|
|
404
408
|
if (!(7 === (7 & seen0))) {
|
|
405
|
-
throwMissingFieldException(seen0, 7, $serializer_getInstance().
|
|
409
|
+
throwMissingFieldException(seen0, 7, $serializer_getInstance().descriptor_1);
|
|
406
410
|
}
|
|
407
411
|
var $this = createThis(this);
|
|
408
|
-
$this.
|
|
409
|
-
$this.
|
|
410
|
-
$this.
|
|
412
|
+
$this.network_1 = network;
|
|
413
|
+
$this.timestamp_1 = timestamp;
|
|
414
|
+
$this.target_1 = target;
|
|
411
415
|
return $this;
|
|
412
416
|
}
|
|
413
417
|
}
|
|
414
418
|
class Response {
|
|
415
419
|
constructor(work) {
|
|
416
|
-
this.
|
|
420
|
+
this.work_1 = work;
|
|
417
421
|
}
|
|
418
422
|
toString() {
|
|
419
|
-
return 'Response(work=' + this.
|
|
423
|
+
return 'Response(work=' + this.work_1.toString() + ')';
|
|
420
424
|
}
|
|
421
425
|
hashCode() {
|
|
422
|
-
return this.
|
|
426
|
+
return this.work_1.hashCode();
|
|
423
427
|
}
|
|
424
428
|
equals(other) {
|
|
425
429
|
if (this === other)
|
|
426
430
|
return true;
|
|
427
431
|
if (!(other instanceof Response))
|
|
428
432
|
return false;
|
|
429
|
-
if (!this.
|
|
433
|
+
if (!this.work_1.equals(other.work_1))
|
|
430
434
|
return false;
|
|
431
435
|
return true;
|
|
432
436
|
}
|
|
433
|
-
static
|
|
437
|
+
static new_cash_atto_commons_worker_AttoWorkerOperations_Response_z9gk0v_k$(seen0, work, serializationConstructorMarker) {
|
|
434
438
|
if (!(1 === (1 & seen0))) {
|
|
435
|
-
throwMissingFieldException(seen0, 1, $serializer_getInstance_0().
|
|
439
|
+
throwMissingFieldException(seen0, 1, $serializer_getInstance_0().descriptor_1);
|
|
436
440
|
}
|
|
437
441
|
var $this = createThis(this);
|
|
438
|
-
$this.
|
|
442
|
+
$this.work_1 = work;
|
|
439
443
|
return $this;
|
|
440
444
|
}
|
|
441
445
|
}
|
|
442
446
|
class AttoWorkerOperations {}
|
|
443
447
|
function *work_1(network, timestamp, target, $completion) {
|
|
444
|
-
var request = new Request(network, timestamp, toHex(target.
|
|
445
|
-
var response = yield* this.
|
|
446
|
-
var work = response.
|
|
448
|
+
var request = new Request(network, timestamp, toHex(target.value_1));
|
|
449
|
+
var response = yield* this.work_s1kcy2_k$(request, $completion);
|
|
450
|
+
var work = response.work_1;
|
|
447
451
|
// Inline function 'kotlin.require' call
|
|
448
|
-
if (!Companion_instance.
|
|
449
|
-
var message = 'Worker returned invalid work for network=' + network.toString() + ' timestamp=' + timestamp.toString() + ' target=' + toHex(target.
|
|
450
|
-
throw IllegalArgumentException.
|
|
452
|
+
if (!Companion_instance.isValid_bw4l0h_k$(network, timestamp, target, work.value)) {
|
|
453
|
+
var message = 'Worker returned invalid work for network=' + network.toString() + ' timestamp=' + timestamp.toString() + ' target=' + toHex(target.value_1);
|
|
454
|
+
throw IllegalArgumentException.new_kotlin_IllegalArgumentException_sfqr8_k$(toString(message));
|
|
451
455
|
}
|
|
452
456
|
return work;
|
|
453
457
|
}
|
|
@@ -455,35 +459,35 @@ class AttoWorkerAsync {
|
|
|
455
459
|
constructor(worker, dispatcher) {
|
|
456
460
|
this.worker = worker;
|
|
457
461
|
}
|
|
458
|
-
|
|
462
|
+
get_worker_lh5cp3_k$() {
|
|
459
463
|
return this.worker;
|
|
460
464
|
}
|
|
461
|
-
*
|
|
462
|
-
return yield* this.worker.
|
|
465
|
+
*work_87s8mv_k$(threshold, target, $completion) {
|
|
466
|
+
return yield* this.worker.work_87s8mv_k$(threshold, target, $completion);
|
|
463
467
|
}
|
|
464
468
|
workThreshold(threshold, target) {
|
|
465
|
-
return promisify(($completion) => this.
|
|
469
|
+
return promisify(($completion) => this.work_87s8mv_k$(threshold, target, $completion));
|
|
466
470
|
}
|
|
467
|
-
*
|
|
468
|
-
return this.workThreshold === protoOf(AttoWorkerAsync).workThreshold ? (yield* this.
|
|
471
|
+
*work$suspendBridge_bi9o6u_k$(threshold, target, $completion) {
|
|
472
|
+
return this.workThreshold === protoOf(AttoWorkerAsync).workThreshold ? (yield* this.work_87s8mv_k$(threshold, target, $completion)) : (yield* await_0(this.workThreshold(threshold, target), $completion));
|
|
469
473
|
}
|
|
470
|
-
*
|
|
471
|
-
return yield* this.worker.
|
|
474
|
+
*work_qtc4fi_k$(network, timestamp, target, $completion) {
|
|
475
|
+
return yield* this.worker.work_qtc4fi_k$(network, timestamp, target, $completion);
|
|
472
476
|
}
|
|
473
477
|
workNetwork(network, timestamp, target) {
|
|
474
|
-
return promisify(($completion) => this.
|
|
478
|
+
return promisify(($completion) => this.work_qtc4fi_k$(network, timestamp, target, $completion));
|
|
475
479
|
}
|
|
476
|
-
*
|
|
477
|
-
return this.workNetwork === protoOf(AttoWorkerAsync).workNetwork ? (yield* this.
|
|
480
|
+
*work$suspendBridge_i98mdt_k$(network, timestamp, target, $completion) {
|
|
481
|
+
return this.workNetwork === protoOf(AttoWorkerAsync).workNetwork ? (yield* this.work_qtc4fi_k$(network, timestamp, target, $completion)) : (yield* await_0(this.workNetwork(network, timestamp, target), $completion));
|
|
478
482
|
}
|
|
479
|
-
*
|
|
480
|
-
return yield* this.worker.
|
|
483
|
+
*work_uniq4r_k$(block, $completion) {
|
|
484
|
+
return yield* this.worker.work_uniq4r_k$(block, $completion);
|
|
481
485
|
}
|
|
482
486
|
workBlock(block) {
|
|
483
|
-
return promisify(($completion) => this.
|
|
487
|
+
return promisify(($completion) => this.work_uniq4r_k$(block, $completion));
|
|
484
488
|
}
|
|
485
|
-
*
|
|
486
|
-
return this.workBlock === protoOf(AttoWorkerAsync).workBlock ? (yield* this.
|
|
489
|
+
*work$suspendBridge_24k5lg_k$(block, $completion) {
|
|
490
|
+
return this.workBlock === protoOf(AttoWorkerAsync).workBlock ? (yield* this.work_uniq4r_k$(block, $completion)) : (yield* await_0(this.workBlock(block), $completion));
|
|
487
491
|
}
|
|
488
492
|
}
|
|
489
493
|
//endregion
|
|
@@ -495,92 +499,92 @@ function toAsync(_this__u8e3s4, dispatcher) {
|
|
|
495
499
|
return new AttoWorkerAsync(_this__u8e3s4, dispatcher);
|
|
496
500
|
}
|
|
497
501
|
function cached(_this__u8e3s4, dispatcher) {
|
|
498
|
-
dispatcher = dispatcher === VOID ? Dispatchers_getInstance().
|
|
502
|
+
dispatcher = dispatcher === VOID ? Dispatchers_getInstance().Default_1 : dispatcher;
|
|
499
503
|
return new AttoWorkerCache(_this__u8e3s4, dispatcher);
|
|
500
504
|
}
|
|
501
505
|
function *delegateWork($this, target, delegate, $completion) {
|
|
502
506
|
// Inline function 'kotlinx.coroutines.sync.withLock' call
|
|
503
|
-
var this_0 = $this.
|
|
504
|
-
yield* this_0.
|
|
507
|
+
var this_0 = $this.mutex_1;
|
|
508
|
+
yield* this_0.lock_ugrcvf_k$(null, $completion);
|
|
505
509
|
var tmp;
|
|
506
510
|
try {
|
|
507
|
-
var deferred = $this.
|
|
511
|
+
var deferred = $this.cache_1.get_wei43m_k$(target);
|
|
508
512
|
if (!(deferred == null)) {
|
|
509
513
|
return deferred;
|
|
510
514
|
}
|
|
511
|
-
deferred = async($this.
|
|
512
|
-
var tmp0 = $this.
|
|
515
|
+
deferred = async($this.scope_1, VOID, VOID, AttoWorkerCache$delegateWork$slambda(delegate, target, $this));
|
|
516
|
+
var tmp0 = $this.cache_1;
|
|
513
517
|
// Inline function 'kotlin.collections.set' call
|
|
514
518
|
var value = deferred;
|
|
515
|
-
tmp0.
|
|
519
|
+
tmp0.put_4fpzoq_k$(target, value);
|
|
516
520
|
return deferred;
|
|
517
521
|
}finally {
|
|
518
|
-
this_0.
|
|
522
|
+
this_0.unlock_ulcrcl_k$(null);
|
|
519
523
|
}
|
|
520
524
|
}
|
|
521
525
|
function AttoWorkerCache$delegateWork$slambda($delegate, $target, this$0) {
|
|
522
|
-
return constructCallableReference(
|
|
526
|
+
return constructCallableReference(($this$async, $completion) => orPromise($completion, function *($completion) {
|
|
523
527
|
var tmp;
|
|
524
528
|
try {
|
|
525
|
-
return yield* $delegate($target, $completion);
|
|
529
|
+
return yield* $($delegate($target, $completion), $completion);
|
|
526
530
|
} catch ($p) {
|
|
527
531
|
var tmp_0;
|
|
528
532
|
if ($p instanceof Exception) {
|
|
529
533
|
var e = $p;
|
|
530
534
|
// Inline function 'kotlinx.coroutines.sync.withLock' call
|
|
531
|
-
var this_0 = this$0.
|
|
532
|
-
yield* this_0.
|
|
535
|
+
var this_0 = this$0.mutex_1;
|
|
536
|
+
yield* this_0.lock_ugrcvf_k$(null, $completion);
|
|
533
537
|
var tmp_1;
|
|
534
538
|
try {
|
|
535
|
-
tmp_1 = this$0.
|
|
539
|
+
tmp_1 = this$0.cache_1.remove_gppy8k_k$($target);
|
|
536
540
|
}finally {
|
|
537
|
-
this_0.
|
|
541
|
+
this_0.unlock_ulcrcl_k$(null);
|
|
538
542
|
}
|
|
539
543
|
throw e;
|
|
540
544
|
} else {
|
|
541
545
|
throw $p;
|
|
542
546
|
}
|
|
543
547
|
}
|
|
544
|
-
}, 1);
|
|
548
|
+
}), 1);
|
|
545
549
|
}
|
|
546
550
|
function AttoWorkerCache$work$slambda(this$0, $threshold) {
|
|
547
|
-
return constructCallableReference(
|
|
548
|
-
return yield* this$0.
|
|
549
|
-
}, 1);
|
|
551
|
+
return constructCallableReference((it, $completion) => orPromise($completion, function *($completion) {
|
|
552
|
+
return yield* this$0.delegate_1.work_87s8mv_k$($threshold, it, $completion);
|
|
553
|
+
}), 1);
|
|
550
554
|
}
|
|
551
555
|
function AttoWorkerCache$work$slambda_0(this$0, $network, $timestamp) {
|
|
552
|
-
return constructCallableReference(
|
|
553
|
-
return yield* this$0.
|
|
554
|
-
}, 1);
|
|
556
|
+
return constructCallableReference((it, $completion) => orPromise($completion, function *($completion) {
|
|
557
|
+
return yield* this$0.delegate_1.work_qtc4fi_k$($network, $timestamp, it, $completion);
|
|
558
|
+
}), 1);
|
|
555
559
|
}
|
|
556
560
|
function AttoWorkerCache$work$slambda_1(this$0, $block) {
|
|
557
|
-
return constructCallableReference(
|
|
558
|
-
return yield* this$0.
|
|
559
|
-
}, 1);
|
|
561
|
+
return constructCallableReference((it, $completion) => orPromise($completion, function *($completion) {
|
|
562
|
+
return yield* this$0.delegate_1.work_uniq4r_k$($block, $completion);
|
|
563
|
+
}), 1);
|
|
560
564
|
}
|
|
561
565
|
function AttoWorkerCache$work$slambda_2(this$0, $block) {
|
|
562
|
-
return constructCallableReference(
|
|
563
|
-
return yield* this$0.
|
|
564
|
-
}, 1);
|
|
566
|
+
return constructCallableReference((it, $completion) => orPromise($completion, function *($completion) {
|
|
567
|
+
return yield* this$0.delegate_1.work_qtc4fi_k$($block.network, Companion_instance_0.now(), it, $completion);
|
|
568
|
+
}), 1);
|
|
565
569
|
}
|
|
566
570
|
function AttoWorkerCpu$work$lambda($workJob) {
|
|
567
571
|
return (cause) => {
|
|
568
572
|
var tmp;
|
|
569
573
|
if (!(cause == null)) {
|
|
570
|
-
$workJob.
|
|
574
|
+
$workJob.cancel$default_8haxne_k$();
|
|
571
575
|
tmp = Unit_instance;
|
|
572
576
|
}
|
|
573
577
|
return Unit_instance;
|
|
574
578
|
};
|
|
575
579
|
}
|
|
576
580
|
function tryComplete($this, work) {
|
|
577
|
-
if (!Companion_instance.
|
|
581
|
+
if (!Companion_instance.isValid_6ggp82_k$($this.threshold_1, $this.target_1, work)) {
|
|
578
582
|
return false;
|
|
579
583
|
}
|
|
580
584
|
// Inline function 'kotlin.collections.copyOf' call
|
|
581
585
|
// Inline function 'kotlin.js.asDynamic' call
|
|
582
586
|
var tmp$ret$0 = work.slice();
|
|
583
|
-
return $this.
|
|
587
|
+
return $this.result_1.complete_ixf84q_k$(new AttoWork(tmp$ret$0));
|
|
584
588
|
}
|
|
585
589
|
function incrementByteArray($this, byteArray) {
|
|
586
590
|
var carry = 1;
|
|
@@ -598,12 +602,12 @@ function incrementByteArray($this, byteArray) {
|
|
|
598
602
|
}
|
|
599
603
|
function WorkerController$result$lambda(this$0) {
|
|
600
604
|
return (it) => {
|
|
601
|
-
cancel(this$0.
|
|
605
|
+
cancel(this$0.scope_1);
|
|
602
606
|
return Unit_instance;
|
|
603
607
|
};
|
|
604
608
|
}
|
|
605
609
|
function WorkerController$calculate$slambda($i, $rangeSize, this$0) {
|
|
606
|
-
return constructCallableReference(
|
|
610
|
+
return constructCallableReference(($this$launch, $completion) => orPromise($completion, function *($completion) {
|
|
607
611
|
// Inline function 'kotlin.toULong' call
|
|
608
612
|
var this_0 = $i;
|
|
609
613
|
var tmp0 = _ULong___init__impl__c78o9k(fromInt(this_0));
|
|
@@ -616,7 +620,7 @@ function WorkerController$calculate$slambda($i, $rangeSize, this$0) {
|
|
|
616
620
|
var work = toByteArray(start);
|
|
617
621
|
var current = start;
|
|
618
622
|
var iterationsUntilYield = 4096;
|
|
619
|
-
while (!(current
|
|
623
|
+
while (!equals(new ULong(current), new ULong(end)) && get_isActive($this$launch)) {
|
|
620
624
|
if (tryComplete(this$0, work))
|
|
621
625
|
return Unit_instance;
|
|
622
626
|
incrementByteArray(this$0, work);
|
|
@@ -630,7 +634,7 @@ function WorkerController$calculate$slambda($i, $rangeSize, this$0) {
|
|
|
630
634
|
}
|
|
631
635
|
}
|
|
632
636
|
return Unit_instance;
|
|
633
|
-
}, 1);
|
|
637
|
+
}), 1);
|
|
634
638
|
}
|
|
635
639
|
function AttoWorkerOperations$Request$Companion$$childSerializers$_anonymous__k0cb7d() {
|
|
636
640
|
return createSimpleEnumSerializer('cash.atto.commons.AttoNetwork', values());
|
|
@@ -658,21 +662,21 @@ function $serializer_getInstance_0() {
|
|
|
658
662
|
return $serializer_instance_0;
|
|
659
663
|
}
|
|
660
664
|
function defaultCpuWorker() {
|
|
661
|
-
return Companion_instance_1.
|
|
665
|
+
return Companion_instance_1.cpu_o7vd24_k$(_UShort___init__impl__jigrne(1));
|
|
662
666
|
}
|
|
663
667
|
//region block: post-declaration
|
|
664
668
|
initMetadataForCompanion(Companion);
|
|
665
669
|
initMetadataForInterface(AttoWorker, 'AttoWorker', VOID, VOID, [AutoCloseable], [2, 3, 1]);
|
|
666
670
|
initMetadataForClass(AttoWorkerCache, 'AttoWorkerCache', VOID, VOID, [AttoWorker], [2, 3, 1]);
|
|
667
|
-
protoOf(AttoWorkerCpu).
|
|
668
|
-
protoOf(AttoWorkerCpu).
|
|
671
|
+
protoOf(AttoWorkerCpu).work_qtc4fi_k$ = work;
|
|
672
|
+
protoOf(AttoWorkerCpu).work_uniq4r_k$ = work_0;
|
|
669
673
|
initMetadataForClass(AttoWorkerCpu, 'AttoWorkerCpu', VOID, VOID, [AttoWorker], [2, 3, 1]);
|
|
670
674
|
initMetadataForClass(WorkerController, 'WorkerController', VOID, VOID, VOID, [0]);
|
|
671
675
|
initMetadataForCompanion(Companion_0);
|
|
672
|
-
protoOf($serializer).
|
|
676
|
+
protoOf($serializer).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers;
|
|
673
677
|
initMetadataForObject($serializer, '$serializer', VOID, VOID, [GeneratedSerializer]);
|
|
674
678
|
initMetadataForCompanion(Companion_1);
|
|
675
|
-
protoOf($serializer_0).
|
|
679
|
+
protoOf($serializer_0).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers;
|
|
676
680
|
initMetadataForObject($serializer_0, '$serializer', VOID, VOID, [GeneratedSerializer]);
|
|
677
681
|
initMetadataForClass(Request, 'Request', VOID, VOID, VOID, VOID, VOID, {0: $serializer_getInstance});
|
|
678
682
|
initMetadataForClass(Response, 'Response', VOID, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_0});
|
|
@@ -693,9 +697,9 @@ export {
|
|
|
693
697
|
AttoWorkerOperations as AttoWorkerOperations1gnkwfcdzd0wa,
|
|
694
698
|
cached as cached1s4yf99twpuut,
|
|
695
699
|
toAsync as toAsync10i9ow1f352l5,
|
|
696
|
-
Companion_instance_1 as
|
|
697
|
-
work_0 as
|
|
698
|
-
work_1 as
|
|
700
|
+
Companion_instance_1 as Companion_instance7s716lzs1l85,
|
|
701
|
+
work_0 as work1yjb62hcp0x3a,
|
|
702
|
+
work_1 as work3lctluiffi34a,
|
|
699
703
|
};
|
|
700
704
|
//endregion
|
|
701
705
|
|