当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript api.setOptions方法代码示例

本文整理汇总了TypeScript中steem.api.setOptions方法的典型用法代码示例。如果您正苦于以下问题:TypeScript api.setOptions方法的具体用法?TypeScript api.setOptions怎么用?TypeScript api.setOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在steem.api的用法示例。


在下文中一共展示了api.setOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: isValidAccount

// Checks if the public with the private key are valid.
function isValidAccount(req: any, res: any, next: any) {
    steem.api.setOptions({ url: 'https://api.steemit.com' });
    try {
        if (steem.auth.wifIsValid(req.body.acc.key, req.body.acc.publicKey)) {
            next();
        } else {
            return res.status(401).send(new Error(StatusMessages._401));
        }
    } catch (err) { return res.status(401).send(new Error(StatusMessages._401)); }
}
开发者ID:damisv,项目名称:steemBotJobs,代码行数:11,代码来源:index.ts

示例2: start

 public async start() {
     steem.api.setOptions({ url: 'https://api.steemit.com' });
     const exists = await DBClient.findOne({_id: this.jobID}, 'logs');
     if (exists === null) {
         await DBClient.insertOne({_id: this.jobID, logs: []}, 'logs');
     }
     try {
         const count: {[key: string]: any} = await this.getCount();
         const followers = await this.getFollowers(count['follower_count']);
         const following = await this.getFollowing(count['following_count']);
         let temp = await this.getUsersToBeFollowed(followers, following, this.user);
         if (temp.length > 0) {
             await this.sendLog('log', `SHOULD FOLLOW --> ${temp.length} users`);
             this.follow(temp);
         } else {
             await this.sendLog('log', `${this.user} FOLLOWS EVERY FOLLOWER ALREADY`);
         }
     } catch (error) {
         await this.sendLog('error', error);
     }
 }
开发者ID:damisv,项目名称:steemBotJobs,代码行数:21,代码来源:steem.ts

示例3: getContent

import * as steem from 'steem';
import config from '../config/config';

steem.api.setOptions({ url: config.steemNode });

export function getContent(author: string, permlink: string): Promise<any> {
  return new Promise((resolve, reject) => {
    steem.api.getContent(author, permlink, (e, p) => {
      if (e) return reject(e);
      resolve(p);
    });
  });
}

export function getDiscussionsByBlog(query: any): Promise<any[]> {
  return new Promise((resolve, reject) => {
    steem.api.getDiscussionsByBlog(query, (e, props) => {
      if (e) return reject(e);
      resolve(props);
    })
  });
}

export function getDynamicGlobalProperties(): Promise<any> {
  return new Promise((resolve, reject) => {
    steem.api.getDynamicGlobalProperties((e, props) => {
      if (e) return reject(e);
      resolve(props);
    })
  });
}
开发者ID:eastmaels,项目名称:v2.api.utopian.io,代码行数:31,代码来源:steemAPI.ts


注:本文中的steem.api.setOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。