Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
remove semi
Browse files Browse the repository at this point in the history
  • Loading branch information
decentraliser committed Jan 30, 2020
1 parent 9332c0e commit 5e87ddf
Show file tree
Hide file tree
Showing 274 changed files with 4,056 additions and 4,056 deletions.
38 changes: 19 additions & 19 deletions src/commands/account/aggregatebonded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,43 @@
* limitations under the License.
*
*/
import chalk from 'chalk';
import {command, metadata} from 'clime';
import {AccountHttp} from 'nem2-sdk';
import {AccountTransactionsCommand, AccountTransactionsOptions} from '../../interfaces/account.transactions.command';
import {AddressResolver} from '../../resolvers/address.resolver';
import {TransactionView} from '../../views/transactions/details/transaction.view';
import chalk from 'chalk'
import {command, metadata} from 'clime'
import {AccountHttp} from 'nem2-sdk'
import {AccountTransactionsCommand, AccountTransactionsOptions} from '../../interfaces/account.transactions.command'
import {AddressResolver} from '../../resolvers/address.resolver'
import {TransactionView} from '../../views/transactions/details/transaction.view'

@command({
description: 'Fetch aggregate bonded transactions from account',
})
export default class extends AccountTransactionsCommand {

constructor() {
super();
super()
}

@metadata
execute(options: AccountTransactionsOptions) {
this.spinner.start();
const profile = this.getProfile(options);
const address = new AddressResolver().resolve(options, profile);
this.spinner.start()
const profile = this.getProfile(options)
const address = new AddressResolver().resolve(options, profile)

const accountHttp = new AccountHttp(profile.url);
const accountHttp = new AccountHttp(profile.url)
accountHttp.getAccountPartialTransactions(address, options.getQueryParams())
.subscribe((transactions) => {
this.spinner.stop(true);
this.spinner.stop(true)
transactions.forEach((transaction) => {
new TransactionView(transaction).print();
});
new TransactionView(transaction).print()
})

if (!transactions.length) {
console.log('There aren\'t aggregate bonded transaction');
console.log('There aren\'t aggregate bonded transaction')
}
}, (err) => {
this.spinner.stop(true);
err = err.message ? JSON.parse(err.message) : err;
console.log(chalk.red('Error'), err.body && err.body.message ? err.body.message : err);
});
this.spinner.stop(true)
err = err.message ? JSON.parse(err.message) : err
console.log(chalk.red('Error'), err.body && err.body.message ? err.body.message : err)
})
}
}
50 changes: 25 additions & 25 deletions src/commands/account/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
* limitations under the License.
*
*/
import chalk from 'chalk';
import {command, metadata, option} from 'clime';
import {Account, SimpleWallet} from 'nem2-sdk';
import {AccountCredentialsTable, CreateProfileCommand, CreateProfileOptions} from '../../interfaces/create.profile.command';
import {DefaultResolver} from '../../resolvers/default.resolver';
import {GenerationHashResolver} from '../../resolvers/generationHash.resolver';
import {NetworkResolver} from '../../resolvers/network.resolver';
import {PasswordResolver} from '../../resolvers/password.resolver';
import {ProfileNameResolver} from '../../resolvers/profile.resolver';
import {SaveResolver} from '../../resolvers/save.resolver';
import {URLResolver} from '../../resolvers/url.resolver';
import chalk from 'chalk'
import {command, metadata, option} from 'clime'
import {Account, SimpleWallet} from 'nem2-sdk'
import {AccountCredentialsTable, CreateProfileCommand, CreateProfileOptions} from '../../interfaces/create.profile.command'
import {DefaultResolver} from '../../resolvers/default.resolver'
import {GenerationHashResolver} from '../../resolvers/generationHash.resolver'
import {NetworkResolver} from '../../resolvers/network.resolver'
import {PasswordResolver} from '../../resolvers/password.resolver'
import {ProfileNameResolver} from '../../resolvers/profile.resolver'
import {SaveResolver} from '../../resolvers/save.resolver'
import {URLResolver} from '../../resolvers/url.resolver'

