Skip to content

Commit

Permalink
Merge pull request #112 from mysteriumnetwork/improvements/balance
Browse files Browse the repository at this point in the history
Pass comperhensible ethereum monetary values
  • Loading branch information
mdomasevicius authored Feb 3, 2022
2 parents ad5f5b9 + a866f63 commit 70cc10c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ci": "yarn tsc-check && yarn lint && yarn test-all && yarn build"
},
"peerDependencies": {
"@mysteriumnetwork/node": ">= 1.2.0 < 2"
"@mysteriumnetwork/node": ">= 1.2.5 < 2"
},
"devDependencies": {
"@types/jest": "^27.0.1",
Expand Down
11 changes: 11 additions & 0 deletions src/common/tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2021 BlockDev AG
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export interface Tokens {
wei: string
ether: string
human: string
}
5 changes: 5 additions & 0 deletions src/identity/identity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ describe('TequilapiClient DTO', () => {
registrationStatus: 'Promoting',
channelAddress: '0xCe93E5A58B20bF3204f8400918C9dd8D28471C8F',
balance: 3888150908128711894,
balanceTokens: {
wei: '3888150908128711894',
ether: '3.888150908128711894',
human: '3.888150',
},
earnings: 0,
earningsTotal: 2557762453645780,
stake: 12000000000000000000,
Expand Down
6 changes: 6 additions & 0 deletions src/identity/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import { Tokens } from '../common/tokens'
import { validate, validateMultiple } from '../fmt/validation'

export interface IdentityRef {
Expand Down Expand Up @@ -42,7 +43,11 @@ export interface Identity {
id: string
registrationStatus: IdentityRegistrationStatus
channelAddress: string
/**
* @deprecated use balanceTokens
*/
balance: number
balanceTokens: Tokens
earnings: number
earningsTotal: number
stake: number
Expand All @@ -59,6 +64,7 @@ export function parseIdentity(data: any): Identity {
{ name: 'registrationStatus', type: 'string' },
{ name: 'channelAddress', type: 'string' },
{ name: 'balance', type: 'number' },
{ name: 'balanceTokens', type: 'object' },
{ name: 'earnings', type: 'number' },
{ name: 'earningsTotal', type: 'number' },
{ name: 'stake', type: 'number' },
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export { TequilapiError, AxiosError } from './tequilapi-error'

export { MMNReport, MMNApiKeyResponse, MMNReportResponse } from './mmn/mmn'
export { Pageable } from './common/pageable'
export { Tokens } from './common/tokens'

export {
PaymentAPI,
Expand Down

0 comments on commit 70cc10c

Please sign in to comment.