本文整理汇总了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)); }
}
示例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);
}
}
示例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);
})
});
}