@@ -124,6 +124,13 @@ export const setDelegationParameters = async (
124
124
...[ indexingRewardCut , queryFeeCut , cooldownBlocks ] ,
125
125
)
126
126
}
127
+ export const setOperator = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
128
+ const operator = cliArgs . operator
129
+ const allowed = cliArgs . allowed
130
+ const staking = cli . contracts . Staking
131
+ logger . log ( `Setting operator ${ operator } to ${ allowed } for account ${ cli . walletAddress } ` )
132
+ await sendTransaction ( cli . wallet , staking , 'setOperator' , ...[ operator , allowed ] )
133
+ }
127
134
128
135
export const stakingCommand = {
129
136
command : 'staking' ,
@@ -359,12 +366,32 @@ export const stakingCommand = {
359
366
. option ( 'cooldownBlocks' , {
360
367
description : 'Period that need to pass to update delegation parameters' ,
361
368
type : 'number' ,
369
+ } )
370
+ } ,
371
+ handler : async ( argv : CLIArgs ) : Promise < void > => {
372
+ return setDelegationParameters ( await loadEnv ( argv ) , argv )
373
+ } ,
374
+ } )
375
+ . command ( {
376
+ command : 'setOperator' ,
377
+ describe : 'Set the operator for a graph account' ,
378
+ builder : ( yargs : Argv ) => {
379
+ return yargs
380
+ . option ( 'operator' , {
381
+ description : 'Address of the operator' ,
382
+ type : 'string' ,
383
+ requiresArg : true ,
384
+ demandOption : true ,
385
+ } )
386
+ . option ( 'allowed' , {
387
+ description : 'Set to true to be an operator, false to revoke' ,
388
+ type : 'boolean' ,
362
389
requiresArg : true ,
363
390
demandOption : true ,
364
391
} )
365
392
} ,
366
393
handler : async ( argv : CLIArgs ) : Promise < void > => {
367
- return setDelegationParameters ( await loadEnv ( argv ) , argv )
394
+ return setOperator ( await loadEnv ( argv ) , argv )
368
395
} ,
369
396
} )
370
397
} ,
0 commit comments