Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Reorganize and modularize generated contract wrappers and artifacts #1105

Merged
merged 55 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
81c4887
Move generated contract wrappers and artifacts into contracts package
albrow Oct 1, 2018
026ad1f
Update contract-wrappers package to use new contracts package for gen…
albrow Oct 2, 2018
90f5e4d
Update .prettierignore
albrow Oct 2, 2018
5b1b423
Change @0xproject/contracts version number back to 2.1.48
albrow Oct 2, 2018
33335a6
Automatically collapse contract artifacts by adding them to .gitattri…
albrow Oct 2, 2018
2aa73fc
Add generated contract wrappers in contracts package to gitignore
albrow Oct 2, 2018
3a7bb97
Remove artifacts from migrations package and update contract-wrappers…
albrow Oct 3, 2018
1da3604
Create contract-artifacts package (needed to solve dependency cycle)
albrow Oct 4, 2018
8f0ceaf
Create abi-gen-wrappers package
albrow Oct 4, 2018
2bd7b0f
update contract_wrappers to use new artifacts and abi-gen wrappers pa…
albrow Oct 4, 2018
57d9fcf
update order-utils to use new artifacts and abi-gen wrappers packages
albrow Oct 4, 2018
d0b37fc
update fill-scenarios to use new artifacts and abi-gen wrappers packages
albrow Oct 4, 2018
3da032f
update asset-buyer to use new artifacts and abi-gen wrappers packages
albrow Oct 4, 2018
29063ca
update order-watcher to use new artifacts and abi-gen wrappers packages
albrow Oct 4, 2018
255da32
Update testnet-faucets and website to work with new artifacts and abi…
albrow Oct 4, 2018
3af7d1a
Add missing dependency to abi-gen-wrappers
albrow Oct 5, 2018
1411210
Remove generated artifacts in the contracts package
albrow Oct 5, 2018
17c6661
Cleanup migrations and contracts package. Make contracts private again.
albrow Oct 5, 2018
ecdd6e3
Fix linter errors in contract-wrappers
albrow Oct 5, 2018
a48e0a0
Add new runMigrationsOnce method to migrations. Update contract-wrapp…
albrow Oct 9, 2018
6c8fb37
Update order-watcher to use new migrations functions
albrow Oct 9, 2018
1b8b2c0
Appease linter
albrow Oct 9, 2018
770cf52
Remove unused copyfiles dependencies
albrow Oct 9, 2018
33e65c3
Remove unused abi-gen dependencies
albrow Oct 9, 2018
fa346d9
Remove networks/addresses from contract-artifacts package
albrow Oct 9, 2018
1e9ea09
Introduce new contract-addresses package and use it everywhere
albrow Oct 10, 2018
6d79e30
Update .gitattributes
albrow Oct 10, 2018
0e1cd97
Use contractAddresses directly in revert_validation_test.ts
albrow Oct 10, 2018
68f150e
Remove as any hack from artifacts in contracts package
albrow Oct 10, 2018
974ec23
Apply various PR feedback
albrow Oct 10, 2018
c83dec2
Improve error handling for unknown network ids in contract-wrappers
albrow Oct 10, 2018
d76d8ab
Update .gitignore and .prettierignore
albrow Oct 11, 2018
8dc73d3
Add README.md for each new package
albrow Oct 12, 2018
7a6cace
Create CHANGELOG.json for three new packages
albrow Oct 12, 2018
24673be
Add resolveJsonModule: true to test_installation.ts
albrow Oct 12, 2018
003ab1e
Fix linter errors in contract-wrappers
albrow Oct 12, 2018
f0e4837
Fix failing doc generation tests
albrow Oct 15, 2018
00db096
Fix bug introduced during rebase
albrow Oct 15, 2018
be1a597
Remove ContractAddresses from packages/types (mistake after rebase)
albrow Oct 15, 2018
e3af06a
Update CHANGELOG.json for all changed packages
albrow Oct 15, 2018
38b146c
Add OrThrow suffix to getContractAddressesForNetwork
albrow Oct 15, 2018
e093864
Update json-schemas for contract-wrappers
albrow Oct 16, 2018
6f8e98e
In contract-wrappers, remove setProvider and add unsubscribeAll method.
albrow Oct 16, 2018
2c63909
In abi-gen-wrappers, ./wrappers -> ./src/generated-wrappers
albrow Oct 16, 2018
5509bf5
Update website to use the new unsubscribeAll method in contract-wrappers
albrow Oct 16, 2018
3c5812c
Update prettierignore
albrow Oct 16, 2018
5bdfad9
Remove ContractNotFound errors in contract-wrappers
albrow Oct 16, 2018
8cffe65
fix(monorepo-scripts): Move the creation of the `.installation-test` …
fabioberger Oct 16, 2018
2e56e2c
fix(0x.js): make web3-provider-engine types a 'dependency' so it's av…
fabioberger Oct 16, 2018
eab88cb
fix(dev-utils): make web3-provider-engine types a 'dependency' so it'…
fabioberger Oct 16, 2018
75b0781
fix(sol-cov): make @types/solidity-parser-antlr a 'dependency' so it'…
fabioberger Oct 16, 2018
6c92778
fix(sra-spec): make @loopback/openapi-v3-types a 'dependency' so it's…
fabioberger Oct 16, 2018
0210411
fix(subproviders): make web3-provider-engine types a 'dependency' so …
fabioberger Oct 16, 2018
fca5260
Add changelog entries
fabioberger Oct 16, 2018
5938e8a
fix(dev-utils): Make chai a dev dependency since exported interface d…
fabioberger Oct 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*.sol linguist-language=Solidity

