How to use the @reactivex/ix-es2015-cjs/asynciterable/asynciterablex.AsyncIterableX.from function in @reactivex/ix-es2015-cjs

To help you get started, we’ve selected a few @reactivex/ix-es2015-cjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neo-one-suite / neo-one / packages / neo-one-client-core / src / provider / NEOONEDataProvider.ts View on Github external
public iterStorage(address: AddressString): AsyncIterable {
    return AsyncIterableX.from(this.mutableClient.getAllStorage(address).then((res) => AsyncIterableX.from(res))).pipe(
      // tslint:disable-next-line no-any
      flatten() as any,
      map((storageItem) => this.convertStorageItem(storageItem)),
    );
  }
github neo-one-suite / neo-one / packages / neo-one-node-vm / src / stackItem / StackItemEnumerator.ts View on Github external
public concat(
    other: StackItemEnumerator,
  ): StackItemEnumerator {
    const iterable = concat(
      AsyncIterableX.from(this.enumerator as AsyncIterableIterator),
      AsyncIterableX.from(other.enumerator as AsyncIterableIterator),
    );

    return new StackItemEnumerator(iterable[Symbol.asyncIterator]());
  }
}
github neo-one-suite / neo-one / packages / neo-one-node-vm / src / stackItem / StackItemEnumerator.ts View on Github external
public concat(
    other: StackItemEnumerator,
  ): StackItemEnumerator {
    const iterable = concat(
      AsyncIterableX.from(this.enumerator as AsyncIterableIterator),
      AsyncIterableX.from(other.enumerator as AsyncIterableIterator),
    );

    return new StackItemEnumerator(iterable[Symbol.asyncIterator]());
  }
}
github neo-one-suite / neo-one / packages / neo-one-client-core / src / sc / createSmartContract.ts View on Github external
const iterActionsRaw = ({
    network = client.getCurrentNetwork(),
    ...iterOptions
  }: SmartContractIterOptions = {}): AsyncIterable =>
    AsyncIterableX.from(client.__iterActionsRaw(network, iterOptions)).pipe(
      filter((action) => action.address === definition.networks[network].address),
    );
github neo-one-suite / neo-one / packages / neo-one-client / src / sc / createReadSmartContract.ts View on Github external
const iterEvents = (actionFilter?: BlockFilter): AsyncIterable =>
    AsyncIterableX.from(iterActions(actionFilter)).pipe(
      map((action) => {
        if (action.type === 'Log') {
          return undefined;
        }

        return action;
      }),
      filter(Boolean),
    );
github neo-one-suite / neo-one / packages / neo-one-client-core / src / sc / createSmartContract.ts View on Github external
const iterActions = (options?: SmartContractIterOptions): AsyncIterable =>
    AsyncIterableX.from(iterActionsRaw(options)).pipe(
      map(convertAction),
      filter(utils.notNull),
    );
github neo-one-suite / neo-one / packages / neo-one-node-vm / src / syscalls.ts View on Github external
invoke: async ({ context, args }) => {
      const hash = vmUtils.toStorageContext({ context, value: args[0] }).value;
      await checkStorage({ context, hash });

      const prefix = args[1].asBuffer();
      const iterable = AsyncIterableX.from(context.blockchain.storageItem.getAll$({ hash, prefix })).pipe<{
        key: BufferStackItem;
        value: BufferStackItem;
      }>(
        asyncMap(({ key, value }) => ({
          key: new BufferStackItem(key),
          value: new BufferStackItem(value),
        })),
      );

      return {
        context,
        results: [new IteratorStackItem(new StackItemIterator(iterable[Symbol.asyncIterator]()))],
      };
    },
  }),
github neo-one-suite / neo-one / packages / neo-one-client-core / src / provider / NEOONEOneDataProvider.ts View on Github external
public iterActionsRaw(options: IterOptions = {}): AsyncIterable {
    return AsyncIterableX.from(this.getProvider()).pipe(
      flatMap((provider) => provider.iterActionsRaw(options)),
    );
  }
github neo-one-suite / neo-one / packages / neo-one-node-consensus / src / Consensus.ts View on Github external
private async startInternal(options: InternalOptions): Promise {
    logger.info({ name: 'neo_consensus_start' }, 'Consensus started.');

    const initialResult = await initializeNewConsensus({
      blockchain: this.node.blockchain,
      publicKey: options.publicKey,
      consensusContext: this.mutableConsensusContext,
    });

    await AsyncIterableX.from(this.mutableQueue)
      .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.mutableConsensusContext,
              });

              break;
            case 'handleConsensusPayload':
              result = await handleConsensusPayload({
                context,
                node: this.node,