Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
values(): StackItemEnumerator<> {
const iterable = AsyncIterableX.from(this.enumerator).pipe(
map(({ value }) => ({ value })),
);
return new StackItemEnumerator(this._getIterator(iterable));
}
}
keys(): StackItemEnumerator<> {
const iterable = AsyncIterableX.from(this.enumerator).pipe(
map(({ key }) => ({ value: key })),
);
return new StackItemEnumerator(this._getIterator(iterable));
}
async _start(options: InternalOptions): Promise {
this._monitor.log({
name: 'neo_consensus_start',
message: 'Consensus started.',
level: 'verbose',
});
const initialResult = await initializeNewConsensus({
blockchain: this._node.blockchain,
publicKey: options.publicKey,
consensusContext: this._consensusContext,
});
await AsyncIterableX.from((this._queue: $FlowFixMe))
.pipe(
scan(async (context: Context, event: Event) => {
let result;
switch (event.type) {
case 'handlePersistBlock':
result = await handlePersistBlock({
blockchain: this._node.blockchain,
publicKey: options.publicKey,
consensusContext: this._consensusContext,
});
break;
case 'handleConsensusPayload':
result = await handleConsensusPayload({
context,
node: this._node,
privateKey: options.privateKey,
this._getAllStorage(hash).then(res => AsyncIterableX.from(res)),
).pipe(flatten());
iterStorage(hash: Hash160Like): AsyncIterable {
return AsyncIterableX.from(
this._getAllStorage(hash).then(res => AsyncIterableX.from(res)),
).pipe(flatten());
}
iterActions(filterIn?: GetActionsFilter): AsyncIterable {
const filter = filterIn || {};
return AsyncIterableX.from(
this.iterBlocks({
indexStart: filter.blockIndexStart,
indexStop: filter.blockIndexStop,
}),
).pipe(
flatMap(async block => {
const actions = await this._getActions({
blockIndexStart: block.index,
transactionIndexStart:
block.index === filter.blockIndexStart
? filter.transactionIndexStart
: undefined,
indexStart:
block.index === filter.blockIndexStart
? filter.indexStart
: undefined,
smartContract.iterEvents = (
actionFilter?: ActionFilter,
): AsyncIterable =>
AsyncIterableX.from(smartContract.iterActions(actionFilter)).pipe(
map(action => {
if (action.type === 'Log') {
return (null: $FlowFixMe);
}
if (action.args.length === 0) {
throw new NotificationMissingEventError(action);
}
const event = client.parameters.toString(action.args[0]);
return {
name: event,
parameters: getParametersObject({
client,
abiParameters: events[event].parameters,
parameters: action.args.slice(1),