-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c1f2e8
commit ec225b4
Showing
55 changed files
with
1,444 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
// Commands that send tx and require a key to sign. | ||
// It's useful to have this listed here so the context | ||
// middleware can request keys up front when required. | ||
export const SIGN_COMMANDS = ['deploy', 'send', 'status', 'submit', 'relayer']; | ||
export const SIGN_COMMANDS = [ | ||
'apply', | ||
'deploy', | ||
'send', | ||
'status', | ||
'submit', | ||
'relayer', | ||
]; | ||
|
||
export function isSignCommand(argv: any): boolean { | ||
//TODO: fix reading and checking warp without signer, and remove this | ||
const temporarySignCommandsCheck = | ||
argv._[0] === 'warp' && (argv._[1] === 'read' || argv._[1] === 'check'); | ||
return ( | ||
SIGN_COMMANDS.includes(argv._[0]) || | ||
(argv._.length > 1 && SIGN_COMMANDS.includes(argv._[1])) | ||
(argv._.length > 1 && SIGN_COMMANDS.includes(argv._[1])) || | ||
temporarySignCommandsCheck | ||
); | ||
} | ||
|
||
export enum CommandType { | ||
WARP_DEPLOY = 'warp:deploy', | ||
WARP_SEND = 'warp:send', | ||
WARP_APPLY = 'warp:apply', | ||
WARP_READ = 'warp:read', | ||
WARP_CHECK = 'warp:check', | ||
SEND_MESSAGE = 'send:message', | ||
AGENT_KURTOSIS = 'deploy:kurtosis-agents', | ||
STATUS = 'status:', | ||
SUBMIT = 'submit:', | ||
RELAYER = 'relayer:', | ||
CORE_APPLY = 'core:apply', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { stringify as yamlStringify } from 'yaml'; | ||
import { CommandModule } from 'yargs'; | ||
|
||
import { | ||
createStrategyConfig, | ||
readChainSubmissionStrategyConfig, | ||
} from '../config/strategy.js'; | ||
import { CommandModuleWithWriteContext } from '../context/types.js'; | ||
import { log, logCommandHeader } from '../logger.js'; | ||
import { indentYamlOrJson } from '../utils/files.js'; | ||
import { maskSensitiveData } from '../utils/output.js'; | ||
|
||
import { | ||
DEFAULT_STRATEGY_CONFIG_PATH, | ||
outputFileCommandOption, | ||
strategyCommandOption, | ||
} from './options.js'; | ||
|
||
/** | ||
* Parent command | ||
*/ | ||
export const strategyCommand: CommandModule = { | ||
command: 'strategy', | ||
describe: 'Manage Hyperlane deployment strategies', | ||
builder: (yargs) => | ||
yargs.command(init).command(read).version(false).demandCommand(), | ||
handler: () => log('Command required'), | ||
}; | ||
|
||
export const init: CommandModuleWithWriteContext<{ | ||
out: string; | ||
}> = { | ||
command: 'init', | ||
describe: 'Creates strategy configuration', | ||
builder: { | ||
out: outputFileCommandOption(DEFAULT_STRATEGY_CONFIG_PATH), | ||
}, | ||
handler: async ({ context, out }) => { | ||
logCommandHeader(`Hyperlane Strategy Init`); | ||
|
||
await createStrategyConfig({ | ||
context, | ||
outPath: out, | ||
}); | ||
process.exit(0); | ||
}, | ||
}; | ||
|
||
export const read: CommandModuleWithWriteContext<{ | ||
strategy: string; | ||
}> = { | ||
command: 'read', | ||
describe: 'Reads strategy configuration', | ||
builder: { | ||
strategy: { | ||
...strategyCommandOption, | ||
demandOption: true, | ||
default: DEFAULT_STRATEGY_CONFIG_PATH, | ||
}, | ||
}, | ||
handler: async ({ strategy: strategyUrl }) => { | ||
logCommandHeader(`Hyperlane Strategy Read`); | ||
|
||
const strategy = await readChainSubmissionStrategyConfig(strategyUrl); | ||
const maskedConfig = maskSensitiveData(strategy); | ||
log(indentYamlOrJson(yamlStringify(maskedConfig, null, 2), 4)); | ||
|
||
process.exit(0); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.