# Automatically collapse generated files in GitHub.
packages/contract-artifacts/artifacts/*json linguist-generated
packages/abi-gen-wrappers/wrappers/*.ts liguist-generated
26 changes: 5 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,14 @@ packages/react-docs/example/public/bundle*
packages/testnet-faucets/server/

# generated contract artifacts/
packages/contracts/generated-artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
packages/order-watcher/test/artifacts/
packages/contract-wrappers/test/artifacts/
packages/contract-wrappers/src/artifacts/
packages/order-watcher/src/artifacts/
packages/0x.js/src/artifacts/
packages/order-utils/src/artifacts/

# unstable generated contract artifacts:
packages/migrations/artifacts/development/

# generated contract watcher
packages/0x.js/src/generated_contract_wrappers/
packages/contracts/generated_contract_wrappers/
packages/contract-wrappers/src/contract_wrappers/generated/

# generated contract wrappers
packages/abi-gen-wrappers/wrappers
packages/contracts/generated-wrappers/
packages/metacoin/src/contract_wrappers
packages/fill-scenarios/src/generated_contract_wrappers/
packages/order-watcher/src/generated_contract_wrappers/
packages/order-utils/src/generated_contract_wrappers/
packages/migrations/src/1.0.0/contract_wrappers
packages/migrations/src/2.0.0-testnet/contract_wrappers
packages/migrations/src/2.0.0/contract_wrappers
packages/migrations/src/development/contract_wrappers

# solc-bin in sol-compiler
packages/sol-compiler/solc_bin/
Expand Down
23 changes: 4 additions & 19 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
lib
.nyc_output
/packages/contract-wrappers/src/contract_wrappers/generated/
/packages/contracts/generated-wrappers
/packages/contracts/generated-artifacts
/packages/abi-gen-wrappers/wrappers
/packages/contract-artifacts/artifacts
/packages/metacoin/src/contract_wrappers
/packages/0x.js/src/generated_contract_wrappers/
/packages/contracts/generated_contract_wrappers/
/packages/fill-scenarios/src/generated_contract_wrappers/
/packages/order-watcher/src/generated_contract_wrappers/
/packages/order-utils/src/generated_contract_wrappers/
/packages/migrations/src/1.0.0/contract_wrappers
/packages/migrations/src/2.0.0-testnet/contract_wrappers
/packages/migrations/src/2.0.0/contract_wrappers
/packages/0x.js/src/artifacts
/packages/contracts/src/artifacts
/packages/contract-wrappers/src/artifacts
/packages/order-watcher/src/artifacts
/packages/metacoin/artifacts
/packages/sra-spec/public/
/packages/contract-wrappers/test/artifacts
/packages/order-watcher/test/artifacts
/packages/migrations/artifacts/1.0.0
/packages/migrations/artifacts/2.0.0-testnet
/packages/migrations/artifacts/2.0.0
/packages/migrations/artifacts/development
package.json
scripts/postpublish_utils.js
packages/sol-cov/test/fixtures/artifacts
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"report_coverage": "lcov-result-merger './{packages/*/coverage/lcov.info,python-packages/*/.coverage}' | coveralls",
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
"test:installation:local": "IS_LOCAL_PUBLISH=true node ./packages/monorepo-scripts/lib/test_installation.js",
"test:publish:circleci:comment": "HACK(albrow) We need an automated way to login to npm and echo+sleep piped to stdin was the only way I could find to do it.",
"test:publish:circleci": "yarn npm-cli-login -u test -p test -e [email protected] -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish",
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
Expand Down
5 changes: 5 additions & 0 deletions packages/0x.js/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"note":
"Removed `SignerType` (including `SignerType.Metamask`). Please use the `MetamaskSubprovider` to wrap `web3.currentProvider`.",
"pr": 1102
},
{
"note":
"Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers",
"pr": 1105
}
]
},
Expand Down
2 changes: 2 additions & 0 deletions packages/0x.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0xproject/contract-addresses": "^1.0.0",
"@0xproject/abi-gen": "^1.0.13",
"@0xproject/abi-gen-wrappers": "^1.0.0",
"@0xproject/dev-utils": "^1.0.12",
"@0xproject/migrations": "^1.0.14",
"@0xproject/monorepo-scripts": "^1.0.11",
Expand Down
6 changes: 0 additions & 6 deletions packages/0x.js/src/globals.d.ts

This file was deleted.

23 changes: 14 additions & 9 deletions packages/0x.js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { ContractAddresses } from '@0xproject/contract-addresses';

export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils';

export {
Expand All @@ -18,6 +20,16 @@ export {
TransactionOpts,
OrderStatus,
OrderInfo,
EventCallback,
DecodedLogEvent,
TransactionEncoder,
BalanceAndAllowance,
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
} from '@0xproject/contract-wrappers';

export {
WETH9Events,
WETH9WithdrawalEventArgs,
WETH9ApprovalEventArgs,
Expand All @@ -38,16 +50,9 @@ export {
ExchangeSignatureValidatorApprovalEventArgs,
ExchangeFillEventArgs,
ExchangeCancelEventArgs,
ExchangeEvents,
EventCallback,
DecodedLogEvent,
ExchangeEventArgs,
TransactionEncoder,
BalanceAndAllowance,
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
} from '@0xproject/contract-wrappers';
ExchangeEvents,
} from '@0xproject/abi-gen-wrappers';

export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher';

Expand Down
2 changes: 1 addition & 1 deletion packages/0x.js/typedoc-tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
"include": ["./src/**/*", "./test/**/*"]
"include": ["./src/**/*"]
}
11 changes: 11 additions & 0 deletions packages/abi-gen-wrappers/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"version": "1.0.0",
"changes": [
{
"pr": 1105,
"note": "Initial release"
}
]
}
]
73 changes: 73 additions & 0 deletions packages/abi-gen-wrappers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## @0xproject/abi-gen-wrappers

