@heathmont/lab-flask
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -62,4 +62,4 @@ import 'source-map-support/register'; | ||
bigNumberToUDecimal: (bigNumber: import("bignumber.js").BigNumber) => Proto.Global.UDecimal; | ||
toMoney: (amount: import("bignumber.js").BigNumber, currency: Proto.Global.CurrencyCode) => Proto.Global.Money; | ||
toUMoney: (amount: import("bignumber.js").BigNumber, currency: Proto.Global.CurrencyCode) => Proto.Global.UMoney; | ||
toMoney: (amount: import("bignumber.js").BigNumber, currency: string) => Proto.Global.Money; | ||
toUMoney: (amount: import("bignumber.js").BigNumber, currency: string) => Proto.Global.UMoney; | ||
Google: typeof Google; | ||
@@ -66,0 +66,0 @@ Proto: typeof Proto; |
@@ -5,11 +5,11 @@ import { Proto } from '@heathmont/coingaming-protobuf'; | ||
amount: BigNumber; | ||
currencyCode: Proto.Global.CurrencyCode; | ||
currencyCode: string; | ||
} | ||
export interface UMoney { | ||
amount: BigNumber; | ||
currencyCode: Proto.Global.CurrencyCode; | ||
currencyCode: string; | ||
} | ||
export declare const moneyHelper: (money: Proto.Global.Money) => Money; | ||
export declare const umoneyHelper: (money: Proto.Global.UMoney) => Money; | ||
export declare const toMoney: (amount: BigNumber, currency: Proto.Global.CurrencyCode) => Proto.Global.Money; | ||
export declare const toUMoney: (amount: BigNumber, currency: Proto.Global.CurrencyCode) => Proto.Global.UMoney; | ||
export declare const toMoney: (amount: BigNumber, currency: string) => Proto.Global.Money; | ||
export declare const toUMoney: (amount: BigNumber, currency: string) => Proto.Global.UMoney; |
@@ -9,3 +9,3 @@ "use strict"; | ||
amount: decimalToBigNumber_1.decimalToBigNumber(money.amount), | ||
currencyCode: money.currencyCode.value, | ||
currencyCode: coingaming_protobuf_1.Proto.Global.CurrencyCode[money.currencyCode.value], | ||
}; | ||
@@ -16,3 +16,3 @@ }; | ||
amount: decimalToBigNumber_1.udecimalToBigNumber(money.amount), | ||
currencyCode: money.currencyCode.value, | ||
currencyCode: coingaming_protobuf_1.Proto.Global.CurrencyCode[money.currencyCode.value], | ||
}; | ||
@@ -23,3 +23,4 @@ }; | ||
amount: bigNumberToDecimal_1.bigNumberToDecimal(amount), | ||
currencyCode: currency ? coingaming_protobuf_1.Proto.Global.CurrencyCodeValue.create({ value: currency }) : null, | ||
currencyCode: currency ? | ||
coingaming_protobuf_1.Proto.Global.CurrencyCodeValue.create({ value: coingaming_protobuf_1.Proto.Global.CurrencyCode[currency] }) : null, | ||
}); | ||
@@ -30,5 +31,6 @@ }; | ||
amount: bigNumberToDecimal_1.bigNumberToUDecimal(amount), | ||
currencyCode: currency ? coingaming_protobuf_1.Proto.Global.CurrencyCodeValue.create({ value: currency }) : null, | ||
currencyCode: currency ? | ||
coingaming_protobuf_1.Proto.Global.CurrencyCodeValue.create({ value: coingaming_protobuf_1.Proto.Global.CurrencyCode[currency] }) : null, | ||
}); | ||
}; | ||
//# sourceMappingURL=moneyHelper.js.map |
{ | ||
"name": "@heathmont/lab-flask", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": "Margus Lamp", | ||
@@ -50,3 +50,4 @@ "main": "./dist/index.js", | ||
"test:watch": "jest --watch", | ||
"test:coverage": "jest --coverage" | ||
"test:coverage": "jest --coverage", | ||
"prepack": "npm run test && npm run lint && npm run compile" | ||
}, | ||
@@ -53,0 +54,0 @@ "jest": { |
@@ -140,3 +140,3 @@ import axios from 'axios'; | ||
expect(expressServer.post).toBeCalledTimes(3); | ||
expect(expressServer.post.mock.calls[0][0]).toBe('/lab-implementation/protobuf'); | ||
expect(expressServer.post.mock.calls[0][0]).toBe('/lab-implementation/protobuf*'); | ||
const substanceCall = expressServer.post.mock.calls[0][1]; | ||
@@ -143,0 +143,0 @@ expect(typeof substanceCall).toBe('function'); |
@@ -20,3 +20,3 @@ import { Proto } from '@heathmont/coingaming-protobuf'; | ||
expect(moneyOut.amount.toString()).toBe('123.456'); | ||
expect(moneyOut.currencyCode).toBe(Proto.Global.CurrencyCode.BTC); | ||
expect(moneyOut.currencyCode).toBe(Proto.Global.CurrencyCode[Proto.Global.CurrencyCode.BTC]); | ||
}); | ||
@@ -35,5 +35,5 @@ | ||
expect(moneyOut.amount.toString()).toBe('123.456'); | ||
expect(moneyOut.currencyCode).toBe(Proto.Global.CurrencyCode.EUR); | ||
expect(moneyOut.currencyCode).toBe(Proto.Global.CurrencyCode[Proto.Global.CurrencyCode.EUR]); | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ import { Proto } from '@heathmont/coingaming-protobuf'; | ||
amount: BigNumber; | ||
currencyCode: Proto.Global.CurrencyCode; | ||
currencyCode: string; | ||
} | ||
@@ -14,3 +14,3 @@ | ||
amount: BigNumber; | ||
currencyCode: Proto.Global.CurrencyCode; | ||
currencyCode: string; | ||
} | ||
@@ -21,3 +21,3 @@ | ||
amount: decimalToBigNumber(money.amount), | ||
currencyCode: money.currencyCode.value, | ||
currencyCode: Proto.Global.CurrencyCode[money.currencyCode.value], | ||
}; | ||
@@ -29,18 +29,20 @@ }; | ||
amount: udecimalToBigNumber(money.amount), | ||
currencyCode: money.currencyCode.value, | ||
currencyCode: Proto.Global.CurrencyCode[money.currencyCode.value], | ||
}; | ||
}; | ||
export const toMoney = (amount: BigNumber, currency: Proto.Global.CurrencyCode): Proto.Global.Money => { | ||
export const toMoney = (amount: BigNumber, currency: string): Proto.Global.Money => { | ||
return Proto.Global.Money.create({ | ||
amount: bigNumberToDecimal(amount), | ||
currencyCode: currency ? Proto.Global.CurrencyCodeValue.create({ value: currency }) : null, | ||
currencyCode: currency ? | ||
Proto.Global.CurrencyCodeValue.create({ value: Proto.Global.CurrencyCode[currency] }) : null, | ||
}); | ||
}; | ||
export const toUMoney = (amount: BigNumber, currency: Proto.Global.CurrencyCode): Proto.Global.UMoney => { | ||
export const toUMoney = (amount: BigNumber, currency: string): Proto.Global.UMoney => { | ||
return Proto.Global.UMoney.create({ | ||
amount: bigNumberToUDecimal(amount), | ||
currencyCode: currency ? Proto.Global.CurrencyCodeValue.create({ value: currency }) : null, | ||
currencyCode: currency ? | ||
Proto.Global.CurrencyCodeValue.create({ value: Proto.Global.CurrencyCode[currency] }) : null, | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
102090
1842