ethpm-spec
Advanced tools
Comparing version 2.0.0 to 3.0.0
133
index.d.ts
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export type ManifestVersion = "2"; | ||
export type Manifest = "ethpm/3"; | ||
/** | ||
@@ -17,2 +17,6 @@ * The name of the package that this release is for | ||
/** | ||
* The version of the package that this release is for | ||
*/ | ||
export type PackageVersion = string; | ||
/** | ||
* Authors of this package | ||
@@ -22,3 +26,3 @@ */ | ||
/** | ||
* The license that this package and it's source are released under | ||
* The license that this package and its source are released under | ||
*/ | ||
@@ -34,8 +38,23 @@ export type License = string; | ||
export type Keywords = string[]; | ||
export type Version = string; | ||
export type SourceCode = string; | ||
/** | ||
* The name for this contract type as found in the project source code. | ||
* Information about a source file included in this package | ||
* | ||
* This interface was referenced by `Sources`'s JSON-Schema definition | ||
* via the `patternProperty` ".*". | ||
*/ | ||
export type ContractName = string; | ||
export type Source = { | ||
[k: string]: any; | ||
}; | ||
/** | ||
* The name of the contract type | ||
*/ | ||
export type ContractTypeName = string; | ||
/** | ||
* The compiler versions used in this release | ||
*/ | ||
export type Compilers = CompilerInformation[]; | ||
/** | ||
* The source ID that corresponds to this contract type | ||
*/ | ||
export type SourceId = string; | ||
export type BytecodeObject = { | ||
@@ -49,8 +68,4 @@ [k: string]: any; | ||
/** | ||
* The contract type of this contract instance | ||
* A 0x-prefixed Ethereum address | ||
*/ | ||
export type ContractTypeName = string; | ||
/** | ||
* An Ethereum address | ||
*/ | ||
export type Address = ByteString & { | ||
@@ -64,3 +79,3 @@ [k: string]: any; | ||
/** | ||
* An Ethereum transaction hash | ||
* A 0x-prefixed Ethereum transaction hash | ||
*/ | ||
@@ -87,3 +102,3 @@ export type TransactionHash = ByteString & { | ||
type?: "reference"; | ||
value?: ContractInstanceName | PackageContractInstanceName; | ||
value?: ContractInstanceName | NestedContractInstanceName; | ||
[k: string]: any; | ||
@@ -96,5 +111,5 @@ }; | ||
/** | ||
* The path to a deployed contract instance somewhere down the dependency tree | ||
* Name of a nested contract instance from somewhere down the dependency tree | ||
*/ | ||
export type PackageContractInstanceName = string; | ||
export type NestedContractInstanceName = string; | ||
/** | ||
@@ -108,3 +123,3 @@ * The values for the link references found within this contract instances runtime bytecode | ||
* This interface was referenced by `BuildDependencies`'s JSON-Schema definition | ||
* via the `patternProperty` "^[a-z][-a-z0-9]{0,255}$". | ||
* via the `patternProperty` "". | ||
*/ | ||
@@ -117,10 +132,11 @@ export type ContentUri = string; | ||
export interface PackageManifest { | ||
manifest_version: ManifestVersion; | ||
package_name: PackageName; | ||
manifest: Manifest; | ||
name?: PackageName; | ||
version?: PackageVersion; | ||
meta?: PackageMeta; | ||
version: Version; | ||
sources?: Sources; | ||
contract_types?: ContractTypes; | ||
compilers?: Compilers; | ||
contractTypes?: ContractTypes; | ||
deployments?: Deployments; | ||
build_dependencies?: BuildDependencies; | ||
buildDependencies?: BuildDependencies; | ||
[k: string]: any; | ||
@@ -142,8 +158,31 @@ } | ||
} | ||
/** | ||
* The source files included in this release | ||
*/ | ||
export interface Sources { | ||
[k: string]: Source; | ||
} | ||
/** | ||
* Information about the software that was used to compile a contract type or deployment | ||
*/ | ||
export interface CompilerInformation { | ||
/** | ||
* This interface was referenced by `Sources`'s JSON-Schema definition | ||
* via the `patternProperty` "\.\/.*". | ||
* The name of the compiler | ||
*/ | ||
[k: string]: SourceCode; | ||
name: string; | ||
/** | ||
* The version string for the compiler | ||
*/ | ||
version: string; | ||
/** | ||
* The settings used for compilation | ||
*/ | ||
settings?: { | ||
[k: string]: any; | ||
}; | ||
/** | ||
* The contract types that targeted this compiler. | ||
*/ | ||
contractTypes?: ContractTypeName[]; | ||
[k: string]: any; | ||
} | ||
@@ -160,37 +199,24 @@ /** | ||
* This interface was referenced by `ContractTypes`'s JSON-Schema definition | ||
* via the `patternProperty` "[a-zA-Z][-a-zA-Z0-9_]{0,255}(?:\[[-a-zA-Z0-9]{1,256}\])?$". | ||
* via the `patternProperty` "". | ||
*/ | ||
export interface ContractType { | ||
contract_name?: ContractName; | ||
deployment_bytecode?: BytecodeObject; | ||
runtime_bytecode?: BytecodeObject; | ||
contractName?: ContractTypeName; | ||
sourceId?: SourceId; | ||
deploymentBytecode?: BytecodeObject; | ||
runtimeBytecode?: BytecodeObject; | ||
abi?: Abi; | ||
natspec?: NatSpec; | ||
compiler?: CompilerInformation; | ||
devdoc?: Devdoc; | ||
userdoc?: Userdoc; | ||
[k: string]: any; | ||
} | ||
/** | ||
* The combined user-doc and dev-doc for this contract | ||
* The dev-doc for this contract | ||
*/ | ||
export interface NatSpec { | ||
export interface Devdoc { | ||
[k: string]: any; | ||
} | ||
/** | ||
* Information about the software that was used to compile a contract type or instance | ||
* The user-doc for this contract | ||
*/ | ||
export interface CompilerInformation { | ||
/** | ||
* The name of the compiler | ||
*/ | ||
name: string; | ||
/** | ||
* The version string for the compiler | ||
*/ | ||
version: string; | ||
/** | ||
* The settings used for compilation | ||
*/ | ||
settings?: { | ||
[k: string]: any; | ||
}; | ||
export interface Userdoc { | ||
[k: string]: any; | ||
@@ -206,3 +232,3 @@ } | ||
* This interface was referenced by `Deployments`'s JSON-Schema definition | ||
* via the `patternProperty` "^blockchain\://[0-9a-zA-Z]{64}/block/[0-9a-zA-Z]{64}$". | ||
* via the `patternProperty` "". | ||
*/ | ||
@@ -216,12 +242,11 @@ export interface Deployment { | ||
* This interface was referenced by `Deployment`'s JSON-Schema definition | ||
* via the `patternProperty` "^[a-zA-Z][a-zA-Z0-9_]{0,255}$". | ||
* via the `patternProperty` "". | ||
*/ | ||
export interface ContractInstance { | ||
contract_type: ContractTypeName; | ||
contractType: ContractTypeName; | ||
address: Address; | ||
transaction?: TransactionHash; | ||
block?: BlockHash; | ||
runtime_bytecode?: BytecodeObject; | ||
compiler?: CompilerInformation; | ||
link_dependencies?: LinkDependencies; | ||
runtimeBytecode?: BytecodeObject; | ||
linkDependencies?: LinkDependencies; | ||
[k: string]: any; | ||
@@ -228,0 +253,0 @@ } |
{ | ||
"name": "ethpm-spec", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Ethereum Package Manager Specifications", | ||
"scripts": { | ||
"prepare": "json2ts -i ./spec/package.spec.json -o ./index.d.ts" | ||
"prepare": "json2ts -i ./spec/v3.spec.json -o ./index.d.ts" | ||
}, | ||
@@ -8,0 +8,0 @@ "files": [ |
@@ -34,21 +34,27 @@ # EthPM Package Specification | ||
{ | ||
"manifest_version": "2", | ||
"version": "1.0.0", | ||
"package_name": "owned", | ||
"meta": { | ||
"license": "MIT", | ||
"authors": [ | ||
"Piper Merriam <pipermerriam@gmail.com>" | ||
], | ||
"description": "Reusable contracts which implement a privileged 'owner' model for authorization.", | ||
"keywords": [ | ||
"authorization" | ||
], | ||
"links": { | ||
"documentation": "ipfs://QmUYcVzTfSwJoigggMxeo2g5STWAgJdisQsqcXHws7b1FW" | ||
"name": "owned", | ||
"version": "1.0.0", | ||
"manifest": "ethpm/3", | ||
"meta": { | ||
"license": "MIT", | ||
"authors": [ | ||
"Piper Merriam <pipermerriam@gmail.com>" | ||
], | ||
"description": "Reusable contracts which implement a privileged 'owner' model for authorization.", | ||
"keywords": [ | ||
"authorization" | ||
], | ||
"links": { | ||
"documentation": "ipfs://QmUYcVzTfSwJoigggMxeo2g5STWAgJdisQsqcXHws7b1FW" | ||
} | ||
}, | ||
"sources": { | ||
"contracts/Owned.sol": { | ||
"type": "solidity", | ||
"urls": [ | ||
"ipfs://Qme4otpS88NV8yQi8TfTP89EsQC5bko3F5N1yhRoi6cwGV" | ||
], | ||
"installPath": "./contracts/Owned.sol" | ||
} | ||
} | ||
}, | ||
"sources": { | ||
"./contracts/Owned.sol": "ipfs://Qme4otpS88NV8yQi8TfTP89EsQC5bko3F5N1yhRoi6cwGV" | ||
} | ||
} | ||
@@ -63,2 +69,10 @@ ``` | ||
Each example directory contains.. | ||
- `1.0.0.json`: ethpm v2 manifest (deprecated) | ||
- `1.0.0-pretty.json`: ethpm v2 manifest (pretty printed) (deprecated) | ||
- `v3.json`: ethpm v3 manifest | ||
- `v3-pretty.json`: ethpm v3 manifest (pretty printed) | ||
- `contracts/`: Directory containing the source contracts for the example | ||
- `metadata/`: Directory containing example ethpm compliant [compiler metadata output](https://solidity.readthedocs.io/en/latest/metadata.html) for each example contract | ||
## Specification | ||
@@ -76,11 +90,11 @@ | ||
### Building Sphinx docs locally | ||
Requirements: Python 3, `pip`, `make` | ||
Fork and clone this repo to get started. Then, activate a | ||
[virtual environment](https://docs.python-guide.org/dev/virtualenvs/) in the cloned repo's | ||
directory and run `pip install -r requirements.txt` | ||
Fork and clone this repo to get started. Then, in the cloned repo's directory: | ||
### Building Sphinx docs locally | ||
1. `pip install -r requirements.txt` | ||
2. `cd docs` | ||
3. `make html` | ||
1. `cd docs` | ||
2. `make html` | ||
@@ -90,1 +104,27 @@ Docs are written in [reStructuredText](http://docutils.sourceforge.net/rst.html) | ||
generator. | ||
### Running tests locally | ||
1. `pytest tests/` | ||
### Test fixture schema | ||
Each test fixture contains a ``package`` field with a raw, json encoded string of the manifest. | ||
Each test fixture contains a ``testCase`` field that indicates whether the associated ``package`` is ``invalid`` or ``valid``. | ||
Each invalid test fixture contains an ``errorInfo`` field. | ||
- The ``errorPointer`` field, which is a [jsonpointer](https://tools.ietf.org/html/rfc6901) pointing towards the cause of the invalid error, is included for ``invalid`` tests. | ||
- The ``reason`` field, which is a human readable description of the error, is included for ``invalid`` tests. | ||
- The ``errorCode`` field, which is a machine readable description of the error, is included for ``invalid`` tests according to the following table. | ||
``N0001`` - Invalid ``"manifest"`` field. | ||
``N0002`` - Invalid ``"name"`` field. | ||
``N0003`` - Invalid ``"version"`` field. | ||
``N0004`` - Invalid ``"sources"`` field. | ||
``N0005`` - Invalid ``"contractTypes"`` field. | ||
``N0006`` - Invalid ``"deployments"`` field. | ||
``N0007`` - Invalid ``"compilers"`` field. | ||
``N0008`` - Invalid ``"buildDependencies"`` field. | ||
``N0009`` - Invalid ``"meta"`` field. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
514160
109
4786
127
2