This repository was archived by the owner on Jan 7, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ Commands:
4343 meridian set-round-reward < reward> Set the round reward
4444 meridian tick Trigger a tick
4545 meridian available-balance Get the balance available
46+ meridian add-admin < admin> Add a contract admin
4647
4748Options:
4849 -a, --address Contract address (or $MERIDIAN_ADDRESS ) [string] [required]
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { setNextRoundLength } from '../commands/set-next-round-length.js'
2222import { setRoundReward } from '../commands/set-round-reward.js'
2323import { tick } from '../commands/tick.js'
2424import { availableBalance } from '../commands/available-balance.js'
25+ import { addAdmin } from '../commands/add-admin.js'
2526
2627const pkg = JSON . parse (
2728 await fs . readFile (
@@ -126,6 +127,12 @@ yargs(hideBin(process.argv))
126127 yargs => yargs ,
127128 availableBalance
128129 )
130+ . command (
131+ 'add-admin <admin>' ,
132+ 'Add a contract admin' ,
133+ yargs => yargs . positional ( 'admin' , { type : 'string' } ) ,
134+ addAdmin
135+ )
129136 . demandCommand ( )
130137 . version ( `${ pkg . name } : ${ pkg . version } ` )
131138 . alias ( 'v' , 'version' )
Original file line number Diff line number Diff line change 1+ import { createContract } from '../index.js'
2+ import pRetry from 'p-retry'
3+
4+ export const addAdmin = async ( { admin, ...opts } ) => {
5+ const { contractWithSigner } = await createContract ( opts )
6+ console . error ( `Adding ${ admin } as admin. Please sign on your ledger...` )
7+ const tx = await contractWithSigner . grantRole (
8+ contractWithSigner . DEFAULT_ADMIN_ROLE ( ) ,
9+ admin
10+ )
11+ console . log ( tx . hash )
12+ console . log ( 'Awaiting confirmation...' )
13+ await pRetry ( ( ) => tx . wait ( ) )
14+ }
You can’t perform that action at this time.
0 commit comments