New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(governance,networks): remove localhost from networks (again) #13321
Merged
Merged
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e9ca71e
remove localhost from networks package
clemsos 20452b2
remove localhost from keys in helpers
clemsos 97f97d4
fix localhost network
clemsos 1de9ea0
trigger ci
clemsos 390253c
fix hardhat plugin tests
clemsos 81a826a
add script to create localhost file
clemsos 0637571
generate localhost in integration tests
clemsos 274beb9
mock localhost network file in locksmith tests
clemsos 3dbec2c
Merge branch 'master' into remove-localhost-fix
clemsos c5d7b55
fix export in test
clemsos d99b561
Merge branch 'remove-localhost-fix' of github.com:unlock-protocol/unl…
clemsos 96f8dd4
Merge branch 'master' into remove-localhost-fix
clemsos 2218112
use latest versions of contracts
clemsos 868e12b
Merge branch 'master' into remove-localhost-fix
clemsos afbcaf3
take address as param
clemsos 21e5a49
fix yarn lock
clemsos 98d35b3
readme info
clemsos 9cac0c0
ignore localhost file
clemsos fea6343
pass unlock address via CLI
clemsos 6a299f7
actually add localhost to networks in integration tests
clemsos 2843e70
actually use the localhost network file in integration tests
clemsos 5bfebbe
remove localhost from index
clemsos 3868027
fix integration tests command
clemsos 108e806
remove unwanted lines
clemsos d210809
remove use of jq
clemsos 4437330
remove console log
clemsos bcd2c4c
Update package.json
clemsos 0031f64
pass docker graph url
clemsos File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,2 +1,3 @@ | ||
dist | ||
build | ||
build | ||
src/networks/localhost.ts |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import fs from 'fs-extra' | ||
import path from 'path' | ||
|
||
// We use Partial<NetworkConfig> for localhost as we don't have all the information | ||
const defaultLocalhost = { | ||
chain: 'localhost', | ||
description: 'Localhost network.', | ||
featured: false, | ||
fullySubsidizedGas: true, | ||
id: 31337, | ||
isTestNetwork: true, | ||
name: 'Localhost', | ||
nativeCurrency: { | ||
coingecko: 'ethereum', | ||
decimals: 18, | ||
name: 'ETH', | ||
symbol: 'ETH', | ||
}, | ||
provider: 'http://127.0.0.1:8545', | ||
publicLockVersionToDeploy: 13, | ||
publicProvider: 'http://127.0.0.1:8545', | ||
subgraph: { | ||
endpoint: '', | ||
}, | ||
} | ||
|
||
const generateLocalhostNetworkFile = ({ | ||
unlockAddress, | ||
subgraphEnpoint = 'http://localhost:8000/subgraphs/name/testgraph', | ||
}) => { | ||
const localhost = { | ||
...defaultLocalhost, | ||
subgraph: { | ||
endpoint: subgraphEnpoint, | ||
}, | ||
unlockAddress, | ||
} | ||
|
||
// log for debug purposes on CI | ||
console.log(localhost) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you wnat to keep that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes lets keep that one so we have it to debug on CI |
||
|
||
// output to js file | ||
const parsed = `import { NetworkConfig } from '@unlock-protocol/types' | ||
|
||
// We use Partial<NetworkConfig> for localhost as we don't have all the information | ||
export const localhost: Partial<NetworkConfig> = ${JSON.stringify(localhost)} | ||
export default localhost | ||
` | ||
return parsed | ||
} | ||
|
||
const run = async () => { | ||
const [unlockAddress, subgraphEnpoint] = process.argv.slice(2) | ||
console.log(`Creating localhost file for unlockAddress ${unlockAddress}`) | ||
|
||
if (!unlockAddress) { | ||
throw new Error('Missing unlockAddress arg') | ||
} | ||
|
||
const fileContent = generateLocalhostNetworkFile({ | ||
subgraphEnpoint, | ||
unlockAddress, | ||
}) | ||
|
||
const filePath = path.resolve('./src/networks/localhost.ts') | ||
|
||
await fs.writeFile(filePath, fileContent) | ||
} | ||
run() | ||
.then(() => console.log('done')) | ||
.catch((err) => { | ||
throw err | ||
}) |
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,20 @@ | ||
import fs from 'fs-extra' | ||
|
||
// this is used to read a network | ||
const run = async () => { | ||
const [networkInfoPath] = process.argv.slice(2) | ||
const networkInfo = await fs.readJSON(networkInfoPath) | ||
const { | ||
localhost: { | ||
Unlock: { address: unlockAddress }, | ||
}, | ||
} = networkInfo | ||
console.log(networkInfo) | ||
clemsos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return unlockAddress | ||
} | ||
|
||
run() | ||
.then((unlockAddress) => console.log(unlockAddress)) | ||
.catch((err) => { | ||
throw err | ||
}) |
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,4 +1,3 @@ | ||
export * from './localhost' | ||
export * from './mainnet' | ||
export * from './gnosis' | ||
export * from './polygon' | ||
|
This file was deleted.
Oops, something went wrong.
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a quick note in the README how the
localhost
network is different from he other ones?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep added