Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 15a3d70

Browse files
committed
fix: 🐛 use PascalDCase for FeeType enum members
also refactored the `getFees` method in the STR wrapper to take advantage of the enum BREAKING CHANGE: `FeeType` members `stLaunchFee` and `tickerRegFee` are now `StLaunchFee` and `TickerRegFee`
1 parent ce60906 commit 15a3d70

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

src/contract_wrappers/registries/__tests__/security_token_registry_wrapper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ describe('SecurityTokenRegistryWrapper', () => {
879879
// Params and result expected
880880
const expectedResult = [new BigNumber(10), new BigNumber(10)];
881881
const mockedParams = {
882-
feeType: FeeType.tickerRegFee,
882+
feeType: FeeType.TickerRegFee,
883883
};
884884
const bytes32 = stringToBytes32('tickerRegFee');
885885
// Mocked method

src/contract_wrappers/registries/security_token_registry_wrapper.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,22 +1133,13 @@ export default class SecurityTokenRegistryWrapper extends ContractWrapper {
11331133
* Returns the usd & poly fee for a particular feetype
11341134
*/
11351135
public getFees = async (params: GetFeesParams) => {
1136-
let feeType = '';
1137-
switch (params.feeType) {
1138-
case FeeType.stLaunchFee: {
1139-
feeType = stringToBytes32('stLaunchFee');
1140-
break;
1141-
}
1142-
case FeeType.tickerRegFee: {
1143-
feeType = stringToBytes32('tickerRegFee');
1144-
break;
1145-
}
1146-
default: {
1147-
assert.assert(false, 'Missing fee type');
1148-
break;
1149-
}
1136+
const { feeType } = params;
1137+
1138+
if (![FeeType.StLaunchFee, FeeType.TickerRegFee].includes(feeType)) {
1139+
assert.assert(false, 'Incorrect fee type');
11501140
}
1151-
return (await this.contract).getFees.callAsync(feeType);
1141+
const feeTypeBytes32 = stringToBytes32(params.feeType);
1142+
return (await this.contract).getFees.callAsync(feeTypeBytes32);
11521143
};
11531144

11541145
/**

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ export enum TransferResult {
132132
}
133133

134134
export enum FeeType {
135-
tickerRegFee,
136-
stLaunchFee,
135+
TickerRegFee = 'tickerRegFee',
136+
StLaunchFee = 'stLaunchFee',
137137
}
138138

139139
export enum Feature {

0 commit comments

Comments
 (0)