-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename getTotalCreditsOnPlatform (#2056)
- Loading branch information
1 parent
c554062
commit e8fc49e
Showing
8 changed files
with
73 additions
and
73 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...lient/lib/methods/platform/getTotalCreditsOnPlatform/GetTotalCreditsInPlatformResponse.js
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,46 @@ | ||
const AbstractResponse = require('../response/AbstractResponse'); | ||
const InvalidResponseError = require('../response/errors/InvalidResponseError'); | ||
|
||
class GetTotalCreditsInPlatformResponse extends AbstractResponse { | ||
/** | ||
* @param {number} totalCreditsInPlatform | ||
* @param {Metadata} metadata | ||
* @param {Proof} [proof] | ||
*/ | ||
constructor(totalCreditsInPlatform, metadata, proof = undefined) { | ||
super(metadata, proof); | ||
|
||
this.totalCreditsInPlatform = totalCreditsInPlatform; | ||
} | ||
|
||
/** | ||
* @returns {number} | ||
*/ | ||
getTotalCreditsInPlatform() { | ||
return this.totalCreditsInPlatform; | ||
} | ||
|
||
/** | ||
* @param proto | ||
* @returns {GetTotalCreditsInPlatformResponse} | ||
*/ | ||
static createFromProto(proto) { | ||
// eslint-disable-next-line | ||
const totalCreditsInPlatform = proto.getV0().getTotalCreditsInPlatform(); | ||
const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto( | ||
proto, | ||
); | ||
|
||
if ((typeof totalCreditsInPlatform === 'undefined' || totalCreditsInPlatform === null) && !proof) { | ||
throw new InvalidResponseError('Total Credits on Platform data is not defined'); | ||
} | ||
|
||
return new GetTotalCreditsInPlatformResponse( | ||
totalCreditsInPlatform, | ||
metadata, | ||
proof, | ||
); | ||
} | ||
} | ||
|
||
module.exports = GetTotalCreditsInPlatformResponse; |
46 changes: 0 additions & 46 deletions
46
...lient/lib/methods/platform/getTotalCreditsOnPlatform/GetTotalCreditsOnPlatformResponse.js
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