|
1 | 1 | import {
|
| 2 | + BigNumber, |
| 3 | + ContractAbi, |
| 4 | + LogWithDecodedArgs, |
| 5 | + ModuleFactory, |
| 6 | + ModuleFactoryChangeSTVersionBoundEventArgs, |
2 | 7 | ModuleFactoryContract,
|
3 | 8 | ModuleFactoryEventArgs,
|
4 | 9 | ModuleFactoryEvents,
|
5 |
| - ModuleFactoryOwnershipTransferredEventArgs, |
6 | 10 | ModuleFactoryGenerateModuleFromFactoryEventArgs,
|
7 |
| - ModuleFactoryChangeSTVersionBoundEventArgs, |
8 |
| - BigNumber, |
9 |
| - ModuleFactory, |
10 |
| - Web3Wrapper, |
11 |
| - ContractAbi, |
12 |
| - LogWithDecodedArgs, |
| 11 | + ModuleFactoryOwnershipTransferredEventArgs, |
13 | 12 | TxData,
|
| 13 | + Web3Wrapper, |
14 | 14 | } from '@polymathnetwork/abi-wrappers';
|
15 | 15 | import { schemas } from '@0x/json-schemas';
|
16 | 16 | import assert from '../../utils/assert';
|
17 | 17 | import ContractWrapper from '../contract_wrapper';
|
18 | 18 | import {
|
19 |
| - GetLogsAsyncParams, |
20 |
| - SubscribeAsyncParams, |
| 19 | + BoundType, |
21 | 20 | EventCallback,
|
22 |
| - Subscribe, |
23 |
| - GetLogs, |
24 | 21 | FULL_DECIMALS,
|
| 22 | + GetLogs, |
| 23 | + GetLogsAsyncParams, |
25 | 24 | ModuleType,
|
| 25 | + Subscribe, |
| 26 | + SubscribeAsyncParams, |
26 | 27 | TxParams,
|
27 | 28 | } 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'; |
29 | 36 | import functionsUtils from '../../utils/functions_utils';
|
30 | 37 |
|
31 | 38 | interface OwnershipTransferredSubscribeAsyncParams extends SubscribeAsyncParams {
|
@@ -78,6 +85,22 @@ interface ChangeCostAndTypeParams extends ChangeSetupCostParams {
|
78 | 85 | isCostInPoly: boolean;
|
79 | 86 | }
|
80 | 87 |
|
| 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 | + |
81 | 104 | /**
|
82 | 105 | * This class includes the functionality related to interacting with the ModuleFactory contract.
|
83 | 106 | */
|
@@ -180,6 +203,50 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
|
180 | 203 | );
|
181 | 204 | };
|
182 | 205 |
|
| 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 | + |
183 | 250 | /**
|
184 | 251 | * Get setup cost
|
185 | 252 | */
|
|
0 commit comments