How to use @cennznet/types - 1 common examples

To help you get started, we’ve selected a few @cennznet/types 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 cennznet / runanode / app / renderer / api / api.js View on Github external
saveStakingPreferences = async (
    wallet: TheWallet,
    prefs: any,
    accountAddress: string
  ): Promise => {
    Logger.debug('api::saveStakingPreferences called');
    Logger.debug(`wallet: ${JSON.stringify(wallet)}`);
    try {
      const originalWallet = this.reloadWallet(wallet);
      await originalWallet.unlock(''); // TODO switch to pin code
      Logger.debug('api::saveStakingPreferences unlock');

      this.api.setSigner(originalWallet);
      Logger.debug('api::saveStakingPreferences setSigner');

      const validatorPrefs = new ValidatorPrefs(prefs);
      const intentionIndex = await this.getIntentionIndex(accountAddress);
      const txHash = await this.api.tx.staking
        .registerPreferences(intentionIndex, validatorPrefs)
        .signAndSend(accountAddress);
      Logger.debug(`api::saveStakingPreferences txHash ${txHash}`);
      return txHash;
    } catch (error) {
      Logger.error('api::saveStakingPreferences error: ' + stringifyError(error));
      throw new GenericApiError();
    }
  };

@cennznet/types

Additional type definitions for the CENNZnet runtime

Apache-2.0
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Popular @cennznet/types functions