本文整理汇总了TypeScript中steem.api类的典型用法代码示例。如果您正苦于以下问题:TypeScript api类的具体用法?TypeScript api怎么用?TypeScript api使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了api类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Promise
return new Promise((resolve, reject) => {
steem.api.getFollowing(this.user, 0, 'blog', count,
(err: any, result: any) => err ? reject(err): resolve(result));
})
示例4: Promise
return new Promise((resolve, reject) => {
steem.api.getRewardFund('post', (e, fund) => {
if (e) return reject(e);
resolve(fund);
});
});