|
1 | | -# `ethpm-v3` |
| 1 | +# truffle/ethpm-v3 |
2 | 2 |
|
3 | | -> TODO: description |
| 3 | +A package that provides truffle support for [ethpm v3](http://ethpm.github.io/ethpm-spec/v3-package-spec.html), the default version in truffle. |
4 | 4 |
|
5 | 5 | ## Usage |
| 6 | +Installing an ethpm package in your truffle project will automatically generate an `_ethpm_packages/` directory to which the package assets will be written. This directory should be treated like a `node_modules/` directory, and not be edited directly. |
| 7 | + |
| 8 | +## Configuration |
| 9 | +To configure ethpm, define the following fields inside your `truffle-config.js`. |
| 10 | + |
| 11 | +```js |
| 12 | +{ |
| 13 | + // required to lookup a registry address via ens |
| 14 | + ens: { |
| 15 | + enabled: true |
| 16 | + }, |
| 17 | + // below are all of the default config values for ethpm |
| 18 | + ethpm: { |
| 19 | + ipfsHost: "ipfs.infura.io", |
| 20 | + ipfsProtocol: "https", |
| 21 | + ipfsPort: "5001", |
| 22 | + registry: { |
| 23 | + address: "0xabc", // ENS is supported here |
| 24 | + network: "ropsten" // must match a network with an available provider defined in `networks` field |
| 25 | + } |
| 26 | + version: "3" // only supported versions include ("1", "3") |
| 27 | + } |
| 28 | +} |
| 29 | +``` |
6 | 30 |
|
| 31 | +## List |
7 | 32 | ``` |
8 | | -const ethpmV3 = require('ethpm-v3'); |
| 33 | +truffle packages |
9 | 34 | ``` |
| 35 | +Reads all directly available packages on the connected registry. |
10 | 36 |
|
11 | | -TODO: |
12 | | -audit all error messages / include useful links to cli/docs/etc... |
13 | | -useful comments throughout |
14 | | -test all the different install scenarios |
15 | | -- test auto semver detect |
16 | | -warnings about trusting packages? |
17 | | -ethpm-v1 tests |
18 | | -truffle-config: ethpm/registry/network_id -> networkId |
19 | | -should the network provider be a function? or instance? |
20 | | -install from github blob uri |
21 | | - |
22 | | -is there a better display output workflow for sending publish tx |
23 | | -do we want timeout errors? // what's the best pattern to catch errors? |
24 | | - |
25 | | -how many deployments/chain does truffle support? if we migrate will it replace a deployment? (probably yes) |
26 | | - |
27 | | -there are no contractTypes in compilers from ethpm.js |
28 | | - |
29 | | -warning if ppl installed a package with insufficient artifacts - but expect them via deploy? |
| 37 | +## Install |
30 | 38 |
|
31 | | -- should we require `name` and `version` in ethpm.json? |
32 | | - |
33 | | -QUESTIONS: |
34 | | -do we support ens in truffle config for the registry address? |
35 | | -should the network provider be a function? or instance? |
36 | | -truffle default registry? |
37 | | - |
38 | | -# questions |
39 | | -- how to install `ethpm` npm package as different versions for `ethpm-v1` / `ethpm-v3` |
40 | | -- can we enforce either v1 / v3 per project? combining manifests seems tricky.. |
41 | | - - should we have a v1 and v3 resolver? |
| 39 | +### Install the latest version of a package from connected registry |
| 40 | +``` |
| 41 | +truffle install owned |
| 42 | +``` |
| 43 | +- Will throw an error requiring a specified version if package versioning does not follow semver. |
42 | 44 |
|
43 | | -todo: resolver source for both ethpmv1 & v3 |
44 | 45 |
|
| 46 | +### Install a specific version of a package from connected registry |
| 47 | +``` |
| 48 | +truffle install owned@1.0.0 |
| 49 | +``` |
45 | 50 |
|
| 51 | +### Install the latest version of a package from any registry |
46 | 52 | ``` |
47 | | -truffle packages |
48 | | -```` |
49 | | -todo: test with big registry |
50 | | -todo: test with no registry |
51 | | -todo: test with invalid registry |
| 53 | +truffle install owned ethpm://0x123/owned |
| 54 | +truffle install owned ethpm://0x123:1/owned |
| 55 | +``` |
| 56 | +- will throw an error requiring a specified version if package versioning does not follow semver. |
| 57 | +- using an ethpm uri overrides the registry set in `truffle-config.js` |
52 | 58 |
|
| 59 | +### Install a specific version of a package from any registry |
| 60 | +``` |
| 61 | +truffle install owned ethpm://0x123/owned@1.0.0 |
| 62 | +truffle install owned ethpm://0x123:1/owned@1.0.0 |
53 | 63 | ``` |
54 | | -truffle install xxx@1.0.0 |
55 | | -truffle install ethpm://packages.eth:3/xxx@1.0.0 |
56 | | -truffle install ipfs://Qmasdfa --alias=awesome |
| 64 | +``` |
| 65 | +truffle install owned ethpm://libraries.snakecharemers.eth/owned@1.0.0 |
| 66 | +truffle install owned ethpm://libraries.snakecharemers.eth:1/owned@1.0.0 |
57 | 67 | ``` |
58 | 68 |
|
59 | | -- supports either v1 or v3 |
| 69 | +### Install a package under an alias |
| 70 | +``` |
| 71 | +truffle install owned@1.0.0 --alias owned-2 |
| 72 | +``` |
| 73 | +- This can be useful for installing multiple packages that have the same name (installed packages share a namespace). |
| 74 | +- This can be useful for adding custom identifiers to installed packages for whatever reason. |
60 | 75 |
|
| 76 | +## Publish |
61 | 77 | ``` |
62 | 78 | truffle publish |
63 | | -```` |
64 | | -
|
65 | | -settings required in `ethpm.json` |
66 | | -
|
67 | | -
|
68 | | -
|
69 | | -escrow: QmNpLojZo471M357NTUZ1qKDwjUZrfYctWhzPtNFEXcSaL |
70 | | -piper-coin: QmNbvXM5ig6Qtz6abRuG52KgjFqfXDyBCdRTz7QDENgxzv |
71 | | -owned: QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR |
72 | | -safe-math-lib: QmWnPsiS3Xb8GvCDEBFnnKs8Yk4HaAX6rCqJAaQXGbCoPk |
73 | | -standard-token: QmQNffBrmbB3TuBCtYfYsJWJVLssatWXa3H6CkGeyNUySA |
74 | | -transferable: QmYX2yqyrpaJQugHQKnaWYcnkJEdnJC4exKaEVR3RK3TTf |
75 | | -wallet-with-send: QmX95FoLeVAFbnbj1PEDQaXDAeccmjbK8Zbw4eos9PAxeA |
76 | | -wallet: QmPtZxv9uEtr671XVjevHDacP9M4Tw9T7p6n1MS1xdyMeC |
| 79 | +``` |
77 | 80 |
|
| 81 | +- Requires that a valid `ethpm.json` file exists in your project root directory. |
| 82 | +- Requires that provider for connected registry has release privileges on that registry. |
| 83 | +- Running `truffle publish` will automatically generate an ethpm manifest from available contract assets and publish it to the connected registry. |
| 84 | + |
| 85 | +#### Sample `ethpm.json` |
| 86 | +```jsonld= |
| 87 | +{ |
| 88 | + "name": "package-name", // required |
| 89 | + "version": "0.1.0", // required |
| 90 | + "meta": { |
| 91 | + "license": "licenseType", |
| 92 | + "authors": ["author-1", "author-2"], |
| 93 | + "description": "Description of package.", |
| 94 | + "keywords": ["keyword1", "keyword2"], |
| 95 | + "links": { |
| 96 | + "documentation": "www.documentation.com", |
| 97 | + "repo": "www.repository.com", |
| 98 | + "website": "www.website.com" |
| 99 | + } |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
78 | 103 |
|
79 | | -ICEBOX: |
80 | | -support github uris |
81 | | -deploy a registry? |
|
0 commit comments