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

Commit b134e26

Browse files
author
Victor Wiebe
committed
feat: add more methods in moduleFactoryWrapper
1 parent a67a39c commit b134e26

File tree

1 file changed

+79
-12
lines changed

1 file changed

+79
-12
lines changed

src/contract_wrappers/modules/module_factory_wrapper.ts

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
import {
2+
BigNumber,
3+
ContractAbi,
4+
LogWithDecodedArgs,
5+
ModuleFactory,
6+
ModuleFactoryChangeSTVersionBoundEventArgs,
27
ModuleFactoryContract,
38
ModuleFactoryEventArgs,
49
ModuleFactoryEvents,
5-
ModuleFactoryOwnershipTransferredEventArgs,
610
ModuleFactoryGenerateModuleFromFactoryEventArgs,
7-
ModuleFactoryChangeSTVersionBoundEventArgs,
8-
BigNumber,
9-
ModuleFactory,
10-
Web3Wrapper,
11-
ContractAbi,
12-
LogWithDecodedArgs,
11+
ModuleFactoryOwnershipTransferredEventArgs,
1312
TxData,
13+
Web3Wrapper,
1414
} from '@polymathnetwork/abi-wrappers';
1515
import { schemas } from '@0x/json-schemas';
1616
import assert from '../../utils/assert';
1717
import ContractWrapper from '../contract_wrapper';
1818
import {
19-
GetLogsAsyncParams,
20-
SubscribeAsyncParams,
19+
BoundType,
2120
EventCallback,
22-
Subscribe,
23-
GetLogs,
2421
FULL_DECIMALS,
22+
GetLogs,
23+
GetLogsAsyncParams,
2524
ModuleType,
25+
Subscribe,
26+
SubscribeAsyncParams,
2627
TxParams,
2728
} from '../../types';
28-
import { weiToValue, bytes32ToString, bytes32ArrayToStringArray, parseModuleTypeValue } from '../../utils/convert';
29+
import {
30+
bytes32ArrayToStringArray,
31+
bytes32ToString,
32+
parseModuleTypeValue,
33+
stringArrayToBytes32Array,
34+
weiToValue,
35+
} from '../../utils/convert';
2936
import functionsUtils from '../../utils/functions_utils';
3037

3138
interface OwnershipTransferredSubscribeAsyncParams extends SubscribeAsyncParams {
@@ -78,6 +85,22 @@ interface ChangeCostAndTypeParams extends ChangeSetupCostParams {
7885
isCostInPoly: boolean;
7986
}
8087

88+
interface ChangeTitleParams extends TxParams {
89+
title: string;
90+
}
91+
92+
interface ChangeDescriptionParams extends TxParams {
93+
description: string;
94+
}
95+
96+
interface ChangeNameParams extends TxParams {
97+
name: string;
98+
}
99+
100+
interface ChangeTagsParams extends TxParams {
101+
tags: string[];
102+
}
103+
81104
/**
82105
* This class includes the functionality related to interacting with the ModuleFactory contract.
83106
*/
@@ -180,6 +203,50 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
180203
);
181204
};
182205

206+
/**
207+
* Change the title
208+
*/
209+
public changeTitle = async (params: ChangeTitleParams) => {
210+
await this.checkOnlyOwner(params.txData);
211+
assert.assert(params.title.length > 0, 'Invalid title');
212+
return (await this.contract).changeTitle.sendTransactionAsync(params.title, params.txData, params.safetyFactor);
213+
};
214+
215+
/**
216+
* Change the description
217+
*/
218+
public changeDescription = async (params: ChangeDescriptionParams) => {
219+
await this.checkOnlyOwner(params.txData);
220+
assert.assert(params.description.length > 0, 'Invalid description');
221+
return (await this.contract).changeDescription.sendTransactionAsync(
222+
params.description,
223+
params.txData,
224+
params.safetyFactor,
225+
);
226+
};
227+
228+
/**
229+
* Change the name
230+
*/
231+
public changeName = async (params: ChangeNameParams) => {
232+
await this.checkOnlyOwner(params.txData);
233+
assert.assert(params.name.length > 0, 'Invalid name');
234+
return (await this.contract).changeName.sendTransactionAsync(params.name, params.txData, params.safetyFactor);
235+
};
236+
237+
/**
238+
* Change the tags
239+
*/
240+
public changeTags = async (params: ChangeTagsParams) => {
241+
await this.checkOnlyOwner(params.txData);
242+
assert.assert(params.tags.length > 0, 'Invalid, must provide one or more tags');
243+
return (await this.contract).changeTags.sendTransactionAsync(
244+
stringArrayToBytes32Array(params.tags),
245+
params.txData,
246+
params.safetyFactor,
247+
);
248+
};
249+
183250
/**
184251
* Get setup cost
185252
*/

0 commit comments

Comments
 (0)