Low-level 0x smart contract wrappers generated using @0xproject/abi-gen. These
low-level wrappers are imported by other packages in the 0x monorepo and
application developers are not expected to import this package directly.

You may also be interested in the
[@0xproject/contract-wrappers](../contract-wrappers/README.md) package which
includes some higher-level features.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️


## Installation

```bash
yarn add @0xproject/abi-gen-wrappers
```

**Import**

```typescript
import * as wrappers from '@0xproject/abi-gen-wrappers';
```

or

```javascript
var wrappers = require('@0xproject/abi-gen-wrappers');
```

## Contributing

We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.

Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.

### Install dependencies

If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:

```bash
yarn config set workspaces-experimental true
```

Then install dependencies

```bash
yarn install
```

### Build

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

```bash
PKG=@0xproject/abi-gen-wrappers yarn build
```

### Clean

```bash
yarn clean
```

### Lint

```bash
yarn lint
```

### Run Tests

```bash
yarn test
```
41 changes: 41 additions & 0 deletions packages/abi-gen-wrappers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@0xproject/abi-gen-wrappers",
"version": "1.0.0",
"engines": {
"node": ">=6.12"
},
"description": "Low-level 0x smart contract wrappers generated using @0xproject/abi-gen",
"main": "lib/src/index.js",
"directories": {
"test": "test"
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "yarn generate_contract_wrappers",
"clean": "shx rm -rf lib wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
},
"config": {
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.12",
"shx": "^0.2.2"
},
"dependencies": {
"@0xproject/base-contract": "^3.0.1"
},
"publishConfig": {
"access": "public"
}
}
Loading