Skip to content

Commit

Permalink
Merge pull request sphinx-labs#694 from chugsplash/pate/error-without…
Browse files Browse the repository at this point in the history
…-api-key

fix(core): Error if no API key is defined when proposing
  • Loading branch information
RPate97 authored May 18, 2023
2 parents 17c70b9 + 3351c6f commit d50bca5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions packages/core/src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ export const chugsplashProposeAbstractTask = async (
integration: Integration,
artifactPaths: ArtifactPaths,
canonicalConfigPath: string,
cre: ChugSplashRuntimeEnvironment
cre: ChugSplashRuntimeEnvironment,
shouldRelay = true
) => {
const { remoteExecution } = cre

Expand Down Expand Up @@ -211,12 +212,6 @@ export const chugsplashProposeAbstractTask = async (
spinner.succeed(`${parsedConfig.options.projectName} can be proposed.`)
spinner.start(`Proposing ${parsedConfig.options.projectName}...`)

const shouldRelay =
process.env.CHUGSPLASH_API_KEY !== undefined &&
((await isLiveNetwork(provider)) ||
process.env.LOCAL_TEST_METATX_PROPOSE === 'true' ||
process.env.LOCAL_MANAGED_SERVICE === 'true')

const metatxs = await proposeChugSplashDeployment(
provider,
signer,
Expand Down Expand Up @@ -1118,6 +1113,12 @@ export const proposeChugSplashDeployment = async (
)
}

if (!process.env.CHUGSPLASH_API_KEY) {
throw new Error(
'Must provide a CHUGSPLASH_API_KEY environment variable to use gasless proposals'
)
}

const { signature, request } = await signMetaTxRequest(
provider,
process.env.PRIVATE_KEY,
Expand Down
3 changes: 2 additions & 1 deletion packages/executor/test/Executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ describe('Remote Execution', () => {
'hardhat',
artifactPaths,
canonicalConfigPath,
cre
cre,
false
)

// approve
Expand Down

0 comments on commit d50bca5

Please sign in to comment.