-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Conversation
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.
here's a round of comments that you saw me type
packages/core/lib/package.js
Outdated
|
||
// Create a web3 instance connected to a blockchain | ||
if (!options.provider && !options.ethpm.install_provider_uri) { |
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.
I think we don't want to use the network provider, since there's no reason to believe that the user will be developing against the same network as the network they're using for ethpm
packages/core/lib/package.js
Outdated
new Web3.providers.HttpProvider(options.ethpm.install_provider_uri); | ||
|
||
// Parse ethpm uri | ||
const ethpmURI = new Erc1319URI(options.ethpm_uri); |
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.
btw if you get sick of typing options.ethpm_uri
, you can do this kinda business:
const { ethpm_uri } = options
packages/core/lib/package.js
Outdated
registryAddress: ethpmURI.address, | ||
ipfs: { | ||
host: options.ethpm.ipfs_host, | ||
port: options.ethpm.ipfs_port, |
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.
y'know if we're looking at this as a breaking change, we should get rid of the underscores and make them proper camelCase to match JS style
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.
(but we should not do a breaking change :)
packages/core/lib/package.js
Outdated
const Web3 = require("web3"); | ||
const { createInterfaceAdapter } = require("@truffle/interface-adapter"); | ||
const async = require("async"); | ||
const { EthPM } = require("ethpm"); |
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.
to make this non-breaking, I would suggest creating new packages in the monorepo here, maybe @truffle/ethpm-v1
and @truffle/ethpm-v2
and having those packages depend on the respective versions of the ethpm Node package.
Then, you could duplicate and move this package.js
file to those corresponding new packages
@@ -35,8 +35,10 @@ export const getInitialConfig = ({ | |||
ethpm: { |
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.
in line with the non-breaking-ness suggestion below, we could add a version
field here that would control the delegation to the correct v1/v2 package.
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.
so then to switch it, users would provide this sort of configuration:
module.exports = {
/* ... rest of truffle-config.js ... */
ethpm: {
version: "2",
/* ... rest of ethpm config ... */
}
}
packages/core/lib/package.js
Outdated
// the blockchain uri coming through is what is set as the network_id | ||
// not a freshly created one with latest block via BlockchainUtils | ||
const foundNetworkId = Object.keys(fileContents.networks)[0]; | ||
if (foundNetworkId !== blockchainUri) { |
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.
note that in order to construct a blockchain URI, you're going to need to actually connect to the networks in the truffle-config, enumerating over each defined network, and for each of these networks, find the relevant block info
sorry
packages/core/lib/package.js
Outdated
.release(ethpmURI.version); | ||
|
||
// Install target manifest URI to working directory | ||
await ethpm.installer.install(manifestURI, ethpmURI.address); |
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.
we need to capture the result here as a list of contract types and list of deployments, so that we can pass this list of contracts to @truffle/artifactor.
you'll need convert blockchain URIs into network IDs because that's how the artifacts format organizes contract instances
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.
note that the format is formally spec'd in @truffle/contract-schema
99920a3
to
1f650ad
Compare
this pr has been superseded by #3247 |
No description provided.