This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.0.0' into 561-rewrite-tx-pool
- Loading branch information
Showing
92 changed files
with
4,555 additions
and
2,408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
'use strict'; | ||
|
||
var _ = require('lodash'); | ||
|
||
// Private Fields | ||
var modules; | ||
|
||
/** | ||
* Initializes with scope content and private variables: | ||
* - modules | ||
* @class AccountsController | ||
* @classdesc Main System methods. | ||
* @param {scope} scope - App instance. | ||
*/ | ||
function AccountsController (scope) { | ||
modules = scope.modules; | ||
} | ||
|
||
AccountsController.getAccounts = function (context, next) { | ||
var params = context.request.swagger.params; | ||
|
||
var filters = { | ||
address: params.address.value, | ||
publicKey: params.publicKey.value, | ||
secondPublicKey: params.secondPublicKey.value, | ||
username: params.username.value, | ||
limit: params.limit.value, | ||
offset: params.offset.value, | ||
sort: params.sort.value | ||
}; | ||
|
||
// Remove filters with null values | ||
filters = _.pickBy(filters, function (v) { | ||
return !(v === undefined || v === null); | ||
}); | ||
|
||
modules.accounts.shared.getAccounts(_.clone(filters), function (err, data) { | ||
if (err) { return next(err); } | ||
|
||
data = _.cloneDeep(data); | ||
|
||
data = _.map(data, function (account) { | ||
if (_.isEmpty(account.delegate)) { | ||
delete account.delegate; | ||
} else { | ||
account.delegate.rank = parseInt(account.delegate.rank); | ||
account.delegate.missedBlocks = parseInt(account.delegate.missedBlocks); | ||
account.delegate.producedBlocks = parseInt(account.delegate.producedBlocks); | ||
} | ||
if (_.isNull(account.secondPublicKey)) { | ||
account.secondPublicKey = ''; | ||
} | ||
delete account.secondSignature; | ||
delete account.unconfirmedSignature; | ||
return account; | ||
}); | ||
|
||
next(null, { | ||
data: data, | ||
meta: { | ||
offset: filters.offset, | ||
limit: filters.limit | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
module.exports = AccountsController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
var _ = require('lodash'); | ||
|
||
// Private Fields | ||
var modules; | ||
|
||
/** | ||
* Initializes with scope content and private variables: | ||
* - modules | ||
* @class DappsController | ||
* @classdesc Main System methods. | ||
* @param {scope} scope - App instance. | ||
*/ | ||
function DappsController (scope) { | ||
modules = scope.modules; | ||
} | ||
|
||
DappsController.getDapps = function (context, next) { | ||
var params = context.request.swagger.params; | ||
|
||
var filters = { | ||
transactionId: params.transactionId.value, | ||
name: params.name.value, | ||
sort: params.sort.value, | ||
limit: params.limit.value, | ||
offset: params.offset.value | ||
}; | ||
|
||
// Remove filters with null values | ||
filters = _.pickBy(filters, function (v) { | ||
return !(v === undefined || v === null); | ||
}); | ||
|
||
modules.dapps.shared.getDapps(_.clone(filters), function (err, data) { | ||
try { | ||
if (err) { return next(err); } | ||
|
||
next(null, { | ||
data: data, | ||
meta: { | ||
offset: filters.offset, | ||
limit: filters.limit | ||
} | ||
}); | ||
|
||
} catch (error) { | ||
next(error); | ||
} | ||
}); | ||
}; | ||
|
||
module.exports = DappsController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.