export class CommandOptions extends CreateProfileOptions {
@option({
flag: 's',
description: '(Optional) Saves the profile.',
toggle: true,
})
save: any;
save: any
}

@command({
Expand All @@ -42,30 +42,30 @@ export class CommandOptions extends CreateProfileOptions {
export default class extends CreateProfileCommand {

constructor() {
super();
super()
}

@metadata
async execute(options: CommandOptions) {
const networkType = new NetworkResolver().resolve(options);
const save = new SaveResolver().resolve(options);
const networkType = new NetworkResolver().resolve(options)
const save = new SaveResolver().resolve(options)

const account = Account.generateNewAccount(networkType);
console.log(new AccountCredentialsTable(account).toString());
const account = Account.generateNewAccount(networkType)
console.log(new AccountCredentialsTable(account).toString())
if (save) {
options.url = new URLResolver().resolve(options);
const profileName = new ProfileNameResolver().resolve(options);
const password = new PasswordResolver().resolve(options);
const isDefault = new DefaultResolver().resolve(options);
const generationHash = await new GenerationHashResolver().resolve(options);
options.url = new URLResolver().resolve(options)
const profileName = new ProfileNameResolver().resolve(options)
const password = new PasswordResolver().resolve(options)
const isDefault = new DefaultResolver().resolve(options)
const generationHash = await new GenerationHashResolver().resolve(options)

const simpleWallet = SimpleWallet.createFromPrivateKey(
profileName,
password,
account.privateKey,
networkType);
this.createProfile(simpleWallet, networkType, options.url, isDefault, generationHash);
console.log( chalk.green('\nStored ' + profileName + ' profile'));
networkType)
this.createProfile(simpleWallet, networkType, options.url, isDefault, generationHash)
console.log( chalk.green('\nStored ' + profileName + ' profile'))
}
}
}
38 changes: 19 additions & 19 deletions src/commands/account/incoming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,44 @@
* limitations under the License.
*
*/
import chalk from 'chalk';
import {command, metadata} from 'clime';
import {AccountHttp} from 'nem2-sdk';
import {AccountTransactionsCommand, AccountTransactionsOptions} from '../../interfaces/account.transactions.command';
import {AddressResolver} from '../../resolvers/address.resolver';
import {TransactionView} from '../../views/transactions/details/transaction.view';
import chalk from 'chalk'
import {command, metadata} from 'clime'
import {AccountHttp} from 'nem2-sdk'
import {AccountTransactionsCommand, AccountTransactionsOptions} from '../../interfaces/account.transactions.command'
import {AddressResolver} from '../../resolvers/address.resolver'
import {TransactionView} from '../../views/transactions/details/transaction.view'

@command({
description: 'Fetch incoming transactions from account',
})
export default class extends AccountTransactionsCommand {

constructor() {
super();
super()
}

@metadata
execute(options: AccountTransactionsOptions) {
this.spinner.start();
this.spinner.start()

const profile = this.getProfile(options);
const address = new AddressResolver().resolve(options, profile);
const profile = this.getProfile(options)
const address = new AddressResolver().resolve(options, profile)

const accountHttp = new AccountHttp(profile.url);
const accountHttp = new AccountHttp(profile.url)
accountHttp.getAccountIncomingTransactions(address, options.getQueryParams())
.subscribe((transactions) => {
this.spinner.stop(true);
this.spinner.stop(true)
transactions.map((transaction) => {
new TransactionView(transaction).print();
});
new TransactionView(transaction).print()
})

if (!transactions.length) {
console.log('There aren\'t incoming transaction');
console.log('There aren\'t incoming transaction')
}
}, (err) => {
this.spinner.stop(true);
err = err.message ? JSON.parse(err.message) : err;
console.log(chalk.red('Error'), err.body && err.body.message ? err.body.message : err);
});
this.spinner.stop(true)
err = err.message ? JSON.parse(err.message) : err
console.log(chalk.red('Error'), err.body && err.body.message ? err.body.message : err)
})
}
}

0 comments on commit 5e87ddf

Please sign in to comment.